| Comments

Je viens en Belgique pour MIX!

MIX Essentials Logo In one of my previous posts I made reference to the MIX Essentials event happening in Belgium later this month (24 APR).  Well, it turns out that I will be there!  I'll be speaking on Silverlight 2 and creating rich applications and am joining the company of Gil Cleeren and Catherine Heller...oh yeah and Ballmer (I tried to catch a ride with him, but couldn't cash in my frequent flyer miles).  My session will provide an overview of everything new in Silverlight 2 and how you can start building your applications using it today.  I'm hoping you all that will be attending will bring some great questions and not throw anything at me (unless it is euros, those are fine). 

I've only had one other trip to Europe ever (to Italy) and am looking forward to going to Belgium.  Everything I know about Belgium is from a recent show on Food TV, so I'm looking forward to some education :-)!  So I'm taking some travel tips from Scott Hanselman and getting things in order (already have the monster cable thanks to my peep Jason Mauer and I, too, highly recommend that one).  I look forward to seeing you there!

| Comments

Firs, thank you for all that came to the presentation in Anaheim.  The room was full, and hopefully you learned something while there (and hopefully it was along the lines that video in text boxes might not be good design, but is doable :-)).

I got a bunch of really great questions and concerns and hopefully answered all of them that were asked.  I saw many more hands lifted than we could get to, so if you have more questions, feel free to send them to me, or join the forum discussions as well!  The Silverlight community site is a great resource for learning, getting the tools, and participating in the conversation...head there today and bookmark!

I was asked to post the code from my presentation, so I'm doing it here.  You can download the solution here.  You'll need Visual Studio 2008, Silverlight 2 Beta 1 SDK, and the Silverlight tools to successfully run the application.  The only files not included there are the media files from the first demo.  Just add a few WMV files into the web applications /ClientBin directory and change the MediaElement attributes in the LameStuff.xaml file if you want to mess around with it.

The sample loads the final solution we had, but I also included the LameStuff.xaml file from the first demo.  If you want to play around with that, look in the App.xaml.cs file and change lines 29/30 to load the appropriate RootVisual. 

I hope you enjoyed seeing some things and wished we could have gone into another hour of cool stuff, like showing how the DeepZoom technology (what I used in my initial 'powerpoint') is composed.  Please feel free to subscribe to my site as I'll be doing a lot around Silverlight here!

| Comments

If you aren't a developer, move along.

If you are and have ever done COM/COM+ development.  You are already chuckling.

| Comments

If you are starting to get into integrating web services with Silverlight, you'll notice that you have to have a cross domain policy file in place on the target server, that is to say, the server hosting the service you want to implement.  There are some public web services (Flickr, YouTube, Digg, etc.) that already have these files in place for Flash, but implement in a slightly different way.

When calling a cross-domain service, Silverlight will check for the existence of clientaccesspolicy.xml first.  This is the format defined by Silverlight and provides a pretty flexible way to define who can access what services.  If not found, it will then default to look for crossdomain.xml, which is the file format implemented for Adobe Flash.  It is important to note that this file will also still work for most public web services.

But now perhaps you are the author of the service that your application is going to consume and/or the public will consume.  There are a few things you want to consider.  First, it would be a best practice to put your service layer on a separate domain other than your site (i.e., api.mysite.com).  In fact, this is how most are doing it these days.  These helps separate more distinctly the services from the web site and also separates the cross-domain security concerns away from the content site versus API access.  Once you have done that you'll want to implement your specific clientaccesspolicy.xml file.

When Silverlight 2 was released to beta, I created some quick helper files to assist me with creating this simple policy file (it is simple, but can get complex depending on how granular you want to define your access).  I figured it might be helpful to some who are implementing services as well.  Sure, they aren't going to save the world, but might save you some quick typing.

Visual Studio Code Snippet

The slcap.vsi file is a Visual Studio Community Installer package which contains "slcap.snippet," which is a Visual Studio code snippet format.  This is an XML snippet, so would be used only in the context of an XML file.  Just double-click on the .vsi file to install and it will walk you through the steps.  I recommend just keeping the defaults.  After it is complete, you now have an Intellisense snippet.  To use it and create a new clientaccesspolicy.xml add a new XML file to your web service site/project named clientaccesspolicy.xml.  It will open a blank XML file by default.  Select all text (CTRL+A).  Then hit the keyboard shortcut for launching XML snippets, CTRL+K,X.

