Skip to content

Archive for April, 2009


Vote Report Wins the Golden Dot Award

Yesterday I went to the Politics Online Conference in Washington D.C. for the Golen Dot Award. Since so many of my friends ask “What is that?”, I’m going to talk a bit about the project and the award itself. I will then post a follow-up blog on my experience yesterday in more detail.

The award is the Golden Dot Award from the Institute for Politics, Democracy, & the Internet at George Washington University. Every year, they organize the PoliticsOnline Conference in Washinton D.C. and announce the best internet projects related to politics. This year, our project, the TweeterVoteReport and Inauguration Report, won the Best Mashup category.

The projects, VoteReport and InaugurationReport, are Crowdsourcing Political Journalism projects. In plain English, it’s using social network technology and allows the public to document political events. During last year’s election and the inauguration in Jan, we use the same technology and allow people to share their experience. The result is huge amount of data (text report, photo, audio, video) with geo location information. We collect data through Twitter, SMS, Filckr, Youtube, iPhone and Android. We then open up this stream of data and allow any media outlet to mashup in anyway they want. The project is completly open-source. The project was organized by NPR, Tech President, American Univeristy and CBS News. There are over 20 developers participated in these projects, including¬† Sanford Dickert from Contagious Conversations, Dave Troy from TwitterVision, Andrew Turner from GeoCommons, Sze Wong from Zerion Software, and Nathan Freitas. Full contributor list of the vote report project can be found here.

You can read more about the projects in my pervious blogs or the following links:

Like I said on the Panel yesterday, it’s been a great honor working on this project. From both the social data collection and development collaboration perspectives, this project was a great success.

Sze Wong holding the Golen Dot Award

Sze Wong holding the Golen Dot Award


Integrating Facebook iPhone Connect

The new Facebook iPhone Connect API makes facebook integration very easy.  Here is what I did to get the libaray compiled:

After downloading the Facebook iPhone Connection SDK,

1.Copy all .m and .h files under src to my project’s classes folder
2. Copy the FBConnect folder into my project’s root folder
3. Manually create the project FBConnect group in XCode
4. Manually drag all the files (2 sets) into the FBConnect group XCode
5. Compile and get like 170 errors
6. Go into project setting, in Header Search Path, click “+”, add the path “.” (Yes, just one dot)
7. Recompile and you should be fine.


iPhone Memory Management – Part II

More examples as I work through the project I’m reviewing:

Case: Auto-release on instance variables

When assigning to an instance variable, you should not set the object to autorelease. By having an instance variable means you want to ‘hold on’ to the object. And, make sure you do a release in the dealloc function for each instance variable that you have.

myObj = [[Obj alloc] init] retain]; //This is an instance variable

- (void)dealloc {

if (myObj) [myObj release];
[super dealloc];

Case: Assigning to properties

As a follow-up example, sometimes your instance variable are ‘linked’ as properties. If you set your instance variable through a property, you need to pay attention to your property attributes. If your property says retain, don’t retain again.

In ClientClass.c


Obj *myObj;


@property (nonatomic, retain) Obj *myObj;

In ClientClass.m

self.myObj = [[Obj alloc] init];  //No need to retain. The setMyObj function takes care of that.


iPhone Memory Management – Part 1

In review of a project today, I realize I need to write down some general rules on memory management around Objective-C.

I’m going to write more on this but here are some general rules:

Case 1. Setting properties.

Obj *obj = [[obj alloc] init];

myClient.obj = obj;

[obj release];

This assumes the property is either retain or copy. Either way, it’s the receiver’s responsibility to make sure the memory is being retained.

Case 2: Returning obj

- (Obj) foo{

Obj *obj = [[[Obj alloc] init] autorelease];

return obj;


When sending an obj as return, always set it to auto release. This is basically the same principle as “Clean up after yourself”.

Case 3: Array Manipulation

Sometimes you need to create a Mutable Array, populate it and return an Array. What I recommend is the following:

- (NSArray) foo{

NSMutableArray *tmpArray = [[NSMutableArray alloc] init];

… Build the array.. read from the database and populate it, etc.

NSArray *rtnArray = [NSArray ArraywithArray:tmpArray]; //This is an autorelease copy.

[tmpArray release];

return rtnArray;

That’s the basic cases I have in mind right now. I will continue to write as I come across them this weekend.