How are the question integer IDs generated?
Logic Behind StackOverflow Question IDs
SQL group by day, show orders for each day I have an SQL 2005 table, let's call it Orders, in the format:  OrderID, OrderDate,  OrderAmount 1,       25/11/2008, 10 2,       25/11/2008, 2 3,       30/1002008, 5   Then I need to produce a report table showing the ordered amount on each day in the last 7 days:  Day,        OrderCount, OrderAmount 25/11/2008, 2,          12 26/11/2008, 0,          0  27/11/2008, 0,          0  28/11/2008, 0,          0 29/11/2008, 0,          0 30/11/2008, 1,          5   The SQL query that would normally produce this:  select count(*), sum(OrderAmount)     from Orders     where OrderDate&gt;getdate()-7     group by datepart(day,OrderDate)   Has a problem in that it will skip the days where there are no orders:  Day,        OrderCount, OrderAmount 25/11/2008, 2,          12 30/11/2008, 1,          5   Normally I would fix this using a tally table and outer join against rows there, but I'm really looking for a simpler or more efficient solution for this. It seems like such a common requirement for a report query that some elegant solution should be available for this already.   So: 1. Can this result be obtain from a simple query without using tally tables?  and 2. If no, can we create this tally table (reliably) on the fly (I can create a tally table using CTE but recursion stack limits me to 100 rows)? What is the best way to remove and prevent leaf stains on concrete pavers? How do I assign the output of a command into an array? Is there a way to set transparency of windows in GNOME? Why does switching to the tty give me a blank screen? After booting to the GUI in 12.04, I attempt to move to the virtual terminal (or shell, or tty) via Ctrl-Alt-F1 (F1 through F6), and the screen remains blank. I have tried all 6 tty instances and the results are the same. Ctrl-alt-F7 brings me back to the GUI without a problem. Any thoughts? Let $f$ and $g$ be continuous at $ x=a$, with $f(a)<g(a)$. Prove that there exists a neighborhood $I$ of a such that $f(x)<g(x)$ for all $x \in I$. Evaluate $\lim\limits_{n\to\infty}\frac{\sum_{k=1}^n k^m}{n^{m+1}}$ By considering:  $$\lim_{n\to\infty}\frac{\sum_{k=1}^n k^1}{n^{2}} = \frac 1 2$$ $$\lim_{n\to\infty}\frac{\sum_{k=1}^n k^2}{n^{3}} = \frac 1 3$$ $$\lim_{n\to\infty}\frac{\sum_{k=1}^n k^3}{n^{4}} = \frac 1 4$$  Determine if this is true: $$\lim_{n\to\infty}\frac{\sum_{k=1}^n k^m}{n^{m+1}} = \frac 1 {{m+1}}$$  If it is, prove it.  If it is not, evaluate $\lim\limits_{n\to\infty}\frac{\sum_{k=1}^n k^m}{{m+1}}$. Correlations between continuous and categorical (nominal) variables What are point objects? What are the Minecraft Easter eggs? I was looking at  and I didn't realize that Minecraft had some Easter eggs in it. Besides the Christmas chest Easter egg, and the sheep Easter egg, what else is there? UV Unwrapping a Modified Model I modified an existing model by removing unwanted vertices, then selecting surrounding vertices and creating faces one triangle at a time (By pressing 'F').  On UV unwrapping the mesh, the faces which were added by me seem to stretch from the very bottom left of the map, shown below.    How do I create a face so it appears on the UV map as expected? For which values of $x$, will $f (x) . f '(x) < 0$? Reinstall software-center in Ubuntu 16.04 finding rational roots of polynomials Could someone please explain me how to apply the Descartes's Criterion? For example , how do I find the rational roots of $ x^3 -x +1$.  I've been looking at some examples, but I get confused. What does it take to understand Maxwell's equations? Assume I want to learn math and physics enough to reach a level where I understand Maxwell's equations (The terms and reasoning in the equations I.e. why they "work"). What would I have to learn in order to have the tools I need to make sense out of it?  I'm kindof looking for a road map which I can use to get started and know what to focus on. The fields are pretty big so some pruning would be very helpful (if possible) As we know, any proposition can translate to Godel numbers, such as  $$( \exists x)\space (x=sy)$$Its Godel numbers is $2^8 × 3 ^4 × 5^ {13} × 7^ 9 × 11^8 × 13^{13} × 17^ 5 × 19^ 7 × 23^ {17} × 29^ 9=a \space big \space number $  We also could get the character sequence "$( \exists x)\space (x=sy)$" through prime factorization of this big number.  Such as$$243,000,000=2^6×3^5×5^6 $$ $$6\space\space\space\space\space 5\space\space\space\space\space 6 $$ $$\downarrow\space\space\downarrow\space\space\downarrow$$ $$0\space\space\space=\space\space\space 0 $$ So $243000000$ is the Godel numbers of "$0=0$"   There are four axioms in Godel's PM system, here are two of them: $$(p\lor p)\subset p$$ $$p\subset (p\lor q)$$ through these two axioms, we can prove "$(p\lor p)\subset(p\lor q)$" is a true theorem.   And these two axioms and a theorem all have a corresponding Godel numbers, can we prove this theorem is true through Godel numbers? If it works, how? Bogus float inequality due to compiler optimization? Add leading zeroes to number in Java? Is it safe to use the hash of the data as the key to encrypt them? Is it safe to use the hash of the data as the key to encrypt them?  That is, if I give one some encrypted data and tell them that the key that was used to encrypt them was the hash digest of the data before encrypting, will it be easier for them to decrypt them?  Edit as I can not reply to comments: The recipient will have the keys, that is no problem. I want to get random decimal digits out of a 6-faced die.  Let's say the die is fair, with an equal probability for each outcome. (But feel free to share any consequences of that not being true, if you feel like it.)  I will represent the outcome of a die roll as a base-6 number:   In base-6 there are only 6 possible digits: $\{0,1,2,3,4,5\}$. The die has faces numbered 1 to 6. Face $f$ corresponds to digit $f-1$.   Thus, I can represent as many die rolls as I like with a base-6 number:   If the die is rolled once:   Let's say the die stopped on face $5$. The final base-6 number will be $4$.  If the die is rolled twice:   Let's say the die stopped on face $5$. And then on face $3$. The final base-6 number will be $42$.  If I roll the dice 10 times:   Let's say the die stopped sequentially on faces $5$, $3$, $4$, $6$, $2$, $3$, $3$, $3$, $2$, and $4$. The final base-6 number will be $4235122213$.    Since I want decimal digits, I need to convert to base-10.   Base-6: $4235122213$ Base-10: $44753985$   For any given number of die rolls, how many different combinations exist? If there are $r$ die rolls, the total of possible combinations is $6^r$.   $r$ rolls — $6^r$ different combinations. $0$ rolls — only $1$ combination. $1$ roll — $6$ different combinations. $2$ rolls — $36$ different combinations. $3$ rolls — $216$ different combinations. $4$ rolls — $1296$ different combinations. $5$ rolls — $7776$ different combinations. $6$ rolls — $46656$ different combinations. $7$ rolls — $279936$ different combinations. $8$ rolls — $1679616$ different combinations. $9$ rolls — $10077696$ different combinations.   $n_r$ ($\in \mathbb{N_0}$) is the number obtained after $r$ die rolls through the process described previously: "If the die is rolled once, twice, ..."  It is impossible for $n_r$ to reach the number of possible different combinations ($6^r$). It will be always short by least $1$:  $$ 0 \leqslant n_r &lt; 6^r $$   $r$ rolls — $n_r$ never surpasses $6^r-1$. $0$ rolls — $n_r$ never surpasses $0$. $1$ roll — $n_r$ never surpasses $5$. $2$ rolls — $n_r$ never surpasses $35$. $3$ rolls — $n_r$ never surpasses $215$. $4$ rolls — $n_r$ never surpasses $1295$. $5$ rolls — $n_r$ never surpasses $7775$. $6$ rolls — $n_r$ never surpasses $46655$. $7$ rolls — $n_r$ never surpasses $279935$. $8$ rolls — $n_r$ never surpasses $1679615$. $9$ rolls — $n_r$ never surpasses $10077695$.   I can never trust the leftmost nor the rightmost digit (fringe digits), since the possible values are potentially restricted.   For $0$ rolls, the outcome is always $0$. For $1$ roll, the fringe digit never surpasses $5$. For $2$ rolls, the leftmost digit never surpasses $3$, and the rightmost, $5$. For $3$ rolls, the leftmost digit never surpasses $2$, and the rightmost, $5$. For $4$ rolls, the leftmost digit never surpasses $1$, and the rightmost, $5$. For $5$ rolls, the leftmost digit never surpasses $7$, and the rightmost, $5$. For $6$ rolls, the leftmost digit never surpasses $4$, and the rightmost, $5$. For $7$ rolls, the leftmost digit never surpasses $2$, and the rightmost, $5$. For $8$ rolls, the leftmost digit never surpasses $1$, and the rightmost, $5$. For $9$ rolls, the leftmost digit never surpasses $1$, and the rightmost, $5$.   The other digits seem perfectly random to me though. Am I wrong?