Sunday, August 19, 2007

My new goal wrt emacs

I some day want to be good enough at emacs so that I can have a very detailed love/hate relationship with it and be forced to bid it a bitter sweet adieu. For now I'm too naive to do anything but love it and believe that anything that doesn't seem quite right is just a failing on my part.

I'm actually bi-editorial (emacs and vim) but I'm far more comfortable with emacs. Generally if I have my sysadmin hat on I crank up vim, otherwise for programming and word processing it's emacs. I do this automatically and without planning to do so.

I wonder if I'll ever be intimate and fluent enough at emacs to be disappointed in it. :)

Friday, August 10, 2007

OSCON Haskell tutorial

I was pretty bummed to have missed the haskell tutorial this year. The one last year was so-so and you can't beat one of the designers speaking about his creation. I was delighted to discover today that the tutorial is available on-line. With a link to the handouts. Hard to beat.

Wednesday, August 1, 2007

django messages

I was a little curious how messaging worked in django (those little messages that pop up at the top of a page after you create an object for instance), it seemed a little magical to me so I went hunting. Here's what I found:

- messages are bound up with a logged in user. they actually have their own class: django.contrib.auth.models.Message with a FK to users.

- messages get added to the user directly: (e.g. this was taken from
request.user.message_set.create(message=ugettext("The %(verbose_name)s was created successfully.") % {"verbose_name": model._meta.verbose_name})

- the very next time a page is rendered "messages" will be available as a variable in the template. use it or lose it. it will be consumed whether you display it or not.

- part of the "magic" (to me) was where this was coming from. global_settings.TEMPLATE_CONTEXT_PROCESSORS has 'django.core.context_processors.auth'

- when RequestContext is instantiated for a request to be used in a template it loops over the items in TEMPLATE_CONTEXT_PROCESSORS one of which is the function auth from above which returns a dictionary of 'user', 'messages', 'perms'

Not so magical now, but interesting.