Tuesday 25 December 2007

Proud father




Well, our little girl is finally here. Daisy Lilla came kicking and screaming into the world at 18h45 on December 13th, 2007.


Weighing in at 3.5kg (7lbs. 11oz.) and measuring 55cm (21.68") long, she's even more beautiful than we could have ever imagined.


It's been 11 days now and I still can't get over how gorgeous she is. Everytime I see her, even when she's grumpy, I beam with pride.


My biggest fear is that someone will come knocking on our door one day and say, "Your time is up and it's time to hand her back." Fortunately she's ours forever.


There are plenty of pictures of her over at her own website, http://daisy.wallace.sh/.

Saturday 24 November 2007

Forward to the past

So, you've got Leopard. You've got Time Machine. But alas, no external drive.

Not to worry - here's how you can backup your Mac over the network to your existing Linux server without mucking about with HFS+ or any other filesystem.

First, install netatalk and avahi on the Linux box.

Once you have those installed, configure netatalk using the following as a guide.

Turn off atalkd and papd in netatalk.conf:
# Set which daemons to run (papd is dependent upon atalkd): 
ATALKD_RUN=no 
PAPD_RUN=no 
CNID_METAD_RUN=yes 
AFPD_RUN=yes 
TIMELORD_RUN=no 
A2BOOT_RUN=no
Then, get atalk to use TCP only by editing afpd.conf:
- -noddp -advertise_ssh
Cool. Now, edit AppleVolumes.default and add the path to where you'd like to store the Time Machine backup(s):
/path/to/backup/dir "NAME OF VOLUME"
Restart atalk using something like:
# /etc/init.d/atalk restart
Great, that's atalk taken care of.

Configure avahi so that the Mac will automatically pickup the atalk share.

You only need to add an XML config file, netatalk.xml, in the avahi/services directory:
<?xml version="1.0" standalone="no"?>
<!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">%h</name>
  <service>
    <type>_afpovertcp._tcp</type>
    <port>548</port>
  </service>
</service-group>
Restart avahi using something like:
# /etc/init.d/avahi-daemon restart
Nearly there!!

Now your server is ready to go, we just need the Mac to connect up.

On your Mac, using Finder, click Go -> Connect to Server and put in the IP address of your server.

Click Connect.

This should prompt you for a username and password.

Once authenticated the Mac should now have this share mounted. ... and, finally, to allow Time Machine to recognise the network share: (thanks, Mike!)
$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
You should now be able to point Time Machine at your Linux share and backup your Mac over the network!

Sunday 30 September 2007

A new phone already...?

It's that time of the year again, although this year it came much quicker than in previous years.


The N73 hadn't dated anywhere nearly as quickly as previous phones - a testament to its operating system and functionality. So, this time around it made sense to stick with the same phone, but just tweak it in the right places.


The Nokia N95 is exactly that... an N73. With wings.


For me, the two big drawcards were WiFi and a faster processor. The N73 was a little sluggish, but useable. The N95 sports a 330MHz CPU and a dedicated GPU which makes it very responsive.


Evil Vodafone cripples the phone out-of-the-box with their awful menu systems and no VOIP.


A quick search on the web reveals a simple guide for installing an un-branded firmware. Essentially, you need to update the internal product code of the phone, which allows it to download the factory firmware instead of the knobbled Vodafone versions.


Compatibility with the Mac is excellent too after you download the iSync driver and the iTunes/iPhotos transfer software.


The N95 has been out for a relatively long time now which means that the initial bugs have been flushed out, saving me some hassle. The latest firmware introduced Assisted-GPS too which is a God-send apparently, supplementing the GPS information with data from the Internet.


Woeful tales of small battery capacity should be tempered with the phone's functionality and size. The N73 had a brilliant battery but it didn't have GPS, WiFi or two processors to contend with. I think I'll be okay as I'm never too far away from a mains power source (or even a USB power supply, for that matter).


I'm not too bothered with the video functionality, but it's nice to know it's there.


All-in-all, a pretty cool phone. I'm trying to unlock the N73 but it's proving a little difficult. Apparently Vodafone will provide the code after you've had the phone for 12 months - so I might have to wait.


Update: It turns out that the Nemesis Software Suite resets the N73's SIM lock code too. ;)

Saturday 1 September 2007

Seam carving





Seam Carving is an ingenious method for dynamically resizing images without stretching, compressing or cropping.

It's one of those great marriages of mathematics and real-world application. Work like this is what drives the Web forward and allows for clean, flexible page design - without messing with the agreed standards.

Thursday 9 August 2007

It's a girl!

After lots of waiting, full bladders, ultrasound gel, grainy images and careful measurements it was announced that our rapidly growing baby is, in fact, a girl -- and not a boy, despite all the predictions from family and friends.


Both Katie and I had been secretly hoping for a girl and it seems that our wish has come true.


This also, of course, narrows down the search for baby names but doesn't make it any easier... any suggestions are welcome!


The ultrasound machine, in the capable hands of the hospital staff, quickly compiled all the data and produced her profile in an instant. Everything is within "normal range" and points to a completely healthy baby, much to our relief.


Amazingly, the brilliant machine even calculated her weight of 311g. (it's started already!)

Thursday 12 July 2007

7 spies at the casino


Tn_1617_sevenspies


Shameless plug for an Edinburgh Fringe Festival production... by none other than, James, Kate and Rick!


7 spies at the casino is "... The unbelievably true story of the 1967 James Bond film, Casino Royale."


You can also read Rick's article in The Guardian about the financial woes of producing a play for the festival.

Sunday 8 July 2007

Macalicious

I've taken the plunge and bought an Apple MacBook Pro.

After buying a MacBook for Katie at Christmas and having the odd little play here and there, I had become strangely addicted.

My initial thoughts were to get the hardware and then install Linux on it... but now that I've got it and had a proper look at Mac OS X, I don't think that's going to happen.

For a start, the default email program is almost perfect. It stores everything on the server, including sent, draft, junk and deleted messages. It uses the folder names that I want, not that it wants and it can show a merged inbox for multiple accounts.

iSync worked flawlessly and it synchronised with the Nokia N73 without any modifications. Unlike Evolution, it even sync'ed the alarms.

The OS is brilliant, the hardware is gorgeous and everything integrates like something that Bill could only dream of. When people say, "It just works"... you better believe it.

Here's the juicy hardware details:
  • 15" LCD
  • 2.4GHz Intel Core 2 Duo processor
  • 2GB RAM
  • 256MB Nvidia GeForce 8600M GT

Monday 11 June 2007

Tagadelic patch

We've noticed that there's a small bug in the Tagadelic module for Drupal.

It doesn't pay attention to the status of nodes. ie: it uses unpublished content for its calculations.

Here's a patch to remedy that:
--- tagadelic.module.old        2007-06-10 17:55:54.980771815 +0100 
+++ tagadelic.module    2007-06-10 18:03:32.950326194 +0100 
@@ -211,7 +211,7 @@
    if (!is_array($vids) || count($vids) == 0) {
      return array();
    }
-  $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size); 
+  $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid INNER JOIN {node} nod ON n.nid = nod.nid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') AND nod.status = 1 GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);
     return tagadelic_build_weighted_tags($result, $steps);  
}

