I am working on trying to split my doubly linked list. But i get nullpointer exception on sublist.head = mid.next. Does it means sublist.head is pointing to null? How can i resolve this??   public void splitMid(DoublyLinkedList&lt;T&gt; sublist) {     Node&lt;T&gt; current;     Node&lt;T&gt; mid;     int i;     if (head == null)     {         sublist.head = null;         sublist.rear = null;         sublist.count = 0;     }     else         if (head.next == null)         {             sublist.head = null;             sublist.rear = null;             sublist.count = 0;         }         else         {             mid = head;             current = head.next;             i = 1;             if (current != null)                 current = current.next;             while (current != null)             {                 mid = mid.next;                 current = current.next;                 i++;                 if (current != null)                     current = current.next;             }             sublist.head = mid.next;             sublist.rear = rear;             rear = mid;             rear.next = null;             sublist.count = count - i;             count = i;         }  }
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?
Ubuntu 14.04 LTS fails to start with a kernel panic How do I add a .sty file to my MacTeX/TeXShop installation? I am looking for a proof possibly using the sandwich theorem and/or Bernoulli's inequality for proving the following statement:  If $x&gt;0$ then $x^{1/n}$ tends to $1$. An instructor has an exam of 5 questions and a question bank of 50 questions. Are there $50\choose 5$ or $(50)_5$ possible exams? A proof using Yoneda lemma Same Video on each face, but with different time delay? iam looking for a way to - like the title says - i want to put the same video on each face, but with different time delay.  In other words, i want to create a kind  of videowall.  i found :  #---------------------------------------------------------- # File multi_material.py #---------------------------------------------------------- import bpy  def run(origin):     # Create three materials     red = bpy.data.materials.new('Red')     red.diffuse_color = (1,0,0)     blue = bpy.data.materials.new('Blue')     blue.diffuse_color = (0,0,1)     yellow = bpy.data.materials.new('Yellow')     yellow.diffuse_color = (1,1,0)      # Create mesh and assign materials     bpy.ops.mesh.primitive_uv_sphere_add(         segments = 16,         ring_count = 8,          location=origin)     ob = bpy.context.object     ob.name = 'MultiMatSphere'     me = ob.data     me.materials.append(red)     me.materials.append(blue)     me.materials.append(yellow)      # Assign materials to faces     for f in me.faces:         f.material_index = f.index % 3      # Set left half of sphere smooth, right half flat shading     for f in me.faces:         f.use_smooth = (f.center[0] &lt; 0)  if __name__ == "__main__":     run((0,0,0))   But it didn't really work out for me, it creates a red sphere and sends      Traceback (most recent call last):   File "\Text", line 36, in      File "\Text", line 28, in run AttributeError: 'Mesh' object   has no attribute 'faces' Error: Python script fail, look in the   console for now...   to the console. Also i didn't know how i could add the delay in there.  Hope you can help me out with this! :) How to draw a shaded sphere? Via command line, I have a log file I'd like to keep track of.  What I want is to have, basically, a tail that refreshes when the log is updated making the text scroll upwards as new lines are appended to the log file.  Is there anything out there that does that without having to write some code? On the grade of an ideal I need to prove the following statment (actually a special case of it).     Let $R$ be a Noetherian ring, $M$ a finite $R$-module and $I$ an ideal of $R$. Then   $\operatorname{grade}(I,M)\geq 2$ if and only if the homomorphism $M\rightarrow$Hom$_R(I,M)$ given by $m\mapsto(i\mapsto im)$ is an isomorphism.   This is Exercise 1.2.24 in Bruns and Herzog, Cohen-Macaulay Rings. Use induction to prove the following: $1! + 2! + .... + n! \le (n + 1)!$ Why is everybody so concerned about etc/passwd? Here is the content of my vagrant machine of this particular file:  root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/us$ nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin syslog:x:100:103::/home/syslog:/bin/false   Could anybody explain me why it is bad if some evil guy could get this file of my production server? Does low disk space affect SSD performance? I was wondering if having less than 5-10GB of free space on an SSD would affect performance. Is it specific to SSD or is it more of an operating system aspect?  For example, on an Intel X-25 G2 that has TRIM support (on Windows 7). ChaCha with 64bit integers as a PRNG with streams Can I use ChaCha with four rounds as a good non-cryptographic PRNG with different streams if I use 64 bit integers instead of the standard 32 bit integers? I need a bigger state and this seems the easiest way to do it. Alternate position of x tick labels Prove that $T$ has a cyclic vector iff its minimal and characteristic polynomials are the same Did you know that :  Map&lt;Object,Object&gt; m1 = new HashMap&lt;Object, Object&gt;(); Map&lt;Object,Object&gt; m2 = new HashMap&lt;Object, Object&gt;(); System.out.println("m1.equals(m2) = "+m1.equals(m2)); System.out.println("m1.keySet().equals(m2.keySet()) = "             +m1.keySet().equals(m2.keySet())); System.out.println("m1.entrySet().equals(m2.entrySet()) = "             +m1.entrySet().equals(m2.entrySet())); System.out.println("m1.values().equals(m2.values()) = "             +m1.values().equals(m2.values()));   would output :  m1.equals(m2) = true m1.keySet().equals(m2.keySet()) = true m1.entrySet().equals(m2.entrySet()) = true m1.values().equals(m2.values()) = false   This is caused by the fact that AbstractCollection (which HashMap$Values inherits from) does not overrides #equals().  Do you have an idea why this is so ? How to validate an email address in JavaScript Is there a regular expression to validate an email address in JavaScript? How do I increase the render distance? I have created a simple model here   When rendering it the end of it is cut off   How can I get the camera to render a longer distance? The new notice for protected questions looks like this:     Earn 10 reputation in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.  The phrasing of this notice leaves out a lot of info, and is incorrect in many cases:  In the case where the user has just created their account on the site (whether or not they have the association bonus of +100), the default 1 for signing up does count toward the required 10. The message implies that the user has to earn 10 more reputation for a total of 11 (or 111), while the actual requirement is 10 (or 110).  If the user just registered and started off with the association bonus, then later lost part of it (e.g. through bounties or making a downvoted post), earning 10 reputation is not enough to answer protected questions. According to the literal wording of the notice, earning 10 reputation is enough regardless of previous rep loss, but this is not the case.   The easiest fix that can be made, to at least fix part of the problem, would be to explicitly indicate that the association bonus does not count. This was implemented in the prior protected question notice in response to , but was omitted from the new notice. This omission  , and adding this back would remove that. Can we please fix this notice? I'm trying to prove that ${n \choose r}$ is equal to ${{n-1} \choose {r-1}}+{{n-1} \choose r}$ when $1\leq r\leq n$.  I suppose I could use the counting rules in probability, perhaps combination= ${{n} \choose {r}}=\frac{n!}{r!(n-r!)}$.  I want to see an actual proof behind this equation.  Does anyone have any ideas?