Tuesday, 18 December 2007

Silverlight Christmas Source

I have just uploaded the source for my section of the Silverlight Christmas session we did at NxtGenUG Cambridge and Coventry.

You can now download the source from here

Wednesday, 12 December 2007

Last Night in Cambridge

Last night in Cambridge myself and Richie did our Silverlight Christmas session again.

I think it went really well once more. It was nearly a little bit of a panic as the projector knackered up, and it was looking very bad for us indeedy.

In the end, Rachel and Ben of Red Gate were superb once more, and managed to find us another room with a projector.

We started late, and finished late (and didn't cover everything we wanted to), but in the end I think it went very well.

One thing that was very weird (this does not happen on my laptop, but i was using Richies laptop), Isolated Storage between Internet Explorer and Firefox seemed to be sharing with each other. This made me look like a little bit of a pillock as I did say it wouldn't share (and it doesn't on my laptop). So I think i need to look into this a little more and find out what happened.

Thanks to everyone who turned up, and have a Merry Christmas and see you next year.

Tuesday, 11 December 2007

VMDK (VMWare) to Virtual PC (VHD) Converter

This is a neat little tool that allows you to convert VMWare images to Virtual PC format

Silverlight Christmas in Coventry

Myself and Rich, did a joint session on Silverlight in Coventry last night for nxtgen.

What a great night, i had to admit i had a brilliant time, and just laughed myself silly with Rich. It was a very light hearted evening, not going into Silverlight in too much depth, but trying to cover lots of little nuggets and demos.

Rich had built an amazing Silverlight advent calendar to give away Swag and pick the demos :)

My only complaint is that due to time constraints (there was also a nugget on), I didn't get to do as many of my demos as I would have liked, there were more of Richies :( , and therefore it got a little rushed towards the end.

However it was a great evening, and I am looking forward to Cambridge tonight, where we do the same session but with more time.

Thursday, 6 December 2007

PDC 2008

PDC 2008 has just been announced.

LA Convention Center October 27 - 30th.

The last time i went to a PDC was 2003 (it was superb). There was a lakers game on one night (which I should have went to), but I didn't realise that the lakers played next door. I thought the Staples Center was a giant photocopy shop :)

I will definately be at this one

I now have my MSDN Subscription


This has been holding me back so much, pratting around with trial editions etc.

I can now get on and do what i need to :)

Wednesday, 5 December 2007

Silverlight Christmas (NxtGenUG Cambridge) (Me and Rich)

Tuesday 11 December 2007

I'm dreaming of a...NxtGenUG Cambridge: St Johns Innovation Centre, Cowley Road, Cambridge

I'm dreaming of a Silverlight Christmas. Just like the ones I used to know. Where the buttons glisten and attendees listen to hear, great demos in the show.I'm dreaming of a Silveright Christmas With every web Page I write. May your devs be merry and bright And may all your pages not be white. I'm dreaming of a Silverlight Demo With Chris and Rich on Stage. May your SWAG be expensive and bright And may all your Pizza be large. Chris Hay and Richard Costall will present a variety of Silverlight nuggets, aimed at highlighting the pitfalls with Silverlight 1.1. This will be a demo heavy session, so fasten your seatbelts.


Silverlight Christmas (with me and Rich) at Coventry

NxtGenUG: Coventry Region

Monday 10 December 2007

I'm dreaming of a ...NxtGenUG Coventry: Coventry Flying Club, Rowley Road, Coventry

I'm dreaming of a Silverlight Christmas. Just like the ones I used to know. Where the buttons glisten and attendees listen to hear, great demos in the show.I'm dreaming of a Silveright Christmas With every web Page I write. May your devs be merry and bright And may all your pages not be white. I'm dreaming of a Silverlight Demo With Chris and Rich on Stage. May your SWAG be expensive and bright And may all your Pizza be large. Chris Hay and Richard Costall will present a variety of Silverlight nuggets, aimed at highlighting the pitfalls with Silverlight 1.1. This will be a demo heavy session, so fasten your seatbelts.


INETA Silverlight Competition

This is the UK region of the INETA Silverlight Competition. (thanks to Ben Hall for this one).

I think I will enter a couple of my apps into this, prizes look good :)

Friday, 30 November 2007

Next Public Release of Silverlight is March

From reading Tim Sneath's blog. It seems that we won't be getting a new public release of Silverlight until March (Mix08).

On one hand this is great news, as we know what we can expect in March, we can get excited about Mix (convince my wife that i want to go), we will also get a non commerical go live license and it is a beta (so it will be pretty good).

The bad news, is that it seems that we won't be getting any more refreshes between now and then.

I am a little disappointed, as it was indicated at MixUK, that we would get a refresh by the end of this year, that gives us some of those features. I dounderstand that it is quite a big featureset change, and this stuff takes time. I guess I am just excited, and I want my presents now :)

Ah well. roll on March.

Mr Guthrie, is there any chance that we might get an earlier refresh???? Please, pretty please?

Finally for those cynics about Silverlight (the we have no controls brigade), this release is going to rock and you will be eating your own words.

Well done Microsoft, the transparency of release schedules is brilliant, and it really allows us to developers to plan for the future. Please keep it up.


Thursday, 29 November 2007

Silverlight 2.0

This is some big news via Microsoft Web Biggy Chieffy

Silverlight 1.1 becomes Silverlight 2.0 (yay, very sensible).

The big news in my opinion is that a beta will appear Quarter 1, 2008 including a Go Live license. This means we can start releasing Silverlight 2.0 enabled sites. Superb news.

Here is a subset of the features becoming available (copied from Scott Guthries blog):

WPF UI Framework: The current Silverlight Alpha release only includes basic controls support and a managed API for UI drawing. The next public Silverlight preview will add support for the higher level features of the WPF UI framework. These include: the extensible control framework model, layout manager support, two-way data-binding support, and control template and skinning support. The WPF UI Framework features in Silverlight will be a compatible subset of the WPF UI Framework features in last week's .NET Framework 3.5 release.

Rich Controls: Silverlight will deliver a rich set of controls that make building Rich Internet Applications much easier. The next Silverlight preview release will add support for core form controls (textbox, checkbox, radiobutton, etc), built-in layout management controls (StackPanel, Grid, etc), common functionality controls (TabControl, Slider, ScrollViewer, ProgressBar, etc) and data manipulation controls (DataGrid, etc).

Rich Networking Support: Silverlight will deliver rich networking support. The next Silverlight preview release will add support for REST, POX, RSS, and WS* communication. It will also add support for cross domain network access (so that Silverlight clients can access resources and data from any trusted source on the web).

Rich Base Class Library Support: Silverlight will include a rich .NET base class library of functionality (collections, IO, generics, threading, globalization, XML, local storage, etc). The next Silverlight preview release will also add built-in support for LINQ to XML and richer HTML DOM API integration."

Web Development Helper

Thanks to tim heuer for pointing me to the Web Development Helper Tool, please see my previous post.

I think in a world of AJAX, you need to be running an http sniffing utility. I have previously used Fiddler, but it isn't much use when you are working with https.

This tool is absolutely superb, and easily allows you to debug script, capture traffic, look at viewstate, the dom..........

What a great tool

HTTP Error 413 Request Entity too Large

We ran into this issue via AJAX.

To be honest this is on a legacy page, where we haven't created a new version of the page. So it a little data intensive.

This was a page where we used the telerik ajax framework rather than the Microsoft ASP.NET Ajax framework (which we try and use in most situations).

The problem with Telerik, if an issue happens the AjaxManager doesn't report the issue, and just goes into a little animation loop.

Using IEWatch we discovered that this situation occured only when we had had client certificates enabled with a certain size of data.

In the end our temporary resolve is to increase the upload limit:

cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 204800

However you do need to be careful when doing this, and set approriate limits. The real resolve is to convert this legacy page so this issue doesn't occur, but this is a good temporary fix