Sunday 10 June 2007

Who's the daddy?

The 12 weeks are finally up and the world can now officially know... Katie and I are expecting a baby!


So far the due date is around 28th December which will be another day to add to growing list of birthdays, celebrations, etc. around that time of the year. We should get a more accurate date in the near future as we're going for our first ultrasound scan on the 27th June (after our Hungarian wedding on the 23rd).


Apart from feeling exhausted all the time, Katie's doing well (if not a little nervous about the entire prospect). Watching childbirth on TV or DVD doesn't help inspire any confidence - despite my reassurances.


Of course, we're both thrilled, as are our parents. ... and, when the time arrives, we'll definitely be ordering some tiny, little shoes from Lucky Little Elephant. </plug> ;)

Saturday 14 April 2007

Converting RAID1 to RAID5 with no data loss

When you record and download lots of TV, movies, music, etc. it can chew up the disk space pretty quickly. If you don't keep on top of your DVD burning you will end up running out of disk space, like me.

That's okay, I have two 200GB drives mirrored in a RAID1 array. If I break the mirror and concatenate the drives I could use all 400GB of space available to me... but if one drive died, I would lose everything that was not backed up.

Buying two more drives isn't the answer as I only have one more PATA drive connection available.

Perhaps I could back everything up, buy two bigger drives, install a new RAID1 array and copy everything back over. That means giving up two perfectly servicable 200GB drives.

If only I could add a third drive and convert the RAID1 array to a RAID5 array. Then I would get the full 400GB of space, and still retain the redundancy. Yeah, right...

