Migrated my blog to Ghost.js

Javascript is awesome and I had to jump on the wagon by moving my blog to this cool programming language. Well, not really, but I was looking for a blog engine that supports markdown instead of the dreaded wysiwyg HTML editor that was standard a year ago.

<!-- more -->

Learning Rails part 4: Integrating bootstrap

One of the coolest frameworks since the existence of web frameworks is Bootstrap, at least if you ask me what would be the coolest framework to work with. It doesn't solve all your CSS troubles, but it gives you a very good basis on which to build your software.

Bootstrap is in no way related to Rails apart from the fact that Rails ultimately generates HTML pages. There is however a ton of neat gems out there that you can use to integrate Bootstrap into your rails application and super charge the application with some of the best UI stuff out there.

Mono for Android memory management tips

Building applications with Mono for Android is fun, I kind of like having the full Linq API, the task parallel library and the rest of the .NET framework at my finger types. Java is great too, but it isn't my primary programming language, so I am missing a few tricks to get the most out of it. So C# and Mono for Android is the way to go even if I do Android-only development.

There's also a downside to using Mono for Android. And that is exactly the thing I'm not using, Java. Because you're working in a universe with two garbage collectors and two typesets, you're constantly balancing on a very thin line. If you go too wild with your code you will make one of the garbage collectors upset and your app will crash. It can be a rather frustrating experience.

Making java libraries available to Mono for Android

While doing a bit of research for a new app I came to the conclusion that I needed some kind of charting library for that app. Looking around the internet I quickly discovered that there's nothing available right now for Mono for Android. There is however a good library available for regular Android development using Java.

The guys at achartengine.org have a very complete library for Android available, that does pretty much what I need. So there I am sitting at my desk, thinking. There's two options: I write a full port of the library for C# or bind the library. The first option is what most people would do. It's straightforward to program, but a lot of work. Also, you will miss out on all bugfixes that the guys over at achartengine might come up with. That leaves option two, bind the library to C#.

Using C# to take pictures with your Android phone

<p>Taking pictures with a phone is probably the number one thing people want to be able to do when they start building apps for Android. It's not that tricky to get working properly, but there are a few things you need to know to get the whole circus going. </p> <p>In this post I will be showing you how you can take pictures using your Android phone right from C#. Keep in mind this assumes you know C# and Mono for Android. I'm also assuming you know a little about Android and how you should build a basic app for it using C# and Mono for Android.<!--more--></p> <h2>Taking the picture</h2> <p>The first step is to take the actual picture using the camera provided by the device. This is done by invoking the camera activity using an intent. Intent in Android can be seen as the asynchronous messaging system to send data between apps on the device. You can use intents to start activities, services or query content providers.</p> <p>To take a picture you need to use the "capture image" intent provided by the Mediastore class that is part of Android. This is done from the current Activity class. The following code sample demonstrates the use of this intent. </p>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
private void TakePicture()
{
// Specify the message to send to the OS
var takePictureIntent = new Intent(MediaStore.ActionImageCapture);
// Start the requested activity
StartActivityForResult(takePictureIntent,1001);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
if(requestCode == 1001 &amp;&amp; resultCode == Result.Ok)
{
//TODO: Do something useful with the image.
}
}

Using OData with Mono for Android

OData is popular these days and a protocol that is very easy to use. It's a way to expose a model in a resource oriented way to clients. There's support for Windows Phone 7, Silverlight and Windows but not Mono for Android. Now that I have grown a liking to Mono for Android I thought it might be cool to convert an existing version of the OData client library to a Mono for Android version.<!--more-->

<!-- more -->