Debian Change Keyboard Layout

I recently downloaded a virtual machine which had all the default factory settings in it – including an American keyboard layout. To change this on Debian Etch I simply used:

dpkg-reconfigure console-data

and then followed the online prompts. For reference (i.e. the next time I have this problem), the | (pipe) symbol on a US keyboard is mapped to the ~ (tilde) on a UK one.

Kubuntu Installation – Disk Partitioning

I’m installing Kubuntu Gutsy Gibbon onto my Dell Vostro 1500 and the first problem I hit was that the Live CD was entirely unable to repartition the disks. There are a few partitions on the disk (as you’d expect from a Dell machine running Vista, its got recovery and things) and I kept seeing the error:


An error occurred while writing the changes to the storage devices.
The resize operation is aborted

To get around this I resized the main partition in Windows and created a new partition but left it unformatted. When I went back to the Live CD install I got the option “Use largest contiguous space” and that worked fine.

Hope this helps someone!

First Manchester Girl Geek Dinner

Last night I attended the first Manchester Girl Geek Dinner. I am very excited about the Girl Geek Dinner events arriving in the north, there’s a lot of activity up here and I’m already involved in other local events such as GeekUp and BarCamp.

I’m based in Leeds, so it was about an hours drive over to Manchester. Thanks to the wonderful world of satellite navigation, I found the venue with no problems. The evening started with some mingling and drinks, and then we were all invited to take seats and help ourselves to the buffet, which was excellent. After the meal we had a variety of talks which were actually really good, I hadn’t been thinking of the talks as the highlight but they certainly were!

During the course of the drinks, the meal, and a few minutes after the talks (although it was a very late finish, 10pm or so, I didn’t leave until half past and then had to drive back to Leeds), I was able to meet and speak with an amazing selection of women of various ages, professions and backgrounds and had some interesting and valuable conversations.

Its early days for this version of this event and the plan is for it to be quarterly, I am looking forward to the next installment.

SVN Deployment and a New Site

I recently got an email from a BarCamp friend, Mark Sailes, telling me about his new site http://www.svn-checkout.co.uk. I am a big fan of subversion and always looking for more tips and tricks for using it better so I popped over to have a look. Its a nice site with some very useful short articles on various subjects related to subverison. In particular the article on releasing new versions of sites caught my eye. Mark suggests use of a checked out version of code rather than an exported one, and using the switch command to upgrade to the next tagged version as needed. He completes the setup with an apache configuration trick to avoid any of the subversion information being served to the outside world. I’ve usually just exported new versions as needed but this trick is a definite alternative and the article itself guides the reader through each step of the way. Nice one Mark :)

PHP Women at PHP London

On Feburary 29th the PHP London 2008 conference will take place in London. Things have been very busy for the guys organising, there have been a few tweaks to the schedule but its looking like things are coming together nicely. I’m all set and have booked tickets and a hotel already – for Thursday *and* Friday nights so I can go both the pre-conference and post-conference socials, which is essential. If you haven’t booked your tickets yet, or you have to get your employer to do it, I suggest that’s something you might want to sort out fairly soon as I imagine it’ll be oversubscribed – in fact if everyone who has told me they are thinking of going does try to book tickets, I think they’ll sell out!!

At this event I will be busy with phpwomen, wearing my t-shirt and generally making a noise and raising the profile of the group. If you are attending the conference then you are morally obliged to pop over to us and say hello, we like to meet new people. If you are extra nice to us we may give you a t-shirt! There will be women from the UK and also elsewhere in Europe and it’ll be great to meet those I haven’t met yet and also see some old friends from other conferences. An excellent way to spend Leap Year Day in my opinion :)

Logrotate Error on Ubuntu

For a few weeks now, I’ve been seeing this error in my logs every night:

/etc/cron.daily/logrotate:
error: error running shared postrotate script for /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log
run-parts: /etc/cron.daily/logrotate exited with return code 1

What’s happening is that after all the mysql backing up and everything is done, ubuntu is trying to use the debian-sys-maint user to flush the logs, this is actually called in /etc/logrotate.d/mysql-server. On my system, we seem to have lost this mysql user.