IE Watch

This is a great little tool, it's a little like fiddler, but much better.

IE Watch is a toolbar option within IE, which allows you to view all requests, replay requests, and works properly with HTTPS. Fiddler doesn't seem to do so well with https in my humble opinion.

I used this on a 30 day eval (retails about $170), and it saved me alot of time.

My only complaint it is a little expensive, and I am willing to bet there are free alternatives, which are just as good.

I think these days, when dealing with AJAX requests, http packet sniffers are necessary. So I think I will investigate a free alternative.

Tuesday, 27 November 2007

DDD6 - Silverlight Samples

I have just posted up my samples for the Intro to Silverlight 1.1 and for the Silverlight Twitter Application.

As I have said in my previous posts, on the day I did not present the way I know I can, however I believe that the samples you have to download are good examples of what you can do with Silverlight.

Feel free to take these samples, expand upon them and build your own applications.

Over the coming weeks, I will be blogging about some of the stuff in the these samples, and some of the cool things you can do.

Monday, 26 November 2007

DDD - Stop showing me Silverlight, build something

Following on from my previous posts http://silverlightuk.blogspot.com/2007/11/ddd-intro-to-silverlight.html and http://silverlightuk.blogspot.com/2007/11/ddd-apology.html

This is my evaluation of what went wrong with this session:

  • Rattled, and lost confidence (see previous post)
  • Sitting down (i should never sit down)
  • Tired and Lacked enthusiams (see previous post)
  • Never practised this session enough
  • Got lost in this session
  • Too much code (confused the audience, and me), can't see wood for trees
  • I got bored (if I am bored, you guys have no chance)
  • Live Coding, and Reference apps were disconnected.
  • Flow was wrong
  • Not clear what bit of code i was working on

The real problems with this session, was due to the way i had structured this presentation, and how complicated, and ambitious I was.

Without comfort in the tools (for presenting purpose), and with a very different flow, everybody including me got rather lost.

I was boring, and unenthusiastic (due to the events leading upto this presentation).

I have some serious work to do on this, but I am pretty sure this will never happen again.

In future posts, I will discuss how i plan to rectify this in the future.

DDD - Intro to Silverlight

