Christmas Cranberry Chutney

This weekend I got a chance to try out a recipe I’ve had my eye on for a while. Its this Spicy Cranberry Chutney which I’m making as christmas presents (home made presents – way nicer and way cheaper!). Here is it in progress, and in the jars when it was finished:

cranberry chutney, cooling cranberry chutney, bottled

Its very sweet and not very spicy because I (predictably) didn’t check I had everything I needed so I had to improvise wildly – and the missing ingredients sadly were the ginger and the pepper. Still, Its very edible and I can see this going with cold turkey very nicely on boxing day. I’m also planning some apple-something (apple jelly perhaps?) since I have a few apples that need something doing with them:

Crate of Apples

Girl Geek Dinner Next Week

I’m getting quite excited now about the next Leeds Girl Geek Dinner which is next Wednesday (3rd December 2008). Got some cool speakers by the look of it – I know Monica (and she is fab) and from Katie’s bio we are in for a treat. Also I have been promised there is more food this time (hot and christmassy food …. yum) so count me in.

I often get asked why we don’t allow men at these events – well of course we do. Men can attend but only when they are invited by one of the attending girl geeks (maximum one man each please, ladies!) – meaning we can have men who are likely to contribute to the event but not be invaded if we don’t want to be. If you’re a guy and looking to go, find a girl geek and ask nicely :)

I’ll definitely be at this event – I look forward to seeing some others. I had a great time last time – so go and buy a ticket (cheap night out at £15!) and I’ll see you there!

PHPNW Post-match Analysis

Last weekend saw a crowd descend on central Manchester in the UK for the first PHP North West conference. We had almost 180 attendees, 12 sessions, 16 speakers, and lots of fun. The day itself went off very smoothly and although I didn’t manage to see many of the sessions, the atmosphere both at the conference and at the socials was absolutely buzzing. I found myself doing the introductions which was a bit scary but apparently the audience were more scared than me when I laid down the law about not moving around during the talks!

On a personal level, I met up with lots of friends and also made several new ones – one of the best things about the conference for me was being able to meet “in real life” the friends I’ve made online, either on IRC or through my site or the phpwomen site. There were people there that I’ve met through my work and through attending other tech events – and to be able to shake hands and chat in person was great.

We also had a phpwomen stand at the event – which generated quite a bit of interest. For the record, we counted around 15 women in the 174 attendees, which is actually quite a lot – or rather, its more than usual – and it was great to see it. Also there were 2 female speakers out of 16 which was accidental but is also quite a good ratio so I’ll mention it (hi Steph, hi Zoe!)

All in all, it was a pretty stunning first conference – I’d like to personally thank Jeremy and the people from his family and company that he dragged in to help, and Jenny who also did a great job. The speakers were ace and the helpers on the day were also really excellent. The main sponsors were my employers, Ibuildings and it was great to have them around for this – and of course to catch up with my colleagues!

Speaking at “Beauty and the Geek”

I’m giving a talk next week in a Beauty Salon. Yes, really :) There is an event entitled “Beauty and the Geek” at Heaven Spa in Didsbury – details on their blog – and the event is on 26th November. It sounds like a fun mix of beauty techniques (mouse-finger massage, anyone?) plus a talk by yours truly … although I need to a) figure out how to give a talk with no projector and b) live up to my reputation as “influential blogger” – if you’re going, then let me know and I’ll see you there!

PHP North West Conference in Manchester – Next Week!

Its been creeping up on us for a while but now PHPNW is almost upon us! PHP people will be arriving from all sorts of places and coming together to attend this event. The schedule is full of excellent talks by a selection of speakers – and we’ll round the day off with a lively panel discussion about the PHP community itself.

We’ve got socials happening right over the weekend – with a pre-conference social on Friday night for people to meet up, catch up, and generally hang out (and drink), the weekend will get off to a good start. Saturday is the main conference event, ticket price includes full access to the event, a year’s subscription to php|architect magazine (in print as well as digital format), lunch, and access to the evening party with yet more food (hotpot, since we’re in the north!), and of course a selection of drinks.

For those coming from further afield, there is plenty to do in Manchester over the weekend. The conference itself is very central, so you have easy access to the entertainments of the city centre. The shopping is excellent in the city centre and for those who prefer a geekier pastime, entry to the Museum of Science and Industry is free and it is open 7 days a week.

I know there are plenty of people going and I’m really looking forward to it – to catching up with old friends (and colleagues, I don’t see them very often!), to making new ones, to hearing the talks that will be going on, and of course to a few drinks and a good time. Hope to see you there :)

