I've created my own CategoryComboBox from JComboBox and using an update() method to add the items. I can't understand why it's working from one String [] (see below, commented out,"Bird", "Cat", etc) and not another (transactions.getCategoriesArray() which returns also String [])  Below is my custom JComboBox:  public class CategoryComboBox extends JComboBox&lt;String&gt; {      /**      *       */     private static final long serialVersionUID = 1L;      private Transactions transactions;      public CategoryComboBox(Transactions transactions) {         update();     }      public void update() {         removeAllItems(); //      String[] categories = { "Bird", "Cat", "Dog", "Rabbit", "Pig" }; // works         String[] categories = transactions.getCategoriesArray(); // line 24, errors         for( String c : categories ) {             addItem(c);         }     } }   If it helps, here is my method of the transactions object's class:  public class Transactions {      //...      public String [] getCategoriesArray() {         String[] categories = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };         return categories;     }    }   When I click Run... in Eclipse I get the following errors in the console:  Exception in thread "main" java.lang.NullPointerException     at biz.martyn.budget.CategoryComboBox.update(CategoryComboBox.java:24)     at biz.martyn.budget.CategoryComboBox.&lt;init&gt;(CategoryComboBox.java:17)     at biz.martyn.budget.NewTransactionDialog.&lt;init&gt;(NewTransactionDialog.java:36)     at biz.martyn.budget.TransactionsToolbar.&lt;init&gt;(TransactionsToolbar.java:34)     at biz.martyn.budget.Budget.main(Budget.java:41)   Should there be anything different in either case?
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?
How do I prevent object distortion when applying a curve modifier? I have a PDF with 100 pages. How can I make a new PDF that displays 4 pages on one?  I know that I can do it with Chrome by printing the PDF to new PDF and change this in the options. But I want to make it for a lot of files and put it as a script. TV series with pull out phone screens and pink/purple space ships I’m looking for a TV show where an alien race comes to Earth and sets up big purple/pink cylindrical or cone shaped spaceships in various cities around the world. The Aliens are not hostile but actually created peace and eliminated hunger on Earth.    I believe the aliens had some human features and were wise and calm the main actor had a phone with a pull out screen I believe the main actor worked for or with the aliens I believe that in the last episode some humans and aliens go into some kind of pods and perhaps leave Earth? one of the space ships was located in a major US city. Maybe Washington DC or another East Coast city   Could someone please tell me what TV series this is? I have been searching everywhere and cannot find it. Thanks! If I call finalize() on an object from my program code, will the JVM still run the method again when the garbage collector processes this object?  This would be an approximate example:  MyObject m = new MyObject();  m.finalize();  m = null;  System.gc()   Would the explicit call to finalize() make the JVM's garbage collector not to run the finalize() method on object m? Combine multiple results in a subquery into a single comma-separated value I've got two tables:  TableA ------ ID, Name  TableB ------ ID, SomeColumn, TableA_ID (FK for TableA)   The relationship is one row of TableA - many of TableB.  Now, I want to see a result like this:  ID     Name      SomeColumn  1.     ABC       X, Y, Z (these are three different rows) 2.     MNO       R, S   This won't work (multiple results in a subquery):  SELECT ID,        Name,         (SELECT SomeColumn FROM TableB WHERE F_ID=TableA.ID) FROM TableA   This is a trivial problem if I do the processing on the client side. But this will mean I will have to run X queries on every page, where X is the number of results of TableA.   Note that I can't simply do a GROUP BY or something similar, as it will return multiple results for rows of TableA.   I'm not sure if a UDF, utilizing COALESCE or something similar might work? Headless linux install Disk brakes severely reduced in power after replacing bearings I computed the homology groups of the torus, can someone tell me if this is correct? The calculation, not the result that is. Thanks!  The cells of $T^2$ are $e^0, e^1_a, e^1_b, e^2$  The chain groups are  $$ C_0(T^2) = \{ k e^0 |&#160;k \in \mathbb{Z} \} = \mathbb{Z}$$  $$ C_1(T^2) = \{&#160;k_1 e^1_a + k_2 e^1_b |&#160;k_1 , k_2 \in \mathbb{Z} \} = \mathbb{Z} \oplus \mathbb{Z}$$  $$ C_2(T^2) = \mathbb{Z}$$  $$ C_k(T^2) = \{ 0 \} , k &gt; 2$$  Now the homology groups:  $$ H_0(T^2) = \ker \partial_0 / im \partial_1 = \mathbb{Z} / 0 = \mathbb{Z}$$  where $im \partial_1 = 0$ because there is no chain in $C_1(T^2)$ whose boundary is a zero-chain in $C_0(T^2)$. (Is this reasoning correct?)  $$ H_1(T^2) = \ker \partial_1 / im \partial_2 = \mathbb{Z} \oplus \mathbb{Z}$$  where $\ker \partial_1 =  \mathbb{Z} \oplus \mathbb{Z} $, i.e. again everything maps to zero because there is no element in $C_1$ whose boundary maps to an element in $C_0$.  $im \partial_2 = 0$ again because there is no element in $C_2$ whose boundary is an element of $C_1$.  I don't want to use Hurewicz to do $H_1$.  $$ H_2(T^2) = \mathbb{Z}$$ using similar arguments as above.  Thanks for your help.  Edit  I posted the computations as an answer below. I got two up votes but I don't know by who so I'm not yet sure I can trust them... I've created a Lightning component to view key details for the Account and Contact lookups from a Case, like so:    The problem is, I have been unable to get field content to render when  using the &lt;force:inputField/&gt; or &lt;force:outputField/&gt; components when I place them inside the markup to style them as cards. I've used &lt;ui:outputText/&gt; as a workaround, but that means I don't get any of the built-in behaviors I would get with the &lt;force:*Field/&gt; components -- like Lightning styling, which means I have to manually do it using SLDS.  This displays the contact name as expected:  &lt;aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="LightningCaseTestController"&gt;   &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}" /&gt;   &lt;aura:attribute name="recordId" type="Id" /&gt;   &lt;aura:attribute name="contact" type="Contact" default="{sobjectType: 'Contact'}"/&gt;    &lt;force:outputField value="{!v.contact.Name}"/&gt;   &lt;force:inputField value="{!v.contact.Name}"/&gt;  &lt;/aura:component&gt;   This does not:  &lt;aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="LightningCaseTestController"&gt;   &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}" /&gt;   &lt;aura:attribute name="recordId" type="Id" /&gt;   &lt;aura:attribute name="contact" type="Contact" default="{sobjectType: 'Contact'}"/&gt;    &lt;article&gt;     &lt;force:outputField value="{!v.contact.Name}"/&gt;     &lt;force:inputField value="{!v.contact.Name}"/&gt;   &lt;/article&gt;  &lt;/aura:component&gt;   Basically, it appears that as soon as any markup is placed around the &lt;force:*Field/&gt; tags -- even just a &lt;div&gt; -- they no longer render. Examples in Trailhead and other places all seem to use &lt;ui:outputText/&gt; or &lt;ui:input*/&gt;.  This seems like a lot of extra manual work. Am I missing something?  Update: it only fails when the component is included in a Lightning page -- such as the record detail page -- from Lightning App Builder. If I add it to a simple Lightning app, it works:  &lt;aura:application &gt;     &lt;c:LightningCaseTest recordId="SOMECASEID" /&gt; &lt;/aura:application&gt;   So it appears to be a bug? Optimizing a screenshot for adding in a document and printing When you discard cards at the beginning of the game, where do they go? The appearance is that they get shuffled back into the deck. However, after discarding key cards and not receiving them the whole game, I am now wondering if they get put in the bottom of the deck. Where do they go after being discarded? I'm reading Galois Theory by Steven H. Weintraub (second edition), and finding that I'm at least somewhat short on the prerequisites. However the following proof looks wrong to me - am I misunderstanding something, or is it actually an incorrect proof?  Lemma 2.2.3. Let $F$ be a field and $R$ an integral domain that is a finite-dimensional $F$-vector space. Then $R$ is a field. Proof. We need to show that any nonzero $r \in R$ has an inverse. Consider $\{1, r, r^2, \cdots\}$. This is an infinite set of elements of $R$, and by hypothesis $R$ is finite dimensional as an $F$-vector space, so this set is linearly dependent. Hence $\sum_{i=0}^n{c_i r^i} = 0$ for some $n$ and some $c_i \in F$ not all zero.  It then goes on to show, given the above, that we can derive an inverse for $r$. However, if I consider examples like $r = 2 \in Q[\sqrt{2}]$, $r = \sqrt{2} \in Q[\sqrt{2}]$ or $r = 2 \in Q[X]/{&lt;X^2&gt;}$, the set $\{1, r, r^2, ...\}$ doesn't look linearly dependent to me. I do believe the lemma is true (and might even be able to prove it), but this does not look like a correct proof to me. Am I missing something? [Edit] Well yes, I am. Somehow I had managed to discount the possibility of any $c_i$ being negative, despite repeatedly looking at each fragment of the quoted text in an attempt to find what I might be misunderstanding. Enabling GPU rendering for Cycles? Prospective PhD contacts potential supervisor but receives no answer after 2-3 emails, what to do? Say a prospective PhD has a high reply rate (90-95%) to first contact emails with potential superviors. He/She has a well thought out e-mail, but a particular professor (here: USA) that is in the top preferences does not reply after two to three e-mails that were sent within a time frame of three months. I also followed the instructions on the professor personal website in the section "prospective PhD students". The student has already contacted some of the advisor students and has received positive feedback about the professor.  Should the student just give up and move on? Should the student keep trying?  Aside from the obvious "I have too many incoming e-mails to answer" or "I am out in the field", what could create a no response behavior from the professor?  I have seen the simplistic answer "move on, bad advisor, doesn't have time, etc". But this seems a contradiction in this case. The PhD students like the professor and say he/she is personable and no e-mail response after a few well written emails. Where did they go / do they went? Where did they go?   Where do they went?   Can you please advise which of above forms is correct?  I'm pretty sure that first one is fine but wondering about second one.   Can I use a second form as well or it's incorrect? I am trying to create Thiessen (Voronoi) polygons, based on points within a defined shapefile extent. The output should be inclusive to the feature.  The output I receive now is the rectangular area around the selected points.    Steps I am using: 1. select points of interest (inside and outside spatial extent) 2. set primary display field to FID (aka:ObjectID) 3. Environment… > Set 'Analysis Mask' to shapefile with feature (in this case, a watershed)  Now here is where the problem starts. I have a set of instructions for arc 9.3, but I am now operating on ArcGIS 10 (Spatial Analyst installed &amp; activated). Also, just to clarify, I did scour the inter-webs for some number of hours- Esri support, gis.SE, Professor Google...  ########  9.3.1 version: Spatial Analyst >> Distance >> Allocation - set 'Assign To' as point shapefile of selected data - set cell size  10.0 methods tried: Analysis >> Create Thiessen Polygons -- Many variations of selected features -- File locations, both inside and out of file geodatabase  I am open to any solution, using Arc 10.0 and/or python would be ideal.  The first image is an example.  The output does not need to be exact.  wiki: What would Voldemort have done had he won? This might sound like speculation, but can it be reliably predicted from canon what Voldemort would have done after he won, were he successful in defeating Harry and the Order?  Would he just rule over the wizard world and keep up the masquerade, or would he try to take over the whole Earth by starting a (dark-)wizard vs. muggle war? The force of gravity is constantly being applied to an orbiting object.  And therefore the object is constantly accelerating.  Why doesn't gravity eventually "win" over the object's momentum, like a force such as friction eventually slows down a car that runs out of gas?  I understand (I think) how relativity explains it, but how does Newtonian mechanics explain it? Is it supposed to be a HTML or an HTML I've seen many people who say:     This is a HTML page.   Yet I've also seen many people who say:     This is an HTML page.   Are both usages equally correct?  Or, which is the grammatically correct one?       Possible Duplicates: How to construct an example of a probability distribution for which $\mathbb{E}\left(\frac{1}{X}\right)=\frac{1}{\mathbb{E}(X)}$ holds, assuming $\mathbb{P}(X\ne0)=1$?    The inequality which follows from Jensen's inequality for a positive-valued RV $X$ is like $\mathbb{E}\left(\frac{1}{X}\right)\ge\frac{1}{\mathbb{E}(X)}$ (the reverse inequality if $X&lt;0$). This is because the mapping $x\mapsto\frac{1}{x}$ is convex for $x&gt;0$ and concave for $x&lt;0$. Following the equality condition in Jensen's inequality, I guess the distribution has to be degenerate for the required equality to hold. A trivial case where the equality holds is of course if $X=1$ a.e. Here is an example I found in a problem book: Consider a discrete random variable $X$ such that $\mathbb{P}(X=-1)=\frac{1}{9}, \mathbb{P}(X=\frac{1}{2})=\mathbb{P}(X=2)=\frac{4}{9}$. It is then easily verified that $\mathbb{E}\left(\frac{1}{X}\right)=\frac{1}{\mathbb{E}(X)}=1$.   This example shows that $X$ need not be positive (or negative) a.e. for the equality in the title to hold. The distribution here is not degenerate either.  How do I construct an example, possibly like the one I found in the book? Is there any motivation?