Are you a Maker or a Manager?

Paul Graham writes very useful stuff.  I respect his mind. Read his Maker’s Schedule, Manager’s Schedule essay for what I think is one of the smartest descriptions of the classic problem all programmers face. Spread this meme in your organization. Are you a Maker or a Manager? Both are useful, but they are very different…

1

Stopwatch on Interlocked.Increment(ref x) vs. lock (y) { x++; }

Given 10 million iterations: object y = new object(); const int iterations = 10000000; Which is faster, InterlockedIncrement: stopWatch = Stopwatch.StartNew(); for (int i = 0; i < iterations; i++) { Interlocked.Increment(ref x); } stopWatch.Stop(); Console.WriteLine("Interlocked took " + stopWatch.ElapsedMilliseconds); Or lock: stopWatch = Stopwatch.StartNew(); for (int i = 0; i < iterations; i++) {…

5

A simple and totally thread-safe implementation of IDisposable

A simple and totally thread-safe implementation of IDisposable, with improved semantics over the Dispose() / Dispose(bool disposing) reference implementation.  Now updated, slightly, after a consult with someone much smarter than me, who suggested a slight improvement: use Thread.VolatileRead in the IsUndisposed method. Instructions: Override DisposeResources in derived classes.  When this method is called, always release…

1

An invariant version of the same…

An invariant version of the same… /// <summary> /// Extends StringBuilder so that it has an AppendFormatLineInvariant method. /// </summary> /// <param name="value">The StringBuilder being extended.</param> /// <param name="format">A composite format string.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> /// <returns>The StringBuilder.</returns> public static StringBuilder AppendFormatLineInvariant(this StringBuilder value, string…


A missing method from StringBuilder…

StringBuilder is so useful.  Does it all.  But it’s missing a method.  Here it is: /// <summary> /// Extends StringBuilder so that it has an AppendFormatLine method. /// </summary> /// <param name="value">The StringBuilder being extended.</param> /// <param name="format">A composite format string.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> ///…


Useful extension method for the object type…

Here’s a useful extension method for the object type: /// <summary> /// Extends object to have a ValidateArgumentNotNull method. /// </summary> /// <remarks> /// Validates that an object is not null. If the object is null, /// ArgumentNullException will be thrown. /// </remarks> /// <param name="value">The object being extended.</param> /// <param name="argumentmName">The argument name.</param> public…

2

I’ve been BUSY!

I’ve been BUSY! I travelled to New York to take some training (Jeffrey Richter, C# Threading), to Seattle for some more training (Scott Bain, TDD) to Bar Harbor, Maine for some R&R, then back to Seattle for an internal engineering conference (which I got to speak at). In the middle of all this, I’ve been…

1

blambert/azure – Windows Azure ASP.MVC Web Roles – Thinking Outside The Box

Azure Ninja Part 2!  (空色の忍者) In my last posting I showed you how to run an Azure Worker Role outside the Development Fabric.  In this posting, I am going to show you how to run an ASP.NET MVC Web Role outside the fabric, too. No special code required, all you need is IIS to be…

1

blambert/azure – Windows Azure Worker Roles – Thinking Outside The Box

In this posting I am going to show you how to run an Azure Worker Role outside the Development Fabric. Why would you want to do this? Because you want to be an Azure Ninja!  (空色の忍者) While testing an Azure Worker Role in the Development Fabric is an important part of the development process, having…

5

blambert/learnings – Don’t Base64 encode PartitionKey and RowKey values in Azure Table Storage.

Azure Table Storage is a “typeless” entity storage system. If you’re an RDBMS person, and learned about data storage by reading ISBN 0-201-14192-2, Azure Table Storage is a different way of thinking about your data. In Azure Table Storage, an entity is simply a “bag of properties”; with a certain minimum “shape” or set of…

4