Skip navigation

Monthly Archives: December 2008

So, on Friday last week at 11:55am my grandfather passed away, he had terminal cancer (I can’t remember what kind) so it wasn’t unexpected, but still rather sad.

I probably won’t blog at all now until the new year, but we’ll see.


So in my effort to set free some of my useful code, today I am releasing a class called JHarris.RegexCollectioner.

I created this because I needed a class to check multiple regexs on a single string (its really increadibly trivial todo)

the code should be pritty self explanitory, but if you have any questions, feel free to ask

so heres the code:

using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace JHarris
public class RegexCollectioner
/// <summary>
/// Internal dictonary that holds the regexs
/// </summary>
Dictionary<string, string> m_RegexCollection = new Dictionary<string, string>();

/// <summary>
/// Adds a Regex to the collection
/// </summary>
/// <param name=”name”>the name of the regex</param>
/// <param name=”regex”>the regex</param>
public void addRegex(string name, string regex)
m_RegexCollection.Add(name, regex);

/// <summary>
/// Tests if a string matches a regex in the collection
/// </summary>
/// <param name=”input”>the string to test</param>
/// <returns>the name of the regex that works, if no regex is found to be a match, this function will return string.empty</returns>
public string FindRegex(string input)
string name = string.Empty;

foreach (KeyValuePair<string,string> rgx in m_RegexCollection)
if (Regex.IsMatch(input,rgx.Value))
name = rgx.Key;

return name;


Well, for those of you who want more from me(and lets be honest, you do[nt]:)) you now have another option,

My FriendFeed feed

This combines my youtube, twittr, facebook (well I think), google reader shared items, reddit profile, amoungst others.

so yeah, go crazy!

This is seriously intresting

So, Most of you will know me as a Microsoft fanboy. However there is another side to me, I also develop in Python quite a bit, so I’m really happy now that Python 3.0 is out,

Go download it now!

Does anybody know why IE defaults to searching for some perfectly valid URL and not for others (I.E makes IE open up a search and not load the url (dont read anything into the site by the way, was looking up something for one of my parents :)))

So, Josh has been a bad blogger. And some things have popped up with a member of the family having terminal cancer, so yeah.

Anyways, on with the letting my code fly.

Today I am gonna get free a tool I created a while ago called Image ripper. The basic idea behind it is that somebody is having lunch or something with a client, and they start diagramming something on a napkin or other non suitable bit of paper and would like to get that into Visio or Word or something like that without redoing the diagram.

It’s a command line program, written in c#, full source is included (should be rather easy to understand).

The way you use it is (from the command line and in the directory the program is) ImageRipper.exe templatefilepath checkfilepath outputfilepath.

The first thing is the path to what I call the template image (I.E If the diagram is on a napkin, the template file would be a blank napkin).

The second argument is the path to the file to check (I.E the napkin or whatever that your diagram is on).

The last argument is the file that you want to be the output file, it will create it if the location doesn’t exist

so as an example ImageRipper.exe c:\images\templatefile.jpg c:\images\checkfile.jpg c:\images\output.jpg

The way it works is that It loads both images into separate System.Drawing.Bitmap classes and then comparing the images pixel-by-pixel, if the current check image pixel is different than the template image pixel, then it will add a pixel to the output images bitmap

Obviously this works best with scanned images.

Any Questions, feel free to leave a comment and I’ll get back to you as soon as I can.

Here’s the link.

As with all my apps that I set free, feel free to-do whatever you want with this, I’d like a email if you do anything cool with it commercially. If you blow up or have vomiting and nausea or anything else bad while using my software, I’m not responsible, so there mmmkay?