Vue.js 2 Cookbook

VueJS 2 Cookbook Cover

Vue.js is an open source JavaScript library for building modern, interactive web applications. With a rapidly growing community and a strong ecosystem, Vue.js makes developing complex single page applications a breeze. Its component-based approach, intuitive API, blazing fast core, and compact size make Vue.js a great solution to craft your next front-end application.

From basic to advanced recipes, this book arms you with practical solutions to common tasks when building an application using Vue. We start off by exploring the fundamentals of Vue.js: its reactivity system, data-binding syntax, and component-based architecture through practical examples.

After that, we delve into integrating Webpack and Babel to enhance your development workflow using single file components. Finally, we take an in-depth look at Vuex for state management and Vue Router to route in your single page applications, and integrate a variety of technologies ranging from Node.js to Electron, and to Firebase and HorizonDB.

This book will provide you with the best practices as determined by the Vue.js community.

Download link for ebook:

Please send a request and I will share it with you with sample code files (~300MB zipped)

How to remove “Remaining deprecation notices” while running Symfony test cases

Symfony Test

Sometime, when you run some Symfony tests, there is a lot of deprecation warning like this:

Symfony Test

Solution: Just add below code

<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />

to your phpunit.xml (or phpunit.xml.dist)

How to use jQuery in NuxtJS


Today, I will guide you how to use jquery with NuxtJS project.

  1. npm install --save jquery.
  2. Open nuxt.config.js and add:

That’s all! Hope this helpful for you!

Generate JPA Entity Script

IntelliJ IDEA Logo

I am using IntelliJ IDEA to write Java code.

It has built in script to generate POJOs class, but I want to generate JPA Entity classes. So today, I wrote a Groovy script to do it.

It saved my time and I hope it helpful to you!

Ten ways to become a better developer

  1. Read other people’s code. ☑
  2. Get someone to read your code. ☑
  3. Fix bugs before writing new code. ☑
  4. Learn a new technology. ☑
  5. Keep it stupid simple (KISS). ☑
  6. Write a blog post about your code. ☑
  7. Contribute to open source. ☑
  8. Fix it, don’t hack it. ☑
  9. Increase code coverage by 1%. ☑
  10. Leave your desk every hour.


Note on migrating Spring Boot 1.5 to 2.0

Spring Framework Logo

1. Useful links
First of all, you should read recommended links:

2. Tips and solution for problems

  • Table ‘hibernate_sequence’ doesn’t exist

Solution: Add config

  • Spring Boot 2.0 use HikariCP by default, so you should add config for HikariCP


Add config


– Value for config must be in millisecond.
– spring.datasource.hikari.idle-timeout < spring.datasource.hikari.max-lifetime < database wait_timeout
– For MySQL/MariaDB, use query SHOW GLOBAL VARIABLES LIKE 'wait_timeout'; to get wait_timeout, this value is in second
– For example, database wait_timeout = 600 second, so I can assign value as below:

  • Use MariaDB driver for MariaDB instead of MySQL Driver

Step 1: Remove MySQL Driver:
Step 2: Add MariaDB Driver:
Step 3: Change database connection URL: change from jdbc:mysql://... to jdbc:mariadb://...

Fix error when install npm package as global package


Today, I will guide you to fix error when install npm package as global package.
I ran below command to install npm package as global package but installation was failed.
Command: sudo npm install -g electron
Error will look like:
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/.electron'
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2018-03-18T10_25_47_793Z-debug.log

And this option saved my time:
--unsafe-perm=true --allow-root

I hope this post is helpful.

Keep database connection on connecting to MySQL/MariaDB using SQLAlchemy

Python 3

You want the database connection will be keep on connect to MySQL/MariaDB, just use pool_recycle parameter in method create_engine().
create_engine(db_url, pool_recycle=1)


this setting causes the pool to recycle connections after the given number of seconds has passed. It defaults to -1, or no timeout. For example, setting to 3600 means connections will be recycled after one hour. Note that MySQL in particular will disconnect automatically if no activity is detected on a connection for eight hours (although this is configurable with the MySQLDB connection itself and the server configuration as well).


Note for awk command on Mac


Today, I cleaned up redundant Docker images.

I used this command line:
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")

But it does not works on macOS, only Linux.

After some hours, I found the problem, and the right command for macOS is:
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')

awk on macOS isn’t same as awk on Linux. So you will use different syntaxes.

Bible Reference Regex (part 1)

Holy Bible

Yesterday, I have updated Bible Plugin for WordPress to version 3.2. In the new version, I rewrote code to parse Bible Reference from input content.

New code solved some cases of Bible reference that the old version can’t parse, but there are new cases so I need more time to solve them.

In this post, I only share the regex I used to parse Bible reference:


This regex cannot parse following case as well as I expected:
john 4:5 - 4:6
3 john 4:5 - 3 John 4:6
John 4:5 - 1 John 4:6
2 john 4:5 - 4:6

I think I need second regex to cover those cases.

Meaning of “covers over a multitude of sins”

Holy Bible

Trước hết, hãy yêu thương nhau tha thiết; vì tình yêu thương che lấp vô số tội lỗi. (1 Peter 4:8)

links to

Thưa anh em của tôi, trong anh em nếu có ai lầm lạc cách xa chân lý, và có người khác đem họ trở lại thì phải biết rằng ai đem một tội nhân từ con đường lầm lạc trở lại, là cứu linh hồn người đó khỏi sự chết và che lấp vô số tội lỗi. (James 5:19,20)

During handling of the above exception, another exception occurred

Python 3

Old code:

New code:

%d bloggers like this: