Microsoft Ajax CDN and the jQuery Validation Library

Scott Guthrie announced the launch of the Microsoft Ajax CDN on his blog last night. If you have not read his post, I recommend that you read it now to get a general overview of the CDN and how you can take advantage of the CDN to improve the performance of your ASP.NET Web Forms and ASP.NET MVC applications:

http://weblogs.asp.net/scottgu/archive/2009/09/15/announcing-the-microsoft-ajax-cdn.aspx

“The Microsoft Ajax CDN enables you to significantly improve the performance of ASP.NET Web Forms and ASP.NET MVC applications that use ASP.NET AJAX or jQuery.  The service is available for free, does not require any registration, and can be used for both commercial and non-commercial purposes.

ASP.NET 4.0 will make it especially easy for ASP.NET Web Forms developers to take advantage of the CDN. By setting one property of the ScriptManager control – EnableCdn=true, you will be able to redirect all requests for the built-in ASP.NET JavaScript files to the CDN and improve the performance of your Web Forms applications.”

In his announcement, Scott describes how both the ASP.NET Ajax and the jQuery libraries are included in the CDN. There is one more set of JavaScript files that are added to the CDN today that Scott did not announce: the jQuery Validation library.

If you are not familiar with the jQuery Validation library then you should know that this is one of the most popular form validation libraries used by jQuery developers. Microsoft is shipping the jQuery validation library with both ASP.NET Web Forms and ASP.NET MVC in Visual Studio 2010.  Furthermore, jQuery Validation library will be integrated with ASP.NET MVC.

Via Microsoft Ajax CDN and the jQuery Validation Library

Developer’s Guide – Google AJAX Language API – Google Code

 

With the AJAX Language API, you can translate and detect the language of blocks of text within a webpage using only Javascript.

The “Hello, World” of the Google AJAX Language API

The easiest way to start learning about this API is to see a simple example. The following example will detect the language of the given text and then translate it to English.

<html>
  <head>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">

    google.load("language", "1");

    function initialize() {
      var text = document.getElementById("text").innerHTML;
      google.language.detect(text, function(result) {
        if (!result.error && result.language) {
          google.language.translate(text, result.language, "en",
                                    function(result) {
            var translated = document.getElementById("translation");
            if (result.translation) {
              translated.innerHTML = result.translation;
            }
          });
        }
      });
    }
    google.setOnLoadCallback(initialize);

    </script>
  </head>
  <body>
    <div id="text">你好,很高興見到你。</div>
    <div id="translation"></div>
  </body>
</html>

You can view this example here to edit and play around with it.

Via Developer’s Guide – Google AJAX Language API – Google Code

Server Authentication on Desktop Application using Client Application Services

Client application services (.NET 3.5) make it easy for you to create Windows-based applications that use the ASP.NET AJAX login, roles, and profile application services included in the Microsoft ASP.NET 2.0 AJAX Extensions. These services enable multiple Web and Windows-based applications to share user information and user-management functionality from a single server. For example, you can use these services to perform the following tasks:

  • Authenticate a user. You can use the authentication service to verify a user’s identity.

  • Determine the role or roles of an authenticated user. You can use the roles service to change the user interface of your application depending on the user’s role. For example, you can provide additional features for users who are in an administrator role.

  • Store and access per-user application settings located on the server. You can use the Web settings service (also known as the profile service) to share settings across multiple applications and locations.

Client application services take advantage of the Web services extensibility model through client service providers that you can specify in your application configuration files. These service providers include offline functionality that uses a local cache for authentication, roles, and settings data when a network connection is unavailable.

Sample: Using WCF, ASP.NET Client application services to authenticate a user on a desktop windows application.

image

Matt Berseth: Creating an Outlook Navigation Bar using the ListView and Accordion AjaxControlToolkit Control

 

image

The left pane contains a 2 level hierarchy of categories and subcategories.  As the user selects different subcategories the designer wants the right pane’s content to be updated with the corresponding information.  Just like Outlook, the designer wants the subcategories to be displayed within expanding and collapsing panels. Accordion AjaxControlToolkit.

The Accordion is not the only toolkit control that allows you to provide multiple panes of content and display them one at a time, the Tab control does this as well.  The trick is deciding what control better meets your requirements.

Live Demo (IE6, IE7 and FF) | Download (.Net 3.5 and Toolkit Version 3.5.11119.0)

Via Matt Berseth: Creating an Outlook Navigation Bar using the ListView and Accordion Controls

Creating JSON-enabled WCF services in .NET 3.5

 

Updated: A even simpler approach by the author. WCF 3.5 supports an even simpler model for building script services than the approach I outlined – by setting Factory=”System.ServiceModel.Activation.WebScriptServiceHostFactory” in your .svc file, you can completely remove all configuration file settings. In fact, you can reduce the entire service to a single file if you like by embedding the service class directly in the .svc file

 

Just over a year ago, I wrote an article for MSDN Magazine detailing how to make client-side web service calls with the ASP.NET Ajax extensions to .asmx web services. While most of the contents of that article still apply today to .NET 3.5 and Visual Studio 2008, there is a fundamental shift going on away from .asmx and towards .svc (WCF) for web services, so I thought it would be timely to post an update to that article to describe how to use WCF for your script-callable web services in .NET 3.5.

My goal with this post is to provide very specific and easy to follow instructions on how to create script enabled WCF services with the final release of Visual Studio 2008 and .NET 3.5.

The simplest way to create an Ajax-enabled WCF endpoint is to use the new Visual Studio 2008 Ajax-enabled WCF Service item template. You can also script-enable an existing WCF service, but to keep this streamlined, we’ll start with this template.

image

 

Via Creating JSON-enabled WCF services in .NET 3.5

Introducing Video.Show: A Silverlight Reference-quality Sample

 

image Video.Show is an end-to-end solution that provides a reference-quality sample for user-generated video content sites. Taking advantage of all of our latest technologies: .NET Framework 3.5, ASP.NET AJAX, LINQ, Silverlight, Expression Encoder and Silverlight Streaming, Video.Show provides support for uploading, encoding, tagging, viewing and commenting on videos.  Here’s a short feature list:

  • Video wall for browsing videos. Hover the mouse over any individual video to see an instant thumbnail preview.
  • Time marker-based comment system. Pause the video at an interesting moment and add your comment, and it will appear as that frame is displayed on playback.
  • Site membership using ASP.NET. Sign in and create a custom profile; favorite, tag and upload videos.
  • First-time experience for a user without Silverlight installed demonstrates best practices for detection and installation.
  • Web services for retrieving video catalogs, tagging and favorites.
  • Background batch processing task that handles the encoding of videos using Expression Encoder and uploads to Silverlight Streaming.

Download Video.Show here from CodePlex.

Also take a look at  Family.Show

Via Introducing Video.Show: A Silverlight Reference-quality Sample