Search This Blog

Sunday, January 30, 2011

Command To Show the enabled modules in apache

sudo apache2ctl -l

Enable mode rewrite in apache2 ubuntu

This command works fine in ubuntu ,login as the root and type the following command to enable mode_rewrite.

sudo gedit /etc/apache2/sites-available/default


In the following section change AllowOverride None to AllowOverride All.


 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 # Uncomment this directive is you want to see apache2's
 # default start page (in /apache2-default) when you go to /
 #RedirectMatch ^/$ /apache2-default/



use rewrite rules

sudo a2enmod rewrite



Restart Apache


sudo /etc/init.d/apache2 restart

Friday, January 28, 2011

Wednesday, January 5, 2011

Date validation Java Script

function isValidDate(txtDate) {
           var objDate;  // date object initialized from the txtDate string
           var mSeconds; // milliseconds from txtDate

           // date length should be 10 characters - no more, no less
           if (txtDate.length != 10) return false;

           // extract day, month and year from the txtDate string
           // expected format is YYYY-mm-DD
           // subtraction will cast variables to integer implicitly
           var day   = txtDate.substring(8,10)  - 0;
           var month = txtDate.substring(5,7)  - 1; // because months in JS start with 0
           var year  = txtDate.substring(0,4) - 0;


          // third and sixth character should be /
           if (txtDate.substring(2,3) != '-') return false;
           if (txtDate.substring(5,6) != '-') return false;

          // test year range
           if (year < 999 || year > 3000) return false;

           // convert txtDate to the milliseconds
           mSeconds = (new Date(year, month, day)).getTime();

           // set the date object from milliseconds
           objDate = new Date();
           objDate.setTime(mSeconds);

           // if there exists difference then date isn't valid
           if (objDate.getFullYear() != year)  return false;
           if (objDate.getMonth()    != month) return false;
           if (objDate.getDate()     != day)   return false;

           // otherwise return true
          return true;

    }

Sunday, January 2, 2011

Bring a HTML Div to the center of the page


This is an easy way of making a div center of the screen. Width and margin-top will make it properly at the center of the screen.