Thursday, October 06, 2011

Steve Jobs RIP

Inspirational Stuff

Tuesday, September 13, 2011

Create a Drupal Module Patch With Git

I thought I'd written my last bit of code over 10 years ago, but here I am struggling with all this new-fangled technology and inevitably tweaking module code that makes up the great Drupal open source empire.
A quick way to generate a patch for a module you want to tweak is using Drush and Git.

1. Download the module to your test environment with Drush. FFS don't do code development on a live site - kittens will die and you might (quite rightly) lose your job.
drush dl [module-name]

2. Navigate to directory and initialize an empty repository  
cd [module-name] 
git init

3. Add the files to new repository
git add *

4. Commit the files to the repository
git commit -m 'Initial commit'

5. Make changes to the file(s) you want to change within the module's directory.

6. Create patch - do this BEFORE committing changes  
git diff —no-prefix > patchfile.patch

7. Optionally commit your latest changes to Git  
git commit -m 'Description of what you've changed' 

Save the patch, submit it on an issue queue, set the issue status to 'Needs review' and hope that some kind person reviews it so it can be committed as a permanent feature. Fame and glory awaits.

This is taken from a post by the awesome Swedish Chef dudes at Node One. They talk about commits against core/contrib HEAD: not really my bag, but ignore the comments about CVS (CVS must die, etc).

Monday, June 27, 2011

Charging Battery on a Touareg

Children playing in the car, forgetful spouse... who knows. Flat battery this morning in the beast known as a VW Touareg. Automatic transmission, so no chance of bump starting this 2 tonne monster either.

A quick search of the manuals to find the battery killed off my first thought - whip it out and re-charge it. Alas it's 'very complicated and must be handled by specialist personnel'. Even my engineering prowess baulked at trying to remove it (it's under passenger seat BTW). So gave up for a while and generally pondered life.

However, VW have placed some funky little terminals in the engine bay (nearside) so you can charge it in situ. Red clip goes on the terminal under the little red cover (to left of photo); black clip goes on to the earthing stud (to the right of photo), which has a convenient lightning symbol etched onto it.

Leave it for a few hours with a meaty charger, and life is back to it's fuel-guzzling, carbon-producing self. Would be easier if a nice publisher, such as Haynes, produced a workshop manual for this. Serves us right, I suppose for buying such a large vehicle, but a necessary evil, alas.

Sunday, June 26, 2011

Downloading Massive Files with a Mac

Damn that slow broadband. I needed to download the latest version of the Apple Developer's iOS toolkit. A whopper at 4.1GB. The best I've ever got from my ISP is about 0.7M. I thought I'd click on the HTTP download link and leave it running overnight. Next morning: dismal failure at about 3GB, so no DMG file downloaded :(.

Inspired by this post, I had a go at WGETing the file instead, which should be a faster download, and automatically accommodate errors/breaks in net connection... but I had a few hurdles to clear:

  1. OSX 10.6 doesn't have wget installed. I had previously installed the wonderful Homebrew package manager, and allowed me to install wget with brew install wget. Please note that you do need a version of the OSX Developer's Tools (ie, the one on your OSX install disc) prior to installing Homebrew. Worth installing Homebrew, just to make your future life much easier.
  2. To use wget for the SDK download, you need to indicate to Apple that you have a Developer's account. To grab the cookie, install Firefox's cookie exporter, log in to the the Apple Developer site and export (save) your cookies.txt file.
  3. Navigate via Terminal to the directory you saved cookies.txt, then run the following:

    wget --cookies=on --load-cookies=cookies.txt --keep-session-cookies --save-cookies=cookies.txt
    --2011-06-22 19:09:30--
  4. Sit back and make a few cups of tea, or strip your car engine, go for a long walk. Took about 5 hours, despite the download being interrupted twice. The SDK downloaded just fine and now I have the newer SDK and XCode tools installed.