Here's a code  (function(x){     // Some code here })(1);   The code above is IIFE so this means that it will be executed just once. Qustion: why would anybody need to pass parameter into this function (whick is 1 in example below)?  I can just create variable inside function, like below  (function(){     var x = 1;     // Some code here })();   This question is not about how closures work but about why and when to use first code pattern and when the second one.
How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?  I have seen  given on Wikipedia, but unfortunately it did not help.
London Heathrow airport - do I need a transit visa? I would like to learn how to use it so I can start to use the terminal more. How do I complete "Find the Bitizen"? In tiny Death Star, Palpatine has given me the mission "Find the Bitizen" with the text "Working for tips is acceptable. Find 1 Bitizen(s)."  I assumed I had to wait for one of the events where you have to find a "rebel scum" and tap on it to get rid of. One of those events finally popped up but it did not complete the mission.   How do I complete this mission? Negative y value in polar plot I'm having some trouble with polar plots. I have to plot negative values, but without changing direction. I tried to set the ymin value to be negative, but it doesn't work.  \documentclass[10pt,border=10pt]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{polar}  \begin{document} \begin{tikzpicture} \begin{polaraxis}[    xticklabel=$\pgfmathprintnumber{\tick}^\circ$,    ymin=-10,    xtick={0,30,...,330}] \addplot table{    0  -1     30 -2    45 -3    60 -4    75 -5    }; \end{polaraxis} \end{tikzpicture} \end{document}   Any suggestion?  For clarity, this is what I expected. Why does the experience-to-next-level not change between some levels? At every level from 1st to 11th, the experience needed to reach the next level (from the current level) increases every level. However, this pattern gets broken for most of the later levels:   Going from 10th to 11th takes 21,000xp (= 85k - 64k), but 11th to 12th takes only 15,000xp! (= 100k - 85k). Both 13th and 14th level only take extra 20k experience each, i.e. the amount needed doesn't increase between those two levels. Levels 16 and 17 similarly only need 30k experience each, and 18 and 19 only need 40k experience each.   Why does the last half of the experience chart have some of these levels maintain the same experience costs, and even briefly decrease the experience cost for 12th level? Kubuntu - can not enter wifi credentials after adding external wifi card My ethernet connection is quite unreliable (It uses powerline adapters) so I bought an external wifi adapter. I have plugged it in and run the command sudo ip address add 192.168.0.39/24 brd + dev enp7s0, and KDE has detected it. Unfortunately, it doesn't seem to realise it is a wireless network and therefore needs credentials. Where I could normally find a place to enter credentials (the network widget, system settings) there are none. KDE reports that the device is connected in the UI. How do I make it work out that it is wireless and therefore needs credentials? Edit: With ethernet plugged out, (USB) adapter plugged in: $ ip address show 1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     inet 127.0.0.1/8 scope host lo        valid_lft forever preferred_lft forever     inet6 ::1/128 scope host         valid_lft forever preferred_lft forever 2: enp7s0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc fq_codel state DOWN group default qlen 1000     link/ether 04:d9:f5:8a:f5:e0 brd ff:ff:ff:ff:ff:ff  With ethernet plugged in, adapter plugged in: 1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     inet 127.0.0.1/8 scope host lo        valid_lft forever preferred_lft forever     inet6 ::1/128 scope host         valid_lft forever preferred_lft forever 2: enp7s0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc fq_codel state UP group default qlen 1000     link/ether 04:d9:f5:8a:f5:e0 brd ff:ff:ff:ff:ff:ff     inet 192.168.0.51/24 brd 192.168.0.255 scope global dynamic noprefixroute enp7s0        valid_lft 863988sec preferred_lft 863988sec     inet6 fe80::7eb1:eca2:96a0:fe5c/64 scope link noprefixroute         valid_lft forever preferred_lft forever  With just ethernet: 1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     inet 127.0.0.1/8 scope host lo        valid_lft forever preferred_lft forever     inet6 ::1/128 scope host         valid_lft forever preferred_lft forever 2: enp7s0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc fq_codel state UP group default qlen 1000     link/ether 04:d9:f5:8a:f5:e0 brd ff:ff:ff:ff:ff:ff     inet 192.168.0.51/24 brd 192.168.0.255 scope global dynamic noprefixroute enp7s0        valid_lft 863960sec preferred_lft 863960sec     inet6 fe80::7eb1:eca2:96a0:fe5c/64 scope link noprefixroute         valid_lft forever preferred_lft forever  With nothing: 1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     inet 127.0.0.1/8 scope host lo        valid_lft forever preferred_lft forever     inet6 ::1/128 scope host         valid_lft forever preferred_lft forever 2: enp7s0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc fq_codel state DOWN group default qlen 1000     link/ether 04:d9:f5:8a:f5:e0 brd ff:ff:ff:ff:ff:ff  lsusb, adapter plugged in: Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 002: ID 046d:c31c Logitech, Inc. Keyboard K120 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 1d57:32da Xenta 2.4GHz Receiver (Keyboard and Mouse) Bus 001 Device 004: ID 0bda:b812 Realtek Semiconductor Corp. 802.11ac NIC Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  I'm not adding it with it plugged out because it's obviously the Bus 001 Device 004: ID 0bda:b812 Realtek Semiconductor Corp. 802.11ac NIC. There were no restarts between any of these changes. Why do variable names often start with the letter 'm'? Proof of Russian Peasant Multiplication I'm studying a combinatorics text () in preparation for taking discrete math this upcoming semester. I've taken a fair amount of math in college, through Calculus II, but this is my first 500+ level math course.    In chapter 2 of the  book, the author introduces an algorithm for multiplication called Russian Peasant Multiplication. I want to prove that this algorithm will always result in the product of two numbers.  I've been chewing on the proof for a while now, and just can't seem to get any traction. Thanks in advance for any help.  Description of Algorithm  I'll try to explain the algorithm clearly. The goal of the algorithm is to find the product of two numbers $m$ and $n$. The below table is filled out for $m$ and $n$:  $$\begin{array}{c} m&amp;&amp;n&amp;\\ \hline \bigl\lfloor \frac{m}{2} \bigr\rfloor&amp;&amp; 2n \\ \bigl\lfloor \frac{m}{4} \bigr\rfloor&amp;&amp; 4n \\ \bigl\lfloor \frac{m}{8} \bigr\rfloor&amp;&amp; 8n \\ \bigl\lfloor \frac{m}{16} \bigr\rfloor&amp;&amp; 16n \\ \bigl\lfloor \frac{m}{32} \bigr\rfloor&amp;&amp; 32n \\ \end{array}$$  The sequence of numbers in both columns is the sequence $a_n = 2a_{n-1}\text{ where }a_1=2$. The columns are extended down until the value in the left column is equal to the number one. After filling out the table, the product is found by adding the values of the right column where the left column is an odd number.  For example, to multiply 18 and 37 with the algorithm:  $$\begin{array}{c} m&amp;&amp;n&amp;\\ \hline 18 &amp;&amp; 37 \\ 9 &amp;&amp; 74 \\ 4 &amp;&amp; 148 \\ 2 &amp;&amp; 296 \\ 1 &amp;&amp; 592 \\ \end{array}$$  To find the product, cross out values of the left column where the value of the right column is even:  $$\begin{array}{c} m&amp;&amp;n&amp;\\ \hline \require{enclose} \enclose{horizontalstrike}{18} &amp;&amp; \enclose{horizontalstrike}{37} \\ 9 &amp;&amp; 74 \\ \enclose{horizontalstrike}{4} &amp;&amp; \enclose{horizontalstrike}{148} \\ \enclose{horizontalstrike}{2} &amp;&amp; \enclose{horizontalstrike}{296} \\ 1 &amp;&amp; 592 \\ \end{array}$$  And add the remaining numbers in the right column to get the result: $18\times37=74+592=666$  Alternate Description of Algorithm  As an aside, here is a shorter way to describe the algorithm, repeat the below steps until the left column == 1:  • Halve the last number in the first column • Write the result below (discard the remainder) • Double the last number in the first column. • Write the result below.   Now, for every even number in the first column, delete the adjacent number in the second column. Add the remaining numbers in the second column.  What I've done so Far  I haven't been able to get much of anywhere on the proof. One thing I did was create a bit of a different way of arriving at the same outcome:  $$\begin{array}{c} m&amp;&amp;n&amp;&amp;\text{index}&amp;&amp;\text{remainder}&amp;&amp;\text{if remainder == 1, }n\times2^{Index}&amp;\\ \hline 18 &amp;&amp; 37 &amp;&amp; 0 &amp;&amp; 0 \\ 9 &amp;&amp; 74 &amp;&amp; 1 &amp;&amp; 1 &amp;&amp; 74\\ 4 &amp;&amp; 148 &amp;&amp; 2 &amp;&amp; 0 \\ 2 &amp;&amp; 296 &amp;&amp; 3 &amp;&amp; 0 \\ 1 &amp;&amp; 592 &amp;&amp; 4 &amp;&amp; 1 &amp;&amp; 592\\ \end{array}$$  Which brings to light the relationship between this algorithm and binary numbers (the fourth column in the above table is the product in binary, read bottom to top).   I also wrote some Python functions to help me explore the problem, I am trying to balance underbraces in the equation below, how can I ensure that both underbraces at the same depth?  \begin{equation} y = \underbrace{ \left [ x^2 + r^2 (a^2+\frac{a^{0.3}}{b}) \right]}_\text{growth rate} \times  \underbrace{ C_0}_\text{initial} \end{equation} How do I disable negative scaling? By default blender allows you to scale past 0 - how do I prevent this?  i.e. it's common in other 3D modelling software to resize a set of vertices against an axis to align them - however this isn't possible when negative scaling is enabled. Real life uses of Moment generating functions In most basic probability theory courses your told moment generating functions (m.g.f) are useful for calculating the moments of a random variable. In particular the expectation and variance. Now in most courses the examples they provide for expectation and variance can be solved analytically using the definitions.   Are there any real life examples of distributions where finding the expectation and variance is hard to do analytically and so the use of m.g.f's was needed? I'm asking because I feel like I don't get to see exactly why they are important in the basic courses. Crossroads / Second Chance / Choices I am trying to find a short story involving an alien race of 'Intellectuals.' They possess no opposable thumbs or other limbs to control their world.  I think the basis of the story is their discovery of a way to influence another unintelligent species that can manipulate objects.  This leads to a new start for them.  They may have been at risk of breeding beyond available resources.  The story ends with explorers returning from sea. They may have discovered a new land into which they can expand. The last few scenes have a darker flavor where one character has been presented with a rock that glows in the dark. He considers it for a period before being called away to greet the explorers. The author then takes over and makes some comments about most species passing one crossroads only to meet another.  The story could have been written at any time from the Golden Age though to the 1970's. The  is the difference between the distances travelled by two waves meeting at a point. Given the path difference, how does one calculate the phase difference? If I run a randomForest model, I can then make predictions based on the model.  Is there a way to get a prediction interval of each of the predictions such that I know how "sure" the model is of its answer.  If this is possible is it simply based on the variability of the dependent variable for the whole model or will it have wider and narrower intervals depending on the particular decision tree that was followed for a particular prediction? Is there a reasonable statistic test one can do to standard random number generators (say, one of those that come built in in Python libs) which shows they are not really random?  (By reasonable I mean to exclude silly things like «generate a looong list and see that it is periodic»)  Later: Notice I am looking for a test that fails on standard generators. With Ubuntu One shut down, is there a way to sync applications between computers? Since Ubuntu one is no longer it appears that Sync between computers no longer works.  Is there a new method to do this?  I'd like to sync the apps from one machine to another. $\left|x_{n+1} - x_n\right| < C\left|x_n - x_{n-1}\right|$ prove this is Cauchy Can I get US sales taxes refunded for electronics purchased while on vacation? Order of execution of jquery document ready can we use past simple with for the past two days