Thursday 29 September 2011

How to automatically backup mysql database using cron?

Hi All,

Open crontab in linux server or window server and write the following line. this will backup database each mint.

$crontab -e

press enter and crontab will be opened and write following line:

* * * * * mysqldump -uroot -proot  ipay4me | gzip -9 > /var/www/archive/dbbackup/ipay4me.sql.gz


OR


$vim /var/www/archive/dumpdatabase

Write down following lines into that file:

#!/bin/bash
clear
mysqldump -uroot -hlocalhost -proot ipay4me | gzip -9 > /var/www/archive/dbbackup/ipay4me_$(date +"%d-%m-%Y-%H-%I-%S").sql.gz
exit 0


Set crontab:

50 11 * * * /var/www/archive/dumpdatabase /usr/bin/php Asia/Calcutta >/dev/null 2>&1

This cron will run daily at 11:50 PM



Cheers!

Tuesday 27 September 2011

How to import a compressed mysql file .sql.gz using linux?

Hellos,

Please do the following to do the same.

zcat /newsites/urdutahzeeb/urdutahzeeb.net/dbbackup/urdujoom.sql.gz | mysql -u naughty -p urdujoom

Cheers!


Wednesday 21 September 2011

How to change color on focus of input box using jquery?

Hi Dear,

<script src="http://code.jquery.com/jquery-latest.js"></script>
<style>
.focused {
    background: #abcdef;
}
</style>
<form name="focusForm" id="focusForm" method="POST" >
<table width="100%" cellspacing="2" cellpadding="2" >
    <tr>
        <td width="180">First Name: </td>
        <td><input type="text" name="txtFName" value="" /></td>
    </tr>
    <tr>
        <td>Last Name: </td>
        <td><input type="text" name="txtLName" value="" /></td>
    </tr>
    <tr>
        <td>Age: </td>
        <td><input type="text" name="txtAge" value="" /></td>
    </tr>
    <tr>
        <td>Occupation: </td>
        <td><input type="text" name="txtOccupation" value="" /></td>
    </tr>
    <tr>
        <td>Secret Question: </td>
        <td><input type="text" name="txtQuestion" value="" /></td>
    </tr>
    <tr>
        <td>Answer: </td>
        <td><input type="text" name="txtAnswer" value="" /></td>
    </tr>
</table>
</form>
<script>
//$("#focusForm input:first").focus();
//$("#focusForm :input").attr('disabled','disabled');
$("#focusForm :input").live("focus blur", function(e) {
    var el = $(this);
    el.toggleClass("focused", el.is(":focus"));
});
</script>

Cheers!

Tuesday 20 September 2011

How to check all checkbox using jquery?

Hi Guys!

include jquery.js on the top of file and then write following code:

<form name="frm" id="frm" >
<input type="checkbox" name="abc[]" id="1" value="1" >Yes
<input type="checkbox" name="abc[]" id="2" value="2" >No
<input type="checkbox" name="abc[]" id="3" value="3" >None
<input type="button" name="btnCheckAll" value="Check All" onclick="checkAll();" />
</form>
<script>
function checkAll(){
$("#frm input[@name='abc'][type='checkbox']").attr('checked', true);
}

Cheers!