NOTE: For some reason XML snippets don't operate like C#/VB ones do where you type the shortcut, then TAB, TAB.  If anyone knows why, let me know :-)

This will bring up the navigator, then simply navigate to the My XML Snippets, then locate the one you just installed:

Once you select it, there are three literal areas to override the defaults if you wanted. 

UPDATE: As Sean probably ran into below (in comments), the above screenshot does not show the required http-request-headers attribute required on the allow-from node of the policy file.  This is, however, updated in the Intellisense files and the code snippet template.  Thanks Sean for pointing out the screenshot is wrong here.

If you are implementing a completely public web service (open to anyone for cross-domain access), then the defaults will suffice.  When done changing the values, hit enter and you are done.  For those who are not keyboard shortcut masters and would be using a mouse to do all this, it might not be terribly faster to be honest (if the TAB,TAB implementation was there for XML snippets, it would eliminate the arrow up/down to navigate to the snippet).

Get the slcap.snippet here.

Visual Studio Intellisense Files

This next step is a super hack that I originally did and decided it might not be a good idea, but I'll include it here anyway :-).  This involves adding Intellisense files to your VS2008 installation and if you aren't comfortable with that, then move along.

First, you'll want to get the XSD I created, which is very simple and I'm sure doesn't fully conform to the final spec, but lacking that spec, it maps to the format well enough.  Copy the clientaccess.xsd file to the C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas location (or wherever VS2008 is installed for you).  Once you've done that you have to add an entry into the catalog.xml file to add the mapping.  Again, not this is my little hack so I created some namespace because there wasn't one defined yet.

Once you have those two files you have Intellisense for your clientaccesspolicy.xml file if you want it.  Following similar steps as above, create the new file.  This time, however, type the root node of <access-policy> but adding the 'xmlns' attribute pointing to the new namespace you just added to the catalog file (note: Intellisense should give you a list to choose from:

Once you have that, then you'll get the rest of the Intellisense for the basic format of the client access policy format.  If you have multiple allow-from/grant-to needs, this Intellisense will support it.

The only lame thing is you have my namespace in there :-).  That is what drives the Intellisense.  Right now you'll want to remove that before deploying the actual file.  Yeah, I know.  But I said this was an early hack of mine didn't I?

Get the Intellisense files here.

What do to with the completed policy file?

Either way, when you are done with the file, it needs to go in the ROOT of the domain.  This is important as it is not the application root, but the root web.  Even if your app is at foo.com/myapp, the policy file needs to be at foo.com/clientaccesspolicy.xml.

Anyhow, maybe these files will help you.  Ideally you won't be using/messing with an access policy file much, but this might save you some clicks and having the docs open next to you :-).

| Comments

I've been with Microsoft now for over 3 years and have loved every minute of my time here.  For the time leading up to being hired at Microsoft, it was a professional goal of mine to work for the company.  Fanboy?  Sure, call me whatever you want.  I prefer to just call it passion.  I joined as a developer evangelist for my community (an area we call desert mountain which spans Arizona, Nevada, New Mexico, Colorado, Utah, Wyoming, and Montana).  This was an easy thing to say yes to because everything I learned I learned from being a part of a community, whether that be online or offline.  I've met a lot of great people along the way and made new really good friends.  I hope that on some level I've been able to help the communities in my area progress a little better or learn something along the way.  I know that there are some that still need some more help and I know that over time we will get there.

As of April 1, I'll be starting a new role on the Silverlight team, focusing on you...the developer and designer.  'Evangelism' is a funny word when used in the context of Microsoft.  You would think (and in some cultures it doesn't translate well) that I'm a missionary of sorts.  Well, whatever you want to call it I like to think I'm not moving to far away on the evang-o-meter.  I'm just getting narrow focus and broader goals.  My focus will be on Silverlight.  My community: you.

I'm working in ScottGu's organization and will be joining forces with Jesse Liberty to help serve the developers of the world for Silverlight.  I'll be much more visible on the Silverlight community site (I started out spending a lot of time there but for workload reasons couldn't sustain).  I'll be helping out with the 'How Do I?' series of videos for Silverlight.  And, if I'm lucky, I'll be able to show up at events across the globe (I hear there's one in Belgium coming up...hmmm, I've never been to Belgium) talking about Silverlight and sharing my passion.

I'm real excited about this opportunity and working with all you talented developers and designers.  All my contact information stays the same and the virtual door is always open...keep the feedback and suggestions coming!

(And no, this isn't an April fools joke...unless my new manager Simon is an evil, evil person.)