Site Archives Web

Install PHPUnit on Leopard


sudo su
pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit
# you can find (/usr/lib/php/pear/PHPUnit)
cd /private/etc
cp php.ini.default php.ini
vim php.ini
find include_path, and change the value to “.:/usr/lib/php/pear”

[Symfony] retrieve fromArray function in baisc model


Once time I wanted to use fromArray function which had created in a model by default, but I can’t find it anywhere. At last I know the reason.
In config/propel.ini, normally it will display :
propel.addGenericAccessors = true
propel.addGenericMutators = true
But if you delete these, fromArray function will not be added when we create a […]

[Symfony] Propel Criteria Note


When we want to use a sql to get rows between two dates, we can use like this:
$crit1 = $c->getNewCriterion( AppEventPeer::CREATED_AT, $end, Criteria::LESS_THAN );
$crit2 = $c->getNewCriterion( AppEventPeer::CREATED_AT, $start, Criteria::GREATER_THAN );
$crit1->addAnd( $crit2 );
$c->add( $crit1 );

[Symfony]Does not work under ‘prod’ on Mac


All things work well under ‘dev’. But, when i want to change to ‘prod’ mode, I can’t see anything at frontpage ‘index.php’.
My solution is changing define(’SF_DEBUG’, false) to (’SF_DEBUG’, true) in ‘/web/index.php’.
Another way is going to ‘/apps/frontend/config/settings.yml’, and find strip_comments, then turn if off like this strip_comments: off. More details you will find here […]

RoR Install On Ubuntu


1. install rails
sudo apt-get install rails
2. install rubygem
download new version:
http://rubyforge.org/frs/?group_id=126&release_id=11889
extract the file, cd /path/to/file
sudo ruby ./setup.rb
sudo gem update
3. install mongrel
before install mongre, install apt-get install build-essential.
sudo gem install mongrel –include-dependencies
cd /yourapp
sudo mongrel_rails start -d -e development
4. config apache / virtualhost
start proxy
cd /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/proxy_balancer.load proxy_balancer.load
sudo ln -s ../mods-available/proxy_http.load proxy_http.load
sudo ln -s ../mods-available/proxy.load proxy.load
sudo […]

difference in ‘==’ and ‘===’


‘$a==$b’ if true, it means the value of $b is equal to $a
‘$a===$b’ if true, it means both the value and type of $b are equal to $a

Play with Dreamhost


Yesterday, I created an account on Dreamhost. It supports many good services like swithing PHP version, ruby on rails, 2 G spaces and so on. caibaohua.com will be transferred to there in the future.