In the below code I got a NullPointerException:  Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException  timer.setInitialDelay((int) delay);   I tried to add     //timer = new Timer(0, null); long delay = dates.getTime() - System.currentTimeMillis();   timer = new Timer(0, null);   new TimerStart();   if (delay &gt;= 0) {    timer.setInitialDelay((int) delay);    timer.restart();   }   to avoid the Exception, it works but doesn't trigger the timer ?  With this Example it works with timer trigger too, but how could it be corrected in the code above :  import java.awt.BorderLayout; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.SpinnerDateModel; import javax.swing.SpinnerModel; import java.util.Date; import javax.swing.Timer; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener;  public class SpinnerTest {   Timer timer;  Date date;  public static void main(String args[]) {    new SpinnerTest().startApp();  }   private void startApp() {  JFrame frame = new JFrame("JSpinner Sample");  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   date = new Date();  SpinnerModel model1 = new SpinnerDateModel(date,null,null,0);  JSpinner spinner1 = new JSpinner(model1);   spinner1.addChangeListener(new CalendarListener());  spinner1.setEditor(new JSpinner.DateEditor(spinner1, "HH:mm dd-MM-yyyy"));   JLabel label1 = new JLabel("Times/Dates");  JPanel panel1 = new JPanel(new BorderLayout());  JPanel panel2 = new JPanel(new BorderLayout());   panel2.add(label1, BorderLayout.WEST);  panel1.add(spinner1, BorderLayout.CENTER);   frame.add(panel1, BorderLayout.CENTER);  frame.add(panel2, BorderLayout.WEST);   frame.setSize(200, 90);  frame.setVisible(true); }   private class CalendarListener implements ChangeListener {    @Override    public void stateChanged(ChangeEvent e)  {     JSpinner jSpinner = (JSpinner) e.getSource();     date = (Date) jSpinner.getValue() ;     long delay = date.getTime() - System.currentTimeMillis();     //System.out.println(delay);     timerStart();     if (delay &gt; 0) {     timer.setInitialDelay((int) delay);     timer.restart();    }   }     }  private void timerStart() {      this.timer = new Timer(Integer.MAX_VALUE, (ActionEvent evt) -&gt; {      System.out.println("okey");     });}    }
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 to import a module given the full path? How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option. In books the equation for length contraction is derived by supposing that the velocity of the spacecraft is the same for both observers. So the question is that, is the velocity really the same for both observers? Whereas there must be some trouble in the velocities noted by observers. I mean: If the observer on the spacecraft measures the velocity of the spacecraft to be $v$ then is it possible for the other observer to measure the same velocity from the Earth? My English is pretty basic, please don't mind. Wondering how to make the liquify wave and distort color effect in Photoshop? I'd tried using distort>shear/wave/zigzag, but still can't make it similar like the photo below. I have lost my passport here in Beograd. Can I travel just with my Czech ID card from Belgrade to Budapest? Sending email in .NET through Gmail Polling the keyboard (detect a keypress) in python How can I poll the keyboard from a console python app?  Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.):     while 1:       # doing amazing pythonic embedded stuff       # ...        # periodically do a non-blocking check to see if       # we are being told to do something else       x = keyboard.read(1000, timeout = 0)        if len(x):           # ok, some key got pressed           # do something   What is the correct pythonic way to do this on Windows?  Also, portability to Linux wouldn't be bad, though it's not required. How many stickers do I need to complete my FIFA Panini album? I'm playing the , which is an Internet adaption of the classic Panini albums that are usually published for the soccer world cup, European championship, and possibly other tournaments.  The album has placeholders for 424 different stickers. The purpose of the game is to collect all 424. The stickers come in packs of 5, which can be obtained through codes found online (or, in case of the classic printed album, bought at your local newsstand).  I make the following assumptions:   All stickers are published in the same quantity.  One pack of stickers does not contain duplicates.     How can I find out how many packs of stickers I need to acquire in order to be reasonably sure (let's say 90%) that I have all 424 unique stickers? Hot and Week tabs not shown to non-logged in users (except on SO) Visiting a SE site without logging in, one can no longer access the tabs Hot and Week (except on StackOverflow). I believe this change hides the feature from those most likely to use it: casual, but repeated, visitors. A number of people visit SE sites such as Travel or Mathematics just to read the content. They have no intention to post, and consequently, no reason to register. It makes little sense to hide the Hot and Week lists from them.   I propose that the tabs  ... Hot | Week | Month should again be made visible to anonymous visitors on SE sites, as they are on StackOverflow. Understanding p-value I know that there are lots of materials explaining p-value. However the concept is not easy to grasp firmly without further clarification.  Here is the definition of p-value from Wikipedia:     The p-value is the probability of obtaining a test statistic at least   as extreme as the one that was actually observed, assuming that the   null hypothesis is true. ()   My first question pertains to the expression "at least as extreme as the one that was actually observed." My understanding of the logic underlying the use of p-value is the following: If the p-value is small, it's unlikely that the observation occurred assuming the null hypothesis and we may need an alternative hypothesis to explain the observation. If the p-value is not so small, it is likely that the observation occurred only assuming the null hypothesis and the alternative hypothesis is not necessary to explain the observation. So if someone wants to insist on a hypothesis he/she has to show that the p-value of the null hypothesis is very small. With this view in mind, my understanding of the ambiguous expression is that p-value is $\min[P(X&lt;x),P(x&lt;X)]$, if the PDF of the statistic is unimodal, where $X$ is the test statistic and $x$ is its value obtained from the observation. Is this right? If it is right, is it still applicable to use the bimodal PDF of the statistic? If two peaks of the PDF are separated well and the observed value is somewhere in the low probability density region between the two peaks, which interval does the p-value give the probability of?  The second question is about another definition of p-value from Wolfram MathWorld:     The probability that a variate would assume a value greater than or   equal to the observed value strictly by chance.   ()   I understood that the phrase "strictly by chance" should be interpreted as "assuming a null hypothesis". Is that right?  The third question regards the use of "null hypothesis". Let's assume that someone wants to insist that a coin is fair. He expresses the hypothesis as that relative frequency of heads is 0.5. Then the null hypothesis is "relative frequency of heads is not 0.5." In this case, whereas calculating the p-value of the null hypothesis is difficult, the calculation is easy for the alternative hypothesis. Of course the problem can be resolved by interchanging the role of the two hypotheses. My question is that rejection or acceptance based directly on the p-value of the original alternative hypothesis (without introducing the null hypothesis) is whether it is OK or not. If it is not OK, what is usual workaround for such difficulties when calculating the p-value of a null hypothesis?     I posted a new  that is more clarified based on the discussion in this thread. After installing Adobe PDF reader, it opens files with the .PDF file extension. Ones' default web browser opens .html files and notepad opens .txt files, etc.  Where exactly in the registry are these filetype - program associations stored in the registry?   In other words, how does Windows know with which software/program it must open a certain file(type)? Why can one bend glass fibers without breaking it, whereas glasses one comes across in real life is usually solid?  Is there also a good high-school level explanation of this? Does one open a browser “on” a URL? \nameref breaks for the star versions of section, paragraph when titlesec is loaded. I have a document that numbers paragraphs by default, but I have a few I do not want to number but would like to refer to. These are marked with \paragraph*, however, if the titlesec package is loaded at the same time, it causes nameref to display an empty string (the link box of hyperref is still visible).  MWE:  \documentclass[12pt]{article} \usepackage[sf]{titlesec} %comment this out and it works fine. \usepackage{hyperref} \begin{document} \section{Sections} \label{sec} This is \nameref{sec} \paragraph{A named Paragraph} \label{par} This is \nameref{par} \paragraph*{A starred named Paragraph} \label{par:star} This is \nameref{par:star} \end{document}   I suspect titlesec causes this defect for ALL star variants of sectioning commands but have not tested this. For me only paragraph* is relevant however a fix for all variants would be the best.  I have a hunch it might be related to this:  however this happens to go way beyond my latex knowledge and is just "magic" for me. Do not show the score for users during primaries I believe that showing the post score for nomination posts during primaries is a bad idea.  When I loaded the primaries page during the election, the first thing I saw was a post voted -1. This immediately colored my impression of the post. Reading his post didn't indeed make me wish he was a moderator, but at the same point I couldn't bring myself to click on the down arrow. He wasn't an awesome candidate, but he wasn't a -2 score candidate either. Actually, I kinda wanted to sympathy upvote instead.  I want to judge by myself whether a candidate is worth or not my +1. For some of those people I don't have an opinion already, and I want to form one on my own. I don't want game theory to kick in, I don't want to be tricked into sympathy upvotes.  Having those numbers in large print as the first thing I see about them honestly prevents me from doing so. I'd rather have their avatar there.     Some people on chat do not agree with me;  I imagine they'll post explaining why I want to be aware of their opinion while forming my own.      Regardless of the discussion here, if you do prefer to hide the scores as you vote, here's the jQuery oneliner that does just that:  $(".vote-count-post").hide() Is it possible to mark the same tag as "Interesting" and "Ignored"? Can you mark the same tag as both interesting and ignored? If you can, what is the resulting appearance of a question with that tag? Is it possible to delete multiple elements from a list at the same time? If I want to delete elements at index 0 and 2, and try something like del somelist[0], followed by del somelist[2], the second statement will actually delete somelist[3].  I suppose I could always delete the higher numbered elements first but I'm hoping there is a better way. I'm not normally a fan of mac software implementations, but recently I saw a copy of Parallels Desktop for mac that I was very much impressed by. I looked into parallel's offerings for Linux (I was initially excited that they developed for *nix) but found that it has essentially the same features as VMware.   Does anyone know if there is a software solution for linux that offers the level of integration that the current Parallels Deesktop for mac has?  I looked into wine for the programs I want to run and was very frustrated. I feel like all the ratings in their application database were fabricated honesty. I've tried wine once every Ubuntu release since 8.10 and have never gotten it to work stably. Isomorphism $f$ preserves the order of an element? Let's say $f$ is an isomorphism $f:G  \rightarrow G'$, where $G$ and $G'$ are multiplicative groups.  Then for $x\in G$, if $f(x) = x' \in G'$. Do we have always have $\text{ord}(x) = \text{ord}(x')$? Why? When I do upgrade it gets stuck here:  user@plato:~# sudo apt-get upgrade Reading package lists... Done Building dependency tree        Reading state information... Done Calculating upgrade... Done The following packages will be upgraded:   bind9-host coreutils cpio curl dnsutils libbind9-90 libc-bin libc-dev-bin   libc6 libc6-dev libcgmanager0 libcurl3 libcurl3-gnutls libdns100   libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libisc95 libisccc90   libisccfg90 libjasper1 liblwres90 libplymouth2 libsepol1 libssl-dev   libssl-doc libssl1.0.0 linux-libc-dev mime-support multiarch-support ntp   ntpdate openssl plymouth plymouth-theme-ubuntu-text python3-distupgrade   ubuntu-release-upgrader-core unzip 39 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 16.0 MB of archives. After this operation, 12.3 kB of additional disk space will be used. Do you want to continue? [Y/n] y 0% [Connecting to us.archive.ubuntu.com (2001:67c:1562::15)] ░   When I do update it gets stuck here:  user@plato:~# apt-get update 0% [Connecting to us.archive.ubuntu.com (2001:67c:1562::14)] [Connecting to sec░   I'm able to ping us.archive.ubuntu.com just fine:  user@plato:~# ping us.archive.ubuntu.com PING us.archive.ubuntu.com (91.189.91.23) 56(84) bytes of data. 64 bytes from economy.canonical.com (91.189.91.23): icmp_seq=1 ttl=54 time=81.5 ms 64 bytes from economy.canonical.com (91.189.91.23): icmp_seq=2 ttl=54 time=81.5 ms 64 bytes from economy.canonical.com (91.189.91.23): icmp_seq=3 ttl=54 time=81.5 ms 64 bytes from economy.canonical.com (91.189.91.23): icmp_seq=4 ttl=54 time=81.4 ms ^C --- us.archive.ubuntu.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3004ms rtt min/avg/max/mdev = 81.425/81.528/81.582/0.355 ms   What can i do to fix this?    What I have tried so far.  I've tried following directions on this blog:   To force apt-get to use IPv4 exclusively   Create a file in /etc/apt/apt.conf.d/99force-ipv4 Add this line to newly created file Acquire::ForceIPv4 false; Apt-get will now use IPv4 exclusively I have just installed Ubuntu 16.04 32-bit.   When I opened its software store, I found that it's not showing the apps I installed in Ubuntu 15.10 like Clementine, Gdebi package installer or synaptic package manager, dconf, acetoneiso etc.   I need these applications. How can I install them?