Algorithms

Wikipedia has a rather large page with links to a ton of programming and math related algorithms. Thanks to this resource I now know of the Pancake Sort!

C# Generic Collection <T>

Here is a nice library of collections which utilize C# 2.0′s generics. I don’t have the latest .NET runtime at work so I haven’t been able to check it out. Apparently it will run on Mono as well.

A Couple Of Links for Windows Users

The first one is a ISO Mounter. Now you can mount ISO’s in Windows just like you can with any Unix-like operating system.

The second link is a collection of .NET tools. I have used Reflector and Resourcer.

Visualizing Computer Chess Movements

Thinking Machine 4 is a Java applet built with Processing, a

programming language and environment for people who want to program images, animation, and sound.

Make moves on the Thinking Machine and watch as the computer builds its decision tree and displays its thinking process right on the chess board. Processing is also a pretty cool cross-platform tool which seems like a cross between flash and POV-Ray. (Wow, two completely unrelated references to POV-Ray in one day!)

Searching in Files Using awk and grep

Sometimes it is handy to have a list of files which contain a certain string (or a regex). You can combine grep and awk in the following manner:

grep -H "string to search for" *.txt | awk -F: '{ print $1 }'

The -H option in grep makes it display the file name before the text that matched the string. The -F option for awk lets you specify the field delimiter, in this case, :.

  • Ed Catmur
    2555 days ago

    Easier:

    grep -l “string to search for” *.txt

    From grep(1):
    -l, –files-with-matches
    Suppress normal output; instead print the name of each input
    file from which output would normally have been printed. The
    scanning will stop on the first match.

    (And faster!)

  • Marshall
    2553 days ago

    Thanks a lot. Much easier to remember too!

Polygons and Points

Here is an interesting article, circa 1987, which provides a nice explaination, and some C code, on how to programatically determine if a point in a 2-D or 3-D space lies within an n-sided polygon.