Code


4 April 2007 in Code & Microsoft & Mindscape & Windows | Comments (0)

Mindscape PowerShell Gadget

Andrew here at Mindscape has just put the finishing touches on his first version of a PowerShell Gadget for the Windows Vista SideBar. I’ve been fortunate enough to have been able to have a play with it while he’s been developing it and personally I think it’s pretty damn cool. I’m always firing up PowerShell for little commands here and there so by integrating PowerShell into the SideBar I no longer have to switch away from what I’m doing for too long.

Click here to see a screen shot of the Gadget in use

If you’re interested in checking this project out and downloading the gadget, check out the Mindscape blog post about it.

- JD

Average Rating: 4.9 out of 5 based on 275 user reviews.


8 March 2007 in .Net & Code & Events & Microsoft & Mindscape | Comments (0)

BackgroundMotion Logo

BackgroundMotion is the website that Mindscape has developed and been showing off in the recent (and future) Microsoft 2007 Technical Briefings. Some people have been asking where they can see this site at the moment so I thought I would clarify that the site is not currently live. It will be available in the near future and I’ll announce that here when it does go live.

Further to this, we are looking to deliver the source code for the website so that everyone can learn about aspects of the system. Following from this there are plans to release video content showing why some design decisions were made and how we implemented them. Should be a great resource for learning from.

It’s been a great opportunity to be creating an awesome system that will be used by real people as well as creating surrounding documentation and content that enables people to learn more about how to do things.

- JD

Average Rating: 4.9 out of 5 based on 151 user reviews.


28 February 2007 in Code & Microsoft | Comments (0)

Recently I’ve been working on a website and I need to make sure it’s standards compliant. I’ve blogged before about some tools I use to make sure that the process of standards compliance is hassle free. In the weekend I was hunting around the Microsoft site, as you do, and I stumbled across the “IE Development Toolbar“, Beta 3. So I pulled it down and installed this this week to have a play.

This is a pretty scrunched up screen shot (I really need to move to a fluid width theme):

IE Web Developer Toolbar Beta 3

Overall, very nice. Lacks pretty icons yet but packs a punch in terms of functionality. It’s got a complete DOM inspector, validation links (both for public pages and local), allows CSS modification and considerably more. Looks promising for when it comes out of beta and so far I haven’t had any issues with it being in beta (hopefully that means pretty icons will be added, I like them ;)

Just thought I’d share as it’s a logical addition to my earlier post. Grab it here.

- JD

Average Rating: 4.5 out of 5 based on 210 user reviews.


23 February 2007 in .Net & Code & Microsoft & Tools & Windows | Comments (3)

I’ve been developing an ASP.NET solution and was starting to get some odd behavior on my development machine (Vista Ultimate). We’ve written a custom HttpHandler for managing user authorisation and when running the solution up against the ASP.NET Cassini web server (the “built in web server”) everything ran fine however when running against IIS7 authorisation wasn’t working correctly. Some debugging and it became evident that the handler wasn’t even executing when running within IIS7.

IIS7 provides a whole swag of great new functionality so after some hunting around I found that the module wasn’t registered with IIS7.

How do you register a custom module in IIS7?

Fire up IIS Manager

Select your website you want to add the module for (IIS will inspect the Web.config of the site to get the modules)

Open up “Modules”:

IIS7 Modules

You should find that your modules will be of Module Type “Managed” if you’re writing them in .NET, check it’s not already listed

Click “Add Managed Module…” on the Action pane

IIS7 Add Managed Module

Type in the name of your module and select it from the drop down list (IIS will populate this from what it finds in the web site, if the module isn’t listed then you’ve made a mistake somewhere :)

Add IIS7 HttpHandler Module

Click OK and you should now find that your custom HttpModule works :)

Another way

Some of you will already know that IIS7 configuration is now XML and you can configure IIS7 from the web.config. This was recently demonstrated at a local .NET User Group in Wellington by Jeremy. It’s a pretty kick ass change from how things work in IIS6 and earlier and makes explaining some of these things easier. After adding the Module reference I noticed Visual Studio warned me that the Web.config file had changed so I took a look at what it had changed and, sure enough:

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="CustomAuthModule"
type="Mindscape.ResearchProject.Website.Infrastructure.CustomAuthModule" />
</modules>
</system.webServer>

