I live in Silicon Valley. I'm really into machine learning and Formula 1. I'm 23 years old. More about me…

Subscribe in a reader

Article archives

Feel free to email me or IM me.

I've decided to try out this writing thing, which wasn't exactly my favorite part of college, but it's growing on me. I'm going to focus on writing about all things tech. I tend to write once a week, publishing early Monday morning.

Top Posts:
So I went to Startup School
Explaining my addiction
A quick foray into linear algebra and Python: tf-idf
Waking from a 64-bit nightmare
Kickin' ass: Firefox 3

Top Commentors:
Paul Stamatiou (4)
Gordon (3)
Arthur (2)
Anton Lindstrom (2)
m13 (2)

This page is valid XHTML 1.0 Strict

© 2008 Tim Trueman

Sniffing packets using BPF

June 6, 2008 Link

I’m insatiably curious. It’s hard for me to not wonder how something works. If I see even a hint of something interesting, I will find out how it works.

Powerbook

One of the few pieces of software I keep running 24/7 is a Perl script called MySQL query sniffer. It watches your network interface of choice and dumps out the query from any packet containing a MySQL query. This is a very handy trick for debugging database issues when your software says it’s execute a query but you want to know exactly what that query looks like to the database. I find it much more convenient for a few reasons:

  • Figuring out which queries are mine on a shared dev database is challenging
  • I may not have permission to turn on query logging
  • Query logging slows down the database
  • Query logging can take up quite a lot of space
  • Sometimes the MySQL server restart required to turn on query logging isn’t an option

I usually leave this script running in the background on my MacBook Pro at work all day long. Starting the script though not using sudo give the following error:

durandal:~ ttrueman$ ./mysqlsniff-0.10.pl en0
(no devices found) /dev/bpf0: Permission denied

I thought I told mysqlsniff to listen on en0, what the hell is this bpf0 device? Curiosity got the better of me, so you’re going to hear from me just what this bpf0 really is.

The Berkley Packet Filter is an abstraction that sits between the raw network interface and application software. It allows applications to access the raw interface if they want or just see relevant packets. The real win with the Berkley Packet Filter is its speedy filtering can allow an application to just see packets relevant to itself. The benefits of this are two-fold: lower CPU overhead from less packets to handle and less packets in the device buffer, which means the buffer is less likely to fill up and drop packets. Wikipedia actually has a short but helpful article on it actually.

If you’re really curious about the benefits of using the Berkley Packet Filter this relatively old but not too long research paper does a good job of elaborating just how expensive it is to process packets with a CPU. Just imagine a few dozen instructions per packet times a gigabit Ethernet and try not to cringe.

What kind of things have you just had figure out how they worked?

So I went to Startup School

May 4, 2008 Link

OK, so I know it’s totally uncool by now to write about this year’s Startup School (which I’ll refer to as SUS from here on out). But I’m going to do it anyways. My excuse is I already wrote most of this and I moved the day after SUS. Oh and I was really sick and swamped with work for almost two weeks. Plus I haven’t seen many articles that I liked about what people took away from it. So here goes…

Y Combinator Party

Preschool

I’m guessing not many people knew about this, but there was “a reception for speakers, press, and some of the attendees” the night before SUS. Someone made a mistake and invited me. Sadly they made a few other mistakes as there was no press and only one speaker there, Paul Graham himself. Basically it was just a bunch of random people with a large number of the currently funded Y Combinator startups. I was surprised by the abnormally high concentration of people from the UK. I was not surprised by the abnormally high concentration of iPhones. Everyone had one. And if they didn’t, they had a Blackberry. Although a couple people had both a Blackberry and an iPhone.

After a few minutes at the very homey, warm, and intimate Y Combinator office, I finally found out what the invitation had meant by “there will also be large metal robots!”. A robot named Monty rolled out on a pair of segway-like wheels. Monty started shaking people’s hands and throwing the horns. It was really impressive, but not nearly as astounding as the second robot in the Anybot workspace. Dexter was a biped robot, learning to walk. He can walk, jump, and catch his balance if pushed. Just watch:

I found it really interesting the mix of people who showed up. I shouldn’t have been surprised to find a few of them knew Mike Speiser. That guy knows everyone. It was mostly 20-something nerds. I was impressed by the attitude and energy and drive of everyone I met. They all wanted to “build something people wanted” as Paul Graham puts it.

Saw a bunch of impressive startup demos during the reception; there were a lot of friggin’ smart people. The most impressive startup I saw was called 280 North, and their product, 280 Slides, was almost literally Apple’s Keynote but on the web (not surprising since I believe they all used to work at Apple). I’m not talking about some simple Powerpoint web clone. This was the shit. I had a screenshot but they requested I take it down until they launch.

