Why does this code return undefined 4 times instead of the array values? This is an example from a blog post by  that addresses IIFE's. The following block of code returns 4 repeated 'undefined' responses by design:  function printFruits(fruits){   for (var i = 0; i &lt; fruits.length; i++) {    setTimeout( function(){       console.log( fruits[i] );     }, i * 1000 );   } }  printFruits(["Lemon", "Orange", "Mango", "Banana"]);   Avaylo then shows how to produce what (to me) would have been the expected output of the first code block (it outputs the values of the array):  function printFruits(fruits){   for (var i = 0; i &lt; fruits.length; i++) {     (function(){       var current = i;                    // define new variable that will hold the current value of "i"       setTimeout( function(){         console.log( fruits[current] );   // this time the value of "current" will be different for each iteration       }, current * 1000 );     })();   } }  printFruits(["Lemon", "Orange", "Mango", "Banana"]);   I understand that the IIFE creates a new scope. What I don't understand is the reason why the first block of code doesn't produce the (again, to me) expected output of returning the values in the array. I've been staring at this for a few days now, thus I conclude that my javascript knowledge is missing something fundamental.  Thank you for any insight!
How do JavaScript closures work? 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.
What does the author mean by 'back to back' and 'hidden city' ticketing hacks? What's the physical meaning of the imaginary component of impedance? As you know, impedance is defined as a complex number.  Ideal capacitors: $$ \frac {1} {j \omega C} \hspace{0.5 pc} \mathrm{or} \hspace{0.5 pc} \frac {1} {sC} $$  Ideal inductors: $$ j \omega L \hspace{0.5 pc} \mathrm{or} \hspace{0.5 pc} sL $$  I know that the reason why they 'invented' the concept of impedance is because it makes it easy to work with circuits in the frequency domain (or complex frequency domain).  However, since in real-life circuits both voltages and currents are real numbers, I'm wondering if there is any actual physical meaning behind the imaginary component of impedance. I want to be able to login to a remote via ssh without having to enter the password all the time.   How do I set it up? Is a different command required to execute a password-less session? Multivariate linear regression vs. several univariate regression models In the univariate regression settings, we try to model   $$y = X\beta +noise$$  where $y \in \mathbb{R}^n$ a vector of $n$ observations and $X \in \mathbb{R}^{n \times m}$ the design matrix with $m$ predictors. The solution is $\beta_0 = (X^TX)^{-1}Xy$.  In the multivariate regression settings, we try to model   $$Y = X\beta +noise$$  where $y \in \mathbb{R}^{n \times p}$ is a matrix of $n$ observations and $p$ different latent variables. The solution is $\beta_0 = (X^TX)^{-1}XY$.  My question is how is that different than performing $p$ different univariate linear regression? I read  that in the latter case we take into consideration correlation between the dependent variables, but I don't see it from the math. What exactly is the cause of RAM incompatibility? I'm looking at rather short QVL lists from manufacturers, and I'm wondering what is the underlying cause of RAM incompatibility aside from the obvious: Obvious Reasons for Incompatibility  RAM Generation (DDR, DDR2, DDR3, DDR4) Form Factor / pin count RAM Type (ECC vs Non-ECC, Registered vs not, Buffered vs not) Minimum speeds on a board that cannot adjust the memory frequency Non-standard voltage range on a board that cannot adjust the memory voltage Channel count (single vs dual vs quad) Bad or inoperable module Mismatched set  Not Obvious Reasons  Brand SKU Max Capacity Speed too high  As in, why can't motherboard manufacturers just list the specifications of the RAM they will accommodate, and support every memory chip of that category instead of listing specific SKUs from specific brands? What happens electrically/physically that causes boards to fail to POST / operate with RAM that is otherwise 'compatible' with all of the specifications of RAM that is on the QVL? What invisible flicker do different types of light bulbs have? What waveform does the light coming off different types of artificial light sources have and (of course) what are the underlying physical reason for them?    I was inspired to ask this question because of several things I have been hearing lately.  Firstly, there was a recent TED talk about how .  Researchers have been working on the problem for a little while now and they've made a fairly impressive product, but it was only recently made possible by the LED technology, which has such a fast response that it can easily compare to the transfer rates of electric information condiuits that we normally use.  My understanding is that incandescent bulbs flicker because they have 60 Hz AC power being pulsed through them.  In fact, I think 60 Hz was chosen in the first place because it was a threshold that was unnoticeable to humans.  Looking at a  demonstrates that it has a very significant lag time responding to both the normal electrical phasor and being turned off.  In other words, it flickers but it doesn't go dark at any point in the AC waveform.  Looking for more information, however, I was a little disappointed, since nothing seemed to give a graph of lumens emitted over time for all different kinds of bulbs.  Of course, there isn't just one relevant time scale.  A light could flicker with 60 Hz and also flicker with 2000 Hz (I just made that up).  I'm interested in the complete picture of what lights exhibit what patterns. Do muggleborns get their letter on their 11th birthday or the summer before they start Hogwarts? A lot of the fanfiction seems to like to give Hermione her letter in September to coincide with her birthday. That just doesn't seem very logical for the Statute of Secrecy, as you then have 10 out of every 12 10-year-old wizards and witches knowing about magic while finishing the school year (assuming even distribution of birthdays).   It seems to me that this is just asking at least one of them to brag about knowing magic and spill the secret.   Also this would mean that the poor kid born on 30 of August would only have 2 days to adjust to being magical before being shepherded off to a boarding school in the middle of nowhere.  From another point of view, getting such news on your birthday can screw up a lot of celebration plans.  Also, from rereading the memory from Dumbledore where he introduced magic to Tom, there is no mention of snow or even closeness to his birthday from the caretaker.  I believe this view came from the fact that Harry got his letter on his birthday but that piece of fanon seems to forget that letters were being sent up to at least a week or 2 beforehand (leading to the Dursleys hiding on a rock in the sea in the first place). Temporarily change language for terminal messages/warnings/errors Messages in my terminal are displayed using Russian language by default, which is my native one.  For just a moment I want them to be in English (eg. to paste in forums), then switch back to the default language.  How can I do the switch and switch back using bash? Different results for integration using Mathematica and MATLAB Layers tab not showing Usually my layers tab appears in the area of the red circle, but I did something that changed it. I would like to know how to get it back. Thanks! delegate keyword vs. lambda notation Once it is compiled, is there a difference between:  delegate { x = 0; }   and  () =&gt; { x = 0 }   ? Function is Continuous When Restricted to Closed Sets Which Cover the Space Suppose that $\{A_i\}$ is a finite collection of closed sets in $X$ such that $X = \bigcup A_i$, and $f : X \to Y$ restricted to each $A_i$ is continuous. Then $f$ is continuous.   Okay. The base case ($n=2$) is just the pasting lemma. I am having a little trouble with the inductive case, specifically with what the hypothesis is and how to deal with continuity with respect to subspaces. I believe the inductive hypothesis is to assume that any function over a topological space that is the union of $n-1$ closed sets such that the function restricted to each of these $n-1$ closed set is continuous must be continuous over the whole space. Then I assume I have a topological space $X = \bigcup_{i=1}^n A_i$, where each $A_i$ is closed, and a function $f : X \to Y$ such that $f|_{A_i}$ is continuous for each $i$. Thus $X = \bigcup_{i=1}^{n-1} A_i \cup A_n$, where $C = \bigcup_{i=1}^{n-1} A_i$ is closed since it is a finite union of closed sets. If I can show $f|_C$ is continuous, then I simply apply the pasting lemma to finish the problem. Give $C$ the subspace topology, and notice that each $A_i$ is closed in $C$. Thus we have a topological space $C$ that is the union of $n-1$ closed. But do I still have continuity $f$ restricted to $A_i$ since I am no longer considering them subspaces of $X$ but of $C$? When one says $f|_{A_i}$ is continuous, is one saying that $f$ is continuous when restricted to $A_i$ and $A_i$ is given the subspace topology?  EDIT:  I think I figured out the lemma I need. Claim: Let $A$ and $C$ be subspaces of $X$ such that $A \subseteq C$. Topologize $C$ with subspace topology with respect to $X$. Then the subspace topology on $A$ as a subspace of $X$ (call it $\tau_X$) is the same as the subspace topology of $A$ as a subspace of $C$ (call it $\tau_C$).   Proof: Let $U$ be open in $X$. Then $A \cap U$ is some open set in $A$ as a subspace of $X$. Since $C$ is a subspace of $X$, $C \cap U$ is open in $C$ as a subspace of $X$. Then $A \cap (C \cap U) = (A \cap C) \cap U = A \cap U$ is open in $A$ as a subspace of $C$, thereby proving $\tau_X \subseteq \tau_C$. Now let $O$ be some open set in $C$ as a subspace of $X$. Then $A \cap O$ is some open subset of $A$ as a subspace of $C$. But $O = C \cap U$ for some open set in $X$. Therefore $A \cap O = A \cap (C \cap U)= A \cap U$, which is also open in $A$ as a subspace of $X$. Hence $\tau_C \subseteq \tau_X$  Kind of obvious. But it was hard to spot the need for this lemma when I was considering subspace of subspaces and continuous functions, etc. Am I right in thinking this is the lemma I need? Transcendental Extensions. $F(\alpha)$ isomorphic to $F(x)$ Let $E$ be an extension field of $F$ and $\alpha \in E$. Then $\alpha$ is transcendental over $F$ if and only if $F(\alpha)$ is isomorphic to $F(x)$, the field of fractions of $F[x]$.   This was a theorem in an abstract algebra textbook with a very brief proof. Can someone please explain why this theorem holds? I'm having difficulty grasping the concepts at hand.  Thanks! Can you travel to the US prior 1 months of tourist visa expiry? I've heard that i can travel to the US any time before my tourist visa expiry.  Is that true?  (please advise) How to pass parameters to an alias? For bash script, I can use "$@" to access arguments. What's the equivalent when I use an alias? In unix/linux, any number of consecutive forwardslashes in a path is generally equivalent to a single forwardslash. eg.  $ cd /home/shum $ pwd /home/shum $ cd /home//shum $ pwd /home/shum $ cd /home///shum $ pwd /home/shum   Yet for some reason two forwardslashes at the beginning of an absolute path is treated specially. eg.  $ cd ////home $ pwd /home $ cd /// $ pwd / $ cd // $ pwd // $ cd home//shum $ pwd //home/shum   Any other number of consecutive forwardslashes anywhere else in a patch gets truncated, but two at the beginning will remain, even if you then navigate around the filesystem relative to it.  Why is this? Is there any difference between /... and //... ? Importing a material from blender to unity Cellcolor overwrites partial horizontal lines (\cline) So I need to make a colored table with multirows, together with the use of partial horizontal lines. I used \cline which does not work: the \cellcolor-command overwrites the line.  told me to change it to \hhline which will not be overwritten by \cellcolor. Instead, \hhline overwrites the color.  To make it more clear:  Without color:  \documentclass{article}  \usepackage{colortbl} \usepackage{multirow}  \begin{document}    \begin{tabular}{|c|c|}     \hline     \bfseries ColumnOne &amp; \bfseries ColumnTwo\\ \hline     First data &amp; 932\\ \hline      &amp; 239\\ \cline{2-2}  % or \hhline{|~|-|}      &amp; 137\\ \cline{2-2}  % or \hhline{|~|-|}     \multirow{-3}{*}{More data} &amp; 319\\ \hline     Last data &amp; 132\\ \hline   \end{tabular}  \end{document}     With color: Using \cline  \documentclass{article}  \usepackage{colortbl} \usepackage{multirow}  \begin{document}    \begin{tabular}{|&gt;{\columncolor{red}}c|&gt;{\columncolor{blue}}c|}     \hline     \bfseries ColumnOne &amp; \bfseries ColumnTwo\\ \hline     First data &amp; 932\\ \hline      &amp; 239\\ \cline{2-2}      &amp; 137\\ \cline{2-2}     \multirow{-3}{*}{More data} &amp; 319\\ \hline     Last data &amp; 132\\ \hline   \end{tabular}  \end{document}    Makes the lines in the right column disappear.  Using \hhline  \documentclass{article}  \usepackage{colortbl} \usepackage{multirow} \usepackage{hhline}  \begin{document}    \begin{tabular}{|&gt;{\columncolor{red}}c|&gt;{\columncolor{blue}}c|}     \hline     \bfseries ColumnOne &amp; \bfseries ColumnTwo\\ \hline     First data &amp; 932\\ \hline      &amp; 239\\ \hhline{|~|-|}      &amp; 137\\ \hhline{|~|-|}     \multirow{-3}{*}{More data} &amp; 319\\ \hline     Last data &amp; 132\\ \hline   \end{tabular}  \end{document}    Creates white lines on the left column.  Is there any possible way on how to resolve this? I'm reading Algebraic Number Theory by Jurgen Neukirch. I have some problems with some of the exercises in Section 9 of Chapter 1.  They are:  1) If $L / K$ is a Galois extension of algebraic number fields with non-cyclic Galois group, then there are at most finitely many non-split prime ideals of $K$.  2) Let $L / K$ be a finite (not necessarily Galois) extension of algebraic number fields and $N / K$ the normal closure of $L / K$. Show that a prime ideal $p$ of $K$ is totally split in $L$ if and only if it is totally split in $N$.  I have worked on them for a long time but couldn't get any idea of it.   Can you please help? Thank you! A couple years ago, it was easy to root any device: Install KingRoot, KingoRoot, or a similar app, hit the large ROOT button, and let it do the rest. After 5 minutes or so, a green "Root Succeeded!" prompt will pop up, and we can choose to keep the root app, or uninstall it and install a clean root manager app like SuperSU/Superuser.  How do they work? Why aren't they working anymore? And if they work, should I use them or not?