A Place for my head

On Ruby, Rails, Concurrency and fiction

Posted in : rant | 1 comment

Slow silly movement. No, its not for you.
No, You can’t talk too loudly , you will
be grabbed and gagged. There will be questions!

Its not, “Freedom is Slavery”.

Its You. Its the tangled webs that you have woven, and lo! Who is hanging and smiling from
webs of Shelob. No its not him, its you most likely.

A memory of never happening bliss and if it happens you wouldn’t know most likely.

That there
Thats not me
I go
Where I please
I walk through walls
I float down the liffey
Im not here
This isnt happening
Im not here
Im not here

I wish no questions!

Posted in : Uncategorized | 1 comment

Whoa, Advanced Rails Recipes book is coming full steam ahead. It contains a full chapter on BackgrounDRb now.

Awesome.

Posted in : java, ruby | 1 comment

You might have heard of Raven . Its a rake and Rubygems based tool for building/managing Java projects.

Looks like upgrades to rake and rubygems has broke raven and my search for “Ruby Raven” led me to this:

Quite amusing.

Posted in : Uncategorized | No comments

‘Hey, Mr Cunningham’
The man did not hear me, it seemed.
‘hey, Mr Cunningham. How’s your entailment gettin along?’

Mr Walter Cunningham’s legal affairs were well known to me; Atticus once described them at length. The big man blinked and hooked his thumbs in his overall straps. He seemed uncomfortable; he cleared his throat and looked away. My friendly overture had fallen flat.

‘Don’t your remember me, Mr Cunningham? I’m Jean Louise Finch. You brought us some hickory nuts one time, remember?’ I began to sense the futility one feels when acknowledged by a chance acquaintance

And It goes on to demonstrate something thats truely humane. I know, probably its fiction.

It also pretty much sums up state of Online Communities. Be it open source/free software, bloggers or some other social networking platform. You will be amazed to find so much hate there. Its mostly pointless and perhaps triggered by mere fact that, people know that nobody will perhaps ever show them the mirror. Worst of all, it plagues Open Source projects and its people.

New year has begun with all the usual obnoxious stuff, perhaps we can make this place better by just raising our tolerance level a bit higher.

Posted in : REM | No comments

Eastern to Mountain, third party call, the lines are down
The wise man built his words upon the rocks
But I’m not bound to follow suit
The trees will bend, the conversation’s dimmed
Go build yourself another home, this choice isn’t mine

REM

Posted in : Uncategorized, ruby | 7 comments

Update: Mysql official bindings has been ported to 1.9, look into comments for details
For those who want to stay on the edge, here is modified set of mysql C bindings for Ruby 1.9. Works perfectly well in my small tests.

To compile it:

$ ruby2 extconf.rb
$ make
$ sudo make install

Mysql C bindings for Ruby 1.9

Although its been quite sometime since 1.0 release of BackgrounDRb has been out in the wild, yet a belated post mentioning its features is nonetheless welcome.

