I have this very simple code:    public class Player{     private int x,y,velX,velY,width,height,id;     private boolean isControllable;       public Player(int _x,int _y,int _width,int _height,int _id,boolean _cont){         x = _x;         y = _y;         width = _width;         height = _height;         id = _id;         isControllable = _cont;         if(_cont == true){             addToCont();         }     }      private void addToCont(){         Main.controllable.add(this);     }  }   And this:    public class Main {      public static Render render = new Render();     public static Controlls controll = new Controlls();      public static LinkedList&lt;Player&gt; controllable;      public static void main(String[] args) {         controllable = new LinkedList&lt;Player&gt;();         render.height = 750;         render.width = 1000;         render.RenderWindow();     } }   As You can see I am trying to add this instance of player class to the linked list. But it returns an error:    Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.NullPointerException at game.Player.Player.addToCont(Player.java:23) at game.Player.Player.&lt;init&gt;(Player.java:18) at game.Main.Render.&lt;init&gt;(Render.java:28) at game.Main.Main.&lt;clinit&gt;(Main.java:9)   What am I doing wrong?
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 a clean install better than upgrading? Is it better to install Ubuntu completely new or is the upgrade process just as good? In other words, will my computer run just as problem-free and efficiently when I upgrade as opposed to a fresh install? This is how I'm approaching it: let $R$ be a finite integral domain and I'm trying to show every element in $R$ has an inverse:   let $R-\{0\}=\{x_1,x_2,\ldots,x_k\}$,  then as $R$ is closed under multiplication $\prod_{n=1}^k\ x_i=x_j$,  therefore by canceling $x_j$ we get $x_1x_2\cdots x_{j-1}x_{j+1}\cdots x_k=1 $,  by commuting any of these elements to the front we find an inverse for first term, e.g. for $x_m$ we have $x_m(x_1\cdots x_{m-1}x_{m+1}\cdots x_{j-1}x_{j+1}\cdots x_k)=1$, where $(x_m)^{-1}=x_1\cdots x_{m-1}x_{m+1}\cdots x_{j-1}x_{j+1}\cdots x_k$.   As far as I can see this is correct, so we have found inverses for all $x_i\in R$ apart from $x_j$ if I am right so far. How would we find $(x_{j})^{-1}$? How does one get started with web test automation using Selenium? So I've been testing web based analytical software now for the past 4 years or so with mostly manual techniques. But for 2015, I've set myself the goal of getting setup and start writing automated tests and to introduce automated testing into my company.  I've done a little research and it seems that Selenium is quite big when it comes to writing automated tests, but most of the tutorials I've come across reference the Java language.  Some questions:   Is Java the primary language used for Selenium tests?  Do you recommend it over C# ?  Wat is the process of writing test scripts?  Are there Frameworks that I should use that can make the process even easier? Am I required to pay UK/ USA Visa fees if I have a German residence permit? Here is the situation. I am non-european but staying in Germany with a Residence permit. I can visit all Schengen listed countries with no issue. Assuming that I would want to travel to a non-Schengen country e.g. UK or USA, can I use my residence permit to travel there or am I required to apply as a citizen of my country? Assuming Germans are not required to pay Visa fees to that country, will I have to pay since I only have a residence permit? Third case, Europeans can fly directly to the airport of some countries and apply for a visa from there. In some other countries, you are required to book a Visa appointment at the embassy, which may be granted or not. Does that apply for one with a residence permit? Permission Denied To Delete File First of all, I'm not looking for an answer on how to remove the files. I am looking for a reason why this doesn't work - and a suggestion on how to remove the files without sudo.  I have a directory in my Desktop that has a few inner directories (don't judge the naming - I just extract what I need from files I'm given) and after getting the files I try and remove the files with rm -rf Bengal\ Tiger\ Creative/, I am surprised to see the following warning for each image.     rm: cannot remove ‘Bengal Tiger Creative/Bengal Tiger Creative/images/customer-services-landscape.jpg’: Permission denied   Below is some code outputs.  tree  nathan@nathan-pc:~/Desktop$ tree . ├── Bengal Tiger Creative │   └── Bengal Tiger Creative │       └── images │           ├── awards.jpg │           ├── blank.gif │           ├── bullet1-light-green.gif │           ├── bullet2-light-green.gif │           ├── bullet3-light-green.gif │           ├── bullet4-light-green.gif │           ├── customer-services-landscape.jpg │           ├── desktop.ini │           ├── header-img1.jpg │           ├── header-img2.jpg │           ├── header-img4.jpg │           ├── header-img5.jpg │           ├── softhr.gif │           ├── Thumbs.db │           ├── tiger_main-img1.jpg │           ├── tiger_main-img2.jpg │           ├── tiger_main-img3.jpg │           ├── tiger_main-img4.jpg │           ├── Vanquis-benefits-icons_iphone-green.gif │           └── white-arrow-green.gif   ls -laR  nathan@nathan-pc:~/Desktop$ ls -laR Bengal* Bengal Tiger Creative: total 12 drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:30 . drwxr-xr-x 6 nathan nathan 4096 Aug 10 11:34 .. drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:34 Bengal Tiger Creative  Bengal Tiger Creative/Bengal Tiger Creative: total 12 drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:34 . drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:30 .. dr-xr-xr-x 2 nathan nathan 4096 Aug 10 11:36 images  Bengal Tiger Creative/Bengal Tiger Creative/images: total 356 dr-xr-xr-x 2 nathan nathan   4096 Aug 10 11:36 . drwxrwxr-x 3 nathan nathan   4096 Aug 10 11:34 .. -rwxrwxrwx 1 nathan nathan  14910 Mar 18 12:29 awards.jpg -rw-rw-r-- 1 nathan nathan   1093 Mar 21  2014 blank.gif -rw-rw-r-- 1 nathan nathan   1978 May  8  2014 bullet1-light-green.gif -rw-rw-r-- 1 nathan nathan   1969 May  8  2014 bullet2-light-green.gif -rw-rw-r-- 1 nathan nathan   2416 May  8  2014 bullet3-light-green.gif -rw-rw-r-- 1 nathan nathan   2449 May  8  2014 bullet4-light-green.gif -rw-rw-r-- 1 nathan nathan 113138 Apr 14  2014 customer-services-landscape.jpg -r--r--r-- 1 nathan nathan    142 Mar 25 11:58 desktop.ini -rw-rw-r-- 1 nathan nathan  14312 Mar 23 11:39 header-img1.jpg -rw-rw-r-- 1 nathan nathan   1480 Mar 23 11:41 header-img2.jpg -rw-rw-r-- 1 nathan nathan   1278 Mar 23 11:41 header-img4.jpg -rw-rw-r-- 1 nathan nathan   1168 Mar 23 11:41 header-img5.jpg -rw-rw-r-- 1 nathan nathan   1703 Mar 21  2014 softhr.gif -rw-rw-r-- 1 nathan nathan  88064 Aug  4 10:39 Thumbs.db -rw-rw-r-- 1 nathan nathan  23607 Mar 23 11:56 tiger_main-img1.jpg -rw-rw-r-- 1 nathan nathan  23400 Mar 23 11:56 tiger_main-img2.jpg -rw-rw-r-- 1 nathan nathan   6970 Mar 23 11:56 tiger_main-img3.jpg -rw-rw-r-- 1 nathan nathan   8996 Mar 23 11:57 tiger_main-img4.jpg -rw-rw-r-- 1 nathan nathan    275 Jul 31  2014 Vanquis-benefits-icons_iphone-green.gif -rw-rw-r-- 1 nathan nathan   1821 Jul  9  2014 white-arrow-green.gif   Doing chmod 777 and then delete does not work.  Doing rm -rf * inside the directory does not work.  Doing sudo rm file does work.   I can easily remove these files using sudo, however, I cannot see why they cannot be removed without sudo. As a relatively new Ubuntu user, I would like to learn why.  Thanks in advance, Nathan Why did Aragorn and Theoden ride out at the Hornburg? In the Battle of the Hornburg from The Two Towers, Aragorn and Theoden say "We must ride out." Why did they do this?  Was it just a matter of honor? Did they ride out on their horses in the middle of battle because they thought it was the end, as they were outnumbered? Was it because Aragorn knew Gandalf was coming so they were confident they were about to win? Computing Galois Group of $\mathbb{Q}(\sqrt{2},\sqrt{3}):\mathbb{Q}$ Galois Group of $\mathbb{Q}(\sqrt{2},\sqrt{3}):\mathbb{Q}$ is cumbersome to computing. Is easy to find the all four possible candidates but is cumberstone to show that they are automorphisms:  For multiplication is too long showing that  $f((a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6})(a'+b'\sqrt{2}+c'\sqrt{3}+d'\sqrt{6}))=f(a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6})f(a'+b'\sqrt{2}+c'\sqrt{3}+d'\sqrt{6})$  For some non trivial candidate since the left hand side expands in $16$ terms. What about $\mathbb{Q}(\sqrt{2},\sqrt{3},\sqrt{5}):\mathbb{Q}$? there are $7$ non trivial candidates and multiplication expands in $64$ terms!   How to do it in a tricker form?  Edit(Let me be more precise in my question):   I know that if $f\in\Gamma(\mathbb{Q}(\sqrt{2},\sqrt{3}):\mathbb{Q})$, then $f(\sqrt{2})=\pm\sqrt{2}$, $f(\sqrt{3})=\pm\sqrt{3}$ so there are $4$ candidates for $\mathbb{Q}$-Automorphisms. Candidates are given by:  $f_1(a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6})=a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6}$  $f_2(a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6})=a-b\sqrt{2}+c\sqrt{3}-d\sqrt{6}$  $f_3(a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6})=a+b\sqrt{2}-c\sqrt{3}-d\sqrt{6}$  $f_4(a+b\sqrt{2}+c\sqrt{3}+d\sqrt{6})=a-b\sqrt{2}-c\sqrt{3}+d\sqrt{6}$  But I need to check that they are $\mathbb{Q}$-Automorphisms in $\mathbb Q(\sqrt{2},\sqrt{3})$. All candidates $f_i$ fixes $\mathbb{Q}$ and is obvious that all preserves sums, $f_1$ obviously preserves product also since is the identity, but is cumberstone to show that $f_i(xy)=f_i(x)_if(y)$ to conclude $f_i\in\Gamma(\mathbb{Q}(\sqrt{2},\sqrt{3}):\mathbb{Q})$. What is the difference between display: inline and display: inline-block? Pdf bookmark error in beamer Hi. I've compiled a Persian language beamer file by both luapersian and persian babel package using LuaLaTex, and in both I've the same problem in pdf bookmark as shown in the figure (some strange characters are shown instead of correct characters). su command + authentication failure I am having problems with the su command. I know my password and I am typing it correctly but su indicates authentication failure.  So I checked on the internet and then went into recovery mode and changed my username's password to what I was entering before.  Even now entering the same password on su gives me authentication failure.  Please suggest what am I doing wrong?? I would like to delete, from the following figure:  the top circle, but without removing the black edge that separate the orange part from the gray part. The figure above has been obtained by the following code: \documentclass[border=0.2cm]{standalone}  % Required packages \usepackage[dvipsnames]{xcolor} \usepackage{tikz}   \begin{document} \begin{tikzpicture}[thick, set/.style = {circle,      minimum size = 3cm,      fill=black!30}]  % Set A \node[set,label={135:$A$}] (A) at (0,0) {};  % Set B \node[set,label={45:$B$}] (B) at (1.8,0) {};   % Intersection \begin{scope} \clip (0,0) circle(1.5cm); \clip (1.8,0) circle(1.5cm); \clip (0.9,1.5) circle(1.5cm); \fill[orange!60](0,0) circle(1.5cm); \end{scope}  % Circles outline \draw (0,0) circle(1.5cm); \draw (1.8,0) circle(1.5cm); \draw (0.9,1.5) circle(1.5cm);  \end{tikzpicture} \end{document}  A rough example of the desired result is: Detect the Internet connection is offline? How to detect the Internet connection is offline in JavaScript? Remove Windows entry in GRUB menu OR-ing power supplies (diode or mosfet) I have got two power supply options on my board:   USB 5.0V DC Power Jack of 5.0V   My intention is to design a or-ing power supply option, as either of them will be used at a time. Possible solutions are shown below:    Using oring diodes   or using two p-mos    Possible issues observed with the above options:   Using diode is cheap and good option but an ordinary diode gives a drop of 0.7V and a schottky diode will give a drop of 0.16 to 0.20 volts, which is also not acceptable because my processor  recommended operating power supply is 5.0V and minimum supply voltage is 4.75. With a 0.2V with schottky diode the 5.0V comes down to 4.80V and the space between recommended and supply fed is very less. Then I thought to use p-mosfets which serves the purpose of oring along with reverse polarity protection, but assume a case when both the supplies are fed together by mistake and there is minor difference between USB supply and DC jack say 4.9V for USB and 5.10V for DC Jack. Then, the DC jack supply may pump the current in USB Jack, which may damage USB.   Is there any other better and cheap option I should use for or-ing supply, or is there something wrong with my analysis? How can I lock a file using java (if possible) List all directories that do NOT have a file with a given file name inside How would I go into listing all directories that do not have a file with a given file name inside? e.g. given this tree  /   /a      README      file001      file002   /b      README      file001   /c      file003   I want to list the directories that do not have a file named README, in this case it would be directory /c. How would I do that? I can't think of any syntax using e.g. find. Is there a free program to (batch) change photo file's date to match EXIF? I want to specify a directory and have the software find all the photos in the directory and its sub-directories, and if they contain EXIF date/time, it sets their filesystem timestamp to match the EXIF. jQuery animate() What is the width of the standard paragraph indent in LaTeX's article class? If no changes has been made to the settings of indentation of an article class LaTeX document, what is the width of the paragraph indent?  texdoc article in the terminal opens the Standard Document Classes for LaTeX version 2e manual. In section 6.2 Paragraphing I find the following line:  ⟨10pt⟩ \setlength\parindent{15\p@}   The  means 1pt ... so I guess this would mean that the standard indent is 15 pt at a 10 pt text size? Is this correct? If there are injective homomorphisms between two groups in both directions, are they isomorphic? If I have two groups, $G$ and $H$ and two injective homomorphisms $\phi:G \to H$ and $\psi: H \to G$, then by the first isomorphism theorem applied to $\phi$, we have that $G \cong \mathrm{Im} (\phi)$, a subgroup of $H$. Similarly, $H$ is isomorphic to a subgroup of $G$. For finite groups, this guarantees that $G \cong H$ but does this hold for infinite groups?  Weird things can happen for infinite groups, e.g $n\mathbb Z \subsetneq \mathbb Z$ but $n \mathbb Z \cong \mathbb Z$. I'm wondering if this kind of thing stops an isomorphism from occurring.  I think this question generalises to rings, modules, fields and so on. Can this be answered for all of these structures?