Web Camps Training Kit - September Edition

The Web Camp in Los Angeles was a great success last Friday with Phil Haack, Jon Galloway and myself imparting a raft of knowledge on ASP.NET MVC 2, jQuery, Entity Framework Code-first, ASP.NET MVC 3 and Razor.  However, there’s little time to pat ourselves on the back – because this week marks the launch of the September Edition of the Web Camps Training Kit! 

Online and available as a download

The previous version of the Web Camps Training Kit was only available as a download, but we listened to your feedback and are now publishing it online too!  Choose your flavor below:

globe Browse the content online

save Download it Now

What’s new in the Web Camps Training Kit - September edition?

The goal for Web Camps is to provide great training events and an accompanying Training Kit so that web developers have thing they can rely to build websites and apps on the Microsoft Web Platform.  To be a complete web developer, you have to understand many different types of technology, not just the server side.  You also need to know technologies like jQuery, OData and when/how to leverage Web Apps like Umbraco, Kentico, DotNetNuke and more.  As things move so fast, you’ll also need to keep in touch with the latest developments in HTML 5 and how to take advantage of them in the websites you build.

So, in the September edition we are starting to introduce some new technologies areas that help you to keep on the cutting edge.  This is only the beginning and in future editions we will be constantly adding to future versions of the Training Kit.  Here are some new things I would like to highlight:

  1. jQuery

    Working with the .appendTo() team we’ve put together 3 jQuery sessions with presentations, demo scripts and source code.  This content covers some of the fundamentals of jQuery and then extends using Ajax as well as jQuery Templates and jQuery UI.
  2. IE 9 & HTML 5

    With the IE9 Beta just out the door, we’ve provided you some presentations on how to develop on IE9 as well as some of the enhancements the team have made on performance.  This is useful background material and we’ll be following this up with more content in the next release.
  3. ASP.NET MVC 2

    The ASP.NET MVC 2 content has been refreshed and we’re now basing all the content off the MVC Music Store.  There are presentations, labs and demo scripts that walk you through build the site and we’ve also provided a bonus lab on how to start adding Tests to the project.
  4. Web Apps

    The beauty of Web Apps are that they install really easily and they get you to 80% of a completed solution with little effort.  You can customize and tweak them the rest of the way for your own requirements to build complete solutions for customers is no time at all.  In this release we’ve teamed up with Umbraco, Kentico and DotNetNuke to provide presentations, videos and labs for you to get started building solutions.
  5. OData

    OData is the new standards-based web protocol for querying and updating data.  If you are writing an API for your website, it’s worth seeing how you can leverage OData to give developers a clean and familiar way to access your data.  Or, if you are interested in consuming one of the many OData services out there then there are a bunch of SDKs out there to get started in your language.  We provide an intro presentation into OData with more content coming soon to help you learn the programming syntax.

Phew – there’s lots of new content in this release and it’s been fun pulling it all together.  We’ll continue to add more as well as update existing pieces as they become out of date.  Of course, if you have feedback we’d love to here it – please get in contact here.

Don’t forget about the events – you can get expert training by registering for a Web Camp here.  We will be releasing a raft of new event dates very soon.  We are going large – stay tuned!

Tags:

New: Windows Azure Storage Helper for WebMatrix

Hot on the heels of the OData Helper for WebMatrix today we are pushing out a new helper into the community.  The Windows Azure Storage Helper makes it ridiculously easy to use Windows Azure Storage (both blob and table) when building your apps.  If you’re not familiar with “cloud storage” I would recommend you take a look at this video where my pal Ryan explains what it’s all about.  In a nutshell, it provides infinitely simple yet scalable storage which is great if you are a website with lots of user generated content and you need your storage to grow auto-magically with the success of your apps.  Tables aren’t your normal relational databases – but they are great for simple data structures and they are super fast.

You can download the helper from the Codeplex website.

Get started in 60 seconds
  1. If you haven’t already got one, sign up for a Windows Azure account
  2. In the _start.cshtml file setup the helper for use with your account by adding this code:

    1. @using Microsoft.Samples.WebPages.Helpers
    2. @{
    3.     WindowsAzureStorage.AccountName = "youraccountname";
    4.     WindowsAzureStorage.AccountKey = "youraccountkey";
    5. }

  3. Download the latest Windows Azure Storage Helper Binaries
  4. In your WebMatrix project, create a folder named "bin" off the root
  5. Copy the Windows Azure Storage Helper Binaries there
  6. Check out the documentation
  7. Start using Windows Azure Storage Tables and Blobs from WebMatrix with the Helper!

There are loads of use cases out there for blob and table storage.  You just need to look at of the popular startups like Facebook, Twitter, YFrog, Foursquare, Dropbox who all use this type of storage to gain great scale and performance.

How to use the helper

With the helper we’ve provided a bunch of methods that make common operations really easy so that you can that in your WebMatrix apps.  Here are some of my favorite examples:

