Feb 2007

Figured it the heck out

There are sometimes these little problems that just stick, that just take a long time to figure out. Months go by. Years go by.

Anyway, for a long time I’ve been bugged because I couldn’t figure out how to set an alternate location for the WebKit cache. (Really the URL-loading cache, but I call it the WebKit cache anyway.)

The reason I wanted to do this was, well, because Apple recommends it somewhere (I forget where) if you have other stuff in your cache folder (as NetNewsWire does). Plus it just feels quite a bit cleaner.

It seems like it should be easy: the NSURLCache documentation tells you to use +[NSURLCache setSharedURLCache]. Piece of cake, right?

But when I did it, everything seemed to be fine, except that nothing was ever written to disk.

My code, which ran very early at startup, looked something like this:

NSURLCache *originalCache = [NSURLCache sharedURLCache];
NSURLCache *newCache = [[NSURLCache alloc] initWithMemoryCapacity:[originalCache memoryCapacity] diskCapacity:[originalCache diskCapacity] diskPath:RSCacheFolderForAppSubFolder(APP_SUPPORT_FOLDER_NAME, @"WebKitCache", NO)];
[NSURLCache setSharedURLCache:newCache];

Makes sense, right? In creating the new cache, I wanted to use the capacity settings from the original cache.

So tonight I got it in my head to finally get to the bottom of this. I tried a bunch of things, including creating an NSURLCache subclass where all the methods called super, and watching the various methods actually get called in the debugger, so that I knew that my cache was getting sort-of used, even if nothing ever made it to disk.

Finally, on a hunch—a hunch that I wish I’d had a year ago—I rewrote my code like this:

NSURLCache *newCache = [[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024 diskCapacity:1024 * 1024 * 10 diskPath:RSCacheFolderForAppSubFolder(APP_SUPPORT_FOLDER_NAME, @"WebKitCache", NO)];
[NSURLCache setSharedURLCache:newCache];

And now it works! Cache-y things actually written to disk. You have no idea how glad I am: this really has been bugging me for a long time.

It turns out that referencing [NSURLCache sharedURLCache] before calling setSharedURLCache was the problem. So there’s the answer: don’t go like that.

Anyway, if anyone else ever runs into this particular problem and looks on the web for help, this post is repetitive enough with terms like sharedURLCache that it will probably turn up in Google near the top. ;)

Slice of life

The small exchange below happened on the NetNewsWire private mailing list after the release of a recent build:

>>Helvetica in the unread count bubbles again. Awesome.
>
>/me cries

The above is a perfect capsule description of what it's like to develop Mac software. ;)

-Brent

Damon as Kirk?

SCI FI Wire: “On Feb. 26, IGN.com reported a rumor that Matt Damon was under consideration for the role of Kirk, Oscar winner Adrien Brody was being eyed to play Spock and Gary Sinise was being mulled to play Dr. Leonard McCoy.”

I could take Matt Damon as Kirk. It’s Ben Affleck as Kirk that gives me the heebie-jeebies.

Clean Build of the Beast

I had added a couple new files to NetNewsWire today (UKCrashReporter .m and .h)—and then, when I went to do a clean build, I noticed the following:

Compiling 666 files

Picture the terror on my face as I quickly took a screen shot.

MarsEdit acquired by Red Sweater Software

MarsEdit has been acquired by Red Sweater Software!

I have every confidence that Daniel will move the app forward, do new and cool things, and make sure MarsEdit users are taken care of the way they deserve.

Read more about it:

- Q&A with me and Daniel

- Daniel’s press release

- Greg Reinacker’s weblog post

- New MarsEdit home page

Monochrome toolbars

I’ve been noodling with the colors in the toolbars, since not everyone likes (as I do) the colorful look.

Here’s a blue version and a graphite version. What do you think? (Note: I’m just asking about colors, setting aside the issue of shapes and so on.) Do you prefer the single, more subdued color for all?

blue toolbar

graphite toolbar

Gallery of noodling

I noodle around a lot with user interface. I try things. I have pet theories. Some people know where to go in advance—me, I have general ideas, I iterate, change course, go nuts, keep at it, keep noodling, then fiddle a bit until I like what I see.

Once I start getting feedback, it all starts all over again.

Anyway, here are some screen shots from the builds right before NetNewsWire 3.0d8 got into the hands of the private testers last Fall.

nnw3_weird.png

