What is the difference between the following two class implementations  function Animal() {   this.feed = function () {   } }   function Animal () { }  Animal.prototype.feed = function () { };   I tried creating both the function but both worked in a similar way.
What's the difference between  var A = function () {     this.x = function () {         //do something     }; };   and  var A = function () { }; A.prototype.x = function () {     //do something };
What is the formula for this numerical series? How often did Gandalf return to Hobbiton after the events of The Hobbit? Background not changing using gsettings from cron I'm trying to change my wallpaper to a random image using Indrajith Indraprastham's suggested script here:    When I run the script from a terminal window, the bg changes just fine, but when it's run from cron, I'm mailed this error:     (process:21901): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line 'dbus-launch --autolaunch=00216c114dcf433c9bb9009985d607d6 --binary-syntax --close-stderr': Child process exited with code 1   I would appreciate any suggestions. Where do the X-Men get all their money/funding? Charles Xavier's father was a "wealthy nuclear scientist". In the beginning, Charles personally bankrolled the Xavier Institute/X-Men using his family's money.   This included, but was not limited to things like upgrading the mansion to house the training levels, providing a helicopter (the predecessor to the Blackbird jet), providing and replacing uniforms, providing health care for injured students, and rebuilding/repairing the mansion and parts of the Danger Room  repeatedly.  These have all been recurring costs. The mansion has been damaged or outright destroyed a ridiculous number of times. X-Men can't get into a fight without someone's uniform getting damaged.   In one of the more recent stories (I believe it was an early issue of Wolverine &amp; The X-Men), a comment is made about how the X-Men are pretty much bankrupt.  Where has all this money come from over all these years?   Xavier may have had a large war chest to start with, but no other income has ever been mentioned to my knowledge. Student's tuition could account for some of it, but there's no way that's going to fund everything. Difference between Hashing a Password and Encrypting it The current top-voted to  states:     Another one that's not so much a security issue, although it is security-related, is complete and abject failure to grok the difference between hashing a password and encrypting it. Most commonly found in code where the programmer is trying to provide unsafe "Remind me of my password" functionality.   What exactly is this difference? I was always under the impression that hashing was a form of encryption. What is the unsafe functionality the poster is referring to? I'm trying to understand the derivation of the equations for the logistic regression. I'm following the cs229 notes:    At some point in the derivation, in the notes we need to maximize the log-likelihood of the parameters:  ℓ(θ) = log L(θ) = y log h(x) + (1 - y) log(1-h(x))  In the notes, after the derivation we get:  $\frac{\partial}{\partial \theta_j}$ = (y $\frac 1 {h(x)}$ - (1 - y) $\frac 1 {1 - h(x)}$) $\frac{\partial}{\partial \theta_j}$h(x)  Shouldn't this be:  $\frac{\partial}{\partial \theta_j}$ = (y $\frac 1 {h(x)}$ + (1 - y) $\frac 1 {1 - h(x)}$) $\frac{\partial}{\partial \theta_j}$h(x)  I've been looking at this for a while and I can't see where this minus sign is coming from...  Thanks for your help! Is there a performance difference between i++ and ++i in C++? We have the question   What's the answer for C++? Chrome S3 Cloudfront: No 'Access-Control-Allow-Origin' header on initial XHR request 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? using gedit through ssh connection - should I have gedit installed on the server? I wanted to try out using graphical tools over ssh. Just to learn a new thing :)  so my understanding is this, I connect like this: ssh -port -x user@server  But I'm running ubuntu server so it has no gui and thus no gui tools. My understanding is I've to install gedit on server. But also xserver?  Can someone clear up this concepts to me? Disable Debug Log Programmatically I'm trying to disable WP_DEBUG_LOG if and only if debug.log exists. I'd like to hook into wp_footer and test if the file exists and if so disable my debug log. All I've found though is that WP_DEBUG_LOG is a constant and can only be changed from the wp-config.php file which is too early for my case. Is there a way to change it from a constant on install and keep it working as normal?   My only other thought is to create an option on install in the options table and just check it every time wp-config loaded to see if the value has changed but I was wanting to avoid that.   Granted I could check if the file exists before I define WP_DEBUG_LOG but somebody would have to view a page twice before debug log actually exists and is detected by the file_exists() (since it's run very early) which is not optimal.  Does anybody know of a workaround to programmatically turn off WP_DEBUG_LOG? How to calculate the summation $(\sum_{p = k}^{n} \binom{n}{p}) / 2^n$ quickly? I was solving a question which technically reduces to the following     Given $N$ items, it is equiprobable for each item to be good or bad, what is the probability that number of good items in the set are greater than or equal to $K$.   This can be reduced to $\dfrac{x}{2^n}$ where $\displaystyle x = \sum_{p = k}^{n} \binom{n}{p}$. Is there a more simplified form which is easier to calculate for large values of $N, K$?  Note: It may be safe to assume that we do not require extremely high precision while calculating(first 5-10 digits only).  Thanks! Applications of complex numbers to solve non-complex problems Recently I asked a question regarding the diophantine equation $x^2+y^2=z^n$ for $x, y, z, n \in \mathbb{N}$, which to my surprise was answered with the help complex numbers. I find it fascinating that for a question which only concerns integers, and whose answers can only be integers, such an elegant solution comes from the seemingly unrelated complex numbers - looking only at the question and solution one would never suspect that complex numbers were lurking behind the curtain!  Can anyone give some more examples where a problem which seems to deal entirely with real numbers can be solved using complex numbers behind the scenes? One other example which springs to mind for me is solving a homogeneous second order differential equation whose coefficients form a quadratic with complex roots, which in some cases gives real solutions for real coefficients but requires complex arithmetic to calculate.  (If anyone is interested, the original question I asked can be found here: )  EDIT:  I just wanted to thank everyone for all the great answers! I'm working my way through all of them, although some are beyond me for now! Is it possible to view the latex code after Lua expansion is made? When using Lua code inside Latex file, where Lua code sends to Tex Latex code to insert into the document at the location the lua code is made, it will be useful to look at the content of Latex file (internal) after the expansion is made but right before the file is compiled to pdf. This can help in debugging and in many other cases.  Is there an option to do this?  A small example will help explain what I mean.   Given this latex file  \documentclass{article} \usepackage{luacode} \begin{document}  The following is my table  \begin{luacode} i=6 j=8 tex.print("\\begin{tabular}{|l|l|}\\hline") tex.print(i.."&amp;"..j) tex.print("\\\\ \\hline") tex.print("\\end{tabular}") \end{luacode}  \end{document}   Compiling this gives the pdf file:    What I'd like to now see is the Latex file that would resulted after the Lua code expansion, which should be something as follows  \documentclass{article} \usepackage{luacode} \begin{document}  The following is my table  \begin{tabular}{|l|l|}\hline 6 &amp; 8 \\\hline \end{tabular}  \end{document}   I could not find an option to do this so far.  TL 2015    Update  Another example to make clear what is being asked here. I'd like to see not only the latex code that was generated from the lua bits of code, but the full Latex document that would result after all the expansion of all lua code in the original Latex. But this has to be done without modifying the original Latex document itself.   Assuming there is this virtual pipeline:  Latex file -&gt; Lua code expand -&gt; Updated Latex (internal)-&gt; lualatex -&gt;pdf    I'd like to get a copy of the full latex code/file just after all the lua code expanded.  Here is another example. Given this Latex file input:  \documentclass{article} \usepackage{luacode} \begin{document} The following is my table \begin{luacode*} i=6 j=8 tex.print("\\begin{tabular}{|l|l|}\\hline") tex.print(i.."&amp;"..j) tex.print("\\\\ \\hline") tex.print("\\end{tabular}") \end{luacode*}  Our annual budget for the company is \luaexec{tex.print(200*15^3)} dollars as  shown in this list of items \begin{luacode*}  tex.print("\\begin{itemize}")  for i=1,5 do    tex.print("\\item "..i^2)  end  tex.print("\\end{itemize}") \end{luacode*} And so on. \end{document}   The PDF is    I'd like to get a copy of the following latex file, which has all the Lua code expanded and gone and only the Latex code is left in its place. This file can go to a temporary file, or anywhere, as long as it is the complete Latex file as shown and not bits and pieces. This would be very useful in debugging when there is lots of Lua code in different places in the original Latex file.  \documentclass{article} \usepackage{luacode} \begin{document}     The following is my table  \begin{tabular}{|l|l|}\hline 6 &amp; 8 \\\hline \end{tabular}  Our annual budget for the company is 675000 dollars as  shown in this list of items  \begin{itemize} \item 1 \item 4 \item 9 \item 16 \item 25 \end{itemize}  and so on     \end{document}   I hope now the question is even more clear :) Proving $\sin(x^2)$ Continuous but Not Uniformly Continuous with non-standard Definition Show that the bounded function $f(x) = \sin(x^2)$ is continuous, but not uniformly continuous, on the interval $[0,\infty)$.  The problem should be solved using the following definitions: Definition of Continuous Function Let $X$ and $Y$ be metric spaces. We sat that a function $f:X\rightarrow Y$ is continuous if given any open set $V \subseteq Y$, its inverse image $f^{-1}(V)$ is an open subset of $X$. Definition of Uniformly Continuous Function Let $(X,d_x)$ and $(Y,d_y)$ be metric spaces. If $E \subseteq X$, then we say that a function $f: X\rightarrow Y$ is uniformly continuous on $E$ if for every $\epsilon &gt; 0$ there exists a $\delta &gt; 0$ such that for all $x,y \in E$ we have $$d_x(x,y) &lt; \delta \longrightarrow d_y(f(x),f(y)) &lt; \epsilon$$ For the continuity part it is clear that $f^{-1}(a,b), (a,b) \subseteq (-1,1) = \{x:f(x) \in (a,b)\}$ which appears to be an open set however I doubt this is sufficient as a proof since it holds for any function $f$. Not sure how to go about proving $f$ not uniformly continuous. Seems to be difficult to prove from the definition alone. Style every four posts differently Possible Duplicate:          Is it possible to style every four posts differently? I mean something like this:  &lt;div class="row"&gt; &lt;div&gt;1st post&lt;/div&gt; &lt;div&gt;2nd post&lt;/div&gt; &lt;div&gt;3rd post&lt;/div&gt; &lt;/div&gt; &lt;div class="row&gt; &lt;div&gt;4th post&lt;/div&gt; &lt;/div&gt; ...Repeat   I'm using , so it would be great if I could experiment more with that.. :) Auto-mounting network shares per user I have a server that has a number of CIFS shares that need to be accessed on a per-user basis. For example, I have a Music share which I have full access to, but my wife has read-only access.  When either myself or my wife log into our Ubuntu 11.04 laptop I would like these shares to be automatically mounted per user. Now I understand that if I mount as -t cifs without specifying a user then it will use the USER environment variable. However, I also need to specify a password, so how can I do that when each user has a different password?  I think my questions are:   Is there a way for me to have a per-user /etc/fstab? If not, is there a way to specify that a mount is only applicable to a certain user? Also, the share password is always the same as the local password. Is there a way to specify that this password should just pass through from the client to server rather than having to specify it in a credentials file somewhere?   Or maybe I'm missing something and there's a completely different solution. Can anyone help? Prove that if prime $p$ divide $a_{2k}-2$, then $p$ divide also $a_{2k+1}-1$. Monday morning mistake: sudo rm -rf --no-preserve-root / Please note: The answers and comments to this  question contains content from another, similar question that has received a lot of attention from outside media but turned out to be hoax question in some kind of viral marketing scheme. As we don't allow ServerFault to be abused in such a way, the original question has been deleted and the answers merged with this question.      Here's a an entertaining tragedy. This morning I was doing a bit of maintenance on my production server, when I mistakenly executed the following command:  sudo rm -rf --no-preserve-root /mnt/hetznerbackup /  I didn't spot the last space before / and a few seconds later, when warnings was flooding my command line, I realised that I had just hit the self-destruct button. Here's a bit of what burned into my eyes:  rm: cannot remove `/mnt/hetznerbackup': Is a directory rm: cannot remove `/sys/fs/ecryptfs/version': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/inode_readahead_blks': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/mb_max_to_scan': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/delayed_allocation_blocks': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/max_writeback_mb_bump': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/mb_stream_req': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/mb_min_to_scan': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/mb_stats': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/trigger_fs_error': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/session_write_kbytes': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/lifetime_write_kbytes': Operation not permitted # and so on..   I stopped the task and was relieved when I discovered that the production service was still running. Sadly, the server no longer accept my public key or password for any user via SSH.  How would you move forward from here? I'll swim an ocean of barbed wire to get that SSH-access back.  The server is running Ubuntu-12.04 and hosted at Hetzner. Can anyone please help me with my problem regarding my WordPress left hand side admin menu. I want it collapsed at all times, how do I do that?  Well, I'm creating a WP Multisite so I want that menu bar to be always collapsed at all times.  Any help would be appreciated. Looking for code or if plugin exists, should be fine, too. Thanks.