tools

July 30, 2006 tools

Number to String Converter

Number to String Converter

To capture the work that Doug and I did to make Indigo (WCF) and Avalon (WPF) work together, I tore up our PDC sample application into a set of simpler technology samples. To make it fun for myself, as part of these samples, I built a little library for converting numbers into strings of English words, e.g.

Enjoy.

July 30, 2006 tools

RegistrySettingsProvider2

I updated the SDK RegistrySettingsProvider to implement IApplicationSettings and built a sample to demonstrate how to integrate it (or any .NET 2.0 custom settings provider) with the settings designer-generated code. Enjoy.

Discuss

July 30, 2006 tools

Number To String Converter

Number To String Converter

To capture the work that Doug and I did to make Indigo (WCF) and Avalon (WPF) work together, I tore up our PDC sample application into a set of simpler technology samples. To make it fun for myself, as part of these samples, I built a little library for converting numbers into strings of English words, e.g. 4 is four:”

To drive home the point (of which there wasn’t any because the sample had nothing whatever to do with number to English phrase conversions), I spent some time polishing the algorithm so that it handled decimal points:

and when that didn’t satisfy me, I added large numbers and negative numbers:

Before writing this code, I searched the net and didn’t find any algorithms that handled both negative numbers and decimal points, let alone for .NET or in the number of lines of code to which I cut it down (93, including comments). I know it’s not useful, but it was fun. If you want the code, you can get it by downloading the .NET 3.0 Cross Technology samples and checking out the WinSDK_Samples\CrossTechnology\WpfDataBindingToWcfResults\service\NumberUtility.cs file. I built the file to be dropped into any .NET 2.0+ project (and even .NET 1.x projects, if you remove the using System.Collections.Generic” statement at the top of the file — I don’t actually use generics), regardless of whether you’re using Avalon or Indigo or not.

Enjoy.

Discuss

July 29, 2006 tools

MS Live Labs PhotoSynth: building the photo web

Imagine your vacation photos displayed in 3D and linked together, both around a space and zooming in and out. Now imagine everyone’s photos linked together in this way. What you get is PhotoSynth:

Worth checking out.

July 11, 2006 tools

Functional Language Summary

I’ve been hearing a lot about functional programming lately (and the circle of life continues); I found Functional Programming For The Rest of Us to be a nice summary. Here’s what I got from it:

Atoms of FP:

  • All variables” are immutable, often called symbols”
  • Program state is kept in functions (specifically, arguments passed on the stack to functions), not variables
  • Functions are first class citizens, i.e. functions can be passed as arguments
  • currying” is a convenience syntax for adapting a function to an alternate function signature
  • closures” are functions that are allowed mutable state and access to state outside their lexical scope to bridge functional and non-functional languages

Implications:

  • Functions cannot cause side effects (“variables” are immutable)
  • FP is great for unit testing (only have to test outputs against inputs — don’t have to test side effects)
  • FP is great for debugging (no need to worry about external state affecting function results — results are only based on the input)
  • No need for multi-threaded locks, as state is immutable
    • This makes functional programs automatically parallelizeable
  • Can hot swap new function definitions w/o effecting existing instances
  • Don’t need to evaluate a function til the results are needed

FP sounds great! Why do we mess around w/ anything else?!?

July 5, 2006 tools

A Shared Source Site: CodePlex

CodePlex functionality, built on Microsoft Visual Studio® 2005 Team Foundation Server, provides source control, issue tracking, discussion forums and RSS feeds in and out of each project so that members can stay up to date on the development issues most important to them. Microsoft Visual Studio Team Foundation Server enables developers to collaboratively develop, share, discuss and consume source code and build software.”

Enjoy.

June 12, 2006 tools

“man” for MSDN

If you like man, you’ll love MSDN man. Enjoy.
June 9, 2006 tools

Annotate the MSDN Wiki

For a long time, my favorite place to put up code snippets that I could get back to later has been pinvoke.net (like GetTempFileName). However, that was only good for managed/native interop, whereas the MSDN Wiki is for anything in the docs. I don't know what their commitment is to keeping content over time or between versions, but I've got my fingers crossed. Enjoy!