I'm newbie at java and have no idea how to repair my simple code. I need to create a person, using another class, in this case, "PersonBuilder".  The problem is, that I've got NullPointerException :X      Exception in thread "main" java.lang.NullPointerException       at RevStr$PersonBuilder.withAge(RevStr.java:64)       at RevStr.main(RevStr.java:75)   There is class Person  public class Person{ private String name; private String surname; private int age; private String pesel;  // ** AKCESOR I MUTATOR ** // public void setName(String name){     this.name = name; } public void setSurname(String surname){     this.surname = surname; } public void setAge(int age){     this.age = age; } public void setPesel(String pesel){     this.pesel = pesel; }  public String getName(){     return this.name; } public String getSurname(){     return this.surname; } public int getAge(){     return this.age; } public String getPesel(){     return this.pesel; }   }  and PersonBuilder      public static class PersonBuilder{     private Person p;      public Person build(){     return p;     }  public PersonBuilder withName(String name){     p.setName(name);     return this; } public PersonBuilder withSurname(String surname){     p.setSurname(surname);     return this;  } public PersonBuilder withAge(int age){     p.setAge(age);     return this; } public PersonBuilder withPesel(String pesel){     p.setPesel(pesel);     return this; } }   Main method  public static void main(String[] args) { Person p = new PersonBuilder().withAge(25).withName("A").withSurname("B").withPesel("11224").build(); System.out.println(p); }   I assume that the problem could be repaired quickly and simply, but I can't see the solution right now :X
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?
Network-wide HTTPS: It's time Difference between == and === in JavaScript Many spells have "At higher levels" that provides for more targets or more damage.  For example Magic Missile can be cast as a second level spell and shoot 4 missiles instead of it's 3 as a first level spell.  Can a spell without that verbiage, such as Firestorm be cast in higher level slots for the same effect as the lower level spell? Potential difference across a zero resistance wire So I started off with electrostatics and everything seemed nice and mathematical and justified and then "DC circuits" happened!  I just cannot understand the model of electron flow in electrical circuits.  Here are my specific doubts-:  1) If potential difference across a tiny cross section of conducting wire is zero, then why on earth does electron flow across that cross section at all? Never mind potential difference across the whole circuit.   2) Is there a constant electric field across a wire connected to a battery? If yes then how is potential difference across a zero resistance wire constant?   Shouldnt it be increasing?  Doesnt it violate ohms law?  If no,  then why do electrons flow at all?  Please take time to consider these doubts and relieve me of my frustration.  I havs searched through the net for this but every answer seems like beating around the bush.  All of the 4 books I have consulted do not address these facts to my satisfaction.   Frankly I think nobody understands this. I have a  beautiful  inequality, but I can only prove part of cases. Given any positive real numbers $a,b,c$, we have   $$(a^{2}+2)(b^{2}+2)(c^{2}+2)\geq 9(ab+bc+ca)$$  How can we prove this statement? Prevent browser caching of AJAX call result It looks like if I load dynamic content using $.get(), the result is cached in browser.  Adding some random string in QueryString seems to solve this issue (I use new Date().toString()), but this feels like a hack.   Is there any other way to achieve this? Or, if unique string is the only way to achieve this, any suggestions other than new Date()? I can join the server and sometimes the map would load for the server but i would just fall through the map and it would dissconect me and say timed out, any solutions? What is the correct formula for gravitational time dilation for a satellite in a circular orbit? In the Wikipedia article on  I see two formulae for the gravitational time dilation. One contains $\sqrt{1 - r_0/r}$ but the other $\sqrt{1 - 1.5 r_0/r}$. What formula should I use to calculate the time dilation due to gravity inside a satellite? The speed induced time dilation is of course just special relativity.  With the first of these two formulas I can perfectly reproduce the graphs on time dilation as a function of $r$,  I find that the two contributions to time dilation cancel at 1.5 Earth radii, all numbers are OK... But why not the second formula? Sum of the series $\sum _{ r=1 }^{ \infty }{ \frac { { r }^{ 3 } }{ r! } } $ "Who wants ice-cream?" — Should I say "(not) I" or "(not) me"? With the enthusiastic question of "Who wants ice-cream?", what is the more correct response?         (Not) I.   (Not) me.      Neither response is a sentence. The first response of "(not) I" sounds stuffy, like it should be followed with an indignant sniff. The second sounds like American idiom and acceptable for casual speech.    What do you say? Suggested Edits Dashboard doesn't agree with Suggested Edits view What is the best way(s) to fake function overloading in Javascript?   I know it is not possible to overload functions in Javascript as in other languages.  If I needed a function with two uses foo(x) and foo(x,y,z) which is the best / preferred way:   Using different names in the first place Using optional arguments like y = y || 'default' Using number of arguments Checking types of arguments Or how? Are Jedi bound by a code of honor or morals? In The Phantom Menace alone, Qui-Gon (and in part Obi-Wan) are quick to use Jedi mind tricks and not only gamble but also cheat at it. They seem happy with this fact.  Do Jedi have morals and ethics, or a code of honor? An example of a group such that $G \cong G \times G$ I was trying to find an example such that $G \cong G \times G$, but I am not getting anywhere. Obviously no finite group satisfies it. What is such group? I have a larger, external monitor connected to my MacBook Pro and have arranged it such that the dock is in the external monitor (via System Preferences > Displays > Arrangement, by dragging the white bar to the larger screen). This works fine, except for the fact that every now and then, the dock will suddenly shift back to my MacBook screen, but when I open up Displays to change this back, the white bar is still on the external monitor. So I have to drag it to the smaller screen, and then drag it back to the external monitor.   It's a minor issue, obviously, but I've noticed that it has been happening more and more frequently and it's getting quite annoying. Perhaps there's something I've been doing unintentionally for this to happen?   I'm using Mavericks, 10.9.5. Prove that $\sin(2A)+\sin(2B)+\sin(2C)=4\sin(A)\sin(B)\sin(C)$ when $A,B,C$ are angles of a triangle Prove that $\sin(2A)+\sin(2B)+\sin(2C)=4\sin(A)\sin(B)\sin(C)$ when $A,B,C$ are angles of a triangle   This question came up in a miscellaneous problem set I have been working on to refresh my memory on several topics I did earlier this year. I have tried changing $4\sin(A)\sin(B)\sin(C)$ to  $$4\sin(B+C)\sin(A+C)\sin(A+B)$$ by making substitutions by reorganizing $A+B+C=\pi$. I then did the same thing to the other side to get $$-2(\sin(B+C)\cos(B+C)+\sin(A+C)\cos(A+C)+\sin(A+B)\cos(A+B))$$ and then tried using the compound angle formula to see if i got an equality. However the whole thing became one huge mess and I didn't seem to get any closer to the solution. I am pretty sure there is some simpler way of proving the equality, but I can't seem to figure it out. Maybe there is a geometric interpretation or maybe it can be done using just algebra and trig. Any hint's would be appreciated (I would prefer an algebraic approach, but it would be nice to see some geometric proofs as well) Ways to Install and uninstall programs in deb format I need rules to drop some malicious Apache connections I drop all traffic on ports except on 80 for my web server.  I have some rules like this on iptables:  iptables -A INPUT -p tcp -m tcp --dport 80 -m string --string "cgi" --algo bm --to 1000 -j DROP   Someone who have more can share? I know always the bad hackers still updating, but some of them always begin with the same code. I need to Drop the connection based on some criteria. Here are some Apache log (I remove ips but each atack come from the same):  Attack 1: This I don't know what are trying to do, but make it 50 times from the same ip  GET / HTTP/1.1  301 224 -   Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22 GET / HTTP/1.1  302 3387    -   Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22   Attack 2: this try to get information about server only.  GET / HTTP/1.1  301 224 http://myip:80/ Go-http-client/1.1 GET / HTTP/1.1  302 3228    http mywebsite  Go-http-client/1.1 GET /es/ HTTP/1.1   200 40947   https mywebsite Go-http-client/1.1   Attack 3: they try get access to a login page vulnerability  GET /userlogin/login.aspx HTTP/1.1  302 186 -   -   Attack 4: this try to access a cgi at first request, (see my first iptables rule to drop this)  GET /hndUnblock.cgi HTTP/1.0    302 186 -   Wget(linux) GET /tmUnblock.cgi HTTP/1.0 302 186 -   Wget(linux)   I'm very new with server this 4 attacks are from only last 12 hours... Have thousands per week. Etymology of Tor and Ext Functors The names of the derived functors $\operatorname{Tor}$ and $\operatorname{Ext}$ seem quite cryptic to me. Does anyone know what these abbreviations stand for? I would be glad if someone could tell me where these names come from. Compiling documents online I have heard rumors that you can compile documents online, and more specifically that Google has a free online compiler, but I have never been able to find any. Is there a way to compile documents online, so that I can write and compile documents even if I don't have a TeX distribution installed on my computer?