Saturday 30 April 2011

How to setup symfony project?

Hey Fox,

Download symfony project.
create folder let suppose symfony_test i.e, mkdir symfony_test
Go into symfony_test and create lib folder i.e, c:\>symfony_test> mkdir lib
Go into lib folder and create vendor folder ie., c:\>symfony_test\lib\> mkdir vendor

Now,

extract symfony project into vendor folder.

Further, open command prompt and type the following
c:\> cd wamp\www\symfony_test
c:\wamp\www\symfony_test> php lib\vendor\symfony\data\bin\symfony generate:project jobeet
c:\wamp\www\symfony_test> php symfony configure:database "mysql:host=localhost;dbname=jobeet" root root
c:\wamp\www\symfony_test> symfony generate:app --escaping-strategy=on --csrf-secret=UniqueSecret frontend


OR



Now, create the frontend application by running the generate:app task:
$ php symfony generate:app frontend




create model, form and filter on the basis of schema.yml and then

I am going to create a module "job" on the basis of model "JobeetJob"

c:\wamp\www\symfony_test> php symfony doctrine:generate-module --with-show --non-verbose-templates frontend job JobeetJob


Cheers!



How to run symfony on dos prompt?

Hey,

To run symfony in windows machine, you just set the Environment Vairables if not set for php.

Following are the steps to set Environment Variables on window machine:

Right click on MY Computer
Go to properties
Choose the Advanced tab
Click Environment Variables
Now you can edit the environment variables of the system.
In this window, you will see User Variables and System Variables.
If you change in User Varibale then changes will be applicable for your login only.
If you change in System Variable then changes will be applicable for all users.
So,
find "PATH" variable in the list of system variables.
Select it and press edit button given below.

Let Suppose, this example using wamp and wamp installed in D: drive.

now,

append the following line in variable value fields:
D:\wamp\bin\php\php5.2.8\

this folder conatains php.exe file.

now press OK and save the configuration.

Futher, the most important point. Restart your machine.


Note the ; character. It is used to separate directories in the variables, so be sure it is present.

Again, D:\path\to\php is where your php.exe is located.

Cheers!

Wednesday 27 April 2011

How to read last 10 line in a file using linux command?

tail -10 filename

also,

tail -f filename

Cheers!

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!