Rewrote this algorithm to be O(nlogn), and it’s oh-so-functional. The tail recursion and case statements were perfectly natural. I’m a convert– I think my next webapp backend will be in Scala.
def fastConvexHull(points: List[Point2D]) = {
def ensureConvex(hull: List[Point2D]): List[Point2D] = {
if (hull.length > 2) {
val lastThreePoints: List[Point2D] = Utility2D.lastThree(hull);
if (Utility2D.isRightTurn(lastThreePoints(0), lastThreePoints(1), lastThreePoints(2)))
return ensureConvex(Utility2D.dropNextToLast(hull))
}
return hull;
}
def nextIter(remainingPoints: List[Point2D], hull: List[Point2D]): List[Point2D] = {
remainingPoints match {
case point :: rest => nextIter(rest, ensureConvex(hull ::: point :: Nil))
case Nil => hull
}
}
def hullHalf(points: List[Point2D]): List[Point2D] = {
nextIter(points.tail.tail, points(0) :: points(1) :: Nil);
}
drawLine(hullHalf(points))
drawLine(hullHalf(points.reverse))
}
I’ve decided to forreals learn Scala and forreals learn some computational geometry (I’ve been faking it at my job for a year now). I’m using Processing to draw pixels to the screen, and it turns out to be amazingly easy to access the Java library from Scala. My first algorithm was the naive implementation of convex hull generation (given a set of points, draw the tightest convex polygon possible that contains all points). This implementation runs in O(n^2) but I plan to reimplement it using the O(nlogn) algorithm that’s only slightly more complex.
I think graphics is an interesting example of combining functional and imperative aspects of Scala. The program is all about the side effect of putting pixels on the screen, but functional tools help me get there. Check out this method I used for testing:
def drawLine(pts: List[Point2D]): Unit = {
def drawLines(p1: Point2D, p2: Point2D) : Point2D = { line(p1.x, p1.y, p2.x, p2.y); p2 }
pts.reduceLeft(drawLines);
}
This is a little hacky but, in my opinion, fairly elegant. Reduce does the work of giving me consecutive pairs and then I use line() to draw to the screen.
I’ve put up all the code here.
This video more completely captures the aesthetic I am interested in than anything I have seen in a while. Original hi-res here, which is recommended.
Niksawe: it’s like
N: 30% of your peeps…are still here….
N: unless you never had peeps….
N: maybe you just stood outside the French House on Cafe Nights
N: and hoped for the best
N: regardless, I am not RSVPing to meet you at the Zen Buddha Lounge
jasonpjason: hahaha
j: you will be missed there mr sawe
j: hemingway had his six word stories
j: we could come up with some six word doucheries
j: “outside french house, hoping for best”
Found a cool app that fills a need that’s been around forever. Quassel is a distributed IRC client– it consists of both a core running on some server somewhere that actually connects to IRC servers and clients that connect to the core. The core is connected even when no clients are, so you can toss a core on a shell somewhere and connect to it at will, but your client looks connected all the time.
Quassel does a few things right– it’s a “cloud” service, but without the need to put all your eggs in one basket. It works well, it’s light-weight, and does just one thing. The fact that you control both the cloud component and the local component means it will keep Stallman happy when he says “keep your data at home”.
It sucks at a few things, too, though. The worst thing is that is an application, not a platform. You are stuck using the Quassel client, which blows. It’s not much worse than any other horrible OS X IRC client, but it is bad. It is open source so maybe one could improve the client, but it should be useable with any local IRC client instead. There’s no reason to reinvent the wheel.
This is one direction I would love to see “cloud computing” go. Connected components, some in the cloud and some at home, but all of them under your control. I’m willing to give my data to Google when it is the most convenient thing to do, but I would sure as hell prefer not to given any alternative.
p.s. Can we call it anything but “cloud computing”? Talking about technology in the “cloud” makes me feel like this guy:

It occurred to me this morning that I love Facebook’s “Like” feature. It’s neat enough to actually make me login to Facebook (usually I just rely on my mobile for FB notifications). Saying you “Like” a newsfeed item is supercheap in every way, but still gets the point across that a friend was in your thoughts at that moment and that you care about what they had to say. It’s enough to start a conversation with, but it’s also fine to just leave it as it is. It’s stress-free. And it’s much, much less sketchy than a Poke.
The lack of hassle required to Like something made me think of other low-cost yet worthwhile interactions. When I was hollerin’ at the Media Lab I saw Blossom, a minimal interaction by Sajid Sadi. Two electronic flowers are linked over IP and can communicate at any distance; when a user picks one up, the other glows wherever it is. There’s no content to the message– just the fact of a thought.
On a related noted, the most common romantic-type txt is “just thinking of you”.
These are all ways we are working towards the much FUDded End of Alone.
Apparently there is a serious market for Obama campaign buttons, in a gotta catch ‘em all kind of way. Such a market, in fact, that a pirated button bearing the logo of a very small organization that never actually printed a button will sell for $37 on eBay.
iTunes has been pissing me off lately– when you download the HD version of something it forces you to download the SD version also to play on an iPod. There is no getting around this other than to let it download. It’s also getting slow and clunky and I’m done buying video episodes off of it.
I tried using an app called ted to automatically download torrents, but it needed constant tinkering and ultimately wasn’t worth the hassle. So yesterday between 9:01am and 9:11am I hacked out a python script to fetch me the Daily Show and Colbert Report off of mininova. To use the script you need python and a torrent client that can watch a directory for incoming torrents; I use Transmission.
To use the script, download it and edit it to put torrents where you want them. Configure your client to watch the same directory, and run the script. I recommend you schedule the script to run every morning using launchd. Notice that the script has no error handling whatsoever and might totally not work for you. It’s worked the past two days for me, so, you know, it works on my machine.
My friend Ben and I built this webapp, pleasexpla.in, during our first organized hack day in Seattle. With pleasexpla.in, a user creates a discussion and can share it with others via its URL on twitter/facebook/reader, etc. You can also subscribe to a conversation in RSS. Ideally, I see this as enabling conversations in places where they can be difficult at present– inside of an RSS reader or on twitter for anything that doesn’t fit in 140 characters.
We’re hacking on it a bit in our nonexistent spare time, so we’ll see where it goes.
laotralamisma Laughing at myself for running around getting the apartment clean and the laundry done before He gets home. Maybe I should vacuum too.
ehagen @laotralsmisma are you getting ready for the rapture? Your capitalized He must mean Jesus is coming soon
jasonpjason @ehagen @laotralamisma Jesus probably cares more about the cleanliness of your soul than of your carpet.
ehagen @Jasonpjason @laotralsmisma I hear he has a pocket full of horses and fucks the shit out of bears
laotralamisma @ehagen My GoodHousewifing Magazine says that ladies should always refer to their domestic partners in the Capital.
laotralamisma @jasonpjason @ehagen It also says to just be still and let him finish- any idea what that means?
cbfx @laotralamisma evidently, they don’t. Lucky for you, I do. It means don’t move until he’s done giving you that barbershop-close shave.
ehagen @laotralsmisma it means “he’s coming, he’s coming, he’s coming.” … George Washington that is!
Twitter started as a microblogging platform for publishing short statements that others would read not necessarily realtime. The concept of @replies was not even a feature, it was just a habit created entirely by the community to make conversation easier.
Microblogging is boring, and I don’t actually care what you are doing except in the rare cases that it is funny or otherwise entertaining. If you are always answering the question “what are you doing?” when you use twitter, you are doing it wrong. Twitter doesn’t actually become interesting or useful until there are shared conversations going on.
jasonpjason 40+ woman next to me is checking facebook on her blackberry. this is the best of all possible centuries.
cbfx @jasonpjason why are 40 or more women next to _you_? Jk, woulda been cool if you said “women” but you didn’t and botched my joke.
laotralamismaмебели @cbfx lol- I had been thinking ‘that’s a lot of blackberries’. =]
ehagen @cbfx @jasonpjason I think he means age 40+. GG
jasonpjason @ehagen et al, you’re all right, I meant 40+ 40+ women
cbfx @ehagen god damnit. @laotralamisma we think and probably move alike. You enjoy the tango? VAMANOS A BAILAR!
laotralamisma @ehagen @jasonpjason @cbfx I like this conversation. Let’s hang out.
From an article in the New Yorker last week about the history of the Village Voice:
Nichols and May specialized in the language of received wisdom: they improvised on the way people talk when they think that they are sounding smart or hip or just impressively reasonable. This was Feiffer’s specialty, too. His strips are almost always the same: people who are trying to talk their way through or around something, and en up ensnarled in their own discourse, because the discourse is not, in fact, their own. Feiffer’s strips are about borrowed ways of talking, about the lack of fit between people and words, and the way that clichés take over.
Reminds me of everyone’s favorite webcomic, no?
For undisclosed reasons I recently had cause to collect everything of any note I’ve ever worked on into one central place– this site. Follow the projects link on the sidebar for an informal tour of everything worthwhile I’ve ever worked on, ever. Sometimes I look at it and I’m pretty pleased, but mostly I keep thinking why am I not filthy rich and retired yet? Maybe one of my projects will have a, what’s it called? Oh yeah, a business model someday.
I’ve known this forever, but I never really thought about how strange this is, and why it is strange. Print papers might have dating ads, right? And The Onion is actually a paper weekly in a few cities in the US, but its dating site is national. It’s definitely an online endeavour in my mind, so it strikes me as incredibly odd that this content site spawned a dating network. Weird.

