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

PHP get first day of current month, datepicker friendly

December 22, 2014

The simplest and readable way to do it is using this clean solution. All you need is a string represent the date. First day of the month: Last day of the month:

MySql find all tables with specific column/field name

December 8, 2014

How to look up in the entire DB and list out all tables which have specific column name or field name? Example belows looks for field `currency` from all database: To add specific database to the query, use:

PHP script execution time tracking wallclock time

December 1, 2014

A simple way to find out execution time of php script without lots of calculation is tracks the wallclock time. Compare to tracking CPU time, it also include time that PHP is sat waiting for external resources such as disks or databases, which is not used for max_execution_time. Output: Execution time get user: 0.00023317337036133