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

Angular 4 download file from server via http

When want to download a file from server, usually just provide a <a href... will do. But what if the file only allow authorised user to access? Means you have to download first, in this case will have to use http

Read More

CefSharp listen to JavaScript event

CefSharp is a Chromium browser embedded to an application.

In my case, I’m using WinForms (CefSharp.WinForms v57.0.0).

Read More

PayPal Rest API with Laravel 5 and Angular

Previously I wrote a post regarding to Integrate PayPal SDK into Laravel 4. And I believe now Laravel 5 is quite different from Laravel 4. Also, PayPal API also updated now.

Read More

Allow Vagrant to access from other computers in LAN network

I’m using Laravel Homestead. By default, the config is set to private network with IP 192.168.10.10.

Read More

How to backup MySQL database from time to time

To backup your database from time to time, this can be done by write a simple shell script, and setup a cron job to run it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

# config
backup_dir=/path/to/backup/folder
max_backup_files=5
db_host="127.0.0.1"
db_name="my_db"
db_user="root"
db_pass="secret"

if [ ! -d $backup_dir ]; then
mkdir $backup_dir
fi

output_file=$backup_dir/`date +"%Y-%m-%d_%H-%M-%S.sql"`
# the tables data you want to exclude, but keep the structure
excluded_tables=(
ex_table1
ex_table2
ex_table3
)

ignored_tables_string_with_option=''
ignored_tables_string=''
for tbl in "${excluded_tables[@]}"
do :
ignored_tables_string_with_option+=" --ignore-table=${db_name}.${tbl}"
ignored_tables_string+=" ${tbl}"
done

# change this line if you use postgresql
mysqldump $db_name -u $db_user -h $db_host -p$db_pass ${ignored_tables_string_with_option} > $output_file
mysqldump $db_name -u $db_user -h $db_host -p$db_pass ${ignored_tables_string} --no-data >> $output_file

total_sql=`ls -l $backup_dir/*.sql | wc -l`

if [ $total_sql -gt $max_backup_files ]; then
old_file=`ls $backup_dir/*.sql | sort | head -n 1`
echo "Exceed $max_backup_files files, remove $old_file"
rm -f $old_file
fi

Read More