• Knowledge point synchronous and asynchronous


    Let’s start with a high vote answer from stackoverflow When you execute something synchronously, you wait for it to finish before moving on to another task. When you execute something asynchronously, you can move on to another task before it finishes.When you synchronize a task, you need to wait for it to complete before you […]

  • Java Concurrent Programming — basic knowledge (1)


    1. What is thread safety? When multithreading accesses a class or a resource, the class or resource can show the following characteristicsRight behaviorSo this is thread safety 2. What is thread safe class? When a multithread accesses a class, no matter what scheduling mode the running environment adopts or how these threads execute alternately, and […]

  • Custom exception of Java exception


    Custom exception class custom exception   1. Java built-in exception classes can be used to describe most of the exceptions in programming. In addition, users can customize exceptions. User defined exception class, just inherit the exception class. 2. Using custom exception classes in programs can be divided into the following steps: Create a custom exception […]

  • Anti avalanche sharp device: the principle and application of fuse hystrix


    preface In a distributed system, a basic service is often unavailable, which makes the whole system unavailable. This phenomenon is called service avalanche effect. In order to deal with the service avalanche, a common method is manual service degradation. The emergence of hystrix provides us with another choice Definition of service avalanche effect The avalanche […]

  • Dependency injection code examples of PHP design patterns (15)


    objective A loosely coupled software architecture is implemented to get better code for testing, management and extension Dependency injection pattern: dependency injection is an implementation of inversion of control. To achieve inversion of control, the usual solution is to leave the creation of the callee instance to the IOC container, and then inject the callee […]

  • MIT6.824-Lab2B


    summary Lab2b needs us to improverf.Start(..)This function. This function takes acommandAs input parameter, if the current noderfyesleaderThen the process of reaching consensus will begin If the current node is a leader,rf.Start()The command will be pressed into its own log and the index will be returned immediately.The caller gets an index, which does not mean the […]

  • Command mode of design pattern


    Command mode command Intro The command mode encapsulates a request into an object, so that it can be parameterized with different requests, queue or log requests, and support revocable operations. Command mode is to encapsulate the command, the caller initiates the command request, and the receiver executes the request. When we call, the timing of […]

  • “IOS development, let’s do the interview questions together” – 10 times a day – the first day of punch in


        If it’s helpful for you or you like, I hope you can like it or add some attention 1、 The difference between calayer and uiview1. Uiview is UIKit’s and can only be used in IOS. Calayer is universal to quartzcore IOS and Mac OS2 calayer is more lightweight than uiview, but can achieve […]

  • C ා practice design pattern principle solid


    The relationship between theory and practice is not far away, but near. It’s hard to say whether we can apply theory to practice.   When it comes to design patterns, one of the most common principles is solid S – single responsibility principle O – Open Closed Principle L – Liskov Substitution Principle I – […]

  • Two ways to create objects


    Create an object by using the literal value of the object var obj = { Name: ‘Andy Lau’, age: 18, sayHi: function () { console.log(‘hi’); } }; //Using objects console.log(obj.name); console.log (obj [‘age ‘); // note that you can’t forget to drop the quotation marks here. obj.sayHi(); //Property takes the property name: property value //Multiple […]

  • The pain of react hooks: inefficient change communication


    How to use react hook reasonably recently? -Parabola’s answer – Zhihu. The author compares the model of react hooks to the model of rxjs, such as the merge operation of rxjs. In the world of react, it can be implemented as follows: They can really be understood as equivalent.They are all definitions of data computing […]

  • [go] the best set of options


    background When you write a struct in go, you often encounter setting functions for each field in the struct. This question seems very simple and easy. In fact, it bothers many people. Even rob pike, one of the three go giants, has been troubled by it for a while. Later, he found out the best […]