BackgrounDRb best practises

  • Best place for BackgrounDRb documentation is the README file that comes with the plugin. Read it thoroughly before going anywhere else for documentation.
  • When passing arguments from Rails to BackgrounDRb workers, don’t pass huge ActiveRecord objects. Its asking for trouble. You can easily circumvent the situation by passing id of AR objects.
  • Its always a good idea to run trunk version rather than older tag releases.
  • To debug backgroundrb problems. Its always a good idea to start bdrb in foreground mode by skipping ‘start’ argument while starting the bdrb server. After that, you should fire rails console and try invoking bdrb tasks from rails console and find out whats happening. John Yerhot has posted an excellent write up about this, here
  • Whenever you update the plugin code from svn, don’t forget to remove old backgroundrb script and run :
     rake backgroundrb:setup
  • When deploying the plugin in production, please change backgroundrb.yml, so as production environment is loaded in backgroundrb server. You should avoid keeping backgroundrb.yml file in svn. Rather, you should have a cap task that generates backgroundrb.yml on production servers.
  • When you are processing too many tasks from rails, you should use inbuilt thread pool, rather than firing new workers
  • BackgrounDRb needs Ruby >= 1.8.5
  • When you are starting a worker using

    from rails and using a job_key to start the worker ( You must use unique job keys anyways, if you want more than one instance of same worker running at the same time ), you must always access that instance of worker with same job key. Thats all MiddleMan methods that will invoke a method on that instance of worker must carry job_key as a parameter. For example:

       session[:job_key] = MiddleMan.new_worker(:worker => :fibonacci_worker, :job_key => 'the_key', :data => params[:input])
       MiddleMan.send_request(:worker => :fibonacci_worker, :worker_method => :do_work, :data => params[:input],:job_key => session[:job_key])

    Omitting the job_key in subsequent calls will be an error, if your worker is started with a job_key.

Price Parity between notebook prices – India and US

Its a no brainer in India that you should buy your favorite notebook from US if possible. The usual way is, Ask your friend, family , distance relative , beg them and if they are kind enough, you will get a good laptop in cheap bargain. But for most of us, its not possible.

So, I did a comparison between cost of same model notebooks in India and US and here are the results.

  • Dell : I dunno about you, but I like XPS M1330. Its really an awesome notebook. Starting price in US for this model is $ 1000 and in India its about 52,000 ruppes. Assuming $1 = 40 Rs, you have a price parity of about 12,000 rupees and notebook is costlier by 300 dollars in India. Not bad I would say.
  • Apple Macbook : I will leave Macbook air for you to figure. But simple white macbook costs around 59,000 Rs in India, while in US the same model costs 1100 dollars. Again assuming same currency conversion rates, macbook is costlier by 15,000 rupees or 350 dollars in India. Again, pretty good deal. The price difference used to be really high for Apple products, but Apple seem to have bridged the gap.
  • Thinkpad T61: Well, Thinkpads are Thinkpads and generally T61 and X61 are one of the best notebooks out there.But wait a minute, entry level T61 costs a mind boggling 90,000 rupees (2250 dollars ) in India, while in US it costs 984 dollars. So If you are buying this notebook from India, you are paying 1266 dollars or about 51,000 rupees more. Apple is selling Macbook air for a price of 96,000 rupees in India and T61 is 90,000 rupees. Somebody should slap these bastards at Lenovo. It pisses me off badly. I can’t imagine, one single reason, why Thinkpad models are so overpriced in India.
  • EEE PC: Again price parity is of about 6,000 rupees. EEE PC costs around 349 dollars in US and in India, it was launched at a price of 18,000 rupees.

Well, thats about it. I hope, Lenovo will learn and make thinkpads cheaper.

Dell Support Sucks

Boy, I am in pain.
I am a heavy keyboard user and left alt key on notebook has stopped working suddenly. First I tried to call them and after trying for nearly half an hour, I tried mailing them. Here is the text:

Dear Dell,

My laptop’s left alt key has stopped working since last couple of
weeks. I tried to get through the support line today with no success,
someone picked my call and assured that within 5 minutes my call will
be attended by someone from technical support. I waited for half an
hour and no one picked the call. I have bought two Dell laptops in
last 6 months and I am generally happy with price and quality match,
but is this how Dell treats its customers?

Is this called responsibility at Dell, where a customer is made to
wait for half an hour after a promise of call *will be attended within
5 minutes*. I know, I haven’t bought your *gold support* package and
you would have listened better if probably I would have, but who

Anyways, I will stop my rant and would like to know, how can I get my
left alt key working?

My Mobile number is: xxxxxxxxxxx . If possible please call on this
number, rather than replying to this mail, which gets irksome soon. I
have tried email support in past and it doesn’t work.

Now, what, my mail was rejected by their server. Here is gmail response:

Delivery to the following recipient failed permanently:

Technical details of permanent failure:
PERM_FAILURE: SMTP Error (state 13): 550 #5.1.0 Address rejected

Okay, now what? So I visited their support site and they asked me to take a survey, I did, because I felt okay may be that will be helpful.
So I tried to post my problem through the web interface, and You can’t believe this, because of a stupid Javascript error, I am not able to submit my request. Here is what firebug says:

Also, since I am aware of the fact that firebug sometimes creates problem for third party websites, I had firebug disabled initially. Now, Dell, how do I contact your technical support?

Of Hate and Humane

‘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.

Mysql C bindings for Ruby 1.9

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