I've seen this in a lot of scripts. When is it better to do  var foo = function() { console.log("Foo!"); };   than  function foo() { console.log("Foo!"); }   when it's obvious that function name(){} is more compact and seems to do the same things? At first, I thought it was so you could use foo as a variable, but you can still do that with both methods. They can even both be redeclared by either method.  I know that var foo = function(){}; creates the function at runtime, but I don't see the advantage of this, because it can lead to crashes, which I assume are unwanted.
I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent.  The previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or not.  The two ways are:  var functionOne = function() {     // Some code };     function functionTwo() {     // Some code }   What are the reasons for using these two different methods and what are the pros and cons of each? Is there anything that can be done with one method that can't be done with the other?
I am using a cloned hard drive in attempts to restore some old files.   The cloned drive has 2 users, one with an encrypted home drive, one without. Both are administrators. When I couldn't get into the main user (with the encrypted home directory), I logged in as the 2nd user and changed the password.   It seems that I somehow broke the relationship between the encryption passphrase and the user. I'm pretty sure I have the passphrase. Is there a way to get to the data? My system was configured to dual boot Ubuntu 12.04.1 LTS and Windows 7. Today I got my hands on the MSDN release of Windows 8 and I installed it over my Windows 7. Now the computer just boots to Windows 8 directly without loading the GRUB screen.  So I followed the steps as suggested in: . Running this command:      ls -l /dev/disk/by-label/   gives the following output:      total 0     lrwxrwxrwx 1 root root 10 Sep 11 07:51 Entertainment -&gt; ../../sda2     lrwxrwxrwx 1 root root 10 Sep 11 02:45 PENDRIVE -&gt; ../../sdb1   Also fdisk -l command gives this as the output:      Disk /dev/sda: 320.1 GB, 320072933376 bytes     255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x1246aa23         Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048   319582199   159790076    7  HPFS/NTFS/exFAT     /dev/sda2       319582208   602906623   141662208    7  HPFS/NTFS/exFAT     /dev/sda3       602908672   625135615    11113472   83  Linux      Disk /dev/sdb: 1939 MB, 1939865600 bytes     64 heads, 63 sectors/track, 939 cylinders, total 3788800 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xc3072e18         Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *        2248     3788799     1893276    c  W95 FAT32 (LBA)   So I assume that I have to run this: sudo grub-install /dev/sda3 to get GRUB up and running. But I am getting this error:      /usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).   Can anyone please guide me in the right direction? The current Ubuntu installation is far too customized to my needs to lose it to a boot manager issue! Any help is much appreciated! Point reflection over a line I'm having trouble understanding the solution presented below (It's from a textbook). I tried to get something similar, but to no avail. Help me find the way he derived those a,b,x2 and y2 expressions.   Point p is a point which we want to reflect (It's a simple structure with two integers x and y representing coordinates on a 2d plane); (x0,y0) and (x1,y1) are coordinates of endpoints of a line.  Expected result is a new point with reflected coordinates.   Point mirror(Point p, int x0, int y0, int x1, int y1) {     double dx,dy,a,b;    long x2,y2;    Point p1; //reflected point to be returned      dx  = (double) (x1 - x0);    dy  = (double (y1 - y0);     a   = (dx * dx - dy * dy) / (dx * dx + dy*dy);    b   = 2 * dx * dy / (dx*dx + dy*dy);     x2  = Math.round(a * (p.x - x0) + b*(p.y - y0) + x0);     y2  = Math.round(b * (p.x - x0) - a*(p.y - y0) + y0);     p1 = Point((int)x2,(int)y2);      return p1;  } is a plug-in to display informational and beautiful statusline for vim, tmux and shell prompt for bash, zsh.  Vim statusline:     How can I install and setup Powerline for different applications and shells in Ubuntu? I'm struggling to understand the concept of quantum entanglement. I've distilled my understanding into an analogy, and I need your help to validate it. Here it is:  Let's say I receive two envelopes. Both envelopes have this written on them:     Hello! Open this letter...   If the paper inside is red, then other envelope has blue paper.   If the paper inside is blue, then other envelope has red paper.   So, if I open one letter, and the paper inside is red, then I know the other letter contains the blue paper.  Is this equivalent to quantum entanglement? The fact that I will know the color of the other paper when I open (i.e. observe) one envelope?  In theory, if one of the letters "appeared" in a different galaxy, I would still know the color of the paper inside that letter, just by opening my letter, instantly, correct?  Before I open the letter, is the paper inside each envelope in superposition (??), i.e. 50/50, red or blue?  In this analogy, I am assuming that what's written on the letters is true. Is this a correct assumption in quantum physics? I think so yes?  In real quantum physics, would I be able to change the color of one paper, so that I change the color of the other one? No right? wp_customize_image_control default value I am trying to create a custom theme using Wordpress 3.4's customization options. I would like to create an option to change the theme's logo, but I would like to also display a default logo image.   I am using the following code in my function.php page:  $defaultbranding = "get_bloginfo('template_directory') . '/images/logo.png";      $wp_customize-&gt;add_setting( 'change_branding', array(         'default' =&gt; get_bloginfo('template_directory') . '/images/logo.png',     ) );      $wp_customize-&gt;add_control( new WP_Customize_Image_Control( $wp_customize, 'change_branding', array(         'label'   =&gt; 'Image Control',         'section' =&gt; 'theme_settings',         'settings'   =&gt; 'change_branding',     ) ) );   And in the theme's header.php page:  src='&lt;?php echo get_theme_mod( 'change_branding' , 'default' ) ?&gt;'   I would like the 'default' value on the front end to be:  get_bloginfo('template_directory') . '/images/logo.png'   Is there some way I can achieve this?  Thanks in advance for any help. I would like to install Ubuntu 14.04.02 LTS on my machine which currently has Mageia 4.1.   So, I have the following partitions: One for /, one for swap and one for /home.   I have some important data on /home which I wouldn't like to lose (I have backed them up, but I would prefer to keep them) after a clean install. I plan to reformat partitions one and two as above and keep the /home one.   Will I be able to tell Ubuntu to do so during an installation? By this I mean: Will it be able to recognize the /home partition and keep all its data intact while formatting the rest? And one more question: Will it be able to keep the users as they are our will I be forced to change them too? (I have the bad feeling that it won't be able to keep the users as they are...) subequations and array in braces I need something like this:  \left\{ first line  (1a) second line (1b) third line  (1c) \right.   all lines should be aligned to left How do I get the UTC time of "midnight" for a given timezone? The best I can come up with for now is this monstrosity:  &gt;&gt;&gt; datetime.utcnow() \ ...   .replace(tzinfo=pytz.UTC) \ ...   .astimezone(pytz.timezone("Australia/Melbourne")) \ ...   .replace(hour=0,minute=0,second=0,microsecond=0) \ ...   .astimezone(pytz.UTC) \ ...   .replace(tzinfo=None) datetime.datetime(2008, 12, 16, 13, 0)   I.e., in English, get the current time (in UTC), convert it to some other timezone, set the time to midnight, then convert back to UTC.  I'm not just using now() or localtime() as that would use the server's timezone, not the user's timezone.  I can't help feeling I'm missing something, any ideas? Difference between 'max distance' and 'radius' in Physics.SphereCastAll How to prove $\int_{-\infty}^{+\infty} f(x)dx = \int_{-\infty}^{+\infty} f\left(x - \frac{1}{x}\right)dx?$ If $f(x)$ is a continuous function on $(-\infty, +\infty)$ and $\int_{-\infty}^{+\infty} f(x) \, dx$ exists. How can I prove that $$\int_{-\infty}^{+\infty} f(x) \, dx = \int_{-\infty}^{+\infty} f\left( x - \frac{1}{x} \right) \, dx\text{ ?}$$ I got a new laptop; it came with an existing Windows installation, but I wanted to migrate my current backup to the new machine. I dd-ed the new machine's partitions to an external drive:  /dev/nvme0n1p1 /dev/nvme0n1p2 /dev/nvme0n1p3 /dev/nvme0n1p4   and afterwards move my current partitions to the new machine. What followed was a medium-sized nightmare. The new machine would boot, but the wireless network drivers were not recognized and later found out (to the best of my knowledge) they couldn't be installed. I tried:   booting from the console and running:  sfc /scannow chkdsk C: /f /r /x   both seemed to have completed successfully, but now the machine would get stuck in a startup repair loop. I tried resetting the machine (whilst keeping my files), but this failed halfway through. now the machine's still stuck in the loop and decided to try and repair it externally using a bootable Windows&nbsp;10 . It's likely that I'll need the new machine's Windows&nbsp;10 key. I'm not sure if it's stored in the BIOS (it came with Windows&nbsp;10  preinstalled) or somewhere on the partitions.   How can I get the key from the partitions (if it's there at all) while booting from a Linux image? Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)? How can I use adb to send a longpress key event? Serana disappeared during dawnguard questline. Prove that for all non-negative integers $m,n$, $\frac{(2m)!(2n)!}{m!n!(m + n)!}$ is an integer. Prove that for all non-negative integers $m,n$, $\frac{(2m)!(2n)!}{m!n!(m + n)!}$ is an integer.   I'm not familiar to factorial and I don't have much idea, can someone show me how to prove this? Thank you. Using residue theorem to integrate from $-\infty$ to $\infty$ I'm trying to integrate $$\int_{-\infty}^{\infty} {x^2 \over {(x^2 + 1)}^2(x^2 + 2x + 2)} $$ given that the function  $$f(z) = {z^2 \over {(z^2 + 1)}^2(z^2+2z+2)} $$ has residues $${9i - 12 \over 100},{3 - 4i \over 25}$$ at the poles $i$ and $-1+i$ respectively. From my understanding of this I have added the two residues (by the residue theorem, and because their respective poles lie in the upper half plane) and multiplied by $2\pi i$ and got an answer of $14\pi \over 100$  Have I done this right? When should I use the subjunctive mood? In which cases should I use the subjunctive mood?     I suggest that every applicant fill out the form carefully.        If she were rich, she would live on Long Island. $X$ is a topological space with no special properties.  If a space $X$ has no isolated points, then show the same for any dense subset of   $X$.  Thanks a lot. How to express a polar coordinate for a macro that only accepts space-separated values? \psElectricfield only accepts a coordinate in space-separated values as follows. For example, a charge of -0.1 unit at (-1,0) is written as [-0.1 -1 0]. I have attempted to write in PS notation but it still does not work.  \documentclass{article} \pagestyle{empty}  \usepackage{pst-electricfield,multido} \def\M{2}  \begin{document} \multido{\i=0+30}{12}{% \begin{pspicture*}(-\M,-\M)(\M,\M)     \psElectricfield     [         Q={[-0.1 -1 0][-0.1 1 0][0.1 !\i sin 2 mul \i cos 2 mul]}     ] \end{pspicture*}\newpage} \end{document}   How to express  a polar coordinate for a macro that only accepts space-separated values?