Movember Day 29: Thanks @ana_crt! (Also, orthodontist mo!)

Special and awesome thanks to Ana for donating! 2 more days to go, get your donation in now and be awesome like Ana!  With her donation and one from Jason, I’m at $586.  It would be awesome to break 600. (More awesome would be $1000, but I’m being realistic.)

To celebrate, Ana (and everyone else) gets a “I’m at the orthodontist” picture!

Movember Day 24: Mustache in the Huddle House

I haven’t posted in a bit, but I haven’t thrown in the towel yet. I’ve been so busy I haven’t been able to say: seriously, I’m being goofy for a good cause, if you can, please donate. It’s only 6 days until the stache goes away. The mustache is temporary, a cure for testicular or prostate cancer can be forever!


FFI for Ruby and an mp4v2 example

Previously on my blog: In my TiVo2Podcast stuff I automated the process of putting chapters around commercials, but had to call out to a small C++ app I wrote to put the chapters in using libmp4v2.

A few weeks ago I was looking at some ruby gems for a project I was working on and stumbled across ffi, a foreign function interface gem for ruby, or as its docs put it: “a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code.”  As long as you know the function signatures that you need, its pretty trivial to make the calls from Ruby. You do need to be aware of memory management stuff sometimes, but overall its pretty easy, especially for basic use. If you’re only going to be working in Ruby and need access to a C library, this is much easier than mucking with swig, that’s for sure.

The mind-blowing part for me is that the authors of the gem have made it smart enough to know what flavor of ruby vm and platform the code is running in and it does the right thing, no matter if its JRuby or on Windows or whatever. While I haven’t had a chance to use it yet, I suspect this property will be useful with JRuby at work in the future.
Continue reading ‘FFI for Ruby and an mp4v2 example’ »