David Grant's blog

My First Piano Lesson in 15 Years

Just had my first piano lesson in 15 years tonight! The last time I had a lesson was when I was 12. It was so weird; I felt like a kid again. Felt especially like a kid after buying a book of songs called "Something for the Boys" (it's got arrangements for music from Star Wars and other such movies). I did feel like a grown-up when my teacher would say stuff like "Usually what I do for kids is but you're not a kid so . . ." I'm really enjoying playing piano again. Just bought a circa 1988 Yamaha Clavinova right before Christmas for about $500 and have been playing almost every day. Sometimes I lose track of time and hours can just slip by. My first lesson has already paid off as I learned a new technique for learning a new piece, then tried it tonight and it worked great. The teacher is also a few years younger than I am, rather than 40-50 years older than me which I like lot better. I'm working on Grade 4 Royal Conservatory, for anyone who knows RCM.

Maintaining Vendor Sources With Subversion

Here is how I upgrade my Drupal sites (which have their own customizations) to new versions of drupal core when they become available, as I mentioned in a previous post.

This section of the subversion book pretty much explains it. Here is specifically what I did for Drupal, assuming you already have some directories set up as follows:

/var/svn/repos/www/vendor/drupalcore
/var/svn/repos/www/vendor/drupalcore/4.7.2
/var/svn/repos/www/vendor/drupalcore/4.7.3
/var/svn/repos/www/vendor/drupalcore/4.7.4
/var/svn/repos/www/vendor/drupalcore/current
/var/svn/repos/www/drupal4.7

The /var/svn/repos/www/drupal4.7 is like my own drupal4.7 "trunk". The /var/svn/repos/www/vendor/drupalcore is where I track all the vendor sources.

Download the new drupal sources:

cd ~/downloads
wget <a href="http://ftp.osuosl.org/pub/drupal/files/projects/drupal-4.7.5.tar.gz

">http://ftp.osuosl.org/pub/drupal/files/projects/drupal-4.7.5.tar.gz
[/ge...
Run svn_load_dirs to load the new sources into current and create a tag of current called 4.7.5:

svn_load_dirs file:///var/svn/repos/www/vendor/drupalcore current ~/downloads/drupal-4.7.5 -t 4.7.5

Now go to a checked-out copy of /var/svn/repos/www/drupal4.7

cd /var/www/localhost/htdocs/sandbox
svn st
svn ci -m "commit some uncommitted changes that I had (might as well get these in)"

Merge in the changes between 4.7.4 and 4.7.5. This is the magic (almost as magical as svn-load-dirs):

svn merge file:///var/svn/repos/www/vendor/drupalcore/4.7.4 file:///var/svn/repos/www/vendor/drupalcore/current .

Now you will see a bunch of output similar to what you would get if you did an update. Look through the changes with svn diff |less. Especially the changelog, just to make sure you are actually upgrading from 4.7.4 4.7.5 and not something different (due to a typo in the previous svn commands above).
Make sure to test the codebase first. I backed up my database first, then went to <a href="http://localhost/update.php">http://localhost/update.php[/geshifilter-code] and made sure the upgrade worked. Very important step!
Commit it when you are happy:

svn ci -m "Merged differences between drupal core 4.7.4 and 4.7.5"

After this I logged in to my 3 drupal sites, backed up the db, ran svn up, ran <a href="http://localhost/update.php">http://localhost/update.php[/geshifilter-code], and checked that there were no errors and that the site loaded some pages with no trouble. If I notice a problem in a few days I can always revert to the database backup I made.

That's all there is to it to upgrade a Drupal site when a new Drupal tarball is released! As long as you track vendor sources in your own subversion repository, the rest is easy.

The advantage of this technique is that I can make changes to drupal core but I can still easily merge in changes from new drupal releases. I can also do this same thing with modules. I track the module sources in a directory structure like:

/var/svn/repos/www/vendor/drupalmodules/gmap
/var/svn/repos/www/vendor/drupalmodules/gmap/09_09_2006
/var/svn/repos/www/vendor/drupalmodules/gmap/10_24_2006
/var/svn/repos/www/vendor/drupalmodules/gmap/10_25_2006
/var/svn/repos/www/vendor/drupalmodules/gmap/current
/var/svn/repos/www/vendor/drupalmodules/flash_gallery
/var/svn/repos/www/vendor/drupalmodules/flash_gallery/11_01_2006
/var/svn/repos/www/vendor/drupalmodules/flash_gallery/current
/var/svn/repos/www/vendor/drupalmodules/location
/var/svn/repos/www/vendor/drupalmodules/location/10_20_2006
/var/svn/repos/www/vendor/drupalmodules/location/current

I made some changes to the gmap and location module. I have had to merge in upstream changes in the gmap module 3 times. You can perform the merge by providing the location of the old tag and the new tag (or just use current) and the destination of the merge is a working directory of the module in question's directory (within the drupal modules directory of your trunk).

I have also used this technique several times for the mediawiki site at work. I highly recommend doing this any time you modify upstream source code and want to get updates from upstream when they become available.

Upgraded to Drupal 4.7.5

I just upgraded to Drupal 4.7.5 today and upgrading is now more of a snap than ever for me. I fully track the drupal sources in my own svn server and then I merge changes between the releases into my own Drupal 4.7 branch (that contains core drupal + patches + contrib modules + contrib themes + 4 sites/ directories). It is so easy. Here is an article I wrote that explains how to maintain vendor sources using Drupal specifically.

Tags:

LibraryElf: Library Overdue Book Reminder Service

I am constantly late at returning library books. While studying at the University of Waterloo I racked up huge fines, often just by being one day late (they would send me an overdue notice the day after they were due, thus incurring $1 per book, before I could renew). I eventually wrote a little python script that would log on to the University of Waterloo's library website and renew books for me (the script ran automatically every night). That worked great for the last year that I was at Waterloo.

When I came back to Vancouver I was also late at returning books to the Vancouver Public Library. I stumbled on a site a while ago called Library Elf that sends me reminders when my books I have taken out from the VPL are almost due. It supports many other libraries as well. It automatically logs into any libraries that you add to your account and you can receive notification up to one week in advance, or every week, by RRSS and/or email. It has worked great for me, except for one time when it didn't send me any reminder. Perhaps GMail thought it was spam, I'm not sure. I might add the RSS option, just in case.

Another neat feature is that in the reminder email, they will suggest a book that they you might be interested in, based on the books you have borrowed. It just recommended a great authentic Mexican cookbook to me that has a 5-star rating on Amazon on 13 reviews!

Tags:

My New Year's Resolutions

Here are my resolutions for 2007. Some of these are more like goals than resolutions. The theme this year is heating healthier and hopefully losing a few pounds.

  • No high-fat foods, deep-fried foods, or other obviously fatty foods and limit highly-refined carbs too (thanks CBC for showing Fast Food Nation on January 1st, one of the wonderful advantages of having a publically-funded health care system and a publically-funded TV station). I am not going to forbid myself from having all "fast food" because sometimes I need something "fast" and not all fast foods (like salads for example) are bad.
  • Eat more fruits and vegetables.
  • Ride my new stationary bike at least 3 times per week.
  • Limit TV to one hour per day.
  • Practice piano at least 1 hour 5 times per week.

Tags:

Drupal Modules I am Waiting to be Ported to Drupal 5.0

I am really looking forward to upgrading this site to Drupal 5.0. I really like the new default theme and I am thinking of using it along with a customized colour scheme. I am a big fan of using default themes by the way because it means I never have to monkey around with my theme if anything in the underlying API changes from version-to-version. For a simple site like mine, using a default theme makes the most sense. Especially for someone who is by no means an expert in HTML and CSS. I have made a few sites using only CSS (no tables) that were fully XHTML 1.0 compliant and worked on all browsers but only after much work and late nights.

I am going to keep a little list here of modules that I am waiting to be upgraded to Drupal 5.x before I upgrade to Drupal 5.0. I will scratch them off by crossing them out once each of them is ported. Any remaining ones I will port myself if possible.

Tags:

Destruction of Trees in Stanley Park - Due to Global Warming?

Here is some footage of the damage done to Stanley Park's trees during a recent wind storm.

The guy in the film likes to blame the destruction on global warming. Although I agree that world temperatures are rising, and I do agree that winds are partly caused by warm air rising or cold air falling which is all affected by air temperature, I would be interested in seeing some hard facts like number of days with winds over 50 km/h or something like that. Or average wind speed for every year since 1900. I am sure I have heard statistics like number of hurricanes per year and such. Last year was definitely a bad year for hurricanes in the Northern Hemisphere. We are all familiar with the "hockey stick" graph of global temperatures, it would be interesting to see a similar graph charting other weather observables.

Update (2007/01/08): this just hit the news today as John Baird, Canada new Minister of the Environment claimed that this freakish weather was due to global warming. Even if this wasn't due to global warming at least it will bring more attention to the issue.

SNL-Dick in a Box

Hilarious clip on SNL last weekend (from their "SNL Digital Short" series) staring Andy Samberg and Justin Timberlake.

Tags:

Java float vs. double and micro-optimization

Some people at work implemented a few classes all with floats and I am sick and tired of casting everything into float. There is absolutely no reason why floats should have ever been used. The original reason was because of memory and/or network and/or diskspace issues which is all now totally irrelevant because the project that these classes were mostly used for has now been scrapped. I recently ripped out a few classes from that project, however, because they are useful. I am finding them extremely annoying to use, however. Not only do they use floats but they are totally micro-optimized in other ways as well. I'm probably rewrite the class soon anyways so that it is readable. My opinion is that there is no reason to ever use anything other than ints, doubles, and bytes in Java. At leas in 2 years I have never come across any reason. Part of this is Java's fault for having two floating point types in the first place. I would have been much happier had this all been developed in Python.

Tags:

Rudolph the Red-nose Reindeer

I just watched part of the original Rudolph the Red-Nosed Reindeer on TV last night. Here's a funny overdub I found on YouTube:

Tags:

Complex GMail Filtering

A few days ago I ran in to a situation where I wanted Gmail to filter something based on the OR of a From: filter and a Subject: filter. In other words I get email from a website and I want to catch their From: email address as well as another criteria based on the Subject: line. In this case, I want to catch emails with From:bookmooch.com OR Subject:Bookmooch OR Subject:"Book received" OR ... (there are a few other cases. If you enter the From: and Subject: conditions in the google create-a-filter wizard they will be logically connected with AND by default; however, if you put the following:

from:bookmooch.com OR subject:bookmooch OR subject:"book received"

in the "Has the words" field. This works like a charm. I will probably be able to compress a few of my old filters into one with this tip.

Tags:

The Atheist Delusion

Just saw a neat flash presentation called the "Atheist Delusion". Follow the link or click "read more" to view. The funny/sad part about this is that some fanatics will watch this and it will only reinforce their views.

Tags:

My Cuba Photos at JPG Magazine

I submitted some of my Cuba photos to JPG Magazine. It is a neat print publication publishes photos based on online voting of user-submitted photos. Here's one I submitted to the "street" issue:

Actually, I've just noticed that you cannot just vote on any picture you want for some reason. It randomly selects certain photos you can vote on. I guess this is to prevent friends from voting for their friends' photos and in turn having their friends vote for theirs.

I just noticed one further gotcha. It looks like one can only submit one photo to each theme. These guys at JPG are really trying hard to prevent people from gaming the system and I admire that.

First Muslim Elected to Congress is Asked if he is Working with Enemies

First Muslim elected to Congress. First question out of Glenn Beck's mouth during his interview: "Prove to me that you are not, uh, oh, uh, working with our enemies":

Religious Solicitors Gone Wild

If the door-to-door preachers in this video did not get violent then this probably would not be something to laugh at. But they did, so it is hilarious

Pages

Subscribe to RSS - David Grant's blog