Kettles should turn redder as they get hotter. No more quickly touching the side to see if its already boiled.
Nigel Thorne's software development blog, focusing on finding simple solutions to real work problems.
Saturday, December 11, 2004
Wednesday, December 08, 2004
VersionIt
I wish I had local version control. Seeing as I don't, here is a little tool I have stared using that took literally 5 mins to write.
VersionIt- It makes a copy of a given file. The copy is named the same as the original but with a date stamp appended.
First I'll show you the code, then tell you how I use it.
- Make a new C# ConsoleApp in Visual Studio called VersionIt.
- Replace the
Main
method with the following code.
[STAThread]
private static void Main(string[] args)
{
if (args.Length == 1){
string from = args[0];
string to = args[0] +
DateTime.Now.ToString(" yyyy-MM-dd HH-mm-ss");
try {
File.Copy(from, to);
Console.WriteLine(
"Coppied file '{0}' to '{1}'",
from,
to);
}
catch (Exception ex){
Console.WriteLine(
"Error copying file '{0}' to '{1}'",
from,
to);
}
}
}
Okey, now compile it and copy it to somewhere in your path (eg. c:\windows\System32\VersionIt.exe)
I am using this in two ways.
- I have associated the command with .cs files in windows explorer. This means I can right click on a file and select "versionIt" to make a backup.
- I also added the executable as a new External Tool in Visual Studio.
Now while working on a file, I can click 'VersionIt' and know that my current changes are safe. If you click the 'Use output window' option it even nicely displays where it copied the file to. Like that! You can even map it to a keyboard shortcut if you can find one that is not in use by ReSharper. :)
Tuesday, November 16, 2004
NigelThorne.com
I have finally registered http:\\www.nigelthorne.com.
I intend to build up a collection of open source projects and resources that I needed and couldn't find anywhere else. Hopefully being driven bya real need will ensure the tools (etc.) will be useful to others. I intend this to be a place where my ideas can take shape, and I can gather feedback to help shape them.
Friday, November 12, 2004
Mutant NMock
A while ago I found I wanted NMock to allow me to specify what a mock object should return without setting up an expectation. SetResult
lets you do this, but I wanted the return value to change depending on the parameters. So I hacked the source code a bit and came up with this.
The new syntax is
DynamicMock mock = new DynamicMock(typeof("Banana"));
mock.Return("MethodName",returnValue,param1, param2 ... );
Feel free to try it out. No warrenty is provided.
Saturday, October 16, 2004
Toki Pona
Toki Pona is "the simple language of good".
I first came across it a couple of years ago, but it keeps popping back into my mind, so I though I would share it. Toki Pona is a simple spoken language. It is so simple infact that you can become fluient in about a month. I first found it when I was looking for a simple spoken language to that I could teach a computer, but thats another story. There are user groups, and lessons,etc.
Check it out!