What's the significance of finding neon on lunar atmospehere? new explanation of moon light?

Question: Now that NASA's LADEE spacecraft has confirmed the presence of Neon in the moon's atmosphere could the official explanation of the moon's light end up being change from reflecting the sun's light to some sort of electromagnetic interaction with the neon caused by solar winds, or something like that?
Comment: I've never seen a moon this particular shade of red: http://www.neoncircus.com/images/hire_catalogue/full/hotel_neon_sign_263-F11-A.jpg
Comment: @WayfaringStranger your point being?
Comment: "Electromagnetic interaction" with neon would likely produce ionized neon, which is the red color you see in the sign, but not when looking at the moon.
Comment: @WayfaringStranger What about a blood moon?
Comment: Some lunar eclipses are redder than others due to increased scattering of light through earth's atmosphere when it's extra humid or dusty. https://en.wikipedia.org/wiki/Lunar_eclipse#Blood_moon I've seen them orange, I've seen them dark red, never any that looked like neon; except for the Photoshopped images on the internet.
Answer: The moon's "atmosphere" isn't much of an atmosphere, and is sometimes called an exosphere.  The particle density in the moon's atmosphere is low enough to be considered a very good vacuum for Earth experiments.
The discovery is mentioned in this article on phys.org, which specifically says

There's not enough neon to make the moon visibly glow because the moon's atmosphere is extremely tenuous, about 100 trillion times less dense than Earth's atmosphere at sea level.
...
The behavior of a dense atmosphere is driven by collisions between its atoms and molecules. However, the moon's atmosphere is technically referred to as an exosphere because it's so thin, its atoms rarely collide.

As far as the question "what's the importance" in your title, it seems mainly to be a confirmation of something that has been predicted for a while, as well as providing more data concerning exospheres: the most common type of "atmosphere" in the solar system.


Why is the Euclid's Fifth Axiom/Parallel Postulate unnatural?

Question: Why is the Euclid's Fifth Axiom/Parallel Postulate unnatural for many mathematicians such that they want to find a way to prove it from the other four axioms? Is there an example that show its unnaturalness?
Comment: Related: ["Why did the ancients hate the Parallel Postulate?"](http://math.stackexchange.com/q/802848/409).
Answer: The fifth axiom is interesting, in that he did not introduce it at the start of the book, but seemingly only added it after the 28th proposition, realising he would need it for the next one.
It is an interesting axiom for mathematicians, as it ONLY holds for Euclidean geometries.
Have a read about non-euclidean geometries:
http://en.wikipedia.org/wiki/Non-Euclidean_geometry
Answer: Mathematicians are always interested to know if the axioms of some system are or are not independent. So the desire to show that the fifth postulate is or not implied by the first four is as much about logical neatness as anything else.
Euclid's system was probably the first to come under such scrutiny. Whether or not the fifth axiom is different from others in some qualitative sense is subjective. I don't know of any mathematician in particular who has called it 'unnatural', do you?
That being said, such scrutiny was definitely worthwhile, because non-Euclidean geometries have turned out to be remarkably fruitful.


Role of potassium hydroxide in alkaline battery?

Question: Is the role of potassium hydroxide ($\ce{KOH}$) in an alkaline battery to provide hydroxide for the reaction with zinc? Would the battery cease to work if $\ce{KOH}$ was removed and only $\ce{OH-}$ from autoionization ($\pu{10^{-7} M}$) remained?
Answer: The role of $\ce{KOH}$ is to provide enough ions for redox reactions. Remember that redox reactions come in pairs, for every reduction there must be oxidation. If $\ce{Zn}$ reacts with $\ce{OH-}$ to form a hydroxide, what would be a counter-reaction?
A battery also needs to have certain ionic conductivities to be functional. Could you ever get enough $\ce{OH-}$ ions through autoionization?
Comment: Thanks. Yes I'm aware of the conductivity. The cathode reaction is MnO2 + H2O + 2e-.
Comment: I think the reason I asked is because potassium hydroxide is labeled as the electrolyte, whereas it is actually the anode reaction, its the oxidation of hydroxide that releases electrons. The anode reaction, the O that reacts with Zn comes from 2 OH- --> O + H2O + 2 e-.
Comment: The oxidation state of the zinc does not change. ZnO has 38 electrons, O has 8 and Zn(s) has 30, and the lewis structure of ZnO is analogous to Zn2+ (28 electrons) and O-2 (10 electrons), still 38 in total.
Comment: Or, the oxidation state of zinc does change. But the total number of electrons in it (ZnO) remains the same, zinc is actually releasing its electrons into the oxygen it bonds with. The source of the electrons released from the anode is the hydroxide ions.


How to have the same configuration for both root and user?

Question: Hello I just installed Debian and have only one user since it's my personal computer. I would like for all softwares, x, xfce, terminal, vim, shell to always have the same configuration without me having to to manually configure everything twice once from user and once from root. Is there a convenient way to have the same configuration for both accounts ?
Comment: You almost certainly shouldn't be running X, XFCE, terminal, etc... as root. For `vim` and a few others your question is perfectly valid, but once you reduce the scope of the question to software that you *should* be running as root, you may find that the problem of duplicated configurations is a lot less important than you feel that it is now.
Answer: From my point of view there are at least 3 ways to solve your question:

Do not use root account in the first place. Really. Configure just vim for root separately and that's it. sudo is your best friend. As a bonus you have improved logging of all your root activities and the whole command history in a single place. Can be combined with option 2.
Put all your configuration into ansible or something similar. Configure it to be deployed into /root and your user home dir. If you have to change something, just change in the configuration project and deploy. It will be deployed to all directories at once. As a bonus you have all the configuration in a single place, which can be easily extended to as many users as you want. If you put it to git or other VCS you can have a nice history of changes. lso it can be easily transferred to a brand new machine. Can be combined with option 1. That will be the best solution I believe.
I don't like this solution to be honest, though it's very simple. So still worth to mention. Make a cron job to copy all configuration from /root/ to your user's home (overwrite files and directories if exist). Do not configure it vice versa, as it would be extremely bad for your security (even if you're the only user of machine). Who knows what your browser is able to download?
Answer: That's easy: don't log in as root. You don't need configuration files in the root account because you shouldn't be running programs as root. (And the fact that you shouldn't be doing this explains why there's no convenient method of doing it.)
There are a few administration programs that it makes sense to run sometimes as root and sometimes as a user, e.g. a package management program such as aptitude. (This isn't necessary though: you can always launch aptitude directly and then use its "become root" command.) Just run these programs with sudo; under the Debian configuration, this preserves the HOME environment variable so e.g. sudo aptitude will lead to aptitude looking for its configuration in your home directory.
Comment: While this answer is good from broader POV, it doesn't answer the question. The user is clearly a beginner and this needs to be said, but we should tell how to do it anyway, imho. Once you understand what using root account means, you can start using it. I do and take precautions not to mess anything up, and it works. If I asked this question I'd expect answer, not just warning.
Comment: root escalation exploits are so easy that some OSes like Qubes don't even bother with making root and user separate as they rely on other means to make the system secure, so I don't know why everybody seem to make such a big deal of it
Comment: @ChiseledAbs because you're vulnerable in one way doesn't mean you should be in other. Moreover, it's not only the matter of security from exploits as it is from you; root can literally do everything, meaning that you can destroy your data unintentionally. There are lots of stories about beginners making dumb choices. Some of them were saved because of non-root accounts. That's why Gilles answer is good from broader POV. It brings some insight, although it doesn't explains why; I don't blame him though; these are the lessons you probably have to experience by yourself.
Comment: @MatthewRock I do answer the question: `sudo` preserves the home directory, so when you do need to use the root account, you get the same configuration.
Comment: @Gilles not the most direct way, but fair enough


Queueing model for web server

Question: Suppose i have a single web server machine on which clients send requests in form of poisson distribution and all the clients have different service times,now i am confused whether i will take this scenario as M/G/1 or M/M/1.
I am also confused with 2nd letter M ie in M/M/1 2nd letter M stands for random what does it mean? In case of web server clients have different service time can i say "the clients have random service times?
Plz explain
Answer: The standard notation of $A/B/C$ in queuing theory is as follows:
$A$ - The arrival process.
$B$ - The service process.
$C$ - The number of servers.
The most common assumption for both arrival and service is $M$ which stands for memoryless, i.e. exponential inter-arrival times (or exponential service times). $G$ Stands for a general unspecified distribution. Other common examples are $D$ for deterministic and $Er$ for Erlang.
So to answer your question, you need to specify if you assume exponential service times and then you have an $M/M/1$ system, or a general service distribution and then you have an $M/G/1$ system.
Note that it is very common to deal with $M/G/1$ because many of the steady-state results that appear in $M/M/1$ hold in the general case as well. This is not true if you change the arrival distribution ($G/M/1$ system). You can read up on the PASTA property if you are interested.

Queueing model for web server


How can a penalty charge notice result in adverse impact on one's credit score?

Question: If one totally neglects and disregards penalty charge notices and the ensuing proceedings etc can it result in adverse effect upon one's credit score?
Answer: united-kingdom
In the UK, if the "penalty charge" matter proceeds to a successful court judgment, which isn't settled by the judgment debtor, then the credit reference agencies will collect and report this judgment as adverse information about creditworthiness.
However, the mere non-payment of a "penalty charge" demand will not typically be reported to credit reference agencies or affect a credit score.
Comment: A Transport for London Penalty Charge Notice (e.g. for ignoring ULEZ) doesn't ultimately land in court for a CCJ. The Traffic Enforcement Centre issues a 'warrant of control' but, according to TfL, "this does not result in a County Court Judgement (CCJ) being registered against your name or address. In addition, it does not affect your credit rating in any way."
Answer: australia
The same way any unpaid debt does
The government can, and does, report overdue debts to credit reporting agencies and they report them along with any other unpaid debts you might have.
They government has an advantage over private creditors as they don't need to prove the debt in court and have access to more enforcement actions, like cancelling your licence and registration.
To be clear, the fine is not final while you are contesting it in court but once that is done, or your opportunity to do so has passed, the fine, and any additional enforcement costs, is a proven liquidated debt.

How can a penalty charge notice result in adverse impact on one’s credit score?


90s Novel Capitalizing On Jurassic Park

Question: This novel was clearly trying to pull from the goodwill Jurassic Park had generated.  It starts with a scientist or engineer who is building some sort of dinosaur (maybe hologram or virtual reality).  In the first chapter he is poisoned and imagines the dinosaurs are real as he starts to die.  A detective comes in. He is led around the company by a female employee. He ultimately determines the murder was an accident and the female employee asks if all his cases end so stupidly.  I read this in 94 or 95. It might be part of a series.
Comment: https://www.goodreads.com/book/show/10240235-the-dinosaur-feather is too late in time, and features an actual murder, but I figured I should mention it.
Comment: No, I definitely read it pre-1997 and post-1994. So it can't be later than '97.  Was part of a series featuring the investigator. The engineer working on the dinosaurs was killed by poison out in the bathroom soap. The janitor out it there to kill someone else, his rival in a live triangle.
Answer: Could it be: Night of the Carnotaurus ? It is part of Dinosaur Detective series and it came out in 1995.

When Fenton Rumplemayer's father goes to Hollywood for a week as a technical consultant on a dinosaur film, Fenton accompanies him and discovers strange mistakes and accidents plaguing the movie studio.
Comment: I agree, but that is what I found. The others all have dinosaur detectives - detectives which are dinosaurs! Damn you, Google.
Comment: Seems somewhat unlikely to me. Those books seem to have a kid protagonist and seem a bit softer in tone than people dying.
Comment: U don't think that is it. It was an adult book. I don't remember a child being involved, or illustrations. Thanks though!

90s Novel Capitalizing On Jurassic Park


Are there any limits on hunting?

Question: Does the game put in place any limits on hunting? Is it possible to out-hunt a region, either temporarily or permanently? Or do animals just keep spawning?
Comment: Not to my knowledge I've farmed a area with cougar spawns and they just kept respawning
Comment: Where do cougars spawn? I haven't seen any except in the homestead quest for Myriam.
Answer: TL;DR: NO
While it's not possible to hunt an animal to total extinction, it's possible to out hunt them temporary, a good example for this is the place with the 2 bears just below the entrance to the frontier from the homestead. There are only 2 bears that spawn there, (1 in the winter). And if you go there and hunt them both, there won't be any bears there until they re spawn, which means that you have to leave the area and wait, or fast travel to the entrance and go to them from there.
It doesn't happen with beavers, elk, deer, raccoons, hare, bobcats, foxes and wolfs, only to the animals with few specific spawning places, which are bears and cougars. They will disappear from their spawning place if you hunt them faster than they re spawn, but will return once you fast travel or go and wait for some time.
Answer: Nope, there is no limit on hunting. It is NOT possible to out-hunt a region.
Once you kill a few animals, more keep spawning.
Answer: I was harvesting beavers in a place near a fort. They respawned quickly and often. I skinned  324 of them and they kept respawning so I kept killing and skinning them. I would not get anymore credit for them after 324 animals. I don't know why. Maybe there is some kind of limit?
Comment: If that is true, then maybe you hit an inventory limit first? We have so much mostly useless crap there, it seems plausible that your total inventory has a fixed limit, not that you can't skin animals at some arbitrary number.

Are there any limits on hunting?


Split Payment supporting APIs

Question: I need a help in finding the best solution for a Payment Gateway.
I need to split the payment so that the payment can be divided between Seller, Website provider and the Payment Gateway provider. Also, it needs to customizable. Is there any payment Gateway that satisfies this scenario? Please share your thoughts.
Answer: Stripe offers the requested functionality.  You should explore the Stripe Connect option. It is a customizable solution, and Connect lets you handle complex money movements.  ZiftPay also allows for split payments, distributing vendor payouts, managing money flow, and it has powerful APIs. I think there are more solutions in the market that you could consider.

Split Payment supporting APIs


Mosfet and mosfet driver question

Question: I need to drive a single n channel mosfet. To do that, I choose LTC1154 Mosfet driver. The first question of mine, power of the driver is supplied by 4 lithium-ion battery cells. Normally, with time, cells are discharged. Does the given gate voltage by driver decrease or could it be constant? Second question of mine, as you can see in the picture, there is a typical appliction for MOSFET. However,it is said 2.7A maximum. I checked the MOSFET that are used continious drain current is 14A and I can not find any limitations for LTC1154 driver. Can you explain me please?
Thank you. link is the datsheet of the LTC1154
Comment: The 2.7A limit is set by the 0.036\$\Omega\$ resistor per the function of the DS pin. 100mV/0.036 = 2.7A.
Answer: 1) Assuming your 4 Lithium-Ion battery cells provide a nominal series voltage of 3.6V you're looking at 14.4V at the Vs pin, this means that as long as you don't allow the batteries to discharge below 3.0V, the voltage delivered to the  LTC1154 won't be below 12V.
The LT1154 uses a gate charge pump to drive the MOSFET gate to generate a much higher voltage than the input voltage. As long as your supply voltage is above approximately 10V, as you pointed out, the gate voltage is relatively constant at 18V due to the internal charge pump, even if the supply voltage itself is as high as 22V.