This a list of my points (and some of Guy Smith-Ferriers, John's and Richies points), of what went wrong at this session. I will add to this list when I get feedback.

  • I was very tired meaning that I was not enthusiastic as I could be.
  • Due to the events on the Friday, I had lost my confidence.
  • Vista on my laptop would not work with the projector, which rattled me, and I had to switch to XP.
  • Starting 5 minutes late, rattled me (due to projector issues).
  • My Laptop wasn't setup to do the demos in XP.
  • Vista is much faster than XP, meaning that my samples were being slow, and this rattled me.
  • I usually psyche myself for a presentation beforehand, which i never got a chance to do
  • I mistakenly agreed for the lights to be switched off, which disconnected my from the audience.
  • I frequently switched between the demo, and the code, not giving folks a chance to absorb the code, and the impact of the demo
  • It wasn't clear which bit of code I was referring to
  • Still a little rushed, may'be packing too much in
  • I turned my back to the audience a couple of times
  • I got a little lost in my first demo (due to being rattled), and it took me time to get back on track
  • I was very nervous
  • It was my first ever one hour session, and there is a difference between this and 20 minute sessions
  • I never really let my style, and enthusiasm come across, due to the above events

The positives

  • I kept to time pretty well, and got across what i wanted to samplewise
  • I had a backup copy of XP
  • I felt my knowledge of Silverlight really came across
  • I think people will come away from this session, and be able to get started with Silverlight

All in all, I was very disappointed with myself, and I know that I can present so much better than I did. However I do have a good list of points that I can really work on to improve my presentations.

The bad news this was my better session, as the following session was a real disaster. I will follow up on what went wrong with this session later.

I still have to post up the samples, which will be later on

DDD Apology

I believe DDD was a great success, and hats of to Guy, Zi, Phil, Craig etc, for organising a great day.

Unfortunately, I must apologise for my sessions. I am highly disappointed in myself, as I know I can present around 1000 times better than i did.

If you attended any of my 2 sessions, I will post up my samples later on today. On a positive note, my samples are good.

I will be critically evaluating, what went wrong for me on the day, and how I will be resolving this in the future for later sessions.

I have learned a lot of lessons, and these sessions were my first ever one hour sessions, and this was my first time presenting at a conference. I do not offer this as an excuse, but just as a contributing factor. The blame lies purely with myself and my lack of experience is just a factor.

For those of you who attended my sessions, i thank you for turning up, and putting up with me. In the future i will resolve these issues (to be posted later), and I know that in my future sessions, I will be giving much better presentations.

Again thanks for coming to my session, and thanks to the guys at DDD (especially Guy Smith-Ferrier, who is an outstanding bloke, a real inspiration, and a real champion for developing UK speakers).

Let the critical evaluation begin........

Sunday, 18 November 2007

First draft of DDD sessions finished.

Well, it has been a very long few weeks (especially the past few days).

However, my first version of both presentations I am doing are now ready, yay.

The rest of this week, is just tidyup work, finalising some slides (i only have around 5 per session), finalising the structure, and going through it.

However, it is time to relax.

I have to say, I am particularly pleased with the "Silverlight Twitter" session.

Wednesday, 14 November 2007

The you choose nugget in Coventry

So I did a nugget in Coventry on Monday night for NxtGenUG. Thanks to Rich for letting me do this nugget.

I think this was my most challenging nugget to date. I had agreed to let the audience choose the nugget they wish to hear the most about any of the new C#3.0 language features and how they work at an IL level.

Not only did I have to prepare 6 nuggets, and only present one, but the presentation skills speaker was on after me. I was more nervous about this nugget, than DDD.

At the end of the night, I was really happy with the way i presented, and the speaker guy was absolutely amazing, and I have learned so much from him, and I am sure DDD will go so much better for it. He was really complimentry, and in the end I am happy and confident about speaking. Unfortunately I wasn't so happy with the subject in the end. I think it was a mistake to let the audience choose the nugget, however it was a great challenge to do so. I guess if you voted for another nugget, you wouldn't be happy that i presented a different one.

I also think the subject was to deep to be doing as a nugget for a user group evening. I think in future, I will keep this as an entire session, which allows me to tackle it (with questions), at a reasonable pace.

However saying that, I was suprised that the feedback (so far) is really good considering.


"great nugget - under a lot of pressure brave man - well done."

"Good stuff on the wrong night. I'm not sure I like to be asked which nugget I want - just feed me the nugget please."

"Enthused, indiviual brave and wears's a loud beach shirt to boot, now that's a guy you want at your next party talking about computers."

"Chris did extremely well to do a nugget off the fly, and managed to give a succinct and clear overview of lambda expressions in a very short space of time. Well done."

"The presentation chris provided was extremely good and interesting to see what is actually going on behind the scenes."

"Well prepared and presented."

"Sorry, just caught the last few minutes of the nugget, but liked what I saw - well done!"

"Very enthusiastic but a bit rushed; Nice shirt!"

" thought the point was being demonstrated (i.e. CLR has not changed) was covered quite well, but the 'show the IL or #1 then for #2' didn't really work so well. It would have been a little better if there were a way to see the IL side-by-side. I accept that the IL is the same, but it wasn't really possible to confirm that with your own eyes as #1 was removed from sight to show #2."

Some really great comments, very constructive, and will really help me improve my sessions. I have only been speaking for 2 months now, so this is really helping me find my style, groove, and preparations.

Thanks again to all the guys in Coventry for being brilliant.

Thursday, 8 November 2007

Silverlight and WCF Services

This is a pretty good article on how to expose a WCF service to AJAX. AJAX accessing uses JSON to interact with web services. In order to achieve that you need to make the service as Scriptable.

Although this article is describing interacting AJAX and WCF, the same technique applies for exposing WCF services to Silverlight. Please note for silverlight you must have the service running under the same domain (as cross domain communication isn't supported at this time).

Tuesday, 6 November 2007

Automatic Properties Nugget Feedback Birmingham

I've got some early feedback in from Dave at NxtGenUG Birmingham.

2 x 9's
3 x 8's
1 x 6


"OUtstanding nugget again! Smooth, well presented."
"Good subject for a nugget"
"I don't think there was much discussion on IL. The automatic property was introduced quite decently. The presenter should have delved into some more details especially regarding its implications, in writing better code.. (smell free!).."

I don't expect too much feedback from this nugget as there was only around 15 people at the event. This was the feedback as of Friday.

All in all, I am very pleased with the feedback. I think I am finding my style and way for speaking, and getting more comfortable about it.

A Silverlight Image Map

I've been preparing one of my sessions for DDD, and trying to bring new and fresh samples for the talk. One of my aims is that even if you have seen a Silverlight session before, you will come away with some new and useful knowledge.

In my talk I will obviously cover the Image tag in XAML, which led me to creating a crude little image map as demonstrated by the XAML below:

<!-- An Image Map -->
<Canvas Visibility="Visible"
Canvas.Left="20" Canvas.Top="200">
<Image x:Name="myImage"
<Rectangle x:Name="leftEye"
Canvas.Left="42" Canvas.Top="48"
Height="12" Width="10"
Stroke="Black" StrokeThickness="2" Fill="Red" Opacity="0"
<Rectangle x:Name="rightEye"
Canvas.Left="57" Canvas.Top="48"
Height="12" Width="10"
Stroke="Black" StrokeThickness="2" Fill="Red" Opacity="0"

The key to how this works is, the rectangles being the click points. I.e. Its an image with 2 rectangles overlaying the image. By setting the opacity to 0, it makes the rectangles act as a hotspot even though its not visible.

Please note that I have used a fill, as the default fill is transparent, and therefore the center of the rectangle is not hittable, so it needs to be a solidcolorbrush.

Anyways I will demo this for DDD, and I will probably make it a little snazzier than it is just now.

Thursday, 1 November 2007

Automatic Properties in Birmingham

I was in Birmingham last night doing a nugget on Automatic Properties. I tried to demystify what is going on with Automatic Properties and looking at it from an IL perspective. We compared it to fields, and regular properties, and what is approriate in what situation.

I think it went pretty well (only feedback will tell), people didn't seem to be too scared by the IL. I was especially pleased that i seemed to do a lot better with timings, and I came in undertime (which is good), and gives me a warm fuzzy feeling for DDD.

My Silverlight laughing cavalier XAML thingy went down pretty well, so I think he will be making an appearance at DDD, and then I will make him available to download.

I will obviously post my feedback when it comes in (Good or Bad)

Thanks again to Dave and everyone at NxtGenUG Birmingham for having me speak.

Silverlight 1.1 has expired

My Silverlight 1.1 has expired, and there seems to be no refresh in sight.

Help me obi-wan guthrie, you're my only hope.

Seriously, we need a new refresh please?


I just reinstalled the refresh again, and my 1.1 is working again. Very bizzare as the error i got was definately about the version of Silverlight installed is no longer valid.

Well we will just wait and see

18th / 19th of March in the UK

On MSDN Flash, Daniel Moth has indicated something big is happening on the 18th and 19th of March.

I am assuming it is some sort of marketing launch for Visual Studio 2008, since the US marketing launch is February.

I guess I need to block out those dates

Sunday, 21 October 2007

Bizarre Keyword Search

I run google analytics on my blog to keep an eye on what content is interesting folks.

Today, the most bizarre search came through to my blog.

Somebody from Google (Mountain View), was searching for "free pizza cambridge uk". They got to my blog due to the fact that I advertise the Cambridge region of NxtGenUG (which I help coordinate).

I find it bizarre that whoever this person is who is visiting Cambridge, feels a major priority is getting Pizza and not paying for it. Don't you love our industry :)

Well Mr Google Person, you are very welcome to come along to one of our sessions, and get your free pizza.

Saturday, 20 October 2007

F# to become a part of Visual Studio

This is a superb announcement that F# is to become productionized and be given the same status as C#, VB etc.

Congratulations to both Don and James on this achievement.

Anyone who attends NxtGenUG Cambridge (which I help run), will have probably guessed that this announcement was coming. We had a great session from Don on F# on our launch event of the new user group. Don gave some very big hints that something was going to happen (and most of us had already guessed this might be it).

So a big congrats from everyone at NxtGenUG, and I hope that we can have you back across doing another session (this time much longer) on F#.

F# really is a very cool language (and Don has a great book on it). I hope at some point to clear some time and write some F#

Thursday, 18 October 2007

ASP.NET rebuilding inapproriately

I have been aware of this awhile now, but it has only annoyed me enough today to blog about it.

If you are using Orcas Beta 2, ASP.NET Web Application Projects, if you modify the aspx file (not the code behind), it seems to be forcing recompile of the whole app. Aaaaargh.

I may have got some funny setting go on, but it is annoying

Wednesday, 17 October 2007

My speaking schedule

Unfortunately at the moment, I have been not well for the past few weeks. This has meant I haven't done much Silverlight etc. I have just increased my speaking schedule for the next few months, so I have a few more days to get better and then i need to get on with the preparation.

End of October: Automatic Properties nugget at NxtGenUG in Birmingham
Mid November: Nugget at NxtGenUG in Coventry
End of November: (hopefully a session at DDD, will find out this weekend if any of my proposed sessions are accepted.
December: Silverlight Christmas session (double act with Richard Costall) at NxtGenUG Coventry and Cambridge
January: Silverlight Session (not the same as the december one) at NxtGenUG Southampton.

I have made myself tired just looking at my schedule. Anyways I have a few days left to relax and recover.

Monday, 15 October 2007

Visual Studio 2008 - Go Online

Today, our TFS server was offline for a few hours.

VS2005 is normally a pain and requires me to track what changes i have made, and then prat around for around half an hour trying to get my changes checked in.

VS2008 is a dream, just click the "Go Online" button, and off it goes and works out which files you have changed.

I think this might be one of the best new features of Visual Studio 2008

Silverlight Controls rant

I just responded to a question on Silverlighters, and i figured i should publish my answer here too (it related to Silverlight controls).

The control providers are not really providing a useful set of controls at the moment. If you do use their controls you are likely to be locked into their technology (and unfortunately provided styles).

The main reason for this is that Silverlight at the moment doesn't include the standard set of controls that you would expect to build applications (Textbox etc), and get with WPF. The reason they haven't really provided these controls is that the plumbing for layout management (StackPanel, Grids etc) Databinding and Control Templating haven't been done. These features really need to be in place before MS will provide these standard controls. I believe that we will start to see a bunch of controls at the end of this year (based on what Scott Guthrie said at Mix UK), therefore I don't think you have to wait too long.

There are lots of things to get to grips with in Silverlight and if you are just playing, I would look at these fundamentals first (http://silverlight.net) as a great set of quickstarts). If you are really needing to get on with building applications and wish to use the standard controls in the future, I would consider Dave Relyea's controls (http://blogs.msdn.com/devdave/archive/2007/05/17/silverlight-1-1-alpha-layout-system-and-controls-framework.aspx), as they should have a smaller migration path when the standard controls are released).

If you don't care and just want some controls and start developing:

http://www.netikatech.com have a good set of free controls (same sort of controls as you get with WinForms), i believe they use the trick of interacting with HtmlControls (which is the current recommended practise for Textboxes etc).

http://labs.componentone.com/Sapphire/ also have some pretty controls

I would ignore Telerik (for just now) as they don't seem to offer much beyond what you get already in Silverlight.

Friday, 12 October 2007

DDD Voting Begins

DDD voting has now opened.

I have submitted a some sessions on Silverlight. If you are interested in Silverlight and will be at DDD, feel free to put some my votes my way.

There are loads of great sessions posted by some great folks, so the day will be a blast I'm sure.

Silverlight Mix Sample hits Silverlight.Net Galley

I just noticed this in Google Analytics, but my Mix UK event schedule Silverlight sample is now on the the Silverlight.net community gallery

Another nugget in Birmingham

I am back at NxtGenUG in Birmingham at the end of this month to do the first of a series of nuggets.

I am very pleased to be back as I really enjoyed the nugget i did there last month. And its nice to get to know the folks of Birmingham (my third month in a row in Birmingham).

This month I will be covering Automatic Properties, and will be digging down deep into what is going on behind the scenes at an IL level (scary I know but it is halloween).

Click here for further details of the event

Bug: Attaching to Debugger with asp.net development web server

I know i use a strange method of debugging but nonetheless it has always worked in Visual Studio 2005.

I start the asp.net development server via the command line and then attach to the debugger whilst working in asp.net.

This has always worked in Visual Studio 2005, but doesn't seem to work in Visual Studio 2008. I thought it might be something I have done on my machine (hence why i haven't blogged about it before), however Allister ran into the same issue yesterday.

I am not ruling out the fact that it might be something wrong with the solution or project files (haven't tried this against different projects), however it is a little annoying.

This has meant that i have been back to using the play button (i could instead use IIS and attach that way, but i don't want too).

Hopefully this will be fixed for the RTM.

Tuesday, 9 October 2007

NxtGenUG Cambridge October 23rd - XSLT 'Extreme'

This is a reminder about the October Cambridge NxtGenUG Meeting which will be held on 23rd October 2007 at St John's Innovation Centre.

"Watch out, Dave and Rich are in town, and Dave's got his XSLT hat on again, this time with knobs on! Yes its an evening with the NxtGenUG co-founders as Rich talks to his Vista in his award winning Nugget. Dave will be running through his XSLT 'Extreme' session which he will be giving at TechEd in November. Pizza and swag will abound as ever, don't miss it!

Due to building works at Microsoft, we are at our alternative venue at St Johns Innovation Center (thanks to our superb corporate partners www.red-gate.com for sorting this out). Don't worry we have also upped the Pizza order :)

Anybody is welcome to attend the meeting whether they are a NxtGenUG member or not. Just go to the NxtGenUG site at http://www.nxtgenug.net/ViewEvent.aspx?EventID=87 , register for FREE and book your place! We start sharp at 07.00pm and end at 09.00pm.

Main Session: Dave McMahon XSLT 'Extreme'
Is eXtensible Stylesheet Language Transformations (XSLT) the greatest language in the world as Dave claims? Well, no matter what you think, Dave think's so. In this session Dave takes a deep dive into some of the more obscure aspects of programming with XSLT in the .NET Framework. We'll look at a few of the not so common syntax, examine some of the advanced options available in .NET for working with XSLT. We'll look at differing forms of output including HTML, XHTML, XML, CSV, Word and XAML that XSLT can generate easily and also at how with a little magic, XSLT cam transform non-XML based data into other non-XML based data!

Nugget: Richard Costall Vista Speech - the Nugget
Richard Costall shows us the demo that went down a storm at DDD. Vista speech starring the Costall Stunt double. But just how good is Vista Speech? Find out in this 10 minute demo which will make you go - WOW!

To register for this event an for a map and directions visit http://www.nxtgenug.net/ViewEvent.aspx?EventID=87

Thanks, and look forward to seeing you in Cambridge on Tuesday 23rd October

Chris and Allister

Sunday, 7 October 2007


I was at SQLBits in reading yesterday.

I had a superb time and enjoyed the sessions very much.

The best session by far was "Dave's top 10 sql keywords" from Dave McMahon of NxtGenUG Apart from his wig and sunglasses, I was most impressed with SET LANGUAGE 'British' for solving Datetime conversion errors when working with the uk date format (the hacky way).

The second best session was by Simon Sabin and his SQL Server Myths. His session was very deep, and I have gained a much better insight into SQL Server from it.

The 3rd best session was the transactiony one, and my favourite snippet from that one, is SET IMPLICIT_TRANSACTIONS ON. This allows you to modify data within a transaction, so if you knacker up a where clause you can easily rollback.

I had a great day, and it was a superb event, and i will definately go to the next one.

I only have one real complaint for the speakers. When demonstrating code, set your font to Lucida Console, with the size being around 14. It makes a big difference to the audience.

Friday, 5 October 2007

Replication in SQL 2005

In our project (in my day job), we have just implemented the first version of replication.

This is a pretty tough challenge as we are taking replication beyond mere reporting. We have a very large system, with millions of transactions per day. We also have multiple applications connected to the system.

This has meant to distribute load, we are using a subscriber database for non time latency critical tasks, and the publisher for the real time aspects. So we have this interleaving between the publisher and the subscriber based on the application at that point in time.

Although we are following a publisher-subscriber model, we will certainly be looking to use multiple publishers in the future.

To be honest this is pretty exciting stuff, and we are really pushing the boundaries of how you use replication and the performance benefits for us are incredible.

It does lead me to believe that replication is an underused feature in performance systems, and i can see as time goes by, even more use of it.

DDD Sessions

I've just submitted my third session for DDD.

The first 2 sessions of Silverlight are all about the grand tour of Silverlight, and getting to grips with Silverlight.

The third session, I guess is the next level. Its really for those people who have seen Silverlight Sessions before and want to go that little bit deeper and start building applications.

On the first 2 sessions, I want to be clear although they are about learning Silverlight, I will not rehash sessions you have seen before, I will try and bring an original spin, fresh samples, fresh demo's. So hopefully if you have seen Introduction to Silverlight Sessions before, you will get something new from this. If I don't manage to achieve this, then I am truly sorry.

One of the frustrating things about DDD is that we won't find out for 2 weeks which session (if any has been successful). Which then leaves 4 weeks to prepare, where if I start preparing now, I have 6 weeks. However that preparation might be wasted if not voted in.

Therefore I am going to take the opinion, that I have a session on Silverlight in Southampton in January, so if I start the preparations for that, it should fit together with everything else.

Wednesday, 3 October 2007

Trunc with Replication and reseeding indexes

Thanks to Allister for this one.

With replication in SQL Server 2005 you cannot trunc a database table.

Therefore you have to delete the contents of the table and reseed the index.


The reseed command is useful for those tables where you need to reseed in 2 way replication (because you have been a naughty boy and have not used guids).

Tuesday, 2 October 2007

Application of multiple CSS Tags & Inheritence

Following my back2basics thing at the moment.

CSS does not support inheritence of tags, however it does support the application of multiple tags.

Therefore the following allows you to apply 2 styles to one label.

<asp:gridview id="myGrid" autogeneratecolumns="true" cssclass="GridStyle1 GridStyle2" runat="server"></asp:gridview>

Interestingly enough i was interested in the order of preference (for style clashes). Using Visual Studio 2008 and its CSS properties functionality, i discovered that the order of preference comes from the order of the tags in the CSS file (first style found takes precedence).

Therefore be careful about how you order your styles in CSS.

Back to Basics

At the moment, I am doing the whole back to basics thing in .NET.

I think I have learned many things in my many years of .NET, but I have also forgotten many things, or missed many things.

I think I am going to go back to basics and revisit many of the things I have learned with the hope of gaining stronger knowledge.

I will dump this sort of stuff in my blog for just now, but i think in the future I will sort out my website (in order to gain some structure for this).

Wednesday, 26 September 2007

Feedback in from my nugget in Birmingham

Well the feedback is in, from the nugget I did in Birmingham on Monday night at NxtGenUG.http://www.nxtgenug.net/

All in all, I am pretty pleased with the feedback, so I guess it's time to get on and do more speaking.

Thanks again to everyone who was there on Monday, I really enjoyed it, and I'm glad you did too.

The feedback is below:

Really good, more time spent on this presentation would have been good.
(9) 25 Sep 2007 17:09

Very quick, intense review of some of the new features available in Orcas, could have done with more time for the quantity and quality of information.
(9) 25 Sep 2007 16:09

No Comment
(9) 25 Sep 2007 03:34

Great litle nugget. Wouldn't mind seeing an entire session dedicated to this.
(9) 25 Sep 2007 03:21

I'm a little biased on this one. However i would be crazy to mark myself down. You need to work on your timings more Mr Hay.
(9) 25 Sep 2007 04:56

No Comment
(8) 25 Sep 2007 05:36

No Comment
(8) 25 Sep 2007 04:50

Chris - how did you pack so much into so little time! A classic example of how to do a nugget!
(8) 24 Sep 2007 19:55

No Comment
(8) 25 Sep 2007 04:21

Good to just get a wistlestop tour on things that really matter to developers rather than the usual blurb!
(8) 25 Sep 2007 06:00

Great enthusiasm from Chris, the demos helped this nugget to be informative and the examples demonstrated each aspect clearly as well. Overall a good use of the short time we have for a nugget.
(8) 25 Sep 2007 12:51

Full of useful tips.

Tuesday, 25 September 2007

Iron Python in Silverlight

Michael Foord has got some great stuff on Silverlight with IronPython. You can see his Web IDE and other cool stuff at http://www.voidspace.org.uk/ironpython/silverlight/index.shtml

Michael did a very succesful talk at Mix earlier this month (which I didn't see unfortunately), but I heard a lot of good things about, and I believe he has a proposed session in at DDD in November (so hopefully i will make it this time).

I got a great comment on my blog from Michael,

"Hey, I didn't manage to find you at Mix - but I wanted to say thank you.I did a talk on IronPython and Silverlight at Mix, and a lot of your blog entries were inspiration for me.So thanks. :-)", which is kind of cool, if you look at the navigation bar it looks like the SKY EPG (which I am assuming he used the how to make a button tutorial) :)

I'm pleased that blog is proving useful to folks, and I promised to start writing more Silverlight soon, rather than just about community stuff (as I am the moment).

Anyways, I'm gonna take a couple of days off from technical blogging about Silverlight and resume service next week, I think.

Last Night's Nugget in Birmingham


So i've just done my first ever nugget / speaking gig. My subject was Visual Studio 2008 (Orcas) for Web Developers targeting .NET Framework 2.0.

Thanks to Dave McMahon of NxtGenUG for letting me doing my first ever nugget up there. The guys at our sister region in Birmingham are brilliant, and I will certainly try and get up to their user group as much as possible (it is a trek though).

I was hugely over ambitious with topic, and subsequently ran out of time. Guy Smith-Ferrier was curious before the event on how i was going to cover such a topic in such a short time frame. I think the answer was naiveity, over optimism, and lack of experience. As we later discovered, really I could cover this as a main session rather than as a nugget. Thanks to Dave for humouring me, and let me stretch the time boundaries as long as possible.

Despite my timing problems, and the fact that i barged through the presentation trying to get as many features in as possible, i think it went pretty well. However feedback will reveal all.

A special thanks must go to Guy for being so supportive, and being a brilliant speaker. So I have taken some of advice on board, and I am now bashing on with trying to get more involved in the speaking community. I have taken some great tips from him, and i learned loads from last night, so onwards and upwards to my next speaking gig.

On that point I am offering 2 sessions on Silverlight for DDD6, so hopefully the community will vote for one of them, and I will get a chance to present at such a large event.

Anyways enough of the waffle:

Here are the slides and sample code for last night.

Monday, 24 September 2007

My Picture is on the Mix Backnetwork

I did my first ever .NET presentation a couple of weeks ago at Mix.

I hijacked the Micropresentations to do a short demo on the Silverlight Agenda application i created, and the Sky EPG reconstruction (I still need to post the source and samples for this).

I was just on the backnetwork and I recognised a piccy of myself doing the micropresentation (my mother would be very proud).

Anyways, that was my first ever speaking thing on .NET, and tonight is my first ever nugget / technical thingy (see previous post).

Interview with Scott Guthrie (covers Silverlight, MVC, Offline)

This is kind of interesting.

Its an interview done with Scott Guthrie. A lot of the info in the article, Scott talked about already at Mix, but its just nice to see it in one article.

The interview covers offline access (interesting he gave the same answers in the interview, as the answers he gave when i asked him a similar question at the cup of tea session).

It also covers MVC, Moonlight, Silverlight, asp.net etc.

NxtGenUG Birmingam Nugget tonight

I think I will be coming to the end of my blogging blackout, I have imposed over the past week.

Last week was a little crazy with a loads of stuff going on, hopefully things should calm down a little this week.

I am doing a nugget tonight in Birmingham at NxtGenUg, on Orcas Beta for Web Developers targeting 2.0..

I am pretty stoked about doing this as its my first speaking gig. Hey its only 15 minutes, but you have to start somewhere.

Although, I have had my talk prepared for a while now, I spent some of this weekend modifying it so I can keep it within the 15 minutes. I think the modifications i made should make the whole thing a little slicker. The good news is Maximum Code, Maximum Demos, Minimum Slides.

Anyways, I will post about it tomorrow, and include links to the slides and sample code.

Thursday, 20 September 2007

NxtGenUg Southampton

And the empire expands.....


Then there were 5! Two months, two new regions, first Cambridge now Southampton. Yes, The Next Generation User Group (NxtGenUG) is expanding (again) and this time they're heading South. The latest and warmest region of NxtGenUG is Southampton. The region is being organised and run by John McLoughlin and Rick Allen two local guys who have sourced a venue, projector, screen, pizza, swag and speakers all on their ownsome - all that a User Group needs or could ask for!

As ever when a new NxtGenUG region opens they insist on having a 'Launch' extravaganza, and this one is no different! The event will be held on 18th October 2007 at St Andrew's Hall, Southampton. The main speaker for the evening is top UK Community speaker Guy Smith-Ferrier speaking on Astoria and there will be a SQL Nugget from Dave 'Readyboost' McMahon. Pizza and Swag will be present also in abundance. All the details of the meeting are at http://www.nxtgenug.net/ViewEvent.aspx?EventID=85, and you can register for the event as always through the NxtGenUG website. Don't miss out on this event which kicks off at 6.30pm and finishes at 9.00pm, as there is only ONE launch meeting after all.

NxtGenUG are a User Group focused on current and future technologies and provide monthly meetings in Birmingham, Cambridge, Coventry, Oxford and Southampton. They love technology, chatting, pizza, swag, Halo 3 (well Richie Costall does) and having a laugh. If you're in one of their areas, get along to one of their meetings and get involved in the UK Community, its well worth it socially and professionally! Visit their website at http://www.nxtgenug.net

Cambridge Launch has been and gone

So we finally launched our first meeting of the new Cambridge region of NxtGenUG (.NET User Group).

It was a great night, both Mike Ormond (who was speaking on Silverlight), and Don Syme (speaking on F#) were superb.

We were a little worried about attendance (10 minutes before start there were 5 people, including ourselves), but we delayed the start until 6.45 and in the end we had 28 folk there.

I think it went very well, i know i enjoyed it (but I am biased), so we are now awaiting feedback to see how other folks enjoyed it.

This is pretty much the reason I have been blogging quiet for the past few days. And now i prepare for my nugget in Birmingham (so will be quiet for another few days).

Normal blogging will resume next week.

Wednesday, 12 September 2007

Distributed (Mesh) Computing with Silverlight

Following on from a bunch of previous posts mainly distributed computing in silverlight

Also the silverlight connected client without polling part 1 and part 2

I think its fair to explain that the source i posted up for part 2 is an example of Silverlight Distributed computing in action.

For example we could replace the for loop, and use some other client executable code, such Searching for Alien Life Forms, Performing Indexing for Google, Being a Google Autobot, the possibilities are endless.

I think I am going to explore this a little in the future, and try and post up some interesting utilities.

I will also clean up the server side code to be a little more real world, rather than play demo (please be aware it took me less than a hour to knock up that code last night).

Here is the source anyways

Silverlight Client Update without Polling part 2

Following up from my previous post which i posted at Mix UK.

Here is some of the specifics on how it works:

1) You should host your asmx file within the same web project you deploy your silverlight app on (to avoid cross domain issues)
2) remember to mark your class as [System.Web.Script.Services.ScriptService] so you can access it via json within silverlight

This is a sample of the web service code:

public bool PerformCalc()
//_startCalc = false;

while (!_startCalc)

// Start the calc
return true;

public bool StartCalculation()
_count = 0;
_startCalc = true;
return true;

Essentially we have two web methods

1) One method Kicks off the calculation (i.e update the client)
2) The other method is called asynchronously, and essentially blocks until we kick off the calc.

This has the effect that the client will accept the update at anypoint without polling.

Here is the client code:

private void RegisterForCalc()
_request = new BrowserHttpWebRequest(new Uri(serviceUri));
//_request = new BrowserHttpWebRequest(new Uri("http://www.chrishay.com/Silverlight/Mesh/MeshService.asmx"));
IAsyncResult iar = _meshWS.BeginPerformCalc(new AsyncCallback(OnPerformCalc), _request);

public void OnPerformCalc(IAsyncResult iar)
for (Int64 i = 0; i < 10000; i++ )
// do nothing
string blah = "blah" + i.ToString();
tbCalcCount.Text = string.Format("Local Count: {0}, Total Count {1}", 10000, _meshWS.GetCount());

Essentially this post shows that, we call the web service asynchronously, and then we perform some code client side, when we receive a repsonse from the web service.

Essentially you can use the code todo a lot of things you can't do just now (until sockets comes along)

For example:

Stock Ticker

Silverlight: Updating a connected client without polling

I'm currently at Mix UK in London.

Yesterday at the Keynote at company called dot net solutions, demonstrated their Silverlight Scrumwall application, which was pretty cool.

The interesting part of the demo, was that they used asynchronous web services, and blocked the thread at the web service, in order to send updates to the client (without polling). In a world of sockets in Silverlight this sort of code is unnecessary but since we don't have socket support at the moment, it is a cool workaround.

They claimed to be the first to do it in Silverlight, so on that basis I will claim to be the second.

I can't give you an online demo as my server doesn't support 3.5 (2000) and targeting 1.0 is a hassle from vs2008, or if you want you can download the source.

I would suggest you point 3 browser windows on your own machine when you run the demo, click the "connect client" button for all 3 browsers, and then click the "Perform Calculation" button.

I will look into getting this hosted somewhere else.

Tuesday, 11 September 2007

Distributed Computing (Mesh Computing) with Silverlight

Somebody at the Developer panel at Mix Uk, mentioned Mesh computing with Silverlight, which is focused at the moment on Storage based computing.

This got me thinking that we could connect up enough browsers to perform lots of calcs (alien searchy thingies), and send the results back to a web service.

This is more of a mental note for me to mock something up at some point, to show my point.

Perhaps some complex calc, show timing for calculation.
Show the calc halve, when another browser connects.

Silverlight and Offline Storage

I've posted about Silverlight Offline before (see this article)

I had a chance to ask Scott Guthrie today at Mix UK 07 about offline storage.

There are a couple of points which very interesting, the reason MS say they don't support offline storage is due to the definition of what being offline means. The sticky points are "what should happen to the data when the browser is closed?", Silverlight will not autosave data by default. You will lose your data if the browser cache is cleared. This behaviour is ok to us as developers, but not necessarily to all consumers.

So we can use features such as isolated storage in Silverlight, we just need to be clear to our users what it means?

Good news MS plan to up the Isolated Storage limit from 1Mb to a higher number (and allow users to increase that limit).

Other good news Microsoft plan to allow cross url access to the isolated storage, i.e. at the moment www.roskakori.net/fred.xaml and www.roskakori.net/bob.xaml would use seperate storage areas

Silverlight Controls Timeline

At Mix UK today, and Scott Guthrie reckons that we will start to see a decent set of controls (stackpanel, textbox etc) for Silverlight 1.1, by the end of this year and a refresh every 4 weeks after.

The controls will be provided in a supporting toolkit (with source). V.Cool.

Wednesday, 5 September 2007

Silverlight 1.1 updated feature list

Scott Guthrie has updated the list of features they plan to support for 1.1.

"Silverlight 1.1 Update
Now that Silverlight 1.0 is out the door, my team is cranking hard on our Silverlight 1.1 release.

Silverlight 1.1 will include a cross-platform version of the .NET Framework, and will enable a rich .NET development experience in the browser. It will support a WPF programming model for UI - including support for an extensible control model, layout management, data-binding, control skinning, and a rich set of built-in controls. It will also include a subset of the full .NET Framework base class library you use today, including support for collections, generics, IO, threading, globalization, networking (including sockets, web-services and REST support), HTML DOM, XML, local storage, and LINQ.

You'll be able to use any .NET language to develop a Silverlight application (VB, C#, JavaScript, Python, Ruby, Pascal, and more). It is going to really open up a lot of new development opportunities."

None of this is really new information (he has posted it in snippets in other blogs), however it means we know where we are heading now.

Silverlight 1.0 Released and Silverlight for Linux Announced


Silverlight 1.0 has now been release, this a major milestone. Well done Microsoft, and Scott Guthrie has now promised that his team are now focused on 1.1 (the most important release in my opinion). Read all about it at Scotts blog

They have also announced they will collaborate with the moonlight folks on Silverlight for Linux.

This truly will be a cross platform triumph, Silverlight really will be the way we do web in the future (and the future is pretty close)

Tuesday, 4 September 2007

Starting Development Web Server from Command Line in Orcas Beta 2

This is a followup to my previous post

To start the Development Web Server in Orcas Beta 2 from a command line / batch file, you need to use this command:

"C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE" /port:8080 /path:"mywebsitepath"

Visual Studio 2005 and Orcas co-existing, running Web Application Projects

Continuing my series of how to make Visual Studio 2005 and Visual Studio Orcas co-exist, and how Framework targeting works.

There is one further change required for web application projects:

Before conversion:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" />

After conversion:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />

If you try this on a machine without VS.NET 2008 Beta 2 installed the project will fail to load because it cannot find the v9.0 path being referred to. The solution is to alter the converted line and replace it (using Notepad) with:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" Condition=" '$(Solutions.VSVersion)' == '8.0'" />

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" Condition=" '$(Solutions.VSVersion)' == '9.0'" />

This way the correct version of the Web Application Projects targets will be loaded depending on the version of VS.NET you are using.

This does however knacker MSBuild (arrrgh), so the best method is to modify this file in a custom task in TFS (which i guess I will create on monday)

Thanks goes to Tom Blackburn on this one

Monday, 3 September 2007

Not written any Silverlight in a few days

I think i might be getting withdrawal symptoms.

The company i am working for have just let me know they plan to send me and a few others to TechEd in November. Therefore i have decided to enter Speaker Idol. I think 3 minutes might be harder than 20 minutes.

I have my first speaking nugget in Birmingham at the end of this month, and we launch the Cambridge region of NxtGenUG .NET User Group this month.

I am at Mix (as a delegate), next week, and then I head off to Vienna for a few days holiday.

And I am in Reading tomorrow meeting some folks at Microsoft (and attending the MSDN Evening event).

Life is busy, not had time to write Silverlight, but I think i will now go and spend some quality time with my Daredevil comics.

Orcas Bug? Test View

I have find the quickest way of writing code these days, is to sort of follow Test Driven Development.

I am not anal about it, I just believe it is quicker for me to write code against a unit test, and debug the unit test, rather than the application. This strategy has saved me a ton of time.

Now that I am using Orcas in my commercial environment, annoyingly enough I am getting the following error when i attempt to debug a unit test:

"Failed to queue test run 'ch3@20070806PC01 2007-09-03 13:00:53': Unable to start program 'c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\vstesthost.exe'."

If i just run the test, it works fine, it is only when i attempt to debug it.

I've discovered what was causing the problem, I have a little batch file, which i haven't update which starts the WebDevServer (Cassini), but this is launched from .NET Framework 2.0.

I never run VS directly (in my work environment), I always attach to the debugger.
For somereason when i debug the unit test, it seems to clash with the WebDevServer, and it dies a horrible death.

Friday, 31 August 2007

Visual Studio 2005, Visual Studio 2008 co-existing peacefully

If you want Visual Studio 2005, and Visual Studio 2008 to co-exist peacefully for the same projects, this might help you out.

I would recommend you minimize the impact of the conversion wizard by following this procedure.

1) Make a copy of your existing solution file (i.e. to have VS2005 and VS2008 version of the solution file, e.g. MySolution.sln and MySolutionOrcas.sln)

2) Open up the new solution, and choose not to convert any projects in the solution

This means you will be able to develop using Visual Studio 2008, and Target .NET Framework 2.0, but still be able to use Visual Studio 2005 (if required), or if other project members haven't moved across to Orcas yet.

Finally this method should also work with TFS meaning, you can develop with Orcas but your build server will know no better (I haven't tested this yet, but I'm pretty sure it will be OK as I have tested it with msbuild)

If you run into trouble you can do it manually:

For each project file in the solution change the first line from this:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

to this:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="2.0">

The important part is the ToolsVersion="2.0", this will mean that VS2008 will not attempt to convert this project, and will target framework 2.0 for you :)

Finally once you have modified all the project files, you can open the new solution file (MySolutionOrcas.sln) in Visual Studio 2008 (Orcas Beta 2)

You can now allow Orcas to convert your solution (and it will not attempt to convert any of the other projects to Visual Studio 2008)

Silverlight and Google Gears

Logically it makes sense that Google Gears and Silverlight would be able to talk to each other.

Infact here is an interesting article where this has been done.

I will even find some time, to do this myself at some point, as I think it would be an interesting thing to do.

However, I can't help thinking we wouldn't need to think about using Google Gears, if Microsoft provided more than 1MB of Isolated Storage per application.

Please, Please, Please increase the Isolated Storage Limit (and as per my previous post on Offline Storage), please put some work into supporting Offline Silverlight.

Thursday, 30 August 2007

My Server is Back


Hosting Server is down

My hosting server is down at the moment, and won't be back up until later today.

This means you won't be able to view any of the online demo's or download the source just now for any of the samples.

Hopefully it will be back up this evening


Tuesday, 28 August 2007

Orcas Framework Multi-Targeting

Within Visual Studio Orcas, the concept of framework targeting is introduced.

You can target any project or solution to any of the following versions of the .NET Framework.

.NET Framework 2.0
.NET Framework 3.0
.NET Framework 3.5

Visual Studio 2008 (Orcas) will always use MSBuild Toolset 3.5, which means that regardless of your targeted framework, and even though the code is compatible with .NET Framework 2.0, it will be generated using the latest C#, VB Compiler (not the compiler that shipped with 2.0).

This means that you can use features that produce IL compatible with .NET Framework 2.0 (e.g. Automatic Properties), but you can't use incompatible features (e.g. LINQ).
The code you deploy will be fully compatible, and will reference the dependant assemblies (system, system.data) that shipped with 2.0, but the IL will be produced by the latest compiler.

There is a word of caution here, if you use new language features you will not be able to continue to use Visual Studio 2005 (or existing TFS Build Server, MSBuild (for .NET 2.0)), you also cannot use Websites (not Web Applications), as this is compiled on the website.

