Archive for March, 2007

my yahoo upgrade? Google home page, thanks.

Thursday, March 8th, 2007

I have been a my.yahoo.com user for a long long time (a decade maybe?? Not sure — a very long time). It gave me a nicely configurable portal through which I could monitor weather, market status, business events, and a bit of entertainment all in one page.

My original layout was 2 columns; a narrow column on left with a list of stocks I care about followed by a bit of weather and some of the photo feeds. The right hand, wider, column contained a set of headline summaries.

With this layout, I could make the window as narrow as I wanted with the only lost information being the right hand, least useful, bits of the headline.

With the “upgraded” layout, the WIDE headlines are on the left and the stock crap is on the right. Stupid. But the worst design sin is that there is now this big bloody fracking square advertisement at the top of my right hand column.

Without scrolling, the information that I care about in my right hand column is now pushed off the bottom of the window. Instead of a banner ad that was outside of my customizable content area, I now have to deal with a non-rectangular content area when laying things out the way I want.

Upgrade? Yeah, sure, I’ll take an upgrade. Google’s personalized homepage is looking like a damned fine upgrade, thanks.

Posted in Rants, Technology | 7 Comments »

What about turning on auto_vacuum on Mail’s envelope index?

Sunday, March 4th, 2007

A couple of days ago, I commented on the vacuum-your-mail-to-make-it-go-faster meme passing through the Mac weblogging community.

In response, Garrett Albright suggested that one could turn on auto_vacuum through a bit of a hack (nice one, too — see the comments).

I wouldn’t do that. It will work. Most of the time. And then it won’t. While there is very little data loss risk — the Envelope Index is just that, an index of all of your Mail — there is a risk and it was clearly left off in Tiger for a reason.

First, auto_vacuum was new to SQLite 3.1.0 and Tiger ships with SQLite 3.1.3, which won’t be updated unless a serious security hole is found. There have been a number of bug fixes to vacuum and vacuum related functionality since 3.1.3. In particular, there have been a handful of fixes that prevent relatively esoteric situations from corrupting a database. Some of these were directly related to auto_vacuum and some were simply catalyzed by auto_vacuum.

Secondly, it isn’t going to buy you that much performance over periodically vacuuming the database. Most of you who have manually vacuumed your database are seeing a performance boost related to the removal of 10s of months of garbage built up in the database. Running vacuum after only a week or two of Mail activity is going to yield very little benefit.

That is, the additional risk of running with auto_vacuum enabled with a 3.1.3 based SQLite database isn’t worth the very slight additional performance you’ll see on a day to day basis. Better to simply manually vacuum the database every six months or so.

Posted in Mac OS X, Software, Technology | 8 Comments »

crab, Crab, CRAB, CCCRRRRRAAAAAAAAABBBBBBBBBB!!! (and LOTS of tequila)

Sunday, March 4th, 2007
Bbum Cleaning Crab

Last weekend was the crab party. 175 lbs of crab. 140+ people. 30 lbs of smoked pork. Over 9 liters of really fine tequila. Home brew. Delicious food. Awesome company.

This was Crabtacular IV: The Boiling. Beyond being bigger than ever, the party achieved a couple of additional milestones. More crab than ever at 175 lbs of live dungeness. Corporate sponsorship in the form of weenie roasters and amazing tequila.

And I didn’t take a single photo. There were far, far more capable photographers attending than I and they took some amazing shots.

I owe a lot of people a huge thank you. Ben Holt for helping to engineer the massive tarps that we hung over the backyard (and for tying all the knots) — lowest spot was 8 feet, making it feel like a whole outdoor room had been added to the house. Duncan & Pinar for taking this amazing set of pictures (including the one seen at left). Buzz Anderson grabbed some great shots, including an awesome shot of myself with Guillermo Erickson Sauza and a crab.

And, of course, to Christine– my awesome wife and co-host of the party. Could not have thrown such an amazing party without her.

And, of course, a huge thank you to everyone who came to the party!

Crab was the center piece of the party. Lots and lots of crab. While most of the crab was served boiled, a number of folks made all kinds of delicious crab recipes or combined crab with other foods in delicious combinations. Bacon wrapped jalapeno peppers stuffed with crab anyone?

Read the rest of this entry »

