I would like to list out files of all folders which are having all type of files like hidden,non-permissible and normal files etc. and it needs to be done all platforms like windows,linux and mac. I wrote a snippet in java  to figure out it but it is able to print only normal files.When the execution comes to non-permissible file it throws an exception stating NullPointerException and execution gets stopped.Is there any way to traverse through the folders with root permissions?.  public static void main(String[] args) throws IOException {              File[] drives;                 FileSystemView fsv = FileSystemView.getFileSystemView();              // returns pathnames for files and directory                 drives = File.listRoots();               // for each pathname in pathname array                 if (drives != null &amp;&amp; drives.length &gt; 0) {                     for (File aDrive : drives) {                         System.out.println("Drive Letter: " + aDrive);                          listFilesAndFilesSubDirectories(aDrive.toString());                     }                 }           }          private static void listFilesAndFilesSubDirectories(String filePath) {             // TODO Auto-generated method stub             File directory = new File(filePath);             File[] fList = directory.listFiles();             for (File file : fList){                 if (file.isFile()){                     System.out.println(file.getAbsolutePath()+"\n**************************");                  } else if (file.isDirectory()){                     listFilesAndFilesSubDirectories(file.getAbsolutePath());                 }             }         }   and the exception it throws is below  Exception in thread "main" java.lang.NullPointerException     at com.dlp.Test.listFilesAndFilesSubDirectories(Test.java:35)     at com.dlp.Test.listFilesAndFilesSubDirectories(Test.java:40)     at com.dlp.Test.listFilesAndFilesSubDirectories(Test.java:40)     at com.dlp.Test.listFilesAndFilesSubDirectories(Test.java:40)     at com.dlp.Test.main(Test.java:24)   Kindly help me to overcome this issue. Thanks.
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?
I can get the element like this $("#txtEmail") but I'm not sure how to get the actual value. What's better here - a single column or multicolumn primary key? Let's assume you have a table groups and a table item. Each item belongs to exactly one group. It is an inherent part of that group. An item cannot exist outside of a group and it cannot be moved to another group.  When trying to decide on a primary key for the item table, what should I use?  Should I make up an artificial global serial key like this:  CREATE TABLE items (     item serial PRIMARY KEY,     group integer NOT NULL REFERENCES groups(group), );   ... or should I rather use a composite key and per-group item serial like this:  CREATE TABLE items (     group integer NOT NULL REFERENCES groups(group),     item integer NOT NULL,      PRIMARY KEY(group, item) );   The reason why I'm leaning more towards the second solution is that the post URL will always show the group and item, so it makes sense to have both of them as the composite primary key. In case of the first solution, the URL contains superfluous information because the group ID can already be deduced from the item ID alone. The URL structure is given, however, and cannot be changed.  The disadvantage of the second solution is that you have to manage a per-group serial (i.e. each item integer should start from 0 for each group).  What's better in terms of best practices, normalization and performance? Or is it simply a matter of taste? When is JavaScript's eval() not evil? I'm writing some JavaScript code to parse user-entered functions (for spreadsheet-like functionality). Having parsed the formula I could convert it into JavaScript and run eval() on it to yield the result.  However, I've always shied away from using eval() if I can avoid it because it's evil (and, rightly or wrongly, I've always thought it is even more evil in JavaScript, because the code to be evaluated might be changed by the user).  So, when it is OK to use it? I have two user profile fields "Last Name" and "First Name". I also have a user list views. I want to expose "Name" as filter which can search for both Last Name and First Name. How can I do single filter of combination of those two fields? Can I create it from views UI?  One possible way is to create another profile field "Name" which will be hidden in the form. On user save, I would combine the two field values into the "Name" field and then expose it as filter in the views. But this solution is hard coding and it needs to write hooks. Citing a range of papers using numeric keys as in \cite{a, b, c} -> [1-3] How can I cite a range of papers, the output is a range of numbers, instead of a list of numbers? In other words, when I type  ... some dummy text here is due to me \cite{me1, me2, me3, me4} ...   I want the output to be     ... some dummy text here is due to me [3-6] ...   instead of     ... some dummy text here is due to me [3.4.5.6] ...   (I use LaTeX, and am currently using the amsart class and whatever it includes. But I am open to other suggestions.) Are there benefits of passing by pointer over passing by reference in C++? What are the benefits of passing by pointer over passing by reference in C++?  Lately, I have seen a number of examples that chose passing function arguments by pointers instead of passing by reference.  Are there benefits to doing this?  Example:  func(SPRITE *x);   with a call of  func(&amp;mySprite);   vs.  func(SPRITE &amp;x);   with a call of  func(mySprite); Sudo PM2 command not found but works without To show for following sequence $\lim_{n \to \infty} a_n = 0$ where $a_n$ = $1.3.5 ... (2n-1)\over 2.4.6...(2n)$ How is it possible in Eclipse JDT to convert a multiline selection to String. Like the following  From:  xxxx yyyy zzz   To:  "xxxx " + "yyyy " + "zzz"   I tried the following template   "${line_selection}${cursor}"+   but that way I only get the whole block surrounded not each line separately. How can I achieve a multiline processing like commenting the selected block? Change the height of a function being plotted Infinitely differentiable function with given zero set? Let $ G $ be an abelian group of order 6.  Then $ G $ has one element of order 6.  And so, $ G $ is cyclic and isomorphic to $ \mathbb Z _6 $.  In general, It is not true that an abelian group of order $n$ has an element of order $n$.  However in the case of $n=6$, it is true. I'm wondering there is any rule of the case (for example, a rule of $n$ that makes an abelian group cyclic). I'm doing some web scraping and sites frequently use HTML entities to represent non ascii characters. Does Python have a utility that takes a string with HTML entities and returns a unicode type?  For example:  I get back:  &amp;#x01ce;   which represents an "ǎ" with a tone mark.  In binary, this is represented as the 16 bit 01ce.  I want to convert the html entity into the value  u'\u01ce' I'm trying to migrate a MySQL-based app over to Microsoft SQL Server 2005 (not by choice, but that's life).  In the original app, we used almost entirely ANSI-SQL compliant statements, with one significant exception -- we used MySQL's group_concat function fairly frequently.  group_concat, by the way, does this: given a table of, say, employee names and projects...  SELECT empName, projID FROM project_members;   returns:  ANDY   |  A100 ANDY   |  B391 ANDY   |  X010 TOM    |  A100 TOM    |  A510   ... and here's what you get with group_concat:  SELECT      empName, group_concat(projID SEPARATOR ' / ')  FROM      project_members  GROUP BY      empName;   returns:  ANDY   |  A100 / B391 / X010 TOM    |  A100 / A510   So what I'd like to know is: Is it possible to write, say, a user-defined function in SQL Server which emulates the functionality of group_concat?   I have almost no experience using UDFs, stored procedures, or anything like that, just straight-up SQL, so please err on the side of too much explanation :) Table and figure side-by-side with independent captions Looking to put a table and a figure side by side so that the table and figure have their own captions. A crude sketch    ------------              -----------------     TABLE    | a |  b |                     FIGURE   | c |  d |  ------------              Table 2: Caption           -----------------                            Figure 7: Caption   The closest I've gotten is:  \begin{table}% \centering \parbox{0.4\textwidth}{ \begin{footnotesize} \begin{tabular}{| l | r |} \hline some &amp; table\\ \end{tabular} \end{footnotesize} \caption{Table} \label{tab:table} } \qquad \begin{minipage}[c]{0.53\textwidth}% \centering     \includegraphics[width=1\textwidth]{awesome} \caption{Figure} \label{fig:figure} \end{minipage} \end{table}   But that gives two Table X: Caption captions. I didn't find anything in subfig.  Help? How to prove that a nilpotent operator has a basis representation that is strictly upper triangular? I currently have a valid Schengen tourist visa that expires next year, issued by the French Consulate in Saudi Arabia.   I am going to a 60-day study abroad program in Italy and they require a student visa. I went to the Italian Consulate in Boston and they asked me to go to the French Consulate and cancel my visa. However, the French Consulate said that I needed to contact the French Embassy in Saudi to cancel the visa.   How can I cancel my tourist visa if I am currently in the United States? My Italian student visa application is due tomorrow morning. I can get goosebumps at will, regardless of the environment. Its mostly visible on my arms, and I can feel it on my head. It requires some level of concentration to achieve this.  My questions are : what biological mechanisms are involved in doing this ? Is it common ? Is it useful ? Currently I am using Outlook 2010, and sometimes customers claim that they will received an attachment in Windows.dat format.  I have searched online for possible solutions, but mostly the suggestion is to change the sending format to plain text. However, by using plain text format, there is some limitation.  So I just wonder, besides the plain text format, is there a ways to solve the winmail.dat issue?  Besides, does plain text format really 100% avoid the issue? I'm having trouble understanding the simple "planetary" model of the atom that I'm being taught in my basic chemistry course.   In particular,    I can't see how a negatively charged electron can stay in "orbit" around a positively charged nucleus. Even if the electron actually orbits the nucleus, wouldn't that orbit eventually decay?  I can't reconcile the rapidly moving electrons required by the planetary model with the way atoms are described as forming bonds. If electrons are zooming around in orbits, how do they suddenly "stop" to form bonds.     I understand that certain aspects of quantum mechanics  to address these problems, and that there are  of atoms. My question here is whether the planetary model itself addresses these concerns in some way (that I'm missing) and whether I'm right to be uncomfortable with it.