Can someone explain what exactly this code does and how? Also, what is i set equal to? function negate (f) {     return function (i) {         return !f(i);   }; } var isNumber = negate(isNaN);  // function object alert(isNumber(5));            // =&gt; true
I've seen references to curried functions in several articles and blogs but I can't find a good explanation (or at least one that makes sense!)
Suddenly mysql/mariadb won't start Nginx: Forward all Subdomains My code doesn't work with second level tld's like domain.co.uk Here is my conf:   # add www.   if ($host ~ ^(?!www)) {    rewrite ^/(.*)$ http://www.$host/$1 permanent;   }    # remove subdomain   if ($host ~ &quot;^www\.(.*)\.(.*\.([a-z]{2,4}|[a-z]{2}\.[a-z]{2}))&quot;) {    set $host_without_sub $2;    rewrite ^/(.*)$ http://www.$host_without_sub/$1 permanent;   } I have created new partition by selecting free space option and now I can't merge it or recreate it.  I have tried to use iPartition to create a new partition on free space but it said I have no permission.  How can I fix it? $\sum_i x_i^n = 0$ for all $n$ implies $x_i = 0$ Here is a statement that seems prima facie obvious, but when I try to prove it, I am lost.  Let $x_1 , x_2, \dots, x_k$ be complex numbers satisfying:  $$x_1 + x_2+ \dots + x_k = 0$$  $$x_1^2 + x_2^2+ \dots + x_k^2 = 0$$  $$x_1^3 + x_2^3+ \dots + x_k^3 = 0$$  $$\dots$$  Then $x_1 = x_2 = \dots = x_k = 0$.    The statement seems obvious because we have more than $k$ constraints (constraints that are in some sense, "independent") on $k$ variables, so they should determine the variables uniquely.  But my attempts so far of formalizing this intuition have failed.  So, how do you prove this statement?  Is there a generalization of my intuition? Boolean and Texts I have used Hexagon for years but find that it sometimes crashes when trying to do Boolean operations with texts.  I have been trying to make the two tables of the Ten Commandments and have been trying to use Blender.  I did it about two years ago in Blender and lost everything on my computer so I am trying again with the latest version of Blender and am having difficulty.  I start with a cube and then get it close to the dimensions I would think the Ten Commandments might look like. I then bevel the top using the bevel modifier. But in doing it this way I don't have any cross sub divisions on the face of the object. I have tried sub dividing first but then I find that I can't bevel the top arches as far as I would like. I still don't know how to add divisions after I bevel the top. Yes I am still a novice at this program.  In any case I did figure out how to make text and turn them into an object. When I make the texts I do all four of the commandments for one side and then the other six for the other side. So this makes allot of texts to cut out.  When doing the Boolean operation in Difference sometimes nothing happens. I am thinking I need to have some sub - divisions on the face of the sized cube after it is beveled but am not really sure if this is the problem.  This whole thing about normal's is still Greek to me. I have watched some videos on how to cut letters into a cube but for some reason it does not work this easy after I bevel the top of the cube. Or it could be that Blender does not like a bunch of texts all at once.  Could someone show me a video or give me some simple steps to make my project work? We can write Bayes' theorem as  $$p(\theta|x) = \frac{f(X|\theta)p(\theta)}{\int_{\theta} f(X|\theta)p(\theta)d\theta}$$  where $p(\theta|x)$ is the posterior, $f(X|\theta)$ is the conditional distribution, and $p(\theta)$ is the prior.  or  $$p(\theta|x) = \frac{L(\theta|x)p(\theta)}{\int_{\theta} L(\theta|x)p(\theta)d\theta}$$  where $p(\theta|x)$ is the posterior, $L(\theta|x)$ is the likelihood function, and $p(\theta)$ is the prior.  My question is   Why is Bayesian analysis done using the likelihood function and not the conditional distribution? Can you say in words what the difference between the likelihood and conditional distribution is?  I know the likelihood is not a probability distribution and $L(\theta|x) \propto f(X|\theta)$. Use of 'prototype' vs. 'this' in JavaScript? What's the difference between  var A = function () {     this.x = function () {         //do something     }; };   and  var A = function () { }; A.prototype.x = function () {     //do something }; Need a proofreading why all the units are satisfied $a^2-2b^2 =\pm1$ for $\mathbf{Z}[\sqrt{2}]$ All the units are satisfied Pell's equation $a^2-2b^2=\pm1$  for $\mathbf{Z}[\sqrt{2}]$, $a,b\in\mathbf{Z}$.  Here is my proof:  Let $a+b\sqrt{2}$ be a unit $\in\mathbf{Z}[\sqrt{2}]$. This implies $$(a+b\sqrt{2})(c+d\sqrt{2})=1, c+d\sqrt{2}\in\mathbf{Z}\sqrt{2}$$ $$\implies \mathrm{norm}((a+b\sqrt{2})(c+d\sqrt{2}))=1$$ $$\implies \mathrm{norm}(a+b\sqrt{2})\cdot \mathrm{norm}(c+d\sqrt{2})=1$$ $$\implies (a+b\sqrt{2})(a-b\sqrt{2})(c+d\sqrt{2})(c-d\sqrt{2})=1$$ $$\implies (a^2-2b^2)(c^2-2d^2)=1$$ $$\implies \left[ a^2-2b^2=1\text{ and } {c}^2-2{d}^2=1\right]\text{ or } \left[ a^2-2{b}^2=-1\text{ and }{c}^2-2{d}^2=-1\right]$$ $$\implies {a}^2-2{b}^2=\pm1$$ How can I edit two materials simultaneously? Whenever I open a new shading window, whatever I do in one is just mirrored on the other. If I click a node in one window, the same node and material get selected in the other. I can't edit two shaders at once. How can I edit two shaders simultaneously? I would like to typeset the top part of Pascal's triangle. To get the triangle with the names of the binomial coefficients, i.e., {n \choose k}, I used the following code  \begin{tikzpicture} \foreach \n in {0,...,4} {   \foreach \k in {0,...,\n} {     \node at (\k-\n/2,-\n) {${\n \choose \k}$};   } } \end{tikzpicture}   The result is this   Now I want to be equally lazy and do something like this for the values of the binomial coefficients, i.e., replace {\n \choose \k} in the node label with \CalculateBinomialCoefficient{\n}{\k} where \CalculateBinomialCoefficient is a hypothetical macro that calculates the binomial coefficient. Has anyone done something like that?  The result should look like this: Disable OS X startup sound How can I permanently disable the startup sound (or chime) in Yosemite?  (I am using a late-2014 13" macbook pro)  I already tried several options found here and there :    installed StartNinja.app => did not work installed Auto-Mute.app  => did not work tried to install the old StartupSound prefPane => did not work tried the command "sudo nvram SystemAudioVolume=%80" => volume does not change (I also tried other values than 80, such as 00, 01, or nothing)   NOTE: I know that it is possible to mute the next startup sound by turning the volume down, but this is not a permanent solution. Polling the keyboard (detect a keypress) in python How can I poll the keyboard from a console python app?  Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.):     while 1:       # doing amazing pythonic embedded stuff       # ...        # periodically do a non-blocking check to see if       # we are being told to do something else       x = keyboard.read(1000, timeout = 0)        if len(x):           # ok, some key got pressed           # do something   What is the correct pythonic way to do this on Windows?  Also, portability to Linux wouldn't be bad, though it's not required. Meaning of a set in the exponent Let $ D = 2^\mathbb{N} $, i.e., D is the set of all sets of natural numbers.   What's the meaning of this definition? Intuitively, I would suggest that $ D = \{1,2,4,...\} $ but the explanation "set of all sets" leads me to the guess that this is wrong. Initializing C# auto-properties I'm used to writing classes like this:  public class foo {   private string mBar = "bar";   public string Bar {     get { return mBar; }     set { mBar = value; }   }   //... other methods, no constructor ... }   Converting Bar to an auto-property seems convenient and concise, but how can I retain the initialization without adding a constructor and putting the initialization in there?  public class foo2theRevengeOfFoo {   //private string mBar = "bar";   public string Bar { get; set; }   //... other methods, no constructor ...   //behavior has changed. }   You could see that adding a constructor isn't inline with the effort savings I'm supposed to be getting from auto-properties.  Something like this would make more sense to me:  public string Bar { get; set; } = "bar"; Bash : compare two strings with space I am trying to write a bash script which run a command and compare the result with another string.   #!/bin/bash -x  STATUS=`/root/setup_ha show --password-file=/root/password | grep "&gt;HA State" | awk '{print $3}' |  cut -c 2-`  TEST=`echo $STATUS` if [[ "$TEST" == "ON Master" ]]; then echo CLUSTER CRITICAL else   echo CLUSTER OK MASTER fi   As the Original string is on two lines, I echo it in a new variable TEST. The New variable have the output of the command on one line.  Here is the Bash debug output :  ++ /root/setup_ha show --password-file=/root/password ++ grep '&gt;HA State' ++ awk '{print $3}' ++ cut -c 2- + STATUS='ON Master' ++ echo 'ON' Master + TEST='ON Master' + [[ ON Master == \O\N\ \M\a\s\t\e\r ]] + echo CLUSTER OK MASTER CLUSTER OK MASTER   I also tried the following test :  if [[ "$TEST" =~ "ON Master" ]]   The thing is bash is not able to compare the strings it is always false.  Any idea ?   EDIT :  Here is the output with the first answer :  + STATUS='ON Master' ++ echo 'ON' Master + TEST='ON Master' + '[' 'ON Master' == 'ON Master' ']' + echo CLUSTER OK MASTER CLUSTER OK MASTER   Still  not working ON seems weird on line 3, plus in my bash it takes green color ! We're injecting records into a journey using a Salesforce data event.  I also want to advance the people in the journey based on updates that happen in Salesforce (e.g., as an Opportunity record advances through the sales process), but I can't figure out how to do that.  I've read all the documentation I can find, but there doesn't seem to be a Journey Builder widget that will wait to be prompted by an event in Salesforce before continuing someone on a journey.  At the moment, I'm completely stuck.    I'd greatly appreciate any advice or information on how I can make journeys event-driven in this way.  Thanks very much! Why don't Starfleet vessels have intelligent on-board computers? Here's :        At the moment, the latest entry there is October 13, which would be mistaken to mean October last year (2012), but it actually is October 2010. This applies to all the filters in the activity tab. Restricting a user to a certain directory on SSH login I am having trouble restricting a user to a fixed directory when they connect with SSH  I want the user restricted to /var/www/home  however I connected myself and they are free to move about the system  I set the home directory to /var/www/home so they go there upon login however this doesnt restrict them.  I have tried a few things from suggestions in Google but nothing so far seems to work / do what I want  For example I have changed the chmod of www to 755 and root owned but still no effect Add a duplicate:0|1 search operator I often search for closed questions and sift through the ones that are not duplicates to see if any of them need to be killed. Technically, closure is the first step towards deletion and the only closed posts that are actually useful are duplicates (unless it's a crappy one).  For the rest, if the community hasn't bothered to reopen it after a while or if the OP has made no effort to edit their question, I delete it if it has no redeeming content. For example, the only closed posts seen on  are exact dupes.  But this does become tedious when there are several results for various close reasons with duplicates interspersed between them. I'd like to be able to search as:  closed:1 duplicate:0   so that it gives a list of questions closed as OT/NaRQ/NC/TL. This will be similar in behaviour to migrated:0|1.   This will also be useful for 10k+ users on all sites (2k+ in beta) in the network, especially SO, so that they can search for questions to spend their delete votes on— especially closed, non-dupe questions in the tag they specialize in. More often than not, I hesitate to vote on questions that are outside my area of interest (unless it is crappy).