in my homework i must embody Bfs and Edge method in BFS method  i must use queue to memory visited edge in Edge method i must store arraymatrix if i input , it shows nullpointerexception void Bfs(int v) {      Queue&lt;Integer&gt; q = new LinkedList&lt;&gt;();          q.add(v);     for(int i=0;i&lt;numofnodes;i++) {         visited[i]=false;     }     visited[v] = true;           while(!q.isEmpty()){             int temp = q.poll();             System.out.print(temp + &quot; &quot;);                          for(int j = 0; j &lt;numofnodes; j++){                 if(AdjMatrix[temp][j] == 1 &amp;&amp; visited[j]==false){                                        q.add(j);                                            visited[j]= true;                                 }                 }                            } }     void Edge(int n1, int n2) {      AdjMatrix[n1][n2]=1;     AdjMatrix[n2][n1]=1; }  java.lang.NullPointerException  i 5 e 0 1 e 0 3 e 1 2 e 1 4 e 2 3 e 3 4 bfs 0 0 1 3 2 4
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?
"had they known" or "if they had known" Can this:     These same officials, however, would have been appalled had they known what was going on behind this façade of self-help.   be rephrased as     These same officials, however, would have been appalled if they had known what was going on behind this façade of self-help.   ? How to detect when a variable changes value How can I easily detect when a variable changes value? I would like the execution of the program to break on the debugger whenever a specified variable changes value. Right now I'm using Eclipse's debugger. Asume the following search queries: osx, cocoa, iphone, xcode, applescript, mac, carbon    Searching for osx, cocoa, iphone or xcode like:   http://stackoverflow.com/search?q=osx   Results into searching by tag:   http://stackoverflow.com/questions/tagged/osx   While searching for applescript, mac and carbon like:   http://stackoverflow.com/search?q=applescript   Results into searching by string.  Yes, I know how to search by tags using brackets: [applescript] But why are the queries above interpreted differently? All queries are valid Stack Overflow tags! Why not convert all queries into search by string or search by tag? What is the logic behind? Tag popularity? It seems rather inconsistent to me. Uncertainty and wave-trains My textbook and the following extract from feynman's lectures present the same idea regarding wavetrains and uncertainty in their wavelengths. Why is it that a wavetrain confined to some space has an uncertainty in its wavelength or the wave number? Is not a confined wave-train equivalent to a burst of successive pulses which can have a definite wavelength according to their origin or nature of origin.   Next, i understand that the De Broglie relation relates the uncertainty in wavelength to the uncertainty in momentum but what links the finiteness of the wave-train to the uncertainty in position? Every closed subset $E\subseteq \mathbb{R}^n$ is the zero point set of a smooth function In Walter Rudin's Principles of mathematical analysis Exercise 5.21, it is proved that for any closed subset $E\subseteq \mathbb{R}$, there exists a smooth function $f$ on $\mathbb{R}$ such that $E=\{x\in \mathbb{R}\mid f(x)=0\}$.   Since $E^c$ is open in $\mathbb{R}$, $E^c$ is a countable disjoint union of open intervals $(a_i,b_i)$. On an interval $(a,b)$, if we let $f(x)=\exp(\frac{1}{(x-a)(x-b)})$, $x\in(a,b)$; $f(x)=0$, $x\notin(a,b)$, ($f(x)=\exp(\frac{1}{(x-a)})$ or $f(x)=\exp(\frac{1}{(x-b)})$ on $(a,\infty)$ and $(-\infty,b)$ resp.), then $f$ is smooth. Hence we can get a smooth function on $\mathbb{R}$ such that $E$ is the zero point sets of $f$.  (1). How about a closed subset $E$ of $\mathbb{R}^n$? is it true that for any closed subset $E\subseteq \mathbb{R}^n$, there exists a smooth function $f$ on $\mathbb{R}^n$ such that $E=\{x\in \mathbb{R}^n\mid f(x)=0\}$?  An open set in $\mathbb{R}^n$ cannot be written as a disjoint union of countable open balls hence the proof above is not valid. The partition of unity only claims that for an  open set $U$, there exists open $V$ in $U$ such that $\bar V\subseteq U$ and a smooth function $f$ on $\mathbb{R}^n$ such that $supp f\subseteq U$, $f|_V=1$.   (2). The taylor series of $f(x)=\exp(\frac{1}{(x-a)(x-b)})$ does not converge around points $a,b$ hence $f$ is not analytic at $a,b$. Is it true that for any closed subset $E\subseteq \mathbb{R}$, there exists an analytic function $f$ on $\mathbb{R}$ such that $E=\{x\in \mathbb{R}\mid f(x)=0\}$? I am creating a GUI frontend for the Eve Online API in Python.  I have successfully pulled the XML data from their server.  I am trying to grab the value from a node called "name":  from xml.dom.minidom import parse dom = parse("C:\\eve.xml") name = dom.getElementsByTagName('name') print name   This seems to find the node, but the output is below:  [&lt;DOM Element: name at 0x11e6d28&gt;]   How could I get it to print the value of the node? Winter is Coming It's my understanding that the phrase "Winter is Coming" is the motto of the Stark house, when the story first reaches the wall it's implied that the winter is not a periodic season like it is in our world.  Does the winter refer to a particularly severe season or does a winter only occur every few years? How can I list all user names and/or home directories? I want to list all the users dirs on the machine.Usually, I will do:  ls -l /home   But I use it in a script that will be deployed on others machines and maybe on that machines they don't call it home (e.g. myHome). So I want to generalize it to ls -l ~. But it just lists my users home dirs instead of all users home dirs name (basically I want to get a list of the users names on the machine). How can I generalize it? Accidentally created directory named "~" (tilde) I managed to make a directory literally named ~.  (Apparently, Python's os.mkdir('~/something') does this.)  How do I remove it without nuking my home?  Also, if it helps, I have my real /home on a separate partition. And the duplicate ~ is located in (the real ) ~. Is it possible to launch any arbitrary iPhone application from within another app?, For example in my application if I want the user to push a button and launch right into the Phone app (close the current app, open the Phone app).  would this be possible? I know this can be done for making phone calls with the tel URL link, but I want to instead just have the Phone app launch without dialing any specific number. How extended must my extended paper be? In Minecraft, you can only build up to a certain height limit (which is something around 256). However, if a player uses mods/hacks to go above the limit (Or simply goes into Creative Mode), then they can go above the height limit.  How high is the player height limit in Minecraft? Is there even a limit to it? I've tried testing this myself, but my thumb started hurting when I reached Y= 1000. Convert track bike to geared Is there any way to convert a track bike to a geared bike? I have a track bike with only the rails for the wheel but I've moved out of the city and there are more hills where I am now living so would like to convert to gears if possible and rather than buy a new bike, save some cash. An unfair three-sided die. An unfair three-sided die. Side $1$ will be rolled with probability $p_1$ , Side $2$ with probability $p_ 2$ and Side $3$ with probability $p_ 3$ . Find a formula for the probability that the $8^{th}$ $3$ will be rolled on the $10^{th}$ roll.  Attempt:  First 9 rolls there are 7 three's.  $$[\binom{9}{7}(p_3)^7(p_1+p_2)^2]\cdot p_3$$ $$=[84\cdot(p_3)^7(p_1+p_2)^2]\cdot p_3$$  any thoughts of this solution? Got NODATA issue: 'NODATA' (does the network require authentication?) I have just started studying implication in mathematics. So, you'll probably have an idea of where my confusion lies right from the get go.  In the truth table, where $A \implies B$ we obtain this result:  A   B   T/F ___________ T | T | T T | F | F F | T | T F | F | T   Now, my confusion here is regarding why $A\implies B$ given A is false, and B true. The others I understand. The first and last one are obvious, the second one implies, to me anyway, that given A implies B, the truth of B rests upon the truth of A, B is false, A is True, which cannot be, thus not B given A is false.  Now... then, why is B true despite the fact that A is false? Or rather, why is the statement B given not A, True. The truth of B is implied from the truth of A, but A is a false statement. So it's very contradictory that this may be, and in fact, if you go through a real life example, you would find that the third statement seems to be false.  Say $A$ is the statement that it is dark outside, and $B$ the statement that the sun is not on our side of the earth. If it is not dark outside, than stating that the sun is on the other side of the planet must be wrong (in my example i'm going to claim that the sun is the only light source).  Side note:  I just had a thought, if A is false, does that mean you can conclude... mmm, whatever? I mean, B is implied via the truth of A, if A is false, B is NOT implied, but then B could be EITHER true or false, I suppose. Is this correct?  However, would that not mean that A does not imply anything when false. Would that not set the 3rd and 4th statement to be undefined? How to calculate $$\int_{0}^{\pi/2}{\{\tan(x)\}dx}$$ where $\{x\}$ means the fractional part of $x$. I mentioned the zero points of $\{\tan(x)\}$. $\{\tan(x)\}$ equals to 0 iff $x=\arctan(k)$, $k$ is an integer. I tried to separate it into$$\sum_{k=0}^{\infty}{\int_{\arctan(k)}^{\arctan(k+1)}{(\tan(x)}-k)dx}$$ Then I found it hard to continue. I don't think I am on the right way. Why Faces eat each other? Some images shown outside of preview rectange Some images shown outside of preview rectange before uploading, eg: How does the speed of electrons change around a circuit? I have been thinking about ways of teaching electronics and I'm wondering if the following is true...  For starters, when we talk about voltage as energy per unit charge, is this energy manifest simply as the kinetic energy of the electron?  So, all other things being equal, will the electrons coming out of a 4 volt battery will have twice the velocity of electrons coming out of a 1 volt battery because of ${1 \over 2}mv^2$?  This would seem to imply that the voltage drop across different parts of the circuit is essentially a comparison of the electron speeds at those points.  Furthermore doesn't this imply that the electrons are nearly halted by the time they reach the positive terminal of the battery? This makes intuitive sense to me, it seems pedagogically sound, and it provides an explanation for how electrons "know" to give up their energy across the circuit -- electrostatic repulsion communicates later resistances to earlier parts of the circuit.  How much of the above is correct? The one things that makes me suspicious is that, in this picture, electron density at the positive terminal of the battery is very high, and repulsive forces would prohibit this. On the other hand, if the Joules per Coulomb are not coming from kinetic energy, then what? The field? But wouldn't that just dissipate as light?  Something is wrong but I don't know what.