Ruby’s Enumerable module provides a couple of methods for stepping through an enumerable with the index of the element as well. However, a couple are missing — there is no inject_with_index or map_with_index. There are a couple of ways of remedying this.
Category Archive: ruby
Sep 30
From the vaults…. on Parentheses
To paren, or not to paren: that is the question: Whether ’tis nobler in the mind to suffer The bugs and errors of maintenance programs, Or to take arms against a host of typos, And by debugging end them? To hack: to slash; No more; and by a slash to say we end The heart-ache …
Dec 24
Merging Records with Uncertainty
I’m in the process of revisiting and migrating a service I’d first written almost five years ago; one of the backend data sources has changed (drastically!) so I’m looking at refactoring as well as streamlining in the process — parsing the new backend takes longer than the old. Part of the reason for doing so …
Jun 22
cygwin and torquebox and rvm, oh my!
rvm, despite being wonderful, doesn’t play very well with torquebox under cygwin. In particular, the gem paths are not working. So, in order to fix this, simply do: rvm use system And then it will work right. Once you’re done with the torquebox work, you can go back to using rvm.
Jun 09
Torquebox and Cygwin: Take I
Torquebox and Cygwin don’t work as nicely together as one might hope. That said, here are a couple of findings: In order to deploy, you need to set the $JBOSS_HOME with the Windows path. You can do this via export JBOSS_PATH=cygpath -w PATH_TO_JBOSS. Additionally, the JRUBY_HOME needs to be a windows path as well. Otherwise …
Mar 02
Rails & JRuby in a Jar
This is a discussion of what I needed to do to put rails and JRuby together in a single jar.
Sep 01
Fractal Terrain Generation
Aug 25
Using jnp as a JBoss heartbeat
jnp is a JBoss protocol which exposes jndi. It is, by default, bound to port 1099. I’d been using that port as a heartbeat, but “cheating” — I would open a socket and then close it immediately. However, this caused problems. jnp is chatty. And it got upset at my not letting it say ‘hi’ …
Feb 05
Web Based Portable mysql tool suite
Are you limited in what software you can use at work? This article details how to have a web based tool suite for mysql. It currently has the following tools: AjaxMyTop — a php implementation of mytop (think top for mysql) which runs in a browser. rbdb — a phpmyadmin work-alike in progress. It’s the …