Aspect Ratio

I installed new TV for my dad. Part of installation was climbing roof and bunch of cabling 10 meters over splash surface, but that was not hard part. Hard part was teaching my dad about how TV should be used (he had 4:3 before).

In Croatia we still use 4:3 aspect ratio. Our national TV just cannot be bothered. Choice was simple for this… You must use 4:3 for everything to look properly but 16:9 can be tolerated if you hate vertical black bars and you like stubby people. Yes, you can zoom picture (three different ways to do it) and cut either people’s heads, or subtitles, or both, but this is not a real choice. That is, until they decide to show 16:9 movie. It is done in such manner that 16:9 picture is crammed into 4:3 frame with black bars on top and bottom. For this you need zoom.

Of course there is sport channel that has proper 16:9 support. If we switch to it, we should use proper aspect ratio. But that sport channel also has some shows that use 4:3. It’s switching time again.

To make things better, aspect ratio settings are common for all channels. That means that my father must switch aspect ratio every time he switches between “incompatible” channels. Tracking two football (proper football) games on two different channels could (and usually will) cause need to adjust aspect ratio.

Before today all choices were clear to me and I never gave it much thought. However, as I stood explaining this to my father it struck me how this can seem complicated and annoying to someone who just wants to watch TV. This whole system is just piece of shit.

Froyo and Calendar

I had application on market for quite a while and suddenly I started receiving “SQLiteException”. Quick look at stack trace showed little bit more details:

android.database.sqlite.SQLiteException: no such column: Calendars._id: , while compiling: SELECT _id, title, dtstart FROM view_events WHERE (1) AND (Calendars._id=1)

This clearly pointed toward code that fills calendar events. Generally it looked like this:

Uri calendarsUri;
Uri eventsUri;
if (android.os.Build.VERSION.SDK_INT <= 7) { //up-to Android 2.1 
    calendarsUri = Uri.parse("content://calendar/calendars");
    eventsUri = Uri.parse("content://calendar/events");
} else { //Android 2.2 (Froyo) and later
    calendarsUri = Uri.parse("content://com.android.calendar/calendars");
    eventsUri = Uri.parse("content://com.android.calendar/events");
}
...
Cursor cursor = resolver.query(eventsUri, new String[]{ "_id", "title", "dtstart" }, "Calendars._id=" + calendarId, null, null);
...

Exception pointed right to that last line with query. Froyo had no idea what it should do with Calendars._id.

To make long ranting short, correct code should be:

Cursor cursor;
if (android.os.Build.VERSION.SDK_INT <= 7) { //up-to Android 2.1 
    cursor = resolver.query(eventsUri, new String[]{ "_id", "title", "dtstart" }, "Calendars._id=" + calendarId, null, null);
} else {
    cursor = resolver.query(eventsUri, new String[]{ "_id", "title", "dtstart" }, "calendar_id=" + calendarId, null, null);
}

With this everything started working again and, since calendar code got first-class citizen treatment and it is finally documented in SDK, I doubt that there will be further breaking changes down the road.

Windows Mobile Developer in Android-land

Illustration

Best conference in these parts of world is almost upon us. Yes, I am talking about KulenDayz 2010.

Conference will be held (as usually) in Beli Manastir (near Osijek, in Croatia) at hotel Patria and attendance is completely free of charge although you do need to register. There is small additional fee if you wish to have dinner there but, trust me, it is well worth it.

This is first year when I will not give Microsoft centric talk - title says it all - “Windows Mobile developer in Android-land”. It will be about how well can Windows Mobile Developer adjust to new environment and how much it hurts. It will be experience and question driven so do not expect much of code.

As always, PowerPoint will be available for download.

P.S. Pun on Alice in Wonderland is quite intended. :)

Technical Talks

What do you get when you cross Mark Minasi and Mark Russinovich?

You get one great presentation. It is named “The Secrets of Effective Technical Talks: How to Explain Tech without Tucking Them In!” and it is mandatory for any presenter-wanna-be.

I might not agree with some things they say (mostly PowerPoint related stuff) but there is lot of things to take home.

QText 2.30 (Beta 2)

After quite a while new version of QText is here. It is still in beta but content of it should be all that is expected for final version - hopefully soon.

Only feature new to this beta is update of QText when content of file is changed in some other editor.

New beta is available for download. Hope you like it.

P.S. Soon in context of final 2.30 version is probably end of September.