December 2007


Well it finally happened. We visited Durham NC and met brother Dwight in person, f2f as they say in text-messaging lingo. We met at the Ole NC BBQ buffet off Duke St, in Durham and had a grand ole southern time. After working together all these years it was a real treat to finally meet the brains, visionary, and digitizing powerhouse behind Voices For Christ.
(more…)

I’ve been continuing to debug the issues with the JRuby web-enabled console into our Emissary P2P Workflow System. I’ve spent an embarrassingly long time debugging this and trying to figure out what is going wrong. Finally I started just printing out object ids for things so see what I might have more than one instance of.

The issue is that sometimes the ruby context is being duplicated. So we get this type of behavior:
(more…)

So our new JRuby console is pretty sporty. Created inside an Emissary P2P Workflow node, made accessible by our custom MVC stuff over Jetty, nice CSS and Javascript that makes it pretty nice to use, including command history on the up-arrow.

But there is a small problem that is driving me bonkers.

Sometimes, more often while debugging something and doing a Shift-Reload on the JRuby Console web page, but sometimes without that — I get TWO JRuby environments and the interactions using AJAX alternate between them. Like this:

=> i=5
5
=> i=6
6
=> i
5
=> i
6

This doesn’t happen all the time and I really don’t know what is going on. There could very well be some fundamental thing about the Bean Scripting Framework’s BSFManager that I just don’t grok. In fact, after looking into the BSFManager a little, I’m worried about the multi-threaded nature of running that inside the emissary node. We could have multiple users each creating a JRuby console which could be living on separate HttpSessions. Should be ok as far as all of my code goes, but that BSFManager factory/singleton is starting to look suspiciously like an anti-pattern I once knew.

Charles, Thomas, Ola — You guys absolutely rock. I am really appreciating the work you have done on JRuby. Thanks also to Sun for supporting this work.

Today I dropped bsf.jar and jruby.jar (1.1b1) into the Emissary P2P Workflow project’s lib directory. I wrote a few dozen lines of java to set up jruby as my ruby scripting language in the framework, create a context to run ruby in. I wrote few more line to hook all of this into our custom high-performance MVC system and now we have a Ruby scripting console served up by Jetty, protected by our normal J2EE security mechanisms. The initial context gets a load of all the important objects inside an emissary node via BSFManager.declareBean. This makes them available as globals in jruby (duh, once you remember to put the “$” in front on the ruby side).

While adding the important object from the Emissary namespace into the JRuby context, some of the object names we were binding things with turned out to be not-so-great for use in Ruby. So here is the little regex that we ended up using to clean up the names and make them nice.

key = key.replaceAll("[-'\"?><{\\\[\\]&$!@#^*()+=]","");

A little css, some MochiKit and how I have an Ajax-enabled JRuby window into running Emissary code served up by our own embedded Jetty. The power this is going to unleash is hard to fathom at the moment but the ideas are coming fast and furious.

So the boy and I were watching football last night. The game was a little slow so I had the laptop out and was working on some unit tests. He looked over and saw the Clover coverage graph and says “What’s that?”
(more…)