Author Archives: Anthony Zhan

Fix errors for MySQL

show_compatibility_56

MySQL 5.7.8 remote access with TCP, you may get error like this:

Add following into MySQL config file my.cf

 

Use git subtree to modularization

Here is my situation, I’ve been developing several projects at the same time. There are some libraries are shared with these projects. After googling I found some really good articles:

How We Modularized Medium’s iOS codebase
https://medium.com/medium-eng/how-we-modularized-mediums-ios-codebase-8f8f26965c76

git subtrees: a tutorial
https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844

Git Subtree Tracking Made Easy
http://endot.org/2012/02/12/git-subtree-tracking-made-easy/

Continue reading

vim tips: arg & buf

Arg

Buffer

Operate command over multiple files

 

Vim search and replace in multiple files

1. Open vim

2. Add files into argument list

3. Search and Replace

 

:argdo: Apply following commands to all the files

%s:  Search and replace all lines in the file

g: Change all occurences in each line

e: No error if the pattern is not found

c: need confirm to save changes

|: Separator between commands

update: Save (write file only if changes were made)

Understanding Nginx Location Directive

Here are Location Block syntax:

  • (none): The location_match is interpreted as a prefix match.
  • =: The location_match is interpreted as a exactly match.
  • ~: This location_match will be interpreted as a case-sensitive regular expression match.
  • ~*: The location_match block will be interpreted as a case-insensitive regular expression match.
  • ^~: The location_match is interpreted as the best non-regular expression match, regular expression matching will not take place.

Continue reading

WPKG redirect virus

Recently a lot websites keep automatically redirecting to “http://wpkg.org/”. It turns out caused by GFW. For more info you check the following page.

http://www.reddit.com/r/China/comments/33wpk3/anyone_else_almost_all_websites_in_both_chrome

Use Adblock plus block the links:

http://wpkg.org/my.js
http://www.ptraveler.com/pt.js

And edit hosts file to map these two sites to 127.0.0.1