September 20, 2011 13:49

I'm feeling pretty grateful this morning that I can wake up to views like this :)

Holy Name Cathedral in downtown Chicago

Chicago, Photography

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 CASE.

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.

    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:

    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:

Cleanin' Out my Closet piano sheet music

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! :)

Music, News

July 18, 2011 04:05

Yesterday I went to Pianoforte Chicago expecting to get a Yamaha keyboard. I've always hated keyboards but I decided it would be better than nothing. When I got there though, I fell in love with the Kawai digital pianos.

Apparently, when recording their samples, Kawai uses a machine to play each key at 100 different volume levels. Most of their competitors only record 3.

As a result my new Kawai CN23 sounds and feels very similar to a real piano. My only complaint is that the higher notes don't ring out as well as they should, but I think if I hook it up to my speakers and adjust the levels that should be taken care of.

I still don't think any digital instrument will ever be able to fully replicate the touch and tone of a real piano, but I've been wrong before, and this is the first time I've ever enjoyed playing one.

Convertibles make the best moving trucks

Music, News