scandalz.net
 
 
 
BETA (Google AJAX Search)

Programming

I'm putting a bunch of programming related resources here. It's always going to be a work in process since every language (except COBOL) is a work in progress. And if I catch someone working in COBOL, I'll rm -rf them

jQuery Intellisense in VS 2008

by ScottGu at 02:07 AM, 11/21/2008

Last month I blogged about how Microsoft is extending support for jQuery.  Over the last few weeks we've been working with the jQuery team to add great jQuery intellisense support within Visual Studio 2008 and Visual Web Developer 2008 Express (which is free).  This is now available to download and use.

Steps to Enable jQuery Intellisense in VS 2008

To enable intellisense completion for jQuery within VS you'll want to follow three steps:

Step 1: Install VS 2008 SP1

VS 2008 SP1 adds richer JavaScript intellisense support to Visual Studio, and adds code completion support for a broad range of JavaScript libraries.

You can download VS 2008 SP1 and Visual Web Developer 2008 Express SP1 here.

Step 2: Install VS 2008 Patch KB958502 to Support "-vsdoc.js" Intellisense Files

Two weeks ago we shipped a patch that you can apply to VS 2008 SP1 and VWD 2008 Express SP1 that causes Visual Studio to check for the presence of an optional "-vsdoc.js" file when a JavaScript library is referenced, and if present to use this to drive the JavaScript intellisense engine.

These annotated "-vsdoc.js" files can include XML comments that provide help documentation for JavaScript methods, as well as additional code intellisense hints for dynamic JavaScript signatures that cannot automatically be inferred.  You can learn more about this patch here.  You can download it for free here.

Step 3: Download the jQuery-vsdoc.js file

We've worked with the jQuery team to put together a jQuery-vsdoc.js file that provides help comments and support for JavaScript intellisense on chained jQuery selector methods.  You can download both jQuery and the jQuery-vsdoc file from the official download page on the jQuery.com site:

Save the jquery-vsdoc.js file next to your jquery.js file in your project (and make sure its naming prefix matches the jquery file name):

You can then reference the standard jquery file with an html <script/> element like so:

Or alternatively reference it using the <asp:scriptmanager/> control, or by adding a /// <reference/> comment at the top of a standalone .js file. 

When you do this VS will now look for a -vsdoc.js file in the same directory as the script file you are referencing, and if found will use it for help and intellisense.  The annotated

For example, we could use jQuery to make a JSON based get request, and get intellisense for the method (hanging off of $.):

As well as help/intellisense for the $.getJSON() method's parameters:

 

The intellisense will continue to work if you nest a callback function within the method call.  For example, we might want to iterate over each JSON object returned from the server:

And for each of the items we could execute another nested callback function:

We could use the each callback function to dynamically append a new image to a list (the image src attribute will point to the URL of the returned JSON media image):

And on each dynamically created image we could wire-up a click event handler so that when it is pressed it will disappear via an animation:

Notice how the jQuery intellisense works cleanly at each level of our code. 

JavaScript Intellisense Tips and Tricks

Jeff King from the Web Tools team wrote up a great post earlier this week that answers a number of common questions about how JavaScript intellisense works with VS 2008.  I highly recommend reading it.

One trick he talks about which I'll show here is a technique you can use when you want to have JavaScript intellisense work within user-controls/partials (.ascx files).  Often you don't want to include a JavaScript library <script src=""/> reference  within these files, and instead have this live on the master page or content page the user control is used within.  The problem of course when you do this is that by default VS has no way of knowing that this script is available within the user control - and so won't provide intellisense of it for you.

One way you can enable this is by adding the <script src=""/> element to your user control, but then surround it with a server-side <% if %> block that always evaluates to false at runtime:

At runtime ASP.NET will never render this script tag (since it is wrapped in an if block that is always false).  However, VS will evaluate the <script/> tag and provide intellisense for it within the user-control.  A useful technique to use for scenarios like the user control one.  Jeff has even more details in his FAQ post as well as his original jQuery intellisense post.  Rick Strahl also has a good post about using jQuery intellisense here.

More Information

To learn more about jQuery, I recommend watching Stephen Walther's ASP.NET and jQuery PDC talk. Click here to download his code samples and powerpoint presentation.

Rick Strahl also has a really nice Introduction to jQuery article that talks about using jQuery with ASP.NET.  Karl Seguin has two nice jQuery primer posts here and here that provide shorter overviews of some of the basics of how to use jQuery. 

I also highly recommend the jQuery in Action book.

Hope this helps,

Scott

We shipped Silverlight 2 last month.  Over the last 4 weeks, the final release of Silverlight 2 has been downloaded and installed on more than 100 million consumer machines.  It has also recently been published to corporate administrators via the Microsoft SMS and Microsoft Update programs to enable them to automatically deploy across enterprises.  Over 1 in 4 computers on the Internet now have some version of Silverlight installed.

Silverlight 2 was a major release, and delivered an impressive set of cross-browser, cross-platform functionality for Media and Rich Internet Application experiences.  It has been great watching new sites launch using it.

Media Experiences

Silverlight 2 enables the highest quality video on the web, and delivers it with the lowest TCO of any media platform.

One of the capabilities built-into Silverlight 2 is its support for "adaptive streaming" - which enables video to be delivered at multiple bitrates (for example: 400Kbits, 800Kbits, 1.5Mbits, 2Mbits) with Silverlight dynamically choosing the optimal bitrate to use depending on the network bandwidth and CPU capability of the client (it can also automatically switch bitrates seamlessly if conditions change later). 

Silverlight's adaptive streaming support is extensible.  Move Networks (who helped pioneer the concept of adaptive streaming) have already integrated their adaptive streaming solution with Silverlight.  Silverlight 2 and Move were used to stream the Democratic National Convention live on the web this summer. 

Last month we announced that Microsoft will be adding adaptive streaming support as a free feature of our IIS7 web-server.  IIS Smooth Streaming will provide an integrated way to deliver HD quality adaptive video over the web. Visit Akamai's www.smoothhd.com site to see some awesome examples of Silverlight 2 and IIS Smooth Streaming in action (with adaptive streaming up to 2.5Mbits).

The NBC Olympics site used Silverlight 2 to serve more than 3,500 hours of live and on-demand Olympic coverage to over 60 million unique visitors this summer.  Visitors to the site watched an average of 27 minutes of video - which is stunningly high for online video.  The site used the new Silverlight adaptive streaming capability to support 1.5Mbit bitrates - which helped deliver an awesome video experience:

In addition to powering the Olympics experience in the US, Silverlight was also used in France (by FranceTV), the Netherlands (by NOS), Russia (by Sportbox.ru) and Italy (by RAI).  In addition to video quality, a big reason behind these broadcasters decision to use Silverlight was the TCO and streaming cost difference Silverlight provided.  In the August 2008 edition of Web Designer Magazine (a Dutch publication) a NOS representative reported that they were able to serve 100,000 concurrent users using Silverlight and 40 Windows Media Servers, whereas it would have required 270 servers if they had used Flash Media Servers.

Over the last month we've seen several major new deployments of Silverlight for media scenarios.  For example: CBS College Sports is now using Silverlight to stream NCAA events from its 170 partner colleges and university.  Blockbuster is replacing Flash with Silverlight for its MovieLink application. And Netflix two weeks ago rolled out its new Instant Watch service using Silverlight. 

Rich Internet Applications (RIA) Experiences