Although README document available at, http://backgroundrb.rubyforge.org is quite comprehensive and there is precious little I can add, yet I shall try.

  • BackgrounDRb is a Ruby job server and scheduler. Its main intent is to be
    used with Ruby on Rails applications for offloading long-running tasks. However unlike other libraries BackgrounDRb offers tight integration with Rails and hence you can check status of your workers, pass data to workers and get response back, register status of your workers, dynamically start or stop workers from rails and stuff like that.
  • BackgrounDRb doesn’t have any DRb in its skin now. Its based on networking library packet, (http://packet.googlecode.com)
  • Its stable.
  • It has support for thread_pools, storing of results in MemCache clusters
  • It comes with its own scheduler and hence you don’t need to muck around with crontab anymore

A Quick overview of installation:

  • Get the plugin using:
     piston import http://svn.devjavu.com/backgroundrb/trunk/ backgroundrb
  • Remove or backup older backgroundrb scripts/config files in your rails root directory
  • Run following command from root directory of your rails app:
     rake backgroundrb:setup
  • Have a look at generated config file, RAILS_ROOT/config/backgroundrb.yml and see if there is anything you would like to change.
  • Generate a new worker using :
     ./script/generate worker foo
  • Read the detail documentation about writing workers and stuff on http://backgroundrb.rubyforge.org
  • Start your BackgrounDRb server with:
    ./script/backgroundrb start
  • Stop your BackgrounDRb server with:
    ./script/backgroundrb stop
Posted in : pim, ruby | 7 comments

Updates
Getting gtk-ruby installed is a bit tricky, look into the comments for getting it installed. Also, you don’t necessarily need Emacs to use this application.

Another important thing is, it stores your todos and metadata files in a directory called, ~/snippets, so make sure you have that directory. Although newer version of app, automatically checks for the directory. I put up lots of bug fixes, and a tab for viewing completed tasks too, So make sure you are using latest version. Thanks.

Version 1.0.2 of Swat App

Install it with:

sudo gem install swat-1.0.2.gem

Hey there,

Curse me for making this app if you will. But the truth is all the todo applications in GNU/Linux suck, then I thought ok, may be they do not suck enough. So, with some ruby skills at my disposal, I wrote a todo application in Gtk Ruby.

swat App Small

So whats swat?

Swat is a todo list manager for Gnome & Emacs.

Heck : Emacs?

Features:

  • Manage your todos, add them according to priority and category.
  • Move your todos to wish list, when not feeling like working on them.
  • libtomboy bindings for global shortcut(Alt-F11).
  • Nice stats for number of tasks finished and added.
  • All your todos are in a .org file and hence can be managed from Emacs as well.
  • System tray integration.

KeyBindings:

  • Alt-F11 : from anywhere, brings the todo window to front.
  • Esc : to dismiss todo window.
  • Control-N : to add a todo.

Installation :

  • sudo gem install swat

Code:

  • http://packet.googlecode.com/svn/branches/swat/
Posted in : java, rails | No comments

I had to recently write a smallish TCP/IP server in Java. It has to be written in Java, because of yet another obsession of corporate world with Java. The API that I had to use was javish, and although people who wrote it, would claim that API can be used easily in any language, it was not so. Whats more, I had to use that API from rails, so you can understand my situation.

Well, So i googled and found the book for “Java Network Programming, Third Edition”.
Java Network Programming

What a crap. My main issues were:

  • I hate a book, which pretends that its examples are ready to run, but they don’t run, because they need tinkering. I am all for snippets, that demonstrate a thing or two. But when you are saying, ok this example is ready to run, with import and everything in place and It doesn’t run on actual machine, it just freaks me out.
  • Although the book has 776 pages, its surprisingly free from useful stuff. Seriously, when I compare this with book by Richard Stevens, this book looks like shit. Although author had more scope here on how to write REALLY scalable networking applications. He wasted 776 pages, talking nothing and perhaps reserved good stuff for “Advanced Network Programming with Java” ( Soon, after reading the book, I found that indeed there is a book on Advanced Network Programming )
Posted in : rails | No comments

Our flash guy, uses usual loadVars for loading external data in a flash movie and do some funky stuff like plotting of nice looking portfolio charts.
Portfolio Chart

But somehow, we saw some issues with loading of charts in IE6 running flash. A quick ethreal packet sniffing showed us, that although client is making
request with “Accept-Encoding: gzip,deflate”, its not able to decode the gzip response of web server. And parsing of gzipped response at flash obviously fails.

This is quite a corner case, I suppose, but I did this, to prevent Content-Encoding for that particular controller.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class OutputCompressionFilter
  def self.filter(controller)
    controller.response.headers['Content-Encoding'] = 'identity'
  end
end
 
class FlashController < ApplicationController
  no_pref true
  after_filter OutputCompressionFilter
  layout :set_layout
  include REXML
  def index
  end
end