I'm answering a practice problem in java and I've created some code. However, when I run it I get an error and I'm not sure what the error means   I've tried re-reading the code, but I still don't know what the error is:    Exception in thread "main" java.lang.NullPointerException   at SugarSmashPlayer.setHighestScore(SugarSmashPlayer.java:42)   at Main.main(Main.java:7) Process finished with exit code 1    public class Main {      public static void main(String[] args) {         SugarSmashPlayer Jacob = new SugarSmashPlayer();         Jacob.setHighestScore(40,1);         System.out.println(Jacob.getHighestScore(1));     }  }   public class SugarSmashPlayer {     private int IDnumber;     public String screenName;     public int[] highestScore;     public int level;       public int getIDnumber() {         return IDnumber;     }      public void setIDnumber(int IDnumber) {         this.IDnumber = IDnumber;     }      public String getScreenName() {         return screenName;     }      public void setScreenName(String screenName) {         this.screenName = screenName;     }      public int getHighestScore(int level) {         if(level &gt; 10 || level &lt; 1) {             System.out.println("Invalid level");             return 0;         } else {             return highestScore[level-1];          }     }      public void setHighestScore(int highestScore, int level) {         if(level &gt; 10 || level &lt; 1) {             System.out.println("Invalid level");         } else {             if(level &gt; 2 &amp;&amp; this.highestScore[level-2] &gt; 99) {                 this.highestScore[level - 1] = highestScore;             } else {                 if (level == 1) {                     this.highestScore[level - 1] = highestScore;                 } else {                     System.out.println("You have not achieved a score of 100 or greater in the previous level");                 }             }         }     } }   I expected the highscore for level 1 to be set to 40 and when I gethighscore I expected it to display 40
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?
pdfTeX error (font expansion): auto expansion is only possible with scalable I run a guest ubuntu 12.04 on a host ubuntu 12.04, with VirtualBox, and the guest is much, much slower than the host (ALT+TAB takes 4-5 secs). I had a look around and I found contradicting opinions on VirtualBox versus VMware (free); so I thought to keep the former.   Both systems are updated, I installed the additions on the guest and I evenly split memory and video memory (64MB) between guest and host. I am running a Toshiba m200 laptop with 4GB ram and shared video memory. The host bios does not include a configuration option for machine virtualization. I have 2 cpus and I can't give them both to the virtual machine.  Is there anything I overlooked that could solve my problem?  Feel free to ask for more info, and thank you for any help.  EDIT Idling with the system monitor open the (single) guest cpu never gets below 55% and could rise to 80 - 90% just by moving the mouse around. Opening Firefox will cause the system monitor to show cpu usage 100% in the guest, while the host shows that both cpus are evenly working around 60%.  My cpu is Intel® Core™2 Duo CPU T5450 @ 1.66GHz × 2.  If this is not a configuration problem, does it mean my machine is too weak for virtualization? Complex polynomial and the unit circle Given a polynomial $ P(z) = z^n + a_{n-1}z^{n-1} + \cdots + a_0 $, such that   $\max_{|z|=1} |P(z)| = 1 $      Prove: $ P(z) = z^n $      Hint: Use cauchy derivative estimation    $$ |f^{(n)} (z_0)| \leq \frac{n!}{r^n} \max_{|z-z_0|\leq r} |f(z)| $$ and look at the function $ \frac{P(z)}{z^n} $     It seems to be maximum principle related, but I can't see how to use it and I can't understand how to use the hint. Often assignments (or even papers) have a word count limit. That is not a big deal when using Word, but I don't know how to do that using LaTeX. My solution has been so far to compile the document and then do a rough word count of my pdf file, sometimes even copying the contents of the pdf file and pasting in Word to get a mostly correct Word count.  Is there any tool (maybe even an online tool), package, script or software to do that directly from my .tex document and still get the right word count (i.e., ignore commands, equations, etc)? Does something like  exist for topological (eg. braided) circuits?   Alternatively, any ideas on how @ is getting  (or something similar)? When something gets wet, it usually appears darker. This can be observed with soil, sand, cloth, paper, concrete, bricks...  What is the reason for this? How does water soaking into the material change its optical properties? latex table border dont appear / to big / to small still working on that table. Here's my new question reguarding the table borders:  It appears, that i do something wrong setting boarders. Here is my code, and a screenshot:  \documentclass{article} \usepackage{multirow} % Used for the vertical cells \usepackage{rotating} % Used for the vertical cells  \usepackage{xcolor} % Used for cell-colors \usepackage{colortbl} % Used for cell-colors  \usepackage[a4paper]{geometry}% Used to set the pdf margins manually \newgeometry{left=2cm,bottom=0.1cm}  \definecolor{grey}{HTML}{F2F2F2} % Define grey for the cells \definecolor{red}{HTML}{FF0000} % Define red for testing  \begin{document} \scriptsize % Use a small font size  \begin{tabular}{|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0,6cm}|}  \cline{10-17}  \multicolumn{9}{|c|}{} &amp; \multicolumn{2}{p{\dimexpr (0.6cm)*2+2\arrayrulewidth+2\tabcolsep\relax}|}{\cellcolor{grey}Work to retired ratio} &amp; \multicolumn{4}{p{\dimexpr (0.6cm)*4+1\arrayrulewidth+2\tabcolsep\relax}|}{Health care sizing (per thousand)} &amp; \multicolumn{2}{p{\dimexpr (0.6cm)*2+1\arrayrulewidth+2\tabcolsep\relax}|}{\cellcolor{grey}Inverse dependency ratio}\\\cline{3-9}  \multicolumn{2}{|c|}{} &amp; \multicolumn{4}{c|}{\cellcolor{grey}Population (mio.)} &amp; \multicolumn{3}{c}{Workforce (1000)}  &amp; \multicolumn{2}{|c|}{\cellcolor{grey}} &amp; \multicolumn{2}{l|}{Physicians by} &amp; \multicolumn{2}{l}{Nurses by} &amp; \multicolumn{2}{|l|}{\cellcolor{grey}Old agers by}\\\hline  \multicolumn{2}{|c|}{} &amp; \begin{sideways}\cellcolor{grey}\parbox{4cm}{Overall}\end{sideways} &amp; \begin{sideways}\cellcolor{grey}\parbox{4cm}{Young age}\end{sideways} &amp; \begin{sideways}\cellcolor{grey}\parbox{4cm}{Working age}\end{sideways} &amp; \begin{sideways}\cellcolor{grey}\parbox{4cm}{Old age}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{Overall}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{Physicians (Proj: 2025)}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{Nurses (Proj: 2030)}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{\cellcolor{grey}Working age by Old age}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{\cellcolor{grey}Work force by Old age}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{Workforce}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{Working age}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{Workforce}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{Working age}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{\cellcolor{grey}1 physicians}\end{sideways} &amp; \begin{sideways}\parbox{4cm}{\cellcolor{grey}1 nurse}\end{sideways}\\\hline  \multicolumn{2}{|l}{USA} &amp; \multicolumn{4}{l}{\cellcolor{grey}} &amp; \multicolumn{3}{l}{} &amp; \multicolumn{2}{l}{\cellcolor{grey}} &amp; \multicolumn{4}{l}{} &amp; \multicolumn{2}{l|}{\cellcolor{grey}}\\\hline  1990/1 &amp; &amp; 248,6 &amp; 71,3 &amp; 146,1 &amp; 31,2 &amp; 127.500 &amp; 615,4 &amp; 1491,6 &amp; 4,68 &amp; 4,09 &amp; 4,83 &amp; 4,21 &amp; 11,70 &amp; 10,21 &amp; 50,7 &amp; 20,9\\\hline  1 &amp; 2 &amp; 3 \\\hline  \end{tabular}  \end{document}     On 1 the Top border of Population is not visible although i did used \\\cline{3-9}\cline{12-17} on that line.  In 2 both borders are pushed a bit to the right for no reason i can see.  And in 3 again the top borders are not visible despite using \cline{10-17} on that line. What did i do wrong?  Thanks! Biblatex + Xelatex does not display accents My question concerns the inductive step of the proof below. I've typed out the work I've done so far. If anyone has any suggestions on how to proceed thanks in advance.  If $n\in\mathbb{N}$, then $(1-\frac{1}{2})(1-\frac{1}{4})(1-\frac{1}{8})(1-\frac{1}{16})\cdots(1-\frac{1}{2^n})\ge\frac{1}{4}+\frac{1}{2^{n+1}}$.  $Proof.$ We use mathematical induction.  Base Case. For $n=1$ we see that $1-\frac{1}{2}\ge\frac{1}{4}+\frac{1}{4}$ since $\frac{1}{2}\ge\frac{1}{2}$.  Inductive Step. Let $n&gt;1$. Assume our statement is true for $n$. Now observe that  $\begin{align}(1-\frac{1}{2})(1-\frac{1}{4})(1-\frac{1}{8})(1-\frac{1}{16})\cdots(1-\frac{1}{2^{n+1}})&amp;\ge\\ \left((1-\frac{1}{2})(1-\frac{1}{4})(1-\frac{1}{8})(1-\frac{1}{16})\cdots(1-\frac{1}{2^{n}})\right)(1-\frac{1}{2^{n+1}})&amp;\ge(\frac{1}{4}+\frac{1}{2^{n+1}})(1-\frac{1}{2^{n+1}}) \end{align}$  My question is: How do we get from $\begin{align} (\frac{1}{4}+\frac{1}{2^{n+1}})(1-\frac{1}{2^{n+1}}) \end{align}$ to $\frac{1}{4}+\frac{1}{2^{(n+1)+1}}$?  Most of what I've attempted has led to tedious calculations that do not simplify to the desired result. I've also tried making the argument that $(1-\frac{1}{2^{n+1}})$ must be $\ge$ to $\frac{1}{2}$ but then I'm stuck with $\frac{1}{8}+\frac{1}{2^{(n+1)+1}}$... Is my approach incorrect here? Can anyone point me to a reference (preferably either something online or something a small liberal arts school would be likely to have in its library) that goes through a derivation of the minimum uncertainty wavefunction in more detail than in the Griffiths?  Edit I've moved the second part of my original question to a separate post: how to hide files from package explorer Given two coprime integers, find multiples of them that differ by 1 I'll describe the problem with an example.  Find integers $n$ and $m$ such that $n\cdot13 + m\cdot101 = 1$. This is the same as solving the equation $n\cdot13 \equiv 1 \pmod {101}$  I'm revising for a maths exam in a few days and it seems like a lot of the questions and examples rely on an ability to solve this type of problem. I can't seem to find a method in my notes, the solutions just get plucked out of thin air! What is a neat way of doing it on pen and paper with a calculator? I'm trying to identify a song by a female 80's pop group.   Here are the lyrics I remember:     It's the story of my life if you want to know   a play where everything is meant to be   you're the story of my life and I can't let you go When conducting a t-test why would one prefer to assume (or test for) equal variances rather than always use a Welch approximation of the df? It seems like when the assumption of homogeneity of variance is met that the results from a Welch adjusted t-test and a standard t-test are approximately the same.  Why not simply always use the Welch adjusted t? Is there a way to have coloured hyperref hyperlinks in the PDF, but have them print "as if" they were black? I like having my hyperref hyperlinks a different colour, so it's obvious that they are links. But when I print a copy of the PDF, I don't want the links to be coloured, because you can't click them, so it doesn't matter and it's distracting.  Other than just having a separate "for printing" version of the PDF where I turn off the hyperlinks, is there a way to have the printed version come out without the coloured links? How does JavaScript .prototype work? I'm not that into dynamic programming languages but I've written my fair share of JavaScript code. I never really got my head around this prototype-based programming, does any one know how this works? var obj = new Object(); obj.prototype.test = function() { alert('Hello?'); }; var obj2 = new obj(); obj2.test();  I remember a lot discussion I had with people a while back (I'm not exactly sure what I'm doing) but as I understand it, there's no concept of a class. It's just an object, and instances of those objects are clones of the original, right? But what is the exact purpose of this &quot;.prototype&quot; property in JavaScript? How does it relate to instantiating objects? Update: correct way var obj = new Object(); // not a functional object obj.prototype.test = function() { alert('Hello?'); }; // this is wrong!  function MyObject() {} // a first class functional object MyObject.prototype.test = function() { alert('OK'); } // OK  Also these  really helped a lot. Use LaTeX to produce Epub Polling the keyboard (detect a keypress) in python How can I poll the keyboard from a console python app?  Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.):     while 1:       # doing amazing pythonic embedded stuff       # ...        # periodically do a non-blocking check to see if       # we are being told to do something else       x = keyboard.read(1000, timeout = 0)        if len(x):           # ok, some key got pressed           # do something   What is the correct pythonic way to do this on Windows?  Also, portability to Linux wouldn't be bad, though it's not required. How do you greet multiple recipients in an e-mail? How do you greet multiple recipients in an e-mail?  Assuming they're both male, I just use "Sirs", but it seems a bit informal. Identical creatures entering the battlefield