Friday, 30 June 2006

Download details: Internet Explorer 7 Beta 3 (Windows XP SP2)

Internet Explorer 7 Beta 3 is out now.

Best Practice Analyzer for ASP.NET

"The Best Practice Analyzer ASP.NET (alpha release) is a tool that scans the configuration of an ASP.NET 2.0 application. The tool can scan against three mainline scenarios (hosted environment, production environment, or development environment) and identify problematic configuration settings in the machine.config or web.config files associated with your ASP.NET application. This is an alpha release intended to gain feedback on the tool and the configuration rules included with it."

Thursday, 29 June 2006

Remote Desktop spanning two monitors

If you participate in the Windows Vista beta program and you use Remote Desktop, then you might want to have a look at the new RDP client. There's a version for XP SP2 and 2003 SP1.

The main feature that interested me was that it now supports spanning multiple monitors. I've installed it on my XP SP2 box at home, and I can now connect to my XP SP2 box at work and have my desktop span across both of my monitors! I didn't even need to install the new client on my work box to get this either.

The resolution limit is up to 4096x2048

Sunday, 25 June 2006

Transactions and Unit Testing with NUnit (part 2)

The good news - I got the transaction unit testing code to work. Two traps that caught me out:

  1. Make sure the test fixture class inherits from the class defined in the transaction library assembly.
  2. Make sure your machine has a valid DNS entry! Turns out mine didn't as I'd reinstalled the OS a couple of months back, and our Active Directory DNS had kept the old record with a SID for the old machine - hence the new install had a different SID and wasn't allowed to update the DNS record.
    This had the effect that the remote server could not resolve my workstation to get the RPC conversation working properly.

Code analysis without buying Visual Studio Team System

If you download the Microsoft® Windows® Software Development Kit (SDK) for Beta 2 of Windows Vista and WinFX Runtime Components, then you actually get the C++ compiler that includes support for the "preFAST" /analyze code analysis feature.

Normally, you'd only get this if you purchased Visual Studio Team System for lots of $$$.

I installed it, and managed to get Mozilla Firefox compiled (just a couple of patches required - problems with the new headers in the SDK conflicting with Mozilla code).

The easiest way to analyze the code is to edit your mozconfig file and add the following:

ac_add_options --enable-optimize="-analyze"

I've uploaded a build log that includes the various warnings. Many are spurious, so the trick is to weed out the noise and find the ones that are relevant.

Wednesday, 21 June 2006

Customising Visual Studio.NET 2005 for Single and Dual Monitors

I have been using a dual-monitor setup for a couple of years now, and find it a very practial way to develop.

I also work from home, and use Remote Desktop (RDP) to connect back to my workstation at work. The problem is that RDP only works on a single screen - so when you launch Visual Studio, all the windows that were anchored on the second screen now are messed up.

The solution is to use the Import and Export Settings wizard to save two window layouts - one for a single screen and one for a dual screen. You can then load these settings to reset the window layout for the appropriate monitor.

To automate the process even further, you can create some Visual Studio Macros and assign them to a custom toolbar so that you can do it all with a single click of your mouse.

Here's my macro code that loads the two different window settings:

Sub RDPLayout()
    DTE.ExecuteCommand("Tools.ImportandExportSettings", "/import:""U:\My Documents\Visual Studio 2005\Settings\rdp.vssettings""")
End Sub
Sub DualMonitorLayout()
    DTE.ExecuteCommand("Tools.ImportandExportSettings", "/import:""U:\My Documents\Visual Studio 2005\Settings\dual monitor.vssettings""")
End Sub

Transactions and Unit Testing with NUnit

Roy Osherove has written a useful library that adds support for wrapping your unit tests inside a transaction (using MSDTC/COM+) which means that you can test your data-layer code and not worry about messing up your database.

The only problem is I can't get it working for me:-(

  1. Microsoft increased the security around using COM+ in Windows XP Service Pack 2 and Windows Server 2003 Service Pack 1
  2. The database I'm testing against is on a remote server (running 2003 SP1)

So even after reading this KB article, I still can't get it to work. The unit test just hangs, and I think it's because MSDTC is having problems of some kind.

Tuesday, 13 June 2006

Australian Story :: Dzung's Anatomy

My wife and her family are friends with the Davis family, and Carl (their son) is married to Thau (Dzung's daughter).

Sunday, 11 June 2006

View Trace.axd

Roger has written a Firefox Extension that ASP.NET developers will find very useful.

As I always say, "Anything that saves me extra keystrokes is a good thing!"

Monday, 5 June 2006

PageMethod Testamonial

Fabrice has published my testamonial about how we are using the PageMethods component with our development of an Online Assessment Tool.

Thursday, 1 June 2006

ObjectDataSource and Sorting (Part 2)

Sergio asked if I could post how I solved my problem with sorting and the ObjectDataSource control.

Here's what I did:

First of all, add a parameter to the method that is being called by the ObjectDataSource control that will be used to sort the data.

    <DataObjectMethod(DataObjectMethodType.Select)> _
    Public Shared Function GetTests(ByVal sortExpression As String) As TestInfoCollection
        If sortExpression Is Nothing Then
            Throw New ArgumentNullException("sortExpression")
        End If

It's up to you what you do with the value that is passed in. The value comes in looking like the sort bit of SQL. In my case to get things up and running I'm loading my data into a DataTable, then use a DataView to do the sorting for me - not the most efficient way but it works for now. Later on, I might pass the sort criteria down to SQL Server and let it do the sorting for me, but that will require messing with the stored procedures!

It seems like an oversight that there isn't a special attribute to prepend the sortExpression parameter so that the ObjectDataSource recognises it as special - unfortunately it just thinks it's a regular parameter and will add it to the SelectParameters part in the aspx file. You just need to remove it from there and instead make sure the SortParameterName attribute is set instead.

<asp:ObjectDataSource id="odsTests"
<asp:QueryStringParameter ConvertEmptyStringToNull="False" Name="courseId" QueryStringField="CourseId" Type="Object" />