November 29, 2009

Recyclists of SF

San Francisco - nexus for the industries of silicon and logic, erstwhile hub for countless wide-eyed Flower Children and their pharmacopoeia of psychedelics, and home to the most efficient army of hunter-gatherer recyclers known to mankind. These scavengers rove about the city filling carts of all descriptions with aluminum, plastic, and glass gold, pausing only to swig the last dregs of partially re-fermented beer from that hastily-discarded PBR. There's a lesson in here somewhere about economics: by raising its bottle deposits to the point where serial bottle-returning becomes a decent source of quick cash, California has effectively crowd-sourced recycling. As a result, they're able to post 74% recycling of beverage containers.

(I can hear the Hounds howling - this wealth-redistribution racket is straight-up capital-C Communism, a conspiracy perpetrated by Obama and his sleeper-agent terrorist-Jew-Illuminati cohort ever since the Dark Time of Marx to pave the way for such unimaginable horrors as public health care and tighter bank regulations!)

The bottle deposit is an effective tax on laziness, which is perfectly fine by me. After all, it's a fair bet that even if we taxed the beverage companies for making these containers in the first place, polluter-pays style, we'd end up paying this portion anyways (unless, in accounting for the total cost of production, that can of Coke became prohibitively expensive...)

November 26, 2009

Fear and Loathing in Philadelphia

6:00 am. There is something brutal and savage about stepping off a red-eye flight into the flickering fluorescent wash at Philadelphia to the tune of stock classical music, like a low-budget stage production of Clockwork Orange - any second now, I fear, my generally unorthodox wardrobe will spark senseless violence and mayhem. Then again, anyone voluntarily leaving California - especially as we begin this inevitable march towards Winter - is clearly expecting a rude shock to the system. Cats meow from somewhere in the open-concept holding cell known as The Waiting Area; before my sleep-deprived sensory apparatus has time to square this with the whole airport thing, a woman starts jerkily dancing along with the classical fare over out front of Gate B-13. There is a scent of rank feral desperation about the place, augmented by the ringtone interjections of crudely-produced hip-hop. The double shot of bourbon back in SFO has long worn off, leaving me woefully unequipped to handle the sort of ultraviolence that is surely headed my way. I hear they still have Public Lynchings in those pleasant atavistic backwaters of this fine country, and I can certainly muster enough blasphemy to make the ticket...

God Jesus! It seems the spirit of Hunter S. Thompson has crept into my brain, a direct frontal assault from the pages of my newly-finished copy of Fear and Loathing: On the Campaign Trail '72. If you would claim to understand the intricate meanderings of politics, read this book - a better account of the haphazard chaos behind your average televised presidential campaign has never been given. No major newspaper could print this with a straight face without immediately forcing the termination of half their editorial staff, with the heads to be mailed to Washington for public display...and it seems my connecting flight is boarding, judging by the impatient queue slowly lurching towards the open gate. More to follow...

November 21, 2009

In San Francisco, Startup == Pub

Any event where you wake up the next morning with two free shirts, a deck of cards, a jar of bubble soap, a stack of business cards, and a video of yourself ziplining across an office hallway is a resounding success. Enter Startup Crawl, an open house on some of San Francisco's hottest startups. It's part pub crawl, part power-speed-networking, part tech-speak geekout session, and 100% SF-style general hilarity. Where else can some lowly Canadian undergrads walk in off the street - in jeans and T-shirts, no less - and end up throwing back Don Julio with the CEO over talk about scalability and the startup life within the half hour? Where else can you climb out a window to have rooftop beers with high-wired entrepreneurs preparing for next morning's Y Combinator pitch? The list of such meritocratic hedonist enclaves is short indeed.

This event deserves to be ported elsewhere - where's the beef, Waterloo?

November 20, 2009

Mean Streets of Silicon Valley

Mean/variance calculation is ridiculously commonplace in data analysis, yet most programmers have never seen this gem from TAoCP:

def online_mean_and_variance(data):
    n, mu, s2 = 0, 0, 0
    for x in data:
        n += 1
        delta = x - mu
        mu += delta/n
        s2 += delta*(x - mu)
    if n > 1:
        yield (mu, s2/(n-1))

Unlike the standard two-pass algorithm, this one is online; it also happens to be more stable.
If that's not enough, I've given it to you here as a Python generator. Enjoy!