Corbin Dunn and Louise Lovelle
Treehouse
Woodworking
About
Search

natural vista


image818834989.jpg
Posted from: http://maps.google.com/maps?ll=37.3355,-122.0307


Greener AAPLs


I’m quite happy that my work promotes green living.


Cocoa programmers: avoid writing to the user defaults when you don’t need to


[Edit: ecto ate this post, so I’m typing it in again!]

I discovered that a lot of applications will unnecessarily write to NSUserDefaults. This causes your app to hit the disk when it shouldn’t, and is a slight performance penalty. AppKit is also susceptible to this problem; if you hit cmd-O to bring up the open panel in any application, you will see it writing things to the user defaults, when it probably doesn’t need to do so. I’m working on fixing that, and you should to!

So, how do you do it? It is easy — just add a breakpoint on -[NSUserDefaults(NSUserDefaults) setObject:forKey:]. You can do this with gdb:

b -[NSUserDefaults(NSUserDefaults) setObject:forKey:]

Or you can use the breakpoints window in Xcode (my preferred way):

Picture4 - breaking on user defaults.png

Then, reproduce whatever action might cause it to happen (ie: starting your application, or in my test case, cmd-o to bring up the open panel). Look at the backtrace in Xcode and figure out why you are doing too much work:

Picture5 - the callstack for a user default.png


Post muni pizza


Hmmm pizza!

We had a great time riding mr
Toads. 3hrs and 15 min– quite fast!

Chuck and kevin finished an x large pizza. Louise and I ate only half.


Chuck with 4 dinners


Chuck had a snack on the drive up.


Getting rid of the undo warning in Xcode after saving


One of the most annoying dialogs in Xcode is the undo warning dialog you get when attempting to undo after a save. I do this all the time, and I hate the warning. Luckily, there is a user default to turn it off:

defaults write com.apple.Xcode XCShowUndoPastSaveWarning NO


Tips for getting into unicycling and mountain unicycling


Do you want to just learn to unicycle, or do you want to eventually mountain unicycle (muni)?

If your goal is simply to learn to unicycle, your best bet is to get a cheap starter unicycle. These can cost $40-$160, depending on how you get it and from where. If you want a new one, the easiest way is to buy one from unicycle.com . A good starter uni could be the Torker Unistar CX 20-inch for $86, or the slightly stronger Torker Unistar LX 20-inch. Torker also has 24″ models that you can easily find on unicycle.com — they cost a little more. Another alternative is to search craigslist.org for unicycles — you can usually find them for $40-$80; however, I would not recommend paying over $50 or $60 for a used unicycle on craigslist, as people seem to over value them (especially old rust buckets). Another place to purchase unicycles is Amazon.com. You can find 20-24″ inch Torker’s for pretty cheap: Search Results on Amazon. For instance, this CX 24″ is only $90, and would be an ideal unicycle to learn on.

Should you get a 20″ or a 24″ wheel? A lot of people feel that a 20″ wheel is easier to learn on. If your goal is just to learn to unicycle, then get a 20″. If you eventually want to ride it around for some distance, get a 24″ — it will pretty much be just as easy to learn on. A 24″ might also be better for larger people (however, many adults would be fine with the 20″, in my opinion — just get a long seat post. If it is too long, you can always cut it down with a hack saw or pipe cutter).

UNI-KH-24.jpg

If you want to get into mountain unicycling, and you are welling to spend the money, then go for the gold, and get the best mountain unicycle for the price. That is the Kris Holm 24″ mountain unicycle (muni), also called the KH24 for short. Unicycle.com has the KH24 for $590. Pricey, but it will last you for a long time. The (older model) KH 24 was my first unicycle, and I was glad I didn’t spend $200 on a cheaper model, as I would have eventually got the KH 24.

If you are looking to spend a little less, the Torker DX 24″ is an excellent mountain unicycle for under $300 (usually $260). The main difference is in weight and build quality. The KH is beautifully built and light. The Torker is heavy.

Anyways, this is just a short introduction. Eventually I hope to post more details for helping people who want to get into unicycling. If you need advice, just post a comment or email me.


Northstar muni this weekend!


We are going to go muni riding in northstar this weekend! The place has lifts so we can just ride downhill.

Here’s the car with my first ever attempt of loading unicycles on the roof.

Edit: I can spell…but writing some posts on the iPhone sometimes doesn’t work well…


Wake up and smell the cocoa



Your most important breakpoint in Cocoa


…..drumroll please…and it is…is: objc_exception_throw. You should always have this breakpoint setup in any Cocoa or Cocoa Touch app that you are building.

How do you do it? In Xcode, Run -> Show -> Breakpoints and double click on a new breakpoint. Type it in, ie:

Picture 3 objc exception throw.png

Exceptions in cocoa are, well, exceptional. If your app is throwing them, then you should fix them.



(c) 2008 Corbin Dunn

Corbin’s Treehouse is powered by WordPress. Made on a Mac

Entries (RSS) and Comments (RSS).

25 queries. 1.628 seconds.

Bad Behavior has blocked 445 access attempts in the last 7 days.