CakePHP Migrations
Installation of CakePHP Migrations
This is a quick how to use CakePHP Migrations. First download the three packages Migrations Pear Core and MDB2. Put the migrations vendor plugin into the cake/vendor directory. Place the two Pear packages into your php include directory, and/or modify your php.ini to reflect the location of installation.
How To Use
In the cake/console directory there is a ./cake or cake.bat file (depending on operating system)
Generating a Migration
to generate a migration file for a User model simply write
cake.bat migrate g user
This will create a file in app/config/migrations/ named timestampuser e.g. 1226324252user.yml
# migration YAML file
UP:
create_table:
table_name:
name:
description: text
count: integer
is_active: boolean
DOWN:
droptable: tablename
Please Note: Make sure you remove the text "table_name" and replace it with the table name you generated the file for, e.g. "user"
Also ensure all fields have a type.
Processing Migrations
To get the database up to the latest migration file
cake.bat migrate all
firefox double page request
For the life of me I couldn't work out why every time I clicked on a new advert in my new classifieds section I'm developing it would count as two clicks in firefox.
After a bit of research I've found that if firefox finds an empty img src, i.e. img src="", then it reloads the page hoping it'll automatically appear.
I wonder why the moz devs decided this was a smart idea, is this part of the w3c? Anyway, to resolve, simply remove all of the empty src tags.
PHP5 with GD on leopard
Crazy! I have to say I miss apt-get! But ohh well. I assume you have ports installed..
Install GD2
sudo port install gd2
Now we want to install entropy php5
curl -O http://www2.entropy.ch/download/php5-5.2.5-6-beta.tar.gz
tar -xzf php5-*-beta.tar.gz
sudo mv php5 /usr/local/
sudo ln -sf /usr/local/php5/entropy-php.conf /etc/apache2/other/+entropy-php.conf
At this point go into the httpd.conf file and comment out the php5 LoadModule line.
sudo apachectl restart
you can then php -i to see we have GD, Imap, etc. etc. installed!
How To Get VirtualBox Working With Kernel 2.6.24.18
So I upgraded to the latest kernel and virtualisation broke. I've come to expect this after having to spend countless hours with vmware. Luckily virtual box is simple to fix and doesn't require hours in front of a pc.
sudo apt-get install virtualbox-ose-source
sudo m-a update
sudo m-a prepare
sudo m-a a-i virtualbox-ose
sudo /etc/init.d/vboxdrv restart
Once you've done that go through the menu bar and start virtualbox, and you'll see it no longer complains about the kernel number and just starts!
Could life be any simpler?
Mac Book Pro
I was tossing up for a while on getting an ultra portable for the train. I couldn't find anything I really liked, or supported a linux operating system. So I decided to get a mac. My mac book pro will land in around 14 days. Its an entry level mac book pro with 4gb of ram and the faster 200gb hdd.
It should be a monster! Hopefull its practical enough to use on a train.
