Posts on this site are never sponsored.

I am giving out free Writely invites (that Google word processing site)

I’ve had a Writely account for a while but haven’t really done much about it until now. It can be quite handy to collaborate on documents with other people (in real time, no less).

My Writely limerick

Anyway, Google does a good job about keeping projects in Beta and increasing hype by limiting sign-ups. I don’t know how many people I can invite to Writely… if you want to check it out, leave a comment on this post and I’ll send you an invite. Write your e-mail address in the e-mail field — it won’t be publicly posted.

Also, if you need to collaborate on spreadsheets (read: tough assignments if you’re a student), check out Google Spreadsheets. You don’t even need an invite for that.


Update: looks like Google has fully integrated Writely into its Documents and Spreadsheets and all you need to sign up is a Google account (which is free).

Update your Punkymoods from within WordPress — plugin

This caps my recent scripting urge… and is the most fun of the bunch in my opinion!

For those who have an account at my Unkymoods revival, Punkymoods (go get an account if you don’t!) and who blog with WordPress, here’s the tool for you! It is a WordPress plugin that will allow you to update your mood from within the WordPress control panel. All you have to do is upload two php files to your plugin directory, configure the first few lines, and voilà — more Punkyfun!

Note: you must have a Punkymoods account first!

The Punkyplugin in action


Download the Update Punkymoods WordPress plugin Version 0.4 (March 30, 2008)

Widget version:
Punkymoods widget plugin! It includes the usual “Update Punkymoods” plugin but you can also drag and drop the Punkymoods display in the sidebar. Fun times… fun times indeed. Follow the same instructions as listed below for the normal Punkymoods plugin, but make sure to upload the files into the widget folder (wp-content/plugins/widgets/)

Note: if you have a installation of WordPress, you cannot use this plugin :( does not allow users to install plugins…


Brief instructions: download the plugin above. Unzip the two files inside to your WordPress plugins directory (likely /wp-content/plugins/). Log into your WordPress admin panel. Click on Plugins, then Plugin Editor, then Update Your Punkymood. Scroll down through the file until you see the lines “// set this to equal 0 for female, 1 for male, 2 to display all images” and “// enter your punkymoods login info”. Set the appropriate fields for your username, password, user id, and mood gender (all from Save your changes, go back to the Plugins menu, then activate the plugin. Go to the Manage menu to change your Punkymood from within WordPress!

Vancouver Sun Run Past T-Shirt Designs

Why am I posting this? I was trying to find pictures of past Sun Run t-shirts and couldn’t find any. So I decided to start a post about it. That’s what I call useful crap.

I’ve run the past four Sun Runs, so here are the t-shirt designs from each run. Got pictures from previous runs? Send ‘em over!

2002 (Thanks to Thom, who also appreciates useful crap)

2002 Vancouver Sun Run t-shirt design


2003 Vancouver Sun Run t-shirt design


2004 Vancouver Sun Run t-shirt design


2005 Vancouver Sun Run t-shirt design


2006 Vancouver Sun Run t-shirt design

2007 (thanks to Kitman Luk)

2007 Vancouver Sun Run t-shirt design

2008 (thanks to Kitman Luk)

2008 Vancouver Sun Run t-shirt design

2009 (thanks to Kitman Luk)

2009 Vancouver Sun Run t-shirt design

2010 (thanks to Kitman Luk)

2010 Vancouver Sun Run t-shirt design

2011 (thanks to Kitman Luk)

2011 Vancouver Sun Run t-shirt design

2012 (thanks to Kitman Luk)

2012 Vancouver Sun Run t-shirt design

2013 (thanks to Kitman Luk)

2013 Vancouver Sun Run t-shirt design

How to e-mail yourself an automatic backup of your MySQL database table with PHP

This script will send an e-mail to you with an .sql file attached, thus enabling you to back up specific tables easily. If you have a database-driven site, your mysql info is what is most valuable to you! You could even set up an e-mail account just to receive these backups…

First of all, this script works best if you place it in a non-web accessible folder and run a daily cron job on it. Cron is a server “tool” that can run scripts regularly or at specified times (thus you don’t need to call them in your browser). I used to be scared of cron but it’s really easy. Here are two tutorials if you are interested Cron Tutorial 1Cron Tutorial 2. If you have cPanel on your server it’s even easier (see here).

The code is below, and requires the Pear Mime and Pear Mail packages. If you want to download everything at once, I have provided a zip file at the end of this post.

Known limitations of this script: if you have a big database table over 2mb, you will probably run into php timeouts and php mail attachment limits. Check this comment for information about compressing the backup file before sending or storing it.

// Create the mysql backup file
// edit this section
$dbhost = "yourhost"; // usually localhost
$dbuser = "yourusername";
$dbpass = "yourpassword";
$dbname = "yourdb";
$sendto = "Webmaster <[email protected]>";
$sendfrom = "Automated Backup <[email protected]>";
$sendsubject = "Daily Mysql Backup";
$bodyofemail = "Here is the daily backup.";
// don't need to edit below this section

$backupfile = $dbname . date("Y-m-d") . '.sql';
system("mysqldump -h $dbhost -u $dbuser -p$dbpass $dbname > $backupfile");

// Mail the file

include( 'Mail.php' );
include( 'Mail/mime.php' );

$message = new Mail_mime();
$text = "$bodyofemail";
$message->setTXTBody( $text );
$message->AddAttachment( $backupfile );
$body = $message->get();
$extraheaders = array( "From"=> $sendfrom, "Subject"=> $sendsubject );
$headers = $message->headers( $extraheaders );
$mail = Mail::factory( "mail" );
$mail->send( $sendto, $headers, $body );

// Delete the file from your server

Download Peter’s automatic mysql backup tool (in the zip file, backup.php is the file you need to execute).

Using php to display visitor / user information such as their IP address

There are domain names dedicated to displaying simple user information, such as your IP address. Some spam ads try and freak you out by saying that sites can tell what your IP address is. So what? Whenever you visit any website, you are usually sharing (unless you’re using a proxy server) lots of information about yourself, and you don’t have much of a choice.

Up until recently, I had no idea that if you have hosting with PHP (the vast majority of hosting offers PHP) you can show some fun information to your users about themselves. Here’s some simple info displaying your IP address, browser info, and the address that referred you to the page:


Display IP address:

More detailed host address:

Display browser info:
CCBot/2.0 (

Where you came from (if you clicked on a link to get here):
Page was directly requested


Here’s the code for what was just displayed above:

$hostaddress = gethostbyaddr($ip);
$browser = $_SERVER['HTTP_USER_AGENT'];
$referred = $_SERVER['HTTP_REFERER']; // a quirky spelling mistake that stuck in php

print "<strong>Display IP address:</strong><br />\n";
print "$ip<br /><br />\n";
print "<strong>More detailed host address:</strong><br />\n";
print "$hostaddress<br /><br />\n";
print "<strong>Display browser info</strong>:<br />\n";
print "$browser<br /><br />\n";
print "<strong>Where you came from (if you clicked on a link to get here</strong>:<br />\n";
if ($referred == "") {
print "Page was directly requested";
else {
print "$referred";

Note: to display php code in a WordPress post, try this plugin:
WordPress PHP Exec Plugin