Silverlight 2 delivers a cross-browser, cross-platform subset of the .NET Framework, and enables developers to build Rich Internet Applications. 

Developers can use either VS 2008 or the free Visual Web Developer 2008 Express to open and edit Silverlight 2 projects, and get a powerful code-focused .NET development environment.  Designers can use Expression Blend 2 SP1 to open and edit the same projects and use a creative tool to sculpt and create rich user experiences.  I recently blogged about the nice developer/designer workflow this enables here.  Two weeks ago at the PDC we also shipped the first release of our Silverlight Toolkit - an open source project which adds additional runtime controls and components for Silverlight 2 development (including new charting controls). 

A number of customers have already launched Internet-facing Silverlight 2 RIA solutions (including Renault, Hard Rock and Toyota). For example, last month AOL launched their new AOL Mail RIA using Silverlight 2:

Silverlight 2 is also now being used in a variety of enterprise solutions.  For example, K2 recently launched their new Blackpoint workflow management solution for Microsoft SharePoint using Silverlight:

Microsoft is also deploying new Silverlight based RIA experiences.  The Windows Live Team's new photo application (photos.live.com) and video communications application (videomessages.live.com) are both built with Silverlight 2, as is the new MSN Toolbar (it uses Silverlight to customize the browser frame).  Last month at the PDC we also gave a first sneak-peak demo of some of the new Office 14 Web Companion RIA applications which use Silverlight.

Silverlight 3

Next year we will ship our next major Silverlight release -- Silverlight 3. 

Silverlight 3 will include major media enhancements (including H.264 video support), major graphics improvements (including 3D support and GPU hardware acceleration), as well as major application development improvements (including richer data-binding support and additional controls).  Note these are just a small sampling of the improvements - we have plenty of additional cool features we are going to keep up our sleeves a little longer. ;-)

Next year Visual Studio and Visual Web Developer Express will also support a fully editable and interactive designer for Silverlight, and add tool support for data-binding:

We are pretty excited about where Silverlight is today, as well as the roadmap in place over the next year.  It has been really great to watch customers go live with cool solutions.  The next year is going to be a fun one as more and more sites launch with Silverlight 2, and as even bigger scenarios are enabled with Silverlight 3 and beyond. :-)

Hope this helps,

Scott

Outage: Myspace, Friendster, Cubics

by Anatoly Lubarsky at 16:26 PM, 11/15/2008

I don't see anyone blogs about this therefore I have to write about it myself.


  • Friendster is offline for more than 36 hours out of last 48 and it is still offline right now.
  • Myspace applications are "down for maintenance" for more than 10 hours now and counting...
  • Cubics is down for maintenance. Obviously cubics takes advantage on myspace and friendster outage to fix their stuff. Hope so...
  • Google Adsense has had unstable reporting during yesterday. Google Adsense was not available at all for 1 hour and has had some delay reporting clicks while reporting impressions from midnight PST.

Myspace and Friendster folks — this is so unprofessional. Sad :(

Silverlight 2 provides a rich platform for building cross-browser/cross-platform RIA applications. 

One of the things that makes Silverlight so powerful is the ease with which developers and designers can collaborate together on projects.  Developers can use Visual Studio to open and edit Silverlight 2 projects and get a powerful code-focused .NET development environment, and designers can use Expression Blend 2 SP1 to open and edit the exact same project and use a creative tool to sculpt and create optimal user experience designs.

The WPF UI framework shipped in Silverlight further enables a great designer/developer workflow by supporting concepts like layout management, controls, styles, templates, and resources - which help avoid scenarios where designers and developers end up tripping over each other when integrating functionality, behavior and expressive design.

Silverlight 2 Twitter Sample

Last month I posted an in-depth blog tutorial on how to build a Silverlight 2 Digg application which you can read here.  This tutorial was aimed primarily at developers, and focused on introducing the fundamental programming concepts involved when building a Silverlight 2 application. 

Today Celso Gomes and Peter Blois posted a cool 10 minute video tutorial that shows off using Expression Blend to stylize a Silverlight 2 Twitter Messenger application.  You can watch the video here.  You can download the source code for the completed Silverlight Twitter application here.

The video does a nice job demonstrating how designers can re-style a Silverlight application without having to mess with the code behind it.  In the process it shows some of the power and capability that Expression Blend 2 provides to build really rich user experiences.  Celso starts with a developer version of the application, and then customizes and sculpts the UI to have a fun twitter character theme:

The Application Model

The Silverlight Twitter client is hosted within an ASP.NET server application that exposes a web service that enables the Silverlight Twitter application to communicate to the Twitter service (since Twitter does not allow direct access from client applications). Communication between the Silverlight client and the ASP.NET web server is done using Windows Communication Foundation (WCF).

The client application uses a Model-View-Presenter (MVP) pattern (also known as the Model-View-ViewModel pattern) which is commonly used in large WPF applications. Even though this is a fairly simple application they wanted to take advantage of the flexibility that MVP allows and allow room for future growth. 

Maintaining the separation between the visuals and the application logic also enables designers to make fairly complex visual changes without impacting the basic application flow.  The video goes through some examples of the styling flexibility this architecture facilitates.

The Styling Process

In the video, Celso highlights how Resources can help designers quickly change colors.  A common Brush Resource, for example, can be used to change the color of all the text elements in the application:

Celso shows how easy is to create new User Controls from graphics using Expression Blend 2 SP1 (just select multiple elements in the designer, right-click, and choose the "Make Control" menu option):

And also how to create new states inside this new User Control (using the Visual State Manager feature - which is also now supported with WPF), to animate the bird (fly, blink, etc...)

Celso also shows how to create animations for each state, changing advanced properties like Key Spline curves, and Repeat Behavior:

He also shows how to create custom buttons from drawings (which can come from XAML or any other design tool like Photoshop or Illustrator). All the states of a Button Control are available out of the box.

Expression Blend also enables you to easily change complex controls like List Boxes. Designers have access to all Styles, Templates, and states - and can completely customize all the parts of a List Box without having to write any code:

You can watch the video and download the code to check out the above Twitter application.

To learn more about Expression Blend, I also recommend watching the Expression Blend: Tips and Tricks presentation from the PDC conference two weeks ago.

Update: Also check out Shawn Wildermuth's Deep Control Skinning with Styles webcast.

Hope this helps,

Scott

Introducing Fosimo 1.0

by Anatoly Lubarsky at 19:49 PM, 11/11/2008

Fosimo 1.0 is available for download. Fosimo is a Facebook desktop client for windows. It's 1.5 year now since Fosimo initial release.


New in Fosimo 1.0

Overall it is just a catch up to recent changes made by Facebook. Since previous version was 0.9.9 I had had no other choice to jump to 1.0 version :)


Here are some key features of Fosimo:

  • Monitor friends online presence and status changes.
  • View friends details.
  • Synchronize Facebook friends with matching OUTLOOK contacts. For windows mobile devices owners - you should be able to see your contacts photos on your phone display.
  • Upload photos without surfing through Facebook.
  • Change Facebook status.
  • Be notified on invites and changes to your account.

Enjoy :)

Javascript Tip: Use Width and Height for Images

by Anatoly Lubarsky at 00:19 AM, 11/08/2008

Let's talk about some dynamic content in HTML. Suppose we have a div:


< div id="div1">< /div>