1. Getting a row from a table – notice how we can just dump the result into a WebGrid and have it render our table for us.

  1. @using Microsoft.Samples.WebPages.Helpers
  2. @{
  3.     var rows = WindowsAzureStorage.GetRows("JamesTable");
  4.     var grid = new WebGrid(rows);
  5. }

2. Updating a row in a table – first we get the individual row, making sure to pass it the partition and table name.  Next we make a change to an item, then update the table.

  1. @using Microsoft.Samples.WebPages.Helpers
  2. @{
  3.     var row = WindowsAzureStorage.GetRow("JamesTable", "partition1", "row1");
  4.     row.Name = "James Senior";
  5.     WindowsAzureStorage.UpdateRow("JamesTable", row);
  6. }

3. Uploading a file into blob storage – I like to use this in combination with the FileUpload helper that we ship with WebMatrix.  You can pass a stream, binary file or text string into the helper method and it’ll be placed in the blob address you specify.

  1. @using Microsoft.Samples.WebPages.Helpers
  2. @{
  3.     var uploadedFile = Request.Files[0];
  4.     WindowsAzureStorage.UploadBinaryToBlob("MyContainer/" + uploadedFile.FileName, uploadedFile.InputStream);
  5. }

4. To grab the blob, use one of the download methods like DownloadBlobAsText or DownloadBlobAsText.

@using Microsoft.Samples.WebPages.Helpers
@{
   // reference to my blob
   var blobRef = "MyContainer/foo.txt";

   // gets the blob as text
   var astring = WindowsAzureStorage.DownloadBlobAsText(blobRef);
  
   // gets the blob as a byte array and puts it in the
   var bytes = WindowsAzureStorage.DownloadBlobAsByteArray(blobRef);
 
   // Send the response so the user can download the file
   Response.ClearContent();
   Response.AppendHeader("Content-Type", "application/octet-stream");
   Response.AppendHeader("Content-Disposition:", String.Format("attachment; filename={0}", HttpUtility.UrlPathEncode(blobRef)));
   Response.BinaryWrite(bytes);
   Response.End();
}

Here’s a video where I walk through how to do all this good stuff in detail:

Get Microsoft Silverlight

 

Future work

There’s some more features I’d like to add to the next version of this helper. I’ve started a discussion here about that – join the conversation if you have any ideas!  Here are the current ideas:

  • Error Handling (Windows Azure Tables)
  • Pagination and continuation tokens (Windows Azure Tables)
  • Lease/Snapshot/Copy Blob operations (Windows Azure Blobs)
  • Sharing Blobs (Windows Azure Blobs)
  • Delimiters (Windows Azure Blobs)
  • Client-side ordering (Windows Azure Tables)

Tags:

Announcing the OData Helper for WebMatrix Beta

I’m a big fan of working smarter, not harder.  I hope you are too.  That’s why I’m excited by the helpers in WebMatrix which are designed to make your life easier when creating websites.  There are a range of Helpers available out of the box with WebMatrix – you’ll use these day in, day out when creating websites – things like Data access, membership, WebGrid and more.  Get more information on the built-in helpers here.

It’s also possible to create your own helpers (more on that in a future blog post) to enable other people to use your own services or widgets.  We are are currently working on a community site for people to share and publicize their own helpers – stay tuned for more information on that. 

Today we are releasing the OData Helper for WebMatrix.  Designed to make it easier to use OData services in your WebMatrix website, we are open sourcing it on CodePlex and is available for you to download, use, explore and also contribute to.  You can download it from the CodePlex website.

  1. @{
  2. var result = OData.Get("http://odata.netflix.com/Catalog/Genres('Horror')/Titles","$orderby=AverageRating desc&$top=5");
  3. var grid = new WebGrid(result);
  4. }
  5.  
  6. @grid.GetHtml();
 

What is OData?

OData, or as I like to call it “Oh…. Data” Winking smile, is an open specification that makes it possible to have consistent APIs for all the different services out there.  Effectively it’s REST with a powerful query syntax that makes it easy to extract the data you want from a service.  So far there are a bunch of websites out there that have exposed their data using the spec, including Facebook, Netflix, Stackoverlow etc.  There’s a full list over at www.odata.org as well as more information on the spec itself.

Getting Started Video

Get Microsoft Silverlight

How to use the OData Helper

The OData helper supports CRUD (Create, Read, Update and Delete) methods - as you would expect -  but for reading there are a couple of syntaxes available; use the one which feels most natural to you.  Here are a couple of examples of the different syntaxes:

Get the top 5 Horror Titles (Using String Filters)

 

  1. @using Microsoft.Samples.WebPages.Helpers
  2. @{
  3. var result = OData.Get("http://odata.netflix.com/Catalog/Genres('Horror')/Titles","$orderby=AverageRating desc&$top=5");
  4. var grid = new WebGrid(result);
  5. }

 

