Logging from C/C++ on Android (instead of debugging)

With the Android NDK Google lets us write C/C++ code for Android. I don’t like writing C/C++ code because it’s error-prone but sometimes there’s no other way.

Unfortunately (this is the “I don’t like this” part), debugging Android C/C++ code is terribly difficult. If you don’t have a week to get the debugging toolchain working, and if you only need some quick and temporary solution, logging may be an alternative.

Read more →

Unicode, UTF-8, WTF?

Ever wondered what Unicode is and how it relates to UTF-8, UTF-16, and so on? Or did you stumble over “code points” and didn’t know what the difference to characters is?

Then you should try out the shiny new Unicode Explorer.

For some basics, click on the “Basics” link in the Unicode Explorer.

MayaStudios Unicode Explorer

HTTP instead of HTTPS in Android SDK Manager

Sometimes (often?) downloads in the Android SDK Manager are annoyingly slow. The problem is that downloads are done over HTTPS. HTTPS is more secure but also slower than HTTP. Fortunately, Google allows us to change this behavior.

You can do this in the Android SDK Manager’s options. You find them in the menu bar under Tools -> Options....

Options menu item in Android SDK Manager

Important: This menu item is not available if you started the SDK Manager from Eclipse. You need to start the standalone version (in the SDK directory: /SDK Manager.exe on Windows, and /tools/android everywhere else). Why this behavior is different is beyond me.

In the options select Force https://... source to be fetched using http://....

Force SDK manager to download via http

That’s it.

Triggering a build when file changed in Visual Studio

In Visual Studio when a source code file is changed, the project it belongs to will be built when the whole solution is being built. So far, so good. But what happens if you want some other files (read: non source code files) to have the same behavior?

In my case, I had some translation files (XML files), and a custom build event that converted them into a binary representation. So when one of translation files changed, I wanted this change to trigger a build for the project the translation files were contained in, so that they could be converted into binary form (ie. so that the build event was executed).

Visual Studio (at least version 2010) provides an easy but hidden way to achieve exactly this. After you’ve added the file(s) to your project, right-click them and choose Properties (Alt+Return).

The Properties menu item

Note: You need to open the properties for the files you want to trigger the build – don’t open the project’s properties. Also, you need to open the “Properties” dialog. You can’t do this from the “Properties” panel (which usually opens up when hitting F4).

Note 2: You can have selected multiple files to make them all triggering a build when changed in one step.

In the “Properties” dialog under Configuration Properties –> General –> Item Type you select Custom Build Tool. Then you hit “OK”. And that’s it.

Selecting "Custom Build Tool" as "Item Type".

Changing the file(s) should now trigger a build when you build the solution (via menu Build –> Build Solution).