I am new to Web development and trying to create a simple project. I have the following HTML code:  &lt;div id="container"&gt;     &lt;div class="ansBox"&gt;&lt;p class="ansBoxP"&gt;&lt;/p&gt;&lt;/div&gt;     &lt;div class="ansBox"&gt;&lt;p class="ansBoxP"&gt;&lt;/p&gt;&lt;/div&gt;     &lt;div class="ansBox"&gt;&lt;p class="ansBoxP"&gt;&lt;/p&gt;&lt;/div&gt;     &lt;div class="ansBox"&gt;&lt;p class="ansBoxP"&gt;&lt;/p&gt;&lt;/div&gt;     &lt;div class="ansBox"&gt;&lt;p class="ansBoxP"&gt;&lt;/p&gt;&lt;/div&gt;     &lt;div class="ansBox"&gt;&lt;p class="ansBoxP"&gt;&lt;/p&gt;&lt;/div&gt; &lt;/div&gt;   I am trying to compare the value in the paragraph to the answer set and display a message.  var ansBoxP = document.querySelectorAll(".ansBoxP"); var ansBox = document.querySelectorAll(".ansBox");  function setSquares() {  for(var i=0; i&lt;numSquares; i++) {     ansBox[i].addEventListener("click", function(){         // Get value of square picked         var clickVal = ansBoxP[i].textContent;         console.log("click is " + clickVal);          if(clickVal == answers[i]) {             alert("corrent");         }         else {             alert("incorrect");          }     });   } }   However i get the following error:  Uncaught TypeError: Cannot read property 'textContent' of undefined at HTMLDivElement.&lt;anonymous&gt;   I believe the issue is with how I am setting the clickVal variable. Am I correct in saying this is a scoping issue?
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.
So here is the problem      Solve $$4^x + 6^x = 9^x$$ for $x$.   I am trying to find its real solution.  I was trying in this way!! $$6^x\left( \frac {4^x}{6^x} + 1\right) = 9^x$$ $$\left({\frac 23}\right)^x +1=\left({\frac 32}\right)^x$$ but I'm stuck . . . Will anyone help ? What determines the number of comments that are displayed? I'm curious how it is decided how many comments to display before the "Show more comments" link. Sometimes I see a dozen comments on a question and no "Show more comments" link, in other occasions no comments are visible at all, only the link. Merging bib files from within LaTeX Why does network ad URL from SO to history.SE mention Ask Ubuntu? Today, I was on Stack Overflow when I noticed an interesting ad pointing to history.SE (actual square ad, not just Hot Network Questions).  The link in the ad was:    which resolves to:  https://history.stackexchange.com/questions/23946/what-were-greek-and-roman-sails-made-from?utm_medium=ad&amp;utm_source=http-askubuntu-com-questions-471178-converting-hundreds-of-jpg-to-pdf-using-te&amp;utm_campaign=history.stackexchange.com-promo&amp;utm_content=23946  (link form for conveniece: )  The confusing part os the URL is: utm_source=http-askubuntu-com-questions-471178-converting-hundreds-of-jpg-to-pdf-using-te. The ad is from SO to history.SE, it doesn't have anything to do with Ask Ubuntu, so why does it appear in the URL? Is this a bug?  EDIT: Okay, managed to trigger it again: the page  contains this ad:    The link of the ad is:    which resolves to:  http://opensource.stackexchange.com/questions/1556/how-to-react-to-unhelpful-contributions-to-otherwise-unnoticed-projects?utm_medium=ad&amp;utm_source=http-sharepoint-stackexchange-com-questions-16925-why-am-i-getting-server-erro&amp;utm_campaign=opensource.stackexchange.com-promo&amp;utm_content=1556  incorrectly referencing an unrelated sharepoint.SE question. Why are hexadecimal numbers prefixed with 0x? What is the formal definition of polynomial ring of several variables? Let's consider a polynomial ring of single variable. One can define them informally by saying $P(X)=\sum_{i=1}^n a_n X^n$ while $X$ is an indeterminate variable. However, since mathematics is based on first-order logic, one can only talk about something that actually exists (as a set). So as its name says, indeterminate variable is not a sentence in $ZFC$. Nevertheless, we can formally define a polynomial ring $R[X]$ as a subset of $R^\omega$ whose support is finite. ($R$ is a commutative ring with unity) Just like a single variable, I want to know what would be the formal definition of a polynomial ring of several variables. What would be a formal definition? === I have figured out a candidate. That is,  Candidate for a &quot;Definition of a polynomial ring $R[X_1,...,X_n]$&quot;. ($R$ is a commutative ring with unity) Let $R[X_1,...,X_n]$ be the set of all functions $f:\omega^n \rightarrow R$ whose support is finite. Define $(f+g)(a,b,c)=f(a,b,c)+g(a,b,c)$ and $(f•g)(a'',b'',c'')=\sum_{a+a'=a''} f(a,b,c)•g(a',b',c')$ (Note that in this way, $+,•$ are well defined.) Then, it can be checked that $(R[X_1,...,X_n],+,•)$ is a ring.  Is this a formal definition of a polynomial ring? Why can't a single ReLU learn a ReLU? As a follow-up to  I simplified even more and tried to train a single ReLU (with random weight) to a single ReLU.  This is the simplest network there is, and yet half the time it fails to converge.  If the initial guess is in the same orientation as the target, it learns quickly and converges to the correct weight of 1:      If the initial guess is "backwards", it gets stuck at a weight of zero and never goes through it to the region of lower loss:        I don't understand why.  Shouldn't gradient descent easily follow the loss curve to the global minima?  Example code:  from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, ReLU from tensorflow import keras import numpy as np import matplotlib.pyplot as plt  batch = 1000   def tests():     while True:         test = np.random.randn(batch)          # Generate ReLU test case         X = test         Y = test.copy()         Y[Y &lt; 0] = 0          yield X, Y   model = Sequential([Dense(1, input_dim=1, activation=None, use_bias=False)]) model.add(ReLU()) model.set_weights([[[-10]]])  model.compile(loss='mean_squared_error', optimizer='sgd')   class LossHistory(keras.callbacks.Callback):     def on_train_begin(self, logs={}):         self.losses = []         self.weights = []         self.n = 0         self.n += 1      def on_epoch_end(self, batch, logs={}):         self.losses.append(logs.get('loss'))         w = model.get_weights()         self.weights.append([x.flatten()[0] for x in w])         self.n += 1   history = LossHistory()  model.fit_generator(tests(), steps_per_epoch=100, epochs=20,                     callbacks=[history])  fig, (ax1, ax2) = plt.subplots(2, 1, True, num='Learning')  ax1.set_title('ReLU learning ReLU') ax1.semilogy(history.losses) ax1.set_ylabel('Loss') ax1.grid(True, which="both") ax1.margins(0, 0.05)  ax2.plot(history.weights) ax2.set_ylabel('Weight') ax2.set_xlabel('Epoch') ax2.grid(True, which="both") ax2.margins(0, 0.05)  plt.tight_layout() plt.show()     Similar things happen if I add bias: 2D loss function is smooth and simple, but if the relu starts upside down, it circles around and gets stuck (red starting points), and doesn't follow the gradient down to the minimum (like it does for blue starting points):    Similar things happen if I add output weight and bias, too.  (It will flip left-to-right, or down-to-up, but not both.) How to make grass appear on top of ground not in middle? How would I implement the quantum oracle in Deutsch's algorithm? When are "if" and "whether" equivalent? Are if and whether equivalent in sentences like the ones below?     How to determine if my saddle is too high?   How to determine whether my saddle is too high?         We should check if everything is okay now.   We should check whether everything is okay now. Can a Sorcerer protect their friend from Web by using Careful Spell? With the metamagic "Careful Spell" does the caster protect his friend from a Web spell for its full duration or just for the first save? If the friend stays in the area or re-enters the area does he continue to automatically save against the restraining effect? "Install alongside" option missing. How do I install Ubuntu beside Windows using "Something Else"? Can I have too many mods? I found a lot of mods that make thinks lighter, and add mark and recall, and a basement I like. They are all on Steam, and what I want to know is if I can have too many? Will they all work together? Or should I just leave them alone? What's the difference between a temp table and table variable in SQL Server? Casting nines and elevens in other bases (radix) and doing check sums for binary Objects Not Showing in Other Workspace Viewports, Only Default Can an illusion give a player partial cover? I'm in an argument with a player at my table, he says hiding behind some bushes while shooting arrows at my monsters gives him partial cover because they can only see his head and shoulders. So they're limited in what they can even aim at. I accepted that. And now he's trying to use minor illusion to create fake bushes/walls and continuing to claim he has partial cover.  I thought cover was based on having a solid obstacle between you and the target... Like, if a magical attack, or penetrating attack can pass through your cover, wouldn't that negate the AC bonus from partial cover? Or is it about "aiming"? Is it okay to say "Yes you're." instead of "Yes you are."? Possible Duplicate:    I was having an SMS conversation with a friend and somehow &quot;Yes you're&quot; came into play in retaliation to a comment. Example:  Person 1: &quot;You are bad at English&quot;. Person 2: &quot;No I are not.&quot;. Person 1: &quot;Yes you're&quot;.  Is that acceptable? I would assume that it is. Think of &quot;don't&quot;. You can say:  &quot;No, don't.&quot;  or  &quot;I don't.&quot;  and it is a contraction like &quot;you're&quot;. So, is it okay? I want to put four figures in a single row. The code I am trying to use is taken from .  This puts three figures in a row. When I add a fourth one, I get three images in row and the last one appears in the second row. But I want all of them in one row. Here is my code.  \documentclass[12pt,twoside]{report}% Use this line for the print version of the thesis   \usepackage{graphicx} \usepackage{caption} \usepackage{subcaption} \begin{document}  \begin{figure}         \centering         \begin{subfigure}[b]{0.3\textwidth}                 \centering                 \includegraphics[width=\textwidth]{gull}                 \caption{A gull}                 \label{fig:gull}         \end{subfigure}%           \begin{subfigure}[b]{0.3\textwidth}                 \centering                 \includegraphics[width=\textwidth]{gull}                 \caption{A gull2}                 \label{fig:gull2}         \end{subfigure}%          ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.           %(or a blank line to force the subfigure onto a new line)         \begin{subfigure}[b]{0.3\textwidth}                 \centering                 \includegraphics[width=\textwidth]{tiger}                 \caption{A tiger}                 \label{fig:tiger}         \end{subfigure}         ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.           %(or a blank line to force the subfigure onto a new line)         \begin{subfigure}[b]{0.3\textwidth}                 \centering                 \includegraphics[width=\textwidth]{mouse}                 \caption{A mouse}                 \label{fig:mouse}         \end{subfigure}         \caption{Pictures of animals}\label{fig:animals} \end{figure} \end{document}   As I have mentioned above, it works for three figures.  But I can not use it for four figures. What should I change?   What does  width=\textwidth mean?   I changed    \begin{subfigure}[b]{0.3\textwidth}   to  \begin{subfigure}[b]{0.2\textwidth}   but it didn't help.  Then, I changed     \includegraphics[width=\textwidth]{mouse}   to  \includegraphics[width=0.5\textwidth]{mouse}   Still no solution. How can I set the box plot (i.e. axis) ratio of a usual 2D plot to a given value, say 4:3.  I don't want to use unit vector ratio since the quantities of the independent and dependent variables are of completely different orders of magnitude.