# Wednesday, 19 May 2004

We all know and love the C# version of foreach where you specify the type in the loop like this

foreach ( object o in list )

In VB.NET 1.0 you had to do declare the variable outside of the loop which is pretty ugly as you might end up using it later in your code by accident. With VB.NET 1.1 you can do a foreach loop the C# way which probably is the new feature of .NET Framework 1.1 I use the most :)

So in the old way you would do this:

Dim o As Object
For Each
o In list

The new way allows you to use this form instead:

For Each o As Object In list

Most people probably know this but I think it's worth mentioning for the 5 people who haven't discovered it yet.

posted on Wednesday, 19 May 2004 13:11:13 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback

Are you using a hidden column in your DataGrids to store the ID of rows? I was until recently when I discovered that you can specify a field on the DataGrid which contains the keys. It goes a little something like this

<asp:DataGrid id="MyGrid" runat="server" DataKeyField="TheFieldInDataSourceWhichContainsTheUniqueKey">...

In code you can retrieve the key in a command event handler or something similar like this

private void MyGrid_EditCommand( object sender, DataGridCommandEventArgs e )
  int id = ( int ) MyGrid.DataKeys[ e.Item.ItemIndex ];

Neat little trick which keeps your DataGrids a little bit cleaner :)

You can of course use any data type as the data key, just change the cast to the appropriate type and you're all set :)

posted on Wednesday, 19 May 2004 12:48:59 (Romance Daylight Time, UTC+02:00)  #    Comments [2] Trackback
# Tuesday, 18 May 2004

Quite a few people in my referrer log use a Mozilla-based browser of some sort and I just wanted to apologize for the layout of this site when displaying it in those browsers.

Please be aware that I am working on modifying the template to be more friendly with Mozilla browsers.

posted on Tuesday, 18 May 2004 14:07:22 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback

My main focus for this blog is .NET which really isn't apparent when you look at the posts so I thought I'd add an entry about a nifty little language trick I picked up reading blogs last week :)

The @ is a really neat symbol which you use for making C# interpret a string literally. You probably written double \ more than once in a file path. Well with the @ symbol you don't have to do this simply write:

string s = @"c:\windows\Microsoft.NET";

Most C# developers know this but did you know that you can also do this:

string s = @"Line 1


The text will appear just as you wrote it. Pretty neat :)

posted on Tuesday, 18 May 2004 13:02:11 (Romance Daylight Time, UTC+02:00)  #    Comments [15] Trackback
# Friday, 14 May 2004

I couldn't believe my eyes when I first saw this so I thought I'd share :) Basically the Japanese come up with some very strange stuff for their consumers, some of the best you can see at http://www.maillist.com.tw/maillist/file/osaki/20040111034221.html

posted on Friday, 14 May 2004 13:30:50 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Thursday, 13 May 2004

About 8 months ago I finally caved in a bought myself an iPod. Just couldn't resist all those cute pictures of it on the net and sure enough, when I got it I instantly fell in love. The little thing followed me everywhere and quickly got to the point where I just couldn't imagine what my life was like before :)


I had almost just finished that thought when my iPod started acting funny on me. I figured it had hit puberty or something and it would pass with time until the day when it just sat there on my desk mumbling something about my girlfriend taking too much of my time and I never had any time for poor old iPod anymore...). ANYWAY I figured it was time to send the old girl back to Apple in exchange for a newer model (heh) and from here on in the story just gets worse.


I started my repair case the 16th of January and figured I would have it back in time for my vacation in London, England. No luck. Some weeks later I made plan to go visit some friends of mine in our great capitol of Copenhagen only to have my hopes dashed by Apple Support. Great! And so the story goes on and on.


Having made dozens of phone calls, spoken to even more people and getting a different story every time I finally got a hold of a Swedish customer relations guy who seemed like a person who could get things done. And man did he get things done ... A week and a half later (that would be today) a UPS delivery person arrived, quite unexpected I might add, with my new replacement iPod. I couldn't believe my own eyes and I may have shed a tear when I was finally reunited with my preciousssssss :)


Anyway I thought I would share this story with the world because people need to beware that Apple might try to screw you over. I don't think that this long wait, four count 'em FOUR months, was intentional from Apple but it just goes to show that when something you leave the normal work flow of a system you can quickly end up in some kind of dead end which is really what I think happened here.


I see this all the time with systems I come in contact with. As long as everything works the way the developer intended things run smoothly. This incident certainly is something I keep at the back of my mind when I write code so that the stuff I write is more flexible. I am often amazed at the creative ways users find to use the software we make. It's extremely satisfying to see users solving problems with your software which you really hadn't intended it to handle - on the other hand this can be extremely annoying as well as users not always "get" what they are supposed to do with the product :) Wouldn't the world be a nice place with no users around, ah well, a developer can dream can't he? :D

