The Airsource Blog

Articles by Teanlorg Chan

Quelle heure est-il? or "What's the time, Mr Jobs?"

A while ago, I was tracking down some NaNs in accelerometer-based code (smoothing device orientation for an OpenGL AR view). It turns out it wasn't my bug — UIAcceleration.timestamp was going backwards approximately every 12 minutes! Naturally, the documentation doesn't mention anything about this: This value indicates the time relative to the device CPU time base register. Compare acceleration event timestamps to determine the elapsed time between them. Assuming iPhone OS is similar enough to Mac OS X, it must be using mach_absolute_time():1 Read more…

Androidinous Efficiency: To bool or not to bool?

A common belief among programmers is that you should write code that says what you mean, because the compiler will probably do a better job at optimising than you can do off the top of your head. On the other hand, Writing Efficient Android Code says "It is unwise to rely on a compiler to "save" you and make your code fast enough" and recommends that programmers do things like caching member variables (like array lengths) in local variables. This isn't just premature optimisation; it's trivial stuff we expect the most basic compilers to handle! To understand why, it helps to know how your code ends up running on device: Read more…

Androidinous Intentions

So you've acquired an Android Dev Phone 1 (the page goes to great lengths to avoid telling you that it's just an unlocked G1). You've downloaded Eclipse, installed the Android plugin, and created a "MyProject" app that says "Hello World, MyProject". Now what? Well, if you've been paying attention, you'll have heard of two (or three) new paradigms: Tasks correspond vaguely to the user's idea of accomplishing something, like "sending an e-mail", and an associated "activity stack" which is hidden from the programmer. Activities correspond loosely to subtasks, like "picking a contact". Intents are issued by activities (like SendEmailActivity) to launch other activities (like ContactPickerActivity). But that's about it. UI programming is traditionally a pain, which is why I like the iPhone SDK's InterfaceBuilder -- Read more…

Mobile Linux?

Last week, the BBC reported on an upcoming version of Ubuntu for ARM "netbooks". Pity there's no article history; the title (currently Ubuntu set to debut on netbooks) originally said "smartphones" and the meta tags still mention smartphones1 even though the article itself mentions nothing about Ubuntu on smartphones, but I could spend all day reporting on inconsistent reporting. Read more…

Android Code Day

After a much-awaited Release Day and the obligatory pub afterwards, last Thursday marked the end of January and Android Code Day in London and Tel Aviv. It was my first time in Israel, which made it more exciting As much as I'd like to visit Israel, I wouldn't be able to justify the expense (it might happen in the future with the current trend in ticket prices). The good news is that the train journey into London is relatively short and painless. Read more…

Using ILogger

It's strange how many BREW specialists you can talk to who have never used ILogger. It's not hard to see why, though: the API reference only sometimes tells you the details of how to use it, and while the ILogger overview notionally tells you what it does, you have to read it very carefully to figure out how to use it. And when you find out what it does, it doesn't seem like the most appropriate thing to use. Read more…