Web Camp LA–Trip Report

"This was the best training I've ever had, this was even more useful than TechEd" – Gabriel Cruz

Last Friday, Phil Haack, Jon Galloway and I ventured to Los Angeles to deliver a Web Camp at the downtown Microsoft office. 

What do you mean you drive on the other side of the road in the USA?

Photo – “What do you mean you drive on the other side of the road in the USA?”

Agenda and Content

After we got to the venue safely, we delivered an agenda on the following topics:

t7vv.jpg

  • ASP.NET MVC 2 Fundamentals
  • Entity Framework (including a sneak peak of code-first)
  • Validation, Localization
  • ASP.NET MVC + jQuery, jQuery Templating, jQuery Globalization
  • ASP.NET MVC 3 and Razor

NEWS – You can now get the Web Camps Training Kit – September Edition!  This includes much of the content we covered at the event.  (note – we don’t have jQuery Glob or MVC 3 content, yet – that’s coming in November).

Feedback and areas for Improvement

Feedback from the event was great with average scores really high:

  • Overall Eval Score: 8 out of 9
  • Overall Instructor Score: 8.8 out of 9

This is what people told us about the event:

  • “Love the flexible agenda”
  • “One big advantage of the training is to learn first hand the trends in the industry and be able to direct appropriate amount of resources toward training and tools.”
  • “The course was great. As a web forms developer, I was particularly interested in learning more about MVC 2 and 3 and this course provided a huge amount of information. Not only was I able to see how sites can be created using MVC, but just by watching the instructors write code in Visual Studio I was able to learn tips and coding shortcuts that I didn't know about before, and that will help me work more efficiently in the future.”
  • Great course. Even better that the price was free.
  • “Were the presenters good? It was friggen Phil Haack, Jon Galloway, and James Senior. They were great.”

There’s always areas for improvement, from what you said we need to work on some things for next time:

  • Make sure we have time for labs
    • Yes – we overran slightly due to questions but next time we’ll try and leave more time for hands-on building instead of doing the extra ASP.NET MVC 3 session
  • Get the wifi working
    • We hear you.  It’s always hard because we can’t control the venue and piping in dedicated broadband is super expensive.
  • Make sure the content is available at the event or on the website
    • Yes – due to timing the Web Camps Training Kit September Edition wasn’t available, that shouldn’t be an issue moving forward

We are on the cusp of releasing more dates for even more Web Camps, around the world. I’m very excited about this and I’ll have more news on this very soon! For all the information make sure you follow @jsenior or @webcamps on Twitter and check the www.webcamps.ms website.

Tags:

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:

Web Camp LA–Results of the agenda poll

For the Web Camp in LA we asked you what you wanted to hear about at the event.  This is always a bit risky because you end up not being able to please everyone but it was clear that there were some popular topics out there.  Here are the results:

image

Phil, Jon and I spend time last week to come up with an agenda that attempts to combine some of the most popular topics, like jQuery, MVC 101, Data Access and Modelling as well as Ajax, and Client-side Validation.  We think we’ve done that pretty well and I’m please to present the agenda for Web Camps LA:

Timing

Session

08:30-09:00 Arrival & Registration

09:00-10:00

ASP.NET MVC Fundamentals: MVC 101

10:00-11:00

ASP.NET MVC Fundamentals: Data Access and Modeling with Entity Framework

 

Break for 15 minutes

11:15-12:15

MetaData and Validation, Localization

 

Lunch for 45 minutes

13:00-14:00

MVC and Ajax, jQuery Templating, jQuery Globalization

14:00-17:00

Labs

17:00 Leave

Depending on how we are feeling and audience demand, we might also squeeze in an extra bonus session on ASP.NET MVC 3 and Razor – Phil’s been wanting to dazzle everyone with Razor syntax Smile

Here’s a sneak peak of me and Phil talking about Razor and MVC3 here.

Tags:

Ask the expert on Web Camps TV: Rey Bango

Every week we give you the chance to ask the experts questions on Web Camps TV when we’re in the studio.  To ask a question – use the Facebook Live Stream below during the “on air time” and we’ll attempt to answer as many questions as possible.  The show will be aired at a later date.

Today, Friday 27th at 4pm PST we have Rey Bango in the Channel 9 studio.  Rey is a member of the jQuery Core Team and also works at Microsoft as a all around web ninja kinda guy.  Ask your questions below and we’ll get them answered!

 

Tags:

Web Camps L.A.– Sold Out in 48 hours (UPDATED)

****UPDATED 8/27/2010 2:20pm****
We have upgraded to a bigger room and there are currently tickets available for the Web Camp in LA. If you were on the wait list you will be automatically assigned a ticket.  If you’ve not yet signed up – make sure you do quickly!

LAWe released the tickets just under 48 hours ago and Web Camp LA is sold out!  That’s good and bad news, right?! For those of you who haven’t yet signed up, don’t be too distressed.  We are currently looking for a bigger room so that we can release some more tickets.  I’ll post an update once we’ve secured the room – fingers crossed!

Remember we are crowdsourcing the agenda – here’s the poll results so far.  Looks like jQuery and ASP.NET MVC 101 is out in front.  Be sure to vote so you hear the right content!

image

Make your voice heard – take the poll and let us know what content you want!

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:

Microsoft Research Street Slide

Microsoft Street Slide

