I'm trying to read in a list of words a file using BufferedReader and determine if any are duplicates, and if they are, to not print them.  I know that there is a SuperClass called "UniqueLineReader" that can check the occurrence of duplicate lines for you, and something else called Linked HashSet. However, I haven't learned either of these in class, so I'm trying not to use them.  Anyways, the e.getMessage() is printing "null", which I don't understand, because the file obviously isn't and I'm checking that it isn't. Do I have wrong placement of variables?   try {  inFile = new BufferedReader(new FileReader(inputName));  outFile = new PrintWriter(new FileWriter(outputName));   while((nextLine = inFile.readLine())!= null){     if(indexOf(nextLine) == -1){       insert(nextLine);        outFile.println(nextLine);}    else{      System.out.println(nextLine + " has been seen before!");        }     }    inFile.close();  }//try  catch(Exception e){  System.out.println(e.getMessage());  }//catch   My indexOf method:  private int indexOf(String newWord){  for(int i = 0; i &lt; numWords; i++){   if(arrayStrings[i].equals(newWord)){     return i;   } }  return -1;  }//indexOf   stacktrace  `java.lang.NullPointerException     at A2Q2.indexOf(A2Q2.java:58)     at A2Q2.removeDuplicateLines(A2Q2.java:79)     at TestA2Q2.main(TestA2Q2.java:10)
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?
How to make a file (e.g. a .sh script) executable, so it can be run from a terminal I have a script.sh file and type of this file is shellscript file. I want to make this file as application/x-executable file. How can I make it? Multiples of an irrational number forming a dense subset Name tikz pic as if it was a node I'm confused about tikz pics. I can freely define them without issue, and even add coordinates inside that will be available by name inheritance like (-A) as for example in \pic (S) at (0,0) {myPic}; \draw (S-A) -- ++(0,0);. This is all documented around p. 255 of the pgf manual.  However I don' understand why it is not possible to give a name to a pic like the one above if no coordinate is defined inside it. By default it would be great if it could behave like a normal node.  MWE:  \documentclass{minimal} \usepackage{tikz}  \tikzset{     myBlock/.pic = {         \node[draw,minimum width=1cm,minimum height=0.5cm] at (0,0) {};     },     myBlockNamed/.pic = {         \node[draw,minimum height=1cm,minimum width=0.5cm] (-m) at (0,0) {};     }, }  \begin{document} \begin{tikzpicture}     \pic () at (0,0) {myBock}; % can't give it a name     \pic (S) at (3,0) {myBlockNamed}; % can give it a name     \draw (S-A) -- ++(2,0); \end{tikzpicture} \end{document}   The underlying point is I'm working on a control blocs library (so that we can stop the chat below with @Alenanno). For example here is the definition of a math operator  \tikzset{     mySum background/.style = {         circle, minimum size=1.5em, fill=white,     },     mySum edge/.style = {         draw=black, circle, minimum size=1.5em, line width=.5pt,     },     pics/bOp/.style = {     code = {       \node [mySum background] {};       \foreach \t [count=\i] in {#1}{         \pgfmathsetmacro{\angle}{\i*90}         \node[anchor=center, font=\tiny] at (\angle:0.45em) {$\t$};       }       \node [mySum edge] {};     },   }, } Nautilus 3.6 doesn't have a status bar? In 12.04, Nautilus showed the amount of remaining space in the status bar , but as of 13.04 the status bar is gone.  gsettings set org.gnome.nautilus.window-state start-with-status-bar true   turned out "no such key".  Is there any way to bring back the status bar? Do I need a firewall for my desktop? I don't have a  router, but I mostly use my desktop for online shopping and torrenting. So, do I have to enable the firewall? I hope not, because I'm really dumb and I don't think I will be able to configure the firewall. Empty intersection and empty union I am running k-fold cross validation on my training data, and then choosing the best set of hyper parameters, re-training on the training data and testing on a new (unseen) testing data. I am getting the following testing results (results on the unseen data):  R^2: 1.000 Adj R^2: 1.000 RMSE: 0.081 MSE: 0.007 MAE: 0.045 MAPE: 0.058   Can $R^2$ have a value of 1.00 but RMSE have a  value of 0.081? Doesn't an $R^2$ of value 1 indicate no errors at all? Can $n!$ be a perfect square when $n$ is an integer greater than $1$?  Clearly, when $n$ is prime, $n!$ is not a perfect square because the exponent of $n$ in $n!$ is $1$.  The same goes when $n-1$ is prime, by considering the exponent of $n-1$. What is the answer for a general value of $n$?  (And is it possible, to prove without Bertrand's postulate. Because Bertrands postulate is quite a strong result.) Get attention to a new answer to an old question It happened to me that I found a solution to an older question. This question was commented by many people with comments like "very interesting, important, ..." such that I thought that my answer has also some value. My answer was the only one. It was upvoted and accepted by the asker. However, I assume, that very few of the "commentators" saw my answer, because the system does not inform automatically about new answers.   I think it would have been helpful for me and the commentators when they would get informed. I could achieve this by adding my own comment to their comments, because this triggers a system message. My question is: would this action be considered admissible or not? Are there some other possibilities? How long does it usually take for published articles to show up on Google Scholar? The title pretty much says it all - what's the typical delay with which Google Scholar indexes newly published articles? (Note I'm not talking about citations, but about the article showing up at all.)  Edit: the article in question went for over six months after being published (in a well-regarded Springer journal with its own Wikipedia page) without appearing on Google Scholar, until it received a citation, at which point it was added to Google Scholar almost immediately. One more motivation to write papers that get cited. :)  Edit 2: Another article in an even more mainstream journal took a little over seven weeks. Say, teamA score is 368 (369 to win), and teamB is batting at 368 (or 366). One run (or 3 runs) will make them win. The batsman hits the ball for a six, so score is 374 (or 372) which is more than the required 369. Even then the runs are counted for the team and for the batsman.  Now, on the last ball, suppose the batsman did not hit a six, but ran for a single : teamB will win. Can the batsmen continue to run until the ball is dead ?  Why will they want this ? (A) If batsman is at 98 and wants to reach a century. (B) If batsman has a career total of 9998 and wants to reach 1000 runs. (C) If the batsman has a very high record strike rate, and wants to remain at that record strike rate. (D) In the championship, this is the last quarterfinal, &amp; even winning will put teamB equal to teamC, and the better runrate at the end of the quarterfinals will enable them to move to the semifinals. (E) Many similar situations can happen.  So coming back to the question : Do the laws of cricket allow running on the last ball, even after winning ?  In most of the matches I have seen, after winning, the batsmen do not even look where the ball is and start celebrating the win. If the rules did not allow them to run more, then fine. If the rules did allow it, then has there been any game where they did run more ? I have often read that using RSA for encrypting bigger size plaintext is not good solution.  What I understand is that using RSA encrytion is best for small plaintext and most effective if it is smaller than 'bit size' of RSA. For instance, if I use RSA with a 2048 bit size then the plaintext that I can encrypt must be smaller than 256 bytes.  Is this true? What happens if the plaintext is bigger than 256 bytes? Why is there a problem with larger plaintext when performing RSA encryption? Reverse Cauchy Schwarz for integrals Let $f,g$ be two continuous positive functions over $[a,b]$ Let $m_1$ and $M_1$ be the minimum and maximum of $f$ Let $m_2$ and $M_2$ be the minimum and maximum of $g$ Prove that $$\sqrt{\int_a^bf^2 \int_a^b g^2}\leq \frac{1}{2}\left(\sqrt{\frac{M_1M_2}{m_1m_2}}+\sqrt{\frac{m_1m_2}{M_1M_2}}\right)\int_a^bfg$$  I can't make any significant progress on this one... Thanks for any hint. How do people understand astromech droids? Here is the dictionary I have  propertyList = {     "id":           "int",     "name":         "char(40)",      "team":         "int",     "realOwner":    "int",      "x":            "int",     "y":            "int",      "description":  "char(255)",      "port":         "bool",     "secret":       "bool",     "dead":         "bool",     "nomadic":      "bool",      "population":   "int",     "slaves":       "int", }   But when I print it out with "\n".join(myDict) I get this  name nomadic dead port realOwner secret slaves team y x population id description   I know that a dictionary is unordered but it comes out the same every time and I've no idea why. The Follow Questions and Answers feature is now live across the Network Proofs of AM-GM inequality Markdown source:  `http://google.com`  - `http://google.com`     - `http://google.com`   Rendered result:  http://google.com   http://google.com   http://google.com    Note that the third code span is a link. Adding a newline before the list item makes the link disappear. How do I document a module in Python? That's it. If you want to document a function or a class, you put a string just after the definition. For instance:  def foo():     """This function does nothing."""     pass   But what about a module? How can I document what a file.py does? How to get from Gatwick airport to Paddington? What's the most straightforward way to get from Gatwick airport to Paddington station in London using public transport?   I'm mostly interested in travel time &amp; general smoothness of the trip (e.g. buying just one ticket for the whole trip would be nice). Price is a secondary concern.