posted on Thursday, 13 May 2004 18:13:54 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Tuesday, 11 May 2004

Like everybody else I get my (more than) fair share of spam ... and for the record those "50% added size to your penis"-spam mails doesn't produce ANY results ... or so I've heard :)

Anyways I have been trying out a couple of Bayesian filters which I was pretty impressed with seeing that I had only used black-/white list filters in the past.

I only have three things I look for in a spam filter: 1) It needs to support Outlook, 2) It needs to be unobtrusive, and finally 3) it needs to get those pesky spam messages (sort of a given :)).

Here are the filters I have been looking at SpamBayes, Spamfighter, and Spam Bully. The list is by no means complete but I simply stop looking when I find a product which fits the bill.

SpamBayes is free which is always a big plus in my book. It's pretty unobtrusive and does a good (not great) job of filtering incoming e-mail. It does not work that well with Hotmail integration in Outlook. It provides no automatic removal of spam from a Hotmail account. I found a small bug in the software which renders it unuseable if you have your mouse set up for left hand - pretty weird :) It actually fell on this bug as I do all my mousing with left hand when at work because I want to conserve my wrist which has begun acting up.

Spamfighter has a free version out there also which is crippled. I chose to try out Spamfigther for one reason only: It was made by the guys behind a well known dot com business here in Denmark named Jubii.dk. I figurered that they would be able to put together a niece piece of software - man was I wrong :) It does a poor job of filtering the spam, it does not work well with Hotmail (like Spambayes), and the interface is very much in your face. You need 7 (seven!) clicks in order to filter a folder (like Hotmail) which is just bad from a user experience point of view. SpamBayes provides the same functionality with just one click. Lastly when you uninstall Spamfighter it messes up your existing add-ins for Outlook which is just a great way of closing a test of a piece of software don't you think? :)

Finally the test winner or whatever: Spam Bully. I have found my new spam filter - I actually liked this filter so much that I bought it before my trial expired. Spambully does a great job of filtering spam. I have not seen any spam in my inbox since I installed and trained the filter and have only had a couple of false positives. The interface is very configurable and very user friendly.
There are all kinds of neat features - I especially like the Punish feature which goes out to the spammers website and pulls some traffic there which the spammer has to pay for. Always great to hit the spammer where it hurts the most :)
The Hotmail support is great. Spam Bully will automatically keep your Hotmail folder clear of spam. I've always said that the best test of a spam filter is Hotmail where I get tons of spam - lo and behold, no spam enters my inbox anymore. INCREDIBLE! This feature works for Exchange as well, Spam Bully will check a number of folders of your choice and clean them when Outlook starts.
The only downside of this filter is that it isn't free but it does come with a very fair price tag if you ask me. $ 29.95 is very fair for a piece of software which you use every single day.

Go download your trial yesterday! You will not regret it :)

posted on Tuesday, 11 May 2004 19:40:40 (Romance Daylight Time, UTC+02:00)  #    Comments [3] Trackback
# Thursday, 06 May 2004

Being a hardware buff I got to say that this thing spikes my interest: A keyboard made of light. Apparantly that's exactly what you can buy for the price of $99.99. Pretty neat for all of those with a PDA or a smart phone. Guess that makes all those hours of practicing thumb typing useless :)

Check it out.

TheScreenSavers TV show had this thing on. Check out their opion of the device; to sum it up: They are not impressed.

posted on Thursday, 06 May 2004 13:52:10 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Wednesday, 05 May 2004

I've been using water cooling for almost a year now and I got to say that it's had it's ups and downs. The reason for the missing posts around here is that the pump in my system gave out on me yesterday ... and it was only a two weeks old replacement for another pump which gave out.

I must say that I am beginning to have my doubts of the merits of water cooling. The objective for me was to get my PC as quiet as possible. While the sound level has dropped a new form of noise has evolved in my PC: Vibration noise. The water pump vibrates (heh) considerably more than any fan I've ever had installed in my case ... and I have had a few.

The kit is from Asetek and is called Water Chill. Other than the pump issues the system has been running great. However losing the pump sucks big time as I have to wait a week or more for a replacement pump meaning my system will be out for that period.

posted on Wednesday, 05 May 2004 09:17:17 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Monday, 03 May 2004

A new version of dasBlog has seen the light bringing us up to version 1.6.4121.0. You can grab the new version here. Being an update-addict this is of course great news for me as it gives me my regular fix (the Longhorn fix has just about worn off about now :) ).

As you have probably noticed by now this site is dasBlog powered and I am happy to report that I have already upgraded to the new version and everything is a-OK.

You can read all about the changes and new stuff if you want to get the low down on this release.

posted on Monday, 03 May 2004 20:54:36 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback