Archive for the ‘Uncategorized’ Category

Ruby: Find ini files containing an entry

Ruby’s always good with the “find”:

require ‘find’
 
Find.find(".") do |path|
Find.prune if path =~ /\.svn$/
Find.prune if path =~ /XPay$/i
next unless path =~ /\.ini$/i
File.open(path,’r') do |f|
f.each_line do |l|
next unless l =~ /^\s*dasserver\.exe\s*=\s*(?:[0-9]+\.){3}([0-9]+)\s*$/
print "#{path} (2.0.2.#{$1})\n" [...]

December 1, 2009 • Posted in: Uncategorized • Comments Closed

Scala: Ugly hairy rewrite C++ code jig

I think this might be the first time I’ve gotten to use a real algorithm at work in several years. This is also my first attempt at Scala (pretty nice!), and one ugly jig. It had to be adjusted every fourth or fifth component I used it on because of strangeness in the [...]

October 5, 2009 • Posted in: Uncategorized • Comments Closed

Java: JFrame tester

Our first submission:

So here is my silly Java JFrame that I use to test all sorts of things; Swing components, logging frameworks or just to see pretty colors on my screen.
Really though, just follow the comments and play with what a JFrame can do. In addition there is a convenient comment that instructs you where [...]

June 18, 2009 • Posted in: Uncategorized • Comments Closed