Get the top 3 Movies in French (Using Query Syntax)

 

  1. @using Microsoft.Samples.WebPages.Helpers
  2. @{
  3. var result = OData.Open("http://odata.netflix.com/Catalog/Languages('French')/Titles")
  4. .Where("Type eq 'Movie'")
  5. .OrderBy("AverageRating desc")
  6. .Top(3)
  7. .Get();
  8. var grid = new WebGrid(result);
  9. }

 

Inserting new data
  1. @using Microsoft.Samples.WebPages.Helpers
  2. @{
  3.    var movie = OData.CreateEntity();
  4.    movie.Name = "OData Helpers - The Movie";
  5.    movie.ReleaseYear = 2010;
  6.    movie.BoxArt.LargeUrl = "http://cdn-4.nflximg.com/us/boxshots/tiny/5670394.jpg";
  7.    OData.Insert("http://odata.netflix.com/Catalog/Titles", movie);
  8. }

Updating existing data

 

  1. @using Microsoft.Samples.WebPages.Helpers
  2. @{
  3.    var movie = OData.Get("http://odata.netflix.com/Catalog/Titles('13kaI')");
  4.    movie.Name = "OData Helpers - The Movie";
  5.    OData.Update("http://odata.netflix.com/Catalog/Titles('13kaI')", movie);
  6. }

 

Deleting existing data
  1. @using Microsoft.Samples.WebPages.Helpers
  2. @{
  3.    OData.Delete("http://odata.netflix.com/Catalog/Titles('13kaI')");
  4. }

With Netflix service the insert, update and delete operations won’t work because they only provide read access – so the examples above are just for illustrative purposes only.

If you are new to the OData query syntax I would recommend checking out the docs that the OData team have put together.

What can you do?

There are bunch of OData services out there (full list here), why not create some wrapper classes for each service with common operations baked in so other developers don’t even have to know the syntax.  You’ll see what I mean if you explore the sample application in the download section of the CodePlex project.  We’ve included a Netflix.cs file in app_code folder – it’s just a wrapper around the OData helper class which performs some commonly used queries for the user.  I’d love to hear what you can do!

Next Steps

OData Helper v2

We’ve already cooked up some enhancements for the next version of the OData helper, you can find the list here.  If you think of anything you would like to see, please reply to the discussion in the forum!

Other Helpers

I’m now working on some other helpers which I think are pretty cool – you’ll hear more about them soon.  I’d love to hear about your ideas for helpers – maybe I can build it for you!  If you have an idea leave me a comment or send me mail – james {at} microsoft.com

Tags:

Announcing the Web Camps Training Kit: July 2010 Edition

webCamps150x240

Today, we are releasing the Web Camps Training Kit: July 2010 Edition – Download it here.

The kit includes all the content we presented around the world at the recent Web Camps events; presentations, demos, labs and more.  Inside the new kit you’ll find content that covers the following technologies:

  • ASP.NET MVC 2
  • ASP.NET 4 Web Forms
  • jQuery
  • Entity Framework
  • Visual Studio 2010
  • Deployment

We’ve also included the agenda so if you want to run your own Web Camp with some of our content, you can do that. Let the team know if you are planning to run your own – we’ll help get the word out (webcamps [at] microsoft.com).

As a bonus we’ve also included scenario based content which comes in the form of complimentary slides, demos, demo scripts and hands-on-labs.  These scenarios show you how to take your own web application from an idea and prototype all the way to getting more visitors and optimizing for performance using the Microsoft Web Platform and other technologies from Microsoft.

  • Prototyping Your Web App
  • Building Your Web App
  • Enhancing Your Web App
  • Getting More Visitors to your Web App
  • Optimizing Your Web App for High Performance

We are going to be adding new scenarios as well as fresh content covering the latest on WebMatrix, ASP.NET MVC, Entity Framework, jQuery and more as well as brand new Web Camps!  Stay tuned!  Again, we’re open to hearing your feedback and requests – if there is anything you would like to see in the next version of the training kit, let us know (webcamps [at] microsoft.com).

Download the Web Camps Training Kit!

Tags:

Top links for getting started with WebMatrix

Post Last Updated: 7/16/2010

image

WebMatrix is everything you need to build Web sites using Windows. It streamlines Web site development and makes it easy to start Web sites from popular open-source apps.

Getting Started
  1. Download WebMatrix
  2. Top 10 features for Web Matrix
  3. Twitter Archive of everything Web Matrix
  4. Scott Gu’s Blog Post on Web Matrix
  5. API Reference Guide
  6. ASP.NET Web Pages Forum
  7. How to Create an ASP.NET Application from Scratch Using WebMatrix Beta
  8. Web Matrix eBook
  9. FAQs for Open Source and Free web applications
  10. Get help in the forums
Find Web Hosting for your projects

Microsoft’s Web Hosting Gallery

Make Suggestions and Submit Bugs

Help us make WebMatrix better! Make a suggestion or submit bugs to the team.

Pragmatic Press and Blog Coverage of Web Matrix

Microsoft Web Matrix: What's In It for Dev Professionals? (Michael K Campbell)
WebMatrix - A Path To Enterprise Web Development? (David Hayden)

Tags: