I am trying to solve this issue since 2 days but I am not able to solve it. Basically I am want that if the result of pst = conn.prepareStatement(&quot;select * from employee where cnic = ?&quot;); is returning empty set than if(rs.next()) will execute and if it returning some data than program skip if and execute else part. I don't know where I am getting NullPointerException. I think I am getting exception after the execution of pst = conn.prepareStatement(&quot;select * from employee where cnic = ?&quot;); I don't how to solve it so please help me try {                 while(!bool){                     pst = conn.prepareStatement(&quot;select * from employee where cnic = ?&quot;);                     pst.setString(1, s9);                     rs = pst.executeQuery();                     if(rs.next()){                         pst = conn.prepareStatement(&quot;insert into employee(id,firstname,lastname,age,gender,job,salary,phone,cnic,email) values(?,?,?,?,?,?,?,?,?,?)&quot;);                         pst.setString(1, s1);                         pst.setString(2, s2);                         pst.setString(3, s3);                         pst.setString(4, s4);                         pst.setString(5, s5);                         pst.setString(6, s6);                         pst.setString(7, s7);                         pst.setString(8, s8);                         pst.setString(9, s9);                         pst.setString(10, s10);                         JOptionPane.showMessageDialog(null, &quot;Employee Added Successfully&quot;);                         new EmployeeMenu().setVisible(true);                         setVisible(false);                         bool = true;                     }else {                         JOptionPane.showMessageDialog(null, &quot;This CNIC Number is Already Registered&quot;);                         s9 = JOptionPane.showInputDialog(&quot;Enter a correct CNIC Number:&quot;);                                                }                 }             } catch (SQLException ex) {                 Logger.getLogger(AddEmployee.class.getName()).log(Level.SEVERE, null, ex);             }
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?
Prove that $PSL(2,\mathbb{Z})$ is free product of $C_2$ and $C_3$ Prove that $PSL(2,\mathbb{Z})=C_2 \star C_3$.  Now $C_2 \star C_3=\langle a,b\ |\ a^2, b^3 \rangle$ i.e. the free product.  But how do I show that presentation of $PSL(2,\mathbb{Z})$ is this? How to combine array items with string substitution? Proving the Cauchy-Schwarz inequality by induction I ran across this problem in some old notes, and I frustratingly can't figure out how to do it   Let $a_i$ and $b_i$ be sequences of natural numbers, use induction to show  $\sum_{i=1}^n (a_ib_i)^{1/2} \le (\sum_{i=1}^n a_i)^{1/2}(\sum_{i=1}^n b_i)^{1/2} $  Obviously this is trivial to show for n=1. I can't make much progress on n+1. I've tried various tactics, squaring both sides etc.   Any hint or help would be appreciated. Thanks. Can I manually put an external hard disk to sleep? Vec2 a, b; // some random vector Vec2 cross = a.Cross(b); RelativeDirection(a,b,cross); // return true if the direction of                               // rotating a to b is counter-clockwise   How do I implement the function RelativeDirection()?  I got some suedo code from the textbook:  if a.Cross(b) &gt; 0 then ... else ...   but the cross product is a vector right? how do you compare it with an integer? Why is the installer not showing any partitions? I want to run DFS replication between a couple of servers. It's my understanding that the servers need to be part of a domain for this. Being able to give people a username and password that works on all servers would be useful too, so I can lock up the admin password.  All machines will be running Windows 2008R2 and they will all be running Windows Firewall, so I need to be able to allow the other machines to connect to this server, but lock out everyone else.   So my question is: what ports do I need to allow the machines to connect to the Domain Controller over? Mount ext4 partition with >4KiB block size I'm attempting to mount a partition from a NAS and the block size is 65536 bytes, this is above my distribution's precompiled kernel memory paging size of 4KiB, so I cannot mount it normally.  Which kernel compilation parameters would I need to change to get a memory paging size large enough?  Would it be possible under the x86-64 architecture?  EDIT: There doesn't seem to be an option for it in make xconfig unless I'm just missing it.  From page_types.h under arch\x86\include\asm  /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT  12 #define PAGE_SIZE   (_AC(1,UL) &lt;&lt; PAGE_SHIFT) #define PAGE_MASK   (~(PAGE_SIZE-1))`   It doesn't look to be configurable.  I could change this number directly to 16 and it would probably make pretty explosions and destroy Tokyo.  I shall probably try it later this evening. Difference between information and knowledge? As far as I think projection of data unto subject mind is information for the subject whereas indentation or impressions accumulated owing to projection of data unto subject mind is knowledge for the subject. I want to know am I right? Or can someone provide a more rigorous answer! Python List vs. Array - when to use? If you are creating a 1d array, you can implement it as a List, or else use the 'array' module in the standard library.  I have always used Lists for 1d arrays.  What is the reason or circumstance where I would want to use the array module instead?  Is it for performance and memory optimization, or am I missing something obvious? Why is it that many of the most important physical equations don't have ugly numbers (i.e., "arbitrary" irrational factors) to line up both sides?   Why can so many equations be expressed so neatly with small natural numbers while recycling a relatively small set of physical and mathematical constants?  For example, why is mass–energy equivalence describable by the equation $E = mc^2$ and not something like $E \approx 27.642 \times mc^2$?  Why is time dilation describable by something as neat as $t' = \sqrt{\frac{t}{1 - \frac{v^2}{c^2}}}$ and not something ugly like $t' \approx 672.097 \times 10^{-4} \times \sqrt{\frac{t}{1 - \frac{v^2}{c^2}}}$.  ... and so forth.    I'm not well educated on matters of physics and so I feel a bit sheepish asking this.   Likewise I'm not sure if this is a more philosophical question or one that permits a concrete answer ... or perhaps even the premise of the question itself is flawed ... so I would gratefully consider anything that sheds light on the nature of the question itself as an answer.    EDIT: I just wished to give a little more context as to where I was coming from with this question based on some of the responses:  @Jerry Schirmer comments:      You do have an ugly factor of $2.997458 \times 10^8 m/s$ in front of everything. You just hide the ugliness by calling this number c.   These are not the types of "ugly constants" I'm talking about in that this number is the speed of light. It is not just some constant needed to balance two side of an equation.  @Carl Witthoft answers:      It's all in how you define the units ...   Of course this is true, we could in theory hide all sorts of ugly constants by using different units on the right and the left. But as in the case of $E=mc^2$, I am talking about equations where the units on the left are consistent with the units on the right, irrespective of the units used. As I mentioned on a comment there:     $E=mc^2$  could be defined using units like $m$ in imperial stones ($\textsf{S}$), $c$ in cubits/fortnight ($\textsf{CF}^{−1}$) and $E$ in ... umm ... $\textsf{SC}^2\textsf{F}^{−2}$ ... so long as the units are in the same system, we still don't need a fudge factor.   When the units are consistent in this manner, there's no room for hiding fudge constants. Wanted: question mark instead of bibtex key for missing citations (biblatex) Instead of having the citation key showing up in the document for missing references, I want to only have [?], as it is the case when using the default bibtex without biblatex. This behavior is driving me crazy, as it messes up all the formatting (especially in tables). I want to focus on writing and only later on deal with the erroneous citations.  This question is related to    and its MWE can be used. However, as pointed out beforehand, I want the question mark in the text instead of the citation key to not mess up the formatting (for missing citations). Strange folder in my home folder after a failed run of BleachBit Why does minimizing the MAE lead to forecasting the median and not the mean? From the , specifically :     A forecast method that minimizes the MAE will lead to forecasts of the   median, while minimizing the RMSE will lead to forecasts of the mean   Can someone give an intuitive explanation of why minimizing the MAE leads to the forecasting the median and not the mean? And what does this means in practice?  I have asked a customer: "what is more important for you to make mean forecasts more accurate or to avoid very inaccurate forecasts?". He said that to made mean forecasts more accurate have higher priority. So, in this case, should I use MAE or RMSE? Before I read this citation I believed that MAE will be better for such condition. And now I doubt. Can a non-EU citizen travel freely within the Schengen area without passport? My current situation is that I have residence permit of Germany (as a stamp in passport) and I wish to apply for UK visa in next few days from Germany and won't have my passport anymore during the processing time.  Instead of waiting for the process, I wish to travel to Scandinavian countries immediately on holidays, later receive my passport from visa center after I return back to Germany.   I am wondering if photocopy of passport and residence permit suffice as identity proof to border control (if I face them)? What else are valid documents that I can show as valid identity proof to border control? What are the exact problems I will face if I face the border control, and they are not satisfied with my travel documents? Command with percent symbols not running in crontab The following crontab does not work:  # TEST LINE DOES DOT RUN */1 * * * * /bin/echo 'test '`/bin/date +%Y-%m-%d` &gt;&gt; /tmp/test   I also tried starting it with:  SHELL=/bin/bash   Update: I thought the backtick characters ` were the villains, but as the answer below clarifies the percentage % was the culprit! I'm quite new to neural networks and currently I'm trying to train a non convolutional neural network on the MNIST data set. I'm observing some behaviour I don't quite understand.   This is the code written with keras as the library:  # the data, split between train and test sets (x_train, y_train), (x_test, y_test) = fashion_mnist.load_data()  y_train = keras.utils.to_categorical(y_train, 10) y_test = keras.utils.to_categorical(y_test, 10) model = Sequential()  early_stopper = EarlyStopping(patience=3)  model.add(Flatten(input_shape=(28,28))) model.add(Dense(128, activation="relu")) model.add(Dense(128, activation="relu")) model.add(Dense(10, activation="softmax")) model.compile(loss="categorical_crossentropy", optimizer="adam", metrics=["accuracy"])  model.fit(x_train, y_train, epochs=20, validation_data=(x_test, y_test), callbacks=[early_stopper])   This gives me a validation_acc of around 20%. The funny thing is, when I change the activation functions to "sigmoid", the loss function to "mean_squared_error" and the optimizer to "sgd" my performance improves to around 85% after 50 epochs.   Having read  I wonder what's the reason for the bad performance of the network I presented in the code. ReLU, cross-entropy and a dynamic optimizer like Adam all seem to improve on the idea of a very vanilla neural network with stochastic gradient optimization, mean squared error as loss and sigmoid activation functions. Yet I get a really bad performance and if I increase the number of nodes in the hidden layers I often get a network that doesn't learn at all.   EDIT: I figured out it has something to do with me not normalizing the input to values between 0 and 1 ... but why is this the problem? PhD duration in the USA I am trying to find out what the average duration of PhD studies are in the USA. Here in Spain it used to be 4 years, but it seems that Europe is moving towards a 3-year scheme since students are expected to do their MSc before they start. What is it like in the USA? Is some kind of shortening also occurring? if $f^{(n)}(x_0),g^{(n)}(x_0)$ exist and $\lim_{x\to x_0} \dfrac{f(x)-g(x)}{(x-x_0)^n}=0$ then $f^{(r)}(x_0)=g^{(r)}(x_0 )$ for all $0\leq r\leq n.$ Show:   if $f^{(n)}(x_0),g^{(n)}(x_0)$ exist and   $$\lim_{x\to x_0} \dfrac{f(x)-g(x)}{(x-x_0)^n}=0$$   then $f^{(r)}(x_0)=g^{(r)}(x_0 )$ for all $0\leq r\leq n.$   My attempt:  let n = 1,  since $f'(x_0),g'(x_0)$ exists then The taylor polynomial exists: $$T_{f,1}(x)=f(x_0)+f'(x_0)(x-x_0), \lim_{x\to x_0} \dfrac{f(x)-T_{f,1}(x)}{(x-x_0)}=0$$  $$T_{g,1}(x)=g(x_0)+g'(x_0)(x-x_0), \lim_{x\to x_0} \dfrac{g(x)-T_{g,1}(x)}{(x-x_0)}=0$$  Then, \begin{align} \lim_{x\to x_0} \dfrac{f(x)-g(x)}{(x-x_0)^n} &amp; =\lim_{x\to x_0} \dfrac{f(x)-g(x)+T_{f,1}(x)-T_{f,1}(x)+T_{g,1}(x)-T_{g,1}(x)}{(x-x_0)^n}\\ &amp;=\lim_{x\to x_0} \dfrac{f(x)-g(x)+T_{f,1}(x)-T_{f,1}(x)+T_{g,1}(x)-T_{g,1}(x)}{(x-x_0)^n}\\ &amp;=\lim_{x\to x_0} \dfrac{f(x)-T_{f,1}(x)}{x-x_0}-\lim_{x\to x_0} \dfrac{g(x)-T_{g,1}(x)}{x-x_0}+\lim_{x\to x_0} \dfrac{T_{f,1}(x)-T_{g,1}(x)}{x-x_0}\\ &amp;=\lim_{x\to x_0}\dfrac{T_{f,1}(x)-T_{g,1}(x)}{x-x_0}\\ &amp;=0 \end{align}  Then, \begin{align} \lim_{x\to x_0}\dfrac{T_{f,1}(x)-T_{g,1}(x)}{x-x_0} &amp;=\lim_{x\to x_0}\dfrac{f(x_0)+f'(x_0)(x-x_0)-g(x_0)-g'(x_0)(x-x_0)}{x-x_0}\\ &amp;=\left(f(x_0)-g(x_0)\right)\lim_{x\to x_0}\dfrac{1}{x-x_0}+f'(x_0)-g'(x_0) \\&amp;=0 \end{align} I am confused because  $\lim_{x\to x_0}\dfrac{1}{x-x_0}$ does not exist. Accessing static member through invalid pointer: guaranteed to "work"?