The Humble Geek

Stuff I write.

Keyword - nokia

Entries feed - Comments feed

Cross-Platform Graphical Library Maddness

An application that provides the user a window with buttons and input boxes is a given in today's graphically driven computer universe. Operating systems of all shapes and sizes provide a programmer the tools and libraries to accomplish their goal of providing such an application. Most of them are pretty boring or are too specialized to be worth taking time to study. The libraries that people should familiarize themselves with are those that can be utilized across operating systems, which include being able to run across multiple types of hardware devices. Two libraries come to mind - GTK+ [has a very interesting history] and Qt (pronounced "cute").

library-maddness

Today, both libraries offer very simple methods of creating a GUI. So, depending on what language your project requires, either one would be able to provide you with a robust and full featured set of options. The current drive to use Qt is entirely commercial driven - by Nokia - who owns Qt. It's the same drive that Sun made with Java. There's no logical reason to use Java. People have just be taught that it [Java] is the best and there is no other language that can do the same job (read: subjective).

I believe the "Qt hate" or "GTK+ hate" stems from the past when Qt didn't offer as many cross-platform routines as Glib (from GTK+) did or vice versa. It has been my observation that people have not spent any time with both libraries and make rash statements about the other library out of ignorance. Most Qt developers view GTK+ as a legacy library that should be abandoned. Don't tell them that there is still active GTK+ development (GTK+ 3.0 is coming soon) driven by a large community, which includes Red Hat.

Need a simple OpenGL widget in your window? There's GtkGLExt, or Clutter for GTK. Starting with Qt 4.0 a similar API for OpenGL handling was implemented.

Need video/audio capability? GTK+ apps can use GStreamer. Qt has phonon.

Need XML or HTML handling? GTK apps can use libxml or GtkWebKit while Qt apps would need to use the Qt APIs.

Nokia is also attempting to drive Qt as a "write once, run anywhere" library. This is great in that it some-what promotes FOSS, but if you wish to use GTK+ you can write once and run anywhere, too. I have done so with a GTK+ app for my $DAYJOB that can compile under Fedora and Windows and does advanced things like TLS encrypted XML packets over a TCP connection and scanning documents (using SANE). Neither library has an advantage.

More recently, Nokia has tried to push the mantra that you can write a Qt app quickly and simply. GTK+ developers can also use Vala to write a GTK+ app quickly and simply. The amount of code to write to accomplish the same goal in each library also ends up being about the same.

I can come up with any more number of examples, but those are ones I have seen used in arguments lately. The person arguing for using Qt has no idea about the matching GTK+ API and vice versa. I think it's great that both Qt and GTK+ offer such a wide range of features that are easy-to-use. You can choose a language (C, C++, Vala, Python, PHP) and write a program that could be used by thousands or millions of people across many different types of devices. Now get out there and start programming.

Developing Openly on Proprietary Land

My programming adventures continue. Nokia's experiment into Linux with Maemo is very alluring and since I've applied myself into a few Linux projects, I felt it would be worth looking into what Nokia has put together.

The Maemo SDK runs under Scratchbox, a virtual environment created in part by Nokia. The Scratchbox toolkit can run under any Linux distribution, and it requires it. If you wish to run the SDK under Windows, your only option is to use a virtual machine. Once your SDK is running, it is nearly identical to a running Maemo device. In order to use the SDK, basic knowledge of Linux goes a long way, but since Maemo is derived from Debian there are some distribution specific programs. I've been using Red Hat based distributions for years, so it took some time to get used to using dpkg and apt-get to handle packages. After a few months of using my N900, creating and handling packages takes less work under an RPM system, but it's adequate.

Since Maemo is Linux, any Linux application has a chance of life. This makes building new applications or porting existing Linux applications a walk in the park. You can literally compile any Linux program for ARM and run it, however, the necessary screen space and physical size of a N900 can make it difficult to use a large application such as Open Office, which has dozens of menus and toolbars. This is where Maemo ports come in. A finger-friendly UI can be designed and added, even sent to the upstream authors, and makes the app you port usable everyday on your device.

I started with building a brand new application. A stopwatch seemed like an easy first project. I noticed several stopwatch applications already existed, however they were written in Python or were not maintained in a long time. The Maemo Garage is a center for Maemo projects, so I created my own project page and began work. I decided to write in C, the native language of many Linux core libraries, and use GTK for the UI, a cross-platform, and the native toolkit for Maemo 5. During the programming process, I learned the Hildon additions to GTK made by Nokia, and the dbus methods to activate and listen for accelerator changes to allow my applications to turn into portrait mode when the user turns their N900. Here's the first incarnation: Stopish 0.9.0

