Closures are functions that inherit variables from their enclosing environment. So lets see this code:  binaryServer = BinaryServer({port: 9001});  binaryServer.on('connection', function(client) {   console.log("new connection");    client.on('stream', function(stream, meta) {     stream.on('data', function(data){     //actions     });     stream.on('end', function() {     //actions     });   }); });   So, I am correct if I say: " function(data){//actions} is a closure because inherits the variables of enclosing environment (like the object client) "? Because of my experiences that's what happening.
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.
I'm on IBM AIX 7.1 where cURL and wget are not available. Also, I'm not in a position to install either.  Are there alternatives that would be available that would enable remote API calls using GET/POST? NB: Nvidia has released an official fix; please see ,  and/or .  Upon waking up Ubuntu 16.04 from Suspend, the following graphical glitches appear around all windows, context menus, and similar:      This is currently known to affect the following NVIDIA cards running the proprietary drivers:  NVIDIA GeForce 610M, driver version 375.39, 340.102 NVIDIA GT 630M, driver version 375.39 NVIDIA GTX 650, driver version 375.39 NVIDIA GT 740M, driver version 378.13 NVIDIA GTX 745, unknown driver version NVIDIA GTX 850M, driver version 375.39, 378.13 NVIDIA GT 940M, driver version 375.39 NVIDIA GTX 950M, unknown driver version NVIDIA GTX 960M, driver version 378.13 NVIDIA GTX 970, driver version 375.39 NVIDIA GTX 970M, driver version 375.39 NVIDIA GTX 980 TI, unknown driver version NVIDIA GTX 1060, driver version 375.26, 375.39, 378.09 NVIDIA GTX 1070, driver version 378.09  The above above list has been sourced from reports from other users here on AU,  thread, and  thread. NB: This is be no means an exclusive list. It probably effects nearly all Nvidia cards.  Furthermore, this issue has been replicated on a clean install where the only change was a software update and the installation of the latest NVIDIA drivers.  What is going on, and how can it be resolved? divisibility question in abstract algebra over a field $d|n \Rightarrow x^{p^d} - x$ divides $x^{p^n} - x$ over $\mathbb{F}_{p}$ where $\mathbb{F}$ is a field.  Attempt:   $d|n \Rightarrow x^{p^d} - x$ divides $x^{p^n} - x \Rightarrow x^{p^d - 1} - 1$ divides $x^{p^n - 1} - 1 \Rightarrow p^d - 1$ divides $p^n - 1$ since $p^n - 1 = (p^d)^{\frac{n}{d}}-1$.  How does this look? Is it possible to do The Pitt without a slave outfit? Nonconstant polynomials do not generate maximal ideals in $\mathbb Z[x]$ GroupBy a list of associations with their keys Unable to log out of chat. I attempted to log out with the following actions:    This accomplished absolutely nothing since I remained logged in after clicking "log out" on the confirmation page. I then tried logging out of Stack Exchange from one of the network sites and repeated the steps above. The results were the same. I remained logged in no matter which combination of steps I performed.  In fact, the only way I could log out at all was to clear all of the cookies that were set. Evaluate the integral $\int_0^\infty \frac{dx}{\sqrt{(x^3+a^3)(x^3+b^3)}}$ In the Breusch-Godfrey test we use a model  $$ e_t = \varepsilon_t + \beta_1 \varepsilon_{t-1} + \dots+ \beta_p \varepsilon_{t-p}. $$  If we reject the null hypotesis of no serial auotocorrelation of the error, it means that the residuals follow an auto-regressive model of order ($p$).  If I want to avoid this problem, I must add a certain number of lags of the response variable $y$ as regressors in the original model. However, in some cases this method is not useful.   Are there other options to consider? I have a SRD-12VDC-SL-C relay with this configuration:  And I want to trigger it with PIR Motion Sensor Detector Module HC-SR501  The problem with direct connection to PIR is, when I connect PIR with 12v DC the Relay remains always ON, i.e. trigger from PIR does not switch it off. And when I connect it via 5V supply the Relay remains always OFF. The trigger output of PIR is 3.3V how can I rectify this problem? by adding some resistor/FETs, or something else. Edit: The voltage at Relay-In(Green) is 10.5V and the relay is OFF it need to go below 9V in order to switch the Relay ON. When I connect it to PIR trigger it goes down to 2.7V (Thus Switching ON the relay, below 9V). And when the PIR trigger of 3.3V comes it goes up to 7.2V but because it is still below 9V) Relay does not switch. Faster language/keyboard swapping I like making a habit to use the different languages I study, to keep that knowledge fresh. So I like typing in those languages when I get the chance. But swapping keyboards under OSX is just a little too cumbersome.  For example, I was just typing the name of one of my co-workers in its original 汉子 form instead of as an English transliteration. It's nice. It reminds me to pronounce her name properly, with tone, etc., which otherwise doesn't come naturally. The transliteration of her name is especially misleading. Everyone at the company is pronouncing it wrong.   But to swap into writing 汉子 I have to mouse up to the top menu bar, select a new keyboard, type, mouse back up to the top bar, and then select back into English. I know there's a keyboard shortcut, but with 5 different keyboards active in my menu, cycling through 5 to get to the one I want feels just as cumbersome.  Is there a way to attach a hotkey to a specific keyboard, or some other way to make swapping character sets lighter? Every element outside the maximal ideal of a local ring is a unit A homework question from my algebra class asks:     Show that in a local ring $R$ with maximal ideal $M$, every element outside $M$ is a unit.   My argument is that since $M$ is maximal $R /M $ is a field and so for any $ x \in R \backslash M $, $ x + M $ has a multiplicative inverse, which implies $ x $ is a unit.  I don't see where we need the fact that $R$ is a local ring. Calculating $\lim_{x\to0} \left\lfloor\frac{x^2}{\sin x \tan x}\right\rfloor$ Find $$\lim_{x\to0}  \left\lfloor\frac{x^2}{\sin x \tan x}\right\rfloor$$ where $\lfloor\cdot\rfloor$ is greatest integer function   I am a high school teacher. One of my students came up to ask this limit.  For $\lfloor\frac{\sin x}{x}\rfloor$, I have used $\sin x &gt; x$ using increasing decreasing functions.  I tried to prove $x^2 &gt; \sin x \tan x$ using increasing /decreasing  function but I am not getting it. I am unable to understand what exactly is critical value.My question here is why do we fail to reject a null hypothesis when the test statistic is within the range of critical value.  What i am trying to ask is what is the property of the critical value that makes the hypothesized value to fall within the range implied by the critical value.  Thanks in advance Add space between headings and body in the home of the iPad app It's a pain in the ass for me to quit the app, draw a red circle in another app and return to the app, so...    If you notice the three questions in the bottom, you will notice that the emboldened headings (New Answer, Comment) are stick to the next character. Imperfect.    App Version: 1.4.0.249 Device: iPad 2 (GSM) OS Version: Version 9.1 (Build 13B143) I have an existing windows application, for which I have decided to create a Mac version. The problem is that the current UI involves a lot of buttons, tabbed panels, multiple windows etc.  This UI had been rated as intuitive and easy to use and straightforward  by many customers and editors. But a beginner (very less experience) may find in confusing a little, but it has been complemented with tutorial.      When creating the Macintosh variant, should I focus on creating a simplified and minimalistic UI (this does not mean the current UI is complex, but I think Mac user's prefer a simple UI right?) or should I try to copy the exact same thing?  By reducing the UI some of the features may be missing. But it can be added later if needed. Should I focus on a fresh approach (this is easier rather than copying the complex UI pattern) or should I go with the old recognized setup? How to add thickness to a curve? How can I add thickness to a curve? I already tried with the extrude and depth options in the curve settings, but it doesn't work properly. How to calculate number of days between two given dates? If I have two dates (ex. '8/18/2008' and '9/26/2008'), what is the best way to get the number of days between these two dates? I have been reading the top posts here, and the recommendations for what to invest in are often similar. What I'd like to know, in as simply of terms as possible, is what the consensus is on priority of these investments.  I am new to this, but here are some of the obvious options:   Paying off credit card debt Paying off mortgage / student loans 401k up to employer match 401k past employer match IRA Emergency fund Other important investments that I have missed   Clearly this will vary person to person, but if you were asked to put an ordered recommendation on a highway billboard, what would it be?  (For example:   Pay off credit debt Emergency fund for 6 months 401k up to match ... ) After one of the latest updates (not sure if it was the last one or a previous one) of the Google Play app, I am having an error trying to update a large app (42MB). It says:     Error Downloading . There is insufficient space on the device.   My device is a Samsung P1000 running Froyo. It's rooted, but the error was there before rooting it.  A quick Google search showed several Samsung users having the same problem (the app in question that was giving me the headache is Smurf's village). Some said that removing the updates to the Android Market (Google Play) app would fix it, but to me it was of no avail.  I also tried the procedure in  to no avail.  Now I am stuck with a prehistoric version of the Market (that works on small apps) and still cannot update Smurf's Village or install big apps. How can I fix this?  EDIT: device has over 2GB of internal SD storage, 27GB of external SD card, so space is not an issue.