Thursday, June 3, 2010

IE Debugging

The following are errors when everything works in Firefox.

1. Could not get the type property. This command is not supported.

var hidden_field1 = row3.appendChild(document.createElement("input"));
hidden_field1.id = 'request_type';
hidden_field1.type = 'hidden'; // problem

In IE you can't change the type of an input element after it has been added to the document, so set before being appended.

2. Object doesn't support this action

var calendar_icon = document.createElement("button");
calendar_icon.type = "button"; // problem

change createElement('input'); but eventually use ajax callback template;

3. Object required
check if object exist

var dt_select_msg = document.getElementById('dt_select_msg');
if(dt_select_msg) { dt_select_msg.style.display = 'hidden'; }


4. Div Overflow

container {
   height:100%;
   overflow:auto;
   position:relative;
}

Tuesday, June 1, 2010

Symfony Tips (part2)

1. Error 500
http://symfony-check.org/

throw new sfException('Testing the 500 error'); 

http://www.symfony-project.org/gentle-introduction/1_4/en/19-Mastering-Symfony-s-Configuration-Files#chapter_19_sub_default_modules_and_actions

symfony 1.2-
web/errors/error500.php

symfony 1.2+
config/error/error.html.php
config/error/unavilable.php


In application settings.yml
set check_lock to true

2. Session name

# ProjectName/apps/appName/config/factories.yml
  storage:
    class: MysqlSession
    param:
        session_name: xxxsession
        db_table: session
        database: uxsession


http://www.symfony-project.org/reference/1_4/en/07-Databases
symfony use databases.yml to determine the connection settings (host, database name, user, and password)

# ProjectName/config/database.yml

all:
 
xxxsession:
    class:          sfPropelDatabase
    param:
      dsn:          mysql://xxxxxxx


Problem:
Fatal error: Class 'sfPropelDatabase' not found in /root/workspace/ProjectName/cache/appName/dev/config/config_databases.yml.php on line 6

From doctrine to Prople
http://stackoverflow.com/questions/1835676/switch-symfony-1-4-from-doctrene-to-propel

#ProjectName/config/ProjectConfiguration.class.php

public function setup()
{
//    $this->enablePlugins('sfDoctrinePlugin');
      $this->enablePlugins('sfPropelPlugin');
}


Problem:
Fatal error: Declaration of MysqlSession::sessionWrite() must be compatible with that of sfDatabaseSessionStorage::sessionWrite() in /root/workspace/ProjectName/lib/symfony/MysqlSession.class.php on line 2


#ProjectName/lib/symfony/MysqlSession.class.php
public function sessionWrite($id, &$data) //reference parameter


Problem:
Unable to open PDO connection [wrapped: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)]



3. Incomplete Object

Fatal error: xxx_xxxActions::executeGroup() : The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition XXXXXXX of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /root/workspace/xxxx/actions/actions.class.php on line 40

Add the XXXXXXX object into the config.php

require_once('xxxxxx/service/xxxx/XXXXXXX.php');

4. Symfony cc
Different environment, index_dev.php works, index.php not.
Try to symfony10 cc, command not found;
Use ./symfony cc