I have a question. I've been coding a jQuery event where the  button with an ID of add is ticked and is updated to an input  Here is the jQuery code   /* Change the Add button to an Input element*/ $("#add").click(function(){     $(this).replaceWith("&lt;input type='text' placeholder='Task'&gt;");     $("div.tasks&gt;span").remove(); });  /* Adding a value to the list */ $("input").keydown(function(e){     if(e.keyCode == 13){         var item = $(this).val();          $(this).parent().prepend("&lt;li&gt;" + item + "&lt;/li&gt;");         $(this).val("");     } });   Here is the HTML:  &lt;header class="content-header"&gt;     &lt;img src="img/icon.png" alt="icon" class="header-icon"&gt;     &lt;h1&gt;Monday&lt;/h1&gt;     &lt;img src="img/icon.png" alt="icon" class="header-icon flipped"&gt;      &lt;!-- &lt;p&gt;6 &lt;span&gt;Tasks&lt;/span&gt;&lt;/p&gt;--&gt; &lt;/header&gt; &lt;div class="tasks"&gt;      &lt;hr&gt;     &lt;button id="add"&gt;&lt;/button&gt;     &lt;span&gt; Add task&lt;/span&gt;     &lt;input type="text"&gt; &lt;/div&gt;   Whats supposed to happen here is once the Button has been ticked it will now turn to an input element.   And once the input element has been populated with data and keycode==13 is pressed (Enter). The value placed on the input element will now be added to the DOM within a li element.
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.
My intent is to show that a composition of bijections is also a bijection by showing the existence of an inverse.  But my approach requires the associativity of function composition.  Let $f:  X \rightarrow Y, g:  Y \rightarrow Z, h:  Z \rightarrow W$ be functions.  $((f \circ g) \circ h)(x) = h((f \circ g)(x)) = h(g(f(x)))$, and $(f \circ (g \circ h))(x) = (g \circ h)(f(x)) = h(g(f(x)))$.  However, I am having problems in justifying that the two compositions, $(f \circ g) \circ h$ and $f \circ (g \circ h)$, have the same domain and range.  When I consulted ProofWiki, whose link is at the bottom, I got even more confused.  Specifically, for $(f \circ g) \circ h = f \circ (g \circ h)$ to be defined, ProofWiki requires that dom$g =$ codom$f$ and dom$h =$ codom$g$.  First of all, I think that it should be dom$g =$ range$f$ ....  Moreover, as you can see in the example below, you actually have to adjust domains and ranges of $f, g, h$ for the requirement to hold true.  Let $f: \mathbb R \rightarrow \mathbb R$ be $f(x) = 2x$, $g: \mathbb R^+ \rightarrow \mathbb R$ be $g(y) = ln(y)$, $h: \mathbb R \rightarrow \mathbb R$ be $h(z) = z - 10$.   Then $((f \circ g) \circ h)(x) = ln(2x) - 10 = (f \circ (g \circ h))(x)$, with dom$((f \circ g) \circ h) = \mathbb R^+$ = dom$(f \circ (g \circ h))$.  As a result, we need to set dom$f = \mathbb R^+$, range$f = \mathbb R^+$; dom$g$, range$g$, dom$h$, and range$h$ remain the same.  Am I allowed to do that?  This adjustment implies that when we say dom$f = X$, $f$ must be defined for all elements in $X$, but $X$ may not be the entire set of elements for which $f$ is defined. Proving $1-\exp(-4x^2/ \pi) \ge \text{erf}(x)^2$ How can I set custom key bindings and key macros on Mac OS X? I recently upgraded to Snow Leopard, from Leopard and I was using an awesome app called  that let you remap your keys, set scripts/macros and even had repeat functionality.   However, this app doesn't seem to be in active development anymore, and 10.6 broke the ability to bind certain modifier keys (Shift) with other keys.   I totally miss things like Shift+Insert for paste (Linux/Windows), setting Ctrl+Shift+Esc for Activity Monitor, and Ctrl+Alt+Del for the login window.   So, how can I achieve this instead? We can say ‘fried fish’, ‘baked potato’ or ‘minced pork’ using past participles for modifiers.  However, ‘roast’ is different - either ‘roast duck’ or ‘roasted duck’ works, it seems to me.  How should we analyze this?  Is ‘roast’ a noun modifying a noun here, or is it a different form of the past participle?  (According to freedictionary.com, in Middle English the past participle was ‘roste’ – does that mean that this was once a strong verb?) List of Stored Procedure from Table I have a huge database with 100's of tables and stored procedures. Using SQL Server 2005, how can I get a list of stored procedures that are doing an insert or update operation on a given table. Why is there no absolute maximum temperature? If temperature makes particles vibrate faster, and movement is limited by the speed of light, then I would assume that temperature must be limited as well. Why is there no limit? I have been taught to use the if I had form in conditional clauses referring to the past:     If the president had asked me, I would have told him the same thing.   As far as I can tell though, the would have construct is sometimes used in conditional clauses as well, so it wouldn't be incorrect to say:     If the president would have asked me, I would have told him the same thing.   What is the difference between the two and the proper use of the latter? Dimension of cone of projective variety How do I translate strings in Twig templates? I am working on a (my first) Drupal 8 project witch is a multilingual site. Drupal 8 really delivers in terms of native support for content translation.  However, I have a few strings set directly in some if the theme .Twig template files printed out like ex.   {{ 'Read more'|trans }}   I am really stuck on where to handle the translation for strings like these within the Drupal 8 installation.  What steps do I need to take to be able to translate these strings into the language currently selected for on the site? Do I need any additional modules other than the ones included in Drupal 8 core?  Steps I have taken:   Activated the Content Translation &amp; Interface Translation modules Added Twig strings like {{ 'Read more'|trans }} Flushed cache and refreshed pages containing the strings Checked admin/config/regional/translate for the strings with no result How can I assign different random values to each row in a SELECT statement? Please look at this code:  create table #t1(   id int identity (1,1),   val varchar(10) );   insert into #t1 values ('a'); insert into #t1 values ('b'); insert into #t1 values ('c'); insert into #t1 values ('d');   Now, whenever you execute this  select *,      ( select top 1 val from #t1 order by NEWID()) rnd  from #t1 order by 1;   you will get a result with where all rows have the same random value. e.g.  id          val        rnd ----------- ---------- ---------- 1           a          b 2           b          b 3           c          b 4           d          b   I know a way using a cursor to loop throw the rows and get different random values, but that is not performant.   A clever solution to this is   select t1.id, t1.val, t2.val from #t1 t1     join (select *, ROW_NUMBER() over( order by NEWID()) lfd from #t1) as t2 on  t1.id = t2.lfd    But I simplified the query. The real query looks more like  select *,      ( select top 1 val from t2 where t2.x &lt;&gt; t1.y order by NEWID()) rnd  from t1 order by 1;   and the simple solution doesn't fit. I'm looking for a way to force repeated evaluation of  ( select top 1 val from #t1 order by NEWID()) rnd    without the use of cursors.  Edit: Wanted output:  perhaps 1 call  id          val        rnd ----------- ---------- ---------- 1           a          c 2           b          c 3           c          b 4           d          a   and a second call  id          val        rnd ----------- ---------- ---------- 1           a          a 2           b          d 3           c          d 4           d          b   The value for each row just should be a random value independent from the other rows  Here is the cursor version of the code:  CREATE TABLE #res ( id INT, val VARCHAR(10), rnd VARCHAR(10));  DECLARE @id INT DECLARE @val VARCHAR(10) DECLARE c CURSOR FOR SELECT id, val FROM #t1 OPEN c FETCH NEXT FROM c INTO @id, @val WHILE @@FETCH_STATUS = 0 BEGIN     INSERT INTO #res     SELECT @id, @val, ( SELECT TOP 1 val FROM #t1 ORDER BY NEWID()) rnd      FETCH NEXT FROM c INTO @id, @val END CLOSE c DEALLOCATE c  SELECT * FROM #res For example, the square can be described with the equation $|x| + |y| = 1$. So is there a general equation that can describe a regular polygon (in the 2D Cartesian plane?), given the number of sides required?  Using the Wolfram Alpha site, this input gave an almost-square: PolarPlot(0.75 + ArcSin(Sin(2x+Pi/2))/(Sin(2x+Pi/2)*(Pi/4))) (x from 0 to 2Pi)  This input gave an almost-octagon: PolarPlot(0.75 + ArcSin(Sin(4x+Pi/2))/(Sin(4x+Pi/2)*Pi^2)) (x from 0 to 2Pi)  The idea is that as the number of sides in a regular polygon goes to infinity, the regular polygon approaches a circle. Since a circle can be described by an equation, can a regular polygon be described by one too? For our purposes, this is a regular convex polygon (triangle, square, pentagon, hexagon and so on).  It can be assumed that the centre of the regular polygon is at the origin $(0,0)$, and the radius is $1$ unit.  If there's no such equation, can the non-existence be proven? If there are equations, but only for certain polygons (for example, only for $n &lt; 7$ or something), can those equations be provided? Probability that 2 appears at an earlier position than any other even number in a permutation of 1-20 Suppose we uniformly and randomly select a permutation from the 20! Permutations of 1,2,3,...,20. What is the probability that 2 appears at an earlier position than any other even number in the selected permutation?  My approach :   2 in first position ==> 1*19! (1 is the position of 2)  2 in second position ==> 10 *1 *18!  2 in third position ==> 10*9 *1 *17!  . . .  2 in 11th position ==> 10*9*8*7*6*5*4*3*2*1*1*9!  But this was asked as a multiple choice question in GATE 2007 and the options were  (A) 1/2   (B) 1/10  (C) 9!/20!  (D) None of these  I am not able to reduce this analysis to a given option. This is a follow-up to this question:   Hans Bethe wrote a paper in 1944, "Theory of Diffraction by Small Holes," Phys. Rev. 66, 163. I don't have access to the paper, but from descriptions online it sounds like he proved the following. Suppose a plane wave impinges on an absorbing sheet, and there is a hole in the sheet of diameter $d$, with $d&lt;\lambda$. Let $P_0$ be the power incident on the hole, and $P$ the power diffracted through the hole. Then the transmission is $T=P/P_0=(d/\lambda)^4$.  As a practical application, I think this explains why microwaves don't leak strongly through the metal grille in the front of a microwave oven.  Questions:   Does the thickness of the sheet matter? From references online, it sounds like the hole is treated as a waveguide...? This seems to relate to cutoff frequencies of waveguides, etc.? It seems to me that Huygens' principle would give $T=1$ for $d\ll\lambda$, since in this limit the wavelets are in phase. Why is Huygens' principle invalid here? Is this related to question #1? Is there a simple argument for the proportionality to $(d/\lambda)^4$? Or if not, how does one prove this using the gory details of Bessel functions, etc.? I can clearly see that $\dfrac{n!}{n^n}\to 0$ when $n\to\infty$. But how do I know if the sum $$\sum_{n=1}^{\infty}\frac{n!}{n^n}$$ is convergent or not? I know this might be basic, but thank you if anyone can help me. How can a Photon have a "frequency"? I picture light ray as a composition of photons with an energy equal to the frequency of the light ray according to $E=hf$. Is this the good way to picture this? Although I can solve elementary problems with the formulas, I've never really been comfortable with the idea of an object having or being related to a "frequency". Do I need to learn quantum field theory to really understand this? 3D arrows with TikZ Asymptote does give 3D arrows when drawing three dimensional figures (they even have shade!). Could we fake it with TikZ? Here's an example, manually written, with just one arrow worked:  \documentclass{scrartcl} \usepackage{tikz} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[-&gt;,scale=2]   \draw[&gt;={Triangle[width=3pt,length=5pt]}] (0,0,0) -- (1,0,0);   \draw[&gt;={Triangle[width=3pt,length=5pt]}] (0,0,0) -- (0,1,0);   \draw[&gt;={Circle[sep=-.9pt,width=3.08pt,length=2pt]Triangle[width=3pt,length=5pt]}] (0,0,0) -- (0,0,1); \end{tikzpicture} \end{document}     But that's (wrongly) manually calculated by trial and error (apart from the fact that it's not perfect, seeing how the other two axis —x and y— are oriented, it should have certain slant). It would be nice to have an interface like the other arrows  &gt;={3D[length=⟨real length⟩,width=⟨real width of the base⟩]}   Which would then calculate from those values (and, of course, also taking into account x=⟨x vect⟩,y=⟨y vect⟩,z=⟨z vect⟩)  Circle[sep=⟨value⟩,width=⟨value⟩,length=⟨value⟩,slant=⟨value⟩] Triangle[width=⟨value⟩,length=⟨value⟩] % And I'm not sure if `slant=⟨value⟩`                                        % is necessary in this Triangle case   Example  Using the code from the answer (thanks to Symbol1), for instance, this code (taking the idea from another question, link in the comments)  \begin{tikzpicture}[x={(0cm,1cm)},                     y={({cos(30)*1cm},{sin(30)*-1cm})},                     z={({cos(20)*1cm},{sin(20)*1cm})},                     thick,                     scale=3]   \pgfmathsetmacro{\ax}{.4}   \pgfmathsetmacro{\ay}{.6}   \pgfmathsetmacro{\az}{-.6}   \pgfmathsetmacro{\bx}{.4}   \pgfmathsetmacro{\by}{-.7}   \pgfmathsetmacro{\bz}{-.8}   \draw[densely dotted,thin] (\ax,\ay,\az) -- (\ax,0,\az);   \draw[densely dotted,thin] (\ax,\ay,\az) -- (0,\ay,\az);   \draw[densely dotted,thin] (\ax,0,0) -- (\ax,0,\az) -- (0,0,\az);   \draw[densely dotted,thin] (0,0,\az) -- (0,\ay,\az) -- (0,\ay,0);   \draw[densely dotted,thin] (\bx,\by,\bz) -- (\bx,0,\bz);   \draw[densely dotted,thin] (\bx,\by,\bz) -- (0,\by,\bz);   \draw[densely dotted,thin] (\bx,0,0) -- (\bx,0,\bz) -- (0,0,\bz);   \draw[densely dotted,thin] (0,0,\bz) -- (0,\by,\bz) -- (0,\by,0);   \draw[-{Cone3}] (0,0,0) -- (1,0,0) node[right] {$x$};   \draw[-{Cone3}] (0,0,0) -- (0,1,0) node[above right] {$y$};   \draw[-{Cone3}] (0,0,0) -- (0,0,1) node[below right] {$z$};   \draw[-{Cone3}] (0,0,0) -- (0,0,-1) node[above left] {$-z$};   \draw[thin] (0,0,0) -- (0,-.9,0);   \draw[-{Cone3}] (0,0,0) -- (\ax,\ay,\az) node[below left] {source};   \draw[-{Cone3}] (0,0,0) -- (\bx,\by,\bz) node[above right] {sim}; \end{tikzpicture}   gives this figure What do you call exaggerations like "I'm starving"? For example, when you are a little hungry and you say "I'm starving", or when you are so tired and you say "I'm dying". What do you call these type of expressions? Just exaggerations? I don't know how to explain this better. What is the difference between const_iterator and non-const iterator in the C++ STL? What is the difference between a const_iterator and an iterator and where would you use one over the other? Why is there an electric field in a wire even though it is a conductor? If you take a perfect conductor, there cannot be a field across it since if there were, the particles would arrange themselves in a way to cancel out the field right?  Yet, why does the same not hold true for a wire. A wire is essentially a long, thin conductor yet electrons do indeed flow so there must be an electric field.  Does this not contradict with what happens in a conductor? Why don't the electrons re-arrange to cancel out the electric field? I lost my house in minecraft. How can I find it? I was in creative mode on minecraft PE. I made this really awesome house plus a hotel! I was finishing up my house but decided to explore first. I explored for about 10 minutes and then stopped. Suddenly, I started worrying because I didn't know where I was. I couldn't find my house on a map, a compass, and I didn't make a beacon or keep track of what side of the sun it was on either. How can I find my house again???