My problem is that one specific activity in my app can't be launched for some reason, and it throws:   java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference  All other launching code that looks like this work fine, the problem is ONLY when I'm launching Player1. The class surely exists, and I can't understand what is the problem.  I'm launching an activity called Player1 from an activity called ChooseLevel. When some button is pressed, the call is:  Intent intent = new Intent(ChooseLevel.this, Player1.class); Bundle b = new Bundle(); b.putInt("game_level", 1); intent.putExtras(b); startActivity(intent); finish();   The logs show that the error is in: Player1.onCreate(Player1.java:50)  The code in line Player1:50 is:     @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_player1);      changeIndex = 0;     cards = new ArrayList&lt;Card&gt;(8);     score = (TextView) findViewById(R.id.score_text);     message = (TextView) findViewById(R.id.msg_text);     timer = (TextView) findViewById(R.id.timer);     timer.setText(String.valueOf(definitions.TIMER_START)); # LINE 50      Bundle b = getIntent().getExtras();      ...  }   When this launching code runs, I get this in my logs:  33:04.338 18302-18302/com... D/AndroidRuntime: Shutting down VM 01-18 10:33:04.338 18302-18302/com... E/AndroidRuntime: FATAL EXCEPTION: main            Process: com..., PID: 18302 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.../com....Player1}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference         at com....Player1.onCreate(Player1.java:50)     EDIT:   I found my answer, it had to do with some object that I had in my Player1.onCreate() method. In a wierd way, android-studio raised the exception regarding getClass(). If someone knows why this happend, please share :)
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?
I am trying to mimic the interesting proof from  to give a generating set of the ideal correspond to the $d$-uple embedding: We fix the notation $\Delta = \big\{ (\nu_0, \dots, \nu_n) \in {\mathbb{N}}^{n+1}_0 ~:~ \nu_0 + \dots + \nu_n = d \big\}$. The polynomial map is $\theta : k[y_\nu : \nu \in \Delta] \rightarrow k[x_0, \dotsc, x_n]$ given by $$ \theta ( y_\nu ) := x^{\nu_0}_0 \cdots x^{\nu_n}_n $$ and we know that ${\mathrm{ker}}~\theta$ is the ideal of the $d$-uple embedding, i.e., $\rho_d({\mathbb{P}}^n) = Z({\mathrm{ker}}~\theta)$ (cf. Exercise I.2.12 Hartshorne). Now let $W \leq k[y_\nu : \nu \in \Delta]$ denote the ideal $$ W := \Big\langle y_{\tau_1} y_{\tau_2} - y_{\tau^{\prime}_1} y_{\tau^{\prime}_2} ~:~ \tau_1, \tau_2, \tau^{\prime}_1, \tau^{\prime}_2 \in \Delta, \tau_1 + \tau_2 = \tau^{\prime}_1 + \tau^{\prime}_2 \Big\rangle $$ Clearly, $W \subseteq {\mathrm{ker}}~\theta$. Using the lemma in the above link, we need to produce a $k$-subspace $T \subseteq k[y_\nu : \nu \in \Delta]$ with the conditions $$ T + W = k[y_\nu : \nu \in \Delta], \hspace{.2in} \theta \lvert_{T} = {\mathrm{injective}} $$ After a few thoughts it seems reasonable to think of the following subspace as a candidate for $T$: First define the equivalence relation on $\Delta \times \Delta$ given by $(\tau_1, \tau_2) \sim (\tau^{\prime}_1, \tau^{\prime}_2)$ if $\tau_1 + \tau_2 = \tau^{\prime}_1 + \tau^{\prime}_2$. Let $\Omega \subseteq \Delta \times \Delta$ be a subset with a unique representative from each class of $\sim$. Now let $T$ be the $k$-span of the monomials $y^{\alpha_1}_{\tau_1} \dotsc y^{\alpha_r}_{\tau_r}$ (with the distinct elements $\tau_1, \dotsc, \tau_r \in \Delta$ and $\alpha_1, \dotsc, \alpha_r \geq 1$) such that $(\tau_i, \tau_j) \in \Omega$ for each $i \neq j$. Clearly, $\theta$ is injective if restricted to $T$. I got lost in the step : Each monomial $M$ of $k[y_\nu : \nu \in \Delta]$ satisfy $M \equiv b$ mod $W$ for some $b \in T$. Did I do anything wrong? A "failed to fetch" error occurs when apt-get update is run. How do I fix this? I am trying to install linux on my laptop, a Toshiba Satellite C6550-S5200. I did it once but something happened so I removed it then I had to destroy all data on hard drive so now I have nothing on it. Well I got a iso file burned to a CD and to a flash drive. With the flash drive I get.   SYSLINUX 4.06 EDD 4.06-pre7 Copyright (C) 1994-2012 H. Peter Anvin et al  With the CD it will start booting it but somewhere loading it up, the dots turn all orange and stay that way and my CD drive turns quiet.  Oh and some more info the images work because I tried loading them up on another pc and it worked just fine.  I manage to get the CD to boot I just had to let me pc boot up first then insert the CD and have it boot the CD then. Once I get done installing ubuntu it works fine but I have to leave the PC on 24/7 for if I turn it off the PC will freeze 5-10 seconds after booting back up no matter how I install it. What lies beyond the Sedenions Finding the contact point with SAT A term for words that change pronunciation with part of speech I'm talking about words like:   construct: CON-struct(n.), cun-STRUCT(v.) present: PRE-sent(n.), pre-SENT(v.) record: RE-cord(n.), ri-CORD(v.)   They are pronounced differently based on whether they are a noun or a verb.  Here are the terms I DON'T think would apply:   Homograph: same spelling, different meanings: for example, bark (the sound of a dog) and bark (the skin of a tree). Homophone: same pronunciation, different meaning: for example, to and two Homonym: same pronunciation and spelling, different meanings: for example: bank (river bank or savings bank) Heteronym: same spelling,  different pronunciations and meanings: for example bow (the front of a ship) and bow (a ranged weapon)   Bow is particularly interesting. It is a heteronym based on the two nouns I described. But in the sense of the body movement, the noun and the verb are pronounced alike (rhyming with wow), thus, not belonging to the category I've explained.  In fact none of the terms explained  satisfy my requirement.  I'm looking for the term for words that have same (or related at best, NOT different) meanings, same spelling and different pronunciation.  Specifically, different pronunciation depending on the part of speech. As against the words which have the same pronunciation in different parts of speech like bill, turn, case (or bigger ones like manoeuvre)  TL;DR:  Fill in the blank:     The noun and verb forms of construct are pronounced differently   because the word construct is a _____   or      The noun and verb forms of construct are pronounced differently   because they are _____s. Can you 'exit' a loop in PHP? I have a loop that is doing some error checking in my PHP code. Originally it looked something like this...  foreach($results as $result) {     if (!$condition) {         $halt = true;         ErrorHandler::addErrorToStack('Unexpected result.');     }      doSomething();  }  if (!$halt) {     // do what I want cos I know there was no error }   This works all well and good, but it is still looping through despite after one error it needn't. Is there a way to escape the loop? I use a cookieless sub domain static.example.com to serve all images, js, and css files. This static sub domain has as its root directory the same directory as the parent http://example.com. So static.example.com/index.php will result in calling the same file as http://example.com/index.php  Google has taken up indexing static.example.com and I need to stop this.  I can't modify robots.txt since it would apply to both domains. Webmaster tools allows "temporary" removal of a link, but this needs to be permanent.  I registered this static domain through google as a separate site from example.com, but this doesn't seem to buy me anything since I can't see a way to block crawling without using robots.txt - which would block it from the parent domain.  Any other ideas?  UPDATE  Found this conversation on   I am looking into whether it's possible to insert a META tag dynamically into the header of every page called on the static domain using php  CLARIFICATION  I am not putting any content on static.domain.com. There are NO webpages on it that are called - it only serves images. I have it redirecting to the same root directory as the main site for ease of coding image links (not every image is fed from the same image path).  Google got a hold of the static web root address - probably because .htaccess redirects to index.php if a file is missing and then crawled it. Now Google is showing the static version of the same pages with search results. Tiny navigation buttons and tags on responsive mobile I know it will be hard for you to tell on desktop because the resolution is so high, but the clickable text in the upper left, the icons on the upper right, and the navigation buttons at the bottom are all tiny. I have to squint to read the tags, I can't reasonably tap any navigation button except for Next without zooming, and selecting the achievements dialog, etc. is all very difficult. It seems to me that this would not be terribly difficult to change, so I am posting this feature request. I'm using a relatively large Samsung phone (Note 8), so I can imagine it would be worse on smaller phones.  Edit: I see from posted images that the responsive design on other phones looks nothing like mine. I'm wondering if it has something to do with the high resolution  where it thinks it is bigger than it is, or it's picking the wrong sizes because it's a tiny bit over some size threshold, in which case this would be a bug. True or False: there is a space $X$ such that $S^1$ is homeomorphic to $X\times X$ I had an exam this morning, one of the questions asked about the truth of the statement      There is a space $X$ such that $S^1$ is homeomorphic to $X\times X$.   I said that this was false and this was my reasoning... was I correct? (Note, an earlier part of the question asked me to prove $\pi_1(Y\times Z)=\pi_1(Y)\times\pi_1(Z)$, I took this as a hint.)  Suppose for the sake of contradiction that such an $X$ exists. Then $\Bbb{Z}\cong G\times G$ where $G\cong\pi_1(X)$. Let $\Phi$ be the isomorphism.  Let $\Phi(1)=(g_1,g_2)\in G\times G$. Then at least one of $g_1,g_2$ is nonzero, since $\Phi(0)=(0,0)$ (the identity on $G\times G$, and $\Phi$ is injective). Without loss of generality $g_1\ne 0$. Then which element $n\in\Bbb{Z}$ has $\Phi(n)=(kg_1,0)$? Since $$kg_1=\underbrace{g_1+\dots +g_1}_k\in G,$$ and $\Phi$ is surjective, such an $n$ should exist. But this is not possible since $\Phi(n)=(kg_1,0)$ implies (since $\Phi$ is a homomorphism) that $kg_1=ng_1$ and $ng_2=0$, and since $k$ was arbitrary and this need not hold if $k\ne 0$. Best books for mathematical background? What are the best textbooks to read for the mathematical background you need for modern physics, such as, string theory?  Some subjects off the top of my head that probably need covering:   Differential geometry, Manifolds, etc. Lie groups, Lie algebras and their representation theory. Algebraic topology. I am in the process of creating a LaTeX template for a conference submission, and up until now I've been working only with the anonymous submissions. Now I need to create the "camera-ready" version, which means I need to add authors to the document.   The template is based on article.cls, with some tweaks to meet the font and formatting specifications. The following image contains the examples from the Word template for the conference:    Basically, I need to be able to bold the author's name (which could I suppose be done manually in the document rather than in the template) and more importantly: divide the authors into two columns, with an optional centered last column with an odd number of authors. The font size of the author block corresponds to my \LARGE defined in the class file.  Are there any packages that facilitate this type of conditional formatting, either in a document, or in a .cls file? How can I use those packages to achieve the formatting I require? How is it possible to use the GNU find command to match several file types at a time (one search command)?  The man page says:  -type c     File is of type c:     b      block (buffered) special     c      character (unbuffered) special     d      directory     p      named pipe (FIFO)     f      regular file     l      symbolic link; this is never true if the -L option or the -follow            option  is in  effect,  unless  the  symbolic link is broken.  If            you want to search for symbolic links when -L is in effect, use            -xtype.     s      socket     D      door (Solaris)   and I want to search for files (f) and symbolic links (l) and pipe it to another process. How can I search for both at the same time?  I have tried  find -type fl | … find -type f -type l | … find -xtype f -type l | …   I know a workaround would be to use a subshell  (find -type f; find -type l) | …   but I just want to know if it is possible. This may be a simple question, but how do I use files starting with "-" with command line programs?   For example,  I am trying to use pdfgrep on a file named -2013-01-01.pdf but it complains that there are no options defined for 2, 0, 1, 3 and so on.  Changing the filename to something that does not start with "-" solves it, but this is not an option since the files aren't created by me. I simply want to check for a specific change I know is coming. How to add greek polytonic with setxkbmap I want to add greek polytonic keyboard layout under Lubuntu (so in LXDE). I already realized there is no easy tool to do it with the graphic interface, so I need to use setxkbmap executing something the like of:  setxkbmap pl,gr   Now, how to make setxkbmap set the greek polytonic variant? How to chat to all I very rarely see chats too all and don't know how to do it myself. Normally it's SHIFT + ENTER The following hotkeys have been tried: - SHIFT + ENTER - CTRL + ENTER - ALT + ENTER Fantasy book where a young prince becomes a mage When I was younger (11-12 years old, so the early 2000s) I once read a story where a young boy, who may have been either a young prince or a squire of some sort, is recruited by a wizard and taken to a city to train as a mage.  I seem to remember him living in dorms with the other children at this school, until he gets into difficulty with another of the boys in the dorm. He is kicked out of the dorms and ends up living above a blacksmith shop (I think).  I remember it being the first book in a series of books of which there were about 3 out at the time. I think one of the stories was about the boy going to a tower to do something or other.  Does anyone have any idea what this book series is? I haven't been able to find it for years now but it was a story I really loved. Why are the number of false positives independent of sample size, if we use p-values to compare two independent datasets? If I run the R code below, it will generate two independent vectors then test them to see if they are related in some way (i.e. p-value &lt; 0.05).  If I repeat this 1,000 times, then 50 of these (5%) will have a false positive, with a p-value &lt; 0.05. This is a type 1 error.  If we increase sampleSize to 1000, or even 100,000, the results are the same (5% false positives).  I am struggling to understand this, as I would have thought that if we collected enough samples, the chance of a false positive would drop towards 0 (just like correlation).  So, I guess my question is: "How is it possible that the number of false positives, based on p-values generated from comparing two independent datasets, be independent of sample size?".  # R code to demonstrate that with a large dataset, we can still  # get significant p-values, purely by chance.  # Change this to 1000, and we still get the same number of false positives (50, or 5%). sampleSize = 20  cat("Sample size:",sampleSize,"\n")  set.seed(1010093) n=1000 pValues &lt;- rep(NA,n) for(i in 1:n){     y &lt;- rnorm(sampleSize)     x &lt;- rnorm(sampleSize)     pValues[i] &lt;- summary(lm(y ~ x))$coeff[2,4] } # Controls false positive rate fp = sum(pValues &lt; 0.05) cat("Out of ",n," tests, ",fp," had a p-value &lt; 0.05, purely by by chance.\n",sep="")  ----output---- Running "true positives - none.R" ... Sample size: 1000  Out of 1000 tests, 52 had a p-value &lt; 0.05, purely by by chance. Sort on a string that may contain a number I need to write a Java Comparator class that compares Strings, however with one twist.  If the two strings it is comparing are the same at the beginning and end of the string are the same, and the middle part that differs is an integer, then compare based on the numeric values of those integers.  For example, I want the following strings to end up in order they're shown:   aaa bbb 3 ccc bbb 12 ccc ccc 11 ddd eee 3 ddd jpeg2000 eee eee 12 ddd jpeg2000 eee   As you can see, there might be other integers in the string, so I can't just use regular expressions to break out any integer.  I'm thinking of just walking the strings from the beginning until I find a bit that doesn't match, then walking in from the end until I find a bit that doesn't match, and then comparing the bit in the middle to the regular expression "[0-9]+", and if it compares, then doing a numeric comparison, otherwise doing a lexical comparison.  Is there a better way?  Update I don't think I can guarantee that the other numbers in the string, the ones that may match, don't have spaces around them, or that the ones that differ do have spaces. Remove blank attributes from an Object in Javascript