July 23rd, 2010
Yesterday, I released an Android application on the Android Market; Agricola Buddy.
For months now, we’ve had regular games of the Agricola board game at work. It’s a real gem of a game, and in my opinion perfect for “thinkers” – like programmers usually are.

The application helps you with calculating the score for each player in the game, which is done at the end of each game. While far from a necessity when playing, it provided me with an opportunity to create and release an application of limited size and complexity.
You can find the application on the Android Market, just search for “Agricola Buddy” or scan the QR-code to the right.
In the future, I hope to add lots of cool features to it – a way to store results over time, submit to a webservice, easily share the results with others, occupation/minor improvement reference and so on. If you have an Android phone, give it a go
Here are some screenshots:


Tags: agricola, Android, application
Posted in Android | No Comments »
July 8th, 2010
Been a while since I made my Samsung Galaxy skin. Since then, a ton of Android phones have arrived and many of them with different resolutions than the “normal” HVGA.
A popular one in Europe is the X10 Mini, from Sony Ericsson which has a QVGA resolution.
When you are creating Android applications, you should make sure that it works well on various resolutions, which the emulator helps you with. However, the built in QVGA skin is rather ugly, so I decided to try and whip up a skin based on the X10 Mini. Here’s what I ended up with:

I quite like it, and it also works fairly well on low-resolution monitors, such as on netbooks (at least it does on mine). I zipped it up and put it up for download. To use it:
- Extract the zip file into your Android/platforms/android-<version>/skins folder.
- Create a new AVD with the AVD Manager and select X10Mini from the skins dropdown.
- If you want to get as close to the X10 Mini software, use the 1.6 image (android-4, I believe).
- Enjoy!
Note: I forgot to include the hardware.ini file required for 1.6+. Should work better now
Tags: Android, emulator, skin, sonyericsson, x10mini
Posted in Android | No Comments »
May 6th, 2010
Over the past month or two, I’ve been learning Silverlight at work, so I might put up a few posts when I encounter interesting topics. The solutions I post might not be the best way of doing things, obviously
Integrating Silverlight into a rich, Javascript-driven website, I found myself wanting to call Javascript functions from Silverlight. A quick Google search told me this was possible, using the HtmlPage.Window.Invoke method. You could also use the Eval method, but it feels like a dirty hack,
so let’s not go there.
1
2
3
4
| private void displayDialog(string message)
{
HtmlPage.Window.Invoke("showSomeDialog", message);
} |
Easy, right? But like a good Javascript-coder, I like to “namespace” my methods, instead of leaving lots of global functions around. The invoke method seems to call global objects only, so I can’t do Invoke(“Rexxars.showSomeDialog”, “message”) – which is a shame. So I thought to myself, I’ll just create a “proxy” function which calls methods in my namespace. Simple:
1
2
3
4
5
| function slBridge(method, arg) {
if(Rexxars[method]) {
Rexxars[method](arg);
}
} |
Now I can do: HtmlPage.Window.Invoke(“slBridge”, “showSomeDialog”, message); – cool. But what if I want to call a function with more than one argument? I further improved my Silverlight-Javascript “bridge” to support a variable number of arguments:
1
2
3
4
5
6
7
8
9
10
11
| function slBridge() {
// Turn the arguments object into a regular, usable array
var args = Array.prototype.slice.call(arguments);
// Method name is the first argument and should not be included
var method = args.shift();
// Make sure the method exists inside our namespace
if(Rexxars[method]) {
// Call the method with the arguments passed
Rexxars[method].apply(null, args);
}
} |
Simple, eh? Now I can use the slBridge function to call any method inside my Rexxars namespace, with different number of arguments in each. Sweet!
Tags: Javascript, Silverlight
Posted in Silverlight | No Comments »