And we need to render an image dynamically from inside this div (for example during page load). The small trick I'd like to share is to use width and height attributes for this image (even when we use original size without stretching the image). Like so:


var div1 = document.getElementById("div1");
div1.innerHTML = '< img src="some-url" width="200" height="175" />';

The image will load faster and it won't move or shift other HTML content therefore will provide better experience for the user. Enjoy :)

Last week was our big PDC conference, and I've been busy catching up back at work this week.  I'm hoping to publish a bunch of new posts soon (including some on the PDC announcements we made).  Until then, here is the latest in my link-listing series.  Also check out my ASP.NET Tips, Tricks and Tutorials page and Silverlight Tutorials page for links to popular articles I've done myself in the past.

ASP.NET

  • Download Hotfix: False C# Compilation Errors for ASP.NET Code Behind Files with VS 2008 SP1: The C# team added support for live semantic errors with background compilation in VS 2008 SP1.  There were a few cases where this caused false errors to be shown with ASP.NET Web site projects.  You can fix these either by disabling live semantic errors (tools->options allows you to disable this), or by downloading a recent hotfix patch which is now public.  Omar Khan has a useful blog post with more details on it.

  • ASP.NET Patterns Developers Should Know: Alex Homer from the Patterns and Practices (PAG) team at Microsoft has a nice article that introduces a number of common design patterns (MVC and MVP, Repository, Singleton, etc) and how you can apply them within ASP.NET applications.  If you are interested in learning more about pattern based development I also highly recommend reading the Head First Design Patterns book (which has more than 250 positive reviews on Amazon).

ASP.NET AJAX and jQuery

  • Rich jQuery Intellisense with VS 2008: Last week we published a new jQuery intellisense file for VS 2008 that delivers super-rich and accurate javascript intellisense when using jQuery.  Jeff's article describes how to download and start using it today.

  • ASP.NET and jQuery: Stephen Walther delivered an awesome talk on using jQuery with ASP.NET at the PDC conference last week.  You can now watch it online for free.  Click here to download his code samples and powerpoint presentation.

  • jQuery Primer Part 1 and Part 2: Karl Seguin has two nice posts that provide a quick overview of some of the basics of how to use jQuery.  Also check out Rick Strahl's longer Introduction to jQuery article (which I've previously linked to) for a longer jQuery tutorial.

  • ASP.NET AJAX Futures: Bertrand Le Roy delivered an awesome talk on the new ASP.NET AJAX features coming soon at the PDC conference last week.  You can now watch it online for free as well as download his slides and code-samples.