Posted in Entertainment, Life, Tequila | 8 Comments »

The perfect dog roaster?

Sunday, March 4th, 2007
The levitating dog

I like hot dogs & sausages. A lot. Grilled well done, at that.

But I hate the black crispies that are induced upon grilled dogs where they touch the grill. Yuck.

Obviously, the dog needs to be lifted off the grilling surface while over the fire. Now, one could use a stick, but that is a pain. And for a gas grill, it prevents the lid from being closed, thus taking longer to cook.

Now, clearly, that dog in the photo is lifted off the grill. Almost levitating.

Neat trick, huh? Click on through to the solution created by the fine folks at RoastMyWeenie.com. The solution is a bit, um, phallic in nature — might want to think twice before clicking through if you are in a particularly prudish context….

Read the rest of this entry »

Posted in Entertainment, Food | 11 Comments »

Vacuuming Mail’s Envelope Index to make Mail faster (and Aperture, too)

Friday, March 2nd, 2007

Update:

In response, Garrett Albright suggested that one could turn on auto_vacuum through a bit of a hack (nice one, too — see the comments).

I wouldn’t do that and I have explained why in a followup post.


The weblogging world is all abuzz with this simple hack which makes Mail.app faster, more or less depending on how your Mail happens to be configured and your coincidental usage history.

There seem to be quite a few questions about what is going on. I figured I’d throw out a bit of clarity to the situation.

To invoke the command, do the following:

(1) Quit Mail. This will prevent any lock contention issues.

(2) Go to Terminal and copy/paste the following line:

/usr/bin/sqlite3 ~/Library/Mail/Envelope\\ Index vacuum

The details:

/usr/bin/sqlite3 refers to the SQLite command line tool. Nir Soffer suggested that I use the absolute path to avoid any conflict with sqlite3 binaries installed by things like Fink, MacPorts, or the like. He is correct and I updated the command. It is an interactive shell that can be used to interact with a database or with multiple databases.

~/Library/Mail/Envelope\ Index refers to Mail’s envelope index, a SQLite database that Mail uses as a cross reference for all your messages, mailboxes, and accounts. The ~ means “in my home directory” and the \ is shell speak for “no, really, I meant for the next character to be treated as data, not as some special invisible Unix goop”.

vacuum is a SQLite command that will remove all unused pages and generally compact the SQLite database. You don’t need to specify a table name as the original post suggests. It has been ignored since the vacuum command came back in SQLite 2.8.1 (it was originally in 1.x and removed in 2.x, to return in 2.8.1).


So, what is really going on? The Envelope Index file dropped from 10s of megabytes down to only a couple of megabytes??? What data was deleted?

OK — here starts a bit of technical spewage regarding the details of SQLite’s internals. Not in any depth, but enough to understand what is happening.

SQLite is, as its name implies, a SQL based database storage solution. The “lite” part is that it is designed to be embedded into an application and to store data pretty much directly to/from disk, not electing to use the more common client/server two or three-tiered architecture of a traditional relational store.

Unlike most database solutions, there is no server as a part of SQLite. Internally to your application you call — or you tell Core Data to call — some SQLite functions that go off and deal with the database. These are designed to be very fast and the whole thing is designed to have minimal impact on your application. So, just as there is no random external server process, SQLite doesn’t spawn threads — worker bees that can operate independently in an app — to do various tasks.

Now, a database is designed to retrieve data very quickly. As such, the data written to disk is generally written in a highly structured fashion such that scanning and retrieving subsets of the data can be done quickly and can be optimized– or indexed– to make certain kinds of queries very fast.

Whenever new data is written into such a data store or existing data is updated, the structure of the data in the store has to be adjusted to optimally represent the data now contained to maintain query performance.

SQLite happens to use a storage structure derived from B-Trees that uses pages — equally sized chunks of the overall data file — to store the data. As the data in a database is updated, the pages are re-organized and, occasionally, an update of the database will cause a page to be orphaned. That is, a page will no longer be used but, because of the need to optimize the queries, it won’t be reused either.

So, the vacuum command effectively copies each and every in-use page in the database file to a new copy of the database file. As it does so, it omits all unused pages and it optimizes the fresh copy such that query performance will be as fast as possible.

If this is the case, why doesn’t Mail periodically perform a vacuum command?

There are a number of reasons why you would avoid it. Most importantly, it can take a really long time and there is no way to predict how long it might run or what the savings might be. Not exactly the kind of thing you want to subject the user too if the general performance profile is “good enough” (and it mostly is).

And this is a problem that really should be addressed in the database itself. SQLite should be responsible for appropriately recycling unused pages and generally optimizing the database file as it goes. By doing so, it should be able to amortize the potentially large cost of a periodic vacuum across each INSERT or UPDATE of the database.

And that is exactly what SQLite has done in more recent versions. SQLite now has an auto-vacuum feature that will cause the database to effectively stay “vacuumed” of free pages automatically and without need to periodically do a rather intrusive copy-and-fix operation.

It can be turned on or off on a per-database basis for optimization purposes. But only at database creation time. If you have a database into which data will only ever be added — a logging application, for example — you would likely turn off auto-vacuum as it will just incur overhead without ever being able to shrink the database.


There is another useful command you can use at the command line in a similar fashion. During the development of Tiger, I lived by this command as there were a couple of periods of time where the filesystem had embraced chaos when it came to writing data.

/usr/bin/sqlite3 ~/Library/Mail/Envelope\\ Index 'PRAGMA integrity_check'

'PRAGMA integrity_check' causes SQLite to walk the entire internal structure of the database and make sure everything makes sense (as much as possible). The 's at the beginning and end of the SQL stuff tell the shell (the thing in Terminal that interprets what you type, for all intents and purposes) to pass 'PRAGMA integrity_check' as a single argument to sqlite3 command, instead of breaking it into two arguments separated by a space. Now, sqlite3 could be smart enough to deal with this. But it isn’t. Such is the unix way.

SQLite’s integrity checker will look for out-of-order records, missing pages, malformed records, and/or corrupt indices. If there are none, the command emits a single line saying “ok” (sorry about the mistake before — chalk it up to an unfortunate Terminal related issue).

If you happen to execute the above command and it emits any output save for “ok”, recovering from the problem is really quite terribly easy for Mail. Just delete the Envelope Index:

rm ~/Library/Mail/Envelope\\ Index

When deleted, Tiger’s Mail will re-import all of the messages as if you just migrated from Panther. Nothing lost save for a bit of time, potentially quite a bit of time if you have a particularly large set of Mail.

Obviously, if a SQLite database contains unrecoverable data, the above would be a very bad idea. Recovering data in such a situation is very difficult.

Update: Yeah– I hate Unix. When I wrote the post, I had included the appropriate “\” escaping of all the commands and even called out why they are necessary. Apparently, either Wordpress or MarsEdit ate the damned slashes. Grr. Fixed. Thanks for pointing out the error.

BoingBoing has picked it up, perpetuating the incorrect command (works, but the table name is not necessary — no big deal). The hawk wing site now has a couple of scripts that nicely automate the process.

Of course, this will work for any SQLite application that uses the built in SQLite on Tiger and does not periodically vacuum it. For example, Steve Weller has tossed together a script to update the sqlite database in Aperture’s library.

Posted in Mac OS X, Software, Technology | 39 Comments »

A-shake-shake-shake…

Friday, March 2nd, 2007

A 4.2 quake hit just northeast of Berkeley at 8:40pm this evening.

It jostled my chair ever so slightly (an Aeron in full bouncy mode) and made the shelves / TV pop a little. I wasn’t the only person to feel it.

I knew what it was when it happened and didn’t really even think about it. It was quite minor here, but likely caused light damage near the epicenter. Shook up a basketball game a little bit, too.

I fully expect to lose control of all bodily functions when a quake that size happens nearby or when a much larger quake hits in the area.

Tally? 4 quakes since moving here nearly 4 years ago. One was a 3.4 basically directly under our house — woke me up. One was at Apple; just a bit of movement caused by a good sized quake south of us. One was at home; my wife had just gotten done with a rousing round of Dance Dance Revolution and stated that either she was having a heart attack or we were having an earthquake. Thankfully, it was another medium sized quake south of us. And now this one.

Oh, and I sort of woke up, but mostly slept through, a quake in mid Missouri when I was about 8.

Posted in Life, Nature | 4 Comments »