Archives

Archives / 2004 / September
  • BENUG Test Driven Development Session - TestDriven.NET

    Today I went to a BENUG session about test driven development, and I finally got NUnitAddin to work ;)

    A small recap of today:

    • Get TestDriven.NET-0.9.615d.msi, this includes MbUnit along with NUnitAddin already setup to work with MbUnit. No more need to edit that config file yourself. The future testing tool is TestDriven.NET ;)
    • Reference Core, Framework and TestFu in your project.
    • Add [TestFixture] as attribute to your class.
    • Add [Test] as attribute to a method.
    • Right click somewhere in the class and Run Tests, to run them all, or right click in one method to only run that one.
    • Watch the Output window display success or failed, and display the report url at the end.
    • CTRL+Click the url to see a detailed report (view example).
    For all other news, I redirect you to Jonathan de Halleux his blog, where he talks about the Database Populator Framework and other nice testing stuff.

    Note:
    If you have installed csUnit, leave it installed! Do NOT uninstall it unless you are good enough informed about the uninstall possibly fucking up your VS.NET installation. I uninstalled it today, and poof, adding classes and everything else trough VS.NET was broken, solution, Repair VS.NET :(

  • Add IE Features - New keywords (yeah, the ones Firefox users are so proud of)

    Right, someone trying to convince me why Firefox is so much better than IE brought up the issue of being able to type "google searchterm" into his Adress bar and immediately being taken to the site.

    Well, here's some news: IE can do that to, along with imdb, whois, vandale, php and everything else that uses parameters as query terms.

    How? Look at this registry key and see the light:

    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\google]
    @="http://www.google.com/search?q=%s"
    " "="+"
    "%"="%25"
    "&"="%26"
    "+"="%2B"

    %s is where your search term comes, and the name of the key is the prefix.

    Another example to get the hang of it:

    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\imdb]
    @="http://us.imdb.com/Find?%s"
    " "="+"
    "%"="%25"
    "&"="%26"
    "+"="%2B"

    Got it? Sweet, enjoy your new IE power! ;)

    I have uploaded a .reg file which contains altavista, astalavista, cd, download, google, googlenl, imdb, php, sub, vandale, vcd, whois and lucky as search terms. Feel free to invent more :)

    Update: Google feeling lucky keyword.

    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\lucky]
    @="http://www.google.com/search?q=%s&btnI=I%27m+Feeling+Lucky"
    " "="+"
    "%"="%25"
    "&"="%26"
    "+"="%2B"

  • The Invisible Administrator

    Today something very weird happened and I doubt something this weird will ever happen again.

    I was working on a site at school when I browsed to a file-server to check some paths, and to my surprise I could suddenly access ALL shares, not only the ones for students, but all of them...

    When I tried creating files they got made under BUILTIN\Administrators! But I was logged on with my own student account. So, being nice and all, I reported it...

    Then we spent almost entire afternoon trying to determine why I was suddenly an admin.

    And this is when the weird stuff started to happen:
    On PC1 I was an admin on the server, but when I logged in to PC2 I couldn't access it.
    We tried different student accounts on PC1 but they also couldn't access the shares.
    Then we removed all groups from my account except Domain Users, and I still could get in.
    We cleared the profiles from PC1 and 2 and also deleted my roaming profile.
    Nothing changed...

    First conclusion: It's tied to username X and PC1, examine PC1 later.

    Then we go to another room and try it on different computers. And there it starts all over again.
    PC3: I'm an admin, PC4: I'm not.

    In the end we checked all groups I belonged to, and their membership, deleted my profile, checked all NTFS permissions (which I could change as well..), and nowhere there was a trace of me or any groups I belonged to. Nothing had admin rights.

    We forced replication to make sure I was group-less but it still worked!

    Conclusion: User X has the rights of an Admin, but does NOT show up in any group, NTFS permissions or anything else...

    Solution: We disabled the account and created a new account.. (Which means I have to recreate my entire profile again...)

    Has anyone else every encountered this, and found out why this was happening?

  • Six Invites to the Most-Hyped-Mail-Service-Of-The-Year, aka GMail

    Ah, well, 11 blog posts on a day is fine as well :p

    With all those people giving away GMail accounts, I got 6 as well.

    I got one someday, never used GMail, but hey, I can give them away.

    There's too much hype around it, and I'm really not into webbased mail when I just can read it from Outlook.

    But anyway, if you want one, it seems I have to supply a First and Last name and an email adress, so, the first 6 people who supply them in the comments get an invite.

    Update: I just got 5 more invites, will update post when they're all given out...

    Update2: All gone, closing comments

  • Fix Outlook Contacts Phone Number "+32" with C#

    I own a Sony Ericsson T630 and manage my contacts with Outlook trough Bluetooth.

    This has the side side-effect that I finally started adding everyone I might need to contact to my Contacts, before that I just picked an email and used the Reply-To ;)

    But there is one thing that bothers me, I store my numbers in international format (eg: +32 50 .....), but Outlook always removes the + in front of it, and I can't find how to change that. And my phone needs the +!

    So I wrote a C# tool that would let me fix my contacts.

    You can download it here and read the full article here.

  • Fix Outlook Contacts Phone Number "+32" with C#

    I own a Sony Ericsson T630 and manage my contacts with Outlook trough Bluetooth.

    This has the side side-effect that I finally started adding everyone I might need to contact to my Contacts, before that I just picked an email and used the Reply-To ;)

    But there is one thing that bothers me, I store my numbers in international format (eg: +32 50 .....), but Outlook always removes the + in front of it, and I can't find how to change that. And my phone needs the +!

    So, let's write a tool to fix this.

    First we need a reference to Outlook. So add a reference to 'Microsoft Outlook 11.0 Object Library' (or 10.0, if you use 10.0 leave a comment if this source worked for you!)



    When you did this you'll have two new reference, just remove the Office Core... so that you have something like this:



    Our application has a very simple logic, where the Main controls it all.

    1using System; 
    2using System.Text.RegularExpressions;
    3using System.Collections;
    4using System.IO;
    5using System.Diagnostics;
    6using Outlook = Microsoft.Office.Interop.Outlook;
    7
    8namespace FixContacts {
    9 class FixContacts {
    10 static void Main(string[] args) {
    11 // TODO
    12 }
    13 } /* FixContacts */
    14} /* FixContacts */
    First we get the folder where our Contacts are stored.
    1 //string contactFolder = @"Cumps David\Contacts"; 
    2 Console.Write("Contact Folder: ");
    3 string contactFolder = Console.ReadLine();
    Then we open Outlook and get the folder.
    1 Outlook._Application appOutlook = new Outlook.Application(); 
    2
    3 Outlook.NameSpace olNS = appOutlook.GetNamespace("MAPI");
    4 olNS.Logon("", null, null, null);
    5
    6 Console.WriteLine("Searching Folder...");
    7 Outlook.MAPIFolder olContactFolder = GetFolder(contactFolder);
    8 Outlook.Items olContactItems = olContactFolder.Items;
    When we have the contact items, we loop over everyone of them, checking if there is a number to be fixed.
    1 Console.WriteLine("Fixing Phone Numbers..."); 
    2 foreach(Outlook.ContactItem olContact in olContactItems) {
    3 CheckNumbersToReplace(olContact);
    4 }
    Finally, we clean everything up.
    1 olNS.Logoff(); 
    2
    3 olContactItems = null;
    4 olContactFolder = null;
    5 olNS = null;
    6 appOutlook = null;
    7 Console.WriteLine("Done");
    8 Console.ReadLine();
    First the GetFolder method. This will get us our folder we specified with a path.

    Again we open Outlook. Then we split the path into the corresponding folders and we look for the root folder.
    1Outlook._Application appOutlook = new Outlook.Application(); 
    2Outlook.NameSpace olNS = appOutlook.GetNamespace("MAPI");
    3olNS.Logon("", null, null, null);
    4
    5Outlook.MAPIFolder olFolder = null;
    6folderPath.Replace("/", @"\");
    7string[] arrFolders = folderPath.Split('\\');
    8
    9foreach (Outlook.MAPIFolder olTmpFolder in olNS.Folders) {
    10 if (olTmpFolder.Name == arrFolders[0]) {
    11 olFolder = olTmpFolder;
    12 break;
    13 }
    14}
    When we have found our root folder, we will look for our first folder and when we find it, we replace our parent object by that folder and go looking for the next folder.
    1if (olFolder != null) { 
    2 for (int i = 1; i < arrFolders.Length; i++) {
    3 Outlook.Folders olFolders = olFolder.Folders;
    4 olFolder = null;
    5
    6 foreach (Outlook.MAPIFolder olTmpFolder in olFolders) {
    7 if (olTmpFolder.Name == arrFolders[i]) {
    8 olFolder = olTmpFolder;
    9 break;
    10 }
    11 }
    12 olFolders = null;
    13 }
    14}
    And in the end we return our found folder after cleaning up.
    1arrFolders = null; 
    2olNS = null;
    3appOutlook = null;
    4return olFolder;
    Now the CheckNumbersToReplace method, this is a simple one.

    We create an ArrayList where we will add every phone number in the contact that starts with our contry prefix.
    1 private static void CheckNumbersToReplace(Outlook.ContactItem vContact) { 
    2 ArrayList phoneNumbers = new ArrayList();
    3 string countryPrefix = "32";
    Next we check every phone entry if it contains the prefix. (I only show one of them now)
    1 if (vContact.HomeTelephoneNumber != null) { 
    2 string phoneNumber = vContact.HomeTelephoneNumber;
    3 if (phoneNumber.Substring(0, 2) == countryPrefix) { phoneNumbers.Add(phoneNumber); }
    4 }
    When we looked over all phonenumbers, we will build a new vCard with the correct information in it, that is, our numbers prefixed with a +.
    1 if (phoneNumbers.Count > 0) { 
    2 string vCardLocation = "";
    3 Outlook.MailItem vCardMail = vContact.ForwardAsVcard();
    4 Outlook.Attachments vCardArray = vCardMail.Attachments;
    5 foreach (Outlook.Attachment vCard in vCardArray) {
    6 vCardLocation = Environment.CurrentDirectory + @"\" + vCard.FileName;
    7 vCard.SaveAsFile(vCardLocation);
    8 foreach (string phoneNumber in phoneNumbers) {
    9 FixNumber(vCardLocation, phoneNumber);
    10 }
    11 }
    12 vContact.Delete();
    13 Process launchvCard = new Process();
    14 launchvCard.StartInfo = new ProcessStartInfo(vCardLocation);
    15 launchvCard.Start();
    16 launchvCard.WaitForExit();
    17 File.Delete(vCardLocation);
    18 }
    As you can see, we create a temporary vcard for this, and then launch it, you only have to press Save on it, and it's saved. As this is just a personal tool I didn't have the time or requirement to look into automatically saving it. In the end we delete the temporary file.

    The FixNumber method is a simple search and replace in the vCard file.
    1 private static void FixNumber(string vCardPath, string phoneNumber) { 
    2 if (File.Exists(vCardPath)) {
    3 StreamReader readvCard = File.OpenText(vCardPath);
    4
    5 string vCard = readvCard.ReadToEnd();
    6 readvCard.Close();
    7 vCard = vCard.Replace(phoneNumber, "+" + phoneNumber);
    8
    9 StreamWriter writevCard = File.CreateText(vCardPath);
    10 writevCard.WriteLine(vCard);
    11 writevCard.Close();
    12 }
    13 } /* FixNumber */
    And that is our FixContacts utility. It opens the contact dir, scans the contacts, check for phone numbers and fixes them if necessary and pops them up with the correct information, after which you only have to press Save.

    Good enough for me, me phone and Outlook playing nicely together with this.

    Full sources and executable are uploaded again. Enjoy.

  • Blog-post record - Using ndiswrapper

    Wow, apparently I made 8 blog-posts today (9 now), that's a record ;) Well I've been away for a while as well, so..

    Busy holiday, little time for computer, and plenty of new projects, a new laptop, airport express, all the toys ;)

    I guess it'll be a bit more quiet the coming days, as I said everything today ;)

    But to give this post some information, here's how to set up a Dell truemobile 1450 under linux. (I got it working under Fedora Core 2)

    Get ndiswrapper and the .exe file that came with your card.
    Extract the exe to a location on your disk
    Install ndiswrapper (make install)
    Install the driver (ndiswrapper -i bcmw15a.inf)
    Check if it worked (ndiswrapper -l)
    If it worked, check iwconfig to see wlan0

    Now set up your wlan
    iwconfig wlan0 mode managed
    iwconfig wlan0 key open 12345..6 (your hex WEP key)
    iwconfig wlan0 channel 11 (your channel)
    iwconfig wlan0 essid HEAVEN (your essid, without quotes)

    You can test with iwlink wlan0 scan (I believe) if it finds your AP.

    I found that when you are unable to set your essid, it is because your WEP key is invalid. I don't know WiFi tech enough, but it seems that you only need a valid WEP key and it'll find your wlan.

    If it's associated, bring it up with ifup wlan0 and it'll get an ip trough dhcp.

    It took me a while, especially the essid part. Also sometimes it can bark at you when trying to set your key, then you have to do:

    iwconfig wlan0 key open
    iwconfig wlan0 key open 12345..6 (your hex WEP key)

    Don't know why, but that solved it.

  • Open Java and .NET Programmer functions

    Ulysses Consulting recently contacted me asking if I didn't knew anyone for the following positions:

    • Java Programmer
    • .NET Programmer
    Both functions need to have some years of experience and be able to coach other people in orde to improve to projectleader.

    If you want to apply contact me and put Ulysses in the subject. Include your contact details and which function you're going for and I'll forward the info.

  • New site for Dutch teachers - Lerarenforum.be

    In case there are some Dutch teachers reading this, I just finished a forum site exclusively for teachers...

    It's a project of Kurt Meuleman, a teacher himself, who wanted to have a forum for the entire Dutch-speaking teacher-community, and today it's officially open.

    Basically it's phpBB with a self-created theme and some mods. I'm convinced that with his motivation it could become something, should be on Radio 1 soon normally ;)

    The address? http://www.lerarenforum.be

  • Stream Music over WiFi - JustePort - .mp3 support needed

    Right, about 2 weeks ago Jon Lech Johansen released Justeport, a tool to stream your Apple music files to your Airport Express.

    His site went down almostly as soon as the big news sites picked it up, and the source of Justeport couldn't be downloaded.

    I also didn't see much blogging about this, which is strange, because his tool is written in C#!

    A few days ago I got an Airport Express and now I'm streaming .mp3 to it from iTunes (on Windows) but I have to use iTunes, and that's not something I like, making me go away from Winamp...

    But JustePort can not stream .mp3 files to it, but the source is available (and here is a mirror), so maybe there is someone with a better understanding of handling music files in C# who could write something to stream .mp3 to it.

    Hopefully there will be a Winamp plugin someday to do this.

    It's a great piece of technology, a very small WiFi AP which you can plug in to an electric outlet and to your stereo and stream music to it through the air.

    I guess if someone has too much time on his hands and wants a challenge, this is one, writing an mp3 player that can stream to the Airport Express (with volume control, play, pauze, prev, next and playlist support ofcourse ;))

    If someone is up to it, and needs someone testing it with an Airport Express, contact me and I'm willing to help you.

  • Random Wallpaper through Scheduled Tasks

    With my new laptop I got a screen with a 1920x1200 resolution, so I went out looking for wallpapers for the resolution, because my existing ones degraded in quality with that size.

    My search led to Deaddreamer from which I have my current wallpaper as well.

    But nowadays he got so many good ones, so I picked up 5 1600x1200 wallpapers. And now I want a random wallpaper each time I logon.

    Having some spare time (very rare) I created something small myself, I'm sure there are tools out there to do all that.

    Originally I wanted to use PHP to get a random number and set the wallpaper, and then call the php script with a bat file and set it as a scheduled task. But that kept popping up a dos prompt each time it set it, and my wallpaper disappeared after boot (some bad registry settings).

    So I used KiXtart to set the wallpaper and then link it with a shortcut which would run minimized.

    That worked for one paper, but when I tried the RAND function in KiXtart, it didn't go well.. But I had the php script and bat still there so I let that make a random number and then kill the KiX script with that number as argument.

    Result:
    Shortcut to wall.bat, which calls wall.php, which makes a random number and calls wallpaper.kix with the number, after which my wallpaper is set, and saved in registry.

    I have to shortcut Run as minimized and on logon and every hour, and now I got a nice random wallpaper implementation.

    Overly complicated? Maybe, If you have php installed, it's a small solution, otherwise you need a 1.3Mb dll and 24k php.exe in the same dir, which isn't really something bad.

    I have zipped everything and written the steps to install it out in a Readme.txt for everyone wanting it as well. I also included the php.exe and dll.

    Download it here: RandomWall.zip (706Kb).

    And now I have sweeeet super-detailed wallpapers auto-changing without any special timer programs running, but just the Scheduled Tasks :)

    Here are my wallpapers:
    ddr_0075_vertical_theory_pure.jpg
    ddr_0075_vertical_theory_decay.jpg
    ddr_0088_v1r2a_1600x1200.jpg
    ddr_0091_bioforge_1600x1200.jpg
    ddr_0086_21st_century_kaos_1600x1200.jpg
    (convert them to .bmp first, not sure if it's required, but whatever, bmp is nicer, no need for desktop to go in Web mode)

  • Hacking Uxtheme.dll - Watercolor Theme

    One thing I immediately do on a new pc is get it personalized. This includes changing icons and wallpapers, but also resource hacking the run box and hacking the uxtheme.dll to support custom themes.

    Today I'll talk about implementing the Watercolor theme I have been using for a year now, and got a lot of mails on where and how to get it.

    First you have to modify UXTheme. This used to be somthing "difficult" but now it's easy. Get the UXTheme Multi-Patcher and run it.

    As always, and on the left side of the blog, I'm not responsible if something goes wrong, everything you do is your responsability.

    Normally, according to the page I just linked, this doesn't work on XP SP2 final, but I ran it anyway and it worked. Just make sure you wait for the Windows File Protection box to come up.

    Next you get the Watercolor theme, unzip it and run WatercolorLitev211.exe, it'll install the theme and you can select it from the Desktop Configuration control panel. It packs with several colors, I either have it set to Blue or Ergonomic.

    Enjoy your sweet new theme :p

    A screenshot from a previous posting demonstrating the theme:

  • New Student Site - Interview with Jan Tielens, Wouter Sergeyssels, Patrick Verbruggen, Tom Mertens and Gerd De Bruycker

    During the holidays I recreated our internal school site, and reformed it to a place for students.

    And one nice thing for everyone is: it's public from now on!

    Well, actually, let me explain. The informational part is public, with the interviews, news, pictures, etc...

    The (new) community is also publically viewable, but not registerable.

    And students of our school get extra features, like accessing their homedir from home, reading plenty of internal school stuff (like, when not to waste time coming to school when somebody is sick :p), along with the ability to join the community.

    One small disadvantage for a lot of readers... It's only available in Dutch.

    If that isn't a problem for you: visit Studnet!

    What does this has to do with IT (besides the creation)?

    Well, it has an interview section on it, for which I did 5 of them already, and they are about IT. Here are the links:

    Jan Tielens - About the tasks of a .NET architect.
    Wouter Sergeyssels - A look inside a hosting company, Nucleus.
    Patrick Verbruggen - Processes and the future of programming in the Western world.
    Tom Mertens - Installers and the future of passwords.
    Gerd De Bruycker - Microsoft Communication Channels (MSDN, TechNet, several magazines, user groups, MVPs, ...) and how it is to work for Microsoft.

    If there are other Dutch-speaking people reading this and who believe they would add value to the site with an interview, please contact me. The target group is students, preffered interview channel is MSN/ICQ.

  • Windows XP Pro and IIS5 - Multiple Sites

    I recently got a new laptop (Dell Inspiron 8600) and installed Windows XP Pro on it (with SP2 installed already, yes :p).

    One thing I hate about this, is that it includes IIS5 and you can't install IIS6 on it (not that I know of).

    Why is this bad? Because you can only have one site... Which is something I got way to much used to running Windows 2003.

    Luckily enough, Davy Belmans thought the same, so he developed IIS Admin.

    It's a very nice tool, very small, and sits in the tray bar, allowing you to easily add new sites, and switch between them.

    Yes, switch, because even with multiple sites configured, you can only run 1 at the same time apparently.

    If you run Windows XP, and you don't have a way to get multiple sites working, get this tool, otherwise, comment and tell me how ;)

  • BENUG Hands-on workshop on TDD - Location Info

    On 9 September 2004 there is a Hands-on Workshop on TDD organized by BENUG.

    The location info only indicates directions for cars though.

    I just called Compuware to get some info for train- and bus info. So, everyone coming by train, this is what I got:

    Get the train to 'Leuven'.
    Overthere is a bus with number 358, every 20 minutes.
    Take that bus and it should stop right at a Q8 station, right after it passed a firemen-building.
    It should stop right in front of Compuware.

    I'm going there by train ;) Hopefully I'll find it easily.