Written on November 04, 2009
by Zaki
and No one have comment
Yes, I have a problem with CodeIgniter built-in Form Validation Library, the lack of direct Regular Expression test/rule is a huge turn off for me especially when I need to use Regular Expression to as a rule to verify user input.
There are alternative with the use of “callback” to by creating an additional method inside your Controller. The solution is good if you have a complex filtering but why bother when all you need to do is a simple RegExp verification. Based on my Twitter status:
[Click here to read more...]
Written on October 04, 2009
by Zaki
and 2 peoples have comment

The default WordPress title using the_title() structure is acceptable but lack SEO. Some Wordpress theme already try to improve the structure instead of just the default value, most theme I been using has adopted this method.
<title><?php wp_title('--',true,'right'); ?> <?php bloginfo('name');?></title>
I prefer a more informative title display to improve SEO for your blog/website.
<?php
function seo_title()
{
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
wp_title('«', true, 'right');
if ($paged > 1)
{
echo ' Page ' . $paged . ' —';
}
echo ' ';
bloginfo('name');
if (is_home() && $paged === 1)
{
echo ' — ';
bloginfo('description');
}
}
?>
<title><?php seo_title(); ?></title>
Written on September 29, 2009
by Zaki
and 2 peoples have comment
Malaysia recently introduce a rounding mechanism for trading to remove the need for 1 cent in the market, but with this new implementation it cause us web developer more task to make it work with our current application.
The Rounding Mechanism is a method whereby the total bill amount (including goods and services subject to tax) is rounded upwards or downwards to the nearest multiple of 5 sen. In this regard, total bill amount that ends in 1, 2, 6 and 7 sen will be rounded down while 3, 4, 8 and 9 sen will be rounded up to the nearest multiple of 5 sen.
For example, a total bill amounting to RM82.01 will be rounded down to RM82.00. If it amounts to RM82.04, it will be rounded up to RM82.05.
Source BNM Rounding Mechanism
[Click here to read more...]
Written on July 14, 2009
by Zaki
and No one have comment

Previously if there a need to something like this, I would have definitely create a temporary tool using PHP to automatically loop a SELECT and UPDATE each field inside the loop, for example:
$sql = "SELECT * FROM item";
$query = $this->db->query($sql);
foreach( $query->result_array() as $row ) :
$this->db->query("UPDATE relationship
SET rel_date=?
WHERE (rel_value=? AND rel_type=1)", array(
$row['item_datetime'],
$row['item_id']
));
endforeach;
This actually can be simplify using only MySQL query such as:
UPDATE relationship r, item i
SET r.rel_date=i.item_datetime
WHERE (r.rel_value=i.item_id AND r.rel_type=1)
Written on July 09, 2009
by Zaki
and No one have comment
This is actually just a modification from JavaScript Round To Nearest Number by Talk in Code. Instead of getting the nearest digit, we will actually get the rounding to the next nearest number.
function roundNextNearest(num, acc) {
if ( acc < 0 ) {
return Math.round(num*acc)/acc;
} else {
var value = Math.round(num/acc)*acc;
if (value < num) {
value += acc;
}
}
return value;
}
Recent Comments