Monday, December 14, 2009

Two Decades, Two Birthdays

I'm twenty now. This will take some getting used to.

It happened en route from Bangkok, on my way home to Utah, somewhere on the flight from Kuala Lumpur and Sydney. I took in the biggest skyline Down Under for the third time in three months, chilled for a few hours, then got on a plane to San Fransisco. The sunset from the window seat six miles up was gorgeous. It also happened in 2x fast-forward, since the plane was going east almost as fast as the earth's rotation at that tropical latitude. Just three hours later instead of the usual six, it was midnight, December 13. Then we crossed the international date line, and it became my birthday again.

(True-color Earth, courtesy of NASA.)

If I could somehow go back to that other hemisphere exactly a year from now, I'd troll the stewardesses with a ridiculous legal edge case: I'd try buying a beer four times on the plane. It wouldn't work the first time, because I'd still be twenty. Then, after midnight, I could celebrate being twenty-one. Crossing the date line the other way, the date would jump back, to Dec. 11, and I'd be underage again. Finally, by the time we landed in Sydney, my legal age would change a third time.

Not that it would matter, since the drinking age Australia is 18. Cheers!

Sunday, December 6, 2009

Heading South

...we've just come full circle a second time. We started our Thailand trip in Bangkok, and after all our adventures in Chiang Mai, we passed through Bangkok again a week ago. Here we are now in Bangkok a third time, looking out across the Chao Prahya river, which is buzzing quietly with millions of mosquitoes and loudly with a handful of overpowered ferries.

We just finished an awesome trip. A side-trip, but still--we spent the week in southern Thailand, on hills, on a beach, and in no less than four caves.

The first two of these were in Petchaburi, our first stop. A place so far off the tourist trail that it was hard to find any signs in letters I could recognize, and where getting food was an exercise in sign language. The town's one attraction was that pair of caves, which had been converted into religious spaces--one was a wat, or temple, while the other was just filled with Buddha images. Both had an interesting, unexpectedly postapocalyptic feel to them, empty and surrounded with stray dogs. Hundreds of monkeys sat in the side streets as much as in the trees, scratching themselves and squawking at us. They seemed to be waiting for throngs of snack-laden tourists that didn't exist. Inside the "cave of a thousand buddhas" were two women in white robes, meditating in silence. The darker corners of the cave were filled with the guano and high-pitched chirps of lots of bats.

...the Buddhas

..and us, waiting patiently for the shutter timer.

The real Terminator vibe, however, came from the wat cave. Its entrance was halfway up a hill that rose out of the otherwise flat outskirts of Petchaburi. As we approached the hill, locals were burning trash and leaves in ditches by the side of the road. The smoke wafted up to large, but decaying facilities--a half-finished parking structure, some food stalls, and a long line of bathrooms. These buildings, like the monkeys that surrounded them, seemed to be waiting for visitors that never came. We were the exception.

Only one other person entered the cave with us--a lady, like those in the by the "thousand buddhas", dressed in white. Three dogs followed her in; they looked as though they had definitely seen better days. We followed the dogs.

Inside, the wat was lit with bare flourescent tubes. The Buddhas were beautiful, but the smell was consitent with the handful of stray animals that seemed to call the place home. Nathan and I found a side cave that was accessible only by crawling through a tunnel a few yards long. It was just big enough to stand in, and black except for the dim glow of Nathan's iPhone. It also contained two floorboards, a broom, and a piece of cloth--we're guessing that a monk spent some quality time alone there.

...then we set the iPhone flashlight to red and Ben took a really long exposure shot.

We kept walking. One of the coolest statues in the cave was a very large reclining Buddha. So Matt whipped out his headlamp and Ben did another 15-second exposure:

...every year during New Student Orientation, there's a slideshow of the wildest pictures people have taken with the word "Stanford." With a little luck, this might qualify. (Also, the way the word overlaps the Buddha a bit was unintentional.)

We walked deeper into the cave, and into the most surreal experience I've had on this trip so far. We heard someone's voice echoing from the walls, piling syllables on top of each other in a fast staccato rhythm. It was the lady who had walked into the cave in front of us, and it was clear that she wasn't saying anything in any language. She was exerting herself visibly, though, taking short sharp breaths between long stretches of sound. This was glossolalia--"speaking in tongues." I had only known it from the book Snow Crash (which, by the way, is awesome.) In real life, however, there was something seriously disconcerting about it. I watched open-mouthed for about a minute. The three unkempt dogs stared back, presumably hoping for food, but the lady was facing one of the Buddha images and never acknowledged our presence.

