Category: Uncategorized

How to untar or uncompress tar or tar.gz file

Untar files in Current Directory

tar xvf whatevername_yougive.tar

If you want to untar in specified directory

tar xvf whatevername_yougive.tar -C /path/of/directory/to/un-archive

Check how to compress or create tar file here

How to copy file from local machine to remote server in linux

scp fileName userName@remoteServerIP:remoteServerFolderPath

Example :
>scp abc.txt root@XXX.XXX.XXX.XXX:/home/xyzFolder/

once you type this command, system will ask for the remote server login password.once password is verified , file get copied to remote server.

How to add or condition in mysql query in symfony

$c1 = $c->getNewCriterion(TblUsersPeer::USR_PARENTID,$this->getUser()->getAttribute(‘userid’),Criteria::EQUAL);
$c2 = $c->getNewCriterion(TblUsersPeer::USR_PARENTID,null, Criteria::ISNULL);

unicode issue in Perl CGI

When some special character(or other language data) is displayed as ‘? ? ? ? ?’ in browser, then you have to make the following change.

1.In your table set the collation of the field that is to be displayed as “Binary”.

If this does not work then you can try the below option in your cgi script

2. Set the meta-type in your templates file as

“<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />”.

If the above two does not work,then try the third option.


use Encode qw(encode decode);

my $text = decode (‘utf8’, $value_to_be_decoded);

To calculate date difference between two given dates

function timeDifference(startDate,endDate)

date1 = startDate;
date2 = endDate;

laterdate = date1.split(“-“);

earlierdate = date2.split(“-“);

var laterdate = new Date(laterY,laterM,laterD);
var earlierdate = new Date(earlierY,earlierM,earlierD);

var difference = laterdate.getTime() – earlierdate.getTime();

var daysDifference = Math.floor(difference/1000/60/60/24);
difference -= daysDifference*1000*60*60*24
var hoursDifference = Math.floor(difference/1000/60/60);
difference -= hoursDifference*1000*60*60
var minutesDifference = Math.floor(difference/1000/60);
difference -= minutesDifference*1000*60
var secondsDifference = Math.floor(difference/1000);

return daysDifference;