About

mFabrik Blog is about mobile and web software development, open source and Linux. We tell exciting tales where business, technology, web and mobile convergence.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Thoughts about WP7

Now that Nokia made sure most of the energy put on Qt goes down the drain, I took a peek at Windows Phone 7 development and I was disappointed.

I posted a short comment to Future of Qt blog post and I thought I’ll write a bigger rant to make people more aware of an important issue.

The tools for WP7 are probably the best with Visual Studio and GUI editor and what else, I’m pretty sure about that, but the platform itself is disturbing: all code must be C#. You can’t use C/C++ with WP7. And when there can’t be those, there won’t be CPython nor Lua or any scripting language implemented without C# or .NET managing your code, unless you’ll find a C# port for it. And if you did, it most likely lacks in features compared to the original. And then there’s numerous other C/C++ libraries that you can’t use.

Somebody commented on my post saying this is the reason why the platform will fail and nothing except meaningless apps(fart apps,rss readers etc) will be ported. Apps with long history, existing code base and support for multiple platforms can’t be pure C#.  And I agree 100%.

Microsoft wants to avoid fragmentation, well that’s good but not with these restrictions. Lack of “unmanaged code”, as native code is called in .NET land, will be causing fragmentation, not the ability to reuse your code. It’s your code that’s fragmenting so MS doesn’t care. This is even worse than the Apple’s ban on scripting languages, which was removed a while ago. They still allowed reusing old C/C++ libraries, like physics engines in your apps.

If WP7 ever gains popularity among major app/game makers, I believe and wish they’ll make this issue clear to Microsoft as they (I assume) did to Apple. Well, first they need to gain popularity among consumers ;)

Without knowing much about the internal workings of WP7, I don’t see reason to block native libraries. Sure, it’s harder to avoid dll hell with C/C++ as the problem is well known on desktop. But if my app doesn’t use any system libraries but only its own? How many system libraries do you think a physics library might need? How many system libraries does a Lua interpreter need? I can think of one: libc for allocating and freeing memory. All those libraries do is reserve some memory and do some math and give some results back. Sure scripting languages may allow file access etc., but that’s not necessary. I just want to script some logic of the app, not the whole app. Anyhow, I don’t see the point, somebody, please enlighten me. Google & Apple can do this without getting in your way, why not Microsoft?

I have been reading discussions about Nokia-Windows deal, and only fraction seems to think that the whole Nokia-WP7 thing is a good thing. And those who do seem to be… less informed. The only good thing here is that we are finally getting rid of Symbian, but the price is too high.

So what’s the main reason that I’m worried about: to force people use .NET and me to write only C#. We have now witnessed what happened to people skilled with Symbian C++, the fear that I heard soon after Nokia started using Symbian. So don’t try to get us stuck with a single way of doing things. Sure there’s monotouch and monodroid to reuse your code on iPhone and Android. Not sure about them though, not free and they add another layer of complexity to your app. Easier to just learn the platform’s own way. I have no trouble using C#, but that’s not the point: I want to reuse my old code and the other libraries out there. Apple is good boy compared to MS.

And my opinion about C#? Nice, but Qt Quick rules. Sadly, now I can only think that it should rule. *sigh*… back to the drawing board.

Native mobile application development with Plone, WordPress and Python

We have just released two mobile applications backed by Plone, WordPress and Python middleware code. In this blog post I’ll tell some background information what we have learnt with mobile applicationand Python development.

mFabrik News – download now for iPhone and Android

Why create a mobile application?

The first question is why one rather create a mobile application when the same task can be accomplished with a mobile site? Most people even prefer mobile sites over applications. From a pure engineering viewpoint, mobile applications are usually just glorified RSS readers that embed Webkit and add some native user interface bling bling over it. With an app, you are limiting your target audience, because an application is limited to one platform. Maintaining application(s) and application developers is more expensive compared to a mobile site which few (cheap) PHP junkies can throw together.

But is not always technology or price which matters. Mobile applications have prestige value – having or showing success, rank, wealth, etc. If you have a high quality brand, you probably want to have a mobile application too. When you see the brand logo swinging forth and back in an iPhone application with smooth animation running 60 frames per second, you see that it is a proper placement for the brand logo. The output is more luxury, more carefully planned, and does not look like it was thrown together by few cheap web developers.

There are even rationale reason for going after applications. First, you are in a business of making money. It is a lot of easier when the platform itself is offering you a payment solution without a monthly fees (iTunes payment). Other good reason is that there exists interaction between the application and your content beyond the browser window.  You can push messages or do things even if the user is not on your site (see more information about the push solution we implemented below).

Mobile application development and Python

As most of this post readers are probably fellow Python developers, here are some thoughts specifically aimed for them. Python itself is not a very good alternative what comes to mobile application development. Though, the application itself may not contain Python code, Python still shines on the backend side of the things. For example, we’ll hope to publish an example application using Google App Engine in the near future.

The only future proof platform where Python is 1st class citizen for building applications, is Nokia’s Meego with its Pyside and Qt bindings. Unfortunately Meego doesn’t have any shipped handsets and looks like it never will.

