Flickr: Oct 18, 2009
Sunday, October 18th 2009 — Photography — 1585 comments

Pleased to meet you! My name is Andreas and I'm a 22-year-old guy currently living in Malmö, Sweden.
Besides enjoying what most people do – such as hanging out with family and friends – I am quite the geek when it comes to computers, so it should come as no surprise that I work as a system developer.
Hobbies include developing small, mostly pointless projects, such as my MoNKey! game. I'm also into photography, and currently use a Canon EOS 450D. I usually upload my most interesting photos to my Flickr page.
If you for any reason want to get in touch with me, you can reach me at andreas@blixt.org.
Oh, and if you think all the Flickr updates in the list are annoying, you can filter them out by going to /tagged/-photo/.
External sites you may find me on:
Subscribe to the Blixt.org feed!
Sunday, October 18th 2009 — Photography — 1585 comments
Wednesday, September 2nd 2009 — Photography — 29 comments
Sunday, July 26th 2009 — Random Stuff, Gaming, Google App Engine — 356 comments
Check out a new project I'm working on! You could say it's in early alpha now. It just barely works, but it's worth keeping an eye on.
It's called multifarce (which means something like "many situations abounding with ludicrous incidents".) You can find it at beta.multifarce.com.
What is it? It's a collaborative text adventure. The idea is that at any point in the game – called a "frame" – you, as a user, may add commands to the frame, which in turn can change the state of the game (e.g., "pick up torchlight") or lead to another frame (e.g., "go east".) Of course, you're also able to add new frames.
Eventually, the game will have a ratings system where you are able to point out commands or frames that you like/dislike, thus separating poor and excellent content. These votes will also affect a score that each user has (let's call it reputation), encouraging users to provide good content. Further down the road, a high reputation would also lead to more delicate features of the game being unlocked for the user, since a good reputation should indicate that the user can be trusted with them.
The interface is still being developed, but it's possible to register, log in and create new frames and/or create new commands.
If you just want to try out the game, there's a small "storyline" that starts with go east. It's very hard to figure out what commands to use, but I'll make sure to add an easy to play storyline soon.
Oh, and it's open source, in case you want more insight on how it is built.
Thursday, July 9th 2009 — Programming, JavaScript — 4 comments
Do you like JavaScript? So do I! I've found that over the years I've developed quite a few useful stand-alone libraries, and now I've finally refactored them and put them online for everyone to benefit!
The libraries are available on a separate site, that quite suitably requires you to have JavaScript enabled:
My JavaScript realm
Friday, June 5th 2009 — Programming, C# — 4 comments
I've worked on a couple of applications that support plugins, and wanted a way to automagically get all the classes that implement by base plugin class/interface. Using LINQ in C# 3.5 this is really easy to do!
Check out the following piece of code:
/// <summary>
/// Gets all the types implementing the Type.
/// </summary>
public static IEnumerable<Type> GetImplementors(this Type implementee)
{
var types = from a in AppDomain.CurrentDomain.GetAssemblies()
from t in a.GetTypes()
where t != implementee && implementee.IsAssignableFrom(t)
select t;
return types;
}
As you can see, it's implemented as an extension method. Stick it in a static class and you'll be able to do the following:
var plugins = typeof(PluginBase).GetImplementors();
This piece of code has been of use to me on several occasions. Just consider that it'll also return interfaces and abstract classes (which, of course, cannot be instantiated) that implement the type.
Another piece of code useful when working with types is the following shortcut to get an instance of a type:
/// <summary>
/// Gets an instance of the Type using the constructor that matches the given type
/// signature and with the given parameters.
/// </summary>
/// <typeparam name="T">The Type to instantiate.</typeparam>
/// <param name="types">The type signature of the constructor to use.</param>
/// <param name="args">The parameters to use when invoking the constructor.</param>
public static T GetInstance<T>(Type[] types, params object[] args)
{
return (T)typeof(T).GetConstructor(types).Invoke(args);
}
/// <summary>
/// Gets an instance of the Type using the given parameters.
/// </summary>
/// <typeparam name="T">The Type to instantiate.</typeparam>
/// <param name="args">
/// The parameters to use when invoking the constructor. The types of the parameters
/// will be used to determine the type signature.
/// </param>
public static T GetInstance<T>(params object[] args)
{
return (T)typeof(T).GetInstance(args);
}
/// <summary>
/// Gets an instance of the Type using the constructor that matches the given type
/// signature and with the given parameters.
/// </summary>
/// <param name="type">The Type to instantiate.</param>
/// <param name="types">The type signature of the constructor to use.</param>
/// <param name="args">The parameters to use when invoking the constructor.</param>
public static object GetInstance(this Type type, Type[] types, params object[] args)
{
return type.GetConstructor(types).Invoke(args);
}
/// <summary>
/// Gets an instance of the Type using the given parameters.
/// </summary>
/// <param name="type">The Type to instantiate.</param>
/// <param name="args">
/// The parameters to use when invoking the constructor. The types of the parameters
/// will be used to determine the type signature.
/// </param>
public static object GetInstance(this Type type, params object[] args)
{
Type[] types = new Type[args.Length];
for (int i = 0; i < args.Length; i++)
types[i] = args[i] == null ? typeof(object) : args[i].GetType();
return type.GetInstance(types, args);
}
Just call it like so:
var instance = Types.GetInstance<MyPlugin>();
If you only have the Type instance, you can use the extension method:
var instance = (PluginBase)typeInstance.GetInstance();