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.

Saturday, July 28, 2007

Dear people at the firefox booth at OSCON

This is a fox. This is a red panda. I can imagine that these could be easily confused by the casual observer. While my daughter thinks the plush toy that I purchased at your booth is adorable, I feel it is my duty to point out that most if not all of the people who purchased these toys thought they were getting a fox. A firefox. I'm not planning to press this issue farther at this point, but I think it's important that you recognize this misleading maneuver and apologize publicly. Or send me another one for free for my son. :)

(OK, I've just learned that a firefox IS a red panda. But you have to admit that ALL firefox art work depicts a "normal" fox. But still I deserve another free firefox....)

Friday, July 27, 2007

Python and Data Structures

I've been really lucky finding exact matches for some of my wishes recently. For instance I decided to start working in a methodical manner to keep my CS skills strong and up to date. I've always had little fun learning projects going but I want to be more organized and consistent about it.

As a first project I was thinking of taking the Weiss algorithms and data structures in C book and do it all in python. It turns out that (a) it's really hard to write good library code from scratch. And I didn't want to spend my limited time doing that and not learning much matierial. (b) I'd rather learn from someone who knows what they are doing (e.g. well thought out pythonic code instead of my sad ports of C to python code).

The solution was: Data Structures and Algorithms with Object-Oriented Design Patterns in Python. It is so exactly what I was looking for that it's scary.

Any way if you are interested in learning or relearning OO design ideas and/or algo/data structures and you want to use python (or ruby, c#, etc) you could do a lot worse than this (family of) book(s).

OSCON notes

- One of the highlights for me was a panel discussion at Powell's Technical book store with some of the authors of the book "Beautiful Code". Besides just being interesting to put some names with faces it was really fun to see some famous programmers talk about code they found beautiful. It was sort of like watching people who have been given an opportunity to talk about how awesome their children are.

As a side note there was sort of a heated exchanged between the developers of svn and one of the lead developers of perl (chromatic). It some how surprisingly came down to an argument over whether lisp was beautiful and whether perl was like the only language that one could write the programming equivalent of Finnegan's Wake. And then something about getting tattoos with perl code. Etc. The content of the discussion was pretty interesting but just seeing that these were real people who don't necessarily think that you are awesome simply because you are an open source developer was a bit enlightening.

- I was very disappointed to that Damian Conway didn't speak this year. After first seeing his perl in klingon talk a few years ago, I've been hooked. Almost makes me want to rediscover my perl roots. Almost.

- On the other hand it was interesting to finally see Steve Yegge talk in person. His powerpoint slides crapped out but he gave pretty interesting talk on the importance of product positioning. Much more interesting than it sounds. And NBL is javascript2 if that wasn't already obvious.

- Giles Bowkett gave a rehash of his seaside presentation which is available from his web site. I was excited when he started the talk because he was actually up there going thru code, but then he fell back to his prepared talk. The talk was interesting, but was more marketing than reasoned argument for the wonders of seaside.

- I saw two talks by Simon Peyton Jones on parallelism and memory management using haskell. Here's a case where the personality of the person was a bit surprising to me. He was the most friendly and ebullient yet soft spoken and modest speaker I've seen so far at OSCON this year. Quite in contrast to haskell which makes me cry when I try to use it. But I keep trying.

- overcoming bias. I had recently discovered this web site (I think thru oreilly radar) so it was interesting so see one of the bloggers from there speak. I've been thinking alot lately about how you can detect biases in your self and other and how to systematically recognize and overcome them. So it it's pretty uncanny (to me) that there is a site about this and I got to see a talk on this. The universe is trying to tell me something....

- State of the Onion: Always interesting to hear Larry Wall speak. Once again I can't help to be intrigued by perl to hear it described, but I'm always a little horrified when I do. his talk was basically a tour of the features and concerns that a language designer must consider. it seems that perl 6 (if it is ever released) will be the kitchen sink of all kitchen sinks. Interestingly his talk was not given the focus it usually does and was just given in a well packed conference room rather than the central meeting area.

Thursday, July 26, 2007

django's newforms

I've been anxiously awaiting for a long time for the newforms documentation to show up in the on line beta of the django book. It's still not there so I took matters into my own hands and did the unthinkable: I read the documentation on the django site. I know, I know, what sort of loser reads the documentation?  Desparate times call for desperate measures friends.

Anyway I think the use and function of newforms has finally settled in my brain.  Partly because I copied someones example a few months back and got it working though I didn't thoroughly understand it.  Partly because I read thru the documentation for the 3rd time. And party because I read through the unit test code for newforms.

Any way my issue was that I was trying to clone an existing object. The breakthrough was realizing that I could call so that I could intercept the resulting model instance and set the id = None before saving it so i didn't update the original object in anyway.

I just may get the hang of this django thing one of these days...

Greetings from OSCON

I'm sitting here at geek central and I've decided it's as good a time as any to start my tech/geek/whatever blog.  So here goes.

Mostly this will be a brain dump of things I'm working on or learning and other random observations of the world.