Saturday, November 27, 2010

Christchurch

We set off for from Melbourne on our way to Christchurch on Friday evening. Our plane was delayed by three hours due to thunderstorms around Melbourne. We eventually arrived in Christchurch in the early hours of Saturday morning and didn't get to the hotel until 3am. This didn't help us to get over our mini-jetlag, New Zealand being two hours ahead of Melbourne.

Also not helpful was the complete lack of windows in our tiny day-glo hotel room, despite the space age alarm clock and mood lighting.

Compared to Australia, Christchurch looked surprisingly familiar to us Poms, with familiar British things such as...

... Christchurch Cathedral:



...the tiny river Avon meandering its way through the city, complete with a family of ducks:



...the most awesome ever fountains:



We only stayed in Christchurch for a short time before picking up our Spaceship campervan and heading south at a rate of knots.

Tuesday, November 23, 2010

Profiling My Slow Django Templates

This is another techie post. If you have no interest in Django or Python then you may not be interested in this post either :-)

A Django app that I'm working on was running ridiculously slow. A quick Google search helped me to learn the basics of the Python profiler.

Add the following in order to profile my_function()


cProfile.runctx("my_function()", globals(), locals(), filename="profile.txt")


Run the code in question and then run the following in the Python interpreter in order to analyse the results:


import pstats
p = pstats.Stats("profile.txt")
p.sort_stats("cumulative").print_stats()


This will output results similar to the following, sorted in order of cumulative execution time:


Wed Nov 10 07:39:39 2010 profile.txt

11405 function calls (11319 primitive calls) in 0.459 CPU seconds

Ordered by: cumulative time

ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.458 0.458 /home/chris/MyProject/thingie.py:60(my_function)
1 0.001 0.001 0.458 0.458 /home/chris/MyProject/wizzle.py:32(thing_function)
1 0.000 0.000 0.358 0.358 /home/chris/MyProject/hoss.py:2(hussss)




In my case, I needed to see the call graph. The following draw a pretty .png picture of the call graph

gprof2dot -f pstats profile.txt | dot -Tpng -o out2.png

Armed with a visualisation of all this data, it became apparent that Django's template system was taking up most of the time. I had a line in a template, deep within a doubly nested for-loop that looked like this:

onclick="leftClick( {{cell.x}}, {{cell.y}} )"

Django was rendering this very slowly indeed. I ended up removing the for loop from the template and generating the html directly from within python code. This wasn't pretty but sped things up by nearly an order of magnitude.

I wonder if there is a more satisfactory solution to this problem, other than dumping Django templates altogether.

Back in Melbourne

I have a few Blog posts in draft which I'll post soon. In the meantime, check it out: we're in Melbourne.

We arrived back in Melbourne yesterday after a tortuous 9 hour journey by coach, train and rail-replacement-bus-service from Canberra. Melbourne is a lot hotter than it was when we were last here (a month ago) and that, combined with a hotel room next to a noisy main road and the insect bites that I sustained while in Canberra, made it very difficult to sleep last night. Consequently, I am feeling very sorry for myself. We're off to New Zealand on Friday and have plenty to do in order to get ready so this week we'll be getting ready, Melbourne-style.

Sunday, November 21, 2010

Tidbinbilla

On Sunday, after visiting the Deep Space Center, we visited the Tidbinbilla Nature Reserve. This is located in an area that was devastated by a bush fire in 2003. Thankfully, it seems to have recovered over the past seven years.

The first sign that the local wildlife had recovered came shortly after we entered the reserve. We had been pretty frustrated up until this point to have only seen one solitary kangeroo in our whole time in Australia. Imagine our delight, therefore, at meeting a whole herd of them:



Later on, we were even more excited to see a rare duck billed platypus. Normally, these creatures are pretty shy. This little guy, however, was bit of a show off and kept coming up for air near us every few minutes, allowing us to take photos.



Next up, we went looking for koalas in the eucalyptus forest. Sadly, we weren't able to find any wild koalas but we did see this little guy who was being prepared for release into the wild:

Deep Space!

On Sunday, we visited the Canberra Deep Space Communication Complex. This is the one of NASA's ground stations for communicating with spacecraft and is particularly important since it is the only one in the southern hemisphere. The dishes here differ from the dish at Parkes in that they are specifically designed for this purpose and they are capable of transmitting messages to spacecraft as well as receiving them.

