Totally awesome software for iPhone and OS X

Friday, March 20, 2009

Strange Safari behaviour...

For a few weeks now my Safari has hung on startup. Spinning beachballs of doom and everything. I figured it was something I'd done to it (I'm tracking the WebKit nightly releases and tend to hack around a bit with my OS) but never really had much time to figure out what exactly was going wrong.

Until now. I knew it was hanging on opening a file (I assumed the PubSub database and had tried deleting that to no avail), but this morning I decided that the PAIN of using firefox was too great to not spend half an hour fixing Safari.

After a bit of tinkering with lsof and gdb I discovered a couple of caches that I didn't know about on my machine these were..

/private/var/folders/gc/gcMtdPw4FY4KstxwBSOd7U+++TI/-Caches-/com.apple.Safari/Cache.db


and

/private/var/folders/gc/gcMtdPw4FY4KstxwBSOd7U+++TI/-Caches-/com.apple.Safari/SafeBrowsing.db


They were also huge. I've no idea what they were but I do know that when either Safari or Webkit starts up it tries to read them and on my machine this was causing it to hang (perhaps they were corrupt).

Anyway, the fix was to delete them (and the pubsub database for good measure). Steps below.

1. sudo rm -rf /private/var/folders/gc/

2. rm ~/Library/PubSub/Database/Database.sqlite3

After these two steps both Safari and WebKit work and I'm finally out of Firefox purgatory. I hope this comes in useful if anyone else has Safari hanging on startup.

Wednesday, March 4, 2009

Yahoo! BOSS and Java

A while ago we had to use the Yahoo! BOSS API to search and link to news stories related to various topics.

I had a quick google (no point re-inventing the wheel) but I couldn't turn up any code in Java for this, there's plenty of Javascript/Python/Ruby/etc. code. But we needed to use Java in this instance so I quickly dashed out a simple wrapper for BOSS.

A while later, it was tidied up (a bit) there's still some rough edges, but it's working perfectly well for us.

And yesterday, we decided to release it under the Apache 2.0 License so that in the future anyone Googling for Yahoo! Boss and Java should have something to help.

The buildable source is available at http://code.google.com/p/javaboss/

At the moment it has dependencies on org.json.jar and junit.jar which are included in the repo, I expect at some point we'll move those out and either use maven or ivy to resolve this sort of thing.

© 2007 Wired Up And Fired Up