IT in my DNA

A few months ago I got a message on LinkedIn to “prove” I got IT in my DNA and win a Windows phone 7.

These where the prices:

  • 1-5: Windows Phone 7
  • 6-10: Mini laptop
  • 11-20: Entrance ticket for TechDays 2011
  • 21-30: Windows 7 licence
  • 31-40: TechNet subscription
  • 41-50: Fnac coupon of 50 €
  • 51-311: 250 books and 10×2 cinematickets

The first week I tried each day a few times, I think I got on place 4.

And after that I only played a few times, I saw the top 10 was getting faster and faster. A few weeks back I checked again and the top 20 was revealed.
At that time I saw myself on place 40+, time for really IT (reflecting it and so hacking it), but a week later (had no time to reflect it) I saw myself on place 20+. Hmm, the cheaters where removed? So I thought I’m just going to let it be and we will see on which spot I will end.

And so what did I found in my mailbox yesterday: Kraak de code : Kijk snel of je gewonnen hebt (free translated: crack the code: look quick to see if you won).

I won 1 of the 5 Windows Phone 7’s (a HTC 7 Trophy). It will be handed over to me at the Awards Ceremony at the Microsoft Office at 21 feb 2011.
I’m also getting a tour at the offices and there will also be interviews and photos.

Thanks to TechNetMSDN-Microsoft Developer Network and

So don’t cheat or hack but play fair and own them all!

Ubuntu: Installing Apache, MySQL, PHP and Samba, sFTP

I ran a local virtual Ubuntu server for a while, but as I formatted my PC I thought it was time to do it on another way, yet today I switched back to a virtual Ubuntu server, to continue PHP-web-development.

As some functions are not working 100% the same on Linux and windows, I really need a Linux development environment, it offers me a great test server for all my PHP applications with extra SVN and Redmine.
As I also installed Samba, I can use it just like local development.
Off-course its no backup and it’s only for local development, not for team-development, so that’s why I needed a live SVN server.

So the main reason for posting this post is for installing a virtual test server, I created this post almost a year ago and as I installed it just now, it’s still working 🙂
This way you can use all of PHP’s functions. You can also test everything like you would on a real (linux-)server as PHP is mostly run on linux-servers.

For the first post, we just gonna install Apache, MySQL and PHP (a LAMP server), together with Samba and sFTP.
I also add some tests to see everything is working.

In the next post(s?) I’m gonna add Ruby on Rails (RoR), SVN and possibly more.

First I setted up a virtual machine that was running Ubuntu (just the latest Ubuntu desktop, yes desktop, I always use the terminal but some thing are just easier with the GUI software).

Installing and configuring Samba

First I installed Samba, this way we can live edit files. You can map it with “network drive mapping” in windows for extra easy access.

We install it by using sudo apt-get install samba

Now we need to configure samba: First we need to edit the smb.conf file located in /etc/samba by using sudo nano /etc/samba/smb.conf

First we set security by user. This is in the part authentication. If you search for “security”, the second time you wil find:

#    security = user

We just need to remove the # here.

Next we need to add shared locations, because it’s a test server it’s usefull we can do just about everything, at the end of the file I added:

comment = all
path = /
read only = no
guest ok = no
browseable = yes
create mask = 0655
directory mask = 0755

Now we need to add users capable of logging in by using sudo smbpasswd -a username (The username needs to be a linux user)

And last but not least we need to restart the service, this is easily done by using sudo service samba restart

Now we can go to the server by \\hostname\ (in my case \\testserver\), when you login with the user and pass you just added with the smbpasswd command, you should see a folder named ALL. This is the share we just created. You should be able to add folders and files like you should in linux (of course its bound to the Linux user rights)

Install sFTP

Maybe you ask why: My main reason is to edit rights. Samba is very easy and faster then sFTP but you can’t edit rights, although not as far as I know …
Because some things just require more rights, and I don’t want to edit all rights higher (in /etc/samba/smb.conf you can change “create mask” and “directory mask” to 0777). Because I don’t want to open my VM each time, I want to use sFTP (FTP over SSH) as Fillezilla can do it, and its always installed at my pc’s).

As far as I remember (back me up please) Ubuntu 8.10 had openSSH-server installed standard. In 9.10 it isn’t. So we need to install the openSSH-server by using sudo apt-get install openssh-server

And its done, that easily 🙂 You can now login with sftp with every user account including root. Off-course the root user has standard no password, so you need to change the password by sudo passwd root

Install apache

We can install the latests apache2 by using: sudo apt-get install apache2

