I wasn't aware of generator expressions:
wwwlog = open("access-log")
bytecolumn = (line.rsplit(None, 1)[1] for line in wwwlog)
bytes = (int(x) for x in bytecolumn if x != '-')
print "Total", sum(bytes)
Similar to list comprehensions, but evaluated lazily. Voidspace describes it:
MoreNone of the generators are consumed until the …
The Chrome download was surprisingly fast (as in, less than 5 seconds). FireFox options import during install didn't work, but it's been smooth sailing since then. It's snappy and so far not buggy. Aesthetics of rendering web pages is good, seems better than FireFox. Quite fast too.
I remember thinking …
MoreInteresting that Google's Chrome is based on WebKit instead of the Mozilla rendering engine…
MoreJavascript inheritance is another one of those topics that always escapes my mind, so I'm recording it here for future reference.
I tried to get into Crockford's Prototypal Inheritance method but I like the plain-old prototype inheritance without the object.create better. It's entirely possible that I'm not quite getting …
MoreWhat I know about the innards automobiles I learned from a book on Wankel engines when I was 8. So when my "check engine" light turned on I knew I'd be in for a severe siphoning of money out of my pocket.
Buoyed by my strong sense of miserliness, however …
MoreI frequently run into pages with loads of images (here's one via Kedrosky, here's another, and here's yet another). Viewing these images involves a dance of scrolling or hitting space, then scrolling again to get the image lined up in the viewable part of the browser, and repeating over and …
MoreThree.
The number of programmers who will write most of the code in a system developed by a team of 24 engineers, two project managers, three group leaders, a quality lead and an office manager.
From Russ Olsen.
MoreSeveral friends have been at work on several startups and are looking for technology leaders to round out their teams. One opportunity is in the social network / eduction space and is looking for the VP Technology / CTO as well as good web/php guys. Another is more hardware related. Both …
MoreMI5 report on terrorist profiling, via Schneier. The short version: it is very difficult to come up with a valid profile.
MoreMozilla announces TraceMonkey, a just-in-time compiler for Javascript. If you've watched Steve Yegge's talk on Dynamic Languages (transcript) you've already had a taste of what the future could look like for dynamic languages - namely, performance on par with today's low level languages.
Javascript started as an ugly language but has …
MoreMike Verdon's Python Twitter Tools is less popular and findable than the Dewitt Clinton's python-twitter (I only found the former from an email on the latter's mailing list), but it's a beautiful library. 125 lines, most of which are comments. It implements the full API by implementing a single call …
MoreWatching the women's uneven bars. The announcers have spent the vast majority of the time whining and moaning Nastia's the 2nd place finish.
Now I recall earlier gymnastics events where these same announcers said starting first is a huge disadvantage and effectively penalizes the American competitor (pretty sure it was …
MoreWife is in Florida with the youngest kid, and the other two spent most of the weekend at my parents', giving me a chance to engage in plenty of bad habits. Mostly work and sleep.
It's an amazing feeling to wake up after more than 8 hours of sleep. Really …
MoreAll the cool kids are into Git these days and I've been reading plenty of articles about how good it is and how to use it. The problem is, I don't really have a problem with Subversion. I know I should, because all the cool kids do, but I just …
MoreThis is just incredible. The effects are amazing, but I'm guessing the models and tools behind what they do are going to fundamentally change the way we use video. Apparently these guys are divining a pretty good depth and color projection map from videos and photographs. With that you've added …
MoreI couple of years ago I wrote about Taste Vectors, did a bit of hacking, and not much else.
The Strands folks have launched a similar concept in OpenTaste. Worth a look, will write more if I get a chance.
Via Duke Listens!
MoreMy wife tells me no one listens to lyrics. Perhaps it's true; I found myself singing Pony Up's Matthew Modine today. It gets real interesting a few paragraphs into it.
MoreExcellent article on Simple Top-Down Parsing in Python. The nud and led business could be better explained, but the rest of the article and code is great. I learned several things I hope to employ shortly.
I'm trying to remember if we studied this in compiler class or not. I …
More