I would like to make an array of buttons, which later will help me construct the board with JButton, but whenever I try to call on the code below i get a NullPointerException on the addButton method. The Exceptions are with the actionPerformed and mouseReleased in the BasicButtonListener, which I don't really understand.  public Window(int size, MainWindow mainWindow) {         this.size = size;         this.mainWindow = mainWindow;         mainWindow.getWindowList().add(this);         model = new GamePlay(size);          JPanel top = new JPanel();          label = new JLabel();         updateLabelText();          JButton newGameButton = new JButton();         newGameButton.setText("New Game");         newGameButton.addActionListener(new ActionListener() {              @Override             public void actionPerformed(ActionEvent e) {                 newGame();             }          });          top.add(label);         top.add(newGameButton);          JPanel mainPanel = new JPanel();         mainPanel.setLayout(new GridLayout(size, size));          for (int i = 0; i &lt; size; ++i) {             for (int j = 0; j &lt; size; ++j) {                 addButton(i, j); //Line 50                 mainPanel.add(buttonMatrix[i][j]);             }         }          getContentPane().setLayout(new BorderLayout());         getContentPane().add(top, BorderLayout.NORTH);         getContentPane().add(mainPanel, BorderLayout.CENTER);     }       private void addButton( int i,                             int j) {         final JButton button = new JButton();          button.addActionListener(new ActionListener() {             @Override             public void actionPerformed(ActionEvent e) {                 Player newValue = model.step(i, j);                 button.setText(newValue.name());                  updateLabelText();                  Player winner = model.findWinner();                 if (winner != Player.NOBODY) {                     showGameOverMessage(winner);                 }              }         });          buttonMatrix[i][j] = button; //Line 81      }   And the MainWindow class:  private List&lt;Window&gt; gameWindows = new ArrayList&lt;&gt;();      public MainWindow() {          JButton small = new JButton();         small.setText("3 x 3");          small.addActionListener(getActionListener(3));          JButton medium = new JButton();         medium.setText("5 x 5");          medium.addActionListener(getActionListener(5));          JButton large = new JButton();         large.setText("7 x 7");          large.addActionListener(getActionListener(7));          getContentPane().setLayout(                 new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));         getContentPane().add(small);         getContentPane().add(medium);         getContentPane().add(large);     }      private ActionListener getActionListener(final int size) {         return new ActionListener() {              @Override             public void actionPerformed(ActionEvent e) {                 Window window = new Window(size, MainWindow.this); //Line 43                 window.setVisible(true);                 gameWindows.add(window);             }          };     }
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?
Is it possible with GEE to export all the images in an image collection? Show that G is a group, if G is finite, the operation is associative, and cancellation law holds Is there a system in place to prevent new users asking, answering and accepting answers to each others' off-topic questions? What's the best way to break from nested loops in Javascript?  //Write the links to the page. for (var x = 0; x &lt; Args.length; x++) {    for (var Heading in Navigation.Headings)    {       for (var Item in Navigation.Headings[Heading])       {          if (Args[x] == Navigation.Headings[Heading][Item].Name)          {             document.write("&lt;a href=\""                 + Navigation.Headings[Heading][Item].URL + "\"&gt;"                 + Navigation.Headings[Heading][Item].Name + "&lt;/a&gt; : ");             break; // &lt;---HERE, I need to break out of two loops.          }       }    } } Short-lived sci-fi series with a former astronaut turned superhero (or maybe a police officer?) using his spacesuit for his "powers" Plot Details/Summary I only watched an episode or two of this one, so I can't recall a whole lot about it.  The protagonist is a former astronaut of some sort, who makes it his mission to clean up the crime in his city.  He might have been a police officer in his &quot;new life&quot; or he might have decided to become a sort of quasi-superhero.  In either case, I distinctly recall his space suit being the gimmick that makes him an effective crime fighter in the show.  I seem to recall the protagonist being a young, dark-haired man, and I think he had a friendship or an alliance with a young woman (maybe a fellow cop, or someone from the space program?).  I don't think there were alien beings in the show.   The criminal threats were all quite terrestrial, IIRC. Timeframe and other Publication Details This was a syndicated tv show I saw on American television, probably around the late 90s to early 2000's.  I believe the show was filmed in Canada, though I'm not certain.  I don't think it lasted very long - it was pretty dreadful.  I can say for certain the show is not Space Cop or Gerry Anderson's Space Precinct. Helix in a helix I am trying to work out a "helix in a helix" mathematically.  Intuitively I think of this as a steel cable, which is made up of a number of smaller steel cables all bound together in spiral.  If I wanted to find the length of one of the individual cables, it would be bound in a spiral in the smaller cable and then those cables bound in a larger spiral cable.  I know that if I wanted to do a helix whose ends meet, I would use the parametrization $$((a+b\cos(\omega{t}))\cos{t},(a+b\cos(\omega{t})\sin{t},b\sin(\omega{t})),t=0..2\pi$$ I've been trying to map out in my head how to, instead of curling the helix, making the helix travel in the path of a helix.  I've achieved it partially with $$((a+b\cos(\omega{t}))\cos{t},(a+b\cos(\omega{t})\sin{t},t),t=0..\infty$$ But this doesn't keep the smaller helix in tact, and turns it into a sine wave helix.  I've also tried  $$((a+b\cos(\omega{t}))\cos{t},(a+b\cos(\omega{t})\sin{t},tb\sin(\omega{t})),t=0..2\pi$$ But this gives me sort of a nautilus shape where the helix curls into itself and increases in size and curls around into itself.  What am I missing?  EDIT:  Also, what if we wanted to do this again, like a 'helix in a helix in a ... in a helix'? Reputation does not update after community wiki is removed from a post, and does not match the value displayed in the reputation audit Why are second order linear PDEs classified as either elliptic, hyperbolic or parabolic? Is there a geometric interpretation of second order linear partial differential equations which explains why they are classified as either elliptic, hyperbolic or parabolic, or is this just a naming convention? That is, do they have any relation with actual ellipses, hyperbolas and parabolas? Seatpost Overextension I've been riding with my very short seat post extended well past its maximum extension line for quite a while now. Looking at the seat post itself I don't see any signs of deformation or damage other than some very minor surface rust.   Could my bike frame have been damaged? Could the lever force have damaged the frame? I can post some pictures of the frame if needed. My bike is all aluminum. Given that the majority of biologists do not currently consider viruses to be alive, a virus can never die.  It can, however, get destroyed by long exposures to soapy water, alcohol, and apparently certain frequencies of UV light.  Why is an individual SARS-CoV2 virion not infectious forever?  Or is it? Explode string into array with no empty elements? PHP's explode function returns an array of strings split on some provided substring. It will return empty strings when there are leading, trailing, or consecutive delimiters, like this: var_dump(explode('/', '1/2//3/')); array(5) {   [0]=&gt;   string(1) &quot;1&quot;   [1]=&gt;   string(1) &quot;2&quot;   [2]=&gt;   string(0) &quot;&quot;   [3]=&gt;   string(1) &quot;3&quot;   [4]=&gt;   string(0) &quot;&quot; }  Is there some different function or option or anything that would return everything except the empty strings? var_dump(different_explode('/', '1/2//3/')); array(3) {   [0]=&gt;   string(1) &quot;1&quot;   [1]=&gt;   string(1) &quot;2&quot;   [2]=&gt;   string(1) &quot;3&quot; } Preview Breaks with Invalid Tag Name [tag:+] In the formatted preview for Questions &amp; Answers, typing a tag link with an invalid tag name "crashes" the preview. As soon as you type the following the preview stops updating and an error can be observed in the Javascript console.   [tag:+]   Observed in Safari 7 and Chrome 31.   seems related to the business rule of not allowing certain characters in tags, but it sounds like a different bug. Will something accelerate forever if a constant force is applied to it on a frictionless surface? If so how? I don't understand the fact that let's say hypothetically I was pushing a block on a frictionless surface, and I kept applying the same force on the object how it would keep accelerating! Wouldn't there have to be a certain velocity where it would stop getting faster? If not then what is actually acting on the object to cause it to accelerate infinitely? Why are Python's 'private' methods not actually private? PHP import Excel into database (xls & xlsx) Adding Table to Layout View using ArcPy? I am using ArcGIS 10.1 and I have a non-spatial table and some layers in a Data Frame.   When I switch to Layout View I want to be able to show the map in a data frame element and the table in another element (something that one could do with "Add Table To Layout" from Table Options, but I want to do this in one step without having to go to Table Options).   Is there a way to do this using ArcPy?   I couldn't find any function in the ArcPy library that would create a new Layout Element ... and then I also don't know how to add the contents of the table to the Layout Element. Authenticate to Stack Exchange using GitHub I've seen sign in methods using  as an authentication provider, for example : (AWS Cloud9)        Is it possible to authenticate into Stack Exchange using this method? At the moment there's other methods such as OpenID, Google, Yahoo and Facebook, but it would be interesting to also have the GitHub authentication. Where can I find legendary crafting materials? memoryless property of exponential distributions with random variables It is true that $P(X&gt;t+s|X&gt;t)=P(X&gt;s)$ for certain values $t$ and $s$.  However, how can I show that this still holds if:   $T$ is a continuous random variable. That is $P(X&gt;T+s|X&gt;T)=P(X&gt;s)$ Both $T$ and $S$ are continuous RVs: $P(X&gt;T+S|X&gt;T)=P(X&gt;S)$   All the random variables are independent. When conducting multiple regression, when should you center your predictor variables & when should you standardize them? In some literature, I have read that a regression with multiple explanatory variables, if in different units, needed to be standardized.  (Standardizing consists in subtracting the mean and dividing by the standard deviation.)  In which other cases do I need to standardize my data?  Are there cases in which I should only center my data (i.e., without dividing by standard deviation)?