Recently, I have had trouble comparing LocalDateTime instances using the predefined method isAfter().   I have tried the following in Eclipse and it works fine:   stock.getReserveDate().isAfter(LocalDateTime.now())  where stock is a JPA Entity with a LocalDateTime field that has a getter called getReserveDate().  Executing the following code in JSP(which I believe is identical to the line above) gives me a NullPointerException.  &lt;c:when test="${!compStock.getReserveDate().isAfter(LocalDateTime.now())}"&gt;     &lt;p&gt;Stock is reserved!&lt;/p&gt; &lt;/c:when&gt;  After debugging, I've managed to find out that the LocalDateTime.now() part of my code is considered null by JSP / JSTL but I have no idea why. This code works perfectly when ran in Eclipse but fails in a JSP.
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?
Turn off display in Windows on command Already I have lost all hope of looking at late answers etc. It's just a parade of meh. I can't make any kind of intelligent decision because I can't see the other answers to the question, for instance. There's no Looks Good, only Skip, and those feel different to me. So I've been more interested in .  But people keep approving crap while I'm looking at it. Two or three "the post was already approved; please visit to edit" and I'm just "screw this whole thing".  Can we do something like one reject bounces all existing votes: you need three approves in a row? Because a lot of people are stupidly approving and actually driving me away from the queue.    Note this is less about letting bad edits through and more about keeping reviewers motivated. Can't resolve issue: iptables: No chain/target/match by that name blink code(escape code) has been removed? How to prove Fibonacci sequence with matrices? More homework help.  Given the function $f:A \to B$.  Let $C$ be a subset of $A$ and let $D$ be a subset of $B$.  Prove that:  $C$ is a subset of $f^{-1}[f(C)]$  So I have to show that every element of $C$ is in the set $f^{-1}[f(C)]$  I know that $f(C)$ is the image of $C$ in $B$ and that $f^{-1}[f(C)]$ is the pre-image of $f(C)$ into $A$.  Where I'm stuck is how to use all of this information to show/prove that $C$ is indeed a subset.    Do I start with an arbitrary element (hey, let's call it $x$) of $C$? and then show that $f^{-1}[f(x)]$ is $x$?  I could use a little direction here...  Thanks. Why does friction play the role of centripetal force during the turning of a car? Grub not showing on startup for Windows 8.1 Ubuntu 13.10 Dual boot How are pronouns resolved? Are pronouns in English resolved syntactically or semantically? Do they always refer to the closest matching noun?  A  has these examples:        We gave the bananas to the monkeys because they were hungry.   We gave the bananas to the monkeys because they were ripe.   We gave the bananas to the monkeys because they were here.       My understanding was that pronouns are resolved syntactically, and so sentence 2 is semantically incorrect (unless the author really meant that the monkeys were ripe) and sentence 3 is not ambiguous. Is this wrong?  Citations and references are most welcome. From the Immediate Window in Visual Studio:   &gt; Path.Combine(@"C:\x", "y") "C:\\x\\y" &gt; Path.Combine(@"C:\x", @"\y") "\\y"   It seems that they should both be the same.    The old FileSystemObject.BuildPath() didn't work this way... Are these solutions of $2 = x^{x^{x^{\:\cdot^{\:\cdot^{\:\cdot}}}}}$ correct? Let $U$ be an open set in $\mathbb R$. Then $U$ is a countable union of disjoint intervals.    This question has probably been asked. However, I am not interested in just getting the answer to it. Rather, I am interested in collecting as many different proofs of it which are as diverse as possible. A professor told me that there are many. So, I invite everyone who has seen proofs of this fact to share them with the community. I think it is a result worth knowing how to prove in many different ways and having a post that combines as many of them as possible will, no doubt, be quite useful. After two days, I will place a bounty on this question to attract as many people as possible. Of course, any comments, corrections, suggestions, links to papers/notes etc. are more than welcome. A quick search for currency regex brings up . The problem I have in choosing one is that regex is difficult to verify without testing all the edge cases. Does anyone have a regex for U.S. currency that has been thoroughly tested? My only requirement is that the matched string is U.S. currency and parses to System.Decimal:  [ws][sign][digits,]digits[.fractional-digits][ws]   Elements in square brackets ([ and ]) are optional.  The following table describes each element.   ELEMENT             DESCRIPTION ws                  Optional white space. sign                An optional sign. digits              A sequence of digits ranging from 0 to 9. ,                   A culture-specific thousands separator symbol. .                   A culture-specific decimal point symbol. fractional-digits   A sequence of digits ranging from 0 to 9. Can I transfer my Terraria character from one PC to another? Currently my map server is run on my laptop at home, and my brother and I play via LAN each on his desktop PC.  However, I'd like to transfer my character from the Desktop PC to my laptop in order to play on the go.  Can I do this? Where is the character information saved? Lightning Change Event Is there a way to catch the change event of a particular field/component? I saw on the AuraDocs that there is a valueChange event but trying to handle it makes the app throw an error on load. I was wondering if I could build some automatic field validation / search suggestions without relying on other js libraries. $\int_0^\infty \frac{\log(x)}{x^2+\alpha^2}$ using residues I'm trying to find $\int_0^\infty \frac{\log(x)}{x^2+\alpha^2}dx$ where $\alpha&gt;0$ is real.  My approach was to take an integral along the real line from $1/R$ to $R$, around the circle counterclockwise to $-R$, along the real line to $-1/R$, and then around the circle clockwise to $1/R$.  I have encountered 2 problems with this:   This path encloses one pole, at $z=\alpha i$.  I found the residue at $z=\alpha i$ to be $\frac{\ln(\alpha)+i\pi/2}{2\alpha i}$.  However, this gives me that $\int_0^\infty \frac{\log(x)}{x^2+\alpha^2}dx=\frac{\pi(\ln(\alpha)+i\pi/2)}{2\alpha}$.  Since I have a real function integrated over the real line, there cannot be an imaginary part.  Where did I go wrong?  (Also, doing a few examples, the correct answer seems to be $\frac{\pi\ln(\alpha)}{2\alpha}$, the same as I have but without the imaginary part.) At first chose my path so instead of going all the way around the upper semicircle, it only went 3/4 of the way around, as I wanted to avoid anything that might go wrong with the discontinuity of $\log(x)$ at the negative real axis.  When I do this, though, I get a different answer than before (the denominator of the fraction is $\alpha(1-e^{3\pi i/4})$ instead of $2\alpha$.  What am I doing wrong that gives me different answers? MacBook Pro detects syncmaster (monitor) but doesn't display How can one have a mini table of contents for the current chapter appear just after the chapter name listing all sections of that chapter? Question I use pgfplots with the ultra thick option ans without explicitly giving the domain for the y-axis. It seems that in this case, some part of my graph is &quot;eaten&quot; by the margin: see the picture below to understand what I mean. Is there a way to avoid this? Code \documentclass{article} \usepackage{pgfplots} \begin{document}  \begin{tikzpicture}  \pgfplotsset{every axis/.append style={                     axis x line=middle,    % put the x axis in the middle                     axis y line=middle,    % put the y axis in the middle                     axis line style={-&gt;},  % arrows on the axis                     xlabel={$x$},          % default put x on x-axis                     ylabel={$y$},          % default put y on y-axis                     grid = major                     }}  \begin{axis}[xmin=-5,xmax=5] \addplot[orange,smooth, ultra thick] {sin(deg(x))} ;                  \end{axis} \end{tikzpicture}  \end{document} Best way to remove file extension from a string? So, I'm using a script I've made to convert videos to the webm format. A certain program calls the script, sending %f which is the full, absolute file name of the video, like this:  converter.sh %f   where %f has two possible extensions, .avi or .mpg.  # /bin/bash ffmpeg -i $1 `dirname $1``basename $1 avi`webm &amp;&amp; rm $1   It currently works perfectly when $1 contains a .avi file, because basename removes the .avi extension. When $1 ends with .mpg instead, the result is .mpgwebm.  How can I modify that script to be able to receive those two possible different formats?    Resuming: If $1 is /somedir/video.avi, the script should do:  ffmpeg -i /somedir/video.avi /somedir/video.webm   And if $1 is /somedir/video.mpg, the script should do:  ffmpeg -i /somedir/video.mpg /somedir/video.webm   I know this might be fool for some people, but I'm kind of new with the bash.