I strangely don’t hate this meme.
This woman sits outside the ice cream shop below my apartment most nights, and rarely asks for anything. Like a hybrid from BSG, she talks constantly about things beyond sense. The best thing is she wears this light pink sequined top that is awesome.
Havana has all of a $5 cover, but why pay when the whole street is your dance floor? He will routinely stand right outside a window and dance to the music that bleeds through. I recently wanted to go dance with him, but Annie nixed the idea.
“Save the lies for your dad or for her,” he yells and gestures to Corey. This guy got me thinking a lot about how important politeness and saving face are in our society. I usually have cash on me, but I prefer to say “Don’t have any” when people ask me for change. The alternative would be “Listen, I’m not stupid, I know that it is impossible to go hungry on the streets of Seattle and you’re going to spend this money on drugs.” In the end I think this is okay behavior, just a fully-acknowledged white lie like the many others we tell (”I have to wash my hair”). But props to this hobo for inciting this thought.
Benny is Fremont’s chief hobo. Any given night of the week, he will gather huge stones and stack them five feet high. There isn’t anything special about these rocks and there’s no trick to it, just mad concentration and some sort of Hinduism he subscribes to. He also yells at passersby sometimes, though usually just bros who fuck with him and he says nice things to me (he digs my ’stargyle’ hoodie). He’s pretty much an institution around here and everyone knows his work.
This is my favorite hobo in a sincere way; no snark about it. He sells those hobo newspapers in front of the grocery store below me, and I buy one every week. He lives in a rehab center of some kind getting help, and selling the paper is part of his program. He talks to everyone on the street and is mad cheerful. I’m pretty sure that there are days there he is the only human I interact with in person, which probably says more about me than him.
|
I just got back from Japan where I went to Tokyo and Kyoto with Emily and George. That place is just insane. Short form of some highlights:
Sam and I are blagging again over at nomoreshittythings. We’re going for 3 posts a week instead of one a day now to be more sustainable. Do check it out.
After Obama’s victory speech I went down to 1st and Pine outside the Showbox with Ben and Talia, and it was amazing. A decent-sized crowd marched from there down to Pioneer Square, chanting and dancing and playing music the whole way.
www.flickr.com
|
And then on Saturday I attended the local march for civil rights and marriage equality.
www.flickr.com
|
I came across the need to compare two XML trees for equality in unit tests I’m writing for a project you’ll hopefully hear about soon. I started to write a tree-walking comparer then thought I’d google around to see if anyone had done this for me. simplexmldiff is a clever script that just reads in two XML docs, pretty prints them, and then diffs their output. Brilliant. It isn’t perfectly accurate due to whitespace, but I don’t care about that for this project. I reimplemented what I needed of it in 4 lines of python. hellah.
I spent all the bus rides of the last two months of my life reading David Foster Wallace’s 1000-page epic Infinite Jest, and I just finished last weekend. It was a great experience reading the book and it is a phenomenal piece of literature. I was cnstantly impressed by how approachable it was; like most Stanford grads, I am forever 150 pages into Thomas Pynchon’s Gravity’s Rainbow, but I had no trouble reading Wallace beyond the sheer volume of it. It did inspire me to buy the WordBook app for my iPhone, though. That app is sweet.
John and I have talked a bit about how oddly predictive the novel is, though it is not really trying to be any kind of science fiction story. Particularly interesting is a several page spew about the (future) history of videoconferencing technology. The short version of it is that (1) the bandwidth and devices for vc become as ubiquitous as the telephone, (2) vc becomes all the rage, (3) people start to notice that vc does not have the anonymizing qualities of voice communication; a vc’er cannot be doodling, doing a crossword, watching TV, etc while engaged in vc’ing; a vc’er has to worry about his appearance, so (4) first devices and then software come out that alter and improve the appearance of people vc’ing, (5) these devices progress to the point that the vc image of a person is almost completely replaced with lifelike avatars of people in a state of appearance so pristine that it bears no resemblance to the actual user of the technology. (6) Everyone gets sick of this silly state of affairs and vc is obsolesced by good old voice communication. Back in the real world, we are basically at stage (1) right now and vc has not yet taken off the way 2001 told us it would. Upon reading this history, it is obvious that videoconferening sucks big ones and I don’t want it (though I must admit I have some interest in developing the software in (5)). John posted an excerpt of this section.
The novel also predicted the end of broadcast TV, something I am very committed to. I have yet to regularly watch broadcast TV since I started college, and the rest of the world has finally caught up with me; I can watch what I want on hulu or iTunes even more easily than I used to pirate it. Broadcast TV’s days are certainly numbered. A prediction that no one seems to have made, though, is the coming demise of physical media. Apple deprecated the floppy drive before anyone else (to much criticism) and is now deprecating the CD/DVD, or trying to. Netflix soft-launched its Silverlight streaming player recently and put tens of thousands of films online, and one must suspect that the days are numbered for the somewhat silly business of sending people movies through the mail. In Infinite Jest, most entertainment is consumed through HD casette tapes; soon most entertainment will be streamed to your computer or XBox or, least likely, some dedicated set-top box.
These details are not at all the main thrust of this great work, but I wanted to mention them because they’re things I think about a good deal. Also, I recently read Rolling Stone’s story on Wallace’s demons. It’s an interesting read, and really reminds you that depression is a tragic disease like any other.
After running for two months, it’s almost time to finish up with TravelForChange. It’s been more successful than we ever expected, and I feel that we really made a difference– nearly 300 campaigners were sponsored by around 150 sponsors. Conventional wisdom says 1 in 14 people are persuaded by personal contact with a campaigner, and a campaigner can talk to such and such people in that timespan. Do some math and I’m sure it’ll turn out that TFC touched tens of thousands of people in states where every vote is critical.
I’d like to thank everyone who worked on the project: Alisa Whitfield, Brian Park, Justine Seidenfeld. Mesa Schumacher, and Devin Sok. And I’d like to thank all of the volunteers who did the real important work. And I’d especially like to thank all the sponsors, and I’d also like to especially thank Alisa for having the great idea and really running the operation and Brian for writing so much of the code for the site.
You can read about TFC in some press-like publications; we were covered by the SF Chronicle, panned by Dan Savage, and mentioned in Wonkette.
Thanks again to everyone involved in the project! Now all that remains is to WIN!