Monday, 2 April 2012

how to check path of ffmpeg or mencoder in linux in php?

<?php
$output = shell_exec('whereis ffmpeg');
echo "<pre>".$output."</pre>";
echo "";

$output = shell_exec('whereis mencoder');
echo "<pre>".$output."</pre>";
echo "";
?>

Output in browser :

Monday, 26 March 2012

How to launch jQuery Fancybox on page load?

//first include fancybox javascript file and jquery javascript file.

<script type="text/javascript">

jQuery(document).ready(function() {
$("a#various2").trigger('click');
});
</script>

Friday, 23 March 2012

how to remove any character using javascript?

I am removing only " - (dash), . (dot), (space) in this exmple.

function dotrm(cit)
{
var cl=cit.length;
var ch=cit;
for(l=0;l<=cl;l++)
{
if(cit[l] == '.' || cit[l] == ' ' || cit[l]=='-')
{
ch=cit.replace(cit[l],'');
}
}
document.getElementById("city").value=ch;
}

Saturday, 17 March 2012

how to backup mysql database using php?

<?php
$backfile="a.sql";
$command="mysqldump  -u root test>$backfile";//
system($command);
?>

Friday, 16 March 2012

how to validate password allow space in middle of string

function spc(str)
{
var l=str.length;//check length of string
for(var i=0;i<l;i++)
{
if(str[0]==' ' || str[str.length-1]==' ')//check first & last character of password
{
document.getElementById("spa_error").innerHTML='Space key cannot be used for the first or last character of your password';
}else
{
document.getElementById("spa_error").innerHTML='';
}
}
}

Monday, 12 March 2012

how to use trim() function in IE below version

Use this function in head section of your webpage and then use trim() function.

if(typeof String.prototype.trim !== 'function') {
  String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, '');
  }
}

Saturday, 10 March 2012

How to add top and bottam pagination in datatable?

First open  jquery.datatables.js file and find   this.sDom = 'lfrtip'; or this.sDom  and then write below code inplace of previous code.

this.sDom = '<"top"iflp>t<iflp>';