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

Magento 2 Error Can’t run this operation: deployment configuration is absent.

January 5, 2021

We all know that Magento has CLI command. You can call Magento CLI commands using shortcuts instead of the full command name. For example, you can call bin/magento setup:upgrade using bin/magento If you sees this error:  Can’t run this operation: deployment configuration is absent. Run ‘magento setup:config:set –help’ for options. Please check whether your two files are […]

MAC Big Sur NGINX Installation PHP-FPM error

December 28, 2020

After PHP7 installation and try run $ php-fpm Below error: ERROR:failed to open configuration file ‘/private/etc/php-fpm.conf’: No such file or directory.. It is due to the configuration file with the path /private/etc/php-fpm.conf and the file does not exist. To solve this cp /private/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf After copying this file, you need to modify some of the things in […]

Laravel 7 Digitalocean managed database error: The server requested authentication method unknown to the client

July 20, 2020

I am using Laravel 7 to do testing on DigitalOcean’s managed database cluster. Laravel connection doesn’t work, with error and I have fo find the fix that causing it. Illuminate\Database\QueryException SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client This issue has been fixed in PHP7.4, please install PHP7.4 in the Droplet. If […]

Laravel & NPM installation Steps

July 15, 2020

Create a new laravel project. $ composer create-project –prefer-dist laravel/laravel   my-project (NOTE: if you do not have composer, please install in your machine and make it global. This will make a lot easier) Or Clone the repository from github or your private repo. $ git clone <your repo> Install NPM globally if you haven’t installed that […]

PHP Apache2 Laravel Resource interpreted as Stylesheet but transferred with MIME type text/html: “

July 13, 2020

Depending on your server configuration. Some condition, it can be solved by creating an .htaccess file into your root folder (or update the existing one) with this line inside AddType text/css .css this will tell apache to send the right content-type header for .css file On my case, the above won’t work at all. My own hosted Ubuntu needs below changes so […]

[Phpmyadmin] Temporary disable phpmyadmin how to?

December 19, 2016

Phpmyadmin is an easy tools to have visualize interface to access database. If it is not in use, better to disable it to protect your site from hack or SQLInjection, You do not want to remove it, because in future it might be needed again, so just disable it in a simple way and enable […]

Building ‘_imagingft’ extension error command ‘cc’ failed with exit status 1

November 3, 2015

This error is due to freetype header missing. _imagingft.c:73:10: fatal error: ‘freetype/fterrors.h’ file not found #include <freetype/fterrors.h> ^ 1 error generated. error: command ‘cc’ failed with exit status 1  First, verify freetype is installed. With brew: brew install freetype If freetype installed, warning message shows: Warning: freetype-2.5.5 already installed Next to fixed the issue, is […]

Screen Shot 2015-11-03 at 11.33.25 AM

Pip Install error: invalid command ‘bdist_wheel’ Mac Os

November 3, 2015

Install the wheel package first: pip install wheel If requirement already satisfied, you will see: Requirement already satisfied (use –upgrade to upgrade) Then, you should update your setuptools: pip install setuptools –upgrade Run again pip install, it should works now!

python validate string allowed only spaces, alphabet and numbers

September 29, 2015

Using pattern matching, this is not hard to achieve. To check that each character matches your requirements Regular expression “^[a-zA-Z0-9_]*$” With spaces checking: “^[a-zA-Z0-9_ ]*$” Code example: if allow_special_char == False: import re if not re.match(“^[a-zA-Z0-9_ ]*$”, gname): print “Invalid” Regular expression refer from http://stackoverflow.com/a/336220/1903116 reference: http://stackoverflow.com/questions/19970532/how-to-check-a-string-for-a-special-character