Sylvester

From WiKim

Sylvester is a twitter client, formerly known as Twestigator, with a focus on tracking followers for specific users. Currently only available for Mac OS X.

Contents

Introduction

The idea behind the application started on twitter here: http://twitter.com/Bubbr/status/2128960861

A screenshot of the first version is available here.

http://www.flickr.com/photos/kimbach/3624989466/

Features

  • Generation of a list of shared followers for two twitter users
  • Possibilty to post status updates to twitter
  • Show list of "shared" and "not shared" followers - the list of "not shared" followers might be more interesting

Suggestions

"Share this" feature

Kim Bach 08:40, 16 June 2009 (CEST)

Add a button to share the list of shared followers, this how I think that it could be implemented.

Send the list as HTML to a blog using the XML-RPC blog API, with an option to tweet the blog-post.

Issues

Error 400 - API request limit reached

Sylvester is utilising the twitter API, that API has a limit to the number of requests a user can make, currently it's at 100 / hour. Sylvester makes quite a few requests, and currently has no local storage/caching, you can quickly reach that limit, here's why:

Sylvester makes, at least 4 requests, first it get's the user-information for the two users to compare, this is in order to retrieve the number of followers for the users, then it requests the list of followers for each user, since twitter returns a paged list of 100 followers, it will result in int(followers / 100) requests for each user, so this is the total number of request needed to generate the list:

n = number of followers for user 1
m = number of followers for user 2
int() = is the ceiling of the integer division, e.g. 50 / 100 = 0.5 ceiling is 1 150 / 100 = 1.5 ceiling is 2.

requests ::= 2 + int(n/100) + int(m/100)

This means that you can run out of avaliable API requests quite quickly, and unfortunately that will hurt your other API clients.

Revision history

  • 2009-11-26 Decided to release the sourcecode in the open, I have no intention of maintaining the code further, download link below
  • 2009-06-18 Sylvester Version 1.0 - Rebrand to Sylvester, possiblity to post status updates and select between lists of Shared and Not shared followers
  • 2009-06-14 Twestigator Version 1.0 - Generation of a list of shared followers for two twitter users. Given credentials for a user, and two twitter usernames, a list of shared followers will be shown in a standard Cocoa Table View

Credits

Sylvester is utilising the wonderful MGTwitterEngine developed by Matt Gremmell http://mattgemmell.com/2008/02/22/mgtwitterengine-twitter-from-cocoa, I did have to add two new API methods, since it didn't support the twitter API for requesting the followers for a specific user, as well as paging. This was a breeze to implement, the MGTwitterEngine framework is pretty well designed, and it's very easy to add new parameters for RESTful APIs.

Unfortunately the documentation on how to make a real world client is very skimpy in the MGTwitterEngine readme files, and the bundled sample can't really be called a client, so I had to struggle with that, luckily I found a sample that contained a full fledged client, that included very nice User and Status entity classses. This sample is called Twittter4iphone http://code.google.com/p/twitter4iphone/ and it was developed by Dang Duc Nam, it implements a pretty nice iPhone Twitter client based on MGTwitterEngine.

Lessons learned

All in all it took me probably 20-25 hours to develop this small client, most of my time was spend strugling with Cocoa Bindings and understanding the NSTableView component. I finally gave up on bindings, and changed to the old delegate and dataSource model, it took quite a while to understand that it was really, really simple.

First: implement these two methods in you class.

-(int)numberOfRowsInTableView:(NSTableView *)tableView
-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row 

Second: remember - this is something that I didn't fully understand, and thus forgot - to connect the delegate and dataSource of your NSTableView to your controller class in Interface Bulider,

After doing this, it worked, but only after I removed my manual binding code that I had entered while experimenting, and understod how to serve data in response to the objectValueForTableColumn. One thing that impressed me, was how easy it is to implement sorting of NSArray datasets, this is all that I needed to do to perform a sort by screen_name:

NSSortDescriptor *screenNameSorter = [[NSSortDescriptor alloc] initWithKey:@"screen_name" ascending:YES];
[sharedFollowers sortUsingDescriptors:[NSMutableArray arrayWithObject:screenNameSorter]];

Source code

You can get the sourcecode, and the app, here: http://www.kimbach.org/downloads/Twestigator.zip (4MB download)

External links