I'm trying to modify a JTextField's text when a row in a table is selected, however when I select a row, a NullPointerException is thrown and I can't seem to find a solution.  table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {         @Override         public void valueChanged(ListSelectionEvent event) {              if (!event.getValueIsAdjusting() &amp;&amp; !recordTable.getSelectionModel().isSelectionEmpty()) {                  field.setText("Test!");             }         }     });   ERROR:  Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at packagename.MOTFrame$1.valueChanged(RecordFrame.java:127) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:184) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:154) at javax.swing.DefaultListSelectionModel.setValueIsAdjusting(DefaultListSelectionModel.java:685) at javax.swing.plaf.basic.BasicTableUI$Handler.setValueIsAdjusting(BasicTableUI.java:953) at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(BasicTableUI.java:1166) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)   Any help is greatly appreciated.
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?
Pluralization rule for "five-year-old children", "20 pound note", "10 mile run" Homotopy invariance for cohomology I have tried to read Hatcher's  book. He proved  Theorem 2.10: If two maps $f,g :X \to Y$ are homotopic, then they induce the same homomorphism $f_* = g_*:H_n(X) \to H_n(Y)$.  One can immediately obtain following corollaries using the dual version of prism operator described in Theorem 2.10 and some facts:  Corollary 1: If $f,g :X \to Y$ are homotopic, then $f_* = g_*:\tilde H_n(X) \to \tilde H_n(Y)$ for $n&gt;0$.  Corollary 2: If $f,g :(X,A) \to (Y,B)$ are homotopic, then $f_* = g_*:H_n(X,A) \to H_n(Y,B)$.  Corollary 3: If $f,g :X \to Y$ are homotopic, then $f^* = g^*: H^n(X) \to H^n(Y)$.  Corollary 4: If $f,g :X \to Y$ are homotopic, then $f^* = g^*:\tilde H^n(X) \to \tilde H^n(Y)$ for $n&gt;0$.  Corollary 5: If $f,g :(X,A) \to (Y,B)$ are homotopic, then $f^* = g^*:H^n(X,A) \to H^n(Y,B)$.  I wonder that how can we prove the following statements:  Corollary 6: If $f,g :X \to Y$ are homotopic, then $f_* = g_*:\tilde H_0(X) \to \tilde H_0(Y)$.  Corollary 7: If $f,g :X \to Y$ are homotopic, then $f_* = g_*:\tilde H^0(X) \to \tilde H^0(Y)$.  An attempt for Corollary 7 is  Proof of Corollary 7: By Universal Coefficient Theorem, we have $$\tilde H^0(X;G) \approx Hom(\tilde H_0(X),G).$$  Hence the result follows from the dualization of the proof Corollary 6.  Any help will be appreciated. I am drawing a 3D array like the attached picture, which actually describes a multidimensional array. However, I can not put the name of the axis and take the value from the matrix like the attached picture.  This is the code that I have:  \documentclass[margin=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{matrix,calc}  \begin{document} \begin{tikzpicture}[every node/.style={anchor=north east,fill=white,minimum width=1.4cm,minimum height=7mm}] \matrix (mA) [draw,matrix of math nodes] { (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ };  \matrix (mB) [draw,matrix of math nodes] at ($(mA.south west)+(1.5,0.7)$) { (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ };  \matrix (mC) [draw,matrix of math nodes] at ($(mB.south west)+(1.5,0.7)$) { (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ (1,1,3) &amp; (1,1,3) &amp; (1,1,3) &amp; (1,1,3) \\ };  \draw[dashed](mA.north east)--(mC.north east); \draw[dashed](mA.north west)--(mC.north west); \draw[dashed](mA.south east)--(mC.south east); \end{tikzpicture}   \end{document} Mapping Russia - Int'l dateline splitting polygon Consider the sentence      E-books are on the rise, but they haven't suppressed paper books though.    This usage seems to be quite common, but when I learned English  I was taught to use "however" where I now read "though". My questions on this use of "though" are:     Is this a new trend? Is it restricted to American English? Is "though"  considered more colloquial than "however" ?    And on a syntactic level: Do you put a comma before "though"? Are there strange attractors whose coordinates are "almost integers"? Is there some guide I can use for cooking soft boiled ostrich eggs? Accessing private member variables from prototype-defined functions Is there any way to make “private” variables (those defined in the constructor), available to prototype-defined methods?  TestClass = function(){     var privateField = "hello";     this.nonProtoHello = function(){alert(privateField)}; }; TestClass.prototype.prototypeHello = function(){alert(privateField)};   This works:  t.nonProtoHello()   But this doesn’t:  t.prototypeHello()   I’m used to defining my methods inside the constructor, but am moving away from that for a couple reasons. How to create a pattern or tiles from rotated elements I'm seeking for a proof of the following:     Let $A$ be an invertible matrix. Then the determinant of $A^{-1}$ equals:   $$\left|A^{-1}\right|=|A|^{-1} $$   I don't know where to begin the proof. Any suggestions? mysql select distinct rows into a comma delimited list column Bonferroni adjustment in SPSS - what does it do? I just want to write a script which changes my directory.  I put the below commands in the file /home/alex/pathABC  #!/bin/sh cd /home/alex/Documents/A/B/C echo HelloWorld   I did   chmod +x pathABC   In the Terminal, while in /home/alex, I ran ./pathABC, but the output is just HelloWorld and the current directory is not changed.  So what is wrong? What will be the value of the following Infinite Product :   $$\displaystyle \prod_{k=0}^\infty \left(1+\dfrac{1}{2^{2^k}}\right)$$  It would be nice if anyone could spare the time and boil down to the absolute basics and tell how they reached the solution. Messages on Macs don't work I've tried every suggestion I could find on Apple forums. Deleted .plist files, removed message caches, reset passwords, coordinated sign on/offs between my iPhone and my Macs, reset iPhone and reinstalled Mavericks on my Macbook Air. All pointless exercises.   I suspect it all started because I jailbroke my iPhone using Pangu. It may or may not have been the culprit, but my problems started a couple of days after I did it. All my phone conversations went green and stopped synchronizing with Messages apps on my Macs. Trying to send a new message from Macs would result in either "Your message could not be sent" error with a warning icon next to it, or:     XXX is not registered with iMessage.   So I restored my iPhone to factory defaults using iTunes. That didn't help immediately, but in a day or two, my conversations with other iPhone users went blue. So I am happy that works.  So now I sacrificed my Macbook Air to try and make messages work on it. I reinstalled Mavericks several times, each time trying different approaches: not immediately signing into iCloud, not associating an iCloud profile with login profile, etc. Nothing helps. I launch Messages app, it asks me to sign in (and I do, successfully), and then nothing goes through.   Sending messages to myself also works inconsistently. Yesterday, whatever I sent to myself (using phone number) would appear delivered to the same window, but not on my phone. Today I get "... not registered with iMessage" error. subideals of an ideal If $R$ is a ring, J is an ideal in $R$, and $I$ is an ideal of $J$ (with $J$ considered as a ring), does it follow that $I$ is an ideal of $R$?  That is, is $I$ necessarily closed under multiplication by elements of $R$?  Surely $I$ is closed under multiplication by elements of $J$ (since $I$ is an ideal of $J$).  The "obvious" approach to proof fails so quickly that it must be false, that "an ideal of an ideal is not necessarily an ideal of the big ring".  Please provide a counterexample.  (Or a proof?) The keyboard I am trying to create has a lot of Unicode and looks like this:   Being unsuccessful with the following tutorial:    (There are a few errors in the tutorial, and it uses imprecise language such as "Cutting" things instead of "Deleting" them, and it is formatted strangely)   I was wondering if anybody would be so kind to provide a better tutorial with step by step instructions? How to show TCP listenings and filter them by local IP on Windows? Server has numerous IP addresses, set up on it's network interface.  How to find, who is listening to specific IP port 80?  netstat shows very long list. Are there any builtin means?  UPDATE  Also can't use findstr with also wishing to know process name because brocess name is displayed on separate line. Switching a DIV background image with jQuery If $S$ is a nonempty subset of group $G$, then $S^{|G|}$ is a subgroup of $G$. Let $G$ be a group with $|G| = n$ and let $ \emptyset \ne S \subseteq G$.   I want to show that $S^n$ is a subgroup of $G$ where by $S^n$ I mean the set $\lbrace s_1\cdots s_n \; | \; s_i \in S\rbrace$.