So you could just drop this block into your Web.config and get the same module registration that I detailed earlier. Fantastic.

- JD

Average Rating: 4.8 out of 5 based on 255 user reviews.


7 February 2007 in .Net & Code & Microsoft | Comments (2)

This evening I delivered a quick presentation on SQL Server 2005 Compact Edition (SQL CE). Below is my demo project that shows how to connect and execute SQL commands. Note that if you run my code you’ll need to update the location of the database file in the connection string. You will also need the SQL CE Runtime (link at the end of this post)

Download the demonstration project

Product overview

Advantages of SQL CE:

  • Tiny footprint, 1.7MB
  • Replication to SQL Server, great for Smart Client and Mobile applications
  • Works on Windows XP, 2003, Vista, Windows Mobile, CE, Smartphone
  • Single file for the database makes deployment easy
  • Zero cost!

Limitations of SQL CE:

  • Maximum database size of 4GB
  • Not all SQL data types or features (you have to sacrifice something :)
  • Note that most of these limitations won’t be an issue for most of you.

Overall it makes great sense to be hooking SQL into any desktop applications. Given the simplicity of integration and small file size it makes a great case for just dropping a SQL engine into any application that needs to store data (much much sexier than managing xml files or any other hybrid data repository).

Links

Microsoft SQL CE DataSheet

Microsoft SQL CE Download

Microsoft SQL CE Homepage

– JD

Average Rating: 4.4 out of 5 based on 185 user reviews.


16 November 2006 in .Net & Code & Microsoft & Tools & Windows | Comments (0)

I was going to blog quickly about the other fifty Microsoft products that have gone gold but it seems nearly every blog on the planet is talking about it. So I thought I’d just mention that PowerShell 1.0 has been released :)

PowerShell is a fantastic replacement for your command prompt of old and has a wealth of new functionality. I’m still trying to get used to it but those who grok it completely rave about it so I’m sure the more I learn the more I’ll love it.

So if you haven’t played with it or are using the beta then go and grab it. Oh, and F7 still works in PowerShell ;)

Download PowerShell RTM

 - JD

Average Rating: 4.6 out of 5 based on 270 user reviews.


26 October 2006 in .Net & Code & Microsoft & Tools | Comments (2)

Recently I’ve been doing some work with CruiseControl.Net 1.1 and setting it up to build my work projects. I’ve been using earlier versions of CC.Net at home (what? you don’t run a continuous build environment at home? for shame…) but that has been using Nant for most of the tasks.

For this implementation I decided to try and only use MSBuild and have found it surprisingly easy to work with. Every time I think I’ve hit a wall or found something it cannot do I find some great community additions that add more tasks that I require. One project seemed to offer a considerable number of tasks.

Some of the tasks supplied include:

  • Zip & Unzip
  • Subversion support
  • NDoc generation
  • XML reading & writing
  • Control windows services
  • FTP upload & download
  • SQL Execute

There are a pile more and some of these could be done by just calling against executables but being wrapped up as tasks is a more elegant solution.

The MSBuildTasks Project

 - JD

Average Rating: 4.5 out of 5 based on 239 user reviews.


23 October 2006 in .Net & Code | Comments (3)

This long weekend I’ve been doing a fair bit of coding and catching up on some tech reading online in the domain of business objects, testing and WPF development. I managed to find my way to an article on The Code Project which discusses the use of interface I hadn’t heard of before – IDataErrorInfo and goes into some detail on how to write what I consider to be some rather clever validation code for your business objects.

The error information provided by an object implementing IDataErrorInfo is automatically picked up by controls that the object is bound to (for example, if the object has an error based on the data entered the control will automatically notify you about the error without you, the developer, having to explicitly wire it up). I won’t go into too much detail about IDataErrorInfo since it is covered in the article and has links to MSDN as well with more information.  

Paul’s article goes into further detail about implementing the business rules for validating business objects. The implementation discussed made a lot of sense and looked quite elegant, I will certainly be looking to follow this design with any business object design I’m doing in future.

Paul Stovell, the article author, has a great blog as well which he posts about WPF and some more interesting topics of .net.

Code Project Article: Delegates and Business Objects

 - JD

Average Rating: 5 out of 5 based on 281 user reviews.