Dec 5th Links: ASP.NET, ASP.NET MVC, jQuery, Silverlight, Visual Studio

Here is the latest in my link-listing series.  Also check out my VS 2010 and .NET 4 series for another on-going blog series I’m working on.

[In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu]

ASP.NET

  • ASP.NET Code Samples Collection: J.D. Meier has a great post that provides a detailed round-up of ASP.NET code samples and tutorials from a wide variety of sources.  Lots of useful pointers.

  • Slash your ASP.NET compile/load time without any hard work: Nice article that details a bunch of optimizations you can make to speed up ASP.NET project load and compile times. You might also want to read my previous blog post on this topic here.

  • 10 Essential Tools for Building ASP.NET Websites: Great article by Stephen Walther on 10 great (and free) tools that enable you to more easily build great ASP.NET Websites.  Highly recommended reading.

  • Optimize Images using the ASP.NET Sprite and Image Optimization Framework: A nice article by 4GuysFromRolla that discusses how to use the open-source ASP.NET Sprite and Image Optimization Framework (one of the tools recommended by Stephen in the previous article).  You can use this to significantly improve the load-time of your pages on the client.

  • Formatting Dates, Times and Numbers in ASP.NET: Scott Mitchell has a great article that discusses formatting dates, times and numbers in ASP.NET.  A very useful link to bookmark.  Also check out James Michael’s DateTime is Packed with Goodies blog post for other DateTime tips.

  • Examining ASP.NET’s Membership, Roles and Profile APIs (Part 18): Everything you could possibly want to known about ASP.NET’s built-in Membership, Roles and Profile APIs must surely be in this tutorial series. Part 18 covers how to store additional user info with Membership.

ASP.NET with jQuery

  • An Introduction to jQuery Templates: Stephen Walther has written an outstanding introduction and tutorial on the new jQuery Template plugin that the ASP.NET team has contributed to the jQuery project.

  • Composition with jQuery Templates and jQuery Templates, Composite Rendering, and Remote Loading: Dave Ward has written two nice posts that talk about composition scenarios with jQuery Templates and some cool scenarios you can enable with them.

  • Using jQuery and ASP.NET to Build a News Ticker: Scott Mitchell has a nice tutorial that demonstrates how to build a dynamically updated “news ticker” style UI with ASP.NET and jQuery.

  • Checking All Checkboxes in a GridView using jQuery: Scott Mitchell has a nice post that covers how to use jQuery to enable a checkbox within a GridView’s header to automatically check/uncheck all checkboxes contained within rows of it.

ASP.NET MVC

  • ASP.NET MVC Diagnostics Using NuGet: Phil Haack has a nice post that demonstrates how to easily install a diagnostics page (using NuGet) that can help identify and diagnose common configuration issues within your apps.

  • ASP.NET MVC 3 JsonValueProviderFactory: James Hughes has a nice post that discusses how to take advantage of the new JsonValueProviderFactory support built into ASP.NET MVC 3.  This makes it easy to post JSON payloads to MVC action methods.

  • Practical jQuery Mobile with ASP.NET MVC: James Hughes has another nice post that discusses how to use the new jQuery Mobile library with ASP.NET MVC to build great mobile web applications.

  • Credit Card Validator for ASP.NET MVC 3: Benjii Me has a nice post that demonstrates how to build a [CreditCard] validator attribute that can be used to easily validate credit card numbers are in the correct format with ASP.NET MVC.

Silverlight

  • Silverlight FireStarter Keynote and Sessions: A great blog post from John Papa that contains pointers and descriptions of all the great Silverlight content we published last week at the Silverlight FireStarter.  You can watch all of the talks online.  More details on my keynote and Silverlight 5 announcements can be found here.

  • 31 Days of Windows Phone 7: 31 great tutorials on how to build Windows Phone 7 applications (using Silverlight). 

  • Silverlight for Windows Phone Toolkit Update: David Anson has a nice post that discusses some of the additional controls provided with the Silverlight for Windows Phone Toolkit.

Visual Studio

  • JavaScript Editor Extensions: A nice (and free) Visual Studio plugin built by the web tools team that significantly improves the JavaScript intellisense support within Visual Studio.

  • HTML5 Intellisense for Visual Studio: Gil has a blog post that discusses a new extension my team has posted to the Visual Studio Extension Gallery that adds HTML5 schema support to Visual Studio 2008 and 2010.

  • Visual Studio 2010 Emacs Emulation Extension and VIM Emulation Extension: Check out these two extensions if you are fond of Emacs and VIM key bindings and want to enable them within Visual Studio 2010.

Hope this helps,

Scott

Error with One-Way WSDL Operations and BizTalk Receive Locations

Error with One-Way WSDL Operations and BizTalk Receive Locations

Do you ever do WSDL-first web service development? Regardless of the reason that you do this (e.g. you’re an architectural-purist, your mother didn’t hold you enough), this style of service design typically works fine with BizTalk Server solutions. However, if you decide to build a one-way input service, you’ll encounter an annoying, but understandable error. […]

StreamInsight: Reading from other data contexts into StreamInsight with LINQPad

The LINQPad driver for StreamInsight provides an awesomely easy way to run StreamInsight queries using easily accessible data contexts of temporal streams.  However, as LINQPad only supports a single active data context connection in a query it can be difficult to use one of the hard to read “without a data context” sources (such as OData) and use StreamInsight.

As LINQPad does enable execution of generic .NET code, we can use a little trick to get around the single-connection context limitation simply placing the embedded server creation code (i.e. Server.Create()) directly into a LINQPad query statement (regardless of the active context).

Step 1: Reading an OData Service in LINQPad

We’ll start off by importing the Northwind data set as an OData service, then converting the Orders table into a CepStream.  For more background on how to work with the new (as of 1.1) IEnumerable/IObservable adapters for StreamInsight refer to Colin Meek’s excellent StreamInsight Sequence Integration: Five Easy Pieces post.

  • Start a copy of LINQPad with the StreamInsight driver installed.  Refer to the StreamInsight LINQPad Driver post if you haven’t yet done this.
  • From the data context list, click on Add Connection.  From the Choose Data Context dialog, select WCF Data Services (OData) and click Next.

The Northwind OData context is now available for use in LINQPad.  One question that might immediately crop up is why didn’t I use the StreamInsight database context instead of the OData context?  LINQPad, unfortunately, doesn’t yet support multiple database contexts in a single query.  With the need to pull data from one context (LINQ to OData) and process it in another (StreamInsight), and the LINQ to OData context being rather challenging to create on the fly, we’ll use the Northwind as our primary context, and dynamically generate a StreamInsight embedded server.

  • The Northwind data context should now be available in the list of connections.  From the query pane, select C# Statement(s) as the language, and the Northwind URI as the database.  We use C# Statement instead of C# Expression to let us build up more complicated objects and code (such as the StreamInsight embedded server object).
  • Let’s run a simple query to make sure that the data feed is flowing through appropriately.  Type the code in the block below into the query window and press F5 to execute the query.
  1. // Retrieve orders from the Northwind OData feed that
  2. // have valid shipping dates and order dates.  Select
  3. // fields to be used in the StreamInsight query (basic
  4. // types only)
  5. var orders = from o in Orders
  6.                 where o.ShippedDate != null && o.OrderDate != null
  7.                 orderby o.OrderDate ascending
  8.                 select new
  9.                 {
  10.                     CustomerName = o.Customer.CompanyName,
  11.                     OrderDate = (DateTime)o.OrderDate,
  12.                     ShippedDate = (DateTime)o.ShippedDate,
  13.                     Region = o.ShipRegion
  14.                 };
  15.  
  16. orders.Dump();
  • The results should be similar to those shown in the screenshot below.  Once you’ve validated that the OData feed is being consumed properly, delete the orders.Dump() call.
IOrderedQueryable<> (200 items)
CustomerName OrderDate ShippedDate Region
Vins et alcools Chevalier 7/4/1996 0:00 7/16/1996 0:00 null
Toms Spezialitäten 7/5/1996 0:00 7/10/1996 0:00 null
Hanari Carnes 7/8/1996 0:00 7/12/1996 0:00 RJ
Victuailles en stock 7/8/1996 0:00 7/15/1996 0:00 null
Suprêmes délices 7/9/1996 0:00 7/11/1996 0:00 null
Hanari Carnes 7/10/1996 0:00 7/16/1996 0:00 RJ
Chop-suey Chinese 7/11/1996 0:00 7/23/1996 0:00 null
Richter Supermarkt 7/12/1996 0:00 7/15/1996 0:00 null
Wellington Importadora 7/15/1996 0:00 7/17/1996 0:00 SP
HILARION-Abastos 7/16/1996 0:00 7/22/1996 0:00 Táchira

 