Then I stumbled across this blog entry in which a guy creates some experimental loopback devices, creates a RAID1 array and then converts it to a RAID5 array with no data loss.

I was intrigued.

The theory says that the RAID5 algorithm, when applied to 2 disks only, ends up looking like a RAID1 array except for the RAID metadata. If you overwrite the RAID1 metadata with the RAID5 metadata, mdadm should recognise the 2 disk RAID5 array and not mess with the contents.

Once the metadata is updated, you can then add a third partition to the array and grow the RAID5 array to utilise it. All that remains is to then resize the filesystem to fill the new space.

The main question is, am I brave enough to try it?

You bet I am!

Of course, everything is caveated with the usual "back everything up before you attempt this procedure" and, like a good boy, I borrowed a 400GB external drive from work and rsync'd all the important stuff across... and, with heart in mouth, followed the procedure...

Boot from a Fedora Core 6 rescue CDROM and get to a command prompt.

You must ensure you have a recent kernel (> 2.6.17) and that you have a recent version of the mdadm software:

# uname -a 
Linux localhost.localdomain 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:54:20 EDT 2006 i686 unknown  
# mdadm --version
mdadm - v2.5.4 - 13 Ocotober 2006

Stop the array:

# mdadm --stop /dev/md0

Overwrite the RAID1 metadata with the RAID5 metadata:

# mdadm --create /dev/md0 --level=5 -n 2 /dev/hda1 /dev/hdb1 
mdadm: /dev/hda1 appears to contain an ext2fs file system
     size=1946592K  mtime=Sat Apr 14 07:18:32 2007 
mdadm: /dev/hda1 appears to be part of a raid array:
     level=1 devices=2 ctime=Sat Sep 17 16:17:45 2005 
mdadm: /dev/hdb1 appears to contain an ext2fs file system
     size=1946592K  mtime=Sat Apr 17 07:18:32 2007 
mdadm: /dev/hdb1 appears to be part of a raid array:
     level=1 devices=2 ctime=Sat Sep 17 16:17:45 2005 
Continue creating array? y 
mdadm: array /dev/md0 started.

At this point the RAID software decided it wanted to rebuild the array. Uh-oh, there goes my data...

I quickly mounted /dev/md0 and had a look... all my data is still intact! Oh well, let the software do it's thing. Who am I to argue?

Add in the third, new partition:

# mdadm --add /dev/md0 /dev/hdd1

So far, so good. Once the rebuild is complete, grow the RAID5 onto the new partition: (NB: use the --backup-file option in case the grow is interrupted. It will allow a safe recovery.)

# mdadm --grow /dev/md0 --raid-disks=3 --backup-file=/mnt/tmp/raid1-5.backup.file 
mdadm: Need to backup 128K of critical section .. 
mdadm: ... critical section passed.

I'm impressed that I've had no problems so far.

The reshaping of the RAID5 from a 2 disk to a 3 disk array takes quite a while (about 6.5 hours for around 200GB of raw data) but the filesystem resize shouldn't take anywhere near as long:

# e2fsck -f /dev/md0  
# resize2fs -p /dev/md0

Apart from the modification of the RAID metadata, the whole operation can be done "online". I chose to do it from single-user/rescue mode as I wanted to make sure there was no data loss. If you're not too bothered then you could leave the whole thing up and running.

Thanks to Neil Brown for his wonderful software RAID drivers, Nathan Gray for his cunning RAID1/RAID5 conversion technique and, of course, everyone who makes Linux the great OS it is.

Monday 19 March 2007

I want to be a janitor

I just read a great article entitled, "Myths, Lies, and Truths about the Linux kernel".  I found it quite inspirational and it taught me a couple of things - always good.


For a start, I was unaware of the kernel janitors project.


It seems a good way to get involved in some kernel development and give back to the community that I've mostly taken for granted. I'll probably have to learn git, ketchup, cscope and quilt -- and I'll certainly have to brush up on my C skills but, again, all feathers in the cap.


One question remains. Where will I be able to work on this kernel?


I can't have my main PC up-and-down. Oh wait, thank god for VMWare.

Wednesday 14 March 2007

Drop Gear?

The unthinkable has happened.


Jeremy Clarkson has said Top Gear won't be back in the summer.


What!? How the... what the... but I was watching that!


It seems to be the usual problems for this kind of show. Contracts, budgets, government lobby groups, green activists, etc. Poor Top Gear takes a lot of heat for glorifying the car and its lack of regard for the environment.


