More Virtualization

I've been thinking about code distribution. I like native code, and I'm continually impressed by the divergence of "native" capabilities (e.g., pixel shaders and fantastic low-level optimization) from the execution and display capabilities of the web.

When I get around to thinking about it, it seems like the flaws of .net and java on the desktop were the idea that these problems could and should be solved in user space, and that nobody had to do any hardware or new OS technology to make things work.

I had one conversation in the past week about how I think "apps should be VMs", and communication across processes should be done through authenticated channels. I should be able to download an app, try it out, and uninstall it, with no trace left on my PC, no matter how bad the app is. A decent scheduler and resource monitor should be able to take care of the rest: don't use all my disk time, don't use all my RAM, etc.

Then I had another conversation at Siggraph with some guys working on "Larrabee" at Intel, and how we might soon have GPUs executing native x86 code. And I was thinking, oh, an almost general-purpose massively parallel chip that's naturally firewalled from messing with the OS? This sounds rather like a VM, again. Flash today lets me write pixel shaders that "tunnel" into the hardware--remote code, but a limited subset. What if I could download a native x86 "pixel shader game" and run a big percentage of it on my GPU?

These thoughts are probably oversimplified for someone who actually does security for real, but a native code sandbox (there are many) that works in the browser, or even a full "light VM" environment seems extremely feasible for someone who makes big OSes.

User perception of this? Installs are "one click", uninstalls are "one click". Code just works again, though sharing data stills needs more specific solutions.

And I guess this leads to another thought: if Microsoft had shipped Vista as some sort of "app VM" where apps could install into sandboxes with no UAC prompts or annoyance, we'd think of them as magical, as technology geniuses. But I think where Vista fails is in doing this establishing a secure boundary, but making the user deal with it. Virtualization & amazing sandboxing could potentially defer these decisions--antivirus software could analyze what an app was doing in its VM, and users could make informed decisions about trusting an app, more or less.

I've run across a number of problems where solving them "at the core" makes everything else simpler. I think the success of VMs (e.g., VMWare) in the enterprise proves that this is all technically feasible, and I think virtualization at a massive level should be the way we deal with untrusted apps.


1/3 the insurance: FDIC protections unchanged since 1980

The FDIC protects up to $100,000 in deposits, right? But did you know that this amount was set in 1980 and hasn't changed (in nominal terms) since?

Lorna and I just looked this up, and in real terms, FDIC protections for deposits have declined in value by 2/3 since 1980, when the $100,000 insurance rate was set. Today's FDIC protections are worth just $30k in 1980 terms.

On a somewhat-related note: I was talking with an IndyMAC customer last week who said that if you had deposits exceeding the FDIC limit, and you have a loan through IndyMAC, they deduct the excess from your loan amount. Nice of them, if you're in that situation.


Little Picasaweb feed viewer

I made a simple scriptaculous+Picasaweb display widget a few months ago for Lorna's TED sketches:

If you want to look at the code, view source on that page or look here:


Leaving Google...bye Picasa!