I came across this excellent video of a new type of view that Microsoft Research has put together which makes it easier to look at a street and side-step (or slide) to the right or left using panoramic stitching.  I can see myself using this to find a particular building and familiarize myself with what’s either side of it so that when I am walking I remember where the building is.  The store logos are also super useful because it’s hard to see from the photos where a company is at.

It’s always great to see Microsoft Research projects, it’s even better when they show up in actual products that you and I can use – hopefully we’ll see this in Bing Maps soon!

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:

New Social API Web Application Toolkit for .NET web developers

image

What’s New?

I’ve just published an update to our Web Application Toolkits!  If you’re not familiar with Web Application Toolkits (WATs) then here’s a summary:

FREE Web App Toolkits help ASP.NET web developers complete common web development tasks and quickly add new features to your apps. Whether it’s Bing Maps integration or adding social capabilities to your site, there’s a toolkit for you. For the full list of Web Application Toolkits check out this website.

Here is a summary of the work we’ve done in this release:

  1. Added a new Social API Web Application Toolkit
  2. Updated all the WATs to be compatible with Visual Studio 2010
Introducing the Social API Web Application Toolkit
Summary

As social networking Web sites are becoming more and more popular, users often want to access simultaneously the different networks they belong to from one only entry point. For example, one user might want to post the same message they are posting on your site also on Facebook, Twitter, MySpace and so on.

Although many of these social networks provide APIs for accessing their information, you might want to integrate your Web application with several social sites at the same time and be able to do this in a consistent manner, without having to go into numerous modifications in your code with each new social network that you want to incorporate.

This Web Application Toolkit provides a generic “Social Networks” API that allows connecting your Web application with different social networks and managing them through one entry point with a consistent set of methods. In the Toolkit you’ll find examples of how to use the Social Networks API provided to connect a Web application with Facebook and Twitter, allowing you to manage the data provided by these networks in a generic way.

Please notice that this Toolkit includes examples only for reduced set of operations (mainly posting status updates) within the two social networks named before. Through this documentation you’ll find instructions on how to extend this set into more operations and more social networks.

Details

This toolkit comes with Facebook and Twitter Providers that allow you to perform tasks against different Social Network APIs in a common way.  For example, Facebook and Twitter do authentication in different ways which is a pain because you have to write different code for each network.  The Providers mean that you can call common methods and pass in which social networks you want to perform the action against – behind the scenes the providers call the appropriate methods against Facebook or Twitter to get the job done.  The provider model also makes it easy to extend the API to other Social Networks in the future – we’ve provided detailed instructions on how to do this in the documentation that comes with the toolkit download – it’s in the “next steps” section.

  1. public ActionResult NetworkLogin(string providerName)
  2.         {
  3.             var social = new SocialProxy();
  4.             return this.Redirect(social.GetProvider(providerName).LoginUrl);
  5.         }

The code above shows how you use the SocialProxy class, included in the toolkit to get the login URL for the given social network.  In this example we then redirect the user to that URL instead of an MVC view in our application.

The Social Networks API checks if the user is already authenticated in the application and if not it authenticates him by using the FormsAuthentication.SetAuthCookie method. The API maintains a user repository with the account information for each user’s social networks.

  1. public bool Login(string providerName, HttpContextBase httpContext)
  2.         {                        
  3.             var provider = this.GetProvider(providerName);
  4.             var identity = provider.GetLoginIdentity(httpContext);
  5.             
  6.             if (identity == null)
  7.             {
  8.                 return false;
  9.             }
  10.  
  11.             if (!httpContext.User.Identity.IsAuthenticated)
  12.             {
  13.                  var userId = this.usersRepository.FindIdentity(identity) ?? this.usersRepository.CreateUser(identity);
  14.                  FormsAuthentication.SetAuthCookie(userId, false);
  15.             }
  16.             else
  17.             {
  18.                  var userId = this.usersRepository.FindIdentity(identity);
  19.                  if (userId != httpContext.User.Identity.Name)
  20.                  {
  21.                      this.usersRepository.AssociateIdentity(httpContext.User.Identity.Name, identity);
  22.                  }
  23.             }
  24.  
  25.             return true;
  26.         }

Notice that new users do not need to create a separate account when registering on the Web application. The API stores the user's Facebook and Twitter account information, and creates a unique identifier on the user repository for that user to keep them associated.

The API stores the user internal identifier together with the login information for each of its associated social networks, by using the UsersRepository.AssociateIdentity method.

image

Once connected I can do things against multiple social networks at once.  For example, I can call one method and have it update my Facebook and Twitter status automatically.  Here is one of the overload methods in the SocialProxy class that does just that:

  1. public void UpdateStatus(string status)
  2.         {
  3.             this.UpdateStatus(status, this.ConnectedIdentities.ToArray());
  4.         }

image

This is one of the social network actions we’ve provided in the toolkit but there are bunch that we’ve not covered, I’ve included some other operations from Facebook and Twitter that would be interesting to see – you can see them in the next steps section of the documentation that comes with the toolkit download.

Download the Social Network API Web Application Toolkit
  1. Download the Social Network API Web Application toolkit and let me know what you think – either leave comments on this post or give feedback on the MSDN Code gallery.
  2. Don’t forget to check out the other Web Application Toolkits and start using them in your ASP.NET web applications today!
  3. If you have ideas for future Web Application Toolkits then email me james [at] microsoft.com

Footnote: We’ve also stopped working on the “Web App Toolkit for Making Your Website Social” because the Windows Live team have a new API more information here.  We have also stopped working on the REST Web Application Toolkit because the functionality provided in the toolkit is now part of .NET 4.

Tags: