At the moment I try to learn more about java and try to code a graph.  I have a HashMap with . At the moment I want to implement a DFS but it won't work.   I want to add all nodes who are achievable from the startNode to a List  Is the code in principle correct or ok? I get a NullPointerException if I test my program. But I don't know why. I know a NPE is but in my mind my code shouldn't throw a NPE. So please don't mark it as duplicate from a NullPointer Question.  Thank you a lot for helping!  Here is my code:   /**  * For a given node the method returns all nodes the outgoing edges of the node directly lead to.  *   * @return list containing all directly connected nodes.  */ @Override public List&lt;Node&gt; getAdjacentNodes(Node startnode) {     List&lt;Node&gt; nodes = null;     if (startnode != null &amp;&amp; this.nodes.values().contains(startnode)) {         return startnode.getAdjacentNodes();     }     nodes = new LinkedList&lt;Node&gt;();     return nodes; }  @Override public List&lt;Node&gt; getAdjacentNodes(int startnode) {     return getAdjacentNodes(nodes.get(startnode)); }public List&lt;Node&gt; depthFirstSearch(Node startNode){     LinkedList&lt;Node&gt; nodeList = null;     resetState();      //Get a List with all Adjacent Nodes from the startNode     List&lt;Node&gt; node = getAdjacentNodes(startNode);     //Test for each of the ADjacent Nodes from startNode if the current status is white     for(Node child : node) {          //Is the status white, run the recursive method         if(child.status == Node.WHITE) {             runDFS(child);         }      }      return nodeList; }  public LinkedList&lt;Node&gt; runDFS(Node child) {     //Create a LinkedList as in the depthFirstSearch-Method     LinkedList&lt;Node&gt; nodeList = null;     //Set the status from the current child to GRAY     child.status = Node.GRAY;     //For each Child from the AdjacentsNodes from the child check if color is white     for(Node nextNode : getAdjacentNodes(child)) {         if (hasWhiteNeighbor(nextNode) == true) {             //is color white execute the runDFS method again to get to the last node             runDFS(nextNode);         }         //If the color is not white set it to black and add the node to List, because last node was found         else {             child.status = Node.BLACK;             nodeList.add(child);         }     }     return nodeList; }
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?
If $0 &lt; \alpha &lt; 1$, then       $$ (x + y)^{\alpha} &lt; x^{\alpha} + y^{\alpha} $$      for $x$, $y$ positive.   Is this inequality true in general?  I tried using Young's Inequality: For $z,t &gt; 0$, and for $n$, $m$ such that $n+m=1$, then   $$ z^n + t^m \leq nz + mt $$  So, using this we have   $$ (x+y)^{\alpha} \cdot 1^{1 - \alpha} \leq \alpha(x+y) + (1-\alpha) = \alpha x + \alpha y + (1-\alpha)$$  which is not as tight as I want. Can Muggles publicly establish the existence of a magical community? Proving a limit of a trigonometric function: $\lim_{x \to 2/\pi}\lfloor \sin \frac{1}{x} \rfloor=0$ $$\lim_{x \to \frac{2}{\pi}}\lfloor \sin \frac{1}{x} \rfloor=0$$    I need to prove the limit of this using the $\epsilon - \delta $ way but I don't know how to find $\delta$ when I'm given a trigonometric function I know only how to do it with polynomial functions VirtualBox Toolbar is hidden! How to show it? Sam Weller in The Pickwick Papers: What accent is Dickens portraying? In Dickens' Pickwick Papers, there's a character "Sam Weller". Weller's dialogue is written somewhat phonetically, I presume, but I'm struggling to understand what accent Dickens is trying to portray. The main peculiarities of Weller's speech are using "v" where there should be a "w" and a "w" when there should be a "v". For example, he says "wery" instead of "very" and "avay" instead of "away". Weller is supposed to be from London, but this doesn't seem like any kind of London accent I've heard. Is this a particular archaic accent?  More importantly, what is Dickens telling us about Sam Weller by having him speak like this? Bash script doesn't see SIGHUP? I've got the following script:  #!/bin/bash echo "We are $$" trap "echo HUP" SIGHUP cat    # wait indefinitely   When I send SIGHUP (using kill -HUP pid), nothing happens.  If I change the script slightly:  #!/bin/bash echo "We are $$" trap "kill -- -$BASHPID" EXIT    # add this trap "echo HUP" SIGHUP cat    # wait indefinitely   ...then the script does the echo HUP thing right as it exits (when I press Ctrl+C):  roger@roger-pc:~ $ ./hupper.sh  We are 6233 ^CHUP   What's going on? How should I send a signal (it doesn't necessarily have to be SIGHUP) to this script? How do I apply differential cryptanalysis to a block cipher? I have read a lot of summaries of block ciphers particularly with regards to the NIST competitions stating that reduced-round block ciphers are – for example – vulnerable to differential cryptanalysis.  I have a general idea that the application of differential cryptanalysis is to look at the difference between inputs;  makes that fairly clear. However, I could take any two inputs for any given block cipher and I am pretty certain I'd be staring at random differences.    I am aware this is the idea of a well written block cipher; however, assuming a broken or vulnerable cipher (feel free to provide simple examples) how do I go about choosing differences to try?  Are there any clues in algorithm design that would inform a decision on which values to choose?  How does being vulnerable to differential cryptanalysis impact a cipher in the wild?  If all I have are differences between known plain-texts and known keys as my analysis and a captured ciphertext as my data to exploit, what can I actually deduce? Include ALL pdf graphics in document I have several plots saved as .pdf in a folder and I would like to know if there is a way of adding all of them in a document at once, without typing the path to each file. How do I determine the shutter count on a EOS 60D body? "To mentor someone during a project" vs. "to mentor someone on a project" ..., whom I mentored during his final semester's project.   ..., whom I mentored on his final semester's project.      Which of these two is grammatically correct? Since I am not talking about the final semester but the final semester's project, I am not very sure about during. Can someone help me with this? How do I solve the partial differential equaiton  $u_{t} = (u_{x})^{-1}$  subject to the conditions $u(t,x) \geq 0$ and $u(0,0) = $0. Use the separation Ansatz $u(t,x) = f(t)g(x)$.  The inverse in confusing me Do flight attendants prefer I press the button or walk to the back? (Long-haul flights) overset text over equal sign in in an Align environment How to implement a tree data-structure in Java? win 10 home how to rename my home directory and account login ColdFusion adding extra quotes when constructing database queries in strings I am coding in ColdFusion, but trying to stay in cfscript, so I have a function that allows me to pass in a query to run it with   &lt;cfquery blah >   #query# &lt;/cfquery>   Somehow though, when I construct my queries with sql = "SELECT * FROM a WHERE b='#c#'"  and pass it in, ColdFusion has replaced the single quotes with 2 single quotes.  so it becomes  WHERE b=''c'' in the final query.  I have tried creating the strings a lot of different ways, but I cannot get it to leave just one quote.  Even doing a string replace has no effect.   Any idea why this is happening?  It is ruining my hopes of living in cfscript for the duration of this project Diplomacy Attacking a Territory as they move If I convince Turkey, to move Army Bul to Gre, would I be able to send Army Ser to Bul and take the area? Euler-Lagrange equation in curved spacetime: how to calculate $\partial \mathcal{L}/\partial(\nabla_\nu A_\mu)$? My problem is mostly with notation. When we apply the Euler-Lagrange equation to the Lagrangian scalar $$\mathcal{L}= -\frac{1}{4}F^{\mu\nu}F_{\mu\nu}$$ Where $$F_{\mu\nu} = \partial_\mu A_\nu -\partial_\nu A_\mu= \nabla_\mu A_\nu -\nabla_\nu A_\mu$$ and I start with $$\frac{\partial\mathcal{L}}{\partial A_\mu}=\nabla_\nu\left(\frac{\partial \mathcal{L}}{\partial(\nabla_\nu A_\mu)}\right).$$   Now I rewrite the lagrangian as $\mathcal{L} = -\frac{1}{4}g^{\mu\alpha}g^{ \nu\beta}(\nabla_\mu A_\nu-\nabla_\nu A_\mu)(\nabla_\alpha A_\beta-\nabla_\beta A_\alpha)$ $$\mathcal{L}= -\frac{1}{4}g^{\mu\alpha}g^{\nu\beta}\left[(\nabla_\mu A_\nu)(\nabla_\alpha A_\beta)-(\nabla_\mu A_\nu)(\nabla_\beta A_\alpha)-(\nabla_\nu A_\mu)(\nabla_\alpha A_\beta)+(\nabla_\nu A_\mu)(\nabla_\beta A_\alpha) \right]$$ My problem is calculating $\frac{\partial \mathcal{L}}{\partial(\nabla_\nu A_\mu)}$, how are the rules of partial derivatives generalised to covariant ones? Also, is $\frac{\partial\mathcal{L}}{\partial A_\mu}=0$, is that correct ? Adding script conditionally Lightning Cancel Enqueued Server Side Action