ASP.NET MVC

  • Bin Deployable ASP.NET MVC: Phil Haack has a useful blog post that describes step-by-step how to enable \bin directory deployment of ASP.NET MVC.  This enables you to deploy ASP.NET MVC based applications on remote hosting servers that do not have ASP.NET MVC already installed (which means you don't need them to run any setup or do extra steps for your application to work).

  • Donut Caching in ASP.NET MVC: Phil Haack has a great blog post that talks about how to implement substitution output caching with ASP.NET MVC.  I coined the name "donut caching" for this technique with a previous blog post I did on using substitution output caching with ASP.NET Web Forms.  Phil covers it for ASP.NET MVC.

  • Grouping Controllers with ASP.NET MVC: Phil Haack has another great post that covers how to segment a ASP.NET MVC application into multiple "areas" or "modules" - which can optionally be developed in separate projects and merged into one large master application.  Also check out Steve Sanderson's follow-up post with more ideas on this topic.

Silverlight and WPF

  • Silverlight Toolkit Released: Last week at PDC we shipped the first release of the Silverlight Toolkit.  This is a free download that works with Silverlight 2, and delivers a whole slew of awesome controls and features (including new charting controls, new layout managers, treeview, viewbox, and more).  A must-have download for every Silverlight  developer.

  • Updated WPF Performance Profiling Tool: The WPF team recently posted an update to their excellent WPF Performance Profiling Tool.  Definitely something to check out if you are doing WPF development.

Hope this helps,

Scott

Einstürzende Neubauten — Nagorny Karabach

by Anatoly Lubarsky at 07:26 AM, 11/01/2008

Today music video is by Einstürzende Neubauten, a german group which is active for more than 25 years now. I remember myself listening to Einstürzende A LOT 10-12 years ago. The band name means self-collapsing new buildings in english.


Their style has been most of the time hard industrial avant-garde. They used custom-build metal instruments and used scraping them.


The following music composition has a bit more conservative sound and is called "Nagorny Karabach". Nagorny Karabach refers to anclave in Armenia which can be translated as black garden.



Enjoy

My Bet for Dow and NASDAQ for 01/01/2009

by Anatoly Lubarsky at 18:56 PM, 10/25/2008

So I bet that on 01/01/2009 lead indexes will be:


  • Dow — 7140
  • NASDAQ — 1325

Around December they will both reach the bottom point.

Here is the latest in my link-listing series.  Also check out my ASP.NET Tips, Tricks and Tutorials page and Silverlight Tutorials page for links to popular articles I've done myself in the past.

ASP.NET

  • Building a Great ASP.NET AJAX Application from Scratch: Brad Abrams has a nice end to end application tutorial that shows off building an ASP.NET AJAX application from scratch. It covers ASP.NET, LINQ, Server and Client-side AJAX, the ASP.NET AJAX Control Toolkit, jQuery and more.  A great end to end read.

  • ASP.NET MVC and the new IIS7 URL Rewriting Module: Scott Hanselman has a great post that shows off using the new IIS7 Rewriitng Module (which is free and very, very cool) to deliver great SEO (search engine optimization) for sites built with ASP.NET and specifically ASP.NET MVC. 

Visual Studio

  • VS 2008 Snippet Designer: A cool utility that enables you to quickly create re-usable Visual Studio snippets.  Very handy for automating common tasks.

Silverlight and WPF

  • XAML Power Toys Released for WPF and Silverlight: Karl Shifflett has released an awesome update to his XAML Power Toys download.  This is a must-have download if you are doing WPF or Silverlight development, and provides a bunch of great wizards and tools that help automating application development.  Very, very cool stuff.

  • WPF Pixel Shader Effects Library on CodePlex: .NET 3.5 SP1 added Pixel Shader support to WPF - which enables you to add cool DirectX optimized visual effects to any WPF control or surface.  This article from Jamie points to a nice new CodePlex project that is available that delivers a bunch of pre-built effects you can use.

  • Silverlight 2 UI Templates: Tim Heuer writes about some cool new UI templates available for the recently released Silverlight 2.

Hope this helps,

Scott

Patrick Bunton — Young Birds

by Anatoly Lubarsky at 07:49 AM, 10/18/2008

As on every Saturday this is a music post. Todays music video is created by Patrick Bunton from Hamburg, Germany. The style he performs is called "hardstyle" (More info).


The following music video is called "Young Birds":



Enjoy

Does Facebook Platform Matter Anymore?

by Anatoly Lubarsky at 21:28 PM, 10/17/2008

The short answer is no. Short summary:


  • Facebook platform does not care about their developers community.
  • "Facebook API" is not backward compatible. They deprecate methods every week.
  • Facebook platform is overregulated and unfair to a "small guy".

At the end of the day they will eat their own lunch. It means that they will eventually start to loose money with bad advertising CPMs. Or they already started, didn't they? Thanks god, we (developers) have OpenSocial.

ASP.NET MVC Beta Released

by ScottGu at 15:30 PM, 10/16/2008

Today we released a beta of the new ASP.NET MVC framework.  Click here to download it.  You can also visit www.asp.net/mvc to explore tutorials, quickstarts, and videos to learn more.

The ASP.NET MVC Beta works with both .NET 3.5 and .NET 3.5 SP1, and supports both VS 2008 and Visual Web Developer 2008 Express SP1 (which is free - and now supports class libraries and web application project types).

Today's ASP.NET MVC Beta release comes with an explicit "go-live" license that allows you to deploy it in production environments.  The previous preview releases also allowed go-live deployments, but did so by not denying permission to deploy as opposed to explicitly granting it (which was a common source of confusion).  Today's release is clearer about this in the license.

The beta release is getting close to V1 feature complete, although there are still a few more features that will be added before the final "V1" release (including several VS tooling enhancements).  The team decided to call this release a "beta", though, because the quality and testing of it is higher than the previous previews (a lot of bug fixes and performance tuning work went into it), and they feel that the core features that are in it are now "baked enough" that there won't be major changes from this release to the final product.

This post contains a quick summary of some of the new features and changes in this build compared to the previous "Preview 5" release: 

I am also planning to publish a few end to end tutorials in the weeks ahead that explain ASP.NET MVC concepts in more depth for folks who have not looked at it before, and who want a "from the beginning" set of tutorials on how to get started.

New "Add View" Menu in Visual Studio

With previous ASP.NET MVC preview releases you had to manually add views through the Project->Add New Item dialog in VS, and creating and wiring up everything required several manual steps (making sure the directory/file structure is right, going into the code-behind file to specify the strongly typed ViewData model type, etc).

Today's beta makes the steps much easier.  You can now just move your source editor cursor to be within a Controller action method in the source editor, and then right-click and select a new "Add View" context menu item (alternatively you can type the Ctrl-M Ctrl-V keyboard shortcut to invoke this without having to take your hands off the keyboard):

This will bring up a new "Add View" dialog that allows you to specify the name of the view you want to create, its master page, and optionally its strongly typed ViewData "Model" type:

 

Visual Studio will automatically pre-populate the view name based on the action method your cursor is within (you can then override this if you want).  For example, if our cursor had been within an "Edit" action method when we selected "add view" it would have pre-populated the view name textbox with "Edit" instead of "Browse".

The strongly typed ViewData "model" for a view can be selected from an editable ComboBox that lists all classes in (or referenced) from the MVC project:

You can either select a type from the list, or manually type one in the ComboBox.  You can also optionally pick an initial type from the list and then tweak it.  For example, we could select the "Product" class from the list and then use the ComboBox editing support to wrap it as an IEnumerable<Product> - meaning a sequence of products:

When we click the "Add" button, Visual Studio will automatically create the appropriate view directory structure, and add a strongly typed view with the right name and base class to our project.  For example, if I followed the steps above it would create a new \Views\Products directory for me (since my controller class name is "ProductsController") and add the strongly-typed "Browse.aspx" view to it (which derives from ViewPage<IEnumerable<Product>> - since that was the model type we indicated in the dialog above):

The newly created view will automatically be opened for us in the IDE.  We can then implement our view with full intellisense (tip: make sure to do a build immediately after creating the view to ensure that intellisense shows up for your strongly typed model):

And at runtime we will now have an SEO optimized product browsing page built with ASP.NET MVC:

Note: The view file created by Add-View with this beta release is empty.  For the final release we are hoping to add some "scaffolding" features to the Add-View dialog that will allow you to optionally specify that you want to automatically create an HTML list/details view or edit/insert form based on the strongly-typed model specified in the add-view dialog (you can then start with this initial html view and tweak it however you want).  In the future we will also integrate ASP.NET Dynamic Data with MVC to support even richer scaffolding options.

New \Scripts directory and jQuery Support

The project template that ships with today's release now adds a new \Scripts directory underneath the project root.  This is now the recommended place to store JavaScript files in your application.

The ASP.NET MVC Beta now adds both ASP.NET AJAX and jQuery libraries to this folder:

The jQuery files are the standard jQuery libraries, and are licensed under the MIT source license (read my previous jQuery and Microsoft post for details).

With the SP1 updates of VS 2008 or Visual Web Developer 2008 Express, you will get basic JavaScript intellisense when using the above jQuery files.  We will be shipping a jQuery intellisense-annotation file in a few more weeks that provides much better and more complete jQuery intellisense support (including the ability to get intellisense when using multiple chained selectors/commands).  This will be included built-in with the next ASP.NET MVC update.

Form Post and Model Binder Improvements

One of the biggest areas of feature investment with the ASP.NET MVC "Preview 5" release was the work around form post scenarios.  I did an in-depth blog post about these form post scenario features last month.

Today's beta includes a number of additional tweaks, enhancements, and refinements in this area.  These include:

Built-in Model Binder support for Complex Types

Preview 5 introduced the concept of "model binders" - which allow you to map incoming form post values to complex .NET types passed as Controller action method parameters.  Model binders in preview 5 were extensible, and you could create custom binders and register them at multiple levels of the system.  Preview 5 didn't ship with any "pre-built" binders, though, that you could use out of the box (you instead had to build your own).  Today's beta now includes a built-in, pre-registered, binder that can be used to automatically handle standard .NET types - without requiring any additional code or registration. 

For example, we can now create a "Person" class like below with standard properties:

And then have a Controller action method take it as an parameter argument simply by writing the code below:

Because the argument parameter above is named "person", the model binder will by default look for form-post values whose key names are in the format "person.Name", "person.Age", "person.Email".  It will then use these values to create and populate a new "Person" object that is passed into our action method.

Developers can optionally override the default name mapping logic using a new [Bind] attribute introduced with today's beta - and by setting its "Prefix" property.  For example, if we set the prefix property to "PersonToSave", the binder would instead look for the following form values: "PersonToSave.Name", "PersonToSave.Age", and "PersonToSave.Email" when creating the person instance.  You can set the prefix to an empty string to have the binder map "Name", "Age" and "Email" with no prefix:

The [Bind] attribute allows you to optionally specify an "Included" or "Excluded" property - which can be used to either "whitelist" or "blacklist" properties from being mapped on the objects.  For example, the code below indicates that we want to map only the "Name" and "Age" properties on our person object:

Important safety tip: In general you want to be very careful to make sure you don't allow properties to be mapped that you don't want mapped.  Always use include/exclude anytime you have properties that you don't want to be mapped on an object.  For example: assuming there was a "Salary" property on our Person object - we would not want to map it unless we explicitly wanted an end-user to be able to set it.  You want to be explicit about not mapping unwanted properties like this to prevent a hacker from trying to fake out a form request and attempting to submit additional property information not editable in the UI.

Refactored Model Binder Infrastructure

The model binder system has been refactored significantly for the beta.  You can now re-use and plug-in functionality in a much more granular fashion when building your own custom model binders.

Model binders are also now used by the UpdateModel and TryUpdateModel methods - allowing you to write one binder and re-use it everywhere any form value is handled inside ASP.NET MVC.

Improved UpdateModel and TryUpdateModel methods

The UpdateModel and TryUpdateModel methods now support several new options and overloads (including richer whitelist and blacklist options). 

It also now optionally supports the ability to just call "UpdateModel" to populate an instance with the default binding rules (with preview 5 you always had to supply a whitelist - and several people asked for an option to just map all):

Another new feature in today's beta is the ability to define a strongly-typed whitelist filter that you use with UpdateModel/TryUpdateModel.  You can do this by defining an interface with the subset of bindable properties that you want to map.  For example, below I'm defining a "IPersonFormBindable" interface that only has three properties (and does not have the salary property):

We could then indicate that we want to use this contract to limit which properties are mapped using code like below:

This will ensure that only those properties defined on the IPersonFormBindable interface are mapped - and that the Salary one is not mapped.

Improved Unit Testing of UpdateModel and TryUpdateModel Scenarios

With Preview 5 you had to use mocking in order to unit test form post scenarios that used the UpdateModel or TryUpdateModel methods.  Today's beta now allows you to unit test all form post scenarios without ever requiring mocking (which enables better friction-free unit testing).

There is a new IValueProvider interface introduced with today's beta that the model binding infrastructure uses to retrieve values to bind (as opposed to always going against the request object).  The FormCollection class (which is built-into the beta) implements this interface - and you can now explicitly pass an instance of this to UpdateModel/TryUpdateModel to bind its values from. 

For example: below in the "Save" action method we are binding all incoming form values to a FormCollection (which will be passed in as an argument to the action method).  I can then pass this form collection to the UpdateModel call and have it map the values onto the person model object using this parameter: 

We could then unit test a successful form post scenario for the above action method using the code below (notice how we don't need to mock anything - instead we can just create a formcollection, populate it, and pass it as a parameter):

We could then unit test an unsuccessful form post (which fails because of invalid input for the age value) using the code below.  Notice how we are verifying that the edit form is redisplayed (so that users can correct their problem) in a form-post failure scenario:

We did not have to mock anything to unit test both of the above form submission scenarios.

Strongly Typed [AcceptVerbs] attribute

ASP.NET MVC Preview 5 introduced a new [AcceptVerbs] attribute that you could use to indicate which HTTP verbs an action method supported. 

In preview 5 you always specified verbs using strings.  We still support this with the beta, but have also added support for common verbs to be specified using a strongly-typed enum mask.  For example:

Today's beta release also no longer requires that you specify [AcceptVerbs] on both actions in scenarios like above.  By default ASP.NET MVC now looks for an action method that explicitly supports the incoming http verb - and if one is not found will use the action method that doesn't have an explicit verb specified.  This saves some typing for common GET/POST scenarios (you no longer need to decorate the GET method).

Validation Error Messages

One of the features that unfortunately did not make it into the beta (but which we will add for the next update) is support so that you can expose custom error validation messages from your model classes (as opposed to customizing them in the Controller like you can do today).  We are currently investigating a few ways to enable this - including adding support for the IDataErrorInfo interface, as well as support for the new Dynamic Data attributes in the System.ComponentModel.DataAnnotations namespace.

One improvement that did make it into today's beta, though, is that the default validation error messages are now more end-user friendly (which hopefully eliminates the need to define custom validation messages in a lot of cases):

HTML Helper Cleanup

Today's beta has some miscellaneous cleanup improvements to the HTML helpers (in general this is a tricky area - since there are so many overload combinations to get right). 

Html.Form -> Html.BeginForm

One of the usability changes made with today's beta was to rename Html.Form() to Html.BeginForm() and to support two modes of using it - one leveraging a using statement, and the other leveraging an explicit Html.EndForm() helper method.  The reason we've moved to support both of these approaches is that we've seen a lot of questions/confusion in the forums around how the using statement works for this scenario (the pattern is unfamiliar to a lot of developers). 

Below are two examples that demonstrate how we can implement the above create screen scenario (complete with validation error message UI) using the two different form approaches:

Approach 1: Using Statement with Html.BeginForm():

The below approach uses the IDisposable pattern with the using keyword in VB and C# to auto-terminate the </form>:

Approach 2: Explicit Html.BeginForm() and Html.EndForm():

The below approach uses an explicit EndForm() call to close the </form>:

Developers can use whichever they feel most comfortable with - both approaches logically do the exact same thing.

Many HTML Helper Methods Moved to be Extension Methods

One change we made with today's beta was to move many of the Html helper methods to be extension methods that live under the System.Web.Mvc.Html namespace (previously they were just instance methods on the HtmlHelper class).  We did a similar thing with the AJAX helper methods in "Preview 5" (they now live in the System.Web.Mvc.Ajax namespace). 

These changes don't impact intellisense in the view markup (we by default automatically reference the namespace in the web.config file so it works just like before - although if you are migrating an app from preview 5 you'll need to add the namespace yourself to web.config, read the release notes for steps on how to-do this).  If you have standalone classes/tests that use the helper methods make sure to add the appropriate "using" statement to import them.

The reason we moved the helper methods to be extension methods instead of instance methods was to provide developers with more flexibility to add/remove/replace our built-in implementations (as well as to give ourselves more flexibility in the future). If you want to override the HTML rendering of a method you can now easily do so - and still keep the same method code/signature in your markup.

Silverlight / ASP.NET MVC Project Integration

When you create a new Silverlight 2 project within Visual Studio or Visual Web Developer 2008 Express (using the recently released Silverlight 2 and VS 2008 Tools for Silverlight download), you now have the ability to select a ASP.NET Web Site, ASP.NET Web Application Project and now an ASP.NET MVC Project to host it within:

When you choose this option, Visual Studio will automatically copy and deploy/update the Silverlight application into the ASP.NET MVC application when you make a change and do a build within the IDE.  This makes it easier to start integrating a .NET based Silverlight front-end (running inside the browser) with an ASP.NET MVC web backend - and opens up some interesting new possibilities.

ASP.NET MVC Futures Assembly

For the last several preview releases, ASP.NET MVC features have been split across two assemblies - System.Web.Mvc.dll and Microsoft.Web.Mvc.dll.  The later assembly + namespace contains "futures" features that hadn't yet been committed to ship in the core V1 product.  As features become "committed" we move them from the futures assembly into the core assembly - and also change the namespace (from Microsoft.Web.Mvc to System.Web.Mvc). 

The previous preview releases automatically shipped and added the "futures" assembly when you did a File->New ASP.NET MVC project.  Starting with today's beta we are no longer automatically adding this assembly - instead you need to explicitly add it from your project if you want to use it.  The reason for this is so that developers can clearly distinguish those features that will be in the fully supported V1 product (which implies product support and a higher commitment around backwards compatibility), and those that might still evolve in the future (and not be added to the supported product until vnext).

Important: the futures assembly (along with all the source code in it) will continue to ship and will work with ASP.NET MVC V1.  So if there is a feature in it you really like, you do not have to worry about it disappearing on you (it is still there and you can still use it).  You just now need to explicitly reference the assembly and use it in your project. 

We plan to ship a version of the ASP.NET MVC Futures assembly that works with the Beta later today.  You will be able to download it here.

\Bin and GAC Deployment

The ASP.NET MVC beta now supports both GAC based deployment (where you install the assembly once for the machine) as well as local \bin based deployment (where you store a copy of the assembly in the application directory). 

We will use the GAC to enable automatic-servicing updates via Windows Update (where an administrator can automatically patch a machine - like they do with the rest of the .NET Framework today, and not have to update each individual application).  One downside with GAC based deployment, though, is that it can make deploying applications that require a GAC component harder for hosted scenarios - since you typically do not have admin access on the server machine (and you need admin rights to install components in the GAC).

To make sure hosted scenarios work well (and to ensure that you don't need your hoster to install anything other that ASP.NET 3.5 in order for ASP.NET MVC to work), we will also support the ability to deploy the ASP.NET MVC framework assemblies in the \bin directory of your application.  This will allow you to just xcopy/ftp the application onto the server and have it work (no admin access or setup needs to be run on it).  The one caveat with this is that you'll be responsible for updating the assembly anytime a servicing update comes out - Windows Update can't automatically find all the application directories on a machine to-do this for you.

Summary

Today's beta release is a step closer to the final ASP.NET MVC 1.0 product.  While not 100% feature complete, we think the major subsystems are all getting really close to being done, and that the quality level is now pretty good.

I am going to try and post some more end-to-end tutorials in the coming weeks that show off how to use ASP.NET MVC from the beginning, and then logically progress to richer and richer scenarios.  Included in the list of tutorials will be my infamous AJAX with MVC post that I keep promising to write - but so far haven't (my excuse: the Silverlight 2, ASP.NET MVC, .NET 4.0, VS10, and Windows 7 ship cycles are all happening in parallel on my team - and I've unfortunately been really busy which is the reason for the delay).

As I always like to make sure I point out: If you don't like the MVC model or don't find it natural to your style of development, you definitely don't have to use it.  It is a totally optional offering - and does not replace the existing WebForms model.  Both WebForms and MVC will be fully supported and enhanced going forward (ASP.NET WebForms in .NET 4.0 will add richer URL routing features, better HTML css markup support, complete control over the ClientId property, more AJAX features, and more that I'll be blogging about soon).  So if you don't like the MVC option, don't worry, and don't feel like you should or need to use it (you don't). 

