Monday, June 17, 2013

JavaScript or Jquery hacks....!

1- If you want to redirect to some other url after some seconds; say 5 seconds here; than you need to do below.

 \$(window).load(function() { window.setTimeout(function() { window.location.href = "https://www.google.co.in"; },5000) });

Here function call at setTimeout is necessary because without it redaction will occure immediately.

NOTE-  Jquery load function is triggered when after loading the page in web-browser. Where as ready() function invoked when DOM is ready.

Below codes  won't work as expected.

document.ready(window.setTimeout(location.href = "https://www.google.co.in",5000));

OR

$(window).load(function() { window.setTimeout(window.location.href = "https://www.google.co.in",5000); });

Saturday, June 15, 2013

Wordpress hacks...

1- If below wordpress error in module installation
"
Unpacking the package…
Abort class-pclzip.php : Missing zlib extensions
"
just list the compiled modules with php with "php -m"
or
check with wordpress function which require zlib moulde "var_dump(function_exists("gzopen"));"

whether current php supports zlib or not.if not than recompile it with --with-zlib option.Second
should return true if zlib is one of the compiled module.

Below is one sample to manually configure and install php.

./configure --prefix=/soft_install/php5 --with-apxs2=/soft_install/apache2/bin/apxs --with-mysql
--enable-fastcgi --enable-fpm --with-zlib --with-bz2 --with-xml --with-zlib --enable-mbregex
--with-mhash --enable-xslt --enable-memcache --enable-zip --with-pcre-regex

make & make install