About Developer Day Scotland

Developer Day Scotland (DDS) is a community event, run by community for community, which is based upon the highly successful Developer! Developer! Developer! (DDD) community conference events.

Scottish Developers is pleased to bring this phenomenal success to Scotland once again. The very best of the UK speaker community will be presenting on the topics delegates wish to see.

Highlights of Developer Day Scotland

 

Listed below are some of the key highlights of the day:

  • Modern state of the art conference facility courtesy of Glasgow Caledonian University.
  • Four technical tracks with a capacity of of 200 delegates.
  • Sixty minute in-depth technical content sessions.
  • Leading international speakers and technology specialists.
  • Networking area, CPD resources.
  • Sponsor area to facilitate networking with delegates

The Developer Day Scotland team are constantly working on adding resources and more value to the day, so remember to come back from time to time to see what’s been added.

Who Should Attend?

Anyone involved in the software development or software engineering world. 

Delegates will typically be drawn from software professionals and soon-to-be professionals, including business analysts, designers, DBAs, software developers, software engineers, students, team leads, testers and not forgetting managers of all levels.

Dates & Times

DDS will run from 9am to 5pm on Saturday 2nd May 2009.

Venue

The Continuing Professional Development Centre, Glasgow Caledonian University, Cowcaddens Road, Glasgow G4 0BA.

See the location on Google Maps or the Caledonian University website

Cost

Now the very best part! This event is free thanks to the generosity of our sponsors and supporters.

Agenda

  • jQuery Deep Dive : Andy Gibson
  • Virtualisation for Developers - What? Why? Where? : Liam Westley
  • Everything you wanted to know about refactoring but were afraid to ask! : Gary Short
  • Testing the SQL Database - Best Practice : Satya SK Jayanty
  • TDD? I don't have time : Craig Nicol
  • Real-world MVC Architecture : Steven Sanderson
  • Embracing a new world - dynamic languages and .NET : Ben Hall
  • 77 SQL Server Myths : Simon Sabin
  • What's new in C# 4.0 : Guy Smith-Ferrier
  • ASP.NET MVC Best Practice : Sebastien Lambla
  • Make Patterns with Patterns - Introducing the MVVM design pattern for WPF : Ray Booysen
  • SQL Server Optimisation - Best Practice for Writing Efficient Code and Finding and Fixing Bad SQL to Improve Performance : Iain Kick
  • Stop your website being stung : Barry Dorrans
  • What is functional programming? : Barry Carr
  • When Good Architecture Goes Bad : Mark Dalgarno
  • Who Needs Schema When You Have SQL Data Services? : Eric Nelson
  • ASP.NET 4.0 : Mike Ormond
  • Scrum Pain - Lessons learned swimming against the current : Abid Quereshi
  • AOP with Castle Winsor and PostSharp Chris Canal SQL Server Architecture - The Life of a Query : Christian Bolton

You can view the full agenda on the Developer Day Scotland website.

 


I currently have the requirement to set the Request.AcceptTypes property for a controller test.  AFAIK there is currently no way of doing this within the MVC-Contrib TestControllerBuilder.

I updated their latest trunk and have created a patch file in case you, or the MVC-Contrib guys want to use it.

Heres the test:

        [Test]
        public void CanSpecifyRequestAcceptTypes()
        {
            builder.AcceptTypes = new[] {"some/type-extension"};
            var controller = new TestHelperController();
            builder.InitializeController(controller);
            Assert.That(controller.HttpContext.Request.AcceptTypes, Is.Not.Null);
            Assert.That(controller.HttpContext.Request.AcceptTypes.Length, Is.EqualTo(1));
            Assert.That(controller.HttpContext.Request.AcceptTypes[0], Is.EqualTo("some/type-extension"));
        }

 

Heres the code

		protected void SetupHttpContext()
		{
			...
SetupResult.For(request.AcceptTypes).Do((Func<string[]>)(() => AcceptTypes));

.....
		}

Download the patch: click here

 

Dave the Ninja


Official launch of www.richpictures.co.uk

1 Apr 2009 In: C# 3.5, Family, MVC.net

I had been working for some time on a project for my friends company Rich Pictures Ltd, who are based in Glasgow - Scotland (UK)


The site had been up and running for quite a while as we ironed out the remaining features such as the shop and PayPal integration but on Monday I flicked the switch and rolled over to the final release of this application.

 

 

The website is designed to showcase the works of Lisa Clelland, and to enable her to clients to log in and select which photographs they would like prints of and then add them to cart for purchasing.

 I am really happy how this site has evolved and with the design of the site. This was a 1 man job from start to finish, working closely with Rich Pictures throughout the design processes

 

 

I twittered on it and have received some lovely comments so far, two of which were from Phil Haack (Microsoft MVC) and Louis DeJardin (Spark View Engine Creator)

I see big things for the future of this site and company as a whole as Lisa is a very talented photographer, as you can see from looking at the site.


You can visit Rich Pictures at www.richpictures.co.uk or contact Lisa directly on 07786 077 891 if you are interested in booking her (quote you got the link/number from me)

Dave the Ninja

 


Update:

This fix is included in the current release of MVC-Contrib.

I have been using the MVCContrib RouteTestingExtensions today for the first time and they have been working really well.... that is until I started writing a custom route that returns a complex type to the RouteValueDictionary.

The tests that I had assumed would work and pass were like the following:

    [TestFixture, Category("Routing")]
    public class When_Url_to_route_is_dynamic_with_trailing_slash_and_no_html_extension : DynamicContentRouteSpecification
    {
        public override void Given()
        {
            base.Given();
            currentUrl = "~/business/something/";
            dynamicUrl = new DynamicUrl(currentUrl.Substring(2));
        }

        [Test]
        public void Then_the_current_url_should_map_to_DynamicContentController_Render_action()
        {
            route.ShouldMapTo<DynamicContentController>(a => a.Render(dynamicUrl));
        }
    }

In my code sample above the DynamicUrl is a class that wraps additional logic around the passed in url, and I have a ToString() method on it that simply returns the original url value.

This test kept blowing up, and after looking at the tests and code from MVCContrib I found the code that was causing all of the problems.

        public static object GetValue(this RouteValueDictionary routeValues, string key)
        {
            foreach(var routeValueKey in routeValues.Keys)
            {
                if(string.Equals(routeValueKey, key, StringComparison.InvariantCultureIgnoreCase))
                    return routeValues[routeValueKey] as String;
            }

            return null;
        }

This GetValue method within the RouteTestingExtensions would work as expected until the return "as String".  As we know "as String" returns a string if it can be converted or null if it can not.

To resolve this issue I amended the MVCContrib code to the following:

        public static object GetValue(this RouteValueDictionary routeValues, string key)
        {
            foreach(var routeValueKey in routeValues.Keys)
            {
                if(string.Equals(routeValueKey, key, StringComparison.InvariantCultureIgnoreCase))
                    return routeValues[routeValueKey].ToString();
            }

            return null;
        }

After making the changes and running the MVCContrib tests, they all passed.

I then re-built and referenced the new assembly builds in my project and HAZZA! my tests started passing.

I have uploaded the patch and you can download it here

If anyone has any feedback on this, or if I have gone about using the helper the wrong way please leave me a comment.

David the Ninja

 

 


.Net Developer Roles, Competitive Salary

3 Mar 2009 In: C# 3.5, Jobs, MVC.net

Want a job?

We are looking for a number of .Net developers, both senior and junior, to join our team developing exciting products in the digital identity and communications arena.  You should be happy working for a cutting edge, dynamic, fast moving company.

 
Developers must be able to demonstrate the following skills and experience:
  • Experience with c# and asp.NET.
  • A strong grasp of object-oriented design.
  • Ability to produce quality code across all layers of a web application stack.
  • 3+ years development experience on commercial or open source projects.
 
Experience in any of the following areas will prove advantageous:
  • OpenID
  • Information Cards (CardSpace)
  • ASP.NET / MVC.NET
  • TDD
  • NHibernate
  • Castle Project
 
Interested?
Send your CV to: recruitment@netidme.com, including an indication of your salary expectation.
 
Location:
East Kilbride, Scotland, United Kingdom
 
Please Note:
All prospective employees must undergo disclosure checking with www.disclosurescotland.co.uk
 

NO 3RD PARTY REFERRALS PLEASE 


UPDATE 2:

The most recent edition includes Fluent NHibernate and a fresh build of Linq to Nhibernate - enjoy!

UPDATE:
Well looks like the cat was correct. As soon as I had turned my back, Phil Haack and co. released a MVC.NET RC refresh.  I have rebuilt MVC Contrib with the updated MVC assemblies.

After 24 hours 48 hours of full scale warfare I can finally present to you all................

A download with all third party assemblies used within:

  • Castle Windsor
  • NHibernate
  • Rhino-Tools
  • NHibernate-Contrib
  • Linq-to-Nhibernate
  • MVC Contrib
  • Fluent NHibernate <- new build

All of the above are built together and contrib is running off NHibernate 2.1.0.100 and MVC.Net RC1.