280 Slides felt almost exactly like a desktop application. I suspect the reason for this is the startup wrote the whole thing in something they called Objective-J, which as they explained it was essentially Objective-C style Javascript. There’s some sort of interpreter that runs client-side—but trust me—it doesn’t feel slow. Their very brief explanation of the whole thing only made me more convinced they were some of the smartest engineers I’ve ever met.

Someone put on loud music early on, which combined with the small space and packed room, caused me to all but lose my voice. I had been there for almost six hours and my feet were aching. I was tired and eager to get to sleep so I could get to SUS on time in just a few hours.

Startup School crowd

Startup School at Stanford

There really no way to understate this, so I’ll just say it. Parking at Stanford is a bitch, especially for guests. I walked into Kresge Auditorium, 20 minutes late, hoping I wouldn’t get a ticket. It turns out it was OK, I wasn’t really interested in the first two speakers anyways.

Paul Graham really surprised me when he took the stage. The last words I expected to come out of his mouth would be “stop using the Internet”, but that’s precisely what he told us. It turns out he was using 280 Slides and with all the attendees trying to use the wifi, Paul couldn’t load his presentation. His talk was good but just wasn’t as inspiring as I had hoped.

David Heinemeier Hansson gave my favorite talk of the day. He was definitely the rockstar of everyone there. He went right on the heels of Greg McAdoo, a VC at Sequoia Capital (who has funded just about every major tech company). DHH had lots of little pokes at Greg’s main points, which boiled down to the need to turn your company into a billion dollar company and some sort of surfing metaphor for catching the next big wave. I dunno, he wasn’t really saying much other than get lucky and make me hundreds of millions, which was a lame message.

DHH was the complete opposite of the preceding talk. His title was “The secret of making money online”. First he presented the classic Slashdot comment:

  1. Great Application
  2. ???
  3. Profit!

What could step two possibly be? It’s having a price DHH told us. You have an application, you set a price, and people pay you money. “I’ve heard, over time, hundreds of years actually, that has been how most businesses made their money,” David stated plainly. For some reason this notion of having a price doesn’t seem to have made it to the Internet. Everyone goes for free with ads, or anything but actually putting a price on their product.

DHH put up some basic math trying to remove the idea that making a million dollars a year isn’t as hard as you might think. If you built a great application and sold subscriptions for $40/month, all you would need is ~2,000 users. That’s not unthinkable. Build something people want. Focus on what DHH calls the Fortune 5,000,000. Businesses tend to focus on the consumer or the enterprise; there’s no middle ground.

I loved and was relieved to hear him talk about how it’s OK to just make millions, and you don’t have to rush it. DHH explained how the patterns 37signals set, stuck with them. They don’t work crazy hours, in fact they just moved to four day work weeks. As he said if you could just get actual work done for two hours a day you’d be in good shape. His message of calling your own shots and running at your own pace hit welcome ears. I would love to have a job akin 37signals.

One thing that really comes through with DHH in person is how sarcastic and hilarious he is. So just trust me, you seriously have to watch his presentation, then come back and finish reading.

David Heinemeier Hansson

Jeff Bezos came to SUS to talk about Amazon Web Services, which I assumed would be quite boring. I’m sure many if not most tech people know of AWS (S3, EC2, SimpleDB, SQS, FPS, and Mechanical Turk), but most people on this planet haven’t heard of it and I believe this quote summarizes that in an unexpected way:

“Amazon on Monday announced persistent storage for its EC2 service and what’s notable is how quickly the e-tailer is running ahead of the competition. In fact, Amazon’s real business down the line will be its cloud services. Amazon will be like a book store that sells cocaine out the back door. Books will be just a front to sell storage and cloud computing.”
Larry Dignan of ZDNet

Bezos explained the basic AWS principles, easy to use, fast, elastic, highly available, and pay by the drink, were centered around a story I had not heard. Back in the 19th century (I think) breweries started to build their own generators because electricity allowed them to make beer better. Better meaning more efficiently as there was no difference in taste. The reason they had to build and manage their own generator was the electrical grid as we know it today did not exist yet. AWS aims to “make electricity, so you don’t have to”.

Bezos was charismatic and brilliantly diplomatic. I hugely respect him now. One question asked about a frustrating limit around SimpleDB and domains. Bezos didn’t know enough technically to answer the question so he asked a colleague of his to field the question. The colleague started giving a fluffy non-answer, totally avoiding the question. Bezos interrupted his colleague and said, “so basically he’s not answering your question. Come find us after the talk and we’ll work something out.” I’ve never seen someone handle a situation with a frustrated customer as well as that one.

