Thursday, December 30, 2010

2 steps to install sqlite 3 on ubuntu for ruby

open a console and write two steps one by one
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby
And you are done :)

Thursday, October 7, 2010

MTNL broadband not opening certain websites

:) then what to do.. i just got one MTNL TriBand broadband unlimited connection for my home in Palam Colony, New Delhi. Everything was great except that it was not opening certain web links like linkedin.com, assembla.com, cricketnirvana.com most of the time and within two days of installation, frustration was so severe that i looked up for google for any help(mind you MTNL,Delhi people they are awesome at NOT resolving any issues like this)
On a random look out for solution i found two things..
1. Change PrimaryDNS and SecondaryDNS to 208.67.222.222 and 208.67.220.220 respectively
and
2. Change TCP MTU Option(in interface page of ADSL router) to 1400

and Final step, Do a restart (one of the option in 'Maintenance' page)
and see if it works for you.. it worked for me :)

Just for information i am having a ADSL router of Sterlite(Firmware Version :2.11.38.0(UE0.C2)3.9.9.5)(provided by MTNL) and am using my own netgear wifi router on top of it,

Monday, October 4, 2010

How to Stop an Ajax request in prototype.js

Question is what will you do if you are using prototype.js(which is not having any abort method) for making a Ajax request and due to some circumstance you want to abort the ajax request raised. Well one can think that this is a narrow requirement, why will anybody need to do this because in the meantime request will be done and one might be having the response in return from server.

I hit this corner case where page content was loading from an Ajax request and which after rendering was firing another Ajax request to update the paginate-r(which is also self firing the request on response completion), but to my surprise i was not able to control the "Ajax request to update paginate-r" and hence i am creating the self firing request but am not able to destroy them.

And i don;t know for what reason there is no "ajaxRequest.abort()" method. And i found the answer from a narrow corner of http://blog.pothoven.net/2007/12/aborting-ajax-requests-for-prototypejs.html and it worked and just to increase the find-ability of this solution am re-writing the post.

introduce a method abort like this for prototype.js
Ajax.Request.prototype.abort = function(){
this.transport.onreadystatechange = Prototype.emptyFunction(); //prevent state change callbacks from being issues
this.transport.abort(); //abort the XHR
Ajax.activeRequestCount--; //updates the request counter
};

and then in your code
write it somewhere so that it is executed only once
<script>
var cw_paginator_request = null;
</script>

and then to assign the request if null else abort the request and fire a new request, like this
<script>
if(cw_paginator_request != null){
cw_paginator_request.abort();
}
cw_paginator_request = <%=remote_function(:url => {:controller => "some_controller", :action => "update_paginator", :id => @selected_id }) -%>;
</script>

Hopefully it might help somebody in need :)

Tuesday, July 13, 2010

Now what will you interpret from this?


This is from the showcase of a bookstore in CP, Delhi. What you(hindi reading) all can interpret from this?
Posted by Picasa

Monday, May 24, 2010

3 step Memcache install in ubuntu with rails binding

#To Install memecache
sudo apt-get install memcached
#To restart memcahce
/etc/init.d/memcached restart
#To install ruby binding gem to memecache
sudo gem install memcached




and to start memcache automatically on system startup
sudo gedit /etc/default/memcached
# Set this to yes to enable memcached.
ENABLE_MEMCACHED=yes

Saturday, May 22, 2010

3 step RMagick install in rail/ubuntu

sudo apt-get install imagemagick
sudo apt-get install libmagick9-dev
sudo apt-get install libmagickwand-dev
sudo gem install rmagick

yes thats it :)

Tuesday, May 4, 2010

Mirrored text is fine but why upside down

It has been really a while now.. have posted something here :) but its better late than never..
This post is about one of the head turning material that i got while i was going in for tea break on the other side of road (we do so because its small fun break even though we have very good pantry)





And i was wondering this is to seek attention of viewers and will act as publicity stunt or some more un-understandable logic behind it!! what you say??

Honda Civic & A/C problems.

Hello Friends, Got a post again on to Honda Civic (The good old favorite commuter of mine). This car has been doing great except for so...