Friday, July 03, 2009

Architectural, technical and spiritual videos

From Norwegian Developers Conference June 2009 (Scott Hanselman, Phil Haack, Michael Feathers, Juval Löwy, Rocky Lhotka and many more)

From Øredev conference Nov 2008 (Jimmy Nilsson, Eric Evans and many more)

Thursday, July 02, 2009

WCF thread safety in 25 lines of code

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class ThreadSafeService : IServiceContract
{
private int counter;

[MethodImpl(MethodImplOptions.Synchronized)]
public void IncrementCounter(int amount)
{
Mutex m = new Mutex(false);
try
{
Monitor.Enter(this);
m.WaitOne();
lock (this)
{
Interlocked.Add(ref counter, amount);
}
}
finally
{
m.ReleaseMutex();
Monitor.Exit(this);
}
}
}

I dare to conclude that familiarity with every technique used in this sample would make you comfortable in dealing with WCF multithreading and throughput issues.

Friday, June 26, 2009

Agile family values

The best thoughts taken from the last meeting of Toronto Agile User Group (heard or taken from the air):

In reality client doesn’t need to spend less money – he needs to spend it wisely.

In reality managers don’t need to ship software faster – they need to ship it predictably.

It is all about honesty and trust. Honesty to others and to yourselves: to be ready to admit that everything else is just smoke and mirrors. And to trust others that you can say it out loud without igniting political wars.

Monday, June 01, 2009

Applying Fluent Interface. Part II – fluent validation.

In of the podcasts on Dimecast.Net Derik Whittaker has shown very smart way to address object validation with Fluent interface.

First I couldn’t help myself but notice that “Painfulway Validation” could be replaced with a yield constructs (picked up from ScottGu’s tutorial):

public static IEnumerable<string> Validate (HostEntry hostEntry)
{
if (string.isNullOrEmpty(hostEntry.FirstName))
yield return "First Name is null";
if (string.isNullOrEmpty(hostEntry.LastName))
yield return "Last Name is null";
etc...


Maybe it is still painful to read but obviously less verbose. But anyway that construct is still to be replaced by Derek’s smart implementation.

Thursday, May 28, 2009

Awesome video

Technology is great – this video was shot at speed of 1000 and 2500 frames per second. Some moments look unreal. This small thing is just a taste – go and download the file from here.

 

 

SprintCam v3 NAB 2009 showreel from David Coiffier on Vimeo.

Sunday, May 10, 2009

MS SQL Server: Default database for Windows user

Never ever set custom database as a default for your Windows account. If you drop the DB (quite legitimate operation when updating or scripting it), you will be kicked out of your Server Management Studio session to never come back (not quite true - you still can sneak in but why would you loose few precious nerve cells?)

If you are the same unfortunate idiot as I am - there is a way to fix this. You can do all kind of voodoo stuff from the command line and shell but if you prefer UI, then the first challenge will be to log in to the SQL Management Studio, unless you have a spare admin account at your disposal.

1. Click "Options" button and change database to connect to (because you just deleted your default one).
2. Run the following statement: ALTER LOGIN [server\account] WITH DEFAULT_DATABASE = master
Now your account has a mastr DB as your default (how it was supposed to be from the very beginning).

Monday, April 06, 2009

Disk defragmentation

For me, who have left a part of his heart with XP, Vista defragmentation tool is a sore disappointment. There are may be some clever algorithms behind the scene, but I feel insecure, staring at incomprehensible message "Defragmentation is running. It may take minutes or hours...". Bill's balls! Why these guys slumming me with so much of unwanted graphics, would cut off the actually useful one?!

These are third-party alternatives I found:

1. PageDefrag from Sysinternals. The name is the best recommendation.

2. Auslogic Disk Defrag seems to have good reviews.


© 2008 Michael Goldobin. All rights reserved