Friday, May 08, 2009

Sometimes it is possible that after you have done a full install of VS2008 with Team Explorer, than you can’t create a new project.  The only thing you could do is creating a new Team Project.

 

Mostly this happens when the installation takes a long time.  Internally the installation goes in timeout then.

 

Instead of re-installing your VS2008, you could also use following tip:

 

Follow this path

 

            Tools à Import and export settings à reset all settings

 

If you have done this, reboot your PC and restart VS.  You will see that you now can create not only new Team Projects, but also standard Projects.

.Net | VSTS
5/8/2009 1:22:46 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Thursday, November 27, 2008
11/27/2008 8:41:27 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, October 28, 2008

It's a pitty that I wasn't able to go to PDC.  A lot of interresting news is comming from there up to me :-).

.Net has a new logo. This is the one.

This looks so great for me it so refreshing.  Being tired after 8 years of the old logo, I'm so happy with it.

10/28/2008 3:47:54 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Monday, January 07, 2008

Roland Weigelt has released a new verison of his famous Ghostdoc.  It's a minor release but it solves a few issues with some operators and rules.

Download it form the Ghostdoc website.

If you want a easy and fast way to ahve standard documentation of your code this is a very nice product.  I'm using it now on several projects.

1/7/2008 3:49:18 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Friday, November 23, 2007

OK, I know.  The official RTM is released last monday (So 4 days late with blogging it), but I haven't had time to blog.  So here's a full list of all info I have about VS2008.

Since monday, you can download VS2008 RTM if you are an MSDN subscriber (almost 4GB).

But you aren't a MSDN subscriber and you still want to have it.  Well here are a few possibilities :

You can also download the .Net 3.5 runtime.

Read a few Microsoft blogs who announced the shipment :

When you're a Silverlight developer, be sure to read the last paragraph with some important info.

Also the VS2008 RTM Training kit is available for download.  This kit contains presentations, hands on labs, demo's,... about VS2008.  It's just a great bunch of sources. Go and download it here.

More and more info can be found on blogs.  Dan Fernandez has blogged a list with 15 nice and great new features which can be found in thss editions.  Here's his list. Great work Dan.

And if you're in game programming.  You can download the beta of XNA Game Studio 2.0 add-in here.

So fo those who doesn't still have anything of VS2008.  Go, grap it, download it and install it.  You just will love the new version.

.Net | News
11/23/2007 10:30:49 AM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 

Yesterday evening, the Belgium Visug group organized a “Best of TechEd” session.  In this session several speakers (I was one of them ;-) ) has given a 5 – 10 minute presentation about the best session they attended at TechEd 2007.

Following topics were given:

  • Astoria (Yves Goeleven)
  • BizTalk Services (Lieven Iliano)
  • ASP.Net Futures (Gill Cleeren)
  • Building Services with the Service Factory: Modeling Edition (Kurt Claeys)
  • .Net Code Protection (Sven Cipido)

The evening started with a 25 minute part of the openings keynote video. And at the end Peter Himschoot also gives a little example of the combination between Ajax and Silverlight.

Afterwards there was a bit of time to talk with everyone.  The comments that I heard where very positive.  So I hope Visug will organise it next year again. For me it was also a great experience, as this was my first external presentation I gave (I already had given presentation within my company).

All presentations and demos will be available at the Visug site later this week.

You can download my presentation here Best Of TechEd - SLPS.ppt (560 KB).

.Net | Visug
11/23/2007 9:36:02 AM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 
 Monday, April 30, 2007
In a previous post I wrote about how you could create a VS2005 template. I also told you that there was a problem when using multi-project templates. This can be solved by using the GAT tool to create your template. If you never heard about the Guidance Automation Toolkit (GAT) or the Guidance Automation Extensions, I would like to refer the Guidance Automation community site. You are probably wondering why I’m talking about two products. Let’s make it clear. First you have the Guidance Automation Extensions. This is the runtime and must be installed on every machine that will make use of Guidance Packages. The Guidance Automation Toolkit is only needed on the machines of the architects or lead-developers or the developers who will create the Guidance Packages. In this post I will provide you a solution for the problem with the multi-project templates
4/30/2007 2:40:02 PM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 
 Tuesday, April 17, 2007
In this chapter, we will show you how you can generate your NAnt build scripts. First we do it the manual way, but at the end you will see that we have a script, which automaticly creates our master.build scripts for all the projects we have defined in our script generator. There will be a follow up for this article in the next chapter to discuss the a few build scripts which are called from within this script.
4/17/2007 8:13:22 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Friday, April 13, 2007
In this chapter we will show you how we can add a project to our cruisecontrol.Net configuration file, so it will build our project. NAnt uses master.build files for building a project. In this chapter we show you also how this build file can be made.
4/13/2007 10:04:59 AM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 
 Tuesday, April 10, 2007

Finally the next part of my Buildserver article.  This time about the the project structure we are using.

First of all, let's see our project structure in Sourcesafe :

We can locate following folders:

  • Sources : Still in the project folder
  • BinIntern : The project compiled assemblies
  • BinExtern : external assemblies
  • Release : The officially deployed assemblies
  • Buildscripts: All the Cruisecontrol.net, Nant (MsBuild) scripts are located here. This folder has also a subfolder for each Visual Studio Project. In here you can find the master.build script for each project specifically.
  • Tools: All the correct versions of the tools (= the versions which are used in the scripts and sources).
  • Server and WebDashboard: Contains the configuration of CruiseControl.net like config files, projects, reports, style sheets…

This is it for this part.  Be sure to stayed tuned for the next part, as we will start with our first NAnt scripts.


Overview Buildserver chapters on my blog :

Chapter 1 : Introduction
Chapter 2 : CruiseControl.Net
Chapter 3 : Projects
Chapter 4 : Project Structure
Chapter 5 : NAnt and all our buildscripts

4/10/2007 8:13:40 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Friday, February 09, 2007

At this moment I’m busy with creating a windows service with following specifications:

  • Host a web service in this windows service without using IIS
  • On one site the communication uses TCP Sockets
  • On the other site the communication uses SOAP messages
  • Above all of this, the whole thing must work Asynchronous.

Yesterday in my RSS Feeds, I came to an interesting site for using this in ASP.Net.  Just follow this link http://gbarnett.org/archive/2007/02/08/asynchronous-programming-in-asp-net.aspx.

2/9/2007 9:33:34 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Monday, January 22, 2007

For the first time, Scott Guthrie will come to Belgium.

Read more and register @ the VISUG website.

.Net | News
1/22/2007 1:29:58 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Friday, January 05, 2007

This means that you can’t post values containing HTML or script tags.  So when you have an ASP.Net page with a textbox on it, and your users enters something like

And then the user press a submit button, they get this error.
More info about this can be found here.

Just change the page-directive on top of your page by adding the tag "validateRequest".  Set this tag to false and your users are able to add HTML tags in your textbox.

1/5/2007 10:21:40 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 

I got this error when accessing an ashx file, wich returns some data to me.  After trying to figure out what the problem is, I came to this solution.

It seems that .Net closes connections prior to it being finished.  I think it's a bug in .net which concerns me. 

Find a solution here : http://support.microsoft.com/default.aspx?scid=kb;EN-US;915599

1/5/2007 8:34:32 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Thursday, October 19, 2006

Here at the customer we are encountering a problem when calling our .Net web applications.  Many users are getting a HTTP 400 – Bad Request error (Request Header Too Long). 

After many investigations with other people who do not have this problem when connecting to the web applications, it seems that only users who are belonging to too many groups (>300) get this error.

Here are a few articles on this problem:
http://support.microsoft.com/kb/327825
http://support.microsoft.com/kb/269643/
http://support.microsoft.com/kb/263693/

After checking the workaround proposed in these articles (increasing the MaxTokenSize value to 65535), but it is already done on our workstations!  According these articles, "the token size to 65 KB allows a user to be present in more than 900 groups. Because of the associated SID information, this number may vary”.  In addition, the naming conventions used here for security groups do not help!

If you want to check in which group you belong, you can use following command in a DOS box:

ismember /list

If you want to know, the total groups use this command:

ismember /list|find "User" /c

For myself, at this moment, I belong to 478 groups.

At For the moment, we do not have a solution for this problem.

10/19/2006 4:53:45 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Monday, August 28, 2006

I had this problem almost a year ago, but finally I've written it down.

The problem I had (and sometimes other developers too) is that I don’t had administrator rights on my local PC.  So I called the people from security about this issue.  They were very helpful for this problem.  Step by step they upgrade my account with more rights and more rights (e.g. rights for the event log, rights for the registry…).  With a few of them I got a step further, but at the end I still haven’t enough rights to install the service.  The last step was to give the full administrator rights on my local PC and it’s just this step that I needed.  As following MSDN article states “Only processes with Administrator privileges are able to op handles to the Service Control Manager that can be used by the CreateService and LockServiceDatabase functions”.

