Leeds Girl Geek Dinner - December 3rd
Friday, November 7. 2008
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 :)
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 :)
Posted by LornaJane
in tech
at
09:11
| Comments (3)
| Trackbacks (0)
Defined tags for this entry: leedsgirlgeek, tech
My PHPWomen Interview on Sun's SDN Podcast
Thursday, November 6. 2008
I was recently interviewed by Cassandra Clark from Sun about PHPWomen - they've put the interview live now and you can find it at http://blogs.sun.com/SDNChannel/entry/introduction_to_phpwomen_org
Locale-Sensitive Dates in PHP
Wednesday, November 5. 2008
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() 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.
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() 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.
Posted by LornaJane
in php
at
08:28
| Comments (8)
| Trackbacks (0)
Defined tags for this entry: php
Introduction to Zend_Db
Friday, October 31. 2008
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.
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.
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.
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.
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.
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.
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.
Posted by LornaJane
in php
at
08:53
| Comments (14)
| Trackbacks (0)
Defined tags for this entry: php, zendframework
Opera's Address Bar AutoCompletion
Thursday, October 30. 2008
I recently upgraded the copy of Opera on one of my machines, only to find a few things about it which had changed from previous versions were driving me mad!! Immediately noticeable was that the address bar autocompletion seemed to have gone completely nuts. It was autocompleting all sorts of addresses that bore no resemblance to what I was typing, and it was giving me deep-link choices first, so I couldn't autocomplete to just the domain I wanted, for example.
It turns out that this new behaviour is, in fact, a feature - Opera remembers the content of all the pages you've been to as well as just their URLs, and then it tries to give you the most relevant matches in your address bar. Well that doesn't work for me. Address bars are for typing addresses and search engines are for searching content in my world, maybe I'll find this useful one day but that day isn't right now. The good news is, its easy to turn off.
Just go to Preferences -> Advanced -> History and then uncheck the box "Remember Content on Visited Pages". Now when I start typing, I just get the URLs that look like my actual words, and with the shortest matches first. I'm safe to upgrade the other machines now!
It turns out that this new behaviour is, in fact, a feature - Opera remembers the content of all the pages you've been to as well as just their URLs, and then it tries to give you the most relevant matches in your address bar. Well that doesn't work for me. Address bars are for typing addresses and search engines are for searching content in my world, maybe I'll find this useful one day but that day isn't right now. The good news is, its easy to turn off.
Just go to Preferences -> Advanced -> History and then uncheck the box "Remember Content on Visited Pages". Now when I start typing, I just get the URLs that look like my actual words, and with the shortest matches first. I'm safe to upgrade the other machines now!
Posted by LornaJane
in tech
at
13:17
| Comments (6)
| Trackbacks (0)
Defined tags for this entry: tech
Man-fit T-shirt to Girl Top
Saturday, October 25. 2008
I am sick beyond description of conference shirts, they are big and they are sack-like. I have lots of them, I'm expected to wear them a lot, and they are not particularly confidence-boosting. Dressing up for the crowd at technical events is not the way forward, but I am a tiny bit tired of shapeless - so I decided to learn how to refashion this pile of shirts that I now have, into something I might want to wear.
I began with this rather excellent tutorial, and an oversized shirt (my sister brought this back from scout camp last year).

I also took a favourite t-shirt that fits me nicely (not too tight, the finished article is still going to be a t-shirt) and used this as a template. Clothes that fit are pretty rare as I'm above average height, but I have a few favourites. In a nutshell, you draw around the main body of your template shirt (I used kiddy chalk, because it was handy), then make sleeves but by lining your template shirt up against the cuffs of your victim shirt.

