About I know the answer (it's 42)

I am a developer at Microsoft and work in the .NET Common Language Runtime (CLR) team. For the last 4 years I have been working on virtual machine technologies on a variety of form factors including desktops (Windows, Linux), tablets (Win8), gaming-consoles (Xbox 360), mobile devices (Windows Phone 7, Windows CE, Symbian).

I have worked on various core pieces of the runtime including Garbage Collector, memory manager, platform abstraction layer, runtime-performance, etc.

Before working on .NET I worked on Visual Studio Team Foundation Server, Visual Studio Team System, Adobe Framemaker, Adobe Acrobat, Texas Instrument's Code Composer Studio.

September, 2008

I had posted about tail call and how .NET handles it before. However there was some email exchanges and confusion on internal DLs around it and so I thought I'd try to elaborate more on how .NET goes about handling tail calls

I'm trying to learn WPF and IMO it is not a simple task. Previously whenever I upgraded my UI technology knowledge it had been easy as it build on a lot of pre-existing concepts. However, WPF is more of a disruptive change.

I decided to write some simple fun application in the effort to learn WPF. Since I cannot write a BabySmash application as Scott Hanselman has already done a awesome job out of it, I decided to code up a simulation of A* path finding algorithm and push it out as a screen saver. The final product looks as follows.

What it does is that it shows a source, a destination with blockages (wall, mountain?) in between and then uses A* algorithm to find a path in between them. This is the same kind of algorithm that is used in say games like Age of the Empires as workers move around collecting wood and other resources. The algorithm is documented here.

Features

It supports plugging in your own scenes with help of the awesome screen/board designer I blogged about

Comes with a WPF and a console client to show the animation

Algorithm can be played with easily to change or tweak it.

Shows full animation including start, end, obstacle, closed cells, current path being probed and the final path

Multi-screen support. Each screen shows a different board being solved.

Limitations:

Obviously this was more of a quick dirty hobby project and there remains a ton to work on. E.g.

Screen saver preview doesn't work.

Setting dialog is a sham.

The boards do not flip for vertically aligned screens

The XAML data binding is primitive and needs some work

The path can choose diagonally across cell even if it seems to cross over diagonal wall of obstacle.

Mouse move alone doesn't shut down the screen saver. You need to hit a

Many more :)

Download:

Download the final binaries from here. Unzip to a folder, right click on the *.scr and choose Install

Can you guess how many managed Type gets loaded to run this? I was doing some profiling the .NET Compact Framework loader (for entirely unrelated reason) and was surprised by the list that got dumped. 87 177 types**, never could've guessed that...

System.Object

System.ValueType

System.Enum

System.Void

System.Boolean

System.Char

System.SByte

System.Byte

System.Int16

System.UInt16

System.Int32

System.UInt32

System.Int64

System.UInt64

System.Single

System.Double

System.String

System.Type

System.Reflection.MemberInfo

System.RuntimeType

System.Array

System.IntPtr

System.UIntPtr

System.Text.StringBuilder

System.Delegate

System.MulticastDelegate

System.DateTime

System.Exception

System.MarshalByRefObject

System.AppDomain

System.__ComObject

System.Decimal

System.SZArrayHelper

System.Collections.IEnumerable

System.Collections.IEnumerator

System.Nullable`1

System.SystemException

System.Security.VerificationException

System.Runtime.InteropServices.CurrencyWrapper

System.Runtime.InteropServices.UnknownWrapper

System.Runtime.InteropServices.DispatchWrapper

System.Runtime.InteropServices.ErrorWrapper

System.Runtime.InteropServices.CustomMarshalerHelper

System.Attribute

System.Runtime.InteropServices.InterfaceTypeAttribute

System.Runtime.InteropServices.GuidAttribute

System.Runtime.InteropServices.ComVisibleAttribute

System.Runtime.InteropServices.ComEventInterfaceAttribute

System.Runtime.InteropServices.ComSourceInterfacesAttribute

System.Runtime.InteropServices.LCIDConversionAttribute

System.Runtime.InteropServices.ComDefaultInterfaceAttribute

System.Runtime.InteropServices.DispIdAttribute

System.CorPubObject

System.Char[]

System.Collections.Hashtable

System.Reflection.BindingFlags

System.Reflection.MemberFilter

System.Reflection.Binder

System.Type[]

System.Reflection.TypeAttributes

System.Void*

System.Int32[]

System.IntPtr[]

System.Collections.IDictionary

System.UnhandledExceptionEventHandler

System.AppDomainManager

System.Version

System.Runtime.InteropServices.ComInterfaceType

System.Collections.ICollection

System.Collections.IEqualityComparer

System.AppDomainManagerInitializationOptions

System.ArithmeticException

System.ArgumentException

System.MissingMemberException

System.MemberAccessException

System.AppDomainSetup

System.Runtime.InteropServices.Marshal

System.PInvoke.EE

System.Reflection.AssemblyName

System.Byte[]

System.Globalization.CultureInfo

System.Reflection.Assembly

System.Configuration.Assemblies.AssemblyHashAlgorithm

System.Configuration.Assemblies.AssemblyVersionCompatibility

System.Reflection.AssemblyNameFlags

System.Globalization.CultureTableRecord

System.Globalization.CompareInfo

System.Globalization.TextInfo

System.Globalization.NumberFormatInfo

System.Globalization.DateTimeFormatInfo

System.Globalization.Calendar

System.Globalization.BaseInfoTable

System.Globalization.CultureTable

System.Globalization.CultureTableData

System.Globalization.CultureTableData*

System.UInt16*

System.Globalization.NumberStyles

System.Globalization.DateTimeStyles

System.String[]

System.Globalization.DateTimeFormatFlags

System.Globalization.TokenHashValue

System.Globalization.TokenHashValue[]

System.Byte*

System.Globalization.CultureTableHeader

System.Globalization.CultureTableHeader*

System.Globalization.CultureNameOffsetItem

System.Globalization.CultureNameOffsetItem*

System.Globalization.RegionNameOffsetItem

System.Globalization.RegionNameOffsetItem*

System.Globalization.IDOffsetItem

System.Globalization.IDOffsetItem*

System.TokenType

System.Int32&

System.IO.TextReader

System.IO.TextWriter

System.IFormatProvider

System.Console

System.Char&

System.Char*

System.ArgumentNullException

System.PInvoke.NSLIntl

System.ArgumentOutOfRangeException

System.RuntimeTypeHandle

System.NotSupportedException

System.PlatformNotSupportedException

System.String&

System.TypeLoadException

System.Globalization.EndianessHeader

System.Globalization.EndianessHeader*

System.Globalization.GlobalizationAssembly

System.BCLDebug

System.PInvoke.TableData

System.InvalidProgramException

System.Collections.HashHelpers

System.Globalization.CultureTableItem

System.UInt32&

System.Security.CodeAccessSecurityEngine

System.LocalDataStoreMgr

System.Threading.ExecutionContext

System.LocalDataStore

System.Collections.ArrayList

System.Threading.SynchronizationContext

System.Runtime.Remoting.Messaging.LogicalCallContext

System.Runtime.Remoting.Messaging.IllogicalCallContext

System.Threading.Thread

System.Object[]

System.Collections.Generic.Dictionary`2

System.Runtime.Remoting.Messaging.CallContextRemotingData

System.Runtime.Remoting.Messaging.CallContextSecurityData

System.Collections.Generic.IEqualityComparer`1

System.InvalidOperationException

System.Globalization.CultureTableRecord[]

System.Threading.Monitor

System.Globalization.CultureTableRecord&

System.Object&

System.Threading.Interlocked

System.Runtime.CompilerServices.RuntimeHelpers

System.RuntimeFieldHandle

System.PInvoke.PAL

System.IndexOutOfRangeException

System.IntPtr&

System.Buffer

System.NullReferenceException

System.OutOfMemoryException

System.InvalidCastException

System.OverflowException

System.DivideByZeroException

System.ArrayTypeMismatchException

System.MissingMethodException

System.FormatException

System.RankException

System.Security.SecurityException

System.StackOverflowException

System.Threading.ThreadAbortException

System.Threading.ThreadTerminateException

System.MethodAccessException

SmartDeviceProject1.Program

**This is for the compact framework CLR. Your mileage will vary if you run the same on the desktop CLR.

I'm writing a small application (or rather a screen saver) that animates and demonstrates A* search algorithm. The idea is simple. On screen you see a start and end point and some random obstacles in between them. Then you see animation on how A* algorithm is used to navigate around the board to find a path (close to the shortest possible) between the two.

All of this is fairly standard. However, I got hit by a simple issue. I wanted to have the ability to design this board visually and also let my potential million users do the same. Obviously I don't have time to code up a designer and hence choose the all time manager's favorite technique. Re-use :)

So the final solution I took was to use Microsoft Office Excel as the WYSIWYG editor. I created a xlsx file with the following conditional formatting which colors cells based on the value of the cells.

So in this case

w = Wall marking the end of the table

b = blocks/bricks/obstacle

s = start

e = end

Using this I can easily design the board. The designer in action looks as follows

Since the excel sheet has conditional formatting the user just types in s, e, b, w in the cells and they all light up visually. At the end he/she just saves the file using File => Save As and uses CSV format. This saves the file shown above as

The clock is ticking and the Large Hadron Collider in Cern is going to get switched on today (9/10/2008). Even though there are speculations, CERN is claiming it's perfectly safe and the world won't end. But it's easy to claim that, who'll be around to prove them wrong in case they are :)

It's one of the coolest device at an operating temperature of < -270°C. But I'd get really angry if there's any disturbance to my Birthday celebrations!!