lblPt1.setIcon(bd.pt1.getImage());   works while  lblPt1.setIcon(bd.pts[0].getImage());   throws a NullPointerException   pts[] is an array containing "Point" objects pt1 through pt24.  I would like to handle it with this for loop where pointLbls[] is an array of JLabels:  for (int i = 0; i &lt; 24; i++)         pointLbls[i].setIcon(bd.pts[i].getImage());   I have determined that it is the object that is null, not its associated image. What am I doing wrong? I am rather new to programming.
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?
Does encrypting my home folder make my computer more secure? Do I have to enter my password more if my home folder is encrypted? What else should I know about encrypting my home folder? Uploading video to youtube in right format Why doesn't matter pass through other matter if atoms are 99.999% empty space? The ghostly passage of one body through another is obviously out of the question if the continuum assumption were valid, but we know that at the micro, nano, pico levels (and beyond) this is not even remotely the case. My understanding is that the volume of the average atom actually occupied by matter is a vanishingly small fraction of the atom's volume as a whole. If this is the case, why can't matter simply pass through other matter? Are the atom's electrons so nearly omnipresent that they can simultaneously prevent collisions/intersections from all possible directions? Get most common value for each value of another column in SQL I have a table like this:   Column  | Type | Modifiers  ---------+------+-----------  country | text |   food_id | int  |   eaten   | date |    And for each country, I want to get the food that is eaten most often.  The best I can think of (I'm using postgres) is:  CREATE TEMP TABLE counts AS     SELECT country, food_id, count(*) as count FROM munch GROUP BY country, food_id;  CREATE TEMP TABLE max_counts AS     SELECT country, max(count) as max_count FROM counts GROUP BY country;  SELECT country, max(food_id) FROM counts     WHERE (country, count) IN (SELECT * from max_counts) GROUP BY country;   In that last statement, the GROUP BY and max() are needed to break ties, where two different foods have the same count.  This seems like a lot of work for something conceptually simple.  Is there a more straight forward way to do it? Theorem 13.9 in these  is the polynomial spectral mapping theorem:     Theorem 13.9 For a polynomial $p$ we have $\sigma(p(T)) = p(\sigma(T))$.     My questions:   First direction: Why would $q(T) (p(T) - p(\lambda) I)$ be an inverse for $T - \lambda I$? Update: @RobertIsrael said that instead $(p(T) - p(\lambda) I)^{-1} q(T)$ should be $(p(T) - p(\lambda) I)^{-1}$ be? According to the lines in the proof above, we have $$ (p(T) - p(\lambda) I)^{-1} = ((T - \lambda I) q(T))^{-1} \overset{?!}{=} q(T)^{-1} (T - \lambda I)^{-1}, $$ but as $\lambda \in \sigma(T)$ by assumption, $(T - \lambda I)^{-1}$ doesn't exist, right? For the second direction: Why does $x_i \in \sigma(T)$ imply that $p(x_i) - \mu = 0$? I thought that $x_i \in \sigma(T)$ only implies that $T - x_i I$ is not boundedly invertible. Since $\mu \in \sigma(p(T))$ we have that $p(T) - \mu I = c \prod_{k = 1}^{n} (T - x_i I)$ is not boundedly invertible but how does that help?   In both statements there seem to be a notion of "a product of operators is not invertible iff all factors aren't invertible", but how can that be true? Consider i.e. shift operators on a sequence spaces such that $ST = I$, i.e. the left and right shift operators, then the above mentioned notion doesn't hold, right? How to view CD key for a Steam game? I have purchased a game on Steam and can not find out the details of the file or purchase. How does one find their CD Key from a game purchased in Steam? Is there a way to recognize destructible environment in XCOM:Enemy Unknown? How can I get back a system file after deleting it from my Mac? I've deleted a system file from my Mac and need to get it back.  System files can include:   hidden files in the root of / - especially unix files in /private  /System files /Library files /Applications files that ship with the core OS   System files are not any app, user files or files that can be regenerated by a known sequence such as cache files, Spotlight index files, etc…    Canonical question and answer for . Is it possible to match encrypted documents using user-defined search terms? Suppose I am storing a number of encrypted documents in a database. I would like to make it possible to identify the subset of documents whose contents match user-specified search terms without a) maintaining a plaintext index or b) decrypting documents on the fly. Is there any way to accomplish this securely?  By the same token, I'm wondering if a collection of encrypted documents can be sorted according to an encrypted attribute (e.g., document title) without first decrypting all attribute values. I have looked at other questions on this site (e.g. "why does space expansion affect matter") but can't find the answer I am looking for.  So here is my question: One often hears talk of space expanding when we talk about the speed of galaxies relative to ours. Why, if space is expanding, does matter not also expand? If a circle is drawn on balloon (2d plane), and the balloon expands, then the circle also expands. If matter is an object with 3 spatial dimensions, then when those 3 dimensions expand, so should the object.  If that was the case, we wouldn't see the universe as expanding at all, because we would be expanding (spatially) with it.  I have a few potential answers for this, which raise their own problems:   Fundamental particles are 'point sized' objects. They cannot expand because they do not have spatial dimension to begin with. The problem with this is that while the particles would not expand, the space between them would, leading to a point where the 3 non-gravity forces would no longer hold matter together due to distance Fundamental particles are curled up in additional dimensions a la string theory. These dimensions are not expanding. Same problems as 1, with the added problem of being a bit unsatisfying. The answer seems to be (from Marek in the previous question) that the gravitational force is so much weaker than the other forces that large (macro) objects move apart, but small (micro) objects stay together. However, this simple explanation seems to imply that expansion of space is a 'force' that can be overcome by a greater one. That doesn't sound right to me. ZF: Difference between POW and SEP? include svg images with the svg package "Was" or "were" in subjunctive clauses I'm not a native english speaker, so even though I'm decently proficient at it, I don't really "know the rules" sometimes, and this is one that's been confusing me for a long time.  Which one is correct in each sentence?     If the movement [was/were] to continue uncorrected, the tower would   one day topple.      If I [was/were] rich, I would buy a yacht.   NOTE: I care not only about the case of "I", but also "she", "them", "it", etc, as in the example of the tower. Would it be any different if instead of the tower, it'd be me who'd topple if uncorrected?  I'm pretty sure it's "were" in both cases. That's what they taught me, I think. I started to doubt when I saw a lot of "was", but it sounded like the typical intentional mistake used "stylistically". ("If I was a rich girl...")  Then I saw it some more and thought it came down to an American/British English difference (I was taught British, in theory, and most of what I read is American).    But that tower sentence came straight from "The Guardian"...  When do you use was and when do you use were? Trigonometry question finding the sin and tan If angle $\alpha$ is reflex, and $\cos \alpha = -\frac{9}{41}$, without using a calculator, evaluate  (a) $\sin \alpha$ (b) $\tan \alpha$ (c) $\cos (\alpha - 180\deg)$     . Casting nines and elevens in other bases (radix) and doing check sums for binary How do I run a batch file from my Java Application? Related:   I have put a bit of commentary enumerating my confusions in parentheses  I read in Black Holes and Time Warps (Kip Thorne), that quasars can generate their jets from four different processes. These all involved the accretion disk, but there was one which doesn't make quite as much sense. It was called the Blandford-Znajek process, and it involved magnetic field lines carrying current.  The process was visualized in two ways. A black hole, with magnetic field lines, is spinning. In the first visualisation (viewpoint actually), the magnetic field lines 'spin' along with the black hole, and nearby plasma is anchored onto the field lines by electrical forces (where did the electrical fields come from?). The plasma can slide along the field lines but not across them (why?).  Since the field lines are spinning, centrifugal forces will fling them up and down the field lines, forming jets.  The other viewpoint is this, and it makes even less sense (to me that is, I haven't had a formal education in GR): The magnetic fields and the swirl of space generate a voltage difference across the field lines (Why? How?). The voltage carries current across the magnetic field lines (why are the field lines behaving like wires?). This current travels across plasma, which accelerates it, creating the jets.  Now the main thing that doesn't make sense, is that magnetic field lines are behaving like wires. Why would they? I suspect the answer lies hidden somewhere in the equivalence of EM waves in different frames, but I can't think up any convincing argument from that side.  If the answer involves GR equations, you don't need to solve it here (wouldn't make sense to me), but if you have to, just refer to the equation and what you did to it, along with the final result. Thanks! Mrs Reed safe combination Mrs Reed forgets the number combination to her safe. The combination has $4$ numbers each is a $1$ digit number. The $4$ digits add up to $10$ and there are no zeros. How many times does Mrs Reed have to try to open her safe?  My attempt: ${9 \choose 3} = 84$ but the answer is $80$. Available space not changing when resizing a partition $M$ connected $\iff$ $M$ and $\emptyset$ are the only subsets of $M$ open and closed at the same time I'm trying to understand this proof that:  $M$ connected $\iff$ $M$ and $\emptyset$ are the only subsets of $M$ open and closed at the same time  Which is:  If $M=A\cup B$ is a separation, then $A$ and $B$ are open and closed. Recriprocally, if $A\subset M$ is open and closed, then $M = A\cup(M-A)$. What? I know that if $M=A\cup B$ is a separation, $A$ and $B$ are both open. But why closed? Also, the 'recriprocally' part is totally nonsense to me. Anybody could help?  Also, there's another proof, which states: $M$ and $\emptyset$ are the only subsets of $M$ at the same time closed and open $\iff$ if $X\subset M$ has empty boundary, theb $X=M$ or $X=\emptyset$  which is proved as the following:  given $X\subset M$, we know the condition $X\cap \partial X = \emptyset$ implies $X$ is open, while the condition $\partial X \subset X$ implies $X$ is closed. Then, $X$ is open and closed $\iff$ $\partial X = X\cap \partial X = \emptyset$, this show $\iff$ for the theorem above.  First of all, I think that the condition $X$ has boundary empty implies that $X\cap \partial X$ is empty, but who said anything about $\partial X\subset X$? Also, where's the $\rightarrow$ of this proof? I can only see $\leftarrow$