Defying Classification

by Malcolm Tredinnick

Topic: software

Fri 1 Feb 2008

Networks In Practice

Posted at 18:31 +1100

Melbourne airport's Qantas Club has free wifi, which is nice. However, all is not entirely sane in the network land:

...
Feb  1 18:24:36 lancre dhclient: bound to W.X.Y.Z -- renewal in 59 seconds.
...
Feb  1 18:25:35 lancre dhclient: bound to W.X.Y.Z -- renewal in 55 seconds.
...

and so on (public IP address changed to protect the innocent). Rinse, wash, repeat. I'm all for not tying up the network with unexpired leases that aren't being used, but 60 seconds seems a little eager. I'm just saying.

Topics: software/linux, conferences/linux.conf.au, technology/sysadmin

Thu 31 Jan 2008

linux.conf.au ... part 1

Posted at 15:47 +1100 (edited 2 Feb 2008, 18:41)

[I'm quite behind on a lot this month, due to a bit of unforseen downtime, but I want to get this down whilst it's fresh.]

Currently at linux.conf.au, feeling a bit rushed, but enjoying it now I'm here.

Have my tutorial this morning and it seemed to go reasonably well. I realise as I was writing the slides last week that, as usual, I'd vastly overestimated the amount of stuff I'd be able to cover in 90 minutes. I miss the three hour tutorial slots we used to have at this conference. Still, enough people showed up that they were sitting in the aisles: always a good stroke for the ego.

My talk was nominally about website server performance and I tried to structure things to give people a sense of the problems they have to identify and face. The entire field is pretty large, so I stayed away from too many specifics and concentrate on the attitude and approach that is required to understand and solve problems. Although the slides won't make a lot of sense if you weren't at the talk, they're available online for those who did attend and want to remember which tools I mentioned.

The talk was video taped and they gave me a microphone this year (vast improvement on last year), so it should be available online eventually.

Somebody asked, quite reasonably, if I blogged about the stuff I was talking about and, indeed, I should do more of that stuff. There are a lot of examples of good problem solving, both pre-emptive and after the post facto changes that sites have made, both large and small. I'll try to write some articles about that sort of thing over the coming months. Sharing experiences in the sysadmin/operations arena seems to be a good way to get the knowledge spread around.

The conference generally has been fun, although I only flew down yesterday (missing the mini-conferences on Monday and Tuesday). It was nice to hear Stormy Peters speak at the keynote this morning. Not sure I entirely agree with her conclusions, but her groundwork was sound and it provided food for thought. Val Henderson's talk on her clusterfs project was worthwhile, too. She's a good presenter and filesystem theory and practice is full of interesting algorithms and data structures.

Oh, I was lucky enough to get an OLPC in the giveaway yesterday, so I now have a nice little XO to play with.

More later.

Topics: software/linux, conferences/linux.conf.au

Wed 9 Jan 2008

API Design -- The Rusty Levels

Posted at 14:28 +1100

Rusty Russell's Hard To Misuse Interface Levels

Lower numbers are better. Really. Source is here. See below for details.

  1. It's impossible to get wrong.
  2. Compiler/linker won't let you get it wrong.
  3. Compiler will warn if you get it wrong.
  4. The simplest use is the correct one.
  5. The name tells you how to use it.
  6. Do it right or it will always break at runtime.
  7. Follow common convention and you'll get it right.
  8. Read the documentation and you'll get it right.
  9. Read the implementation and you'll get it right.
  10. Read the correct mailing list thread and you'll get it right.
  11. Read the documentation and you'll get it wrong.
  12. Follow common convention and you'll get it wrong.
  13. Do it right and it will break at runtime.
  14. The name tells you how not to use it.
  15. The obvious use is wrong.
  16. Compiler will warn if you get it right.
  17. Compiler won't let you get it right.
  18. It's impossible to get right.

(Read more...)

Topics: software/design, software/linux

Sun 6 Jan 2008

Django Tip: Complex Forms

Posted at 13:39 +1100

On the Django mailing list, we periodically see requests for help by somebody trying to create a semi-complex form of some description. Often, getting a second perspective is a good choice because the original poster was overlooking a possibly easier alternate approach.

Today, I want to fill in one of the gaps. Something that is really easy once you know the machinery and possibly not so obvious until you sweat it out once: putting multiple repetitive sections into a single form.

(Read more...)

Topics: software/django/tips

Wed 14 Nov 2007

Django Tips: Source Code Filenames

Posted at 22:58 +1100

Following on from last week's post about writing code that isn't tied to a project structure in Django, here are a couple of other quick thoughts about file naming and layout.

(Apologies to the half dozen or so people who read this blog for the "anything but Django" content. I've been spending all my free time in the last week working on Django, so it's buzzing around in my head at the moment.)

(Read more...)

Topics: software/django/tips

Sun 11 Nov 2007

Django Tip: External Database Backends

Posted at 20:26 +1100

I was going to write a longer Django entry today about WSGI, but I've been spending time working on Django code instead, so a here's something shorter and possibly less useful that deserves some attention from Django users.

Every now and again, somebody has a need to change the behaviour in Django's existing database backends. Or they want to develop a new backed for, say, Firebird or Microsoft's SQL-Server or something. A couple of months ago (in revision 6316), George Vilches contributed a patch that gave Django the ability to import external database backends.

(Read more...)

Topics: software/django/tips

Fri 9 Nov 2007

Django Tip: Developing Without Projects

Posted at 22:03 +1100

As developers progress along the path from Django grasshopper to Django master and beyond, it slowly (or rapidly) dawns on them that Django's project concept is something that really only exists as a convenient kickstart mechanism. It's a great way to help you get your initial work started and arrive at the point where you can start writing code.

The usefulness of the project concept is reinforced by the fact that django-admin.py startproject exists and does all this work for you. Surely, we are meant to use projects all the time.

No! A project is certainly a convenient "getting started" concept. It's also a handy development aid (the meaning of which, I'll describe later). However, the core of Django-based software is the application, not the project. When you distribute Django software to other people, you are generally distributing one or more applications.

So, here are a few tips and tricks for using a collection of Django applications without needing to create a Django project.

(Read more...)

Topics: software/django/tips

Fri 2 Nov 2007

Development experiences with version control

Posted at 23:34 +1100

I recently received an email from somebody asking for about experiences using git to do development for Django. It turned out they weren't interested specifically in git, but in how it was working using a different system from the upstream master repository.

Well, I can write a few words about that. I've written about some of my previous experiences here and here, so this is an update based on accumulated experience.

(Read more...)

Topics: software/django, software/version control

Sun 7 Oct 2007

Django Tip: HTTP verb dispatching

Posted at 05:38 +1000

A recent thread on django-developers discussed one style of laying out views, whereby the handling of different request methods to the same URL end up in different functions. This isn't a requirement or even a good idea in some cases (since there's frequently a lot of common code), but when it is a good solution, doing it frequently can become repetitive.

Fortunately, adding any extra code to Django's core isn't necessary to handle this. We can write a helper method that's less than twenty lines of code (and could be much shorter if I wanted to be less readable). This article is about the design of such a feature (at least, about my design, since different people want different hings). Code is included.

(Read more...)

Topics: software/django/tips

Sun 16 Sep 2007

Continued Django Sprinting

Posted at 12:47 +1000 (edited 15:39)

Considering the late finish yesterday, I feel surprisingly good today. This can't last.

Still, let's do some more ticket closing. The liveblogging continues...

(Read more...)

Topics: software/django