Connecting to Azure Table Storage
Mar 12th
After you finally manage to get Table Storage working (see nice tutorial here) you’ll try to deploy it to your staging environment. That means you need to change the configuration.
There are three settings to use: AccountName, AccountSharedKey and TableStorageEndpoint.
Unfortunately, the values you need for them aren’t what you would naturally expect.
AccountName: This isn’t your account name, but the name of your storage account. (I guess that’s why it has to be a unique name at the time you create it.) On the summary page of your storage project you will only see the value you need in the list of endpoints. It’s the first part of each of the three domain names.
AccountSharedKey: This is the Primary Access Key as found in the summary page of your storage project in the developer portal.
TableStorageEndpoint: This isn’t the endpoint as described in the summary page, but rather a shortened version. Just lop off the AccountName part of the endpoint you use as described in the summary page. That should give you something like http://table.core.windows.net.
For more information see this article on MSDN.
It is so time-consuming to get right, that it really makes sense to follow the advice in the documentation. First, test locally. Then test your local hosted app using the live Storage account. Finally, load your app and test that in the staging environment.
Saying that, I haven’t yet managed to get the second scenario to work. It just crashes on start-up. (Help!)
Learning Windows Azure
Mar 12th
I started to learn how to use the Azure Cloud Service from Microsoft this week. Currently it’s still in Tech Preview stage. Unfortunately you can tell that from the SDK documentation.
Here’s some useful links to get you going:
- Screencasts: http://msdn.microsoft.com/en-us/azure/dd439432.aspx
These are quite basic, but trust me, you need them to be basic to get you started. - SDK: http://www.microsoft.com/downloads/details.aspx?FamilyID=80e3eabf-0507-4560-aeb6-d31e9a70a0a6&displaylang=en
Contains CHTM-style documentation, tools and samples. Don’t expect too much from the docs; they explain enough to get you confused, and then have an API reference. You need to unzip the samples and get into them to start understanding how everything fits together. - Visual Studio Templates: http://www.microsoft.com/downloads/details.aspx?FamilyID=8e90b639-1ef0-4e21-bb73-fc22662911bc&displaylang=en
This gives you a set of project and item templates which you can use to create and publish Azure applications. Don’t worry about the extra projects it adds to a solution, or the config files. You will learn more about them later. - The Azure developer center on MSDN: http://msdn.microsoft.com/en-us/azure/default.aspx
Assuming you already registered for Azure, that’s all you really need to get started.
The biggest problem I found at first was deploying an app. Once you have generated an Azure project in Visual Studio, you expect to be able to publish it from Visual Studio too. Unfortunately you can’t, and it takes a little more effort. I’ll write more about that in another post.
I also needed help trying to understand what to focus on to get started. So here’s a big tip: Ignore .Net Services, Live Services, and SQL Data Services. They aren’t part of Azure per se. You can come back to them later. First you just need a hosted project and some storage – either blob storage or table storage. (There’s also queue storage, but I bet no one will want to use that straight away – it’s for tying two apps together, which no one will want to do at first.)
I recommend you download the SDK and the Visual Studio templates, create yourself a “Web Role” project (which is really the equivalent of an ASP.Net project), and work on that. Then move onto table and blob storage. You can use the screencasts to help you.
Good luck getting started!
The Value of Being Free to See the Source
Apr 18th
Since the source code to ASP.Net was made available, I’ve been using it extensively. Here’s a great example of why it’s so valuable.
I’ve been trying to integrate the Enterprise Library 3.1 Exception Handling Block into my application. My application is split into a core and web UI specific components, so I’ve defined errors in my code to be thrown when a resource is not available. The web application configuration file specifies that if a specific exception, e.g. a ResourceNotFoundException, is thrown, the Exception Handling Block should replace that exception with a 404 Resource Not Found error using Http. That should in turn use the CustomErrors feature to redirect to a 404 not found page.
Makes sense, and sounds simple, don’t you think?
Nothing in the docs says that it shouldn’t work.
But it doesn’t. It simply won’t work. Why? Well, there’s nothing on the web. But after spending some serious hours digging through the source code, I can finally see why.
Here’s a lovely little hidden-to-the-world snippet of the code I got inside of Visual Studio:
code = HttpException.GetHttpCodeForException(e); // Don't raise event for 404. See VSWhidbey 124147. if (code != 404) { WebBaseEvent.RaiseRuntimeError(e, this); }
Nice of them to let me know.
Easy Data-loading with LINQ-to-SQL and LINQ-to-XML
Mar 20th
.Net 3.5 had some nice tricks in it. LINQ-to-XML was one of them. With the new "X"-types, you can make working with XML really easy.
VB.Net 9 takes it one step further, and lets you write XML in your code without strings.
"Hey Rich, that’s old news," I hear you say. "And who’s interested in VB today anyway?"
Well, apparently there are a lot of VB-er’s still out there. I am mainly a C# developer myself, but I found that VB was perfect for a problem I had recently - loading of XML data into a SQL Server table.
Silverlight 2 Poster Available
Mar 17th
You’re not a real Silverlight developer until you have the poster stuck up on your wall.
Apparently these were hot at Mix.
Thanks to Brad Abrams for posting it.
Design Guidelines for LINQ
Mar 13th
Have you wondered if and when you should use the new LINQ features in .Net 3.5?
Like, where should I put a new extension method? Should I use Func<T> or a custom delegate? How do I best implement a mix-in (extension methods on an interface)?
Well, Mircea Trofin has just published a new draft of some LINQ design guidelines. You might just find your answers there.
Read Word Documents in a Web Browser
Mar 7th
I love this! Not because of the features, but because of the way it works.
Tim Sneath just blogged about TextGlow – an online Word docx file reader. The docx format is XML, and Silverlight 2 apps can use LINQ-to-XML to parse it and format it for display inside the browser.
Amazing!
You can read more about it on Tim’s blog.
Mix 08 WPF Scheduling Application
Mar 5th
Mix 08 seems to be much more mature than ever before. In previous years there were a lot of ideas being spoken about; this year there are much more implementations of those ideas available to look at. It seems like a lot of people have been working on the new technologies over the past year or so. Hopefully that will lead to the ripening of many technologies (especially WPF) to a point where we can actually use them.
As an example, there is a scheduling application available for Mix. Unfortunately it only runs on Vista, but I captured a video and made a few screenshots for you.
This is the opening screen, with an agenda for the 4 days of the event:
(Click the image to make it larger.)
Silverlight for Nokia Phones
Mar 5th
BBC News has just released an article referring to a deal made between Microsoft and Nokia to put Silverlight on mobile phones.
Yet another reason to get polishing those WPF skills.