Getting Bake to Work

A really powerful feature of CakePHP is bake –  a script located at  /cake/scripts/bake.php – it is similar in function to the Ruby on Rails Scaffold application – it is a command line programme that can generate outline or scaffolding code to carry out simple CRUD operations, based solely on your database structure.

I have had quite a few problems getting Bake to work reliably, but persevere because it is worth it. I have been developing on a PC running XP Pro and Apache2Triad 2.0.55

On windows there seems to be a bit of an issue with paths and in order to do any baking on an existing project you need to specify the full paths.

[I use the Command Window Here  Power Toy for Win XP which makes it easy to get the command prompt to the right place.]

To create a new cake application

  1. Navigate to \cake\scripts\ and open the command prompt.
  2. php bake.php -app name_of_application
  3. follow the onscreen instructions…

For Example: To create a new application called Flamingo:

php bake.php -app flamingo


As you can see bake asks you if its ok to create a skeleton application on the path specified.

How to bake inside an existing application

If you want to bake inside an existing application, from the Cake tutorials and articles, it appears that you should be able to just type: php bake.php -app flamingo again, unfortunately this doesn’t work. Instead you get the following message.

how not to bake

What you actually need to type is something that includes the full path to your new cake application, something like:

php bake.php -app D:\apache2triad\htdocs\ctest\public_html\flamingo

If you already have a database structure you will see something like this:

Let’s bake

If you don’t yet have a database setup you will be prompted for connection details like this:

bake - no database

Happy Baking

Thickbox vs. Lightbox

My gallery plugin for WordPress is up and running now – there are still a lot of loose ends to tie up, but the principle is sound and it works well. Hopefully it’ll be tidied up eneough to let free in the world in a week or so, but first there are all the little bits like writing the options admin to do.

James Cameron,  a (bloody good) photographer asked me to build him a new site to replace his current one: so I’ve been using this as the excuse to write a plugin, something I’ve been meaning to do for a long time. I decided to use WordPress as the base of the website. Now there are plenty of Image Galleries available for WordPress, but I didn’t feel any of them was quite right.

My Plugin (Flip Gallery) is designed to be as easy to use as possible, there aren’t going to very many options, no mass upload of zip archive, just fast and simple with everything thought nicely through. My one concession to modernity has been the decision to use a fancy gallery popup. The choices (for me) boiling down to lightbox and thickbox – these are both amazing little widgets and are functionally pretty equivalent.

In the end the things that swung it for me in favour of Thickbox are:

  • Ajax functionality – load anything – not just an image (although I’m not using this yet)
  • jQuery – 19kb (compressed) – awesome
  • The back and forward links (sad I know)

I’d like to say have a look at the work so far on James’ new website – but I can’t really. Sorry!

Compare Lightbox & Thickbox

  Thickbox 2.1.1 Lightbox JS v2.0 Notes
Examples Thickbox Lightbox  I’ve set up a quick test – identical pages of html, identical images, the only difference is the one page is powered by Thickbox and one by Lightbox. Compare and Contrast, enjoy.
Powered By jQuery Prototype
A matter of personnal preference. I have used jQuery and Prototype, I don’t think that Scriptaculous adds anything unfortuntely.
Hook class="thickbox" rel="lightbox" I like the use of rel – it’s good to keep your classes clean.
Related Galleries rel="gallery_name" rel="lightbox[gallery_name]"
Single Image Y
Gallery Y Y  
AJAX Y   For me the additional features swing it to Thickbox for me, I love the idea of having an image gallery but to also be able to have notes about each image, via an iFrame or AJAX.
Inline Content Y  
iFrame Y  

In print again

Coop - network magazine

I’ve got in print again. Whilst that is quite nice, it hasn’t worked out exactly as I’d hoped. There is a double page spread all about me in Network – the magazine for members of the co-operative group. Unfortunately the one thing that I insisted on as a condition (links to COSMIC and flipflops) haven’t happened. The pictures are jaw drop-ingly cheesy, but it’s not every day I get to show some of my work to 50,000 (or whatever people).

The idea behind the piece was that it would be a week in the life of somebody who works for a social enterprise. The trouble is that the majority of my working week is spent writing code, whilst that may me intellectually absorbing to me, to anyone else it just isn’t. I haven’t actually read the article – to tell the truth I am afraid of finding out how my words have been twisted. Not only are the words a paraphrase of my actual words, but they are then are re-written for a reading age of 10.

My Sister – Secret Agent

I think my Sister is a secret agent. She claims to be just a humble scientist working for Manchester University, but the evidence just doesn’t add up. She is mysterious, She is very hard to get hold of, always jetting off conferences all over the place and she is a lethal killing machine cpable of kicking a man’s head off with a single Capoeira twirl.

A friend of her’s once went for a job interview with the Foreign Office, the first thing the interviewers said was:

You do realise that this isn’t really an interview for the Foreign Office don’t you? 

I don’t think the friend went for the job, but then they’d have to say that wouldn’t they?