If you are paranoid about beta code, then you should therefore develop in Orcas (ignoring new language features, and build in VS2005, or using the earlier version of MSBuild).

Visual Studio 2008 will also stop you from using the features of an earlier framework, until you retarget the framework (which you can do at anytime, (Right Click on Project, Select Properties, Application Tab, Target Framework)
). The support in the IDE is so good, that it will even hide web control specific to .NET Framework 3.5 (e.g. LINQDataSource and ListView).

There is only one gotcha to really be aware of, if you upgrade a solution to Visual Studio (2008), you will need to prat around with the solution to make it work again in Visual Studio 2005 (i.e. the version number in the solution file). This is a bit of a pain, but not the biggest deal in the world (since this is the only change).

Sunday, 26 August 2007

How to make a Button in Silverlight 1.1

In my button we will change the color of the canvas in on mouse hover, and allows you to implement the click logic at the TODO.

You can use this code for your own buttons.

The important points are:

MouseEnter - When we hover over the button
MouseLeave - When we stop hovering over the button
MouseLeftButtonDown - When you hold the mouse left button down
MouseLeftButtonUp - When you release the mouse left button.

A click is only considered a click, when you are hovered over the button, and the MouseLeftButtonUp.

On MouseLeftButtonDown you need to capture the mouse input, and release the mouse capture when finished (so mouse input can be capture by other objects at another time, you can only capture mouse input if no other object has captured mouse input).

