I've a Jersey based REST Client and a GET call defined as this :  The code doesn't come out after the client.get() call. A null pointer exception is hit on the client.get() call , this is the initialization logic from the class which calls the REST client :  Student.java :  public class Student {      private static RestClient client;      @SuppressWarnings("static-access")     public Student(Client client) {         this.client = new RestClient(client, "xyz");     }      public static RestClient getClient() {         return client;     }      public static void addStudent() throws Exception {          try {                    String addStudentUri = "https://www.zebapi.com/api/v1/market/ticker-new/btc/inr";                  ClientResponse js_response = getClient().get(URI.create(addStudentUri));             String s = js_response.getEntity(String.class);             System.out.println(s);         } catch (Exception e) {             System.out.println(e);                   }     }      public static void main(String[] args) {         try {             addStudent();         } catch (Exception e) {             // TODO Auto-generated catch block             e.printStackTrace();         }     } }   RestClient.java  public class RestClient {      private Client client;     private String randomHeader = "";      public RestClient(Client jerseyClient) {         this.client = jerseyClient;     }      public RestClient(Client jerseyClient, String random) {         this.client = jerseyClient;         this.randomHeader = random;     }      public String getRandomHeader() {         return randomHeader;     }      public void setRandomHeader(String randomHeader) {         this.randomHeader = randomHeader;     }      public RestClient() {     }      public ClientResponse get(URI uri)     {         return client.resource(uri)                 .get(ClientResponse.class);     }      public ClientResponse post(URI uri)     {         return client.resource(uri)                 .type(MediaType.APPLICATION_JSON)                 .accept(MediaType.APPLICATION_JSON)                 .post(ClientResponse.class);     }  }   Can you please help?
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 put in a switch and a light it controls in a storage building and  is how I wired it.   Click for larger view  When I checked the wiring it registered 120V when the switch was on, and right around 50V when the switch was off.  Why would power still be getting to the light (I'm guessing there is a problem with the switch) and why would it only be 50V?  Oh, and where everything branches off at the beginning I have a junction box there where all of the wires are joined there. Co-signed a loan and I need to have my name removed Let $a&gt;b&gt;0$ and let $n \in N$ satisfy $n \geq 2$.  Prove that $$a^{1/n}-b^{1/n}&lt;(a-b)^{1/n}.$$  If we let $a=x$ and $b=x-1$, then we need to show that $f(x):=x^{1/n}-(x-1)^{1/n}$ is decreasing for $1\leq x$ (which means that $f'(x)\leq 0$ and $f$ is differentiable), and evaluate $f$ at $1$ and $a/b$. How many passes do you need to wipe/shred your files to make them not undeletable? I am looking for a device that can track my location (lat,long) and speed all day long. Perhaps, I need GPS and accelerometer data bundled together.  What I want to do is to log my daily activities. I spend time walking, running, driving, taking a bus, staying in a building, etc., just like any normal human-being :) I am willing to carry the device with me at all times and would like to see every place I go into and my speed at certain positions.  My requirements are that the location and speed data should be recorded at least every ~20 seconds. I would also like the device to timestamp (date+time) each record. It would be enough if timestamp is precise to nearest minute and the location can go off about a maximum of 10-15m. (30-50ft.)  What I want is a portable device so I can carry all day long for about 2-3 months. I will only use it during casual, daily activities.  I don't want real-time tracking. I can collect the data from a storage later on. How can I find the smallest set of groups of $n$ elements such that every element is in the same group as every other at least once? Background: I'm working on  for , and I've run into a problem with how I'm creating the individual matchups (groups of 4 entries).  Currently, I'm simply generating all combinations of 4 elements (in the combinatoric sense) of entries, but that gets really big really quickly:  $$x \choose 4$$    (from )  Therefore, my question is: How can I choose subsets (of length $n$) of a set such that each element of that set appears in the same subset as every other element at least once, while maintaining a minimal amount of subsets?  I can figure this out for $n = 2$, since the solution is quite intuitive: simply combine the first element with every other element, combine the second element with every other element that comes after it, etc. For a set of length $L$, this yields:  $$\sum_{x=1}^{L-1}(L - x)$$    (from )  which is much smaller and more manageable.  However, I still have not been able to figure out: How can I generalize this to any $n$? As the title says, I've heard two possible meanings for turning down the air conditioning: It could mean set the target temperature lower (i.e. colder) or make it work less (i.e. warmer).  Turning down the heat makes it colder, but both meanings are in agreement there. First Order Language for vector spaces over fields I'm attempting to come up with a first order language $L$ that is able to describe vector spaces over fields. I came up with a few sets of nonlogical symbols.  $Rs_L=\{Scal,Vec\}$ where $Scal,Vec$ are unary relation symbols which I interpret to be true or false depending on whether $x$ is a scalar or vector.  Also, $Fs_L=\{+,\cdot,\}$ which are the usual addition and multiplication for both vectors and scalars.  For constant symbols, $Cs_L=\{0,1,0_V\}$, where $0$ and $1$ are regular field scalars for the additive and multiplicative identities, respectively, and $0_V$ is the additive identity for vectors.   Using these, I was able to formulate axioms for scalar multiplication on a given structure, and I define addition between a scalar and a vector to simply always give the 0 vector and define multiplication between two vectors to always be the 0 vector. This gives a theory such that a structure models it if and only if it is a vector space in the regular algebraic sense. It is easy to see that all linear transformations in the algebraic sense are included in the class of homomorphisms (in the logical sense), but I am having difficulty proving they are the only ones in this class.   I suppose I want to show that for any $L$-homomorphism $T$, $T(av+w)=aTv+Tw$ for $a$ a scalar and $v,w$ vectors. Since $T$ is a homomorphism, I see that $T(av+w)=Tav+Tw=TaTv+Tw$, so it would be enough to show that all homomorphisms act as the identity on all scalars? Is there a way to show this, or an extra axiom to include? Why should the interface for a Java class be preferred? Setting the editing style on a UITableViewCell This is a summary of the excerpt:  Given that we have:  *$10^9$ people  *each person has a chance of 0.01 of going to a hotel  *we have $10^5$ hotels, each hotel holds 100 people  *Thus, $P(2 \text{ persons meet on the same hotel in any given day}) = 0.01 \cdot 0.01 \cdot 10^{-5}$  *and $P(2\text{ persons on the same hotel in $2$ day}) = P(2 \text{ persons on the same hotel in any given days})^2 = 10^{-18}$  the book "Mining of Massive Dataset" said that the expected number of pairs who stay in the same hotel for 2 days is:  $P(2 \text{ persons on the same hotel in $2$ days}) \cdot ( \text{number of pairs of people} ) \cdot (\text{number of pairs of days})$  this is the part where I got stuck. Can't understand how it come to this derivation. Can anybody explain it in more elaborate detail.  You can find the content on page 6 of this link:  (it is freely available) Why does $\tan^{-1}(1)+\tan^{-1}(2)+\tan^{-1}(3)=\pi$? Playing around on wolframalpha shows $\tan^{-1}(1)+\tan^{-1}(2)+\tan^{-1}(3)=\pi$. I know $\tan^{-1}(1)=\pi/4$, but how could you compute that $\tan^{-1}(2)+\tan^{-1}(3)=\frac{3}{4}\pi$ to get this result? How do you document your databases? My girlfriend is Russian. Last night we tried to fly her to the US on a valid tourist visa. She was stopped at DME and told she would be required to have $2700 USD to get back home immediately even though she had a return ticket. She said this was an "unwritten" rule because of the nonsense i keep seeing on CNN , Anybody else know anything? She is literally trapped and scared to death. I want to convert a std::string to lowercase. I am aware of the function tolower(). However, in the past I have had issues with this function and it is hardly ideal anyway as using it with a std::string would require iterating over each character. Is there an alternative which works 100% of the time? This is an exercise from my calculus class. The function is defined as $x\sin (1/y)+y\sin (1/x)$ if $x\neq0 $ and $y\neq0 $, and $0$ if $x=0 $ or $y=0$.  I'm pretty confident the limit exists and should be $0$, because: $$\lim_{(x,y)\to(0,0)}[x\sin (1/y)+y\sin (1/x)]=\lim_{(x,y)\to(0,0)}[x\sin (1/y)]+\lim_{(x,y)\to(0,0)}[y\sin (1/x)]$$  And: $x\leq x\sin(1/y)\leq x$, so $\lim_{(x,y)\to(0,0)}[x\sin (1/y)]=0$ right? (The same can be said for $\lim_{(x,y)\to(0,0)}[y\sin (1/x)]$)  However, I tried checking my answer, and according to Wolfram Alpha the limit doesn't exist. Is this because I'm wrong, or is it just because $x\sin (1/y)+y\sin (1/x)$ is undefined for $y\neq0 $ and $y\neq0 $ Where does console output go Tensors are mathematical objects that are needed in physics to define certain quantities. I have a couple of questions regarding them that need to be clarified:   Are matrices and second rank tensors the same thing? If the answer to 1 is yes, then can we think of a 3rd rank tensor as an ordered set of numbers in 3D lattice (just in the same way as we can think of a matrix as an ordered set of numbers in 2D lattice)? How to properly Drape vectors over a DEM? Find a non-negative function on [0,1] such that $t\cdot m(\{x:f(x) \geq t\}) \to 0$ that is not Lebesgue Integrable