I tacked (by hand) up the marked side seams, and tried the shirt on (inside out) to make sure it fit and I could get into it and so on (its easy to overestimate how stretchy something is and not be able to actually get into the finished article!). It was fine so I cut out along the chalk lines.
The only really tricky part came next ... fitting the sleeves. In fact I had to phone home for some help (thanks mum!) and it turns out what you do is: Put the shirt down inside out and the sleeve the right way out, but post the sleeve in through the armhole with the hand-end of the sleeve inward-most - like a top with the arm inside out. Then the pins go inside this inside-out sleeve, at right angles to how you are going to sew, and with the points pointing out at you. Then you sew round the armhole and just sew over the pins with the machine. I hope that makes sense - I'm hoping it'll remind me for next time anyway (/me points and laughs at future self reading these instructions)
Sew round the sleeves and down the sides, and take out the tacking. In theory you should also overstitch the hems but ... I didn't quite manage to wait that long before trying on my new shirt.

I began with this rather excellent tutorial, and an oversized shirt (my sister brought this back from scout camp last year).

I also took a favourite t-shirt that fits me nicely (not too tight, the finished article is still going to be a t-shirt) and used this as a template. Clothes that fit are pretty rare as I'm above average height, but I have a few favourites. In a nutshell, you draw around the main body of your template shirt (I used kiddy chalk, because it was handy), then make sleeves but by lining your template shirt up against the cuffs of your victim shirt.

I tacked (by hand) up the marked side seams, and tried the shirt on (inside out) to make sure it fit and I could get into it and so on (its easy to overestimate how stretchy something is and not be able to actually get into the finished article!). It was fine so I cut out along the chalk lines.
The only really tricky part came next ... fitting the sleeves. In fact I had to phone home for some help (thanks mum!) and it turns out what you do is: Put the shirt down inside out and the sleeve the right way out, but post the sleeve in through the armhole with the hand-end of the sleeve inward-most - like a top with the arm inside out. Then the pins go inside this inside-out sleeve, at right angles to how you are going to sew, and with the points pointing out at you. Then you sew round the armhole and just sew over the pins with the machine. I hope that makes sense - I'm hoping it'll remind me for next time anyway (/me points and laughs at future self reading these instructions)
Sew round the sleeves and down the sides, and take out the tacking. In theory you should also overstitch the hems but ... I didn't quite manage to wait that long before trying on my new shirt.

« previous page
(Page 4 of 67, totaling 400 entries)
» next page


Comments
Mon, 05.01.2009 13:06
Doh! Interesting that you play piano, didn’t know that pi ece!
Mon, 05.01.2009 10:46
Daniel: I completely agree. I do like and use Zend Framewor k, but I already have books about it. When I buy a book on a subject, I don’t really want lots of ZF content. I can on ly assume that because its seen as a “buzz word”, people fee l the need to include it in any books current being wr [...]
Mon, 05.01.2009 10:41
Ubuntu User, Prasad, Joe – I’m pleased this was helpful, tha nks so much for dropping by and letting me know it worked ou t for you :)
Sun, 04.01.2009 23:25
Thanks for the tagging :) I responded (first time ever): htt p://www.urbanwide.com/2009/01/05/7-things/
Sun, 04.01.2009 06:42
You are my freakin’ hero! Thank you soooo much! mainMem.useN amedFile=FALSE fixed all my problems, my wife came back, I w on the lottery….. :) Thanks! Joe
Fri, 02.01.2009 23:33
I agree with your issues about some of the book turning into a mini ZF tutorial book. I feel that lately a lot of spa ce has been wasted on PHP books re-explaining MVC concepts, THEN introducing ZF (or another framework). Chalk it up to p ublishers not wanting to assume everyone reading the b [...]
Fri, 02.01.2009 00:44
All the best for Peru, and the rest of 2009!
Thu, 01.01.2009 23:33
Berry__: For normal people that is probably true but I add all sorts of clues which are different per-server, and still find myself regularly confused about which machine I’m logg ed in to …
Tue, 30.12.2008 15:23
Although I kinda like the colors for tabs, I think it’s over kill to have different colors on different servers. To be ho unest, I think the name of the machine you’re working on (on the left) is clear enough when working with it. The only thing I tend to dislike in screen, is that it’s rathe [...]