Saturday, December 11, 2004

Kettles should change colour!

Kettles should turn redder as they get hotter. No more quickly touching the side to see if its already boiled.


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.

  1. 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.
  2. 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. :)

GitHub Projects