Behold the turtle

jb's Blog

"behold the turtle, he only makes progress when he sticks his neck out"
Andrew posts about the NHAML View Engine 20 Dec 2007 09:29

Last week we had the news about the ASP.NET MVC Framework, which has spawned a fever of interest from the community at large. Andrew who has been doing some Rails work of late decided that he would make a port of the Haml view engine from Rails and port it over to become a view engine for the MVC framework as a pet project - nice one!

Check out Andrews very lengthy post on NHAML (pronounced: Enamel) for more details and give it a try :)


comments
Finally talking about IE8 20 Dec 2007 09:01

So a bit of new news today about Internet Explorer 8 (IE8) which has been getting a bit of interest since Bill Gates started talking about it. Have a read of the official post here and there is also a video up on Channel9 - note: no new chrome yet.

One of the talking points in the current round of information is the major milestone that IE8 as of last week renders Acid2 correctly (when in Standards Mode), bringing it inline with Opera, Safari, Konquerer and Firefox 3. This is awesome news and a great step forward from a standards perspective!!

The discussion around how IE8 standards mode actually works is likely to bring up a bit of debate and probably contention; as a bit of a background on this - most modern browsers render in two different modes, quirks mode and standards mode. There is also an "almost standards mode" for browsers that are almost there but not quite - such as IE7 and Firefox 2.

Based on the DOCTYPE of the page the browser will determine which mode it will use to render. IE8 is going to work the same in this regard, however its "quirks" mode is described as being IE7 compatible rendering as based on DOCTYPE, with standards mode being opt-ed into by inserting a new HEAD tag. So this means that XHTML 1.0 Strict is not going to render in standards mode?!? (but in IE7 compatible almost standards mode)

Sounds a bit iffy to me. I personally hope that they reverse on this one and simply render based on the DOCTYPE. The rational given is simply one of backwards compatibility and minimising the impact on customers who have sites deployed that render correctly under IE7 today but would break under IE8s new standards compatible rendering. Clearly there are pro's and con's in either direction..

While we are still not likely to see it anytime in the near future it sounds like we will be starting to get some CTP and Beta drops a few months into the New Year (Mix08 anyone?) and the team can start blogging about it; So for now its back to waiting :)

kick it on DotNetKicks.com


comments
The directory name is invalid 16 Dec 2007 14:10

So I ran into an annoying issue earlier - ran an svn update over our core repository and a few seconds later heard Tortoise screaming because it couldnt access one of the directories down the tree (inaccessible).

Drilling down on the tree I saw that I had a corrupt directory - bah. So I schedule a chkdsk and reboot. Chkdsk runs away and reports no errors. Eh? Oh well, continue on with the reboot and then go to dispose of the directory and refresh it from Subversion. Except that when I tried to delete (or access) the directory now I get the error "The directory name is invalid".

So what to do? Well after trying a few approaches I thought I would give Unlocker a try - running it reported no locks, but it offered to help anyway so I asked it to delete the directory and what do you know, it sorted it :)

Previously you may have (like me) only seen Unlocker used to remove locks on files etc, but its very interesting (and useful) that it can cater for these types of issues as well.

Nice!


comments
Going on a Road Trip 11 Dec 2007 09:40




In February next year Chris, Darryl and I will be taking a wee tour around New Zealand and will be coming to a town near you to tell you all about 2008! (SQL, VS and Windows that is)..

We have some great content lined up and we want to show you how easy it is to build cool things, deploy them and manage them on 2008 application platform. What we have planned is to take 2 hours and build, deploy and scale up a web site giving you heaps of new ideas to absorb. We have lots of cool swag including away three Windows Home Servers - cheers Darryl! :)

So mark these dates for February and be on the lookout for more information on these events coming soon!
  • Auckland – Feb 4
  • Tauranga – Feb 5
  • Hamilton – Feb 7
  • New Plymouth – Feb 8
  • Hawkes Bay – Feb 11
  • Palmerston North – Feb 12
  • Wellington – Feb 13
  • Nelson – Feb 14
  • Christchurch – Feb 15
  • Dunedin – Feb 18
  • Invercargill - Feb 19
Update: Darryl reminded me that you can now register for these events! Sign up here :)


comments (4)
ASP.NET 3.5 Extensions - December CTP now available 10 Dec 2007 15:02

Just noticed that the much awaited December CTP for the ASP.NET 3.5 Extensions library is now available for download.

This has been highly anticipated because it will be the first ASP.NET Futures CTP which includes the first working bits for the ASP.NET MVC framework.

ScottGu has been actively posting on this already so there is plenty of good information to get started with.
  • ASP.NET MVC Framework (Part 1) 
  • ASP.NET MVC Framework (Part 2): URL Routing
  • ASP.NET MVC Framework (Part 3): Passing ViewData from Controllers to Views
  • ASP.NET MVC Framework (Part 4): Handling Form Edit and Post Scenarios  
The other bits that feature with this release are:
  • Dynamic Data Controls: I had a good look at these recently after Tokes showed them off at the Code Camp session down in Christchurch. If you are looking at any sort of 2 tier data driven scenario these should be on your must look list..
  • Entity Framework Beta 3: This was actually released seperately on Friday, but looks like it was intended to be bundled with this release :) Remember to download the tools for this which integrate with VS2008.
  • Data Services: Previously known as Project Astoria, these let you expose your ADO.NET sources data through REST based service endpoints. This now also supports working with the Entity Framework and published your Entity Data Model
  • Improvements and new controls for the ASP.NET AJAX library
So lots to check out - most likely most of the press will be on the MVC framework, but this looks to be a pretty nice little early Xmas pressie for us :)

kick it on DotNetKicks.com


comments
Want to connect to SQL 2008 from Visual Studio? 21 Nov 2007 12:35

Trying to connect to your new SQL 2008 November CTP instance from inside Visual Studio and getting this error?

"This server version is not supported. Only servers up to Microsoft SQL Server 2005 are supported"

Well, help is on hand for (initially for Visual Studio 2005) in the form of patch which lets VS target a SQL 2008 instance (CTP 5 up). You can grab the patch from here.

It adds:
  • Server Explorer successfully connects to SQL Server 2008, and database objects such as stored procedures and table data can be viewed and edited. Note that table schemas still cannot be viewed or edited in this release.

  • SQL CLR projects that target SQL Server 2008 CTP5 can be created and deployed to the server.

  • T-SQL and SQL CLR debugging are now enabled for SQL Server 2008 CTP5.
  • Data binding features in Client and Web Projects are enabled.

There is no patch targetting Visual Studio 2008 just yet, but apparently thats in the works and will be out when CTP 6 ships (next couple of months based on the schedule).


comments
Visual Studio 2008 RTMs 20 Nov 2007 07:13

The funny thing about being on this side of the world is you always get to wake up to some good news :) This morning it was the slightly unexpected and delightfully early release of Visual Studio 2008 and the .NET 3.5 Framework!

Soma has the details here, there are a bunch of links to the publically available pieces and trials and if you have MSDN you can now grab the Team Suite! If you are looking to ship on the 3.5 Framework, then you can find the redistributable here.

As Ive posted about earlier we are using Visual Studio 2008 almost exclusively now at Mindscape, in fact we only use Visual Studio 2005 to create our sample solutions prior to wider availability of 2008. Outside of a few areas during the betas its proved to be very fast and very solid - so I would highly recommend you look at making the move forward - start by checking out the 2008 trial versions and seeing if you enjoy them like I have :)


