I am just a doing a little project on my own, trying to create a bingo game. I'm wondering why I'm getting a nullpointer when trying to set the text of a JLabel. The only thing the JLabel needs to display is a random number 1-15.  static JLabel[] boardNumbers = new JLabel[25]; static Random r = new Random();   public static void generateBoard() {      for (int i = 0; i &lt; 1; i++) {         if (i &lt; 5) {             int n = r.nextInt(15);             numbersUsed[i] = n;             boardNumbers[i].setText("" + n);         } else if (i &gt;= 5 &amp;&amp; i &lt; 10) {             //i numbers         } else if (i &gt;= 10 &amp;&amp; i &lt; 15) {             //n numbers         } else if (i &gt;= 15 &amp;&amp; i &lt; 20) {             //g numbers         } else {             //o numbers         }     }  }   The line that is giving me a nullpointer is this line boardNumbers[i].setText("" + n);  For the full source code you can view this:
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
Why don't I have the right to create a text file in my root directory? Why do these page numbers get partially cut off at bottom of page? I am asked to prove this theorem:  If $f:U \rightarrow C$ is holomorphic in $U$ and invertible, $P\in U$ and if $D(P,r)$ is a sufficently small disc about P, then   $$f^{-1}(w) = \frac{1}{2\pi i} \oint_{\partial D(P,r)}{\frac{sf'(s)}{f(s)-w}}ds$$     The book says to "imitate the proof of the argument principle" but I am not seeing the connection. How to make a curve path from scratch given a list of (x, y, z) points? How can I write % into a file? How can I write % into an auxiliary file? % will not work, because LaTeX thinks that I start a comment with it (in the main file, not in the auxiliary file!), and \% will write \% into the file. How can it be accomplished?   \documentclass{article} \begin{document} \newwrite\outfile \immediate\openout\outfile=example.dat \immediate\write\outfile{%}% will not work, of course, but neither \% \immediate\closeout\outfile \end{document} Display Database Instance Relationship with TikZ I'm trying to display all of my corporate database instances and their relationship to each other, so to speak the database links. I found the geometry shape cylinder using TikZ \usetikzlibrary{shapes.geometric}, but I'm new to the whole TikZ stuff and it doesn't worked out that well so I thought maybe you could help me getting something like the following figure:    There will be a ton of instances and arrows, but I hope that you guys could give me a start so that I could do the rest on my own. Can I start and stop a tile floor job? I am tiling my bathroom floor and don't soon have a full day to dedicate to the job. Is it ok to lay down a few tiles each day and come back to the job when I have time? I would only lay mortar for the tiles I have time to lay each day.    My concern is that the mortar wouldn't properly "join" to the previously laid sections of tile and cause an inferior result, but I'm not really basing this concern on any facts. That is what I'm hoping to learn with this question. Redirect all requests to HTTPS, except for one subdirectory LSTM : shape of tensors? I'm trying to understand LSTM, using for instance   I get the overall idea, I guess. But I'm not quite sure I get the maths.  I'll set a very simple problem : I have a sequence of numbers and want to predict next number.   So x_t is of shape (1), and as I understand, h_t will be the prediction, so it should also be of shape (1). (I'm just here ignoring batch size)  Now, the equation producing h_t, using * operation should then have two operands of the same size as the result; that is, C_t and o_t should also be of shape (1).  Following on that idea, equation producing C_t forces also shape of (1) for f_t, i_t and ~C_t.  So... everything reduced to scalar real numbers in that case ?  what am I getting wrong ? because this would just not be able to learn much, would it ? Create Java console inside a GUI panel How can I create an instance of the Java console inside of a GUI panel? What's the most efficient way to get experience? Now that experience does something besides render regions of a server uninhabitable due to  orb lag, what's the most efficient and safe way to get those excellent enchants?  A mob farmer may rank highly, but what about without tons of setup? Correct the "about" page to reference the new "on hold" policy How to change the numbering of \part, \chapter, \section, ... to alphabetical, Roman numbers, etc Deleting photos on the phone - does it affect them on iCloud? Search by multiple tags I'd like to be able to search for questions by multiple tags; for example "questions tagged 'nhibernate' and 'web-services'".  I can get close by searching for "nhibernate web-services" but the results tend to be a few questions that relate to both terms--but much more largely just questions that relate to one or the other. Cauchy principle value of $\int_{-\infty}^{\infty}\sin(x)/(x-a)dx$ What are the practical implications of a name change for international travel and activities abroad? I am considering a name change, which seems to be a relatively straightforward action, when one remains in the same country: certain documents are replaced with new ones bearing the new name, and others are presented together with the name change document.  However, I travel internationally multiple times per year, and I often change temporary residence from one country to another. So I often deal with immigration and similar things. Furthermore, I have a lot of things going on like work and studies.  Quite obviously, if I change my name, I would often have to produce a proper translation of the name change document, which may include notarized translation thereof with apostille or, for example, traduction assermentée in France.  However, it would be great to hear about experiences of people, who have dealt with this issue first-hand, so I can weight the disadvantages against advantages of this correctly. In particular, I would like to know if anyone has encountered unforeseen difficulties with this, and how people rate the overall difficulty of such experiences. How can I remove duplicate rows? I am revising for an exam and have just realised that the euclidean algorithm questions in past exams are much harder than in homeworks! So i need some help please.  I have a question here, i already have the solution to it but i dont understand it that well, so i would like someone to please explain what is going on ect, and dont worry about avoiding giving me the full solution as i already have it so a full solution would be good!  Here is the question:  Use euclids Algorithm to find $gcd(172,20)$.  Hence solve $172a + 20b = 1000$ giving all solutions in terms of parameter t. List any solutions for which $a,b&gt;0$.  So it wants the answers in terms of parameter t, which is something i am not familiar with and cannot find in my books.   I have the solution in the solutions paper as   $$172= 8\times20+12 $$ $$20=1\times 12 + 8$$ $$12=1 \times 8 +4$$ $$8=2\times 4+0$$  thus $gcd(172,20)=4$  then   $$4= 12-8=12-(20-12)=2\times 12 - 20$$  $$=2\times(172-8\times20)-20$$  $$=2 \times 172 -17 \times20$$   multiplying by 250 we get   $$1000=500 \times 172 -4250 \times 20$$  so one solution is $a=500, b=-4250$  So, I understand everything up until here!!  Now it says,  Generally, $$a=500-t \frac{20}{4}=500-t$$            $$b=-4250+t \frac{172}{4}=-4250+43t$$  To have $a,b&gt;0$, we need $$500-5t&gt;0, (100&gt;t)$$ to have $a&gt;b$ we need $$-4250+43t&gt;0,(t&gt;98.8)$$$  Need $t=99$, $a=5$, $b=7$  Could someone please help explain what is going on in this last bit of working out? I am pretty good at euclidean algorithm usually but havent seen this type before an am panicking  bit as so close to exam! Any help appreciated how to find t and the other positive solutions would be great!  Please could you show me exactly how it is done here as my lecturer is quite strict with us using his exact methods. Many thanks Degrees of freedom in theoretical sample variance (for use in F-distribution) My question is essentially simple: suppose we have a sequence of heads and tails with an apparent chance of getting heads $\hat{p} = 0.5$.      h h t h t t t h t t h ...   How do we tell if this sample was drawn from a binomial distribution with this $\hat{p}$ or if it comes from a combination of different distributions which produces the same average? (e.g. $p = 0.25$ or $p = 0.75$)  Here's what I was thinking of doing:   We chop the sequence into subsections of length $n$, for example $n=5$, and calculate $\hat{p}$ in every such window: {h h t h t}, {t t h t t}, {h ...}0.6, 0.2, ... We then calculate the standard deviation in these $\hat{p}$ values: $\sigma_{ex}=\sqrt{\frac{\sum_{i=1}^M{(\hat{p}_i - \hat{\mu})^2}}{M}}$, where $\hat{\mu}$ is the average $\hat{p}$ and $M$ is the total number of windows of size $n$ we can make.  We calculate the standard deviation in $\hat{p}$ based on a binomial distribution, $\sigma_{th}=\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}$.   Now comes the problem: how to determine if these two values are the same? After a lot of research, I decided to try using an F-ratio test and plugging the result into an f-distribution.  F-ratio: $F = \frac{\sigma_{ex}^2}{\sigma_{th}^2}$ (only valid for normal-distributions :S)  And then an f-distribution to get to a p-value we can check against. However, for the f-distribution I need to know the degrees of freedom in the nominator and denominator. And therein lies my problem: what are the degrees of freedom for the variance calculated from theory? (In the experimental case I think it is M)  If you have this answer or any suggestions on how to solve this problem differently, I would love to hear about it!