You must be aware that the circuit you show is in a high side configuration, so when selecting the MOSFET make sure the Vgs makes sense for the voltage you want to deliver to your load. In your application it may make more sense to use an NMOS in a low side configuration to drive your load. This gate driver however, can also be used in a low side configuration.
2) The 2.7A max in this application comes from the on chip programmable over-current sensing. As pointed out by the datasheet, the RC network in series with the drain-sense input is set to trip "based on the expected characteristics of the load after start-up", in the particular application you have shown, LT has determined this to be 2.7A by selecting Cd=0.1uF and Rd=200k.

The goal is to select Rd and Cd to provide an appropriate delay in the trip current, you can use the normalized graph they provide (shown above) to determine Rd and Cd, of course you must make sure that whatever trip point you set can be handled by the MOSFET.

Mosfet and mosfet driver question


'brew doctor' command not recognizing path changes

Question: When I run brew doctor, I get /user/bin occurs before /usr/local/bin  So I changed my /etc/paths and my ~/.MacOSX/environment.plist as this post said to do.  When I run brew doctor again, I still get the same error.  Any tips?  Thanks
Comment: I started a new shell and it worked.  Not sure why I had to so it would still be nice if someone could shed some light on that.  Thanks
Answer: If you change environment files, you have to tell the shell to manually read them to update the environment.  Closing the terminal and reopening is one way to do it, but a more efficient way is to use the source command.
Also, I would avoid editing any files that require sudo access, such as /etc/paths.  A safer way to edit your path would be to add the line
export PATH=/new/path/name/:$PATH

to the file ~/.profile (it may not exist on your computer) then run
$ source ~/.profile

to have your changes take effect.  By editing your ~/.profile instead of a system file such as /etc/paths you are safeguarding against user error.  If you need to reset to the default PATH settings at some point in the future, simply delete that line from ~/.profile.  However, you will have to manually change /etc/paths again to revert to default.  ~/.profile will automatically be sourced by Terminal.app when a new shell is opened if it exists, so you only need to do this once.
Comment: In the post i linked, the first comment recommends to change the /etc/paths file, that's why i did it.  Is his recommendation incorrect?
Comment: To say it's incorrect would be incorrect.  I'd say it depends on your philosophy of maintaining your system.  Personally, I like to keep all modifications (such as changing my PATH) in single file (i.e. ~/.profile) so that if I need, I can "instantly" return to the system default.  There also may be cases when a program assumes that the system path in /etc/paths is default and may break if it is not (this is not likely, but it could happen).  If you don't have an issue with messing with your system files, then I can't tell you that it is incorrect.  It's just that I wouldn't do it that way.
Answer: Whenever you change environment settings, you have to start a new shell to pick up those changes. This is by design, to ensure that changes you make won't impact existing shell sessions.
You will see this behaviour in most OSes.


Common origin of multi mesh character

Question: I want to set the origin/pivot point of a multi mesh character to the feet of the character. I tried making an empty object as the parent to all other objects (and armature) of the character and have this empty objects origin in (0,0,0), but when importing to Unity the charcters origin/pivot point is still in the center of the character... Any ideas/solutions?
Answer: Set the origin of your armature object.
Don't have unity to test atm, (not since I quit windows for ubuntu)  but IIRC the origin is the origin of the armature object.

