I have a free Technet Plus subscription up for grabs. If you're a member of the Vista Squad usergroup, drop me an email on ray@vistasquad.co.uk with your username, full name, telephone number and full address and I'll send one of my subscriptions over to you.
First come, first served! :)
A reminder post for myself. If you're looking for where the standard Sharepoint field type definitions are stored, they are here:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\template\XML\FLDTYPES.XML
Found via MSDN.
"Found" an annoying little bug that I can't seem to get around while moving some Silverlight 1.1 code to Silverlight 2.0.
In this project, all of our controls have a base class that provides some common functionality. In Silverlight 2.0, now that we have proper user controls and that wonderful InitializeComponent() method, I've been moving all our old style user controls to the proper method.
However, Silverlight generates a partial class where the InitializeComponentMethod() sits, and this class is regenerated every time you change some of the XAML. Now the bug comes in here. When the class is regenerated, the base class you've chosen in your partial class is not the one that Silverlight uses in the generated code. It always sets it back to UserControl.
In our project, with around 50 controls, on an initial checkout, the developer has to go to 50 controls and change the generated code and on every XAML change, fix it too. I really do hope this is fixed in the next Silverlight release.
Just received an email from Ravi Nangunoori regarding his .Net video site he runs. Over 120 videos for free (you do have to register) all regarding .NET. You do have to register but its definitely worth it for the content. If you sign up now, you also get a free 6 month ASP.NET Pro magazine subscription.
Well done Ravi, keep up the good work
Dot Net Videos Site
Pretty cool news on the Silverlight front. With Silverlight 2 betas dues for release at Mix 08, Microsoft and Nokia have announced that Silverlight will be ported onto the S60 phones. At the moment, Silverlight on mobile is an empty space and with a partnership like this, Microsoft have a great footing into the Symbian world.
More information at BBC
Developer Day Scotland has hit the voting phase for talks. Head on over to their site to cast your vote for the talks you would most like to see.
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.
DDD itself is a highly successful community event held at Microsoft’s TVP Campus in Reading! There have been six DDDs so far, the first one back on the 15th May 2005, the most recent on the 24th November 2007. The Reading event attracts some 300+ developer-focused delegates. The success of DDD is best expressed through the registration rate: DDD6 was fully booked within 24 hours of registration opening.
Scottish Developers is pleased to bring this phenomenal success to Scotland. The very best of the UK speaker community will be presenting on the topics delegates wish to see. We’re working with interested third parties to supply all manner of additional CPD resources for those delegates interested in professional and career development.
The guys at Innerworkings are back at it! Partnering with Vista Squad, we have 3 hours of free training in the new features in .NET 3.5. I've used the Innerworkings software before and it is a great learning tool. Head on over and to sign up for this special offer which is well worth your time. Please remember that you need Visual Studio 2008 RTM and the .NET Framework 3.5 installed.
Have fun!
Pretty neat app from the guys at Triplewood. You can point it at a Sharepoint document library and get a great visualisation from it.

