I found some strange behavior in the javascript parse int function. Check the following code:   console.log([..."111"].map(Number.parseInt)) console.log([..."111"].map(x =&gt; Number.parseInt(x)))    When you run the first line, you get: [1, Nan, 1] When you run the second line, you get: [1, 1, 1] Can someone explain this strange behavior?
From the :  [1,4,9].map(Math.sqrt)   will yield:  [1,2,3]   Why then does this:  ['1','2','3'].map(parseInt)   yield this:  [1, NaN, NaN]   I have tested in Firefox 3.0.1 and Chrome 0.3 and just as a disclaimer, I know this is not cross-browser functionality (no IE).  I found out that the following will accomplish the desired effect. However, it still doesn’t explain the errant behavior of parseInt.  ['1','2','3'].map(function(i){return +i;}) // returns [1,2,3]
Chess Piece Combinations I came across a question yesterday about combinations, and I wanted to know what the correct answer was. The question states as follows:  There are 8 spaces that are alternately black and white. There is one king, one queen, two identical rooks, two identical bishops, and two identical knights. The king needs to be surrounded by the two rooks. Then, the two bishops can be put on any of the remaining spaces as long as one is on a black space and the other is on a white space. Finally, the queen and the knights can be placed anywhere in the remaining spaces in relation to the other pieces. How many possible arrangements are there considering these conditions? In Ubuntu 20.04, on the desktop, there is a number of actions I wish I could do, such as, by order of importance :  use keyboard shortcuts such as select all, copy / paste. use drag &amp; drop with icons deactivate the &quot;mouse over&quot; highlight, and restrict the clicking area to only the icon, not the surrounding square  To put it simply, I'd like to have the exact same features as offered by the desktop of Ubuntu 18.04 (probably related to a specific version of GNOME, and not Ubuntu itself). Am I missing something obvious here? I actually see no reason why those actions are removed or deactivated on the desktop, since they all work in any Nautilus window. Can I use the Google font 'Lato' for a logo design? I am creating a logo and would like to use the Google Font 'Lato', can I use this font in my logo design or are there copyright/limitations I need to worry about? I can't find anything online other than that it is an open source font that can be used in anyway you want (maybe that's my answer but I just want to make sure). Also, is it a bad idea to use a web-based font for a logo? Prime ideal and nilpotent elements using tar showing, "No Such file or directory" But when I try to run it using  tar zxvf jre-8u151-linux-i586   I get tar (child): jre-8u151-linux-i586: Cannot open: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2  What is wrong? The name and place matches prefectly. I have some cites in my captions. But I do not want to appear them in the table of figures or listings. With figures I managed to display an different caption like this:  \begin{figure}   \centering   \includegraphics[width=0.55\linewidth]{images/FIPA_Message-Transport-Reference-Model}   \caption[FIPA Message Transport Reference Model]{FIPA Message Transport Reference Model (\cite{FIPA2000}).}   \label{fig:FIPA_Message-Transport-Reference-Model} \end{figure}    But with lstlisting I have some troubles because the caption is an option of the listings and that seems not to have an optional caption label.  \begin{lstlisting}[ language=Scala, label={lst:Publisher}, caption={Publisher notify\cite{Zenger2013}}]    protected def publish(event: Evt) {     filters.keys.foreach(sub =&gt;       if (!suspended.contains(sub) &amp;&amp; filters.entryExists(sub, p =&gt; p(event)))         sub.notify(self, event)     )   } \end{lstlisting}   Any Ideas how to solve this? Thanks in advance! Detecting current iPhone input language Do we know of any living forms on Earth that could continue to live on Mars? If $\frac{\cos x}{\cos y}+\frac{\sin x}{\sin y}=-1$, then what's the value of $4\left(\frac{\cos^3y}{\cos x}+\frac{\sin^3y}{\sin x}\right)$? I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different properties based on whether I am on a Windows or Unix platform). What is the safest way to do this with 100% reliability? Calculating $\sum_{n=1}^\infty\frac{1}{(n-1)!(n+1)}$ I want to calculate the sum:$$\sum_{n=1}^\infty\frac{1}{(n-1)!(n+1)}=$$  $$\sum_{n=1}^\infty\frac{n}{(n+1)!}=$$ $$\sum_{n=1}^\infty\frac{n+1-1}{(n+1)!}=$$ $$\sum_{n=1}^\infty\frac{n+1}{(n+1)!}-\sum_{n=1}^\infty\frac{1}{(n+1)!}=$$ $$\sum_{n=1}^\infty\frac{1}{n!}-\sum_{n=1}^\infty\frac{1}{(n+1)!}.$$  I know that $$\sum_{n=0}^\infty\frac{1}{n!}=e$$  so $$\sum_{n=1}^\infty\frac{1}{n!}=\sum_{n=0}^\infty\frac{1}{n!}-1=e-1$$  But, what can I do for $$\sum_{n=1}^\infty\frac{1}{(n+1)!}$$ ?  Am I allowed to start a sum for $n=-1$ ? How can I bring to a something similar to $$\sum_{n=0}^\infty\frac{1}{n!}$$? When should we consider a dataset as imbalanced? I'm facing a situation where the numbers of positive and negative examples in a dataset are imbalanced.  My question is, are there any rules of thumb that tell us when we should subsample the large category in order to force some kind of balancing in the dataset.  Examples:   If the number of positive examples is 1,000 and the number of negative examples is 10,000, should I go for training my classifier on the full dataset or I should subsample the negative examples? The same question for 1,000 positive example and 100,000 negative. The same question for 10,000 positive and 1,000 negative. etc... Can a quasiclassical electron wave packet in elliptic orbit be formed from bound hydrogen-like eigenstates? Position probability densities of eigenstates of hydrogen-like systems have axial symmetry, so that the wavefunction too much resembles the circular orbits in Bohr's model. I'd like to have a demonstration of correspondence principle, where an electron would be localized to look somewhat like a classical particle, and move in an elliptic (non-circular) orbit around a nucleus.  It seems though that if we try to make a wave packet too localized, then it'll disintegrate (get scattered by the nucleus) too fast to see anything resembling an elliptic orbit. OTOH, if we take it too spread out, it'll have to be quite far from the nucleus so as to avoid hitting it, and thus it'll have high total energy, which may appear to be above ionization threshold (at least partially), after which it'd be quite hard to analytically calculate evolution of the wave packet.  Thus my question is: is it possible to form a more or less localized wave packet, which would (on average) move in an obviously-elliptic orbit (major/minor axes ratio of 4:3 or higher), and only require bound states to fully represent it? If yes, then what properties (FWHM, apocenter, angular momentum etc.) should it have for this to be possible? This came up in  , but I can't see good documentation or examples that explain how the feature works. How can I upgrade to Java 1.8 on an Amazon Linux Server? I tried sudo yum update but it just keeps java "1.7.0_75". I need 1.8 for it to work with another application but can't figure out how to upgrade it. Do I need to manually install it somehow? There's not much information on this on the internet as far as I can see. Specs:   java version "1.7.0_75" OpenJDK Runtime Environment (amzn-2.5.4.0.53.amzn1-x86_64 u75-b13) OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)   When I try update now:     [ec2-________]$ sudo yum update Loaded plugins: priorities, update-motd, upgrade-helper amzn-main/latest                                         | 2.1 kB     00:00 amzn-updates/latest                                      | 2.3 kB     00:00 No packages marked for update   Is there anything else I need to do? Thanks. How does the ternary operator work? Please demonstrate how the ternary operator works with a regular if/else block. Example:  Boolean isValueBig = value &gt; 100 ? true : false;     Exact Duplicate: Are there any examples of Humans and Aliens producing offspring in Star Wars? The title is pretty self explanatory, although to expand on the question further I am looking for any examples of inter-species breeding in the Star Wars universe, not just inter-species (ahem) "relations". How to read ext4 partitions on Windows? Is there a way to read ext4 partitions from Windows? If so, what can I do? Why are properties lost in the Cayley–Dickson construction? What's the best way of handling permissions for Apache 2's user www-data in /var/www? Has anyone got a nice solution for handling files in /var/www? We're running Name Based Virtual Hosts and the Apache 2 user is www-data.  We've got two regular users &amp; root. So when messing with files in /var/www, rather than having to...  chown -R www-data:www-data   ...all the time, what's a good way of handling this?  Supplementary question: How hardcore do you then go on permissions?  This one has always been a problem in collaborative development environments.