Categories
iola

Django Alliance

Being small and agile has many advances, but sometimes people confuse it with being fragile. Although one could argue that betting on a single-vendors proprietary solution would be a more fragile business proposition. Anyway, to make people feel safer buying web systems developed in Django and Python based on Open Source, we have had a finger in the creation of the Django Alliance. The web site complements Django People with a focus on companies rather than on single individuals.

Categories
android

Andnav2 working on Hero again

First a short background. HTC Hero released with android 1.5. Google releases android 1.6 with TTS (text-to-speech) support. Andnav2 working fine since it uses external tts library. Author of Andnav2 (Nicolas) releases version compatible with android 1.6, but leaves all users of 1.5 devices out in the cold. The update was uploaded to marked with NO warning. After many talks back and forth Nicolas finally agrees to release a version that at least starts up on 1.5, but still crashes when using turn navigation. HTC announces that they are working on a new firmware based on 2.0, but release has not yet been determined.

So with that history out of the way, I now announce a version of AndNav2 that works on HTC Hero by simply removing all the calls to TTS. You can download the version here. Please note that you need to uninstall your previous version of andnav2 first as this version is simply signed with the android beta key.

I could have removed all the ads as well, but that was not the point of this reverse engineering. I simply want to be able to use a program, which in my view, is the killer app for the android phone. Don’t get me started on Google Maps with navigation. It’s US only, not based on OSM, and works only on android >= 1.6.

Enjoy 🙂

Categories
Programming

Go

Google released a new system programming language. I wonder if the names of Robert Pike and Ken Thomsen will make it more appealing to C people 🙂

It’s clearly meant to go head to head with C++. The two most interesting design decisions to me is their take on OO (feels like templates done right and no crappy inteheritance in the ordinary sense) and concurrency which looks a lot like Erlang because it’s CSP. Both of these things make it feel very functional.

So many languages to tinker with and so little time 😉 Oh yeah and it doesn’t run on Windows yet 🙂

Categories
python

Python scoping

Last friday, Lau discovered an interesting edge case of python. Something that at first appeared to be a bug, but later revealed a deeper truth about the scoping of Python. I guess coming from a C++ background spoils one in some regards. Scoping in C++ is simple and uniform, I have never in many years of programming C++ got bitten by the scope of the language, something that I also can’t say about C#.

The problem boils down to how Python treats local variable and global variables. The following example, stolen and modified from here, shows the edge case in its most simple form:

a, b = (1, 2)

print(a, b)

def test():
    print(a)
    print(b)    # (A)
    #b=1       # (B)

test()

(A) works as long as (B) is commented out. The strange thing is that changing (B) into += produces the same result. Actually it is the case that += a global variable will never work, unless you have declared it in the local scope first. This comes back to the way Python threats variables in the local scope. The following link has more examples to illustrate how scoping works and also how this is different in Python 3k. As explained on Stackoverflow, using the dis functionality sheds some light on strange cases like these. All this said, the scoping has one good thing going for it. The following is quite useful and perfectly legal in Python:

i = 0

def ex1():
if i < 0:
b = 10
else:
b = 20
print b

ex1()

Categories
android

Getting android emulator running on Ubuntu 9.10

I had a little trouble getting the android emulator running on my laptop. I wanted to start debugging why andnav2 is no longer working. Hopefully Nicolas can get it fixed, but it appears that he’s quite busy 🙁

The first problem I ran into was that the buttons in the tools/android application where not responding properly. Starting tools/android with the env variable GDK_NATIVE_WINDOWS=1 fixed that problem. Next problem was that the ssl mirror for getting the different SDK versions was not working. A quick google revealed that adding a sdkman.force.http=true to ~/.android/androidtool.cfg fixed that. Do not try to just remove the http. You’ll get the SDKs, but it will not work.

Last problem was getting java jdk working. I settled on openjdk as it seems to be the way forward. Be sure to use java-alternatives to set your java version. Sun-java6 seems to be 9.04 so I should probably remove that at some point. Just don’t want to ruin my webbank 😉

After getting everything up and running I tried the debugging tool and it appears to be really neat. It has tons of debug information, even down to when the GC is running, and was able to give me a proper backtrace of the problem. Another really cool thing is that it’s extremely easy to test ones application one 1.5, 1.6 and 2.0 by simply running 3 different emulators. Or different screen sizes for that matter. One can also see some of the goodies coming in android 2.0. The browser seems to have gotten a nice overhaul. Can’t wait for HTC to release an updated ROM based on 2.0.

Categories
ubuntu

Font problems with QT programs in Ubuntu 9.10

I upgraded early to Ubuntu 9.10 release and have been overall very satisfied with the changes. 3d effects are back, thanks to fixed intel drivers, kernel has been upgraded and suspend + boot is faster, and Emacs has been upgraded to 23 🙂 I just had one problem when upgrading, namely that QT applications would use a non-hinted font which made Skype and Virtualbox would look like crap. It took a bit of googling to find out what the problem was. Using qtconfig-qt4 did not work for some unknown reason. I followed the guide on the link, and got fonts working again by simply copy/paste in his .fonts.conf file into my home directory.

