I was seeing a very strange description for an NSMutableArray object in XCode. Instead of viewing the array’s count, as I expected, I was seeing some garbled message that said {(int)[$VAR count]} objects:

A quick google search pointed me to a conversation about this on stackoverflow. The key point in that link is this, made by Quinn Taylor:
it’s possible that the object has been reclaimed (either by -dealloc or GC) so check to make sure it’s retained if needed.
AH-HA!! I am screwing up my memory management again!
For some context, I went back to the Objective-C bootcamp chapter of the iPhone Developer’s Cookbook
, and sure enough, Erica Sadun talks about this on page 112:
Retaining objects set to autorelease allows them to persist beyond a single method.
The problem? My array was created by calling [NSMutableArray array], which returns an autoreleased NSMutableArray object. Thus, it was disappearing once I left the method where I created it.
Changing my code from:

To:

solved my problem. Huzzah!
The Erica/Alexis project is going quite well, despite my lack of new posts about it. I have a number of drafts in the queue, but for now, I give you visual evidence of the progress I’ve been making. Yes, I really love mini post-it notes:

Filed in: Erica/Alexis project, ipad, iphone, programming | am | May 9, 2010 | Comments (0)
Tags: Erica/Alexis project, highlighers, ipad, iphone, objective-c, post it notes, programming, reading is good for you, RTFM
I’m on page 58 of the second edition of Erica Sadun’s “iPhone Developer’s Cookbook
,” and here are the most important lessons I’ve learned so far:
- Zombies!
- What’s inside that XIB?
- The Clear Log Button
Zombies!
Did you know that, by default, your XCode project is NOT enabled to catch Zombies? And by zombies, I mean objects that you have released, but then subsequently try to access? THEY ARE ZOMBIES! They are the dead that still roam. This is good for horror films, but very bad for your code. But, by default, XCode’s debugger has no way to catch these nasties.
If you try and access a destroyed or released object, you’ll get back a cryptic objc_msgSend. But! If you ENABLE THE ZOMBIES as Sadun suggests, you’ll get back a much better message. In my case, I’m trying to access an array (via this call: CFShow([array self])) that I’ve already released. This gives me the following message in my gdb console:
2010-03-30 21:39:28.180 HelloWorld2[2398:207] *** -[CFArray self]: message sent to deallocated instance 0x1810260
Getting inside those .xib files
Read more »
Filed in: Erica/Alexis project, apple, education, iphone, programming, technology | am | March 30, 2010 | Comments (0)
Tags: akosma, apple, Clear Log button, erica sadun, iphone, nib2obj, NSZombieEnabled, zombies
I recently picked up the Second Edition of Erica Sadun’s “The iPhone Developer’s Cookbook,” that focuses on the iPhone 3.0 SDK.
Now, admittedly, a third edition is now required given that the iPad comes along with SDK 3.2. However, I still feel that completing all 163 recipes outlined in Sadun’s book will bring me from iPhone development amateur to iPhone development expert–and give me a leg up in understanding the next version of the SDK.
So, my goal is to get through all 163 recipes over the remaining 347 days left this year.
Thanks to Julie & Julia
for the inspiration on this one.
Here are the notes I took from my first NYC Drupal Meetup. I highly recommend the group. I learned an enormous amount, I got to see the legendary Earl Miles, and the space where it’s held is nothing short of breathtaking (think Hudson River views + floor to ceiling windows).
Drupal NYC Meetup 5/13/09
Speakers:
- Ezra Gildesgame
- Earl Miles (merlinofchaos)
- George Weiner, CTO of dosomething.org
Nodequeue The nodequeue module can:
- Keep track of how to notify users
- Be used for granular permissions:
- Ex: separate editors for designers, developers, admins
- Works very well with Nodes and Panels
- You can create Views specific to one queue
- Recently added international support
- You can have a MAX SIZE to the nodequeue
- Once you’ve exceeded the max, the oldest story will be kicked out.
- That’s why nodequeue works so well for lead stories
- USE CASE: Read more »
Filed in: Drupal, media, programming, technology | am | May 29, 2009 | Comments (2)
Tags: awesome office space, Drupal, drupal notes, meetup, merlinofchaos, panels, views
There are three main resources I’ve been using to teach myself Objective-C, Cocoa Touch and iPhone programming:


The cookbook is excellent as a reference, and as a human-readable, easy-analogy alternative to the lecture slides.
The class itself holds your hand with their assignments, and I have been slowly builing up my Obj-C development skills through their carefully thought-out assignments.
Finally, the ADC videos provide an excellent window into what iPhone OS 3.0 can do, and code samples to help you start actually doing it.
Now, you may be asking, “that’s all fine and good, but where do the LOLCATS come in?”
SO, you only need look at someone and you can quickly make an assessment if they’re an apple or a PC person. Apple’s TV marketing depends on it. But I would like to argue that you need only look at their EDUCATIONAL SLIDE MATERIAL to make the same assessment.
Sure, this isn’t from WWDC, but this is on iTunes to help people understand how to use iPhone OS 3.0. If I wasn’t a Mac convert before, this truly would have made me a believer:

Brilliant. Bloody fucking brilliant.
Filed in: education, media, programming, software, technology | am | May 5, 2009 | Comments (0)
Tags: apple, cocoa touch, iphone, lolcats, microsoft sucks, objective-c, tech
So I’ve been trying to write an Excel macro to select only the last trading day of the week from a list of Dates. Typically, this is a Friday, but when Friday falls on a holiday, the last day of the week can be a Thursday.
I made a list of all non-Friday end-of-the-weeks going back to 2006, and wrote a simple little function to loop through this list, and return true if the current date matches any one of them.
The problem is, there is no Break keyword in VBA. And unlike functions in other languages that return a value, when the minute you return a value, the function exits, VBA just keeps on going on its merry way. So the minute I found my correct date, set the return value to True, and wanted to return to my main code, I had to explicitly exit the function. Here is the full function. The needed extra line is “Exit Function”:
Read more »