Wednesday, May 23, 2012

sfDependentSelectPlugin: Cannot set property 'onchange' of null

From README:

        // always the selects order has to be according to the dependency.
        // ich means: country > state > city
        $this->widgetSchema->moveField('city_id', 'after', 'state_id');


If you not set the order, you will get a Uncaught TypeError: Cannot set property 'onchange' of null error.

Wednesday, May 16, 2012

Sync Datetime in CentOS

service ntpd stop
ntpdate time.kfki.hu
service ntpd start

ps: or ntpdate pool.ntp.org

Tuesday, May 15, 2012

Wednesday, May 9, 2012

mssql_query Cause net::ERR_EMPTY_RESPONSE in Chrome

If you get net::ERR_EMPTY_RESPONSE Chrome error message when you want to query some simple select with native mssql_query in PHP, you should set mssql.datetimeconvert = Off in php.ini or use ini_set("mssql.datetimeconvert", false); in the code.

Tuesday, April 17, 2012

Add Group to User Automatically when Creating a New User with Form

Add this to the form...
public function save($con = null)
  {
    //Do the main save to get an ID
    $user = parent::save($con);
  
    //Add the user to the relevant group, for permissions and authentication
    if (!$user->hasGroup('Dispatchers'))
    {
      $user->addGroupByName('Dispatchers');
      $user->save();
    }
  
    return $user;
  }

Friday, April 13, 2012

Format Datetime in Symfony

$user->getDateTimeObject('created_at')->format('Y-m-d H:i');

Tuesday, April 10, 2012

Customize Zend Studio

Disable AltGr + N to create a New Document
Windows / Customize Perspective -> Command Groups Availability -> uncheck New PHP Document.

To open a file by double-clicking in Zend Studio, not in external editor
 Add the file type to the list of file types which will automatically be opened in Zend Studio by doing the following:
  1. From Zend Studio 's Menu Bar, go to Window | Preferences | General | Content Types.
  2. The Content Types dialog will be displayed.
  3. Select Text | PHP Content Type from the list.
  4. A list of file types associated with Zend Studio will be displayed.
  5. Click Add to add your file's type to the list, Enter the file type (e.g. .php) and click OK.
  6. The file type will be added to the list.
Encoding / character set + Line delimiter:
Window / Preferences -> General -> Workspace -> Text file encoding -> UTF-8
+
New text file line delimiter

Remove trailing whitespace:
Window / Preferences -> PHP -> Editor -> Save Actions -> Remove trailing whitespace

Ctrl + TAB to the next file
Windows / Preferences -> General -> Keys
Search for: Previous Editor, Next Editor...

Default indentation for array initializers

Window > Preferences > PHP > Code Style > Formatter > Edit... > Line Wrapping
Set Default indentation for array initializers to 0.

Mark Occurrences
Windows / Preferences -> PHP -> Editor -> Mark Occurrences