comments
SQL Server November CTP released 19 Nov 2007 15:24

Just got word that the November CTP (CTP5) for SQL 2008 is now released and is slowly making its way up to MSDN, sporting a new WinForms based installer - nice!



New in this CTP is:
  • FILESTREAM support (Allows you to store your blob data on the local NTFS file system)
  • SPATIAL data support with new GEOMETRY and GEOGRAPHY types
  • BACKUP with COMPRESSION
  • CHANGE TRACKING support (Sounds interesting..)

I talked about FILESTREAM at Boot Camp a couple of weeks ago and it recieved a fair amount of feedback. Looks like this is definitely one of the main features that developers are looking for.

If you have MSDN or Technet downloads look for the November CTP to appear on your radar soon.

Update: This is also available as a public download from here! :)


comments (1)
Team System User Group 16 Nov 2007 14:59

At the last .NET User Group here in Wellington, Mark Carroll mentioned that he was starting up a Team System Users Group here in Welly to help build some community around the use of Team System and Team Foundation Server. Quite a few people have expressed interest for this, particularly around how to best use Team System as a full set of lifecycle tools rather than just for "better version control".

So Mark has just passed through word of the first meeting - so if you are using Team System or Team Foundation Server at the moment just for source control I would strongly suggest you pop along and join us on the 28th :)

The meeting is on Wednesday 28 November at 5:30pm , and will be held at Microsoft, Level 12, Vodafone on the Park (on Lambton Quay – behind Midland Park).

--

Details of the session on 28 November;

Title:  Team Development – working with Project Manager, Team Lead and Business analyst roles;

This talk focuses on how the project manager / lead and the Business analysts can interact with the other primary roles of Architect, Developer, Tester and DBA. Learn how a variety of approaches can be used and how Team system can leverage the strengths of other tools including Microsoft Excel, and Microsoft Project to allocate and track tasks that need to be undertaken by the entire software development team.

Speaker: Mark Carroll



comments
LightSpeed 1.1 Released 14 Nov 2007 10:10



On Monday we announced the release of LightSpeed 1.1, an update release to our popular Domain Model / OR Mapping framework for .NET developers. The release includes a number of requested changes particularly in the areas of Inheritance and Validation.

Andrew posted plenty of information on the release on the Mindscape blog - have a read and then download the Express Edition to give it a test drive :)



comments
SQL Server User Group - Next Meeting 14 Nov 2007 09:25

Quick heads up about the next SQL Server User Group meeting - Matti is a very knowledgable speaker so well worth attending. Big thanks to Intergen who is continuing to provide their excellent facilities for these meetings and to Microsoft for providing the Drinks and Nibbles :)

----

Wellington SQL Server Meeting Notice

Our next meeting will be:-

29 November 2007 6pm

Intergen

L7 Plunket House

126 Lambton Quay

(Lifts lock at 17:30. If you're late and there's nobody around to swipe you up, contact Adrian on 027 435 4050)
 

The topic of his presentation is:-

"Addressing in New Zealand - Introducing e-SAM"

In August 2008 NZ Post is forcing all organizations to re-apply for the bulk mail discounts. New rules are that mailing databases need to be SOA certified; 85% of the address data need to comply with NZ Post addresses and standards. How are organisations to achieve this? e-Spatial's solution is different to the others in that it is an open database model allowing DBAs to easily find any issues and tune it when necessary. It is also spatial including mapping reference data for all common NZ datasets.

Presented by

Matti Seikkula - Chief Information Officer, e-Spatial, will talk about how  SQLServer is used against e-Spatial's addressing product e-SAM. Matti has more than 17 years of experience in systems design, software development, architecture and data modelling and over 11 years of experience in spatial integration.

Matti will be supported by Shane Turk, Spatial Database Specialist at e-Spatial. Shane has more than 15 years of experience with various spatial databases and GIS.

Pizza and drinks are being provided with the kind courtesy of Microsoft.

Seating is limited to the first 50 registrations.

Ping us an email at wgn-sql-server AT googlegroups.com if you will be attending :)



comments
Boot Camp 2007 - Composite Web Block and Web Patterns 04 Nov 2007 16:01



Thanks to everyone who came to my session on Day 2 on the Composite Web Block and Web Patterns. Here are the slides from the talk, Ill post the code shortly once I get it all seperated out :)

Slides: Composite Web Block.pptx (pptx - 1.2mb)

Also if you are interested in seeing how this worked for us in BackgroundMotion, go download the source from CodePlex and have a look for yourself :)


comments (13)
Boot Camp 2007 - ADO.NET Entities 04 Nov 2007 11:34



Thanks to everyone who came to my session on Day 2 on the ADO.NET Entity Framework. Here are the slides and demos from the talk.

Slides: ARC342.pptx (1.1mb)
Code: EntityDemos.zip (52kb)

There is a README to help you get set up inside the Demos zip file.


There are also some community samples available on CodePlex.

Remember to download the current Entity Framework from here.
And then the tools to integrate with Visual Studio 2008 from here.

You will also want to keep a watch on the ADO.NET blog where they regularly discuss updates to the Entity Framework and the changes being made along this idea of the conceptual data model.

Lastly if you are interested in building your own provider to use with the Entity Framework check out this blog post from David Sceppa.



comments
Boot Camp 2007 - SQL Server 2008 for Developers 04 Nov 2007 11:22



Thanks to everyone who came to my session on Day 1 on SQL Server 2008. Here are the slides and demos from the talk.

Slides: SQL Server 2008 for Developers: (pptx - 1.24mb)
Demos: Sql2008Demos.zip (zip - 304kb)

Remember to go download the July CTP (CTP 4) from here.

Currently the FILESTREAM and BACKUP COMPRESSION features
are coming in CTP 5, so I will put up some blog posts on those (along with the SPATIAL support) when that becomes available :)


comments
Boot Camp 2007 30 Oct 2007 09:09

So its been a while.. the last month has been filled with TechEd, a great holiday and plenty of interesting work in between. What has been great is being back in a solid phase of coding and getting full on working with .NET 3.5 and VS2008.



This weekend JD and I are heading down to Christchurch to speak at Boot Camp 2007.  JD is giving a talk on C# 3.0 language enhancements and Im covering SQL 2008, ADO.NET Entities and the Composite Web Block. All in all it should be a pretty exciting weekend filled with lots of discussion around the "next wave" in the Microsoft dev space.

Speaking of such things, we have all moved to using Visual Studio 2008 exclusively now, and I have to say its a great step up from 2005. There is nothing amazingly "new or cool" since most of the "new" stuff has been shown under other guises already (3.5, LINQ, WPF designer, Web Designer etc) but having it all togethor and running very smoothly is well worth it :)

One of the other great things in 2008 is the Framework re-targeting mode. This allows you to select which version of the .NET Framework you want to compile the project against (2.0, 3.0, 3.5) which of course gives the backwards compatibility you would want to avoid having to side by side 2005 and 2008. Fantastic :)

See you at Boot Camp this weekend!


comments
SQL2008 for Developers: INSERT INTO enhancement 13 Sep 2007 18:42

Sometimes it’s the smallest enhancements… INSERT INTO has gotten a small makeover in SQL Server 2008 which now allows you to specify multiple rows as part of a single statement. While the sky has yet to fall in reaction to this, it’s a great little enhancement for people generating data insert scripts so that the data can be inserted as a single statement (rather than having to batch it all together), and I was surprised how many people commented to me after my TechEd session about how they loved this change :)

