wintermute :: bits
April2007
You are currently viewing bits entries by month. You can browse through months by time, or click on a directLink or category to switch to individual entries.
« March2007 :: May2007 »
This is one reason so many long-time Unix nerds have found themselves so happy using Mac OS X
24April2007
[directLink]
[links]
This item was changed on 24April2007
Read this comment in a footnote over on John Gruber’s latest epic, about every Mac user’s new favourite web dev environment, Coda.
In terms of historical user interface traditions and conventions, Unix and the Mac could hardly be more different, but there is one similar philosophy shared by both cultures – a preference for using a collection of smaller, dedicated tools that work well together rather than using monolithic do-it-all apps.
Thought, at first, Well duh… But it occurs to me that not everyone realises this. The image of Apple and of OS X is of this monolith - you use everything Apple provides. And sure, Apple’s integration is one of its strongest selling points. But what I love about OS X is that I can plug in whatever little unix tool I feel like using.
Meanwhile, Jeff Croft asks that everyone “just chill out a minute”. His own problem with Coda is that it’s missing SVN integration, and part of me wants to agree (Coda seems to assume that you use FTP).
But my problem, I think, is the very idea that you can arbitrarily select the tools that I’m going to use and bundle them all together in one app. I actually like being able to collect my tools myself - makes it easier to switch, eg, to a different text editor. Gruber touches on this in that he suggests that Coda’s strength is the interface (“Coda groups and visually organizes these disparate elements by project, rather than by app.”) But still, I tend to only work on a single project at a time, and deliberately strip my collection of open Apps back - so I’m effectively using my entire desktop to do what Coda’s designed to do. (And that’s where the Desk metaphor really works - if I’m working on a project, I clear my desk, get out the tools I want to use, &c)
Personally, I’m currently using:
- TextWrangler, the free version of BBEdit, and more than enough for me
- A combination of Quicksilver and Markdown (I just hit Command-Shift-M, paste in my latest bits entry in plain text, and it gets converted into HTML)
- Terminal, SSH and SVN; I have a central repository on Dreamhost from where I check out the Django source to this website (to here and to my test server at home, plus to work when I feel like hacking on my lunch break)
Photos with location clouds
23April2007 [directLink] [personal]
Just finished work on a nice little cloud thing for my photos/locations/ page. I’ve been slowly leaking bits of the locations stuff online, tweaking it as I go. It’s at a cool place now so I figure I can draw attention to it. Click through there and you’ll get two different tag clouds - one for countries (by their three-letter IPTC code) and one for cities. The idea with such clouds is that the size of the words changes to reflect the number of objects - in this case I’ve taken the most photos in France and England, and by city, in Reims and Paris.
Whether you’re viewing a country or a city, you’ll get a paged set of photos (10 to a page, thanks to Django’s ridiculously easy from django.core.paginator import ObjectPaginator). And all the URLs are hackable, so you can work your way back up the chain (remove the city part to get the country, eg). Plus each country view has another cloud for just its cities.
This is why I took my time setting up the photos app properly - ‘cause once you’ve got metadata to work with, there’s no limit where you can take it… This gives me lots of opportunity to experiment.
Now ETagging Right!
17April2007
[directLink]
[webprog]
This item was changed on 17April2007
Am now handling etags right! Django already takes care of the messy business - caching generated views and sending the appropriate etags, so if a view doesn’t change, the browser shouldn’t have to download it again.
macosxpeter:~ peter$ wget -S http://wintermute.com.au/
--19:44:57-- http://wintermute.com.au/
=> `index.html'
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Content-Length: 21112
ETag: 3290c8e891866e8b1b0884e3a3820b7e
Content-Type: text/html; charset=utf-8
Length: 21,112 (21K) [text/html]
macosxpeter:~ peter$ wget -S --header='If-None-Match: 3290c8e891866e8b1b0884e3a3820b7e' http://wintermute.com.au/
--19:45:53-- http://wintermute.com.au/
=> `index.html.1'
HTTP request sent, awaiting response...
HTTP/1.1 304 NOT MODIFIED
Content-Type: text/html; charset=utf-8
19:45:54 ERROR 304: NOT MODIFIED.
But the etags weren’t doing anything before, as I was generating random references to the banner image and to album photos on every load, so the view would change. I’ve now written a handy little ‘randoms’ app instead. Now the html for each page doesn’t change - it just points to /random/banner.jpg and to, eg, /random/photo.jpg?1 through ?4. Those point to ordinary django views that deliver the contents of a random banner or photo. So the etag on those image references will change, but not on all the html pages, and that should make a real difference, as there’s rarely much real change on most of the pages round this site…
The Django code, for anyone interested
Create a django app in the usual manner; this one is called randoms (I tried random until I realised it kept conflicting with the standard Python library random); you can lose the models.py file as this just pulls in other models…
Note that my setup differs from the usual advised by Django’s docs, in that I have the folder where all my apps sit on the Python path. What this basically means is that I don’t have to keep putting my_project. before all my app calls, as hey, that violates DRY (though, true, it would’ve let me call the app random, so I’m not going to argue this point). So if you’re using the default setup, remember to drop a my_project. into a bunch of the imports.
And of course, after creating the randoms app, you’ll want to include it in your INSTALLED_APPS, and include this line in your project’s urls module:
(r'^random/', include('randoms.urls')),
urls.py:
from django.conf.urls.defaults import *
urlpatterns = patterns('randoms.views',
(r'^banner.jpg$', 'banner'),
(r'^album-(?P<album_id>\d+).jpg$', 'album'),
(r'^photo.jpg$', 'photo'),
)
views.py:
from django.conf import settings
from django.http import HttpResponse
import os, random
from photos.models import Photo,Album
def banner(request):
#return a random from the banners folder
banner_path = settings.MEDIA_ROOT + 'banners'
dir_list = os.listdir(banner_path)
file_list = []
for file in dir_list:
index = file.rindex(".")
if(file[index:] == '.jpg'):
file_list.extend([file])
rand = random.choice(file_list)
return HttpResponse(open(banner_path + '/' + rand,'rb',0).read(),'image/jpeg')
def album(request,album_id):
#return a random thumb from the given album
photos = Album(album_id).photos.values('filename')
photo = random.choice(photos)['filename']
photo_path = settings.PHOTO_ROOT + 'thumbs/' + photo
return HttpResponse(open(photo_path,'rb',0).read(), 'image/jpeg')
def photo(request):
#return a random thumb
photos = Photo.objects.values('filename')
photo = random.choice(photos)['filename']
photo_path = settings.PHOTO_ROOT + 'thumbs/' + photo
return HttpResponse(open(photo_path,'rb',0).read(), 'image/jpeg')
I’ve got a lot in here; obviously you can pick and choose between the various views, but there are probably a few useful bits in here.
def banner:
This view, called with /random/banner.jpg, returns the contents of a random image stored in a path of your choosing; I just created a banners folder under the MEDIA_ROOT, though it could easily live outside the webroot. It loops through the folder, looking for .jpgs, picks one at random, reads it in (open(path).read()) and outputs it… Django’s HttpResponse is usefully flexible, passing 'image/jpeg' to it means it’ll serve the response up with the appropriate mimetype (so the browser has no way of knowing the image was generated).
def album:
This one hooks into my Album model. The idea is that it returns a random image from the given album, so I call this with /random/album-N.jpg, where N is an album’s id. (I haven’t put the necessary checks in to make sure that N exists, but there may be circumstances where you’d want to do that.) This view grabs a list of files associated with the given album (photos is a ManyToManyField), and returns one at random. The only weird thing here is settings.PHOTO_ROOT, which is a setting I use on this site for my photos app - I use it because I keep a number of photo files outside of the webroot, so the MEDIA_ROOT setting wasn’t enough.
Update
Made a little tweak to make the code work on my Windows box; the open call needs a switch to tell it not to buffer ('rb',0); cf random on windows
The Roots, Live at the Enmore
14April2007 [directLink] [music]
Saw The Roots at the Enmore on Tuesday night. Was an amazing show, and far better than when I saw them at the Hordern a couple years ago. The Hordern is just a massive empty hall, while the Enmore is a theatre - a much more intimate space, and really suited to the band’s performance.
They played most of their latest two albums (Game Theory and The Tipping Point), but also a number of much older songs, which was really cool. Seeing You Got Me performed (and extended dramatically) was a really special experience - if anything can be said to have been an influence on my life, it’s that song.
True Live played before The Roots; they were very cool. An interesting little group - a cellist, a double bass, a violin, a keyboardist playing lots of synth strings, and the lead rapper. They’re talented musicians and have a really smooth sound when the lead is flowing. At one point the cellist played a solo with lots of classical sounds in it - was very cool to have a hip hop crowd bouncing along to classical. Am going to have to look these guys up.
More photos in the album.
All these photos were taken with my phone camera, so they’re rather unattractive at times; plus, strangely, the camera would occasionally decide to take the pictures really small. Does make me want to get a really good stills camera, but it’s hard to beat the convenience of having a camera in something I’m already carrying everywhere…
300
08April2007
[directLink]
[movies]
This item was changed on 08April2007
Went into 300 expecting a violent, stylish comic book movie, and was suitably entertained. The intro did probably a bit more setup than was necessary, but once it got going it was gripping to the end. It looked stunning, melded CG and live-action nearly flawlessly (there were a couple minor shots where buildings looked like models), built and unfolded well, and dropped some very cool fantastical elements in there (I loved the weird old priests and their oracle, despite the fact they could’ve done more interesting things with the actual historical priests). David Wenham’s narration takes some getting used to, but really suits the mood, and I started to see it as the text written across the top of the comic’s panels. I am curious though, as I didn’t feel it added anything to the film - it served as continuity and exposition, but I’m not sure he gave away any crucial information. The visuals were so powerful that the narration was made redundant.
I don’t want to pretend that 300 is anything more than entertainment - it at least made no pretentions to history - but I’d seen/heard some discussions of its politics, so I was kind of watching out for them. Sure, one can read almost anything into some of these things, but still - there are two (almost conflicting) stories I got from it.
The first was something that struck me prior to watching the film, and was only strengthened by some of the dialogue. There’s an inescapable feeling that you’re watching these guys defend freedom, democracy, and the foundations of western culture against a barbarian horde - Persian, no less. And these crypto-Muslims come with a combination of recognisable groups (‘whirling dervish’-like) and of devil-worship-invoking goats’ (and other antlered) heads. And though the Spartans obviously aren’t Christian, our heroes have rejected the old (pagan) gods, and talk about ‘god’ in the singular - so it’s okay for Christians to sympathise with them? And the war talk reaches its peak when the Spartan Queen addresses Congress begging them to send more troops (meanwhile troops are dying on the front lines).
And the second was throughout the film, but only hit home right at the end, when David Wenham’s narrator makes a statement about ushering in a new age of reason and banishing the old ways of mysticism. Combine that with the aforementioned rejection of the pagan gods, and the fact that Xerxes shares various epithets with God (eg, “Lord of Lords”, “Lord of Hosts”, &c) and there’s a strong anti-religion bent (in its anti-superstition variety).
So I’m left wondering who put those politics in there… Is the latter stuff there just for people who get creeped out by the former? I’ve no familiarity with Miller nor with his work, so I don’t know if it was his doing, and the guys that wrote the screenplay haven’t written much else, so I can’t really tell… In any case, it’s never a surprise when a war film glorifies war, so I’m only left curious rather than railing against it.
Edit: Oh yeah, there’s also the whole ridiculous macho versus effeminate thing going on, but that’s way too obvious.
Settling In, And A Withdrawal
02April2007 [directLink] [personal]
Well, back online, at last… Took nearly a month - most of that time was taken doing absolutely nothing, which was made all the more ridiculous at the end - once I got put on priority it took like 5 days to get completely hooked up… Problem was getting Telstra and Optus to communicate; I guess that’s something we have to put up with in a society that can’t decide if it’s socialist (where the govt control Telstra for the good of the nation) or capitalist (where Telstra do what they want to make their money)…
Being reconnected feels like the final stage of getting settled in to the new place, though the reality of having done it is barely sinking in… I’ve not really done anything dramatic, but I keep walking around utterly amazed at my surroundings. I think I love Sydney like I love Paris, which is a really good place to be in.
Has been strange though. Moving out keeps reminding me of the only other time I moved out, and I keep thinking about life in Reims. I walked up to the cathedral for mass last weekend, just as I did numerous times in Reims. Tonight, walking home from work, it was the first night I’ve noticed the darkness (DST having ended a week ago), and I found myself thinking, excitedly, Here comes winter, and with it, Christmas. Except that it’s not like that here.
Currently working on the monologue for my final video project - will have more up here soon. But for now:
“A light has been extinguished, and we see them - angels and demons walk amongst us.”
« March2007 :: May2007 »
- July2008
- April2008
- March2008
- January2008
- December2007
- November2007
- October2007
- September2007
- August2007
- July2007
- June2007
- May2007
- April2007
- March2007
- December2006
- October2006
- September2006
- August2006
- July2006
- June2006
- May2006
- April2006
- March2006
- February2006
- January2006
- December2005
- November2005
- October2005
- September2005
- August2005
- July2005
- June2005
- May2005
- April2005
- March2005
- January2005
- December2004
- November2004
- October2004
- September2004
- August2004
- July2004
- June2004
- May2004
- April2004
- March2004
- February2004






