Wednesday, December 31, 2008

Regular expressions in Cocoa using NSPredicate

I spent some time tonight figuring out how to exploit the NSPredicate class from Cocoa for my regular expression needs. I've been trying to do some test-driven development in my iPhone development endeavors and had a need for regular expressions. NSPredicate seems to be the tool for the job, so I wrote up the following wiki page so I could keep this information around.

http://sites.google.com/a/pintailconsultingllc.com/objective-c-and-cocoa/Home/nspredicate-examples

I even cracked open my "Mastering Regular Expressions" book tonight.  Excellent tome on all things regular expression.  Highly recommended.


Tuesday, December 23, 2008

Can't login to the Apple iPhone Dev Connection

Hmmm... I'm having issues logging into the Apple iPhone Developer Connection. I can authenticate on the Mac Developer Connection site and ADC, but the iPhone Developer Connection site doesn't seem to use the same session information, so navigating from one Apple developer site to another seems to be impossible. Anyone else seen this?

Saturday, December 20, 2008

Using Subversion from Xcode 3.1.1

I started using the integrated Subversion SCM support in Xcode today. I've been working through some iPhone development examples from the Beginning iPhone Development book (the grapefruit book). I've been using the command line client and SmartSVN on my Mac up until now. Well, I found out that both the command line client and my SmartSVN client are both version 1.5.x and that the built-in support within Xcode is still at version 1.4.x. The working copies for a 1.5.x client won't work with the older client support that Xcode has linked into its executable. Therefore, if you plan on using Xcode's Subversion support, use only Xcode to interact with that working copy. A 1.5.x client will silently update the metadata in the .svn directories if used against a 1.4.x-based working copy, so be very careful with inadvertantly dropping down to the command line to do some SVN work. You'll most likely render your working copy unusable within Xcode if you do. Here's hoping that Apple will update Xcode and link it against a 1.5.x SVN client library.

Other than that little gotcha, the Subversion support within Xcode is pretty good. I think I prefer how the Java IDEs have it implemented (Eclipse and IntelliJ IDEA). Those tools make the SCM interactions much more seamless. In Xcode, it seems kinda off to the side. I'd really like key mappings for Commit Entire Project... and Update Entire Project. I'll have to look into that and see if that's possible.

Friday, December 05, 2008

EclEmma, a code coverage plugin for Eclipse

If you're an Eclipse user and you're full on with TDD, then you owe it to yourself to install the EclEmma plugin for Eclipse.  It's an open source tool for instrumenting code from within the Eclipse Workbench and then running tests to determine how much test coverage you have.  I've been a Cobertura user, but AFAIK there isn't a Cobertura plugin for Eclipse.  EMMA is another code coverage tool (and is baked into Jetbrains IntelliJ IDEA).  This plugin is very well done and really helped me to understand where I needed more tests.  The best thing about this plugin is that you can get code coverage on a single class that you're unit testing, so the turnaround time is very small for determining where you have holes in your test coverage.  Very impressive.  One gripe that I do have with it is the inability to turn off coverage on the tests.  I don't want to instrument those, but the tool seems to want to select the tests to instrument along with your source.  Not a big deal...I just ignored any of the coverage information pertaining to tests.