Peter Norvig gave an interesting talk but it really wasn’t what I was hoping to hear for some reason. He did say something really funny though when someone asked a really lame question about semantic web and the future. Norvig dropped this golden nuggest after a slight pause, “the semantic web will always be the future of the web”.

Google

Check out my Flickr set from the weekend. I highly recommend all the other SUS talks on Omnisio’s site.

Cupertino, start your copiers

April 6, 2008 Link

As I said at the end of this article back in February, I think Microsoft could try something crazy that just might work; Windows 7 could make Microsoft the first company to actually make use of the Internet in an operating system. Steve Ballmer gets that Microsoft needs a big change I think, but I’m not sure he really knows how to do it. In fact I’m pretty sure he doesn’t know what to do. Yahoo! isn’t the answer to your prayers Steve, trust me. Here’s a freebie for you…

Bishop's Peak, San Luis Obispo, CA

I’ve come up with the 12 Steps to Windows 7 of Awesomeness™!

1. Ditch the NT kernel; use Linux. Just because Linux wasn’t invented at Microsoft doesn’t mean it’s not a total waste of resources to maintain Windows. I’m not saying I think it’s crap; I think very highly of it, but you’re not getting any return on investment for these resources. Why spend tons of money here when you don’t have to? Just do it. And contribute the awesome things you used in NT back to the Linux kernel.

2. Ditch the Windows name. Props to ExtremeTech for this idea. The name just leaves a bad taste in my mouth, and, even if it’s not true, Windows now stands for insecurity, pain, and suffering to everyone. Leave those memories behind. Don’t pick something shitty and misty like Vista. You want to signal customers you’re doing something new, exciting, and thinking totally different.

3. Build a new type of browser that blurs the distinction between desktop and web apps. There’s a lot of reasons web apps cannot compete. Arguably the biggest difference is caused by Fitts’ law. Fitts’ law is a mathematical formula for the amount of time it will take to hit a target, depending on the size and distance of that target. Some places on the screen are easier to get to than others. As Bruce “Tog” Tognazzini explains, the easiest is directly under the pointer, because you don’t have to move anything. The next easiest location is the corner, because it has essentially infinite height and width, making it a really easy target to hit. The edges only have one infinite direction but they are also easy to reach. The thing about web apps is they cannot use the corners or the edges of the screen. Desktop apps can.

Here’s what I’m suggesting: build a browser that lets web apps have the same functionality as desktop apps. It will need to let the web app take complete control over the browser’s menus and windows. It needs to be able to open and save files like a desktop app. It should be able to provide a systray/menubar item for easy access. A few tricks to getting this to work would be thinking of each web app as a separate instance of the browser, just like desktop applications are separate. Caching web apps could provide pretty decent performance and strong offline APIs (e.g. Google Gears, or a SQLite DB similar to WebKit’s HTML 5 implementation) could blur the line even further. Imagine Google Docs in this browser. Or Flickr. Hells yes!

MacBook Air

4. Allow OS to be installed completely over the Internet. Look at the beginning of the trend: the MacBook Air doesn’t have a DVD drive. Seriously, physical media has got to die. CD/DVDs suck. A lot. The trick is how do we live without them. Trick one: allow a direct install from microsoft.com. Trick two: allow the user to install from an ISO image on another machine similar to Apple’s Remote Disk but without the physical disk. Just write some software to server up ISO images. You could use multicast DNS so that there’s no configuration, it just auto-discovers available media on the local network.

5. Stop worrying about piracy; you’re only pissing people off. Seriously. No more keys, licensing, or Windows Genuine Advantage validation shit. People have about zero tolerance for being punished just because you’re paranoid of losing revenue from a few customers. If you have to, think of the lost revenue as marketing your product as not fucking obnoxious.

6. Time Machine style backups to something functionally equivalent to Amazon S3. Copy Amazon’s Web Service work. Then you can build amazing products on top of that infrastructure. The goal here is to have all the user’s data stored on Microsoft’s servers, with the hard drive acting as more of a cache. That way the user can have way more data than their hard drive can hold and they don’t have to worry about managing it. All the user’s documents will be automatically backed up and placed in a versioning system on the Internet in a fashion similar to Apple’s Time Machine. Users don’t want to buy hardware and manage it themselves. Highly skilled IT teams do a much better job. I’ll explain later how you can afford to do this for all your users.

Storage Area Network

