Wednesday, 27 April 2011

How to go start and end of the file open fron VI?

For Beginning press esc then :0
For Ending press esc :$ OR shift+g

Cheers!

Tuesday, 26 April 2011

How to put error message below the field in symfony form?

Hey,

Got to /lib/form/doctrine/BaseFormDoctrine.class.php
adn put following line in public function setup().
$row_format   = "<tr>\n<th>%label%</th>\n<td>%help%%field%%error%%hidden_fields%</td>\n</tr>\n";
$this->getWidgetSchema()->getFormFormatter()->setRowFormat($row_format);

see example below:


## /lib/form/doctrine/BaseFormDoctrine.class.php
<?php

/**
 * Project form base class.
 *
 * @package    passportServices
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormBaseTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
abstract class BaseFormDoctrine extends sfFormDoctrine
{
  public function setup()
  {     
    $row_format   = "<tr>\n<th>%label%</th>\n<td>%help%%field%%error%%hidden_fields%</td>\n</tr>\n";
    $this->getWidgetSchema()->getFormFormatter()->setRowFormat($row_format);     
  }
}

Cheers!

How to remove .svn folder using linux command?

Go to that folder and run the following command:

find ./ -name ".svn" | xargs rm -Rf


Cheers!

Thursday, 27 January 2011

How to remove ^M from VI editor ?

Hellos


To remove this, open your file in vi editor and type
:%s/(ctrl-v)(ctrl-m)//g

OR

:%s/^M//g


Here %s is search and replace command in VI
^M is need to replace
Enter text between // which you want there
and 
finally g is using for all occurrences.




Cheers!

Friday, 21 January 2011

How to run php commands in command line on ubuntu?

Use the following example to run php command in command line:

$ php -a
php > echo 'aswani kumar';
ashwani kumar
php >


Cheers!

Friday, 7 January 2011

How to copy files/folder in ubuntu/putty?

Hi

Suppose you have a folder which name is ashwani & it contains some content and now you want to create new folder name kumar with same content.

So

source = ashwani
destination = kumar

cp -r <source> <destination>

Note: -r is being used for subfolder and files.

Cheers!

Monday, 18 October 2010

How to Find and Replace Text in MySQL Database?

Use the following syntax for replacing text in mysql:

The syntax of REPLACE is REPLACE(text_string, from_string, to_string)

SELECT REPLACE(‘www.mysql.com’, ‘my’, ‘you');

and result will be:

www.yousql.com

Cheers!