Working at object mapping with Java and JDBC for SQL Server I wondered myself if I would create a variable to save the value that returns a select sentence or if I could put the sentence in the foreach loop.  I have post the complete function but the question is only about the foreach loop. Both options works good for me, but I wanted to know if there is any difference about efficiency or if exists any case where the first one could fail.  public static List&lt;User&gt; UserList() {     BD miBD = new BD(BD_SERVER,BD_NAME);     ArrayList&lt;User&gt; list = new ArrayList&lt;User&gt;();       for(Object[] tuple: miBD.Select("SELECT name,password FROM tUser;"))     {         String id = (String)tuple[0];         String p = (String)tuple[1];         User u = new User(id,p);         list.add(u);     }      return list; }   or      List&lt;Object[]&gt; tupleList = miBD.Select("SELECT name,password FROM tUser;")      for(Object[] tuple: tupleList)     {         String id = (String)tuple[0];         String p = (String)tuple[1];         User u = new User(id,p);         list.add(u);     }     return lista; }   Which is more advisable to use?
Consider:  List&lt;String&gt; someList = new ArrayList&lt;String&gt;(); // add "monkey", "donkey", "skeleton key" to someList     for (String item : someList) {     System.out.println(item); }   What would the equivalent for loop look like without using the for each syntax?
While I understand the intuition behind expectation, I don't really understand the meaning of variance and moment.   What is a good way to think of those two terms? Pointwise convergence of $h_n(x) = x^{1+\frac{1}{2n-1}}$ Okay, maybe I'm missing something obvious but consider $h_n(x) = x^{ 1+ \frac{1}{2n-1}}$ on the set $[-1,1]$. Now consider a fixed $x \in [-1,1]$, we have:  $$\lim_{n\rightarrow \infty} h_n(x) = x \lim_{n \rightarrow \infty} x^\frac{1}{2n-1} = x$$  But my book says it's $|x|$? Why? How to perform orthogonal regression (total least squares) via PCA? I always use lm() in R to perform linear regression of $y$ on $x$. That function returns a coefficient $\beta$ such that $$y = \beta x.$$  Today I learned about total least squares and that princomp() function (principal component analysis, PCA) can be used to perform it. It should be good for me (more accurate). I have done some tests using princomp(), like:  r &lt;- princomp( ~ x + y)   My problem is: how to interpret its results? How can I get the regression coefficient? By "coefficient" I mean the number $\beta$ that I have to use to multiply the $x$ value to give a number close to $y$. Evaluating indefinite integrals of the form $\int \frac{x^2 \,dx}{a x^5 + b}$ Evaluate the indefinite integral   $$\int \frac{x^2 \,dx}{a x^5 + b},$$   for real parameters $a, b \neq 0$.   No apparent substitutions simplify the expression (if the exponent of $x$ were an integral multiple of $3$, this would suggest the substitution $u = x^3$, $du = 3 x^2 \,dx$, but the exponent is not). Applying integration by parts with $u = a x^5 + b$, $dv = x^2 dx$ is straightforward, but it produces an integrand with a much larger degree in the denominator and so appears only to make the situation worse. Applying integration by parts instead with $dw = \frac{x^k dx}{a x^5 + b}$ results in integrating $\frac{x^k dx}{a x^5 + b}$, which except when $k \equiv 4 \pmod 5$ (which doesn't appear immediately fruitful), doesn't appear much easier than the given integral. How can I prove these statements? Use a variable reference "inside" another variable I'm sure it is relatively simple, I just don't know how to do it.  #!/usr/bin/ksh set `iostat` myvar=6   I want to something like echo ${$myvar} which i want interpreted as ${$myvar} -> ${6} -> value How do I get help for "echo" or other bash commands? man echo works. but out of curiosity, does echo have something similar to a --help flag/parameter? Why does Super User site appear twice in vote-to-close dialog? Super User appears in both the main Off-Topic list and the Migration list of the close dialog. Is this a bug or intentional?  I also don't really understand why Server Fault appears in the main Off-Topic list and not the Migration list, apart from it being new.  Here:    and: I was recently invited to join InitiativeQ via a friend on Facebook. The underlying idea makes rough sense to me (as a non finance expert). However their 'hook' seems to be that early adopters will get free money later down the line when the currency launches (the earlier you adopt, the more currency you will receive). Looking at the website, there is a big button with the text Reserve $128,957 (I assume that's their idea of what the dollar value of my reservation will be if it launches).  The website's production quality suggests it is not a scam, however the language suggests strongly that it is. Is this a scam, a get rich quick scheme? Or am I being overly paranoid? format date in c# How can I format a date as dd/mm/yyyy or mm/dd/yy ?   Like in VB format("dd/mm/yy",now)  How can I do this in C#? Explaining what GIS is to 11 year old kid? Well, since it was one of the highest rated , hasn't been asked yet, and I would love to know the answer, I thought I'd ask it.  How do I explain what GIS is for the 11 year old kid? In Shakespeare's Macbeth, the Third Witch says to Banquo: "Thou shalt get kings, though thou be none" (1.3.65); if I want to quote that line and write it in the third person singular, how should I conjugate the verbs "shall" and "be" correctly? Sending `time` command into text file I want to get the result of time command into a text file but it's not working it only put blank space in the text file.  I already tried this commands,  A-  $ x=`time` $ echo $x &gt; log.txt $ cat log.txt  $   B-   $ time &gt; log.txt  real    0m0.000s user    0m0.000s sys     0m0.000s $ cat log.txt  $   C-  $ time &gt; log.txt 2&gt;&amp;1  real    0m0.000s user    0m0.000s sys     0m0.000s  $ cat log.txt  $    What I really want is this.   $ time &gt; log.txt $ cat log.txt  real    0m0.000s user    0m0.000s sys     0m0.000s "python" not recognized as a command Get TEXT value of a CLOB OID in Postgresql Find the limit of $\frac{\log(n+1)}{\log(n)}$ where $n\rightarrow\infty$. Here $n$ is a natural number so I guess we can't use L'Hopital We have a view for a type of node that includes a Private File.  We cannot see a way to add an exposed filter, such as "Contains any word", and have it filter based on the file's name.  Are we missing something obvious? How to prevent system applications (like the Software Center) from asking for password? "Compared with" vs "Compared to"—which is used when? Is only one of them correct? Are they used in different situations? Or are they interchangeable? Is it possible to set the "urgent" flag in Gmail for outgoing mail? I'd like to be able to flag time-sensitive emails as such.