This past weekend I dusted off my prototypical Ruby implementation of Markov chains for the purposes of generating sentences that bear striking similarities to a corpus of sample text, but are in fact random nonesense text. My first exposure to this idea was the implementation in Kernigan and Pike’s Practice of Programming, but I’ve run across it a number of times since.
Most Markov text generation schemes I’ve run across are just for fun, like mixing the text characteristics of the Bible and Dr. Seuss or whatever.
I’ve run into a very annoying and seemingly serious gotcha in the YAML.rb implementation that ships with Ruby 1.8.6 patchlevel 0 i386-mswin32. The problem is surfaced when you attempt to serialize a Ruby string value with a trailing comma.
I just convinced my company to migrated from BugZilla to FogBugz On Demand, the hosted version of Fog Creek Software’s case tracking tool, FogBugz. FogBugz is a vastly better tool, but that’s a post for another time.
It’s been a while since I last reported on the status of my Wireshark wrapper for Ruby. This past Thanksgiving weekend I put alot of time into it, and I’m pretty pleased with the progress.
I’ve made a few major changes to accommodate my long-term use for this wrapper, which is to index and analyze hundreds of gigabytes of captured network traffic.
I’ve been playing around with CouchDb, and to that end I’ve been writing a little Ruby app to suck the DMOZ directory database into CouchDb, to see how it performs and get a feel for CouchDb’s idioms.
To do that I was using Libxml-Ruby, which is the closest thing to a performant XML API Ruby has. I ran into an issue using the XML::Reader object, which reads an XML file as a stream of nodes sort of like a pull version of a SAX parser.
I had my test code running great, only it would seemingly at random crash with:
I’ve been playing with CouchDB lately, and the CouchObject Ruby bindings. When I tried to install the latest CouchDB gem with sudo gem install couchobject-0.5.0 it fails because json isn’t installed. Then I ran sudo gem install json, which failed with:
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
ruby extconf.rb install json
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1
This page contains my notes on Ruby. Mostly it’s stuff I always forget and need to google each time I code something. It’s not meant to make sense to anyone but me.
def initialize() in ActiveRecord objectsI’ve not posted recently on the progress of my Ruby extension to wrap Wireshark’s packet dissectors and expose a complete protocol tree to Ruby.
I’ve finally reached a point where the initial groundwork is in place and I have a workable solution. I had severe performance problems, and ended up implementing a lookaside list to keep a cache of reusable C++ objects to avoid excess memory pressure, and also switched to use the Ruby memory allocator, which will trigger a GC if necessary to satisfy a memory request.
It’s hard to believe the previous episode was less than 24 hours ago. So much has changed.
Last time, I encountered horrifying performance with my Ruby extension, and had two action items:
I was actually shocked how easy it was to build Ruby from sources. Under windows it’s literally just:
win32\configure
nmake
nmake test
nmake DESTDIR=foo install