We all know the state of the public transport system is really to blame. Crap trains, expensive buses, cramped tubes and abysmal cycling conditions. That and the big green push at the moment all adds up to a well-timed cancellation.


Top Gear is a one-of-a-kind and the world will be a sadder place without it. They've tried to come up with similar whacky shows that attempt crazy stunts, but none of them match the cinematic quality and hyperbole that the BBC has provided. They've proved it by winning an International Emmy and being nominated for several other awards.


Please, BBC. Don't drop this one.

Monday 12 March 2007

Fujifilm remote capture stream.c diff

[See also, Time Lapse Photography, Part 1]

stream.c
--- stream.c    2007-03-11 18:00:53.000000000 +0000
+++ stream.c.new        2007-03-11 18:01:22.000000000 +0000
@@ -30,7 +30,8 @@
        for (dev = bus->devices; dev; dev = dev->next) {
            if (dev->descriptor.idVendor == 0x04cb) {
                // OK, it's a FUJI
-               if (dev->descriptor.idProduct == 0x0125) {
+               if (dev->descriptor.idProduct == 0x0125
+                   || dev->descriptor.idProduct == 0x010b) {
                    printf("Found it on bus %d(%s), dev %s.n",
                           bus->location, bus->dirname, dev->filename);
                    // our product
@@ -50,8 +51,14 @@
 #define BULK_WRITE_ENDPOINT   0x02
 #define INTR_ENDPOINT         0x03

+#define        DEBUG_OUTPUT                    0
+
+#if DEBUG_OUTPUT
 #define DEBUG(txt, ...) 
   fprintf(stderr, "DEBUG[%s:%d]: " txt "n", __FUNCTION__, __LINE__, ##__VA_ARGS__);
+#else
+#define DEBUG(txt, ...) fprintf(stderr,"");
+#endif

 #define VERIFY(code) 
   code; 
@@ -242,8 +249,6 @@
        DEBUG("Frame [2]");
        len = usb_bulk_read(udev, BULK_READ_ENDPOINT, buf, 0x2000, 3000);
        if (len < 0) {
-           fprintf(stderr, "Failed to get bulk frame datan");
-           return frame;
            frame_free(frame);
            return NULL;
        }
@@ -260,6 +265,7 @@
     int res;
     int i;
     struct usb_interface_descriptor *intf;
+    struct frame *frame;

     usb_init();
     usb_find_busses();
@@ -267,7 +273,7 @@

     dev = find_our_black_sheep();
     if (!dev) {
-       fprintf(stderr, "No FUJI FinePix A310 found.n");
+       fprintf(stderr, "No FUJI FinePix found.n");
        goto end;
     }

@@ -311,19 +317,19 @@
        if (argc > 1)
            count = atol(argv[1]);

-       for (i = 0; count-- > 0; ++i) {
+       for (i = 0; i < count; i++) {
            char filename[32];
-           struct frame *frame = get_frame();
-           if (!frame) {
-               fprintf(stderr, "Can't get framen");
-               break;
-           }
+           frame = get_frame();
+           if (frame) {
                sprintf(filename, "out/frame%05d.jpg", i);
                FILE *f = fopen(filename, "wb");
                fwrite(frame->data, frame->length, 1, f);
-               frame_free(frame);
                fflush(f);
                fclose(f);
+           } else {
+               fprintf(stderr,
+                       "Problem with frame %05d.  Trying again.n", i--);
+           }
        }
     }

Time lapse photography. Part 1.

Time lapse photography is something I've wanted to try for a while.


But how exactly would I do it?


I've got an old digital camera lying about, a Fujifilm S602 zoom, that I could use. Of course I'd have to hook it up to the PC and get it to capture the images at regular intervals.


Again, how exactly would I do that?


A quick scour of Google revealed a couple of projects.


Finepix uses it's own kernel driver and it plugs into Video4Linux. I didn't get this to work initially.


I then found Mishoo's personal project to get his A310 capturing images.


This second one is much simpler and uses libusb to control the camera and it's a single binary.


Once I'd switched the camera into PC-Cam mode, it worked straight away. It had a few problems so I tidied it up a little and it now does something close to what I want.


Next steps... get it capturing decent images on a regular basis and then turning the photos into an AVI.


PS: It turns out that the power supply for my old Creative Zen MP3 player also works as DC-in for the S602 zoom.

Sunday 25 February 2007

Minority Report style screens aren't as far away as you might think.

I was replying to a friend's email today and remembered an extraordinary video clip that I saw just over a month ago.


I sent it over to him but I thought I'd share it with the rest of the world too.


It's been quite a while since I've seen some gadgetry that makes my jaw drop, but this is something that definitely falls into that category.


The Google Earth stuff is kinda cool but when he starts playing with the photos and flinging them around the desktop is when it really starts to become a replacement for the real world.


If you can't picture what I'm talking about, check the video out and you'll see what I mean.

Saturday 24 February 2007

All work and no play...

There's not been much activity on the blogging front since I got back from skiing as I've been working my arse off in the sweat shop that the office has now become.


If you've not heard already, my employer had decided to engage a large, well-known consultancy company to manage and construct the new versions of our websites.


That company outsources its development to India.


Without getting into the details, the code sucks and we've had nothing but trouble since.


They use the Agile programming methodology which effectively means we've been thrown right into the middle of the development cycle - much to the detriment of the day-to-day support of the rest of the business.


Many late nights and little sleep have resulted in us having to mitigate the amount of load going through to the backend by caching the the site more than should have been necessary.


This has resulted in reasonable response times but it means the dynamics of the new site has suffered.


Oh well, maybe the business will engage IT when it comes to spec'ing these things in the future... ha!

Saturday 3 February 2007

Borovets ski break

A joint sojourn to Bulgaria with the Allens proved a big success as we got our first taste of downhill skiing.


Our original flight was cancelled and we got bumped to a later flight and we arrived at Borovets ski resort in the small hours of Sunday morning.


Hotel Olymp wasn't our first choice but as we booked late that's all that was available at the time.


Our first shock was the state of the room. I'm sure the last time these rooms received any TLC was back in the 80's - simply proved by the fact that not a single door in the place was hung straight.


The next morning, in the light of day, things weren't as bad as they first seemed and we promptly headed down to Hotel Rila to meet with the Balkan Holiday reps to pick up our ski passes, etc.


As we arrived late the previous night and we had to meet the reps early, we weren't in the mood for skiing straight away and needed a day to unwind. This wasn't met with great approval and we were reprimanded several times over the next two days. So much for it being OUR holiday!


Borovets turned out to be quite a nice little town with some colourful characters about the place trying to tempt us into their cosy restaurants. We resisted for a while but once lunch time approached it was all too much and we succumbed to the pressures of a large bloke called Danny.


Danny was to become our friend over the next few days and we sampled his traditional Bulgarian meals on more than a few occasions.


Day 2 was our first day of real skiing and we were introduced to our ski instructor, George.


George was a really nice guy and we quickly formed a good rapport with him.


After a lesson in the absolute basics we went for lunch. Over lunch George introduced us to the Ambrosia that is hot chocolate with brandy. This was to become my staple for the next week.


The afternoon saw us learning the rest of the basics and after a couple of tumbles it was time to call it quits.


The next morning was bright and sunny and the weather continued to melt much of the dwindling snow cover.


As the beginner slopes were getting too crowded to do any decent skiing, George took us up one of the smaller chair lifts to a blue run. When we got to the top and saw the gradient of the slope and the condition of the ice snow, our nerves wavered just a little. A few reassuring words from George was enough and we headed down.


Surprisingly, this was exactly what was needed and our skills quickly improved with each turn on the slope. After a couple of brandy hot chocolates for lunch, our courage was strengthened and we tackled the slopes with vigour before heading wearily back to the hotel.


Each of the next couple of days were greeted with bad news. No snow and the main gondola was shut due to high winds. It turns out that a ski resort isn't so much fun without the snow.


By Thursday evening we were going stir-crazy but luckily for us our prayers were answered and the heavens opened up and unleashed a dump of unparalleled proportions.


On Friday morning we were up and dressed and ready to jump on the gondola at 9am. We spent the rest of the day skiing back down to the gondola station from the top - an effort that took us about 5 hours. We encountered blue, red and even some black runs on the way down. Certainly a crash course, if ever I had one.


By the time we reached the bottom we were all sore and ready to go to bed, but at least on our final day we finally got some real skiing in.


On Saturday we found ourselves back at Sofia airport and boarding our flight home.


All-in-all a great week off from the stresses of work and a great introduction to skiing. Now we only need to save up for our next skiing trip!


You can find photos from the trip in the gallery.