Using implicitly typed local variables
Why would var be a bad thing?
What is the difference between currying and partial application? I quite often see on the Internet various complaints that other peoples examples of currying are not currying, but are actually just partial application.  I've not found a decent explanation of what partial application is, or how it differs from currying. There seems to be a general confusion, with equivalent examples being described as currying in some places, and partial application in others.  Could someone provide me with a definition of both terms, and details of how they differ? I want to use the GameJolt API, how do I protect my private key which is in my game? GameJolt is a gaming platform/website that offers API access with features like achievements tracking for users, etc. I can use the API no problem on my tests but what I'm concerned about is the private key that is issued to my game. How do I ensure that it's protected from people that want to decompile my game? Once  they get the API private key, they will be able to do anything with it. Let $N$ be a normal subgroup of $G$. Let $G/N = \{gN : g \in G \}$. Show that the $(G/N, \circ, 1_{G/N})$ is a group, where:  $\circ : G/N \times G/N \rightarrow G/N$ is defined by $(gN \circ hN) = ghN$ and $1_{G/N} = 1*N$.  Thanks for your help. What does the explicit keyword mean in C++? Atmospheric pressure experiment using a cup with a fluid to hold a glass plate When I was in high school, my teacher did an experiment to show the power of atmospheric pressure.  Experiment: Prepare a glass bottle, fill with water, put a glass plate on the bottle, make sure there is no air in the bottle, just water. Hold the glass bottle and plate, and invert them. Slowly, release the hand which hold the plate. Because the atmospheric pressure, the glass plate will not fall down.    Question 1: As we know, if we didn't put water into the glass bottle, just air in the glass bottle the glass plate will fall down. So, If we use other liquid instead of water, this liquid has smaller density than water, like alcohol, the plate will not fall down. But, if we continue to chose the smaller density liquid until the liquid has density like air the plate will fall down. So, if there is a threshold density of liquid make the plate between falling  down and not falling down?  Question 2: If we put the bottle and plate into water slowly, when the plate and part of bottle are in the water but part of the bottle still above the water, will the plate fall down?  Question 3: Continuing question 2, when both bottle and plate are in the water I know the plate will fall down. So, how does the pressure of water and atmosphere change?  Is there a good description of this phenomena?  Why does the trick continue to work with lower density fluids and why does placing the plate in the water cause it to fall? How to compute the  formula $\sum  \limits_{r=1}^d r \cdot 2^r$? Given $$1\cdot 2^1 + 2\cdot 2^2 + 3\cdot 2^3 + 4\cdot 2^4 + \cdots + d \cdot 2^d = \sum_{r=1}^d r \cdot 2^r,$$ how can we infer to the following solution? $$2 (d-1) \cdot 2^d + 2. $$   Thank you Proof of an inequality by induction: $(1 + x_1)(1 + x_2)...(1 + x_n) \ge 1 + x_1 + x_2 + ... + x_n$ Let $n \in \mathbb N^+$. Show that if $x_1, x_2, ... , x_n$ are $n$ real numbers such that $-1 \le x_i \le 0$ for each $1 \le i \le n$, then $$(1 + x_1)(1 + x_2)...(1 + x_n) \ge 1 + x_1 + x_2 + ... + x_n$$  I am using a proof by induction, but I am unable to complete it. I would appreciate any tips on how I could finish the proof.   Incomplete Proof Let $P(n)$ be the proposition that $(1 + x_1)(1 + x_2)...(1 + x_n) \ge 1 + \sum_{i = 1} ^ n x_i$. When $n = 1$, LHS = RHS = $1 + x_i$. Clearly $1 + x_i \ge 1 + x_i$ and so $P(1)$ is true. Assume that $P(k)$ is true, i.e. $(1 + x_1)(1 + x_2)...(1 + x_k) \ge 1 + \sum_{i=1}^k x_i$. Case 1 Suppose $x_{k + 1}  = -1$. Then $1 + x_{k + 1} = 0$, hence LHS = $(1 + x_1)(1 + x_2)...(1 + x_k)(1 + x_{k+1}) = 0$. RHS = $1 + x_1 + x_2 + ... + x_k - 1 = x_1 + x_2 + ... + x_k$ which is always nonpositive since each $x_i$ is nonpositive. Hence RHS $\le 0$ and so LHS $\ge$ RHS. Case 2 Suppose $x_{k+1} = 0$. Then $1 + x_{k+1} = 1$, hence multiplying it to LHS does not change anything. Also, adding $x_{k+1}$ to RHS does not change anything. Therefore, LHS $\ge$ RHS still holds. Case 3 Suppose $-1 &lt; x_{k+1} &lt; 0$. Then $0 &lt; 1 + x_{k+1} &lt; 1$. Adding $x_{k+1}$ to RHS makes the RHS smaller since $x_{k+1}$ is negative. If LHS $= 0$, then multiplying $1 + x_{k+1}$ to LHS does not change anything, and so LHS $\ge$ RHS holds. If LHS > $0$, then multiplying $1 + x_{k+1}$ to LHS makes the LHS smaller since $0 &lt; 1 + x_{k+1} &lt; 1$. In this case LHS $\ge$ RHS does not necessarily hold? ... How do I "replay" the "Caveats" section from a homebrew recipe How to mount a RAM disk on startup? I'm trying to mount a RAM disk on startup with this:  /Users/Aram/Development/Tools/ramdisk.sh  diskutil erasevolume HFS+ "RamDisk" `hdiutil attach -nomount ram://800000`   com.aram.ramdisk.plist  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"          "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt;     &lt;dict&gt;         &lt;key&gt;Label&lt;/key&gt;         &lt;string&gt;com.aram.ramdisk&lt;/string&gt;         &lt;key&gt;ProgramArguments&lt;/key&gt;         &lt;array&gt;             &lt;string&gt;/bin/sh&lt;/string&gt;             &lt;string&gt;/Users/Aram/Development/Tools/ramdisk.sh&lt;/string&gt;         &lt;/array&gt;         &lt;key&gt;RunAtLoad&lt;/key&gt;         &lt;true/&gt;     &lt;/dict&gt; &lt;/plist&gt;   And then running:   sudo chown root:wheel /Library/LaunchDaemons/com.aram.ramdisk.plist sudo launchctl load -w /Library/LaunchDaemons/com.aram.ramdisk.plist   But I get these in the console:  1/08/12 1:29:25.982 PM fseventsd[64]: could not open &lt;&lt;/Volumes/RamDisk/.fseventsd/fseventsd-uuid&gt;&gt; (No such file or directory) 1/08/12 1:29:25.982 PM fseventsd[64]: log dir: /Volumes/RamDisk/.fseventsd getting new uuid: 102D7293-F1F1-4640-AA50-D547C365339F  1/08/12 1:29:24.561 PM sudo[1193]:     Aram : TTY=ttys000 ; PWD=/Library/LaunchDaemons ; USER=root ; COMMAND=/bin/launchctl load -w /Library/LaunchDaemons/com.aram.ramdisk.plist  1/08/12 1:40:17.052 PM com.apple.launchd[1]: (com.aram.ramdisk) Throttling respawn: Will start in 8 seconds   It works if I set KeepAlive to true, but then it creates a RAM disk every 10 seconds.  Is there a way to delay the script for 10 seconds before running? Sum of $k$-th powers My script (should) acts differently, depending on the presence of the data in the input stream. So I can invoke it like this:  $ my-script.sh   or:  $ my-script.sh &lt;&lt;-MARK     Data comes...     ...data goes. MARK   or:  $ some-command | my-script.sh   where two last cases should read the data, while first case should notice the data is missing and act accordingly.  The crucial part (excerpt) of the script is:  #!/bin/bash local myData; read -d '' -t 0 myData;  [ -z "${myData}" ] &amp;&amp; {     # Notice the lack of the data. } || {     # Process the data. }   I use read to read input data, then option -d '' to read multiple lines, as this is expected, and the -t 0 to set timeout to zero. Why the timeout? According to  (typing left unchanged; bold is mine):     -t timeout time out and return failure if a complete line of input is               not read withint TIMEOUT seconds.  The value of the TMOUT               variable is the default timeout.  TIMEOUT may be a               fractional number.  If TIMEOUT is 0, read returns success only               if input is available on the specified file descriptor.  The               exit status is greater than 128 if the timeout is exceeded   So I in case 2 and 3 it should read the data immediately, as I understand it. Unfortunately it doesn't. As -t can take fractional values (according to above man page), changing read line to:  read -d '' -t 0.01 myData;   actually reads the data when data is present and skips it (after 10ms timeout) if it is not. But it should also work when TIMEOUT is set to real 0.  Why it actually doesn't? How can this be fixed? And is there, perhaps, alternative solution to the problem of "act differently depending on the presence of the data"?  UPDATE  Thanks to @Isaac I found a misleading discrepancy between quoted on-line version and my local one (normally I do not have locale set to en_US, so help read gave me translation which I couldn't paste here, and looking up for on-line translation was faster than setting new env---but that caused the whole problem).  So for 4.4.12 version of Bash it says:     If TIMEOUT is 0, read returns               immediately, without trying to read any data, returning               success only if input is available on the specified               file descriptor.   This gives a little bit different impression than "If TIMEOUT is 0, read returns success only if input is available on the specified file descriptor"---for me it implied actually an attempt to read the data.  So finally I tested this and it worked perfectly:  read -t 0 &amp;&amp; read -d '' myData;   The meaning: see if there's anything to read and if it succeed, just read it.  So as to base question, the correct answer was provided by Isaac. And as to alternative solution I prefer the above "read &amp;&amp; read" method. I’ve always understood that the phrase two weeks usually turns into two weeks’ when used as a modifier as in   I’m giving my two weeks’ notice.  I get two weeks’ vacation. (“two weeks’ holiday” for Brits)   with an apostrophe on the word weeks’, indicating that the vacation “belongs” to the weeks.   One way to explain this is the phrase “two weeks of vacation” being contracted to “two weeks’ vacation” – the vacation is “of” the weeks; that is, it is possessed by them.  But I’ve seen a lot of people omit the apostrophe in casual writing, and thinking about it, it seems plausible that the noun vacation would be plainly modified by the adjectival phrase two weeks.  But on the other hand, shouldn’t adjectival phrases be hypenated, namely two-weeks vacation?  Yet that seems wrong, too: the hyphenate should be singular, two-week vacation (like two-tone shoes) because .   touches on this (and references a good ) but doesn’t explain why the plural must be possessive in this case.   suggests that two weeks might be adverbial rather than adjectival, and thus resists being used attributively. But that still doesn’t quite explain this particular muddle of pluralization, possession, and attribution.  Given all this, why should “two weeks vacation” be written “two weeks’ vacation” with a possessive apostrophe? What is the name of this theorem, and are there any caveats? For random variable $X$ that follows some distribution, $f(x)$ is the probability density function of that distribution if and only if $$\mathbb{E}[\phi(X)] = \int_{-\infty}^\infty \phi(x) f(x)dx$$ for all functions $\phi$.  Context: My professor used this in lecture to demonstrate a way to find the distribution of $cX$ given random variable $X$ that follows a specific distribution.   What is the name of this theorem? Have I missed any qualifications/caveats? I am in particular curious about whether "for all functions" is correct. My professor mentioned "positive, bounded, deterministic functions," but I am not sure what he meant by that. Where can I find a proof of this theorem? Motivating the ansatz for the infinitesimal translation operator Windows of an application have minimum size and I can't find the window anymore I had an application (in case it matters: LibreOffice Calc] in full-size mode. I then clicked the middle of the three buttons of the top right to adjust the size. When I did that, the window became minimum size, literally a vertical line. I panicked and alt-tabbed, and now I can't even find the vertical line anymore. Opening new windows in that application opens all of them hidden to me, and closing/reopening or even restarting the OS doesn't help. I don't know how to resize my invisible windows anymore. Here's the preview of the windows in the application launcher: a vertical line (that I don't find on my screen anywhere if I click this). How can I scale all images in a folder to the same width? I want to scale all images in a given folder to the same width (but different appropriately scaled heights). How can I do this using  a GUI-based or command-line tool?  For bonus points, is it possible to restrict which images are scaled based on their initial width (that is, only scale images that have a width > x and/or a width &lt; y)? Groups of order $pqr$ and their normal subgroups We want to prove that a group, say $G$, of order $pqr$ where $p \gt q \gt r$ has a normal Sylow $p$-subgroup and deduce that it has a normal subgroup of order $pq$.    I know how to show $G$ has a normal Sylow $p$-subgroup or normal Sylow $q$-subgroup, but not the rest. Thanks for your advices. What is the word for act of monotonously demanding for something (many be a toy) repeatedly? How do I arrange selected vertices into a circular formation quickly?  The other answers does not have the same title as my question. My question is direct and simple for younger beginner to search for results. How to show this function's discontinuity?  $ f(n) = \left\{     \begin{array}{l l}      \frac{xy}{x^2+y^2} &amp; \quad , \quad(x,y)\neq(0,0)\\      0 &amp; \quad , \quad(x,y)=(0,0)    \end{array} \right.$