Vincent Leung .NET Tech Clips

The latest tech clips from the .NET community

Knockout 2.0.0 released

image

Knockout is an MVVM library for JavaScript – it makes rich dynamic web UIs easier and cleaner to build. The best place to start learning is with the interactive tutorials.

January 3, 2012 Posted by | JavaScript, Knockout | Leave a Comment

Building Offline Experiences with HTML5 AppCache and IndexedDB

imageUsers expect their Web sites and apps to work well even when the network isn’t available. With data increasingly stored in the cloud, developers want to enable fluid experiences that allow access to data when there is no connectivity; when devices are disconnected from the network or when they encounter dead spots in coverage.

In this post, we show how to create well-behaved offline sites and apps using the following HTML5 features:

  • AppCache to store file resources locally and access them offline as URLs
  • IndexedDB to store structured data locally so you can access and query it
  • DOM Storage to store small amounts of text information locally
  • Offline events to detect if you’re connected to the network

For more goto –> http://blogs.msdn.com/b/ie/archive/2011/09/27/building-offline-experiences-with-html5-appcache-and-indexeddb.aspx

Also, BUILD presentation Building offline access in Metro style apps and Web sites using HTML5

December 1, 2011 Posted by | HTML5, Metro Style | Leave a Comment

Html JavaScript Development using MVVM

Shawn Wildermuth talks about using KnockoutJS framework to develop a MVVM application:

KnockoutJS is a framework that allows me to use HTML-based data binding markup to describe my UI, CSS to describe what the design looks like and JavaScript to tie the data to the data binding. The is chiefly accomplished through the concept of observable objects. For example, I created a new JavaScript ‘class’ called gameModel in my view.js by creating members using the observable method on the knockout (e.g. ko) object:

// view.js
$(document).ready(function () {

  function gameModel() {
    this.name = ko.observable();
    this.id = ko.observable();
    this.genre = ko.observable(); this.releaseDate = ko.observable();
    this.price = ko.observable();
    this.imageUrl = ko.observable();
  };
  …
});

 
The observable call returns an object that not only can store a property, but let the KnockoutJS binding stack know when the property changes (two way binding). In order to use the gameModel ‘class’, I created a view model to store a collection of gameModels like so:
 
// Define Main ViewModel
var theViewModel = {
  games: ko.observableArray([]),
  ...
};

The games property of the view models ‘class’ will hold the current list of games that are shown in the UI. The observableArray object is like the observable object but it notifies the data binding stack when a collection changes. The goal here is to have the view model load the games from the REST service and as the collection changes, the HTML should change to react to that. No more manually creating/destroying parts of the markup.

In order to make this work, we must use the data binding syntax in the HTML code:

<div data-bind="foreach: games">
  <div class="game-block">
    <div>
      <img data-bind="attr: { src: imageUrl, alt: name }" /></div>
    <div class="game-name" data-bind="text: name">
    </div>
  </div>
</div>

For more: http://wildermuth.com/2011/11/20/Using_MVVM_on_the_Web_with_KnockoutJS

December 1, 2011 Posted by | HTML5, JavaScript, Knockout, MVVM | Leave a Comment

Silverlight Async Programming – Best Practices

Silverlight client runtime does not allow synchronous operations and requires network-based operations to be asynchronous. While asynchronous and event-based programming models have been a part of the .NET Framework since the earliest versions, orchestrating sequential and parallel asynchronous workflows can be problematic.

November 17, 2011 Posted by | Uncategorized | Leave a Comment

Kinect for Windows SDK Beta

image

The Kinect for Windows SDK beta includes drivers, rich APIs for raw sensor streams and human motion tracking, installation documents, and resource materials. It provides Kinect capabilities to developers who build applications with C++, C#, or Visual Basic by using Microsoft Visual Studio 2010.

This SDK includes the following features:

  • Raw sensor streams
    Access to raw data streams from the depth sensor, color camera sensor, and four-element microphone array enables developers to build upon the low-level streams that are generated by the Kinect sensor.

  • Skeletal tracking
    The capability to track the skeleton image of one or two people moving within the Kinect field of view make it easy to create gesture-driven applications.

  • Advanced audio capabilities
    Audio processing capabilities include sophisticated acoustic noise suppression and echo cancellation, beam formation to identify the current sound source, and integration with the Windows speech recognition API.

  • Sample code and documentation
    The SDK includes more than 100 pages of technical documentation. In addition to built-in help files, the documentation includes detailed walkthroughs for most samples provided with the SDK.

  • Easy installation
    The SDK installs quickly, requires no complex configuration, and the complete installer size is less than 100 MB. Developers can get up and running in just a few minutes with a standard standalone Kinect sensor unit (widely available at retail outlets).

Home page here.

The SDK is documented and code walkthroughs are provided here. Enjoy!

July 5, 2011 Posted by | Kinect | Leave a Comment

Developer’s Guide to Microsoft Prism 4.0

The documentation for Prism 4 has been completely rewritten and includes the architectural overview, design, and technical concepts for composite applications, applied patterns, two chapters covering Model-View-ViewModel (MVVM), application navigation, Stock Trader Reference Implementation (Stock Trader RI) and MVVM Reference Implementation (MVVM RI) overview, QuickStart overviews, and deployment topics. Much of this guidance is applicable even if you are not using the Prism Library, but you want to know best practices for creating composite applications

Prism 4.0 – November 2010

The guide contains the following topics:

More:

Class Library References:

Desktop Class Library

Phone Class Library

Silverlight Class Library

March 30, 2011 Posted by | Design, MVVM, Prism, Silverlight | Leave a Comment

MVVM-Friendly DomainDataSource: DomainCollectionView

Yes, that’s right… we now have a component that is a big step toward addressing the request for an MVVM-Friendly DomainDataSource.  As of this posting, that feature was the #2 requested item on the RIA Services wish list, and we’ve been pondering its design for a long time.  Kyle McClellan has delivered on this and he is posting details to his blog.  This feature is completely separate from the DomainDataSource, and it’s built from the ground up with ViewModel usage in mind.

Here are some specific links from Kyle’s blog:

Here are the links you need to get up and running:

    Install WCF RIA Services SP1 for Silverlight 4

March 30, 2011 Posted by | MVVM, RIA Services, Silverlight | Leave a Comment

Native Extensions COM automation Library for Microsoft Silverlight

image

While Silverlight 4 supports accessing COM automation components from elevated trust OOB applications, many Windows platform features are currently not available through COM automation. This makes them inaccessible to such Silverlight OOB apps. Native Extensions for Microsoft Silverlight(NESL) is an effort to incrementally build a library of components that expose select Windows 7 features through COM automation, making them easily available to Silverlight 4 OOB applications running with elevated trust. The current version of NESL provides access to Windows 7 features like Sensors, Portable Devices, Speech, Taskbar and more. NESL is made up of a set of COM automation based runtime libraries, Silverlight wrapper libraries usable from Silverlight 4 OOB applications, sample applications with source, API documentation, and a developer’s guide.

A NESL is a set of libraries for Silverlight developers that allow them to access some really cool features of Windows 7 from their Silverlight applications.

  • Take advantage of sensors like accelerometers, light sensors, compasses, GPS etc.
  • Access content from connected portable devices like music players and digital cameras.
  • Capture and create video from webcams and screen output
  • Use speech recognition and text to speech capabilities.
  • Integrate with the Windows 7 taskbar (Jump Lists, Icon Overlays, Taskbar Progress etc.)

Head over to http://code.msdn.microsoft.com/nesl to start developing with it.

December 17, 2010 Posted by | Silverlight, Windows 7 | 1 Comment

How to set up an Authenticated Web Service for Windows Phone

image

Setting up an authenticated web service is recommended, as communication occurs over an HTTPS interface for better security. Authenticated web services do not have a daily limit on the number of push notifications they can send. Unauthenticated web services, on the other hand, are throttled at a rate of 500 push notifications per subscription per day. Additionally, authenticated web services are able to register a callback request, as described in How to: Set up a Callback Registration Request for Windows Phone. more here.

 

Learn more about Push Notification:


December 17, 2010 Posted by | Phone, WCF | Leave a Comment

Using the ASP.NET Membership Provider and Authentication Service from Windows Phone 7

image

Those of you who have been building ASP.NET applications for a while now are no doubt familiar with the provider model, which includes provider abstractions for membership (authentication), roles (authorization), profiles (user data), and session state. These providers make it incredibly easy to provide a secure framework for your application. In fact, with an ASP.NET application template right out of the box, you can have a fully functioning authenticated, secure website in minutes.

What a lot of people have less familiarity with is the notion of provider services. You can actually create a WCF service head that sits on top of the ASP.NET membership system. This allows client applications (WP7) to authenticate against your ASP.NET website using exactly the same authentication scheme that your users use. This means that a user who has access to your website should also be able to have access to the client application seamlessly.

If you already have an ASP.NET application that is using the membership provider, role provider, and profile provider you can quickly, easily, and securely expose services to a mobile (WP7) client that allow that client to have secured, remote access to services exposed by that site. In short, any user of your existing web application can use their existing credentials to log in from their WP7 device and access any services you decide to make available.

ASP.NET provider services, coupled with WP7 and the fact that Silverlight has access to WCF client proxy generation, means you can very easily prep your site for a rich WP7 experience.

To read more…

December 17, 2010 Posted by | ASP.NET, Phone, Security | Leave a Comment

Follow

Get every new post delivered to your Inbox.

Join 68 other followers