Step 2: Creating a StreamInsight host and a basic query

Now that we have the OData feed available in LINQPad, let’s go ahead and set things up to allow us to create and execute StreamInsight queries without a data context (a data context or data connection makes this a lot easier – but since we also need the Northwind OData context, one of these has to be manually defined).

  • In LINQPad, click on the Query menu item, then on Query Properties (or press F4).
  • In the Query Properties dialog, add the following references to the Additional References list, as per the screenshot below.
    • Microsoft.ComplexProcessing.dll
    • Microsoft.ComplexProcessing.Observable.dll
  • Click on the Additional Namespace Imports tab, and add the following namespaces as per the screenshot below.
    • Microsoft.ComplexEventProcessing
    • Microsoft.ComplexEventProcessing.Linq
  • Since this won’t be the only time (I hope ) that we use this technique, go ahead and click on the Set as default for new queries button, click OK to acknowledge the popup, then click OK to close the Query Properties dialog.
  • Now we can go ahead and define an embedded StreamInsight server to process our queries, by pasting the code below into the LINQPad query window.
  1. using (Server server = Server.Create(“Default”))
  2. {
  3.     Application app = server.CreateApplication(“test”);
  4.    
  5.    
  6. }
  • Using the techniques described in Colin’s excellent post on using Sequences with StreamInsight v1.1, let’s convert the set of orders into a temporal stream.  The code below demonstrates how to obtain a CepStream<> of intervals from the enumerable set of orders.
  1. // Convert the set of orders into an interval stream
  2. var orderStream = orders.ToIntervalStream(app, t =>
  3.     IntervalEvent.CreateInsert((DateTimeOffset)t.OrderDate, (DateTimeOffset)t.ShippedDate, t),
  4.     AdvanceTimeSettings.IncreasingStartTime);
  • Now we’re ready to write our basic query.  Let’s look for the condition wherein we have more than one outstanding order in a region (i.e. if the order date and ship dates overlap).
  1. // Group the order stream by region, and create
  2. // snapshot windows to look at the sets of overlapping
  3. // orders.  Count the number of orders.   
  4. var regionCounts = from o in orderStream
  5.                    group o by o.Region into regionGroups
  6.                    from win in regionGroups.SnapshotWindow(SnapshotWindowOutputPolicy.Clip)
  7.                    select new { ShipRegion = regionGroups.Key, Count = win.Count() };
  8.  
  9. // Look for regions which have more than 1 overlapping
  10. // order
  11. var filter = from e in regionCounts
  12.              where e.Count > 2
  13.              select e;
  14.  
  15. // Dump the results of the query out into an enumerable
  16. var snk = from i in filter.ToIntervalEnumerable()
  17.           where i.EventKind == EventKind.Insert
  18.           select new { i.StartTime, i.EndTime, i.Payload.ShipRegion, i.Payload.Count };
  19. snk.Dump();
  • Let’s run the query (by pressing F5) and observe the results.
IEnumerable<> (130 items)
StartTime EndTime ShipRegion Count
7/8/1996 7:00:00 AM +00:00 7/9/1996 7:00:00 AM +00:00 null 3
7/9/1996 7:00:00 AM +00:00 7/10/1996 7:00:00 AM +00:00 null 4
7/10/1996 7:00:00 AM +00:00 7/11/1996 7:00:00 AM +00:00 null 3
7/11/1996 7:00:00 AM +00:00 7/12/1996 7:00:00 AM +00:00 null 3
7/12/1996 7:00:00 AM +00:00 7/15/1996 7:00:00 AM +00:00 null 4