To make use of it, simple append addition rows in a comma delimited format, surrounding each row set in brackets.

e.g.

insert into Product values

(1, 'XBOX 360', 100),

(2, 'Black Zune', 100),

(3, 'Windows Server 2008', 100),

(4, 'SQL Server 2008', 100),

(5, 'Visual Studio 2008 Professional Edition', 100)


comments (57)
TechEd - ADO.NET Entities Session 13 Sep 2007 18:37

Thanks to everyone who came along on Thursday to the session on the ADO.NET Entity Framework. As mentioned here are the slides and code for that session :)

Slides: ARC342.pptx (1.1mb)
Code: ARC342.Demos.zip (52kb)

There is a README to help you get set up inside the Demos zip file.



comments
TechEd - Enterprise Patterns Session 13 Sep 2007 18:35

Thanks to everyone who came along on Monday to the session on Enterprise Patterns. As mentioned here are the slides and code for that session :)

Slides: ARC412.pptx (2.3mb)
Code: ARC412.Demos.zip (1.1mb)

There is a README to help you get set up inside the Demos zip file.



comments
Table Value Parameters in SQL Server 2008 09 Sep 2007 13:11

Table Value Parameters are a small new T-SQL enhancement in SQL Server 2008 which allows us to pass through a TABLE value instance as a parameter to a stored procedure. This is a welcome new addition to support of the TABLE type as it helps in the situations where we want to pass in a row like structure without having to separate it out into arguments and then recombining it as part of the query.

Making use of it is fairly simple, let’s look at an example:

First we define the type

create type OrderTableType  as TABLE(ProductId int, ProductName varchar(255), Quantity int)

Then we define the stored procedure (implementation excluded)

create procedure dbo.UpdateProductFromDailyOrders( @orders OrderTableType READONLY )

 

First we need to declare an instance of the type and populate it with some data

declare @todaysOrders OrderTableType

insert into @todaysOrders

select p.Id, p.ProductName, sum(o.Quantity)

                from [Order] o inner join Product p on o.ProductId = p.Id

                where o.OrderDate = '2007-01-05'

                group by p.Id, p.ProductName

 

Then can now make use of it with the stored procedure

exec dbo.UpdateProductFromDailyOrders @todaysOrders

 

Easy!

The only caveat you have is that the structure passed in has to be specified as READONLY preventing any modification of the data inside the parameter.



comments (2)
SQL 2008 for Developers: MERGE 30 Aug 2007 12:21

As indicated previously, I had a strong level of feedback from the TechEd session I ran on SQL2008 commenting on how useful it was to get some good understanding about the new features being introduced. I thought as a result we could follow through the new "features of interest to developers" as we move through the SQL 2008 CTP cycle.

One of the first features introduced with the SQL 2008 CTP series is going to be one of the most useful for developers. Thats the introduction of a new statement called MERGE which allows us to elegantly manage two common database problems; UPSERT'ing (thats a conditional INSERT or UPDATE depending on the row being available) and synchronizing two tables.

Lets have a look at how it works.

The basic syntax for MERGE is as follows:

MERGE <source>
USING
( SELECT <expression> FROM <target>) <alias>
    ON <intersection>
WHEN MATCHED
    THEN <UPDATE | DELETE>
WHEN TARGET NOT MATCHED [AND <conditions>]
    THEN <INSERT>
WHEN SOURCE NOT MATCHED [AND <conditions>]
    THEN <UPDATE | DELETE>
;


Effectively we are asking to take two sets, the source and the aliased target selection and then join them on an intersection. Rather than specifying the type of join (inner, left outer selecting non intersecting rows, right outer selecting non intersecting rows) we are going to operate on all sides of that join simultaneously and take appropriate action depending on a condition of what we find in those respective sets.

The three part conditional (WHEN MATCHED, WHEN TARGET NOT MATCHED, WHEN SOURCE NOT MATCHED) allows us to select which part to operate on (INNER, RIGHT OUTER and LEFT OUTER respectively) and then allows appropriate DML given the context. Our DML is always being performed on the <source> table, hence the filtered set of DML operations.

Here are a couple of examples of how this can be used..

Given two identical tables (for ease of example)

create table t1
(
Id int not null,
FullName varchar(100)
)

create table t2
(
Id int not null,
FullName varchar(100)
)

And some test data

insert into t1 values
( 1, 'Jeremy Boyd' ),
( 2, 'Adam Cogan' ),
( 3, 'Scott Hanselman' ),
( 4, 'John-Daniel Trask' )

insert into t2 values
( 1, 'Jeremy Boyd' ),
( 5, 'Andrew Peters' ),
( 6, 'John-Daniel Trask' )

We can syncronize these tables with this statement:

MERGE t1
USING
( select * from t2 ) target
ON t1.Id = target.Id
WHEN MATCHED
THEN UPDATE SET t1.FullName = target.FullName
WHEN TARGET NOT MATCHED
THEN INSERT VALUES( target.Id, target.FullName )
WHEN SOURCE NOT MATCHED
THEN DELETE;

The results, unsurprisingly look like t2! The statement itself updates 6 rows, 1 update on Id = 1 and 3, 2 inserts on Id's 5 and 6 and deletes on Id's 2,3,4.



Ok, lets have a look at the other type of scenario, a conditional INSERT/UPDATE

Again some fresh test data, this time we want the changes from t2 to be merged into t1

insert into t1 values
( 1, 'Jeremy Boyd' ),
( 5, 'Andrew Peters' ),
( 6, 'John-Daniel Trask' )

insert into t2 values
( 1, 'Jeremy Boyd' ),
( 5, 'Andrew "Ninja" Peters' ),
( 7, 'Darryl Burling' ),
( 8, 'Nigel Parker' )

So the MERGE statement will look very similar to the one above, but without the deletion of non existent rows from t2

MERGE t1
USING
( select * from t2 ) target
ON t1.Id = target.Id
WHEN MATCHED
THEN UPDATE SET t1.FullName = target.FullName
WHEN TARGET NOT MATCHED
THEN INSERT VALUES( target.Id, target.FullName );

Nice and easy!

One last thing to remember is that MERGE uses the closing semi-colon syntax to help the parser understand where your statement ends so don't forget that :)


comments (2)
TechEd New Zealand is a wrap! 16 Aug 2007 09:14

Thanks to everyone who came along to my 2 sessions at TechEd during New Zealand and Australia - I had a lot of fun (despite a few speed bumps) and I think again the bar was raised for overall quality of the events and the material covered. In particular I had quite a few people comment on the SQL 2008 session so I will be following this up with some blog posts around SQL 2008 over the coming month or so :)



In the mean-time here are the slides decks from the sessions in case you didnt grab them from CommNet.

DAT314 - SQL Server 2008 for Developers: (pptx - 1.24mb)
WEB309 - Composite Web Block (pptx - 1.29mb)



comments
Amusement at TechEd 09 Aug 2007 16:35

Some random amusement from TechEd Australia..



Over at the MVP stand today with Rose we watched as this poor guy had to defend the table full of donuts for 30 minutes (since you were not allowed to eat them until 11am). Much fun ensued :) You also have to appreciate the ratio of fruit to donuts :)

