-->

Ruby on Rails debugging / profiling tools

June 2nd, 2009

Long time with no updates, it’s been a busy time.

Here I’ll briefly recommend (I’ll not talk about how to install and use) two tools we’re using in the project I work for to profile Ruby on Rails.

First, on the developer side, is the rack-bug Rails plugin.

RackBug is a developer toolbar that is injected in the top of every page in the application when they are rendered. This toolbar displays very useful profiling informations like number of queries run, time taken doing tasks, and many others. For projects facing scalability and performance challenges, it’s specially useful to see witch queries were run and you have the option to (SQL-) profile or explain them.

The second one, a la “enterprisey” and on the sysadmin side, is the NewRelic.

NewRelic brings on the monitoring, profiling and troubleshooting to a more sophisticated level in medium-sized projects. You install it, it collects informations about the application and this info is displayed in newrelic site, like a Google Analytics for Rails applications.

Update: just saw on railscasts.com: Three Profiling Tools. So, if you want to know more about these tools, check it out!

0 comments »

RCE : Array.slices

March 5th, 2009

We all like how Ruby is flexible. It’s flexible enough to increase its flexibility and when we want to go further, it’s time for a Ruby Core Extension (or RCE).

This time I was wondering if it’s possible to, from an original Array, get multiple subarrays which are slices from the original. As you maybe thinking now, it’s not. So I wrote this simple extension:

Now you can use:

1
2
3
4
5
6
7

>> a = (0..5).to_a
=> [0, 1, 2, 3, 4, 5]
>> a.slices(0, 1..3, 5)
=> [0, [1, 2, 3], 5]
>> a.slices(0..0, 1..3, 5)
=> [[0], [1, 2, 3], 5]

Passing integers to slices() makes it to return single elements, while passing Ranges, it returns subarrays.

1 comment »

A list of Linux desktop applications

February 9th, 2009

I’ll be honest: I spend too much time searching, downloading, using, testing and trying new applications. Sometimes I go further: I download source codes, compile by myself – often spend 90% of the total experience in this process – and for a smaller subset of this applications, that I judge to be worth it, I kill some bugs. For a even smaller subset of these, I submit the patch. The cause of this is that I’m never satisfied by what I find out there. Its no fault of the software developers, that’s me, maybe it’s the “human nature”. But I don’t care about the cause, what I’m definitively frustrated about is the result I got from all this. What concerns me is: what was all this for? And its a concern because of the answer, and this post is the answer. I compiled an application list to post in my blog. So nice. But no problem, as long as I do it with passion. (You doubt? You shouldn’t. I’m really good in wasting time compiling a tremendous useless piece of software.)

Ok, enough whining, let’s go to it.

Because I’m currently in the desktop limbo, between the not-ready-and-very-unstable-KDE4 and I’m-not-gonna-use-the-nazi-interface-produced-GNOME*, i.e., I’m using XFCE 4 (which actually is very, very good); then I’ll try to remember and list applications suitable for both environments or desktop-agnostic apps (which use only GTK+ or Qt3/4 libraries).

* Torvalds vs GNOME

IRC

Microblogging

More info on this topic here: Twitter Fans

Instant Messaging

Music

Do you use separate applications for tag editing, music playing and library management? Come on. Let these little poor apps aside. I’ve found at least two good ones that does it all:

Both do a decent job maintaining your library, mass editing tags and, after all, playing music. But I’ve experienced some bugs with Exaile while using some of its plugins.

And there’s my favorite choice of all, but… you know that feeling of when you like so much, for example, an actor or, even better, a band, a musician or a singer, then they release a new work that goes completely against your taste/beliefs? Well, that’s the felling I’m talking about.

Desktop usability

Since I experimented KDE4 for the first time, now I’m a desktop usability psycho. What I mean for “desktop usability” is: easy application launching, good interoperability with internet applications, fast and easy location of “things” and the better: all of this in a single mini, unobtrusive, box that shows itself by a single keyboard shortcut. Yes, I’m talking about the various application launchers that goes beyond that concept of just launching applications (What the hell? Well, is that the way they refer to themselves). Really good ones are:

System monitoring

Hey, STOP looking for it. This comes from the revolutionist adolescent era and trust me kids, the last thing you will be willing to have in your desktop at 5 in the morning, when you’re blown with the amount of coffee you ingested, is a stupid text blinking showing the CPU usage or disk IO.

Terminal emulator

Each official one from each desktop (xfce4-terminal, konsole and gnome-terminal) are really good, but they don’t have the mojo! Do you ever played First Person Shooter games like Quake? Ever used their consoles to type commands? Then you’ll be willing to see terminal emulators like these:


Alright, seems to be a fair list of things commonly used in a desktop. I’ll update it as I remember of more apps. Soon I’ll collect some useful web apps (to give a taste: GMail, delicious and Flickr are in) and this one will be much more harder to do.

3 comments »

Import a plain text URL list to del.icio.us

February 8th, 2009

If you have a plain text list of URLs that you want to import to del.icio.us, but do not want to import into a browser bookmarking system first (since delicious only imports files in the various browsers bookmarks formats), then you should probably go this way:

This is a Python (2.5) script that uses the great pydelicious library. The information to use it are inside, in the header comments.

One thing to note: it will, by default, replace your existing posts in delicious, and currently there’s no way of specify a different behavior. Please pardon me, I did it in 10 minutes (documenting it actually took half of this time) just to send bookmarks I stored in a text file or in draft emails in my Gmail account.

1 comment »