Yearly Archives: 2011
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…
LF will be replaced by CRLF
I was getting following message while trying to add files to GIT index: Warning: LF will be replaced by CRLF …. By google search I found that – whenever tried to add files to the repository, git thinks that, the file is a text file and all files automatically will have their LF line endings…
Install mysql2 gem on Windows 7
Last couple of days ago, I was stuck to install mysql2 gem on windows7 for rails3 and tried lots of instructions by googling. Unfortunately, those were not worked for me. Finally, I have specified a older version of mysql2 during installation which worked for me. Following are the steps which i did: Install Mysql 5.5…