2.8 example, cube is parented to armature as though it was body mesh
Select the armature in object mode, set the 3D cursor to where you wish the origin to be.  In image example it's simply cursor to origin ShiftC.  Select origin to 3D cursor from the set origin menu. (In 2.7x Object > Transform > Origin to 3D Cursor)
Now this is going to mess up the location of all children. In the case above I have selected the cube (it's the "body" of the armature for example sake) and clear the parent inverse to move it back. AltP Ckear Parent Inverse.
This however may depend on how the mesh objects were positioned as children to the armature. in which case selecting and translating is another option.
Also to move all meshes as well to have new origin as origin follow @FFeller's answer for meshes and clear parent inverse.
Hmmm, beginning to recall might actually be the root bone location. In which case, in bone edit mode, add a new bone at (0, 0, 0) and make it the parent bone of what is current root bone (probably hips)
Answer: Every mesh have an own origin. In Object mode set the cursor to 0,0,0 then select every mesh you want then click on Object>>Transform>>Origin to 3D cursor

The problem also can be in Unity.
Comment: Even with every separate mesh having the origin in (0,0,0) Unity seems to want to put the origin/pivot point in the center of the character

Common origin of multi mesh character


How do I permanently remove a default Powershell alias?

Question: For some unknown reason, the devs included "curl" as an alias for Invoke-WebRequest, even though it is not compatible with the proper implementation of curl, which means it gets in the way when I try to make a curl request. I can remove the alias using Remove-Item alias:curl, but next time I start Powershell, the alias has returned. Is there a way to remove it permanently without having to run a script every time I start?
Comment: just FYI:
I have issued same command `Remove-Item alias:curl` inside windows server 2019  and it's does not appear again even after restaring
Comment: @matsonkepson that worked.
Answer: Skip this step if you already have a Powershell profile:
New-Item $profile -force -itemtype file

Then edit your profile:
notepad $profile

Add the following line to it:
remove-item alias:curl

Save, close notepad and reload the profile with the command below or close and open Powershell to apply the profile:
. $profile

Comment: Thanks. I must say it's annoying that the powershell developers didn't think this through, forcing us to now have to work around the issue in this way.
Comment: The first step can always be skipped. I just did, and got a pop-up asking if I wanted to create the file.
Comment: I don't think it's meant to be a 1:1 replacement. Powershell focuses on an overarching use of a defined set of parameters and automatic parameter binding (which is really great once you get into it). Providing the curl alias is to show folks accustomed to *nix that there is a curl equivalent in Powershell.
Comment: FYI: For some aliases, you will need to append "-Force"
Comment: The "funny" thing is that even azure docs show curl commands to quickly test out thing. Real curl commands, not `Invoke-WebRequest` syntax...
Comment: For people who googled this and want to remove their individual aliases: If I remove the alias from $profile, close the session and open it, it should be blown away without using remove-item. Or instead of closing $profile, sourcing it.
Answer: I'd stick with using curl.exe instead of just curl. This approach doesn't rely on PowerShell running with particular profile (and PowerShell could be run with no profile at all using -NoProfile switch).
Comment: I could argue that in theory, powershell may eventually run on unix, where program files don't have a ".exe" extension. It makes absolutely no sense to unix people to have aliases enabled in *scripts*. I have to wonder whether that bad-design choice was deliberate to try to kill the opensource GNU software stack on windows. And why don't we at least have a "command" built-in to force the shell to look for a real program? Powershell really fails on the KISS principle.
Comment: @JohanBoulé No need for for conspiracy theories, it was just an oversight. PowerShell 6 already runs on Linux and the alias issues are partially fixed. See this links: [initialsession: remove curl and wget aliases](https://github.com/PowerShell/PowerShell/pull/1901), [Please remove **all** built-in aliases and put them in a module](https://github.com/PowerShell/PowerShell/issues/5870), [Provide a syntax to call native binaries when its name is aliased](https://github.com/PowerShell/PowerShell/issues/1975)
Comment: None of those PRs are merged. Just saying.
Answer: add Remove-Item alias:cur to powershell autorun script
above XP,2003:
%ALLUSERSPROFILE%\Documents\Msh\profile.msh
%ALLUSERSPROFILE%\Documents\Msh\Microsoft.Management.Automation.msh_profile.msh

XP,2003:
%USERPROFILE%\My Documents\msh\profile.msh
%USERPROFILE%\My Documents\msh\Microsoft.Management.Automation.msh_profile.msh

Answer:
Is there a way to remove it permanently without having to run a script every time I start?

Technically, no. However, you can utilize the built-in PowerShell Profiles, which runs a script every time you load up PowerShell, to do it for you. But, at least it's not manual.
This is (part) of what I added to my $profile.AllUsersAllHosts file. It is similar to megamorf's answer but slightly more expansive.
Remove-Item alias:curl
Set-Alias curl "${env:SystemRoot}\System32\curl.exe"
Set-Alias wcurl Invoke-WebRequest

You can do this with any of the 6 Powershell profile files, but I'm the only one who uses my desktop, and I see no harm in changing it up a little. If you're not, then go with a different one with a smaller scope. The default $Profile is CurrentUserCurrentHost, so that can't hurt, I'll do the rest of it with that in mind, just substitute the code for whichever one you're changing.
Open a PowerShell terminal, as an Administrator if you can, but I'm fairly certain that the default, CurrentUSerCurrentHost, does not require admin privileges.
Then run:
if (!(Test-Path -Path $profile.currentusercurrenthost)) {
  New-Item -ItemType File -Path $profile.currentusercurrenthost -Force
}

Then run notepad $profile.currentusercurrenthost
That will check to see if the file exists, if it does not, it will create the file. Then the second command will then open it with notepad.
Note: If you have VSCode or Notepad++ installed, you can open it with VSCode by typing code $profile.currentusercurrenthost instead of notepad. For notepad++ run the command Set-Alias npp "${Env:ProgramFiles}\Notepad++\notepad++.exe" to temporarily create an alias for Notepad++. That way, you can simply type npp $profile.currentusercurrenthost, and it'll open in notepad++. It's similar with other file editors. You can also add this to your profile as well if you'd like that to be permanent.
Then add the lines as you see fit, though this first one must be first.
Remove-Item alias:curl will simply remove the existing alias curl has for Invoke-WebRequest every time you open a powershell prompt.
Set-Alias curl "${env:SystemRoot}\System32\curl.exe" sets curl to be an alias for curl.exe which is the actual cURL. It's included in Windows 10 Build 17063 and later.
I also chose to add an alias for the original Invoke-WebRequest, calling it wcurl, with Set-Alias wcurl Invoke-WebRequest as there may be situations when I want to use it, and don't want to type out the long string there.
So, in order, that is:

Remove-Item alias:curl
Set-Alias curl "${env:SystemRoot}\System32\curl.exe"
Set-Alias wcurl Invoke-WebRequest
Set-Alias npp "${Env:ProgramFiles}\Notepad++\notepad++.exe"

Everything after #1 is optional, and the order after #1 does not matter, but #1 must be before #2, or any attempts to create an alias named curl.
If this is a brand new profile, it will be blank upon opening it, and you can add them (in order) if you want them or not. If it's not blank, I would recommend adding it towards the end, if not the end. Personally, my $Profile ends with
cls
pwsh -v

which clears the screen from the various operations it does upon boot, and shows the PowerShell version.
Answer: Just add this to your powershell profile:
notepad $profile

if(Test-Path -Path alias:curl) { Remove-Item alias:curl }

Windows Powershell has this default curl alias, but Powershell Core doesn't.
If you want your profile useable for both, you should add Test-Path before remove.


Why does reactive power bounce back and forth between a source and load, while active power does not?

Question: I am trying to understand the difference between active and reactive power. Reactive power is said to be "wasted" because it is constantly alternating between a source and load in AC power system. What is confusing to me is that, this isn't some ontologically distinct form of energy. These are still electrons oscillating in a circuit. Why does active power not also oscillate between source and load? I assume this oscillation is because the polarity is switching back and forth rapidly from the AC generator source, so there shouldn't be any special distinction to how the electrons respond?
Answer: Apply an alternating voltage to a capacitor.  The capacitor will charge with one polarity on the rising quarter-cycle, discharge on the following quarter-cycle, charge with the opposite polarity, and discharge again.  Assuming the capacitor is ideal, there is no energy lost in the capacitor; all the charge that went in at one voltage comes out at the same voltage.  This "sloshing" of energy back and forth is reactive power.
Now apply that same alternating voltage to a resistor.  The resistor will dissipate energy at V^2/R on both half-cycles.  All the energy that goes into the resistor is turned into heat that dissipates into the environment.  This is active power.
Reactive power isn't "wasted" per se, but it doesn't perform any useful work.  And while it is conserved for the most part, all the lines and devices (transformers etc) from the generating station to the point of use need to be sized to accommodate it.  There's also the extra losses incurred in resistive heating in the transmission chain that drive designers to power factor correct their devices to something closer to 1 (active power only).
Answer: The difference between pushing electrons through a resistive load, and pushing them through a capacitor/inductor is easier to understand when you consider what happens when you stop pushing, rather than as you push.
If, as you push, the force-times-distance energy you expend to move each individual charge is immediately removed from system by some environmental  "energy sink", then as soon as you stop pushing, the electrons stop moving. The energy you gave them is lost to that sink.
If however, as you push charges, the environment does not steal away the force-times-distance energy you expended when moving them, but rather causes the electrons to somehow "push back" like a spring pushes back as you deform it, then when you release or relax the potential difference that delivered energy to the charges, the charges can return that energy. Under the force of whatever "spring mechanism" that got "wound up" when you displaced them, those charges can now deliver the same force-times-distance energy back to the source, returning to their initial locations.
In the case of a capacitive load, the energy you give to charges by injecting them onto a plate, and ejecting equal charge from the opposite plate, results in an imbalance of charge on either side, manifesting an electric field. It is that electric field that now pushes the charges in a direction back from whence they came. Thus the energy delivered to the charges to get them into this situation in the first place is not leaked or lost to the environment, it is simply stored, ready to impart force-times-distance energy to whatever is connected across the capacitor some time later.
For inductors, the "wind up spring" energy storage mechanism is magnetic rather than electric, but the same principle applies. When the force that imparts energy to charges (to eventually become a magnetic field) is relaxed, the magnetic field begins to collapse and that same energy causes the charges to push, rather than be pushed. A better analogy is perhaps a moving mass with momentum, rather than a spring, but the important concept is that energy delivered to accelerate charges isn't lost, just stored in some manner.
Active loads do not "wind up" like this. You can turn an inductor into an active load by causing its magnetic field to make something metallic/magnetic nearby move, which is what happens in a motor. Instead of allowing the magnetic field's energy to return to the electrical source, you can drain it away by accelerating a mass instead.
Resistors are the exact opposite of springs, in this analogy. It's as if charges are being dragged across a surface with friction. Things get hot, and when the potential difference that pushes those charges is removed, there's no energy stored in such a way that can cause the charges to "spring" back.
This isn't just about "electrons oscillating", because you are right, that's essentially what's happening. However, movement alone is not sufficient to explain the energy exchanges and mutations that are going on. In addition to position and velocity, you must also consider the forces at work, and the distances that charges are travelling, and the coulombs of charge.
In the same way that mechanical systems have "springiness", so do electrical systems. Some elements are springs, some aren't. Some springs are more springy than others. It's all about springs. Reactive systems are springy, resistive systems are not.
Answer: To say reactive power is wasted is wrong.  Without it ac electric motors, generators or transformers do not work.
Actve power or real power (P in W) is something we get out of the circuit.  In a resistor, real power is given off as heat.  In an ac electric motor, real power produces torque to drive a load.
Current (red) and Voltage (blue) are in phase and multiplying the instantaneous values at every instance in time gives an instantaneous  power (green) that goes from 0 to \$P_{Max}\$, with source providing \$P_{Avg} = \frac {P_{Max}}{2}\$.  Positive average so power creates heat in a resistor.

With a pure inductor [or capacitor], the voltage and current waveforms are out of phase.  I lags \$V_S\$ by 90° [I leads \$V_S\$ by 90° for capacitor].  The inductor consumes power to form a magnetic field, but returns it to the source the next quarter cycle.  Similarily, the capacitor consumes power to form an electric field, but returns it to the source the next quarter cycle.
Current (red) lags Voltage (blue) by 90° and multiplying gives an instantaneous  power (green) that has a positive and negative component.  When both waveforms are positive, power is consumed.  When one is negative, power is returned.

\$P_{Avg}\$ is 0, so no real power.
But the source is providing power to the circuit.  This power is reactive power, inductive reactive power \$Q_L\$ in VAR [or capacitive reactive power \$Q_C\$ for capacitors].
Up to this point, you may wonder why I bring up capacitors.  Capacitors provide power factor correction for inductors, providing leading reactive power to meet needs of lagging reactive power.
If \$Q_C\$ = \$Q_L\$, then all power from source goes to resistor.  I is in phase \$V_S\$.  Essentially, the capacitor acts as a source for the inductor.  The collapsing electric field in capacitor forms a magnetic field in the inductor and vice versa.
Current (red) and Source Voltage (blue) are in phase.  \$V_C\$ (purple) is opposite in polarity to \$V_C\$ (brown) and cancel each other out.  All power (green) from source goes to resistor.

Graph source: Waveforms for Series AC Circuits
Referenced app allows you to explore different waveforms for different series circuits.


pontiac oil change before or after repairing the car

Question: I have to send my 2001 Pontiac Grand prix  to a mechanic to fix some stuff. What do u recommend to change the oil before or after that
Comment: What repairs are you having done?
Answer: If you are having engine work done (where it has to be torn down or taken apart) have the shop do the oil change in conjunction with the maintenance. I suggest this because they may get contaminants into the oil from the work, such as antifreeze or gasket residue. If it is just other maintenance being done, such as suspension work, it really doesn't make a difference. Get it done when it's most convenient for you, or have the shop do it for you while the other work is getting done. This is more of a preference thing than anything else. If you do have the shop do the work, ensure you give them specifications for oil and filter (brand) if this matters to you.
Answer: If they are going to take the engine apart, they're probably going to drain the oil. A good shop won't put the same oil back that they drained out unless it's obviously fresh and clean. With that in mind, it's better to wait until they've done their work before you change the oil. Or actually, it's better to give them your jug of oil and ask them to do it while they're busy. If they're really nice, they won't charge you.
I had this very issue last week. I changed my Subaru Forester's oil, sump washer and filter on Saturday, just to find out I had a blown head gasket, so I had to take the engine to the shop to have it inspected. This means they'll have to tear the engine apart and drain the oil anyway. Unless the oil is spotless and obviously brand new, they're going to throw it away and put in a fresh jug.
Answer: After the mechanic has fixed the stuff on the vehicle as you don't know how long it could be in there., you need to change oil every 10000 km or 6 months. So might as well keep it clean and make the full use of the six months.
Comment: Why do you mention European? The OP explained the type of car.
Comment: USA = Pontiac NZ = Holden, so you can see why I said it. Well if you read CAREFULLY I said after the mechanic has fixed the stuff on the vehicle as you don't know how long it could be in there. So its worth waiting it out.


What is the purpose of Attributes in C#?

Question:
What is the purpose of Attributes in C#?
How do I know which attribute have to use for particular functionality?
How can I add them dynamically in c#?
What are custom attributes ?
Answer:
Attributes are meant to add additional information about a class, function, etc. Compilers sometimes do special things when they see an attribute. Other attributes are looked at by libraries while the program is running.
Start by looking at the documentation for the functionality you want. It should list what attributes are necessary.
No. Attributes can only be applied before the code is compiled.
That is just an attribute you created yourself as opposed to one that came with .NET.
Answer: When you write your code you answer the "what?" question:

what to do? (methods)
what to store? (fields and properties)
what is what? (class hierarchies)

etc. Attributes  add another dimension to this question. They answer the "how?" question. And the reply to the "how?" question may be important for IDE,
[Browsable(false)]
public string NotImportantField { get; set; } // property which will not be displayed in VS

for the compiler
[ThreadStatic]
private static RequestContext context; // field which will be different for every thread

or for another code which analyzes yours via reflection.
[XmlIgnore]
public string NotSerializableField { get; set; } // property which will not be xml-serialized

you might want to define custom attributes, if your assemblies, classes, fields, methods, etc. will be analyzed or invoked via reflection (which is often the case for example with inversion of control containers and aspect-oriented programming). Such attribute might (and often are the only way to) instruct the invoker or analyzer to behave differently depending on such attribute presence or its properties.
About your first question, well, how we know which method to call for a particular result? One of the advantages of being a .NET developer is that everything is documented pretty thoroughly. :)
Answer: Attributes are used for a Declarative Programming Model.
Attributes don't force any functionality (unless out of the box). For out-of the box attributes read up the documentation on msdn. For your own attributes you need to write code on what do if a class/method etc. has an attribute.
I don't think attributes are added dynamically. They're read dynamically though. They are metadata so are added at compile-time. Check this: Can attributes be added dynamically in C#?
Custom attributes are those that you create and tag your classes with. To create an attribute you need to create a class (for the attribute) that inherits from System.Attribute. Check this: http://msdn.microsoft.com/en-us/library/sw480ze8.aspx
Answer: Attributes are used for meta-programming. meta-programming helps you achieve dynamism with your code at runtime. Say you have 10 props in your class and you want to read only some specific props for some reason, to do this you will apply some special attributes to those props and at runtime, via reflection you will ask to filter only those props with given special attributes and then perform your job on those props. This is just one example.
In our case, we have attribute driven validation framework. so if want a prop. to be not left empty before the object is saved into database, we will mark it as NotNullOrEmpty attribute and the base class will have a method Validate() which will be called before saving the object to the database. The Validate() method will filter obj. props. with Validatable attributes and  perform validation and throw exception in case validation is violated.
Comment: Great explanation and example, I just have such case right now, so thank you!
Answer: Attributes are used to provide meta data about your classes and methods, properties, and events inside your classes.
Some of the most common attributes are used to tell the Designer information about properties in classes, such as Browsable and Description. This meta-data is then used by the PropertyGrid. Other examples of attributes would be the Serializable or Obsolete attributes used during serialization or to mark code elements as obsolete.
You can add attributes to classes, properties, methods, and events by using the [AttributeName(parameter1,...)] syntax.
Custom attributes refer to attributes that derive from System.Attribute that are not standard attributes in the .NET framework.
Answer: Attributes are often used when setting different environment such as DEBUG, DEV, STAGING, PROD, Etc.
  [Conditional("DEBUG")]
        private void OutputDebugInfo()
        {
            WriteLine("***DEBUG MODE ***");
        }

Comment: This is true, but your example doesn't actually show how the attribute does anything. Perhaps a more complete example would be better.
Answer: Attributes are used when you want to specify certain kind of constrains to your programming statements:
Exapmple:
[StructLayout(LayoutKind::Sequential)]
value struct Point
{
public:
   int x;
   int y;
};

Above you are defining that the structure should be a sequential one.
Another example is:
 [DllImport("user32.dll",CallingConvention=CallingConvention::StdCall)]

Here you are specifying to import a dll using DLLImport by using attributes. I hope you are able to find out what is the purpose of attribute.
Now how to know which attributes to be used when and which functionality is the same as How you learnt Function, Delegate and Events ...by the course of time and using it. Also many people might have answered the same for you.
Answer: If you want a very usable example of where attributes can be useful, and how to do the reflection code to access them, check Enum ToString. Using that code, it becomes easy to bind a ComboBox to your enum to have typesafe choices, as well as pretty human-readable descriptions:
public static void ComboItemsFromEnum<EnumType>(ComboBox combobox) where EnumType : struct
{
    combobox.FormattingEnabled = true;
    foreach (object enumVal in System.Enum.GetValues(typeof(EnumType)))
    {
        combobox.Items.Add(enumVal);
    }
    combobox.Format += delegate(object sender, ListControlConvertEventArgs e)
    {
        e.Value = GetDescription<EnumType>(e.Value);
    };
}


PATH work with relative directories

Question: I'm trying to get a program to work that isn't in my distro's package manager.  It doesn't provide a makefile or sources, just binaries.  If I copy the whole folder to /usr/local and then add that to my PATH in .bashrc, I can execute the program but there are problems.  The program requires some local files from its directory, and they are stored as a relative path.  The program looks for the files in the directory I'm currently in, not the directory that the program itself is in.  Is there any way around this? Thanks.
Answer: If the program is really so unfriendly as to expect you to run it only from it's own directory then you may have to leave it in it's own directory (including sub folders) and create a script which is on your PATH. This script will change directories to the location of the program and run it. All will be well. Well... well enough. Something like:
#! /bin/sh -
cd /usr/local/crudesoftware &&
./theprogram

Answer: Many programs use environment variables that are unique to themselves.  For example, a program called foo might look for an environment variable called FOO_DIR or FOO_DATA_PATH (and it might use the current directory as a default if the variable isn't set).  I know you said that you don't have source, but do you have any documentation?  Maybe a sample .bashrc for using the program?
As a last resort, try
strings foo

(assuming that foo is the name of the program).  This lists all the "strings" in the binary file (see strings(1) for details).  This will produce a lot of output; much of it gibberish.  You should probably pipe it into a pager; e.g., more or less.  Look for lines that look like environment variable names –– i.e., all caps, possibly including underscores –– and try setting them to the directory where you installed the program.

PATH work with relative directories


How could i express changes in this image in English?

Question:
Am i right in saying that it's both sides became circular?
Comment: The ends of the lower one are rounded.
Comment: The corners are filleted
Answer: Both ends are rounded.
(Adjective)

1 : made round : flowing rather than jagged or angular

Both ends were rounded off.
(Verb)

1 : to trim or finish into curved or rounded form

Circular would be understood but is more for when the entire piece becomes a circle, for example if you started with a square and made it a circle.


Use of braiser for frying

Question: In our large commercial kitchen, which is seldom used, how long can we keep the oil in the large tilt braiser that is used for French fries and fried fish?
Can this oil then be disposed of in the floor grease trap?
Answer: Uh...NO!
While running some 'minor spillage' down the floor trap is not a big deal washing a large amount of oil down the drain would be BAD. As the oil cools it will form a solid clog that would be very difficult (and probably expensive) to clear.
(there is no information about where you are from, so this may or may not apply to you...)
[In the U.S.]
Local fire departments will allow for the disposal of waste petroleum products (like this or motor oil).
Most restaurants which do a serious amount of frying have oil disposal services that come by and collect used fryer oil.

Use of braiser for frying


When do two different matrices have the same eigenvalues and eigenvectors?

Question: What are the conditions on two different matrices having the same eigenvalues and eigenvectors?
Answer: You would have to avoid having a full basis of eigenvectors.  Thus some "generalized eigenvectors" would have to be present.
For example, the $2\times 2$ matrices:
$$ \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} \; , \; \begin{pmatrix} 0 & 2 \\ 0 & 0 \end{pmatrix} $$
have the same eigenvalue (zero) and the same eigenvector $[1\; 0]^T$ (or a nonzero multiple thereof).
Answer: If you mean "What does it mean for $A$ and $B$ both to have the same set of eigenvalues, occurring in each care with the same multiplicity", then the answer is that $A$ and $B$ are similar: $B=P^{-1}AP$ for some non-singular $P$.


USB Drive missing space, no unallocated space found in Device Manager

Question: I followed the link below to try and fix this issue but unfortuantly DiskPart, GParted or any other method has been unsuccessful. It's a 32GB flash drive and I'm seeing 1.8GB. Any ways of totally wiping and reformatting this to a stock flash drive?
16 GB USB flash drive capacity down to 938 MB
Comment: Is this a relatively new drive? What caused this? Have you ever successfully stored and retrieved 32GB data using the drive? I'm asking because it could very well be a fake that has reverted back to its original 2GB size.
Comment: It is a 32GB. I used it last week to install a bootable image. Something got messed up though & that's what I'm trying to fix.
Comment: What file system are you using? FAT16 max is 1.8-2gb and that is ALL it can handle.  Did you try FAT32 or NTFS?
Comment: Also related: [16 GB USB flash drive capacity down to 938 MB](//superuser.com/q/752874/354511), [Flash disk capacity turns from 32 GB to 4 MB](//superuser.com/q/937410/354511), [USB drive not showing full size](//superuser.com/q/88509/354511), [16 GB USB flash drive shows as 16 MB and is unusable](//superuser.com/q/50207/354511), [1 GB space left after formatting a 16 GB flash drive?](/q/339489/354511), [16 GB USB flash drive turned to 1 GB after writing an ISO image onto it](/q/759602/354511) and [Toshiba pen drive shows 4 MB instead of 8 GB; what could have happened to it?](/q/927680/354511)
Answer: I've encountered this problem several times. When Gparted, Diskpart, Disk Manager fails me (often times before) I use BootIce. I'm sure there are other alternatives but this is one of my many recommendations and I've found to be more convenient and portable than EaseUs, etc... mention in the link.
It's never been my "go to" program but it does offer more functions, control and user friendly interface than DiskPart and Disk Management. ie: more say over partitioning, specifically the "hidden" partition mentioned in the link, drive letters, etc... check it out, if it doesn't work, let me know.
Comment: I'm not to sure how to use this tool. I tried going through and re-formating and setting the partition table but its still showing a total of 1.9GB. Is there a tut. on this or anything?


Is there a difference in colloquial/juristic use of "Jugendlicher/Teenager/Schulkind" in German?

Question: Germany has a political scandal currently. A 40 year old politician had a sexual relationship with a 16 year old girl/woman. Jugendlicher, Teenager, Schulkind are afaik common terms in Germany with a juristic defintion. But are above terms clearly separated in daily usage/understanding, esp. in different regions (rural/urban/federal states)? Apart from relative age difference there seems to be a major debate mainly driven by different opinions/language when childhood ends (and therefore moral misbehaviour begins). Is Schulkind, containing the critical term Kind, at all widely used or more a rural term for very young school kids in elementary school?
Answer: From Wikipedia, about juristic definitions:

Nach deutschem Recht ist Jugendlicher, wer 14 (außer im Jugendarbeitsschutzgesetz, dort ab 15), aber noch nicht 18 Jahre alt ist. Im Kontext des Achten Buches Sozialgesetzbuch (SGB VIII), ist in Deutschland Jugendlicher, "wer 14, aber noch nicht 18 Jahre alt ist" (§ 7 Abs. 1 Nr. 2 SGB VIII). Ein Jugendlicher gehört zu den im SGB VIII definierten jungen Menschen, zu denen ebenfalls die jüngere Personengruppe der Kinder gehört (mit Ausnahmen, "wer noch nicht 14 Jahre alt ist") und die ältere Personengruppe der jungen Volljährigen ("wer 18, aber noch nicht 27 Jahre alt ist"). Heranwachsender ist nach dem Jugendgerichtsgesetz jede Person, die das 18. Lebensjahr, aber noch nicht das 21. Lebensjahr vollendet hat
[...]
mit Ausnahme der Bestimmungen zur Pflege und Erziehung der Kinder als Recht und Pflicht der Eltern (Kind in diesem Sinne ist, "wer noch nicht 18 Jahre alt ist") und zur Annahme als Kind (Kind in diesem Sinne sind "Personen, die das 18. Lebensjahr noch nicht vollendet haben"); Kinder gehören zu den im SGB VIII definierten jungen Menschen. Nach § 32 AufenthG gilt als minderjähriges Kind, wer das 16. Lebensjahr noch nicht vollendet hat (vgl. Kindernachzug).

In English:

Jugendlicher is at least 14, but not yet 18 years (with exceptions)
A Kind (regarding age only) is younger than 14 years
Junge Volljährige are at least 18, but not yet 27 years old
The preceding three groups together are called junge Menschen
Heranwachsender is at least 18, but not yet 21
A Kind is anyone below 18 when talking about parenting
A minderjähriges Kind is anyone below 16.
A Schulkind is defined as at least 6, but not yet 16

This Wikipedia article has a nice chart for the age groups.
There's of course the term Schulpflichtiger, which is someone that must go to school (i.e. did not yet finish the required nine years).

In everyday language, Teenager and Jugendlicher are used interchangeably (with Teenager not really limited to 10-19 (or rather 13-19, coming from the English term), typically starting later though). It depends on your age; older people may call anyone under thirty Jugendlicher ("diese Jugend!" / "die Jugend von heute!"). The term Kind is sometimes used for older Teenagers as well to emphasize an age difference. Schulkind roughly matches the juristic definition; Schüler might be a better (i.e. politically correct) word because it avoids the Kind and can be used for all ages. For elementary school, you may instead use Grundschüler.
Young people sometimes insist on being treated as adults; there is a blurry line between when you should call a girl a young woman, or a boy a young man, or say "Sie" to them. This may begin at about 16, and go up to the age of 20, and with this line, the terms to use move.
Comment: @Hauser: I'd say that the "Kinder" in _Kindergeld_ refers to Kind in the sense of blood relation, not in the sense of age.
Comment: whats about terms like **Kindergeld**?. Are there similar terms in german bureaucracy used non only for non under aged in specific context and falsifying the perception of people,  what defined age *Kind* relates to. @user unknown im not so handy with regex afaik you used this in another question to filter out words listed in a dictionary. What common expressions used for non under aged contain `*kind*`?
Comment: @Hendrik i know thats the meaning. The whole question to me here is more how juristic definitions are dissolved **unconsciously** in daily langugage usage due to this type of ambiguous expressions. Of course *kindergeld* refers to *your own kids* and not the age of a person. But imo this whole debate is partly driven by this unaware/unconscious & different use of *kind* for humans way older than 6-12, esp. in rural regions. I think *teenager* is much more common in urban regions.
Answer: Jugendlicher is a common, official and juristic term for young people not yet in the age of full criminal responsibility.
Teenager is adapted from the english term and refers to kids between the age of 13-19 ("teens").
Schulkinder are basically people going to school. Yes, it is basically more widely used for young kids going into their first few years in school.
Answer: Both Teenager and Jugendliche are fairly common in colloquial use. Jugendlicher seems to be getting a little less common and more old-fashioned, while Teenager is getting more common particularly among younger generations, but neither word would raise an eyebrow when referring to anyone between the ages of thirteen and twenty.
I've hardly ever heard anyone use the word "Schulkind" for a kid older than elementary school age, and never for anyone older than 7th grade or so.
Comment: What is 7th grade? 7te Klasse?
Comment: Yes, it means "7te Klasse". From what I have seen "7. Klasse" seems to be more commonly used than "7te Klasse" btw. "Siebente Klasse" is also common, as is "siebte Klasse", both spellings are correct.
Comment: Both "7. Klasse" and "siebte Klasse" are quite common, but I've hardly ever seen "siebente Klasse," although it's grammatically correct. Might be a regional difference? I'm Bavarian.
Answer: In the American usage, these terms would refer to different degrees of "minority" for the purposes of "age of consent" or "dating" eligibility.
"Kind" would refer to a child, someone up to the age of 12 of 13, (depending on the state), a "first degree" minor who is clearly not "dating" eligible.
Jugendlicher would refer to an older person, between 13-14 at the low end, and 16-17 at the upper end, or a "second degree" minor, who is more of an adolescent than a child, therefore "datable" by "nature," but not in the eyes of the law.
Teenager is a misleading term in this context. While it refers to ages 13-19, it spans all three categories; a 13-year old "Kind," a 14-17 year old "Jugendlicher," and an 18-19 year old of "full age" of consent.


Squid proxy user verification

Question: I want to setup squid on my home pc where many people uses the same pc. What can i do to verify users based on their account on the pc ?
Answer: You can setup authentication (of varying levels and complexity) in Squid to prompt for user/pass by the person browsing.  For such a small implementation, I'd maybe recommend using basic authentication, but your decision.
You can review the documentation here: https://wiki.squid-cache.org/Features/Authentication
But essentially, for Basic Authentication you'll need to install the apache2-utils package. Then follow this:
sudo touch /etc/squid/passwd
sudo chown proxy: /etc/squid/passwd
sudo htpasswd /etc/squid/passwd user1

Now we need to edit the squid.conf for authentication.  Towards the bottom and before you http_access allow none, you'll want this:
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Authentication for Squid Proxy
auth_param basic credentialsttl 6 hours
acl auth_users proxy_auth REQUIRED
http_access allow auth_users

Now restart squid and when you access the proxy you'll be prompted for user/pass.  There are helper applications that allow the user to modify their own password after the fact, but for a single instance, it probably isn't necessary.
Good luck

Squid proxy user verification


Why all problems are not in P complexity?

Question: İf Somebody wants to play perfect chess.I consider for finding solution to this problem,possible minimum data compression method which describes with 10 bit maximum possible data is in the range of 2^10.Then with some formula which can take input as next move in the chess,There should be some formula that can change all equations which are in the chess solving algorithm.Therefore ,if we assume in the chess.There should be 10^120 possible games.With approximately 400 bit with if conditions we can calculate all possible game's best strategy and with same thinking way all math problems can be solved with P complexity.Why there are differences with complexity classes?Short answer:İn karnaugh map some variation cannot be described shortly.
I understood my mistake vote to delete.
Comment: Your question is really hard to read, but I think you may not realize that there are time complexity and space complexity of algorithms. If you somehow manage that you algorithm uses only polynomial space, it does not mean that it will use polynomial time. The second thing you may be missing is that time complexity analysis is not done on a high level, where something might seem polynomial. About the if-statements that you mention: How many of them will there be?
Comment: İf there are 5 if statements which are nested and when first if statement decided other four if statenents are changed then if fourth if statement decided other three if statements are changed.
Comment: I am afraid that I am seeing this question as an intentional or unintentional attempt to puzzle people with fuzzy and gray logic. I cannot see OP's intention to clarify the question.
Answer: Chess is a fixed, finite problem. Because there's no input, you can solve it in a constant amount of time.
Computational complexity considers problems with inputs and looks at how the cost of the computation increases as the input gets longer. For example, you could generalize chess from an $8\times 8$ board to an arbitrary $n\times n$ board and ask how the time taken to compute which side can force checkmate varies as a function of $n$.  Certain versions of this problem (it depends on exactly what rules you take) have been proven to require an amount of time that is exponential in $n$, which implies that they can't be solved in only a polynomial amount of time.


How is Ethereum related to Bitcoin?

Question: Is Ethereum related to Bitcoin? Does any one know whether they are related or not?
Comment: https://ethereum.stackexchange.com/questions/45/how-would-i-explain-ethereum-to-a-non-technical-friend
Comment: I am voting to close this question because Ethereum is not related to Bitcoin whatsoever.
Answer: Bitcoin is a cryptocurrency. It runs on blockchain technology. Ethereum is another independent cryptocurrency that runs on blockchain technology as well.
Comment: Thats not true Ethereum is not a currency
Answer: Hardly related at all actually.
Bitcoin generally has a community which cares about decentralization in the form of the following: lots of full node runners, acceptable mean fee rates, upgrades through softforks and user facing consensus, slow and secure approach to what goes into the software.
Ethereum community generally is willing to sacrifice decentralization for what I would refer to as "shiny objects" like artificially fast block times (with really slow finality), fee bidding wars that increase profit for the large organizations responsible for approving blocks, censorship capabilities: https://www.mevwatch.info/ , "turing completeness" which basically just means you can use it for things you should not be able to and practically would not if you were sane, and creating tokens out of thin air with 0 effort involved. Not sure why they like these things but that is basically what Ethereum is. Source: Mined Ethereum since 2020 was not informed about "the merge" until halfway through, sold all my Ethereum promptly upon learning the truth about how centralized their operation is.
Note: During the entire ~2 years that I mined ETH I was forced to use a centralized rollup called polygon to even have a hope of avoiding fees, this means I was paid in an IOU version of ETH called wETH. Technically I did save fees but only because I trusted a random organization with all my profits in the form of daily IOUs, on a fundamental level that is incredibly insecure and a shame that they tell people it is. But the point is as a miner for 2 years I was not even able or willing to use the base layer as sending 1$ cost 4$ even today. Selling wETH daily to USDC and offloading to a CEX every week is the only reason I profited and I have 0 regret there.

How is Ethereum related to Bitcoin?


Do inverse/reverse sawtooth waves sound different to human ears than forward sawtooth waves?

Question:
Do the 2 sound waves in the picture (same frequency) sound different?
Comment: What do you notice when you play them?
Answer: This comes down to the question of audibiltiy of phase in a signal. To test this, I created two signals (both with f0 = 220.5 Hz, Fs = 44100 Hz) in Matlab, a saw wave with an upwards facing ramp and one with a downwards facing ramp:
<code>ramp_up = repmat(linspace(-1, 1, 200), 1, 440)';
ramp_dn = repmat(linspace(1, -1, 200), 1, 440)';
</code>
These are (excerpts of) the resulting signals:

You can listen to them here (careful, relatively loud):

Saw ramp up
Saw ramp down

There is no audible difference between the two. Let's now look at the magnitude and phase spectra of the signals:

We can see that the magnitude spectrum (top part of graphs) for both signals is identical, yet there are differences in the phase spectrum (bottom part of graphs). For these signals, the difference in phase seems to be inaudible. Note however that current science on this topic suggests that under lab conditions phase distortions can be audible. Further reading on the topic:

Audibility of Phase Distortion
Human Hearing - Phase Distortion Audibility
Sensitivity of Human Hearing to Changes in Phase Spectrum
Comment: The phase will make more difference in synthesis when mixed with other sounds, but yeah it's going to be less than audible alone.  Still an interesting subject itself.
Answer: They will sound exactly the same. The human ear responds to the frequency of the waveform - not the direction of the waveform itself.
Comment: They'll sound the same, but the frequency is a sine wave.  The waveform has a harmonic spectrum (really, the waveform itself can look vastly different for the same spectrum—reverse is just one odd possible alternative).
Answer: One curve is the negative of the other.  This is generally indistinguishable.  However, playing one curve on one ear and the other on the other will likely be distinguishable from playing the same on both ears.  I doubt that you could distinguish which of the curves (main part of the curve being pressure increase or pressure decrease) was which, though.  Just whether one ear got to hear the inverse of the other or not.
Comment: Just tested, I could not distinguish
Answer: I tested saw wave with different frequency with headphone, and the result is you can distinguish in frequency around 60Hz, it gave different pressure feeling pattern in your head when inverse the wave.
Also, it took time to the brain remember the feeling to compare with new sound input.
You'll need to focus to listen for a minute (and feel the vibration inside head too), then switch to other. And then play this sound few second and switch sound and play... it change a little and you can  distinguish it.
However, when change higher >60Hz or lower <60Hz, it gave the same feeling. And if you play the 60Hz on speaker, you won't able to distinguish it.
Tested on GoldWave: f(x) = (2ft%2-1)/2
f=60
When combining to stereo, one file have Left Right same, another file have Left Right mirror symmetric, you can distinguish it easily in any range frequency (must use headphone)
Same:

Mirror:


Head lamp identification

Question: Does anyone know from which car is this head lamp?
Comment: Not mine :)  Presumably you want to know the make and model.  I would have thought that there will be a manufacturers symbol/mark on it somewhere or even a part number.  That would help a lot.
Comment: Also, where are you in the world? Knowing if the general location is South Africa or Norway might make a difference in identifying what we're looking at.
Comment: Further photos from different angles could help
Answer: This looks like an inexpensive aftermarket knockoff. I don't see the ribbing in the housing I'd expect for an Original Equipment Manufacturer (OEM) product. The glue track doesn't include alignment cues I'd expect to see. I doubt this lamp seals well when it rains. I also don't understand the straight line cutoff at the right. Is that just a bandsaw cut? Its definitely not legal for USA market, no side markers, etc..Not sure which country allows that amber bulb without diffuser. I'm assuming that amber bulb is a parking lamp. My guess is Far East but not Japan; their lamp rules are insane.
I would like to see ALL the markings stamped and/or molded on the outside of the housing.  Part #'s, Spec #s, Cavity and molding #'s including the molded in date codes.  All of that information tells a whole lot... but in this case I'm guessing you won't find anything. And if so, that fact confirms it's an aftermarket knockoff.  Inexpensive lamp, not to code anywhere.
Another hint is the headlamp aim mechanism. Seeing that would tell us a whole lot.  Generally a manufacture picks a system, sticks with it and uses it EVERYWHERE.  If this lamp has no aim mechanism, that would clinch it as a VERY inexpensive aftermarket knockoff.
One more indicator.  All headlamps MUST include some sort of mechanism to allow the cavity to breath, but not include water.  Remember lamps get hot, and hot air expands.  I've seen designs that use Gortex patch, macaroni elbows, molded in air inlet channels.  Like the headlamp aim, most manufacturers tend to use the same system for that everywhere. How does this lamp allow air in and out?  On an aftermarket lamp you won't find a breathing system.  They just leak.

Head lamp identification


How to fix my email address on Careers 2.0

Question: I accidentally entered a 'wrong' email address when creating my Careers 2.0 profile. This is probably because I signed in using Google where I normally use OpenID for Stack Overflow. Now I cannot link to questions on Stack Overflow, and I cannot change my email address (the system tells me the address has been taken).
How do I link my Careers 2.0 profile to my other Stack Exchange sites accounts?
Answer: You should be all set, your account is now properly linking to your SE sites.
Comment: Thanks Korneel! I guess this means it is not something I could have fixed myself (other than thinking before signing up).
Comment: @Han Nope... it was a backend thing that can happen when someone uses different credentials for SO and Careers.


Are there any words that have changed usage/meaning multiple times (multiple semantic shifts) from 1850s to present time

Question: I am interested in semantic shift undergone by words, and I am aware of classic examples like 'gay', which has shifted in meaning since the 1900s. However, are there any words that have actually undergone multiple such changes from, say, 1850 to the present?
Comment: How big a change do you want? Every term in computer science and electronic technology -- to take only one example -- has been invented in the last century, largely by adding extra meanings or metaphoric extensions or abbreviations or slang usages of existing words. Most words are already polysemous, and they don't lose meanings just because they gain new ones in different contexts. Old meanings drift away when their contexts disappear; technology inevitably destroys linguistic habitat.
Comment: Just in English or across all languages? If the former then please add the `English` tag.
Comment: A few examples of popular words is sufficient. I just want to get a sense of these words.
Comment: There's a list of computer terms that are obvious metaphors in [this article](http://www.umich.edu/~jlawler/April05Eye.pdf): _editor, file, folder, spreadsheet, hacking, jump drive, slide show, the Net, the Web, surfing, spam, overflow, virus, worm, cut-and-paste, cyberspace, garbage, troll,_ and _wizard_. Those were just off the top of my head -- there's plenty more.
Answer: Some English words have undergone multiple semantic changes, but you might have trouble finding multiple changes within the restricted time from 1850 to the present.
Some Examples:

Silly:   from "happy" to "blessed" to "pious," to "innocent" (c.1200), to "harmless," to "pitiable" (late 13c.), "weak" (c.1300), to "feeble in mind, lacking in reason, foolish" (1570s). Further tendency toward "stunned, dazed as by a blow" (1886) to today's "frivolous".
Fanny:   from "a diminutive of Frances" (1700-1800's) to "female genitalia" (1879) to "buttocks" (since 1920's in America only).
Swell: from "a morbid swelling" (1200) "rise in sea" (1600) or " a rise music" (1803) to "wealthy, elegant person" (1786) to "good, excellent" (1897). Just for fun also see "An Unfinished Story" by O Henry (1906): "Well, ain't you the lucky one? Piggy's an awful swell; and he always takes a girl to swell places. He took Blanche up to the Hoffman House one evening, where they have swell music, and you see a lot of swells. You'll have a swell time, Dulcie."


point-and-click open source javascript equation editor for latex?

Question: Does anyone have experience with a good open source equation editor for online use?  I'm not interested in WYSIWYG (What are the Open source WYSIWYG Independent Web Equation Editors available on LaTeX/MathML), just a nice point-and-click solution for inputting things like <code>$\frac{}{}$</code> etc.
Comment: @LostBrit - I am indeed looking for something I can host myself.  The UI from the SciWeavers tool you pointed out is nice, but the tool isn't open source.
Comment: I'm not sure this question is on topic for the site, since our focus is on using the TeX family of applications, not the broader topic of applications that use TeX-like syntax.  However, if all you want to do is enter LaTeX math code and have it rendered, the MathJax site has a [demo page](http://www.mathjax.org/demos/).
Comment: Hi @MatthewLeingang - it's a question about how to enter syntactically-correct TeX into web browsers.  MathJaX is good for displaying the results of that process.  Unfortunately the demo site seems to be down at the moment so I can't check whether they have a nice editor there as well!
Comment: @JoeCorneli: give us something to work with? What are you trying to do here? You tell us you want to be able to input things like your `$\frac{}{}$`, but without knowing _why_, we can't help. Do you want  to produce graphics, covert to another language, or what? Are you looking to have something you can use to test equations? Ah, whatever, I'll try an answer.
Answer: If you really want point and click functionality that builds up your latex code for you, try http://www.sciweavers.org/free-online-latex-equation-editor.
Alternatively, if you want to type in the source yourself and see if it compiles, try something like http://www.writelatex.com.
Comment: The sciweavers thing is indeed a lot like what I have in mind, but it's not open source.
Comment: @JoeCorneli in that case, please see my comment to your original question. I definitely don't understand what you are looking for! Are you looking for something you can host yourself? Maybe you could answer that original comment and then people will have a better idea.


How to download a game twice with an apple ID?

Question: Could you pls inform me How I could download a game twice with my apple ID on my Iphone, since I deleted it by mistake and now I can not download it.
Comment: You can search for the game in the store again, click the little cloud in the appstore and it will download again. If not, please add a screenshot or describe the problem you are running into in more detail.
Comment: What exact words are shown next to the app in the App Store? What led you to conclude "I can not download it"?
Answer: Anything you buy on the App Store is able to be downloaded again as many times as you like, it's not like it used to be on iTunes where you downloaded it once, and then couldn't do it again if you lost the file.
To do this, just go back to the app store, and search for the app in question.  Instead of listing a price, or saying FREE etc, you should have a little icon showing a cloud and an arrow which you can tap to redownload.  Note, you can only download the latest version of the App, so it it has been updated since you last used it, then you cannot go back to an older version (unless you have a local backup of the file on your iTunes machine).  Also, you must be logged into the store using the same Apple ID that was used to make the original purchase.
The only way I know of that you cannot use this method, is if the app is no longer available on the App Store, in which case you can still get it, but you need to go through your purchase history to get to the download link instead of getting it from searching the store.
Answer: Instead of searching for the app, you could open the Purchased list and download it from there.
Comment: Damn the autocorrect.
Answer: You can reinstall purchased apps (and free apps just the same) using the App Store app.

On your device, navigate to the App Store Select the right-most
tab, Updates
At the top of this view is an area labeled
Purchases. Tap on it
This shows anything you have purchased on the Apple ID you are logged into (more on how to change that in a
second)
You can Search... for your app, or if you can't recall
the name, tap Not on this iPhone to look for apps that you own,
but are not installed on your device.
Once you've found it, there
should be a Cloud icon with a Down Arrow. Tap that and your
download will begin!

To change your Apple ID:

Head over to Settings ->iTunes and App Store -> AppleID:email@example.com -> Sign Out

See attached images for examples of navigating the App store.


Can't group by year from a date row

Question: I have a field of date-time type. I added this field into a view and formatted the date-time field to show only year. When I switch 'aggregation' on in Views and try to group this field it didn't work as i expect and show all the dates again. I saw the Vies-query and there wasn't any preformatting. It was grouping by dis field only. I want the modify the query to get this fields formatted as i need(years only). Any advices would be appreciated. Thanks in advance!
Answer: I don't think (I haven't seen your view) you need to enable aggregation to group by year. This is a solution:

