I have an index which shows a list of orders with a button that calls a function (to simplify i've reduced the function that button calls to just an alert), but also every minute an ajax function executes that searches for new orders and appends them on top, with the exact same code as the ones initially loaded. The button works perfectly in the elements that are loaded initially but doesn't work at all in the elements generated dynamically.  This is the index with one initial order inside, BEFORE newOrders runs for the first time. The button on that order functions properly  &lt;div id="content"&gt;   &lt;div id="pedido_4126" class="pedido"&gt;     &lt;h4&gt;Pedido 4126&lt;/h4&gt;     &lt;button id="btn4126"&gt;Alert&lt;/button&gt;     &lt;script&gt;      $("body").on("click","#btn4126",function(){       alert("Pedido 4126");     });     &lt;/script&gt;   &lt;/div&gt; &lt;/div&gt; &lt;script&gt;   function newOrders() {     var xhttp = new XMLHttpRequest();     xhttp.open("POST", "simplereq.php", true);     xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");     xhttp.onreadystatechange = function() {       if (this.readyState == 4 &amp;&amp; this.status == 200) {        var response = JSON.parse(this.responseText);        console.log(response);       var element = document.querySelector('#content');       var content = element.innerHTML;       ultimoid = response.ultimoid;       element.innerHTML = response.contenido + content;       }     };     xhttp.send("ultimoid="+encodeURIComponent(ultimoid));   }   setInterval(newOrders, 60000); &lt;/script&gt;   And this is the index when the function has executed once and appended a new order on top:  &lt;div id="content"&gt;   &lt;div id="pedido_4255" class="pedido"&gt;     &lt;h4&gt;Pedido 4255&lt;/h4&gt;     &lt;button id="btn4255"&gt;Alert&lt;/button&gt;     &lt;script&gt;      $("body").on("click","#btn4255",function(){       alert("Pedido 4255");     });     &lt;/script&gt;   &lt;/div&gt;   &lt;div id="pedido_4126" class="pedido"&gt;     &lt;h4&gt;Pedido 4126&lt;/h4&gt;     &lt;button id="btn4126"&gt;Alert&lt;/button&gt;     &lt;script&gt;      $("body").on("click","#btn4126",function(){       alert("Pedido 4126");     });     &lt;/script&gt;   &lt;/div&gt; &lt;/div&gt; &lt;script&gt;   function newOrders() {     var xhttp = new XMLHttpRequest();     xhttp.open("POST", "simplereq.php", true);     xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");     xhttp.onreadystatechange = function() {       if (this.readyState == 4 &amp;&amp; this.status == 200) {        var response = JSON.parse(this.responseText);        console.log(response);       var element = document.querySelector('#content');       var content = element.innerHTML;       ultimoid = response.ultimoid;       element.innerHTML = response.contenido + content;       }     };     xhttp.send("ultimoid="+encodeURIComponent(ultimoid));   }   setInterval(newOrders, 60000); &lt;/script&gt;   As you can see, the button and function are exactly the same, but the one on the new order brought by the ajax call, doesn't work, and the other one still works properly.  EDIT: I have seen the  on event binding to dynamically generated elements, and am in fact already applying what I saw in those answers, by binding the function to the descendants of a a static ancestor:   $("body").on("click","#btn4126",function(){       alert("Pedido 4126");     });
I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.
Understanding of the theorem that all norms are equivalent in finite dimensional vector spaces The following is a well-known result in functional analysis:     If the vector space $X$ is finite dimensional, all norms are equivalent.     Here is the standard proof in one textbook. First, pick a norm for $X$, say  $$\|x\|_1=\sum_{i=1}^n|\alpha_i|$$ where $x=\sum_{i=1}^n\alpha_ix_i$, and $(x_i)_{i=1}^n$ is a basis for $X$. Then show that every norm for $X$ is equivalent to $\|\cdot\|_1$, i.e.,  $$c\|x\|\leq\|x\|_1\leq C\|x\|.$$ For the first inequality, one can easily get $c$ by triangle inequality for the norm. For the second inequality, instead of constructing $C$, the  is applied to construct a contradiction.   The strategies for proving these two inequalities are so different. Here is my question,      Can one prove this theorem without Bolzano-Weierstrass theorem?   UPDATE:     Is the converse of the theorem true? In other words, if all norms for a vector space $X$ are equivalent, then can one conclude that $X$ is of finite dimension? Moment generating function of the natural sufficient statistics of Gamma distribution I have $X_1,X_2 ... X_n$ Gamma-distributed r.v with density:    First of all I showed, that Gamma distribution belongs to exponential family and can be represented in form     I found, that for Gamma distribution $B(\theta) = log(\theta)$ where $\theta$ is $\alpha/\beta$  Then we know, that moment generating function of the random variable $T(X)$ is given by $$M(t)=\exp\{B(\theta+t)-B(\theta)\}$$  Natural sufficient statistics for Gamma distribution is:    But I didn't understand what should I do next? Because Natural sufficient statistics is two dimensional it confuses me:  $M(T) = exp[log(\theta + T) - log(\theta)]$  and $T = [s,t]^\intercal$ Considering the following formulae:  (i) $1+2+3+..+n = n(n+1)/2$  (ii) $1\cdot2+2\cdot3+3\cdot4+...+n(n+1) = n(n+1)(n+2)/3$  (iii) $1\cdot2\cdot3+2\cdot3\cdot4+...+n(n+1)(n+2) = n(n+1)(n+2)(n+3)/4$  Find and prove a 'closed formula' for the sum  $1\cdot2\cdot3\cdot...\cdot k + 2\cdot3\cdot4\cdot...\cdot(k+1) + ... + n(n+1)(n+2)\cdot...\cdot (k+n-1)$  generalizing the formulae above.  I have attempted to 'put' the first 3 formulae together but I am getting nowhere and wondered where to even start to finding a closed formula. Split string on spaces in Java, except if between quotes (i.e. treat \"hello world\" as one token) If $\lim_{x\to\infty}(f(x)+f'(x))=L$ show that $\lim_{x\to\infty} f(x) = L$ and $\lim_{x\to\infty} f'(x) = 0$ Let $f:(0,\infty) \to R$ be differentiable. Suppose that $\lim_{x\to\infty}(f(x)+f'(x))=L$. Show that $\lim_{x\to\infty} f(x) = L$ and $\lim_{x\to\infty} f'(x) = 0$. (Hint: Write $f(x) = e^xf(x)/e^x$ and use l’Hopital’s Rule.)    My working for $\lim_{x\to\infty}f'(x)=0$:  For $\lim_{x\to\infty}f'(x) = 0$, I let $f(x) = e^xf(x)/e^x$ and applied quotient rule which then cancels off $e^{2x}$ and I'm left with $\lim_{x\to\infty}(f(x)+f'(x)-f(x))$. Can I then equate this with $\lim_{x\to\infty} \left(f(x)+f'(x)\right) - \lim_{x\to\infty}f(x)$ which then gives $L-L=0$? Is this step correct? Fibonacci proof question: $f_{n+1}f_{n-1}-f_n^2=(-1)^n$ When do I use "can" or "could"? When should I use can? When should I use could? What is right under what context? Show that any bounded linear functional on a normed linear space is continuous Show that any bounded linear functional on a normed linear space is continuous.   Can we say that it is uniformly continuous ?   Also, is it true, if we reverse the statement    any continuous  linear functional on a normed linear space is bounded ?? Let $a$ be an element of a group G. Prove that $a$ commutes with each of its conjugates in $G$ iff $a$ belongs to an abelian normal subgroup of $G$.   My Try:  I proved the backward direction. For forward one, given $g\in G, a(gag^{-1})=(gag^{-1})a$. I was trying to prove that $a\in Z(G)$. In order to prove that, I must show that $ag=ga$. But failed. Am I on the right track? Can anybody please give me a hint? I want to try it myself. What kind of "mathematical object" are limits? If a SHA256 hash with high entropy is then hashed with one made from low entropy, is the resulting hash higher/same/lower entropy? If one were to create a SHA256 hash using 256 coin flips converted to hex (which, as I understand it, is as "entro-phized" as one can capture in SHA256) then take that hash as a string, combine that with a hash of the word "cat" and hash the resulting 512 character string, would the resulting hash from that exercise be any less random than our "perfect" hash we began with?  My thinking is the final string would capture the same amount as the original randomness as what we started with because the "extra" entropy can not be captured and is lost. Is this the case and am I thinking about this correctly? Would hashing something with high entropy with something simpler ever cause a lower amount of randomness or does it only go up?  Thanks to anyone who can help explain this a little better. How to obtain a confidence interval for a percentile? I have a bunch of raw data values that are dollar amounts and I want to find a confidence interval for a percentile of that data.  Is there a formula for such a confidence interval? Last seen not updating when using Android app This isn't directly related to the app, but probably more on the APIs it's using. The last seen on the profile page doesn't seem to reflect that I'm actively using the Android app, or taking actions. I was able to vote on items and the last seen property on the profile page said I was last seen 50 minutes ago, when I was using a computer.  I'm assuming it won't count as a visit for the Enthusiast and Fantic badges either. I don't want someone angrily posting on Meta swearing they used the app for a day, yet they lost the consecutive days and has to prove it by showing they voted for something (we're probably far from this situation since it's alpha...) Everything was working fine for a long time. But suddenly the device is getting slower than usual (e.g. apps react slowly when starting an action -- like the RSS reader takes "ages" to open an article). Also, several apps start crashing: force-closes as well as unexpected restarts. Sometimes this even involves some automatic reboot of the device.  Is there anything I can do, besides doing a factory-reset? Preferably it should work on un-rooted devices.  Remark: not all described problems may occur together, so on one device e.g. there might be no automatic reboot involved. Question remains the same, nonetheless. Why is 'ping' unable to resolve a name when 'nslookup' works fine? On my Windows XP workstation, I can find the machine I want to connect to in DNS with nslookup:  nslookup wolfman Server: dns.company.com Address: 192.168.1.38  Name: wolfman.company.com Address: 192.168.1.178   But, when I try to connect to that machine, I get an error telling me that the machine can't be found (i.e., can't be looked up in DNS):  C:\&gt; ping wolfman Ping request could not find host wolfman. Please check the name and try again.   I am able to connect if I use the IP address directly:  C:\&gt; ping 192.168.1.178  Pinging 192.168.1.178 with 32 bytes of data:  Reply from 192.168.1.178: bytes=32 time=41ms TTL=126 Reply from 192.168.1.178: bytes=32 time=41ms TTL=126 Reply from 192.168.1.178: bytes=32 time=44ms TTL=126 Reply from 192.168.1.178: bytes=32 time=38ms TTL=126   I could work around this by adding an entry to my hosts file, but I would rather find out why this is happening.  The problem is transient, most of the day I can connect to the machine just fine.  How is this possible?  ETA: I left this out for brevity, but it was asked for:  C:\&gt; ping wolfman.company.com Ping request could not find host wolfman.company.com. Please check the name and try again.   ETA: Other applications get the same results.  I only tried ping to simplify.  telnet can't connect, Cygwin apps print a "unknown host wolfman" message.  Update: Using wireshark, I found that my workstation is not attempting a DNS lookup.  It's just reporting the "could not find host" error message. Set the QGIS display to show decimal degrees? Using QGIS 2.6.1 Brighton. I am trying to set the CRS for the project to display Decimal Degrees, where it is defaulting to Feet. I can change it in the Properties Dialog, but it does not change it, it is just staying on Feet. How do I change it?  Edit: this layer was imported from a shapefile where it was internally set to Feet. I was able to get the vendor to supply one with Decimal Degrees so my problem is gone. Still would love to know if there was a way to do it myself from within QGIS. I have a skyscraper building but I only want the glass in the texture to be glossy.  How would I accomplish this?    Ok, I have done a test and here are the results.  Here is the original:   here is an adjusted image Creating additional Virtual Host Ubuntu Server Is there any way of making a Minecraft server lower than the current version? So me and my friends manged to make a server in Minecraft for us to play on and we would like to add mods. But the mods we want to add are a few versions lower than the updated version. Is there any way of making a server with a lower version of Minecraft that people can still play on? Loopy integral $\int xe^x\sin(x)$