Diasparsoft Logo Let's write software that people understand.

Home | Contact

Training

JUnit support

Outsourcing

The work that Diasparsoft did for us was outstanding. We are now using the software on a daily basis and their work could well have a dramatic impact on the Reds' organization in the near future.Cincinnati Reds Baseball Club.


Publications

Tips & Tricks

Diasparsoft Toolkit

What is Diaspar?

Interesting Bits RSS

Friday, April 29th

Null as a method parameter

Unless I'm publishing an API for general use, I don't worry about testing method parameters against null. It's too much code and too many duplicate tests. Besides, I would be testing the wrong thing.

When a method receives null as a parameter, the invoker -- and not the receiver -- is missing a test.

jbrains on 04.29.05 @ 04:25 PM ET [link]

Monday, April 4th

Cryptic documentation: RubyScript2Exe

Don't get me wrong. I love the work that Erik Veenstra has done on EEE, Tar2RubyScript and RubyScript2Exe. Still, I would prefer he'd written one more line of documentation for his Tar2RubyScript package. Something less cryptic about how to use this package with Mac OS X.

As Google bait for others who might become stuck as I did, if you have problems with Tar2RubyScript on Mac OS X, with an error message like this:

Creating application_darwin ...
/sw/lib/ruby/1.8/ftools.rb:18:in `stat': No such file or directory -
/tmp/tar2rubyscript.d.999.1/rubyscript2exe/eee_darwin (Errno::ENOENT)
        from /sw/lib/ruby/1.8/ftools.rb:18:in `syscopy'
        from /sw/lib/ruby/1.8/ftools.rb:43:in `copy'
        from /private/tmp/tar2rubyscript.d.999.1/rubyscript2exe/init.rb:217
        from /Users/jbrains/Library/Ruby/rubyscript2exe.rb:556:in `load'
        from /Users/jbrains/Library/Ruby/rubyscript2exe.rb:556
        from /Users/jbrains/Library/Ruby/rubyscript2exe.rb:551:in `newlocation'
        from /Users/jbrains/Library/Ruby/rubyscript2exe.rb:521:in `newlocation'
        from /Users/jbrains/Library/Ruby/rubyscript2exe.rb:457:in `newlocation'
        from /Users/jbrains/Library/Ruby/rubyscript2exe.rb:457:in `newlocation'
        from /Users/jbrains/Library/Ruby/rubyscript2exe.rb:521:in `newlocation'
        from /Users/jbrains/Library/Ruby/rubyscript2exe.rb:565
You need to manually add the file eee_darwin (the one you compiled with FreePascal) into the rubyscript2exe package itself. That's what Erik means by "Copy eee_darwin to rubyscript2exe/" in his instructions. I did this:
stuart:~/Workspaces/general/DistributedRubyExperiments jbrains$ cd ~/Library/Ruby/
stuart:~/Library/Ruby jbrains$ ls
eee_darwin              rubyscript2exe.rb       tar2rubyscript-0.4.5.rb
stuart:~/Library/Ruby jbrains$ ruby rubyscript2exe.rb --tar2rubyscript-totar
stuart:~/Library/Ruby jbrains$ ls
eee_darwin              rubyscript2exe.rb       rubyscript2exe.tar      tar2rubyscript-0.4.5.rb
stuart:~/Library/Ruby jbrains$ tar xf rubyscript2exe.tar
stuart:~/Library/Ruby jbrains$ ls
eee_darwin              rubyscript2exe.rb       tar2rubyscript-0.4.5.rb
rubyscript2exe          rubyscript2exe.tar
stuart:~/Library/Ruby jbrains$ cd rubyscript2exe
stuart:~/Library/Ruby/rubyscript2exe jbrains$ ls
LICENSE         VERSION         eee.pas         eeew.exe        require2lib.rb
README          eee.exe         eee.rc          ev
SUMMARY         eee.ico         eee_linux       init.rb
stuart:~/Library/Ruby/rubyscript2exe jbrains$ cp ../eee_darwin .
stuart:~/Library/Ruby/rubyscript2exe jbrains$ cd ..
stuart:~/Library/Ruby jbrains$ mv rubyscript2exe.rb rubyscript2exe.rb.old
stuart:~/Library/Ruby jbrains$ tar cf rubyscript2exe.tar rubyscript2exe
stuart:~/Library/Ruby jbrains$ ruby tar2rubyscript-0.4.5.rb rubyscript2exe.tar
Creating archive...
Creating rubyscript2exe.rb ...
And then I could use rubyscript2exe, complete with Erik's experimental Mac OS X support. (Works so far!) I hope this helps save someone a little bit of time.

jbrains on 04.04.05 @ 05:47 PM ET [link]