Symfony LswMemcacheBundle LoggingMemcache::get() should be compatible

June 16, 2015

When running Symfony application with LeaseWeb/LswMemcacheBundle, below error: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::get() should be compatible with Memcached::get($key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL) It is cause by php-memcached 2.2.x gives runtime notices and should be avoided! For those who used php-memcached 2.2.x, may uninstall it and install with php-memcached 2.1.0. Using php pecl, […]

Eclipse auto indent, auto formatting, auto alignment shortcut

September 25, 2014

Ctrl+Shift+F to invoke the Auto Formatter Ctrl+I to indent the selected part (or all) of you code. To format it automatically when you save the file, then Goto Window > Preferences > Java > Editor > Save Actions and configure your save actions. Along with saving, you can format, Organize imports,add modifier ‘final’ where possible […]

Best way to test if gzinflate process right string

September 2, 2014

If the string is not gzinflated, there will be error throwing. Simple way to test:

jQuery handle null value in PHP variable or array

August 6, 2014

Handling php array or variable inside javascript directly using json_encode, will result some value null. To check null using jquery in this case:

FuelPHP CRUD – Orm find all where with or & and criteria

March 12, 2014

FuelPHP orm find all criteria with WHERE OR & AND is easy to achieve is we understand the concept behind and built the correct array. The documentation stated as below without multiple criteria such as ‘WHERE (status = “single” OR status = “married”) AND name = “superman” ‘ My success example is as below:

jQuery Datepicker UI language translation implementation

March 11, 2014

There are already localized versions of the jQuery Datepicker. The datepicker includes built-in support for languages that read right-to-left, such as Arabic and Hebrew. http://jqueryui.com/datepicker/#localization For a multiple language website, the easiest way to do it is by loading the related language file which contain the range of rationalization options. After that set the datapicker […]

PHP difference between single-quoted and double-quoted strings/arrays

February 13, 2014

1.Single quoted strings will display things almost completely “as is.” Variables and most escape sequences will not be interpreted. The exception is that to display a literal single quote, you can escape it with a back slash \’, and to display a back slash, you can escape it with another backslash \\ (So yes, even […]

PHP check whether image exists on remote URL

February 12, 2014

The simplest and fastest way is to use curl if your host supports curl.

PHP – How to check if variable is an array?

February 12, 2014

PHP has an internal variables handling functions to finds whether a variables is an array Another fastest way of determining an array is by: Cast the value to an array, then check using (===) if it is identical to the original.

PHP obfuscated or hide part of the email address

January 17, 2014

I wrote my own function for one of the project to display first 3 characters and last characters before the @. In between the first and last 3 characters, put in 3 star (*). So, this is how it looks like