Robert Kern of www.robertkern.com has found this great article about Project Management and the view from a web developer written by Brandon Ching. I think it is a great article.
Monthly Archives: August 2008
2008 Olympix
2008 Olympix
Now, I didn’t watch that much of the Olympics, I watched a few events NZ were in, the Evers-Swindell sisters win gold and that about it.
Its not that i don’t support NZ, or any other country, but i’m just not that much in to sport or the olympics that I could sit and watch that much TV.
New Zealand did quite well for such as small country, New Zealand got nine medals – our best since Seoul 20 years ago.
How ever, of the few sports I did watch and the 3 minutes max of the beach volleyball, this is by far my favorite aftermarks of the 2008 games.
The Photographers have named this slideshow of the volleyball women’s signals appropriately enough:
Cracking the Code
Hiking in the Rain
Today it was wet, wet and horrible. There was Thunder, lightening and heavy rain. It was Yuck! Not as bad as it has been many times this winter, but Yuck!
So, being bored out of my mind, and trying to give me internet a break over the weekends, I decided to go for a walk. As part of my plan to get myself fit, loose the beginning of my beer gut and build up a little muscle in my lazy self I am going to walk, the occasional push-up and/or sit-up, and eat the less occasional healthy meal.
I dressed in some warm clothes, loaded a mix of ‘Tom Petty‘, ‘David Grey‘, ‘Rhombus‘ and ‘Phil Colins‘ on to my iPlod and I was away.
I hiked in to the local forest, this is a pine plantation that sections are felled, milled, and planted on a regular schedule, It starts just behind where I live. I walked for around 5 hours only hitting the tracks once or twice, it was a hard slog through dense bush and plenty of gorse and mud.
I eventually came out to the road on the other side of the bush, and it took about an hour to walk back home via the road.
It was a fun time, and as wet as I got, it stayed warm for both the exercise and that I wore warm clothing.
I took a few photos, but mostly it was too wet to safely bring out the camera. Plus most were crap as as much as I wish – I am not a great Photographer.
Using PHP exec to backup mySQL databases.
Backing up your site and files is a Must, and many servers have back-up options available to them. But one thing that is forgotten far too often when backing up your site, is backing up your database.
With a blog, like this and most wordpress blogs, the only part of the site to regularly change is the database. The site itself rarely changes other than the few uploaded photos.
Every Post, Comment, Trackback, registration all modifies the database. I like to take mywordpress DB from this online Blog, and dump in to my local copy so I have content, and comments/trackbacks where I test plugins/designs/hacks.
So here is a simple PHP script that will back up a whole database, and save the output as either a .sql file, or a compressed gunzip archive to a specified directory.
function mysql_backup($type,$host, $user, $password, $table, $path) {
global $day;
if($type == "gz"){
// Gunzipp Output (.gz)
$backup = $path.$table.'_'.$day.'.gz';
exec(
sprintf(
'/usr/local/mysql/bin/mysqldump --host=%s --user=%s --password=%s %s --quick --lock-tables --add-drop-table gzip > %s',
$host,
$user,
$password,
$table,
$backup
)
);
}elseif($type == "sql"){
// SQL Outout (.sql)
$backup = $path.$table.'_'.$day.'.sql';
exec(
sprintf(
'/usr/local/mysql/bin/mysqldump --host=%s --user=%s --password=%s %s --quick --lock-tables --add-drop-table > %s',
$host,
$user,
$password,
$table,
$backup
)
);
}
return true;
}
Here is an example of how to use it.
In a PHP file.
$day = date("l"); // Lowercase L
mysql_backup('sql','localhost', 'SQL_Username', 'SQL_Password', 'table', '/root/path/to/mysql/data/backups/');
The Function perametors are in order;
'sql' or 'gz' -> Type of backup. 'localhost' -> mySQL Server path 'SQL_Username' -> mySQL Username with all read/write privileges 'SQL_Password' -> mySQL Password 'table' -> mySQL Table to backup // $day is set to name the backup, I use 'l' to name the backup the full day ( monday, tuesday.. sunday)
Here is a full example to back up multiple databases, If used with a CRON, you can get a 7 day rotation of any number of databases.
< ?php
$day = date('l');
function mysql_backup($type,$host, $user, $password, $table, $path) {
global $day;
if($type == "gz"){
// Gunzipp Output (.gz)
$backup = $path.$table.'_'.$day.'.gz';
exec(
sprintf(
'/usr/local/mysql/bin/mysqldump --host=%s --user=%s --password=%s %s --quick --lock-tables --add-drop-table gzip > %s',
$host,
$user,
$password,
$table,
$backup
)
);
}elseif($type == "sql"){
// SQL Outout (.sql)
$backup = $path.$table.'_'.$day.'.sql';
exec(
sprintf(
'/usr/local/mysql/bin/mysqldump --host=%s --user=%s --password=%s %s --quick --lock-tables --add-drop-table > %s',
$host,
$user,
$password,
$table,
$backup
)
);
}
return true;
}
foreach(array("sheldons_blog","rogers_blog","janes_blog") as $table){
if(mysql_backup('sql','localhost', 'SQL_Username', 'SQL_Password', $table, '/root/path/to/mysql/data/backups/')){
echo('Table backed up. '.$table.'_'.$day.'.sql
'."\n");
}else{
die('Error backing up table.' .$table);
}
}
?>
If you are planning on passing the information from a form, I suggest using PHPs escapeshellarg.
On line 8 of the function you will see I have stated the full path my mySQL, in most cases you will just need
mysqldump
or it may vary depending on your server setup, on one of my servers ‘mysqldump’ works, on this server I need
/usr/local/mysql/bin/mysqldump
BlueSimplicity – WordPress Free Theme
This is a free WordPress theme available for download.
Is it a Clean, 2 Column Layout with a Left side Navigation / Sub Navigation. The Sub navigation uses Mootools to appear, and will display Posts under their Categories.
It has support for Gravatars and Widgets, includes the Header PSD and is fully xHTML and CSS Valid all for free!

Download: [download#3]
New Modem – Thomson TG8585v7
Configuring my new Thomson TG8585v7
thanks to lightning on friday night that fried my previous modem ( DLink 604t ( No big loss)), My ISP Telescum sent me a replacement. Thanks you Telescum!
Contents
First Impressions:
- Pretty
- In the box: Modem 4-port 10/100, WiFi b/g, 2m Cat5 Cable, 3m RJ11 x RJ11 Telephone Cable, 2x inline ADSL spliters
- Child-like Interface
- Navigation structure is confusing.
Digging Deeper:
There is no default User/Password, So once I found out my default router IP from my Network Preferences I access the interface via Safari, http://192.168.1.254
The interface is clean, but I don’t like the use of the bright purple colour, or what seams to me like childish icons and style.
The Main navigation is down the left side, you select your option, then it will display that preference, It took me a minute to figure out, if you want to alter the current options settings, the menu is now on the top right hand side.
Configuration Options are deep in the menu structure. Can you, in 30 seconds from logging in, find out how to assign a static non-DHCP address to a connected device?
Configuring ISP User Account
I took me a minute to figure out how to actually make changes and add my user account.
By Default the Modem came pre-configured to connect as the default ISP account with limited Connectivity.
To Configure DSL Account:
- Login to your Modem via your browser
- On the main page, under Broadband Connection, click Disconnect.
- Now Select the Internet link and it will bring you to a screen that allows you to enter your correct connection details. You must disconnect before you can alter your details
- Click Apply
- There is no Save and Reboot option, it appears that once you have applied the setting, it is saved.
- Now you are connected with your ISP details, if your internet is like it is here in New Zealand, watch out for your data limit, I have 15 gig of Slow Internet, and use it every month with out using torrent!
Port Settings:
I like to allow access to certain applications from my local network to the www. Like for instance, http://home.lendrum.co.nz points to my laptop, when online you will be able to see all my local sites and AFP/VNC/SSH open to all machines on the network. I have internal rules for my networked printer, my VoIP Phone, QoS for my Phone, All sorts of different rules.
Statically assign internal Addresses
- On the front page on the Admin you have the Home Network option.
I connect wirelessly, So I see my computer name: iBook under the wireless list. - Select your computer you wish to view
- On the top right, click configure
- this will show all info about the current device.
- Under Addressing you have Always use the same address:, Check this.
- Under Connection Sharing, you have Game or Service. Select the services you will to apply to this device and click add
- Click Apply to save changes
I have not yet found out where/how to assign QoS to a device, and have searched the Thomson website, with little success so far.
Overall:
Overall, this new modem seams pretty decent, once I got a handle of that way the admin works, it wasn’t too bad, a few shortcomings, but for a cheap home router – good!
If any one has any ideas, tips, tricks, firmware hacks or has figured out how to back up/export a condiguration – please share!
New Theme for Sheldon.Lendrum
I have just launched my site with a theme that I have made myself completely from scratch.
It uses multiple colour sets and some ‘grunge’ style imagery. Let me know how you like it, and if you come across any bits and pieces that aren’t working.
The site uses CSS 2/3 and xHTML code, with a heavily modified version of WordPress 2.6.02.6.1
I have made all hacks to WordPress 99.9% upgradable so should be good to go with upgrading to the newly released WP 2.6.1. was simple.
I hide all CSS and JS with some simple PHP code and have a colour changer in the top right. This sets a PHP cookie for 7 days on your computer, and nothing is harmful about my cookies
I have built in the CSS/JS for the plugins is use to reduce code and scripts that WP inserts, I really hate how if you use a couple of plugins there gets a mess of included files in the <head> of the pages.
Check out my source code, it is pretty, and you can’t view my CSS and JS files
Security Update to SimpleSite 07/08
I have had a concern brought to me that using .inc files is a security issue, people can access the xxx.inc file directly and read the full file contents.
While I agree, this can be fixed with a rule in your .htaccess file that will send a 403 Forbidden response to all requests .inc files. I personally like using .inc file extensions for include files rather than .php as there files do not and should not be run directly. To use .php over .inc this section explains what to change.
Download an update from the main SimpleSite post ~ http://sheldon.lendrum.co.nz/building-a-completely-dynamic-site-using-text-files-php-and-no-mysql_187/03/
Modifying your .htaccess file
Add these lines in your .htaccess file in your root html directory were SimpleSite is installed
# Block Reading of *.inc files
order allow,deny
deny from all
To Customise your 403 Forbidden page you can use this in your .htaccess file
# Set Error Documents.
ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notFound.html
ErrorDocument 500 /serverError.html
Another Security Idea would be to make sure that your server will not allow directory listings, this will happen on some servers where there is no default file in the directory, e.g. no ‘index.html|.htm|.php|.shtml’etc..
# Block Dir Listing
Options All -Indexes
Using .php file Extensions over .inc
If you would rather use a .php file extension (or for that matter any file extension ) in your included files. rename the .inc files to your chosen ext and then open the
includes/simplesite.php
file and edit your $config array to look for your new file ext.
"fileExt" => ".php",
function config() {
$config = array(
"siteName" => "Dynamic File Based Site", // 'siteName' -> TITLE OF THE SITE, USED FOR COSMETIC PURPOSES MOSTLY.
"httpHost" => "http://{$_SERVER['HTTP_HOST']}/", // 'httpHost' -> HTTP PATH 'http://sheldon.lendrum.co.nz'
"docRoot" => "{$_SERVER['DOCUMENT_ROOT']}/", // 'docRoot' -> FULL DOCUMENT ROOT PATH.
"filePath" => "pages/", // 'filePath' -> DIRECTORY OF PAGE FILES.
"fileExt" => ".php", // 'fileExt' -> INCLUDES FILE EXT.
"request" => "page", // 'request' -> USED IN $_GET[], IF USING MOD REWRITE, ALTER RULE TO MATCH.
"newLine" => "\n", // 'newLine' -> FORMATING NEW LINE, OPTIONS: (empty), "\n", "\r\n"
"styleSheet" => "styles/format.css", // 'styleSheet -> PATH TO STYLESHEET, USED WITH 'httpHost'
"defaultPage" => "home", // 'defaultPage' -> DEFAULT FILE WITH NO PAHT OR EXTENSION TO BE INCLUDED.
"modReWrite" => "off" // 'modReWrite' -> IF YOU WANT TO USE MOD REWRITE TO HAVE 'PRETTY URLS', SET THIS TO ON,
); // CREATE YOUR '.htaccess' AND ADD THE RULES FROM THE 'help-file' PAGE.
return $config; // THE NAVIGATION WILL AUTOMATICALLY WRITE THE CORRECT URLS DEPENDING ON YOUR SELECTION.
}