We left the cave and climbed to the top of the hill, which is capped with an enormous (20-ish yard tall) sitting Buddha.

...and some extreme scaffolding

The statue was under renovation, surrounded by an abandoned-looking construction site. The hilltop also had some excellent views of Petchaburi and the countryside. this one

The next day, we took the slow train to Hua Hin, through some scenic farmland. Hua Hin is only about 100 km south of Petchaburi, but in many ways the cities seem to be opposites. Hua Hin, it turned out, is a sunny beachside resort town. Once an annual destination for the Thai royal family, it is now full of Hiltons, Courtside Marriotts, and middle-aged vactioners in beach chairs. Nathan found some really good seafood.

Our last stop was lots more memorable. It was Khao Sam Roi Yot National Park, and it was almost as devoid of tourists as Petchaburi. Steep, dramatic, jungle-covered limestone peaks rose up next to a white-sand beach. We had a bunglow surrounded by palm trees.

...yes, it was this good.

That night, I walked over a short, steep path to a nearby fishing village. The boats were all ridiculously colorful. No English was spoken or written anywhere, so I just walked up to some dude who was loading fishes into a giant cooler and asked "khao lai"--"how much?", one of the five or so phrases of Thai I know. (I have the same understanding of Thai that a parrot might have if it was still in training. It worked, though, and with a bit more gesticulation and waving of Baht bills, I got some fish.) I got a few other things from two little shops. (This town was so small, it didn't even have a 7-Eleven. Those are totally ubiquitous in Thailand, kind of like McDonalds in America, and like McDonalds, you know you're really off the map when you find a place that doesn't have one.) In any case, I carried the fish back and Nathan showed me how to cook them Japanese style, encrusted in salt. We made a bonfire out of coconut shells and palm fronds.

...the fish was ridiculously delicious.

We got up the next morning to go caving again. These were a different kind of cave altogether, though--no black chambers or hair-raising utterances here. Instead, these caves were gigantic, and most of their roofs had caved in, creating two gaping sinkholes. Lots of sunlight filtered in through really tall trees reaching toward the surface. We shared the space with a couple of butterflies and a group of elementary-school kids.

We rolled back to Bankok again by the scenic route--chugging along in a German-built diesel contraption from a couple of decades ago.

...yours truly and friends

Until next time... peace!

Monday, November 23, 2009

Welcome to the Jungle

We're in Chiang Mai now, the center of northern Thailand and gateway to the madness that is the Golden Triangle jungle. We trundled in a few hours ago on a sleeper train. It smelled strongly of grease and chunked its way relatively slowly over a rough track. Nevertheless, I slept well after walking around Bangkok all of yesterday.

Tomorrow morning, we're going on a three-day jungle trek. Of all the places we've been on this trip, this is the least beaten path. According to those storytelling history bubbles in Lonely Planet, Northern Thailand only became reasonably stable in the 1980s. Before that, it was torn between Burmese, Chinese, and, during the Vietnam War, even CIA influence. It was home to a vicious drug trade, a lot of the world's opium production, and to some colorful personalities like this guy.


That's Khun Sa, the Burmese warlord who got his start with the Kuomintang, amassed a personal army big enough to have territorial feuds with the governments of Thailand and Burma, and trafficked more than 1000 tons of heroin to America. The party, it seems, has since moved to Afghanistan, and the indigenous people now cultivate rice paddies where the poppy fields used to be.

...and now

The plan is to ride some elephants, go bamboo rafting, and hang out with some hill tribes. I'll have some pictures and updates when I come back.

Monday, November 16, 2009

Thailand Ahoy's been a pretty intense month. We drove across the outback twice, racking up 8000km of desert. We broke and then (mostly) fixed the array on our solar car, then raced it across Australia--we managed to go coast to coast on just sunshine. Great success! That weather script I posted about a few weeks ago worked great, but was totally unneccesary since the entire race was cloudless and not particularly windy.

Then we went to New Zealand, a land of hippies, awesome hikes, good surf, and more than a hundred million sheep. A land with so much grass and so many timid meaty animals that steak burgers cost less than veggie burgers. It was like Sunday-school picture-book Heaven, with sunshine and rolling green hills and fluffy white lambs.

Now were going the last leg of our trip: Thailand. Here's what I just posted on our travel blog: we spent two relaxing days in the lovely town of Wellington, and are now sitting in the international terminal of its airport. On Saturday night, the All Whites beat Bahrain at "football" and the city filled with load people in white jumpsuits and live music and generally turned into a giant seaside party. The atmosphere of revelry continued well into Sunday, which saw some major streets cordoned off and lined with flag-waving kids for the Santa Day Parade. I said goodbye to Wellington's palatial Burger King, complete with an extravagant neo-Baroque ceiling and an espresso machine, by getting a giant pancake breakfast. Yes, even the fast food here is pretty extreme.

...almost like this

In a few hours, we'll be Down Under again. Next stop: Thailand. I spent this morning reading a bit about that country's history--an elaborate fugue of warlords, farmers, clashing ethnic groups and abortive attempts at democracy. The country has 17 different constitutions since they first tried that sort of thing in 1932. Their most recent PM was kicked out after the Royal Thai Army walked into Bangkok with lots of guns and accused him of having a "conflict of interest" because he was also a host on a TV cooking show. Apparently this sort of thing happens every few years. Thailand is a very peaceful country in spite of everything--it's mostly Buddhist and hasn't had a real war or particularly violent coup since WWII.

Political ridiculosity aside, Thailand sounds like a promised land of teak temples and spicy street food, where a dollar will get you 33 Baht and a couple Baht will get you really good tea. Updates forthcoming!

Tuesday, October 13, 2009

Solar Car Strategy

One of my jobs over the past couple of days has been to program a weather data feed for the solar car. (The race is in twelve days! More on that soon.) After a lot of looking, we settled on NOAA's Global Forecast System as our source.

the world, simulated. thanks NOAA!

(That, by the way, is a really cool system. It gives you everything that's going on at any point on the globe, in three hour increments, from right now to more than a week in advance. By "everything", I mean everything from the chance of rain to "soil porosity" and "total cloud water (atmospheric column)." They run the simulation four times a day. That means that the NOAA guys crank out gigabytes of data every six hours, and anyone can just go there and download it.)

For the World Solar Challenge, we're interested in two things: the amount of power we're going to get (or as NOAA likes to call it, "downward shortwave radiation flux") and the amount of headwind or tailwind.

solar power, in W/m^2

The only problem is that the race is one one of the most remote highways in the world. We're bringing extra fuel canisters so that our vans make it from one outpost to the next. Those gigabytes of real-time data aren't going to get there. Instead, we're bringing a satellite phone, which gets us a couple kilobits per second--1991 style--and at exorbitant cost. Sasha calculated that loading Gmail would take more than an hour and cost $400.

To get around this, I wrote a script that runs at regular intervals on my server back in California. Each time, it downloads the latest weather data and parses out only the variables we care about, does a little bit of voodoo, and samples them roughly every kilometer along the race route.

Plan A was to compress the output into a hackish text file. I'd output one line for each waypoint along the route, and each line would have one character per forecast: the first character would be the amount of sun we're getting now, the second would be the amount of sun we expect in three hours, and so on for the entire six-day race.

~3000 waypoints * 60 forecast times * 1 character per value = 180000 bytes. 180 kB. Doable over a satellite phone! Still, I forgot the obvious part: the weather at one point in the middle of nowhere in the desert is very similar to the weather a kilometer away, or a kilometer after that... as a result, many of the lines in the script output were very similar to each other. Not optimal. So I tried something else...


Plan B was to round each value to the nearest integer, then write them as a regular text file. Number, comma, number, comma, on every line, one per waypoint.

Then I zipped the file and made it available for download. Much easier, and fewer moving parts since we can just open the zip file with software we already have. As Donald Knuth once famously said,

premature optimization is the root of all evil.

Simplicity rules.

Tomorrow at the crack of dawn (according to Sasha), we are leaving for Adelaide, then for Darwin. I'll post when I can, but internet will be spotty. In fact, internet access sucks in Australia, in general. More on that later. Peace!

Saturday, October 3, 2009

I'm in Sydney

...on my way to Melbourne. Jesus, Australia is awesome. I think even the bag claim conveyor belts go counterclockwise here.

Over the next few weeks, we'll be putting as many miles onto the solar car as we possibly can, and then we're racing. It's the World Solar Challenge--from Darwin to Adelaide, across the outback, sun power only.

(The car, just before shipping, with about half the solar panels on. Taken a few weeks ago by Nathan.)

I'll be blogging from the road, of course, and on the trips to New Zealand and Thailand some friends of mine and I are doing afterward. Nathan has some great pictures of the solar car on his blog (which he started writing just for this trip, and which I'm sure will be excellent). If we have time, we'll throw some content on the Stanford Solar Car team blog, too. And's Autopia did a post about us a few weeks ago.


Saturday, August 29, 2009

Drive-By Journalism

So I was cruising down the boulevard in the Stanford Solar Car last Thursday. I was the middle car in a three-car convoy. Cars would slow down as they passed by to do a double take on our carbon fiber contraption.

One guy pulled up next to me and started taking pictures. The "experimental prototype" he snarks about is the car we're taking to Australia, and "Solstice" is the old model, this one's Apogee. Cool pictures, nonetheless. And mad props to Mr. Zbrozek for digging this up.

And if you want more production value and more ridiculous commentary, did a post about us, too.

More pictures forthcoming!

Friday, August 7, 2009

Finding the Next Dot-Com

Its seems like everyone and their mom has a domain name nowadays, and domain squatters have the rest.

The land grab is speeding up. VeriSign says that more than 2.4m new .coms are registered every month. Virtual real estate is just a name, but domain auctions sometimes make actual real estate look cheap--and even if you aren't paying $7.4m for "", a lot of domain names are expensive. If it's pronounceable, paying a few thousand bucks is apparently normal.

All this squatting and grabbing makes life harder for people who actually want to build a web presence. Just look at the names of some of the newer companies around here: Ooyala, anyone? DealKat? SaaSure? That first one reads like a misspelling of a French exclamation. The second is a misspelling. The third is a pun on SaaS, which is usually pronounced "sass", so it sounds like a lisp ("sass-sure"?).

These guys seem to have gotten what lots of people want: an unregistered domain name. Those sell for about $10, renewed yearly; the details depend on the specific TLD you want. In any case, they're vastly cheaper than domains that are already registered, whether by previous legitimate users or by squatters.

After spending half an hour recently typing stuff into whois, looking for the coveted "not found" that would tell me a name was unregistered, I found nothing. I thought: there's got to be a better way...

So I wrote a few quick-and-dirty programs that generate domain names, then used a shell script to test them automatically and pick out the unregistered ones. I wanted domains that were reasonably short and looked and sounded like English words. Since all the tricks I tried to that end rely on a large English word list, and since I didn't feel like waiting very much, I wrote these mini-programs in C++.

Attempt #1 goes through a list of English words and builds a map of all each 'syllable' along with how often that syllable occurs. For syllables, I just used all the substrings in each word of 2-5 letters that had at least one vowel. The most common were es, in, er, ed, ing...

Then, I combined two syllables at a time, starting with the the most common and the second most common:,,,

The names got a bit more complicated after that, but they weren't very wordlike. Worse, the first 1000 were all four or five letters long, so despite sounding like gibberish, almost all of them were taken.

Attempt #1 results

500 domains
53 of which happen to be in the original wordlist. None of those was available.
Of the remaining 447, 2 were available: 0.4%

I needed something better...

Attempt #2 is a Markov model of the words in the dictionary. After a bit of experimenting, I decided to use a Markov model. For every three-char sequence in the input word list, I kept track of all the characters that come next. I included the null character at the end of each word, to model the length of English words as well as the characters they're made of.

To generate names, I sampled the most common three-character sequences at the beginning of dictionary words. For each sequence, I randomly picked from the characters that could come next, and repeated that until I got to a null character.

This one worked a lot better:

I especially like Maybe a communications or PR agency? It's a sweet domain.

These names were generally a bit longer, but pronounceable. A lot more of them were available--it seems like raw length is what the squatters really care about.

Attempt #2 results:

500 domains
122 of which happen to be in the original wordlist. None of those were available.
Of the remaining 378, 61 were available: 16.4%

Possibilities abound. I could..
  • Artificially crank up the probability of the null character for every seed in the Markov model, to make it produce shorter domain names while still trying to keep them wordlike.
  • Exclude long words from the wordlist and then build the Markov model, also in an effort to produce shorter domain names.
  • Use the Markov model to generate two words at a time, and simply concatenate them, also to get more compound-word domain names.
  • Repeat the experiment for languages other than English.
  • Run a bunch of popular domains and less popular ones through the Markov model to see how they score. Are domains that look like words more popular than those that don't?
  • Compare some sites with a lot of direct traffic (people typing the domain into their URL bars, instead of going through a link or a search engine) and see if those tend to be more wordlike than their less typeable counterparts.

I might try some of this stuff. If I do, I'll keep you posted. Peace...

Thursday, July 30, 2009


...the 140-character crowd gets retweets, so why not a reblog?

This is an awesome one I found yesterday: Overcoming Bias

It's by an economist and in the style of Freakonomics, but with fewer inhibitions. In particular, Robin Hanson has no qualms applying the rational, disinterested analysis of incentives, biases, and markets to issues of gender and race. I especially like this post, which is a bit outside his usual vein. It's not your average relationship advice...

In other news, Max now has a column on The DC Writeup. He's one post in so far--and that post is coincidentally also about overcoming bias. It's an exposition of academic groupthink in climate research. (Disregard the article title; he didn't pick it, and the real one seems to be in the URL.)

Finally, there's Rick Rusczyk, of Art of Problem Solving fame, who seems to share Max's mix of topics: his writing generally falls in the triangle whose corners are math and politics and economics. He has the inside scoop on an interesting niche culture--that of high-school contest math, and the kids who participate in it. His tagline is "the Search for Intelligence Continues."

I think that search is what the blogosphere is about, too. People like these are making it easy.

Friday, July 17, 2009

Yet Another Round of SunSpider Benchmarks

... I ran some today because I've been getting mixed signals reading other people's results. I only tested the latest versions of the four most popular browsers. The executive summary:

Chrome 2.0 776.2ms
Safari 4.0 957.0ms
Firefox 3.5 1648.8ms
IE 8 6045.4ms

Each measurement is a mean of five tests, and the 95% confidence intervals for each one were all close to ±3%. Full breakdowns of all the tests behind the links...

Machine: Toshiba Satellite L305-S5939, Core 2 Duo T6400, 4GB 800MHz DDR2 SDRAM

Lots of people have been writing about just how quickly Javascript is becoming quicker, so I didn't test for that--instead, I just wanted to see for myself how the race was going. Chrome still owns.

Chrome runs V8, built by a crack team of Danish coders. Among other things, it's great at handling tail recursion. Chrome does monomorphic inline caching to migitate the performance hit from dynamic typing, plus a lot of aggressive bytecode optimization.

Safari has it's own lightweight JIT compiler and some other optimizations (amusingly, they call their engine "SquirrelFish Extreme"). They use polymorphic inline caching to optimize object member lookups. As far as I can tell, that means a smaller potential speedup than that of V8's monomorphic caching, but one that applies in more situations.

Firefox runs TraceMonkey, using a really cool hack, trace trees (PDF). In my tests, it took a bit more than twice as long as Chrome 2.0, but by all indications is lots faster than the original Chrome. It's like adding another Moore's law on top of Moore's law! At least for now, the speed of Javascript software seems to be doubling every 18 months or so.

Even IE 8, which took twice as long as Firefox, is a huge improvement over IE 7. John Resig, the Javascript guru who wrote jQuery and now works for Mozilla, gave it no faint praise. In his words, "our day has finally come." He goes on to talk about "some big improvements in improving garbage collection issues, memory management, and performance - all of which will be greatly appreciated in everyday applications."

I think the coolest thing about these speedups is that the different teams all got there by different routes. Maybe there will be convergence resulting in even better numbers? Javascript on Chrome 2.0 and Safari is already comparable to optimized native code, and the two most popular browsers aren't far behind.

I bet the day will come when programming languages will be performance equivalent--when working at a higher level of abstraction won't carry the serious performance hit that it usually does today. Javascript is a very dynamic, functional language--so if it can be optimized this well, why shouldn't other languages get the same boost?

In other news, I've resurrected my blog, Lazarus style. It's a zombie now, back from the dead. My last few months have been busy. More coming soon!

Sunday, April 19, 2009

I'll be BAWK

Last weekend, we went on an epic roadtrip through California.

It's an annual section leader tradition, and this was its fourth year. On Friday afternoon, we piled into cars with food, sleeping bags, laptops, and cameras, and started our trip. The goal? Solving puzzles and getting places as fast as possible. BAWK is framed as an adventure game. The theme? Always a B-movie. This year it was Cannibal Women of the Avocado Jungle of Death The route? TBD. We go nowhere fast, then hang out and have fun.

It turned out that we were driving from Stanford to within 90 miles of Mexico on that first afternoon. It was a beautiful drive through the Sacramento Valley and the Mohave Desert.

Stop 1: the Salton Sea.

A rainbow on the way to Dinosaur Point (San Luis Resovoir).

We camped on the Salton Sea our first night. In the morning, we went to an abandoned trailer park that had sunk into a wet marsh. Pictures coming soon.

Antelope Valley California Poppy Reserve.

Joshua Tree National Park.

On the way back, we made it to Big Sur before sunset. It was gorgeous.

Brandon, the B in BAWK and roadtrip planning genius.

The sun.

The sea.

The beach. We swam here.

I love the desert. I love the backroads, the cogs under the surface of society, the small towns that grow our food, transport our goods, generate our electricity. I love the freedom of driving with friends through the middle of nowhere, going wherever we want to go.

California is beautiful.

Friday, February 13, 2009

Holy Zuck

I met the Zuck today.

It all started a few weeks ago, when I joined Stanford's CS106 section leading program. I lead a discussion with a group of seven CS106A students every Friday, help people with assignments, do some grading, and party with other section leaders. Today, a group of us went to Facebook. We walked through two of the engineering floors; even in the late afternoon, most of desks were manned, and most of the engineers didn't bother to look up as twenty students sauntered past.

Later, we filed into a small conference room. We looted the open cafe at the back of the room; one section leader pocketed three Snickers, and I grabbed a protein shake. We sat down to a terse introduction from one of Facebook's PR people: "We call him the Zuck." We waited. I looked to the door just in time to see an unassuming, incongruously dressed, boyish-looking man slide in. The room was quickly silent.

Mark Zuckerberg was wearing brand-new sneakers and designer jeans, a conventional North Face fleece clashing with the shirt and tie underneath. He would not have looked out of place at a Harvard frat party. Yet there he was, twenty-four years old and worth $1.5 billion. One Stanford CS professor had recently announced that he was leaving to work for Zuckerberg full-time. "Welcome to Facebook!"

The Zuck told his story -- how he'd hacked together a some simple apps during his sophomore year at Harvard, and how those apps later become Facebook. The first was a product of necessity. Two days before a mandatory freshman humanities class, he had been "busy building stuff", he said, and needed a crash course. Badly. It was an art history class, so he built an app that let students upload images; they could see their friend's uploads and pick a few sentences to describe each one. Afterward they'd contributed, they could see what other students had written. The professor later told him that people had scored higher on the test than on any he'd given before. Then came Thefacebook, which let users put up a picture of themselves, a few words, and poke each other. Zuckerberg said wrote in three weeks, and that three more weeks were all it took for a few hundred students to join.

Then came the Q&A.
First I asked him: "You said you built Facebook and a few other projects in your spare time at Harvard. What gave you the impetus to take all that time and just write code?"
The first part of his answer was all about hacking for it's own sake. He said that he's always like to build stuff, to hack things together quickly and to see what other people do with it. The second part was about network effects. He said he was fascinated by them. People had complex relationships to each other -- now (in 2004), with everyone constantly in touch, those were only getting more complicated, but there was no easy way to map those relationships. He realized that just as collaboration had made that art history final easier for everyone involved, it could also make relationships easier to navigate. He could use people's desire to keep in touch to map out their real-world social networks and to make their lives more transparent to themselves and to each other.

I asked him, later on, what Facebook's original killer app was. He told me: there was none. The original Facebook had no apps, of course, no status updates, no "friend feed", not even a wall. More than any social network at the time (and certainly more than Myspace), however, it emphasized existing friendships. It started only at Harvard, and so built a community of trust where people on Thefacebook knew each other, were actually friends with their online "friends", and were willing to share their lives online. That philosophy -- not any individual 'app' -- was the real "killer app", of course, and it still is.

Meeting Mark Zuckerberg was fun and surreal. Here's what I got out of it:

  • technology is cool, but the people who use it are far more important and require far more attention to detail than it does. Doing things "the right way" is good, but it's not nearly as important as most engineers take it to be. Facebook is best example of this I can think of. It started as an app written in PHP (which originally stood for "Personal Home Page", but that's another story). PHP is a scripting language, and not particularly fast. It ran on Linux, in a "LAMP" stack -- about as standard as web setups get. And it borrowed the basic ideas of a social network -- profiles, "friends", personal blurbs, and so on -- from sites like Myspace that had been around for years. It was not rocket science. It was just closely in tune with the way people connect in the real world and the way the want to communicate online.

  • nothing is impossible. Cheesy, I know, but literally nothing. Imagine you were Zuckerberg's dad, and he had told you in 2004: "I don't need to finish Harvard! I'll just drop out and become a billionaire like Bill Gates." That would have sounded ridiculous, but nonetheless: he would have been right.

  • most importantly, build it now. Facebook started on a whim and version one came out in three weeks.

Its either now, or its not at all. Make it happen! Seize the day! There are so many Facebooks that nobody's thought of... yet.

Friday, January 30, 2009

Go is like Crack

Go is something unearthly . . . If there are sentient beings on other planets, then they play Go.

-- Emmanuel Lasker, former World Chess Champion

I played Go for the first time a few months ago. Fortunately for me, I didn't play enough to understand how amazing it is. That changed this week, and my work-Go balance (Go-life balance?) has tanked as a result.

Go is an ancient, originally Chinese game played between two people with black and white stones on a 19x19 grid. The rules are really simple:
* black goes first
* you take turns putting stones on the vertices (or passing)
* if a connected group of stones is completely surrounded, it's captured
* the ko rule: you can't create the same board twice
* the game ends after two consective passes
* territory consists of empty vertices surrounded by your stones. Each vertex is worth a point, as is each captured stone. whoever has the most points at the end wins
* to make things fair, a komi compensates white for going second, usually by 6.5 or 7.5 points. The extra .5 ensures that games are never tied -- they have a binary outcome.

Chess is Baroque by comparison. Despite its simplicity, Go is very deep. The average chess position has about 25 legal moves available to the current player. A typical Go move is chosen from about 250. (Since it's a 19x19 grid, the first move can go on any one of 361 vertices.)

The real reason I started playing Go, though, isn't because of its simplicity, beauty, or depth. It's because Go is fun and because I learned that computers can't do it.

In 1999, IBM's Deep Blue beat Garry Kasparov in tournament chess. It was a giant machine with about 4000 special-purpose chips, dedicated to evaluating literally billions of chess positions per second. In other words, Deep Blue beat Kasparov by brute-force attack, thinking as far as forty moves ahead on some turns. A very intelligent person lost to a machine with lots of number-crunching power, but no intelligence at all.

Go is not like Chess. There are simply too many possibilities for any kind of exhaustive search. Like Chess, humans play it with advanced pattern recognition and and with directed strategies. Go differs from other games, however, because humanlike intelligence seems to be the only way to play well. Humans balance lots of difficult trade-offs -- is it better to keep playing in a part of the board with lots of activity, or to jump away and stake out a territory claim somewhere else? Is it better to go for secure territories along the sides of the board or influence over the center? Better to finish an impenetrable fortress or to branch out and make a bigger, more porous one? Questions like that take experience, intuition, and lots of pattern recognition to answer well. They can't easily be forced with faster algorithms and bigger supercomputers.

The best Go-playing programs today are using Monte Carlo sampling, like the stuff I blogged about earlier. Running on computers three orders of magnitude faster than Deep Blue, they're on par with skilled amateurs. Earlier this month, one program became the first to defeat a professional Go player in a tournament match--by accepting a massive nine-stone handicap. For now, Go is a game where real intelligence isn't just helpful, but required. There are few others like it.

Go is simple, yet radically open-ended, and it seems like a uniquely human game. Could it be AI-hard? We'll find out. Lots more info and links at the Stanford Go Club. I would write more, but the night is young, and it just became my turn to place a stone.

Tuesday, January 6, 2009

Winning science fairs

... I've never done it, but I did get a "third award" at Intel ISEF '07. That's International Science + Engineering Fair, and it was one of the most fun things I've ever done. My friend Tom and I built the project, took it to regional fairs, improved it between each fair, and of course partied the nerdy way for a week at the main event. Our project was on Stirling Engines, building four from scratch. The last two worked.

We built the engines using parts from my garage and from Home Depot. The last engine also included two borosilicate glass-graphite piston cylinders generously donated by Airpot. The Riverton Science Department hooked us up with real-time pressure and rotation sensors. The end result was an engine that could run on a candle and a faster one that ran off of a propane stove; we measured the thermodynamic cycle of the second engine, creating and experimental PV diagram.

My partner-in-crime Sawyer just facebooked:
Hey! You went to ISEF a while ago, didn't you? Any advice on choosing a project?

Sure! In my unhumble opinion, engineering is the way to go.
Pick something fun or cool, because then you'll spend time on it and make it great. Also, pick something that you can build. I have way better experience with that than doing pure science or math, at least in the context of a science fair. (Science fairs are really science/math/engineering fairs; I like the engineering part best.) If you do pure math or science, then you'll need a mentor. Many entrants in those categories, even at Utah-level fairs, partner with university professors; needless to say, it's very hard to compete if you're going it alone. Building stuff is different; you need a lot less arcane knowledge. I wrote some of the programs I'm most proud of before I had any formal CS training; my friend Nathan built a car -- from scratch -- that does 0-60 in under four seconds -- before he went to Stanford and took introductory mechanical engineering. If you're excited about it, if you persevere, and if you're willing to use Wikipedia a lot, you can learn as you go and build really cool stuff.

I also recommend building something physical. You can enter a computer science project, but you'll have plenty of chances to code. In my experience, the clubs, groups, and other orgs you'll be part of in college never have enough programmers. Web developers are especially in demand -- you'll spend lots of time sitting in front of a screen hacking apps into existence. Science fairs are your chance to design, machine, tinker with, and generally build stuff, and get recognition for it. Companies sponsor you. Teachers love it and are often very helpful. It's a very good deal, and one you really don't get once you're out of school. I can't overstate how great an experience my project was. Find something interesting and build it. You'll rock the science fairs and get more out of it than you can imagine.

(Tom and I at Sandia National Labs. One of our judges invited us to come see his project there: harvesting solar energy with Stirling engines. The dish focuses sunlight onto the hot end of a 25KW engine. The other side is cooled with a radiator.)

Thursday, January 1, 2009

Celebrating 2009 the manly way

... with Patrick's New Year's resolutions. His story:

So, I watched "Wanted" again tonight instead of going out. And you know what? I probably had more fun that way. 2009 is going to be my year, the year that I stop trying to live like everyone else, justifying my unsavory actions by the social acceptance in our decadent society...and other non-pompous reasons. I will not bore any readers with any sort of analysis of my faults. Those are irrelevant. What matters is how I'm going to fix things. So, let me begin...

1. I will no longer be scared by my (lack of) potential. I have put myself on the path of the creator, the writer, and I will no longer hold myself back by a terror that I will not live up to anyone's standards. So, for 2009, I vow that by the end of freshman year, I will write/direct/create something that I am proud of. It will be my vindication, my tangible proof that I deserve to call myself an artist. For you see, I watched "Wanted" for reasons other than to see mind-blowing action and Angelina Jolie's fantastic ass. The beginning of the movie scares me. I see visions of Wesley in myself, a bright young man, suddenly waking up out of his stupor and wondering where the last ten years went. I don't intend to assassinate anyone but I am ready to rise up, step into the shoes that have been waiting by the door of life for as long as I can remember. So, I will create, I will prove myself.

2. I will work out. Several years ago, I exercised with a vigor I had never shown anything before. I was fit, toned, and a damn sexy beast. The trouble was, I was still too shy and withdrawn to stand out to anyone except my closest friends. So, my transformation went unnoticed. I felt fantastic but I was too immature to care about anything other than what others noticed. I slowly lost my will power and gave up. Rabbit food turned back to junk food and fab turned back to flab. No one noticed this either, except my dog who started enjoying the left-overs a lot more. Since then, I have tried several unsuccessful times to start again but it never took. I lacked the devotion. Until now.

3. I will stop chasing girls with which I have no chance. I cannot even begin to describe how much time I waste thinking about the fairer sex. That is not to say I forgo romantic involvement. Instead, I will not seek it out needlessly like a crack addict looking for his next fix. I will leave that to sluttier people than me (Adam O. and Sri, here's looking at you). I will, instead, just let whatever happens happen. I remember about 2 or 3 months ago, I was laying on the roof of the dorm late at night. I was stargazing and thinking about girls. Suddenly, I saw a shooting star go streaking across the sky. My first thought was that I had to make a wish. My second thought was, "Please, let me find someone that I can care about." Even though circumstances have changed since then, that wish remains. No more chasing, no more games. Please, let me simply find someone that I can care about.

4. I will be a manly man. I will stand tall and proclaim the words from the hills, blowing a sea shell, my man blouse billowing in the wind. I will drink unleaded and shit mustaches. Mountains will quake and panties will vanish into thin air. I will ride an imaginary horse and call it a steed like the pretentious prick that I am for I am a manly fucking man. I am Sir Patrick Sean Kelly TM the 17th, beyotch!

2009. Here I come.