In the background you can see one of the neat things they had going on here at TechEd in Australia which is the Technical Showcase area. Basically they set up a number of zones where you could rock up with a laptop and start presenting to a crowd of people who wanted to hear you talk. There were various tiers of stage so you could present 1 on 1, 1 to few or 1 to many (like the stage behind the donut stand).

Pretty cool :)


comments
The Perils of Hardware 09 Aug 2007 16:28

Just when [you || I] thought we had heard all of the "technical issue" stories from TechEd, yesterday my laptop screen decided to die..

To much amusement to the other speakers in the speaker room at the time I cracked open my laptop, dissassembled a few parts and then found the problem. The screen power supply lead had become loose and subsequently fallen out. Thankfully after a plugin and quick clean the laptop was back to full health.. phew.

The perils of hardware failures :\


comments
New Zealand and OpenXML  09 Aug 2007 14:37

I see Chris and the crew at Intergen are just about to put out some bits on Codeplex leveraging the flexibility afforded us now with Office OpenXML (OOXML) and dragging down IIS log files into Excel :) Great stuff guys!

This reminded me that there is an impending vote about OpenXML being certified as an ISO standard. For those of you who havnt heard about ISO certifications and voting, basically the standards bodys of all countries consider a submission for a new standard and then vote it either in or out. All countries are equal so its not a biased approach.

Currently the submission is pending "fast-track" approval, and sadly Standards New Zealand seems set to reject the submission on behalf of New Zealand on the grounds that ODF already got through first as a standard.

Personally I think this is quite sad for the industry as clearly OOXML is a huge step forwards in terms of openness of the key file formats in the business industry and even if it lacks ISO support in the short term is still set to become a de-facto standard anyway.

The New Zealand vote is happening at a workshop in Welly later this month - so if you care about this, speak out about it :)


comments (2)
YSlow using IIS? 07 Aug 2007 14:56

Indeed!

Recently Yahoo put out a developer tool to snap into Firebug called YSlow. It analyzes a given web page and generates a marked score for a number of "performance traits" of the site. If a page can be improved, YSlow gives some tips on what can be improved.

The other day Simone put up a horrid post listing my blog as having a D ranking?!? What the...

So I had a nosey to see what he was on about and low and behold, there were definitely some areas for improvement.


Ok - so thats better! Maybe I should migrate to Akamai?

If you are using IIS 6 like me, you are likely to be failing on a couple of the rules:

3. Add an Expires header (for resources such as CSS/JPG)

This one is fairly easy. Browse to the directory holding your resources, select the properties, select the HTTP Headers tab and then enable Content Expiry. Set a number of days sometime in the future (e.g. 30).

4. Gzip components (for resources such as JS/CSS)

Firstly enable GZIP by right clicking on the Web Sites folder and selecting the Service tab. Check the appropriate boxes. I normally just enable static file compression.



Next edit the Metabase.xml in %windir%\system32\inetsrv (you will need to enable Direct Metabase editing for this on the properties for the top level node in IIS Manager)

Find the section named HcFileExtensions (there will be 2 of them) and modify them to include any static resources you want compressed.

Mine looks like this:

HcFileExtensions="htm
            html
            txt
            js
            css"


You will need to do an IIS reset to finish off and you might want to disable Direct Metabase Editing as well :)

13. Configure ETags

This one on the face of it is quite annoying, that is until I found this article! Compile the code using Visual C++, or just download a binary version.

You can install it into IIS by adding a new ISAPI filter (either at the Web Sites level or to a specific site), it will show as unknown initially, which is fine. Make sure you allow the filter to run by adding it as the same name into the Web Service Extensions and set the extention to be allowed.



You will need to do an IIS reset to finish off.

And done! Your site now should be much better off to deal with that impending Slashdotting :)


comments (9)
Welcome to TechEd Oz 06 Aug 2007 16:17




So its nice and sunny in the Gold Coast and from chatting with a few of the speakers on the trip over it sounds like there is going to be some great sessions in store.

Also Rocky Heckman (who has put togethor a great lineup on the security front this year) tipped me off to the fact he is going to give away some free USB keys to the first 50 people who do the Threat Modelling hands on lab this year, so if you want to get one of those as well as check out the new Enterprise Threat Modelling tool then head off to the labs and get yourself sorted.

Rocky also mentioned a new auditing tool for IT departments to audit by policy which sounds quite interesting - its something Ive heard time and time again of being needed and useful and "oh we will have to build that" so sounds like Ill have to find out more :)


comments
LightSpeed goes 1.0! 06 Aug 2007 16:13


On Friday we released version 1.0 of LightSpeed, our domain model and O/R mapping framework for .NET developers. This was an exciting time for us being the first full product release out the door and at the same time we also launched our updated web site which integrates the forums we used during the EAP program along with an online store (so you can all go ahead and purchase LightSpeed straight away!).

For more information on LightSpeed, check out the product page online.

As mentioned in the previous post, if you are up at TechEd come and snag either Andrew, JD or myself if you are interested in hearing more about the product and seeing how easy it is to work with :)


comments
Off to TechEd 05 Aug 2007 09:57

So I'm just about to head off to Australia for TechEd 07! This is the start of a bit of a TechEd circuit for me this year with Australia followed by NZ and then over to Malaysia for TechEd there in September.


The Logo is also very cool this year ;)


In Australia I will be talking about the Composite Web Block and how we used it on BackgroundMotion. We will be covering off what the block is, what benefits it affords you and how it leverages MVP and DI. The session is called "Building Background Motion - Scalable Web Fast with the Composite Web Block" so come along!

As always it should be great to meet and hear what hear what people are up to and generally soak up the geeky goodness that is TechEd. I will also be keen to tell anyone who wants to hear about LightSpeed so feel free to ping me for a quick demo and chat if you are interested!

If you are going up to TechEd NZ and will be up there on the Sunday, why not go to the DNUG Code Camp which is going to be on!

Also, remember to say Thanks! to the people behind the scenes who put in all the hard work to get these things to happen :) This year a special mention to Darryl who has been organizing all the speakers! You rock! :)


See you at TechEd!


comments (1)
svcutil under Visual Studio 2008 Beta 2 01 Aug 2007 15:14

Trying to run svcutil.exe to generate your WCF proxies and getting this?

C:\Program Files\Microsoft SDKs\Windows\V6.0A\Bin>svcutil

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembl
y 'svcutil, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' o
r one of its dependencies. Strong name validation failed. (Exception from HRESUL
T: 0x8013141A)
File name: 'svcutil, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11
d50a3a' ---> System.Security.SecurityException: Strong name validation failed. (
Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer

What you need to do is add a verification entry for the tool like this:

C:\Program Files\Microsoft SDKs\Windows\V6.0A\Bin>sn -Vr svcutil.exe

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.20706.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Verification entry added for assembly 'svcutil,B03F5F7F11D50A3A'


Thanks to Justin Smith for the tip! :)


comments
Visual Studio 2008 Beta 2 branch of BackgroundMotion 30 Jul 2007 10:53



For those of you having a play with Visual Studio 2008 Beta 2, we have put up a port of BackgroundMotion thats compatible with the new 3.5 LINQ and ASP.NET AJAX bits. Its available for download from the Codeplex site.

The port itself was relatively straightforward with just a few namespace changes to work through, which promises to be good for those of you building web apps on 2005 today and wondering about moving up to 2008 in the near future..

Happy coding! :)


comments
BackgroundMotion - Community Resource / Sample 26 Jun 2007 09:29



