Why ruby? part three – method arguments

Table of contents for Why ruby?

  1. Why ruby? part one – a classy class system
  2. Why ruby? part two – blocks and closures
  3. Why ruby? part three – method arguments

This is the third part of my series: “Why ruby” – this time I quickly run through using method arguments, their types and some examples.

 
Read More

A dead simple trick to detect top unindexed or badly indexed mysql queries

The ingredients are:

1. tcpdump – check your local package distributor ( apt-get, pkg_add, etc.)

2. a great maatkit tool, mk-query-digest – use wget http://www.maatkit.org/get/mk-query-digest to fetch the simple perl script, then chmod +x it, and move to a dir in path

When the stage is set, cast the following mystic spell:

tcpdump -i eth0 port 3306 -s 65535  -x -n -q -tttt | mk-query-digest \
--type tcpdump  --filter '($event->{No_index_used} \
|| $event->{No_good_index_used})'

Of course replace eth0 with the proper interface and do similarly with the port if mysql listens on a non-default one.

Let it run for a while, possibly redirecting its stdout to a log file, then ctrl-c the beast and study the output. You will be surprised how useful this can prove.

 
Read More

Sun’s JRuby team moves to Engine Yard

So this day has come… Charles Nutter, Thomas Enebo and Nick Sieger are leaving Sun, moving to Engine Yard, the major Rails hosting and development company. The guys refer to the uncertainty generated by Oracle buying Sun. Along with Ola Bini, they are my personal heroes, creators of the wonderful piece of work: JRuby, so I wish them the best, have much more fun on the path of developing JRuby.

 
Read More

Why ruby? part two – blocks and closures

Table of contents for Why ruby?

  1. Why ruby? part one – a classy class system
  2. Why ruby? part two – blocks and closures
  3. Why ruby? part three – method arguments

Let’s go on with diving into the beauties of ruby – this time check out how elegant blocks and closures and their first-class support in ruby can make our codes.

 
Read More

A quick and dirty jruby mysql jdbc wrapper

I’ve started using jruby more and more, but I’m a bit unsatisfied by the current status of mysql support, the jdbc api is a bit cumbersome to me (of course only after getting lazy because of the convenience of the original ruby mysql gem) – especially about SELECTs and using their result set. Thus, I wrote a small callback wrapper, see below:

 
Read More
Page 3 of 612345...Last »