Core Fruition

Quick and Easy Drawing Performance Debugging With NSShowAllDrawing

While watching one of the WWDC09 session videos I was informed of a great tip that I had been previously unknown to me: Pass -NSShowAllDrawing YES as an argument to your application in Xcode to see a visual representation of the drawing that your application performs as it runs.

To illustrate how NSShowAllDrawing works and the issues it can help you correct I’ve put together two videos.  The first shows my app, Bezipped, in its current 1.0 state and its current drawing behavior.

This second video shows how I improved the drawing in Bezipped simply by setting the top-level container to be backed by a Core Animation layer:

I highly recommend giving your app a spin with NSShowAllDrawing if you haven’t already, it was certainly a real eye-opener for me.  There are some additional resources for debugging your drawing performance on OS X (as pointed out to me by André Pang) provided by Apple here: Drawing Performance Guidelines: Measuring Drawing Performance

Lastly, both Alan Rogers and Steve Streza pointed me towards Quartz Debug.app (included with the developer tools) as another means to see similar redrawing behavior.  I found Quartz Debug’s options to be a bit heavy-handed as the drawing performance of the entire OS was shown instead of just my app, but your mileage may vary.

The Best Interface Builder Layout Ever

This morning I posted a screenshot of my Interface Builder layout on Twitter.  I didn’t think much of it at the time, but I received enough positive feedback on it that I decided to post it here for generations of future Cocoa developers to find.  The layout gets harder to work with the smaller your screen gets, but it works very well on my 24” display.  Another tip for working well with IB: keep it in it’s own space and don’t let other apps invade that space.  I find that when I can concentrate just on my IB windows without having to mentally block out background windows it makes my workflow much smoother.

IB Layout

ParseKit

While I don’t have an immediate need for ParseKit, I’m fairly certain that it’s going to come in very handy in the future.  Written by Todd Ditchendorf, the framework offers:

  1. String Tokenization via the Objective-C PKTokenizer and PKToken classes.

  2. Language Parsing via Objective-C – An Objective-C parser-building API (the PKParserclass and sublcasses).

  3. Parser Generation via Grammars – Generate an Objective-C parser for your custom language using a high-level grammar syntax (similar to yacc or ANTLR). While parsing, the parser will provide callbacks to your Objective-C code..

Head on over to the ParseKit website to download it.

Well That Didn’t Take Long

As you can see we are now flying under a new banner: Core Fruition!  In less than two hours from my last post I had the answer to my naming quandary from Paul Goracke, and I can’t thank him enough.

When I saw Paul’s suggestion my first thought was, “That’s an awesome name!”. My second thought was, “That sounds really close to another popular Cocoa site…”  Not wanting to step on any toes, I decided to throw the name into some focus testing, asking a bunch of high ranking folks for their gut reaction.  Here are the results:

Mickey Roberson: “That’s not bad”

Bill Dudney: “Frution is too ‘hard to read’, but not gut reaction is I like it … cool name”

Danny Greg: “rip off of core intuition, other then that – nice”

Jeff LaMarche: “I like it.”

Dave Verwer: “I like Core Fruition”

Brent Watson: “I like it”

Marcus Zarra: “I like it. Makes me think of learning cocoa”

As you can see, most folks liked it with only Danny giving me the reaction I was afraid of, which wasn’t enough to keep me from pulling the trigger.  I’d like to thank everyone for submitting names and cool ideas, and especially Paul for hooking me up with a winner.  Now, if some intrepid graphic designer would like to hook me up with a sweet logo…

I Am Not a Name Thief

Not intentionally, anyway. First a little back story: When I was trying to decide on a name for this blog I would come up with what I thought was a great name and then plug it into Google to make sure that it wasn’t already taken. Most of the time I would find a blog that already had the same name and move on to a new round of brainstorming. When I arrived at the name “Cocoa Nut” I thought for sure it would be taken. I did a quick search but found no hits for that name having anything to do with programming in the first few pages of search results. I thought, much to my amazement, that I had struck blog naming gold, I couldn’t believe my luck!

Apparently my brain decided to ignore the third entry on the first page of Google results

