S60 Surveillance Camera and PyS60 instability

During my 4-week summer vacation I had some time to work on one of those projects that I’ve been meaning to do for ages. The task at hand seems simple: I have an old Nokia E70 device and I want to use it as a surveillance camera so that I can go to joker.iki.fi and see the pictures taken from our house when I’m travelling with my family.

I decided to implement first quick-and-dirty version of this in such way that the phone takes pictures every 10 seconds and sends them, one-by-one, using the wifi interface, to joker.iki.fi as a POST request. On the server side, there would be simple server component, which saves the image and tags it with the time it’s taken.

Since I made a holy promise not to touch Symbian C++ ever again, I implemented the component which takes the pictures and sends them using python for S60. I already had some good experiences of this from the SMS forwarder script, so I decided to take a deliberate risk on developing something for a Symbian device on my free time. On vacation time, I like to avoid any frustrating projects and doing something on Symbian is always frustrating, maybe excluding shooting the thing with a shotgun.

At first, everything seemed to work very nicely. Then I got *AGAIN* into the hell that is development on the S60 platform. Even using Python, you can feel the shaky yet rigid bubblegum patchwork that is Symbian underneath. Nothing works like you expect, error messages are about as informative as sudden kick to groin and documentation is outdated, crap or it doesn’t exist.

The script is under hundred lines and doing basic things, yet it took me close to 12 hours to get it working (well kinda). Here’s the most annoying things I found:

1. PyS60 Socket library madness. I can’t understand (or really care) why there are two socket libraries in PyS60. There’s the normal python “socket” module and then there’s something called “btsocket”. These look mostly the same and BT in the beginning refers to “Bluetooth”, but then you can use it like you would use sockets for anything else. The thing is, it seems like pys60 libs use the socket library, so if you give python libs instances of btsocket, you get unexpected behavior. Nothing in the documentation tells you this.

2. The “default access point” behavior on S60. This is related to the socket annoyance but is a nice extension to this. You see, when an application tries to use network in Symbian, the os pops up a dialog for the user to select which access point (can be 3G packet data or Wifi for example) you want to use. At times this dialog randomly refuses to show you the Wifi access option and best of all: If you do “send(data, server)” in a loop for example, 10 times over, the default behavior is to … yes you guessed it: Ask the question 10 times, each time for each loop! How cool and secure is that!

So I ended up doing my own access point selection dialog which prevents also the problem of constantly selecting the access point. Why oh why did I need to code this myself?

3. Fail eventually, silently, horribly -style behavior. This is really notorious thing and seems to happen always on this platform. My application is essentially like this:

initialize()
ap = select_access_point()
while(True):
image = camera.take_photo()
send_image(ap, image)

Everything worked nicely so I decided to leave the script running and went to golf course. When driving back, I checked the camera output from my trusty HTC Hero. Surprise, the image hadn’t updated for hours.

I spend a lot of time trying to find why it’s crashing (and it was crashing the OS, not the python runtime) and managed to isolate the problem.

Probably most annoying thing was this:

4. When the app crashed the first time I first checked through the code and found no problems. Then I checked my pyS60 version, which was quite old, and decided to upgrade to the latest 2.0.0. I spend hours trying to do this and found out that no, it seems that for some reason the installation is just not working. Grr.

While every annoyance is probably not related to Symbian but some can be attributed to the pyS60 project, this is yet-another negative development experience on top of Symbian. It really is a waste-of-time-kinda-platform. I do realize that I’m in S60 3rd edition still and newer versions exist, but still I wonder when there will be a brave leader of Symbian who has the balls to say: Look guys, this OS is no more. It was nice in 2000, but we actually need to develop something that works nowadays and Symbian only gets in the way.

Please let there be such hero really soon.

I’ll probably release the surveillance camera as soon as I get the code cleaned up and hopefully the bugs get fixed sooner than later by PyS60 team.

Changing jobs and other stuff

It’s been a hectic beginning of 2009. Today we are celebrating my daughter’s first birthday. Also, I have signed a contract with new employer which looks like it’s going to be an excellent opportunity.

