What is your favorite API?

Some APIs are just great.

What are some of the funniest, weirdest, ugliest, most beautiful, easiest to understand, most rewarding once you know it or just in general awesome API that you have used?

I design APIs from time to time, and like to peruse API documentation in my spare time for inspiration (yes, I’m quite dull).

Some of my favorites include these gems from BeOS:


// returns true if and only if
// the computer is currently powered on
bool isComputerOn();

// if the processor is on fire, returns
// the temperature of the processor in
// degrees farenheit. Otherwise,
// returns some other number
float isProcessorOnFire();

This very recent classic in Android SDK:


// What a Terrible Failure: Report a
// condition that should never happen.
public static int wtf (String tag, String msg)

And this (also in Android):


// Returns "true" if the user interface is
// currently being messed with by a monkey.
public static boolean isUserAMonkey()

So, what are some of your favorite API-calls and why?

Would you think less of a “funny” API or would you rather enjoy using it more? Do you think there’s danger in being funny in code? What is your experience?


‘NSInvalidUnarchiveOperationException’, reason: ‘Could not instantiate class named MKMapView’

Did you just get hit by this cute error, even after adding MapKit to your Frameworks in Xcode? I did and the fix was not exactly obvious if you’re not used to Xcode. You need to double-click your target and under General you must add MapKit under Linked Libraries. Next you should be good to […]


Icon sizes for iOS and Android

When doing cross-platform projects we need a bunch of different sizes for the application icon in order for it to be useable for both the Android Market and Apple App Store. The sizes and filenames below are what I corrently use for iPod, iPhone, iPad and Android handsets as well as the promotional graphics. iOS […]


extThree20JSON dependencies using ttmodule

I’m getting started with Three20, an iOS framework with some nice eye candy and various nice-to-have features. While attempting to use the extThree20JSON module and adding the project dependencies using ttmodule.py I ran into the following: $ python three20/src/scripts/ttmodule.py -v -p acando-directory/ios-client/AcandoMobile/AcandoMobile.xcodeproj:AcandoMobile -c Debug -c Release extThree20JSON INFO:root:acando-directory/ios-client/AcandoMobile/AcandoMobile.xcodeproj target:AcandoMobile guid:xxxxx prodguid: xxxxxxx prodname: Acando.app INFO:root:Checking […]


MyApplicationAppDelegate.h:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘interface’

Aww. If you’re doing iPhone/iPad/iOS development (as I am at the moment), you might have gotten what I will now deem the infamous error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘interface’ error. I call it infamous because it seems it can be caused by about a gazillion different errors and can thus be […]


NoMethodError with Carrierwave & ActiveRecord

Hacking on a Padrino-powered application and need file uploads? I needed a nice way to do image uploads and decided to go with Jonas Nicklas’ carrierwave to add an image field to my ActiveRecord model. Current version of carrierwave is/was 0.4.10 and I got this error: Turns out this was fixed in master and is […]


Can’t upload files in WordPress on XAMPP in Mac OS X?

I couldn’t, and I confess to trying a bunch of stupid things like chmod -R 777 or something stupid like that. Here’s how folks: sudo chown -R nobody:admin /Applications/XAMPP/xamppfiles/htdocs Happy hacking!


Creating a REST-based API for PrestaShop, part 1

I’m currently helping a client with integrations between custom, in-house systems and their upcoming PrestaShop-based e-commerce site. In doing this job it’s clear they will need a two-way synchronization scheme for products/articles in PrestaShop (PS) (set stock levels, adjust base price, send orders, read order statuses, CRUD products etc). Now, the default PS-way (from reading […]


Super Simple Quotes in WordPress

This is a long-overdue pointer to a puny WordPress-plugin I made a little while back for handling quotes very easily. It’s called Super Simple Quotes, and I think it is! Have a look and tell me what you think!


Find Java classes in the classpath

My brother Oskar needed to read some Java classes from disk, so I whipped up some code to show a possible way. Then I figured you might like it as well. Here it is (and find the latest version at GitHub where you can submit your improved fork) Ain’t java short and sweet? Gimme closures […]