NullPointerException in my program
What is a NullPointerException, and how do I fix it?
Windows 7 finding location of installed program A friend of mine asked me the following question:      Suppose you have a basket in which there is a coin. The coin is marked   with the number one. At noon less one minute, someone takes the coin   number one and put into the basket two coins: the number two and the   number three. At noon less $\frac{1}{2}$ minute, he takes the coin   number two and put into the basket the coins number $4$ and the number   $5$ and so on. At noon less $\frac{1}{k}$ he takes the coin number $k$   and put two other coins.       The question is: How many coins I can find in the basket at noon?   Intuitively the answer is $\infty$ because I added one coin for infinite times. But the correct answer seems to be $0$ because every coin numbered $k$ has been removed at noon less $\frac{1}{k}$ of minute. What is the correct answer? Thanks. The use of nominative "whom" (as in “persons whom it is foreseeable are likely to...”) Line-breaking widget layout for Android I'm trying to create an activity that presents some data to the user. The data is such that it can be divided into 'words', each being a widget, and sequence of 'words' would form the data ('sentence'?), the ViewGroup widget containing the words. As space required for all 'words' in a 'sentence' would exceed the available horizontal space on the display, I would like to wrap these 'sentences' as you would a normal piece of text.  The following code:  public class WrapTest extends Activity {     /** Called when the activity is first created. */     @Override     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         LinearLayout l = new LinearLayout(this);         LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(                 LinearLayout.LayoutParams.FILL_PARENT,                 LinearLayout.LayoutParams.WRAP_CONTENT);         LinearLayout.LayoutParams mlp = new LinearLayout.LayoutParams(                 new ViewGroup.MarginLayoutParams(                         LinearLayout.LayoutParams.WRAP_CONTENT,                         LinearLayout.LayoutParams.WRAP_CONTENT));         mlp.setMargins(0, 0, 2, 0);          for (int i = 0; i &lt; 10; i++) {             TextView t = new TextView(this);             t.setText("Hello");             t.setBackgroundColor(Color.RED);             t.setSingleLine(true);             l.addView(t, mlp);         }          setContentView(l, lp);     } }   yields something like the left picture, but I would want a layout presenting the same widgets like in the right one.        Is there such a layout or combination of layouts and parameters, or do I have to implement my own ViewGroup for this? How to recover files after deleted my Ubuntu partition? Why is the word 'number' abbreviated to 'No.' in UK English and '#' in American English? Why the disparity? And why use 'No.'? Is it from the French?  And the hash or pound sign seems a weird choice too, is there a history or any reason involved? GUI does not start Initially, the computer was showing the error as mentioned in   question. Fixing it resulted in the above error.  Please take look at the last line   Started GNOME display manager... and deal with any system changes..p link was shut down.....     One more thing before all this problem I have edited xorg.conf file to use  as suggested on .  I don't know if that's the reason but I thought it is important to share. How to store and preserve lots of data? I have many DVDs with movies and games, they are getting old and dusty, some of them are damaged. And I have more than 300 GB of general files in my PC. I want to store and preserve all of my data and keep them for a long long time.  I want to know what is the best and more reliable storage media that I should use and... I can buy. I will copy all of my DVDs to a new media and throw all of my DVDs away. It will take a very smaller physical space.  I think that everything that I need to store is currently 800 GB.  I do not like optical discs, because they are fragile and I have lost many CDs and DVDs. Hard drives would be good, but they can suddenly stop working, and it is very expensive to recover data from a broken hard drive.  Other questions: How often will I have to copy the files to a new storage media? Is it good idea to have another copy of each file stored in another storage media?  Edit: If I put all of the movies and games in a HDD, if the HDD stops working, I will lose everything. This is how valuable they are for me: If I lose 10% of them, I will not cry, because I can get new ones, but if I lose 90%, it will be a disaster.  Edit 2: I do not think that that online storage is reliable even if I pay for it, because they may be closed or may get bankrupt. They are not from my country and it would be difficult to get the files back. BibTeX bibliography not printing I was unable to find a previous post about this - perhaps too simple? I just came across the BibTeX and am trying to use it with an EndNote library. I have exported to the .bib file (which looks good as far as I can tell), but no bibliography is printed and the references aren't being cited. Obviously there is something major missing.  My document looks as follows.  \documentclass[11pt, fceqn]{article} \usepackage{epsfig} \usepackage{setspace, titlesec, caption, floatrow}    \usepackage{amsmath, amssymb, amsfonts, amsthm, cite, mathtools, lineno, subfig, natbib}  \begin{document}   Some text \cite{Alo_1}.  \bibliography{bib} \bibliographystyle{plain}  \end{document}   Any thoughts would be greatly appreciated. What would the collision of two photons look like? Pgfplots: How to fill area under a curve in a 3d plot similar to \closedcycle in 2d How can I fill the area under a curve in a 3d plot, similar to the \closedcycle command in ordinary 2d plots? Applying this command does a filling which is not rotated.  Minimal working example:  \documentclass{article}  \usepackage{tikz} \usepackage{pgfplots} \begin{document}   \begin{tikzpicture}      \begin{axis}[     xmin=0,xmax=3,     zmin=0,zmax=2     ]         \addplot3[red,domain=0:1,fill=blue,opacity=0.5,samples y=0] (2,x,x^2) \closedcycle ;      \end{axis}   \end{tikzpicture} \end{document}   In 2D it looks like this  \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document}   \begin{tikzpicture}   \begin{axis}[domain=0:1     ]         \addplot[red,domain=0:1,fill=blue,opacity=0.5,samples y=0] {x^2} \closedcycle ;   \end{axis}   \end{tikzpicture} \end{document}   How can I easily apply this to a 3D plot? Are S.P.E.C.I.A.L. skills capped at 10? We know that the maximum level a dweller can train to on any SPECIAL skill is 10, however this does not consider bonuses given from their outfit.    Is there any additional benefit for going over 10? For example, a dweller with an Intelligence skill of 10 wearing a lab coat that boosts Intelligence by 3?   If it is a hard cap, would it be more useful to use outfits that raise a secondary characteristic instead? I've searched for multiple forums for this questions and have seen different answers but so far, nothing have worked yet even from the ones I've seen here.  I want to extract a single file from a tar to a different directory.  I've tried this:  tar xvf file.tar -C /home/dir/ filename   or this:  tar -x filename -f file.tar -C /home/dir   But got these errors respectively:  x filename, 14826 bytes, 29 media blocks. File -C not present in the archive. File /home/dir not present in the archive.   and:  tar: /dev/rmt0: A file or directory in the path name does not exist.   The first extracted the file but in the same directory, not to the folder I wanted. Make Bash autocomplete guess the closest approximation I have a somewhat uncomfortable keyboard on my laptop, resulting in that I sometimes misspell things in Bash and when pressing Tab for an auto-completion nothing happens.   Is it possible to have Bash guess what I meant to type, by for example when wanting to change directory to Documents and then mistyping cd ocum[TAB], given no other folder beginning with "ocum" is present, Bash interprets it as cd Documents/ since it is the closest possible action to do?   Or is this idea terribly complicated to achieve? How can I mount my partition with executive permissions using the launcher icons? Persistent Dummy Output The soundcard I want to use is detected and works (it only recently switched to dummy output and didn't allow me to go back). HDMI is no longer listed under Audio and Video - KDE Control Module; everything under audio module is set to dummy output and its the only 'soundcard' on the list now. I can view my previous sound cards in alsamixer, but changing the settings from there does nothing. How can I get my real soundcards to work again? I have already tried the following answers without success:  EDIT: name@name-desktop:~$ lspci -vvv | grep -A8 Audio 00:01.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Kaveri HDMI/DP Audio Controller         Subsystem: ASRock Incorporation Kaveri HDMI/DP Audio Controller         Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+         Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast &gt;TAbort- &lt;TAbort- &lt;MAbort- &gt;SERR- &lt;PERR- INTx-         Latency: 0, Cache Line Size: 64 bytes         Interrupt: pin B routed to IRQ 43         Region 0: Memory at ff764000 (64-bit, non-prefetchable) [size=16K]         Capabilities: &lt;access denied&gt;         Kernel driver in use: snd_hda_intel         Kernel modules: snd_hda_intel -- 00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD] FCH Azalia Controller (rev 01)         Subsystem: ASRock Incorporation FCH Azalia Controller         Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-         Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=slow &gt;TAbort- &lt;TAbort- &lt;MAbort- &gt;SERR- &lt;PERR- INTx-         Latency: 32, Cache Line Size: 64 bytes         Interrupt: pin A routed to IRQ 16         Region 0: Memory at ff760000 (64-bit, non-prefetchable) [size=16K]         Capabilities: &lt;access denied&gt;         Kernel driver in use: snd_hda_intel  Could this image possibly help?:  There is another soundcard but I'm unsure of what its for because it never outputs sound, but it does have a lot of settings: that sound card is labelled as &quot;HD-Audio Generic&quot;.   So I went into Software &amp; Updates under the Additional drivers tab and I see this:  It was on Do not use the device so I changed it and applied the settings but unfortunately the soundcard isn't back even after reboot. Antiresonance of multiple parallel decoupling capacitors: use same value or multiple values? My quesiton: Is it better practice to put same-valued capacitors in parallel of capacitors of different values to decouple the high-frequency noise caused by digital ICs? Background Digital IC need a decoupling capacitor close to their supply pins to ensure a stable voltage during power transients and to deal with noise (mostly to prevent noise generated by the IC to affect neighboring circuitry). It seems sensible to place a bulk capacitor (say 10-100uF), to act as an energy reservoir, and several smaller capacitors to deal with higher frequencies. The reason to place several small capacitors instead of just one is to deal with their Equivalent Series Inductance (ESL), which in practice, causes them to behave like an LC circuit. The effect of anti-resonance Yet, here is where best design practices and electronic myth seem to get mixed up and confusing to me. Most electronic engineers I have met like placing several decoupling capacitors of different values in parallel (with the smaller capacitors closer to the IC). The logic behind it is that the each capacitor takes care of a different noise frequency as depicted in Figure 1.  Figure 1: Impedance over frequency of three different value capacitors in parallel (cyan) vs their individual contribution (brown, blue, red). Image taken from . Note the small anti-resonance peak. It seams no major trouble , and the overall behavior of the three different capacitors in parallel is vastly superior to their individual decoupling capabilities. However, I have read in  by [Henry W. Ott] that placing capacitors of different values may cause a much greater antiresonance-peak which can be very harmful for our designs (see Figure 2). In fact, it amplifies any noise that falls into the anti-resoance frequency range, which is corroborated by .  Figure 2: from Electromagnetic Compatibility Engineering, by Henry W. Ott, section 11.4.4. The 15nH inductance makes reference to the capacitors ESL. Is Ghost Adventures real or fake? Mount a VirtualBox drive image (vdi)? Is it possible to mount a VirtualBox drive image (.vdi) so the contents can be viewed in Nautilus etc.?  I have a windows 2000 .vdi which won't boot ("inaccessible boot device") after upgrading from VirtualBox 2.x to 3.1.6. I believe the IDE drive details have changed and that all I need to do is access the internal drive image and edit the Windows boot.ini to point to the new location. single query to print all the rows whose count is greater than 10