Arrow

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

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

2003 Vancouver Sun Run t-shirt design

2004

2004 Vancouver Sun Run t-shirt design

2005

2005 Vancouver Sun Run t-shirt design

2006

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.

<?php
// 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
unlink($backupfile);
?>

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:
127.0.0.1

More detailed host address:
localhost

Display browser info:
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])

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:

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$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

PayPal’s toll free telephone number

It surprises me that PayPal still isn’t advertising their toll free number, thinking that they can scare people off by only offering their local (long distance for most!) number on their contact page.

Anyway, here’s the toll free number: 1-888-221-1161.

I’ve gotta say, I’ve had some of the worst customer service experiences with PayPal. But at least if you can speak to them over the phone, you can tell them that!