[java design pattern] - strategy pattern (case analysis)

Policy Mode 1. Concepts 1. Understanding Strategic Patterns Policy mode is a behavioral mode that separates objects from behaviors and defines behaviors as an interface to behaviors and an implementation of specific behaviors.The most important feature of strategy mode is the change of behavior, which can be replaced by each other. Each ...

Posted on Mon, 25 May 2020 18:19:41 -0700 by gizmola

Moving End Elements Follow Move - Anti-Apple Suspension Sphere Effect (Reload)

Thanks to the original author for sharing. After all, I have been tossing around for a day or had a lot of problems. I feel stuck mainly in the issue of getting and compatibility of the event objects. The first code is my own, no problem without scrollbars on the page, and bugs appear when there are scrollbars. //T ...

Posted on Mon, 25 May 2020 09:59:41 -0700 by Lirpa

JAVA Concurrent Programming Introduction, thinking about the realization philosophy behind synchronous lock

Multithreading is similar to preemptive multitasking processing in concept. The reasonable use of threads can improve the processing ability of the program, but it also brings disadvantages. For shared variable access, there will be security problems. Here is an example of multi-threaded access to shared variables: public class ThreadSafty { ...

Posted on Sat, 23 May 2020 02:53:17 -0700 by downfall

Analysis of Redis master-slave replication

How does Redis master-slave replication work? Do you know how to keep high performance while synchronizing data? https://redis.io/topics/replication Note that based on the latest version of redis 5, the slave term and configuration item have been officially changed to replica. In fact, they refer to slave nodes. Basic process of master- ...

Posted on Thu, 21 May 2020 03:19:07 -0700 by sri.sjc

Solution to the problem of merging stones

[Title Description] N piles of stones are placed in rows on a playground. Now we will combine the stones into a pile in order. It is stipulated that only two adjacent piles of stones can be selected to merge into a new pile at a time, and the number of new piles of stones shall be recorded as the score of this combination. Calculate the mini ...

Posted on Sun, 17 May 2020 08:01:51 -0700 by jswinkelman

Java 8 Stream API Learning Summary

The Java 8 API adds a new abstract called Stream, which allows you to process data in a declarative way.The Stream API can greatly increase the productivity of Java programmers, allowing them to write efficient, clean, and concise code.This style treats a collection of elements as a stream that is transported through the pipeline and can be pro ...

Posted on Fri, 15 May 2020 14:58:26 -0700 by mduran

wait/notify mechanism for Java thread communication

Preface Java thread communication is the process of associating individual threads so that threads can communicate with each other.For example, thread A modifies the value of an object and then notifies thread B so that thread B knows the value modified by thread A, which is thread communication. <!-- more --> wait/notify mechanism One t ...

Posted on Fri, 15 May 2020 10:05:56 -0700 by ScoTi

Package component El upload: upload a single picture through v-model

The El upload image in the element UI has been encapsulated twice. (by default, everyone has a certain vue foundation, and there are only a few details.) In the project, we mainly get pictures or other parameters. Here is the Guid returned after uploading So I have concentrated on the upload actions, such as the input v-model to get the param ...

Posted on Fri, 15 May 2020 07:12:18 -0700 by Phoenix~Fire

Write a redux, react redux and the extension of Middleware (asynchronous thunk, printing logger)

The beggar version of the manual roll up is as follows. It only realizes the most basic functions: subscription, dispatch and access. However, it can be used easily. It's no problem to make a counter, and the core functions of redux can be seen more simply and roughly Note: the length of this article is long. It is recommended to read it slowl ...

Posted on Wed, 13 May 2020 22:28:54 -0700 by mady

Security design scheme of third party application obtaining data

In the actual business, it is inevitable to interact and transfer data with the third-party system, so how to ensure the security of data in the transmission process (anti stealing)? In addition to the https protocol, can we add a general set of algorithms and specifications to ensure the security of transmission?   Now let's discuss some com ...

Posted on Tue, 12 May 2020 08:17:32 -0700 by flyingeagle855