<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>H3RALD: Blog</title>
    <link>http://www.h3rald.com/blog</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Fabio Cevasco's Writings</description>
    <item>
      <title>New Release: RawLine 0.2.0</title>
      <description>&lt;p&gt;&lt;del&gt;InLine&lt;/del&gt; RawLine 0.2.0 is out!&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Raw&lt;/strong&gt;Line is the new name for InLine, in case you didn&amp;#8217;t guess. The name was changed to avoid name collision problems with the RubyInline project.&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s what&amp;#8217;s new:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Added /examples and /test directory to gem.&lt;/li&gt;
		&lt;li&gt;Escape codes can now be used in prompt.&lt;/li&gt;
		&lt;li&gt;It is now possible to use bind(key, &amp;#38;block) with a String as key, even if the corresponding escape sequence is not defined.&lt;/li&gt;
		&lt;li&gt;Added Editor#write_line(string) to print a any string (and &amp;#8220;hit return&amp;#8221;).&lt;/li&gt;
		&lt;li&gt;Library name changed to &amp;#8220;RawLine&amp;#8221; to avoid name collision issues (Bug &lt;a href="http://rubyforge.org/tracker/?func=detail&amp;#38;aid=18879&amp;#38;group_id=5622&amp;#38;atid=21788"&gt;18879&lt;/a&gt;).&lt;/li&gt;
		&lt;li&gt;Provided alternative implementation for left and right arrows if terminal
supports escape sequences (on Windows, it requires the Win32Console gem).&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;In particular, I decided to provide an &amp;#8220;optimized implementation&amp;#8221; for the left and right arrows using escape sequences rather than shameful hacks. This is now possible because the Win32Console gem now enables &lt;span class="caps"&gt;ANSI&lt;/span&gt; escape sequences on Windows as well (weehee!).&lt;/p&gt;


	&lt;p&gt;So:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;If you&amp;#8217;re on *nix all good, your terminal is smart and can understand escape sequences =&amp;gt; the new implementation will be used.&lt;/li&gt;
		&lt;li&gt;If you&amp;#8217;re on Windows and you installed Win32Console, your termnal is smart and can understand escape sequences =&amp;gt; the new implementation will be used.&lt;/li&gt;
		&lt;li&gt;If you&amp;#8217;re on Windows and you didn&amp;#8217;t install Win32Console, then your terminal is stupid and it doesn&amp;#8217;t understand escape sequences, so the old implementation will be used.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;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.&lt;/p&gt;


	&lt;p&gt;I re-emplemented only cursor movement because I&amp;#8217;m still having some problems in getting the delete/insert escapes to work properly (or better: how I want them to work!).&lt;/p&gt;</description>
      <pubDate>Wed, 02 Apr 2008 05:33:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:6241d85c-e816-4c5c-9e9e-61a4f87d59de</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/rawline-020</link>
      <category>Blog</category>
      <category>ruby</category>
      <category>programming</category>
      <category>OpenSource</category>
      <category>RawLine</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/156</trackback:ping>
    </item>
    <item>
      <title>InLine name change: what's your opinion?</title>
      <description>&lt;p&gt;I&amp;#8217;ve been kindly asked by the lead developer of &lt;a href="http://www.zenspider.com/ZSS/Products/RubyInline/"&gt;RubyInLine&lt;/a&gt; to change the name of my &lt;a href="http://rubyforge.org/projects/inline/"&gt;InLine&lt;/a&gt; project, due to potential confusion and conflicts.&lt;/p&gt;


	&lt;p&gt;This makes sense, and I&amp;#8217;m ready to change the name of my project, although I&amp;#8217;m not that good at choosing original and &lt;em&gt;smart&lt;/em&gt; names, so well, any suggestion is more than welcome!&lt;/p&gt;


	&lt;p&gt;I was thinking of something like:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;RawLine&lt;/li&gt;
		&lt;li&gt;EditLine&lt;/li&gt;
		&lt;li&gt;RawInput&lt;/li&gt;
		&lt;li&gt;RubyInput&lt;/li&gt;
		&lt;li&gt;RubyLine&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;I personally think that &lt;strong&gt;RawLine&lt;/strong&gt; is probably the best option, but please, if have any better idea just speak up!&lt;/p&gt;


	&lt;p&gt;P.S.: &amp;#8220;RedLine&amp;#8221; is taken, unfortunately, otherwise it would have been my first choice since the beginning.&lt;/p&gt;</description>
      <pubDate>Thu, 27 Mar 2008 06:30:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:cbe78136-e994-4e16-92c2-d6dae16fc9c7</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/inline-name-change</link>
      <category>Blog</category>
      <category>ruby</category>
      <category>programming</category>
      <category>OpenSource</category>
      <category>RawLine</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/153</trackback:ping>
    </item>
    <item>
      <title>RawLine - a 100% Ruby solution for console inline editing</title>
      <description>&lt;p&gt;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&amp;#8217;s accept this generalization for now).&lt;/p&gt;


	&lt;p&gt;More specifically, I liked the fact that I could use the &lt;a href="http://tiswww.case.edu/php/chet/readline/rltop.html"&gt;&lt;span class="caps"&gt;GNU&lt;/span&gt; Readline library&lt;/a&gt; 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:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;File/Word completion&lt;/li&gt;
		&lt;li&gt;History support&lt;/li&gt;
		&lt;li&gt;Custom key bindings which can be modified via .inputrc&lt;/li&gt;
		&lt;li&gt;Emacs and Vi edit modes&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Basically it makes your command-line interface fast and powerful, and that&amp;#8217;s not an overstatement. Ruby&amp;#8217;s own &lt;span class="caps"&gt;IRB&lt;/span&gt; can be enhanced by enabling readline and completion, and it works great&amp;#8212;at least on *nix systems.&lt;/p&gt;


	&lt;p&gt;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&amp;#8217;t come back, and other similar leprechaun&amp;#8217;s tricks, which are not that funny after a while.&lt;/p&gt;


	&lt;p&gt;Apparently there&amp;#8217;s no alternative to Readline in the Ruby world. If you wan&amp;#8217;t tab completion that&amp;#8217;s it, you&amp;#8217;re stuck. Would it be difficult to implement &lt;em&gt;some&lt;/em&gt; of Readline functionality natively in Ruby? Maybe, but the problem is that for some reason the Ruby Standard Library doesn&amp;#8217;t have low level methods to operate on keystrokes&amp;#8230;&lt;/p&gt;


	&lt;p&gt;&amp;#8230;but luckily, the &lt;a href="http://highline.rubyforge.org/"&gt;HighLine&lt;/a&gt; gem does! James Edward Gray II keeps pointing out here and here that HighLine&amp;#8217;s own &lt;code&gt;get_character&lt;/code&gt; method does just that: it returns the corresponding character code(s) right when a key is pressed, unlike &lt;code&gt;IO#gets()&lt;/code&gt; which waits for the user to press &lt;span class="caps"&gt;ENTER&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;Believe it or not, that tiny method can do wonders&amp;#8230;&lt;/p&gt;


	&lt;h2&gt;Reverse-engineering escape codes&lt;/h2&gt;


	&lt;p&gt;So here&amp;#8217;s a little script which uses &lt;code&gt;get_character()&lt;/code&gt; in an endless loop, diligently printing the character codes corresponding to a keystroke:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="comment"&gt;#!/usr/local/bin/ruby -w&lt;/span&gt;

&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rubygems&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;highline/system_extensions&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="ident"&gt;include&lt;/span&gt; &lt;span class="constant"&gt;HighLine&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;SystemExtensions&lt;/span&gt;

&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;Press a key to view the corresponding ASCII code(s) (or CTRL-X to exit).&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;

&lt;span class="ident"&gt;loop&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;

    &lt;span class="ident"&gt;print&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;=&amp;gt; &lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
    &lt;span class="ident"&gt;char&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;get_character&lt;/span&gt;
    &lt;span class="keyword"&gt;case&lt;/span&gt; &lt;span class="ident"&gt;char&lt;/span&gt;
    &lt;span class="keyword"&gt;when&lt;/span&gt; &lt;span class="char"&gt;?\C&lt;/span&gt;&lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;x&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; &lt;span class="ident"&gt;print&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;Exiting...&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;;&lt;/span&gt; &lt;span class="ident"&gt;exit&lt;/span&gt;&lt;span class="punct"&gt;;&lt;/span&gt;
    &lt;span class="keyword"&gt;else&lt;/span&gt; &lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="expr"&gt;#{char.chr}&lt;/span&gt; [&lt;span class="expr"&gt;#{char}&lt;/span&gt;] (hex: &lt;span class="expr"&gt;#{char.to_s(16)}&lt;/span&gt;)&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;;&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;

&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;A pretty harmless little thing. Try to run it and press some keys, and see what you get:&lt;/p&gt;


&lt;div style="font-family: Monospace"&gt;
Press a key to view the corresponding &lt;span class="caps"&gt;ASCII&lt;/span&gt; code(s) (or &lt;span class="caps"&gt;CTRL&lt;/span&gt;-X to exit).

	&lt;p&gt;=&amp;gt; a [96] (hex: 61)&lt;/p&gt;


	&lt;p&gt;=&amp;gt; 1 [49] (hex: 31)&lt;/p&gt;


	&lt;p&gt;=&amp;gt; Q [81] (hex: 51)&lt;/p&gt;


	&lt;p&gt;=&amp;gt; &amp;alpha; [224] (hex: e0)&lt;/p&gt;


	&lt;p&gt;=&amp;gt; K [75] (hex: 4b)&lt;/p&gt;


&lt;/div&gt;

	&lt;p&gt;Hang on, what are the last two codes? &lt;em&gt;A left arrow key on Windows&lt;/em&gt;, apparently.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Welcome to the wonderful world of input escape sequences!&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;To cut a long story short, both Windows and *nix system &amp;#8220;terminals&amp;#8221; translate special keystrokes into sequences of two or more codes. This applies to things like &lt;span class="caps"&gt;DEL&lt;/span&gt;, INSERT, arrows, etc. etc.
For some ideas, check out:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.microsoft.com/whdc/device/input/Scancode.mspx"&gt;Windows Scancodes&lt;/a&gt; (Thanks &lt;a href="http://64.223.189.234/node/92"&gt;Huff&lt;/a&gt;)&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.connectrf.com/Documents/vt220.html"&gt;&lt;span class="caps"&gt;VT220&lt;/span&gt; Terminal Input Sequences&lt;/a&gt; (Thanks &lt;a href="http://www.grayproductions.net/"&gt;James&lt;/a&gt;)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Let&amp;#8217;s now assume that we&amp;#8217;re smart and we can write a program which can parse keystroke properly, including handling different input escape sequences according to the OS, what can it be used for?
Well:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;For normal characters, just print them back to the screen (&lt;code&gt;get_character&lt;/code&gt; doesn&amp;#8217;t print anything, it &amp;#8220;steals&amp;#8221; the keystroke)&lt;/li&gt;
		&lt;li&gt;For special characters, do something nice!&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;We could setup &lt;span class="caps"&gt;TAB&lt;/span&gt; to auto-complete the current word according to an array of matches, or bind the up arrow to load the last line typed in by the user, for example, that&amp;#8217;s basically something Readline does, right?&lt;/p&gt;


	&lt;h2&gt;RawLine: how it works and what it does&lt;/h2&gt;


	&lt;p&gt;I created a small project on RubyForge called &lt;a href="http://rubyforge.org/projects/rawline/"&gt;RawLine&lt;/a&gt; (not to be confused with RubyInline, a completely different thing altogether, sorry about that) to play around with the possibilities offered by the &lt;code&gt;get_character&lt;/code&gt; method. The library is just a preview of things which can be done, but it&amp;#8217;s already usable, provided that you&amp;#8217;re brave enough to try it out, that is.&lt;/p&gt;


	&lt;p&gt;The basic idea behind RawLine is to be able to parse keystrokes properly on different platforms and re-bind them to a set of predefined, cross-platform actions or a user-defined code block.&lt;/p&gt;


	&lt;h3&gt;Basic line-editing operations&lt;/h3&gt;


	&lt;p&gt;The first challenge was to re-invent the wheel, i.e. re-bind keystrokes to their typical actions: a left arrow moves the cursor left, a backspace deletes the character at the left of the cursor and so on. Yes, because &lt;code&gt;get_characters&lt;/code&gt; gives you the right character codes at the price of &lt;em&gt;cancelling their normal effects&lt;/em&gt;, which is a great thing, as you&amp;#8217;ll soon find out.&lt;/p&gt;


	&lt;p&gt;Printing a character on the screen was one of the easiest tasks (at first). &lt;code&gt;IO#putc&lt;/code&gt; does the job pretty well: it prints a character out.
What about moving left? Easy: print a non-descructive backspace (\b) and hope it is really not destructive. I did some tests and it seems to do as it&amp;#8217;s told and move the cursor back by one position.&lt;/p&gt;


	&lt;p&gt;Moving right was a little trickier: the easiest thing I found was to re-print the character under the cursor, which will then move the cursor forward (as naive as it may seem, it does the job!). If there&amp;#8217;s nothing under the cursor, then we must be at the end of the line and it shouldn&amp;#8217;t move anywhere, so there we go.&lt;/p&gt;


	&lt;p&gt;What if I move left a bit and then start typing normal characters? Well, everything is rewritten of course: this will be our &amp;#8220;character replace mode&amp;#8221;. Unfortunately users don&amp;#8217;t like this behavior that much, so what I did was this:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Copy all characters from the one at the left of the cursor till the end of the line&lt;/li&gt;
		&lt;li&gt;Print the character to be inserted&lt;/li&gt;
		&lt;li&gt;Re-print the previously-copied characters&lt;/li&gt;
		&lt;li&gt;Move the cursor back at the right place&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Again, a primitive solution which works seamlessly on all platforms, and yes, it&amp;#8217;s fast enough that you don&amp;#8217;t notice the difference.&lt;/p&gt;


	&lt;p&gt;As you may have guessed, this of course means that I always had to keep track of:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;The cursor position within the line&lt;/li&gt;
		&lt;li&gt;The text currently printed to the screen&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Backspace and delete were implemented in a similar way, you can figure it out yourself or look at the source code: I won&amp;#8217;t bore you any further!&lt;/p&gt;


	&lt;h3&gt;History management&lt;/h3&gt;


	&lt;p&gt;The next step was to implement a history for both the characters inputted by the user (to allow undoing and redoing operations) and for the whole lines. This was just an ordinary programming exercise: a simple buffer with some extra controls here and there, nothing too scary.&lt;/p&gt;


	&lt;p&gt;So every &amp;#8220;modification&amp;#8221; to the current line being typed is saved in a line history buffer and all the lines entered are saved in another history buffer. All is left is to allow users to navigate through these buffers back and forth. 
Nothing impossible: all I had to do was keeping track of the current element of the history being retrieved and then overwrite the current line with a new line stored in the buffer? How&amp;#8217;s this line overwriting done? Same old:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Move the cursor to the beginnig of the line&lt;/li&gt;
		&lt;li&gt;Print X spaces, where X is the line length, so that the characters are no longer displayed in the console&lt;/li&gt;
		&lt;li&gt;Move the cursor back to the beginning of the line&lt;/li&gt;
		&lt;li&gt;Print the new line.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Easy and naive, as usual. But again, it works well enough.&lt;/p&gt;


	&lt;h3&gt;Word completion&lt;/h3&gt;


	&lt;p&gt;The other challange was word completion. The current implementation can be summarized as follows:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;If &lt;span class="caps"&gt;TAB&lt;/span&gt; (or another character, if you wish) is pressed, call a user-defined &lt;code&gt;completion_proc&lt;/code&gt; method which returns an array and show the first element of the array (in this case I actually used a cyclic RawLine::HistoryBuffer, not an array)&lt;/li&gt;
		&lt;li&gt;If the user presses &lt;span class="caps"&gt;TAB&lt;/span&gt; again, show another match, and so &lt;em&gt;ad infinitum&lt;/em&gt; if the user keeps pressing &lt;span class="caps"&gt;TAB&lt;/span&gt;.&lt;/li&gt;
		&lt;li&gt;If the user presses another key, accept the default completion and move on.&lt;/li&gt;
	&lt;/ul&gt;


Obviously this means that:
	&lt;ul&gt;
	&lt;li&gt;RawLine has to keep track of the current &amp;#8220;word&amp;#8221;. A word is everything separated by a user defined &lt;code&gt;word_separator&lt;/code&gt;, which can obviously modified at runtime, with care.&lt;/li&gt;
		&lt;li&gt;Regarding the &lt;code&gt;completion_proc&lt;/code&gt;, typically you may want to return only the elements matching the word which is currently being written, so that&amp;#8217;s given as default parameter for your proc. Exactly like with ReadLine, the only difference is that you can access other things like &lt;em&gt;the whole line&lt;/em&gt; and &lt;em&gt;the whole history&lt;/em&gt; in real time, which can be really handy at times!&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Here&amp;#8217;s a simple example:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;completion_proc&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;lambda&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;word&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;
    &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="ident"&gt;word&lt;/span&gt;
        &lt;span class="punct"&gt;['&lt;/span&gt;&lt;span class="string"&gt;select&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;update&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;delete&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;debug&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;destroy&lt;/span&gt;&lt;span class="punct"&gt;'].&lt;/span&gt;&lt;span class="ident"&gt;find_all&lt;/span&gt;    &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;e&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt; &lt;span class="ident"&gt;e&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;match&lt;/span&gt;&lt;span class="punct"&gt;(/&lt;/span&gt;&lt;span class="regex"&gt;^&lt;span class="expr"&gt;#{Regexp.escape(word)}&lt;/span&gt;&lt;/span&gt;&lt;span class="punct"&gt;/)&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Custom key bindings&lt;/h3&gt;


	&lt;p&gt;All these pretty things are obviously bound to some keystrokes. If the key corresponds to only one code, everything is fine, but because special keys typically aren&amp;#8217;t so it was necessary to implement a mechanism to track an escape key (e.g. 0xE0 and 0 on Windows and \e on Linux) and listen to further characters, in case a known sequence is found. Anyhow, the final result of the method used for character binding is the following:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;bind(key, &amp;#38;block)&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;Where key can be:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;A &lt;code&gt;Fixnum&lt;/code&gt; corresponding to a single character code&lt;/li&gt;
		&lt;li&gt;An &lt;code&gt;Array&lt;/code&gt; of one or more character codes&lt;/li&gt;
		&lt;li&gt;A &lt;code&gt;String&lt;/code&gt; corresponding to an escape sequence&lt;/li&gt;
		&lt;li&gt;A &lt;code&gt;Symbol&lt;/code&gt; corresponding to a known escape sequence or key&lt;/li&gt;
		&lt;li&gt;A &lt;code&gt;Hash&lt;/code&gt; to define a new key or escape sequences&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;So, in the end you can do things like this:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bind&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:left_arrow&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;move_left&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bind&lt;/span&gt;&lt;span class="punct"&gt;(&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="escape"&gt;\e&lt;/span&gt;test&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;)&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;overwrite_line&lt;/span&gt;&lt;span class="punct"&gt;(&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;Test!!&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;)&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bind&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="char"&gt;?\C&lt;/span&gt;&lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;z&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;undo&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bind&lt;/span&gt;&lt;span class="punct"&gt;([&lt;/span&gt;&lt;span class="number"&gt;24&lt;/span&gt;&lt;span class="punct"&gt;])&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;exit&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Which, for Rubyists, it&amp;#8217;s far sexier and more flexible than editing an .inputrc file.&lt;/p&gt;


	&lt;h3&gt;How do I use it, anyway?&lt;/h3&gt;


	&lt;p&gt;A code example is better than a thousand words, right? So here you are:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="comment"&gt;#!/usr/local/bin/ruby -w&lt;/span&gt;

&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rubygems&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rawline&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;*** Inline Editor Test Shell ***&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt; * Press CTRL+X to exit&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt; * Press CTRL+C to clear command history&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt; * Press CTRL+D for line-related information&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt; * Press CTRL+E to view command history&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;

&lt;span class="ident"&gt;editor&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;RawLine&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;

&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bind&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:ctrl_c&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;clear_history&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bind&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:ctrl_d&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;debug_line&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bind&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:ctrl_e&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;show_history&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bind&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:ctrl_x&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;puts&lt;/span&gt;&lt;span class="punct"&gt;;&lt;/span&gt; &lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;Exiting...&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;;&lt;/span&gt; &lt;span class="ident"&gt;exit&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;

&lt;span class="ident"&gt;editor&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;completion_proc&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;lambda&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;word&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;
    &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="ident"&gt;word&lt;/span&gt;
        &lt;span class="punct"&gt;['&lt;/span&gt;&lt;span class="string"&gt;select&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;update&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;delete&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;debug&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;destroy&lt;/span&gt;&lt;span class="punct"&gt;'].&lt;/span&gt;&lt;span class="ident"&gt;find_all&lt;/span&gt;    &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;e&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt; &lt;span class="ident"&gt;e&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;match&lt;/span&gt;&lt;span class="punct"&gt;(/&lt;/span&gt;&lt;span class="regex"&gt;^&lt;span class="expr"&gt;#{Regexp.escape(word)}&lt;/span&gt;&lt;/span&gt;&lt;span class="punct"&gt;/)&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;

&lt;span class="ident"&gt;loop&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
    &lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;You typed: [&lt;span class="expr"&gt;#{editor.read(&amp;quot;=&amp;gt; &amp;quot;).chomp!}&lt;/span&gt;]&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;This example can be found in examples/rawline_shell.rb within the RawLine source code or gem package.&lt;/p&gt;


	&lt;h2&gt;Current status and availability&lt;/h2&gt;


	&lt;p&gt;I currently &lt;a href="http://rubyforge.org/forum/forum.php?forum_id=22543"&gt;released&lt;/a&gt; RawLine 0.1.0 on &lt;a href="http://rubyforge.org/projects/rawline"&gt;SourceForge&lt;/a&gt;, and it can be installed via:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;gem install -r rawline&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;The RDoc documentation is available &lt;a href="http://rawline.rubyforge.org/"&gt;here&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;Feel free to try it out. First of all try the &lt;code&gt;rawline_shell.rb&lt;/code&gt; example, and see if it works on your machine. If it doesn&amp;#8217;t than maybe you try re-binding some keys (use &lt;code&gt;key_tester.rb&lt;/code&gt; to &amp;#8220;reverse-engineer&amp;#8221; your terminal&amp;#8217;s input escape sequences), and let me know!&lt;/p&gt;


	&lt;p&gt;Status information and limitations:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;It has been tested on Windows (XP, using the usual command prompt) and on Linux (ZenWalk, using &lt;span class="caps"&gt;XFCE&lt;/span&gt; Terminal). &lt;/li&gt;
		&lt;li&gt;It can handle lines no longer than the maximum terminal width &amp;#8211; 2. This is to ensure that the cursor never &amp;#8220;falls down&amp;#8221; to the next line.&lt;/li&gt;
		&lt;li&gt;On Windows, the cursor doesn&amp;#8217;t blink immedialy when moving left, but it moves, don&amp;#8217;t worry.&lt;/li&gt;
		&lt;li&gt;On Linux, you should really consider installing the &lt;a href="http://raa.ruby-lang.org/project/ruby-termios/"&gt;Termios&lt;/a&gt; library for a faster experience (otherwise &lt;code&gt;get_character&lt;/code&gt; won&amp;#8217;t parse characters correctly if you press and hold a key, and that, trust me, is a real mess!).&lt;/li&gt;
		&lt;li&gt;RawLine is very far from being a complete replacement for the ReadLine library, and it is currently in alpha stage.&lt;/li&gt;
		&lt;li&gt;Release 0.1.0 has been created after 2 weeks of sporadic coding during lunch breaks and week-ends.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;For any ideas on where to go from here, comments and feedback, just reply below or send an email to my usual email address.&lt;/p&gt;</description>
      <pubDate>Mon, 10 Mar 2008 06:59:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:63fe570a-0c27-4ab4-9a8f-cf32e1cdf551</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/inline-introduction</link>
      <category>Blog</category>
      <category>ruby</category>
      <category>programming</category>
      <category>OpenSource</category>
      <category>RawLine</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/152</trackback:ping>
    </item>
    <item>
      <title>Beware of sudden upgrades!</title>
      <description>&lt;p&gt;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&amp;#8217;m on shared hosting with FastCGI, for now) was displayed &amp;#8220;as it is&amp;#8221; instead of being interpreted.&lt;/p&gt;


	&lt;p&gt;After the initial moment of anger and stress (I immediately realized it was BlueHost&amp;#8217;s fault, not mine), I opened two tickets and went to bed, hoping to see everything solved in the morning.&lt;/p&gt;


	&lt;p&gt;Unluckily it wasn&amp;#8217;t the case, so I posted on BlueHost forum trying to be as polite as possible complaining because the issue wasn&amp;#8217;t being dealt with. It turns out that for such issues you&amp;#8217;re supposed to use the &amp;#8220;Live Chat&amp;#8221; feature instead of the tickets, so that&amp;#8217;s what I did.&lt;/p&gt;


	&lt;p&gt;After a quick chat with &amp;#8220;Christian&amp;#8221;, it turns out that BlueHost decided to perform a server upgrade &amp;#8220;silently&amp;#8221; upgrading to Apache2, &lt;span class="caps"&gt;PHP5&lt;/span&gt;, MySQL4.1, etc. etc.
Cool, pity that nobody told me that!&lt;/p&gt;


	&lt;p&gt;I was expecting some sort of &lt;span class="caps"&gt;PHP&lt;/span&gt; upgrade (not that I care like that), which was supposed to happen according to the last BlueHost newsletter:&lt;/p&gt;


&lt;blockquote&gt;
&lt;em&gt;&amp;#8220;To alleviate any issues in the future with certain scripts that only run on one
version of &lt;span class="caps"&gt;PHP&lt;/span&gt; we have developed the ability to run &lt;span class="caps"&gt;PHP4&lt;/span&gt; and &lt;span class="caps"&gt;PHP5&lt;/span&gt; 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.&amp;#8221;&lt;/em&gt;
&lt;/blockquote&gt; 

	&lt;p&gt;But&amp;#8230; hang on? Does it say anything about migrating to Apache2? I don&amp;#8217;t think so! What&amp;#8217;s worse, is that quite a few things changed with Apache2, in particular the way FastCGI handlers are declared:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;# Apache 1.3:
AddHandler fastcgi-script .fcgi

# Apache 2:
AddHandler fcgid-script .fcgi&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;See? Different. This is due to the fact that &lt;a href="http://wiki.rubyonrails.org/rails/pages/Debian+mod_fastcgi+Notes"&gt;&lt;code&gt;mod_fcgid&lt;/code&gt; is used instead of &lt;code&gt;mod_fastcgi&lt;/code&gt; on Apache 2&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;The fix was easy, of course, and now my site is up and running again (and actually running faster)&amp;#8230; but, I wonder, why the hell wasn&amp;#8217;t I informed? Is it acceptable? It sounds like I might end up on a &lt;span class="caps"&gt;VPS&lt;/span&gt; sooner than expected, unless BlueHost doesn&amp;#8217;t roll out some new exciting feature soon, as I think it might&amp;#8230;&lt;/p&gt;</description>
      <pubDate>Thu, 20 Dec 2007 07:41:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:c033d1c9-f0f1-4990-a37c-5c80fec26a90</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/apache2-upgrade</link>
      <category>Blog</category>
      <category>website</category>
      <category>Rails</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/146</trackback:ping>
    </item>
    <item>
      <title>Announcement: RedBook v0.5.0 released</title>
      <description>&lt;p&gt;This new beta release of RedBook introduces quite a few changes when it comes to configuration and setup. Here&amp;#8217;s some highlights&amp;#8230;&lt;/p&gt;


	&lt;h3&gt;Regexp changes&lt;/h3&gt;


	&lt;p&gt;It is now necessary to enter &amp;#8220;proper&amp;#8221; regular expressions for &lt;code&gt;:select&lt;/code&gt;. Proper means between slashes, like the following:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;/Work Day/&lt;/li&gt;
		&lt;li&gt;/mail/i&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;I changed this in order to support case-insensitive searches using the &lt;code&gt;i&lt;/code&gt; switch. This makes queries much more powerful.&lt;/p&gt;


	&lt;h3&gt;Variables&lt;/h3&gt;


	&lt;p&gt;A new, interesting feature I decided to introduce in this release is &lt;em&gt;variables&lt;/em&gt;. For now you define them inside your rbconfig.yml file, like this:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;:var_monday_morning: &amp;quot;monday at 8 am&amp;quot;

:var_friday_evening: &amp;quot;friday at 8 pm&amp;quot;

:var_week_report: &amp;quot;:select :duration :from :%monday_morning :to :%friday_evening&amp;quot; &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;In this way, every time you type in :%week_report in RedBook, it will expand to: &lt;code&gt;:select :duration :from monday at 8 am :to friday at 8 pm&lt;/code&gt;. By the way, completion is supported, so you&amp;#8217;ll only have to type in something like &lt;code&gt;:%we&lt;/code&gt; and hit &lt;tab&gt;.&lt;/p&gt;


	&lt;p&gt;It is possible to define variables as &lt;code&gt;:var_&amp;lt;something&amp;gt;&lt;/code&gt; in the rbconfig.yml file and then used them inside RedBook as &lt;code&gt;:%&amp;lt;something&amp;gt;&lt;/code&gt;.&lt;/p&gt;


	&lt;h3&gt;New Operations&lt;/h3&gt;


	&lt;p&gt;Five new operations have been added:&lt;/p&gt;


	&lt;h4&gt;:blank&lt;/h4&gt;


	&lt;p&gt;This will blank your current log after asking you if you really want to do so.&lt;/p&gt;


	&lt;h4&gt;:restore&lt;/h4&gt;


	&lt;p&gt;This operation will overwrite your current log with the last saved backup. Like with the &lt;code&gt;:blank&lt;/code&gt; operation, you&amp;#8217;re asked if you really want to proceed or not.&lt;/p&gt;


	&lt;h4&gt;:archive&lt;/h4&gt;


	&lt;p&gt;By typing &lt;code&gt;:archive&lt;/code&gt;, the current log file will be archived to your &lt;code&gt;:archives_folder:&lt;/code&gt; directory specified in the rbconfig.yml file (similarly, it is now possible to specify a :backups_folder: for your logs&amp;#8217; backup files).&lt;/p&gt;


	&lt;h4&gt;:dataset&lt;/h4&gt;


	&lt;p&gt;A simple operation to display the messages inthe current dataset.&lt;/p&gt;


	&lt;h4&gt;:dump&lt;/h4&gt;


	&lt;p&gt;This operation will dump the output of the last &lt;code&gt;:select&lt;/code&gt; operation to a text file. Useful for saving the average, total time and duration of a set of activities.&lt;/p&gt;


	&lt;h3&gt;Portable edition&lt;/h3&gt;


	&lt;p&gt;Some Windows users will definitely love this. I finally found an easy way to run RedBook confined within the current directory, by using a simple &lt;code&gt;start.bat&lt;/code&gt; batch file to set the &lt;span&gt;&lt;span class="caps"&gt;INPUTRC&lt;/span&gt;&lt;/span&gt; and &lt;span&gt;&lt;span class="caps"&gt;HOME&lt;/span&gt;&lt;/span&gt; variables temporarily to the path to the .inputrc file and the directory of RedBook executable. This makes RedBook 100% portable and suitable to be used on &lt;span class="caps"&gt;USB&lt;/span&gt; sticks &amp;#38;similar.&lt;/p&gt;


	&lt;p style="text-align:center;"&gt;&lt;strong&gt;&lt;a href="http://redbook.googlecode.com/files/RedBook-0.5_Win32-portable.zip"&gt;Get RedBook Portable&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;h3&gt;New Development Page&lt;/h3&gt;


	&lt;p&gt;I decided to move the primary RedBook repository from &lt;a href="http://www.assembla.org"&gt;Assembla&lt;/a&gt; to Google Code. Why? Well, nothing wrong with Assembla per se, I still think it&amp;#8217;s an excellent free service to host your public &lt;em&gt;and private&lt;/em&gt; projects, but Google Code is faster and offers only the features I need:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Public &lt;span class="caps"&gt;SVN&lt;/span&gt; repository access&lt;/li&gt;
		&lt;li&gt;Simple-to-use issue tracker&lt;/li&gt;
		&lt;li&gt;Very nicely developed downloads section, with download counts, and &amp;#8220;normal&amp;#8221; filenames.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;So here&amp;#8217;s the new RedBook Development Home:&lt;/p&gt;


	&lt;p style="text-align:center;"&gt;&lt;strong&gt;&lt;a href="http://code.google.com/p/redbook/"&gt;http://code.google.com/p/redbook/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Additionally I also setup a &lt;a href="http://groups.google.com/group/redbook-support/"&gt;RedBook Support Google Group&lt;/a&gt;, so if you have any question concerning the program, you know where to go!&lt;/p&gt;</description>
      <pubDate>Sun, 16 Dec 2007 08:07:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:e1a7f2c4-2e24-4e6c-b8f2-4deed6504804</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/redbook-050-released</link>
      <category>Blog</category>
      <category>OpenSource</category>
      <category>productivity</category>
      <category>redbook</category>
      <category>ruby</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/145</trackback:ping>
    </item>
    <item>
      <title>Review Services</title>
      <description>&lt;p&gt;When it comes to software, I definitely like to try out new things. My collegues takes the piss out of me because every &lt;del&gt;week&lt;/del&gt; day I come up with &amp;#8220;some new tool they &lt;em&gt;have&lt;/em&gt; to start using&amp;#8221; 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&amp;#8217;t &lt;em&gt;feel&lt;/em&gt; right. I&amp;#8217;ll use a tool for months but still try out new ones which claim to do the same thing &#8212; but better &#8212; as they come out.
Unfortunately &#8212; or fortunately, depends how you look at it &#8212; when it comes to software, there are very few &lt;em&gt;silver bullets&lt;/em&gt;, and things keep changing: that&amp;#8217;s the way it is and the way it will be.&lt;/p&gt;


	&lt;p&gt;I must try to write up a page (and ideally update it regularly, that&amp;#8217;s the hard part) listing all the tools I use, at some point&amp;#8230; 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&amp;#8217;ll definitely try it out, and if it&amp;#8217;s worth a post I&amp;#8217;ll blog about it.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;The same applies to books&lt;/strong&gt;, actually, as I like reading, especially those which are related to Ruby or programming, nowadays.&lt;/p&gt;


	&lt;p&gt;The cost of such reviews and articles? Depends! Certainly I wouldn&amp;#8217;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 &lt;strong&gt;not&lt;/strong&gt; doing this full time, and I already have a job and a fianc&#233;e to look after, but I&amp;#8217;ll do my best to publish as much as I can on my site or even elsewhere elsewhere [Note: on e-zines, magazines &amp;#38; similar, not on your brother&amp;#8217;s friend&amp;#8217;s mother-in-law&amp;#8217;s crappy blog!].&lt;/p&gt;


	&lt;p&gt;For any inquiries, contact me (&lt;strong&gt;h3rald [&#8212;at&#8212;] h3rald.com&lt;/strong&gt;).&lt;/p&gt;</description>
      <pubDate>Fri, 14 Dec 2007 12:24:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:3125dba7-1b4d-41a6-90b8-82bcd5740d44</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/review-services</link>
      <category>Blog</category>
      <category>review</category>
      <category>website</category>
      <category>personal</category>
      <category>tools</category>
      <category>books</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/143</trackback:ping>
    </item>
    <item>
      <title>Announcement: RedBook v0.4.0 released</title>
      <description>&lt;p&gt;I&amp;#8217;m pleased to announce a new release of the RedBook daily logging and time tracking script. This release introduces two new operations, four stats-related directives and a brand new Windows Installer able to setup RedBook in a blink, with (almost) no configuration at all.&lt;/p&gt;


	&lt;p&gt;Let&amp;#8217;s have a closer look&amp;#8230;&lt;/p&gt;


	&lt;h2&gt;New Operations&lt;/h2&gt;


	&lt;p&gt;Suppose that you just logged a message and you noticed one of these two things happened:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;You didn&amp;#8217;t really wanted to log it&lt;/li&gt;
		&lt;li&gt;You made a silly typo in the message or in the tags&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;What can you do about it? Up to RedBook 0.3, the only solution was to open the &lt;span class="caps"&gt;YAML&lt;/span&gt; file and correct the mistake manually. From now on there&amp;#8217;s also another simpler way to operate in such situations: using the :update and :delete operations!&lt;/p&gt;


	&lt;h3&gt;:update&lt;/h3&gt;


	&lt;p&gt;This operation can be used to update the message and or the tags of a previously-logged activity. The usage is simple: load a dataset first, and then execute an &lt;code&gt;:update&lt;/code&gt; command like:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;:update 4 :message My updated message :with new_tag1 new_tag2&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;This will update the 4th message of the dataset modifying its message and tags. Of course you can update either of the two things or both; the timestamp of the activity will not be changed.&lt;/p&gt;


	&lt;h3&gt;:delete&lt;/h3&gt;


	&lt;p&gt;The delete operation can be used to completely delete a message from the log. Just load a dataset using a &lt;code&gt;:select&lt;/code&gt; operation and then execute a &lt;code&gt;:delete&lt;/code&gt; command, e.g.:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;:delete 1&lt;/code&gt; &lt;em&gt;(will delete the first activity)&lt;/em&gt;&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;:delete 4 2 7 9&lt;/code&gt; &lt;em&gt;(will delete activity #2, #4, #7 and #9)&lt;/em&gt;&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;:delete&lt;/code&gt; &lt;em&gt;(will delete the entire dataset)&lt;/em&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;A confirmation message will appear before deleting the message(s).&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;IMPORTANT&lt;/span&gt;&lt;/strong&gt;
&lt;em&gt;Due to the architecture of the application, whenever an &lt;code&gt;:update&lt;/code&gt; or &lt;code&gt;:delete&lt;/code&gt; occurs the log file will be reloaded in memory and completely overwritten. This doesn&amp;#8217;t cause problems, although for big log files (10,000+ activities) this may take a few seconds.&lt;/em&gt;&lt;/p&gt;


	&lt;h2&gt;Statistics&lt;/h2&gt;


	&lt;p&gt;Another important new feature introduced by this release is &lt;em&gt;time tracking&lt;/em&gt;. It was actually already there, kind of: the &lt;code&gt;:calc&lt;/code&gt; operation was already able to calculate the time elapsed between two activities&amp;#8230; however, this is not really practical.&lt;/p&gt;


	&lt;p&gt;Since last release, it is possible to log the completion of an activity using the &lt;code&gt;:finish&lt;/code&gt; command. This will basically re-log the same activity prepending &lt;em&gt;[COMPLETED]&lt;/em&gt; to its message.
If you started using the &lt;code&gt;:finish&lt;/code&gt; command to complete your activities, RedBook can now calculate the following stats for you:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Count the number of messages in a dataset&lt;/li&gt;
		&lt;li&gt;Calculate the average time spent for the completed activities in a dataset&lt;/li&gt;
		&lt;li&gt;Calculate the total time spent for the completed activities in a dataset&lt;/li&gt;
		&lt;li&gt;Calculate the duration of each completed activity in a dataset&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Each of these calculations is performed by adding special directive to a &lt;code&gt;:select&lt;/code&gt; command, as explained in the following sections.&lt;/p&gt;


	&lt;h3&gt;:count&lt;/h3&gt;


	&lt;p&gt;This directive can be added to a &lt;code&gt;:select&lt;/code&gt; command to return just the number of message of the loaded dataset. 
In other words, executing the following:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;:select :count :with mail !work&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;&amp;#8230;will return the number of activities tagged with &lt;em&gt;mail&lt;/em&gt; but not with &lt;em&gt;personal&lt;/em&gt;, without listing all the activities.&lt;/p&gt;


	&lt;h3&gt;:avg&lt;/h3&gt;


	&lt;p&gt;The &lt;code&gt;:avg&lt;/code&gt; directive can be used to calculate the average time spent on activities matching certain criteria, for example:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;:select Status Meeting :avg :with meeting&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;&amp;#8230;will return the average time spent on activities whose messages matches &lt;em&gt;/Status Meeting/&lt;/em&gt; and are tagged with &lt;em&gt;meeting&lt;/em&gt;.&lt;/p&gt;


	&lt;h3&gt;:total&lt;/h3&gt;


	&lt;p&gt;Similarly, &lt;code&gt;:total&lt;/code&gt; can be used to return the total time spent on activities matching certain criteria, e.g.:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;:select :total :with mail work&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;&amp;#8230;will return the total time spent on activities tagged with &lt;em&gt;mail&lt;/em&gt; and &lt;em&gt;work&lt;/em&gt;.&lt;/p&gt;


	&lt;h3&gt;:duration&lt;/h3&gt;


	&lt;p&gt;Lastly, &lt;code&gt;:duration&lt;/code&gt; will print each completed task along with its duration. The syntax is similar to the others:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;:select :duration :with break&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;This will print each completed activity tagged with &lt;em&gt;break&lt;/em&gt; along with its duration.&lt;/p&gt;


	&lt;h3&gt;:nodiff and _concurrent&lt;/h3&gt;


	&lt;p&gt;The logic behind the above-mentioned directives may seem trivial to implement, but it is not. The fun part was telling RedBook to subtract the duration of each sub-activity contained in another activity&amp;#8230; a feature I considered necessary for time tracking purpose. However, if you start your work day with a &lt;em&gt;Working Day&lt;/em&gt; activity and you complete that activity using the &lt;code&gt;:finish&lt;/code&gt; command, when calculating the duration of the working day RedBook will subtract the duration of &lt;em&gt;all the completed sub-activities&lt;/em&gt; from the duration of &lt;em&gt;Working Day&lt;/em&gt;. This is not OK, so I added the directive &lt;code&gt;:nodiff&lt;/code&gt; which can be used to prevent RedBook from calculating the difference between the parent activity&amp;#8217;s duration and the duration of each of its child activity.&lt;/p&gt;


	&lt;p&gt;What if you&amp;#8217;re doing two things at once? use the special &lt;code&gt;_concurrent&lt;/code&gt; tag, and that activity will be considered symultaneous to its parent activity for time tracking purposes.&lt;/p&gt;


	&lt;h2&gt;Activity Status Filters&lt;/h2&gt;


	&lt;p&gt;RedBook is now fully aware of the &amp;#8220;status&amp;#8221; of each activity, so it is possible to display only activities in a certain status using the following directives:&lt;/p&gt;


	&lt;h3&gt;:plain&lt;/h3&gt;


	&lt;p&gt;Executing &lt;code&gt;:select :plain :from today&lt;/code&gt; will return all the activities logged today, omitting their completions (if any), i.e. any activity beginning with &lt;em&gt;[COMPLETED]&lt;/em&gt;.&lt;/p&gt;


	&lt;h3&gt;:pending&lt;/h3&gt;


	&lt;p&gt;Executing &lt;code&gt;:select :pending :from today&lt;/code&gt; will return all the activities logged today which have not been completed yet. Again, this was not too trivial to implement, but it seems to work (it also smart enough to detect if the same activity has been relogged etc. etc.).&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;WARNING&lt;/span&gt;:&lt;/strong&gt; 
&lt;em&gt;Using this directive with a large dataset may cause RedBook to take some time before delivering the result, due to the amount of iterations to perform. Use with care.&lt;/em&gt;&lt;/p&gt;


	&lt;h3&gt;:completed&lt;/h3&gt;


	&lt;p&gt;Executing &lt;code&gt;:select :completed :from today&lt;/code&gt; will return all the activities logged today which have been completed.&lt;/p&gt;


	&lt;h2&gt;Windows Installer&lt;/h2&gt;


	&lt;p&gt;I decided to spend some time (half an hour) and create a proper setup file for Windows using InnoSetup. The setup will take care of almost everything for you, so you have no excuse not to try RedBook because it&amp;#8217;s not user-friendly to install!&lt;/p&gt;


	&lt;p&gt;Check out the &lt;a href="http://redbook.h3rald.com"&gt;manual&lt;/a&gt; for more details.&lt;/p&gt;


	&lt;h2&gt;RubyForge Project&lt;/h2&gt;


	&lt;p&gt;Finally, I registered a new &lt;a href="http://rubyforge.org/projects/redbook/"&gt;RubyForge Project&lt;/a&gt; for RedBook, which include a public &lt;span class="caps"&gt;SVN&lt;/span&gt; repository updated every week (Assembla doesn&amp;#8217;t allow anonymous checkouts, unfortunately).
This project will also host the official RedBook Gem, scheduled for the 1.0 release.&lt;/p&gt;


	&lt;p style="text-align:center;"&gt;&lt;strong&gt;[&lt;a href="http://www.assembla.com/spaces/files/redbook"&gt;&lt;span class="caps"&gt;DOWNLOAD&lt;/span&gt;&lt;/a&gt;] | [&lt;a href="http://redbook.h3rald.com/"&gt;&lt;span class="caps"&gt;MANUAL&lt;/span&gt;&lt;/a&gt;]&lt;/strong&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 28 Nov 2007 08:34:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:da37ee90-7e9f-4f73-9df7-c734ade3a347</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/redbook-040-released</link>
      <category>Blog</category>
      <category>OpenSource</category>
      <category>productivity</category>
      <category>redbook</category>
      <category>ruby</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/142</trackback:ping>
    </item>
    <item>
      <title>Text Link Ads sidebar for Typo</title>
      <description>&lt;p&gt;I thought it would be nice to share the code of the sidebar I created to display &lt;a href="http://www.text-links-ads.com"&gt;Text Link Ads&lt;/a&gt; sponsor links on my Typo powered blog.&lt;/p&gt;


	&lt;p&gt;There&amp;#8217;s actually another &lt;a href="http://blog.nanorails.com/articles/2006/10/01/a-new-rails-plugin-for-textlinkads-including-support-for-feedvertising"&gt;plugin&lt;/a&gt; which was made for Typo 2.6, but unfortunately it doesn&amp;#8217;t work with Typo 4.1.1.&lt;/p&gt;


	&lt;h3&gt;Installation&lt;/h3&gt;


	&lt;p&gt;Just unzip it inside your vendor/plugins directory. The new sidebar should appear in the list of your available sidebars in the Typo&amp;#8217;s administration area.&lt;/p&gt;


	&lt;h3&gt;Configuration&lt;/h3&gt;


	&lt;p&gt;In Typo&amp;#8217;s administration area, configure the following settings for this sidebar:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: The title of the sidebar&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;&lt;span class="caps"&gt;KEY&lt;/span&gt;&lt;/strong&gt;: Your &lt;span class="caps"&gt;TLA&lt;/span&gt;&amp;#8217;s &lt;span class="caps"&gt;XML&lt;/span&gt; key&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;Affiliate ID&lt;/strong&gt;: Your &lt;span class="caps"&gt;TLA&lt;/span&gt;&amp;#8217;s affiliate ID&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;Advertise Here&lt;/strong&gt;: A message shown when no links are displayed.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;&lt;strong&gt;&lt;a href="/files/textlinkads_sidebar_v0.1.zip"&gt;Download Text Links Ads Sidebar v1.0&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 17 Nov 2007 04:47:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:42b26026-f175-4e44-be6d-f19b37e45534</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/textlinkads_sidebar_v01</link>
      <category>Blog</category>
      <category>Rails</category>
      <category>OpenSource</category>
      <enclosure url="http://www.h3rald.com/files/textlinkads_sidebar_v0.1.zip" type="application/zip" length="3294"/>
      <trackback:ping>http://www.h3rald.com/trackback/entries/127</trackback:ping>
    </item>
    <item>
      <title>Announcement: RedBook v0.3.0 released</title>
      <description>&lt;p&gt;It&amp;#8217;s time for a new beta release of RedBook. This was actually going to be a fairly modest release in terms of features, but I actually ended up implementing a lot more than expected, even things which were planned for the first production release 1.0. So, let&amp;#8217;s see what&amp;#8217;s new&lt;/p&gt;


	&lt;h3&gt;New operation names &lt;em&gt;(which break compatibility with previous versions)&lt;/em&gt;&lt;/h3&gt;


	&lt;p&gt;I had a look at the names I choose for the operations and I noticed that they were either not intuitive enough or too verbose. So I decided to change a fair few of them (thus breaking compatibility with previous versions, but after all that&amp;#8217;s what beta releases are for, right?):&lt;/p&gt;


	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;&lt;span class="caps"&gt;OLD&lt;/span&gt; &lt;/th&gt;
			&lt;th&gt;&lt;span class="caps"&gt;NEW&lt;/span&gt; &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; :complete &lt;/td&gt;
			&lt;td&gt; :finish &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; :load &lt;/td&gt;
			&lt;td&gt; :select &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; :load_config &lt;/td&gt;
			&lt;td&gt; :config &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; :load_log &lt;/td&gt;
			&lt;td&gt; :refresh &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; :timecalc &lt;/td&gt;
			&lt;td&gt; :calc &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; :stop &lt;/td&gt;
			&lt;td&gt; :quit &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;h3&gt;New Manual/Home Page&lt;/h3&gt;


	&lt;p&gt;A while ago I discovered &lt;a href="http://www.tiddlywiki.com/"&gt;TiddlyWiki&lt;/a&gt;, but as a matter of fact I never used it for anything practical. From last week though, I started using it a work for taking notes and create short memos, and then I thought of using it to replace RedBook&amp;#8217;s standard &lt;span class="caps"&gt;README&lt;/span&gt; file (which was made in a hurry and was kinda cryptical). Now a brand new &amp;#8220;manual.html&amp;#8221; ships with RedBook&amp;#8212;308 KB (30 of actual docs and 278 of Javascript/HTML/CSS magic) with everything you need to know about it. Additionally, an online version is available at the following address:&lt;/p&gt;


	&lt;p style="text-align:center;"&gt;&lt;strong&gt;&lt;a href="http://redbook.h3rald.com"&gt;redbook.h3rald.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;h3&gt;Removed Win32::Console Library&lt;/h3&gt;


	&lt;p&gt;OK this is not good news for people (like me) who use RedBook on Windows, but I promise you&amp;#8217;ll forgive me when you read about the other new features below. I discovered by chance that the Win32::Console library (which was used to get colors working on Windows) seems not to handle international characters properly and also seems to be conflicting in some way with the Readline library I decided to include (see below). I don&amp;#8217;t know whether this is a problem of the actual library or just of the gem used to pack it.&lt;/p&gt;


	&lt;h3&gt;rbconfig.yml&lt;/h3&gt;


	&lt;p&gt;The &lt;code&gt;config.yml&lt;/code&gt; file has been renamed to &lt;code&gt;rbconfig.yml&lt;/code&gt;. Additionally, if you place a file with this name in your $HOME directory it will override the one in your RedBook folder (This was done in preparation for the RedBook RubyGem).&lt;/p&gt;


	&lt;h3&gt;New operations&lt;/h3&gt;


	&lt;p&gt;The following new operations are available:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://redbook.h3rald.com/#%3Arelog"&gt;:relog&lt;/a&gt;&amp;#8212;Re-logs a previously-logged message (keeping the same tags and updating the timestamp)&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://redbook.h3rald.com/#%3Aclear"&gt;:clear&lt;/a&gt;&amp;#8212;Clears the screen.&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://redbook.h3rald.com/#%3Aruby"&gt;:ruby&lt;/a&gt;&amp;#8212;Evaluates arbitrary Ruby code outputting the result (use with care&amp;#8230;)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h3&gt;Auto-completion&lt;/h3&gt;


	&lt;p&gt;Some Mac users originally complained that the backspace key wasn&amp;#8217;t working in RedBook (and it didn&amp;#8217;t in Linux either). Fortunately the solution to this was easy enough: include the &lt;span class="caps"&gt;GNU&lt;/span&gt; &lt;a href="http://tiswww.case.edu/php/chet/readline/rltop.html"&gt;Readline&lt;/a&gt; library. 
Readline is now being used in RedBook to:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Provide basic (Emacs-style) bindings&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;Auto-completion&lt;/strong&gt; for keywords &lt;em&gt;and tags&lt;/em&gt;&lt;/li&gt;
		&lt;li&gt;Allow the user to automatically customize key bindings via an &lt;a href="http://redbook.h3rald.com/#.inputrc"&gt;.inputrc&lt;/a&gt; file placed in their $HOME directory (on Windows you&amp;#8217;ll have to define a &lt;span&gt;&lt;span class="caps"&gt;HOME&lt;/span&gt;&lt;/span&gt; environment variable pointing to a directory of your choice). An example .inputrc file is distributed with RedBook with some specific key bindings.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h3&gt;Support for international characters&lt;/h3&gt;


	&lt;p&gt;Finally, I decided to implement another feature which was originally planned for the 1.0 release: international characters support. This is possible using the Iconv Ruby extension (requires &lt;a href="http://www.gnu.org/software/libiconv/"&gt;&lt;span class="caps"&gt;GNU&lt;/span&gt; libiconv&lt;/a&gt;) which can convert strings between different character sets. The character sets needs to be configured via the &lt;a href="http://redbook.h3rald.com/#rbconfig.yml"&gt;rbconfig.yml&lt;/a&gt; file.&lt;/p&gt;


	&lt;p&gt;For more information, check out the &lt;a href="http://redbook.h3rald.com/#ChangeLog"&gt;ChangeLog&lt;/a&gt;&lt;/p&gt;


	&lt;p style="text-align:center;"&gt;&lt;strong&gt;&lt;a href="http://www.assembla.com/spaces/files/bWE7NkzCqr3k25abIlDkbG"&gt;Download RedBook&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 25 Oct 2007 07:18:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:299d1433-4d77-4c06-abc4-3e3e2e04c914</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/redbook-030-released</link>
      <category>Blog</category>
      <category>redbook</category>
      <category>ruby</category>
      <category>productivity</category>
      <category>OpenSource</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/126</trackback:ping>
    </item>
    <item>
      <title>Announcement: RedBook v0.2.0 released</title>
      <description>&lt;blockquote&gt;
&lt;em&gt;&amp;#8220;Release Early, Release Often&amp;#8221;&lt;/em&gt;

           &amp;#8212;Eric S. Raymond, &lt;a href="http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s04.html"&gt;The Cathedral and the Bazaar&lt;/a&gt;
&lt;/blockquote&gt;

	&lt;p&gt;In other words, time for another (early) release of &lt;a href="http://www.assembla.com/space/redbook"&gt;RedBook&lt;/a&gt;. There are quite a few new features which are worth examining, in particular:&lt;/p&gt;


	&lt;h3&gt;Regexp search for messages&lt;/h3&gt;


	&lt;p&gt;This was actually already available before, just if you inputted a search string which was not a regexp, you&amp;#8217;d get an unhandled exception (more or less). This exception is now handled propertly so you get a pretty message instead, if an error occurs when parsing the search string.&lt;/p&gt;


	&lt;h3&gt;Log Backup&lt;/h3&gt;


	&lt;p&gt;A new &lt;strong&gt;&amp;#58;backup&lt;/strong&gt; keyword is available to quickly backup your log file. Here&amp;#8217;s what it does:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Loads all messages silently&lt;/li&gt;
		&lt;li&gt;Writes them to a file in the same directory as the original log file named &amp;lt;log-alias&amp;gt;.bkp.yml.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Handy, especially if there was a similar keyword to restore the last backup, which is planned for &lt;a href="http://www.assembla.com/spaces/milestones/index/bWE7NkzCqr3k25abIlDkbG?spaces_tool_id=ceS8UazCqr3k25abIlDkbG"&gt;later on&lt;/a&gt;.&lt;/p&gt;


	&lt;h3&gt;Support for multiple log files&lt;/h3&gt;


	&lt;p&gt;This is perhaps the most important feature introduced by this release. It is now possible to configure more than one log file by adding any number of &lt;strong&gt;&amp;#58;data_&amp;lt;alias&amp;gt;&amp;#58;&lt;/strong&gt; settings inside your config.yml file, where alias is the name of your log file. So, for example, if your config.yml file contains the following:&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&amp;#58;data_test&amp;#58; &amp;#8220;testlog.yml&amp;#8221;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;You can load the &amp;#8220;test&amp;#8221; log by typing&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&amp;#58;use test&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;(&amp;#58;use is a shorthand for &amp;#58;load_log). Similarly, another new keyword &lt;strong&gt;&amp;#58;dest&lt;/strong&gt; has been introduced to be able to log a message to a different log file without loading it into memory, like this:&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&amp;#58;log This message will be saved to testlog.yml &amp;#58;dest test&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Finally, a &lt;strong&gt;&amp;#58;refresh&lt;/strong&gt; keyword has been introduced as an alias to reloading the current log.&lt;/p&gt;


	&lt;h3&gt;(Almost) automatic log of completed activities&lt;/h3&gt;


	&lt;p&gt;Right when I was coding the &lt;strong&gt;&amp;#58;timecalc&lt;/strong&gt; operation, I thought it would be nice to be able to log the start and end of a task without having to type it twice. Now this is possible using the &lt;strong&gt;&amp;#58;complete&lt;/strong&gt; keyword:&lt;/p&gt;


	&lt;p&gt;&amp;#58;log Testing feature X in product Y&lt;/p&gt;


	&lt;p&gt;&amp;#58;complete&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&amp;#58;complete&lt;/strong&gt; will re-log the last message prepended with [COMPLETED]:

	&lt;p&gt;4 Mon Oct 08 2007 &amp;#8211; 10:47:45 AM Testing feature X in product Y&lt;/p&gt;


	&lt;p&gt;5 Mon Oct 08 2007 &amp;#8211; 10:54:31 AM [COMPLETED] Testing feature X in product Y&lt;/p&gt;
&lt;/p&gt;


	&lt;p&gt;What if I start another task before completing the first one? No problem, it is sufficient to load the last activities using a &lt;strong&gt;&amp;#58;load&lt;/strong&gt; command and then issuing &lt;strong&gt;&amp;#58;complete &amp;lt;number&amp;gt;&lt;/strong&gt; where &amp;lt;number&amp;gt; is the index of the loaded activity. 
This nifty little feature will become more and more important when (starting from release 0.4) I&amp;#8217;ll implement more time tracking functions, and it will be possible to track completed tasks in a specific timeframe and/or marked with a specific tag.&lt;/p&gt;


	&lt;h3&gt;Easy integration with launchers like Launchy and QuickSilver&lt;/h3&gt;


	&lt;p&gt;To conclude, as someone pointed out that it would be cool to use RedBook from launchers like Launchy or Quicksilver, I made another standalone script (redbooklet.rb or redbooklet.exe) which is just able to parse a log command and write a message to the specified log file.
To use it with Launchy, for example, all you have to do is the following:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Create a shortcut to redbooklet.exe (or to a way to execute the corresponding ruby script) named &amp;#8220;log&amp;#8221;.&lt;/li&gt;
		&lt;li&gt;Copy the &amp;#8220;log&amp;#8221; shortcut anywhere in your start menu&lt;/li&gt;
		&lt;li&gt;Bring up launchy (ALT+SPACE) and type in &amp;#8220;log&amp;#8221; &lt;/li&gt;
		&lt;li&gt;Hit tab&lt;/li&gt;
		&lt;li&gt;Type in your log message, optionally with the any &amp;#58;tags or &amp;#58;dest keywords.&lt;/li&gt;
		&lt;li&gt;The message will be logged to your default log file or to the log you specified using the &amp;#58;dest keyword. If an error occurs, it will appear in a command line window for 15 seconds before the program is closed.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;That&amp;#8217;s all folks! As usual, if you have any comment or suggestion feel free to reply to this post or email me. For a list of the planned features and releases, check out the &lt;a href="http://www.assembla.com/spaces/milestones/index/bWE7NkzCqr3k25abIlDkbG?spaces_tool_id=ceS8UazCqr3k25abIlDkbG"&gt;Milestones&lt;/a&gt; page.&lt;/p&gt;


	&lt;p style="text-align:center;"&gt;&lt;strong&gt;&lt;a href="http://www.assembla.com/spaces/files/bWE7NkzCqr3k25abIlDkbG"&gt;&lt;span class="caps"&gt;DOWNLOAD HERE&lt;/span&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 08 Oct 2007 05:05:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:071aae77-a911-4801-8061-3809c648999a</guid>
      <author>h3rald</author>
      <link>http://www.h3rald.com/blog/redbook-020-released</link>
      <category>Blog</category>
      <category>redbook</category>
      <category>ruby</category>
      <category>productivity</category>
      <category>OpenSource</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/125</trackback:ping>
    </item>
  </channel>
</rss>
