Archive for July, 2009

CakePHP in Japan

Friday, July 24th, 2009

Cakephp Bakers are increasing rapidly in Japan. I think there are some reasons as follow.

1. Books

There are over 7  japanese books for CakePHP!  Japanese Book is very important factor to get many developers in Japan.

Some books for beginner(XAMP install, bake, create small applications), some books for intermediate or higher level( component, behavior, helper, test cases, mobile site, Routing, callbacks, create practical applications).

You can see book covers followin link (Japanese web site).

http://d.hatena.ne.jp/keyword/CakePHP

2. Community Site

Japanese cakephp community ( http://cakephp.jp ).  There is a good forum on its web site. Many bakers ask questions and argue many topics in japanese , very usefull for not only beginners but also higher level users. Sometimes find some bugs in that discussion, then post tickets for trac.cakephp.org.

3. Events

Now in japan,  it is boom of meet-up for study( Programming, Design, Server Operation, etc ). In these meet-up, many different company people come together after working or in a holiday, and discuss some topics, often talking with drinking beer :-)

There were some CakePHP meet-up in  Tokyo, Osaka and Fukuoka. This is a report of CakePHP meet-up at Tokyo. http://bakery.cakephp.org/articles/view/report-cakephp-meet-up-at-tokyo-4th

In these meet-up, 50 or 100 japanese bakers come together, so nice events.

4. Blogs

There are many japanese baker’s blogs. Some bakers post good articles ( how to solve a problem, find bug, explain or make compoent, behavior, plugins,etc). If we have problems, we can find japanese articles of that resolutions  easily with the google.

It is very important to get many japanese information and resolutions easily.

Validation error message i18n

Thursday, July 23rd, 2009

In a Model, we can define validation error message as follow

<?php
class User extends AppModel {
	var $validate = array(
		'email' => array(
			"email_invalid" => array('rule' => VALID_EMAIL,
				'required' => true,
				'message'    =>    'Invalid Email address.',
	),

But, can not use i18n function __() for validation error messages .
This is a solution to do it.

<?php
class AppModel extends Model {

	//Validation message i18n
	function invalidate($field, $value = true){
		parent::invalidate($field, $value);
		$this->validationErrors[$field] = __($value, true);
	}
}

Model::invalidate method is called in validation processing(Model::validates , Model::invalidFields).
This solution override Model::invalidate and set __() in each error messsage.

Then, you write po file of each language, language of validation error messages change depending on browser language configuration.

SQL syntax highlighting for Debug_kit

Wednesday, July 8th, 2009

I make SQL syntax highlighting feature for sql log panel of Debug_kit. I use GeSHi for syntax highlight.

Source code download here(include GeSHi).

You can see diff code here.

screen shot

debugkit_geshi_sql3

Hello Baker!

Wednesday, July 8th, 2009

test

<?php echo "Hello baker!"; ?>