Posts

Showing posts from January, 2011

Documentation of C# Code with SandCastle and Visual Studio 2010

Image
In this post I'll show you, how you can create a documention of your code. In the past ndoc was the tool to create code docus but the project seems to be dead. Therefore we use SandCastle, a freeware tool, that is also used by Microsoft to create Code-Documentations.

Here is the reference of the comments within visual studio:

http://msdn.microsoft.com/en-us/library/b2s063f7.aspxhttp://msdn.microsoft.com/en-us/magazine/cc302121.aspx

First of all you need to install these things in the given order.

Download and install SandCastle http://sandcastle.codeplex.com/releases/view/47665Download and install SandCastle Help File Builder (shfb). This is a gui for SandBox. Sandbox is mostly a command line driven tool, with a poor gui. This tool helps to create the documentation easier. http://shfb.codeplex.com/releases/view/40105If you want to create MS specific .chm (Compiled Html Help) files, download and install htmphelp.exe.
http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&a…

HttpModule to check the performance of a (sharepoint) site

Image
I want to share the code of a http module I made for checking the performance of the backend site creation process. The result indicates if the site will break down when its launched and used by tausends of people. You can leave this module in your solution and activate it everytime you have to check the performance of a webpart or control. The module is simply activated by inserting an entry in the web.config.

When you type perf=1 in the querystring (ex. http://mydomain.com/pages/default.aspx?perf=1) than a little yellow div will appear on the upper left corner, that displays the information.



First we create a new class and implent the IHttpModule interface. We implement the init method, which is the starting point.There we have to create two delegates, that process the request.

In an other class we implement the PerformanceFilter to manipulate the outputstream of the request. Here we read the stream an place a div with the information when we find the </body> tag


1: using Sys…

RegularExpressionValidator autocomplete enter key problem in firefox

Image
I had some problems with the regularexpressionvalidator in firefox today. When I selected a value from the browsers autocomplete box, the field was validated to false.



The RegularExpressionValidator checks if the insert email address has the right format. If not than the validator outputs an error. In my case when I hit the enter key in the autocomplete box for the field, the validator message appeared, but when I hit the tab key all was fine.

I digged a little into the javascript and found out that when I pressed Enter the value for the field to check in forefox was only the first character of the value entered. Therefore this was not a valid email address

Then I found this post, that describes that this is a firefox bug

The only solution for this problem seems to override the Microsoft core ValidateTextBoxOnKeyPress function somewhere in your page and check if the function is called in firefox. (I used here the JQuery browser method )

1: function ValidatedTextBoxOnKeyPress(event) {…