Testing wordpress scheduling
One of the things I like of wordpress is the fact that I can schedule my posts. That is until it breaks.
I had a post scheduled at 1200 today but when I checked it at home I noticed that it hadn't updated yet. It even said that it had missed its schedule. Calling the cron job a few more times didn't do anything so this is just a quick post to check if it does work now.
Update @ 2012-02-02 00:06: It seems to be working just fine
Test run Windows 8
Today at the office I download and installed the developer preview of WIndows 8 in VirtualBox. The first thing I noticed was that the installation was fast. It was a similar installer as Windows 7 so no big suprises there. After installing and starting it for the first time I was suprised to see a really green screen. The windows color for me has always been blue (which is recuring theme in almost every Windows version since Windows 95). After completing the create account procedure and logging in you notice that green is the new blue, almost everything is green and as you have noticed I'm not too big a fan of green. But enough about green, lets go to the part that is important.
After logging in you are presented with the new Metro GUI which is confusing if you are not familiar with it (and even more if you have no touch device). So a few hints:
- If you move the mouse completly to the left bottom you will see a start menu. Clicking on start will always bring you to the metro page.
- If you move the mouse to the rightside of the screen you will get to see a thumbnail of the application to switch to
- Left mouse click will switch to it
- Scrolling will display other running applications
- Right mouse click will give you the snap options
- Alt-F4 closes applications
- The windows key will switch between the metro interface and the application
- In metro applications the right mouse button often shows menus at the top and bottom, but you will never see quit (which confused me a lot)
- Windows-R gives you the run dialog and yes mspaint, wordpad, notepad, explorer are all available.
- Seen enough and want to shutdown? Move to the left bottom and click on devices and you will get a toolbar on the right. The center bottom button there is a power off button.
After playing with it for a few hours there are a few things I like and a lot I don't. Keep in mind that this is a developer preview so I'm sure a lot will change before the initial release.
The things I liked where:
- Snapping works well and frankly I love it. This is done way better than I have seen before.
- The twitter app looks good, works good and when snapped to 1/3 of the screen it is just a killer app
The things I don't like are:
- It's confusing, it took me a while to get around
- No good replacement for touch if you only have a mouse
- I miss the old start menu (which is a first since I enjoyed each new version of the start menu so far)
- Scrollbars are ugly
- Metro interface is confusing
As a closing note I would say that Windows 8 is not suitable for coorporate enviroments (no good function for metro interface) and is more aimed at the tablets. If I would have to pick a tablet I would wait until Windows 8 for tablets is ready.
Inline skating
When I was young I loved to my skates (I called them skeelers even though they had four wheels) and I did it quite often. So yesterday when the weather was just perfect I decided that I wanted to do some inline skating even though I had not touched a skate in the past six or eight years. I looked up on the Internet what the current state of the industry is, relearned the things I had forgotten about skating (the theory) and was deciding where to buy them until my mom reminded me that six or eight years ago I had bought these excellent skates but had only used them for a week or so.
So up in the attic I searched for my inline skates and found them in one of the boxes. I had indeed bought them and I recalled that they were quite expensive for me at the time. They were bought in France when we were there on vacation and I had indeed used them for only a week or so before I boxed them in the attic. The weather in the Netherlands was what excpected in the Netherlands: Nothing but rain. The year after that the weather was also poor and so I forgot all about them.
After cleaning the frame and wheels (I had not done that when I boxed them
) I geared up (wearing protection for elbow, knees and wrist), I finally got up and... almost planted my face on the ground. I admit I knew that I would have trouble skating again, but except the first time I wore skates I had never had any trouble getting up. I guess that the years of sitting behind a desk, hitting the keyboard while writing code had not improved my balance. Big surprise there. However that was indication enough I had to learn everything from scratch again.
So after a few test rounds on the parking lot, learning to brake and to turn I was reminded why I didn't like skating on the parking lot with these skates. The wheels of my skates are 80mm 82a which means that they are small and reasonable soft and the the parking lot has a lot of bricks. So after a few minutes you feel like your feet have been put in the blender. Leaving the parking lot behind me I left in a random direction. I'm proud to say I did not fall, but it took a lot of effort and I wouldn't be suprised if I have lost my balance more than 20 times.
When I decided to rest I was tired and everything hurt. My arms from spinning, my feet from the poor road, my back because it wasn't used to bend like that and my head because it was the middle of the day and it was hot. After a few minutes of recovering my breath I decided to go back home. To my suprise going back was a whole lot easier. I only lost my balance a few times, four or five times if I recall correct, and the rough tarmac didn't feel so rough anymore. I enjoyed it. The distance skated was only 8 kilometers (about 5 miles) but for the first time after so many years it feels like quite a feat.
I only hope that this weather will stay as I want to do some more skating.
New job!
When I first created my site, I once joked that it is, besides a platform for me to talk about various subjects, it would also be a professional business card in which I present myself to any prospecting employers. Well, the joke is on me, since I was actually contacted through the "contact me" form and was offered a job. I went in on the job offer and within two meetings I had signed the employment agreement and I have a really good feeling about it.
The downside is that I had to talk to my current boss about me leaving, which I did the next day. I have never done something like this before and the only time I was "let go" was due to the fact there was no more work for me. But instead of getting angry or sad I was happy with the news. The HR (Human Resources) person who brought me the bad news had trouble understanding this (I was smiling) and I had to explain that I didn't feel OK with only showing up and then do nothing. Maybe it is my sense of pride, but I rather have no job than not doing my job.
So that day I asked my boss if he and I could have a few private words and explained that I would be leaving. I had talked it over with my dad how to do such things and what should be done in which way, but my boss was a true sportsman and except a request if I could stay one month longer to give him more time (which I declined) there were no problems. The reason why I tell this is because there are plenty of stories (often American) where someone is escorted from the premises without even giving them time to grab their jacket. Those are horror stories and a clear case of a lack of trust and proper behaviour, but this was the exact opposite.
So that is the news. I have a new job starting the first of May (well second actually since the first is a Sunday) and except the bit of overtime at my old job to ensure that me leaving there has a minimum impact (technical documentation and finishing a few projects) it seems there are no problems professional and personal. Now all I need to do is find a new home and wait until it is time.
Plug-in system in C# and C++
(if you are reading this article through a feed, you might want to switch to the website because of code highlighting)
In this post I will explain a easy to use plug-in system for both C# and C++. Yes, they are different languages...
If you want to skip my babbeling just scroll down and you can find the source code.
Plug-ins are rather cool as you can write one plug-in and use it for everything. They can add (or replace) functionality without having to modify the application itself. Of course, there is a small downside and that is that plug-ins can be quite a bit slower as they need to be integrated in your application at runtime instead of compile time.
A plug-in framework is in my opinion something that is easy. Instead of calling a function from the executing module/assembly, you call it from another module/assembly. Lets start with a simple logger, which has one function namely Log that has string as content.
class LogFile
{
public:
// inits a log with the given log file
LogFile(const char* const filename);
// Logs text
void Log(const char* const logText);
};
But then someone says that he has trouble reading the plain log file and wants something that is more graphically appealing and suggests HTML and you think, oh, fine, why not. But how are you going to solve it? And while you are thinking about the solutions the big boss comes to your desk and says he wants to import the log in a reporting facility which only accepts csv. And then a third persons comes and tells you how cool XML is and you also add it to the list. Now you could write something like:
// Without the open/closed principle
enum LogFiletype
{
LOG_FILETYPE_TXT,
LOG_FILETYPE_HTML,
LOG_FILETYPE_CSV,
LOG_FILETYPE_XML,
};
class LogFile
{
public:
// inits a log with the given log file
LogFile(const char* const filename, LogFiletype filetype);
// Logs text
void Log(const char* const logText);
};
Now before we start adding more formats, I would like to point out that this is clearly a case where the Open/closed principle should be applied. Simply put it says that anything should be closed for modification but open for extension. In the above example, we are constantly extending our existing LogFile with new functionality. If we would apply the open en closed principle we would get something like:
// With the open/closed principle
class ILogFile
{
public:
virtual ~ILogFile() { }
// Logs text
virtual void Log(const char* const logText) = 0;
};
class LogFileTXT : public ILogFile
{
public:
void Log(const char* const logText);
};
class LogFileHTML : public ILogFile
{
public:
void Log(const char* const logText);
};
class LogFileCSV : public ILogFile
{
public:
void Log(const char* const logText);
};
class LogFileXML : public ILogFile
{
public:
void Log(const char* const logText);
};
Now if you need to add an extra filetype you simply extend ILogFile and you are done. The downside of the above method however is that if this system is in a single library (*.lib) you will have a lot of dead code. Also as every programmer knows, a small codebase is easier to maintain than a large codebase. We can solve this by using plug-ins. Each logger is put in a separate dll and only the Dlls required are used.
The reason why I used to above example is not because I want to point out that small codebases are easier to maintain than large codebases, but because the open/closed principle is a very important aspect for my plug-in system. The projects (both attached at the bottom) work because of it.
Writing a plug-in framework is often explained as difficult while in fact, once you understand the basic principles, it can be rather easy. As a programmer we must work hard to be lazy. The first one is that all plug-ins are derived from IPlugin which is defined as followed:
class IPlugin
{
public:
virtual ~IPlugin() = 0;
virtual std::string GetName() = 0;
};
The above is in one word useless on its own, except a name (which is only there to identify the plugin) it is basically an empty class. However lets add two new functionalities to it.
class IPluginInput : public IPlugin
{
public:
virtual void DoInput() = 0;
};
class IPluginOutput : public IPlugin
{
public:
virtual void DoOutput() = 0;
};
And we have two types of plugins we know that if a plug-in is derived from one or the other it has a certain function. We know that one can do input and the other can do output. In C# we could have the following:
List<IPlugin> allPlugins; // Contains all the plugins
List<IPluginLogger> loggers = new List<IPluginLogger>();
foreach(IPlugin plugin in allPlugins)
{
if(plugin is IPluginLogger)
{
loggers.Add(plugin);
}
}
foreach(IPluginLogger logger in loggers)
{
logger.Log("Hello world!"); // Logging in HTML, TXT, CSV, XML
}
So if you are writing a game (or software) and you want to add a new type of AI (or business rule) you simply derive from IPluginRule, which is a defined interface for that specific behavior, and you can quickly add new rules. So once you have your basic framework setup (we get to that in a minute) writing plug-ins becomes really easy. Of course if you have something as complex as graphics engine or adding new features to a form, it becomes quite a bit harder.
The plug-in framework is where the majority of the problems come from. Luckily you only have to do this code once. The basic steps are as followed:
- Select a folder that contains plugins
- Load all modules/assemblies.
- Get an instance of all plug-ins
I'm going to skip step 1 and step 2 and only discuss step 3. If there are any questions regarding step one or two after you have reviewed the source code just comment and I will try to answer as quickly as possible.
Step three involves getting an instance of all the plug-ins. You might not want an instance of the plug-in but rather a factory, but the bottom line is that in the end we somehow need to have an instance of the plug-in. In C# we only have to use reflection.
/* modified snippet from the source code */
// Find all objects that implement IPlugin
pluginTypes = pluginAssembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IPlugin))).ToList();
foreach (Type pluginType in pluginTypes)
{
// Getting the constructor
System.Reflection.ConstructorInfo pluginConstructor = pluginType.GetConstructor(new Type[] { });
// Invoking the constructor to get an instance of the object.
IPlugin plugin = pluginConstructor.Invoke(new Object[] { }) as IPlugin;
}
C++ doesn't have reflection (RTTI is not really the same) so there it is a bit different. Instead of letting the framework find all plug-ins in a certain module (dll), we export only one function in the dll. This function has as sole task to instantiate a plugin and register it with the framework.
// dllmain.cpp
extern "C" __declspec(dllexport) void RegisterPlugins(PluginCore* core)
{
core->RegisterPlugin(new ExamplePlugin(core));
core->RegisterPlugin(new ExampleInputPlugin(core));
core->RegisterPlugin(new ExampleOutputPlugin(core));
IPlugin plugin = static_cast<IPlugin*>(static_cast<IPluginInput*>(new ExampleCombinedPlugin(core)))
core->RegisterPlugin(plugin);
}
// Load each dll and find the plugin factory
for(size_t i = 0; i < files.size(); ++i)
{
HMODULE dll = LoadLibrary(files[i].c_str() );
RegisterPluginsFunc registerPluginsTo = (RegisterPluginsFunc)GetProcAddress(dll, "RegisterPlugins");
// Create all plugins and register them to this core
registerPluginsTo(this);
m_Modules.push_back(dll);
}
Ubisoft DRM
Recently I bought "Settlers 7" and even though I enjoy the game, it is the first game that I want to remove after only 21 minutes of in game time. The reason for this is the DRM (Digital Right Management).
Now I'm not one of those guys who says that DRM is bad as piracy is a problem and it should be dealt with. I don't think that DRM would improve sales either as people who pirate a game either have no intention of buying or are unable to buy due to some reason (territory, credit card instead of debit card required, et cetera). The only reason why I think DRM works is because installing a crack might be more hassle.
The DRM in Settlers requires you to be always connected to the internet and if for some reason this is not the case, it will stop the time in your game until you are connected. My PC is on the third floor of our house. The router is on the first floor of the house. I have boosted the signal to 150% but because we have a lot of wireless networks in our neighborhood which sometimes interferes with our wireless network.
The result: The game reports I have only played 21 minutes while the game is already running for 50 minutes.
Now I admit that one of the reasons of buying the game was that I wanted to see how the DRM would work and how I as user of the game would experience it. As an user I didn't mind it the first time I could understand it, the times after that I started to get annoyed. As a gamer you want to move your game forward, not wait until someone says "Ok, your game is legal". This wouldn't be an problem if this has once (or maybe twice or thrice) every hour but when the game starts and stops every 5 minutes it breaks your flow. Once every hour would be like a commercial, giving you a natural pausing moment, once every five minutes is like you require the toilet every five minutes because your diner was spoiled and rotten. The next time you eat diner you sure as hell will avoid eating something rotten.
And this is the problem I think Ubisoft will have to solve. The DRM as it is now or as how I experienced can be rotten in certain situations and people in that situation will avoid your games in the future. What is worse, they will talk about their experience and even though the problem is on their side, Ubisoft will lose a potential customer. Those who had good experience will even though they have had different experience also try to avoid it as they might be in that same situation someday.
On top of that, requiring a constant internet connection is a bad idea because of:
- Privacy, Ubisoft knows when you play, what you play and how you play.
- EULA, they say they can change it anytime they want (not entirely true, but they say it)
- What if I have no internet connection?
As you can see there are plenty of reasons to avoid this kind of DRM. I'm interested to see if this DRM will be accepted and if not long how long it will last.
No update for Story Editor, next week a major new feature
This week there is no update for Story Editor, but next week I will have implemented a major feature which makes that version of Story Editor a complete version.
The new feature can best be compared to a database in which you can create your own content types like persons, items and what else you can think of. Don’t know the age of a certain person? Just open a quick screen in which you can look up your character!
But that being said it will take at least one more week to fully implement it so that is useable. After that I might add some more complex features, although I have to take care in not adding too much features.
Then I have to make a design decisions as I’m not yet finished. For one I could start working on a publishing site on which users can register and to which Story Editor can save and load stories. Imagine writing your story and then publishing it with a single click!
Or I could add relationships in the database. This I think is the biggest challenge, as I’m starting to write a database.
The last thing that is on my list is change the GUI so that it no longer depends on propriety software. That would mean I could put the source code online so that others have access to it as well and might learn from it.
Looking at things that I want to do and the final deadline (I stop actively working on this project when it is 2011) I might make it or I might just miss it.
Anyway here are some screenshots of what I mean with content types:

Pay attention to which version when buying Windows 7
When I graduated I had decided that I would reserve a maximum of €500 to buy myself a present. Now that I have graduated I have looked around to see on what I would spend my hard earned money on and now, almost two weeks later, I have decided it would be Windows 7.
For the average customer (AKA me) there are three flavors I can buy: Home Premium, Professional and Ultimate. So I decided to do a little bit of research and I'm glad I did.
My laptop is used for both personal pleasure (games, writing and my personal projects) as well as for work. As of late I do a lot of remote desktop (RDP) and to my surprise, this is not included in Home Premium. Home Premium is actually a version between Windows Vista Home Basic and Windows Vista Home Premium.
This means that if I use Home Premium I will no longer be able to use my laptop for work. So I need to buy the more expensive version.
This brings me to another problem. My current laptop (Dell XPS M1530) is four years old, which makes it pretty much an outdated model. If in the future I would switch to another system then I'm pretty sure that they only install the cheapest windows version on it.
That in turn would mean that I, as customer, would need to buy another version of Windows Professional or Ultimate.
On the other side, I'm not responsible for equipment used at work. I just prefer to have all my work available and should my laptop fail, then I can buy a new system for personal use. I have no qualms with Windows 7 Home premium.
Still... I think I will sleep about it for another night or maybe even two before I decide on the matter.
UPDATE 02-09-2010: I stand corrected, a friend of mine just tested it and the only the RDP server is unavailable in Home Premium and the RDP client is. That means you can use RDP to connect to other desktops, but other desktops not to you.
Fixed bug in story editor
As I had mentioned yesterday at late night, there was a small but highly annoying bug in the Story Editor, which I have now fixed.
You can download a new version here: Story Editor V0.0.0.2
Next week I will add reordering in it. If anyone comes across a bug, feel free to reply on this post.
