04 2019 档案
摘要:Asking you to implement the Math.pow method The navie implemenation can be: It takes O(N) time. Now if we want to improve it to O(logN) time. we can d
阅读全文
摘要:Even by using modules, they still share the same namespace. So you couldn’t have the same mutation name in different modules. Namespaces solve that by
阅读全文
摘要:For Fibonacci Sequence, the space complexity should be the O(logN), which is the height of tree. Check the source
阅读全文
摘要:Sometimes we need to create modules at runtime, for example depending on a condition. We could even want to lazy load that module by using Webpack’s c
阅读全文
摘要:When the Vuex store grows, it can have many mutations, actions and getters, belonging to different contexts. Vuex allows you to split your store into
阅读全文
摘要:Mutations perform synchronous modifications to the state, but when it comes to make an asynchronous operation, they become useless. Actions are a high
阅读全文
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
摘要:Learning notes. Video. Less than: If you use 'ramda', you maybe know 'lt, gt'.. Is '2' less than '1' , the result is false. We can see that the data i
阅读全文
摘要:The code is from Plusight course, github link is here. In this post, we will give a overview about how to setup Docker for a Angular, Node application
阅读全文
摘要:A Vuex store centralizes the state of your app, making it easy to reason about your state flow. In this lesson we’ll see how we can create a Vuex stor
阅读全文
只有注册用户登录后才能阅读该文。
摘要:It is recommened to write unit testing with Mockito in Spring framework, because it is much faster with Spring framework test. But in case you can doi
阅读全文
摘要:For example, we want to test against a implemataion: We want to do the test with Java Context: 1. Bring in some dependencies: in pom.xml Create a new
阅读全文
摘要:The benfits of multi-stage builds: Avoid manual creation of intermediate images Reduce complexity Selectively copy artifacts from one stage to another
阅读全文
摘要:In this post, we are going to see more functionalities in Mockito. Mock a List interface: Call multi times: First call, return 10, second times return
阅读全文
摘要:Let's say we want to write a most simple implementation 'avg' function: Basiclly, the 'avg' function doing two things: Calculate sum Divide sum / leng
阅读全文
摘要:The highlighted part is important, without this, if you hint the page url: It will show 404 page, because it will be regareded as a server request. Wi
阅读全文
摘要:Previously we have seen how to do Unit testing with Mockito; In this post, we are going to see, using annotation from Mockito to make testing easier:
阅读全文
摘要:For example, in React application, we have initial state; We have a toggle button, which everytime, it is toggle 'ui.filterGroups.status' to true/fals
阅读全文
摘要:For example we have a component, it needs to call 'react-redux' connect function. For the hightlighted part, there can be many possible reason for it
阅读全文
摘要:When we develop the Angular app inside Docker container, we can simulate Production envioment by build Angualr App instead of using 'ng serve': '--del
阅读全文
摘要:We have the implemetion: And we want to test agaisnst it:
阅读全文
摘要:First of all, install Prettier extension: "Pettier - Code formatter". The open the VSCode setting: Search for "format": and enable "Format On Save" Ad
阅读全文
摘要:Check the get started guid https://junit.org/junit5/docs/current/user-guide/#overview-getting-help
阅读全文
只有注册用户登录后才能阅读该文。
摘要:All the tagged function really does is give us a function to fill the given named properties on an object. taggedSum is a combination of multi Typed c
阅读全文
摘要:For some React component testing, we have common setup in each test file: We want to setup a common place for JEST to load those scripts: Then for com
阅读全文
只有注册用户登录后才能阅读该文。
摘要:kompose is a tool to help users who are familiar with docker-compose move to Kubernetes. kompose takes a Docker Compose file and translates it into Ku
阅读全文
摘要:Let's say we have a extral app.proporites file which contains some extra configuration: We can read the extra propoties by using @Value("${xxx}") As y
阅读全文
只有注册用户登录后才能阅读该文。
摘要:function Node(val) { return { val, left: null, right: null }; } function Tree() { return { root: null, addLeft(val, root) { const newNode = Node(val); root.lef...
阅读全文
摘要:Create an ssh key: Copy an SSH key to a remoate server: Then enter your password. To make sure you can SSH into remote server, you can do: Since ssh-c
阅读全文
摘要:Component Scan is important concept when we want to create Bean. Currently we know what, for the class, we want to create Bean from it, we need to add
阅读全文
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
只有注册用户登录后才能阅读该文。
摘要:Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer
阅读全文
摘要:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep
阅读全文
摘要:JavaScript has multiple APIs that use callback functions that all do nearly the same thing with slight variations. Event listeners, array methods such
阅读全文
摘要:Another way to add plain text to templates is to prefix a line with a pipe character (|). This method is useful for mixing plain text with inline tags
阅读全文
摘要:In previous post we have seen how to link two container together by using `--link`: In this poist, we are going to see how to create brige network, an
阅读全文
摘要:We have the following example: The idea is to understand in different cases, how those instanse are created. Currently when running the application, w
阅读全文
摘要:When we use Bean to do autowired, it actually use singleton, so even we create multi instanses, they are the same: It print out: We can also tell Spri
阅读全文
摘要:In the example we have currently: The way we do Autowired is by '@Primary' decorator. It is clear that one implementation detail is the best, then we
阅读全文
摘要:It is possible to group containers into a network and we can create multi networks so that container in each isolated network can communiate with each
阅读全文
摘要:Spring boot is really good for Dependencies injection by using Autowiring. Each class instancse in spring boot is called 'Bean', we can use 'Bean' to
阅读全文
摘要:Assume we have two linked list, we want to find a point in each list, from which all the the nodes share the same value in both list. Then we call thi
阅读全文
摘要:To do communcation between containers, we need to do link between containers. 1. Run a container with a name Give a name call 'my-postgres' 2. Link to
阅读全文
摘要:Returning multiple values from a function is a common idiom in Go, most often used for returning values along with potential errors. We'll go over how
阅读全文
摘要:Validating forms in React can take several lines of code to build. However, Formik's ErrorMessage component and Yup simplify that process.
阅读全文
摘要:For the given tree, in order traverse is: visit left side root visit right side The successor is the one right next to the target: So, given the tree
阅读全文
摘要:Create a Dockerfile: Build Dockerfile: Run image:
阅读全文
摘要:The solution for the problem can be divided into three cases: case 1: if the delete node is leaf node, then we can simply remove it case 2: if the del
阅读全文
摘要:Sometime you need to check one prop exists on the object and value should not be ´null´ or ´undefined´. One problem people may occur with: Here we mis
阅读全文
摘要:What is Binary Search Tree (BST) A binary tree in which for each node, value of all the nodes in left subtree is less or equal and value of all the no
阅读全文