Friday, 29 February 2008

Leap Year Maths

Today is Leap Day, the 29th of February. Reading this article on The Register earlier and in particular the comments, it looks like the logic behind calculating whether a year is a Leap Year is still fuzzy for some. This is an essential calculation to get right in any software that deals with dates (that is, most of them), so here are all the gory details.

Tuesday, 19 February 2008

The Dangers of Alcohol

I am in Chesterfield tonight, for work. I just had dinner with colleagues and came back to my hotel, picked up the key from reception and started walking back towards my room. On the way there, I met a couple who had had a few too many drinks. They were so pickled with booze that they first needed a few minutes to identify which room was theirs. Then they realised that inserting the key into the lock was way too challenging so they asked me for help. I obliged and the lady managed to spittle a drunken thank you. I have the feeling that tomorrow morning will be a difficult time for them both.

Monday, 11 February 2008

Vodafone Handset Warranty: The Plot Thickens

I posted a rant about Vodafone a few months ago and followed it up yesterday with an update. Someone called Edward Peter, who apparently works for Vodafone UK, commented on the update in a way that confuses matters further.

Let's recap: I had an 18 month Vodafone contract that came with a free handset, namely a Nokia 6234. Said handset started mis-behaving 15 months into the contract. When I contacted Vodafone support at the time, I was told that because the warranty of the handset was 12 months and that I wasn't due an upgrade before another 3 months, they couldn't replace the handset. This incident convinced me to leave Vodafone, which I did when my contract expired. I then got a phone call from a customer relationship manager who, when I explained why I was leaving, said that the support people had not advised me correctly and that all handsets had a 2 year warranty. The comment left on yesterday's entry states: If you get a handset directly from Vodafone its warranty matches the length of conttract you're on; 12 months for 12 months, 18 for 18 and so on. So this leaves us with 3 options:

  • The warranty is 12 months, irrespective of the duration of the contract, which means you are toast if you have an 18 or 24 months contract and your phone packs up after 12 months;
  • The warranty is 24 months, irrespective of the duration of the contract, which means that you're covered because whatever the length of your contract, you are due for an upgrade before or at the same time as the warranty expires, that is until Vodafone start offering 36 month contracts;
  • The warranty matches the length of your contract, which means you're covered as you are aligible for an upgrade as soon as the warranty expires.

The last option would be the most sensible one. The first one is a trap for customers and one of the reasons why I left Vodafone even though it seems not to have been Vodafone's policy, just a misconception from support staff.

So if someone knows the answer, please tell me and tell the support guys at Vodafone: giving correct advice may help them retain customers. In the meantime, make sure you check that the length of the warranty for your handset matches the length of your contract, whoever you take your contract with.

Sunday, 10 February 2008

Vodafone Support

Stop press: Vodafone are not evil, it's just that some of their support staff don't have a clue. Now that's a surprise!

Following my rant about Vodafone contracts and phone warranties, I did not contact the Office of Fair Trading as I said I would. However, a few weeks ago, as my Vodafone contract was about to expire, I took up a contract with 3 and made sure the phone I was getting had a warranty that extended beyond the duration of the contact. I then requested my PAC code from Vodafone to move the number over to the new contract. Of course, that triggered someone at Vodafone to call me and ask why I was leaving. I explained that they had lost me as a customer three months ago after the phone warranty incident. It appears that what I had been told originally was incorrect: all Vodafone handsets have had a 2 year warranty for quite some time so I should have been able to get my handset replaced without a problem. I was then assured that the support manager would be made aware that some of the staff were wrongly advising customers so that this would not happen again. Ah well, too little too late Vodafone.

Funnily enough, getting the PAC code and transferring the number went without a glitch after that: perfect service both from Vodafone and 3.

For tales of PAC code woos, check Coofer Cat.

Subversion on Ubuntu

The Cunning Plan

One of the planned functionality for my new silent server was to offer a Subversion repository for code and documents that I could access via WebDAV. By doing this, I would be able to save important documents on the server and benefit from version control. Version control is essential for computer code but can also be very useful for other types of documents by allowing you to have multiple versions, revert to an old version, etc. So without further ado, let's get into the nitty gritty of getting it to work on Ubuntu 7.10.


Installing the software packages

We need to install Subversion, Apache and the Subversion libraries for Apache. As this is all part of the standard Ubuntu distribution, it is extremely easy.

sudo apt-get install subversion apache2 libapache2-svn

And that's it, you have a working Subversion installation! It doesn't do very much yet so we need to create repositories for documents.

Subversion Repositories

Subversion is extremely flexible in the way it deals with files and directories. There are a number of standard repository layout that are well explained in the book. Then there's the question of whether you'd rather put everything in the same repository or split it. This is also well explained in the book. My rule of thumb is to only create multiple repositories if you need to keep things completely separate, such as having one repository per customer, or if you need different settings. In my case, I need to store code and documents, the code being accessed via an IDE that competely supports Subversion, the documents being accessed as a network folder. Both usage scenarios require different settings in Apache so this is a typical case where several repositories are a good idea. However, there is no need for splitting the code or the document repositories further. You can create your repositories where you want in the file system, I chose to create them in a specific top level directory.

$ sudo mkdir /svn
$ sudo svnadmin create /svn/docs
$ sudo svnadmin create /svn/dev
$ sudo chown -R www-data:www-data /svn/*

The svnadmin command created a complete structure:

ls /svn/dev
conf  dav  db  format  hooks  locks  README.txt

The last command changes ownership recursively of both repositories so that the Apache instance can read and write to them. This is essential to get WebDAV to work.

Configuring Apache

Next, we need to configure Apache so that it can provide access to both repositories over WebDAV.

$ cd /etc/apache2/mods-available
$ sudo vi dav_svn.conf

In this file, I defined two Apache locations, one for each repository, with slightly different options. As this is a home installation, I don't need authentication. If you want to add authentication on top, check the How-To Geek article. The extra two options on the documents location are meant to enable network clients that don't support version control to store files. See Appendix C of the Subversion book for more details. Note that if you wanted to use several development repositories, such as one for each of your customers, you could replace the SVNPath option with SVNParentPath and point it to the parent directory.

<Location /dev>
  DAV svn
  SVNPath /svn/dev

<Location /docs>
  DAV svn
  SVNPath /svn/docs
  SVNAutoversioning on
  ModMimeUsePathInfo on

The last thing to do is to restart Apache:

$ sudo /etc/init.d/apache2 restart

Subversion Clients

Now that the Subversion server is working, it's time to connect to it using client software. For development, I use Eclipse for which there is the Subclipe plugin. It all works as expected. For the documents repository, Apple OS-X has built-in support for WebDAV remote folders. Go to the finder, select the menu Go > Connect to Server and type in the folder's URL in the dialogue box that appears, in my case http://szczecin.home/docs. It's also possible to browse both repositories using a web browser, which is a good way to provide read-only access.


That was a very short introduction to Subversion on Ubuntu. There's a lot more than this to it, a lot of it in the Subversion book. In particular, you can add authentication and SSL to the repositories once they are available through WebDAV. There are also a lot of options as far as Subversion clients are concerned and you can find free client software for every operating system you can think of.