Interesting result combining LINQPad exploration of a LINQ to WCF OData and StreamInsight – but what went into producing that result? Which collection of events resulted in that output event?  Answering that question will be my next post on using the Event Flow Debugger with LINQPad and StreamInsight

  1. // Retrieve orders from the Northwind OData feed that
  2. // have valid shipping dates and order dates.  Select
  3. // fields to be used in the StreamInsight query (basic
  4. // types only)
  5. var orders = from o in Orders
  6. where o.ShippedDate != null && o.OrderDate != null
  7. orderby o.OrderDate ascending
  8. select new
  9. {
  10.     CustomerName = o.Customer.CompanyName,
  11.     OrderDate = (DateTime)o.OrderDate,
  12.     ShippedDate = (DateTime)o.ShippedDate,
  13.     Region = o.ShipRegion
  14. };
  15.  
  16. using (Server server = Server.Create(“Default”))
  17. {
  18.     Application app = server.CreateApplication(“test”);
  19.  
  20.     // Convert the set of orders into an interval stream
  21.     var orderStream = orders.ToIntervalStream(app, t =>
  22.       IntervalEvent.CreateInsert((DateTimeOffset)t.OrderDate, (DateTimeOffset)t.ShippedDate, t),
  23.       AdvanceTimeSettings.IncreasingStartTime);
  24.    
  25.     // Group the order stream by region, and create
  26.     // snapshot windows to look at the sets of overlapping
  27.     // orders.  Count the number of orders.   
  28.     var regionCounts = from o in orderStream
  29.         group o by o.Region into regionGroups
  30.         from win in regionGroups.SnapshotWindow(SnapshotWindowOutputPolicy.Clip)
  31.         select new { ShipRegion = regionGroups.Key, Count = win.Count() };
  32.  
  33.     // Look for regions which have more than 1 overlapping
  34.     // order
  35.     var filter = from e in regionCounts
  36.         where e.Count > 2
  37.         select e;
  38.  
  39.     // Dump the results of the query out into an enumerable
  40.     var snk = from i in filter.ToIntervalEnumerable()
  41.           where i.EventKind == EventKind.Insert
  42.           select new { i.StartTime, i.EndTime, i.Payload.ShipRegion, i.Payload.Count };
  43.     snk.Dump();
  44. }

Installing the Designer Extensibility Sample: Issues I came across

While working on this sample, I came across the following errors:

  1. I needed to change the version of .NET from 3.5 to 4.0 in the properties of the project.
  2. I got the following error when I compiled the error: The type ‘Microsoft.VisualStudio.Modeling.ModelElement’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘Microsoft.VisualStudio.Modeling.Sdk.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. C:\Projects\Microsoft.Practices.ESB\Source\Samples\Designer Extensibility Samples\Extenders.Itinerary.OrchestrationSample\Extenders.Itinerary.OrchestrationSample\OrchestrationSampleExtender.cs
  3. This made me install the following components:
  4. Visual Studio 2010 SDK
    Visual Studio 2010 Visualization and Modeling SDK
  5. This then required me to reference the following assembly in the project: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Modeling.Sdk.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Modeling.Sdk.10.0.dll
  6. Once I built the two projects, in the directions (step 7) it states: In Windows Explorer, open the \Lib folder under the Itinerary Designer install path. This actual path is: C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit 2.1\Tools\Itinerary Designer\Lib\

ESB Toolkit 2.1 Samples

Is anyone else wondering?

  1. If the ESB Toolkit 2.1 is designed for BizTalk 2010, why are all of the sample projects still compiled in Visual Studio 2008?
  2. Why the projects are still referring to the old .Net version (which is incorrect in this project)?

    which by changing the .Net version changes the references:

Does anyone have an idea?

(Could it be that you can use the ESB Toolkit 2.1 with BizTalk 2009?)

BizTalk on Windows 2007 Issues

Issues Installating BizTalk on Windoes 2007

If you get the following error: Installing BizTalk on the Windows 7 platform,

[5:02:36 PM Info SSOServerCfg] (ssoconfigobj2.cpp:5125) Returning error description: <Exception Message=”Failed to connect to the SQL database ‘SSODB’ on SQL Server ”.” Source=”SSO” HelpID=””><Exception Message=”(0x80131700)” Source=”Win32″ HelpID=””/></Exception>

1. You can use the cmd prompt or the visual studio command prompt
2. For command prompt use the following
3.Using Command prompt
a. C:\Program Files\Common Files\Enterprise Single Sign-On>C:\WINDOWS\Microsoft.NET \Framework\v2.0.50727\RegAsm.exe ssosql.dll
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.4927
Types registered successfully
4. Using VS.NET
a. C:\Program Files\Common Files\Enterprise Single Sign-On> regasm ssosql.dll

If the above approach still does not resolve the issue then follow either of these steps

