December 2003 - Posts

The default System.Windows.Forms.DataGrid provided by the .NET Framework is a little bit limited in functionality. Therefore I've spent some time during my holidays building an extension to this default grid: the ExtendedDataGrid. At this point I've released a Beta version: 0.1 including these features:

  • Image DataColumn
  • Formatted Text DataColumn
  • LinkLabel DataColumn
  • Calculated field DataColumn
  • ...

New features and probably bug fixes will come soon so if you have any comments, questions, remarks, ... please let me know. If you are intrested in the ExtendedDataGrid, you can monitor this RSS Feed of the latest news. I know all these features are available as sample, code snippet, article, ... on the web, but I just hated to implement some of them all of the time, for each project. Also, if you are planning to use this component, or if you are just intrested: let me know, your support will motivate me to make further improvements. :-)

Btw, happy new year to all of you!

It seems that not everybody has a day-off; the MSDN Belux team published my new article: Getting Started with ObjectSpaces, thanks Tom! This article starts with a description of what Object/Relational Mapping tools are, or at least I tried to explain it as clearly as possible. After that the article provides a step-by-step guide to a first ObjectSpaces article using the Mapper Utility. Topics like Spanning, Delay Loading, OPath are explained too. At the end there are some intresting links regarding ObjectSpaces, I'll post them here:

  • ObjectSpacesDemo source files, Schema Documents and SQL script
  • GotDotNet User Sample: ObjectSpaces PDC 2003 Samples and Mapper Utility
  • System.Data.ObjectSpaces Namespace documentation
  • Working with the ObjectSpaces Architecture
  • OPath Operators
  • Some time ago I started to explore InfoPath, so far it was a pleasant journey. Everbody (including myself) seems to be requesting an user-control version of InfoPath so you can have InfoPath forms in your own Smart Client applications. This would be really great, top of the bill would be integration in Visual Studio.NET, but maybe that's a little bit too wishfull-thinking. Another nice feature would be a free version of InfoPath, without the functionality to create and edit forms. Like there is a free Acrobat Reader and a commercial Acrobat Writer. Microsoft says it's hearing these requests, but has anyone already an idea if these features will be available?

    Anyway, InfoPath is great when you walk between the lines. As soon as you step out of these lines, it becomes a little bit dirty, especially if it involves scripting (VBScript and JScript). That's right, it's a pitty that you can not use managed code (e.g. VB.NET or C#) in InfoPath (add this feature to the whish list!). What I wanted to accomplish was a form with a dropdown list of customer names, which could be submitted as a part of an invoice (for example). Filling a listbox with customer data is pretty simple using secondary data sources: you can have a webservice as the data source of the dropdown list. But what I wanted to have was an additional textbox in which you could specify a part of the name of the customer, so only a subset of customers would be listed (avoiding fetching a lot of data and improving the user experience: shorter list). Thanks to Joel Alley (Msft Developer Support) I found following KB Article, which is almost exactly what I was looking for:

    Microsoft Knowledge Base Article - 826994
    How To: Dynamically Populate a Drop-Down List Box by Using a Web Service
    SUMMARY
    The Microsoft Office InfoPath 2003 user interface does not permit you to specify a value in an input field and then have that value passed to a Web service that will in turn populate a drop-down list box with the results that match the value in the input field. This article describes how to call a Web service to dynamically populate a drop-down list box that is based on the selection in a second drop-down list box.

    Now that ScottW has updated the .Text blog engine, it’s possible to post stuff that doesn’t appear in the weblogs.asp.net main feed. So I can post some more personal things, or things that are only appropriate for Belgian people (who all check the Belgian .NET Bloggers Aggregated Feed of course :-).

    Anyway, I would to take the opportunity to wish everyone a Merry Christmas and all the best for the coming year. I'm looking forward to read and write about all the exciting things the IT world will bring us in 2004.


    Image by Nele!

    I've been exploring for some time now Windows Sharepoint Services and I'm really getting excited about it! After seeing some demos and presentations about this product I gave it a try. Actually it's quite impressive what you get out-of-the-box. In my opinion one of the great things is that once a user has it's own workspace or team site, he/she can control what will be on his/her site. Not only which Webparts are on the site, but even he/she can create subsites beneath his/her workspace, for example for meetings, documents, ... And this is possible without any intervention of an IT-guy. Life will be great! :-)

    Although there are a bunch of Webparts you get out-of-the-box, it's always nice to be able to add some yourself, especially if they are free. Here are some links to directories of (mostly) free Webparts:

    But after playing with WSS, you'll probably get bored and (as a developer) want to do some real work: building your own webparts. First you need to get the Web Part Templates for Visual Studio .NET and install them so you have a new project type in Visual Studio.NET. From then on, it's pretty straight forward. The only tricky part is deploying your Webparts so you can test them (if someone has a better solution, please tell me!).

    1. Give the assembly containing the Webpart a strong name (SN tool).
    2. Put it in the GAC of the server.
    3. Alter the web.config file on the server (add it to the SafeControls node).
    4. Put the dwp file in the wpcatalog directory (under your Sharepoint site directory).
    5. Add the Webpart to a workspace.

    Once you've given the assembly a strong name, make sure to alter the dwp file to, so the Assembly node contains the full name (including the key, version, ...) of your assembly (tip: use Reflector for .NET to get the complete name of an assembly). If you don't do that, it won't work I've found out the hard way... This, and a lot more information can be found in the articles of Patrick: Building Web Parts for Microsoft SharePoint Products and Technologies and part two. Finally one last tip (which I also discovered the hard way), if you replace an assembly in the GAC while testing a Webpart, without changing the version number, you need to restart IIS (e.g. use the IISRESET utility) or clear the assembly cache. Otherwise you'll be using the old version of the Webpart. Have fun!

    Since you can't hide something on the internet very long, here is the “official” announcement! :-) I've created an aggregated feed for all the Belgian .NET Bloggers. On this page you can see the last 15 post made by the bloggers in the list, ofcourse there is also an RSS feed. If you want your blog included or removed, please contact me.

    Actually Patrick Verbruggen was the first one to discover the page (see his post) during my brief test period. At this point I haven't had any problems, but if you notice a bug or something like that, drop me a message. I have to look at the caching strategy too, so don't expect a high performance page (yet).

    UPDATE The link for the RSS feed was wrong, this is now corrected. Although the link to the rss feed at the aggregated feed page is still wrong... I'll upload a new version tomorrow. Sorry for the problems...

    UPDATE2 The link to the rss on the aggregated feed page is fixed too. (I really should go to sleep now...)

    When Webservices are used, a common concern is security: SOAP messages are transferred in plain text over the network, so anyone with a sniffer could intercept the SOAP message and read it. In my opinion this could happen also to binary data, but probably it requires a little bit more hacker skills. So a solution is to use HTTPS (SSL) instead of HTTP, so the communication is encrypted. To accomplish this, you need to get and install a certificate (issued by a Certificate Authority) on your webserver. In a production environment you would buy a certificate from Verisign or another well known CA, or you would install your own CA, which is a component of Windows Server. If you only want to play with HTTPS, SSL and certificates or your project is in the development phase, you can also generate a test certificate using the MakeCert.exe tool (included in the .NET Framework SDK). After that you have to add this certificate to a website in IIS, and set a port which HTTPS should use.

    When you browse to a HTTPS site, you probably get a dialog window asking you if you want to trust the certificate provided by the webserver. So the responsibility of accepting the certificate is handled by the user. Let's get back to the webservice scenario, if you want to invoke a webservice located on a webserver which uses SSL and HTTPS there is a problem. When you make the call from code, there is no dialog window popping up, and asking if you trust the certificate (luckily because this would be pretty ugly in server-side scenarios); probably you'll get following exception:
    An unhandled exception of type 'System.Net.WebException' occurred in system.dll

    Additional information: The underlying connection was closed: Could not establish trust relationship with remote server.

    But there is a solution for this problem, you can solve this in your code by creating your own CertificatePolicy class (which implements the ICertificatePolicy interface). In this class you will have to write your own CheckValidationResult function that has to return true or false, like you would press yes or no in the dialog window. For development purposes I've created the following class which accepts all certificates, so you won't get the nasty WebException anymore:
    public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy
    {
     public TrustAllCertificatePolicy()
     {}

     public bool CheckValidationResult(ServicePoint sp,
      X509Certificate cert,WebRequest req, int problem)
     {
      return true;
     }
    }

    As you can see the CheckValidationResult function always returns true, so all certificates will be trusted. If you want to make this class a little bit more secure, you can add additional checks using the X509Certificate parameter for example. To use this CertificatePolicy, you'll have to tell the ServicePointManager to use it:
    System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
    This must be done (one time during the application life cycle) before making the call to your webservice.

    Last week, I blogged about my experiences with generics in C# and VB.NET. The focus was on applying multiple constraints for which the syntax in C# was well documented. But the syntax in VB.NET was not that easy to find, but I “discovered” it after a little bit of searching. Anyway read more about this topic here.

    In the meanwhile Wim Uyttersprot (U2U), has published an article about generics on the MSDN Belux site: Generics in .NET - Part I. This article gives not only a nice view on generics, but also goes down to the IL; recommended reading if you're intrested in generics. Since this is Part I, I'm already looking forward to your next article Wim! :-)

    Do you know this feeling: you're working and while coding you find a really cool code snippet. Or you are surfing the web and you find an interesting article, but way too long to read at that point. Or you're browsing through posts of weblogs you read, and there are some “must-remember” ones. You want to remember all of this valuable information, so you can go look for it when you really need it (or have time to catch up). But my personal internal memory is rather limited and cannot be expanded, so it's impossible to remember the location or contents of everything. Some time ago I started looking for a tool that could capture all this information and store it in a database making it easily searchable. For some time now, I'm using Code Library for .NET: a free tool to store all sorts of information (articles, links, code snippets, pictures, ...). It's available both for Access databases and SQL Server (or MSDE), and it has a really nice user interface.

    This month the author released version 5.6, which has some new features and improvements (even a VS add-in!). There is only one feature missing to make this the perfect tool: a server installation (which is on the “future-list” I believe). I work at different locations and now I'm storing everything in a CodeLib Access database, so I can easily take the database with me. But the ideal situation would a server installation that would provide a webservice interface for the CodeLib GUI, so you could access it from anywhere. By the way, when you visit the site, you'll see most of the text is in Chinese (I think), but the application is completely in English!

    I played a little bit with Microsoft OneNote, and I think this tool can do the same. Has anyone some experiences with OneNote, is it possible to setup a server side database?

    More Posts