I am doing a simple multiplayer socket.io tic tac toe game. So far everything is working, however, when I try to rotate the screen I am getting a null pointer exception error. I have two override methods to save and restore the values of my player turn's boolean value.   When I try to directly set the value like this player1.setMyTurn(savedInstanceState.getBoolean("playerTurn")) It gives me a null pointer exception.   Does anyone know why?  @Override protected void onSaveInstanceState(Bundle savedInstanceState) {     super.onSaveInstanceState(savedInstanceState);     savedInstanceState.putBoolean("playerTurn", player1.isMyTurn()); }  @Override protected void onRestoreInstanceState(Bundle savedInstanceState) {     super.onRestoreInstanceState(savedInstanceState);     player1.setMyTurn(savedInstanceState.getBoolean("playerTurn")); //this seems to cause the issue }   Error:  E/AndroidRuntime: FATAL EXCEPTION: main               Process: com.twochicken.multiplayertictactoe, PID: 8612               java.lang.RuntimeException: Unable to start activity ComponentInfo{com.twochicken.multiplayertictactoe/com.twochicken.multiplayertictactoe.MainActivity}: java.lang.NullPointerException                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)                   at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738)                   at android.app.ActivityThread.access$900(ActivityThread.java:135)                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)                   at android.os.Handler.dispatchMessage(Handler.java:102)                   at android.os.Looper.loop(Looper.java:136)                   at android.app.ActivityThread.main(ActivityThread.java:5017)                   at java.lang.reflect.Method.invokeNative(Native Method)                   at java.lang.reflect.Method.invoke(Method.java:515)                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)                   at dalvik.system.NativeStart.main(Native Method)                Caused by: java.lang.NullPointerException                   at com.twochicken.multiplayertictactoe.MainActivity.onRestoreInstanceState(MainActivity.java:416)                   at android.app.Activity.performRestoreInstanceState(Activity.java:916)                   at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1138)                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)                    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738)                    at android.app.ActivityThread.access$900(ActivityThread.java:135)                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)                    at android.os.Handler.dispatchMessage(Handler.java:102)                    at android.os.Looper.loop(Looper.java:136)                    at android.app.ActivityThread.main(ActivityThread.java:5017)                    at java.lang.reflect.Method.invokeNative(Native Method)                    at java.lang.reflect.Method.invoke(Method.java:515)                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)                    at dalvik.system.NativeStart.main(Native Method)
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?
Some vertices don't move along with the rig Question is :     Prove that the polynomial $p(x)=x^4-4x^2+8x+2$ is irreducible over the quadratic field $F=\mathbb{Q}(\sqrt{-2})$. [Hint : first use the method of proposition $11$ for the U.F.D $\mathbb{Z}[\sqrt{-2}]$(cf.Exercise $8$, Section $8.1$) to show that if $\alpha \in \mathbb{Z}[\sqrt{-2}]$ is a root of $p(x)$ then $\alpha$ is a divisor of $2$ in $\mathbb{Z}[\sqrt{-2}]$ . Conclude that $\alpha$ must be $\pm 1,\pm \sqrt{-2}$ or $\pm 2$ and hence show that $p(x)$ has no linear factor over $F$. Show similarly that $p(x)$ is not the product of quadratics with coefficients in $F$.]   What I have done so far is :  Suppose $\alpha \in\mathbb{Z}[\sqrt{-2}]$ is a root of $p(x)=x^4-4x^2+8x+2$ we would then have :  $p(\alpha)=\alpha^4-4\alpha^2+8\alpha+2=0\Rightarrow 2=\alpha(-\alpha^3+4\alpha-8)$  i.e., $\alpha$ is a divisor of $2$ in $\mathbb{Z}[\sqrt{-2}]$.  so, I have used the method of proposition $11$ for the U.F.D $\mathbb{Z}[\sqrt{-2}]$(cf.Exercise $8$, Section $8.1$) to show that if $\alpha \in \mathbb{Z}[\sqrt{-2}]$ is a root of $p(x)$ then $\alpha$ is a divisor of $2$ in $\mathbb{Z}[\sqrt{-2}]$  I do not understand why does he mentioned that $\mathbb{Z}[\sqrt{-2}]$ is U.F.D and all... I do not use that at all... It is unnecessarily confusing me or i am unnecessarily getting confused.. hint is actually misleading me :(  Now, I have to prove that $\alpha$ must be $\pm 1,\pm \sqrt{-2}$ or $\pm 2$  i.e., suppose I have $2=ab$ in $\mathbb{Z}[\sqrt{-2}]$ then, $N(2)=N(ab)\Rightarrow 4=N(a)N(b)$   i.e.,$N(a)=1\text{ or }2\text{ or } 4$ i.e., $p^2+2q^2=1\text{ or }2\text{ or } 4$ for $a=p+\sqrt{-2}q$   $p^2+2q^2=1\Rightarrow p=\pm 1 \Rightarrow a=\pm 1$ $p^2+2q^2=2\Rightarrow q=\pm 1\Rightarrow a=\pm\sqrt{-2}$  $p^2+2q^2=4\Rightarrow p=\pm 2\Rightarrow a=\pm 2$    Once I prove that those are the only divisors then I would consider :    $p(1)=(1)^4-4(1)^2+8(1)+2\neq 0$ $p(-1)=(-1)^4-4(-1)^2+8(-1)+2\neq 0$ $p(\sqrt{-2})=(\sqrt{-2})^4-4(\sqrt{-2})^2+8(\sqrt{-2})+2\neq 0$ $p(-\sqrt{-2})=(-\sqrt{-2})^4-4(-\sqrt{-2})^2+8(-\sqrt{-2})+2\neq 0$ $p(2)=(2)^4-4(2)^2+8(2)+2\neq 0$ $p(-2)=(-2)^4-4(-2)^2+8(-2)+2\neq 0$   So, no divisor of $2$ is a root..  Thus $p(x)$ do not have a root in $\mathbb{Z}[\sqrt{-2}]$  suppose I have something like :  $$x^4-4x^2+8x+2=(x^2+ax+b)(x^2+cx+d)=x^4+(a+c)x^3+(b+d+ac)x^2+(ad+bc)x+bd$$  But then, $bd=2\Rightarrow \text { b,d  are  a divisors of 2 in $\mathbb{Z}\sqrt{-2}$}$  But then we have seen that only divisors of $2$ in $\mathbb{Z}\sqrt{-2}$ are $\pm 1,\pm \sqrt{-2}$ or $\pm 2$  So, only possibilities are   $x^4-4x^2+8x+2=(x^2+ax\pm 1)(x^2+cx\mp 2)$ $x^4-4x^2+8x+2=(x^2+ax\pm \sqrt{-2})(x^2+cx\mp \sqrt{-2})$   But these are not possible...  This only tells that $p(x)$ is irreducible in $\mathbb{Z}[\sqrt{-2}]$ but then how do i show this is irreducible in $\mathbb{Q}(\sqrt{-2})$ I was expecting gauss lemma to help but it only works for integers and rationals...  So, please help me to clear this..  Thank you...   P.S : Proposition $11$ is Rational root theorem and Exercise $8$ is that ring of integers of $\mathbb{Q}(\sqrt{-2})$ is an Euclidean domain. Can noindex tags on several pages affect the overall SEO or ranking on Google? Some SEO Gurus assured me that noindex attributes are good to devalue the unimportant pages.   When I asked in the moz Q and A, they're quite sure that having noindex on the bulk of the articles on the website can harm overall SEO ranking.   Which is true? How to store and preserve lots of data? I have many DVDs with movies and games, they are getting old and dusty, some of them are damaged. And I have more than 300 GB of general files in my PC. I want to store and preserve all of my data and keep them for a long long time.  I want to know what is the best and more reliable storage media that I should use and... I can buy. I will copy all of my DVDs to a new media and throw all of my DVDs away. It will take a very smaller physical space.  I think that everything that I need to store is currently 800 GB.  I do not like optical discs, because they are fragile and I have lost many CDs and DVDs. Hard drives would be good, but they can suddenly stop working, and it is very expensive to recover data from a broken hard drive.  Other questions: How often will I have to copy the files to a new storage media? Is it good idea to have another copy of each file stored in another storage media?  Edit: If I put all of the movies and games in a HDD, if the HDD stops working, I will lose everything. This is how valuable they are for me: If I lose 10% of them, I will not cry, because I can get new ones, but if I lose 90%, it will be a disaster.  Edit 2: I do not think that that online storage is reliable even if I pay for it, because they may be closed or may get bankrupt. They are not from my country and it would be difficult to get the files back. How to do research in two very different fields? I need your help with references. I have 1 main reference section, and I want to include a second list of references as an appendix. For the main reference I use:  \newpage  \bibliographystyle{plainnat}  \bibliography{library}   The problem is that I don't know how to include the second list using a different bib file, and then calling the function \nocite{*} to show every sources inside the file.   I have the appendix part workout. I need your help to design the function to call the second bibliography, and that does't interfere with the main reference:   \newpage  \appendix  \section{Other Sources} \label{app:ReferencesB}   In addition, I will prefer that the word References is not shown after Other Sources.  Thank you so much!! Post Problem Analysis - Rod in a cylindrical time varying magnetic field? A metal rod of length $l$ is placed (as shown in figure) in a cylindrical time varying magnetic field. Find the potential difference across it.   My answer:  As electric fields as forming circles around the centre with magnitude $$\frac12r\frac{dB}{dt}$$ whose magnitude is same along any chord at a fix distance from centre: $$\Delta V=E.l=\frac12r\frac32at^{\frac12}.l$$ $$\Delta V=\frac34arlt^{\frac12}$$  My question: Is $\Delta V =V_M-V_N$ or $\Delta V=V_N-V_M$ $\bf OR$ equivalently which side is at high potential?  Possible    $(i)$ As Field lines are circular from $M$ to $N$, $M$ must be high potential. $(ii)$ As this field line apply a force on electrons- in the rod- towards left, then $M$ must have excess $e^-$ and $N$ must have deficiency; so $N$ would be high potential as $M$ is $(+)$ and $N$ is $(-)$. Linear Matrix Inequality of a matrix $T$ with $\| T \|_2 < \rho$ Assume $T \in \mathbb{R}^{d\times d}$. Let $\rho(T)$ be the spectral radius of $T$ and $\rho \ge 0$. Prove that  $\rho(T) &lt; \rho$ if and only if there exists a $P \succ 0$ satisfying $T^TPT - \rho^2 P \prec 0$.  I can prove the Necessity: If $P = I$, for any $x \in \mathbb{R}^d$,   \begin{equation} x^T T^T P T x - \rho^2 x^T P x = \| Tx \|^2 - \rho^2 \| x\|^2 &lt; 0 \end{equation} so $T^T PT - \rho^2 P \prec 0$  I get stuck in proving the Sufficiency. Started new job. Rollover previous employer 401k to new 401k, IRA or Roth IRA? In Book 1, Artemis et al escaped from the time stop by drugging themselves to sleep.  In the same time stop, Julius Root "accidentally" plugged Briar Cudgeon with a tranquilizer dart.  Cudgeon fell asleep, but did not disappear from the time stop.  Why not? Is it wasteful to use a heating element, instead of doing useful work? Consider a computer CPU consuming electrical energy to perform calculations and consequently emitting heat.  Assumption: That a CPU consuming x Watts of power, emits the same amount of heat as an incandescent heating element which consumes the same amount of power.  The rest of the question assumes that this is true: the energy has to go somewhere, and I can't see that the outcome of the calculations counts as "somewhere".  I've long repeated the claim that "wasteful" appliances such as incandescent lightbulbs, over-full kettles, computers left running, etc. are not wasting power if we make the assumptions:   the appliance is in a room which we aim to maintain at above a certain temperature, warmer than the external temperature (cf a home in winter) the room leaks heat to the outside faster than the "wasteful" appliances emit heat. the room contains an electric heater the electric heater is regulated by a thermostat   In these circumstances, I think (?), if a light bulb produces excess heat, its only effect is to cause the thermostat to switch off sooner, so what energy you've "wasted" in the light bulb, is "saved" at the heater.  I don't think that's controversial.  But my question is:   If a CPU does useful work, and emits all the input energy as heat as a side effect But a heating element emits the same heat, without doing useful work Is it therefore wasteful to use heating elements? Is it more efficient to (for example) run  on a CPU, to get "free" computation as a side-effect of heating?   One reason to heat a room with a heating element, rather than with CPUs, is that the heating element is much cheaper to produce. But ignoring the initial cost of the hardware, would a "heater" made out of 20 CPUs, each running at full capacity and consuming 50W each, output less thermal heat than a 1KW element that does nothing else useful?  To be useful, of course, the CPUs would need to output the result of their computations, which would account for a tiny amount of energy. Let's assume that's negligible.  I'm sure there's a flaw in there somewhere; probably that the assumption above is false. What have I missed? Why does the review system disable the "First Posts" and "Late Answers" if I reached daily upvote limit? I was reviewing on , and I faced a weird thing. I can review "Close Votes", "Low Quality Posts", and "Suggested Edits" if I reached my daily vote limit, but I can't for "First Posts" and "Late Answers". Why?    If they just deserve an upvote/downvote then they should not include in the review system. But if we can improve them through leaving comments and by editing the posts then why can't we access them? What is the difference between "var=${var:-word}" and "var=${var:=word}"? Uncertainty modeling for samples I have instances of data that are composed of 6 attributes. Each attribute takes values between 1-10. Any instance has a utility calculated by some utility function:  Example: {1,1,2,5,5,2} , utility = 0.89  In some readings for these attribute values, undefined values may appear in the instance, I mark them as question mark '?'  Example: {1,1,?,5,?,2}  These question marks represents uncertainty in the instance.  How can I model this uncertainty in a statistical or mathematical way ?   Thanks Speed of light travel Dragon souls not activating new words So if I understand correctly you can learn new words and the souls will activate these words. I just killed a dragon and when it died it looked like I absorbed the soul but it didn't unlock any of the words I have.   I noticed some dragons actually have a name so do certain dragons unlock certain words? What's the difference between a method and a function? Can someone provide a simple explanation of methods vs. functions in OOP context? How should a bot earn enough reputation to perform the actions necessary for that bot? Baking lots of bread - keeping a yeast starter I just upgraded from Ubuntu 10.04 to Mint 16. The installer did not detect my existing RAID 1 array, and I can't access it anymore.  My drives are:  SDA - First RAID Disk SDB - Second RAID Disk SDC - Non-RAID where the OS is installed.   The disks are full of stuff I want to keep, so I don't want to create a new RAID.   On the old machine, the two raid drives became MD0, which was a physical disk for Logical Volume Management.  How do I put the two halves together and get it to mount at boot? (I know how to mount single drives and how to add fstab entries for single drives, but the part I don't know is how to mount the two drives as one disk as a RAID.