Categories
android

8 free android apps and two web

One of the more interesting aspects of the HTC Hero for me was the android market. As paid applications are not yet available in Denmark, this list only includes free (as in beer) apps:

  • Locale: Brilliant and simple program to handle profiles automatically. Currently I just use it to have the phone silent when at work and with ringer on at home. But there are endless possibilities with this application. No wonder it won the Android Developer Challenge 1 competition. Highly recommended.
  • Facebook: pretty decent way to read and post status updates. Mostly needed because their website sucks in the browser.
  • Flickr.com: While not an app, the web site is simply a blast to use with the browser. Way to go flickr!
  • Wikipedia.com: Also not an app, but I’ve tried a few different apps, and the web site beats them all hands down. Don’t bother installating any apps.
  • AndNav2: I wrote a seperate post about it here. I’ll just add that I tried mapping with it yesterday and that also works perfectly. This application for me is the killer app for the android right now.
  • Google sky map: Mostly a wow-factor application but to be fair this application is pretty nice.
  • PMix: Application to control music player daemon (mpd) that I use at home for playing music. It’s ok, but still quite rough around the edges (=crashes).
  • Skype lite: The software uses normal phone minutes for calling and thinks its a feature. Very disappointed.
  • Pro football live: Just to keep up with the latest games. Works pretty well. The best NFL app I have used.
  • Advanced task killer: The best I have found to keep the android running lean and clean 🙂
Categories
android

Getting album covers working on the HTC Hero

I’ve been strugling getting album art working properly with the music player included on the HTC Hero. Covers was only working for some albums. After a bit of googling and a few different tries, since there was a lot of misinformation on google about this problem, I finally figured out how it works. The player reads covers from a tag on the files. This is apparently the only way it supports covers. The player after reading a new cover, then thumnails them and stores the thumb in the albumart directory on the flash. The first application that I tried to add the album art to the files was Easytag, sadly it has a pretty nasty bugs that leads all the covers all fucked up. That combined with the caching of the player, left me strugling trying to correct the covers after I found a tagger that actually worked. So please don’t try that at home 🙂 My second try was Kyamo, which I can’t recommend sadly. There are simply too many things that sucks in it. Things that combined makes fixing up ~10gb music a complete pain in the ass. I finally settled with Mp3tag, it’s for Windows, but at least it works quite well and its free (as in beer). Another annoying thing about the player is that, while it supports Ogg Vorbis, it doesn’t understand covers embedded in ogg. So no cover for those albums. Ah yeah, I should probably also mention that the thumbs generated are in 320×320, so in my experience around 500×500 pixels works best.

Hopefully this should help others, who have been struggling with figuring out how the hell the music player on the HTC Hero handles covers.

Categories
profiling

Profiling multithreading applications

I’ve written about profiling before in the general case. But when it comes to multithreading, there are a few more factors to consider such as lock contention and cache invalidation that affect performance. And this is where mutrace (mutex profiler) comes into the picture. The profiler has a very low overhead compared (no perceived delay for me) to other solutions and gives quite nice results. I tested it on My Media System (C++) and Nemo (C#) and got interesting results for both. I knew more or less what the results for mms would be, but the results for Nemo was a bit suprising. The lock contention was significantly higher than for mms, even though I didn’t really use a multithreaded design for Nemo. So I guess it comes from the mono platform itself. Sadly it seems that mono programs aren’t compiled with -rdynamic, so the results that one gets are quite hard to decipher.

Categories
android

Andnav2, open maps for the android

As I was researching the android platform before buying a HTC Hero, one of the things that really got me excited was the mappping/gps application andnav2. It’s a frontend for openstreetmap, that uses the open routing service to provide turn-by-turn, all for free. The only thing is that it requires is a internet connection for routing, but it’s not really a problem as a route is only a few kilobytes. Maps can be preloaded onto the device also, for situations where one doesn’t have an internet connection available (like when traveling). I used the nice TrekBuddy atlas creater application to fill the device with maps of all of Denmark, London, Berlin and Europe at a decent level.

I was really impressed by the openstreetmap when I was in Corsica earlier this month. I had preloaded maps onto the device before going and it really served us well as the rented car didn’t have a GPS, and my other GPS of course didn’t have maps for Corsica. This was using the excellent maemo mapper and the Nokia N810, but it should be the same with the android.

The user interface of andnav2 could use a lot of cleaning. It’s not very user-friendly, but it will hopefully improve. As the coverage of openstreetmap improves, it will be harder and harder for companies like Tom Tom to ask 750kr for their mapping application like on the iPhone.

Also as the search interface in android marked sucks hard (of the irony Google), one needs to enter andnav2 and not andnav, as that will only show the older version.

Happy mapping!

Edit: The author released a new version, that only works on android > 1.6 (because of TTS), and appears to not really care about older versions of Android. I have approached him multiple times asking for him to fix it, sadly he’s been playing the silent ninja. Just making the old binary available would be fine, but sadly no. Since the source is not available there isn’t much we can do except wait for HTC to release the 2.0.

Edit2: Working version available here: http://people.iola.dk/arj/2009/11/25/andnav2-working-on-hero-again/