Emergencies, and How to Kill Creativity

A post over at Slow Leadership: Slow Leadership: How to Kill Creativity is closely related to a “rule” we have at Oasis Digital: we have a limited “budget” of emergencies; we will spend no more than a small percentage of time in “emergency mode”.  If there appear to be so many fires that that the team spends most of its time fighting fires, we first review who is doing what work – and usually find that most of our developers are mostly doing the right things in the right way.  There is a bit to be gained by “trying harder” – in the short term.  The real solution is not to try harder – in fact that approach almost never works over time.  Rather, the solution is to slow down and get to the heart of the matter, which is usually some variation or combination of:

  • The software doesn’t have the right features to handle unusual situations or inputs gracefully.  Add them.  Make it so our customers/users have the data and features they need, to deal with new situations directly, rather than those situations becoming our emergencies.
  • The software doesn’t have the right documentation and training, to enable its users do deal with new situations directly.  Add that documentation and training.  Users are often far smarter and more capable than the typical software developer gives them credit for.  We have repeatly been amazed and thrilled at what our customers have been able to accomplish when handed even the roughest of tools and explanations.
  • Our software has a deep mismatch to the problem it is intended to solve.  Change it… even if it means something scary like rearranging the core of a large DB schema.
  • We don’t have the right team for the problem/project at hand.  Swap someone around.
  • The team isn’t big enough for the problem.  Grow.
  • The problem is too big for the team/budget.  Trim scope, do a great job on the new scope, then consider expanding it again.

By doing these things, we apply more brainpower / creativity to automation, innovation, and genuine progress on the problems at hand.  This is the antithesis of the “pressure based culture” described in the article linked above.

The Rails aren’t so smooth if you want some [Image]Magic[k]

We started some work recently with the much-hyped Ruby / Rails combination. For the most part, it’s lived up to the hype; going down it’s ‘happy path’ has been far more productive than work with some other web app frameworks and languages. But today I hit several sources of Ruby / Rails pain in a row, and it seems worth writing about them, perhaps to save the next fellow from the same.

The nexus of the pain is RMagick, which, once working, is a great set of tools for drawing graphics in Ruby. My partner on this project had some trouble getting the numerous dependencies in place on Linux and/or MacOS; he thought it would go much easier on Windows, since there are far fewer dependencies.

Indeed, it should have been easy. I went over to the RMagick download site and grabbed the latest and greatest almost-ready Windows Gem, version 1.10.1. Its instructions said I needed Ruby 1.8.4, so I remove my old 1.8.2 and grabbed Curt‘s One-click ruby installer. It is a release candidate (“184-16 release candidate 1”), but Curt said the other night that the installed software is ready to go, he’s only working out a few installer issues.

All good… except now nothing worked at all. Lots of errors like “./script/../config/../app/views/admin/signin_form.rhtml:3: Invalid char `\360′ in expression” and “./script/../config/../app/views/layouts/login.rhtml:2: parse error, unexpected $, expecting kEND”. After considerable searchings I found clues and then the answer. The RMagic docs led me astray – by ignoring them and going back to 1.8.2, it all works again… for small values of “all”… because 1.8.2 doesn’t include Rake, Rails 1.1 prefers 1.8.4, etc.  It appears, if I understand the various posts correctly, that RMagick breaks Ruby by changing a method on String. This is a rather unfortunate, surprising, and in my judgement, bad thing for such a library to do; I can’t imagine offhand why RMagick should do anything at all until invoked. At minimum I’d hope to be able to trust an image manipulation library to not touch, much less break, the String class 🙂

That’s enough digging for now; hopefully when I return to this, the issues will be worked out, there will be matching, current, compatible versions of all these parts, and things will run smoothly along the “rails” as usual.

Make a DVD with ffmpeg

For a project we have going at Oasis Digital, we have explored various libraries for creating video DVDs from computer-generated content until program/script control. There are quite a few ways to do this; one that is appealing for a command-line junkie is the combination of ffmpeg, dvdauthor, and mkisofs. It took considerable research to figure out what commands to string together for a simple scenario:

  • you have some video in AVI format (for example, an MJPEG AVI from a DV video camera)
  • you have some background music in mp3 format
  • you want a simple one-title one-chapter DVD with that video and audio

There are plenty of sites with long and complex sets of commands to accomplish these things. But for this simplest case, the essential commands are:

ffmpeg -y -i video.avi -i audio.mp3 -target ntsc-dvd -aspect 4:3 dvd.mpg

mkdir DVD

dvdauthor -x file.xml # there is a way to avoid the file by putting a few more options here

mkisofs -dvd-video -o dvd.iso DVD

Of course, there is considerable other work involved in wiring up a full solution, but that is more project specific. I hope these example commands shorten the research time for the next fellow who needs to do this core processing.

Ruby OpenGL, Kororaa Xgl

Last night at StlRuby.org the question came up of how to contruct GUIs with Ruby. I mentioned that I think there is a lot to be gained by using the high performance graphics hardware APIs, which are mostly used for games, in business applications. This of course is not all that remarkable, since Java Swing has used DirectX for drawing for the last several years, and Windows “Vista” will use it for most of Windows itself. I’ll discuss this idea more in a later post; I’m investigating it here for a couple of Oasis Digital projects. On my list of tools to experiment with is Ruby + OpenGL; there is a RubyGarden page about it and another page here, unfortunately in Japanese. I found a ruby-talk post which indicates that it works quite well.

John McClenning pointed out Kororaa Xgl, a project which modified an X server to draw with the OpenGL API; there is a LiveCD of the Kororaa Linux distribution for trying this out. I’m downloading it now the torrent. Novell is also a sponsor of this effort.

(A plug: uTorrent is the best BitTorrent client I’ve seen so far: it is small, clean, featureful, usable, robust, ad-free, and free.)

Email2Face, a good idea

Jonathan Goodyear‘s ASPSOFT just announced Email2Face, a public database mapping email addresses to photos.  This strikes me as a good and useful idea.  If it gets some traction, it would be nice to have an email client plugin to automatically retrieve them.

http://www.email2face.com/

What I would really like to see is something with a similar results, but rather than be a project from one company, instead be open, scalable, and RESTful; perhaps some mapping from email address to web site containing information about the owner of the address.  For example, agree that for aaa@bbb.com, information will be a http://bbb.com/email/aaa/ and from there have links to specific kinds of information, such as… a face photo.

Rhino and Web Start

We discovered today that by default, Rhino (the Mozilla project’s Java-based JavaScript interpreter) does not work inside of a Web-Start-launched application; it fails with a permission error due to loading of dynamically created classes. After a few minutes of furious searching, it seems that there are surprisingly few mentions of this issue, which affects lots of other tools when used under Web Start; it makes be wonder how many projects are using Web Start.

A solution was forthcoming from Heng Yuan, who described it in detail in a Rhino Bugzilla entry, and provides a solution/workaround as part of his CookXml JavaScript Extension. Mercifully, you need only two classes from that package (which has a BSD-like license). These two classes depend on no other files therein; I’ve posted those for easy download:

CookXmlRhinoWebStart.zip

The lines needed to invoke them look like this:

// org.mozilla.javascript.Context

context.setOptimizationLevel(-1);

ProxyJavaAdapter.init(context, scope, true);