Although everything is well, everyone is healthy and the recession doesn’t seem to hit me at least yet, I have to say I’m bit sad. Sad and in need of vacation.

I’m sad because I’m leaving a really good company and people behind. I’m sad because I haven’t had that much contact with my good friends because of the hectic schedule. I’m also a bit sad that I don’t really have that much time to spend with my family.

All of my time goes into stuff that doesn’t really make me happy. Cleaning the house, repairing the house, constant ‘gotta do’ shopping for shit that I’m not sure we actually need.

I hope that with the new job, upcoming summer and my wife’s school ending I finally get into a situation where I can enjoy the fruits of all this labor. Life just can’t be this fucking hard constantly.

On a positive note, I have finally found a good RPG, in Ultima-style, for my Playstation 3. Elder Scrolls IV: Oblivion shows real promise. I’ve been somewhat disappointed to the RPG offerings for the PS3, but this is really nice.

I have also kept a small break from bicycling. I’m really waiting for better weathers and some additional motivation to start this year’s training.

That’s pretty much it. I love you all.

Being a father, part II, the 8 hour curse

I can pretty easily summarize the average day of my life. The following things happen during the 24 hours.
8 hours or work. This includes the work done to earn the money to pay everything.

8 hours of home. This includes the household chores, like cooking, cleaning, going to the store to buy necessities like food and clothes and so forth. Also, taking care of the baby is part of this. Changing diapers, feeding her and so forth happens within this 8 hours. Then there’s also the maybe 1 to 2 hours (maximum) that I can actually spend with her. Like playing and going outside to play and walk and such things.

Then there’s the last 8 hours, which goes to sleep. Or should go to sleep. If I want to do anything extra, like play a game, write some open source code, watch a movie or read a book, it’s away from the sleep time and it’s not possible to do for a long time since at some point the lack of sleep catches you.

I’m pretty certain that this can’t be it. The content of life I mean. I also consider myself being lucky enough to have a work that every now and then actually feels like it makes sense. I couldn’t imagine what it would be if I just spend my working hours doing some repetitive trivial bullshit.

Many people say that after a while it all gets easier. I wonder if they mean like it gets easier like you accept it as a fact that this life only gives you so few hours of fun time and rest of it is just work. Or, do they mean, that there starts to be more good hours. I wonder.

Anyway. I would not like to live my life like this, really. I mean the ratio of fun, even if you count sleeping as fun, is just not good. I think I should write a facebook application where people could record their ratio and we could compare. If people constantly score the same figures as I do, let’s commonly agree that the world is royally fucked and call the UN.

Being a father, part I, freedom of expression

For a long time now, I’ve been meaning to do an entry or two about my feelings and thoughts on being a father. I have many times thought what are the areas I want to cover in the entry and what is best left unsaid. Turns out that there’s surprisingly many things that actually need to be left unsaid. And this doesn’t seem to be a cultural thing, it’s more like an evolutionary thing. I intend to make a list about the things that are best left unsaid. I know this has the potential of making a lot of people pissed off. Nevermind, it tends to be so when you criticize things that are better left unsaid.
In the first part I want to mention the lack of freedom of expression. No matter what you do, you can’t speak about feeling bad, at least in public. A man is supposed to take care of the family no matter what. It’s a completely binary thing. You either are a bad father (meaning that you express any negative thoughts publicly) or you are a good father (if you keep your worries to yourself and never open your mouth). Society has advanced enough that it’s ok for a mother to say that she’s tired or is feeling down or downright depressed. This is fair and ok, after all, this is healthy.

The same does not apply to fathers. It’s ok to sigh and say “Wow, I have not slept in three nights. Man, I’m tired.” However if you say, “Wow, I have not slept for three nights, because I keep worrying whether we can make the next payment of the mortgage and I worry constantly about work. For the last three months I have spend either working in the office or at home and I don’t think most of the people I once held dear even remember me.” NO you cannot say that. This would make you a bitch whiner who is not a man and as such not suited for a father. It actually goes beyond this. This is where evolution comes into play. It’s not ok to say this at home, at work, at the doctor’s office.

