Tech Tock

Time is of the essence.

The Matrix is a World of Proxies

Castle Dynamic Proxy is a really cool quick and easy .Net proxy creator, which essentially allows multiple inheritance and method call interception, but the best part might be Krzysztof Koźmic’s Dynamic Proxy Tutorial and its explanation of Proxies in terms of The Matrix.


October 8, 2012 Posted by | Uncategorized | , , , | Leave a comment


An interesting blog post on garbage collection on MSDN proposes that “Garbage collection is simulating a computer with an infinite amount of memory.”

The follow-up to the replies is here.

August 17, 2010 Posted by | Uncategorized | , | Leave a comment


AutoMapper should be called AwesomeMapper.  It does a simple job simply so I can avoid mapping tedium.  It will map between a viewmodel and a DTO in a couple lines of code when the property names are the same and takes lambdas when the names are different or any conversion is involved.

The only thing I could ask for so far is that it could support simple conversions like between decimal and double.

One hint is to set the target to an interface if your target has more properties than your source.  Otherwise you’d have to write an ignore clause for each unmapped field.  Its still quick and easy and the interface documents your mapping in a simple way.

Get it.

July 6, 2010 Posted by | Uncategorized | , | Leave a comment


When a DataGrid Lets You Down

WPF Perf was recommended to solve a performance issue in a commercial datagrid.  It gives some useful info:  rendering thread cpu usage, dirty region, etc., and it’s part of the sdk now.

M$ vs. Apple

Everyone took note as Apple’s market cap exceeded Microsoft’s.  Some AppleHeads are rejoicing.  UX team members showed their pride.

Product DetailshaXe Can’t Hack It?

Multi platform addition to ActionScript 3, haXe, with generics, enums, type inference, etc. is said to be limited by the need to work across all platforms and not suitable for enterprise use.  At least one Flex  developer is disappointed.  On the other hadd, the “Professional haXe and Neko” book is in our library, so maybe there’s hope.

On The WPF Toolkit DataGrid

There’s nothing like fighting XAML to bring out the surly side of a developer who said:

There are very few bad free things in life, but this is one of them.  The only thing good about this grid is the price.  Do not under any circumstances use this grid.  Even on price.

You’ve been warned.

Fix The Debt

Several Lab49ers had no problem stabilizing the US debt at:

Holiday Weekend Heats Up Lab Atmosphere

Lot’s of visitors and energy @Lab this Friday.  Must have something to do with the holiday.

What Makes a Restaurant

Is Subway a sit-down restaurant?  You decide.

June 1, 2010 Posted by | Uncategorized | , , , , , | Leave a comment

Week @ Lab 2/21/2010

Ski Trip!


The Lab sponsored a ski trip on Saturday to Windham Mountain.  It was an awesomely awesome trip.  Great weather, great company, and as far as I could tell, a great time had by all.

Goodbye ThreadPool & BackgroundWorker,
Hello Task

At this month’s .Net Meetup, David Barnhill, gave a great presentation on Multithreading in .Net 4.0.  While the internal features are just upgrades, support for new syntaxes and keywords in a lamda style will make the current thread starting styles obsolete.  Task Parallel Library is now the way to go.  The Mandelbot Set demo was instructive and visually pleasing.

You can download David’s multithreading samples here.

Another David also presented on mutlithreading in PLinq.

Some links:

Patterns for Parallel Programming: Understanding and Applying Parallel Patterns with the .NET Framework 4

Samples for Parallel Programming with the .NET Framework 4

Parallel Programming in the .NET Framework

DryadLINQ is a simple, powerful, and elegant programming environment for writing large-scale data parallel applications running on large PC clusters.

Reactive Extensions – Rx
Rx is a library for composing asynchronous and event-based programs using observable collections.

I’ve heard only great things about the Rx library, but David B. noted that the support and upgrade path is somewhat nebulous at this time.

Interesting fact:  StackOverflow data is publicly shared.

I highly recommend this meetup.


This is the city after the meetup.  Its an interesting area, a few blocks up from times square.

Word of the week:  Blend·a·bility

With MS Expression Blend becoming more and more important in our development, we strive to maintain code that doesn’t break the UI designer features of Blend.  We call this maintaining blendability.

Basically, Constructor and OnApplyTemplate methods for visual elements need to be respected and not throw errors when loading in design time.  Constructor issues often come from dependency injection which Blend doesn’t supply.  In this case making a default constructor can solve the problem.  Code in the OnApplyTemplate should also respect nulls often caused by lack of dependency injection.  Alternatively, you can check for design time with this code:

if(System.ComponentModel.LicenseManager.UsageMode ==

February 22, 2010 Posted by | Uncategorized | , , , , , | 3 Comments

Week @ Lab 2/13/10

Best Practices in DI/IoC

Interesting discussion about best practices in Dependency Injection (DI/IoC).  There’s a consensus that injecting the container is usually wrong.  Basic design still prevails, objects should have specific responsibilities and you’ll stay out of trouble.

some references: LosTechies, Ayende

FX Cop has rules to help out too:

CA1505 Avoid unmaintainable code

CA1506 Avoid excessive class coupling

Snow Day

10-02-10_1310 My little team had our regular stand up meeting, though it was call-in.  And I got a lot of work done at home before sled runs.  My son wasn’t too happy about that though. & Hate for VB

This MVVM toolkit got us talking about VB.

VB is not our favorite language, but a few came out against being against.  It’s too verbose for most of us.

‘Beep’ is a keyword, so maybe its not all bad.

February 14, 2010 Posted by | Uncategorized | , , , , , | Leave a comment

Visual Studio INotifyPropertyChanged Snippet

I just made my first Visual Studio snippet.  It’s really easy.

There’s a consensus developing that says dependency properties are usually too heavyweight and people are using INotifyPropertyChanged instead.  I miss the snippet that creates a dependency property, so I made a similar snippet for INotifyPropertyChanged.  You can download the code here.

To make a snippet, just go to Tools / Code Snippets Manager and find a snippet to start with.  I started with the “Define a Dependency Property” snippet since I was doing almost the same thing.  The Snippets Manager will tell you where that file is:


Go to the file system and copy the file to your My Code Snippets folder.  If you highlight the folder in the Code Snippet Manager, it will tell you where it is — you can copy the path from the location field.  The file is an xml file, but needs to be named “.snippet”.

Editing the file is very straightforward and the snippet will be available immediately – no restart needed.

One interesting thing about the code is that I’m using a simple method to do all the work:

I basically combined this CodeProject work with Jeff Yates object.Equals idea from here in order to handle both reference and value types in a single call:

Here’s how the snippet comes out by default (the myNames and type are the replaceable fields):

int _myField;

public int MyProperty
    get { return _myField; }
            ref _myField, ref value);

This is the method that does a check and notify in the base class:

protected bool CheckPropertyChanged<T>
      (string propertyName, ref T oldValue, ref T newValue)
            if (!Equals(oldValue, newValue))
                oldValue = newValue;
                return true;
            return false;

February 11, 2010 Posted by | Uncategorized | , , , , , | 3 Comments

.Net Logger

In a recent small project I needed a logger. I would normally use Log4Net, but I couldn’t get it to work within the allotted 1/2 hour.  Since I chose it because it was easy, I tossed it aside.

I didn’t want the hassle of Enterprise Library and its heavy handed uber configged implementation.

This little logger on CodePlex with the goal of simplicity worked immediately with no trouble.  It’s now my preferred logger for small projects.

February 10, 2010 Posted by | Uncategorized | , | 4 Comments

4 C# Things You Might Not Have Heard Of

Partial Interfaces

Just learned that Interfaces can be partial.  Not sure how I’ll use this info but it is interesting.

This compiles:

namespace NameSpace
    partial interface IInterface
    partial interface IInterface

Partial Methods

Some folks were unaware that methods can be partial.  But I’ve seen this in my favorite DAL for quite a while.  Its seems most useful in (usually autogenerated) shared code situations as a replacement for virtual functions.  Code calling a partial method is removed from the compiled binary if the method isn’t implemented.  In that way it seems somewhat similar to events as well.

        partial void OnMyMethod();
        private MyMethod()

If OnMyMethod were virtual or an event call, the functionality would be very similar.

Assignment Is A Value

The return value of an assignment expression is the assigned value itself.

            //set both x and y = 5
            int x = (y = 5);

I saw this feature years ago in C/C++ but never thought of using it in C#.


Here’s a use for the return value of assignment with the C# null coalescing operator (another little known feature – coalesce will return the first non null value).  This compresses the code for a common operation while (some would argue) not losing clarity.

private object _aProperty;
public object AProperty
    get { return _aProperty ??
            (_aProperty = new object()); }

January 23, 2010 Posted by | Uncategorized | , , | 3 Comments

Week @Lab

A random list of things I saw and heard @Lab this week.


There’s been Some discussion of the Reactive Framework.  It seems to be this year’s hot .Net topic (aside from .Net 4.0 itself).

Mini Meetup

I stayed late at the office on Wednesday and almost got roped in to a Java mini-Meetup – half a dozen lab guys talking Java for a couple hours.

Maybe next time if you guys have food I’ll stay.

Microsoft Success Story?

Is this success story this actual IT failure?  Maybe I should switch to Java…

UX on Friday

I’ve keep hearing about a Friday meeting that the UX folks have.  I wonder what they’re up to.

All the Cool Kids Are Wearing Black

Some of the best developers @Lab prefer a black background in their Visual Studio dev environment (along with a host of other color customizations).  One developer who attempted the switch this week went back in just a couple days.  I personally, get overwhelmed by the look and have trouble understanding code this way. YMMV.


Chocolate Diet

I brought chocolates to the office to celebrate my new diet which made lots of people happy but confused.  My new diet is basically drinking diluted vinegar with sweetener all day and eating pretty much anything I want.  I found it to be the cure for heartburn and hypoglycemia. I’m also wheat free – because it makes me sick (don’t ask) , not because I’m trendy – not that anybody should really care.

Another Labber brought in some farmer’s market apples of which I thoroughly partook.

Just another reason we love the home office – its homey.

January 16, 2010 Posted by | Uncategorized | , , , | 1 Comment