Configure HTML/JavaScript

Tuesday, October 23, 2012

Passing Objects as parameters in PHP


Objects are Passed by reference by default:

By default the php objects are passed by reference below example will make it more clear. that is why when we copy object it property's are pointing to the same reference

class {
    public 
$foo 1;

$a = new A;$b $a;     // $a and $b are copies of the same identifier
             // ($a) = ($b) = 
$b->foo 2;
echo 
$a->foo."\n";  //this will output 2 as the reference is copied
                    //$a and $b is point to the same location

$c = new A;$d = &$c;    // $c and $d are references
             // ($c,$d) = 
$d->foo 2;
echo 
$c->foo."\n";

$e = new A;

function 
foo($obj) {
    
// ($obj) = ($e) = 
    
$obj->foo 2;
}
foo($e);
echo 
$e->foo."\n";
?>

the output of the above sample example will
2
2
2



/*
 * Created on Oct 24, 2012
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

 class ClassTesting {
 
  private $foo;
 
  function __construct($foo){
  $this->foo = $foo;
  }
 
  private function ent($foo){
  $this->foo = $foo;
  }
 
  public function ret($obj){
  $obj->foo = 'this';
  var_dump($obj->foo);
  }
 }

 $x = new ClassTesting("man");
 $a = new ClassTesting("dog");
 $x->ret($a);

?>

Monday, October 8, 2012

Log file location in Linux

Linux log file location:


you can find various logs related to the linux in the following folder

/var/log/

Under this there are many files contains different types of logs of the system. like syslog contains system related logs

it looks like below:


  • /var/log/message: General message and system related stuff
  • /var/log/auth.log: Authenication logs
  • /var/log/kern.log: Kernel logs
  • /var/log/cron.log: Crond logs (cron job)
  • /var/log/maillog: Mail server logs
  • /var/log/qmail/ : Qmail log directory (more files inside this directory)
  • /var/log/httpd/: Apache access and error logs directory
  • /var/log/lighttpd: Lighttpd access and error logs directory
  • /var/log/boot.log : System boot log
  • /var/log/mysqld.log: MySQL database server log file
  • /var/log/secure: Authentication log
  • /var/log/utmp or /var/log/wtmp : Login records file
  • /var/log/yum.log: Yum log files

Monday, October 1, 2012

Checkbox Value in java or php

Getting Checkbox Value in backend in java or php:


While sending checkbox value from front end HTML to java or php few thinks we need to take care.

1. unchacked checkbox value will not available in the backend(java/php)
2. unchecked checkboxattribute will not available in the java end. if there is a checkbox named 'chck1' and its not checked in the html end. it will not available in the java end. when you will write request.hetAttribute("check1"); it will through an error as these will not a attribute in the request array.


please add anything if i am missing.