7. Nail the operating system’s user experience. I’ve already hammered on why using an Apple style menubar is important. I also think it’s important to come up with something better than the dock, which is one of the worst UI elements ever invented. Make use of the corners, which Ubuntu does really well. Clockwise from top-left it’s the application menu, power menu, trash, and show desktop. Both Windows and Mac OS X fail to use all four corners. What you want to do is really worry about creating a way for your users to be able to string together one small victory after another (e.g. “I downloaded a PDF, and I didn’t have anything that could read PDFs, but it downloaded and launched a reader in seconds…it just worked!”). Which leads me to my next point…

8. Autoinstall anything needed like Ubuntu. Users will be grinning ear-to-ear when software simply works. If the user really cared about which Bittorrent app they used they would install it themselves. Which is why users don’t really care about what software they use to accomplish a task. Take care of this for the user. The average person wasn’t meant to figure this stuff out on their own and it’s just a bad experience to force them to manage software by themselves. Users want things to work and the less thinking they have to do about it, the happier they will be. Happiness is what you should be concerned with, as this quote explains how frustrating experiences are today:

Every few days some crappy software I can’t even remember installing pops up noisy bulletins asking me if I want to upgrade something or other. I could not care LESS. I’m doing something. Leave me alone! I’m sure that the team at Sun Microsystems who just released this fabulous new version of the Java virtual machine have been thinking about the incremental release night and day for months and months, but the other 5,000,000,000 of us here on the planet really don’t give a flying monkey. You just cannot imagine how little I want to spend even three seconds of my life thinking about whether or not to install that new JVM. Somebody out there is already firing up Gmail to tell me that the JVM mustn’t just upgrade itself “because that might break something.” Yeah, if the entire collective wisdom of the Java development team doesn’t know if it’s going to break something, how am I supposed to know? Sheeesh.

Joel On Software, Elegance

9. Move your apps (e.g. Office) to web for free. No sane human being is going pay $300 or whatever it is you charge as apps become more web-based. You’ve made your money here. Move on. Besides you can charge users for storage and bandwidth on a per-month basis. Same thing for businesses with collaboration packages on a per-employee, per-month basis. You’ll make more in the end. How many companies can I think of still running Office 2003 (or even 2000)? Oh yeah, all of them.

10. Decide on a regular and quick release schedule. Hey, it works pretty well for Ubuntu, although you don’t have to be as aggressive as six months. I’d shoot for 12-18 months. 60+ months just isn’t going to cut it. Don’t ever pull that shit again. Ever.

11. Do sassy advertising; I know you guys have a sense of humor. Be edgy, stick it to the guys who have been tearing you apart. People should be laughing so hard they aren’t physically able to send the YouTube URL for your commercial to their friends. I can imagine a nice, sassy marketing campaign sticking it to Apple about their “Think Different” slogan.

12. Hire some young charismatic executives and put them front and center. You’re not going to find Steve Jobs, but you can do better than Bill Gates or yourself (although that remix of your little “developers, developers, developers” speech is entertaining, in a sad way). Here’s how you should measure success: if there aren’t any rumor sites about your new OS, you haven’t succeeded.

Bonus Points

Embrace standards and go totally open source. Don’t waste time on something just because you didn’t build it. Use what’s out there. And if you contribute back to the community you’ll be buying goodwill for your brand.

Shelby GR1

What about the bottom line?

OK, I know what Steve is thinking at this point. How the fuck am I going to make any money off this? Right, I’ve got an idea. Give this futuristic OS away for free. Totally free. It’ll be brilliant. Wait that didn’t involve money going into Microsoft’s coffers. Oh yes, charge for bandwidth and storage your customers actually use. Amazon Web Services style. Backups, system installs, restores, and saving those Office documents. Charge for the storage usage and bandwidth used every month. You can probably charge more than you tried to for Vista. People will love it and not even notice you’re making more money than before–nobody likes to pay $200+ at once. For example, XP cost $200. It lasted for six years (2002-2008). This equates to $33 per year for Microsoft. If you just charge for bandwidth and storage at a rate of $5-20 a month, you’re making anywhere from $60 to $240 a year. That’s more money for you, as well as happier customers with better experiences.

What do I want to do today? Use an OS like what I just described. If anyone can deliver it, it’s Microsoft. Apple’s the only other player and they just don’t really get the Internet. Then again, nobody really does.

Maybe I’m just crazy…thinking that it’s possible Windows 7 could actually be the second coming.

So, when is the future going to arrive Steve?

Thanks to Annie and Adam for reading drafts of this!

Waking from a 64-bit nightmare

March 30, 2008 Link

This all started when I noticed 4GB of Corsair XMS2 only cost $114. You see I can remember surprisingly vividly how cheap RAM was when it was 8MB for $375.

I figured, what the hell it’s 2008 and I’m still using an OS from 2001. 2001! How bad can could Vista be I asked myself, I mean it’s been out for a year. Surely it’s matured enough.

