Grandparent of Ruby and Java: Eiffel and friends
I'm curious about the effort involved in writing a new programming language, and hence have been doing a little research (including watching Guy Steele's now-famous and amusing Growing a Language lecture). I know I want to target the NekoVM (primarily one of the targets of haxe, for now), but what languages should I base it on? One of the languages I've heard a good deal about about, mainly based on its design-by-contract principles, is Eiffel.
(even if you're not interested in building a new language, learning about programming languages and their design decisions increases our understanding of them and, hopefully, our proficiency with them)
Destructors in Ruby? Not quite…
So I was curious to see how destructors work in Ruby, and...they don't. Or rather, the method we do have, ObjectSpace.define_finalizer, is rather restrictive. But it does leave a loophole -- the callback method receives an object_id.
Sprockets — it's a good thing
Came across an interesting utility library: Sprockets. It's a Ruby-powered Javascript preprocessor. It's used for three things -- embedding other js files into the current js file, ensuring required assets get copied to the assets root, and for interpolating constants (like version numbers, author, etc) into the js file. I found it browsing Prototype.js's source -- really cool stuff. Also funny because I came across it by accident and I was just contemplating designing an identical tool. Good thing and bad thing at the same time
Ruby 1.9 and OpenSSL on Ubuntu
Having trouble getting openssl working on your Linux box and Ruby 1.9 (or 1.9.1, specifically)? Here's something to give a try...
CouchDB and logs…
I've taken it upon myself to do some log analysis at my work. This involves taking a large volume of logs (multiple gigabytes) and somehow organizing them so that the data stored within them are readily available. This is no small task. At present, there are thousands of individually gzipped files, and the best way to find what you're looking for is to essentially 'zcat *.gz | grep -in "session=123"' to get what you want and is, frankly, absurd. In some types of log files, you have 15 lines that all pertain to the same log record, with each line in the format KEY=monkeyfacevalue, and in others you have everything on the same line, with key/value pairs comma delimited. Doesn't really matter, but there are key-value pairs in both case, and no two log records necessarily have the same set of keys. This sounded like an opportunity to try out a new type of database...CouchDB.
But, in the end, I think CouchDB is not the best way to solve this problem...
Partial success!
For a good chunk of yesterday, I was trying to ""port"" my exceedlingly simple Ruby application to Windows. The hitch? It uses Gosu (game engine), Chipmunk (physics engine), ImageMagick (popular graphics tool), and RMagick (wrapper for ImageMagick in Ruby). With the help of RubyScript2Exe it almost, almost worked. Gosu and Chipmunk had no problem, as they had no-strings-attached .so files and apparently were programmed well. ImageMagick, despite trying to be a pain in the ass by making me include an extra dozen DLLs in my project folder, actually did end up working. But RMagick...when moving the generated app to a new computer that didn't have ImageMagick installed freaked out with a weird "address not accessible" error or something. After some fiddling I gave it up as a lost cause and dropped support for ImageMagick+RMagick. The only reason they were there in the first place is because I wanted to load SVG files whenever possible, and possibly have some dynamic graphic generation, but...the former isn't that great anyway, and the latter will have to be done other ways, if at all.
So, yes, Ruby+Gosu+Chipmunk play just fine with RubyScript2Exe on both Windows and Linux.
Distributing Ruby Apps
So I'm pondering the idea of writing a game...but I want it to be playable on Windows and Linux, and I want it to be available on Linux without much trouble. I've made a couple interesting discoveries, in terms of applications to help me do this.