Flash as Bondo

November 10, 2007

Thanks to everyone who came out to support me at Michigan Flash Fest. I am going to try to track down a copy of the audio from the day, but in the meantime here is a copy of the slides that were used.

  • Digg
  • del.icio.us
  • feedmelinks
  • Reddit
  • NewsVine
  • StumbleUpon
  • Technorati

30 days of Cake

October 16, 2007

I’ve been using CakePHP on a number of recent projects at the office and have been longing for some of the little trinkets I took for granted in rails. One of the bigguns has been working out a new build process. After a little head scratching on how to make it feel right I came up with a super tiny build script and a new top level directory alongside /app, /db.

Builder script

A harness to do a fresh export of the site code, drop the existing db tables, build new ones and stub in some data. (gave me a chance to learn about .my.cnf files too).

#!/bin/bash
# get latest from SVN
rm -rf /path/to/htdocs/*
svn export http://www.svnrepo.com /path/to/htdocs

# purge and rebuild db and data
mysql < /path/to/htdocs/db/schema.sql
mysql < /path/to/htdocs/db/stub_data.sql

/db/schema.sql

I found it more convienient to throw away the old structure and start fresh with each change to the db (if nothing else, it makes me update my stub data file and test harnesses. You could just as easily have stacked “alter table” statements to denote changes between versions.

...

----------------------------------------------------------------
-- incoming data feeds
-- -- rev 61: added "video" and "photo" to `feed_type`
-- -- rev 76: changed `name` VARCHAR(50) -> VARCHAR(255)
----------------------------------------------------------------
DROP TABLE IF EXISTS `feeds`;
CREATE TABLE feeds (
    id INT UNSIGNED AUTO_INCREMENT,
    project_id INT UNSIGNED NULL,
    name VARCHAR(255),
    src_url VARCHAR(300),
    feed_type ENUM('rss', 'atom', 'video', 'photo'),
    active BOOLEAN DEFAULT true,
    created DATETIME DEFAULT NULL,
    modified DATETIME DEFAULT NULL,
    PRIMARY KEY  (id, project_id)
) TYPE=MyISAM;

...

/db/stub_data.sql

By giving all developers on a project a common set of starting data, it makes it easier to replicate issues uncovered throughout the site. If one coder finds that a section of the codebase is soft against a certain type of data (unicode, html entities, etc) they can add sample data of that kind to everyone’s stub file. By making everyone feel the pain of the insecurity it tends to get addressed faster.

...

----------------------------------------------------------------
-- stub data feeds
----------------------------------------------------------------
INSERT INTO feeds 
    (project_id,name,src_url,feed_type,created) 
VALUES
    (1, "Google News", "http://news.google.com/?output=rss", "rss", NOW()),
    (2, "Fine Hypertext Products", "http://feeds.kottke.org/main", "rss", NOW()),
    (1, "Yahoo! Interface Blog - dev", "http://feeds.yuiblog.com/yuiblog/development", "rss", NOW());

...

This approach is still really early in its development and will almost certainly be revisited a number of times as it is used more, but so far it has fared quite well for deployment and replication across a number of machines.

  • Digg
  • del.icio.us
  • feedmelinks
  • Reddit
  • NewsVine
  • StumbleUpon
  • Technorati