Sunday, May 25, 2008

Safari bookmarks and Sync Services


For my own purposes, I need to make a Cocoa program that knows about my bookmarks in Safari. Lucky for me, Safari submits its bookmarks to Sync Services, according to Syncrospector:



To complete my evil plan, I also need to know the last time I clicked on a bookmark. Lucky for me, the sync schema includes a "last visited date", according to /Applications/Safari.app/Contents/SafariSyncClient.app/ Contents/Resources/SafariClientDescription.plist:


<key>Entities</key>
<dict>
    <key>com.apple.bookmarks.Bookmark</key>
    <array>
        <string>url</string>
        <string>last visited date</string>
        <string>name</string>
        <string>position</string>
        <string>notes</string>
        <string>parent</string>
        <string>com.apple.syncservices.RecordEntityName</string>
    </array>


So I just need to write my own Sync Services client that syncs with the com.apple.bookmarks.Bookmark(s)...

Uh oh. Let's have another look at that Syncrospector screenshot. The displayed entity there is a Bookmark, but it doesn't appear to have a "last visited date" property. Neither do any of the others.

I went ahead and made my own Sync Services client, so I could poke around in there for myself, but it sure seems to be that Safari doesn't set that property on the bookmarks that it submits to the truth database (it's not required to) even though Apple's own sync schema defines such a property.

Bah. Back to the drawing board for me.

Thursday, May 22, 2008

OS X, Bonjour, Apache


As part of some experimenting the other day, I went into System Prefs on my laptop running 10.5 and activated Web Sharing. To my surprise, my personal web site did not appear in Safari's Bonjour list, nor did any HTTP service appear in Bonjour Browser. I could reach the web page if I typed in the URL, it just wasn't being advertised by Bonjour. I had a very clear memory that it used to work with Bonjour, so I started asking why it's not working now. I did some Googling, I searched Apple's support forums, I finally got my friend Thomas involved. He, also, remembered that it used to work with Bonjour, he, also, could not find any leads via Google. (And he's a really good Googler.) He suggested that we check the httpd.conf on my laptop. ("Mac use conf file? That's unpossible!") Sure enough, here's what we found:


<IfModule mod_bonjour.c>
    # Only the pages of users who have edited their
    # default home pages will be advertised on Bonjour.
    RegisterUserSite customized-users
    #RegisterUserSite all-users

    # Bonjour advertising for the primary site is off by default.
    #RegisterDefaultSite
</IfModule>


I made a trivial edit to Sites/index.html in my homedir, toggled Web Sharing off and on one more time, and presto! there was my personal site listed in Safari's Bonjour list.

I'm not sure if this is something new in Leopard, or if it changed in Tiger and I just never noticed. I'm sure Panther didn't work this way. And I'm not saying the Leopard way is bad. It just surprised me.

Saturday, May 17, 2008

If it looks like pee, don't drink it


I'm done spending big bucks on any whiskey which is yellow. Good single malt whiskey should be brown. Think about it - Irish, Scotch, or American, all of the really flavorful whiskeys have a rich brown color. Now I do like Dewars White Label occasionally, but that's a blend, and a whole different financial category than a single malt like Auchentoshan or Knappogue. Those pale yellow-colored whiskeys just don't have the depth of flavor that I want from a single malt.