Reference: Passing functions as parameters in C

#include <stdio.h>
//Example to show how to pass
//functions as parameters in C.

//simple function that returns the sum of two ints
int sum(int i, int j) {
return i+j;

//simple function that prints a char*
void printSomething(char* something) {

//function that takes
// 2 ints
// 1 char*
// one function that returns an int and takes two ints
// one function that takes a char* returns nothing
void functionThatTakesOtherFunctions(int a,
int b,
char* name,
int (functionA) (int,int),
void (functionB) (char*)) {
printf("Function A: %dn",functionA(a,b));

int main(void) {
//we pass the first two functions as parameters
"John Doe",
return 0;

This worked fine on my gcc compiler (MacOSX 10.5), no need to even use * or & operators when defining the parameters or when passing the functions as parameters.

On “Inception” and Programming

After watching Inception I think I have an easy way to explain what complex object oriented programming can be like.

Next time someone asks “What is Programming like?” I’ll say something along these lines:

“Did you watch that movie “Inception”? Programming is similar, you build your own worlds, with your own rules (and worlds that can only exist in the abstract, sometimes very hard to explain in words), but now imagine that instead of dreaming in 4 levels (dreams inside dreams) you could be dreaming in about 12 levels down, but not only that, you could be having several dreams at once (each with several levels down), and most of the times some of these dreams have to share things with one another in order to make sense or they break.

So Programming is like Inception, but Deeper, In Parallel and Synchronized.”

Photo by Smif

Reviewing the Nokia N900, User and Developer opinions.

Playing with it from the User Perspective
– Virtual keyboard is deactivated by default, not good if you have one hand busy, however I can see why it’s this way (the virtual keyboard sucks). When it comes out it covers the entire screen, and the experience with it is not there yet in comparison to the virtual keyboards of the iPhone or Android.

Physical Keyboard feels great.

Not sold on the stylus, I think I might loose it. However it comes in handy when clicking on tiny links.

– Web browsing experience is clumsy if you try to use your fingers and you’re used to Android or iPhone where dragging occurs on a light touch. With the N900 you have to Tap harder to begin to drag, probably like that intentionally. I must admit I find myself making mistakes on the Droid maybe because it’s too sensitive.

Using forms on the browser is inconvenient. There’s no way to move from form field to form field except using the stylus. Keyboard arrows won’t work to switch focus between form fields, and the lack of virtual keyboard (when you’re using the real one) implies that you won’t have a “Next” button to move through the form (or at least I couldn’t figure out a field hopping mechanism).

Zooming in and out on a web page will be extremely unintuitive. Thanks to patents on multitouch gestures you’ll have to either double tap, or do a ridiculous tap+hold and twirl clockwise zoom in (in a controlled way), or tap+hold and twirl counter-clockwise to zoom out… wtf.
Nokia has to put up a fight on this, natural multi-touch gestures are a must on today’s smartphones.

– I still don’t know how to select, copy and paste text from a website. Very hard to quote text and twitter it.

– Default timeout for screen auto lock is way too short.

It has a stand on the back, which as a developer I appreciate. It’s a pain to debug apps on the nexus one, you always kind of need to pick it up or create some sort of desktop apparatus to have the phone facing you while you test hands free.

Video and audio playback were perfect. Droid and Nexus One have nothing to envy, so it’s not a selling point. Watch the 3 phones playing the same video.

– Navigation is convenient with top left corner control. It took me a few seconds to figure it out being used to Android’s back and Home Button and of the one physical button on the iPhone.

– The Media player comes with pre-installed internet radio streaming app. On Android I had to download one from the Market.

Didn’t have to install Flickr photo uploading app, already comes with OS.

OVI Store experience frustrated me. Should be an app, not a web page. I got asked for an HTTPS certificate while trying to install a Twitter plugin, it was basically the same exception you get on a web browser. The regular user would get lost adding the certificate and the security exception. Then after that I got asked to signup for the OVI store, and I gave up. Installing apps should be a breeze. Setting up your OVI Store account should be done as part of the phone setup process on an App.

The more I use the phone the more I think, Nokia’s hardware is hot, but they’re wasting their time with competing on software. Nokia running Android would kill everybody else, let’s hope it will happen sooner than I think, they just need to test with one cool device and feel the market.

Unboxing Pictures
[flickr-gallery mode=”photoset” photoset=”72157623986709513″]

Playing with it as a Software Developer
– No SDK for Mac environment, or at least not a very accessible or official version of it. The only solution seemed to be installing the SDK on a Virtualized Linux (e.g. VirtualBox).

– Maemo SDK not compatible with Ubuntu 10.4 64bit, it seems it’s only 32bit.

The project page confirms this:
“The development environment for Maemo running on the desktop is called Maemo SDK. You can only install Maemo SDK on a Linux operating system. Maemo SDK currently supports the following Linux distributions: Debian, Ubuntu”

Tried installing Scratchbox on my Mac with no luck.

– It was a little surprising to see the Nokia documentation for developers talking about GTK+ in all their examples and not Qt, given the acquisition of Trolltech by Nokia in 2008. However you go to the Qt page and it says that it’s the defacto SDK for Maemo devices.

In the end I decided to install it on a 32bit Ubuntu VirtualBox image on my Mac and deal with the performance hit, I couldn’t just return the phone without compiling something, otherwise I’d be speaking out of my ass right?

Hello World in GTK

Hello World in Qt4, exactly the same code I would’ve used for a desktop Qt4 app.

compilation is the same thing as if developing a regular Qt4 app on linux
fakeroot apt-get install libqt4-dev[/bash]

create your helloworld.cpp… then make your project
[bash]qmake -project
make ./qt_helloworld[/bash]

If you’re used to Linux development with GTK or Qt4 you will feel right at home, and you probably know right off what’s the most comfortable set of tools to code. If you’re not, it seems like Nokia has left the whole thing way too much on the hands of the Maemo community.

Documentation seems a little all over the place, unfinished Wikis, not very welcoming for non-linux developers, I’m talking about companies that come from actually making money on iPhone OS or Android, looking to port their apps to Maemo. The first impression won’t be the best and you’ll think that things aren’t as well prepared as for iPhone with X-Code or Android with the Eclipse extension which let’s you deploy a signed installer in just a few clicks.

It seems that Nokia is relying way too much on the Linux community for all of this, I’m not sure if this is going to get very far with mobile shops, specially after seeing how many hurdles a user has to go through sometimes to get an app from the OVI market (in comparison to iPhone or Android’s markets simple purchasing processes).

SDK experience Screenshots
[flickr-gallery mode=”photoset” photoset=”72157624248900230″]


First of all thanks to Nokia for sending the N900. My final conclusions which are mostly thinking from the consumer perspective might not be one you’ll like much (you=Nokia), but you probably need to hear this (I’m guessing this is why you sent the device in the first place).

In my case after being a faithful Nokia consumer I felt dissapointed with the software side when I chose the N95 over the iPhone, newer Nokia phones came, but the same shitty platform was running on them, I thought Maemo would change that but now I know it’s nowhere near what smartphone users today expect. Then Android came along to truly compete with the iPhone.

Now as an Android user when the time comes for me to upgrade my phone I’ll be looking for another Android device.

Let’s imagine what’s going to happen when my Droid is too old, by that time there will be even more Android phones to choose from also a richer Application ecosystem, if I were the kind of person that installs paid apps I’d probably like to keep my “investment” for my next phone, however even if there’s a myriad of Android phones out there, the only brands I’ll consider are Motorola, HTC, LG and SonyEricsson, I’m not too fond of any of them so I’ll have to research what each of the phones they’ll be offering will suit my needs.

An Android based Nokia smartphone would certainly make my decision a lot easier. As of now you’re entirely out of the picture, there’s no way I’m switching to Maemo, and Moblin is way too new to tell if it’s going anywhere.

Nokia, Stop playing outside the garden, don’t get cocky with your current numbers and admit you’re slowly decaying, if you don’t do something about it once Android is on every cheap phone you’re gonna die. Android could use some Nokia.

Follow the geek.