So now we had a problem.  The security people came with two solutions:

  • Every time we need to send the new version to them and they will install it on the server. 
  • We got a second PC with administrator rights, but not connected to the network

Both solutions aren’t that great, but we choose for the second option.  Ones we had the PC, we add our accounts in the administrator group, so we could install the service with our account and we had network connection.

As you can see, in some cases administrator rights as a developer are important on your development machine.

Diederik Krols also blogged about this item, and he has a nice Bart Simpson chalk board about this, which I will include here also and maybe you need to give this picture to security people if you encountered the same problem ;-).

BTW: Dierderik was my scrum master/technical architect there and he helped me a lot with this issue.

8/28/2006 7:02:17 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Saturday, August 05, 2006

At my current project we came across the problem that we didn't receive our exception anymore but a TargetInvocationException.  After a little investigation we found where our exception was.  So here's a little explication about it.

When using reflection to create your assemblies, reflection will act like remoting.  So it will invoke your method.  Hereby we have a proxy and the stub.  The moment that in the stub an exception is thrown this exception will be wrapped in a TargetInvocationException.  To see the real exception you can take the innerexception of the exception.

8/5/2006 3:15:30 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Thursday, June 08, 2006

Projects in CruiseControl.Net

The CruiseControl.Net tasks are divided in ‘Projects’.  There are several kinds of projects.  This is a possible list of projects on the server :

  • The Continuous Integration Build of an application
  • The Deployment Build of an application
  • Automatic generation of buildscripts for the Visual Studio projects of an application

The technical project leader or the architect/designer could also define specific projects on the server.

 

e.g. only checking FxCop rules, or only run the unit testing,...

 

Projects are defined in the XML way in ccnet.config.  It just a list of projects defined one after the other one.  But keep in mind that those projects could be run parallel (and they will).

 

For each project you have to create a <Project> element with following attributes:

  • Name
  • Work folders
  • Links with source control
  • Running scripts.  These are Nant Targets who can be separated in activities
  • Triggers

The official documentation of the <Project> element can be found here .

 

Continuous Integration Build

It’s a good thing to analyze and describe each project in the first place in a Use Case.

 

After this, you are able to create a sequence diagram :

 

Basic configuration of a Continuous Integration Build project

Here we will describe the first step for our configuration.  It’s very basic.  We just at our project and source control.  We will add other features like tasks, publishers,... later on.

So first create a working directory for your build server.  We propose for this ‘c:\buildserver’.

Secondly we will add the project to the cruise control server.  To do this, open the ccnet.config file in the C:\Program Files\CruiseControl.NET\server directory.

<cruisecontrol>
    <project
        name="ProjectX"
        webURL="http:\\localhost\ccnet"
        workingDirectory="C:\Buildserver">
        <sourcecontrol type="vss" autoGetSource="true" applyLabel="false">
            <executable>C:\Program Files\Microsoft Visual SourceSafe\Common\Vss\template\win32\SS.EXE</executable>
            <project>$/Projects\ProjectX\xxxxx.ProjectX</project>
            <username>VSSUser</username>
            <password>VSSPws</password>
            <ssdir>\\path to VSS DB\SourceDB</ssdir>
            <workingDirectory>Buildserver\ProjectX</workingDirectory>
            <cleanCopy>true</cleanCopy>
        </sourcecontrol>
    </project>
</cruisecontrol>


 

Overview Buildserver chapters on my blog :

Chapter 1 : Introduction
Chapter 2 : CruiseControl.Net
Chapter 3 : Projects
Chapter 4 : Project Structure
Chapter 5 : NAnt and all our buildscripts

6/8/2006 8:07:00 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, May 16, 2006

At this moment I'm diving into Design Patterns and Business Objects.  Later I will blog more about these items, but now I just put down the resources I have at this moment:

I also have bought a few books:

  • Head First Design Patterns (Eric & Elisabeth Freeman), which I'm reading now.  This book has it's examples in Java, but that should be no problem.
  • Expert C#2005 Business Objects (Rockford LHotka)

At the project I'm working this moment, we are using Design Patterns like the state Machine Pattern.  We have created a base business object based on LHotka.  We have included the rule manager for broken rules of LHotka.  At last we also included the use of property bags (-Collections).  We have prepared the base in the first project.  All of this will be extended during the next projects.  We have seen that we have the need for some extensions, but have chosen for the pragmatic approach (also because of the project deadline ;-) ).

5/16/2006 8:43:39 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, May 02, 2006

First of all I want to thank Diederik Krols for his help with a few problems I had.

CruiseControl.Net

In this chapter we will explain more CruiseControl.Net and CCTray.Net.

Installation of CruiseControl.Net

Download the latest version at the Thoughtworks website.

Now run the downloaded file (CruiseControl.NET-1.1-Setup.exe) to install CruiseControl.Net.  Just follow the instruction on screen and leave all options as default.  At the end restart your server.

Here we have encountered a problem (only one time).  It seems that our virtual directory isn’t created during the installation phase.  The error we got was that the user and password wasn’t correct, but the installation continued.

This could be solved by manually adding the Virtual Directory.  To do so, follow the next steps:

  1. Open IIS
  2. Create a new virtual directory
    1. Name : ccnet
    2. Directory : the standard installation dir (C:\Program Files\CruiseControl.NET\webdashboard)
    3. Add in the default documents also default.aspx.

Next step is to start the ccNet service manually.  But keep in mind that when starting the service it will run under the local account.  This account doesn’t have network rights to connect to the SourceSafe DB.  So you must have an account with enough rights.  Because for test purpose we are installing everything on our local machine and we will use our own account for the service.  If installing on a server ask the security people for a correct account.

From now on you could access the web dashboard of CruiseControl.net:

Local host: http://localhost/ccnet/
Access from other computers: :/ccnet">http://<servername>:<portnumber>/ccnet

Installation of CCtray

CCTray is a small client application for the team members.  With this application, they can follow up the build progress and is visible in the windows tray. 

To install CCTray, you can go to the web dashboard; there you will find a link for downloading CCTray.  Download this file and run it for the installation.  Just follow the instructions on the screen.

The color of the icon changes depending on the status of the CuirseControl.Net server:

  •  : The most recent build was successful
  •  : The most recent build failed
  •  : The server is unavailable, or returned an error status
  •  : The server is currently building the code

Right-clicking on a project displays a popup menu:

  • Force build Wakes the CruiseControl.NET server from its sleep and tells it to start building immediately.
  • Display Web Page Opens a browser at the CruiseControl.NET build web page for this project. The web page may also be launched by double-clicking the project.

Tray Icons

The following rules are applied, in this order, to determine the icon color:

  • If at least one build is red, the icon is red
  • If no builds are red but at least one is yellow, the icon is yellow
  • If no build are red or yellow, but least one is grey, the icon is grey
  • If all the builds are green, the icon is green

Balloon notifications

Balloon notifications use the standard Windows tray icon popup balloon whenever a build completes. Balloon notifications may be enabled/disabled.

Configuration

Advanced

Two configuration settings can be adjusted only by editing the configuration file directly:

  • Balloon messages
  • Icons

This is done in the cctray-settings.xml file.

Projects

After starting up CCTray doesn’t contain any projects.

You have to fill in your own projects.  To this follow these steps:

  1. Go to File - Settings
  2. At the bottom you will find the Build Servers section.  Here you can add your build servers and projects.  Click on the add button.
  3. Fill in the server with port number (ex: Servername:21234) and click Add Server.  No you will see a list of projects on this server.
  4. Choose your project and click OK.

Now you’re back in the setting screen of CCTray.  You will see that in the build server section, the selected project is visible.

Click on the OK button for leaving this screen.  You’re back on the main screen of CCTray.  And you see that the projects are also added here.

So this is it for this part.  In the next part we will describe how to add your VS 2003 projects in CruiseControl.Net with a Continuous Integration Build configuration.  In part 4 we will talk about using NAnt for our projects.


 

Overview Buildserver chapters on my blog :

Chapter 1 : Introduction
Chapter 2 : CruiseControl.Net
Chapter 3 : Projects
Chapter 4 : Project Structure
Chapter 5 : NAnt and all our buildscripts

5/2/2006 8:34:55 PM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 

