Yearly Archives: 2010
Form validation using jQuery
I have written a simple form validation script using jQuery for one of my projects though it have improvement opportunity. Anyone can use it easily by following four simple steps below: STEP 1: Add jQuery plugin to your application STEP 2: Copy following codes in to a JavaScript file and add the file after jQuery…
PHPMailer: Called Mail() without being connected
I was getting the error message to send email using PHPMailer but didn’t get so much help after googling. Then, started to debug the error source and found that it generate for SMTP port and protocol mismatch. Usually, SMTP port is not same for different protocol with/without ssl. So, It’s very important to find the…
Mysql backup on linux using ssh and cron
Sometimes, we may need to backup and synchronize mysql on linux as a background process. Linux has a great program for this called cron. It allows tasks to be automatically run in the background at regular intervals. Create a script file(.sh) using following code snippet to backup and restore database in to another database: ssh…
Find mouse pointer position using JavaScript
Sometimes we need to know the mouse cursor position to perform a certain action at that place. For example, I need to show up a popup div near the mouse cursor position when user click over a particular field/link. You can get the mouse cursor position using following codes: function getCursorPosition(e) { e = e…
How to do custom redirection of a website
Usually the redirection needs when a website changed/move to different location though it may use for lots of other purposes. In this post, I have explain how you can do it by using .htaccess Say, your site has lots of URL and you want to redirect some of those which query string has a parameter…
Change file extension in URL
In my previous article I have shown how you can use different extension of a file instead of .php explicitly but in this post I have explain how to rewrite the URL instead of renaming the file extension explicitly. To rewrite the URL you must add following lines in a .htaccess file and place it…
Hide the fact that the web pages are written in PHP
Sometimes you may want to hide the fact of your web site’s written language to visitors then you can do it easily by using .htaccess Say, you have developed your site by using PHP and wanted to show it as ASP then you can do it by using following tricks: Just add following line in…
HTML coding guidelines
This is my third article about coding guidelines. In this article I wanted to give you some general guidelines for HTML coding that will help to improve readability, maintainability and code reuse. It will reduce browser related problem. Following are some guidelines: Must be use doctype in your web page. Everyone should be write well-formed…
Specify rendering engine of IE
Internet Explorer 8 supports different document compatibility to ensure that your web pages have a consistent appearance in future versions. If you are having trouble on a site in different IE, you can use specific rendering mode to display your web pages by using simple META tag. Below is the META tag to use IE7…
The bundled mysql.rb driver has been removed from Rails 2.2
After two months, I have started working on rails again and upgraded Rails to 2.3.2 on my laptop. After upgraded when I have tried to run a sample rails application and got following errors: => Booting WEBrick=> Rails 2.3.2 application starting on http://0.0.0.0:3000!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install…