Finally we do a final cleanup (if necessary) on the canvas to ensure we have released the mouse capture.

One final thing to note, within the XAML for the canvas we use the Cursor attribute to define the mouse cursor to use.

Go Enjoy, and make Buttons (whilst you can), before Microsoft makes it even easier for us :)

Here is the XAML for my Button:

<Canvas xmlns="http://schemas.microsoft.com/client/2007"
<TextBlock x:Name="tbMenuText" Foreground="White" FontWeight="ExtraBold" FontSize="28"></TextBlock>

Here is the C# for my Button:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace MySilverlightProject.SkyEPG
public class MenuItem : Control
public MenuItem()
System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("MySilverlightProject.SkyEPG.MenuItem.xaml");
implementationRoot = this.InitializeFromXaml(new System.IO.StreamReader(s).ReadToEnd());
tbMenuText = implementationRoot.FindName("tbMenuText") as TextBlock;

// Set the root leave
implementationRoot.MouseLeave += MenuItem_OnRootLeave;

#region properties
// private members
FrameworkElement implementationRoot;
private TextBlock tbMenuText;

/// <summary>
/// Text
/// </summary>
public string Text
return tbMenuText.Text;
tbMenuText.Text = value;

#region Mouse Handling
// By Default mouse over is false and mouse down is false
bool mouseOver = false;
bool mouseDown = false;

/// <summary>
/// On enter set the color to yellow
/// </summary>
/// <param name="o"></param>
/// <param name="e"></param>
protected void MenuItem_MouseEnter(object o, EventArgs e)
// Get the menu item
Canvas menuItem = (Canvas)o;

// We have a mouse over
mouseOver = true;

// Set the background color to gold, text color to dark blue
menuItem.Background = new SolidColorBrush(Color.FromArgb(255, 255, 215, 0));
tbMenuText.Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 139));

/// <summary>
/// On leave, set the color back to Dark Blue
/// </summary>
/// <param name="o"></param>
/// <param name="e"></param>
protected void MenuItem_MouseLeave(object o, EventArgs e)
// Get the menu item
Canvas menuItem = (Canvas)o;

// Set the background color to Dark Blue, text color to white
menuItem.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 139));
tbMenuText.Foreground = new SolidColorBrush(Colors.White);

// No Mouse Over
mouseOver = false;

