I have an application that needs to send a HTTP request on application exit to tell the server that the app terminated normally.
When the user presses the exit button, I issue an asynchronous request to send off a HTTP transaction and get a callback once that’s done.
Now the problem is, I want to really exit the application from my HTTP handler.
I can’t call CEikAppUi::Exit(), since this basically deletes the top level appUI and proceeds to pull the rug under the HTTP class which KERN-EXEC 3’s once my HTTP handler returns and reads/write some bit of memory that no longer exists.
Once solution is to create a CAsyncOneShot derived active object to cleanly exit, and luckily Nokia have already done this in a well hidden method:
Just call:
iAvkonAppUi->RunAppShutter();
The iAvkonAppUi is an ugly macro over CEikonEnv::Static(), so you can call it anywhere in your code.
THe app shutter allows the current call stack to unwind naturally and then exits the app.
In this article, I talk about the problems of wrapping asynchronous function to make them look synchronous. I first focus on the asynchronous APIs in Symbian OS and how synchronous waiting can be implement, and then discuss how Qt(TrollTech) have solved the same problem.
(This is still a bit rough, so I may make a few changes) Read the rest of this entry »
Eclipse is getting silly. What started off a fairly sensible tool for Java development now appears to have been designed for no one in particular. The problem is that every plugin thinks it’s the most imporatant thing in the system and splats itself all over the place. Sure you can say it support feature X, but and the notion of a co-ordinated design, a tool which crafted for the benefit of the developer seems to have been lost. It doesn’t even look like a tool ‘for developers, made by developers’.
Exhibit 1:
Here is the result of right clicking on an “identifier”. I was trying to look up a header file.
Woah! The list scrolls up and down on my laptop screen. And now with the Qt plugins, I now have around 50 tabs to choose from (all of which seem to jump around when i press them).
Ok, there are quite a few context sensitve options that belong in that list, but “Preferences” – that’s a global project option which doesn’t even refer to the file i’m editing, let alone the highlighted identifier, and why oh why is “Run Leavescan” there?.
I’ve made my developer.symbian.com Wiki search plug-in available on mycroft.
This plug-in adds an item to your Firefox3 or IE7 search bar, allowing you to search for FAQs, code clinics and other resources on developer.symbian.com.
Just spotted that ‘Crayon physics’ has been ported to the iPhone. I’d be interested in how well it works with a finger.
In case you haven’t seen it. It’’s a game in which you have to get a ball from one platform to another by drawing 2D shapes which ‘come alive’ – obeying the laws of gravity. For example, if you draw a closed roundish shape with your finger at the top of the screen, it becomes a heavy boulder which falls to the ground, being deflected by anything in its path.
See here:
Some time ago I introduced the PC version of the app to a customer (a handset manufacturer) and suggested that it would make an excellent product differentiator if they bundled it exclusively with their soon to be released touch phone.
At the time, the word differentiation was on just about every power point deck with big companies craving for original ideas, encouraging “blue sky thinking outside of the box” (to use Ian Pegler speak).
Anyway, the idea was not taken up, but I thought it at least interesting to document the reasons why I think this game should have been snapped up for ROM:
It’s playful – you can waste some time at the doctor’s waiting room without really caring too much if you have to put the game down (a bit like snakes)
It has a viral quality – it’s the sort of game you want to show your friends
It offers design/UI cachet so craved by some of the handset manufacturers
It’s 2D – 3D was one of the worst things to happen to game play
I wonder if it could work on the Nokia5800 touch. I’m not sure if the screen is big enough for Crayon Physics to really work, but certainly the stylus is the perfect tool for drawing.
Box2D
Incidentally, a lot of these recent physics toys are based on the excellent Box2d algorithms and library. Box2D was originally a C++ API for simulating constraints in a 2D plane. It’s fast and visually pleasing rather than an accurate physics simulator.
It has been ported to Flash and Nintendo DS, and you can see some of the demos.here.
And for those who are interested, a Symbian/S60 port has been attempted here.
I frequently write test code which executes in a “text shell” test harness. This is the Symbian equivalent of running from the dos command prompt.
Aside from enabling the essential automation of unit and regression tests, a key advantage of a text shell test harness is that the emulator will boot in a few seconds rather than the excruciating minutes required for the full S60 environment. In the text shell, the edit->build->run cycle frequency is vastly improved when compared with running a full UI app.
For the emulator, Symbian has a fairly convoluted way of supporting this use case and I always forget what the correct options are. So I’ve documented them here for Symbian 9.x.
I spoke at the Symbian smartphone show last year and the slides have been posted by Symbian.
I quite enjoyed putting the talk together, but realised quite late in the day that it was only a 20 mins slot rather than an hour. So apologies for anyone who attended, I went through it incredibly fast.
In case you were wondering, the watermark in the template is my parent’s back yard in Wales.
Symbian have published my paper and code for a DLL which enables a Symbian application to get permission to upload images to a Flickr account via HTTP.
There are test apps which upload photos on S603.x and UIQ3.0.
CLOC is a simple open source tool for counting the number of lines of code in a set of files (minus comments and blank lines).
Recently I needed to run a LOC count on a Symbian based code base to try to make a point about maintenance cost. I came up with a configuration which records the files I would consider code (including rss, rh, hrh etc) but ommits XML and things like SVG. Read the rest of this entry »