Wednesday, December 28, 2011

The Kiwi Rule

Driving in NZ is pretty sweet, the only thing that catches out new arrivals is the `give way to the right' rule, aka the Kiwi rule. Simply described, if you are turning left, you must give way to anyone turning right. They are actually getting rid of this rule next year, and I expect it to be carnage, but in the mean time, I find the rule really interesting, for a number of vaguely computer science related reasons.

First of all, assuming people do everything right, it shouldn't matter whether you give way to the right or left, as long as there is a protocol, then everything should work out. Which is our first computer science lesson (or rather software engineering) - you have to design for the error cases too...

When it works, the Kiwi rule is good as it improves overall contention at a junction, although it is a little counter-intuitive why. With give way to the left (the UK/Aus convention), you often get queues where someone wants to turn right, but there is a steady stream of cars coming in the opposite direction, either straight on or turning left (I'm assuming its just a turn off a main road). The car turning right has to wait for a gap in the traffic, which may not come for some time. In the give way to the right system, the car only has to wait until someone wants to go left, which occurs more often than a gap (well, a gap will suffice also). You might think this just means you get a queue on the other side of the road, but the car turning left only has to wait for no cars in the opposite direction turning right, which is actually the common case. So, wait times, and thus queues, are reduced. In comp sci terms, you adopt a clever scheduling algorithm to reduce contention.

Of course, there is no free lunch. Contrary to most road rules, signalling is essential to the Kiwi rule functioning. If someone accidently leaves on their left indicator, when they are actually going straight on, they can cause a crash if someone else coming from the opposite direction thinks they can turn right. Likewise, if the car turning right forgets to indicate and the car turning left therefore doesn't give way. So, for the Kiwi rule, signalling changes the semantics of the protocol, and this means incorrect signalling can lead to crashes, kind of like an unsound type system, or possibly a language where the type system affects the semantics.

So, for the sake of safety over speed, it's probably a good thing it is being scrapped; but I will be sad to see it go, it seems to me like a formalisation of politeness in driving, and fits nicely with the NZ attitude to life.

Tuesday, December 20, 2011

Things not to like about NZ

I seem to spend a lot of time telling friends and family how awesome New Zealand is, so this blog post is meant to be a counterpoint, where I vent my spleen about a few of the things that are bad about living in NZ. Don't get me wrong though, the list of things that are good would be way too long for a post, and moving here was one of the better life decisions I've made.

Sandstone (most important) - a nice sandstone bouldering area would be nice. God I miss sandstone.

It's a long way from anywhere - this is the biggie for me, it's a pain to get anywhere, and especially anywhere interesting. Doing the long weekend in Europe or a few weeks in the Middle East or North Africa, etc. would be really nice.

Tea - we pretty much solved this one by bringing over 500 tea bags whenever we go to the UK, but still, what is the point of Kiwi tea, you can barely taste it, more like a cup of hot water that dreams of being tea when it grows up. I tried using two or three tea bags at once, but it's still not right.

Beer - proper beer, not lager (Kiwi lager is excellent, some of the best I've tasted). Why can't you get a proper ale or bitter in this country?

The climbing walls are all crap - why? I don't know, there are some largish ones, but still they don't seem to be able to get it together properly, surely it's not that hard?

Horrific child abuse - not funny this one. Not sure if its because there's no other crime to report, but torturing your children to death seems a little too common.

Stuff is expensive - I know it's a small market and all, but if I can international mail order stuff retail and pay the postage and tax and it's still 30% cheaper than in the shops, then something is wrong.

Muesli - yet to find a brand I like.

Slow and expensive internet - and not having free wireless everywhere like in a proper country.

Public transport - it doesn't go where you want it to go, and it doesn't go there very often. Airports seem to be particularly poorly served.

The pollen - I really suffer with the hayfever, especially in Christchurch.

Pumpkin - I like pumpkin as much as the next man (probably more in fact), but it would be nice to just once find a vegetarian dish in a restaurant that ddoesn't include pumpkin.

Ozone hole - it would be nice to be able to go out in the sun without feeling like you are being x-rayed.

Sunday, December 18, 2011

Compiling Firefox

A few posts back I described my slightly painful experience compiling Cairo. It was thus with some trepidation that I approached compiling Firefox (which includes Cairo), also on Windows. As it turns out it was a breeze, the only slightly tricky bit being finding the executable at the end. Instructions are here, and they are pretty accurate.

Check out Firefox from the repository of you choice using Mercurial.

Download the Mozilla Build Environment.

Run the Build Environment from the Visual Studio command prompt.

Make Firefox ("make -f client.mk" in your Firefox source directory).

Wait for some time (I left it running over night, not sure how long it actually took, but at least a few hours).

The executable is in the obj.../dist/bin directory, which is nested inside your Firefox source directory.

Easy-peasy huh? Why couldn't Cairo be that easy?

Christchurch

I've lived in Christchurch for the last year, minus a few months in India and Europe. We picked a pretty bad time to move to Christchurch really, and in a way, the year has been dominated by the earthquakes. Even before the quakes, Chch was not as nice a city as Wellington, so my list here of things I've liked about Chch was always going to be shorter than last year's, but with the quakes closing the city centre for pretty much the whole year, it has been a bit bleak. Anyway, I don't want to dwell on the negatives, so without further ado, here is my list of things I'll miss about Chch.

Castle Hill - Far and away the best bouldering in NZ. Flock Hill is total classic, Quantum Field and Spittle Hill are good when you want something a bit different. I still haven't really got the hang of climbing on limestone, but it's still a lot of fun. And the whole area is amazingly beautiful. Also, Cave Stream on a summers day is lots of fun.

Snowboarding - I started learning this year, and it is so much fun. And there are so many ski-fields around Christchurch, it's amazing, and they're good and not too busy, and some of them even serve good coffee. Oh, and you can get a season pass for all of them for not very much money, how awesome is that?

C4 - Amazing coffee. Really, their flat whites are the best I've tasted, and consistent too, all but one coffee I've had in a year have been perfect, and the one was still above average.

Lyttelton - Before the quake at any rate, Lyttelton was a really nice town, loved the character and the cafes and bars around the main street. I really hope it comes back with the rebuild.

The Bodhi Tree - Burmese restaurant in Ilam, one of the few city centre restaurants that managed to relocate, but a really good one. I'd not had Burmese food before, and I'd been missing out. Some nice wines too.

RDU - Good radio.

Sweet Kitchen - Behind Merivale mall, good (but expensive) cakes,

Bank's Peninsula - Not really in Chch, but close enough, the roads to Diamond Harbour or Akaroa are brilliant for riding a motorbike. And it's very pretty, and Akaroa is a really cool little town. I imagine the peninsula would be a great place to chill out and do nothing for a few days.


So, lets see what Auckland is like...