If you need to display the date field value add the field twice. You will use one for the display of the date and the other for the grouping by year. If you are not going to display the date, you still need the date field to be able to group by year.
On the date field you are going to use to group by year you need a custom format that will only show you the year and if you are collecting both start and end date set it to you only the start date or the end date, but not both.
To create a custom date format go to admin/config/regional/date-time in Drupal 7 or to admin/settings/date-time in Drupal 6. There you will create a date format that will only show the year and then create a date format type that will show that date format.
Back to the date field you want to use to group by year change its format to the newly create format that only show you the date and set you show only one date and click apply. Also if you don't want the year value to show on the view check the option to exclude it.
Depending on the view format you have chosen (Table, Unformatted list, HTML list, etc) you will click the setting of the format and you are going to set the date field with the newly date format as the grouping field. Click apply and you are done.
You might also want to visit the "sort" section of your view to set the sort order of the dates.
Comment: Thanks for the answer but I need to use aggregation because i need the sum of a field after grouping the nodes by year :(. Anyway i tried your way but aggregation automatically adds group by to all fields(despite being excluded from display) and here comes my problem from the question again.
Answer: If you use aggregation in views you MUST remove all sort options or else it won't group.

Can't group by year from a date row


Is Huffman Encoding always optimal?

Question: The requirement of the encoding to be prefix free results in large trees due to the tree having to be complete. Is there a threshold where fixed-length non-encoded storage of data would be more efficient than encoding the data?
Comment: In general 'no'. For an average data, frequency of each character would be >1 and its good to use Huffman Encoding rather than fixed-length codes
Comment: @arunmoezhi Could you please address the example I have provided above? Frequency of each character is greater than 1, yet fixed-length is more optimal.
Comment: This example is interesting. But can you provide such a scenario with the probabilities of each character instead of frequency and make sure the probabilities of all characters add to 1
Comment: @arunmoezhi I have included the probabilities of the characters and they do add up to 1.
Comment: @arunmoezhi - doesn't in general no mean in theory yes? That there would be possible cases, for very small and mostly unique data inputs, where the fixed length encoding would be more efficient than Huffman encoded - say the English alphabet encoded in ASCII (26(8) bits) vs Huffman encoded, along with the tree to decode back to ascii (6(4)+20(5) bits for encoded data + at least 6(12) + 20(13) bits for the tree)
Answer: Huffman coding approximates the population distribution with powers of two probability. If the true distribution does consist of powers of two probability (and the input symbols are completely uncorrelated), Huffman coding is optimal. If not, you can do better with range encoding. It is however optimal among all encoding that assign specific sets of bits to specific symbols in the input.
Comment: There is a theoretical true distribution of message that could hypothetically be sent. Ideally, each message should be encoded in a way that is proportional to the log of its probability, but since Huffman codes are an integer number of bits, that implicitly corresponds to probabilities that are powers of two. Hence an approximation. Look up Shannons Coding Theorem.
Comment: What do you mean by "approximates the population distribution"?
Answer: Yes, it is always optimal.
No, there is no threshold where it would use less space to use fixed length non-encoded data.
I found a number of proofs on the Web, but there is sufficient discussion in the Wikipedia article Huffman coding.
This also covers other techniques which achieve higher compression (working outside the space for which the Huffman code is optimal).
Answer: The entropy H(A) for this problem is 1.998. Both Huffman coding and fixed length coding for this problem has avg codeword length as 2. And FYI the coding you have got using Huffman Encoding is wrong. Huffman Encoding also produces codes similar to fixed length for this problem. It uses greedy approach. So a doesn't get a code as 0 but instead it gets 00. Rework on the tree you generate using Huffman Coding. The tree you should get is:
Comment: You can refer to `Introduction to Algorithms` by `CLRS`. In the chapter that talks on `greedy algorithms` you can get the formal proof for `Huffman algorithm`. Its a lengthy proof and needs patience to read.
Comment: Thank You. Could you provide some kind of proof that Huffman Encoding is always more optimal than fixed length, or atleast refer me to one?

Is Huffman Encoding always optimal?


Rails routing and Rest : make resources alias

Question: I have make some custom naming in Rails and I am not sure if I am still RestFull, and the way I am doing this is ugly.
I have two models activity, and task that both have managements: activity_management and task_management. Notice that managements are two differents models, because model behaviour are very different in my case.
In Rails, I start doing the following :
shallow do
   resources :activity do
        resources :activity_management
   end
   resources :task do
        resources :task_management
   end
end

And give me these route structure :
CREATE /activity/:activity_id/activity_management
SHOW /activity_management/:id

CREATE /task/:task_id/task_management
SHOW /task_management/:id

But I find these routes very long and giving repetitive informations (CREATE give twice the information that we are talking about an activity).
So I change to this :
shallow do
   resources :activity do
        resources :management,
                  only: [:index, :new, :create],
                  controller: :task_management
   end
   scope :activity do
        resources :management,
                  only: [:show, :edit, :update, :destroy],
                  controller: :task_management
   end
   resources :activity do
        resources :management,
                  only: [:index, :new, :create],
                  controller: :activity_management
   end
   scope :activity do
        resources :management,
                  only: [:show, :edit, :update, :destroy],
                  controller: :activity_management
   end
end

That give me this route structure :
CREATE /activity/:activity_id/management
SHOW /activity/management/:id

CREATE /task/:task_id/management
SHOW /task/management/:id

When the code start to be complicated, it's that I am doing something wrong...
Do you see a simpler way to solve my problem ?
Comment: If I understand you correctly `activity_management` is a kind of backend to edit an activity and not an actual resource?
Comment: @max, no an `activity_management` is the resource that handle the people that manage an activity. For exemple, an activity is managed by 3 users, and 1 of them is sick, and remove his management.
Answer: You're correct. Your approach is not very RESTful or conventional.
If you need to separate parts of your application that are public facing and a dashboard or admin section backend you would normally set it up like so:
Rails.application.routes.draw do

  # public facing routes
  resources :activities, only: [:show, :index]
  resources :tasks, only: [:show, :index]

  namespace :management do
    resources :activities
    resources :tasks
  end
end

Note that you should be using the plural form for your routes and controllers!
This would create "public" routes at:
GET  /activities       ActivitiesController#index
GET  /activities/:id   ActivitiesController#show

And also namespaced routes:
GET|POST          /management/activities
GET|PATCH|DELETE  /management/activities/:id
GET               /management/activities/new
GET               /management/activities/:id/edit

These routes would go to Management::ActivitiesController. This lets you provide different "representations" of a resource while still sticking to the rails conventions.
Updated.
If you want to do resource scoped roles you would do it like so:
# routes rb
Rails.application.routes.draw do
  resources :roles, except: [:new, :create]

  [:articles, :tasks].each do |resource_name|
    resources resource_name do
      resources :roles, only: [:create, :index], module: resource_name.to_s
    end
  end
end

       Prefix Verb   URI Pattern                           Controller#Action
        roles GET    /roles(.:format)                      roles#index
    edit_role GET    /roles/:id/edit(.:format)             roles#edit
         role GET    /roles/:id(.:format)                  roles#show
              PATCH  /roles/:id(.:format)                  roles#update
              PUT    /roles/:id(.:format)                  roles#update
              DELETE /roles/:id(.:format)                  roles#destroy
article_roles GET    /articles/:article_id/roles(.:format) articles/roles#index
              POST   /articles/:article_id/roles(.:format) articles/roles#create
     articles GET    /articles(.:format)                   articles#index
              POST   /articles(.:format)                   articles#create
  new_article GET    /articles/new(.:format)               articles#new
 edit_article GET    /articles/:id/edit(.:format)          articles#edit
      article GET    /articles/:id(.:format)               articles#show
              PATCH  /articles/:id(.:format)               articles#update
              PUT    /articles/:id(.:format)               articles#update
              DELETE /articles/:id(.:format)               articles#destroy
   task_roles GET    /tasks/:task_id/roles(.:format)       tasks/roles#index
              POST   /tasks/:task_id/roles(.:format)       tasks/roles#create
        tasks GET    /tasks(.:format)                      tasks#index
              POST   /tasks(.:format)                      tasks#create
     new_task GET    /tasks/new(.:format)                  tasks#new
    edit_task GET    /tasks/:id/edit(.:format)             tasks#edit
         task GET    /tasks/:id(.:format)                  tasks#show
              PATCH  /tasks/:id(.:format)                  tasks#update
              PUT    /tasks/:id(.:format)                  tasks#update
              DELETE /tasks/:id(.:format)                  tasks#destroy

This means to add a manager for a task you would do:
POST tasks/1/roles
{
  name: "manager",
  user_id: 666
}

# - resource_id   [integer]
# - resource_type [string]
# - user_id       [integer, foreign key]
# - name          [string]
class Role < ActiveRecord::Base
  belongs_to :resource, polymorpic: true
  belings_to :user
end

class Article < ActiveRecord::Base
  has_many :roles, as: :resource
  # ...
end

class Task < ActiveRecord::Base
  has_many :roles, as: :resource
  # ...
end
class User < ActiveRecord::Base
  has_many :roles
end

 # do the normal index, delete, update here
class RolesController < ApplicationController
  # ...
end

# abstract controller class for reuse
class NestedRolesController < ApplicationController

  before_filter :set_resource

  def create
    @role = @resource.roles.create(role_params)
    respond_with(@role)
  end

  def role_params
    params.require(:role).permit(:user_id, :name)
  end
end

class Articles::RolesController < NestedRolesController
  def set_resource
    @resource = Article.find(params[:article_id])
  end
end

class Tasks::RolesController < NestedRolesController
  def set_resource
    @resource = Task.find(params[:task_id])
  end
end

Comment: If you want to re-use specific routes for different resources you would use routing concerns however I hardly think this is such a case.
Comment: Thanks, but it's not exactly what I am looking for. A management is a resource, because in our app, you can give a management-role to someone else, or just give it up. I want to CRUD a management for both a task and an activity.
Thanks for plural comment, I update my question.
Comment: Well actually, this resolve my problem. Just need to think a bit diferently. Thanks
Comment: Good, resource scoped roles is the general pattern for what it sounds like what you are trying to do. You might want to check out the Rolify library that provides all the model level components needed to make a good system that is resuable and hooks into your authorization.
Answer: How about something like:
['task','activity'].each do |manager|
  resources :activity do
    resources :management,
      only: [:index, :new, :create],
      controller: "#{manager}_management".to_sym
  end
  scope :activity do
    resources :management,
      only: [:show, :edit, :update, :destroy],
      controller: "#{manager}_management".to_sym
  end
end

Answer: In order to have two shallow resources with the same name. You can provide a shallow_path to differentiate them. You can also shorten your resource URL with path. Don't forget to add shallow: true on the nested resources.
scope shallow_path: "activity"
  resources :activity do
    resources :activity_management, path: 'management', shallow: true
  end
end

scope shallow_path: "task"
  resources :task do
    resources :task_management, path: 'management', shallow: true
  end
end

Comment: the output won't be this one, because the shallow, that will give `management/:id` for both `SHOW`. I need that they go to two different controller.
Comment: Adding ```path``` just changes the URL, it still maps it to the controller identified as the first parameter in ```resources```. Add a shallow prefix to fix the conflict.
Answer: This should get you the routes you're looking for (I think) with fairly little code, but the controller actions will all be namespaced as 'task_management/management#action' so you'd need to account for that:
resources :task do
  member do
    resources :management, module: 'task_management', shallow: true
  end
end

resources :activity do
  member do
    resources :management, module: 'activity_management', shallow: true
  end
end

You can alternatively list the matches explicitly, which is more verbose but will namespace the controller actions a little more cleanly:
resources :task do
  member do
    match '/management' => 'task_management#index', :via => :get
    match '/management/:id' => 'task_management#show', :via => :get
    match '/management' => 'task_management#create', :via => :post
    match '/management' => 'task_management#update', :via => :put
    match '/management' => 'task_management#delete', :via => :delete
  end
end


Speed of electric signal vs chemical diffusion

Question: I'm currently reading the book, "An Introduction to Nervous Systems" by Ralph J. Greenspan.
On page 20, there is a sentence that confused me. It was, "Electrical signaling has the advantage of being able to cover large distances very quickly, much more quickly than chemical diffusion". It is in the context of the primitive signaling mechanism in Paramecium.
My doubt was, isn't the electrical signal caused by the movement of ions? Then how is it any different from chemical diffusion? And again, it's not a electrical signal that travels, but a changing potential, right? Then how does it move at a faster pace than diffusion?
Answer: Membrane potential is a directed force, while diffusion is a random walk
Your confusion is entirely justified, as you're correct that both diffusion and depolarization rely on the speed of ion travel. Where they differ is that depolarization is a directed force, occuring only in one direction along the membrane, whereas diffusion is subject to the stochastic walk of ions in water.
When membranes depolarize, the whole membrane begins with a certain amount of "pressure" built up behind it. As the signal propagates, a small area of this pressure is released at a time and triggers the next section to trip. That next section is essentially identical to the previous one, with the same amount of pressure behind it initially. In this way, you can imagine membranes "conserving" the initial concentration, so that the signal strength isn't dependent on the distance from the signal itself.
Diffusion, on the other hand, is stronger initially and decays over distance because of its stochastic nature. It's a probabilistic force, and so depends in general on something like the square root of the distance. If you imagine a thousand ions taking a step forward in one moment, in the next it's equally likely that five hundred take a step backward even as an equal amount moves forward. So the signal degrades over time and distance from the source.
If that was confusing, the following metaphor may help. Depolarization acts like a line of dominos, while diffusion acts like a complex dance. Check out this video of the largest human mattress dominos: the speed they're falling over is pretty constant when they're not turning. Compare that to two dancing humans who are equally likely to move forward and backward, and hopefully you can see that the mattress dominos is the faster way to go, even though each one is theoretically limited by how fast a human could move.
Answer: Electrons are >100,000 times lighter than the atom nucleus. For chemical diffusion the entire atom moves, it moves >100,000 times times slower.
Molecular diffusion moves at ~500m/s
Electron signals move at ~50,000,000, m/s
In saline, electrons move at 10% speed of light.
In silver, they move at 95% speed of light.
Crowds of electrons drift very slowly, ~1mm per second. It's called electron "drift". Individuals orbiting and free electrons move at nearly the speed of light.
Conductive materials have free electrons that hop between atoms. If you introduce extra electrons at one end of the conductor, it will push free electrons at the speed of light from one atom to another, while the electron drift stays very slow.
Saltatory conduction travels at 10% the speed of light. Like Dubukay sais, the electrons travel like dominos. The dominos don't travel far/fast but the signal does.
Electrical signals are like a sound pressure wave, where the medium/the atoms stays nearly in the same place, but the electron excess propagates very fast with a wave-front, on a conductive line. only a very small number of electrons move, and they don't move very far at all, i.e. one micron each. The electrons travel like a sound pressure wave. The electrons hardly move but the pressure imbalance moves fast. for chemical diffusion I imagine two colors of paint mixing, atoms travel all through the medium, used by the brain to breach micron distances.