Blog

My personal blog, featuring opinions, insights and rants about Ruby on Rails, the Internet, programming, productivity, random thoughts and occasional oddities. My blog posts tend to be shorter than my articles, biased and straight to the point.

Code

A few, hopefully useful, open-source programs, scripts, plugins and code snippets made by myself. Nothing too fancy, just something made in my lunch breaks, mostly (you have been warned).

Articles

Mostly programming-related articles, technology round-ups and reviews of software, websites or cool services. Note that articles are not blog posts: they are (much) longer, slightly less biased and more interesting, or at least I’d like them to be. Enjoy!

Book Review: Design Patterns in Ruby

Posted by h3rald Fri, 11 Apr 2008 11:41:00 GMT

I finally got my hands on a shiny new copy of Design Patterns in Ruby1. The book itself is not brand new and it was already widely praised by many different people online, so I wanted to take a look for myself.

To my surprise, the book is a hardcover edition, which makes it look more professional and more durable than the average programming book2. It’s also smaller and shorter than the average programming book2 (340 pages), which makes it much easier to carry around and less intimidating to read. It’s also not meant to be a reference book, so it is actually pleasant an easy to read all in one go, as you’ll soon find out.

What is it about? — well, design patters in the Ruby language of course. But it’s not the usual brainwash of programming theory you would expect by a typical book on patters, it has plenty of examples of real code. When I say real code I don’t mean the usual Dog/Cat/Horse/<insert animal here> classes or juke-box simulations which don’t work at all etc. etc., I mean actual snippets from well known Ruby applications, like RubyGems, FXRuby and, of course, Rails. OK well, there’s an exception perhaps: Russ did include a few wild life simulations (ponds with frogs and similar), but it’s only for your own good, and for the sake of tradition.

Anyhow, let’s start from the beginning…

Read more...

Posted in  | Tags , ,  | 1 comment | no trackbacks

New Release: RawLine 0.2.0

Posted by h3rald Wed, 02 Apr 2008 11:33:00 GMT

InLine RawLine 0.2.0 is out!

RawLine is the new name for InLine, in case you didn’t guess. The name was changed to avoid name collision problems with the RubyInline project.

Here’s what’s new:

  • Added /examples and /test directory to gem.
  • Escape codes can now be used in prompt.
  • It is now possible to use bind(key, &block) with a String as key, even if the corresponding escape sequence is not defined.
  • Added Editor#write_line(string) to print a any string (and “hit return”).
  • Library name changed to “RawLine” to avoid name collision issues (Bug 18879).
  • Provided alternative implementation for left and right arrows if terminal supports escape sequences (on Windows, it requires the Win32Console gem).

In particular, I decided to provide an “optimized implementation” for the left and right arrows using escape sequences rather than shameful hacks. This is now possible because the Win32Console gem now enables ANSI escape sequences on Windows as well (weehee!).

So:

  • If you’re on *nix all good, your terminal is smart and can understand escape sequences => the new implementation will be used.
  • If you’re on Windows and you installed Win32Console, your termnal is smart and can understand escape sequences => the new implementation will be used.
  • If you’re on Windows and you didn’t install Win32Console, then your terminal is stupid and it doesn’t understand escape sequences, so the old implementation will be used.

The new implementation is significantly faster than the old one, on Windows at least, and the cursor now blinks properly when left or right arrows are pressed.

I re-emplemented only cursor movement because I’m still having some problems in getting the delete/insert escapes to work properly (or better: how I want them to work!).

Posted in  | Tags , , ,  | no comments | no trackbacks

InLine name change: what's your opinion?

Posted by h3rald Thu, 27 Mar 2008 12:30:00 GMT

I’ve been kindly asked by the lead developer of RubyInLine to change the name of my InLine project, due to potential confusion and conflicts.

This makes sense, and I’m ready to change the name of my project, although I’m not that good at choosing original and smart names, so well, any suggestion is more than welcome!

I was thinking of something like:

  • RawLine
  • EditLine
  • RawInput
  • RubyInput
  • RubyLine

I personally think that RawLine is probably the best option, but please, if have any better idea just speak up!

P.S.: “RedLine” is taken, unfortunately, otherwise it would have been my first choice since the beginning.

Posted in  | Tags , , ,  | 3 comments | no trackbacks

RawLine - a 100% Ruby solution for console inline editing

Posted by h3rald Mon, 10 Mar 2008 12:59:00 GMT

