I am just learning linkedlists and trying to insert a node at the head. Here is my code:  Node Insert(Node head,int x) {      Node tmp = new Node();      if (head == null) {         head = tmp;         tmp.data = x;      }     tmp.data = x;     tmp = head;     tmp.next = head;      return tmp; }   I am not sure what is going wrong. My logic:   Create a new node 'tmp' assign that value of 'x' and the reference to tmp would be null MAke tmp's next i.e. reference to the head of the linkedlist if head is null then tmp's data becomes head's data and tmp's reference become null
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 it possible to walk between all three terminals in Dubai Airport without leaving airside? We are arriving into Terminal 2 on the 28th December and want to go to the business lounge in Terminal 1 before getting a flight from Terminal 3 eight hours later. I am trying to find all directories in a folder recursively while exclude all git submodules  by excluding all path containing .git file. How could I do it?     Explanation:  .git file exists at the root of every submodules folder. This submodule folder could be included anywhere.    Test Case  $ mkdir Test $ cd Test $ mkdir a $ mkdir b $ mkdir c $ cd a $ mkdir .git $ cd .. $ cd b $ touch .git $ cd .. $ cd c $ mkdir c1 $ mkdir c2 $ cd.. $ find . -type d \( \( ! -name . -exec [ -e {}/.git ] \; -prune \) -o \( \( \  -name .git\  -o -name .vscode\  -o -name node_modules\  -o -name Image\  -o -name Rendered\  -o -name iNotebook\  -o -name GeneratedTest\  -o -name GeneratedOutput\   \) -prune \) -o -print \) | sort    Expected Results  . ./a ./c ./c/c1 ./c/c2 Local BLAST Copy Number per Hit I generated a series of local BLAST databases using makeblastdb of metagenomic data and am searching for the presence of a particular gene. While I can do the normal BLAST analysis looking at e-values, % identity, etc. I haven't been able to figure out how to determine how many times a given sequence exists in the database.  So: given a BLAST database of metagenomic data where a particular gene may exist multiple times, how do I determine the copy number of a given BLAST hit?  Thanks in advance. I would like to show that   $$ \int_{0}^{1} \frac{x-1}{\ln(x)} \mathrm dx=\ln2 $$  What annoys me is that $ x-1 $ is the numerator so the geometric power series is useless.  Any idea? What does “{} \;” mean in find (in Linux)? Sometimes I see a command like  find . -name * -exec ls -a {} \;   I was asked to execute this.  What does {} \; mean here? Passing more then 100 arguments to ColdFusion function throws an error Number of combinations of dice having different number of faces that add to $10$ A function $\textbf{face}_{\mathrm{sum}}$ that takes a vector  $f$ that represents the number of faces of each die, and a positive integer  $s$ , and returns the probability that the sum of the top faces observed is  $s$ .  For example, if $f=[3,4,5]$  and  $s≤2$  or $s≥13$ , $\textbf{face}_{\mathrm{sum}}$ returns $0$, and if  $s=3$  or  $s=12$ , it returns  $\frac13*\frac14*\frac15=\frac1{60}$  $\textbf{face}_{\mathrm{sum}}([2,4,4,6], 10)$  I tried to solve this but I can't find the formula to calculate the number of combination of die faces that add to $10$, as the number of faces are different for each die.  Since max no of possible combination is $6*4*4*2=192$, all I need to find is the number of combination of die faces that add to $10$.  Thanks in advance. I have a script that I need to execute on an NTFS partition. The script's permission is set to 600.  I attempted to modify the permissions by running chmod 755 script.sh, which doesn't report a failure or anything - but it also doesn't change the permissions on the file:  $ stat script.sh    File: `script.sh'   Size: 297070      Blocks: 584        IO Block: 4096   regular file Device: 811h/2065d  Inode: 35515       Links: 1 Access: (0600/-rw-------)  Uid: ( 1000/  xxxxxx)   Gid: ( 1000/  xxxxxx) Access: 2010-09-30 14:05:16.041621000 -0700 Modify: 2010-09-30 14:05:05.070157000 -0700 Change: 2010-09-30 14:05:05.070475000 -0700  $ chmod 755 script.sh $ stat script.sh    File: `script.sh'   Size: 297070      Blocks: 584        IO Block: 4096   regular file Device: 811h/2065d  Inode: 35515       Links: 1 Access: (0600/-rw-------)  Uid: ( 1000/  xxxxxx)   Gid: ( 1000/  xxxxxx) Access: 2010-09-30 14:05:16.041621000 -0700 Modify: 2010-09-30 14:05:05.070157000 -0700 Change: 2010-09-30 14:05:05.070475000 -0700   As you can see, it remains unchanged. Biliniear form to inner product Let $f:V\times V\rightarrow F$ be a bilinear form in a finite inner product space V.  If $F=R$, how can I prove that there exists a single linear transformation $T:V \rightarrow V$ so that for each $v,u\in V$, $f(u,v) = (Tu, v)$ ?  Would that sill be the case if $F=C$? "Unfortunately, ... has stopped" when Downloading file in Android Actually snapping to pixel grid Does anyone know if there's a way to have Illustrator CC (2014) constrain control points to the pixel grid? I understand that "Align to pixel grid" makes it so that a shape will try to match the pixel grid, but the actual control points don't line up to said grid... The image I've attached illustrates my problem. Does anybody of a way to access files and directories that have a % in their name (which is valid) from the command-line? Specifically, if there are two %’s and the text between them happens to correspond to an environment variable.  For example, if there is a file called C:\blah\%temp%.txt or a folder called C:\Program Files\%temp%\, none of the following will work because the variable gets expanded:  &gt; dir "c:\blah\%temp%.txt" &gt; dir "c:\blah\^%temp^%.txt" &gt; dir "c:\blah\%%temp%%.txt" &gt; dir "c:\blah\\%temp\%.txt"  &gt; dir "c:\program files\%temp%" &gt; dir "c:\program files\^%temp^%" &gt; dir "c:\program files\%%temp%%" &gt; dir "c:\program files\\%temp\%"    Using wildcards will work, but does not uniquely select the file/folder and may include others:  &gt; dir "c:\blah\?temp?.txt"        (also shows ztempz.temp, 1tempa.txt, etc.) &gt; dir "c:\program files\?temp?"   (likewise)    (This is frustrating because every now and then—usually when Explorer is restarted for whatever reason—the environment variables stop expanding and some places where they are used end up creating files or directories with the environment variable in it. For example, because I configured Chromium to store its cache in a subdirectory of %temp%, if the variable expands, it is fine, but when it doesn’t, Chromium creates a directory called %temp% under its own directory and stores the cache—which can get large—there. I want to add a line to my temp-/junk-file cleaning script to automatically delete that folder if it exists, but I cannot figure out how to access it from the command-line without resorting to wildcards.) Can a hyphen be used without anything on the right side? of a monic polynomial $f \in \mathbb F\left[x\right]$ in $1$ variable $x$ over a field $\mathbb F$ plays an important role in understanding the structure of finite dimensional $\mathbb F[x]$-modules.  It is an important fact that the characteristic polynomial and the minimal polynomial of $C(f)$ are both equal to $f$. This can be seen quite easily by induction on the degree of $f$.  Does anyone know a different proof of this fact? I would love to see a graph theoretic proof or a non inductive algebraic proof, but I would be happy with anything that makes it seem like more than a coincidence! Hiding get mobile app button on SP online communication site collection For one of the clients, I have spin up a modern communication site collection and on the landing page of the same, I am seeing 'Get the mobile app' showing up, I was able to hide the 'feedback' button using css but no luck with Get the mobile app button.  Can someone please share css to hide 'get mobile app' button, appreciate the help. How do I challenge an audit failure? I've run through Both SO and Meta searches for an answer, as well as reviewing the , and I cannot find a canonical process to challenge an audit failure.  I can find discussions of the single-choice "I Understand" topic that appear unresolved, in that no solution presently exists.  The particular question in point is .  Despite the number of up-votes, I feel that this quite clearly falls into a common closure category: "Here's my problem; how do I write the program?"  Compare this to   I also failed review on the first link I posted above, .  This looks like a case of code review, rather than SO.  I don't want to get rid of audits; I've learned good things from some of my failures, especially at the start.  However, in the past few weeks, a majority of my failures have been highly questionable, and I've drawn more than one suspension from those that are outright wrong by current standards.  If we have a challenge mechanism, please point me in the right direction.  Otherwise, it's simply not worth the annoyance any more, and I'll drop back to merely comments and answers. Can I carry spare Lithium-Ion batteries with me on Lufthansa? I am travelling from the US to India on Lufthansa. I have five spare Lithium-ion batteries, each 850mAh.  Can I bring them back safely? How to test if a player is near coordinates in 1.13? How can momentum but not energy be conserved in an inelastic collision? In inelastic collisions, kinetic energy changes, so the velocities of the objects also change.  So how is momentum conserved in inelastic collisions? 1.7.4 Problem with mobs spawning I have just updated to Minecraft 1.7.4 and now all of a sudden there are barely any mobs spawning.  I checked to make sure that I was in normal difficult and I saw 1 creeper but that is all.  Also I tried different difficulties. Another thing - mobs seem to to spawn normally in the nether and all other mobs except aggressive mobs spawn like they should.  Please if you know how to fix this, please help!