Earlier in the year we did some work to build a community style video/image sharing web site based on the latest technologies and blocks as an example of how to build a composite web application. The work was done in conjunction with the DPE team here in NZ which was a great collaborative experience for all involved and we finished the solution build in a quick fire 3 weeks. Based on the work we presented a number of sessions as part of the Microsoft Technical Briefing events earlier in the year – the feedback from these sessions was fantastic so many thanks to all who came along :)

The site has now been hosted at http://www.backgroundmotion.com so check it out!

What is it?

Firstly BackgroundMotion is a community website to allow you to share backgrounds and background video for use with Windows DreamScene.

Secondly it is a working sample of a modern web application built on .NET 2.0 w/ AJAX, .NET 3.0 etc.  The source code for the entire solution is also freely available on CodePlex for you to download and re-use.

We have also added developer resources includes sample code, short introduction videos and resources to try and help lower the bar to use these technologies and help teach you about the technologies we used.

What did we use?

    * .NET Framework 2.0
    * .NET Framework 3.0 (WCF)
    * ASP.NET 2.0
    * ASP.NET AJAX 1.0
    * Silverlight (for video previewing)
    * NUnit
    * LINQ (May CTP in standalone mode)
    * Web Client Software Factory (Composite Web Block)
    * Lucene.Net
    * RSS Toolkit (which was extended for the solution)
    * Virtual Earth
    * Windows Vista Sidebar Gadgets

We have an VS2008 B1 compatible branch of the solution we will be loading into CodePlex shortly which updates the LINQ code to the latest bits.

So go check out the site, download the code and enjoy learning! :)



comments
Virtual Server 2005 R2 SP1 baked 13 Jun 2007 10:51

Some good news today - SP1 of Virtual Server 2005 R2 (which must hold the title for most awkward product name to say aloud?) has been completed and is now available for free download! An additional feature included in the Service Pack is support for VSS (Volume Shadow Services) to allow for hot backups of running virtual machines.

This is great as it brings Virtual Server back onto par with Virtual PC 2007 which provided hardware assisted virtualization based on the latest generation of CPU's. Its also good because SP1 represents a bridging solution until the true Hypervisor assisted virtualization appears as an add-on for Server 2008 later in the year (or early next year perhaps?)

You can download SP1 from here.


comments
Silverlight on Windows Safari 12 Jun 2007 11:05

So I noticed that Silverlight wasnt working on Safari while browsing around doing some testing this morning. The standard install box was present despite having the runtime already installed :(



Bummer... Until Tim Heuer mentioned that it would likely be possible to get it working via some updates to the Silverlight javascript. That peaked my interest so I had a look at Help/About Plugins.. and behold, all of my Firefox plugins were being picked up including..

WPFe Plug-In
0.8.5.0 — from file “npctrl.dll”.
MIME TypeDescriptionExtensions
application/ag-pluginnpctrlscr


Great! So just a browser detection issue then, so with a quick mod to Silverlight.js to include the browser check for Safari and we are back cooking with gas!



Fantastic! So the only change required was in detectAgControlVersion() to update the Firefox detection line (which looks for the WPFe Plug-In) to also include a check for Firefox as per below:

if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Safari") != -1)
{
[...]
}


comments
LightSpeed 0.5 12 Jun 2007 06:55



Last week we released our latest beta version of LightSpeed, our domain modelling framework tool. So far we have had great feedback and response to the product and in a few weeks time we will be looking to lock it down and ship it out.

Having used a number of frameworks to assist with persistance, validation and building a domain model before I think what we have done with LightSpeed is pretty nice. While not trying to compete with a number of the larger frameworks out there we have focused more on a common case which we believe should fit most bespoke development efforts where you would look to apply this approach.

The design philosophy for LightSpeed is centred on:
  • Convention over configuration.
  • Support idiomatic .NET domain models: (Data binding etc.)
  • Highly usable API and low barrier to entry.
  • Internalizes best practice patterns: Session per request, Unit of Work etc.
  • Testability built in.
  • Small, lightweight and performant.
  • Solve the 95% case – i.e. more like Rails than NHibernate.
If you want to see an "in anger" example - JD posted about his use of it while tinkering here.

To try it out, hop over to http://beta.mindscape.co.nz and sign up for our beta program and then grab the download from our EAP site. The installer comes with samples and quick starts to get you going as well.

We still have an iPod giveaway at the end of June to one hard working beta participant so we would love to hear your feedback! :)


comments
Some interesting news from Apple's WWDC 12 Jun 2007 06:52

So hot off the press from the keynote of Apple WWDC, some updates on the availablility of the iPhone and Leopard, but the interesting one for me is the availability of Safari (Apples web browser) on the PC. Yep thats right.



Wonder if this will help ease cross browser testing? :)

If you are interested, you can download it from here: http://www.apple.com/safari/download/


comments
SQL Server 2008 June CTP 06 Jun 2007 09:54

Semi fresh from TechEd US, SQL Server 2008 (aka Katmai) has been launched for public consumption as a new round of CTP goodness begins for the 2008 wave :)

I expect we will be hearing a lot more about SQL 2008 at TechEd NZ/AU later this year, but in the meantime now is that point in time where you can get on board early and skill up with whats new. For shops who are still on 2000, 2008 is definitely worth looking at.

For more information check out:
  • The SQL Server 2008 Product Page
  • Download SQL Server 2008 June CTP from Connect
  • Check out the samples and user contributions on Codeplex


comments (24)
PDC gets postponed for now 25 May 2007 11:21

Bummer - so it looks like PDC is off for this year which is a pity because I was really looking forward to getting a look into the "next wave" of opportunities and thinking.

If you havnt read the news then have a gander over here - the cited rational is that the current wave of new releases wont yet be fresh from the oven so rather than duplicating effort in talking about them at both TechEd and PDC, the PDC has been slipped to allow it to be future focused (which of course is what it should be about!).

While PDC is hardly the most attended event by Kiwi's it has always been one of high interest in the Microsoft development sphere. So it looks like we have already had a good helping of the New and Cool for this year and get to spend the rest of it tooling up on the "current wave".

Speaking of the "current wave", it looks like things are firming up for us to have a nice new "2008" toolset.
  • Windows Server 2008 aka Longhorn Server
  • Visual Studio "2008?" aka Orcas
  • SQL Server "2008?" aka Katmai
We have been dogfooding Orcas for the last couple of months at work here. My personal impression so far has been quite positive - its a great rollup of all the various bits and bobs we have all been looking at for a while (ASP.NET AJAX, WPF designer, Expression Web design surface etc) while being much more performant and kinder on my memory than VS2005.

If you are interested you can always check out Beta 1 either by getting the installable bits or a Virtual PC image from here


comments
Template for Vista Sidebar Gadget development 21 May 2007 18:09

Earlier in the year we posted up a number of posts around Gadget development.
Based on feedback from a number of people interested in developing Gadgets for the Windows Sidebar, we have put together a community template to help kick-start your Sidebar Gadget development.

The template includes:
  • New "Web Site" templates for Visual Studio 2005
  • Guidance documentation with how-to's
  • Samples covering RSS, .NET integration and integrating with Silverlight
To use the template you will need Windows Vista and Visual Studio 2005 installed on your development machine.

You can download it from: http://community.mindscape.co.nz/Windows%20Vista%20Sidebar%20Gadget%20Template%20-%20RC.msi  right now, so download it and give us some feedback!

We are planning to update the template with feedback and contributions, so please email them through.