Hope this helps,

Scott

Silverlight 2 Released

by ScottGu at 03:07 AM, 10/14/2008

Today we shipped the final release of Silverlight 2.  You can download Silverlight 2, as well the Visual Studio 2008 and Expression Blend 2 tool support to target it, here.

Cross Platform / Cross Browser .NET Development

Silverlight 2 is a cross-platform browser plugin that enables rich media experiences and .NET RIAs (Rich Internet Applications) within the browser.

Silverlight 2 is small in size (4.6MB) and takes only 4-10 seconds to install on a machine that doesn't already have it.  It does not require the .NET Framework to be installed on a computer to run - the Silverlight setup download includes everything necessary to play video or run applications.

Developers can write Silverlight applications using any .NET language (including VB, C#, JavaScript, IronPython and IronRuby).  Silverlight provides a rich set of features for development including:

  • WPF UI Framework: Silverlight 2 includes a rich UI framework that makes building rich Web applications much easier.  In includes a powerful graphics and animation engine, as well as rich support for higher-level UI capabilities like controls, layout management, data-binding, styles, and template skinning.  The WPF UI Framework in Silverlight is a compatible subset of the WPF UI Framework features in the full .NET Framework, and enables developers to re-use skills, controls, code and content to build both rich cross browser web applications, as well as rich desktop Windows applications.
  • Rich Controls: Silverlight 2 includes a rich set of built-in controls that developers and designers can use to quickly build applications.  The Silverlight 2 release includes core form controls (TextBox, CheckBox, RadioButton, ComboBox, etc), built-in layout management panels (StackPanel, Grid, Panel, etc), common functionality controls (Slider, ScrollViewer, Calendar, DatePicker, etc), and data manipulation controls (DataGrid, ListBox, etc).  All Silverlight controls support a rich control templating model, which enables developers and designers to collaborate together to build highly polished solutions.
  • Rich Networking Support: Silverlight 2 includes rich networking support.  It includes out of the box support for calling REST, WS*/SOAP, POX, RSS, and standard HTTP services.  It supports cross domain network access (enabling Silverlight clients to directly access resources and data from resources on the web).  It also includes built-in sockets networking support.

  • Rich Base Class Library: Silverlight 2 includes a rich .NET base class library of functionality (collections, IO, generics, threading, globalization, XML, local storage, etc).  It includes rich APIs that enable HTML DOM/JavaScript integration with .NET code.  It includes LINQ and LINQ to XML library support (enabling easy transformation and querying of data), as well as local data caching and storage support.  The .NET APIs in Silverlight are a compatible subset of the full .NET Framework.
  • Rich Media Support: Silverlight 2 includes built-in video codecs for playing high definition video, as well as for streaming it over the web (including both live and on-demand support).  Silverlight includes support for adaptively switching video bitrates on the fly based on network conditions (enabling users to avoid seeing the dreaded "buffering..." message), placing and metering ads within video streams, as well as enabling content protection. 

The final Silverlight 2 release delivers a tremendous amount of power and flexibility that enables you to really push the boundaries of what can be done in a browser, and enable great end user experiences.

Silverlight Customers

Over the last few months a number of very high profile sites have successfully launched using the beta releases of Silverlight 2. 

In August, NBC hosted the Olympics live on nbcolympics.com and served up 1.3 billion page views, 70 million video streams, and 600 million minutes of video content - making it the largest ever media event on the web.  Users visiting the site spent an average of 27 minutes on the site when they watched a video - an unprecedented number for online traffic.

In August, the Democratic National Convention was streamed live using Silverlight, and broadcast a 2Mbit live video feed of the event and speeches - receiving outstanding feedback from audiences watching it.

This month a number of other high profile sites are going live with the final release of Silverlight 2.  CBS College Sports Network will be streaming 20,000 hours of live games for 150+ college and university partners.  AOL is launching their new AOL Mail browser version to 60 million users using Silverlight 2.  Blockbuster will be launching their new MovieLink subscription service using Silverlight.  Yahoo! Japan is live today enabling live streaming of Major League Baseball games.  Hard Rock International will be updating their memorabilia site with new features.  And companies like Toyota, HSN and hundreds of others will be live this week as well.

Silverlight Toolkit

Silverlight 2 ships with dozens of built-in UI controls that can be used to build applications.  Below is a screen-shot of the Silverlight DataGrid, RadioButton, CheckBox and DatePicker controls in the final release:


Today we are also announcing the "Silverlight Toolkit" - which will deliver dozens of more controls that you can use with Silverlight 2.  We will continually add new controls to the control pack over the next few months (we expect to ultimately have more than 100 controls total).  The first release of the toolkit will include controls like TreeView, DockPanel, WrapPanel, ViewBox, Expander, NumericUpDown, AutoComplete and more.  All controls will ship with full source, and with a OSI license that allows you to modify and use the source for any purpose.

Interoperability

Today we are also announcing that Microsoft is partnering with Soyatec to sponsor additional tools for developing Silverlight applications using the cross platform Eclipse development platform.  Click here to learn more about this and download the free Silverlight Eclipse plugin.  Click here for a step-by-step tutorial that walks-through how to use their Eclipse tools today to build a Silverlight 2 application. 

We are also announcing today that we are releasing the Silverlight XAML vocabulary and schema under the Open Specification Promise (OSP), which enables anyone to create products that read and write XAML for Silverlight.  You can learn more about this announcement here.

Learning Silverlight 2

The best way to learn Silverlight 2 is to visit the www.silverlight.net web-site.  You can find free online tutorials, videos and training available there.  The site also hosts an online forum system where MVPs and Microsoft Silverlight team members will be able to help answer technical questions.  Also make sure to subscribe to the Silverlight Community RSS Feed, Jesse Liberty's Blog, and Tim Heuer's Blog for a daily dose of great Silverlight content.

I've recently updated my Digg-client tutorial for the final Silverlight 2 release.  This provides an end to end walkthrough of a Silverlight 2 application, and helps explain the different programming concepts behind it (controls, layout management, networking, data-binding, styles, user controls, control templates, etc).  If you are brand new to Silverlight or WPF development I recommend walking through it to understand the basics:

You can develop Silverlight 2 applications using any version of Visual Studio 2008.  Simply install the Silverlight Tools for Visual Studio 2008 download to get Silverlight tooling support within it.

If you do not have VS 2008, you can alternatively install the free Visual Web Developer 2008 Express SP1 Edition.  This free tool provides great ASP.NET development tool support, and starting today also now supports Silverlight 2 development.  You can follow all of the steps in my tutorial above using the Visual Web Developer 2008 Express Edition - and get full intellisense, debugging, and deployment support.

Upgrading from the Beta

If you have the Beta2 or RC versions of the VS Tools for Silverlight, or the Silverlight 2 Beta SDK or Developer Editions of Silverlight 2, please make sure to uninstall these completely before downloading and installing today's release.

End users who have Silverlight 1, or Silverlight 2 Beta1 or Beta2 will be automatically upgraded to the final Silverlight 2 release starting later this month.  Until then, if they visit a Silverlight 2 (final release) site, they will see the standard install prompt that a machine that does not have Silverlight installed would see.  Clicking it will upgrade their machines to the final release of Silverlight 2 (there is no need for them to uninstall anything - Silverlight 2 will cleanly install over Silverlight 1 or the previous betas). 

Because there are some breaking changes between Silverlight 2 Beta2 and the final Silverlight 2 release, end users who have the final Silverlight 2 release installed will not be able to run applications that are still targeting Silverlight Beta2.  Most major Silverlight 2 sites plan to upgrade to the final release in the next 24 hours (which will fix this issue) - if you hit a site built with Beta2 before then you might experience trouble with it.  That should go away within about a day once all sites are updated though (this was one reason why we released the public release candidate last month - to help developers get their sites ready for the final release).

Summary

Silverlight 2 is a major release that enables some great new application and media experiences to be built, and allows developers to use .NET within any browser to create them.

Thank you for all your support and feedback the last year as we've worked on it.  All of us on the Silverlight team are really excited to see what you build with it. :-)

Scott

Project Pitchfork — Timekiller

by Anatoly Lubarsky at 18:28 PM, 10/10/2008

Welcome again on Saturday music :)


