I added a CCSprite(with an image) as the background, the fps jumped to 30.0.
when I remove it or change the scale to less than 1.0, the fps would return to 60.0.
Now I am going to find out what's going on here.
May 25, 2011
Apr 14, 2011
Iphone Code Complete
1. how to count time.
CFAbsoluteTime time = CFAbsoluteTimeGetCurrent();
beware that the CFAbsoluteTime is a Double.
2. How to open a URL
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"your url here"]];
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?
> 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,
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, ""); ?>
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
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
> 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*
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*
Subscribe to:
Posts (Atom)