It was seven years ago that I zipped up the first build of the software that would become Picasa. A year later, we shipped Picasa 1.0...with the team sleeping on my floor and working on $14 card tables all over the apartment. Back then we had to test things like Printing, so there were printers and scanners and USB cables everywhere too. Tara overheard the cleaning lady call me "loquito" (which I'm told is an affectionate term for "crazy") and being amazed with how many cameras there were in one place.

After becoming part of Google a few years later, and seeing Picasa at a scale we never dreamed of back then (40 languages!), I've decided to push the reset button... and start over.

Today was my last day at Google...and it was a tough decision to make. Saying goodbye all at once is actually really hard. I'm very excited about what's been built recently and what's coming for the future. I believe in the team very much.

But I need a change, to get back to that elusive flow & creativity that makes new things. My best work at this time in my life probably isn't in being a manager, even if I love it. For now I expect I need to re-train my brain to make little things, useless things, silly things, and make a lot of them. This is the only way I know, really.

More importantly, Lorna and I are going to travel a lot, and take pictures a lot, and play with our puppy a lot.

And then, after the addiction to 500 emails a day and meetings wears off, I might relax enough to make something really interesting. I guess I'll keep you posted.



I could be wrong about this, but the papers in the Advance Program for Siggraph 08 look considerably cooler than they've been recently.

Leave a comment if you'll be in LA in August.


We got a new puppy. She's named Maggie.

We take her for walks and people stop us so they can kiss her.

Posted by Picasa

boot times

One of the killer features of the iPhone is its boot time. If you want to check your email or check a quick fact on Google, the iPhone takes a single click to become responsive. It "wakes up" instantly.

My laptop...doesn't do this. First, it doesn't last very long in "suspend" mode (it has to power all of its RAM and the battery only lasts so long), so it ends up "hiberating" after awhile. This makes opening the cover take 20 seconds. After that, it has a tough time finding its preferred wireless network and getting an IP address from DHCP (altogether ten more seconds), and this makes it almost faster to walk into the next room and use a desktop PC.

The PC industry has been talking about this problem since the introduction of the Mac in 1984. And now I can actually buy a big chunk of Flash disk to wake my computer up faster.

But after the hardware problems, the software layer is still not built for this -- getting "on" the network (and reconnecting to IM services, email, ajax apps, etc.) is also too slow.

In addition to improving wireless/DHCP, we could a lot better with desktop APIs. Today the Windows OS doesn't give good signals about "why you're not connected to the Internet". It could be a proxy server, or T-Mobile wanting you to login, or just "I don't have a network address yet".

If you write software, you get a message like "Something broke. Sorry." You can't ask again really fast, because it might actually be a server that you're talking to (an overloaded proxy or your own production box). So you end up waiting a while, and then trying again. This means that on average, applications will take 30 seconds or more to wake up after you have a real network connection. Yes, you'll say, Windows has some of these APIs, but they very simply don't work. They'll pick the wrong network adapter or just give wrong information. And so everyone ends up being careful instead. And you end up waiting another 30 seconds.

Even if there were a single service on each PC that did this really really well, and other apps could ask it, "Hey, is there internet yet?" that would be a huge improvement.

Until this kind of thing gets addressed, the PC is going to lag the mobile phone for a whole lot of applications. That's pretty sad, because a few smart people could fix it pretty fast.


spreadsheet bookmark

I added a shortcut to to my browser toolbar, which lets me launch a new spreadsheet faster. I've had a two-key shortcut to Excel for years but always the web version was too hard to launch. Now it's not!



My 94-year-old grandfather passed away last week. I've just returned from Florida, where we had the funeral and started moving my grandmother to assisted living. We thought she might have room for only one picture, and she picked this one I took a few years ago.

I'll miss you, papa.

Posted by Picasa


Another view on low rates

The Giant Pool of Money (This American Life)

Last week's edition of This American Life (finally) did an article on the credit crunch. And among a lot of CDO-funny-mortgage talk, there was a very nice nugget that I took away. Why exactly does a low Fed rate lead to the current set of problems? If you think it's because "mortgages were cheap", that's only part of the story.

You usually hear financial magazines talk about the Fed rate in purely "growth vs. inflation protection" terms, but the point in the This American Life piece is that it's important to see the downstream effect on Treasury rates and what this does to "cash as an investment".

When you create a situation where money and credit are cheap, you also make cash a bad place to invest. (That's the nugget.)

When cash is a bad place to invest (because it doesn't keep pace with inflation), you make people take more risk in order to receive a return on their cash. In so many ways, you've compounded the problem: people can do more risky things with other people's money because credit is cheap. And the people who have the job description "keep cash safe" also have to take more risk to do that job.

The Fed is in a very difficult position right now, and bursting the credit bubble is no fun for anyone. Among other things, if you raise the overnight rate, ARMs reset to higher rates and more people lose their homes, creating the expected avalanche of problems. (Of course, there is some room for the Fed to move because the mortgage market has priced in some of these long-term effects already.)

I think the important idea is that cash is an investment. People will hold more of it either when they're (a) terrified, as in a flight to safety, even holding it at a loss, or (b) it has a good return under normal circumstances. Otherwise this cash will move to other places.

I do hope we can return to a healthy balance, where all this cash can be used to drive real investment, rather than the speculation of the last few years.


The Stable Marriage Problem

Nope, this post isn't about my home life. :)

There's a problem in computer science called the "Stable Marriage" problem. It's about how to match one set of people other people, based on asking each of the groups what they prefer the most.

It's best known as the system used by Medical school programs to match students with programs they like. For medical school, each applicant presents a ranked list of schools they would like to attend, and each school does the same. "The Match" picks the a good global solution to satisfy all these wishes. Not perfectly, but well enough that it "maximizes happiness"...or at least the computers think so.

I've been thinking about the comparisons with housing. And rather than having academic credentials like prospective med students, buyers have money, in varying amounts.

Recently, buyers have had a multiplier on their money: the amount of risk they were willing to tolerate in toxic loans (or they were otherwise convinced they could "afford"). If you were willing to accept a negative-am loan at a variable rate, or maybe a little appraisal fraud with cash back at closing, you could afford "twice as much" house for the same monthly payment. And as we know, home prices in some areas increased by 180% from 2000 prices.

So let's follow this argument to its painful conclusion: if the MCAT administrators were to say, "As of 2004, we're doubling all the test scores! It should make everyone so much more pleased with their results! With twice the score you'll get into a much better school!" Across the board, a rising tide lifts all boats, right?

Of course, because this is a contrived example, you know that nothing at all would change except for the MCAT scores. The Match would proceed identically to the year before, with everybody ranking schools in the same order and vice-versa.

And in areas like the one I live, where almost no new housing was created in 2004-2006, this is exactly what happened.

The loan amounts doubled. For just a bit, people got a little more house than they would before--they "matched" a little higher. But after awhile, they got the same house, or a little smaller one, for twice or three times the money.

I suppose all I'm saying is that the "housing market" just does something that most people don't readily assume: prices reflect demand, not value. After you get over that, price is just a number based on what everyone else can afford.

Of course, occasionally some value was added: Los Angeles County alone kept the Viking corporation in business. But upgrades to existing structures? 5% increase in value for a 100% increase in price. Not value, demand.

I usually get out my moral indignation hat and put it on at this point in the story. It makes sense that new construction of the highest quality could cost some money. But it seriously doesn't make sense for a house that cost $15,000 when it was purchased to now cost 100x as much.

But this is apparently how markets work, and I suppose that we'll see how they work on the other side of the housing bubble as well.


the caffeine test

My results?

You clicked 284 times in 30 seconds.

Your caffeine level for today is:

Near Death - Delusions of Godlike power


The Spreadsheet

I took this post down for a bit, because I wrote it at 4AM. Google Reader appears to have kept it indexed, so I've just succeeded in confusing people. It's back, warts and all.

There are lots of things I don't talk about on this blog. The housing bubble has been one of these. Housing is about money, and money is like politics and religion--you don't talk about them in public so much. But since awareness of the housing issue has shifted over the last year, it's a bit easier to talk about now.

If you've asked me about housing in the past 18 months (and if I wasn't being careful because you'd just bought a house) I almost certainly talked your ear off. I know lots of statistics. Lots. I rant. I'm obsessive. Sorry.

Lorna and I have been bearishly watching the housing market in Los Angeles since late 2004. We got married in 2006 and really wanted to move out of our apartment. Our friends all say, "You have the money. Why not?" And this is why not, yet.

Lorna found Ben's Housing Bubble Blog back in the very early days (2005), and we've been hawks in places like the nerdy but wonderful Calculated Risk ever since. I'll even confess to meeting people we met on the internet to talk about this. We thought we were insane for the better part of two years.

But the Internet has very much kept us from buying a house.

The problem was that we were aware back in early 2005 that the national income-to-housing price ratios were way off, especially in California. Other than the information we found on the blogs, Shiller's "Irrational Exuberance" (the second edition) was a really early indicator. Shiller posted charts and graphs that would make you say "something is very wrong." In our area, people were frequently spending 15x their income on housing. Expert advice says 3-4x income is actually manageable for most people.

Lorna even did a tongue-in-cheek art project featuring an ad for a $2m zero-down NINJA (no income, no job, no assets) loan. Do you think she made it up? Nope, it was clipped from an actual magazine in Los Angeles.

We studied the usual spate of statistics (LA prices throughout the 1990s) and decided that at some point housing would have to return to some reasonable multiple of income. These cycles had come back to earth twice before in LA, and it made sense that it would happen again, especially because this one was so much more extreme. We knew one or two older people in LA who said, "Wait. It came down last time." Not many, though. Most were of the lemming mindset, "Buy-now-or-be-priced-out-forever."

We were both doing really well from the Google IPO, and we actually could afford to buy a house, or so we thought. We could even buy a big house, maybe in nice part of town, right?

The Spreadsheet

One night, we made The Spreadsheet.

We wrote down a number, for a reasonable house, a 3 bedroom on a modest lot, or a very nice condo. Then we looked at historical values from 1990-1995, and decided that it might depreciate 20-30% in 5 years. Then we added in closing and realtor costs (8%), and taxes (1.2% a year), and insurance. And then we looked at the total.

The Spreadsheet said we'd pay 7 times our rent to live there for 5 years, and then sell.

Double-checked the math. 
Double-checked the rates. 
Double-checked the taxes. 
Double-checked the tax deductions.
Pretended we had a discount realtor.

7 times our rent.

Oh, and the house you could rent for 7 times our rent? A mansion in Beverly Hills with 6 bedrooms (not that we needed that). A big estate on Malibu Beach.

The Spreadsheet is dangerous.

The thing that we realized is this: because housing is financed with so much leverage, nobody can afford a house if housing prices decline. The numbers are incredibly scary.

Peter Viles reported that the median house in California is falling $2788 per week. That means the $550k median house in California "costs" the equivalent of $15,000/month, in rent. That amount should get you a big mansion in Brentwood, not a condo in Inglewood. The median homeowner cannot afford $15,000/month in rent.

In Santa Monica in early 1990, if you purchased the median house, you'd have been underwater in real value for 12 years. It didn't make sense that people who still remembered this sort of thing would do it again. But they did. And the west side of LA was the worst.

I have some thoughts about how we've gotten here. And we've heard the most awful stories, of toxic loans and crazy HELOCs and bad decisions. But how do people who had paid off half their mortgage a few years ago now find themselves in foreclosure?

I believe one big flaw is in thinking about your finances in monthly payments. People who HELOC'd their family home (taking out more than they paid in the first place) simply because the payments would be low (for 2 years at least) never actually tried to imagine that they were taking on massive amounts of debt. They believed that they had earned this "value" and that the debt was secondary to the whole windfall. They didn't try to conceptualize paying it off, or what that obligation would mean to their future.

Now, we're hearing about 7-year car loans, so that quite a decent percentage of people who sell a car now are underwater in their payments. It didn't matter for the first few years, though. There are so many people with loans they can only afford in the short term.

Lorna has been reading up on studies that say that fear and depression beget short-term thinking. (Phew, that's a topic for a whole other post.) But 9/11 and the resultant fear? Perfect time for 2/28 loans. You might not live another year. Why not have a nice kitchen?

There was also a funny psychology about these gains. If you realized that you couldn't actually afford to pay for a house but bought it anyway, it was very likely with the idea that you might sell it, earning a 100% return after a couple years. Great idea, right?

Well...when you move, you pay the difference between two properties, and presuming you bought a similar (or a larger house), that difference would get largerIt seems to have occurred to nobody that you couldn't win at this game. Where would you move after you sold your house so that you could afford to live there? To Arkansas? Kentucky? Or would you just "walk away"? I've actually met some real, live people who sold and now rent, but they are an extremely tiny minority. For most people, once they buy a house, they keep buying houses.

Lottery winners are famous for ending up in bankruptcy. And the short-term mindset is exactly the same. I remember overhearing two 25-year-old guys in a restaurant in 2006. They'd bought 2-3 houses apiece, and were discussing their gains. I still remember their giddy "It's free money!" refrain. Was it, really?

I think it's actually true that many people have "trusted the system" to do what's right, and I have to agree that the system has been extremely broken. Buying junk bonds with 32x leverage is a topic for another post.

Someone told me once that "you can only call the housing market once". As much as I rue the day I committed that to memory, it has been hugely informative. Our Spreadsheet took 10 minutes to make, and it told us a huge amount about what our future held. I really wish more people had done the math. It takes perhaps 8th-grade math to make your own. No calculus or trig.

We still want to buy a house very much, but we'll wait just a bit longer...until the spreadsheet makes a little more sense.


the harmonic mean (MPG standards)

One of the bits of math that's interesting to me is the "harmonic mean". It says that in things like fuel efficiency for cars, you often pay for the worst MPG vehicle, and it doesn't really matter how efficient you make the best one.

For a simple example, we'll consider a hypothetical Range Rover (10MPG) vs. a Prius (60MPG). You might think that a Prius "cancels out" a Range Rover in a sort of fuel-consumption way. But that's not true.

For instance, you compute a "simple average" like this: 60MPG + 10MPG / 2 = 35MPG. But this math is simply wrong. In fact, you have to use the harmonic mean (average the numbers in "gallons per mile") because you really care about gallons used, not miles/gallons.

Using the harmonic mean for this? 1/(1/60 + 1/10) = 17MPG on average.

How many Priuses does it take to "cancel out" one Range Rover (achieving the 35MPG above?)


It takes six Priuses to cancel out a Range Rover.

What's important here: improving the worst vehicles on the road is more important than making the best a little bit better.

The Hybrid Chevy Tahoe is much more important in the overall scheme of things than a plugin hybrid. Improving from 60MPG to 100MPG is diminishing returns until you get the 10-20MPG cars off the road. This includes old models! Improving from 10 to 30? Really significant.

Luckily the CAFE standards take the harmonic mean into account. But understanding this math explains quite well why "fleet averages" move so slowly upwards, even as technology gives us great ways to make the "best" MPG really quite good.

It also explains why our consumption levels are still going up. It will take years and years after the CAFE standards for new cars have improved for our actual consumption to decrease.

Practical ways to "reduce our dependence on foreign oil" should take a hard look at the worst vehicles on the road today, and not always try to optimize the best for slightly better gains.



Dec. 19 2007: The Energy Independence and Security Act of 2007 was signed into law. For the original text, go to p83 here:

This law progressively outlaws low-efficiency lighting (e.g., most incandescent bulbs) for "general service" lighting (310-2600 lumens, or approximately what you'd call a 30-150W incandescent bulb in a normal socket.)

There are special purpose bulbs that are exempted, but the bill appears to try its best to prevent exemptions. Notably excluded are 3-way incandescent lamps and reflectors, but there's quite a lot of provisions: if the sale of one of the types doubles, they'll make an effort to outlaw it, fast.

I have some concerns and comments:
  1. This law would be appear to me much better with a progressive tax on energy-expensive sorts of lighting, so people can gradually migrate to new form factors. I tend to dislike "prohibit the sale of X by date Y." There are always exceptions not granted by a law like this, and an economic solution would be much more appropriate. This is heavy-handed.
  2. It's not clear that the technology is appropriate to the problem (and let's hope the intervening years help it somewhat). For example, the bill specifies a minimum of 80CRI. This is rather insufficient for lighting high-quality artwork and photography (where 90+CRI is preferable). While high-CRI fixtures like these are available for purchase, it isn't clear to me that they will be available to the average consumer. (Incandescents are 100 CRI, which means that they represent all colors well, not just some.)
  3. Directional applications are not well covered by CFLs, as they do not have both compact and high-output configurations. A powerful CFL is a very large CFL.
  4. Low-intensity dimming is also not well covered by low-energy light sources today, and the warm candle-lit 1800 Kelvin output of an incandescent when dimmed may be replaced by the sort of sickly flicker that CFL's give at the same intensity. Dimming generally is not a strength of CFLs.

At home, we have replaced most of our "general" lighting in the house with CFLs. But it's the exceptions that make the place feel like home. We have very warm lights (yes, incandescents) in the bedroom that make you feel like sleeping. There are special lights for displaying artwork, and there are dimmers.

As I recall, most energy expenditure and CO2 emissions today come from heating and cooling (primarily heating), not from household lighting.

I've even been having the following thought this past few months: is it possible that the "waste" heat from Halogens and Incandescents actually cancel out lower heating bills, when used in cool climates?

It's nice to see some movement in this direction, but I wish in many ways that it weren't so heavy-handed. There are many market forces that would make this happen regardless: price, cost, etc. It makes so much more sense to me to find an economic solution.

I don't really want the "Attorney General" involved in "prohibiting the sale" of certain devices: they're not munitions and not imminently dangerous. The problem is solvable by great technology and prices in the market. The exceptions in life make it enjoyable, and I hope this bill spurs research in lighting to develop new solutions to many of these problems.


anniversary gifts

Lorna and I have been married for a year. That means (if you look it up) that we've just had our "paper" anniversary (meaning your anniversary gift should relate to paper). Technically we're allowed to substitute "clocks" if we're modern sorts of people.

While there were other gifts that I'm not going to go into, I thought it was worth sharing the paper one.

Over the past year we've had our honeymoon slashdotted and we've been on TV for not buying a car (because they wanted fingerprints first). So apparently we have some sort of privacy theme happening, at least in public.

So we bought ourselves a lovely 15-page micro cut paper shredder. (Frank Abagnale's picture is even on the box, promising that your identity won't be stolen as often if you use it.)

We had a really fun time cleaning the house of all those credit card offers, too.


Seam carving

Shai Avidan and Ariel Shamir made a cool image resizer.
It's terrifically easy to implement the basic technique. Try this thing I made.

Took about an hour or so.


Antialiasing styles

Some debate online over Safari's antialiased text on Windows.

Maxim has a good post here: Font Rasterization (Antigrain)

But I'll point out two things missing from the discussion:

1. Yes gamma correction is very important (I use gamma=1.4, and gamma=1/1.4 depending on whether or not I'm rendering dark or light text). Safari on Windows doesn't do seem to do enough gamma correction and so the comparison of "pure vector" vs. "hinted vector/cleartype" isn't quite fair here.

2. Filtering is also important. The original freetype paper had some mention of this, but most systems do box filtering in practice. If you box filter your fonts, you will not get consistent stroke widths. For my bitmap renderer, I use Lanczos-2 sampling from a 4x4 box-filtered source. (i.e. scaled to 25% at the pixel level). If you were really clever, you could do the analytic version of this for a vector renderer.

One of my favorite filtering tests (and subpixel tracking tests) is the "horizontal crawl" - make your text animate at +1 pixel translation/second, and see if it looks solid.

Picasa's does.


firefox mis-step

I apologize for maligning firefox's startup speed. It turns out if you remove all your extensions and toolbars, it starts faster than IE again.

Went from 6 seconds to 1 second that way.


chunky vs. reusable

I was thinking about how code evolves, since I found myself saying to Ari today, "It's about composition, not derivation. Everybody wants their own widget these days." Out of context that doesn't mean much, but let me explain.

Code gets chunky over time. It gets monolithic and intertwined, and it's inefficient to avoid this. Some code will only get used for one thing, ever, and it doesn't make sense to refactor that 100 lines of really spaghetti code into 5 functions.

But at the same time, for some code (more than you think), it does make sense--you refactor to make things just a little less intertwined, just a little more general, and eventually you can use it somewhere else entirely.

Why the caution? Why not do this all the time? All the popular programming books say to...

Well I've met Java programmers who make this sort of activity into an art form, with 75 interfaces and design patterns for a tiny simple function, so that their abstraction makes useful work impossible. Understanding their code requires days of reading. Basically, it's a way for them to show off, and that's not so good. (I don't know why this kind of thing centers around the Java part of the universe, but it seems to.)

In short, refactoring in the extreme makes for complexity, not simplicity. And simplicity is really the goal.

Some code will stay chunky, and that's fine.

Somewhat related to this discussion is one of the coding laws I kinda tripped over a number of years ago, and which I consider mostly magical:

Reduce Dependencies!

If you write code that doesn't have huge dependencies, or has well thought-out ones, you'll find that you can reuse it, that you can use it for another purpose or in a whole other application, and it's not hard.

If you write code with huge dependencies, this won't happen. I really believe in "build the tools, then build the application" idea, and while you should feel great if you finish a feature that real people can use, you should feel even better if you make a feature and a bunch of reusable technologies at the same time.