Today's clip Timekiller by Project Pitchfork from 2001. Project Pitchfork is a german band. Timekiller sounds more like a club-style music I think.



Enjoy

Top 3 Things Myspace Platform Has to Implement for Developers

by Anatoly Lubarsky at 16:50 PM, 10/10/2008

I think that Myspace development platform is much more developer friendly than that of Facebook these days. Mostly because:


  • Myspace developers participate in developer forums and are responsive. They answer questions and provide feedback to developers.
  • Myspace application gallery is of better quality due to relatively tough approval process (for example you need to approve each application change).
  • Myspace has more advertising friendly audience and as a result - better advertisers (and higher CPM).

There are still several obvious basic features Myspace platform should provide for developers. I think that top 3 of these features are:


  • New section in application gallery sorted by daily active users. Currently there is one section sorted by total installs which doesn't change much — first-movers large apps stay on top. Another section is called "Recently Popular" which means popular among recently submitted apps. Therefore good and popular applications are mostly invisible in the application gallery. Alphabetical section is useless obviously.
  • Revision of approval policy and process. There are several items in the policy which just don't make sense. One example - all canvas external links should open a new window. I don't mention the fact that all modern browsers support tab-browsing. Myspace folks responsible for approval click each and every ad placed on the canvas page which may cause problems to the publisher, not to mention that many ad platforms just open the ad in the same window.
  • Better support for iframes - we need support for numerous Myspace extensions to open social (like "invite friends" and "postto") available for external iframes.

