SQL Server - use a parameter to select the top X of the result set
Use variable with TOP in select statement in SQL Server without making it dynamic
What is the most straightforward way to pad empty dates in sql results (on either mysql or perl end)? I'm building a quick csv from a mysql table with a query like:  select DATE(date),count(date) from table group by DATE(date) order by date asc;   and just dumping them to a file in perl over a:  while(my($date,$sum) = $sth-&gt;fetchrow) {     print CSV "$date,$sum\n" }   There are date gaps in the data, though:  | 2008-08-05 |           4 |  | 2008-08-07 |          23 |    I would like to pad the data to fill in the missing days with zero-count entries to end up with:  | 2008-08-05 |           4 |  | 2008-08-06 |           0 |  | 2008-08-07 |          23 |    I slapped together a really awkward (and almost certainly buggy) workaround with an array of days-per-month and some math, but there has to be something more straightforward either on the mysql or perl side.   Any genius ideas/slaps in the face for why me am being so dumb?    I ended up going with a stored procedure which generated a temp table for the date range in question for a couple of reasons:   I know the date range I'll be looking for every time The server in question unfortunately was not one that I can install perl modules on atm, and the state of it was decrepit enough that it didn't have anything remotely Date::-y installed   The perl Date/DateTime-iterating answers were also very good, I wish I could select multiple answers! How should I punctuate around quotes where the punctuation required by the quote interferes with the punctuation of the sentence? The American convention in quotations is (typically) to place punctuation inside quoted text. But I always run into situations where the punctuation of the quote interferes with the punctuation of the sentence. How would you punctuate this (American, non technical)?     When my friends ask, "What do you want for your birthday?", I never know how to respond.   It seems odd to place the last comma outside the quote simply because of the question mark. Is that the preferred (i.e. most often accepted) standard? How to find the determinant of this $3 \times 3$ Hankel matrix? Today, at my linear algebra exam, there was this question that I couldn't solve.   Prove that $$\det \begin{bmatrix}  n^{2} &amp; (n+1)^{2} &amp;(n+2)^{2} \\  (n+1)^{2} &amp;(n+2)^{2}  &amp; (n+3)^{2}\\  (n+2)^{2} &amp; (n+3)^{2} &amp; (n+4)^{2} \end{bmatrix} = -8$$   Clearly, calculating the determinant, with the matrix as it is, wasn't the right way. The calculations went on and on. But I couldn't think of any other way to solve it. Is there any way to simplify $A$, so as to calculate the determinant? How to connect Selenium to an existing browser that was opened manually in java or create semi automated tests? I want to achieve some use cases in which:  I want to perform some tasks that require manual intervention before kicking in automation execution. For instance, I need to manually launch the browser, navigate to the desired page, perform some manual tasks like entering captcha manually and then run the automation script to continue from there.  Debugging – Let's say we are working on a test script for a certain page (product checkout) in the application. But the script to reach that page (add to cart) is not ready yet. We can manually launch the browser and navigate to that page and then run the automation script.  Can someone help me to achieve this type of scenario? How do I mount a hibernated NTFS partition? Do I need a license to create pdf files? I hope this is the correct place where I could ask this question. My mother is an accountant with a degree in economics. She works as a freelancer and she needs some licenses for her job.  The biggest problem is adobe acrobat standard, which costs 400€, quite a lot. I want understand if she must buy it to create pdf files or she can use some free (even for commercial use) programs that she has because of her job (the chamber of commerce provide some advantages to accountants).  She is actually using PDFCreator, which as I can read is free for business usage (open source also!!):   Thanks for any suggestion Is "You are correct" correct? It seems to me that "You are correct" means that the person in question is supposedly "correct" in their quiddity. "That is correct" or "You are right" seems a lot better.  I also would like to know if someone is using correct(ly) correctly, as to correct someone who is potentially using correctly incorrectly. How to use an existing database with an Android application Is there a reason why "gn" in "reigning" is pronounced /n/ while in "regnant" it is pronounced [gn]? Both reigning and regnant are related to the same Latin noun, regnum.  Why is the ‹gn› spelling pronounced [n] in the first word but [gn] in the second? SCP fails without error Are airlines in the EU obligated to provide water for passengers? Proper display of fractions How to prove this is a metric? I have 2 distance functions $d(x,y)=|x^2-y^2|$ and $d(x,y)=|x^3-y^3|$ and I am trying to prove that they are metrics on $\mathbb R$, or give a counterexample that they are not metrics on $\mathbb R$.  I managed to prove the first 3 properties for the 2nd function namely:   $d(x,y)\ge0$ $d(x,y)=0$ iff $x=y$ $d(x,y)=d(y,x)$   and I now have shown that the 1st function is not a metric.  But for the triangle inequality property, $d(x,y)\le d(x,z) + d(z,y)$, Im stuck on it. How would go about proving it for $d(x,y)=|x^3-y^3|$? Thanks. Alternate Row Coloring in Django Template with More Than One Set of Rows I'm trying to recall the name of a book I read, probably published after 1990, where alien AI infects satellites and a barrier is established, isolating earth from space that maybe slows down time inside of it, relative to the passage of time outside.  Mars or the moon is also colonized in an attempt to flee the now real possibility that the sun will become a red giant and wipe out humanity in the not-too-distant future (as perceived on earth), but the colony gets one of the time barriers as well.  I think the name of the novel was short, "The _______" (one word).  The story focused more on the human cost and followed one particular family, one member of which was somehow also partially infected by the alien AI, but I don't remember as much about them. How can I change a field cardinality? I have two content types: Person and Office with existing content. The Person content type has an entity reference field to Office nodes, which only allows a single reference. I need to change this to allow an unlimited number of Office nodes to be selected.  Drupal 8 prevents changing the cardinality of the field, and it gives the following error message.     There is data for this field in the database. The field settings can no longer be changed.   At first, I thought I needed to write a migration, but they seem to be aimed at bringing data into a Drupal instance. Then, I read about writing  (also ).  I discovered a migrate-plus plugin that adds a couple pages me to export the field storage settings, change the cardinality, and re-import the settings. Given that I'm going from cardinality of 1 to unlimited, I could imagine this change wouldn't destroy data. And my empirical data suggests this is the case. I've now made this change via the migrate-plus screens as well as via configuration export and import and the data is still in the field.  Is this a safe operation, or should I write an update function? How do I prompt for Yes/No/Cancel input in a Linux shell script? I wanted to switch to Xfce (I had KDE and GNOME installed), and I did this :    sudo apt-get install xubuntu-desktop sudo apt-get remove kubuntu-desktop sudo apt-get remove ubuntu-desktop sudo apt-get autoremove   but to my surprise, I could still pick gnome, kde plasma, etc during the log in.  So, how do I completely remove KDE and GNOME desktops? jQuery - regexp selecting and removeClass()? Hi I was looking to install this with or under VMware on windows 7 64bit, is this possiable and where can I find instructions on how to do so? I have searched the site and can not find anything for help on installing this with VMware.  Also I have VMware Workstation do I need VMware player?