1. Enable TCP/IP and Named Pipes?
2. Check the account has proper rights with in the SQL Server

Announcing Silverlight 5

Today at the Silverlight FireStarter event we unveiled the next release of Silverlight. 


Silverlight 5 adds significant new features and capabilities, and enables developers to create premium media experiences and deliver rich applications across browsers, desktops and devices.  In my keynote this morning we demonstrated a number of them, and highlighted both the developer productivity Silverlight 5 provides and the great new user experiences it enables.  You can watch my keynote here.


A Silverlight 5 beta will be available in the first half of next year, and the final release will ship in the second half of 2011.



Premium Media Experiences


We are seeing great adoption of Silverlight for premium media solutions. In the last few months we’ve seen companies like Canal+, TV2, and Maximum TV launch both live and on-demand Silverlight solutions.

Silverlight 5 will enable media experiences to go even further by adding:



  • Hardware video decode: Silverlight 5 now supports GPU accelerated video decode, which significantly reduces CPU load for HD video.  Using Silverlight 5, even low powered Netbooks will be able to play back 1080p HD content


  • Trickplay: Silverlight 5 now enables variable speed playback of media content on the client with automatic audio pitch correction. This is great for training videos where you want to speed up the trainer while still understanding what he’s saying


  • Improved power awareness will prevent screensavers from kicking in while you’re watching movies while allowing the computer to sleep when video is not playing.


  • Remote-control support is now built-into Silverlight 5 – allowing users to control media playback with remote control devices.



Application Development


Silverlight provides a rich application development environment that enables you to build great web delivered applications. 


Silverlight 5 delivers significant improvements for application development including:




  • Databinding and MVVM: Silverlight 5 delivers significant data-binding improvements that improve developer productivity and provide better Silverlight/WPF feature convergence.  Developers can now debug data-binding expressions, set breakpoints on bindings, and more easily determine errors.  Implicit DataTemplates now allow templates to be created across an application to support a particular type by default.  Ancestor RelativeSource bindings makes it easier for a DataTemplate to bind to a property on a container control. Binding in style setters allows bindings to be used within styles to reference other properties.  And a new DataContextChanged event is being introduced to make handling changes easier. Markup extensions are also now support and allow code to be run at XAML parse time for both properties and event handlers, enabling cutting-edge MVVM support.


  • WCF and RIA Services: Silverlight 5 now includes WS-Trust support.  WCF RIA Services improvements include complex type support, better MVVM support, and improved customization of code generation.  Silverlight 5’s networking stack also now supports low-latency network scenarios that enable more responsive application scenarios.


  • Text and Printing: Silverlight 5 delivers improved text clarity that enables crisper and cleaner text rendering, multi-column text flow and linked text containers, character and leading support, and full OpenType font support.  Silverlight 5 also includes a new Postscript Vector Printing API that provides programmatic control over what you print, and enables printing richer reports and documents.  Pivot functionality – which enables developers to build amazing information visualization experiences – will also be provided built-into the Silverlight 5 SDK.


  • Graphics: Silverlight 5 includes immediate mode graphics support that enables developers to take full advantage of the GPU (graphics processing unit) and enables accelerated 3-D graphics support.  This new support facilitates much richer data visualization scenarios (make sure to watch the keynote to see some really eye-popping ones). 


  • Out of Browser: Silverlight 5 builds on the out-of-browser capabilities we introduced with Silverlight 5.  Out of browser applications can now create and manage child windows.  Trusted out of browser applications can now also use P/Invoke capabilities to call unmanaged libraries and Win32 APIs.  Enhanced group policy support enables enterprises to both lock down and open up security sandbox capabilities of Silverlight 5 applications.


  • Testing Tools: We are adding automated UI testing support for Silverlight applications with Visual Studio 2010.  This makes it easy to test Silverlight applications, and automate the functionality of them.


  • Performance: Silverlight 5 support faster application startup, and provides 64-bit browser support.  Silverlight 5 also integrates with the new Hardware Acceleration capabilities of IE9, and enables hardware acceleration in windowsless mode.  


Summary

We are really excited about the great new capabilities that Silverlight 5 will deliver, and look forward to getting your feedback.  My keynote is available to watch online here if you want to see the new release in action and more information can be found on the Silverlight Website.
 
Hope this helps,


Scott