October 10th Links: ASP.NET, ASP.NET AJAX, jQuery, IIS

by ScottGu at 01:53 AM, 10/10/2008

Here is the latest in my link-listing series.  Also check out my ASP.NET Tips, Tricks and Tutorials page and Silverlight Tutorials page for links to popular articles I've done myself in the past.

ASP.NET

  • ASP.NET Dynamic Data Videos using VB: Bill Burrows has put together an awesome series of videos that show off how to use the new ASP.NET Dynamic Data support provided in .NET 3.5 SP1.  You can find more links to ASP.NET Dynamic Data tutorials in my last link post here.

  • Routing with WebForms: Wally McClure has a nice podcast that describes how to use the new ASP.NET routing infrastructure in .NET 3.5 SP1 with Web Forms based pages.  A lot of people mistakenly think this feature only works with ASP.NET MVC applications - when in reality it also works with web forms pages (in fact all ASP.NET Dynamic Data sites use it).

ASP.NET AJAX and jQuery

  • An Introduction to jQuery (Part 1): Rick Strahl has posted an excellent article that introduces jQuery, and walks-through how to take advantage of it within ASP.NET pages.

  • New AJAX Support for Data-Driven Web Apps: Bertrand Le Roy has written a great MSDN article that describes some of the new ASP.NET AJAX features available in preview form today.  Also check out his blog posts here and here to learn more about how the new client-side data templating feature support.

  • ASP.NET AJAX: Enabling Bookmarking and the Browser's Back Button: Scott Mitchell continues his excellent series on ASP.NET AJAX and discusses how to add history points to an AJAX-enabled web page so that visitors can bookmark it, as well as to enable back/forward browser navigation.  This is a new feature added to ASP.NET in .NET 3.5 SP1.

Microsoft Web Platform

Hope this helps,

Scott

Saturday Music — Ice Ages — This Killing Emptiness

by Anatoly Lubarsky at 18:02 PM, 10/03/2008

Welcome again on Saturday music :) Sorry about missing 2 previous saturdays to post music on my blog - this is because I had been in Thailand and mostly offline.


Today's clip style I can categorize as industrial neofolk (or something like this :)). Ice Ages — This Killing Emptiness from 2000. Ice Ages is a sole creation of Richard Lederer.



Enjoy

Here is the latest in my link-listing series.  Also check out my ASP.NET Tips, Tricks and Tutorials page and Silverlight Tutorials page for links to popular articles I've done myself in the past.

ASP.NET

  • Amazon EC2 Support for Windows and ASP.NET: Big news announced this week: Amazon will be offering Windows Server 2008 as an option in their EC2 service.  This enables you to use ASP.NET, IIS7 and SQL Server in the cloud.

  • Using ASP.NET WebForms, MVC and Dynamic Data in a Single Application: Scott Hanselman has a nice post that demonstrates how you can have a single ASP.NET application that uses ASP.NET WebForms, MVC, WebServices and Dynamic Data.  You have the flexibility to mix and match them however you want, which allows you to always use the right tool depending on the specific job.

  • Unlocking and Approving User Accounts: Scott Mitchell posts another in his great series of articles on ASP.NET security (click here for all the articles in the series).  This article talks about how you can setup administration pages that allow admins to lock out and approve user accounts using the ASP.NET Membership system.

