0 Comments
  •   Posted in: 
  • MVC

I'm trying to write some templates for MVC 2 and one of the most useful things I've found is being able to step into the source code and see how it is actually interpreting what you've written.

It's easy enough to acquire the source, but what you might not have done before is set up a symbol server. A symbol server is a location that the Windows and Visual Studio debugging tools can use to obtain pdb files, so that you can debug almost anything, including drivers and the operating system!

Setup Symbol Server

  1. Create a directory, preferably in a shared location if there's more than one of you as this stuff can get quite big.
  2. Change the directory to allow compression as pdb's will typically compress by > 50%.
  3. Add a new system environment variable _NT_SYMBOL_PATH and set it to SRV*<Shared Directory>*http://referencesource.microsoft.com/symbols;http://msdl.microsoft.com/download/symbols
    vssrc2

Enable Debug Symbols in Visual Studio

  1. Install the debugging tools for Windows and run Start Menu|Programs|Microsoft Windows SDK 7.1|Visual Studio Registration|Windows SDK Configuration Tool; this allows Visual Studio to use the symbols.
  2. Run Visual Studio and go to Tools -> Option -> Debugging -> General
  3. Uncheck Enable Just My Code
  4. Check Enable .NET Framework source stepping
    vssrc1
  5. Change to Symbols
  6. Update "Cache symbols from symbol servers to this directory" to point at your shared symbol directory, then hit "Load symbols from Microsoft symbol servers", this will take a while and chew up about 111Mb (~48Mb compressed)
  7. Put a break point in one of you controllers and run through to that point.
  8. Pick a stack frame from System.Web.Mvc from Call Stack and select Load Symbols if it is not disabled and then Go To Source Code, picking the location you have put MVC 2
    vssrc3

One other interesting angle on this is Symbol Source who are providing symbol/source service for a bunch of open source projects including NHibernate, Castle and MVC Contrib

0 Comments

Working on a project where we needed a (slight) proof of humaness, and we opted to use Recaptcha as it has a fairly simple integration with .NET.

Was fine until we wanted to use custom styling to tie in with the site which is when the fun started!  A few hours later, after downloading the project's sample app, I found some things out that I thought I'd share with you...

1. The Recaptcha control must be positioned after the recaptcha_image div and recaptcha_response_field

2. The killer: your recaptcha_response_field must have a name attribute of recaptcha_response_field as well as its id - otherwise Recaptcha won't see it.

3. You can specify your public/private key in the web.config AppSettings rather than against the control; RecaptchaPublicKey and RecaptchaPrivateKey respectively.

4. You can turn off Recaptcha validation either by setting the SkipRecaptcha property of the control or RecaptchaSkipValidation.

The first two are the most important to getting Recaptcha to work with custom styling;  I know the properties are documented on the control, but I managed to miss them for a couple of hours so I thought others might do the same

0 Comments

I'm just in the process of restructuring my source control environment, splitting the single subversion repository into multiple repositories.

Couple of reasons for this..

My repository is getting a bit big at 1.5Gb a big chunk of this are binary files produced by my continous integration process, so I want to break this out to a dedicated repository.

I'd also like to put each client's work into a separate repository, this makes it easier to archive off and/or remove it at the end of a project as there's no way to delete files from a repository apart from dumping it and filtering it into a new one.

One nice new feature I've found that was introduced in 1.5 (I'm using 1.6.4) is the new syntax for svn:externals

Externals are a way of referencing another repository location which can be in the same repository or a different one. This is how I use my floating tags idea to keep projects up to date across minor changes.

In the project's lib directory, I have a svn:externals entry that points at all the libraries that the project depends on

The old format looked like this..

logging svn://myrepository.com/Binaries/Log4Net/tags/1.2.10.0/bin
nhibernate svn://myrepository.com/Binaries/NHibernate/tags/2.0.x/bin

In svn 1.5 they have introduced a couple of new syntax options that means that you don't have to embed the access type (svn, http, https etc) or the server, but the syntax changes slightly to

/Binaries/Log4Net/tags/1.2.10.0/bin logging
/Binaries/NHibernate/tags/2.0.x/bin nhibernate

This will make life much easier if I have to relocate a repository etc. Check out the release notes for more details

0 Comments
Microsoft has published the results of some empirical studies about how development practices affect quality
  • Test Driven Development improves quality by 60 to 90 percent but takes 15 to 35 percent more ‘up front’ time. The time spent is compensated by savings in maintenance time later on.
  • Team & organization structure has a huge impact on quality. Although this is conventional wisdom the study publishes figures to prove this. The metrics used  data such as how many engineers are involved in a project, how many times individual source files were modified.
  • Code coverage in tests must be used intelligently, and has less overall impact than other factors.

Another paper hi-lights the issues of not running the unit tests....

"Specifically, recent contact with the IBM team indicated that in one of the subsequent releases (more than five releases since the case study) some members of the team (grown 50% since the first release) have taken some shortcuts by not running the unit tests, and consequently the defect density increased temporally compared to previous releases."

A friend of mine pointed me at this video as a further illustration

0 Comments

Just recovering from flu at the moment and I'm an official Swine Flu statistic.

Not the nicest of bugs, couldn't keep any food down until the anti-virals kicked in but the funniest thing about the whole episode is the screening questionnaire to see if you qualify for the Tamiflu.

First question is whether you are enquiring on behalf of yourself or someone else, on being told I that I was asking for myself the call centre staff (apologetically) asked

"Are you conscious?"

Now I'm not sure if this is some form of modified Turing test, but I think this belongs on the other branch of the decision tree :-)