Thursday, August 25, 2011

isNumeric javascript

There is no predefined function to test ,if a value is numeric .
This function helps to check whether a variable's value is numeric or not.

var isNumeric = function(x) {
// returns true if x is numeric and false if it is not.
var RegExp = /^(-)?(\d*)(\.?)(\d*)$/;
return String(x).match(RegExp);

Hope this helps!

Thursday, August 18, 2011

PHP date bug | date ends at 2037

While developing an application having backend in PHP ,when I tried to go past the year 2037 the system jumped back to 1970!
This is a known bug in PHP and is a limitation in counter that is 32 bits long,64bit machines are not vulnerable to this.

As per forum

The last date/time that is working:
19.01.2038 03:14:07 ( =2147480047 )

The workaround for this issue is to have 64 bit machine/OS, if you are running any unix based machines. Also make sure that the time_t is set to 64bit !

Hope this helps... and save your time.