Tuesday, December 18, 2007

JNI library testing on OSX 10.5

Refactoring a bunch of the JNI H-ITT code that I was working on last month caused me grief when I was nailed with the presence of UnsatisfiedLinkError during my maven build. My Mac prototype code was very simplistic and I had all the libraries (and Java test driver) in the same directory and it worked flawlessly. Sheesh, LD_LIBRARY_PATH in OSX 10.5 is not the right env variable, should be DYLD_LIBRARY_PATH. Once that was added to my pom I was good to go, tests passed as expected.

Thursday, December 13, 2007

Madison Summit Oxfords, second pair

Three years ago I wrote about a horrible experience with junk shoes from Wal-Mart . Tonight I bought my second pair of Timberland Madison Summit Oxfords. I love these shoes and forwarded my thoughts to Timberland:

To Whom it May Concern,

I just wanted to write a quick note and thank you for such fantastic shoes. Two years ago I was looking for a new pair of shoes that I could use for work (business-casual), for school (walking around college campus), for home (playing sports with my kids, shoveling the walk, and wearing around the house) and for anything else. I was talking with a fellow in my church congregation and he suggested Timberland. I headed over to a local sporting good store and the sales guy immediately showed me your Madison Summit Oxford.

I purchased that pair of shoes 23.5 months ago and they has served me very, very well. I have worn them exclusively, for every activity. The best part about this shoe was how well it "restored" when I regularly applied my leather-weather cream.

Tonight I purchased my new pair, the exact same size and model for $30 cheaper than two years ago. I commend you on a fine product and its outstanding endurance. I appreciate your company's values and commitment to the environment. I hope this next pair will last me another two years and that I can continue on with my Madison Summit Oxford addiction in the foreseeable future (2010, 2012, 2014...).

Wednesday, December 12, 2007

TextMate: Subversion Annotate command

I really like vc-annotate in emacs. Considering the other very easy command I created earlier, thought I'd give this one a shot too (since it's not in the default Subversion bundle). Again, extremely simple and minutes to complete. Here's the command (edited from the Info command):

require_cmd "${TM_SVN:=svn}"
: ${TM_RUBY:=ruby}

"$TM_SVN" annotate "$TM_FILEPATH" |"$TM_RUBY" -- "$FORMAT_INFO"

And here's the Ruby formatter:

require ENV['TM_BUNDLE_SUPPORT']+'/svn_helper.rb'
include SVNHelper

puts html_head(:window_title => "Info", :page_title => "SVN Annotation", :sub_title => 'Subversion')
puts '<div class="subversion">'
@colors = ['BlanchedAlmond',
'DarkSeaGreen'] #see http://www.w3schools.com/html/html_colornames.asp for more pretty colors

@color_hash = Hash.new
@color_ind_size = @colors.size() -1

def color_for_rev(rev)
color = @color_hash[rev]

unless (color)
color_index = rev % @color_ind_size
color = @colors[color_index]

@color_hash[rev] = color


$stdin.each_line do |line|
rev = line.strip.split(" ").first.to_i

color = color_for_rev(rev)
colored = "<div style='color:#{color}'>#{htmlize(line.strip)}"



TextMate command db query prompt

I decided to give TextMate another whirl last night. I thought since I gave NetBeans 6 some time recently I'd see how efficient a couple of days with TextMate would be (compared with my life-blood emacs). I was pleasantly surprised at its extendability, speed and myriad of bundle choices. While perusing the SQL bundle I noticed I couldn't see of a way of directly typing in a query. I really like sql-mysql in emacs, so I was hoping I could do something similar--the workaround being typing a query into a buffer, selecting it, then invoking the command to send it. After poking around in the TextMate manual I was shocked at how easy it appeared to be to add custom commands. In less than a minute I had this (edited straight from the manual example of showing a dialog for input):

res=$(CocoaDialog inputbox --title "Send query" \
--informative-text "Enter query text:" \
--button1 "Submit" --button2 "Cancel")

[[ $(head -n1 <<<"$res") == "2" ]] && exit_discard res=$(tail -n1 <<<"$res") db_browser.rb --query="$(tr '\n' ' ' <<< "$res")"

If I can just get over my remaining habits (screen splitting, hippie-expand, and more), I may end up paying for this editor. Too bad it's not OSS :(