Apr 2, 2011

install ssh on ubuntu

I didn't use apt for a long time, so...first I updated apt...

> apt-get update

then,
> apt-get install openssh-server

after ssh get installed..

> /etc/init.d/ssh start

done!!
pretty simple, right?

Apr 1, 2011

About error messages and locales

Localization
1. create file for localization
/protected/messages/
/en/default.php
/cn/default.php
/jp/default.php

2. specific a lang
Yii::app()->language = "en"
: this means your en folder under /protected/messages.

3. in your default.php, write things as follows,

return array(
'name' => 'xing ming',
'required' => 'bu neng wei kong',
);
?>

4. anywhere you want to use the localized name, write,
Yii::t('default', 'name');

custum error message.
1. in your model/Model.php, find function rules.
return array(
array('name, mail', 'required', 'message' => Yii::t('default', 'required'); ),
);

2. This tag will show all the form errors in a block.
The second param is the title of the block.
Here I leave it blank.
errorSummary($model, ""); ?>



Mar 18, 2011

connect to remote mysql

1. if there is a firewall
sudo /sbin/iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 3306 -j ACCEPT

2. in my.cnf, set
bind-address = your IP

Mar 12, 2011

memcached can't link to libevent.so

> ldd /usr/bin/memcached
> LD_DEBUG=libs /usr/bin/memcached -v
> sudo ln -s /usr/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5

Mar 10, 2011

Install Git

install git on a plain CentOS 5.5 64bit machine:

you may not have these three libraries, so install them first.
> yum install openssl-devel.x86_64
> yum install curl-devel.x86_64
> yum install expat-devel.x86_64


now , go to your git source directory, and hit the following command,

> make
> make install

you shall now find the git commands as bellow,

/root/bin/git*

Jan 24, 2011

Yii - default timezone

1.set default timezone
Encountered an error which was described here:
http://php.net/manual/en/function.date-default-timezone-set.php
I added the following line to the index.php
date_default_timezone_set("Asia/Tokyo");

2.Gii

'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'123456',
'ipFilters'=> array('localhost', '127.0.0.1', '192.168.2.249'),
),
),



3. Gii
"CDbConnection failed to open the DB connection: could not find driver"
I didn't get the proper pdo_php support.
I re-configured php using the following command:
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-pdo-mysql

...fixed now

Sep 22, 2010

NOTES about YII

1. gii

'gii' =>array(
'class' => 'system.gii.GiiModule',
'password' => '****',
'ipFilters' => array(
'127.0.*',
),
),