Everything Tastes Better With Chilli

Well, it does. 

Thark Ridge: In Search of the Devil's Throne

Another walk around Mt Wellington, this time along Thark Ridge. The plan was to go to Devil's Throne, but as it was I couldn't follow the directions too well (the track was pretty sparse; apparently there was a turn-off somewhere but I think I must have missed it). Looking at how far I got I think I must have past it without realising! I did get to quite a nice lookout at the end though, with nice views to one side of Cathedral Rock and Montague Thumbs.

Track here, if you can figure out where I went better than I did.

               
Click here to download:
Thark_Ridge_In_Search_of_the_D.zip (2342 KB)

Loading mentions Retweet

Comments [0]

Lost World

Another belated bush-walking post, sorry -- these are from a couple of weeks ago. I did a circuit up on the mountain, and it was late afternoon so the light unfortunately isn't that great. The first path is so flat and well-maintained it could almost be paved; about 15 minutes along that you get to Sphinx rock, which has a pretty nice lookout from the organ pipes and over the city (first panorama). After that you pass a couple of stone huts, before reaching a third where a number of paths meet: Junction Cabin. I took the Lenah Valley fire trail from there, before getting onto the Old Hobartians' track which climbs up through some nice forest and a few sandstone over-hangs. At the peak of that trail there's a detour up to Lost World, which was the main objective of this walk. The ascent involves mostly clambering over some pretty big boulders, before you suddenly crest and can see all of the "lost world" at once -- it's a pretty breath-taking sight. Unfortunately as I said the light wasn't great and the photos really don't do justice to the scale of the place, but it's a huge ampitheatre-type area with some imposing cliffs slightly wrapped around a field of enormous boulders. Again, it's hard to get a feel for the size of things from the pictures, except maybe to note the trees growing up between the rocks! I took a panorama of the city (which didn't come out to well because of the light), but in the right you can just make out the two TV towers on top of Mount Wellington, to help situate things. The return trip was along the base of the Organ Pipes again, from where I got a reasonable panorama of the city. Great trip, sorry about the quality of the pictures. Speaking of quality: no GPS track this time, because although I was supposedly recording one, the results can only be described as "ass-tacular". Apparently I was teleporting a lot.

(I believe there's a nice short and easy walk to Lost World that approaches from the other side instead, but where's the fun in that!)

                                   
Click here to download:
Lost_World.zip (7097 KB)

Loading mentions Retweet

Comments [1]

Tarn Shelf (this time, all the way around)

Another shot at Tarn shelf, and this time the full loop. It really is some of the most stunning alpine country you will see; I'll the let the photos tell the story.

You can find the GPS track here.

                               
Click here to download:
Tarn_Shelf_this_time_all_the_w.zip (6266 KB)

Loading mentions Retweet

Comments [1]

Per-User Database Authentication in Django

A colleague was recently talking about the need for a data entry interface to a database, and I glibly said "let me see how easy it is to put a Django-admin front-end on it!".  It turned out to be some-what less easy than expected; this post documents my solution to one of the less-easy aspects of it (there were others, but those were mostly to do with concerns of scale and better-documented issues surrounding legacy databases).  It is still quite an ugly solution, and please see the end for some fairly important caveats.  I'm documenting it here though because I did find other people with the same problem, but have yet to come across a solution.

The problem is this: Django assumes that in general it will control the database, including creating the schema and implementing any logic.  This particular database made the opposite assumption; front-ends were merely conduits, and any verification etc would be handled internally.  In this case that wasn't much more complicated than updating fields such as "added by" via triggers, but the principles apply across a range of scenarios.  Here's a random example of the Django way.

So, to play nicely with the database we'd ideally like each connection to be made using the credentials of the user using the application, and Django really isn't built for this.  One reason is that django.db.connection is a module-constant initialised with the database settings from settings.py, but if you are willing to swallow your pride we can also exploit this to our advantage.

The first step is write an authentication back-end so the user will be authenticated using their database credentials:

(I also changed the base admin template so it doesn't offer the "change password" option).  This is fairly standard; I'm using Oracle, but obviously any database can be made to work similarly.  Note that we still need the default database account in settings.py, and this will be used to create the new user in the django.contrib.auth tables for example.

Step two is, err, to save the password in the session (I told you I felt dirty), so we can create a database connection using it each request.  This needs to happen in the login method, where you have access to both the session and the username/password.

Step three is to convert django.db.connection to use these credentials instead of the defaults from settings.py; I did this using a custom middleware:

At this point we're almost done, but a problem still remains: I'm using Oracle where each user has their own private schema, and the application is expecting to find a bunch of tables which don't exist in the user's schema.  We could get around this using synonyms for example, but instead I used a signal that is fired each time a connection is created (there seems to be precious little information or examples about this signal either) in order to change the schema the connection is using:

This needs to be executed each time, so I put it in models.py.

So, all in all, a fairly minimal solution, but...

Here be Dragons!  As I mentioned, there are some pretty important caveats to be aware of if you ever use this (I accept no responsibility for any breakage, break-ins, yadda yadda yadda).  Most importantly, you are storing the user's password in plain-text for the duration of the session.  For our purposes this is fine; it's an internal application where security isn't exactly critical.  Your mileage may vary, significantly.

Secondly and perhaps more importantly, the various other Django applications still need access to their tables, but now you are connecting as a different user, so each user using the application will also need permission on these tables.  This is the bit that turns my stomach the most!

Lastly, there may well be consequences, race conditions, etc in manipulating django.db.connection that I have not come across yet.

Please let me know if there is an easier/cleaner way!  (I still feel dirty)

Loading mentions Retweet
Filed under  //   hacking  

Comments [0]

Token Sydney Harbour panorama

Had to be done, cliched though it is. This was taken from Ball's Head point at dusk. That fucking monstrosity in front of the bridge is the Blues Point tower, by Harry Seidler.

Loading mentions Retweet

Comments [0]

Spit to Manly Walk, Sydney

A much easier walk around the headlands, winding up in Manly. With panoramas, this time.

         
Click here to download:
Spit_to_Manly_Walk_Sydney.zip (1575 KB)

Loading mentions Retweet

Comments [0]

Garie Beach, Royal National Park, NSW

I spent a week in Sydney over the new year. There was walking. This particular lot is from around the coastal track around Garie Beach, in the Royal National Park. Fantastic weather (rain had been predicted!) as you can see, and for those of you expecting it -- yes, I attempted a panorama, but it was so a-kilter that I haven't even bothered stitching it, sorry.

                   
Click here to download:
Garie_Beach_Royal_National_Par.zip (3425 KB)

Loading mentions Retweet

Comments [0]

Organ Pipes Track

Nothing special; I went for a quick walk to break in some new shoes. These are the "Organ Pipes", the cliff at the top of Mount Wellington you can see from Hobart.

       
Click here to download:
Organ_Pipes_Track.zip (1664 KB)

Loading mentions Retweet

Comments [1]

Tarn Shelf panoramas

A sample of the views available less than an hour into the walk!

   
Click here to download:
Tarn_Shelf_panoramas.zip (442 KB)

Loading mentions Retweet

Comments [0]

Tarn Shelf, Mt Field National Park

A shorter-than-intended (left it a bit late leaving, and it's a long way from home!) walk at Mt Field. The first shot is a token one from Russell Falls, which is a paved 10 minute walk from the car park.

The main walk is a loop starting from Lake Dobson, which is a 20 minute drive above Russell Falls. It climbs up briefly through a pandani grove before hitting alpine territory, with some spectacular vistas (wait for the panoramas to be posted separately). Didn't get too far into it unfortunately; next time when I'm more organised perhaps. Just (it was scurrying under the board-walk) caught an echnidna on the return trip.

                 
Click here to download:
Tarn_Shelf_Mt_Field_National_P.zip (4250 KB)

Loading mentions Retweet

Comments [0]