The solution is to look for the password used in the /etc/mysql/debian.cnf file, mine looks like this:

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = xxxxxxxxxxxxxxxx
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user     = debian-sys-maint
password = xxxxxxxxxxxxxxxx
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

Using the password, and some inspiration from this post on the Ubuntu Forums I recreated the user with the necessary permissions and password with:

GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxxxxx'

This did the trick, as the nightly errors have now disappeared from my script. Hope this helps someone in a similar situation – if you can expand these notes then please add a comment and I will update this as needed – thanks :)

Filtering Tables in Joins in MySQL

I had a situation recently where I was outer joining one table onto another. I needed all rows from the first table, plus any matching rows from the second table. So:

SELECT * 
FROM table1 t1
LEFT JOIN table2 t2 ON (t1.col_a = t2.col_a)

So far, so good, right? In this particular instance though I wanted to filter my results on a particular criteria so I added something like:

SELECT * 
FROM table1 t1
LEFT JOIN table2 t2 ON (t1.col_a = t2.col_a)
WHERE t2.col_b <> 42

This is where it all started to go a bit weird. I wanted all the rows from the first table, plus anything from the second table that matched but didn’t have col_b equal to 42 (this is a rather contrived example I know but my real-world example was so complicated I’d still be explaining it if I started). The syntax above was causing a problem in the case that there was a single matching row in the second table which matched the criteria in the where clause. In this instance, the entry from the first table would appear once, and then immediately get filtered out by the constraint in the where clause.

What I actually needed to do was filter the second table before the join happens. So here’s the syntax:

SELECT *
FROM table1 t1
LEFT JOIN table2 t2 ON (t1.col_a = t2.col_a AND t2.col_b <> 42)

It turns out that you can use the ON clause when you join to include anything that you would usually put in a where clause to restrict the rows on the table that is being joined. Hope this makes sense and is useful to someone, add your comments if you have any!

BarCampLeeds Recap

I did it! I went and spoke at BarCampLeeds, there’s flickr evidence to prove it as well :)

My talk was “Source Control Saves Lives”, a primer on what source control and why you should use it, with a definite subversion twist because that’s what I know the most about and I’m not a fan of talking about stuff I don’t know about! For posterity, here are the slides – I haven’t done any presentations for years and I couldn’t remember how to work powerpoint svn_saves_lives.ppt

I borrowed Kevin’s mac and downloaded the demo of iWork. Its a 30 day trial and after its expired I can still use it as a player. Which is excellent as using the mac remote in the talk worked really well and got around the awkward layout of the room I was allocated.

The event as a whole was fabulous – I met some amazing new people and have a stack of business cards of people to email and catch up with. I don’t have my own cards which is proving really awkward at this kind of event, perhaps I will get some in the future when I’m attending something like this since they’re not expensive. The new contacts I made could turn out to be really interesting in a whole load of ways – and the free beer and chatter with like-minded people was very welcome as well. Talking over experiences and projects with others has left me refreshed and inspired, in a way I didn’t expect. What more could a girl want?

Thinking of BarCamp Leeds

Recently I found out about a phenomenon called BarCamp, where a bunch of people, mostly geeks, turn up and run their own un-conference. Every attendee speaks, at least that’s the theory, and there are a lot of concurrent sessions – so you just attend what you want to. It looks interesting and although nobody is making all attendees speak, I figure its good to join in with these things.

Bar Camp Leeds is this weekend, Saturday 17th November 2007, and its wildly oversubscribed. I know a few people who were hoping to go and haven’t been able to get places. At the time of writing, I’m still planning to speak but there’s less than 48 hours to go and I haven’t got further than deciding I may speak about source control, and subversion specifically. The nerves are starting to kick in …

PDO for PHP on Ubuntu Edgy Eft

Today I was asked to add PDO support to PHP on our development box, which I thought was running Ubuntu Feisty Fawn. The first problem is that it’s not running Feisty Fawn, its running Edgy Eft, which is an older version. The next problem is that the PDO libraries weren’t bundled with Eft.

PDO is available in PECL so, using these instructions from Rich Buggy I grabbed the mysql client development libraries from aptitude and then got the PDO libraries I needed.