Thursday, May 31, 2007

Is the Pope…?

[reading: Nancy Kress, "Beggars in Spain"]

Can someone explain to me why a Catholic cardinal attacking abortion is news? After all, it's only been the Catholic position for two thousand years or so…

Friday, May 25, 2007

The Dead Pool

[reading: Tracy Hogg, "Secrets of the Baby Whisperer"; recently Kurt Vonnegut, "Slaughterhouse Five", Christopher Brookmyre, "All Fun And Games Until Somebody Loses An Eye", Greg Bear, "Vitals"]

Looking at the list of dead (or dying) computer skills, I'm starting to feel old. Of the 10 on the list, I've got experience in:

  • Non-IP networks: Yep, about 2.5 years of SNA programming (although the last time I messed in SNA was fortunately back in 1996).
  • C programming: Er, over 10 years of this, although a large fraction of the recent stuff has been more of a C/C++ hybrid (which slightly misses their point—the article specifically targets pure C programmers).
  • OS/2: Ah, the half operating system. As Bill Gates presciently put it (in the foreword to a book that I read at the time), "I believe OS/2 is destined to be the most important operating system, and possibly program, of all time". I had probably a year or so working on it (a printer driver and a comms system) back in 1989/1990.
  • Cobol: Actually, no. But if they'd mentioned Fortran instead, I'd have to admit to a couple of years of it. Most recently in 2005 (don't ask).

[A:42265 B:3736 C:346 D:9187 E:92981 Total:148515]

Friday, May 04, 2007

inline_related_objects

[Edit, Feb 2008: fixed typo—changed extra_content to extra_context]

Today's neat Django trick: getting the create_update generic views for a model to display entries from a subsidiary model in-line—like the admin interface does when you add edit_inline=models.TABULAR.

The (oldforms) Form object that gets generated by the create_update view already has most of the required gubbins inside it; we just need a few extra steps to get at it:

  1. In urls.py, set an extra_context argument for the view to be a dictionary that contains inline_related_objects:
     {'inline_related_objects': model._meta.get_followed_related_objects(None) } 
  2. In the template, include a loop to pull in all of the related objects:
     {% for related_object in inline_related_objects %}{% edit_inline related_object %}{% endfor %} 
    within the <form> tag.
  3. Since the edit_inline template tag is not a built-in Django tag, the template also needs to load up the admin_modify extension:
     {% load admin_modify %} 
  4. Make local copies of the relevant admin templates (such as admin/edit_inline_tabular.html and widget/foreign.html) and tweak appropriately.

Of course, I didn't figure this out until after I'd spent a couple of hours dismantling the admin interface code with a view to stealing the relevant bits. Roll on the Django book.

Wednesday, May 02, 2007

ER Considered Harmful

[reading: Enkin et al, "A Guide to Effective Care in Pregnancy and Childbirth"; recently Charles Stross, "Accelerando", Charles Stross, "Glasshouse", Douglas Hofstadter, "I Am a Strange Loop"]

Hmm. Maybe watching this episode of ER wasn't such a good idea just at the moment.

Watching old ER episodes, it's interesting to see various actors who I recognize from things they've done since. This episode had Bradley Whitford, who's much more familiar now from West Wing; continuing the theme, only 2 episodes earlier Janel Moloney (Donna) showed up—although I mostly recognized her from her voice. Likewise, the voice of Richard Brooks is very distinctive, even though he only shows up in one episode of ER and a single episode of Firefly (as Jubal Early). [Edit: also Richard Schiff, almost unrecognizable without the beard but again with a distinctive voice.]

[A:42265 B:3446 C:346 D:9187 E:92248 Total:147492]