If you want some ideas of Gadgets you could build, take a look at http://www.microsoft.com/nz/windows/gadgets/default.mspx to see what others have been building!



comments (1)
SSIS and WCF 09 May 2007 12:34

One for the "I must remember this later" basket :)

Earlier this week I helped Ayende out with an issue he was having with getting SSIS and WCF to talk togethor..

The problem presents itself when using the Web Service Task in SSIS and trying to bind to a WCF based endpoint which is exposed using a basicHttpBinding.

 

Normally you are able to easily inspect the WSDL and bind to an appropriate Service and Operation using drop down selectors. When connecting to a WCF based service however, Oren found an issue in not being able to use the selectors.

After having a look into this, we found that the problem stemmed from SSIS's apparent lack of being able to digest the xsd:import's being generated by WCF for types generated in a namespace which differed from the namespace being used by the service or the binding.. e.g.:

 

The way I fixed this up "in the interim" was simply to merge the type definitions back into the main WSDL. This fixed up the issue.

e.g.

You can also avoid this problem all togethor if you have a consistant namespace for both your types and bindings. Oren has already wrapped up a nice post on whats involved.



comments
The other Gadget I run.. 09 May 2007 12:14

Other than the all powerful Powershell Gadget, the other Sidebar Gadget I now run all the time is Simone's Cruise Control.NET Gadget. This is a very useful little tool which gives nice visibility of any projects managed by CCNET which you want to view the latest integration status for..

Handy!

Check it out over at Simone's blog..



comments
Silverlight and Gadgets 09 May 2007 12:09

One question Ive seen come up a couple of times recently is "Can we use Silverlight with our Gadgets?" - this was also asked about it back when it was known as WPF/E but the bits were a bit less viable then.

So the answer today is "yes, but its not perfect". Here is an example hosting one of the Video Player applications inside the Sidebar..

Tim Sneath mentioned to me that one of the main limitations is that the Silverlight UI will always be boxed into a rectangular shape, so you dont have free license. Also for deployment, if you have your Gadget installed by someone who doesnt have Silverlight, make sure your window renders large enough to show the "Download Silverlight Beta" button :)

Anyone else looking into this currently?

 



comments (1)
Combine your HTML with .NET using Silverlight 02 May 2007 13:33

As I mentioned yesterday I think the major announcement around Silverlight is the integration with the "CoreCLR". Scott thinks so also (see 2a and 4).. btw thats a post worth reading..

So ignoring all the UI goodness for a few moments, lets imagine I just want to avoid using all that nasty JavaScript and would rather use C# in the browser. Well why not just create an empty transparent canvas and use Silverlight as a .NET hosting container?

A contrived example of how this works in practice is:

Create a simple HTML page:

<div id="fooBlock">Hello World</div>

Add in a Silverlight code container block, and our associated XAML with a Canvas on it, in my case I decided to host an Image inside the Canvas for good looks..

    <div id="SilverlightControlHost" >
        <script type="text/javascript">
            createSilverlight();
        </script>
    </div>

the CreateSilverlight call just instantiates a new XAML object which is hosting Page.xaml. Note the property set of enableHtmlAccess to true which allows the managed instance to get access back to the client side DOM.

Sys.Silverlight.createObjectEx({
  source: "Page.xaml",
  parentElement: document.getElementById("SilverlightControlHost"),
  id: "SilverlightControl",
  properties: {
   width: "0px",
   height: "0px",
   version: "0.95",
   enableHtmlAccess: true
  },
  events: {}
 }); 

Now the default view of this would look like:

But lets say we added the following lines of code in our managed load event:

HtmlElement el = HtmlPage.Document.GetElementByID("fooBlock");
el.SetStyleAttribute("color", "Red");
el.SetProperty("innerText", "foo");

Now we get:

HtmlPage returns us the current page instance, if we are allowed to see it. And from there we can walk the DOM using a new set of classes under the System.Windows.Browser namespace.

Not only can you manipulate the DOM from managed, but you can call into managed from JavaScript, or fire events in both directions. This gives you a fairly tight glue to get even your standard web apps humming with managed goodness.

I dont think the potential impact of this can be understated, while I fully expect the power of .NET to be used in anger in combination with the richer user experience that you get with Silverlight, there is equal opportunity to make sure your AJAX hums even better by doing more sophisticated work client side using .NET.

If you have Beta 1 of Orcas, get started by just creating a new Silverlight project! - you can go download the extensions for Silverlight as well as the 1.1 SDK (remember to install the 1.1 Alpha of Silverlight to make sure you get the new assemblies like System.Silverlight) and check out the QuickStarts at silverlight.net

Of course, you dont want to end up just writing a desktop app inside a browser window, or do you?

 



comments (4)
Project Astoria 01 May 2007 11:47

One of the other things launching today is a project which seems to fit as part of the ASP.NET "Futures" works which is all about delivering the next wave of web applications with technologies like ASP.NET AJAX, Silverlight etc.

The project - codenamed Astoria gives you a toolkit to build and expose data services over a REST interface (Alex - you excited yet?) by leveraging the Entities framework which unfortunately has been delayed.. Still, I think its a good step forward to push out more of a "resource" service over a REST interface because the convention of how you access stuff makes more sense.

So for example, if I had a Content service, it would be exposed as:

http://server/service.svc/Content (returns all rows)

http://server/service.svc/Content[1] (returns the entity keyed as 1)

http://server/service.svc/Content[1]/Tags (returns all tags for that entity)

While you are somewhat expressing a query in the URL syntax, thats the advantage of the convention is that its very clear what you are asking for. This was something Alex pushed hard at the Code Camp and I think he is on to something..

Take a look at the toolkit here..



comments (2)
More on Dynamic Language Support 01 May 2007 09:53

Jim Hugunin who is presenting at Mix has blogged some more about the Dynamic Language Runtime (DLR) which is this new wave of support for dynamic languages and gives a quick overview of what Microsoft are doing in this space. Interesting to note the addition of Dynamic VB - making a comeback?

One thing stressed was that a lot of this is "earlyish still" and he comments that: 

"We plan to kick off a broader engagement with language implementers at the upcoming lang.net conference in three months - at the end of July.  This will be the best place to really engage with the DLR and let us know what we got wrong."

Still, very exciting! Tomek thinks the Ruby news is pretty cool ;)



comments
Testing out the Streaming Services 01 May 2007 09:23

So I thought I would give the Streaming Services a quick test. Thankfully this is a very simple thing to do by following Tim Sneaths instructions on what you need to do.

So following that through a few things to note,

  • When encoding your video, remember to find the output tab and select a Template which will create you the Silverlight assets needed. They by default get output in your Documents\Expression\Expression Media Encoder\Output

  • Remember to zip the resulting files into the root of the container

Uploading was nice and painless too:

When you complete the upload it even gives you all of the HTML and Javascript you need to embed in your page. Very useful.

And voila.. one hosted Silverlight application leveraging the streaming services :)

The API also includes a set of REST based interfaces for doing all of this in an automated fashion which is what Ill be having a look at next.. Interesting to see the use of a REST API as part of this service - signalling perhaps some changes in the wind? Im sure at least Alex will be happy ;)



comments
Mix07 Announcements 01 May 2007 07:04

So lots of new news this morning, here is a recap..

So first off Silverlight was shown off in pretty impressive fashion with some snazzy demos by ScottGu which apprently will be downloadable soon - for now you can check out the keynote videos at http://www.visitmix.com

