Vincent Leung .NET Tech Clips

The latest tech clips from the .NET community

.less – The dynamic stylesheet language for .NET

image

Write regular CSS with your .NET apps, then add a few variables, mixins and nested rules.

.less is a .NET port of the funky LESS JavaScript library

 

1. Install:  PM> Install-Package dotless

2. From Command Line: dotless.Compiler my_style.less my_style.css  more here

3. Reference

4. Function Reference

5. Post Build:

       $(SolutionDir)packages\dotless.x.x.x.x\tool\dotless.Compiler.exe 
                 $(ProjectDir)content\less\*.less.css $(ProjectDir)content\

 

Download: http://www.dotlesscss.org/

Source: github

May 16, 2012 Posted by | CSS | Leave a Comment

Find In Database Objects

It searches the text of triggers, UDFs, stored procedures and views for a particular substring, 
returning the name and type of those database objects that match. 
DECLARE @Search varchar(255)
SET @Search='[10.10.100.50]'

SELECT DISTINCT
    o.name AS Object_Name,o.type_desc
    FROM sys.sql_modules        m
        INNER JOIN sys.objects  o ON m.object_id=o.object_id
    WHERE m.definition Like '%'+@Search+'%'
    ORDER BY 2,1

April 20, 2012 Posted by | Database | Leave a Comment

Getting Started with ASP.NET Web API

ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.

image

http://www.asp.net/web-api

March 29, 2012 Posted by | ASP.NET, WebAPI | Leave a Comment

Auto Bundling and Minifying the .css .js files

image

image

The new bundling/minification feature now allows you to instead bundle and minify all of the .css files in the Styles folder – simply by sending a URL request to the folder (in this case “styles”) with an appended “/css” path after it.

This will cause ASP.NET to scan the directory, bundle and minify the .css files within it, and send back a single HTTP response with all of the CSS content to the browser.

A 90 seconds Video.

March 29, 2012 Posted by | ASP.NET | Leave a Comment

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

Follow

Get every new post delivered to your Inbox.