I wonder how async call works when looping through html elements with jquery. I know that async call doesn't stop iterating when server call is being made. That means, script is immediately iterating over next element in sequence, even if response from call is not yet finished.  My problem is, that on each call I have different values set, like this:  $(".businessUnit").each(function (index) {       var $element = $(this);       var iUCBU_KEY = $element.prop('data-iucbu_key');       var iENTE_KEY = $element.prop("data-iente_key");  $.ajax({       method: 'post',       url: '/CodeBase/LoadInsertCATETE_BASE1/',       data: {         iUCBU_KEY: iUCBU_KEY,         iENTE_KEY: iENTE_KEY       },       success: function (response) {         //will there be $element from sequence when call was made?           $element.find('input.price').val(response.price);        },       error: function (response) {        }     });       });   Which $element will be updated? Will it be $element from which call was made or $element in which iteration is currently? Response from server can take a few seconds, so iteration can go several elements further in between call - response.
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.
Use of quotes in GNU grep regular expressions How to test if my server is vulnerable to the ShellShock bug? How can I ensure my Bash installation is not vulnerable to the  bug anymore after the updates? I'm a little confused as to whether I should install Ubuntu on its own partition on my hard drive, use VirtualBox or another virtualization package to install it, or use Wubi to install it directly on top of my current OS (Win 7). I definitely want to learn and use Ubuntu, so this is not just for playing around with it.   Also, if I choose to partition, should I partition the hard drive myself or should I let the Ubuntu installation menu do it for me? I understand that I am going to need a main partition, for Ubuntu's core components, and also a swap partition. Then there is the option to add a partition for "home"- I don't understand what combination of these partitioning options I should choose, or whether it is better to partition in Windows before I install Ubuntu or just partition my hard drive when I install Ubuntu itself Linear Discriminant Analysis for $p=1$ I'm studying 'Introduction to Statistical Learning' by James, Witten, Hastie, Tibshirani.   In page 139, of their book, they began by introducing Bayes' Theorem $p_k(X)=P(Y=k|X=x) = \dfrac{\pi_kf_k(x)}{\sum_{l=1}^k \pi_l f_l(x)}$. $\pi$ is not mathematical constant, but denotes the prior probability. Nothing is strange in this equation.   The book claims that it wants to obtain an estimate for $f_k(x)$ that it can plug into the equation given above. To estimate $f_k(x)$, it assumes that is normal. In the one dimensional setting, $f_k(x)=\dfrac{1}{\sqrt{2\pi}\sigma}\exp(-\dfrac{1}{2\sigma^2}(x-\mu_k)^2)$, where $\mu_k$ and $\sigma^2_k$ are the mean and variance for the $k$th class. It is assumed that $\sigma^2_1 = \sigma^2_2 = \cdots = \sigma^2_K$. (I began to get confused from the last statement.)   Plugging $f_k$ into $p_x$, you have this quite messy equation (1) :   $$p_x(k)=\dfrac{\pi_k \frac{1}{\sqrt{2\pi}\sigma}\exp(-\frac{1}{2\sigma^2}(x-\mu_k)^2)}{\sum_{l=1}^K \pi_l \frac{1}{\sqrt{2\pi}\sigma}\exp(-\frac{1}{2\sigma^2}(x-\mu_l)^2)}. $$  Again, no surprises here since it is just substitution.     The Bayes' Classifier involves assigning an observation to the class for which equation (1) is the largest. Taking the log of Equation (1) and rearranging terms, it is not hard to show that this is equivalent to assigning the observation to the class for which the following is the largest:  $$\delta_k(x)=x \cdot \dfrac{\mu_k}{\sigma^2} - \dfrac{\mu_k^2}{2\sigma^2} + \log(\pi_k) $$  Question: I do not understand where this came from, and what it means. I tried doing the log of equation and it doesn't become this. Are we taking the derivative somewhere here, since this is the largest observation? Which parts are from Eminems real life? In "" we saw how Bunny Rabbit got into the rapping gang and won the heart of millions of rap lovers. Now in Eminem's original life too similar thing happened. We know how Dr. Dre helped him getting into an industry which is dominated by mainly black people in USA. In fact,  called the film semi-autobiographical. So I want to know which parts are direct picturisations of his real life? How to get Steam to recognize existing game files from a different source? Let's say I have a game bought on retail/other digital download and installed on my hard drive. I buy the same game (or a minor variant of it, say the GOTY edition) on Steam. It should be possible to use the existing installation to avoid the generally big downloads. This is very useful as it saves both bandwidth and time.   Previously, as far as I understood, Steam downloaded the game files directly to steam\steamapps\common\&lt;game_name&gt;. Since this folder would be created on starting the download, pausing and closing steam, copying the game files to this folder and then validating game files would make Steam absorb as much as possible and just download the missing files.  Currently, Steam downloads the files to steam\steamapps\downloading\&lt;game_id&gt; and then moves them over to the aforementioned folder once the download finishes. So first of all, what the final folder would be is not clear. So what would be the correct way of doing the same thing, that is, make steam use as much of the existing files as possible? Should the files be copied to downloading\*\, or should I figure out the actual folder (say via googling) and copy the files to steamapps\common\*\?  More specifically, I had a retail copy of Arkham City installed and I just bought the GOTY version on Steam. Now I tried both of the above things, in either case, the validating does not seem to do anything. Assuming I have the correct folder name steamapps\common\Batman Arkham City GOTY, according to , if I copy the files there, Steam seems to just continue with its 17GB download. If I copy it to steamapps\downloading\200260 then the download keeps stopping every few seconds with "Disk Write Error" after modifying 1 or 2 files, and I have to keep hitting resume. How to check who owns the Slack's workspace? I'd like to check who owns (or at least some kind of public profile page) some workspace based on its subdomain (e.g. xyz.slack.com).  Is it possible? How do I paste into the Windows CMD prompt by using only the keyboard? My current technique is to right-click in the command prompt and then click paste.  This bugs me - is there a better way? What is the most elegant way to solve this:   open a file for reading, but only if it is not already opened for writing open a file for writing, but only if it is not already opened for reading or writing   The built-in functions work like this  &gt;&gt;&gt; path = r"c:\scr.txt" &gt;&gt;&gt; file1 = open(path, "w") &gt;&gt;&gt; print file1 &lt;open file 'c:\scr.txt', mode 'w' at 0x019F88D8&gt; &gt;&gt;&gt; file2 = open(path, "w") &gt;&gt;&gt; print file2 &lt;open file 'c:\scr.txt', mode 'w' at 0x02332188&gt; &gt;&gt;&gt; file1.write("111") &gt;&gt;&gt; file2.write("222") &gt;&gt;&gt; file1.close()   scr.txt now contains '111'.  &gt;&gt;&gt; file2.close()   scr.txt was overwritten and now contains '222' (on Windows, Python 2.4).  The solution should work inside the same process (like in the example above) as well as when another process has opened the file. It is preferred, if a crashing program will not keep the lock open. This question was , but I think that the only answer didn't quite understand the question so I thought I'd try again. I'm writing a paper in which I need to have references show up in two places:  a special list of &quot;key references&quot; in its own section, and a bibliography containing the rest of the references that were cited in the text. I thought that bibentry would do it, so the document looks something like: \documentclass[11pt]{article} \usepackage{natbib} \usepackage{bibentry} \nobibliography*  \begin{document}  \section{Amazing idea}  Chicken chicken chicken \citep{chicken:2010fj}.  Chicken chicken, chicken \citep{turkey:2010jk}.  \section{Key References}  \begin{enumerate} \item \bibentry{lemur:2009ii} \item \bibentry{gibbon:2011jk} \end{enumerate}  \bibliographystyle{apalike} \bibliography{amazing.bib} \end{document}  Unfortunately, this doesn't quite do it, as the resulting document presents the lemur and gibbon bibentry references correctly in the &quot;Key References&quot; section, but also prints them in the bibliography at the end of the document.  Ideally, the only entries in the bibliography would be the chicken and turkey \citep references.  I'd like it to look like:  Key references  Lemur, L. (2009). Lemur, 12(4):1-7. Gibbon, G. (2011). Gibbon, 135:1002-1009.  References Chicken, C. (2010). Chicken. Chicken Press, Coop. Turkey, T. (2010). Turkey, 7(4):E231.  What it actually looks like:  Key references  Lemur, L. (2009). Lemur, 12(4):1-7. Gibbon, G. (2011). Gibbon, 135:1002-1009.  References Chicken, C. (2010). Chicken. Chicken Press, Coop. Gibbon, G. (2011). Gibbon, 135:1002-1009. Lemur, L. (2009). Lemur, 12(4):1-7. Turkey, T. (2010). Turkey, 7(4):E231.  Is there any way to achieve this with the current method, or is there some other (possibly easier!?) way to do this? Desktop shows a white or black background instead of wallpapers How to change default viewport shading in 2.8? Is it possible to change the default mesh color/shading in 2.8 to be more like 2.79? I'm finding it hard to see finer detail in 2.8. On the left is 2.8 and the right is 2.79 sample make file for creating more than one exe files with different directory Forced to Quit PhD although the hard and proved work When writing questions and answers here about the Harry Potter series, I often need a word for "someone who's not a Muggle". People often refer to "the wizarding world" as opposed to the Muggle word, so "wizard" would be one choice - but it seems slightly sexist to exclude witches in that way. On the other hand, "witch or wizard" is a bit cumbersome, much longer than the simple word "Muggle".  Is there a sensible word to use which is neither sexist nor cumbersome, that makes a good equivalent to "Muggle"? What would JK Rowling say to fill in a sentence such as this:     Muggles use technology, while [...] use magic. The tilde operator in Python Which equals operator (== vs ===) should be used in JavaScript comparisons? Why doesn't the "zig-zag" comb deformation retract onto a point, even though it's contractible? I am starting to read Hatcher's book on Algebraic Topology, and I am a little stuck with exercise 6(c) in Chapter $0$. Unfortunately a picture is involved so it doesn't quite make sense for me to repeat it here - but I'll do it anyways (maybe it helps)     Let $Z$ be the zigzag subspace of $Y$ homeomorphic to $\mathbb{R}$ indicated by the heavier line in the picture:       Show there is a deformation retraction in the weak sense of $Y$ onto $Z$, but no true deformation retraction."   Now the definition for deformation retraction and weak deformation retraction as as follows:  We say that $f: X \to X$ is a deformation retraction of a space $X$ onto a subspace $A \subset X$ if there exists a family of maps $f_t : X \to X$ with $t \in [0,1]$ such that $f_0 = \mathbb{1}$ (the identity) and $f_1 (X) = A$ and also $f_t$ restricts to the identity on $A$ for each $t$.   A weak deformation retraction is almost the same, only that we now relax the conditions $f_1(X) = A$ to $f_1 \subset A$ and, for each $t \in [0,1]$ we require that $f_t(A) \subset A$.  Hence, as far as I understand the question and the concepts involved, I need to show that basically no map can be constructed such that the bold zigzag - line stays put while the thin lines retract to the bold line over a finite time interval $0 \leq t \leq 1$. However, I should be able to show that I can pull the thin lines continously onto the thick line, provided I am allowed to move points on the zigzag line .. is that correct ?  Now, the problem is I can't see why I shouldn't be able to do the former, given that I could find a weak deformation retract. Any help would be great! Let's say a 10N cube (in air, on Earth) rests flat on a scale at the bottom of a tank of water, and the scale reads 8N, so there is 2N of buoyant force on the cube.  How does the buoyant force manifest itself on the cube?  I assume the force is normal to the surface of the scale, but if there isn't any water under the cube, how does the water push up on the cube? What is the difference between the following class methods?  Is it that one is static and the other is not?  class Test(object):   def method_one(self):     print "Called method_one"    def method_two():     print "Called method_two"  a_test = Test() a_test.method_one() a_test.method_two()