Fast forward to last week. I was looking up some show notes on the Mac Developer Network when I noticed the blog roll on the side of the page. Curious if my blog was listed there (I had submitted it to Scotty a while back) I took a quick glance through the list and saw Cocoa Nut sandwiched between Call Me Fishmeal and Cocoa Samurai. I clicked through expecting to be greeted with my blog’s homepage but was instead taken to a different Cocoa Nut.

The original Cocoa Nut

Astounded, I quickly checked his archives, sure that he had shown up on the scene after me and had not been thorough enough in his search for naming collisions. 2006. His first post was from 2006. My first post was in 2008. I was sunk.

So back to the title of this post: I am not a name thief. I am currently searching for a new moniker for this blog. Yes, I could make the argument that in a fully qualified world his Cocoa Nut and my Cocoa Nut are in completely different namespaces and that they don’t collide, but that’s BS and everyone would know it.

Therefore, if you’d like to suggest a name, please feel free. Otherwise, I will be thinking and Googling until I come up with something that no one else has thought of yet.

Bypassing the Trouble Caused by Updating an iPhone App Provisioning Profile

[UPDATE] After many discussions on Twitter and many recommendations by different folks, I think that we have determined that the method outlined below is not necessary.  Mike Taylor has hit upon what appears to be a foolproof method for getting around the trouble caused by updating an iPhone app provisioning profile, and best of all, he did it in 140 characters:

@kalperin @MrRooni Delete old profile from Organizer. Download new profile ‘n drag to organizer. Restart Xcode. Choose new profile in target

Many thanks to Mike for helping me out here, I owe you a beer at WWDC10.  For those of you interested in the more masochistic way to get around the issues, feel free to continue reading:

A note before I begin: Everything below was done with the final build of the iPhone OS 3.0 SDK and I was building an app using the 2.2.1 frameworks.

I recently acquired a new iPod touch to use a development device.  One of the first things that I wanted to do was get my existing project up and running on the device so I headed over to the iPhone Development Program Portal to update my provisioning profile.

After adding the new device to my app’s provisioning profile I downloaded the updated profile and installed it into Xcode and onto the device via the Organizer.  So far so good, everything up until this point worked exactly as I expected it to.

Switching back to my project I changed my build settings to be a Release build under 2.2.1 on the device.  The app built fine, but I got an error when it tried to install the app onto the device, something error akin to “This device doesn’t contain the provisioning profile with which this app was built”.  Thinking that maybe Xcode just hadn’t seen the new profile yet I cleaned all targets in my project, restarted Xcode and tried again.  No dice, same error as before.

I then proceeded to delete all versions of the profile from the organizer and re-installed the new one.  My assumption was that once Xcode saw that the old profile didn’t exists anymore it would switch over and use the new one.  I cleaned all targets and built again.  This time I was treated to a different error: ”Code Sign error: Provisioning profile ‘3E6AA725-6534-46F8-B9CE-D19AC9FD854B’ can’t be found”

After a bit of Googling I discovered that Xcode stores the ID of the provisioning profile in its project.pbxproj file.  This discovery led me to the fix:

  1. Close your Xcode project

  2. Navigate to your project folder in the Finder

  3. Right click on your .xcodeproj file and ‘Show Package Contents’

  4. Drag the project.pbxproj file to Xcode (or any plain text editor)

  5. Perform a search for the term ‘provision’ to find the PROVISIONING_PROFILE entry.

  6. Copy the existing profile ID and paste it into the find field of a find and a replace dialog.

  7. Open up the Organizer window (Window menu > Organizer) and navigate to your new profile under IPHONE DEVELOPMENT > Provisioning Profiles

  8. Click on your provisioning profile and copy its Profile Identifier

  9. Paste the string into the replace field in your open find and replace dialog.

  10. . Replace all instances of the identifier, save the file, close it, and reopen your Xcode project.

  11. . That should do it, build and go to run your app on your new device.

Now there is a great possibility that I am going WAY overboard here and missing a very obvious way to accomplish the same solution.  If that’s the case please let me know in the comments.

iPhone, Timezones, and WWDC (or, How I Stopped Worrying and Learned to Love iCal)