/// <summary>
/// Mouse Left Button Down
/// </summary>
/// <param name="o"></param>
/// <param name="e"></param>
protected void MenuItem_MouseLeftButtonDown(object o, MouseEventArgs args)
// Mouse Down
mouseDown = true;

// Get the menu item
Canvas menuItem = (Canvas)o;

// Capture the Mouse

/// <summary>
/// Mouse Left Button Up
/// </summary>
/// <param name="o"></param>
/// <param name="e"></param>
protected void MenuItem_MouseLeftButtonUp(object o, MouseEventArgs args)
// Get the menu item
Canvas menuItem = (Canvas)o;

// Release the mouse capture

// Check if we have a click (mouse over, and mouse down)
if (mouseOver)
// TODO: Implement Click Logic Here

// No Mouse Down
mouseDown = false;

/// <summary>
/// When the mouse leaves the root visual we lose the capture - reset the state
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
protected virtual void MenuItem_OnRootLeave(object sender, EventArgs args)
// Clean Up
if (mouseOver || mouseDown)
// Release Mouse Capture
mouseDown = false;
mouseOver = false;

Making Buttons

Although the button has been implemented in the Silverlight Sample Controls Toolkit, I don't think is particularly useful until Silverlight supports templating.

You could use the ButtonBase class and implement a new control which inherits ButtonBase, however I feel you are avoiding writing code, and you would be better to understand a button on your own. In a sense it is almost simpler just to implement a button yourself.

Therefore in the next post i will discuss how to make your own button (with code), and why we do things a certain way. This is good knowledge to have even thought its something we will not worry about in the future. The reason we will not worry about it, as we will just use a templated button from the standard set of controls.

Waffle Over, Lets Make A Button.

Thursday, 23 August 2007

Partner Conference Silverlight Site

This page has some very cool silverlight on it(version 1.0)

The little tree thing is particularly cool :)


Wednesday, 22 August 2007


Microsoft has released a new sample website in Silverlight 1.0 called Tafiti

I recommend you look at the site, as it gives you a good clue on how Microsoft are doing certain things.

When I looked at the site, there was a nice little Textbox which perked up my interest?

When you look at the back end javascript, it is very clear they are using an Html Textbox with some pretty Xaml around it.

Its great that we can steal that techinique (even in Silverlight 1.1), however it does seem to indicate that we won't see any new sample controls for a while.

Well Done Microsoft, its a great sample site and we will be able to use a lot from it.

It would be better if you provided a 1.1 version as well, which would save us some porting, but definately good enough for me.

Sunday, 19 August 2007

Silverlight Downloader which works both with file system and online mode

One of the issues with the 1.1 Alpha Refresh for Silverlight is that if you attempt to use the downloader object when you are working from the local file system, it will throw up an exception. This forces you to work under IIS.

It is nice to work directly from the file system and skipping out IIS, but you want to develop your applications to use the downloaders from the beginning.

I have therefore created a little downloader which can be used for media elements (will not work for xaml, or xml documents), but will work great for images and videos.

This downloader class can work in multiple modes, if you are working under a file system, then it will just set the image, video sources directly for you (and won't use the downloader), if you specifiy a ZipFile it will download the zipfile for you (using the downloader (unless working in local mode, where it will use the local path and ignore the zip)), finally if you have multiple files to be downloaded (and don't want to use a zip file (large number of files to be displayed, and you wish to show them whenever they have downloaded, then this will also work for you).

The class declaration is below:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace Roskakori.Silverlight.Common.Controls
public class SchemeSensitiveDownloader
#region properties
private Downloader _mediaDownloader;
public string ZipFile { get; set; }
public List<FileDetails> Files { get; set; }

#region Constructors
/// <summary>
/// Constructor
/// </summary>
public SchemeSensitiveDownloader()
// Initialise
Files = new List<FileDetails>();

#region events
public event EventHandler DownloadCompleted;
public event EventHandler FileDownloadCompleted;
public event EventHandler FileDownloadProgressChanged;

/// <summary>
/// Download Completed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void _mediaDownloader_Completed(object sender, EventArgs e)
// Check if we have anything attached to the event
if (FileDownloadCompleted != null)
// Raise the File Downloaded Completed Event
FileDownloadCompleted(sender, e);

// Get the sender as a downloader
Downloader downloader = (Downloader)sender;

// Check if we have anything attached to the event
if ((DownloadCompleted != null) && ((downloader.Name == "zip" || (Convert.ToInt32(downloader.Name) == Files.Count - 1))))
// Raise the File Downloaded Completed Event
DownloadCompleted(this, new EventArgs());

/// <summary>
/// Download Progress Changed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void _mediaDownloader_DownloadProgressChanged(object sender, EventArgs e)
// Check if we have anything attached to the event
if (FileDownloadProgressChanged != null)
// Raise the File Downloaded Progress Changed Event
FileDownloadProgressChanged(sender, e);

/// <summary>
/// Download the files apporiately either as a zip, individually, or as one
/// </summary>
public void Download()
// Loop through all the files if we have a zip file, or if local
if (string.IsNullOrEmpty(ZipFile) || (System.Windows.Browser.HtmlPage.DocumentUri.Scheme.ToLower() == "file"))
// Initialise
int i = 0;

// Loop through all the files
foreach (FileDetails file in Files)
// File Download
if ((System.Windows.Browser.HtmlPage.DocumentUri.Scheme.ToLower() == "file") && (FileDownloadCompleted != null))
// Raise the File Downloaded Completed Event
FileDownloadCompleted(file, new EventArgs());

// Check if we have anything attached to the event
if (DownloadCompleted != null)
// Raise the File Downloaded Completed Event
DownloadCompleted(this, new EventArgs());
else if (FileDownloadCompleted != null)
// Initialise the downloader
_mediaDownloader = new Downloader();

// Set an identifier
_mediaDownloader.SetValue(Downloader.NameProperty, i.ToString());

// Add the event listener
_mediaDownloader.Completed += new EventHandler(_mediaDownloader_Completed);
_mediaDownloader.DownloadProgressChanged += new EventHandler(_mediaDownloader_DownloadProgressChanged);

// Open the downloader
_mediaDownloader.Open("GET", new Uri(file.Source, UriKind.RelativeOrAbsolute));

// Send the request

// increment
// Initialise the downloader
_mediaDownloader = new Downloader();

// Set an identifier
_mediaDownloader.SetValue(Downloader.NameProperty, "zip");

// Add the event listener
_mediaDownloader.Completed += new EventHandler(_mediaDownloader_Completed);
_mediaDownloader.DownloadProgressChanged += new EventHandler(_mediaDownloader_DownloadProgressChanged);

// Open the downloader
_mediaDownloader.Open("GET", new Uri(ZipFile, UriKind.RelativeOrAbsolute));

// Send the request

public class FileDetails
public string Source { get; set; }
public Control AssociatedControl { get; set; }
public string Filename
var uriParts = Source.Split('/');
return uriParts[uriParts.GetUpperBound(0)];

If you wish to see it in action you can look at Mix07UK Sample Site. Both an online demo and source is available.

Friday, 17 August 2007

Javascript Intellisense Bug in Orcas Beta 2

I've been preparing for the nugget i am doing in Birmingham next month at NxtGenUg (I will follow up details on a later post).

I've been working on the ins and outs of intellisense for Javascript.

For some reason whenever i split code between files, intellisense doesn't seem to like it so much.

So for example if i have a person object function, and a test function in the same class, intellisense will work, and i can see the FirstName and Surname properties.

<script type="text/javascript">
function Person(firstName, surname)
/// <summary>This is a person class</summary>
/// <param name="firstName" value="string">The first name of the person e.g. Johnny</param>
this.FirstName = firstName;
this.Surname = surname;

function Test()
var newPerson = new Person("fred", "jones");

If however i move the Person class from my aspx file into a seperate .js textfile, intellisense breaks.

<script type="text/javascript" src="Person.js"></script>