Tuesday, 16 October 2012

Kinect

Win-Joe has been somewhat remiss in not covering, at least in passing, Microsoft's Kinect technology (where "YOU are the Controller"). The Kinect is an attachment for the Xbox 360 that combines a depth camera (sometimes know "in the trade" as RGB-D), standard RGB camera, motorized tilt and four microphones. MSDN Magazine has a good introduction to Kinect programming.

The October 2012 SDK exposes the infrared stream, allowing image capture in low-light situations. However, it is currently not possible to capture infrared and colour streams simultaneously.The Accelerometer Data APIs now provide information on the sensor's orientation. Desktop robotics - Aloha!

Microsoft UI Automation

This comes bundled with .NET Framework 3.0 as part of WPF. This is covered in the following MSDN magazine article. WPF made its debut in .NET Framework 3.0. Instead of using the GDI as previous libraries did, WPF employed DirectX. The relevant DLL is UIAutomationProvider.

Monday, 8 October 2012

C# Semiotics

We talk about the "lexical structure" of a programming language as if programmers are specialists in linguistics. This is not necessarily the case. Lexical analysis informally relates to "parts of speech", or more generally, parts of sentences. In this case, we are analysing "sentences" in the C# programming language.

Taking a "lexical view" of C# is an interesting exercise and helps to explain programming to semiotics majors, for example.

Take the simple assignment: double pi = 3.14159;

Analysing this lexically we can say:

1. double is an "abstract noun". An abstract noun refers to a concept or idea. In this case, the idea is of a 64-bit floating point value.

2. pi is a "proper noun". A proper noun can refer to a place, object or name of a person. In the above case, it is the name we have given to a specific realisation of the concept, double.

3. the value 3.14159 is a "concrete noun" that refers to the physical object.

The acronym to remember this language of nouns is APC (Abstract, Proper, Concrete).

Language also has the concept of collective nouns. A List of doubles is one example; similar to a gaggle of geese or a flight of swallows or even "a troop of kangaroos".

C# Lexical Structure: Keywords vs Contextual Keywords

How do you extend a language without changing its keywords? Contextual keywords go some way to providing an answer.

An example keyword in C# is "double". Double is a simple type that can store 64-bit floating point values. A contextual keyword only has meaning within a specific context e.g. get/set within a property declaration.

The ascending contextual keyword is used in LINQ queries and only has meaning in LINQ context, for example:

IEnumerable<string> sortAscendingQuery = from elephant in zoo orderby elephant ascending select elephant.

There is no specific word for non-contextual keywords. One might call them, "context-independent" keywords.

Saturday, 29 September 2012

Nuget

NuGet is a Visual Studio extension to make it easy for you to find and install third-party libraries and tools. As of September-end 2012, NuGet has had 25 million downloads. Amongst the packages available on NuGet, there is Json.NET, a high performance Json framework for .NET.

Wednesday, 26 September 2012

PFX (Parallel Extensions) built on System.Threading.Tasks

What is PFX? (I heard about it on Channel 9).

PFX stands for Parallel Extensions for the .NET framework (released in .NET 4.0) and is something of increasing importance, judging from the multiple references to PFX on channel9.msdn.com. This post will be a primer to PFX - getting you up-to-speed with the basic terminology and concepts.

Who developed PFX?

Both Microsoft Research and the CLR team were involved in the development of PFX.

Two Parts to PFX and their Relationship

First is Parallel LINQ (PLINQ) and second is Task Parallel Library (TPL). PLINQ uses TPL for execution. The other technical term is CDS which stands for coordination data structures - used to synchronise and co-ordinate execution of concurrent tasks.

Example

using System.Threading.Tasks;
Parallel.ForEach(myListOfStrings, s => Console.WriteLine(s));

Data Structures for Parallel Programming

More can be found here. Ex: System.Collections.Concurrent.ConcurrrentDictionary<Key,Value>

IE9 heralds HTML5 Video Support

HTML5 defines a new element (<video>) specifying a standard way to embed video in a web page (supported in IE9, Chrome, Safari, Firefox).  Supported video formats are:
* MP4 - MPEG4 files (H264 video codec, AAC audio codec
* WebM - WebM files (VP8 video codec, Vorbis audio codec
* Ogg - Ogg files (Theora video codec, Vorbis audio codec)