Other programming projects are endless. I wanted to look at fixing a few usability issues. One was the RSS reader, which used a slider that was too thin for a finger. I submitted a patch to Nokia and it will be included in the next major firmware update. The second was the lack of FLAC tags in the media player. I now enjoy FLAC as my music format of choice, and it's possible to use since the Maemo media player uses gstreamer for media codecs and tracker for tags. In order to add FLAC tags, I had to extend the tracker program to be able to read them. Someone had already created such a plugin for vorbis, and so using it as a template, I made one for FLAC.

There are two Maemo repositories for projects, Maemo Devel and Maemo Extras. Finalized applications live in Maemo Extras, while developers can play with new applications in Maemo Devel Adding my projects to Maemo's repositories was a breeze. Just create a Maemo account and request upload access. I can use scp (SSH CoPy) to send my source code to the Maemo build server and it will package my projects and makes them available on the Maemo Devel repository. From this repository a developer can choose to promote it to Maemo Extras. During this promotion, other Maemo users vote on the application and if enough positive votes are made the project is automatically pushed into Maemo Extras.

Although most of Maemo is open source and source provided through gitorious, there's still a lot left closed - such as the phone, contact, and media player. Nokia's plans include more open source goodness in Maemo 6. The future of Maemo definitely looks bright even if they are forcing Qt down everyone's collective throats.

Maemo, Smaemo they Say

The world welcomes another Linux phone. This time around we have something a little more mature and more appealing to the eye. Behold, the Nokia N900:

As with all my blog posts, I won't bore you with details. Google is your friend. After handling the N900 for a week, I begin my review:

Hardware
  • Feel
    Plastic encased all around, the feel of the phone doesn't feel like plastic. It's a refreshing, solid, stout feel. When I first picked it up it felt heavy, but now I hardly notice the weight. The slider is solid and does not wiggle. It slides in and out of place securely. The keyboard keys are just the right size and it feels great to type on it, but if you don't want to slide out for it, an on-screen keyboard is available.
  • Screen
    While the technology of the screen is not new, I cannot find a problem with it. The 800x480 resolution alone will leave other "phones" in the dust. Most folks now-a-days want the latest and greatest technology and will spit on the N900 for using a resistive screen. I've used touchscreens for a long time starting with Palm Pilots to a Nokia 5800, iPhone, and Google G1 phone. This covers both resistive and capacitive technologies over the past 10 years. The N900 screen is extremely responsive and I cannot tell a difference between it and a G1. I've read other reviews saying the N900 is terrible, but I believe there's some fanboyism hidden under their text. In fact, I wrote brainstorm ideas for this blog post on my N900 with the included stylus. As I was writing I noticed it picked up every tiny detail of my strokes just as if I was using a real pen. Judge for yourself. I used Xournal (Maemo Extras repo) to generate it and Bluetooth'd it to my PC with two clicks of the screen.
  •  CPU/RAM
    The included Cortex A8 is in fact the same as the iPhone and is plenty fast. I have yet to benchmark it, but I have yet to find anything that stresses it too much. The phone remains responsive at all times no matter what you are running. Even when someone calls you.
    RAM isn't too much of an issue as it includes 256 megs of hardware RAM and partitions 768 megs of swap memory on the embedded flash drive.
  • Battery
    Lifetimes of the battery depend on what you do. No news there. Comparing to my N95, I get about the same battery life. One day if I am making calls, surfing the web, and using apps, or two days if I limit my usage to a phone call or two. The included micro USB port and cable allow you to charge anywhere there is a USB port and extra batteries are dirt cheap on Newegg. Battery life isn't too much of a concern to me for how much I get in return out of the device.