Android has script bindings, but they are not good enough for real application development, as interaction with the native platform happens over TCP/IP sockets. However, Android has seen some recent exciting development from PyPy project, possibly enabling native Android development for Python in the future.

iOS with Python could be a go, now when Apple has lift ban on interpreted languages. I haven’t heard anybody doing it yet, though. CTypes had some problems long time ago regarding run-time generated code for Python bindings.

Python has also a port for Series 60 (Symbian) – don’t go there if you are not prototyping. It is good platform for students for  playing around, but unfortunately it has never been considered as serious development environment by the handset manufacturer. You have tons of headaches if you actually want to release a product version of your application.  Nokia N900, soon supported. is better prototyping platform for Python than Series 60 as you get full Debian userland.

Mobile application development and wrappers

There exist various wrapper technologies which help you to wrap your HTML5 application to a native application shell. With simplistic APIs provided through Javascript bindings, you can access a limited subset of native platform APIs. Wrapper technologies are mostly aimed for web developers, who do not have any experience on application development and they might want to skip the learn experience of native development.

Wrapper technologies do their job and produce decent apps. But if you are a Python developer I recommend you skip the wrapper step and build your own native user interface and embed Webkit yourself. Designing an user interface is much is easier with Apple’s Interface Builder or Google’s  Android tools than with half-baked Javascript bindings. The fact that you are actually able to insert a real breakpoint into your code is itself worth of skipping wrappers. If you already are a Python developer you already know at least one real programming language and mastering Objective-C or Java should be an easy task for you.

Webkit itself has bugs. You will regularly hit obscrure bugs when the amount of  Javascript and CSS code grows. In the worst cases Webkit just dies under your application without a way to debug the problem – sometimes without a workaround available for the problem. This means dead end for your lovely application. You don’t want to end up to this situation. So, just to have more low level control, using native tools is good.

mFabrik News application

mFabrik News mobile application allows you to follow the latest news of mobile and web development, produced by our hacking team. The applications source the news from our Plone based web site and WordPress blog (which you are currently reading). It uses special RSS streams prepared with our Web and Mobile multichannel publishing solution: news images are optimized for mobile device screens using a handset database (Wurfl) and some other HTML preproessing is done to make the posts look better in embedded WebKit. Processing is done using mobile.sniffer and mobile.htmlprocessing Python packages which are generic Python packages and should be usable in various environments, including App Engine.

iOS mFabrik News application has push notification support. Android doesn’t yet implement push solution, but it is coming for Android 2.2 handsets.  Please see the earlier blog post how we use Apple Push Notifications with Python.

Download, give the apps a spin and report any feedback! (direct links at the beginning of the post)

We may or may not release the source code of the applications, depending if anybody thinks they actually would find it useful.

Get developers  Subscribe mFabrik blog in a reader Follow me on Twitter

Why people hate Adobe (and have now headache with sports-tracker.com)?

sportstracker.nokia.com was a GPS based sports tracking service for Nokia phones. Around a year ago it spun off as independent company, which was a good move if you really want to develop your service business. Now sports-tracker.com has launched a new website. You can upload your runs and photos there and share your sports results through social media.

It was delightful to see the new site opened and having the features been missing so long time ago. However, I was not totally happy with what I saw.

The whole new site is built on top of Adobe Flash run-time technologies. There are no traditional web pages per se.

The problem is that full page Flash is resource hog. In the picture above you see that opening this web site in my Safari web browser spikes CPU to 100% usage – and it actually stays there indefinitely (note: on front page, see remarks below). This means that my computer is working to barely survive under the stress caused by this one web site – and my computer is powerful iMac. This means that if I have this site open background in my web browser my laptop battery would die very very fast. This means that all programs I try to simultaneously use on my computer become sluggish.

I assume that when sports-tracker.com was spun off from Nokia they contracted some digital advertisiment agency to built the new site for them. Digital advertisement agencies are often, not always, companies focused on the brand and visual appearance. They love to work with Flash because it gives good authoring tools to build nice looking, bling bling filled, animations.  Flash is a great tool for animations. Flash is a great tool for building browser based games. However, it is not good for building the whole web site where the user experience criteria could include 1) the site actually to responds to clicks 2) the site does not bring down to the whole computer. The decision makers probably drink cool-aid “hey let’s built the site with the Adobe’s latest tools – have you seen the demos how coooooool they look like”.

The thing is, I want to just see my sports tracking results. I don’t care whether the diagrams have blurred drop shadows with state of the art Web 3.0 mouse over effects. Now I can enjoy the effects, points for the artistic leader for that, but doing the actual task, accessing my sports results, have become irritating task to do. Things respond sloooow – that’s the main reason. In-flash scrolls bars have noticeable lag.

There exists an uncanny valley how normal web sites behave and how 100% Flash site behave. My right click does not work. I cannot right click a link and open it in new tab. I cannot right click a link to copy it to my friend. I cannot access the site on my N900 web browser (which even has Flash). I coudn’t even send feedback to sports-tracker.com team without first installing a desktop email client, as the email address cannot be copied from Flash to web mail. Text boxes are little different.

