James Tauber's Blog 2008/02
Google Summer of Code 2008
Well, the Google Summer of Code is on again and the Python Software Foundation have asked me to coordinate for the second year (mustn't have screwed up enough last year :-)
It's early days (the organizations involved haven't even been picked yet) but if you are interested in participating in a Python project, either as a mentor or student, you should check out both the official Google page and the SummerOfCode page on the Python wiki.
You should also join the soc2008-general mailing list.
by James Tauber : Created on Feb. 27, 2008 : Last modified Feb. 27, 2008 : Categories python summer_of_code : 0 comments (permalink)
Another Dictionary Trick
Continuing on from my previous post about python dictionaries.
Imagine you're using a defaultdict to count objects. That is, you set up like this:
from collections import defaultdict counts = defaultdict(int)
and then have a bunch of these for different keys:
counts[key] += 1
Now say you want a list of all the objects in order of their count, like I did earlier this morning. My first intuition was to use
sorted(counts, key=lambda i: counts[i])
which then got me wondering if there was a way to create a function that gets an item from dictionary without using lambda—much the same way as the operator module can be used instead of lambdas in many cases.
Then I had a doh! moment. Of course there's a function that gets an item from a dictionary: the get method. And so the above can be rewritten:
sorted(counts, key=counts.get)
by James Tauber : Created on Feb. 27, 2008 : Last modified Feb. 27, 2008 : Categories python : 3 comments (permalink)
Evolution of Default Dictionaries in Python
I write a lot of code where I use a dictionary of sets (or lists or counters, etc)
Method 1
dict_set = {}
if key not in dict_set:
dict_set[key] = set()
dict_set[key].add(item)
Method 2
dict_set = {}
dict_set.setdefault(key, set()).add(item)
Method 3
from collections import defaultdict dict_set = defaultdict(set) dict_set[key].add(item)
setdefault was added in Python 2.0 and I've been using (and loving) it for years.
It was only a month or two ago that I discovered collections.defaultdict. Now I use it almost every day.
UPDATE: I forgot to mention that defaultdict was added in Python 2.5. And owing to the fact that int() returns 0 you can use defaultdict(int) for a dictionary of counters.
by James Tauber : Created on Feb. 27, 2008 : Last modified Feb. 27, 2008 : Categories python : 9 comments (permalink)
Time Machine Isn't What It Used to Be
Yesterday, after a mammoth session importing and organizing photos in Aperture 2, Time Machine informed me that the backup drive was full.
That didn't bother me—it was inevitable—but what did disturb me was the rest of the message. It told me that the earliest backup was now February 18th. In other words, it had eliminated everything from November 19th thru February 17th.
I knew what the behaviour would be when the disk filled up but I didn't expect it to eliminate so much in one go.
I suspect that I would be more likely to want to find stuff from November to February than in the last week although maybe I'm thinking of Time Machine too much as version control rather than backup. Still, I would have preferred it to sacrifice more recent backups rather than eliminate the oldest stuff.
There is an option "Warn when old backups are deleted" in System Preferences which was checked but I'm not sure if that means "tell me when old backups have been deleted" or "tell me when old backups are about to be deleted". My recollection of the message yesterday was that it had already done the deed and there wasn't anything I could have done about it.
Either way, I wish the behaviour in this scenario had been different.
by James Tauber : Created on Feb. 24, 2008 : Last modified Feb. 24, 2008 : Categories os_x : 2 comments (permalink)
Script Breakdown
This weekend, I'm trying to finish an initial breakdown of the script for In the Light of Day. As a preliminary step to scheduling and budgeting, a script breakdown means going through the script and identifying the locations, characters, props, etc, for each scene.
Because the script jumps around a bit, I'm actually distinguishing a scene as written in the script from a "story scene". I'm calling it a story scene if it's a single sequence of action in one location, even if it's non-contiguous in the script. The important point being that we almost certainly want to film a story scene in one go for continuity.
So the main relationships I'm dealing with are the many-to-one from script scene to story scene and the many-to-one from story scene to story location. (Again, I say "story location" because the same physical location may act for multiple locations in the story and I'm just focused on the locations in the story at this stage.)
Once that's done, the many-to-many relationship between characters and scenes can be added. And then from this, we can see who is needed in what locations for how long. And thus begins the process of scheduling (which I'll talk about when we get to it)
I have 98 script scenes and will report shortly on how many story scenes and story locations that corresponds to.
Incidentally, I'm doing all this in a home-grown Django app I'm building as I go along. Mostly just working in the admin console at the moment.
UPDATE (2008-02-17): After an initial pass, there are 75 story scenes and 24 story locations.
by James Tauber : Created on Feb. 16, 2008 : Last modified Feb. 17, 2008 : Categories django filmmaking in_the_light_of_day : 0 comments (permalink)
A New Kind of Graded Reader
Back in 2004, I talked about algorithms for optimal vocabulary ordering. Then in 2006, I talked about using this and other techniques in teaching New Testament Greek (which I've resumed doing with this method, btw)
Earlier this year at BibleTech:2008 I briefly touched on my graded reader approach. It generated a lot of interest so I decided to record a separate presentation at home this weekend, explaining some of the ideas behind the graded reader.
After multiple failed attempts to upload it to Google Video, it's now on YouTube and embedded below. Sound was recorded and mixed in Logic Pro and then synchronized with a presentation in Keynote and output as Quicktime.
Running time is just shy of 9 minutes.
UPDATE 2008-03-22: I have started a mailing list at http://groups.google.com/group/graded-reader and also I plan to make my code available at http://code.google.com/p/graded-reader/
by James Tauber : Created on Feb. 10, 2008 : Last modified March 22, 2008 : Categories linguistics speaking language_learning new_testament_greek graded_reader : 9 comments (permalink)
JMW's Strange Meeting With Romeo and Juliet
Back in the late 1980s there was a new music group in Perth called EVOS. In my final year of high school, I was involved with the EVOS Youth Ensemble as their youngest composer. I had an opportunity to have one of my pieces performed on the national classical radio station ABC FM during New Music Week when EVOS put on a concert featuring young Perth composers and performers.
One of the pieces performed that night was not composed by a local but by an obscure contemporary Hungarian composer, István Márta, that the leader of EVOS had met while studying in Hungary. The piece was entitled "JMW's Strange Meeting With Romeo and Juliet".
It was a playful piece, part minimalist, part neo-classical, part fugue with awesome time signature changes and scored for piano or harpsichord and 5 unspecified instruments. A New York Times review of the piece from the same time period described it as "a light, appealingly textured Minimalist interlude."
At various times during the last 17 years, I've wondered about getting hold of the score. About six months ago, I started looking online again and couldn't find it on any of the usual sheet music sites. I did see it on one sheet music distributor's catalogue but they didn't have any online ordering so I wrote to them. They told me they could order it especially from Hungary for me.
I'd given up on receiving it when yesterday, a package arrived containing the score. Just reading it brought back a flood of memories. But then last night, I realised about 80% of it in Logic Pro, pretty much using the instrumentation I remembered from the EVOS concert: piano, clarinet, sax, bass guitar.
When I'm finished, I'll put up an MP3 of it. I might also do a more electronic realisation of it (I'm thinking harpsichord + Moog).
UPDATE (2008-02-10): Here's an MP3 of my first realisation: piano, flute, soprano sax, clarinet, bassoon, acoustic guitar, bass guitar and percussion. Enjoy!
by James Tauber : Created on Feb. 7, 2008 : Last modified Feb. 10, 2008 : Categories music : 1 comment (permalink)
Django Collaborator Wanted
Just on the off-chance I find the right match amongst the readers of this blog...
So here's the deal: I'd really like a django developer to collaborate with on Quisition, habitualist and/or one or two other sites I haven't announced yet. This isn't a paid gig (yet!), I'm looking for a partner or two. Also, and maybe this will make it more interesting for some of you: I want to make large parts of all my sites into generic open source django apps so you could view this as mostly contributing to a set of open source projects, but ones that are directed toward the needs of specific websites.
Other technologies involved are jQuery and PostgreSQL (and obviously Javascript, SQL, CSS and Python in general).
Being local (i.e. Boston area) would be preferred as I'd love time face-to-face but I'm open to remote collaboration. If we already know each other, that makes it a much easier decision.
Email me if you're interested in discussing more.
by James Tauber : Created on Feb. 5, 2008 : Last modified Feb. 5, 2008 : Categories django quisition : 1 comment (permalink)
Usavich
(via Ned Batchelder)
Usavich has to be just about the strangest thing I've ever seen. And yet I'm addicted.
I can't summarize this minute-or-two-per-episode Japanese cartoon any better than Ned does:
two rabbits are imprisoned in Russian jail. One is dumb and gentle, the other is placid unless provoked, and then he becomes ultraviolent. There's also a transvestite chick and a frog, and there's no dialog.
The first episode is weird. And it gets weirder after that.
The animation technique is fascinating, mostly 2D (in a style resembling a children's book) but with the occasional shift (especially in the second season) into the third.
And the series involves the most bizarre use of Bach's Jesu, Joy of Man's Desiring I've ever heard.
Also check out the Wikipedia page on Usavich.
by James Tauber : Created on Feb. 4, 2008 : Last modified Feb. 4, 2008 : 0 comments (permalink)