I had to explain to a junior developer why using select * is a bad practice.
Well, I had a few reasons for it and after searching the net for more, here’s a list of the top 8 reasons:

    1. By selecting only the fields that you want you don't return any superfluous fields. This results in an immediate speed increase. Suppose we wish to create a drop down select box. To do this we really only need to the information from the first two fields (CustomerID and CustomerName). However, if we use SELECT * then we are pulling all the information for each customer from the database as we write each record, even if we don't need it (i.e. we are pulling data in the CustomerAddress and CustomerComments fields even though we don't need this information). By only selecting the fields we need we reduce the amount of data pulled from the database and thus speed up our application.
    2. At some point in time you'll want to look at using the Recordset Object's .getRows() method to convert a recordset into an array and close your recordset objects earlier. However you will not be able to do this effectively unless you know which fields correspond to which array elements (which requires you to enumerate the fields in the SELECT statement).
    3. At some point you will also look at using the Recordset Object's .getString() method which is even faster than the .getRows() method for returning recordsets to the screen. If you use SELECT * you will have no control over the order in which columns are displayed on the screen.
    4. If you have Access Memo type fields, or SQL Server Text type fields these need to be selected last in your SQL statement, otherwise you will start to run into the problem where these records either do not appear on the screen, or are truncated (see Microsoft's KB article: Q200124).
    5. SELECT * is lazy coding practice. It's probably best to start with good habits early. As well the old saying of "a stitch in time saves nine" is very true. Imagine having to trawl through a 1000 line ASP page that you coded 6 months ago trying to find all the fields you used to edit a SELECT statement at the top of the page. Then imagine doing this for 1000 pages! Better to do it right the first time.
    6. This last point is not a fact, but merely supposition at this point in time. I've heard that if you do SELECT * the database needs to find out what fields are actually in the table before it can then select them all. By specifying the field names the database engine can use those names straight away rather than having to do an extra lookup. However there is very little evidence on the web to say one way or the other.
    7. You need to find errors as soon as possible.  So when a column is deleted, you will get the error directly and not somewhere later in your code.
    8. Interface like programming or program by contract.  Your columns are like the interface.  You define what can be used.

A small example with some time figures can be found here : http://www.tom-muck.com/blog/index.cfm?newsid=36

5/2/2006 7:34:12 PM (Romance Standard Time, UTC+01:00)  #    Comments [7]  | 
 Thursday, March 30, 2006

Introduction

At this moment I have installed the first part of a build server for the customer I’m working at the moment.  We are using VS.Net 2003.

We have installed a Continuous Integration Build server.  The first part exists only of following steps:

  • Get latest version of SourceSafe
  • Build de solution
  • If necessary, create the IIS Virtual Directory

Somewhere in April, I’m going to add several tools to the build process:

  • nDepend
  • nUnit
  • FxCop
  • Simian

As for the build server itself, we use NAnt.  For our source control system we use Microsoft’s Visual Source Safe.
So stay tuned, as I will try to write down all my experience and how to set up a build server.  It will be in several parts and sometimes a file must be changed again.

At the moment we have following versions:

  • Microsoft Visual Studio .Net 2003
  • Microsoft Visual Source Safe : 6.0d
  • NAnt : 0.85 RC3
  • NAnt Contrib : 0.85 RC3
  • Cruise Control.Net : 1.1
  • CCTray : 1.1


Overview Buildserver chapters on my blog :

Chapter 1 : Introduction
Chapter 2 : CruiseControl.Net
Chapter 3 : Projects
Chapter 4 : Project Structure
Chapter 5 : NAnt and all our buildscripts

3/30/2006 9:23:09 PM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 
 Monday, February 20, 2006
We have encountered a problem when regenerating our dataset (or even rebuilden the project/solution) This was the situation
  • Project is in SourceSafe
  • We checked out our dataset file
  • Following files are included:
    • Dataset.xsd
    • Dataset.vb
    • Dataset.xsx
  • Make changes to the dataset
  • Run custom tool
  • Now we have following files
    • Dataset.xsd
    • Dataset1.vb
    • Dataset.xsx
As you can see our VB file has another name.When viewing the source code the class name is correct.This is because the vb-file isn't checked out (a bug in Visual Studio .Net 2003?) and you can't checkout the file anymore because for Visual Studio it's already checked out. To solve this, follow the next steps
  • Delete the vb-file from your solution
  • Save the solution
  • Close the solution
  • Go to explorer en locate your files
  • Delete here also the vb-file.You will get a warning about the read-only state.
  • Go to the project file
  • Search for your dataset
  • Delete the line "LastGenOutput = "DataSet1.vb"
  • Reopen your solution
  • Run again the custom tool

After this the situation will be back normal, so these files are included:

  • Dataset.xsd
  • Dataset.vb
  • Dataset.xsx
2/20/2006 8:04:58 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Wednesday, December 07, 2005

Just found out (See Post of Diederik Krols): The great free Paint replacement tool Paint.Net has released a new version. 

Go to the official site of Paint.Net.

12/7/2005 8:40:46 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Monday, November 14, 2005

Last Thursday (10 November 2005), I went to the Belgium Launch party of Visual Studio .Net 2005, SQL Server 2005 and BizTalk Server 2006.  The place to be was Court-St-Etienne.

There where a few speakers :
· Keynote by S. Somasegar, Corporate Vice President, Microsoft Corporation
· Session 1 : Clemens Vasters, Chief Technology Officer, Newtelligence AG
· Session 2 : Astrid Hackenberg Trainer and advisor SQL Server, Class-A

Mr Somasegar did the kick-off the Belux Launch of SQL Server 2005, Visual Studio 2005 and BizTalk Server 2006

Session 1 gives us an insight in the new capabilities of Visual Studio 2005.  Session 2 presents us the new world of SQL Server 2005.

In between the sessions there where some great shows, to keep everybody ready.  Afterwards we had a walking dinner party.  And we closed the day with a great dance event.  I left the party around 12 o’clock in the night.  And still a few people (10-20) where partying. 

On the Launch site of Microsoft, you can find some pictures.  Go and see them.

11/14/2005 8:22:56 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 

In the MSDN Belux Flash & Events - Volume 9, Number 22, I found following "nice to have" tools:

The Internet Explorer Developer Toolbar.  A must have for web developers.  This toolbar provides you several features like:

  • Exploring the DOM
  • Viewing HTML object details
  • Validating HTML
  • ....

http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en

Snippy - Visual Studio Code Snippet Editor.  A code editor for Visual Studio 2005.  Snippy can be used to add new snippets or to modify previous created snippets.

http://www.gotdotnet.com/codegallery/codegallery.aspx?id=b0813ae7-466a-43c2-b2ad-f87e4ee6bc39

 

.Net | Common | News
11/14/2005 8:07:10 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Monday, October 24, 2005

Today and tomorrow I'm following the master classes for Visual Studio Team System @ the headquarters of Microsoft Belgium in Diegem.

Today we first got an overview and then we learn about the team projects and processes, how to manage a successful project and the application design with Team System. 

This was the first time I worked by myself with Team System, although I already had seen a few sessions.  Just had to play more with it, but at this moment this seems a great tool.  I hope I can find some project templates to use the Scrum methodology in Team System, otherwise we would have a lot of work to create our own templates (or modify an existing one). 

Tomorrow we will learn about Software Configuration Management, Tools fro writing Quality code, Enterprise instrumentation an testing and finally about Process Customization.  So it will be again very interesting.

10/24/2005 6:48:11 PM (Romance Standard Time, UTC+01:00)  #    Comments [3]  | 
 Wednesday, February 16, 2005

Yep, I know.  It's already announced for a while and by several other bloggers.  But OK.  Here is my announcement.

Get a one day event of the latest version of ASP.Net.  More info can be found @ the MSDN Belux site.

.Net | Common | News
2/16/2005 11:00:32 AM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 
 Thursday, February 10, 2005

Today I'm for two days @ U2U.  I'm following the course MS2030A "Creating Reporting Solutions Using Microsoft SQL Server 2000 Reporting Services".  Our teacher is Nico Jacobs.

.Net | Common | Personal
2/10/2005 9:14:53 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Friday, February 04, 2005

Another interresting webcast (Thanks Rudi) for HIS.  If you develop applications who uses a connection with the AS/400, then watch this session.  In here you will learn more about Microsoft and 3rd party solutions for adding the functionality.

More info here.

.Net | HIS
2/4/2005 6:49:53 PM (Romance Standard Time, UTC+01:00)  #    Comments [2]  | 
 Thursday, January 20, 2005

OK, As promised in the previous part, I will give you the solution we used in our project to upload files.

Because, there's also a MS Access client, we have decide to upload our files to a network drive.  The MS Access programmers told us that they couldn't handle the large fields.  Now we had another problem.  Standard we don't have any authorization to write files on a network drive.  We could write only files on our own server.  So looking for a solution for this, I came accross Impersonation.  It seems that we can take over the identity of another user during the run of our upload page.  You can find all the info here.

Now we can open the upload page, and take the identity of a Functional Account, upload our file to the shared dir on the network, close the page and taken back the ASP worker identity.

A bit of code :

WindowsPrincipal p = (WindowsPrincipal)HttpContext.Current.User;
WindowsIdentity id = (WindowsIdentity)p.Identity;

Response.Output.Write("<h2>Process running as {0}</h2>", WindowsIdentity.GetCurrent().Name);

// impersonate temporarily
WindowsImpersonationContext wic = id.Impersonate();
try {
  // do some work while impersonating the client
  Response.Output.Write("<h2>Now impersonating {0}</h2>",WindowsIdentity.GetCurrent().Name);
}
finally {
  // restore our old security context
    wic.Undo();
}
Response.Output.Write("<h2>Once again running as {0}</h2>",WindowsIdentity.GetCurrent().Name);

1/20/2005 10:06:51 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 

Several new webcast are coming out this month and next month.  There are also webcasts for HIS 2004.  Here is some more info :

TechNet Webcast: HIS Bi-directional Transaction and Data Inter-op Between Windows and IBM Mainframe Systems (Level 200)

Thursday, February 03, 2005 - 11:30 AM - 1:00 PM Pacific Time

Stan Murawski, Technical Mainframe Evangelist, Microsoft Corporation

This webcast demonstrates the peer level inter-operation capabilities provided by Microsoft Host Integration Server (HIS) 2004, where a program on either system can use the other as a database or transaction server. Programs running on either side can call programs on the other, within the context of a transaction. Either system can be a database server to the other. Join this webcast to find out all about it.

http://go.microsoft.com/fwlink/?LinkId=39961

TechNet Webcast: Security Integration between Windows and IBM Mainframes (Level 200)

Thursday, February 10, 2005 - 11:00 AM - 12:30 PM Pacific Time

Stan Murawski, Technical Mainframe Evangelist, Microsoft

This webcast introduces the mainframe professional to security on the Windows Server System. Join this webcast to learn how to integrate security   including end-user single sign-on between Windows and IBM OS/390 and zSeries Operating Systems.

http://go.microsoft.com/fwlink/?LinkId=39965

Thanks to Microsoft for the info.

.Net | HIS
1/20/2005 8:18:04 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Thursday, January 13, 2005

When you want to have tabs on your ASP.Net page, you don't have a standard webcontrol in Visual Studio .Net. But Microsoft offers a solution in the MSDN. In the MSDN you can find a topic about Internet Explorer Webcontrols. These selection controls exists of :

  • Treeview
  • Toolbar
  • Tabstrip and Multipage

You can download these controls here.

The tabstrip

The tabstrip can be used for a tabbed layout/menu on your ASP.Net page. In combination with the multipage, we got a powerfull control which can be used to render your pageview whenever a tab is selected. We can show the content of a page, without navigation to another page.

The tabstrip implements server- and client-side objects, therefor the tabstrip offers two modes of authoring.

  • Tabstrip server-side controls : Tabstrip interfaces can be implemented using the elements and objects exposed by the Tabstrip server-side controls.
  • Tabstrip behavior : Tabstrip interfaces can also be written in HTML using the Tabstrip behavior.
In both cases the same set of elements is used, but due the differences in the architecture the models are a bit different. The best is, when the browser is not known, to use server side controls. When you know that IE 5.5 or later will be used, you better use the Tabstrip behavior. The advantge is that there will be a fatser donwload, because server-side processing is avoided.

Tabstrip objects

The Tabstrip has 3 objects :

Client Behavior

ASP.NET

Description

TabStrip TabStrip A container element for other TabStrip elements
Tab Tab Defines a tab element within a TabStrip control
TabSeparator TabSeparator Defines a separator element, which is placed between two adjacent Tab control

Customization

The tabstrip offers a few features :

  • Text based tabs : Is automatiscly available. you focus only on the text content of the tab. You can use CSS.
  • Picture-based tabs : you want the control (full or partial) over the tab, or you want to add graphical items to your tab.
  • Orientation : You can decide to use vertical or horizontal tabs.

Also for formatting there are some features :

  • Default : This state is active when the tab is not selected and the no mouse is going over the tab
  • Selected : This state is active when a tab is selected
  • Hover : This state is used when the mouse is moving over the tab

Multipage or not

You can use multipages on your tabs. This control is also available in the internet web controls.

With multipage

This is most used possibility. You define your tabstrip and your items for each tabstrip using the multipage control.

Without multipage

When using this method, you need to use the SelectedIndex property of the tabstrip so you could naviagte to other Web pages.

Example

<mytab:TabStrip id="tsHoriz" runat="server" Style="FONT-WEIGHT:bold" TabDefaultStyle="border:solid 1px black;background:#dddddd; padding-left:5px;padding-right:5px;" TabHoverStyle="color:red" TabSelectedStyle="border:solid 1px black;border-bottom:none; background:white;padding-left:5px;padding-right:5px;" SepDefaultStyle="border-bottom:solid 1px #000000;" TargetID="mpHoriz"> 
    <mytab:Tab Text="Info" />
    <mytab:TabSeparator />
    <mytab:Tab Text="Address" />
    <mytab:TabSeparator />
    <mytab:Tab Text="Hobby's" />
    <mytab:TabSeparator />
</mytab:TabStrip>

<mytab:MultiPage id="mpHoriz" runat="server" Style="BORDER-RIGHT:#000000 1px solid; PADDING-RIGHT:5px; BORDER-TOP:medium none; PADDING-LEFT:5px; PADDING-BOTTOM:5px; BORDER-LEFT:#000000 1px solid; PADDING-TOP:5px; BORDER-BOTTOM:#000000 1px solid" Height="150">
    <mytab:PageView> 
        <table> 
            <tr> 
                <td>Name </td> 
                <td><asp:TextBox id="Textbox1" runat="server"></asp:TextBox> </td> 
            </tr> 
            <tr> 
                <td>Prename </td> 
                <td> <asp:TextBox id="Textbox2" runat="server"></asp:TextBox> </td> 
            </tr> 
        </table> 
    </mytab:PageView> 
    <mytab:PageView> 
        <table> 
            <tr> 
                <td>Street + Nr </td> 
                <td> <asp:TextBox id="Textbox3" runat="server"></asp:TextBox> </td> 
            </tr> 
            <tr> 
                <td>Postcode </td> 
                <td> <asp:TextBox id="Textbox4" runat="server"></asp:TextBox> </td> 
            </tr> 
            <tr> 
                <td>City </td> 
                <td> <asp:TextBox id="Textbox5" runat="server"></asp:TextBox> </td> 
            </tr> 
        </table> 
    </mytab:PageView> 
    <mytab:PageView> 
        <table> 
            <tr> 
                <td>Hobby's </td> 
                <td> <asp:TextBox id="Hobby1" runat="server"></asp:TextBox> </td> 
            </tr> 
            <tr> 
                <td> </td> 
                <td> <asp:TextBox id="Hobby2" runat="server"></asp:TextBox> </td> 
            </tr> 
            <tr> 
                    <td> </td> 
                    <td> <asp:TextBox id="Hobby3" runat="server"></asp:TextBox> </td> 
            </tr> 
            <tr> 
                    <td> </td> 
                    <td> <asp:TextBox id="Hobby4" runat="server"></asp:TextBox> </td> 
            </tr> 
        </table> 
    </mytab:PageView>
</mytab:MultiPage>

Personnaly I use the tabstrip with Multipage. In this multipage I put my own usercontrols. The reason is, to modify you tabstrip content is easier when using user controls, than putting the content directly on the multipage. With the last way of programming you must change everything thourgh code, because you can't reach teh content in design view.

One note : These controls are not currently supported by Microsoft !!

1/13/2005 8:39:07 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, December 21, 2004

For my current project the user can select a file for uploading to a network drive.  First of all, the network drive is outside the web server.  So this could give us troubles with security.  The reason for this is that there is an MSAccess application which doing the same.  And if possible we must provide a solution with the most little reprogramming in the MSAccess application.

The customer asked us to create a pilot with several possibilities.

So the first thing we did was creating just an upload component, which will save the file in a directory on the web server.  This is very easy.  Just put the HTMLInput control on your site (Remark: This is a standard HTML control). 

<input type="file" id="MyFile" runat="server" NAME="MyFile" />

In the click event you can use the FileName property of HTMLInput control.

string strFileName = MyFile.PostedFile.FileName;
strFileName = System.IO.Path.GetFileName(strFileName);


Now you can use the save method:

MyFile.PostedFile.SaveAs(Server.MapPath("./") + strFileName);

And done.

For more info see also at the MSDN article How To Upload a File to a Web Server in ASP.NET by Using Visual C# .NET.

You can use this principle also for multiple file upload:
We put also a listbox on the screen, where the selected files are visible for the user.  When pressing the upload button, the system will upload all files one by one.
Be aware : What really happens is that when choosing a file with the HTMLInput control, and we press the button to add this file to our list of files, we have a roundtrip to the server.  Also the file is already uploaded to a temporary directory.  You see this very well in following situation:

 - Take two large files (10 MB or so)
 - Select the first and press add to list
 - The systems will add this file in our list, but this takes some time
 - Select the second file and press add to list
 - The systems will also add this file in our list, but this takes some time
 - Now press the upload button, and the system is done immediately.

See later for bigger files, because there's a limitation.


Because we use an Oracle DB, we looked for another solution: Blob fields.
These fields are form the type "base64Binary", and can contains anything (textfiles, images, word documents, ...).

To save your data in a blob field, you must use streaming.  The same for reading the blobfield.

FileStream fs = new FileStream(@uploadFile, FileMode.OpenOrCreate, FileAccess.Read);
byte[] MyData= new byte[fs.Length];
fs.Read(MyData, 0, System.Convert.ToInt32(fs.Length));

fs.Close();

Now you can write MyData in your table field.

The same way for reading :

byte[] MyData= new byte[0];

<Here you put the tablefield content in MyData.

int ArraySize = new int();
ArraySize = MyData.GetUpperBound(0);

FileStream fs = new FileStream(@"C:\temp\" + fName.Text.ToString(), FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(MyData, 0,ArraySize);
fs.Close();

All this is perfectly described at the MSDN article How To Read and Write BLOB Data by Using ADO.NET with Visual C# .NET (although this with using SQLServer).

Uploading larger files
Except when using the Blob fields, we have by default a limitation to upload files not bigger then 4,096 kilobytes.  When you want to upload bigger files you have to change the maxRequestLength parameter of the httpRuntime section in the web.config file.

When you want to change this for all your applications, you can modify the Machine.config (Located in the \System Root\Microsoft.NET\Framework\Version Number\CONFIG directory).  Be sure not to set this parameter too low.  This because when the file is bigger, IE will display cannot find server or DNS" error message.  You cannot use a custom error page.  While looking for this, I came across an article on developer.com which provide a solution so you could give a custom error message.  You can find the article here.

As sson as I know what solution we will implement to save the file on a netwrok drive, I will update this article.

12/21/2004 3:02:55 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, December 07, 2004

I just came across the following problem : A colleague of me has created a server control.  After dropping this control on my ASP.Net page, following line of code is added to the generated code section :

protected <assembly> <controlname On form>;

When compiling we got following error :

"page.aspx.cs(19): Type of '<control>' is not CLS-compliant"

My colleague doesn't receive this message.  At first, just to have a quick, working solution, we put following line above every line :

[CLSCompliant(false)]

In this case, my project compiles and I could put it on the test server.  A few days later, I had some time to look deeper into this problem.

It seems that to make an assembly CLS Compliant, your 3-letter mnemonics must be Pascal case (Only 2 characters are all uppercase).  Also several checks are done :

  • Class and member names cannot differ only by case. For example, you can't have one  property named Counter and another named counter. This is important for cross-language compatibility since VB .NET isn't case sensitive.
  • Overloaded class methods cannot differ only by out or ref parameter designations.
  • Publicly exposed members cannot start with an underscore ( _ ).
  • Operators can't be overloaded
  • Unsigned types can't be part of the public interface of a class


The reason why my colleague doesn't need the CLS compliant = false in his code, is because he has the code of the server control in his project.

To solve my problem : He just need to add set the attribute [assembly: CLSCompliant(true)]. 

When this is done, and I have the new DLL, I can delete the line to set the CLS Compliant false.  So an easy solution.  Also if this attribute isn't set, It's possible that the control can't be used within any .Net language.

Remark : When using VB.Net, you are lucky because VB.Net doesn't check for  the CLS Compliance.

12/7/2004 1:23:19 PM (Romance Standard Time, UTC+01:00)  #    Comments [2]  | 
 Tuesday, November 16, 2004

After my entry about the conversion tools from C# to vb.net, I just found a tool from Tangible Software Solutions to convert vb.net to c#.

I don't have tried this tool at the moment, but you can donwload a demo.  You can buy a full version.

11/16/2004 3:13:23 PM (Romance Standard Time, UTC+01:00)  #    Comments [2]  | 
 Friday, October 15, 2004

At this moment I'm busy with an ASP.Net application in C#, for a customer. We came across the problem that we need to save the Dataset information on the client side, because otherwise we always need a round trip to the server and that's something we don't want tot do. The data need to be saved contains maximum around 20 records. State management will do this for us.

State management involves storing temporary information that is important to the current users. It only applies to web applications that need to keep track of users, authorization and page flow.

State management information is information that is only needed temporarily to enable the system’s functionality. It is not ‘permanent data’ as with e.g. databases. State management be divided into three components:

  • Information about the current session for a single user
  • Information about the web application for all users\
  • Information about page flow and page data Several options are possible.

We will write them down with the advantages/disadventages.

Sessions info

Quick guidelines

  • Restrict ViewState information to non-sensitive data that is needed on one page only
  • When using the Session object, preferably use objects that are serializable as these objects can be migrated to other session state variants
  • Use InProc session state for simple web applications
  • When possible, use session state with server affinity for a web farm
  • Use server session state or database session state for web farms where server affinity is not possible

ViewState

ViewState is a system where data is encoded and sent along as HTML towards the client and subsequently returned with the next request. The information is visible as encoded text in the web page’s source. ViewState is supported by .Net server controls and can be custom-implemented. ViewState operates fully stateless, eliminating the need to store data on the web server. Since extra information is sent to the client and back to the server, possible performance issues may arise.

Pro:

  • No server resources are used · Fully stateless, so easily scalable
  • Easy implementation

Contra:

  • Large amounts of data transport between client and server may cause performance issues
  • Problems may arise regarding security because sensitive information is passed on
  • ViewState cannot be used to enable information interchange between pages

InProc Session State

InProc session state is a system where session data is kept in a Session object. This object is managed in the server’s memory.

Pro:

  • Easy implementation
  • Expandable towards other session state variants (in principle)
  • The Session object is available throughout application

Contra 

  • Session data takes up server resources
  • Not readily scalable to multiple machines

Session state with server Affinity

Session state with server affinity involves keeping data in a Session object. This object is managed in the server’s memory. The server affinity will cause a subsequent request to be routed to always the same server, solving the problem of scalability.

Pro:

  • Easy implementation from the developer’s point of view (no extra effort needed)\
  • The Session object can be used for multiple machines
  • The Session object is available throughout the application

Contra:

  • External configuration of the server environment is needed
  • Session data takes up server resources

Session State Server

A session state server is a system that keeps data in the memory of a specially installed server. This server is accessible for all other servers within a web farm. Actions may be performed on the Session object from within the web application, implicitly making use of the state server.

Pro:

  • Easy implementation from the developer’s point of view
  • Scalable to multiple machines
  • Configurable through configuration files

Contra:

  • Data must be serializable
  • Requires a specially equipped machine
  • Performance is lower compared with a standard session object

Database Session State

Database session state involves keeping data as serialized data in a dedicated SQL Server database.

Pro:

  • Easy implementation from the developer’s point of view 
  • Scalable to multiple machines 
  • Configurable through configuration files

Contra:

  • Data must be serializable 
  • Only possible in combination with SQL Server 
  • Performance is lower compared with a standard session object

Application info

Quick guidelines

Application information is general data intended for all users. No session data or data that is to be shared between pages is involved.

  • When working with application state, use infrequently changed serializable data as much as possible
  • When possible, use caching as this eventually frees resources
  • Use the Application object when data is to be continually present
  • Never use static variables for application state

The Application Object

For each web application, there are situations where you want to share information with all of its users. Application state is a system where such data is maintained within an Application object. This object is kept in the server’s memory.

Pro:

  • Easy implementation
  • Application state variables are accessible throughout the application to all users

Contra:

  • Data is not persistent. Application data is lost in case of a fatal hardware or software failure
  • Application data takes up server resources
  • There is no guarantee that application state data is unique within a web garden or web farm environment, since this data is not shared · Within a multi-threaded environment, locking is to be implemented to prevent deadlocks and access violations

Static Variables

Within a web server, static variables are available to all web pages. These variables can be easily approached by all code.

Pro:

  • All Application object advantages apply here as well

Contra:

  • No guarantee that data is still present when calling upon it
  • Potential issues with the ASP.Net standard multi-threading system
  • Frequent re-starting of the application may cause problems in the application’s development phase

The Cache Object

ASP.Net supports the Cache object, where information may be stored that is needed for a certain amount of time.

Pro: 

  • Data may be cleared after a certain amount of inactivity

Contra:

  • It may be possible that data has to be re-fetched as this object has automatic management

Inter-page state

Quick guidelines

In a web application the situation frequently arises that data that is entered or present on a given page is to be passed onto another. This phenomenon is different from session state because this data is only needed in memory at the moment of page transfer.

  • Use the Server.Transfer method and HTTPContext to transfer state between pages
  • Use query strings for simple data that does not have to be secure
  • Use a single, compound page for a ‘wizard’-like solution
  • Use session state when all other options are out
  • Avoid using cookies to store inter-page state

Compound Pages using ViewState

A compound page is a single page that has been divided into several sections. This page may function as a ‘wizard’, where different sections of a page are shown piece by piece. This way, the information of the ‘previous page’ (in reality, the previous section of the same page) is available through ViewState.

Pro: 

  • Ease of use

Contra: 

  • Only suitable for wizard-like applications
  • Lower performance because all sections are loaded, even when they are not visible

Session State

The Session object may also be used to transfer state between pages. When re-posting the page, new information may be placed in the Session object and control may be released to another page (by means of the Response.Redirect or Server.Transfer methods). On loading, the target page may obtain the information from the Session object.

Pro: 

  • Ease of use

Contra:

  • There is no guarantee that the desired information is present in the Session object. Validation is necessary to check this
  • The information is not type-safe 
  • During the time-out period, the data remains available, unnecessarily taking up server resources 
  • A Response.Redict results in an extra round trip

Query String

This is a method in which arguments are passed on to the target page by adding text to the URL.

Pro: 

  • Easy implementation 
  • No server resources are required

Contra: 

  • The amount of data that may be passed on is limited
  • The data is visible in the browser and can be modified by the user. This may cause security issues
  • Provokes the use of client-side scripting · Only works with HTTP Get requests

Using server.transfer and httpcontext

This technique involves a page performing a HTTP Post request to itself and redirecting this request to another page through the server by means of the Server.Transfer method. At this new page, the old one is still visible through Context.Handler. Moreover, arguments may be passed on using the Items collection of HttpContext.Current.

Pro: 

  • Makes type-safe passing-on of arguments possible
  • Not dependent on server or client state
  • No redirect to the client necessary

Contra: 

  • Complex implementation
  • The URL shown in the browser does not match the page shown in its window

Cookies

Cookies allow for storing small amounts of information at the client. No data is passed on between pages, but information is centrally available to all pages. This makes information sharing between pages possible.

Pro: 

  • No server resources needed
  • Easy implementation 
  • Configurable expiration 
  • Also suitable for fixed HTML that contains no server functionality

Contra: 

  • The amount of data is restricted to a maximum of 8192 bytes (8 kilobytes) per cookie
  • Data is visible to and modifiable by the client, making it a security risk
  • A client may refuse or delete cookies
  • Fixed HTML without server functionality will need client-side scripting to be able to read cookies

We have choosen for the Cache object. 

References

- Visual Basic and Visual C# ConceptsState Management Recommendations
- Caching Architecture Guide for .Net Framework Applications

10/15/2004 2:41:57 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, October 05, 2004

At this moment I'm busy with the second part of my DAAB description, to implement the Oracle driver.  But now a short overview about the Model View Controller.

What's the problem ?

How do you modularize the user interface of a Web application so that you can easily modify the individual parts?

Other items :

  • User Interface changes more than business logic
  • Display info in several ways
  • User Interface consists of 2 parts : Presentation and update
  • User Interface depends on the device, than the business logic
  • Developing the User Interface or the Business Logic takes 2 different skills
The solution :

The Model View Controller (MVC) pattern.  This pattern separates the presentation and the actions based on user inputs in 3 separate classes :

  • Model : Managing of data, responding to information requests, responds to instructions
  • View : Manages the information displaying
  • Controller : interprets the mouse and keyboard inputs, and informed the model/view

 

 

Good to know is that both the view and the controller depends on the model.  But not visa versa. 

There are several variations of the MVC :

  • Passive model
  • Active model
The Passive Model :

This model is employed when one controller manipulates the model exclusively.  The controller modifies the model and then informs the view that the model has been changed.  Now the view knows that he must refresh himself.

 

The Active Model :

This model is used when the model changes states without the controller's involvement.

 

Microsoft did a good way with their example "Implementing Model-View-Controller in ASP.NET".  This pattern is the fundation for further, more specialized patterns like Page Controller and Front Controller.

The example starts with everything in one page and finally gives the good solution on how to build the MVC in ASP.Net. But... Yes your read it good.  I have my thoughts with this example.

When reading about the MVC, I came to the conclusion that the solution of Microsoft isn't really a translation of what they said in the theory about MVC.  SO when searching on the internet, I came across the blog of Mads Nissen, who did in 2003 a nice translation from the theoretical part to the practical part.  Read this article and go to the GotDotNet community to download the example.

More info can be found :

 

10/5/2004 7:11:06 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, September 28, 2004

Since last week Host Integration Server 2004 is available. What is HIS.  HIS will integrate IBM Host applications and data sources with new solutions developed using .Net.

Get more info here.

<Commercial Talk>
          When you have a project in your company (Belgium and The Netherlands), you can
          always contact the company I work for.
          We already have succefully implemented HIS 2004 for customers.
</Commercial Talk>

.Net | HIS | News
9/28/2004 7:00:31 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Thursday, September 23, 2004

Here is the first part of the Application Code Blocks.  In this part, we will give you a theoretical overview of the Data Access Application Block (DAAB) (Based of what I found for reading on the sites in the resources paragraph).  After this examination, we will add a second part, where we will change the DAAB for use with the Oracle DB.  After this, we will put a short overview of real life experience with our modified DAAB.

What is DAAB?

The Database Access Application Block is a .Net component that has optimized code on board to access your database.  Till version 2, this is only for a SQL database.  The component returns SqlDataReader, Dataset and XmlReader objects.

Download, what's included and user requirements?

You can download DAAB from the download center of Microsoft

After you download and installed the component, you will find a new menu under "start --> programs”: Microsoft Application Blocks for .NET.  Under this menu you will find:

  • The VS.Net project files
  • The documentation

Be sure that you have following requirements when running the DAAB version 2:

  • Win 2000 / Win XP / Win 2003
  • .Net Framework SDK 1.1
  • VS.net 2003
  • SQL Server 7.0 or later
Why using DAAB?

You have the traditional Data Access to applications (including web).  That Data Access can be from different sources:

  • Traditional RDBMS (MS SQL, Oracle, ...)
  • Custom Data Store (XML file, flat file, ...)

Using this, often leads to redundant, repeated code, which can be written by experienced developers in their sleep.  In this case the code repetition increase the change for a bug in the code.  And it cost time.  We can say that a typical Data Access can be split up in several parts:

  • Specify the query
  • Create connection object
  • Create command object
  • Add parameters if necessary
  • For a DataReader use ExecuteReader()
    For DataSets or DataTables use a DataAdapter and its Fill() method
  • Bind the control to the DataReader/DataSet/DataTable
  • Close DataReader, Connection

The solution is encapsulation or better-called wrapped classes.  Most of you will use a framework or has written their own wrapper.  Our wrapper could have step 1 till 5 included.
Another solution is to use the DAAB.

Graphical overview:


Basic procedure:
  • Download the application block from the MSDN site 
  • Navigate in your 'start menu --> program files' to "Microsoft Application Blocks for .Net", select "data access" and select the language of your choice.
  • The Application Block Project will open.  Build this project.
  • Once you got the assembly, do following in your project:
  • Add reference to "Microsoft.ApplicationBlocks.data.dll"
  • Add Using (C#) or Imports (VB.Net) for the "Microsoft.ApplicationBlocks.data.dll","System.Data" and "System.Data.SQLClient"

Be aware: If creating an ASP.Net project you has to do following steps:

  • Copy the DAAB Assembly to your web application's "/Bin" dir
  • In the ASP.net web page where you need DAAB add : <%@ Import Namespace=“Microsoft.ApplicationBlocks.Data” %>
Extensive Use of DAAB:

After installing and implementing the DAAB, you got the SqlHelper and SqlHelperParameterCache available in your application. 

The SQLHelper class provides us static methods, while SqlHelperParameterCache is used to improve performance. 

The SQLHelper class:

The SQLHelper provides us with 13 methods we can use (for a complete list, see the MSDN DAAB section - SqlHelper Class Implementation Details).  Each method has it's set of overloads.  This gives the developer all the flexibility how they want to access the data and how they want to pass the connection string, transaction and parameters.

We will show an example.

The Execute reader:

Normally you would write this kind of code :

SqlConnection myConnection = new SqlConnection(connString);

const string strSQL = "SELECT CustomerID, CustomerName FROM Customers ORDER BY CustomerName";
   
SqlCommand myCommand = new SqlCommand(strSQL, myConnection);

myConnection.Open();
SqlDataReader reader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

When using DAAB, we could reduce the code to this:

const string strSQL = "SELECT CustomerID, CustomerName FROM Customers ORDER BY CustomerName";

SqlDataReader reader = SqlHelper.ExecuteReader(connString, CommandType.Text, strSQL);

Know that the every method has it's own set of overloaded method. For example: the ExecuteReader has also a method where you could pass an already open connection,...  Also you have other related methods, like:

  • Executing non-returning queries (Update/insert/...)
  • Executing scalar-returning queries
  • ...

These related methods, have also the overloaded options as the ExecuteReader().

Parameterize:

We can use parameters with the DAAB.  DAAB accepts two kinds of parameters:

  • Explicit sqlparameter Instances
      example:
        dgOrders.DataSource = SqlHelper.ExecuteDataset(connString, CommandType.Text, strSQL, new SqlParameter("@CustomerID", value));
  • Implicit parameter values
      example:
           dgProducts.DataSource = SqlHelper.ExecuteDataset(connString,"getOrders", value);

The explicit method can be used with SQL Query as with Stored Procedures.  The implicit method works only with Stored Procedures.

In the previous examples we only had one parameter.  What if you have more parameters? Well in this case you just include a comma-delimited list of parameter values:

  • dgProducts.DataSource = SqlHelper.ExecuteDataset(connString,    CommandType.Text, query, new  SqlParameter("@ParamName1", value1), new SqlParameter("@ParamName2", value2), …, new SqlParameter("@ParamNameN", valueN));
  • dgProducts.DataSource = SqlHelper.ExecuteDataset(connString, "getProducts", Value1, value2, …, valueN);

When using implicit parameters we have a performance issue.  DAAB has to do 2 steps:

  • Use the DeriveParameters method (SqlCommandBuilder class) to determine the parameters
  • Iterated through the parameter array to assign the values to the discovered parameter list.

To solve this problem, Microsoft has added the SqlHelperParameterCache class.

The SqlHelperParameterCache Class:

This class caches the SP parameter list.  The class contains 3 public methods to manage parameters.  These methods are :

  • Cache parameters: CacheParameterSet
  • Retrieve cached parameters: GetCachedParameters
  • Retrieve the correct parameters for a Stored Procedure: GetSpParameterSet

Internally, the Application block creates a hash table when storing your parameters.  The key of this hashtable is a simple string concatenating of the connectionstring and the command text.  When reading the parameters we will get the name, direction (In- of Output), the datatype and so on.

When using a Stored Procedure, we can use the 3rd method.  This method will connect to the DB, looking for the SP and retrieve all the information about the parameters for this SP.

Future :

Microsoft is working on the next version.  On the date of this writing it is version 3.  This version is available for test at the GotDotNet Community. This version provides the concept of an abstract provider, whereas version 1 & 2 using a concrete provider (SQLClient).  Version 3 will have 3 build-in providers : 

  • SQLServer
  • OleDb
  • ODBC

So it will be possible to use for instance an Oracle DB, or even (if you really, really wants MS Access).

See you at the next part.  In here we will talk about modifying the DAAB so it can be used with an Oracle DB.  In part 3, we will also describe our life experience of the DAAB.

Resources:

MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp
.Net Data Access Architecture Guide
4GuysFromRolla: http://aspnet.4guysfromrolla.com/articles/070203-1.aspx
GotDotNet: http://www.gotdotnet.com/workspaces/workspace.aspx?id=c20d12b0-af52-402b-9b7c-aaeb21d1f431
Microsoft Download :
http://download.microsoft.com/download/VisualStudioNET/daabref/RTM/NT5/EN-US/DataAccessApplicationBlock.msi

9/23/2004 7:24:34 AM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 
 Friday, September 17, 2004

Today is my last day @ U2U.  I'm following a course “Programming .Net Enterprise Applications with C#”.  We had following teachers :

I took a few pictures with my Mobile Phone (So sorry for the low quality).  More to follow

 

.Net | Common | Personal
9/17/2004 8:48:09 AM (Romance Standard Time, UTC+01:00)  #    Comments [2]  | 
 Thursday, September 02, 2004

I hope this will be the start of a useful serie about Application Code Blocks.  It will be my first time experience with these code blocks, and I hope a good starter guide for other developers.

So what are application code blocks?

These are C# (and VB.Net) classes, which can be downloaded from the Microsoft website and used in any .Net application.  Even ASP.Net applications.  These powerful tools will make your applications more efficient and maintainable.  Those application blocks contain classes, methods and interfaces, which can be used.  A big advantage is that those application blocks are very well documented at the Microsoft site. 
A big benefit of using the application code blocks is faster and more modular development of your .Net application.  You don't have to worry about exceptions, ... because it's all in the application code block, so you can focus on your business layer.  Other advantages are:

  •  Buffer between you and the .Net framework
  •  Application Code blocks are distributed as VS.Net projects
  •  Make changes and/or additions that suits your needs

As a conclusion we can say that the application code blocks are great tools and they will add efficiency to our projects, because it will be easier to write our programs and to maintain them. 

My application code blocks pilot?

OK, I put the Application Blocks in a pilot project for myself.  I will use a few of those Blocks in the first place.  In total I have create 3 phases in whom I will describe a few of those blocks :

  • Phase 1: Till October 1st 2004
  • Phase 2: Till December 31st 2004
  • Phase 3: Beginning of 2005

Code blocks that are available at this moment and which I'm going to look at:

  • Aggregation Application Block
  • Asynchronous Invocation Application Block
  • Authorization and Profile Application Block (Phase 1)
  • Caching Application Block
  • Configuration Management Application Block  (Phase 3)
  • Data Access Application Block (Phase 1 and 2)
  • Exception Management Application Block (Phase 2)
  • Enterprise Notification Reference Architecture for Exchange 2000 Server
  • Logging Application Block (Phase 3)
  • Microsoft Content Integration Pack for Content Management Server 2001 and SharePoint Portal Server 2001
  • Smart Client Offline Application Block
  • Updater Application Block
  • User Interface Process Application Block (Phase 3)

More info can be found at the patterns & practices: Code MSDN page

Also, check the Coming Soon Section (Patterns & practices: Coming Soon):

  • Enterprise Library
  • Enterprise Development Reference Architecture - VS 2005 “Whidbey” version

Also Available : Beta release of the Testing .Net Application Blocks Guide.  Very interresting for reading when you have integrated or customized an Application Block in your own application.

Stay tuned for the part in this series, where I will examine the code blocks as we are going to use them.

Resources:

MSDN: http://www.microsoft.com/resources/practices/default.mspx
4GuysFromRolla: http://aspnet.4guysfromrolla.com/articles/062503-1.aspx
GotDotNet : http://workspaces.gotdotnet.com/pagtest

9/2/2004 8:25:28 AM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 
 Monday, August 09, 2004

Through the MSDN blogs, I came to an article of Somaseger.  It seems that he run's the developer division @ Microsoft.  The article is about the future of .Net and contains some interesting facts.

8/9/2004 9:06:20 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Friday, July 02, 2004

In GuntherB's weblog, I read that following service packs are availale in tech preview for download :

Details about this service packs can be read at his blog or by clicking the specific SP link above.

Feedbacks, comments or suggestions can be send to the MS .Net Product Groups.

.Net | News
7/2/2004 9:05:22 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, June 29, 2004

Also available now is SQL Server 2005 Beta 1 Express Editions.  The same as for the Express editions of VS 2005, it's a lightweight version of SQL Server 2005.

You can find more info here :

Update :
Check also the
VSExpress blog.

.Net | News | SQL Server | Tech.Ed
6/29/2004 12:44:32 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 

Finally the first beta of VS 2005 is available for download.

There are two version. 

  1. The full beta, available to MSDN Subsscribers
  2. The express beta products, available for free public download

According to the information I found, it seems that the express version is more for beginning hobbyists, people who get started with .Net programming, ...

Update
Be sure to check out the Channel 9 Summer Of Express Contest.  A lot of info can be found.  BTW you can win one of the 6 Xbox with XBox Live Subscription and the Halo2 game.

.Net | News
6/29/2004 9:20:03 AM (Romance Standard Time, UTC+01:00)  #    Comments [1]  | 
 Wednesday, June 02, 2004

Through Tom's Corner, I came across Paul Vick's blog.  I'm, just like Tom a VB.net programmer (although still a junior ;-) ).  At our work we had several discussions about this.  I know C# has it's advantages and disadvantages, but it's the same for VB.Net.  I also know that in VS.Net 2005 VB.net has several features which will not be availlable in C#.  So look at the interresting article of Paul.

6/2/2004 2:11:11 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, May 18, 2004

Under ASP normally we you use response.redirect("webform2.asp") to go to another page.  This could also be used in ASP.Net. 

Well, Response.Redirect simply sends a message down to the browser, telling it to move to another page.  Server.Transfer is similar in that it sends the user to another page with a statement such as Server.Transfer("WebForm2.aspx"). However, the statement has a number of distinct advantages and disadvantages.

  1. Transferring to another page using server.transfer conserves server resources.  Instead of a redirect it changes the focus on the webserver and transfers the request.
  2. server.transfer also works only on the sites running on the server.  You can't use server.transfer to send the user to an external site.  This can be done only by using response.redirect.
  3. server.transfer maintains the original URL in the browser.
  4. server.transfer has also an optional parameter " preserveForm ".  If you set this to True, using a statement such as Server.Transfer("WebForm2.aspx", True), the existing query string and any form variables will still be available to the page you are transferring to.  This means that you'd be able to retrieve the value of the original page TextBox control by referencing Request.Form("TextBox1").

But be aware when using the preserveForm parameter : ASP.NET has a bug whereby, in certain situations, an error will occur when attempting to transfer the form and query string values. You'll find this documented at http://support.microsoft.com/default.aspx?id=kb;en-us;Q316920

The unofficial solution is to set the enableViewStateMac property to True on the page you'll be transferring to, then set it back to False. This records that you want a definitive False value for this property and resolves the bug.

Update :
I forgot to mention the original article.  So
here it is. (Sorry Karl)

5/18/2004 2:16:29 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Monday, May 17, 2004

I was looking for something that I could create to use a tooltip on a textbox.  Sometimes this can be very handy.  I have a little project where I need this tool tip for extra information to the user.

 

In .net this is easy because under the windows.forms namespace you got the tool tip object.

The best way to add tooltips on your form is to create the tool tip object in your form_load event.

 

These are the steps :

  •             Declare a new tooltip object
  •             In the form_load event set the tooltip for every control you want.  You can set all properties here

Public Class Form1
Inherits System.Windows.Forms.Form

Private oTooltip As New ToolTip

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
oTooltip.SetToolTip(TextBox1, "Meerder adressen scheiden door ;")
oTooltip.ShowAlways =
True
End Sub

End Class

You need also to remove those tool tips when closing your form.  In the closing event you could use the remove_all method to delete your tool tips.

 

oTooltip.RemoveAll()

 

The tooltip has some nice properties :

            AutoPopDelay : Sets the time that the tool tip remains visible.

            ShowAlways : shows the tool tip even when the control isn't active

 

Update :
If you want to do it the easy way.  Just drop the tool tip control on your form.  When asking the properties of the other controls on your form, you will see that they have a new property 'ToolTip on ToolTip1'.  This can be used to show the tool tip text.  All the properties of the tool tip component can be set by using the properties of the tool tip component. (Thanks Raf)

5/17/2004 2:02:33 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Wednesday, May 12, 2004

After years of pointing out the Mono project as a beacon of hope to those who want to enjoy the benefits of ASP.NET without suffering Microsoft lock-in, I had honestly given up hope of ever seeing this open source effort bear practical fruit. Imagine my surprise last week when Beta 1 of the Mono Project was released!

Downloads are available for Windows and Mac OS X, as well as all popular Linux platforms.

For those who don't know, Mono is an open source project that aims to create cross-platform versions of:

  • a C# compiler
  • the Common Language Runtime (CLR)
  • most of the .NET Framework's class library, including ADO.NET and ASP.NET

Most notably for Web developers, ASP.NET (including both Web Forms and Web Services) is advertised as being fully functional with this release!

The Mono project, which is sponsored by Novell (who bought out Ximian last year), have two more beta releases planned before the final release of Mono 1.0 on or about June 30, 2004

.Net | News
5/12/2004 9:03:02 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Friday, April 09, 2004

Also through the MSDN blogging feeds, I found two sites where you could convert C# code snippets to VB.Net code.  For me, these are useful tools because I'm a VB.Net programmer and don't know much C# (Just a little ;-().  I've tested them,  and I must say they work fine.

Here are the links :
http://www.aspalliance.com/aldotnet/examples/translate.aspx
http://www.kamalpatel.net/ConvertCSharp2VB.aspx

ConvertCSharp2VB has a limitation of 6.15 Kb per page.  So you have to trunk your code in smaller parts.  But they offer also an offline tool which you can download, and hasn't this limitation.

4/9/2004 7:49:38 AM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Friday, March 05, 2004

Thanks to Jan, who gives me some remarks on my code, I have created a final update on the sort method.

 

Because in my comparer class both x and y are objects, I used automatic casting.  VB.Net supports this VB6-behaviour when the option Strict is disabled (which is the default value).  So by setting the Option Strict On, the code isn’t compiling anymore.

 

As you can see in the code below, we have rewritten the code of the PersonComparerName (Sorts on the name of persons).

 

Public Class PersonComparerName

    Implements IComparer

 

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare

        Dim xEntity As person

        Dim yEntity As person

 

        If GetType(person).IsInstanceOfType(x) Then

            xEntity = CType(x, person)

        Else

            Throw New ApplicationException("Casting problem...")

        End If

        If GetType(person).IsInstanceOfType(x) Then

            yEntity = CType(y, person)

        Else

            Throw New ApplicationException("Casting problem...")

        End If

 

        If xEntity.Name = yEntity.Name Then

            Return 0

        ElseIf xEntity.Name < yEntity.Name Then

            Return -1

        Else

            Return 1

        End If

    End Function

End Class

 

We haven’t add here the PersonComparerCityName class, but the change is identical.  The dimensioning of xEntity and yEntity is still the same, except that we don’t give directly the correct value.  But we first check that the types matches.  If not, then we throw an exception, else we set our variables to the correct value and we use DirectCast to do this.

 

In our form we have a try/catch block, which shows a messagebox when there’s an exception.

 

For the rest the code stays the same.

 

Also, I have to create a Comparer for each class I want to sort.  Jan mentioned me to you can also use Reflection, so we have a dynamic sorting.  Later I will look for this solution. 

3/5/2004 1:50:19 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Thursday, February 19, 2004

I just fund out that the ASP.net resource kit is availlable for download (Thanks to Tom).

So follow this link to download the file.

This kit contains code snippets, samples, components, white papers and a little extra.  Namely a hosting offer from Hostbasket.  A belgium hoster, who is also integrated in the Visual Studio .Net upload.

.Net | News
2/19/2004 5:58:09 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]  | 
 Tuesday, January 13, 2004

After the previous sorting of strings using the iCompare.  It’s also possible to sort objects.

 

To do this we just have to add 2 extra lines in the code, and change a few parameters :

 

Code :

Public Class PersonComparerName

    Implements IComparer

 

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare

        Dim xEntity As person = x

        Dim yEntity As person = y

 

        If xEntity.Name = yEntity.Name Then

            Return 0

        ElseIf xEntity.Name < yEntity.Name Then

            Return -1

        Else

            Return 1

        End If

    End Function

End Class

 

As you can see, we can now use the properties of the object person to sort on.

 

Result :

We can even go a little further, by sorting on two properties of our class  In this case we have to add an extra sorting check.

 

Code :

Public Class PersonComparerCityName

    Implements IComparer

 

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare

        Dim xEntity As person = x

        Dim yEntity As person = y

 

        If xEntity.City = yEntity.City Then

            If xEntity.Name = yEntity.Name Then

                Return 0

            ElseIf xEntity.Name < yEntity.Name Then

                Return -1

            Else

                Return 1

            End If

        ElseIf xEntity.City < yEntity.City Then

            Return -1

        Else

            Return 1

        End If

    End Function

End Class

 

In this code, first we sort on city.  When the city is equal, then we will check also the name to sort on.

 

Result :

 

1/13/2004 12:04:11 PM (Romance Standard Time, UTC+01:00)  #    Comments [3]  | 
 Monday, January 12, 2004

At our project we had the problem that when reading the data, this data sometimes was unsorted or sorted differently.

 

To do this we have created a class sampleArraylistSort.  This class implements the iComparer.  In this class we have a public function Compare.

This function will do the compare and returns 0,1 or -1 depending on the result of the compare.

 

Code :

Public Class sampleArraylistSort

    Implements IComparer

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare

        If x = y Then

            Return 0

        ElseIf x < y Then

            Return -1

        Else

            Return 1

        End If

    End Function

End Class

 

if you have a collection and want to sort it, you just have to call the sort method on the arraylist with the sorting class as parameter :

 

myAL.Sort(New sampleArraylistSort)

 

Result :

More info can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionsarraylistclasssorttopic.asp

1/12/2004 5:01:37 PM (Romance Standard Time, UTC+01:00)  #    Comments [1]  |