nnw3_weird_widescreen.png

nnw3_weird_tabs_thumbnail.png

And here’s 3.0d8, the build that testers first saw:

nnw3.0d8.png

You can see that, among other things, I was trying to get rid of the toolbar-at-the-top entirely. Though lots of apps (iApps, especially) are going this way, it’s not that great for usability in apps like NetNewsWire and Mail where the items are listed near the top—your mouse ends up traveling too much to hit the buttons at the bottom.

Hiding the subscriptions list

One of my personal favorite new features is the ability to hide the subscriptions list. It gives you more room when you’re viewing a web page—or you can even use NetNewsWire as a single-pane aggregator.

A couple screen shots:

Showing a web page with subs list hidden

Single-pane aggregator

You can hide and show the subscriptions list manually via the View menu: choose Hide Subscriptions List (or Show, of course, depending on its state). It has the same keyboard shortcut as Mail has for showing/hiding mailboxes.

The way I use it is to have it hidden and show automatically. When viewing a web page, it hides. When viewing a news item, it shows. Choose View > Automatically Hide Subscriptions.

NetNewsWire and hidden toolbar pref

There’s a hidden pref for using black (dark gray, really) toolbar buttons instead of colors. I find that certain number of testers liked this look, and so I kept it and made it available. I’m not sure if I’ll make it a “real” pref or not (I don’t like to add prefs).

Toolbar with colors

Dark gray toolbar

If you want to try the monochrome toolbar, here’s what to do:

1. Quit NetNewsWire.

2. In Terminal, copy-and-paste the following and hit return:

defaults write com.ranchero.netnewswire blackToolbarButtons 1

3. Launch NetNewsWire.

To go back to colorful icons, do the same as above with 0 instead of 1.

(Note: I know that the toolbar is the most obviously visible change. I’ll write more about it from an app design point of view today or on the weekend.)

NetNewsWire 3.0d46 sneak-peek release

I just posted NetNewsWire 3.0d46, a new sneak-peek release of NetNewsWire. Important: it’s not even a beta: there are more features to do, and it definitely has bugs. The “d” stands for danger.

You can download it from the beta page. Read the change notes to find out the full scoop.

I’m hugely excited about NetNewsWire 3. Even though there’s still a lot to do, I wanted to get it out there because, well, I can’t stand the thought that you’re not using it. ;) (But, beware, I’m serious about the danger thing, so don’t use it if you’re not comfortable running software that’s clearly unfinished and has bugs.)

There are a ton of changes, not all of them visible or obvious. I’m going to take a break from programming for the next few days and write about some of these changes.

In the meantime, here’s a screenshot. (Click on the thumbnail.)

NetNewsWire 3 screenshot thumbnail

C is cool, but

waffle: “C has dominated programming for the last 35 years. Anyone who says differently is lying or work on Sun’s or Microsoft’s marketing team. One of the first properties I assess of a new programming language is ‘how easy is it to drop into C’?”

Daniel Jalkut asks if C is the new assembly.

Here’s a small data point: I love C. Absolutely adore it. Really. I’m a total freak—I think pointers are cool and I don’t mind at all doing memory management. I fantasize about writing apps entirely in C. That makes me an outlier, a real weird freakazoid.

However, I’ve been quite happy with Objective-C, and I suspect I’ll be even happier still with higher-level languages, using C and Objective-C only when needed for specific features and performance issues.

So it is with reluctance that I agree that C is becoming the new assembly. It’s not like I hate it—quite the opposite. (A well-written C app is a thing of beauty, by the way. Even though C isn’t object-oriented, you can still use object-oriented techniques. You can build things in such a way that most of the time you work at a very high level, only rarely dropping down into lower layers of your app.)

The upshot for me is that, well, I’m learning Ruby. ;) As much as I love C, I’ve always loved scripting, too.

Zcoble

CARS: Zune Phone To Also Suck: “Scoble also said that if you add a ‘z’ to the front of anything, it automatically becomes cool, edgy and hip, and it totally doesn’t suck.”

;)

I actually used to work with Robert—we overlapped at UserLand for about six months.

Holy Rush

Nick Bradbury: “My family moved to Tennessee when I entered my teen years, and it was there that I met my first true love. She was a southern girl whose father was a fire-and-brimstone minister. I was 16 at the time, and to prove my devotion to her I agreed to attend one of her father’s church services.”

Archive