gareth's blog

Manowar - Kings of Metal

Image of Kings of Metal

I can't say that I am one of the biggest Manowar fans, but this album is very listenable, I really only got it for one song "Hail and Kill" and even then that only grew on me because of some many listens in the Solid Rock, Glasgow. The clincher was after a night when a friend named Rab was running around with a plastic sword, when this song came on.

I promptly re-worded the song so that the chorus is now always forever etched in my memory as "Rabs, Sword, is not steel!"

Dio - Holy Diver

Image of Holy Diver - Remastered

A must for any Metal fan and probably needs no explanation as to why its in my most listened to music playlist.

Stand out track for me is the title track Holy Diver

Introduction to the music posts that will follow

The following posts are going to be reviews of albums in my spotify playlist. If you haven't got spotify yet, I would go there now and sign up (, There is a free service and a premium service. You can get all the music on your computer with the free service, but the paid for services can include streaming to your mobile. Check out the comparison here.

A birthday function

When you get older you need to write functions to help you though the day:

Block Hotmail email addresses in user signup

I was recently asked to block users from signing up to a drupal site using a hotmail email address.

To achieve this I wrote a small module that will intercept the validate operation of the user module and add in an extra validation on the mail field of the user registration or edit form.

Create your dot info file:

; $Id$
name = Hotmail Check
description = "Removes the ability to login with a hotmail email address."
core = 6.x

Then create your dot module file: hotmail_check.module

Backup a drupal site - both database and site files through cron

I wrote a little linux bash script that I get cron to run each night to create a backup of my drupal site. I may expand it later to include auto deletion of older files and database dumps, but for the meantime I will just manage the backup files manually.

Basically create a file and call it something like

Drupal 6 l() - the missing link documentation

The format

The drupal 6 link function takes the format of:

l($text, $path, $options = array())

This will format an internal Drupal link.

This function correctly handles aliased paths, and allows themes to highlight
links to the current page correctly, so all internal links output by modules
should be generated by this function if possible.


$text - The text to be enclosed with the anchor tag.

$path - The Drupal path being linked to, such as "admin/content/node". Can be an external or internal URL.

Programmatically set the defaults for a new content type

When programmatically creating a new content type I would like to set the default publishing options, comment settings and upload settings, as the content type is installed, so I create a dot install file for the content type with the following:

Github workflow

In order to keep track of versions of your code, or just to keep a record of the changes you make to code, is an alternative VCS to the popular SVN. Here are some steps to ensure your code is kept up to date, even if you are sharing your codebase with other developers.

MySQL Backup and Restore

This is a script to run when using an SSH connection to move a MySQL database to another host.

mysqldump --host=<host_ip_address> --user <db_username> --password=<db_password> <database_name> > mysqldump.sql

mysql -u <db_username> -p <db_password> -h <host_ip_address> <database_name> < mysqldump.sql

In the first line you should replace the bits in brackets with the host database you need to backup and the second line should be the details of the host you are restoring to.


Subscribe to RSS - gareth's blog