At 9:53 AM EST this morning I asked the Twitterverse the following:

WWDC iPhone question: When I land in SF will my calendar events be localized such that I won’t be showing up for things 3 hours late?

Thanks to @LarryRoth and @jeff_lamarche I have my answer.

According to Larry,

Yes. I travel all the time and it just works. Your calendar should be set to EST and when you land your phone will know it’s PST.

And according to Jeff,

You’ll probably need to manually set your computer to the right time zone, or you’ll be off by 3 hours.

What this means is that any events that I add to my iCal calendar will be shifted three hours down when I land in sunny San Francisco.  Therefore, when I add the sfMacIndie party to my calendar (it starts at 5pM PST) I need to add it at 8PM on my calendar while I’m in the EST time zone.  See the two images below for how my event times change as my time zone changes.

WWDC in EST

WWDC in PST

 

One recommendation that I can make to ease all of your pain is to use a service like TripIt.  My trip to WWDC was my first use of TripIt, and it has been wonderful.  Basically, it manages all your trip information in one easy place and even provides you with an iCal subscription link so that you can have your entire trip in iCal.  Once I had my flight and hotel confirmations I just forwarded them to TripIt and it automatically parsed the information out and created an itinerary from it.  From there I was able to add events manually to it (like the sfMacIndie party and WWDC badge pickup) and they were automatically entered into my calendar.  The best part is that I didn’t have to do any time zone math, I just entered the events into TripIt at the time they are occurring in PST and it handled making sure that they showed up properly on my calendar

WWTweetC

I am currently in the process of madly coding up a new Twitter app that will hopefully be available before WWDC. Before you groan about YATA (Yet Another Twitter App) let me tell you how mine will be different: I don’t expect it to have a life past June 13th.

WWTweetC is an app specifically designed for folks attending WWDC. It will filter your timeline and friends list down to folks also attending WWDC and allow you to find them easily, both inside of Moscone and out and about the streets of San Francisco.

The app will have three parts:

  1. Your timeline, showing only tweets from folks also attending WWDC.

  2. Your Friends list, showing all your friends, but sorted by those attending the conference and those not.  If there’s someone on your list that you know is attending the conference but (for some crazy reason) is not using WWTweetC you will have the option to filter in them and their tweets.

  3. The update screen.  The update screen will let you update your location inside of Moscone West (by selecting your location on a map of the conference center), update your location outside of Moscone West (using your current geospatial location), or post a new tweet.

The way that I plan on accomplishing most of this app’s functionality  is by hijacking your Twitter account’s Location field.  When you sign in using WWTweetC it will prepend your location field with ‘WWDC’.  Any location updates from that point on will replace your entire location field with ‘WWDC ’.

The success of this app is based on a few things:

  1. It being finished in a timely manner

  2. It getting accepted into the App Store before WWDC

  3. People actually using when we get there

I plan on open sourcing the project on Google code so that anyone that wants to help out will be able to contribute to its success.  I’m not sure what the average turnaround time is for app submissions, so it’s entirely possible that this app won’t be available by WWDC, but at least the code will be available for anyone to compile and install on their device.  If you think that this is a worthwhile app please tweet this post, tell your friends, and keep an eye out for future project updates.

Shilling for a DroboPro

That’s right, I want to win a Drobo, and I’m more than willing to use my blog to win one.  Here’s the deal:

Hey would you like to win a Drobo? All you have to do is link from your blog or website to MYDL.ME. That’s it – must be 18 and live in a country where Drobo ships to be eligible. We’re going to pick a winner on March 31 so get your link up now. We’re going to check our referral logs to pick the winner. Good luck. — P.S. If you don’t win but you’d like a good deal on a Drobo check this out. If you want to buy a 2nd Generation Drobo populated with four WD 1TB Green Drives for $849, you can. Just use the code MYDL849 at the Drobostore—Valid through 3/31/09.

Now that post says that the drawing and coupon are only good until 3/31 and of course it is now 4/17, but @drobo did post this tweet last night:

Picking the lucky DroboPro winner this Fri. Just follow @scottbourne, or link to http://www.mydl.me to play, and see who’s won. Please RT.

So I’m holding out hope.  Cheers!