Tuesday, July 22, 2008

Importance of specifying the right FileAccess option.

When debugging an application that accepts a filename as input, I came across the following exception
System.UnauthorizedAccessException: Access to the path 'C:\test.txt' is denied.

The line at which it failed was
FileStream fs = new FileStream(path, FileMode.Open);

I checked my access permissions on the file and everything was perfect. Except that I noticed that this file test.txt was marked Read Only. When I changed the above line to include the FileAccess option
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
the code executed successfully!

So moral of this is that wherever possible we should specify the FileAccess option for file operations.

Using .NET AutomationElement classes from Console Application.

When using .NET 3.0 UIAutomation classes in a console application, I was surprised when a call to AutomationElement.FindFirst returned a null value. The same method when called from a .NET WinForm application returned a valid AutomationElement.

If you encounter a similar issue, please bear in mind that UI Automation APIs only work from a STA thread. So if you ever want to get UIAutomation run from the console application, remember to decorate your Main function with the STAThreadAttribute.

Ref: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1706155&SiteID=1

Friday, July 18, 2008

SQL Server Reporting Services support for Firefox.

For a list of Reporting services features not supported in Firefox, check out http://msdn.microsoft.com/en-us/library/ms156511.aspx

Reading a INI file

A win32 function named GetPrivateProfile can be used to read an INI file.

Ref: http://msdn.microsoft.com/en-us/library/ms724353(VS.85).aspx

Monday, July 14, 2008

.NET Colors visual reference

I needed to visualize the different colors available for setting the BackColor and ForeColor properties of some controls. In my search, I came across this page. Thanks to the person putting this up for use of everybody. :)

Thursday, July 10, 2008

Better Together Microsoft Project Plan + TFS.

Today, I learnt how to synchronize my MPP with TFS work items. I must confess that it is a delightful feature for any project manager!

You can access this productive feature from the Team menu of a MPP. Select Get Work Items and have your mpp populated with work items created in TFS. If you are not too happy with the field mappings, Microsoft provides a nice command line utility named TFSFieldMapping which resides in "%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE". Follow the steps given here and here to customize the mappings for your project.

Simple :)

Updating TFS Warehouse manually.

To update TFSWarehouse manually, you must access the machine hosting TFS and browse to
http://localhost:8080/Warehouse/v1.0/warehousecontroller.asmx

Then invoke the Run operation. This operation executes asynchronously. To see if the warehouse update is complete, invoke the operation GetWarehouseStatus. Simple!

Tuesday, July 1, 2008

Improving Website performance

While studying performance considerations for website design, I came across this site

http://developer.yahoo.com/performance/

that has good tips for developers to improve website performance.

What is success?

The journey of life takes us through varied experiences like landing an admission at a prestigious college, earning a degree, getting hired,...