Saturday, January 31, 2009

Los Angeles + Ruby = LARubyConf 2009

It is with great excitement that I want to tell all of you about the first annual Los Angeles Ruby Conference. Thanks to the fine efforts of a bunch of LA's hardworking Rubyists, and the generous financial support of AT&T Interactive, we are preparing to bring the noise to Los Angeles on April 4, 2009.

Too many of these wannabe cities have been smoking us with their regional conferences, but no more! Time for we Angelinos to step up and be counted among the world's important Ruby communities. All joking aside, it really is time for us to share our enthusiasm and experience, and grow beyond just the local scene.

I am helping out with the organization of the conference, which means a good chance to showcase other people. We are recruiting presenters, sponsors, and most importantly attendees! There will for sure be something for everyone, at all levels of experience.

Here is what you should do:

Want to attend? Register now for the early bird price of $75
Have something cool to talk about? We want your proposal
Want to sponsor the conference? Yes, we want you, click here

We need your support, people. Let's have a great time, learn from each other, and make it a big success. 'Nuff said.

Wednesday, January 28, 2009

Getting Async With Sinatra And Passenger Using spork


Everyone wants it all. In the case of upload processing, this means we want both the convenience of Sinatra coding, plus the performance that a nice process/threading model gives us. Go off and do some work I just assigned you, and don't make me wait around to see you do it.

If you are using Passenger, it already is buffering your uploads, and not calling your Sinatra application until the upload is complete. That saves system resources for more important things, like even more uploads. Pretty nice.

But a lot of work often has to take place after the upload is completed. A common example these days would be a video transcoding or image processing server. Once your user has uploaded their file, it would be considerate to let them go off and do something else. Sites like YouTube and Flickr have been doing exactly this for some time.

For certain highly transactional system, a solid message queue would be essential. But more humble needs, like an upload/transcoding/image thumbnail server, does not really need all of those extra moving parts.

Thanks to the power of the underlying Ruby language itself, it is very simple to fork off blocks of code into a separate process. Combining this with Passenger's already pretty robust process handling, and you get a pretty well performing solution with not much coding effort.

But wait... it does not work?! Sure enough, there are issues in the underlying interaction between Passenger and Rack, that you must address, or your long-running code will be just that, long-running, making the user sit there and wait for it to complete before Passenger allows Sinatra to return a response.

Enter spork... a blatant ripoff of both the spoon and the fork... I mean of the Spawn plugin for Rails, except with no actual Rails stuff in it, of course. spork handles the monkeypatching required to get things working the way they should be, and also lets you run under thin with no code changes should you so wish, like when running in development mode locally.

Anyhow, it may not be a glamorous implement, but it is a useful one. Have a look at spork if you are using Sinatra on Passenger, and you want to get all asynchronous on your users.

The Verdict Is In

For the last week or so, I have been serving on a jury in Department 45 of the Stanley Mosk Courthouse in downtown Los Angeles. Now that the trial is over, I am able to talk/blog/pontificate about my experience.

This was my first time actually serving on a jury, despite having come close a couple of times in the past. The case itself was a canonical example of how ridiculous big companies can be when fighting over money. The dispute was about billings between two very large insurance companies. Like you probably just did, my first comment was "a plague on both their houses." However, after executing the mental gymnastics for days of maintaining equipoise, once I had heard all of the evidence presented by both sides, I felt that the plaintiff had actually been wronged by the defendant. Both attorneys did an excellent job arguing their clients' positions, but the facts seemed reasonably clear to me from the evidence and testimony. At least as clear as anything can be almost ten years after the events had originally transpired.

Anyhow, this post is not about the case. It is actually an ode to my fellow jurors, and the legal system. I have had a slightly negative view of our legal system, like many citizens. But a duty is a duty, and so when the summons arrives, we all must answer. However, most people view it as a kind of 'reverse lottery', and dread jury service like an impending root canal.

The experience of actually serving on a jury, and seeing the legal system from the inside, has altered my perspective quite a bit. Despite coming from very different walks of life, all my fellow jurors had a real dedication to our task, as absurd as we all felt it to be. Nonetheless, we fell to our work with an amazing level of morale. We tried to smile at each other, and remain happy and attentive, even as the hours of hearing and seeing the evidence in the case wore on.

Here I have to remark on an odd, and to me extremely entertaining, coincidence. Ruby programmer and father of Rubinius Evan Phoenix was on the same jury. We had known each other superficially from RubyConf etc., but had never had a chance to hang out together, despite living in the same city. Lunching every day together really relieved the boredom of enduring the testimony, and bad PowerPoint, of the trial. Thanks for putting up with my loud comments!

The lawyers and judge projected a calm friendliness, even to each other, that defined 'professional courtesy'. Even after the cross-examination starting getting bloody. Yes, this was a kind of trial by combat, albeit one of words instead of arms, as I was slightly surprised to discover, after the pomp and ceremony of the opening statements, where the opposing counsel were merely thumping their chests and circling each other.

When the time came that we jurors could finally discuss the facts in the case, after not being able to discuss it with anyone, including each other, it was an incredible release. This was the logic in not permitting us to speak openly until the deliberation had begun. We each had already really defined where we stood relative to the evidence we had seen. The level of mutual respect that we had during this special conversation known as deliberating, was remarkable.

Credit to Evan who served as our lead juror. He did a great job keeping the forum open, and also moving us along to the final verdict.

As I leave my jury experience behind me, and return to my normal slew of programming stuff, I am reminded of Churchill's quote about democracy "the worst form of government except all the others that have been tried." E Pluribus Unum!

Sunday, January 25, 2009

In My Hood

I was taking my morning constitutional with my youngest son, when I noticed my neighbor who programs at JPL had added a new placard to the artistic decor attached to his fence.

And who says there is no software development in Los Angeles?

Friday, January 23, 2009

Get A Grep On TextMate

I really wanted to be all cool and retro by going back to EMACS, but my usual workload has kept me from figuring out the right environment for my Mac. In the meantime, programming pal and fun blogger Daniel Fischer turned me on to just one more reason to stay lazy.

TextMate is really quite a cool editor. However, one problem that annoys, especially when working on larger projects, is TextMate's "Find In Project". If you've ever literally had your entire machine lock up while doing a search, you know the pain.

Why do such a crappy search, when grep is just waiting to serve you? You like the pretty colors and do not wish to leave TextMate? Lucky for us, a wonderful human being in Sweden named Henrik has created a bundle that replaces TextMate's madness for a nice quick clean grep.

You need to get this right now, if you are using TextMate. You will save a LOT of time and frustration.

Wednesday, January 21, 2009

Sinatra and Passenger Back On The Rack

There is a new release of the Sinatra gem, version 0.9.1. This happens to work out well, since the newest Passenger 2.0.6 has a strong dependency on Rack 0.9, and the previous Sinatra 0.3 simply did not work at all due to dependency on Rack 0.4. The last few days have had some of us apoplectic over Ruby gem version hell.

And lots of interesting and even important things require all three. For example, I have been messing around with Integrity, a very cool little continuous integration server which is built using Sinatra. Foca and the rest of Team Integrity are still struggling with upgrading a morass of DataMapper gems, but this should help.

The point here, is getting everything up on Rack 0.9 seem to have made these problems go away, at least for my own Sinatra-based projects. Thanks to everyone who worked on these new releases, and special thanks to the IRC dwellers that provide support for the community.