Written on September 29, 2009
by Zaki
and 2 peoples have comment
Share
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 09, 2009
by Zaki
and No one have comment
Share
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;
}
Written on June 09, 2009
by Zaki
and 2 peoples have comment
Share

FeedMalaya is a social blog aggregator that pull out the best content from Malaysian bloggers was launched on June 7th, 2009 developed by Bat InfoMalaya and myself.
[Click here to read more...]
Written on May 30, 2009
by Zaki
and 2 peoples have comment
Share
This is very simple approach to validate date input in DD-MM-YYYY format.
var validate_date = function(date) {
if ( date.match(/^(\d{1,2})\-(\d{1,2})\-(\d{4})$/) ) {
var dd = RegExp.$1;
var mm = RegExp.$2;
var yy = RegExp.$3;
// try to create the same date using Date Object
var dt = new Date(parseFloat(yy), parseFloat(mm)-1, parseFloat(dd), 0, 0, 0, 0);
// invalid day
if ( parseFloat(dd) != dt.getDate() ) { return false; }
// invalid month
if ( parseFloat(mm)-1 != dt.getMonth() ) { return false; }
// invalid year
if ( parseFloat(yy) != dt.getFullYear() ) { return false; }
// everything fine
return true;
} else {
// not even a proper date
return false;
}
};
Written on April 13, 2009
by Zaki
and 1 people has comment
Share
Here a simple usage of hover on table compatible with all modern browser with a little help from jQuery.
jQuery(function($) {
$("table tbody tr").hover(function() {
$(this).addClass("hover");
}, function() {
$(this).removeClass("hover");
});
});
As for the Stylesheet, you can add
table tbody tr { background: #fff; }
table tbody tr.hover { background: #fafafa; }
Recent Comments