Software
  • Linux
    Nokia has made Maemo their Linux distribution and left most of it open source. Maemo 5, included with the N900, provides kernel 2.6.28. However, Nokia felt that IPv6 support was "bad" and left it out of the provided kernel. There's a bug report for it on Maemo.org. It was included for the WiMax N810 tablet, but now it is removed. Quite a head scratcher, especially since Nokia's Symbian OS has provided IPv6 for a long time.
    All of that aside, if enjoy what Linux has to offer and want that same freedom on your phone that is supported by a major corporation, this is your dream come true. Nokia has stuck with a standard Linux environment instead of building their own, and if you are already familiar to Maemo this isn't news to you.
  • Multi-tasking
    Switching between apps is a breeze and is as simple as if you were using a PC. The included compositing manager allows fancy transition graphics and live resizing of windows so when you view all open windows, you can see what is going on without having to bring them up fullscreen. This technology has been present with Compiz (and now finally Windows 7) so nothing too new, but it is great to have it on a device that fits in one hand.
  • Application Compatibility
    Any Linux app will run on the N900. People have Quake 3 or Duke Nukem 3D running on it. Granted, the screen resolution isn't the same as a PC, so some apps are not usable on a small screen. In that case forks of the UI's for some apps are rewritten and made useable. A big example is Firefox. Mozilla's Fennec is Firefox with a UI for mobile devices. It is a full-fledged copy of Firefox and will render every web page exactly the same as if you were on a PC. All other phones include browsers that render differently and do not provide support any where close to Fennec. In fact, I have installed Adblock Plus on my N900. It works identical to my PC. No ads! This is the first device to provides this sort of environment. Not the iPhone, not the Pre, not even the Android phones can hold a candle to it.
    I have even started my own app for Maemo and did it in just a few hours. Check it out on the Maemo Garage where all Maemo apps are hosted.
    Nokia is even providing an Ovi Store for Maemo apps so businesses who wish to sell apps can do so. All of this is centralized through the app manager and relies on Debian-derived repositories for searching and installing apps. It's brain dead simple and keeps your phone clean for easy installing and uninstalling. You don't have to google search for apps.
  • Phone
    Contact support is brilliant. It merges traditional phone contacts with IM contacts and uses the open source libraries of telepathy to do so. I have my friends with not only their phone numbers, but AIM, MSN, Skype, and Jabber accounts all on one contact. This bleeds over into a conversation app that keeps SMS and IM conversations together. It's dead simple and brilliantly put together. The phone can take contacts off of Ovi or S60 phones so I was able to easily sync with my old N95 and get all my contacts and all their details (address, birthdays, etc).
    It's not perfect though. You can't assign a ring tone per person or use provider numbers to check minutes or data information (bugs in maemo.org for them).
    In all my phone conversations, I didn't have a problem with the speaker or mic. Everyone was able to hear me clearly. It does support speaker phone. The really cool thing is that it supports face detection - the phone will blank the screen when it is next to your face (saving some battery). Other high-end, phone-only devices support this same feature so it is nice to see it available here, too.
Future
  • GTK/QT
    Maemo was originally designed for the GTK graphical interface toolkit. Nokia spent many man hours developing special add-ons to GTK for better tablet support, called Hildon. This past year, Nokia purchased Trolltech, makers of the QT graphical interface toolkit. Starting with Maemo 6, QT will take GTK's place. It was purely a high-level business decision as Nokia, with all businesses, are looking to make a profit. Nokia wants to keep Symbian and they have already invested time in bringing QT support to Symbian. With the Trolltech purchase, Nokia hopes to build a cross-platform design with QT so that all their devices they sell can run the same apps. This helps the small amount of businesses still investing in Symbian... because most of them have left to work on iPhone fart apps or work for Google now. All in all, I don't see this move as a bright business decision. I hope GTK still remains prominent in Maemo as it is the toolkit of choice for my programming both at work and at home.
  • Community
    It's a widely known fact that the Maemo distribution is gaining presence. Several Nokia employees have stated that the maemo.org site has seen huge increases in traffic with the release of the N900. Their garage and other sites have sometimes been susceptible to the heavy loads and become unresponsive. Nokia has stated they do plan on moving to better servers and better hosting ASAP.
If you've skipped to the bottom, screw you. My choice to buy this phone was a good one. I see it being a long time device in my collection, that is, until a faster one comes out. ;) There's so much more to write about the N900, but I want to get back to my life now.

Nokia and Python, a Tight Pair [Part 2]

Woo hoo!? I read my battery voltage. Take that $300 OBD readers. Success is brewing on the application front. I took some time today to rewrite more of the garmon "port" and got some positive feedback. All that really remains is to write the UI part that will display each sensor reading. Hm...

P.S. Don't mind the "RPM" text, I was going to do an RPM reading first, but a battery reading was much easier. >.<

UPDATE: I posted a much nicer screenshot.

Nokia and Python, a Tight Pair [Part 1]

Little, neat gadgets are sometimes necessary to keep life from being a complete drag. That's where the ELM327 OBD-II device comes in. A mouthful? OK, sue me. It's a chip that can read your car's information, such as MPH, RPM, air temperature, water temperature (yes, your car uses water), and all sorts of other goodies. The chips sell for around $60 on eBay for Bluetooth versions. Normally OBD-II readers sell for hundreds of dollars and are standalone products, which are very limiting in what you could do. The catch? It's just the chip - no software. However, since the chip has open specifications there are a dozen or so different softwares that are ELM compatible. Garmon is one such software.


When I first got the device I had a dilemma. I could either drag my desktop computer out to my car and ran a long extension cord for power, bought a laptop, or borrowed a friend's laptop. I chose the third option, thinking I was looking to buy a laptop in the future. But wait! I have my Nokia N95 don't I? The only thing that kept me from thinking of my phone is that I would have to write a program in Symbian C++ - a task I wouldn't do unless I was paid a cool mil or two. So for a while I could only use my ELM reader when I was with my friends.

A few days ago my brain finally clicked into gear: Garmon is written in Python and Nokia has released Python libraries for their phones. I could certainly port Garmon to my phone. No need for a stinking laptop! After installing the libraries and running a "Hello, world!" program I knew it would be possible, with a little help with Google, seeing as this was my very first Python program (I'm a C junkie). Stay tuned for the results...

- page 1 of 2