Coding for parallelism is never easy. Keeping track of threads, synchronisation issues and locking is incredibly hard. We've all had code where instantly we can see that running it in parallel would significantly improve the speed. But the overhead of making sure everything runs properly without any issues normally keeps us developers away.
Introducing PLINQ. In a nutshell it allows us to say what we need to be done instead of how we want it to be done. PLINQ simply builds on LINQ with extra extension methods, in this case AsParallel(). You can build your entire expression tree and simply add AsParallel() to the end which tells the runtime to run the jobs in the query in parallel.
When I say run the query in parallel, this is not totally true. The runtime determines which jobs it can run in parallel and how this will be accomplished
Johan and I cooked up a magical example today to show this in action. An easy example is calculating if a specific number is prime or not and perfectly suited for a parallel execution. We've attached the code so you can run this on your machine but an explanation is helpful.
Our code is very simple. We build up a list of numbers to check and run them both through a parallel execution test and a sequential execution test and time them both. We also run through different upper limits of the number list to test if parallel execution is faster in all instances; and it isn't.
So, on to the code. The full code in the link below so I'll show you the important parts, mainly the sequential test and the parallel test.
private long RunSequentialTest(List<PotentialPrime> numbersToCheck)
{ Stopwatch watch = new Stopwatch();
watch.Start();
foreach (PotentialPrime num in numbersToCheck)
{ var q = IsPrime(num.Value);
num.IsPrime = q;
}
return watch.ElapsedMilliseconds;
}
As you can see above, the method receives a list of numbers to check. We loop over the numbers, calling into a method called IsPrime() and sets the IsPrime property on the number. Pretty simple to do and quite fast to run.
The parallel method is a little different.
private long RunParallelTest(List<PotentialPrime> numbersToCheck)
{ Stopwatch watch = new Stopwatch();
watch.Start();
Parallel.ForEach(numbersToCheck, num =>
{ var q = IsPrime(num.Value);
num.IsPrime = q;
});
return watch.ElapsedMilliseconds;
}
Instead of calling foreach normally, the new class Parallel class gives us a static method to use. This will run the query we build in a parallel way if possible. The expression is essentially the same as the sequential test code-wise but should be executed faster ( in certain circumstances).
If you run the code, we do see times that the sequential operation is faster. This occurs in small numbers to check as there is an overhead of setting up and tearing down the threads so the parallel test does suffer. In my tests on a single core, single CPU intel, the moment we hit 5000 numbers to check, the parallel execution won hands down.
This is pretty interesting stuff and PLINQ is still in its infancy so we should see some cool stuff coming from Microsoft around this area. With the proliferation of multi-core CPUs in computers today, having an easy way to parallelise your code in .NET or in any language is now a necessity. Have fun!
Prerequisites:
Visual Studio 2008 RTM
.NET 3.5
PLINQ December 2007 CTP
Example Code:
Download here
Finally! I've been waiting for this for ages and now its available. Scott Guthrie has more details. First impressions are that the way it works is a little clunky, the first download of symbols takes quite a while (System.Windows.Forms is a 10MB download as an example) and you have no progress meter with Visual Studio being unresponsive until the download is complete.
Still, its worth it for when you're interested to see how the framework works internally with step-ins. All-in-all a good move by Microsoft. Remember guys, its a read-only license so no copying! :)
I thought a little Christmas Silverlight is in order, so the guys at Dot Net Solutions have cooked up a "Christmas Cool Wall" in the spirit of the season. Inspired by the Top Gear Cool Wall, our little application allows you to search for your favourite things and place them on your own special wall. Once you've chosen your presents for the year, you can then either save or share your wall with your friends!
Head on over to the cool wall to setup your gift list!
Christmas Cool Wall
A great article by Michael O'Brien at Innerworkings on how to get started with Silverlight.
One of the most talked-about aspects of Silverlight is its undeniable technical accomplishments. In an age of 50 megabyte downloads, Microsoft managed to squeeze large parts of WPF and a mini-CLR into a tiny browser plug-in, currently under 5MB. Not only that, but it runs in the three major browsers (Firefox, Safari and IE) and more amazingly on the three major operating systems, with Microsoft supporting Windows and Mac OS X and Novell’s Mono project providing a Linux runtime.
This article explains a little of the history behind Silverlight and what you can use it for. You’ll see how easy it is to get started, and then you’ll actually practice using a free InnerWorkings coding challenge featuring a sample app that demonstrates how to use and transform video in Silverlight.
Silver-what?
Windows Presentation Foundation Everywhere (WPF/E) was announced two years ago at the 2005 PDC (Professional Developer Conference), but kept a low profile for a long time. At Mix ’07 in May however, the first 1.0 beta was released under the Silverlight name, along with (a little confusingly) a preview of the 1.1 release.
Version 1.0 has now been officially released and can display vector graphics, animations and high quality video (up to 720p, the low-end of HD). You can program it using a subset of WPF’s XAML syntax, using JavaScript to provide interactivity.
Version 1.1 however – still in technical preview stage – is what’s got everyone excited. Much more than a minor revision, this adds a bite-sized CLR to the plug-in, capable of executing compiled C#, VB, Python and Ruby code. Though it is cut-down, the Core CLR still provides a just-in-time compiler and works with the exact same assemblies as the full-blown desktop CLR. If you can restrict yourself to the smaller set of classes included with Silverlight’s CLR, there is complete compatibility between the two, with no re-compilation necessary.
How does Silverlight work?
From a user’s point of view, the experience is designed to be as smooth as possible. On visiting a Silverlight-enabled site for the first time, a message appears inviting the user to download the plug-in from the Microsoft site. The install is quick and painless, although it can require a browser restart. After that, any Silverlight content is displayed automatically and the plug-in even updates itself as required.
The Silverlight SDK makes this experience easy by providing a JavaScript file that detects the plug-in’s presence and either just displays the content or prompts the user to install. The JavaScript also provides a way to display Silverlight content without worrying about the different expectations of the supported browsers.
The actual “scene” is defined in XAML, an XML-based format where elements and attributes correspond to .NET objects and their properties. This is the same XAML that powers WPF, just with some of the elements missing.
What’s left, at least in Silverlight 1.0, is enough to draw shapes, images, text and video. Some of the flexible layout options from WPF (like the Grid, DockPanel and StackPanel) are missing, along with any kind of prebuilt UI control – there are no buttons, menus, listboxes or anything. Though you can use HTML controls instead, this is a major shortcoming, and the Silverlight team have promised some of these controls for a future release of version 1.1, along with a set of panels to make layout easier.
To build an app that does more than just look pretty, you can attach event handlers to Silverlight objects and write code that manipulates the scene, starting animations, controlling video or audio playback and updating the properties of objects. Silverlight really does behave like a mini-WPF, so if you’re familiar with its big brother (or Windows Forms or ASP.NET for that matter), the programming model is easy to follow.
Hello, Silverlight
When you strip away the helper JavaScript files, very little is required to display Silverlight content in a browser that has the plug-in installed. The snippet below uses inline XAML to reference content defined in the HTML file, but you can just as easily use a file located on your web server (or one generated dynamically by ASP.NET).
Other than the XAML script tag, the snippet contains an object tag that actually creates an instance of the Silverlight control, passing it a reference to the XAML it should use (in this case preceded by the # symbol to specify the ID of the HTML element with the content). That’s it.
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<script type="text/xaml" id="xamlContent">
<Canvas xmlns="http://schemas.microsoft.com/client/2007">
<TextBlock Text="Hello, Silverlight!" />
</Canvas>
</script>
<object id="silverlightObj" type="application/x-silverlight" width="200" height="200">
<param name="source" value="#xamlContent" />
</object>
</body>
</html>
Displaying video with Silverlight
One of the strengths of WPF (and so Silverlight) is its composability: objects can be nested within each other easily to create composite objects. A button, for example, doesn’t have to contain just a text label, it could contain an image as well (or a video, or a tiny interactive game, or whatever you want). While many of these uses aren’t, well, useful, the simplicity that composability affords helps with all sorts of more common scenarios. If you want to display an image or video inside a circle or a rounded rectangle, you don’t have to set some obscure property of the image, you just pop it inside a suitably shaped container.
In the same way, Silverlight’s animation and transformation features can apply to video as easily as primitive shapes. This makes it easy to render video on objects that can be dragged around, or to zoom into or clip video. The key to this is the VideoBrush, which can be used to paint the interior of a shape with the output of a MediaElement. The MediaElement itself can then be hidden, leaving only the VideoBrush-painted shape visible.
Try it out
Silverlight is one of those technologies where words alone can’t possibly do it justice. Have a look at the tutorials at http://silverlight.net/ to find out more, or skip ahead to http://silverlight.net/showcase/ to see what can be done.
Next, download the free Silverlight challenges from InnerWorkings and get to grips with some real Silverlight projects. You’ll learn more about setting up Silverlight in your own apps, as well as practice using a VideoBrush to render and control video clipped and magnified according to your own specifications.
What’s an InnerWorkings coding challenge?
An InnerWorkings coding challenge is a sample of code in Visual Studio that has some key pieces missing. Each challenge includes selected reference links chosen specifically to help you find out how to fill in the blanks, complete the sample app, and learn about a new technology at the same time. Once you’re finished, InnerWorkings Developer automatically checks your code so you can be sure you’ve solved the challenge correctly and that you really understand what you’ve learned.
Our coding challenges are designed to take you to the heart of the technology you want to learn more about, focusing on the most important, practical features. Because everything has been set up for you, you can dive straight in and start coding.
InnerWorkings has a library of hundreds of challenges on diverse topics from ASP.NET to Windows Communication Foundation. For more information, have a look at our catalog.
About the Author
Michael O’Brien (http://mcobrien.org) lives in Dublin, Ireland where he works for InnerWorkings. He currently concentrates on the software that allows InnerWorkings Developer to check code solutions submitted to the code judging engine. When he’s not knee-deep in System.Reflection, he likes to play with ASP.NET and a little bit of Ruby.
Yup, they're ready to go! Download from
here.
Just a note for the rockin' ready 2008 installers. If you're wanting to develop Silverlight applications in 2008, you'll need to hold off on this for a couple of weeks.
From Scott Guthrie's blog:
Two popular add-ins to Visual Studio are not yet available to download for the final VS 2008 release. These are the Silverlight 1.1 Tools Alpha for Visual Studio and the Web Deployment Project add-in for Visual Studio. Our hope is to post updates to both of them to work with the final VS 2008 release in the next two weeks. If you are doing Silverlight 1.1 development using VS 2008 Beta2 you'll want to stick with with VS 2008 Beta2 until this updated Silverlight Tools Add-In is available.
Having been playing with Silverlight for a while now on official projects, I'm now working full time on a WPF application for a client. This blog should now be more heavily investing in WPF content as I work more in this area than Silverlight now. I hope to blog pretty often regarding some of the cooler things WPF can do, the pitfalls you may come across and get some knowledge into the domain.
If you're into WPF at all, start having a look at the CommandManager that comes in .Net 3.0. Pretty neat stuff for separations of your logic and display and really helpful in what we're currently doing.