This program is a work-in-progress tic-tac-toe game, where I've only just made the buttons; at least, theoretically. I looked up "null pointer exception" before posting this, but still don't understand how it applies here. Help?  //this line is line four public class TicTacToe extends JFrame {   public static void main(String[] args) {     new TicTacToe();   }   public TicTacToe(){     super.setTitle("Tic Tac Toe");     super.setSize(800, 800);     super.setDefaultCloseOperation(EXIT_ON_CLOSE);     buildPanel();     super.setVisible(true);   }   public void buildPanel(){     GridLayout g = new GridLayout(3,3);     JPanel p = new JPanel();     p.setLayout(g);     JButton [] buttons = new JButton[9];     //I'm adding text temporarily to help me see where each button's position     buttons[0] = new JButton("One");     p.add(buttons[0]);     buttons[1] = new JButton("Two");     p.add(buttons[1]);     buttons[2] = new JButton("Three");     p.add(buttons[2]);     buttons[3] = new JButton("Four");     p.add(buttons[3]);     buttons[4] = new JButton("Five");     p.add(buttons[4]);     buttons[5] = new JButton("Six");     p.add(buttons[5]);     buttons[6] = new JButton("Seven");     p.add(buttons[6]);     buttons[7] = new JButton("Eight");     p.add(buttons[8]);     buttons[8] = new JButton("Nine");     p.add(buttons[8]);      add(p);      ActionListener Callback = event -&gt; {       String label = event.getActionCommand();      };     for (int i=0;i&lt;buttons.length;i++){       String string="O";       if (i%2==0){         string = "X";       }       buttons[i].setText(string);       buttons[i].addActionListener(Callback);     }   } }   The Result:       Exception in thread "main" java.lang.NullPointerException     at java.desktop/java.awt.Container.addImpl(Container.java:1117)     at java.desktop/java.awt.Container.add(Container.java:436)     at TicTacToe.buildPanel(TicTacToe.java:37)     at TicTacToe.&lt;init&gt;(TicTacToe.java:13)     at TicTacToe.main(TicTacToe.java:7)
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?
C++ templates that accept only certain types What does an icon on the tag mean, for example the "rg" before the sql-server tag as pictured below? How do I help my third-grader focus on homework? My child just entered third grade, and the homework load is much higher this year, with a lot of writing and math drills. It is all work that she can do easily, but it's causing the whole family a lot of pain, because she's have a really hard time just sitting down and doing it — asking many questions about things she clearly actually knows, and getting distracted by the smallest thing going on around her. (Setting up a special quiet area isn't helping, because the distractions could be her pencil or a sudden burst of word association based on something in the lesson.)  So, a page of writing and a couple of pages of math which could be done in fifteen minutes total is taking an hour and a half. She can easily explain the reasoning behind the math problems, but when it comes to writing down what she just said, it's like pulling teeth. She'll slowly write a word, sounding it out in slow motion as she writes each word. And she'll say that she doesn't understand a question, but when she actually gets her mind pointed at it, she can write a great answer. And she's clearly picking up the concepts in class; I have no doubt that she actually understands, which is part of our frustration.  My wife feels like she's just wanting attention, but I think it's more about our daughter's own ability to focus. We both feel that sitting down and working painfully through each question isn't really helping her. That works, but my wife feels like it's just rewarding the behavior, and I feel like it's not really helping her learn any better focus on her own, which, you know, she'll need in actual life. And, we're happy to spend child with our kid, this pretty much the opposite of quality time.  Neither rewards or consequences seem to have any effect, and nor do charts. All of those things basically just seem to add another layer of complication, distraction, and misery. What else can we do? The Android OS monitors the power consumption of running apps and hardware (display). As you may guess, this is a useful feature as it allows to track down energy greedy apps.  Is there an application that would do such monitoring on Mac OS?  It should calculate the percentages of the charge that an application/process/hardware has used.  I use plenty of little software that runs in the background permanently. It would be nice to know if such little helpers drain the battery significantly. A sequence $\{x_j\}$ is said to be fast-Cauchy if $\sum_1^\infty d(x_j,x_{j+1})&lt;+\infty$. Show that every Cauchy sequence has a fast-Cauchy subsequence.   **My attempt:**Argue by contradiction, suppose there is no such subsequence. Then for any subsequence $\{{x_j}_k\}$,  $\sum_1^\infty d({x_j}_k,{x_j}_{k+1})$ diverges. Vaguely recall from an analysis course, if a series diverges, it doesn't not satisfy the Cauchy criterion. That is to say, there exists $\epsilon&gt;0$ such that for all $k$ and all $p\ge1$, $d({x_j}_{k+1},{x_j}_{k+2})+...+d({x_j}_{k+p}+{x_j}_{k+p+1})\ge\epsilon$.  Then I intuitively think that this is a contradiction, since if the original series is Cauchy, then after a large $N$, since $d(x_m,x_n)$ has to be very small, so that their sum should be smaller than given $\epsilon$, which is a contradiction. But I don't know how I can write down the concrete proof? Calculating Image boundary / footprint of satellite images using open source tools? Is there a reasonable statistic test one can do to standard random number generators (say, one of those that come built in in Python libs) which shows they are not really random?  (By reasonable I mean to exclude silly things like «generate a looong list and see that it is periodic»)  Later: Notice I am looking for a test that fails on standard generators. How can I solve "Be aware that removing the lock file is not a solution and may break your system"? I did: sudo apt-get update  I got this: Reading package lists... Done E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1131 (packagekitd)  N: Be aware that removing the lock file is not a solution and may break your system.  E: Unable to lock directory /var/lib/apt/lists/  I used to just remove the lock file, but I've never seen that note before (did it break my system?)?? What do I do? What is a loss function in decision theory? My notes define a loss function as the 'cost' incurred when the true value of $\theta$ is estimated by $\hat\theta$. What kind of cost is it talking about? monetary cost? or is it something related to errors? Can I configure Ubuntu to never install a specific package even if it is required by another package I install? I have a 17 inch LCD, with a maximum resolution of 1280x720. It works fine, but there are some apps that require 1024x768. I know that the maximum resolution is called like that for a reason, but is there no way of increasing the resolution, other than getting a bigger monitor? I  just got these 10 e-mails 5 hours ago from do-not-reply@stackexchange.com:      Recently, you asked a question on [X] Stack Exchange, but you haven't verified your email address yet.      Click on the following link to verify your email and set a password so that you can log in.      Here, [X] refers to all of the following:    GameDevelopment.SE SharePoint.SE Unix.SE  Skeptics.SE Japaneese.SE HomeImprovement.SE SciFi.SE PersonalFinanceMoney.SE  DatabaseAdmins.SE  TeX.SE    I haven't posted on any of these except for TeX.SE, but that was not recently, and through my real account.   =   I asked about this , and was told that someone seems to be impersonating me by using my email. Is it possible for staff to stop this?   Also, I'm pretty surprised there is no measure to stop people from using emails to existing SE accounts (see for example, on wordpress.com, if you use an e-mail which has an existing account on wp.com, you are asked to log in.).    EDIT:  I just got 2 more emails an hour ago for SharePoint.SE, and for AmateurRadio.SE. How to create a site in a sitecollection on a remote SPServer using C# I'm not entirely clear on how Counterspell works, when trying to counter higher-level spells: the CS description only talks about disrupting a creature you can see, within 60 feet, casting a spell.   However, when trying to counter a higher level spell:   Do I know what spell is being cast?  Do I at least know (somehow intuit, based on VSM components) the level of the spell? Or can I tell the spell/level of the spell by sensing a disturbance in The Weave? (I.e., if the spell is being cast using Subtle Spell, can I still tell what's going on?)   The point of the question is to determine how fruitful CS can be in combat--if I know what the other guy/gal is casting (or at least the level), I can decide whether I want to spend my L8 slot to counter his/her L8 slot. But if I have no idea, and I end up using a L8 slot to counter a L3 spell... seems a bit painful.  Hope this made sense! When doing a clean re-installation of El Capitan (highest supported version) from a bootable USB on an older Mac (MBP, 15-inch, Late 2008), I get this error:  An unexpected error occured while signing in. AMD-Action:authenticate:SP  The error shows up, while logging in with the Apple ID into the App Store in the installer.  I tried with different Apple IDs,  Also tried running these commands in the Recovery Terminal and restarting: csrutil clear csrutil enable Why are the characters on the keyboard all capitalized? Why are all the letters (A, B etc) and all the writings (Home, Page Up etc) on the keyboard, capitalized?    Especially, the letters, because a new user could rightly expect uppercase letters to be entered upon pressing those keys to find the contrary. In League of Legends, there are a number of effects which revive a champion upon death.  The item  is the most well-known and widely used of these.  I was wondering, however, whether its effect would come before or after other revive effects?  I have two examples.  First, Zilean's ultimate  will provide a champion with a Guardian Angel -like buff for a limited time.  If a champion has this buff in addition to a Guardian Angel, which effect will happen first?  Second, Anivia's passive  allows her to come back to life if her egg is not destroyed after she is killed.  If she has a Guardian Angel, will her passive be triggered before or after it? How does this compare to  and ?  It seems like in one case it is more beneficial to have Guardian Angel's precedence be greater, and in the other it is more beneficial to have it be less.  In the first scenario, if the Guardian Angel was triggered first, then Zilean would have a good chance of simply wasting his ultimate.  On the other hand, if it is triggered after these revival effects, then Anivia could not get the full benefit of her passive.  Is there a set order of precedence, or does each revival effect have their own unique "priority level" that is explicitly detailed for each ability? Faculty positions: What to say in a statement on diversity? It's become clear that last night's (Tues Jan 8th 2019) patches to Windows 7 broke SMB2 networking in Lanman Server.  One or both of KB 4480970 and KB 4480960 results in any OS that uses SMB2 (such as Windows XP, some Windows 7, and same generation server OS' and Mac OS X machines (certainly 10.10, 10.11 not sure about others yet)) being unable to connect to Windows 7 Pro shares.  Client machines repeatedly prompt for login despite credentials being correct. Family name pluralization When pluralizing family (last) names that also happen to be common English words, does the pluralization follow the same rules as the common word?  For example, "the Smith family" can be pluralized as "the Smiths", but what if the family name is "Wolf" or "Fish"?  Would the correct pluralization be "the Wolfs" or "the Wolves"?