Posts Tagged ‘twitter’

Compiling MGTwitterEngine for the iPhone using Xcode

Surprisingly there are not a lot of options for Objective-C Twitter libraries. In fact there are exactly two options: MGTwitterEngine and Canary (which is actually a “full-fledged client”). The choice looks clear, use MGTwitterEngine or deal with XML directly (yuck!).

MGTwitterEngine does not implement the entire Twitter API but it does implement the most important things like updating status, retrieving your friend’s timeline, etc. For my current uses, that’s all I need.

It took me a little bit of effort to get MGTwitterEngine compiling and running correctly:

  1. Checkout the project from subversion (svn co http://svn.cocoasourcecode.com/MGTwitterEngine-1.0.8/).
  2. Delete files that aren’t needed: .svn, AppController.h, AppController.m, English.lproj, Info.plist, main.m. Optionally delete README.txt, TODO. Leave alone Source Code License.rtf.
  3. Add the remaining sources to your project.
  4. Change USE_LIBXML to 1 (instead of 0) to use libxml for a smaller footprint.
  5. In your target, within the general tab add libxml2.dylib.
  6. In your target, within the build tab, add to “header search path”: “${SDKROOT}/usr/include/libxml2″. Make sure you’ve selected the recursive checkbox.

If you are getting an error saying “error: libxml/xmlreader.h: No such file or directory”, make sure you’ve completed the last 2 steps listed above.

A working example can be found on an early commit to my iPhone app hosted on github.

 

Readtwit – Publish twitter links to RSS feeds

Readtwit

If you’ve ever found yourself having trouble keeping track of links posted by your Twitter friends, then there’s a new Twitter app that should be right up your alley.

The app? Readtwit.

It’s mission? Convert links posted by your Twitter friends into RSS feeds.

The setup

I just setup Readtwit about an hour ago and I’m already digging the ability to link it with my other RSS feeds in Google Reader. Now I can check out tweeted links on my own time. Best yet it’s free and the setup is super easy (it only takes like 3 steps).

Previously I had been keeping track of links that looked interesting by marking them as a favorite for later digesting. The problem with that approach: I always forgot to check out my favorites. With Readtwit I am hopeful that Twitter favorites become a thing of the past (at least one step closer).

Best yet, I can avoid missing links that are important to me, even when I take a Twitter holiday.

Blacklisting features

The first blacklisting feature lets you blacklist certain friends. I have already made use of this feature by blocking links that I know are time sensitive. For example I follow @amazondeals to get notification of Amazon’s lightning deals ( each deal expires in just hours).

The second blacklisting feature is to blacklist certain tags. Currently I don’t have a reason to use this feature, but I can see some uses for it.

Other features

While I haven’t had time to test this feature (it happens automatically), Readtwit has the ability remove duplicate links. I am curious how much time must pass before a link is no longer considered a duplicate.

Another feature to reverse shortened URLs. As you can imagine, tinyurl.com followed by a bunch of jibberish doesn’t help me much in determining what items in my RSS feed is worth reading and what is rubbish.

My wishlist

I think it would be useful to continue with the blacklisting theme and blacklist anything from specific URLs, tweets with certain words (most people don’t use hashtags religiously or at all), and blacklist URLs with specific words in the linked article.

Readtwit does not have any features for whitelisting. That’s unfortunate. If I only wanted a small subset of my friends tweeted links, I would have to blacklist 70+ people. That’s far too tedious.

Bottom line

Overall Readtwit looks very promising. I really like the concept and hopefully I can get some good use out of it. Existing blacklisting features are already helpful, but I’d like to see more blacklisting abilities. I’d also like to see whitelisting features. One thing is certain, Readtwit is worth it’s price and worth a try.

 

potbs4j 0.4: Java library for Pirates of the Burning Sea web services

Pirates in your Java, sacking the classloader.

Pirates in your Java, sacking the classloader.

A few weeks ago I put together a Twitter publisher for Pirates of the Burning Sea (PotBS) for my wife.  She plays the game perhaps a bit too religiously. :-)   Anyhow, two things get published to twitter: (1) server status changes, and (2) in-game port status changes (who is battling who).

To make life a little easier, I wrote potbs4j, a Java library  to work with PotBS services. (My name for the library is genius, really!)  There really wasn’t any need to couple the twitter publisher with XML parsing and HttpURLConnection.

I doubt ayone will make use of the library, but if anyone is really interested in using it, I’ve worked out some usage instructions here.

If you’re using Maven (highly recommended), just include the potbs4j in your list of dependencies:

<dependency>
<groupId>com.ashlux.potbs</groupId>
<artifactId>potbs4j</artifactId>
<version>0.4</version>
</dependency>

Since potbs4j does not exist in the central repository, you will also need to add my maven repository (it’s slow but works) to your pom.xml:

<repositories>
<repository>
<id>ashlux-repository</id>
<url>http://www.ashlux.com/maven2/repo</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository><id>ashlux-snapshot-repository</id>
<url>http://www.ashlux.com/maven2/snapshotRepo</url>
<snapshots>
<enabled>true</enabled>
</snapshots></repository>
</repositories>

You can get the server status with the following code:

ServerStatusService serverStatusService =
new ServerStatusServiceImpl("apikey", "userid");

// get list of all server statuses
ServerListDocument serverListDocument =
serverStatusService.getAllServerStatuses();

// get server status for a single server
ServerDocument serverDocument =
serverStatusService.getServerStatus(ServerName.Antigua);

You can get the server status with the following code:

LandmarkStatusService landmarkStatusService =
new LandmarkStatusServiceImpl("apikey", "userid");
// get list of all port statuses for a server

PortListDocument portListDocument =
landmarkStatusService.getAllLandmarkStatuses(ServerName.Antigua);

// get list of all port statuses for a server
PortListDocument portListDocument =
landmarkStatusService.getLandmarkStatus(ServerName.Antigua, PortName.IRSH_PT);

There are also two utility classes NationUtils (for converting a nation to a nationality) and PortUtils (for converting a PortName.Enum to a string).

An important thing to keep in mind: the library currently does NOT cache results, so you will need to handle this on your own.  Both of the services do implement a method called getMinimumUpdateFrequency that returns the minimum number of minutes you should wait until calling the service.

The source code is hosted on github in all its glory.