I’ve been putting together an automated report for my team, and decided to give prawn and scruffy a try. I ended up using Gruff, but here are some of the lessons along the way: Scruffy has issues with bar charts and values from 1-3 (actual values were [1,3,1]). I was able to get around this …
Category Archive: ruby
Nov 25
Upgrading rubygems on Ubuntu
Maybe it’s me. Maybe it’s a feature of ubuntu, but on two separate systems, when I went to upgrade rubygems to the latest via gem update –system it didn’t work for me. So, I had to go the more extreme route of: gem install rubygems-updateupdatee_rubygems This is mostly for my own reference, it’s not the …
Sep 22
JRuby + jmx4r + rrd4j == Easy reporting on app servers (part I)
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 …
Sep 22
JRuby to check connectivity…
I had an issue reported by a developer where their jboss connection pool wasn’t working properly. It looked good to me, so I decided to verify that everything worked in so far as connectivity from the box. So, I used the following jruby script to help:
1 2 3 4 5 6 7 8 9 10 11 12 |
require 'rubygems' require 'jdbc' require 'java' Java::oracle.jdbc.driver.OracleDriver url = "jdbc:oracle:thin:@SERVER:1521:DB" user = "user" pass = "pass" conn = java.sql.DriverManager.get_connection(url,user,pass) stmt = conn.create_statement query = "select 1 from dual" rss = stmt.execute_query(query) puts rss.next? # did we get anything? |
Sep 12
Class is Class, and Instance, Instance, and never the twain shall meet
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 to keep me …
Sep 11
methods, public_methods, and private_methods
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.
Sep 11
universal cat redux
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 a hot …
Sep 10
cat on steroids (or cat on a hot ruby roof)
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 …
Sep 08
Random Quotes
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.
Sep 05
A “grue”some look at Statemachine and Treetop
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
$ 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 the forest, it looks fairly well travelled. You see a clearing to the east Paths lead w, n, e, s. What do you want to do? e This is a clearing. You can actually see the sky here. Compared to the deep dark forest, it seems a relief. A path can be seen to the west. Paths lead w, n, e, s. You see the following: letter. What do you want to do? get letter Ok, you pick up the letter. What do you want to do? w This is a path in the forest, it looks fairly well travelled. You see a clearing to the east Paths lead w, n, e, s. What do you want to do? w You're lost in the depths of the forest. You're not sure where you are, nor how to get out of there. Paths lead w, n, e, s. What do you want to do? quit |