13 Sep 2007

Acts_as_solr: Starting solr server on windows

RubyonRails, Technology, acts_as_solr, rails, rails plugins, ruby, solr posted by Akhil Bansal

I was using acts_as_searchable for one of my project, which uses Hyperestraier in background. Yesterday I decided to use acts_as_solr which uses solr(based on Lucene Java search library). I did all written in its Manual/Readme, but when I issued

to start the solr server, it threw a heart breaking “Bad file descriptor” error, although acts_as_solr was working fine on one of my colleague’s linux machine.

I started digging around this and found that there is an issue in rake task that starts the solr server. Actually the problem was this rake task uses ‘fork’ which is not available on windows, also it only handles ‘ECONNREFUSED’ exception which is actually “Connection Refused” error raised by ruby on linux. But in windown it throws ‘EBADF’ which is “Bad file descriptor” error raised by ruby on windows.

So below is the hack for that:

Just add this to vendor/plugins/acts_as_solr/lib/taks/solr.rake, and start solr server on windows by issuing

26 Jul 2007

Careful while using Exception Notifier Plugin

General, rails plugins posted by Akhil Bansal

Exception Notifier Plugin can make you crazy as it made me yesterday.

Let me explain, I was using this plugin for one of my project and our server got a DOS attack. We were requested some URLs that doesn’t exists, like http://somedomain.com/game.rar etc… . I had registered my gmail account to get notifiers. And due to this attack I was sent around 7631*61 mails in 10 hrs. This made me crazy, because I was unable to receive any other email as (may be) my queue was busy with receiving notifier mails. Then gmail started bouncing back those mails saying “The Gmail user you are trying to contact is receiving mail at a rate that prevents additional messages from being delivered. Please resend your message at a later
time”
. And then it became a loop, Gmail-My Server-Gmail.

I found 303552 mails in postfix queue of my server. That were ready to send to gmail. Now my first priority was to clean that postfix queue, so I did it by issuing “sudo postsuper -d ALL”. I hope to receive mails ASAP, It is now more than 48 hrs i received any genuine mail.

So I request you to be careful while using this plugin ;-)

Note: Since my gmail account not receiving mails, so please sent it to akhil at vinsol dot com

28 Dec 2006

Plugin: Exception Notifier; Get detail information of exceptions occurred on the live server right on your inbox.

RubyonRails, rails, rails plugins posted by Akhil Bansal

I don’t know whether you guys are aware of Exception Notifier plugin written by Jamis Buck or not. If you don’t then I would like to share this with you.

The Exception Notifier plugin provides a mailer object and a default set of templates for sending email notifications when errors occur in a Rails application. The plugin is configurable and allows programmers to specify:

  • the sender address of the email
  • the recipient addresses
  • the text used to prefix the subject line

The email includes information about the current request, session, and environment, and also gives a backtrace of the exception.

I am using this plugin and found it very useful, and suggest you to use it.

You can get this plugin from http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/

25 Nov 2006

Ajax based drag drop and sortable tree for Rails

RubyonRails, rails, rails plugins, web development posted by Akhil Bansal

My friend sur wrote and shares his code for Ajax based drag drop sortable tree for rails. He is also trying to pluginize this, and soon it will be publicly available. Find more detail here.

12 Sep 2006

Plugin: state_select, generate drop down selection box for states

RubyonRails, rails, rails plugins, ruby posted by Akhil Bansal

I have wrote my first plugin(state_select). This plugin allows to create drop down list for states, same as country_select method in rails. I know this is not a big deal…

Curently it can generate state list for India, US, Canada, Australia and Spain(default is US).

Usage:

  • state_select(object, method, country='US', options = {}, html_options = {})

Return select and option tags for the given object and method, using state_options_for_select to generate the list of option tags.

  • state_options_for_select(selected = nil, country = 'US')

Returns a string of option tags for states in a country. Supply a state name as selected to have it marked as the selected option tag.

NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.

The svn repository can be found at http://opensvn.csie.org/state_select/trunk/

Install plugin by

script/plugin install http://opensvn.csie.org/state_select/trunk/
« Previous Page