Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
Exams are over and I got my results. I passed with 'Highest Distinction', you can only guess how happy I am :p

Details at: www.cumps.be.

Now only a half year of school left, and then it's time to do an interim at a company :)
 
Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
Everyone who has ever used a Regex knows this form of parameter:

[csharp]
Regex r = new Regex("", RegexOptions.Singleline | RegexOptions.IgnoreCase);
[/csharp]

I often wondered how to do that as well and because nobody ever taught me that at school, I had to figure it out myself. And today I did, and I'm sharing :)


This is very useful if you have a class that takes a lot of options and you don't want to add a bool for each possible option.

First you need to create an enum with the possible options, and number them binary. (eg: 1, 2, 4, 8, 16, ...)

[csharp]
public enum Pars {
One = 1,
Two = 2,
Three = 4,
Four = 8,
Five = 16,
Six = 32,
Seven = 64
} /* Pars */
[/csharp]

Next you need to have a method which takes this enum as a parameter, after which you can extract each of the possible options from it with a bitwise AND:

[csharp]
private static void TestPars(Pars options) {
if ((options & Pars.One) == Pars.One) { Console.WriteLine("One"); }
if ((options & Pars.Two) == Pars.Two) { Console.WriteLine("Two"); }
if ((options & Pars.Three) == Pars.Three) { Console.WriteLine("Three"); }
if ((options & Pars.Four) == Pars.Four) { Console.WriteLine("Four"); }
if ((options & Pars.Five) == Pars.Five) { Console.WriteLine("Five"); }
if ((options & Pars.Six) == Pars.Six) { Console.WriteLine("Six"); }
if ((options & Pars.Seven) == Pars.Seven) { Console.WriteLine("Seven"); }
} /* TestPars */
[/csharp]

When all this is done, you call the method, passing the options you want with a bitwise OR between them, like this:

[csharp]
static void Main(string[] args) {
TestPars(Pars.Three | Pars.Five | Pars.Seven);
}
[/csharp]

This example will print Three, Five and Seven.

How does it work internally?

Here are the rules for the bitwise operators:

Bitwise OR:
0101 (expression1)
1100 (expression2)
----
1101 (result)

Bitwise AND:
0101 (expression1)
1100 (expression2)
----
0100 (result)

Now, our enum has the following binary values:

1 - 0001
2 - 0010
3 - 0100
4 - 1000
...

If for example we pass the options One and Two along, we combine them with the bitwise OR, creating 0011.

And if we want to check if Four was passed along, in our if we check if the options combined bitwise with Four result in Four.

0011
0100
----
0000

Four was not passed.

If we check with Two we get the following:

0011
0010
----
0010

And 0010 = Two, our if = true, and Two was passed along.

A lot of you will say "well duh, that's basics". Could be true, but I never learned it at school, and never ever had the need for it, but now I wanted to know, and I guess there are more people out there who haven't learned it either.
 
Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
I had a lot off trouble installing DotNetNuke. This popular portal application kept me busy for an entire afternoon and night.

First I got ASP.NET errors about columns missing in tables, then about stored procedures. When those were gone, the application itself managed to hang IE.

So, for everyone else who might be suffering from this, or will give it a try and encounters the same, here's my installation guide for 2.1.2:

The SQL errors occured when using SQL Server as Data Provider, the IE errors always occur.

This step is for everyone using SQL Server:


  • Download DotNetNuke_2.0.4.zip

  • Extract this, follow the normal installation procedure, this version doesn't give any problems.

  • Open the site so that it creates the tables and stored procedures.

  • Download DotNetNuke_2.1.2.zip.

  • Delete all files from 2.0.4 but keep your SQL Server tables.

  • Extract 2.1.2 in the same location.

  • Open the site, now you got passed the missing columns errors!



This step is for everyone:


  • Download DotNetNuke_2.1.1.zip.

  • Extract this to a temporary location and get the file spmenu.js from controls\SolpartMenu.

  • Copy this file to 2.1.2 overwriting it.

  • You now fixed the IE errors!



And at this point you got a working DotNetNuke 2.1.2 version, which you can begin skinning etc.

Let's hope future versions don't require so much hassle.
 
Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
I'm happy! A site I created for someone has won a price at the DigiKids 2004 Awards.

I heard there were 120 submissions, and the one I created ended up with the 10 best sites! This is a very nice extra as a student, now I can tell something I coded lasted between 120 others! :)


The results are in Dutch, but if anyone is interested: Prijs van de Minister van Onderwijs - Communicatorprijs.

Some extra info about the site: Connectedly

 
Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
Today I experienced something weird.

Normally I run a lot of files just from 'Run' (Win+R), but today I did 'Run', 'notepad', and nothing happened...

This was weird.. As I could still open .txt files with Notepad.

I could not run notepad from 'Run'! I was amazed, I mean,.. what could break notepad? :)


First I checked if the file was still there (of course, how could I still view files otherwise..), and if my PATH variable still included Windows. Everything seemed ok.

But then I found it, it only seemed as I could not run notepad.

What happened was the following: There was a notepad.com file in the system32 dir all of the sudden (spyware, virus, don't know). And Windows decided to run that one instead of notepad.exe

So it seems Windows prefers .com over .exe when trying to run a file without an extension.

Why does this happen?

There's another environment variable, called PATHEXT, with the following data:

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

Now you can clearly see the order of the files. I tried the same thing with a .bat and .exe file, and changing the env var, and it worked.

I'm not sure if the .COM has to be the first in line for normal system operations?

One side-effect of this was that when I wanted to View Source of a HTML page, it would also launch the notepad.com which did nothing, and thus not showing any source! I remember a lot of people complaining about not being able to view the source of their pages, this could be what's causing it!

Hopefully I'm telling something 'new' here, that's useful ;) I never knew that order of extensions.