I recently gave an online JS test, the questions was below, I couldn't understand and solve that, but now I want how that can be done. Please help me understand that.  write a wrap function that takes the execute function as an argument and returns a modified function so that the following requirements are met:   any result returned by the function execute should be returned from the modified function unchanged. if the function execute throws a error, the modified function should return null. after the function execute has thrown an error, its future executions should be prevented and null should be returned multiple modified functions can co-exist   The execute function doesnt take any argument.  function wrap (execute) {   // Return modified function }  var errorExec = wrap(function () {   throw new Error('Error'); }); var resultExec = wrap(function () {   return "Result"; }); console.log(errorExec &amp;&amp; errorExec()); // Should output null console.log(errorExec &amp;&amp; resultExec()); // Should output "Result"
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.
Animations with movie15 and swf files I am trying to use movie15 to embed vector animations in my presentation. The trouble is that embedded SWF files refuse to display on Acrobat Reader X sometimes with a "This Media requires an additional player" message. Eg. this  doesn't work. Animated GIFs won't display either, with no error message.   Maybe this is an Acrobat issue but I tried the flashmovie package with the same SWF files and that does work (but only with the embedded player option so no controls are visible). But flashmovie is supposedly unstable with beamer so I was wondering if someone had run into the same problem with movie15.  I am using Windows 7, Acrobat 10.1.2 and MiKTeX. Why is Leia okay with being tracked to Yavin? In A New Hope, after Han and Luke fight off the TIE Fighters while escaping from the Death Star, these exchanges happen:             INT. DEATH STAR - CONTROL ROOM             Darth Vader strides into the control room, where Tarkin is             watching the huge view screen. A sea of stars is before him.                                   TARKIN                      Are they away?                                   VADER                      They have just made the jump into                       hyperspace.                                   TARKIN                      You're sure the homing beacon is                       secure aboard their ship? I'm taking                       an awful risk, Vader. This had better                       work.             INT. MILLENNIUM FALCON - COCKPIT             Han, removes his gloves and smiling, is at the controls of             the ship. Chewie moves into the aft section to check the             damage. Leia is seated near Han.                                   HAN                      Not a bad bit of rescuing, huh? You                       know, sometimes I even amaze myself.                                   LEIA                      That doesn't sound too hard. Besides,                       they let us go. It's the only                       explanation for the ease of our                       escape.                                   HAN                      Easy... you call that easy?                                   LEIA                      They're tracking us!                                   HAN                      Not this ship, sister.             Frustrated, Leia shakes her head.                                   LEIA                      At least the information in Artoo is                       still intact.                                   HAN                      What's so important? What's he                       carrying?                                   LEIA                      The technical readouts of that battle                       station. I only hope that when the                       data is analyzed, a weakness can be                       found. It's not over yet!   Leia doesn't even know if there is a weakness, let alone whether they'll find one. If she (correctly) realizes that they're being tracked, why doesn't she suggest that the Millennium Falcon go somewhere besides Yavin 4 instead of just frustratedly shaking her head? I know the plans , but it seems unlikely that continuing to fly to the secret Rebel base in the ship she's certain is being tracked is the only option. They are already in hyperspace when this conversation happens, but they apparently have time to talk for a little while after, so presumably they'd have time to stop and reroute. Why is it true that "I before E, except after C"? Does DTIME(O(n)) = REGULAR? Left inverse implies right inverse in a finite ring Let $R$ be a finite ring with identity $1$, and assume $\exists x,y\in R$ such that $ xy=1$. How can I show it implies $yx=1$? Dealing with bundle/omnibus/list-of-questions question that consists of rather distinct questions I have looked at the various help pages but I couldn't find a clear guideline for the following issue: often enough someone will ask in the same post (i.e. in the same SE-question) a whole bunch of questions (in the plain English sense of the word), which while may be about the same topic are nevertheless sufficiently distinct that each may require several paragraphs of text to answer adequately.   I can see an upside for leaving related questions grouped together from the asker's perspective: "there's a thread (on SE) answering all my questions about topic T!" On the other hand, from the perspective of organizing questions by having a clear heading/title for each (actual) question and so forth, i.e. from the perspective of SE being a fairly structured database of Q&amp;As instead of being a more like a collection of forum threads "I'm confused about topic T", the omnibus question-list approach seems clearly sub-optimal.  The omnibus approach also makes the issue of accepting answers (and perhaps reviewing such actions) difficult: if two different users give replies to different parts/sub-sets of the question-list, which one is the most adequate one? Even upvoting all partial answers seems iffy because it actually penalizes the user(s) who provides(s) the most complete answer to the question-list: since a user can only give at most one upvote to another user's answer, if user X provides answers to A &amp; B in the same SE-answer, he can only get at most one upvote from user Y, whereas if these were two different SE-answers, he could get two upvotes from user Y.  So, given the above problems, which I think are real enough, is there anything in the SE system addressing list-of-questions question splitting? How can I change the master volume level? Using this code  [DllImport ("winmm.dll")] public static extern int waveOutSetVolume (IntPtr hwo, uint dwVolume);  waveOutSetVolume (IntPtr.Zero, (((uint)uint.MaxValue &amp; 0x0000ffff) | ((uint)uint.MaxValue &lt;&lt; 16)));   I can set the wave volume but if the master volume is too low this won't have any effect.  Thanks for any help. NVMe PCIe x4 SSD on M.2 PCIe x2 slot? i'm about to get a new SSD for my PC, and before spending the money i have some doubts about my decision i would like to clarify First, my mobo is a B450 Aorus Pro Wifi, it has 2 M.2 slots, one of them full length (22110) compatible with PCIe 3.0 x4 and the other one standard length (2280) and support only for PCIe 3.0 x2 About the drive, i'm aiming for a 1tb XPG SX8200 Pro , which is a PCIe 3.0x4 SSD My first M.2 slot is already taken by the main SSD, which i use for the OS and other stuff, i can't really use it. Will a PCIe x4 SSD work on a PCIe x2 slot? How much performance will be lost if it does? Will it be worth it? In terms of UX what do you guys think is the best approach when integrating a trial period for subscriptions?  My application offers a 15 day trial, at the minute the user can sign up without providing any payment information (Paypal Subscription). The account is then set to trial status and after 15 days the user will be redirected to an upgrade page.  Do you think this is the best approach? I am unsure whether or not to let Paypal manage the trial, this however means that the user will need to go through the Paypal payment system during signup. I think this may put some people off signing up.  On the other hand this approach may increase the number of conversions to a full account. irreducibility of a polynomial over $\mathbb{F}_2$ Why does the /winsxs folder grow so large, and can it be made smaller? A Vista virtual machine I use only has a 10 GB virtual hard disk -- and I'm worried about it running out of space over time. I used  to check for the culprits..  And the primary culprit is that /winsxs or &quot;Windows Side-By-Side&quot; folder.  What is the Windows Side By Side folder? Well, that's .  All of the components in the operating system are found in the WinSxS folder – in fact we call this location the component store.  Each component has a unique name that includes the version, language, and processor architecture that it was built for.  The WinSxS folder is the only location that the component is found on the system, all other instances of the files that you see on the system are “projected” by hard linking from the component store.  Let me repeat that last point – there is only one instance (or full data copy) of each version of each file in the OS, and that instance is located in the WinSxS folder.   So looked at from that perspective, the WinSxS folder is really the entirety of the whole OS, referred to as a &quot;flat&quot; in down-level operating systems.  This also accounts for why you will no longer be prompted for media when running operations such as System File Checker (SFC), or when installing additional features and roles. That explains why the folder starts off big, but not why it gets larger over time – the answer to that question is servicing.   In previous versions of Windows the atomic unit of servicing was the file, in Windows Vista it’s the component.  When we update a particular binary we release a new version of the whole component, and that new version is stored alongside the original one in the component store.  The higher version of the component is projected onto the system, but the older version in the store isn’t touched.  The reason for that is the third part of why the component store gets so large.  Lots of other people :  A coworker recently received his every two year work laptop refresh and was in the middle of loading his new laptop with Vista. For some reason, his hard drive C: was partitioned to only 25GB and the rest of the space reserved for a much larger drive D:. Anyway, after loading many Windows Updates, he was left with hardly any drive space left on C:, and for some reason, the WinSxS directory had ballooned to over 8GB. While I knew what the WinSxS (Windows Side-by-Side) directory was for, I wasn't quite sure why that directory would explode in size so fast with normal operating system updates.  I don't really care about having all these duplicate files for safety, but I do care about the VM exploding due to an out of disk space error. So.. can /winsxs be safely pared down in any way? ..  Administrators should not, for any reason, take it upon themselves to clean out the /winsxs directory - doing so may prevent Windows Update and MSI from functioning properly afterwards.  Preventing accidental deletion from the directory is accomplished by putting a strong security descriptor on the directory that inherits to its children.  If this /winsxs folder gets any larger, I'm going to have to re-image this virtual machine.. which I really don't want to do! Number of normal subgroups of a non abelian group of order $21$... CSIR December $2013$ Question is to :  Find the number of Normal subgroups of a nonabelian group $G$ of order $21$ other than $\{e\}$ and $G$.  What I have done so far is :  As $|G|=21=3\cdot7$  we have :  No. of sylow $3$ subgroups $1+3k$ dividing $7$ leaving out possibilities $1$ or $7$  No. of sylow $7$ subgroups $1+7k$ dividing $3$ leaving out only possibilities $1$.  So, we have a unique sylow $7$ subgroup and so it is normal.  I remember somehow that any normal group should come from a normal sylow subgroup or something like that.  S0, I prefer to conclude there is only one Normal subgroup for a non abelian group of order $21$.  Please let me know if this is true and please help me to fill that gap :      I remember somehow that any normal group should come from a normal sylow subgroup or something like that.   Thank you. Find full path of the Python interpreter? Computing convex hull of points using shapely I want to have an index entry typeset as $a_\text{T}$, so I issue the command \index{at@$a_\text{T}$}. Each use of this index command creates a separate line in the index. How can I get \makeindex to recognize they all reference the same topic?  My index entries look like this: Question about the order of the product of two elements in an abelian group My reference for learning abstract algebra says that in an abelian group $G$ the product of two elements (say $a$ with order $n$ and $b$ with order $m$) has order $mn$ if $gcd(n,m) = 1$.   What I don't understand is where the $gcd(m,n)=1$ comes into use in proving this fact? For example, $ a^{mn} = (a^n)^m = (e)^m = e$ (identity element). A similar argument for $b^{mn}$ together with the fact that $G$ is abelian is enough to show that $(ab)^{mn} = e$. From here, how do I conclude for an integer $r &lt; mn$ that $(ab)^r \neq e$  Also, are there any other conclusion that can be drawn if $gcd(n,m) \neq 1$ ?  Thanks for any feedback in advance ! Now that I have Google Chrome all set up, I got myself a new laptop. Does anyone have any idea how to transfer my settings, cookies, favorites, etc?   I checked documents and settings\me\application data, and found nothing. Question about preposition -of- Arbitrary products of quasi-coherent sheaves? I have a quick question. Looking at the next GIF that I made, what is the quickier way you can come up with to delete the excess material that goes beyond the wall? It is basically the attachment of the handrail to the wall what is giving me this "problem".    My solution would be using the boolean modifier with a cube or something, so obviously I know how to do it. But I'm looking for the best solution, i.e., does Blender let me select the excess material in any way? For example, is there a quick way to intersect those planes? I read about intersecting planes in Blender and seems like a difficult task (not worth it in this case). So I discarded that solution.  Thanks.