I cannot hold my horses to see Adobe conquering mobile phones with Flash and doing the same thing for mobile browsing experience it has now done for sports-tracker.com.

The site is not bad. Usability guidelines have been followed carefully when building the site. The developers seem to have gone into great details to make the operations smooth as possible. For example, URL fragment identifies are used to make sure bookmarking works even though Flash is present on the site. Social media features, not present in old sport tracker, are finally there. The results of design decision to built the whole site on Flash, instead of using Flash for some components only, might not have been seen by the time this decision was taken.

When Nokia Sports Tracker was first introduced 3-4 years ago with the first Series 60 GPS phones it was ahead of the competition. Wow effect had no limits – can you really do that with your mobile phone – in real-time and live?

It is funny how time passes.

It is definitely possible to build a sports tracking site, which looks cool, but does not have issues mentioned here.

Note: With little more research it seems that CPU usage stays 100% is specific to front page only and it has issues of not winding down action when you move away from your browser. However, rendering of other pages still uses vast amount of CPU, causing lag you do not see when opening web pages. The background CPU consumption on sports-tracker.com page is aroud 8% per tab when should be 0%.

Note 2: I am using the latest 10.1  Flash Player.

Get developers  Subscribe mFabrik blog in a reader Follow me on Twitter

Python 2.3, Python for Series 60 1.4.5 still in use… and insight into Symbian deployment process and user experience

Nokia’s Python for Series 60 has a long history. It is a Python interpreter, originally escaped from Nokia prototype labs, running in your phone. It is said to been awesome to show mobile/embedded developers, who were love with their static C compilers and 4 hours built times, opening a Python prompt in your phone and typing import audio; audio.say(“your phone loves Python”) by keypad (Nokia Series 60 phones come with a speech synthetizer). Python for Series 60 is the best tool of building a simple proof of concept mobile applications. The lack of speed, lack of good UI libraries and difficult deployment problems makes it challenging to use it in production grade environments.

PyS60 has also a history of staying in archaid Python version – namely Python 2.3. It was not until this February when stable PyS60 2.0.0 with Python 2.5 was released (1.9.x was considered experimental according to the release notes). Luckily looks like new winds are blowing (Qt acquisition, Meego/Maemo) and Python is getting higher priority. For example, PySide Qt bindings is very high profile project. Based on this, we hope to expect Python to the first class citizen in the future Meego and Symbian devices.

My company had a little side venture with PyS60 Community Edition when we were still betting that Symbian and Python would rock the world – the era before iPhone changed the game.  PyS60 community edition was effectively a revamped PyS60 1.4.x with Python 2.3 toolchain which actually made PyS60 application production deployment possible. Possible…? -you ask. Madness… no. It is Symbian. It is certification and signing and obscure error messages. Basically vanilla PyS60 is being shipped as an external SIS (Symbian package format) and Symbian platform security makes it impossible to deploy two production signed applications using vanilla PyS60 on the same device. The only cure was statically building Python for both apps from the scratch, which is exactly what PyS60 Community Edition was doing.

But this all was long long time ago. Aeons in mobile time. So I was today surprised when I got email from a person (David) using PyS60 Community Edition. We never upgraded PyS60 Community Edition to Python 2.5 . In fact we haven’t touched the project about two years. David was effectively using Python 2.3 and asked questions about the tool chain internals.

My first answer was a question Why on Earth you are still using Python 2.3? I thought maybe the guy had somehow missed the last two years or was a stuck with an old phone.

However… this was not the case and the answer was very insigtful.

Yes, I’m aware of PyS60 2.0.0, but I prefer PythonCommunity, at least for the moment: no OpenC neither Platform Services dependencies; smaller .SIS size and memory footprint. I think that the final .SIS produced with PythonCommunity, with everything necessary to run contained in it and with a clean installation without multiple dependencies, is a better fit for a mass-market than the files produced by PyS60 2.0.0, above all taking into account that people don’t know what S60 or Symbian are.

Also, the runtime deployment on the new PyS60 isn’t automatic for S60_3rd and S60_FP1 devices, so in the worst case scenario, users may end having to learn to install the different files (pips.sis, ssl.sis, stdioserver.sis, Python_2.0.0.sis, PythonScriptShell_2.0.0.sis) in the correct order, which is a big no-no for a mass-market deployment.

So…. I hope someone in Nokia is reading this blog entry carefully. Do it like Apple does. Make your application deployment static. Make OpenC static. Make every freaking library which is not shipped with the device statically buildable. It should be possible now when everything is open source. It will consume precious device RAM, but at least it will make mass market application development possible. SIS hell is worse hell than deb hell, or DLL hell, as the end user cannot fix it due to device security.

In the related news SIS smart installer was announced few weeks ago. Personally I wouldn’t bet it can deal with all the problems of versioning and Symbian platform security. Forum reports aren’t promising and looks like very Symbianish user experience can be expected. In positive light, it seems that Python is being considered for this process.

Get developers  Subscribe mFabrik blog in a reader Follow me on Twitter