Archiving Objective-C Objects with NSCoding
Posted on
For the seasoned Cocoa developer, this is a piece of cake. For newer developers, this can be a real pain, especially if you don't know what you're looking for. I get this question a decent amount, so I figured I'd put a quick guide together.
You can't put just any object in a plist. This mainly gets people when they want to put something into NSUserDefaults and get an error (because NSUserDefaults archives to a plist under the hood).
Plists only support the core types: NSString
, NSNumber
, NSDate
, NSData
, NSArray
, NSDictionary
(and their CF buddies thanks to the toll-free bridge). The key here is NSData
. You can convert any object to NSData
with the NSCoding
protocol.
Updated iPhone JSON Benchmarks
Posted on
Update: You can see the latest benchmarks at https://github.com/soffes/json-benchmarks. The results change quite a bit, so I'd recommend just running the code and seeing who wins.
I wrote a post awhile ago about JSON benchmarks. I was telling a friend he should use JSON Framework based on my old benchmark post. He asked if I had run them again recently, so I figured I'd run them again.
I updated my test app and added a new library called YAJL based on a C library. My results were very similar to before. This time I tested it on an iPad and iPod Touch.
Two Videos You Need to Watch
Posted on
Here are two talks from RailsConf 2010. You can see all of the keynotes on YouTube. I haven't ever gone to a RailsConf, but I hope to sometime.
Even if you aren't a developer, these videos are totally worth your time.
This is a short 26 minute talk by Yehuda Katz (@wycats) on development in general. This is so inspiring. He talks about doing the impossible and just getting stuff done. Really worth your time.
WWDC 2010 Predictions
Posted on
I arrived in San Francisco a couple of hours ago. This week is going to be awesome. I am really looking forward to WWDC 2010!
I've been telling a few people what I think Jobs is going to announce tomorrow at the keynote. I figured it would be good to post it so I can brag about how right I was. (Just joking. I'm not really that arrogant.)
There will be a new iPhone. All of the crazy rumors, phones left in bars, and cops raiding apartments aside, historically Apple has always announced a new one every year since it was released at WWDC.
New Server Script
Posted on
I've found myself setting up lots of servers over at RackSpace Cloud lately. It seemed look a good idea to automate everything instead of leaving it up to myself to remember everything you have to do each time.
I wrote this little shell script to make life easier. It installs everything I need to run a Ruby on Rails app in a matter of minutes. It's designed to work with Cent OS 5.4+. Here's the script's main tasks:
- Install Git 1.7.1.1
- Install Ruby 1.8.7p299
- Install RubyGems 1.3.7
- Install Passenger 2.2.15
- Install Nginx 0.8.45 (with Passenger and SSL modules)
- Install Postgres 8.4.4
- Initialize Postgres
- Install ImageMagick 6.6.3-0
- Install Bundler (latest)
- Open port 80 in iptables
- Open port 443 in iptables
- Start Nginx
- Start Postgres