Check out some blog commentary on the keynote here: http://www.joshholmes.com/2007/04/30/MIX07KeynoteInformationOverload.aspx

The major news was the announement of full support for developing managed code with Silverlight as well as the existing Javascript development support. And the CLR is being taken cross platform as well, with an demo from Scott showing cross platform debugging on a Mac (ooh ahh) ;) Pretty cool, but it really does strengthen the development story :)

The CLR in Silverlight seems fairly competent. Its not just a "Rotor" implementation although you wont just be dragging and dropping ;) But it does retain most of the core BCL including LINQ support. This was obviously seen as core.

Oh, and you can go live with Silverlight now as well - yay! :)

So this is interesting for me around 2 areas,

1: the use of streaming video, particularly trying to introduce more use of high def video for content providers to use. The timing may never be good for us down here in NZ but for the US and Europe its great timing to start capitalising on the uptake of HD. I can definitely see this as a push towards streaming to the 360..

2: A second "big" player in the interactive media front. This is interesting because Flash already has total market coverage and provides the ability for RIA (Rich Interative Applications). I think however with Silverlight and the integration of .NET you will see a high surge of interest in building RIA's and this will translate to it being more widely used in web UI's. Although someone still needs to cover the accessibility (eh JD?) :)

So this will either be the beginning of a new "browser war" of sorts, or a non event.. We shall soon see :)

So you can download the updated beta of Silverlight 1.0, an alpha release of 1.1 (and both for Mac as well) (with the newer bits in it, which is what some of the demos were working off) and the new May CTP of Expression Blend 2  (already eh?) :) You will want to use the Expression Blend 2 version to build for Silverlight..

So second bit of news today was the announcement about the continued support for dynamic languages with IronRuby joining IronPython. The IronRuby 1.0 should be up for download soon.

Also discussed was "Dynamic Language IL" which allows any dynamic language to work happily in managed land. All of that is supported on the Silverlight CLR as well which is pretty impressive and I think that should mean its already installing a semi 3.5 capable CLR :) Nice..

Thirdly, Silverlight Streaming Services was announced and is available straight away for use: https://silverlight.live.com

This is a storage service (similar to S3) which allows you to upload video content for use with Silverlight and then stream your content from the Microsoft servers. The idea is to also price it similar to S3; 1 million free minutes per month followed by costs recovered via injected advertising or a pay as you go model.

I think we might have to do something around Background Motion there this morning ;)



comments
Countdown to Mix 07  30 Apr 2007 10:06

So Mix starts tommorow! Should be some pretty cool announcements coming out from there over the next few days - Chris is pretty excited about whats going on with Silverlight, Im hoping there might be some other cool stuff talked about though :)



Anyway, should be an exciting few days so stay tuned...




comments (1)
Composite Web Block and Orcas Beta 1 30 Apr 2007 10:04

If you have been looking at Orcas Beta 1 recently and using the Web Client Software Factory (or Composite Web Block) you may have run into the following error:

[ArgumentNullException: Value cannot be null. Parameter name: item]
Microsoft.Practices.ObjectBuilder.WCSFExtensions.WCSFBuilderBase`1.TearDown(IReadWriteLocator locator, TItem item) +158
Microsoft.Practices.CompositeWeb.WebClientApplication.InnerPostRequestHandlerExecute(IHttpContext  context) +115
Microsoft.Practices.CompositeWeb.WebClientApplication.Application_PostRequestHandlerExecute(Object  sender, EventArgs e) +79
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


The problem comes from an assertion check which now appears invalid under .NET 3.5. I patched this for our Orcas Background Motion branch so if you want an updated copy of the binaries Ive attached them - or if you have the source, you can patch it yourself in ObjectBuilder.WCSFExtensions -WCSFBuilderBase.cs, TearDown method.

Just remove the throw with a return default(TItem);



comments (6)
Going in the "other direction" with Gadgets and PowerShell 05 Apr 2007 11:01

While Andrews recent sample shows off the use of a Gadget hosting PowerShell, one other quite cool set of Gadgets are PowerGadgets. This is a product which allows any PowerShell output to be directed into a Gadget host using a set of custom cmdlet extensions.

If you have been living under a rock for a while, PowerShell is a replacement command shell which allows for much more powerful scripting and integration with .NET. It integrates collections of commands (cmdlets) with an object pipeline to process individual command returning sets of managed objects and allow these to be piped to new commands as input.

PowerGadgets takes the power of this scripting engine and its ability to product very customised output from a Windows machine and produces graphs, charts etc visualising that output.

You can download PowerShell for:
  • Windows XP
  • Windows 2003
  • Windows Vista

Check out the PowerGadgets site for more info about their product - I think it might suit you very nicely if you think Gadgets are a nice host for monitoring things which can be scripted as PowerShell output :)


comments
PowerShell Gadget and self registration of managed objects 05 Apr 2007 10:46

Andrew posted about the PowerShell Gadget he recently built. Its a pretty cool piece of kit really exercising all of the possibilities in hosting .NET within the Sidebar infrastructure. In fact its currently my most actively used Gadget!



There are some good examples in there are how to wire up to .NET eventing, managed interop and use of platform invoke. AP spent quite a bit of time refactoring this and learning a lot of about the Gadget host in the process - I think he is now the guru of managed gadgets :)

One of the things that initially presented itself through the use of a managed component that needs to be registered through COM is that you need some way of installing that component on to the system in the first place. Normally you would build a MSI to do this, however we found an example of how this can be circumvented and you can have the Gadget "self register" a COM object itself allowing you to retain the .gadget drag and drop packaging and install experience.

In order to do this, we have an initial check to validate the existence of the COM object on the system and if it doesn't exist we execute a script to add the required registry keys which register the ProgId and CLSID on the system.

In the PowerShell gadget, this is done on the Gadget.html file as a script directive:

<script>  

    InitializeInterop();

</script>


That in turn simply wraps the creation of the required COM object in a try/catch block to validate its existence.
  

  try

  {

    var proxy = new ActiveXObject("Mindscape.ConsoleHost");

    proxy = null;

    return true;

  }

  catch (e)

  {

    return false;

  }


If it doesn't exist the registration steps required are:

  codeBase = System.Gadget.path + "\\Bin\\Mindscape.Gadgets.PowerShell.dll"; 

 

  shell = new ActiveXObject("WScript.Shell");

 

  shell.RegWrite(root + "Mindscape.ConsoleHolder\\",

                      "Mindscape.Gadgets.PowerShell.ConsoleHolder");

 

  shell.RegWrite(root + "Mindscape.ConsoleHolder\\CLSID\\",

                      "{91267DB9-9914-4524-A757-9024B99D02E9}");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\",

                      "Mindscape.Gadgets.PowerShell.ConsoleHolder");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\",

                      "mscoree.dll");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\ThreadingModel",

                      "Both");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\Class",

                      "Mindscape.Gadgets.PowerShell.ConsoleHolder");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\Assembly",

                      "Mindscape.Gadgets.PowerShell, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5bd33ec22e477ed5");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\RuntimeVersion",

                      "v2.0.50727");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\CodeBase",

                      "file:///" + codeBase);

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\1.0.0.0\\Class",

                      "Mindscape.Gadgets.PowerShell.ConsoleHolder");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\1.0.0.0\\Assembly",

                      "Mindscape.Gadgets.PowerShell, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5bd33ec22e477ed5");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\1.0.0.0\\RuntimeVersion",

                      "v2.0.50727");

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\InprocServer32\\1.0.0.0\\CodeBase",

                       "file:///" + codeBase);

 

  shell.RegWrite(root + "CLSID\\{91267DB9-9914-4524-A757-9024B99D02E9}\\ProgId\\",

                      "Mindscape.ConsoleHolder");

 

  shell.RegWrite(root + "Component Categories\\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}\\0    ",

                      ".NET Category");


We are using the WScript.Shell object to RegWrite the associated entries. Most importantly with the managed component we are setting the CodeBase entry to specifically identify the location of the managed DLL on the system (because we don't have it registered in the GAC and the Sidebar process is not going to locate it in a known search path)

You would run through these steps for each managed object you want to register. You need to know the CLSID and ProgId of your Gadget.

You will notice that we use use a root specifier to direct where exactly we want to load this in the registry. The code calling our Registration function makes up to 2 calls to try and register the Gadget because of UAC.
 

    try

    {

      Register("HKCR\\");

    }

    catch (e)

    {

        try

        {

          Register("HKCU\\Software\\Classes\\");

        }

        catch (e)

        {

        }

    }


Initially we try and register it globally in HKEY_CLASSES_ROOT, but if you are running as a standard user or with UAC enabled you wont be able to do this. So if we hit an exception on this call we try again but this time using the HKEY_CURRENT_USER area to register it for the current user only.

Using this approach you can now register your managed objects as part of your Gadgets install. You could also use the reverse approach to unregister when your Gadget closes down but keep in mind that the Sidebar will lock managed components so the Gadget uninstall will still not work correctly while the assembly is locked.

Happy Gadget coding! :)




comments (34)
Go OJ! New SharePoint MVP 04 Apr 2007 14:09

I got some great news from OJ on Monday night when he gave me a call to let me know he got awarded a SharePoint MVP for his work in that community in the past year!

Microsoft MVP - SQL Server


OJ has been working hard getting the SharePoint User Group set up and also participating in the Office User Group and doing a great job educating developers about how to get up to speed with the latest version. Along the way he also ran some of the early adopter training for MOSS 2007.

Good stuff man! :)

Update: Thanks Kirk - I knew I had forgotten something ;)


comments (1)
Expression now part of MSDN 04 Apr 2007 08:58

As announced by Soma, ScottGu and others, Expression Web and Blend are going to be released through MSDN to the developer audience.

Have a read on Soma's post for more info. Ultimately this is based on a very strong feedback call from the community. IMHO - its a good thing :)



comments
Xero at the MVP Summit 28 Mar 2007 10:59

Looks like Kirk had an awesome time at the MVP summit recently! While I didnt make it to the Summit myself it looks like plenty of interesting up and coming technologies were showcased and it sets the scene for what should be another awesome PDC towards the end of the year. Definitely looking forward to that!

I was keen to read that Kirk was talking about Xero's interest in Longhorn Server particularly in leveraging IIS7 and some of the new management capabilities. I would say "Go for it guys!" and hopefully I will see a Xero up at the ISV training for Longhorn Server :)

Ive been involved with the Longhorn Server betas since mid last year and Im really impressed with how its taking shape. This is definitely more of a feature release which is building on the existing stability and strength of 2003 Server, bringing togethor a number of features unveiled in Vista as well as a number of great management released features which building on the vision of the DSI. I think "agile operation" of enterprise systems is something we are going to get a lot more focus on over the next couple of years.

If you are interested in IIS 7, there is already a good set of resources building up at http://www.iis.net plus we are more than likely to be blessed with several top speakers from the product team again this year at Tech-Ed :)



comments
A couple of tips for Gadget Development 26 Mar 2007 12:07

AP has been working on a nifty new Powershell gadget (run up a managed Powershell object within a Gadget and have a little prompt which sits in your Sidebar which you can work with) - can't wait to start using that one :)

Anyway, he was commenting on the Gadget development process and particularly working with JavaScript. One tip which is very useful for your Gadget development is to wire up script debugging so you can debug into your Gadget JS from Visual Studio and work out whats going on.

To enable script debugging you need to set the options in Internet Explorer - untick the following two boxes and close off all instances of IE and the Sidebar, and then fire up the Sidebar.

To work with breakpoints you can just set a breakpoint in your JS file and then attach the debugger to the instance of sidebar.exe which is hosting your Gadget. The Sidebar will start up a number of instances of sidebar.exe, so initially you will have nothing to attach to.

A tip here is that you can inject a statement "debugger;" into your Javascript (at an appropriate point) to force it to raise a Script Breakpoint exception that will allow you to attach a debugger at that point to get things going. Very useful for catching the Gadget earlier in the load cycle.

Once your debugger is attached your breakpoints and watches will all operate as expected.

Good times :)



comments
Gadget Opportunities 23 Mar 2007 12:26

Ive spent a bit of time over the last few months working with Vista Sidebar Gadgets and how they could be used to add some extra reach across existing applications. This is something we talked about during the "Extending the Reach of your Applications" talk in the recent Technical Briefing events.

I think there are great opportunities to use Gadgets as a rich surface to present application functionality or information out to users at a desktop level. For example in the enterprise you could use this to surface your typical portal style applications or information in a way that allows personalisation richness with a stronger user experience and still allowing for single sign on through your domain based Windows Authentication.

Getting data from an RSS feed is a pretty simple start, if you are using Sharepoint you can just have your Sharepoint lists published through WSS and then consume them that way. There is already an out of the box RSS Feed Viewer in Vista or you can customise it to suit your own needs for display.

You could also look at coupling Gadgets against functionality exposed through web services. Basic services can be consumed through standard Javascript by using the webservice behavior for IE which has been floating around for a while now.

Or you could leverage .NET functionality to achieve this. We used this to set up our moderation gadget to make a secure call using WCF against a WS-Secure endpoint (wsHttpBinding). This could make the idea of surfacing your internal functions through Gadgets even easier as you will keep focused on the interface.

If you are looking to leverage .NET in your Gadgets AP found a great CodeProject article which can give you a nice (installation free) and generic way to consume .NET objects or you can build your own class library, set it up for Interop and the have it registered as part of your Gadget install process using the same technique of registry key injection.

You could even have your Gadget host a service (again by leveraging WCF) which would allow it to be pushed data rather than using a pull model. This might work well for monitoring scenarios within a subnet or for P2P style gadgets.

Im going to be doing some work on getting togethor some starter material for building Gadgets shortly, and if you are interested in building Gadgets either for public use or  in your enterprise then I would love to hear from you :)



comments
Presentation: Extending the Reach of your Applications 22 Mar 2007 10:59

Thanks to everyone who attended the Microsoft Technical Briefings over the last 3 weeks. We had lots of fun and enjoyed having the opportunity to talk about the recent work we have been doing and discussing some of those ideas. As promised, it’s time to start posting our presentations, demos and links. If you’re looking for the files from John-Daniel Trask you can grab them from his blog. In a few weeks we will also be making available videos of the three presentations that Mindscape delivered for those wanting to see them again or who could not attend the sessions.

Here are the links from the presentation:

    * RSS Toolkit Project on Codeplex
    * Create your OpenSearch xml easily using this online tool
    * WPF: Community Home
    * WPF: Charles Petzold's Blog
    * WPF: Download Expression Blend RC
    * MSDN documentation for Sidebar Gadgets
    * Example of a quick start for developing Ga