October 1, 2011 21:35
I've done a few "manly" things with my car such as changing the battery, putting on a spare tire (more times than I'd like), and replacing the light bulbs. But today I completed my first home improvement - well, office improvement - project.
This is my surprise for the office on Monday - a wall rack for the darts we currently have scattered on the floor. Nothing special, but you have to start somewhere right? And there's something about drilling a hole into a chunk of wood that just feels so... right! :)
September 12, 2011 01:41
Typically, when you try to divide by zero in MySQL, the result will be
NULL. In certain cases, however, you'd like the result to be the numerator.
For example, when posts are receiving votes, we want a post with 8 yes votes and 0 no votes to have a ratio of 8 not of
NULL. The cheap solution is to add +1 to both the yes and no votes, but then the ratio will be slightly inaccurate (9 in this case). The solution is to use MySQL
SELECT `posts`.`id`, (CASE `vote_no` WHEN 0 THEN `vote_yes` ELSE (`vote_yes`/`vote_no`) END) AS `vote_ratio` FROM `posts`
September 8, 2011 16:47
If you have a table in MySQL with a Unix timestamp column (int 11) and you'd like to group results by date, you can run this simple query.
SELECT COUNT(`id`) AS `total`, DATE(FROM_UNIXTIME(`my_timestamp`)) AS `my_date` FROM `my_table` GROUP BY `my_date` DESC
If you want to group by month and year, ignoring the date, you can modify the query like this:
SELECT COUNT(`id`) AS `total`, MONTH(FROM_UNIXTIME(`my_timestamp`)) AS `my_month`, YEAR(FROM_UNIXTIME(`my_timestamp`)) AS `my_year`, FROM `my_table` GROUP BY `my_year`, `my_month` DESC
September 7, 2011 20:25
I recently downloaded the trial version of Finale Notepad. Most of the music I write / transcribe is going to be for piano, so I don't really need the full version.
One of the first things I transcribed is "Cleanin' Out my Closet" by Eminem. You can download the sheet music here:
It's probably not perfect, but I've only heard the song three or four times, and hopefully you'd be playing with some variation if you actually performed it.
Coming soon: a live recording of the song featuring Eshy F Baby on vocals! :)