The following alerts 2 every time.  function timer() {     for (var i = 0; i &lt; 3; ++i) {         var j = i;         setTimeout(function () {             alert(j);         }, 1000);     } }  timer();   Shouldn't var j = i; set the j into the individual scope of the setTimeout?  Whereas if I do this:  function timer() {     for (var i = 0; i &lt; 3; ++i) {         (function (j) {             setTimeout(function () {                 alert(j);             }, 1000);         })(i);     } }  timer();   It alerts 0, 1, 2 like it should.  Is there something I am missing?
How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?  I have seen  given on Wikipedia, but unfortunately it did not help.
Create Yosemite install disk on a Windows machine I have a 2009 Mac with a new blank SSD. I have a Snow Leopard install disk but it doesn't work (it was a replacement installer disk and has never worked), so I don't have a working OS X install.  I do have a Windows 7 machine.  How should I go about installing Yosemite? All instructions I can find require OS X at some point in the process. I can't even download it from the store unless I'm on a mac. Let $\Omega$ be an open subset in $\mathbb{C}$. Let $\{f_n\}$ be a sequence of holomorphic functions on $\Omega$ such that $f_n\to f$ pointwise and converges uniformly on any compact subset $K\subseteq \Omega$. Then by Cauchy Theorem and Morera Theorem, $f$ is holomorphic. Let $f_n$ and $f'$ be the derivatives of $f_n$ and $f$ respectively. Prove that $f_n'\to f'$ uniformly on any compact subset $K\subseteq \Omega$.   How to prove? What is the function of the RNA primer in DNA replication? Prevent VLC from starting a new instance every time a media file is opened Last upgrade crashes network manager (no internet connection, no applet) While upgrading today, something caused my wireless network manager to disappear. Not even connecting via wired connection.  This error is being shown by files:  **(nm-applet:2716): WARNING **: Could not initialize NMClient /org/freedesktop/NetworkManager: The name org.freedesktop.NetworkManager was not provided by any .service files   (nm-applet:2716): nm-applet-WARNING **: Error connecting to ModemManager: Error calling StartServiceByName for org.freedesktop.ModemManager1: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ExecFailed: Cannot launch daemon, file not found or permissions invalid   (nm-applet:2716): nm-applet-WARNING **: Could not find ShellVersion property on org.gnome.Shell after 5 tries   (nm-applet:2716): nm-applet-WARNING **: Failed to register as an agent: (2) The name org.freedesktop.NetworkManager was not provided by any .service files    Is there a patch I can download through windows and send through to my ubuntu, or is it a case of having to reload everything? I tried running two versions back but still no internet access. Thought Experiment - Poking a stick across a Black Hole's Event Horizon I want to set an environment variable from the command prompt and then be able to access it globally (for instance, I should see it by going to System -> Environment Variables).    When I use the set command, it isn't accessible in a new cmd session.  set NEWVAR=SOMETHING echo %NEWVAR%   Related questions: how to concatenate string variables into a third? When water climbs up a piece of paper, where is the energy coming from? Take a glass of water and piece of toilet paper. If you keep the paper vertical, and touch the surface of the water with the tip of the paper, you can see the water being absorbed and climbing up the paper. This climbing up is intriguing me. Where is the energy coming from?  Supposedly, a lot of water molecules are moving up and gaining potential energy. This has to be balanced by something. I can think of a few possibilities, but I can't tell which one it is.   When the water molecules dilute into the paper, they are at a state of lower potential binding energy. Some molecular interaction (van der Waals?) is at lower energy when you have a water+paper solution, compared to a water-only solution. This compensates the gain in gravitational energy. The surface between the paper and the water is at lower pressure than the atmosphere. This causes the water to be pushed into the paper by the atmospheric pressure, up until the point that the column of water above the surface is heavy enough to counterbalance. The potential energy would be a result of work done by the atmosphere. Some water molecules climb up randomly and loose kinetic energy going up, and somehow get "stuck" up there. Something else? When should a verb be followed by a gerund instead of an infinitive? Some verbs are followed by ing, e.g. I enjoy swimming. We can't say I enjoy to swim. Likewise, some verbs are followed by to, e.g. I decided to make a plan.   Which particular verbs are followed by ing and to? Can you please provide a list for that?  Moreover, which verbs can be followed by both without having the meaning changed? Communities list is counting my reputation wrong on some sites I have 101 rep on  and am not suspended there. But the site switcher thinks I only have 1 rep there:     I noticed this after I .   To test this, I just added Expats and Reverse Engineering to my site switcher list. On both of those sites I have 101 rep and am not suspended. Results:    Huh? Bridge Rectifier Fails When AC Inputs are Shorted How can I have `date` output the time from a different timezone? I have a server running with the timezone set to UTC. It seemed like that was generally a good practice (please correct me if I'm wrong).  Anyhow, one of the servers I connect to, in order to scp files, is running on EDT and stores files that I need to copy in the format /path/to/filename/data20120913  I looked at trying to rsync files using something like find's -mtime -1 flag for files modified in the last day, but I didn't have any luck.  I don't mind just using scp to copy the current day's file, but as of right now there is a 4-hour window where running date +%Y%m%d will give a different day on each server and that bugs me a little.  Looking through man date I see that I can have the time output as UTC, but I don't see a way to have it output as another timezone like EDT  I suppose I could also use something like the GNU date extension date -d 20100909 +%s to get the date in seconds from the epoch, apply a manual 4 * 60 * 60 second calculation, and see about rendering that as a date - but then when daylight time kicks in it will still be an hour off.  Is there a simpler way to output the date in a YYYYMMDD format for EDT on a server that is set to UTC ? Deleting self-answered question gets "Delete this answered question" warning While attempting to delete a question which was answered by myself, and with no other answers, I got the following warning:     Delete this answered question?      We do not recommend deleting questions with answers because doing so   deprives future readers of this knowledge.      Repeated deletion of answered questions can result in your account   being blocked from asking. Are you sure you wish to delete?   I understand that deleting your question when someone else has answered it is effectively nullifying the effort that person put into that answer, which is bad. But is it bad if the only answer that's deleted along with your question is your own? Copy the contents of a file into the clipboard without displaying its contents How to copy the contents of a file in UNIX without displaying the file contents. I don't want to cat or vi to see the contents.  I want to copy them to clipboard so that I can paste it back on my windows notepad.  I can't copy the file from that server to another due to access restrictions. Dirac Delta or Dirac delta function? What it says on the tin, a foreign friend of mine has asked and I can't tell him; apart from it sounding horrible.  For example:  "Why is it raining today?"   Instead of:  "Why it is raining today?" I added two planes in Cycles with Image Texture in png with some transparency. I covered one by the other but transparency doesn't work, I mean it is impossible to see the one which is under despite transparency in the one which is above. What could be the problem? How to find and replace a string by increasing its numerical part? Are there concerns with doing a generalized additive model with a smoothing term of multiple variables? In R, usually one performs a generalized additive model like so:  library(mgcv) x &lt;- gam(depvar ~ s(indvar1) + s(indvar2) + parametricvar)   Say I want to explore the non-parametric interaction of indvar1 and indvar2.  Is the following kosher?  x &lt;- gam(depvar ~ s(indvar,indvar2) + parametricvar)