Cross browser event listener
Sometimes, we need to attach or detach an action with an element for specific event where listener function depends on browser. By using following code snippet anyone can do that in all browsers: function addEvent(obj, evType, fn, useCapture) { useCapture = (useCapture === undefined ? false : useCapture); if (obj.addEventListener) { obj.addEventListener(evType, fn, useCapture); }…
Multiple login in google talk
Most of us have multiple google talk IDs and used third party software to login at a time. But, anyone can do multiple login to gtalk by using a simple trick below: Right click gtalk icon and select properties Add /nomutex at the end of target property like following way “C:UsersMorshedAppDataRoamingGoogleGoogle Talkgoogletalk.exe” /startmenu /nomutex Click…
HTTP basic authentication using email address
In my previous article, I have written about HTTP basic authentication in rails using a plain user access YML. Last few days ago, I have modified the logic to log-in using email address and password. So that anyone don’t need to remember another new password. Hope it might help you… Written a news private method…
HTTP basic authentication in rails to protect staging server
Sometimes, you may need to protect your staging server from outside world. It can be done easily by using http basic authentication in rails3. I did following things to use HTTP basic authentication to protect my staging server: YML file with username and password pair: devuser: devpasstestuser: testuserpass Loaded YML data from application initializer: HTTP_AUTH_USERS…
How to deactivate facebook account
Now a days Facebook became part of our busy life and couldn’t think without it. But, if you need to deactivate your account then can do that by following steps below: Once, you deactivate your account, your profile and information will be instantly inactivated. But, information will not be lost however, and will be available…
Rails application deployment using shell script
I have used following shell script to deploy one of my Ruby on Rails applications: DATES=`date +%Y%m%d%H%I%S`service apache2 stop &&mysqldump -u[user] -p[pass] [yourdbname] > “your backup directory”[yourdbname]_${DATES}.sqlgit pull &&bundle install –path [your bundle path] &&bundle exec rake db:migrate RAILS_ENV=production &&mv [your application’s production log file] [your application’s production log backup path]/production_${DATES}.log &&touch [your application’s production…
Using helper method from action mailer views
Action Mailer of Ruby on Rails(RoR) allows you to send emails from application using a mailer model and views. Sometimes you may need to use any helper method though it does not allow by default. In that case you have to include helper(module) in the Mailer class. Say, you may need to use method(s) from…
Disable a user account in Linux
There are some different approaches to do that. The easy way to disable a user account is to alter stored password which is stored to /etc/shadow. In that case password will be lost unless you save save the password in different file. You can alter the password by using following command: passwd {username} {new password}…
How to resize Facebook UI dialog
Once, I had to re-size the facebook UI dialog while working on friends invitation widget for greenarrow.com The widget was loaded under a popup which was wrapped up by an iframe as well. In this case it was not showing properly, the widget was not accommodate in that popup. That’s why had to re-size the…
Ruby interpreter has stopped working
From last couple of days, I was facing a problem with my ruby interpreter. It was crashing continuously after few page requests and getting message: Ruby interpreter (CUI) 1.9.2p180 [i386-mingw32] has stopped working I have tried to find out the reason and frequency to stopped but couldn’t find the actual reason. After googling got a…