Category: Uncategorized

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

$c->add(TblUsersPeer::USR_TYPE,array(2,3,6),Criteria::IN);
$c1 = $c->getNewCriterion(TblUsersPeer::USR_PARENTID,$this->getUser()->getAttribute(‘userid’),Criteria::EQUAL);
$c2 = $c->getNewCriterion(TblUsersPeer::USR_PARENTID,null, Criteria::ISNULL);
$c1->addOr($c2);
$c->add($c1);

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.

3.

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(“-“);
laterY=laterdate[0];
laterM=laterdate[1];
laterD=laterdate[2];

earlierdate = date2.split(“-“);
earlierY=earlierdate[0];
earlierM=earlierdate[1];
earlierD=earlierdate[2];

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;

}