Blanket for Christmas

I’m currently struggling a bit with my Christmas crochet, so I’m posting here to hopefully pressurise myself into actually finishing it in time. The plan is to make a blanket for my granny for Christmas (its a surprise, I’m banking on her not learning to work the ‘net before then) and I’ve been working on this for 6 months already. It will have 36 squares and I’m currently at 24 squares and losing my way! Here it is so far:

Granny's Blanket (so far)

The spaces are the squares I haven’t made yet … I need to get a move on!

Leeds Girl Geek Dinner – December 3rd

Announcing the second girlgeek dinner in Leeds! The event will be Wednesday 3rd December, at The Loft Leeds and tickets are available now, priced at £15. Monica Tailor from Kilo75 will be speaking at the event, and it will have quite a Christmassy feel.

The rules of the girl geek dinners is that any geeky girls can go – and not just tapping-into-a-black-screen-in-a-darkened-room geek girls, there is no minimum requirement! Guys are also welcome but they must be there as the invited guest of one of the geeks. I’m open to persuasion if anyone would like to attend as my guest – and for the girls, I’ll see you there :)

Locale-Sensitive Dates in PHP

I am working on a site at the moment whose front end is in Dutch – and for an English-only speaker, its an education! Most things default to English and I had no idea how to use PHP to work with other languages.

In particular I needed dates like “Donderdag 23 Oktober”, and I was sure PHP should know how to do this without me creating arrays for days of the week and months of the year. With some help from my friend (thanks Derick) I discovered that there is a date function in PHP that takes into account the locale of the script, called strftime. The machine needs to have the locale already installed, then you can just do:

         setlocale(LC_TIME, 'nl_NL.UTF-8');
         return ucwords(strftime('%A %e %B',$publish_date));

Setlocale() will return false if the language isn’t available on the host system, so its possible to check and maybe try a few likely ones or let the user know. This was useful to me and will work for other languages too – you just need the locale installed and then set with setlocale.

Introduction to Zend_Db

I recently worked on a project which was based on Zend Framework – I haven’t worked with it before and I was temporarily confused by the existing implementation of some of the database-level stuff. After much reading and untangling of code, I’m now pretty clear how this should look, so here’s my overview. I’m not going to go into setting up a whole application, but this is a quick primer on how data models go together.

Modelling Tables

Zend_Db_Table is a class that represents a table. You instantiate one of these and call query functions against it. The actual code for my classes is really minimal, here’s an example:

class UserTable extends Zend_Db_Table
{
    protected $_name = 'users';
    protected $_rowClass = 'User';
}

The two properties that I’m setting here are all I use for basic tables. $_name tells Zend Framework which database table to use. $_rowClass tells it which class it should instantiate for the results from your select query. By default you’ll get Zend_Db_Table_Row objects but you can have it use any object which extends this class instead.

Getting Results

To get results from a table, you instantiate the relevant table class, and then fetch some results. You can restrict the results you get but Zend_Db_Select is a whole other kettle of fish that perhaps I’ll post about some other day. So a controller action might look something like this:

function viewAction()
{
    $users = new UserTable();
    $user_list = $users->fetchAll();
}

The $user_list variable will then hold an instance of Zend_Db_Rowset.

Working with Rowsets

The rowsets are iterators, you can loop over them and they will return objects which represent the rows in the resultset of the query. By default these are objects of type Zend_Db_Table_Row but if you set the table object’s rowClass, either in the object declaration or by calling setRowClass() before you fetch the results, then you can have any class which extends Zend_Db_Table_Row used. Its pretty common to pass the rowset straight to the view and iterate over it there – you can put any functionality you need for this object into the class you use. Let’s look at my user class for this example.

The Row Class

    class User extends Zend_Db_Table_Row
    {
        public function getName()
        {
            return $this->first_name . ' '.$this->last_name;
        }

        public function getProfileUrl()
        {
            return '/users/profile/id/' . $this->id;
        }
    }

These are overly simple examples, but giving this kind of functionality to the user model allows it to be re-used any place you need it. I’ve also found it useful to have an intermediate table row class that contains functionality that will be used by data from more than one table – for example for formatting dates in a consistent manner.

Zend Framework and Models

This is a pretty simple overview but it took me a while to get to this point – the framework does have documentation but its quite case-specific and doesn’t really show how it ties together. Now I understand these classes and their relationships, my development project is going a lot more smoothly.