If we now surf to the server we should see “It works!”. (when u use the desktop edition you can use firefox and surf to http://localhost/), because we installed samba we should be able to surf to http://hostname/

The default www location for apache is /var/www but its owned by root so we need to change it so we can also do some stuff:  sudo chown -R user:group /var/www (in my case chown -R tom:tom /var/www)

Now we can add new HTML files and directories.

Install PHP

Now we install the latest  PHP5 version by using: sudo apt-get install php5

With the installation of php5, apache2 should have been restarted, but to be certain, restart it with: sudo service apache2 restart

Quick PHP test

Now we are going to test PHP:

With a text editor you can create a php-file in the www directory with the next content:


After creating the file we can surf to the created php-page (localhost/info.php) You now should see “phpinfo()” as title and a nice PHP information page.

We can also install a few useful extensions, in my case I installed: php5-gd and php5-mcrypt by using sudo apt-get install php5-gd php5-mcrypt

Remember to restart apache2 to enable those extensions. (check a2enmod and a2dismod to enable/disable extensions)

Install MySQL and PHP support

Install MySQL: sudo apt-get install mysql-server

Install MySQL support for PHP: sudo apt-get install php5-mysql

After this we need to restart the apache Service and we see in the php info page a part about mysql and mysqli

Quick MySQLi (PHP) test

Now we can test we can connect to the mysql server by creating a php-file in the www directory with the next content:

$mysqli = @new mysqli('localhost', 'root', 'pass');
if ($mysqli->connect_error) {
    die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
echo 'Success... ' . $mysqli->host_info . "

When you surf to the page (http://hostname/mysql.php) you should see “Success… Localhost via UNIX socket”

Ready for phpBB3

We installed everything needed for phpBB3, you can download it from downloads page.

We need to upload it to the server, I choice to unpack it in the www directory. Changed the rights with FTP (or ssh: chmod 777 cache files store images/avatars/upload config.php)
And surfing to http://hostname/phpBB will then forward you to the installer.

By installing mcrypt and gd everything was OK except for Imagemagick
(Imagemagick can be installed by: sudo apt-get install imagemagick php5-imagick and afterwards restarting apache.)

I also uploaded phpMyAdmin for easy MySQL access. I added a user and a database and I could install phpBB3 perfectly.

So as far as I can see at the moment everything is working, with exception for mail.
This was it for this blogpost, in a few weeks I’ll add SVN, RoR and redmine and mail possibility.

Weird StackTrace behaviour

A colleague noticed that changing a combobox wasn’t showing the changes in the text fields below.
When testing, I saw it WAS working. But with the click-once application not.
After some time I noticed running the release without visual studio, it didn’t work.
Although it worked when running with visual studio. Also the debug version was working.

For binding the text fields to my object I simply used a property: “Regime”.
The (work)regime has 10 properties: id, user(id), “Monday” till “Sunday” and “weektotal”.
All these properties raise an event by calling “PropChanged()”.
This method would look up into the call stack which method called him. Properties get set_ and get_ before the property-name as method.
This way I could test it was ending with “day” and then also raise a “weektotal”-changed event, as this property is read-only and actually a property for binding the total of all days.

Private Sub PropChanged()
    'Get the stacktrace and get the calling method
    Dim stack As Diagnostics.StackTrace = New System.Diagnostics.StackTrace
    Dim method As Reflection.MethodBase = stack.GetFrame(1).GetMethod()
    'Methods starting with "set_" are the properties
    If method.Name.ToLower.StartsWith("set_") Then
        'remove the "set_" and raise the event with the propertyname
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(method.Name.Substring(4)))
        'when the day changes, the total is also changed
        If method.Name.EndsWith("day") Then
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("weektotal"))
        End If
    End If
End Sub

In a combobox I had a list of “presets” and when I select one, I update the “Regime”, to have the same values. Now, this wasn’t working.
After like testing everything, for fun I showed a messagebox with the method.Name property.
This let only see: “.createWorkRegime”, a complete surprise as it was actualy called by the Property “Monday” or “Tuesday” etc.

Obvious, when adding the plain RaiseEvent PropertyChanged, the binding works.
I didn’t figured out why this happens, but it looks like the call-stack is changed when using properties in the constructor.
I really don’t understand it as it’s only having this behaviour when used in the constructor.

So it is changing the call stack AND ONLY when its executed from release (and directly the exe and not by visual studio)

If someone knows why this is happening, please let me know.

phpBB2CH to phpBB3

Converting phpBB2CH aka Ptifo to phpBB3

On my  installed board (still partially found on I installed phpBB2CH (Categories Hierarchy)  also known as Ptifo.

Basically it adds sub-forums, forum links, advanced permissions, board announcements and many more features.
It broke support with most (or better said with almost all) mods for phpBB2. But had or has a pretty large community ( is offline at the moment of writing).

As phpBB3 came out and there was also build-in support for those features, I wished to upgrade. But because of the changes on phpBB2, the phpBB2 converters wasn’t converting half of my forum settings. So I needed to create a converter. As the basics where the same I could use the phpBB2 converter to start with.

Yesterday somebody contacted me, and said the converter wasn’t working any more. As my converter was basically made for phpBB 3.0.2 and the current version is phpBB 3.0.7-PL1, I can understand why.

I updated my converter to work with phpBB 3.0.7-PL1, and so here you can find the converter for phpbb2CH to phpBB 3.0.7-PL1.
It isn’t 100% testing on all functions, but most stuff is converted. The predefined permissions aren’t, as they are (almost) impossible to do.

A few thing you maybe want to know:

  • main admins will be admins with founder status
  • admins and main admins will both in the admin group.
  • attachments are converted

If you find any bugs, tell me, I’m happy to solve them.

[download id=”731″]

Java MD5 (hex)

I needed to make a program in java which logins with the vBulletin login system.
As you may know, many php boards use MD5 for hashing passwords.
vBulletin uses a “more advanced way” of hashing, just like phpBB3. phpBB2 used just old plain MD5 hashes.
So I needed to find out how I could use MD5 in java.

Off course there is no MD5 function like in php .
That’s why I searched a function that can do it, a little search on google like “java MD5 function” and so I looked at the first pages links and tried the functions that weren’t too long.


I created the vBulletin login system in java and with the first test account I could login …. BUT my own login failed :(. Quite irritating if you try 10 passes, all work and when you put it live, many people complaining they can’t login…

As I got “lucky” with my pass, I found that my hashed login was wrong, so after some debugging I found a 0 (zero) was missing in the first MD5. So the MD5 function was WRONG:(

As a test, I created a program that creates random passwords and create the MD5 of it with the functions I found on different sites (found by using  google).

Extra info

Both MySQL and php’s MD5 function has a hex notation, clearly not all MD5-functions found are hex notated, this is not a must, but off course needed for being compatible with php/MySQL.

The problem

In the next image you can see the standard behavior of the MD5-function found.
Most of them looks okay, but notice that the one from bombaydigital uses upper-case hex notation, and by using it for another round with MD5 it will go wrong.
The one found on Stockoverflow clearly doesn’t use hex-notation. And the one from Spiration, lost a 0 (zero).

MD5 function output from different sites

With double MD5 you see the differences even faster, like shown in the next image:

differences seen by using double use of MD5 functions found for java

The first marked line, you see that Spiration’s MD5 is wrong, in the second marked line, you see Spirition’s MD5 is ok. So it’s not reliable.
In the first and second marked lines you can see that dzone’s MD5  is ok, but the third and fourth are wrong. Also, not reliable.
As noted by single MD5, StockOverflow is not hex and bombaydigital is upper-case, so both functions aren’t giving me the expected output.

The right solution

This leaves us with the one from twmacinta, clearly it’s working, but in code, I needed 779 lines (including comment)
But it’s not really worth if it can be done in nearly 10 lines of code.

public String MD5(String md5) {
   try { md ="MD5");
        byte[] array = md.digest(md5.getBytes());
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < array.length; ++i) {
          sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3));
        return sb.toString();
    } catch ( e) {
    return ';

So don’t just copy/paste everything you find by using google. Other sites (just like me) can be wrong, yes, we are also just people.


I finally worked at the website and here we are!

A month ago my laptop HDD broke, I couldn’t boot anymore. All my work from school was on it so I really thought I was screwed big time.
After a few hours hard disk checking it was only at 2%, not really good …
So I attached the broken HDD to my PC, and I could backup the second (data) partition, backing up the first (win7) partition was a bit worse. But I managed to recover some. Bought a new HDD and after a day I was up again.

But I was still worried about my work/projects for school and knew SVN was a good solution.
Thats why I installed Redmine and Subversion, found respectively at and
It probably needs some more tweaking, but it’s working.
It will become the main spot for my projects I’m working on, most private but also some public project.

This said, what can you guys expect finding here:
– programming solutions about things that are very hard to find.
– programming solutions of things found everywhere wrong (a good example will follow soon)
– (server/)software installation issues and its solutions
– a bit personal stuff
– …