Part one of this code example is from , and part two is from my imagination, apparently.   var array1 = [1, 4, 9, 16];  // pass a function to map const map1 = array1.map(x =&gt; x * 2);  console.log(map1); // expected output: Array [2, 8, 18, 32]  var array2 = ['1', '2', '3']; var map2 = array2.map(parseInt);  console.log(map2);  // expected output: [1, 2, 3] // actual output: [1, NaN, NaN]   Can you explain why this output isn't mapping? parseInt is a function that takes a string and returns an integer. Each element in the mapped array is a number string, so each element in the output array should be a number, right?
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]
What am I doing when I separate the variables of a differential equation? I see an equation like this:  $$y\frac{\textrm{d}y}{\textrm{d}x} = e^x$$  and solve it by "separating variables" like this:  $$y\textrm{d}y = e^x\textrm{d}x$$ $$\int y\textrm{d}y = \int e^x\textrm{d}x$$ $$y^2/2  = e^x + c$$  What am I doing when I solve an equation this way?  Because $\textrm{d}y/\textrm{d}x$ actually means  $$\lim_{\Delta x \to 0} \frac{\Delta y}{\Delta x}$$  they are not really separate entities I can multiply around algebraically.    I can check the solution when I'm done this procedure, and I've never run into problems with it.  Nonetheless, what is the justification behind it?  What I thought of to do in this particular case is write  $$\int y \frac{\textrm{d}y}{\textrm{d}x}\textrm{d}x = \int e^x\textrm{d}x$$ $$\int \frac{\textrm{d}}{\textrm{d}x}(y^2/2)\textrm{d}x = e^x + c$$  then by the fundamental theorem of calculus  $$y^2/2 = e^x + c$$  Is this correct?  Will such a procedure work every time I can find a way to separate variables? Stone-Weierstrass theorem with $p(1/x)$ I am trying to prove that for a continuous $f\colon[1,\infty)\rightarrow\mathbb R$ and $f(x)\to a$ as $x\to\infty$ it could be approximated by $g(x)=p(1/x)$ where $p$ is a polynomial. I'm trying to prove the following statements.  Let $G$ be a finite abelian group $G = \{a_{1}, a_{2}, ..., a_{n}\}$.   If there is no element $x \neq e$ in $G$ such that $x = x^{-1}$, then $a_{1}a_{2} \cdot \cdot \cdot a_{n} = e$.   Since the only element in $G$ that is an inverse of itself is the identity element $e$, for every other element $k$, it must have an inverse $a_{k}^{-1} = a_{j}$ where $k \neq j$. Thus $a_{1}a_{1}^{-1}a_{2}a_{2}^{-1} \cdot \cdot \cdot a_{n}a_{n}^{-1} = e$.   If there is exactly one $x \neq e$ in $G$ such that $x = x^{-1}$, then $a_{1}a_{2} \cdot \cdot \cdot a_{n} = x$.   This is stating that $x$ is not the identity element but is its own inverse. Then every other element $p$ must also have an inverse $a_{p}^{-1} = a_{w}$ where $p \neq w$. Similarly to the first question, a rearrangement can be done: $a_{1}a_{1}^{-1}a_{2}a_{2}^{-1} \cdot \cdot \cdot xx^{-1} \cdot \cdot \cdot  a_{n}a_{n}^{-1} = xx^{-1} = e$. And this is where I am stuck since I proved another statement.    Any comments would be appreciated for both problems. Euclidean domain in which the quotient and remainder are always unique Let $R$ be a Euclidean domain in which the quotient and remainder are always unique. Does it follow that the ring $R$ is either a field or a polynomial ring $F[X]$ for some field $F$? Does anyone know how to remove this dead bolt that has no screw heads to use a screw driver? Here's a picture below. Sorry, I'm still a newbie to blender, but why are some edges visible only in edit mode, but not in wireframe view? is it a bug or am I missing something here?  edit mode: Edges visible. Object mode, wireframe view: Pooff, they're gone. what can i do to fix this? / thanks $IS \mid JS$ implies that $I\mid J$ where $I$ and $J$ are ideals of a number ring contained in another number ring $S$ How to sort this JSON Getting image dimensions without reading the entire file Questions link almost unreadable when active on meta If you click on  the font color is almost unreadable on the main site here.  Is it possible to make it a slightly different color? (I cannot say if darker or lighter is better) Is "connected, simply connected" Redundant? Here are my definitions of &quot;connected&quot; and &quot;simply connected.&quot;  A topological space $X$ is connected if and only if it is not the union of two nonempty disjoint open sets. A topological space $X$ is simply connected if and only if it is path-connected and has trivial fundamental group (i.e. $\pi_1(X)\simeq\{\mathrm{e}\}$ and $|\pi_0(X)|=1$).  It is a classic and elementary exercise in topology to show that, if a space is path-connected, then it is connected. Thus, if a space is simply connected, then it is connected. Yet, despite this implication, I've read several cases where the words &quot;connected, simply connected&quot; appear together. For example, in Kobayashi and Nomizu's Foundations of Differential Geometry, Volume 1, page 252, the following is written: &quot;Let $M$ be a connected, simply connected analytic manifold with an analytic linear connection.&quot; In  and  (Links to Journal Storage, also known as JSTOR), they use &quot;connected, simply connected&quot; on their first page. The first of these takes it a step further, referring to &quot;closed, compact, connected, simply connected $4$-manifolds,&quot; where a closed manifold (unfortunate terminology) is defined as a compact manifold without boundary. My question is simple: Why use the words &quot;connected, simply connected&quot; when being simply connected implies connectedness? Thank you. Comma with 'who' in this specific sentence Can you shed light into this?  The coach came to the defence of the player who has been sacked from the team following his differences with the captain.  OR  The coach came to the defence of the player, who has been sacked from the team following his differences with the captain.  Isn't the subordinate clause that begins with 'who', non-restrictive? How to clear the Skype chat history how clear the skype chat history ? Any situation, any time; this person has always something negative to say about it.  It should be a noun or an adjective to describe a person who is a damp cloud walking over every sunshine situations at the cubicle, hoping to drench other people with his miserable comments.    I considered "sourpuss" but would prefer something more important sounding, like "misogynist." Is there a way to get "people reached" sum across entire network for a user? The New Model profiles on Meta.SE (pretty big improvement!) have a section for "" stat.  Now, unless I'm much mistaken, that stat is specific to a given site on the network.  If that assumption is indeed correct, is there a way to find out the "People Reached" summary across 100% of the sites on the network for all your connected profiles? Salesforce query on profile not working on user language change I have a query on profile like  profilename = [Select name from profile where id=:userinfo.getUserprofileid ].name  Now I have a check in  VF page  like  profilename  == 'System Administrator' . this works fine if the logged in user language is english. If the user language is different then profile name will be  'System admin' in that language . So how to prevent this beahviour?   Also  is there any particular field in profile which I can use  to identify the profile is system admin? so that I can have check on that field instead of checking for name which is causing the problem, for example I think modifyall filed is only checked for system admin. How to handle UNABLE_LOCK_ROW errors when this is caused by a batch APEX job we are facing a serious issue. We have a batch APEX job running daily which makes updates on records fulfilling certain conditions. There is another job running parallel to this, in some cases updating or accessing to the same records than the batch job and hence, causing the error:     Update failed. First exception on row 400 with id XXX; first error:    UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record or 200    records:   So, I had then read that in order to fix this kind of error you should use FOR_UPDATE in your select statement (records that have to be updated). The problem is, that you can not use FOR UPDATE for batch jobs. We tested this and effectively, we get the error:     System.QueryException: Locking is implied for each batch execution and   therefore FOR UPDATE should not be specified      It will however lock the records within each execution of execute. See   QueryLocator.getQuery()usage:      You cannot use the FOR UPDATE keywords with a getQueryLocator query to   lock  a set of records. The start method automatically locks the set   of records in  the batch.   Could you find a solution to this?. We would like to handle this in the code itself, because we don't have the permission to schedule the batch job for another time as the another job. Browsing  I came across this:  The conjugacy class of an element $g\in A_{n}$:  splits if the cycle decomposition of $g\in A_{n}$ comprises cycles of distinct odd length. Note that the fixed points are here treated as cycles of length $1$, so it cannot have more than one fixed point; and does not split if the cycle decomposition of $g$ contains an even cycle or contains two cycles of the same length.   Anybody with a proof? How do you clear a stringstream variable? I've tried several things already,  std::stringstream m; m.empty(); m.clear();   both of which don't work. How to do relative imports in Python?