Monthly Archives: February 2009

Safari? SQL? Seriously?

So let’s say you your friend has a wordpress blog and you weren’t he wasn’t smart enough to back up the files in the theme and then working late after a long day to tweak some details, as the grand finale of a comedy of errors involving lots of open tabs and multiple browsers, the css file that actually lays out the whole theme was truncated in a manner which is most approproriately described as ‘obliteratisticated’.

First your friend comes to the realization that while WordPress stores revisions of posts and pages, editing themes is without a safety net. As this sinks in, he realizes that while the site has been reloaded on Firefox, Safari is sitting there with the page loaded with the old css. Hallelujiah, he can just dig that out of the cache… there is a cache right?

This was rocking Safari 3.1.2 on OS X 10.5.5.

I’m writing this because at point there was a lot of google and a bit of thrashing, uhm, for my friend.

You might find a ~/Library/Caches/ and think there is something in there, and waste a bunch of time but this will only lead to swearing and teeth gnashing.  At some point Safari decided that was not the place to put the Cache.  If you have a newer version of Safari this is not your cache, this is an artifact from some Safari of days gone by.

The Cache.db file you want is in /private/var/
/private/var/folders/sn/SomeLongRidiculousHashedUpBS/-Caches-/ to be exact.

That big blob of a file is a little sql db and you can search through it with sqlite.

sqlite2 Cache.db

Now that is is open you can get the lay of the land.

sqlite> .schema
CREATE TABLE cfurl_cache_blob_data
      response_object BLOB,
      request_object BLOB,
      receiver_data BLOB, 
      proto_props BLOB,
      user_info BLOB);
CREATE TABLE cfurl_cache_response
    (entry_ID INTEGER 
                   PRIMARY KEY 
     version INTEGER,
     hash_value INTEGER,
     storage_policy INTEGER,
     request_key TEXT UNIQUE,
     time_stamp NOT NULL
CREATE TABLE cfurl_cache_schema_version
    (schema_version INTEGER);
CREATE INDEX proto_props_index 
    ON cfurl_cache_blob_data(entry_ID);
CREATE INDEX request_key_index
    ON cfurl_cache_response(request_key);
CREATE INDEX time_stamp_index
    ON cfurl_cache_response(time_stamp);

The data you want is in the cfurl_cache_blob_data table in the receiver_data column.

If you know something about the contents of what you are looking for then it is going to be easy:

select receiver_date 
          from cfurl_cache_blob_data 
          where receiver_data
          like '%What I Know%'

If you know the file name you should be able to use where request_object like '%filename%'

This version of Safari for whatever reason, and maybe it is my settings, doesn’t seem to be caching images, which is pretty awesome…

Hey Apple… WTF?

Mountain West Ruby Conference

Rocky Mountain High

Rocky Mountain High

I’m definitely looking forward to Mountain West Ruby Conference. Last year was most excellent, and this year I’m presenting. Puppet, clouds, live demo, no net, should be a good time…

MWRC is a single track regional conference, but it brings in some of the biggest names in the Ruby world. (maybe we can get Matz to come next year) Sharing the stage with some of these guys is an honor and a privilege, if not a little intimidating. And if last year was any indication, even the guys you haven’t heard of will be awesome.  I can’t recommend this conference highly enough.

Pat Eyler of On Ruby is one of the organizers and just posted an interview with me. He is interviewing other speakers as a lead up to the conference, so keep an eye out.

Use your powers for Awesome!!!

Use your powers for Awesome!!!

Puppet and Capistrano

I haven’t just been slacking off.

%d bloggers like this: