Laravel Lumen API Validate Json Array

February 18, 2021

I have this json array as my request data from API. Example input: { “name”: “Test Bundle”, “sku”: “SKU123″, “qty_available”: “2″, “items”:[ { "sku": "SKU123-1", "qty_required": "1", "item_price": "32.00" }, { "sku": "SKU123-2", "qty_required": "1", "item_price": "12.00" } ] } Validation in laravel: // validate request data $bundle_data = $this->validate($request, [ 'name' => 'required|string|min:1|max:255', 'sku' […]

MySQL Your password does not satisfy the current policy requirements

December 28, 2020

This happened due to MySQL Validate Password Policy level is higher. You can see password validate configuration metrics using the following query in MySQL client: SHOW VARIABLES LIKE ‘validate_password%’; The output should be something like that : +————————————–+——-+ | Variable_name | Value | +————————————–+——-+ | validate_password.check_user_name | ON | | validate_password.dictionary_file | | | validate_password.length | 6 […]

Mac OSX Kubernetes Run `brew link` on these: kubernetes-cli

July 26, 2020

You may see this error after installed Kubernetes and run “brew doctor”. Warning: You have unlinked kegs in your Cellar. Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run `brew link` on these: kubernetes-cli It can be solved by running below […]

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 […]