Stop pulling your hair out, use Process Explorer

How many times have you tried to open a file in Windows, only to see it is already in use by some another program? Thus begins the witch hunt of process destruction, until you can open the file. Process Explorer gets rid of this problem. Just search for a file name, and it tells you which process has a hold of it. This is only a small piece of its functionality, but a huge piece of my sanity. »

Using Powershell for MD5 Checksums

The older I get, the more paranoid I get about things I download. Today I downloaded a freeware program from a 3rd party download site, since the publisher doesn’t actually allow downloading from their site. All they give is an MD5 checksum. Well, I decided to write a quick Powershell script to do the checksum for me. (Got some pointers from another blog writing a cmd-let to do the same thing) param ( $file ) $algo = [System.Security.Cryptography.HashAlgorithm]::Create("MD5") $stream = New-Object System.IO.FileStream($file, [System.IO.FileMode]::Open) $md5StringBuilder = New-Object System.Text.StringBuilder $algo.ComputeHash($stream) | % { [void] $md5StringBuilder.Append($_.ToString("x2")) } $md5StringBuilder.ToString() $stream.Dispose() I probably should add a try/catch for the stream disposal and file existence validation. »

The Welcome Screen

Why would I ever want to see this welcome screen again? Beautiful designs start with the needs of the user, not the the requirements of the business. This welcome screen probably started because someone said “We should welcome users every time they start the application, lots of other apps do it!”. The problem is, this welcome screen is counter-productive and adds no value to me the user. One thing I have learned is this type of thing is all too easy to happen to an application. »

The trouble with Big Up Front Design

Agile methodologies say that big up front design (BUFD) is bad. What happens when requirements change? What happens when scalability issues are encountered? How can you know solution X is better than Y? BUFD fails in these cases because unpredictable issues changed the design. For the most part, I agree in that it is impossible to plan for everything. But I don’t believe it to mean that design is dead. For example, if you are designing Windows Vista, would you want to have the Windows XP architect involved? »

Twitter me timbers

Pat and I just got done talking about Twitter vs. blogging. I said Twitter sucks because it is just noise. He said Twitter is awesome because it is simple and therefore gets people communicating. We are both right. So from here on out, my blogs are not going to be novels that take days to get published. They are going to take minutes, even though they may have typo’s and may be an idea that I wish I could redact later. »

Brian Hartsock

Liskov Substitution Principle

Last night I was reading Agile Software Development, Principles, Patterns, and Practices (freaking amazing book) and came across the Liskov Substitution Principle. I had never heard of this principle, so it got me intrigued. What it is… The idea is very simple. For any client using a base class, any child class should be able to be substituted in that client. It seems very straightforward, but the example Martin gives blew my mind. »

In love

I wish ASP.NET MVC and NHaml existed a year ago when I started my last ASP.NET project. I am in love with the simplicity and elegance. At first, I was worried about losing some of the power of Web Forms. I was way off. I created my first MVC + NHaml application (CRUD for one model) in a few hours. The same can’t be said for the learning curve of Web Forms. »

Powershell? Yes

I have read over Scott Hanselman’s Tool List at least a dozen times. The first time I read it, I saw that Powershell was on his top 10. I knew a little about Powershell from Exchange 2007 but hadn’t taken any time to look at it. About a month ago, I had to write some server maintenance scripts. Things like deleting files older than X days, SQL Server maintenance, etc. These tasks were perfect for scripting, so I picked up a Powershell book and went to town. »

How you should start your next project...

public interface IRepository { T Get(object id); void Update(T entity); void Add(T entity); } public interface IEntity { object Id { get; } } public abstract class EphemeralRepository<t> : IRepository<t> where T : IEntity { private IDictionary<object, T> storage; public EphemeralRepository() { this.storage = new Dictionary<object, T>(); } public T Get(object id) { return (this.storage.Keys.Contains(id) ? this.storage[id] : default(T)); } public void Update(T entity) { this.storage[entity.Id] = entity; } public void Add(T entity) { this.storage.Add(entity.Id, entity); } } The data layer can quickly become a time sink, especially since the amount of change in a new project is so high. »

Really?

I am playing around with S3’s REST library for fun. I started writing the request signature code and quickly realized something, the .NET HttpWebRequest object doesn’t allow the date header to be set. You can’t send the Date header. No matter what. Unless you implement your own TcpClient… Am I missing something? Does this make sense to anyone? Encapsulation doesn’t mean restricting behavior, it means restricting knowledge of implementation details. Maybe Microsoft had a reason for enforcing this behavior, but I would like to at least know about it. »