My node is having list of nodes(as children). ref.get(L.get(t)).children.add(N); L.get(t) is giving my parent node. ref.get(L.get(t)) is another node which I want to work with. I wanted to add my new node N to children of ref.get(L.get(t)). While debugging I can see a node in ref.get(L.get(t)) but throwing NullPointerException.  public void CreateNode(Node m,ArrayList&lt;Node&gt; S,HashMap&lt;Node,Node&gt; ref,ArrayList&lt;String&gt; L) {        Node N = new Node(m.val,m.data);     ref.put(m,N);      if(S.isEmpty()) {         S.add(N);     } else {         Node c =ref.get(L.get(t));          //Showing C as null         ref.get(L.get(t)).children.add(N);  //unable to access node in ref.get(L.get(t))         System.out.println(ref.get(L.get(t)).val);          S.add(N);         t++;     } }
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?
Proving that $ 2 $ is the only real solution of $ 3^x+4^x=5^x $ How many solutions has the equation $\sin x= \frac{x}{100}$ ? How many solutions has the equation $\sin x= \frac{x}{100}$ ?   Usually when I was asked to solve this type of problem, I would solve it graphically but this one seems to be trickier. It doesn't seem wise to put $f(x)=\sin x$ and $g(x)=\frac{x}{100}$ in the same graph and then counting all the intersection points.  What would be some algebraic methods to solve this? Can a person negotiate with banks on CD interest rates? I use a brick and mortar bank for some of my savings. I’d love to get a CD interest rate closer to what Ally or other online banks offer.   Are brick and mortar banks will to negotiate with customers on interest rates? For instance, if I went into a branch and said I’m moving my money to Ally unless the bank matches Ally’s rates, do I have any chance of getting them to? I'm using Google calendar, and I subscribe to my Google Calendar from multiple computers.  Whenever I set an event with (an) email reminder(s) on Google calendar, I'll get multiple emails because (1) Google calendar itself sends me the email reminder and (2) each computer that subscribes the calendar tries to send the email reminder (when the computer wakes up).  It's very annoying. I ran into an interesting behavior recently.  It seems that if I override .equals() to take a parameter other than Object, it doesn't get called.  Can anyone explain to me why this is happening?  It seems to violate my understanding of polymorphism in OOP, but maybe I'm missing something.  Here's much simpler code that shows what I'm seeing:  public class MyClass {   private int x;   public MyClass(int n) { x = n; }   public boolean equals(Object o) { return false; }   public boolean equals(MyClass mc) { return x == mc.x; }   public static void main(String[] args) {     List&lt;MyClass&gt; list = new ArrayList&lt;MyClass&gt;();     list.add(new MyClass(3));     System.out.println("Contains 3? " + list.contains(new MyClass(3)));   } }   When this is run, it prints "Contains 3? false".  It looks like the equals(Object) function is called, even though there is another that would work.  By contrast, if I write equals like this the code works as expected:  public boolean equals(Object o) {   if(!(o instanceof MyClass))     return false;   MyClass mc = (MyClass)o;   return x == mc.x; }   Why isn't it figuring out which version of the function to call based on the type of the parameter? How do electromagnetic waves travel in a vacuum? This is perhaps a total newbie question, and I will try to formulate it the best I can, so here it goes. How does an electromagnetic wave travel through for example, the vacuum of space?   I usually see that waves are explained using analogies with water, pieces of rope, the strings of a guitar, etc, but it seems to me that all those waves need a medium to propagate. In fact, from my point of view, in those examples the wave as a "thing" does not exist, it's just the medium that moves (involuntary reference to The Matrix, sorry).   But in space there is no medium, so how does a wave travel? Are there free particles of some sort in this "vacuum" or something? I believe , so supposedly there isn't a medium for the wave to travel through.   Moreover, I've seen other answers that describe light as a perturbation of the electromagnetic field, but isn't the existence of the field, potential until disturbed? How can it travel through something it does not exist until it's disturbed by the traveling light in the first place? (this last sentence is probably a big misconception by me). I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias:  sum(reviews.rev_rating)/count(reviews.rev_id) as avg_rating align vs equation Hill cipher, unknown letter value I've been struggling on this problem for a while now : the Hill cipher is well-known to be vulnerable to known-plaintext attack due to its linearity. Given a key matrix $K$ of size $n\times n$, one can retrieve the key with as little as $n^2$ plaintext/cipher text couples.  All examples found on the Internet assume an alphabet where $A=0, B=1 \dots Z=25$, but how could we break the Hill cipher using a know-plaintext attack without any clue over the alphabet permutation nor the key matrix ?  I've tried several things such as  the whole set of equations together, however it requires several divisions in $\bf{Z}_{26}$ which aren't possible (i.e. division by even numbers or 13) I am looking for a convenient way to set the background of tabular cells. I'd like to do two things:  (1) Set the background shaded in a color (2) Set the background hatched  I learned that the TikZ package provides means to do this but I am unable to come up with a solution that does not use matrices (such as here: ) but instead uses the tabular package.  Here's what I'd like to do:  \documentclass{article} \begin{document} \begin{tabular}{|l|l|l|} \hline   1 &amp; \setBGGray 2 &amp; 3 \\\hline   4 &amp; 5 &amp; 6 \\\hline   7 &amp; \setBGHatched 8 &amp; 9 \\\hline \end{tabular} \end{document}   The output should look like this:    Can someone please help me achieving this using tabular (or tabularx) and TikZ? String representation of an Enum How do I return a variable from Google Maps JavaScript geocoder callback? What is the name of the package for R? I tried aptitude search r, but (unsurprisingly), there are waaaay too many results to sift through. Let $L$ and $R$ be $n \times n$ matrices. I am trying to solve the following minimization problem  $$ L^{k+1} := \arg \min_{L} \lambda \|L\|_{\ast} + \frac{1}{2\mu}\|L-R^{k}\|_{F}^{2} $$ $$ \mbox{s.t.}\ L \succeq 0 $$  where $\|\cdot\|_{\ast}$ and $\|\cdot\|_{F}$ denote the nuclear and Frobenius norms, respectively. Also, $k$ expresses the $k$th iteration when solving an optimization problem successively.  I don't know how to solve this problem. Would you tell me the way? What's the easiest way to use a linked list in python? In scheme, a linked list is defined simply by '(1 2 3 4 5). Python's lists, [1, 2, 3, 4, 5], and tuples, (1, 2, 3, 4, 5), are not, in fact, linked lists, and linked lists have some nice properties such as constant-time concatenation, and being able to reference separate parts of them. Make them immutable and they are really easy to work with! The number of divisors I am reading a math book. It states the following rule:      For an integer $n$ greater than 1, let the prime factorization of $n$ be $$n=p^a_1p^b_2p^c_3...p^m_k$$    Here $a, b, c,..., m$ are nonnegative integers, and $p_1,p_1,...,p_k$ are prime numbers. Then the number of divisors of $n$ is: $$d(n)=(a+1)(b+1)(c+1)...(m+1)$$   I can use the rule to solve problems correctly, but I don't understand the rule. How to prove it? Has there been any news from the maintainers of Ubuntu packaging of Ruby as to whether they'll be releasing a package for Ruby 2.0? If so, have they indicated whether they'll be releasing any packages for Ruby 2.0 on 12.04? I would like to know how I can get the value of a node with the following paths:   config/global/resources/default_setup/connection/host config/global/resources/default_setup/connection/username config/global/resources/default_setup/connection/password config/global/resources/default_setup/connection/dbname   from the following XML:  &lt;?xml version="1.0"?&gt; &lt;config&gt;     &lt;global&gt;         &lt;install&gt;             &lt;date&gt;&lt;![CDATA[Tue, 11 Dec 2012 12:31:25 +0000]]&gt;&lt;/date&gt;         &lt;/install&gt;         &lt;crypt&gt;             &lt;key&gt;&lt;![CDATA[70e75d7969b900b696785f2f81ecb430]]&gt;&lt;/key&gt;         &lt;/crypt&gt;         &lt;disable_local_modules&gt;false&lt;/disable_local_modules&gt;         &lt;resources&gt;             &lt;db&gt;                 &lt;table_prefix&gt;&lt;![CDATA[]]&gt;&lt;/table_prefix&gt;             &lt;/db&gt;             &lt;default_setup&gt;                 &lt;connection&gt;                     &lt;host&gt;&lt;![CDATA[localhost]]&gt;&lt;/host&gt;                     &lt;username&gt;&lt;![CDATA[root]]&gt;&lt;/username&gt;                     &lt;password&gt;&lt;![CDATA[pass123]]&gt;&lt;/password&gt;                     &lt;dbname&gt;&lt;![CDATA[testdb]]&gt;&lt;/dbname&gt;                     &lt;initStatements&gt;&lt;![CDATA[SET NAMES utf8]]&gt;&lt;/initStatements&gt;                     &lt;model&gt;&lt;![CDATA[mysql4]]&gt;&lt;/model&gt;                     &lt;type&gt;&lt;![CDATA[pdo_mysql]]&gt;&lt;/type&gt;                     &lt;pdoType&gt;&lt;![CDATA[]]&gt;&lt;/pdoType&gt;                     &lt;active&gt;1&lt;/active&gt;                 &lt;/connection&gt;             &lt;/default_setup&gt;         &lt;/resources&gt;         &lt;session_save&gt;&lt;![CDATA[files]]&gt;&lt;/session_save&gt;     &lt;/global&gt;     &lt;admin&gt;         &lt;routers&gt;             &lt;adminhtml&gt;                 &lt;args&gt;                     &lt;frontName&gt;&lt;![CDATA[admin]]&gt;&lt;/frontName&gt;                 &lt;/args&gt;             &lt;/adminhtml&gt;         &lt;/routers&gt;     &lt;/admin&gt; &lt;/config&gt;   Also I want to assign that value to the variable for further use. Let me know your idea. Closure of a Ball is Contained in Closed Ball (usual metric) Let $\overline{B_d (x, r)}$ be the closure of an open ball, and let $\hat B_d (x, r)$ be a closed ball. Show that in any metric space $(X, d)$, $\overline{B_d (x, r)} \subseteq \hat B_d (x, r)$ for all $x \in X$ and $r &gt; 0$.    I used the definition of closure: $\overline{B}$ = $B \bigcup B'$. If $x \in \overline{B}$, then $x \in B$ or $x \in \overline{B}$, or both. If $x \in B$, then clearly $x \in \hat B$ since $B \subseteq \hat B$. But, if $x \in B'$, then $x$ is an accumulation point. Since $\hat B$ is closed, it contains all accumulation points of $B$. Thus, $x \in \hat B$.  Is this approach correct, or at least in the right direction? Should I be using the closure definition, or try another one? Thank you. Cycles : shadows on smooth shaded mesh, strange behavior I wonder if this is a bug, or if I missed something... When a light hits tangentially convex surfaces with "smooth shading", the shadow on this surface seems to "partially ignore" the smoothness of the surface. Here is an example with a simple cylinder :    On the left, a cylinder with "flat shading". Everything's ok. On the right, the same with "smooth". We can see an edge, bad shadowed.  With or without the "Edge split" modifier, no matters, the edge is still there. The shader is a simple white diffuse shader with no texture nor displace.  I have to add a subsurf modifier with at least 2 levels, which will insanely increase the vertex count... And I can't do that for my project.  I hope someone already saw it, and have a little tip to share. Or if someone already know it's a bug, or a limit of the current Cycles renderer ?