The only thing missing is Fluent NHibernate which is a pain in the tits to build.  Hopefully get a release of that within the next day or so.

Fluent NHibernate is now included!

Download:

Dave_The_Ninja_-_Full_Stack_Builds_04-02-2009.rar (24mb approx) <-- Use this one

Dave The Ninja - Full Stack Builds 29-01-2009 MVC RC Refresh.rar (20mb approx)

Dave The Ninja - Full Stack Builds 29-01-2009.rar(20mb approx)

Any issues let me know as ill probably run into them too.

Dave the Ninja
Temporary Horn Replacement


Getting started – Project Structure

I have a standard project structure that I work to on 90% of all MVC.net web applications that I develop and would like to give some insight to what each part of the application

Folder Structure

The image below is the file system folder structure of this project.

  • Build
    Contains the build scripts for the CI server
     
  • Lib
    Contains all of the third party assemblies that will be used in this application.
     
  • Licenses
    Contains all of the third party assembly licences.
     
  • Src
    Contains the source code and project files.
     
  • Tools
    Contains the tools required for building and testing the application such as Nant and Nunit.

 

Visual Studio Solution

The image on the right is of my Visual Studio solution explorer which contains the following projects:

  • Build
    I create a Solution Folder and attach the build script files for easy access to edit within visual studio.
     
  • Core
    Initially when I create a new project, I keep all of my application and domain code in a core project separating the layers by namespaces as I personally do not see the need to overly complicate a project structure until such time as the codebase grows large enough to justify separating out to codebase into individual projects.
     
  • Core.Specifications
    Core.Specifications is referenced by Core.Specifications.Integration and Core.Specifications.State.  Core.Specifications is where I keep all of my test setup/helper classes.
     
  • Core.Specifications.Integration
    When it comes to testing an application, I prefer to separate out my integration and state based tests into separate projects.  It enables me to easily differentiate between the slower integration tests and fast state based tests when setting up my continuous integration server.

    The integration tests are those which actually execute against databases or other live services.
     
  • Core.Specifications.State
    The state based tests are those which are only testing the current “state” of the class under test.  For example when I add a Page to a Section, I want to assert that the page has actually been added to the sections page collection.
     
  • UI
    The UI project is the presentation layer of the application.  Harnessing the MVC framework and the Spark view engine give so much more freedom than the ASP.net Web Forms model.  It also has major benefits over the default MVC.net view engine, such as the formatting of the views – no classic asp spaghetti code in sight!
     

Next post will be on configuring the projects prerequisites - setting up castle/nhibernate/test helper libraries/MVC/Spark etc etc...

The Ninja

p.s the next post will be up when I return from Hong Kong (January)


IEnumerable of T to SelectList extension methods

2 Dec 2008 In: C# 3.5, MVC.net

 Here are some helper extension methods I use within MVC.net to convert IEnumerable lists of T into SelectList's for use on form Dropdown lists.

Code:

    public static class ListExtensions
    {
        public static IEnumerable<T> ForEach<T>(this IEnumerable<T> collection, Action<T> action)
        {
            foreach (var item in collection) action(item);
            return collection;
        }

        public static SelectList ToSelectList<T>(this IEnumerable<T> collection)
        {
            return new SelectList(collection, "Key", "Value");
        }

        public static SelectList ToSelectList<T>(this IEnumerable<T> collection, string selectedValue)
        {
            return new SelectList(collection, "Key", "Value", selectedValue);
        }

        public static SelectList ToSelectList<T>(this IEnumerable<T> collection, string dataValueField, string dataTextField)
        {
            return new SelectList(collection, dataValueField, dataTextField);
        }

        public static SelectList ToSelectList<T>(this IEnumerable<T> collection, string dataValueField, string dataTextField, string selectedValue)
        {
            return new SelectList(collection, dataValueField, dataTextField, selectedValue);
        }
    }

Usage:

ViewData["Countries"] = Country.AsList.ToSelectList("Code", "Name", "GB");

Cheers

The Ninja


About this blog

Dave the Ninja is an Alt.net practitioner from Glasgow in Scotland (UK). He rants about all things from coding to Kung Fu with some swearing thrown in for good measure.

Dave the Ninja has been programming professionally with Microsoft technologies for the past 9 years starting and is now working primarily with C# 3.5, MVC.net and Resharper.

Dave the Ninja has been practicing Chinese internal arts for the past 15 and a half years, mainly Taiji Quan, Neijia Quan , Chi Na and Qigong.

I have joined Anti-IF Campaign

My Communities/Projects

Flickr PhotoStream


Sponsors