It’s not that I personally feel all these negative things. But what I gather from observing the environment is what makes me argue the point of part one. It’s quite obvious really. The age-old “stop whining and be a man” argument applies to being a father more than to anything else. It’s hard to point the finger who is to blame because it seems to be an evolutionary thing, so I wont even try.
Nevertheless, it’s good for others to understand this the easy way. For me, since I have always bit naively thought that being a man is not such a binary thing, it has taken a while to realize this. It’s really that easy. Never speak negatively of fatherhood, mothers, children, family or anything related to these. Don’t believe in equality or that anyone would understand your pain. In the end, you are always alone with that since you can’t fight evolution. If you are lucky enough to have friends with whom you can talk freely, they will listen and understand, but the problem is that they can’t do anything about it. Talking may help, but so may the realization that this one is something that you just need to take and be happy about it. Even if you are not. Or then there’s the other side of the coin. You don’t take it - and then you need to face the music.

How did life get this way?

I find it hard to understand how life is like it is nowadays. This week is a good example. I have to plan everthing I do EXACTLY since otherwise I miss something that I need to do. Like, if I talk on the phone an extra 10 minutes, this makes me miss a meeting where I need to be. If I spend 10 minutes longer than planned changing diaper for my daughter, that makes me miss my bus which again makes me miss the metro and this makes me miss an appointment where I need to be or is away from the time I can do productive work and if I miss that I start to miss deadlines. If I miss deadlines I need to play catch up with the tasks which again makes me miss some freetime.

It’s a vicious thing really. I know it’s only temporary. The work can’t continue like this forever. My daughter is not so demanding when she’s older, at least I hope so. My wife can’t make anymore so much plans (for me) when she needs to start working after maternity leave. But I feel that I’m really running on fumes now.

I’m just about thirty years old. There’s no way I can keep this pace up until I’m fourty. Or I could, but I feel that I would not see fourty if I tried. Another thing that’s a big problem with this insane hurry, is that it’s by no means efficient. It’s just absolutely impossible to be creative and motivated if you are constantly just bouncing around trying not to miss anything.

The complete lack of free time is very frustrating. All of the things I know I enjoy in life, I cannot do. I probably need to stop writing now since I don’t have anything positive to say now.

Quickie

A short summary why joker.iki.fi has been offline for quite some time now.

  • A new baby in the the house takes all of the free time
  • I got fed up with the problems the old web server had
  • I purchased a new server
  • Didn’t have time to configure it until today

What else? Nothing much. Lots of changes lately, mainly due to new baby. During bad days, I at times feel that I’m ready to shoot myself in the head because I just can’t take this anymore. During good days it’s ok though.

I have been worrying a lot about my mental and physical health lately. Combining a busy job and busy family life, while trying to stay in shape and to educate myself has turned out much more difficult than I thought. I still have some resources left but I have constantly a feeling that the batteries will just run out at some point.

Ok, enough ranting. I’m going to go to sleep now, otherwise I’m history.

Helsingin Sanomat refuses to publish anti-copyright law ad

During this week, a group of people has been gathering funds to publish an ad in the largest newspaper in Finland, that is, Helsingin Sanomat (well, ok, not in the main paper but still). The ad is not obscene or very provocative even. It basically says “These people (who are the ones now running for parliament) voted for the law, and these people voted against.” Read the scoop from the Vaalimasinointi.org, who are the ones behind the ad.

Since I believe that passing the law was a stupid mistake and Finland is going to pay dearly for that, it is very frustrating to see that Finland’s biggest newspaper which, grated, has a very bad track record of being truly independent and party-neutral publisher, turned down the ad.

Well. even though it’s morally wrong, I guess it’s their right to team up with the Finnish equivalent of the MAFIAA. Probably makes a good business sense if you optimize for the past and stagnation. Good thing that I don’t subscribe to expensive partisan probaganda that is the HS.

Idiots