One of the many things I like about Ruby is its cross-platform nature: as a general rule, Ruby code runs on everything which supports Ruby, regardless of its architecture and platform (yes, there are quite a few exceptions, but let’s accept this generalization for now).

More specifically, I liked the fact that I could use the GNU Readline library with Ruby seamlessly on both Windows and Linux. Readline offers quite a lot of features which are useful for those people like me who enjoy creating command-line scripts, in a nutshell, it provides:

  • File/Word completion
  • History support
  • Custom key bindings which can be modified via .inputrc
  • Emacs and Vi edit modes

Basically it makes your command-line interface fast and powerful, and that’s not an overstatement. Ruby’s own IRB can be enhanced by enabling readline and completion, and it works great—at least on *nix systems.

For some weird reason, some people had problems with Readline on Windows: in particular, things get nasty when you start editing long lines. Text gets garbled, the cursor goes up one or two lines and doesn’t come back, and other similar leprechaun’s tricks, which are not that funny after a while.

Apparently there’s no alternative to Readline in the Ruby world. If you wan’t tab completion that’s it, you’re stuck. Would it be difficult to implement some of Readline functionality natively in Ruby? Maybe, but the problem is that for some reason the Ruby Standard Library doesn’t have low level methods to operate on keystrokes…

…but luckily, the HighLine gem does! James Edward Gray II keeps pointing out here and here that HighLine’s own get_character method does just that: it returns the corresponding character code(s) right when a key is pressed, unlike IO#gets() which waits for the user to press ENTER.

Believe it or not, that tiny method can do wonders…

Read more...

Posted in  | Tags , , ,  | 9 comments | no trackbacks

Book Review: Writing Efficient Ruby Code

Posted by h3rald Mon, 21 Jan 2008 12:47:00 GMT

The second shortcut from Addison-Wesley Professional series I’m going to review is called Writing Efficient Ruby Code. A very promising title, especially considering that this book is only 50 pages long.

As usual, this shortcut can be intended as a sort of programmer-friendly detailed cheatsheet: like the other ones in this series it sports a monitor-friendly landscape layout and does not go to deep into the details unless strictly necessary to understand a particular concept.

Read more...

Posted in  | Tags , ,  | 2 comments | no trackbacks

A Firefox Lover's Guide to Opera

Posted by h3rald Fri, 28 Dec 2007 21:19:00 GMT

Note: This article can be considered a sequel for An IE Lover’s Guide to Firefox, which described Firefox through the eyes of an Internet Explorer fan. Similarly, this article describes Opera’s features from the point of view of a user – myself – who has been using Firefox for years and is now considering another browser switch.

I am a Firefox fan. I’ve been using Firefox since it was named “Firebird” and calling it “stable” was a big overstatement. Firefox dragged me out of Internet Explorer, and that was definitely one of its biggest achievements.

Because I’m addicted to trying out new tools, however, I always kept testing new browsers I discovered here and there. K-Meleon, Flock, Sleipnir… When Safari came out for Windows I immediately installed it and used it for about 2 hours, only to realize that it wasn’t – and it still isn’t – usable at all, mainly due to sporadic crashes.

Similarly, I’ve been trying out Opera periodically, as new releases came out, but again it didn’t seem to work for me. The biggest complaint I had was its inability to render heavily-ajaxified web sites properly. However, now it seems that the Opera Development Team made a big effort to improve the browser, and I was pleased to notice that Opera 9.5b (“Kestrel”) doesn’t seem to have this sort of problems at all.

Read more...

Posted in  | Tags , , , , ,  | 22 comments | no trackbacks

Beware of sudden upgrades!

Posted by h3rald Thu, 20 Dec 2007 14:41:00 GMT

Yesterday I got a rather annoying early Christmas present: when visiting my site, I noticed that the raw source code of my dispatch.fcgi file (yes, I’m on shared hosting with FastCGI, for now) was displayed “as it is” instead of being interpreted.

After the initial moment of anger and stress (I immediately realized it was BlueHost’s fault, not mine), I opened two tickets and went to bed, hoping to see everything solved in the morning.

Unluckily it wasn’t the case, so I posted on BlueHost forum trying to be as polite as possible complaining because the issue wasn’t being dealt with. It turns out that for such issues you’re supposed to use the “Live Chat” feature instead of the tickets, so that’s what I did.

After a quick chat with “Christian”, it turns out that BlueHost decided to perform a server upgrade “silently” upgrading to Apache2, PHP5, MySQL4.1, etc. etc. Cool, pity that nobody told me that!

I was expecting some sort of PHP upgrade (not that I care like that), which was supposed to happen according to the last BlueHost newsletter:

“To alleviate any issues in the future with certain scripts that only run on one version of PHP we have developed the ability to run PHP4 and PHP5 on the same server simultaneously. This will be rolled out to all users in the next couple of weeks. Some servers already have this ability while most will see it in the next two weeks.”

But… hang on? Does it say anything about migrating to Apache2? I don’t think so! What’s worse, is that quite a few things changed with Apache2, in particular the way FastCGI handlers are declared:

# Apache 1.3:
AddHandler fastcgi-script .fcgi

# Apache 2:
AddHandler fcgid-script .fcgi

See? Different. This is due to the fact that mod_fcgid is used instead of mod_fastcgi on Apache 2.

The fix was easy, of course, and now my site is up and running again (and actually running faster)… but, I wonder, why the hell wasn’t I informed? Is it acceptable? It sounds like I might end up on a VPS sooner than expected, unless BlueHost doesn’t roll out some new exciting feature soon, as I think it might…

Posted in  | Tags ,  | 6 comments | no trackbacks

Announcement: RedBook v0.5.0 released

Posted by h3rald Sun, 16 Dec 2007 15:07:00 GMT

This new beta release of RedBook introduces quite a few changes when it comes to configuration and setup. Here’s some highlights…

Read more...

Posted in  | Tags , , ,  | no comments | no trackbacks

Book Review: Mongrel Digital Shortcut

Posted by h3rald Sat, 15 Dec 2007 10:42:00 GMT

If you ever considered about developing an deploying a Rails application in the last year or so, you must have heard of Mongrel before. If you didn’t, I’d recommend you learn more about it because up to now it proved to be one of the few essential ingredients for deploying scalable Rails applications.

Mongrel is a creation of Zed Shaw who started writing a replacement for FastCGI to use with Rails, and ended up creating a brand new, HTTP web server who turned out to be one of the best things the Rails community ever saw happening.

It was created to be simple to use and configure, nevertheless it does require some skill to set it up and tune it. Documentation is there, along with plenty of blog posts, but there’s also an interesting book from Addison Wesley Professional which is definetely worth a read.

“Mongrel: Serving, Deploying, and Extending Your Ruby Applications” – that’s the title of the book. A Digital Shortcut, 100-odd pages long, in landscape format to make it easier to read on a computer, straight to the point with no added sugar for just 15$ (PDF only). I must say Addison Wesley got it right: the book’s format is, as a matter of fact, optimized for web developers, especially those who can’t afford to read a 500-pages book covering everything about a subject just to find that one thing they don’t know about. This shortcut can be seen, essentially, as an expanded cheatsheet which will teach you the basics about Mongrel and also give you plenty of advice on how to learn more about it.

Let’s have a closer look at it.

Read more...

Posted in  | Tags , , ,  | no comments | no trackbacks

Review Services

Posted by h3rald Fri, 14 Dec 2007 19:24:00 GMT

When it comes to software, I definitely like to try out new things. My collegues takes the piss out of me because every week day I come up with “some new tool they have to start using” and so on. As a matter of fact, I like reviewing software as well. I enjoy writing and analyzing new things, evaluating all the new possibilities they may offer, and I also tend to have a rather critical eye for what doesn’t feel right. I’ll use a tool for months but still try out new ones which claim to do the same thing — but better — as they come out. Unfortunately — or fortunately, depends how you look at it — when it comes to software, there are very few silver bullets, and things keep changing: that’s the way it is and the way it will be.

I must try to write up a page (and ideally update it regularly, that’s the hard part) listing all the tools I use, at some point… but at any rate, if you coded some new app you think kicks ass or you found a hidden jewel in the labyrinth of freeware, just let me know: I’ll definitely try it out, and if it’s worth a post I’ll blog about it.

The same applies to books, actually, as I like reading, especially those which are related to Ruby or programming, nowadays.

The cost of such reviews and articles? Depends! Certainly I wouldn’t mind donations or some compensation of some form, especially from publishers or software companies. It may be money, books, software or even nothing: it really depends on what I have to review. Please be aware that I am not doing this full time, and I already have a job and a fiancée to look after, but I’ll do my best to publish as much as I can on my site or even elsewhere elsewhere [Note: on e-zines, magazines & similar, not on your brother’s friend’s mother-in-law’s crappy blog!].

For any inquiries, contact me (h3rald [—at—] h3rald.com).

Posted in  | Tags , , , ,  | 1 comment | no trackbacks

Older posts: 1 2 3 ... 9