March 10 2013

Yii rules numerical minimum or maximum display error message

Tagged Under :

Yii
Normally in Yii model rules validation to set the error message like below:
array('username', 'required', 'message'=>'username cannot blank.');

But, numerical validate method is different if you set the ‘min‘ or ‘max‘ inside the rules.

March 02 2013

PHP warning: getdate() [function.getdate]: It is not safe to rely on the system’s timezone settings

Tagged Under :

php
I face a weird problem in PHP. I just upgrade to php 5.3.0 and since the upgrade I’m getting the following warning:
Warning: getdate() [function.getdate]: It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
And date.timezone also added. But the warning still there.

February 03 2013

PHP use curl post xml

Tagged Under :

php
Because I want integrate my web application with one of the famous payment gateway. But they didn’t provide any API and just give the documentation only.

So I write the code myself to communicate the payment gateway server.

February 01 2013

Yii PHPUnit CLI has stopped working

Tagged Under : ,

PHPUnit
Few day ago I install PHPUnit3.7 on my PC. and I follow phpunit.de instruction install on my PC.

So far everything working properly. But when I try run it on Yii, it pop out an alert message “CLI has stopped working”.

January 20 2013

Jquery Array Key Search

Tagged Under : ,

jquery
How to using jQuery search the array key or check for a key exists in an array.

Since JavaScript doesn’t really have associative arrays, then we only write a function to check.

January 20 2013

Jquery Static Array

Tagged Under : ,

jquery
Use a short code to get a value from the database the easy way is using Ajax.

But the short code and value are fixed, we keep it in database is for future reuse it.

So I use another way to get the value. That is an array. use array key find the value.

January 16 2013

Jquery Remove White Spacing

Tagged Under : ,


Use jQuery remove white space to avoid user escape required field.

There is one of the functions from jQuery which help to solve this problem.

January 16 2013

Jquery Find Attribute Name Value of Input

Tagged Under : ,

jquery
Because want use jQuery get the input box value but the input box without the id attribute.

Then need use name attribute to find the input box get the value.

January 12 2013

Mysql replace() function

Tagged Under : ,

MySQL
Because I found that record save inside the database have typo problem.

How to solve it? Normally I will use PHP str_replace to solve the issue. But now requires use SQL to print out all the record and replace the typo.

January 12 2013

Mysql regexp and rlike function

Tagged Under : ,

MySQL
Mysql regexp or rlike function it same as PHP preg_match() function.

It save the time write code and filter the data.