There was a very interesting visitor centre with lots of details on the workings of zero gravity toilets. Here are some pictures of enormous dishes:




To be fair, these dishes were actually a bit wimpy and small when compared to the one at Parkes, since they are only designed to receive signals from mere millions of miles away. As opposed to millions of lightyears.

Saturday, November 20, 2010

Canberra Botanic Gardens

After climbing visiting the Black Mountain Tower, we paid a brief visit to the Botanic Gardens. There were plenty of botanical plants on display:






The most exciting thing, though, was meeting a real live wild kangeroo. As far as wild beasts go, it was actually pretty tame and wasn't bothered much by our presence, preferring to continue its meal of grass. Question: do kangeroos have to chew the cud? I wonder...



Finally, we paid a brief visit to the shores of Lake Burley Griffin, down near Parliament. Here, we ran across a wedding which we did our best not to disturb as we went past. We discovered some aboriginal artwork which I feel duty bound to post here, despite the fact that aboriginal art is rubbish:



See: aboriginal art isn't very good.

Black Mountain Tower

The next day, we went to the top of the Black Mountain and climbed (actually went up the lift in) the tower at the top of the mountain:



From the viewing platform, parliament was visible in the distance:



As was the CBD:



We had been advised by a few people not to bother visiting Canberra. That's pretty unfair. It may not be as massive and as exciting as Sydney or Melbourne but it is a beautiful place, set in a stunning location. One thing that we noticed is that public transport is not nearly as good as in Melbourne or Sydney and a car would have been very useful. As it was, we relied on lifts :-)

Friday, November 19, 2010

Parliament

Last weekend, we stayed with Gill in Canberra. On Friday, Gill gave us a lift into the city on the way to her work. We headed for parliament, specifically the old Aussie parliament which is now a museum of Australian democracy and has been since the new parliament was built in 1988.

Here is a picture of Hannah in the cabinet room, pretending to be the Aussie Prime Minister:



Sadly, she wasn't permitted to pose in the Prime Minister's office:



...but she was permitted to pose on (a replica of) the speaker's chair. The Aussie speaker's chair is a replica of the original speaker's chair from the Westminster parliament in London. When this original chair was destroyed during World War 2, the British parliament made a replica of the Aussie speaker's chair. Thus, the current chair in the UK parliament is a copy of a copy of the original one. Which, in turn, was probably a copy of the one that was destroyed by fire in the 1830s. Which is nice.



We took a look into the chamber of the House of Representatives (roughly equivalent to the UK House of Commons)...



...and, after escaping from an overly enthusiastic volunteer guide, we found the Senate (an elected assembly which seems roughly equivalent to the UK House of Lords) chamber:



On the way from the old parliament building to the new one, we discovered some interesting geological rocks, as this sign shows:



Here is the old parliament building, with the interesting rocks in the foreground:



When we finally reached the new parliament building, we didn't have enough time to go in. Hannah was nevertheless very excited to be there:

Wednesday, November 17, 2010

Everton

They are clearly massive Everton fans in Sydney, as evidenced by this picture of the Everton Cafe taken from a train passing through Strathfield station. You might like to click on the photo to see a higher-res version and then zoom in a little.

The Dish

On Tuesday, we visited the Parkes radio telescope. This was made famous by the film The Dish. Here is a picture of the telescope not doing much:



Unfortunately, the telescope was undergoing maintenance when we visited. I'm sure it wouldn't have looked much different if it was actually doing something, mind. The telescope is in use most of the time (when it is not being maintained) so the general public can't get any closer than the visitor's center. From there, we looked at lots of exhibits and fun activities which almost managed to make Hannah become enthusiastic about science.

Very interesting were the "whispering dishes" outside the visitor center. These were a pair of parabolic dishes 20 metres or so apart, positioned such that someone whispering at the focal point of one of the dishes could be heard clearly at the focal point of the other dish. This was naturally very exciting. Here is a picture of Hannah bigging up one of the dishes:



I was so excited by this that I attempted to reproduce the mathematical proof that a parabolic dish will focus parallel light (or sound or radio waves or whatever) to a focal point. Unfortunately, I failed, due to having forgotten pretty much all the maths that I learned in school.

Sunday, November 14, 2010

Newtown Festival

On Sunday, we met up with Lindsay and Lisette at the Newtown Festival. This is a festival in aid of a community centre in the Newtown area of Sydney, Newtown being a favourite of hippies and new age types, as far as we could tell. The festival was free, which was nice. We managed to check out a few bands. Here is Hannah enjoying one of them:



The best band of the festival wasn't actually playing at the festival at all but were playing from the garden of a house adjoining the festival site. Here is a picture of them rocking out, taken from a distance.



Just out of shot are a few very nervous looking cops. Presumably they think a riot is about to start. Or... worse!

Wednesday, November 10, 2010

Movember

To celebrate Movember, I will be spending the whole month of November growing a moustache, in aid of The Prostate Cancer Charity. Please visit my fundraising page here and sponsor me; it will go towards a very good cause

Here is a picture of what I look like so far:



Sersiously, please donate. Prostate cancer is rubbish.

Monday, November 08, 2010

Building the Django docs

Having limited access to t'internet at the moment, I decided to try to get an offline copy of the Django documentation. It turned out not to be as easy as I had thought but I managed to find out how to do it. Here's what I did:

Install Python's easy_install by running:

yum install python-setuptools

Use easy_install to download Sphinx:

easy_install Sphinx

After downloading the Django source and untaring it, cd to the docs directory and run the following:

make html

Wait for an age while it builds the html docs from source!

This page in the Django docs was quite helpful:

http://docs.djangoproject.com/en/1.2/internals/documentation/

Sunday, November 07, 2010

Cleveland and Birkdale

Today, we visited Cleveland Point. Here are some pictures:

Point Cleveland Ligthouse:


Mangroves by the waterside:


Some highly geological stones on the beach:


Sophie and Hannah enjoying ice creams (actually gelato and sorbet) next to a big tree:

A heavily moustacheoed (please sponsor me here) Chris enjoying his very first gelato:


Afterwards, we visited a British import store where Hannah bought some out of date Robinsons fruit squash and then had British-style fish and chips. It seems that the area of Birkdale is a bit of a ghetto, being chock full of immigrant poms, explaining the presence of the above British establishments, as wells as a genuinely British balti house.

Beachy

While we were staying with Sophie and Dan, we visited the beach a fair few times. Brisbane actually doesn't really have nice beaches itself but is located between the Sunshine Coast and the Gold Coast, both of which have great beaches.

My favourite beaches were on the Gold Coast, where the waves were big and pretty powerful. A mere picture doesn't do justice to them:



As I remarked on my previous visit to the Gold Coast, the area has been massively built up. We visited the northern end, on The Spit, lured mainly by the free parking. In the near distance, we could see Surfers Paradise:



We also found time to visit Mooloolaba and Noosa on the Sunshine Coast. These places were slightly more relaxed (and apparently posh) affairs with gentler seas and fewer skyscrapers.

Saturday, November 06, 2010

Mount Coot-tha

On Friday, we drove to the top of Mount Coot-tha, a hill near Brisbane with great views of the city. From the lookout point, we could see the whole city beneath us:


As well as sampling the views, we stopped for lunch at the cafe at the top of the hill. Alas, the meal proved to be absolutely horrible. Hannah's shepherd's pie was barely edible. My Thai curry was a little better but wasn't worth the $15 that we paid for it. Avoid the cafe at the top of Mount Coo-tha!

Our Lonely Planet guidebook told us to check out some of the waterfalls in the area. We drove to near Simpsons Falls but didn't bother to visit the falls when we realised how little water was coming down the stream:


Luckily, there were some highly geological rocks in the area:


We headed to the nearby JC Slaughter Falls in search of actual flowing water. Alas, there wasn't much there either (and the path to the bottom of the falls was closed!).


Nevermind. We had the most awesome Chinese/Vietnamese takeaway at Dan's sister's house that evening. Mmmmm....


Monday, November 01, 2010

Brisbane

We are staying with Spohie and Dan in Brisbane right now. I will write about lots of the fun things that we have done but, for now, here is a picture of the city.