Articles are paginated with only three posts here for example. You can set the number of entries to show on this page with the “pagination” setting in the config file.

Docker

Dockers Concepts Official Definition Docker is an open platform for developers and sysadmins to build,ship and run distributed applications Docker’s philosophy is “build->ship->run”. In contemporary IT industry, there are two major usage of Docker. Focus on Build & Ship, to leverage Docker to setup a platform of “CI/CD”, for develop, test enviornment. Make use of Docker as light weight VM (virtual machine), focus on Run, apply it in large scale production environment. []

Mock in kotlin

Argument Matching & Answers For example, you have mocked DOC with call(arg: Int): Intfunction. You want to return 1 if argument is greater than 5 and -1 if it is less or equal to 5. This can be achieved by following construct: every { mock.call(more(5)) } returns 1 every { mock.call(or(less(5), eq(5))) } returns -1 returnsMany specify a number of values that are used one by one i.e. first matched call returns first element, second — second element, e. []
Kotlin  Mock 

How to decode path parameters in All REST WebServices calls

How to decode path parameters in All REST WebServices calls TL:DR If there are multiple places requires decode a parameter during WebServices RESTful calls, you can use UrlPathHelper from springframework to do this in central place Image there is one param1 in RESTful URL which may contains some Non URL friendly characters, such as forward slash “/”. You definitely can call URLCodec().decode(param1) on every calls. But that’s cumbersome and error-prone. []

Curl

Linux Curl command arguments -L, –location (HTTP) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place. If used together with -i, –include or -I, –head, headers from all requested pages will be shown. When authentication is used, curl only sends its credentials to the initial host. []
Linux 

AOP

The concept of join points as matched by pointcut expressions is central to AOP, and Spring uses the AspectJ pointcut expression language by default.

Awesome Shortcuts

Shortcuts & tips Intellij Notes CMD+3: Open actions (Eclipse) CMD+F12 (Mac) or Option+F12: Show terminal Shift+ESC: close auxiliary windows, such as project explorer, terminal window, etc. Cmd+O: File structure, list all methods Shift+Cmd+F: reformat code Sublime Ctrl+-: Go to last edit: Notion Notes Cmd+: show left bar Cmd+P: global search Mac tips Cmd + ← or → : move cursor to begin or end of line Shift + Cmd + →: select whole line (move cursor to line front first) Option + Shift + → / ←: select whole word ^ + Down: to show notiifcation center Ctrl+F2: to access menu bar Linux comands List only folders: ls -dl conflu* []

Micrometer notes

As a general rule it should be possible to use the name as a pivot. Dimensions allow a particular named metric to be sliced to drill down and reason about the data.

Tips about algorithm resolving from Leetcode

Here are some tips and notes about how to resolve algorithm issues listed in LeetCode Rotation problem Rotate array Here is one sample from Leetcode 189. Rotate Array Given an array, rotate the array to the right by k steps, where k is non-negative. Follow up: Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem. Could you do it in-place with O(1) extra space? []

Pigeons in holes principle

Pigeonhole principle In mathematics, the pigeonhole principle states that if {isplaystyle n}n items are put into {isplaystyle m}m containers, with {isplaystyle n>m}n>m, then at least one container must contain more than one item.[1] In layman’s terms, if you have more “objects” than you have “holes,” at least one hole must have multiple objects in it. A real-life example could be, “if you have three gloves, then you have at least two right-hand gloves, or at least two left-hand gloves,” because you have 3 objects, but only two categories to put them into (right or left). []

Awesome solutions for algorithm questions

你就会发现只要涉及递归的问题,都是 树的问题。 Different Trees Full Binary Tree : For every node, it can either has no children or two children Complete Binary Tree: Leaf nodes are aligned leftwards (it must be left child if there is only one child) Perfect Binary Tree: every node has two children 但是必须说明的是,不管怎么优化,都符合回溯框架,而且时间复杂度都不 可能低于 O(N!),因为穷举整棵决策树是无法避免的。这也是回溯算法的一 个特点,不像动态规划存在重叠子问题可以优化,回溯算法就是纯暴力穷 举,复杂度一般都很高。 vector<vector<string>> res; /* 输入棋盘边⻓ n,返回所有合法的放置 */ vector<vector<string>> solveNQueens(int n) { // '.' 表示空,'Q' 表示皇后,初始化空棋盘。 vector<string> board(n, string(n, '. []