Ramblings

Posts Tagged ‘ruby

This is a how-to for using jmx and rrd4j, a java implementation of rrdtool, to report on app server statistics.
Thanks to Jeff Mesnil(author of jmx4r), Werner Schuster (JMX the Ruby way with jmx4r), sishen (JRobin sucks), and the rrd4j team.
You’ll need the following:

JVM 1.5 or higher — JRE is not enough, you also need the [...]

More about methods, it’s inspired/spurred by a comment on methods, public_methods, and private_methods by Pit Captain. It also corrects some misconceptions I had (and may have (wrongly) given others).
I’ve added a new category, “eating crow” for this and any other postings where I step back and re-evaluate my posts. This is [...]

11 Sep, 2008

methods, public_methods, and private_methods

Posted by: Matt Williams In: programming| ruby| tips

Ruby’s Object has a method, methods. You can use it to see the methods which an object has. Sort of. In this post I’m examining methods, public_methods, and private_methods as well as some of their implications.

11 Sep, 2008

universal cat redux

Posted by: Matt Williams In: programming| refactoring| ruby| utilities

I have a neglectful relationship with inject. That is, I neglect to remember that it exists, having worked for so long with other languages which are “unfamiliar with the concept”. Amos King’s blog entry on Inject & Me - BFFs got me to thinking that ucat (see cat on steroids (or cat on [...]

10 Sep, 2008

cat on steroids (or cat on a hot ruby roof)

Posted by: Matt Williams In: programming| ruby| utilities

I got to thinking about SuperIO and how it could be used as a swiss army chainsaw to open files, whereever they might be on the net.  From there, my fevered mind got to thinking about cat and how the two could be used together.  That said, I present ucat — a universal cat, if [...]

08 Sep, 2008

Random Quotes

Posted by: Matt Williams In: ruby

Quotes can provide inspiration or food for thought.  In this entry, I’m examining the use of open-uri and feed-normalizer to get a random quote which could be used as either a thought for the day or a “fortune” replacement.

05 Sep, 2008

A “grue”some look at Statemachine and Treetop

Posted by: Matt Williams In: games| gotchas| ruby

In this blog entry, dear reader, we examine the statemachine and treetop gems via an old standby, a Zork imitation.  And, despite the title, you won’t find a grue.
$ ruby adventure.rb
This is the beginning. Like all tales, there’s a beginning, a middle and an
end….

Paths lead n.

What do you want to do?
n

This is a path in [...]

26 Aug, 2008

Why my code is broken….. (break my code redux)

Posted by: Matt Williams In: gotchas| programming| ruby

Yesterday, I posted an article entitled Break my code, please, wherein I posted a very fragile piece of code, with the challenge to find ways in which to break it.
What follows is a discussion of the code and why it is bad/fragile/easily broken…..

25 Aug, 2008

Break my code, please

Posted by: Matt Williams In: gotchas| programming| ruby

There’s a number of things we can should take into account when writing code — boundary cases, etc., that can make or break a programme.  Yes, testing is important, but I think that developing good defensive programming practices is even more important.  That said; I present the following, fragile, code.  Just about every line has [...]

22 Aug, 2008

Ruby’s ObjectSpace: Subclasses

Posted by: Matt Williams In: ruby

One of the (imho) lesser used pieces of the Ruby language is ObjectSpace.  In this article I’ll show one of the things you can do with it — get all the subclasses of a class.


Categories

DrakNet Web Hosting