Auto-create App.config from App.config.default

  1. Project properties
  2. Build Events
  3. Enter the following command in the Pre-build event command box:

if not exist "$(ProjectDir)App.config" ( copy "$(ProjectDir)App.config.default" "$(ProjectDir)App.config" )



Generate a Guid with PowerShell


PS H:\> [guid]::NewGuid()

Guid
----
d166ce77-b58d-4219-833a-bbf9dc2b0282



Exitscript

Added scriptable exits ( lua / luabind ) to the levels!



Time flies when you’re having fun!

Shooter v3 - work-in-progress

Currently working on a data-driven level structure to make it able to navigate throught ‘levels’.



Bachelor’s degree

Yesterday I graduated for my Bachelor’s degree in Information Technology at the Hogeschool van Arnhem en Nijmegen!

Thanks to all the teacher that supported me throughout the years.



Find out which process is locking an exe or dll

This might come in handy if you need to find out which process is locking an exe/dll file:

tasklist.exe /m [filename]

What is does :

  • quote “Lists all tasks currently using the given exe/dll name. If the module name is not specified all loaded modules are displayed.


Lua / Luabind

The following code shows the small demo I created to test if the luabind-0.8.1 library worked for me.

main.cpp

extern "C" 
{
	#include <lua.h>
	#include <lualib.h>
	#include <lauxlib.h>
}

#include <luabind/luabind.hpp>

#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;

class Unit 
{
private:
	string name;
	int maxHealth;
	int health;

public:
	Unit() :
	name("unit"),
	maxHealth(10),
	health(10)
	{
	}

	Unit(const Unit& unit) :
	name(name),
	maxHealth(maxHealth),
	health(health)
	{
	}

	const char* getName() const
	{
		return name.c_str();
	}

	void setName(const string& name)
	{
		this->name = name;
	}

	int getHealth() const
	{
		return health;
	}

	void setHealth(int health)
	{
		this->health = health;
	}

};

class UnitManager
{
private:
	map<string, Unit*> unitMap;

public:
	virtual ~UnitManager()
	{
		map<string, Unit*>::iterator i = unitMap.begin();
		while (i != unitMap.end())
		{
			delete (*i++).second;
		}
	}

	void createUnit(const string& name)
	{
		Unit* pUnit = new Unit();
		pUnit->setName(name);
		pUnit->setHealth(10);

		unitMap.insert(pair<string, Unit*>(
			pUnit->getName(),
			pUnit));
	}

	void deleteUnit(const string& name)
	{
		map<string, Unit*>::iterator i = unitMap.find(name);
		if (i != unitMap.end())
		{
			delete (*i).second;
			unitMap.erase(name);	
		}
	}
	
	Unit& getUnit(const string& name)
	{
		map<string, Unit*>::iterator i = unitMap.find(name);
		if (i == unitMap.end())
		{
			throw exception();
		}
		return (*((*i).second)); 
	}

	const vector<string> getKeys() const
	{
		vector<string> keys;
		map<string, Unit*>::const_iterator i = unitMap.begin();
		while (i != unitMap.end())
		{
			keys.push_back((*i).first);
			i++;
		}
		return keys;
	}

	void printUnits()
	{
		const vector<string> keys = getKeys();
		for (int i = 0; i < keys.size(); i++)
		{
			cout << keys[i] << endl;
		}
	}

};

int main()
{
	lua_State *pState = lua_open();
	if(pState == NULL)
	{
		std::cout << "Error initializing " << LUA_RELEASE << std::endl;
		return -1;
	}

	luaL_openlibs(pState);
	luabind::open(pState);

	luabind::module(pState)
	[
		luabind::class_<UnitManager>("UnitManager")
			.def(luabind::constructor<>())
			.def("createUnit", &UnitManager::createUnit)
			.def("deleteUnit", &UnitManager::deleteUnit)
			.def("printUnits", &UnitManager::printUnits)
			.def("getUnit", &UnitManager::getUnit)
	];

	luabind::module(pState)
	[
		luabind::class_<Unit>("Unit")
			.def(luabind::constructor<>())
			.def("getName", &Unit::getName)
			.def("getHealth", &Unit::getHealth)
			.def("setHealth", &Unit::setHealth)
	];

	luaL_dofile(pState, "script.lua");

	lua_close(pState);
	
	return 0;
}

script.lua

um = UnitManager();
um:createUnit('jack');
um:createUnit('john');
um:createUnit('jane');

print('Unit names:');
um:printUnits();

u = um:getUnit('jack');
print('Jack\'s health: ' .. u:getHealth());
u:setHealth(3);

u = um:getUnit('john');
print('John\'s health: ' .. u:getHealth());

u = um:getUnit('jack');
print('Jack\'s health: ' .. u:getHealth());

output

Unit names:
jack
jane
john
Jack's health: 10
John's health: 10
Jack's health: 3

further reading



Simple Note Trainer

notetrainer-v08

A simple note trainer I made in C/C++ using the Allegro game library. Have fun with it while learning something useful!

Note trainer v0.8



Hello world!

public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}


Brugge 2008

Weekendje Brugge eind 2008.