Saturday, January 14, 2012
Testing with Visual Studio 2010
It is possible to execute a code analysis after each developer build. You can enable (or disable) this in the properties of the project; see tab Code Analysis. There are several rules you can configure (globalization rules, basic correctness or of course you can customize these)
It is also possible to measure the quality of the code, with Code Metrics. Code metrics gives some overview in maintanability and complexibility. The code metrics can be used to give a progress overview in a refactor proces to the management, simply export this data to Excel. The index for maintability, complexibility, depth, code coupling and lines of code.
With the Test Impact Analysis feature Visual Studio shows you the tests which are affected on the code change. (use the Test Impace Window)
There are several tests; Code UI Test, Load Test and Web Performance test. You can also use profiling for your application. You can select CPU Samples, Instrucmentation and compare the results and find the method or class which is the most expensive.
Monday, October 18, 2010
Public token key
With the 'sn.exe' tool of Visual Studio it is possible to retrieve the public token key. But watch for the casing!!
Use the command: sn.exe -Tp "FilePath to assembly"
Tuesday, October 12, 2010
Fiddler and localhost
Working with Fiddler for seeing the details of the Http request of a website is usefull for optimizing the performance of a website. Check if there are unneeded requests or if there are many requests which triggers a 404.
A tip when working with localhost you must http://localhost.:1519/default.aspx instead of
http://localhost:1519/default.aspx. So add a point behind the hostname.
IEnumerable Empty
When creating an IEnumerables, I mostly returned a null value when there are no values for the collection. But it is in some situations better to return an empty collection. This can be done with the Enumerable.Empty method.
Friday, May 28, 2010
Wednesday, May 19, 2010
How to take ScreenShot in C#
here is the code in C# for screenshot.
int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);
Friday, April 30, 2010
.NET Framework 4
Update: Some changes from another view
Thursday, March 25, 2010
Embedded Resources
foreach (string s in this.GetType().Assembly.GetManifestResourceNames())
System.Diagnostics.Debug.WriteLine(s);
More info on How to use assemlby embedded resources
Friday, March 12, 2010
Check your web.config
Check your web.config on these common mistakes which occurs in the web.configs.
IIS 7 and IIS 7.5
The IIS version for Windows Server 2008 (Vista) is IIS7 and the IIS version for Windows Server 2008 R2 (Windows 7) is IIS 7.5. read more information about specific details. At the moment it is not clear for me what the difference are for configuring a web application in IIS 7 and IIS7.5, specially for the web.config. When I know more about this, I will blog this....
Wednesday, February 17, 2010
LINQ: ToLookup vs ToDictionary
A nice article about LINQ: ToLookup vs ToDictionary
Monday, February 8, 2010
Taking Shapshots in ASP.NET
Which exceptions are there in .NET?
Friday, February 5, 2010
Monday, February 1, 2010
How to get an indexed item of an IEnumerable object (Linq)
How to get an indexed item of an IEnumerable object (Linq), this is a question which I often have had when I start using IEnumerable. But it is possible with the ElementAt() extension method!.
Wednesday, January 27, 2010
Friday, January 22, 2010
Get the name of the method
Sometimes it is easy to print the methodname of the current method. This can be typed manually, but with use of Reflection this can be retrieved with the following simple command:
System.Reflection.MethodBase.GetCurrentMethod().Name
Saturday, January 9, 2010
Reflector
Link dump
http://weblogs.asp.net/aghausman/archive/2009/07/20/show-loading-message-in-asp-net-ajax.aspx
Resolve urls with Javascript
http://weblogs.asp.net/joelvarty/archive/2009/07/17/resolveurl-in-javascript.aspx
Logging guidelines
http://www.bugfree.dk/blog/2009/07/22/basic-logging-guidelines/