MySQL - a trick to filter multi-values column

For certain reason, sometime we want to filter the data in a multi-values column.

e.g.

books

Read More

Guzzle HTTP client cannot download file with special character

I’m using Guzzle to download image file, the code as below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

$normal_url = 'http://example.com/path/to/image.png';
$special_char_url = 'http://example.com/path/to/ครีมอาบน้ำ.jpg';

function download($url) {
$output = '/tmp/' . basename($url);

$client = new \GuzzleHttp\Client();
$res = $client->get($url, [
'verify' => false,
'sink' => $output,
]);
}

download($normal_url); // this 1 works
download($special_char_url); // this throw 404 error

Read More

TinyMCE insert js/css into iFrame head element

TinyMCE is an iFrame element with full HTML content.

Sometime we would like to add in Bootstrap & jQuery or any plugins into it.
Let’s see how we achieve it.

Read More

AWS Lambda test in local machine

I believe many developer first time deal with AWS Lambda will have this question: “How can I test the code in my machines?”

After keep trying hundreds of times, I found a way to do it.

Read More

Python trick - copy file among computers in LAN network

The conventional way of file transfer between PCs, is via thumb drive.

Some time the file size are too large and not able to copy to FAT thumb drive.

Read More

How to add more hosts to phpMyAdmin

If want to add in more hosts in phpMyAdmin, just edit the file config.inc.php

Replace the following content

1
2
3
4
5
6
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

Read More

How I personalize my Linux config

I begin touching Linux back in 2011. I still remember, I learning vim, command line, etc.

The first thing my mentor told me to do was, clone his dotfiles.
If you first time heard about this term, I’m pretty sure that you’re new to Unix world.

Read More

Laravel event multi listeners not working

The Laravel Event feature is pretty useful, just like Trigger in DBMS;

Read More

Ubuntu server not support chinese character

I’m using Amazon EC2, Ubuntu 16.04.

I noticed this problem when I try to generate a pdf file from php, the filename was not the right chinese character.

Read More

Guest post: Some Facts About Amazon

Today’s largest online retailer used to be originally known as ‘Earth’s Largest Bookstore’. They were actually sued for that statement by Barnes & Noble, because the claim was supposedly ‘fake’. The two companies later decided to settle off court.

Read More