Saturday, August 21, 2010

xmanager for linux

The title may seem stupid. But believe me that is what I have searched for. I wanted to run the applications of a far_away_computer on a local_computer as of they are applications of local_computer
The steps

  1. In the sshd_config if far_away_computer check for

    X11Forwarding yes
  2. On the local_computer edit ssh_config to have

    ForwardX11 yes
    or use the -X flag every time u connect to far_away_computer
  3. Once you are connected to far_away_computer from local_computer, start xterm on the far_away_computer.

Both ssh_config and sshd_config will be present in either /etc or /etc/ssh

Sunday, August 15, 2010

disable zend layout on home page

$this->_helper->layout()->disableLayout();

where $this represents the controller

Zend Router application.ini

if you want http://domain.com/user to be mapped to http://domain.com/index/index/username/kranthi
use this in your application.ini file
resources.router.routes.route_id.route = "/user/:username/*"
resources.router.routes.route_id.defaults.controller = "index"
resources.router.routes.route_id.defaults.action = "index"
resources.router.routes.route_id.defaults.username = "kranthi"

this code executes before transferring the control to the controller

in zend docs it is mentioned
$router = $ctrl->getRouter();
here $ctrl is an instance of Zend_Controller_Front and should be declared before running your bootstrap file in your index.php (single point of entry) file
$ctrl  = Zend_Controller_Front::getInstance();
$router = $ctrl->getRouter();
.
.
.
$application->bootstrap()
            ->run();

Monday, August 9, 2010

Datatype mismatch

Dont use the typecast blindly. Make it a practice to log datatype mismatches

Saturday, August 7, 2010

Syntax highlighter for this blog

Typecasting to int or float

easy solution is
$val = $val + 0;
And PHP will take care of the rest.
If you want to ensure that the variable is integer is_numeric is the way to go. is_int and is_float will be of little help here.
Also note that will always evaluate to true
if ((int)$value == $value)
that is because of the internal typecasting of the equality operator