import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.*; public class SecondsTimer{      private ScheduledExecutorService timer;      private int seconds=0;      public SecondsTimer(){           long second=1000;           timer.scheduleAtFixedRate(new Runnable(){public void run(){seconds++;}},                                     second, second, TimeUnit.MILLISECONDS);      }      public int getSeconds(){return seconds;} }   In the above code, I am attempting to create code to count seconds as they pass. I'm getting a runtime error, NullPointerException for line 9. Is there an easier way to do this, or am I missing something obvious?
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?
On the three Stack Overflow chat servers, the  page displays the following image:    Is it from an actual episode, or is it a 'shop? Would depositing large cash amounts cause problems? I saw  recently where a man withdrew $600,000 USD in cash from his bank.  I'm sure many folks here would advise against this move for obvious (and perhaps not-so-obvious) reasons.   My question: suppose you did this and then, some months later, changed your mind and wanted to re-deposit with a bank.  I assume the gent cannot simply walk into a bank with $600,000 USD and deposit it, right?  Wouldn't money-laundering alarms be raised?  Wouldn't the IRS like to know where the money came from? It seems that they can all mean "easily provoked to anger"  irascible：Easily provoked to outbursts of anger; irritable.  fractious：Irritable; argumentative; quarrelsome.  irritable：1.Capable of being irritated. 2.Easily exasperated or excited.  atrabilious：1.Characterized by melancholy. 2.ill-natured; malevolent. How do I center text horizontally and vertically in a TextView? I've just recently started playing D&amp;D 4e through the Red Box, and I am confused about how to fill in the power cards.  So, take Nimbus of Holy Shielding for instance. I understand the Target and Hit components as well as the effect, but my question is about the Attack component. It reads:     Attack: Wisdom vs Will.   Does the mean whatever my Wisdom score is, without the modifier, is compared to the Will score of the enemy? Would I then not even have to roll a d20 to see if it works? What documentation does a Mexican citizen need to fly domestically within Mexico? If a Mexican citizen, residing in Mexico, wants to fly domestically, what documents are needed?   Example: Flying from Torreon to Cancun (different states in Mexico) Effect of switching response and explanatory variable in simple linear regression Cohen's d for 2x2 interaction I have a significant 2x2 interaction in a between-subjects design.  I would normally report omega-squared as my effect-size measure, but I've been asked to provide Cohen's d instead?  Can Cohen's d be computed for an interaction?  If so, how? Why didn't Star Trek TOS have better medical equipment for Vulcans? In  when Ambassador Sarek became critically ill, why didn't they send him home or send for a Vulcan medical expert? Since they were hosting many prominent political figures from many races, it seems strange that they did not have much medical support for a race so common as Vulcans (who are part of the Federation). Books about matroids Could you recommend any approachable books/papers/texts about matroids (maybe a chapter from somewhere)? The ideal reference would contain multiple examples, present some intuitions and keep formalism to a necessary minimum.  I would appreciate any hints or appropriate sources. A typical $L^p$ function does not have a well-defined trace on the boundary As the question states... In Windows 7 with a single screen, you can drag a window to the right and a window to the left to maximize them both at half the screen, letting you quickly and neatly see two windows simultaneously.  If I have 2 monitors, is there a way to do this with 4 windows, where each monitor gets 2 windows split across each screen? How was Loki not crushed by Mjolnir? In the Thor movie, Thor puts Mjolnir  on top of Loki at the end of the movie to stop him from moving.  Why did this not crush Loki?  And if it did not crush him, why could he not just roll out from under it? I want to shrink my second (LVM) partition, in order to create a new partition in the newly freed space. I am using the Live CD to do so, because I know I can't resize/move this partition while it is in use. When I opened GParted in the Live CD, I realized that I could not resize the partition, because when I right-click it, the option "resize/move" is disabled.  I tried to unmount it, to "lazy" unmount it (umount -l /dev/sda2) but it didn't work.  A screenshot from GParted: I have unistalled and reinstalled the Ubuntu Software Center as per info I found in a similar thread and I got the same response about line 91 or something like that.  I just tried to upload a screen shot but since I'm new it won't allow me to.  I also can not figure out how to cut and paste anything so I have to hand type what the error screen says, both when I attempt to open the software center and nothing happens, when I try to enter commands into the terminal to uninstall, reinstall, whatever I get the same following:  COULD NOT INTITIALIZE THE PACKAGE INFORMATION An unresolvable problem occured while initializing the package information Please report t:his bug against the 'update-manager' package and include the following error message: 'E: Malformed line 91 in source list/etc/apt/sources.list (dist parse)  E: The list of sources could not be read.,  E: The package list of status file could not be parsed or opened.   How do I report bugs?  What can be done about this.  I have searched and everything everyone says to do leads me back to the same line error message.  So, I don't know how to get to line 91 in the source list; to tell you what it says. Sorry, I'm really new to this. That is what I need is to find out how to get there and fix what it says. I would really like to NOT have to re partition my hard drive and start from scratch, so I'm really looking forward to getting this problem solved. I need to be able to install new software. Here's a screen capture from a site where I can view /site-analytics:    The orange "all posts" curve should be strictly larger than the blue "questions" curve, but they are mistakenly displaying the same data. Show all the file up to the match grep --before-context 5 shows 5 lines before the match.  I want to show everything before the match. Doing grep --before-context 99999999 would work but it is not very... professional.  How to show all the file up to the match? What does the decay constant mean? In my curriculum, the  is "the probability of decay per unit time"  To me, this seems non-sensical, as the decay constant can be greater than one, which would imply that a particle has a probability of decaying in a time span that is greater than 1.  Can someone explain this? Find weak form of linear transport equation I am stuck on the following problem that says:       a) Find a weak formulation for the partial differential equation $${\partial u\over\partial t\ }+ c{\partial u \over \partial x\ }=0$$    b) Show that $u=f(x-ct)$ is a generalized solution of $${\partial u\over\partial t\ }+ c{\partial u \over \partial x\ }=0$$ for any distribution $f$    My Attempt:   I know that in order to find a weak form of a pde, we need to multiply it by a test function, then integrate it. Also, to find a generalized solution, we need to find a weak solution and just multiply it by the Heaviside function.  Let's take any test function $\phi $, then we have (integrating by parts second part of the integral) $$\int_{\Omega } ( {\partial u\over\partial t\ }+ c{\partial u \over \partial x\ })*\phi(x) dx= \int_{\Omega } {\partial u\over \partial t}\phi(x) dx - c\int_{\Omega } u(x,t)\phi'(x)dx$$ where $\phi $ vanishes at boundaries. So, is it the final form or can we proceed further? And how am I supposed to find a generalized solution?  Can someone help me out? Thanks in advance for your time. I want to display from cache for a long time and I want a slightly different behavior on page render vs loading the page from cache.  Is there an easy way I can determine this with JavaScript?