Friday, 11 June 2010

How to clear Simfony Chache?

First go to the project foleder and then type the following command on command line i.e., Terminal

$ php symfoy cc

and then press enter.

This will clear all the cache of your project.

Thanks

Cheers!

How to GET, POST or REQUEST parameters in symfony?

suppose, randomToken variable coming from the last page either GET or POST.

Using the following command, you can fetch that variable:

$rondomToken = $this->getRequestParameter('randomToken');

Cheers!

How to set Cookie in symfony?

// cookie getter
$string = $this->getRequest()->getCookie('mycookie');
 
// cookie setter
$this->getResponse()->setCookie('mycookie', $value);
 
// cookie setter with options
$this->getResponse()->setCookie('mycookie', $value, $expire, $path, $domain, $secure);
 
If you want to manipulate cookies outside of an action, you will need to access the Request and Answer objects without shortcut: 
 
$request  = sfContext::getInstance()->getRequest();
$response = sfContext::getInstance()->getResponse();
 
 
Cheers! 

How to set, get and remove session variables in symfony?

## Create Session Variables...
$this->getUser()->setAttribute('nickname', 'ashwani');


## Retrieve Session Variables...
$this->nickname = $this->getUser()->getAttribute('nickname');
   
## Check if session is exist return 1 else blank value...
$hasNickname = $this->getUser()->hasAttribute('nickname');

## Remove Session Variable...
$this->getUser()->getAttributeHolder()->remove('nickname');

Cheers!

Wednesday, 9 June 2010

How to see IP Address of a system in Linux?

Write following command on command line:

$ /sbin/ifconfig/

As soon as you enter, you will se following on the screen:

eth0      Link encap:Ethernet  HWaddr 00:25:64:ba:67:2d 
          inet addr:192.168.29.231  Bcast:192.168.29.255  Mask:255.255.255.192
          inet6 addr: fe80::225:64ff:feba:672d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:51598 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27730 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15121530 (14.4 MB)  TX bytes:6643763 (6.3 MB)
          Interrupt:16

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12269 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12269 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:13829812 (13.1 MB)  TX bytes:13829812 (13.1 MB)

The bold text is your IP Address.

Thanks

Cheers!

What are the upload credentials for php.ini ?

Following are the hierarchy for uploading a file:

memory limit > upload post size > upload max filesize

by default in php.ini, it is 16M > 4M> 2M.

Cheers!

How to access LAMP configurations from putty?

Type the following command on command line:

For edit apache configuration file use the follwoing :
$ gedit /etc/apache2/httpd.conf
$ gedit /etc/apache2/apache2.conf


For edit php.ini file, use the follwoing :
$ gedit /etc/php5/apache2/php.ini

Cheers!