zend framework

Brotherhood Books Launches - Giving Books a Second Chance

In late 2008 I worked on building an online second hand bookstore for the Brotherhood of St Laurence. Today Brotherhood Books was launched by comedian and writer Corinne Grant, at the Sacred Heart Primary School in Fitzroy. I'm hanging out for Corinne to publish her short story about the snot eating witch.

Brotherhood Books is a really exciting project, it allows people who can't access bricks and mortar second hand book stores to access quality second hand books at good prices. All of the profits from the service flow directly back to Brotherhood programs and services. Before this project I thought the Brotherhood ran a few big Opys and gave out some food vouchers. They do a lot more than that.

I have been to the East Brunswick warehouse a few times to meet with the workers to discuss how the platform is working and what can be done to improve it. Most of the Brotherhood Books workers are volunteers, who are trying to get some experience so they can enter or return to the workforce. They all seem to really love their books.

The identity, webdesign and initial marketing material was done by imageffect.com.au. The platform is built using Zend Framework, where possible we used off the shelf libraries, but there is a large amount of original work. The cataloguing functionality is pretty slick, almost all of the books are catalogued by volunteers scanning a barcode, entering a condition and adjusting the system recommended price and it is done. Yahoo's YUI Toolkit provides most of the AJAX yummy-ness for the volunteers, while most of the data is pulled from Bowker's web services.

Brotherhood Books has over 30,000 items for sale, and growing every day. So far over 45 tonnes of books have been saved from going to landfill!

If you have some spare books to donate to the Brotherhood, they have many ways of accepting donations.

At the launch today there was some media present, and someone from the BSL was interviewed by Red Symonds on 774 ABC Melbourne.

Many of computer books are dated, but they still make for fun reading, These days I have several titles from the Brotherhood on my bookshelf - including a mid 90s guide to cracking.

Go check it out and buy a book so you can claim you were there at the start.

Yes I am doing the hard sell on it, but I have been waiting since the soft launch earlier this year to be able to promote it widely.

A Virtual Host per Project

Not long before my old laptop got to the end of it usable lifespan I started playing with the Zend Framework in my spare time. One of the cool things about ZF is that it wants to use friendly URLs, and a dispatcher to handle all the requests. The downside of this approach, and how ZF is organised, it works best if you use a Virtual Host per project. At first this seemed like a real pain to have to create a virtual host per project. One Saturday afternoon I worked through the apache docs and found a solution - then I found it fantastic. Rather than bore you with more of my views on Zend Framework, I will explain how to have a virtual host model that requires a little work up front and is very low maintenance.

It gets tedious copying and pasting virtual host config files each time you want to start a new project, so instead I let Apache do the work for me.

I added a new virtual host config file called projects to

. The file contains

UseCanonicalName Off

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon

<Directory /home/dave/Projects>
Options FollowSymLinks
AllowOverride All

	ServerName projects

	CustomLog /var/log/apache2/access_log.projects vcommon

	VirtualDocumentRoot /home/[username]/Projects/%1/application/www
	AccessFileName     .htaccess

The important bit is the VirtualDocumentRoot directive which tells Apache to map a hostname to a path. I use an IP address from the range for the virtual host, so they aren't accessible to the outside world and I don't have to worry about it changing every time I check locations.

All of my projects live under ~/Projects and each one gets a directory structure that looks something like this.

  +- notes - coding notes, like grep output when refactoring etc
  +- resources - any reference material or code snippets
  +- application - the code for the project
     +- www - document root for vhost

There are usually other paths here too, but they vary from project to project.

To make this work there are few more steps. First enable the new virtual host

$ sudo a2ensite projects

Don't reload apache yet.

Next you need to add the apache module

$ sudo a2enmod vhost_alias

Time to edit your

file so you can find the virtual hosts. Add a line similar to this projects phpgw-trunk.project [...] phpgw-stable.project

Now you can restart apache.

$ sudo /etc/init.d/apache2 reload

This is handy for developing client sites - especially using drupal.

Now my

is just an empty file.

I am getting a bit bored with adding entries to

all the time. If I get around to adding dnsmasq with wildcard hosts to the mix, I will post a follow up.

This setup is based on my current dev environment (Ubuntu Hardy), but it also works on older versions of Ubuntu. The steps should be similar for Debian and derivatives. For other distros, it should work, just how to make it work may be a little different. Feel free to post tips for others in the comments.