ASP.NET MVC

  • MVC Membership with Preview 5: Troy Goode posts an update of his popular MVC Membership template that works with ASP.NET MVC Preview 5.  It provides a set of administration pages you can use for user/role management, as well as adds support for OpenID and Windows LiveID.

  • MVC Flickr Xplorer: Mehfuz Hossain has a cool ASP.NET MVC sample application posted that enables a nice picture explorer for FlickR photos.

ASP.NET Dynamic Data

  • Simple 5 Table Northwind Example: Matt Berseth kicks off his ASP.NET Dynamic Data tutorial series with a nice post that shows how to build a simple 5 table application using ASP.NET Dynamic Data with .NET 3.5 SP1.

Hope this helps,

Scott

jQuery and Microsoft

by ScottGu at 11:32 AM, 09/28/2008

jQuery is a lightweight open source JavaScript library (only 15kb in size) that in a relatively short span of time has become one of the most popular libraries on the web.

A big part of the appeal of jQuery is that it allows you to elegantly (and efficiently) find and manipulate HTML elements with minimum lines of code.  jQuery supports this via a nice "selector" API that allows developers to query for HTML elements, and then apply "commands" to them.  One of the characteristics of jQuery commands is that they can be "chained" together - so that the result of one command can feed into another.  jQuery also includes a built-in set of animation APIs that can be used as commands.  The combination allows you to do some really cool things with only a few keystrokes.

For example, the below JavaScript uses jQuery to find all <div> elements within a page that have a CSS class of "product", and then animate them to slowly disappear:

As another example, the JavaScript below uses jQuery to find a specific <table> on the page with an id of "datagrid1", then retrieves every other <tr> row within the datagrid, and sets those <tr> elements to have a CSS class of "even" - which could be used to alternate the background color of each row:

[Note: both of these samples were adapted from code snippets in the excellent jQuery in Action book]

Providing the ability to perform selection and animation operations like above is something that a lot of developers have asked us to add to ASP.NET AJAX, and this support was something we listed as a proposed feature in the ASP.NET AJAX Roadmap we published a few months ago.  As the team started to investigate building it, though, they quickly realized that the jQuery support for these scenarios is already excellent, and that there is a huge ecosystem and community built up around it already.  The jQuery library also works well on the same page with ASP.NET AJAX and the ASP.NET AJAX Control Toolkit.

Rather than duplicate functionality, we thought, wouldn't it be great to just use jQuery as-is, and add it as a standard, supported, library in VS/ASP.NET, and then focus our energy building new features that took advantage of it?  We sent mail the jQuery team to gauge their interest in this, and quickly heard back that they thought that it sounded like an interesting idea too.

Supporting jQuery

I'm excited today to announce that Microsoft will be shipping jQuery with Visual Studio going forward.  We will distribute the jQuery JavaScript library as-is, and will not be forking or changing the source from the main jQuery branch.  The files will continue to use and ship under the existing jQuery MIT license.

We will also distribute intellisense-annotated versions that provide great Visual Studio intellisense and help-integration at design-time.  For example:

and with a chained command:

The jQuery intellisense annotation support will be available as a free web-download in a few weeks (and will work great with VS 2008 SP1 and the free Visual Web Developer 2008 Express SP1).  The new ASP.NET MVC download will also distribute it, and add the jQuery library by default to all new projects.

We will also extend Microsoft product support to jQuery beginning later this year, which will enable developers and enterprises to call and open jQuery support cases 24x7 with Microsoft PSS.

Going forward we'll use jQuery as one of the libraries used to implement higher-level controls in the ASP.NET AJAX Control Toolkit, as well as to implement new Ajax server-side helper methods for ASP.NET MVC.  New features we add to ASP.NET AJAX (like the new client template support) will be designed to integrate nicely with jQuery as well. 

We also plan to contribute tests, bug fixes, and patches back to the jQuery open source project.  These will all go through the standard jQuery patch review process.

Summary

We are really excited to be able to partner with the jQuery team on this.  jQuery is a fantastic library, and something we think can really benefit ASP.NET and ASP.NET AJAX developers.  We are looking forward to having it work great with Visual Studio and ASP.NET, and to help bring it to an even larger set of developers.

For more details on today's announcement, please check out John Resig's post on the jQuery team blog.  Scott Hanselman is also about to post a nice tutorial that shows off integrating jQuery with ASP.NET AJAX (including the new client templating engine) as well as ADO.NET Data Services (which shipped in .NET 3.5 SP1 and was previously code-named "Astoria").

Hope this helps,

Scott

Silverlight 2 Release Candidate Now Available

by ScottGu at 21:54 PM, 09/25/2008

This evening we published the first public release candidate of Silverlight 2.

There are still a small handful of bugs fixes that we plan to make before we finally ship.  We are releasing today's build, though, so that developers can start to update their existing Silverlight Beta2 applications so that they'll work the day the final release ships, as well as to enable developers to report any last minute showstopper issues that we haven't found internally (please report any of these on the www.silverlight.net forums).

Important: We are releasing only the Silverlight Developer Runtime edition (as well as the VS and Blend tools to support it) today, and are not releasing the regular end-user edition of Silverlight.  This is because we want to give existing developers a short amount of time to update their applications to work with the final Silverlight 2 APIs before sites are allowed to go live with it.  There are some breaking changes between Beta2 and this RC, and we want to make sure that existing sites can update to the final release quickly once the final release is out.  As such, you can only use the RC for development right now - you can't go live with the new APIs until the final release is shipped (which will be soon though).

You can download today's Silverlight Release Candidate and accompanying VS and Blend support for it here.  Note that Expression Blend support for Silverlight 2 is now provided using Blend 2.0 SP1.  You will need to install Blend 2.0 before applying the SP1 service pack that adds Silverlight 2 support.  If you don't already have Blend 2.0 installed you can download a free trial of it here.

Beta2->RC API Updates

Today's release candidate includes a ton of bug fix and some significant performance optimization work.

Today's release candidate also includes a number of final API tweaks designed to fix differences between Silverlight and the full .NET Framework.  Most of these changes are relatively small (order of parameters, renames of methods/properties, movement of types across namespaces, etc) although there are a number of them.  You can read this blog post and download this document to get a listing of the known API breaking changes made from the Beta2 release. 

We have updated the styles of the controls shipped with Silverlight, and have also modified some of the state groups and control template names they use.  When upgrading from Beta2 you might find it useful to temporarily remove any custom style templates you've defined, and get your application functionality working using the RC first - and then after that works add back in the styles one style definition at a time to catch any rename/behavior change issues with them.

If you find yourself stuck with an question/issue moving from Beta2 to the RC, please report it on the www.silverlight.net forums (Silverlight team members will be on there helping folks).  If after a day or two you aren't getting an answer please send me email (scottgu@microsoft.com) and I can help or connect you with someone who knows the answer.

New Controls

Today's release candidate includes a bunch of feature additions and tweaks across Silverlight 2, as well as in the VS and Blend tools targeting it. In general you'll find a number of nice improvements across the controls, networking, data caching, layout, rendering, media stack, and other components and sub-systems.

Over the next few months we will be releasing a lot of new Silverlight 2 controls (more details on these soon).  Today's release candidate includes three new core controls - ComboBox, ProgressBar, and PasswordBox - that we are adding directly to the core Silverlight runtime download (which is still only 4.6MB in size, and only takes a few seconds to install):

At runtime these controls by default look like:

The ComboBox in Silverlight 2 supports standard DropDownList semantics.  In addition to statically defining items like above, you can also use databinding with it.  For example, we could d