Normally whenever something’s on in TV that sucks big time it does not bother me, as I just don’t watch it. But Idols, the very very original brain-eating format show, is something different. As I don’t like it I don’t watch it, but still I can’t escape it. Every magazine, person on the street and news website I visit has some reference to it.

Every time I see or hear about these asshats I feel mentally sick. Ok, I don’t know these people personally, but let’s gather the facts:

  • This is a TV-Show where people go to perform for free. If you suck at singing people think you plain suck. If you actually can sing, people are not going to recognize you for that. You’ll always be “the idols wannabe” - no chance for real respect in the music scene.
  • You may get some idiots to look up to you by performing there, but most of the population of the planet are going to feel sorry for you or downright hate you.
  • The TV show is there - not because it’s somehow great or entertaining - but because companies want people to watch advertisement of diapers and toothbrushes and the latest “scientifically proven healthy”, frozen microwave dinners.
  • If you are “famous” in Finland, that means nothing. There’s something like 6 million Finns. There’s 6 billion people on the planet. Do the math. People are just not going to give a shit about you in the big picture. Even if toilet papers like 7 päivää are calling you a “star”, that does not make it real.
  • You are not going to get any money from this stuff in the long run. The “record deals” are very shitty and only make fat cats in “record companies” another piece of bacon.

Real musicians (and I don’t mean Britney Spears and other products like her) actually write their own music, get people’s respect by touching their inner feelings with their art and actually contribute something to the human race. Idols on the other hand, is mostly just a waste of perfectly good oxygen. Go to school and try to learn some useful skills for your life.

Just some of my insights to Symbian development

This post I think I need to start with a disclaimer: The following that is said is in no way related to my employer or any other company for that matter. It’s just an interesting thing that happened to me during my free time and is in no way related to any person I have business affiliance with.

Just the other day I was discussing with one guy who has been involved with Symbian S60 platform development. I didn’t actually know that he had been involved with this stuff until this discussion took place. Basically, I complained to him about Symbian S60 as a development platform. The platform is just very hard to learn even if you know C++ and getting from initial concept to a working and installable product is very time-consuming and frustrating.
I have written quite a lot of software in many languages and platforms during the 20 years I have been coding. This includes also some very low-level things with C and assembler. I took to Symbian development a few years back and was first very excited about the platform. Now that I finally have S60 devices and have some time to actually do more complex development, the difficulty and pain of developing working software has really surprised me.

Then just as a proof to the points I made, I found a link to this article from Slashdot. I would not like to call it a piece-of-shit OS as the article does, but I think it’s in serious need of redesign. I do realize it’s just not very easy nor cheap to make an easy, fast and customizable mobile smartphone OS, but the things that the article mentions just don’t seem to be today (or future) anymore.

I also would like to see some statistics on how much resources the worst problems of Symbian, like the VERY frustrating “leaving” exception handling and the descriptor paradigm does really save. If just these few things could be fixed and I could actually write my apps using a language closer to C++, I would not complain anymore.

Well, that and starting to add support for Linux on the development tools side.
I just needed to write this as the coincidence of stumbling to that article was quite eerie.

Const correctness and pointers

I have lately been writing a system in C++, which is a very refreshing experience after years and years of working with Java, Perl and PHP. Just like coming home. I guess what I am about to say applies to other languages too, but if you have ever written code of any considerable length and complexity in C++ you should know what I am talking about here.

Firstly what annoys me the most is that Java and most of these scripting languages - and languages originating from scripting languages - let you get pretty far in programming without really understanding the concept of pointers. Granted, it’s easier to code if you don’t really have to think about them, but even in languages where there is no direct concept of pointers I would argue that understanding the concept can make a difference when debugging and writing maintainable code.

Now, when moving from these languages to C++ environment, things get very ugly very fast. For everyone who is developing in C++ anything, I would suggest (among other useful resources) to read about const-correctness. Having spend a week hunting a single bug which would have been avoided if original author of a linked class would have used const modifier properly in the first place, I just had to say this. Grr.

Having an innocent looking PrintDebugInfo function which quietly modifies your supposed-to-be-hidden class members can really ruin your week.