Oh, how I can be so very wrong.

Personally I try to stay out of the Operating System Holy Wars, because I believe good computer scientists don’t really care about anything other than what it can do, and certainly not if it’s from Redmond or Cupertino. And let’s be honest, technically they’re all about the same. Good computer scientists may have a favorite but that doesn’t cloud their judgment or ability to pick the right one for the right task or cause them to make asshats out of themselves because they feel very strongly about their favorite (on Slashdot, or more recently Digg).

Anyways, so there I was. I had my Windows XP 32-bit OS running just fine. I bought more RAM. I backed up and installed Vista 64-bit. After I reached the desktop, which was running at 800×600, I launched IE to download the Nvidia drivers. It crashed. Not just the app, but the entire friggin’ system. Must have been a freak problem I figured. Not so. After about 50 hard reboots (holding down the power button for five seconds, and no I’m not exaggerating, it was at least 50), I managed to get all the drivers and software in place the stability of the system was…better. I was still getting random crashes all the time.

And seriously Microsoft, I heard Aero would be pretty neat. I’ve never been so underwhelmed. That’s the best you got in five years? And what the fuck did you do with my control panels. Things that used to take 1 or 2 clicks to navigate to are now buried behind 5 or 6 clicks.

Frustrated I thought about trying XP 64-bit instead. Then I thought, “NO, fuck that shit Microsoft. You’ve blown your chance and I’m not paying again for an OS I already own. We’re done, do you hear me?”

I need my desktop PC for three things: virtual machines (to run development servers), storage, and games. That last one it turns out pretty much mandates I use Windows, but for better or worse I decided to risk not being able to play Counter-Strike: Source or Call of Duty 4. I read about the rapidly maturing Ubuntu Linux beta Hardy Heron on Arstechnica and researched getting games to work on Wine, a Windows compatibility layer.

So I downloaded Hardy Heron (in just a few minutes, thank you Yahoo bandwidth). It fits on a CD unlike many other Operating Systems out there. What’s really different though is the way you install it. You pop the CD in the drive boot from it and instead just installing right away it boots into the full OS as a live CD. On the desktop is an icon to permanently install it, but you already know if it’s going to work…because you’re actually using it. So I started to install.

Best Install Experience Ever

While I was installing, unlike any other OS, I could actually do whatever I wanted. No crappy interface at 800×600 that told me how awesome Microsoft shit was going to be. No, I was in the actual OS I would be using running at the full resolution of 1920×1200, which it picked automatically, and browsing around in Firefox 3 (as you can see above). And it was snappy, no slowdowns as it installed. I actually wrote part of this during the install.

Remember how underwhelmed I was by Vista and Aero? Even Mac OS X (which I really like) isn’t graphically anything special anymore. Ubuntu uses something called Compiz which has a real wow factor to it. You will instantly get attention when someone else sees you move a window (I can’t promise girls though, you’re on your own for that one).

Up and running

The one really awesome thing about Ubuntu is how automatic it is. Any time you try to do something that it doesn’t know how to do, it loads some software to do it for you. Download a torrent file? It automatically downloads and installs an application that can do bitttorrent. Trying to watch a movie that’s encoded with something you don’t have? It loads a codec. Plug in a new device, it grabs the drivers for you. It doesn’t ask you, it just works. Even if it has to download something from the Internet to do it. It’s a very nice philosophy for a consumer-oriented OS.

Which brings me to another point. Yes there was a time I had to touch the command-line. To get DVDs working I had to enable DMA (direct memory access) on my DVD drive, using this command:

sudo hdparm -d1 /dev/cdrom

Other than that Ubuntu is really getting close to being 100% ready to be used by your mother. I hope it eats away Microsoft’s marketshare as the OS becomes less important and software becomes much more web-based. The best part is Ubuntu is developed on a six month schedule so I don’t have to wait 5+ years to get something better (or a steaming pile of crap in the case of Vista).

So I got Hardy Heron up and running. Did I mention it’s just a beta? It’s rock solid for a beta. And I’m not regretting it. Hell, I even got Counter-Strike: Source working. Transmitting voice doesn’t work out of the box but I haven’t tried to get it working. I’m sure a simple Google search will solve that. It’s very playable at 1920×1200 and honestly it’s more stable than Vista.

Counter-Strike: Source on Linux

Microsoft, even if Windows 7 is the second coming, it’s already too late.

P.S. My one question is, Apple how did you do that 64-bit migration so painlessly I didn’t even notice? I didn’t even realize it until Microsoft fucked it up so badly. Kudos Apple for a job well done.

Explaining my addiction

March 23, 2008 Link

I have an addiction; it is simply impossible for me to kick the habit, not that I’m trying. Cocaine? Nah, it’s worse than that. Let me explain…

BMW recently updated their M3. It’s an amazing car, that’s now powered by a monstrously powerful 4 liter V8 engine that revs up to 8,300 RPM and can get to 60 MPH in 4.2 seconds. That’s fast…

…for a road car. Imagine a car that has a much smaller 2.4 liter V8 that revs up to the race-regulated 19,000 RPM, summons up gear changes in just milliseconds, and can accelerate to 60 MPH in just 2.4 seconds. And acceleration isn’t even the amazing part of a Formula 1 car: its brakes can tear your head off. In just seven seconds an F1 car will start from a dead stop, blow past 125 MPH, and come to rest again with a screeching 5-6 g’s of deceleration.

It’s not that the BMW M3 is a bad car; It’s utterly outclassed on an inconceivable scale. The M3 has a power-to-weight ratio of 230 horsepower-per-ton. The F1 car has more than 1,100. It’s crazy. Just watch:

"…190 mph at the bottom of the hill, 5 g in compression, 4 g in lateral forces, you pop out over the top in Les Combes and you’re still accelerating, climbing gently uphill too, 210 mph…"

"…bring it down to 90"

"…another 100 mph corner"

Is it just me or is this infuckingsane? 5g compression? At 5 times the force of gravity I’d weigh 875 pounds. Holy shit, how do the drivers cope with that lap after gut-wrenching lap?

How did I get sucked into this? Let me explain…I was never into cars until a certain chain of events. It started with my friends telling me to just visit my school’s solar car team meeting. When I showed up they immediately put me in charge of building the telemetry system for the upcoming car. Solar cars are pretty crazy and share lots of engineering such as carbon fiber chassis with F1 cars.

After a few months of solar car I found my first Top Gear video on YouTube. Quickly I caught up with the last few seasons of Top Gear. One of the episodes had a segment where they brought a F1 car out to show just how different they are from even the fastest supercar, the fastest of which was the Ferrari Enzo with a lap record of 1:19. They talked about all the crazy stats behind the car and then put the car in the hands of The Stig. The F1 car destroyed that time with a 0:59 in the wet. This is when I started watching F1—the start of the 2007 season.

Being a nerd, I have an unchangeable need to consume information. I want to grasp all aspects of a problem until I understand it. Then I can move on to the next problem. The only catch with F1 is that the whole system is changing year-to-year and race-to-race. New drivers, new regulations, improved technologies, and unpredictable weather. I’m never going to be satiated and that’s OK with me.

I think there’s a second reason I’m addicted to F1. When I was on solar car I would constantly think, sketch, imagine, and discuss ways to improve the aerodynamics, decrease the weight, create better systems for race strategy. It’s the same thing with F1. I imagine ways to use machine learning to determine race strategy, predict failures, or design a better car. F1’s official website has great technical analysis, detailing each of the changes made by the teams with pretty diagrams, and explaining how it will affect the performance of the car, and giving me even more gritty details to waste my precious neurons pondering.

F1
Image by Tinou Bao

Pitstops in F1 are serious business. Guess how many people are involved on average. If you guessed less than 25 you’re wrong. Let’s break it down:

  • 3 guys per wheel: 1 to operate the airgun, 1 to take away the old tire, and 1 carrying the new tire
  • Lollipop man who signals the driver which pit lane to enter, shows the driver where to stop, tells him when to put the car in gear, then, pending traffic, tells the driver to go by lifting the lollipop
  • 2 guys to clear debris caught in the radiators
  • 2 guys, one front and one back to lift the car up so the tires can be changed
  • 3 guys to operate the fuel rig, which dumps more than 12 liters (3+ gallons) of fuel per second
  • 2 guys to adjust front aerodynamics (sometimes another 2 on the back)
  • 2 guys with fire extinguishers just in case
  • 1 driver

Generally pitstops take 6-8 seconds, but if there’s damage to anything you can add a few people and seconds. It’s “totally fucking busy” as Rands would say.

The engine in an F1 car gets unbelievably hot, reaching 1,800 to 2,000 degrees Fahrenheit. Cooling is provided by 23 cubic feet of air per second during the race—as much air as a human breathes while running a mile. You can imagine why F1 cars can’t drive right behind another car for more than a few laps because the cooler air they would normally be breathing in is replaced with the hot exhaust from the leading car.

Sure they barely get over 3 MPG, but I’m guessing they’re more efficient at converting fuel into energy than almost anything. When was the last time you took a corner at 140 MPH? Oh, that’s right, that’s faster than your car’s top speed. Trust me if a team could figure how a way to increase their MPG they would do it. Less fuel means less weight which means a few tenths of a second advantage. F1 cars are essentially maximization functions manifested in physical form.

F1

After all the crazy stats, there’s even more to love about this sport. And yes, it’s a sport. Just try wearing four layers of fire-retardant clothing in temperatures that exceed 120 degree Fahrenheit, while you’re subjected to dozens of high g-force accelerations, decelerations, and turns, every lap. These forces punish the driver’s body, especially their neck, which must support 3-5 g’s on their head in every direction. Over the course of a single race, the extreme heat and exercise causes drivers to lose about 6.6 pounds.

Lewis Hamilton was in his rookie season as I started watching and I quickly become a fan. The 23-year old’s enthusiasm and love for F1 really shows in his driving. He nearly took the world championship in his first season, which has never been done, but sadly a couple late-season rookie mistakes (of course) prevented him from sealing victory.

I have yet to leave the U.S. and I plan on it as soon as I can. Let me tell you, it’s going to be to see an F1 race. Not sure which one (suggestions?), but I cannot wait to feel the thunderous roar of 22 cars shaking the ground.

Pretty decent self-justification for an obsession, don’t you think?

How do they do it?

March 17, 2008 Link

MacBook Air

Seriously, how do they do it? I have a few computers (four not counting work machines). It’s a fair collection of horsepower. And yet somehow Jonathan Ives has managed create something that, despite being a step back from anything I have in terms of power, I still want it. Badly. Like I dream almost daily about how I could get one. Selling my current laptop of choice even though it’d be a slight downgrade in terms of performance and storage simply isn’t an issue. For me, as long as you have enough RAM, it’s the hard drive that’s the real bottleneck—not the CPU.

Apple, I hate you. You’ve figured out how to generate lust. In spades. It has more sex appeal than Milla Jovovich or Natalie Portman. Fortunately I have (some) self-control. I refuse to get a MacBook Air until: 1. larger, faster, cheaper SSD (it’s only a matter of time) and 2. more RAM (2GB? o rly? I want 4GB).

Sigh.

Edit: You know, thinking about it, I realized I don’t really care about the RAM but the SSD would be nice. Either way, I’ll take one as is. Time to save up!

The importance of being abstract

March 11, 2008 Link

powerbook

As an undergrad, I didn’t spend much time sleeping before a project was due. Then again I hadn’t spent the last two weeks working on it. Now it was 24 hours before it was due and I was hadn’t even thought about how I was going to code an mathematical expression interpreter.

The project was pretty open-ended on how it was implemented but it had to be able to parse and interpret a mathematical expression and evaluate it. The more features your software had the higher your grade, for instance having order of operations, square roots, or variables were all good ways to push your grade into the A range.

Googling turned up an interesting approach I had never heard of before, the recursive descent parser. It was a beautiful solution to the problem, but let me tell you it was hard to wrap my mind around. It’s abstract simplicity was what made it so hard to grasp how it was actually working. I had never thought of using recursion that way; layering function calls into four different levels according to the order of operation. It took hours for me to really fully understand how it worked but finally the “AH-HAH!” moment came to me. I submitted my program, drearily sleep-walked through the snow to my dorm room like a zombie, and fell asleep.

It turns out that recursive descent parser I wrote in a night let me blaze three weeks ahead of schedule in a ten week project to build a Modula-2 compiler in C++.

fluent cluster

Almost a year after graduation I find I still don’t get much sleep, although I guess that’s my own fault. I blame it on the absolute beauty of abstraction. When I started studying computer science it never dawned on me the sheer importance of abstraction. As we abstracted from assemblers to memory-managed languages, we increased the ease, manageability, and speed of development, allowing much more advanced software to be written as fast as Saturn V at escape velocity.

Anyways I sidetracked, let me get to the point I was really trying to share with you. It’s a pair of abstractions called map and reduce that go together like peanut butter and jelly.

So let’s imagine you’ve got the hankering to sum up the first ten perfect numbers. Normally you’d write something like this (in Python, as usual):

sum, array = 0, [2,3,5,7,11,13,17,19,23,29]

for num in array:
  sum = sum + (pow(2,(num-1)) * (pow(2,num) - 1))

What sucks about this is that it’s not very abstract. Why would that matter? Just bear with me and I’ll explain just how awesome this concept actually is. Let’s start by abstracting out the perfect number formula into a separate function:

array = [2,3,5,7,11,13,17,19,23,29]

def perfect(num):
  return (pow(2,(num-1)) * (pow(2,num) - 1))

perfectNums = map(perfect,array)

What’s happened here is we’ve defined a function for calculating perfect numbers, and now we’re mapping that function onto our data set, producing a resulting array of the first ten perfect numbers. But what’s the best way to sum up that array? This is where reduce comes into play:

array = [2,3,5,7,11,13,17,19,23,29,31]

def perfect(num):
  return (pow(2,(num-1)) * (pow(2,num) - 1))

def sum(x, y):
  return x + y

reduce(sum,map(perfect,array))

google datacenterNow we’ve mapped our reduce function onto our previous results, and we finally have the sum of the first ten perfect numbers. Awesome. But wait, isn’t that more code, that’s possibly even more difficult to understand than Lock, Stock and Two Smoking Barrels? Ahh, yes. Why would someone use the map/reduce abstractions? Look no further than Google, who refactored their search algorithm for map/reduce because it offered a leviathan leap forward in speed. Can you guess why?

Parallelization (what a tough word to say!). The beauty of map/reduce is that mapping a function to a data set can be broken up into many tasks. It doesn’t matter if you calculate the first perfect number then the second, or if you split it into two halves being simultaneously executed in parallel. Now imagine your data set is the web and your function is the PageRank algorithm. Apply that to your massively parallel cluster or commodity hardware and you have what is the heart of Google.

There you have it, functional programming’s gift to man: map and reduce. If you’re still confused or have questions, leave a comment!

Frigtarded Leopard DNS issue

February 28, 2008 Link

Audi R8So ever since Leopard shipped in October, I’ve had serious problems with using the Internet. I had just moved to Silicon Valley and the process of new OS, new ISP, and a new router complicated tracking down the issue. Let me assure you, AT&T is by no means a reliable (or fast or cheap) service. Their Uverse service requires you to use their 2Wire “residential gateway”. I’ve got no nice things to say about 2Wire but this time I think the ultimate blame goes to Leopard.

I’ll be the first to admit Apple probably let this one slip through their QA process and that I’m kind of disappointed (perhaps even upset). The problem lies in a newly implemented Request For Comments (RFC), numero 2308. This RFC outlines “Negative Caching of DNS Queries”. Negative caching of DNS queries is a proposal for a way to speed up the user’s experience when network problems arise. Instead of waiting for a timeout to occur, the negative cache resolves near-instantaneously and lets the request know that it’s not going to work. Brilliant idea…right?

Not so fast. Remember my shitty Internet connection? AT&T’s DNS servers are spotty at best and from time to time a lookup will take longer than expected, timing out and creating a negative cache entry. For the next hour. Even though I could perform the look up again and this time it would work, the negative cache entry stops the second lookup from ever happening. So that’s it, I’m hosed right? Nope, Apple has provided a handy command-line application that can manage these negative cache entries. It’s called dscacheutil and it can “gather information, statistics and initiate queries to the Directory Service cache”. For instance to see if there are any negative cache entries run this command:

dscacheutil -cachedump -entries

There’s a column labelled “Neg” and if you see a “YES” then you may be able to solve your problems by flushing the cache manually (instead of waiting an hour):

dscacheutil -flushcache

Thanks to this discussion on Apple’s support website for helping me out! Now I just want Apple, AT&T, and 2Wire to take note and nip this one in the bud.

Tell me if you’ve had this problem or another similar one!

What’s a homepage?

February 25, 2008 Link

I’m pretty crazy…I mean I have the URL structure for Wikipedia memorized. But seriously, I can’t think of the last time I used a homepage. I either type in the exact URL or I type a search into the location bar (in Firefox 2+ just make sure there’s a space and it automatically does a Google search). Does anyone actually set a homepage? What do you do?

Kickin’ ass: Firefox 3

February 23, 2008 Link

I’m sitting here writing this with twelve open tabs. If this was Firefox 2, I’d be somewhere between 300 and 500-something megabytes of RAM. I actually tried to switch to Safari (and WebKit nightly) unsuccessfully. What’s wrong with Safari? Honestly, there’s nothing wrong with it. I’m attached to command-option-arrow-key to switch tabs and I can’t retrain my brain to use command-shift-arrow-key. Oh and one more thing. I’m a developer. I am married to Firebug, which incidentally actually works in Firefox 3 if you get the 1.1 beta. So where was I? Oh yeah. So here I am with twelve open tabs. Twelve open tabs and it’s eating 137MB of RAM. It’s like I just doubled my entire system’s RAM. Holy shit it’s so much snappier and it’s got native-looking UI in Leopard (Although it’s not truly native, if it was I could command-control-d-mouse-over a word to look it up–try that in any native app). Anyways, if you’re running Firefox 2 and thinking of switching, do it now…to Firefox 3.
Dictionary

Updated: slight fix for location bar behavior courtesy of Richard Crowley


Older Posts »