i'm building some program. apache guacamole (VNC tool) makes log in console. (it can be tweak for make log in file, but i won't) so, my program reads log in console and determine which user(id) accessed(connected) or leave(disconnected).  but it gives me "java lang nullpointer exception at line 19". so here is my code.  import java.util.*; import java.lang.*; import java.io.*;  class id {     public static void main (String[] args) throws java.lang.Exception     {     String connect    = "connect";     String disconnect = "disconnect";     String id;     int strindex, endindex; //mark start, end index      while(true){          String phrase = System.console().readLine();         if(phrase.equals(""))             continue;          if(phrase.contains(disconnect)){             if( (strindex=phrase.indexOf("- User ")) &gt; -1 )             strindex = strindex + 8;                 endindex = phrase.indexOf('"', strindex);         id = phrase.substring(strindex, endindex);          System.out.println(id);         System.out.println("disco\n");         //dockerfile_logout+pause;         }//islogout          else if(phrase.contains(connect)){             if( (strindex=phrase.indexOf("- User ")) &gt; -1 )             strindex = strindex + 8;                 endindex = phrase.indexOf('"', strindex);         id = phrase.substring(strindex, endindex);          System.out.println(id);         System.out.println("connected\n");         //dockerfile_login+start!        }//islogin      }//while }   }
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 find users by name I have a whole bunch of people I would love to follow or at least check out on Stack Overflow. I know them from places like Github as well as personal friends. However I am having a really hard time finding them even though I know e.g. their Gmail address and that they use OpenID via Gmail to login and their full name.   How come this is so painful? Note that I don't want to have to fuzz around with the data explorer just to find a friend of mine on Stack Overflow. What am I missing? Is it just not there or just not working properly? Does Earth really have two high-tide bulges on opposite sides? The bit that makes sense – tidal forces My physics teacher explained that most tidal effect is caused by the Moon rotating around the Earth, and some also by the Sun. They said that in the Earth and Moon system, the bodies are in freefall about each other. But that points on the surface of Earth, not being at Earth's centre of gravity, experience a slightly different pulls towards the Moon. The pull is a little greater if they are on the Moon's side, and slightly lesser if they are on the side away from the Moon. Once freefall is removed, on the Moon side this feels like a pull towards the Moon and on the the opposite side it feels like a repulsion from the Moon. This makes sense to me, and is backed up by other questions and answers here, like  and also  Phys.SE question. The bit that doesn't make sense – tidal bulges They also said that there are &quot;tidal bulges&quot; on opposite sides of the Earth caused by these forces. The bulges stay still relative to the Moon and Earth rotating through the bulges explains why we get two tides a day. They drew a picture like this one…  An image search for  finds hundreds of similar examples, and  from a scientist on Twitter. …But, if there is a tidal bulge on both sides of Earth, like a big wave with two peaks going round and around, how can an island, like Great Britain where I live, simultaneously have a high tide on one side and a low tide on the other? For example:   on the West coast  on the East  Two ports with tides 6 hours, or 180º apart. It's high tide at one while low tide at the other. But they are only  by road. Great Britain is much smaller than Earth. It's probably not even as big as the letter &quot;A&quot; in the word &quot;TIDAL&quot; in that picture.  To prove this isn't just Britain being a crazy anomaly, here is another example from New Zealand:     Two ports that are 180º (6 hours) apart, but separated by  through a national park. New Zealand, unlike the UK, is in fairly open ocean. I am a freelancer programmer and so far I have only worked on projects on Windows platform. I don't have much idea about OS X hardware. I am not looking for a very high end configuration but integrated development environment and one database server should just run fine. I have a Dell laptop i7 processor, 8 GB RAM, 1 TB HDD; I am fairly satisfied with the performance. I am mainly going to use it for app development and not for any rich graphics app development.  What are the minimum and recommended hardware requirements for Xcode development on OS X? Tweak showlabels/showkeys - wrap the label "No, I didn't see him" vs "Yes, I didn't see him" Bob didn't come to office today.  I was asked "Didn't you see Bob today?"  Should I say "Yes, I didn't see him today" or "No, I didn't see him today"? I am confused about the usage of the words like and unlike in sentences. Like and unlike make me confused because I see them being used everywhere almost interchangeably, and to make matters worse I even saw commas making difference in meaning.  Which of the following sentences is most correct, and least ambiguous?      Unlike Xbox, Playstation can't play Halo.     Playstation can't play Halo unlike Xbox can.     Playstation can't play Halo, unlike Xbox can.     Like Xbox, Playstation can't play Halo.     Playstation can't play Halo like Xbox can.     Playstation can't play Halo, like Xbox can.     Playstation can't play Halo unlike Xbox.     Playstation can't play Halo, unlike Xbox.     Playstation can't play Halo like Xbox.     Playstation can't play Halo, like Xbox.    In case you don't know what I actually wanted to say in those sentences: I'm trying to say that Playstation can't run the Halo video game and Xbox can run that game. I probably should have tried sentences with no brands but I can't imagine any meaningful sentences at this moment which contains like/unlike. Windows seems to have a length limit on file names when trying to delete, though it won't prevent those files from being created.  Our build process creates a number of temporary files (many build off of a WSDL) that run afoul of this limit.  Our ant script is somehow able to delete them when doing a clean, but sometimes I need to delete the workarea directory (where all the temp files go) without actually doing a full clean from ant.  This is the same errors , but the answers there don't really work for me as I'm dealing with a directory, not a file, and I don't always know what specific files or subdirectories are causing the problem.  And I'm trying to avoid any manual process (other than triggering a single command) to actually delete them.  If I try deleting the directory from Explorer I get the error   Cannot delete [file name]: The file name you specified is not valid or too long.   Specify a different file name   Trying Remove-Item in powershell gives the following error:  Remove-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. At line:1 char:12 + Remove-Item  &lt;&lt;&lt;&lt; -force -Recurse &lt;directory&gt;   Does anyone know of any tools or easy ways to get around this delete error without having to manually find the problem files and move/rename them? Solve the following system of equations  $ \begin{cases}  x_1^{'}(t)=x_1(t)+3x_2(t) \\  x_2^{'}(t)=3x_1(t)-2x_2(t)-x_3(t) \\  x_3^{'}=-x_2(t)+x_3(t)\end{cases} $.  First, I create the column vectors $X$ and $X^{'}$. Then the matrix $$A= \begin{bmatrix} 1 &amp; 3 &amp; 0  \\ 3 &amp; -2 &amp; -1 \\ 0 &amp; -1 &amp; 1  \\ \end{bmatrix} $$  Now, I find the eigenvalues, $-4,3,1$ and their corresponding eigenvectors $(-3,5,1)^T (-3,-2,1)^T (1,0,3)^T$.   I'm just not sure how to take it from here and solve the system of differential equations. I want a diagonal matrix $D$ so that I can read the solutions easy, but I'm not sure how to do it.  EDIT   Building on @Francisco 's answer, I'd have that:  $$X=c_1  (-3,5,1)^T  e^{-4t}   + c_2 (-3,-2,1)^T e^{3t} + c_3 (1,0,3)^T e^{t} $$.  But I believe this could be written in a simpler form. How to work with "FIFO" in C# .NET? Filter a Python list by predicate I would want to do something like:  &gt;&gt;&gt; lst = [1, 2, 3, 4, 5] &gt;&gt;&gt; lst.find(lambda x: x % 2 == 0) 2 &gt;&gt;&gt; lst.findall(lambda x: x % 2 == 0) [2, 4]   Is there anything nearing such behavior in Python's standard libraries?  I know it's very easy to roll-your-own here, but I'm looking for a more standard way. Image in a cell with a hyperlink Can anyone please give an example of why the following definition of $\displaystyle{\lim_{x \to a} f(x) =L}$ is NOT correct?:  $\forall$ $\delta &gt;0$ $\exists$ $\epsilon&gt;0$ such that if $0&lt;|x-a|&lt;\delta$ then $|f(x)-L|&lt;\epsilon$  I've been trying to solve this for a while, and I think it would give me a greater understanding of why the limit definition is what it is, because this alternative definition seems quite logical and similar to the real one, yet it supposedly shouldn't work. Recently I noticed that many people post .htaccess files here with:  &lt;IfModule mod_rewrite.c&gt;   Sometimes this even appears several times in the file! It obviously checks to see if mod_write is in fact enabled but the statements it protects are necesary to those sites anyway. So if the IfModule fails, the website is broken anyway.  Is there an advantage in having the &lt;IfModule mod_rewrite.c&gt; fail rather than the RewriteRule statements below it?  mod_write now is so essential and ubiquitous that I do not check for it anymore. Might this cause a vulnerability of some kind? I'd like to create a Categorized style in QGIS, classify with it data in a shapefile and then save the shapefile with the new categorized style. Is it possible? What is the life expectancy of a Wookiee? At lunch, my coworkers and I were discussing The Force Awakens, and started questioning Chewbacca's age.  A quick check of  and it says he is possibly about 230 years old as of Episode VII.  Following the  link on that page, Wookieepedia claims that they live to be 400 years old.  Do we know from canon what the average life expectancy of a Wookiee is? Assuming this is on the way, but having not seen it previously reported: I can't view myself from the sidebar, or anyone else by tapping them. View Self From Sidebar:   View Asker/Answerer:   View Commenter: Simplifying and evaluating $\cot 70^\circ+4\cos 70^\circ$ If string is stretched just by weight, where does the gravitational potential energy goes if only half is converted to elastic potential energy? If a spring is stretched by a weight of mass m, (so the extension is $\Delta x$) then $ k = \frac W{\Delta x} = \frac {mg}{\Delta x}$. So $ k\Delta x= mg $.  When the Spring is stretched by distance $\Delta x$ (by the weight) then it looses gravitational potential enegry. ($ \Delta GPE= mg\Delta x$)  But, when we calculate the change in elastic potential energy, We get  $ U = \frac 12 k(\Delta x)^2 $. Since $ k\Delta x = mg$, $U=\frac 12 mg\Delta x$  At, equilibrium we have no kinetic energy $E_k = 0$  Doesn't that violate Energy Conservation?  Where does the rest of lost GPE goes?  Here's a illustration How do I run a command before or after every command written in the console? The reply buttons in chat shouldn't reposition themselves on pinged messages