QA Official

Traps in Java

https://qaofficial.com/post/2019/04/09/69648-traps-in-java.html 2019-04-09
There are five general ways to create objects in Java:   1. Create Java objects by calling the constructor new; 2. Create the object by calling the constructor through the Class object's newInstance () method; 3. Recover objects from IO stream through the deserialization mechanism of Java; 4. Copy an object through clone method provided by Java object; 5. Basic types and String types can be directly assigned direct quantities.

Use @Aspect in Spring to Control Custom Annotations

https://qaofficial.com/post/2019/04/09/69742-use-aspect-in-spring-to-control-custom-annotations.html 2019-04-09
Use @Aspect in Spring to Control Custom Annotations reprint an introduction @Aspect 1. Define System Log Annotation [email protected](ElementType.METHOD)@Retention(RetentionPolicy.RUNTIME)@Documentedpublic @interface SysLog { String value() default ""; } 2. Define tangent plane processing classes package com.kxs.common.aspect; import com.google.gson.Gson; import com.kxs.common.annotation.SysLog; import com.kxs.common.utils.HttpContextUtils; import com.kxs.common.utils.IPUtils; import com.kxs.modules.sys.entity.SysLogEntity; import com.kxs.modules.sys.entity.SysUserEntity; import com.kxs.modules.sys.service.SysLogService; import org.apache.shiro.SecurityUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; import java.util.Date;

in-depth understanding of Java Proxy mechanism

https://qaofficial.com/post/2019/04/09/69740-in-depth-understanding-of-java-proxy-mechanism.html 2019-04-09
Dynamic Proxy is actually the Java. lang. reflection. proxy class dynamically generates a class byte according to all interfaces you specify, which inherits the proxy class and implements all interfaces you specify (the array of interfaces you pass in in the parameters);Then use the classloader you specified to load class byte into the system, finally generate an object of such a class, and initialize some values of the object, such as the invocationHandler, to be the Method members corresponding to all interfaces.

javassist for Java Dynamic Programming

https://qaofficial.com/post/2019/04/09/69730-javassist-for-java-dynamic-programming.html 2019-04-09
Overview Javassist is a bytecode editing tool that can directly edit and generate Java-generated bytecodes to achieve the effect of dynamically modifying. class files.Proficient use of this set of tools can make Java programming closer to dynamic language programming. tutorial maven dependency pom.xml <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> <version>3.20.0-GA</version> </dependency> API explanation 1, create a new Class ClassPool pool = ClassPool.getDefault(); //定义类 CtClass stuClass = pool.makeClass("com.ricky.Student"); Of course,

reading notes, statistical trap

https://qaofficial.com/post/2019/04/09/69643-reading-notes-statistical-trap.html 2019-04-09
biased samples in chapter 1 The desired data will be obtained mainly through biased samples. In this paper, the salary of Yale graduates is taken as an example to illustrate this problem, but no samples are given when statistical conclusions are given. Through reasonable speculation, we can know that such samples are biased. For example, the people who can contact are generally not poor, and those who are willing to tell others their salary are not poor.

4 How should I choose to move bricks and hug you?

https://qaofficial.com/post/2019/04/08/69571-4-how-should-i-choose-to-move-bricks-and-hug-you.html 2019-04-08
"I don't wear a gold hoop, can't save her, wearing a gold hoop, can't love her.Ten thousand years is too long, seize every minute and walk all the way, only to find that nothing is immortal.We finally understand that once those who were one step away from us, once they missed it, even if they became The Greatest Hero In The World, dressed in golden clothes and armor, and stepped on colorful auspicious clouds, they would not necessarily come back.

C Language Trap-Misuse of Pointers

https://qaofficial.com/post/2019/04/08/69633-c-language-trap-misuse-of-pointers.html 2019-04-08
Introduction In C language learning, the biggest difficulty is to understand and use pointers.Pointers are closely related to memory, so in order to understand the usage of pointers, you must also know the memory layout of the platform system. You can at least distinguish between heap and stack (of course, the stack here is not the stack referred to in the data structure).Pointer is like a double-edged sword. If you

C Language: The Frog Jumped Step Problem

https://qaofficial.com/post/2019/04/08/69535-c-language-the-frog-jumped-step-problem.html 2019-04-08
Topic: (1) A frog can jump up one step or two at a time.Find out how many jumping methods the frog can use to jump up an n-step. analysis: when n = 1, there is only one jump method;When n = 2, there are two jump methods;When n = 3, there are 3 jumping methods;When n = 4, there are 5 jumping methods;When n = 5, there are 8 kinds

C. Birthday

https://qaofficial.com/post/2019/04/08/69606-c.-birthday.html 2019-04-08
C. Birthday Cowboy Vlad has a birthday today!There are n children who came to the celebration. In order to greet Vlad, the children decided to form a circle around him. Among the children who came, there are both tall and low, so if they stand in a circle arbitrarily, it may turn out, that there is a tall and low child standing next to each other, and it will be

Github Common Commands

https://qaofficial.com/post/2019/04/08/69464-github-common-commands.html 2019-04-08
1. Basic git Command view branch: git branch create branch: git branch <name > switch branch: git checkout <name > create+switch branch: git checkout -b <name > merge a branch to the current branch: git merge <name > delete branch: git branch -d <name > gitadd < ... >//add files gitcommit-m "message"//message explains the information for this change. gitpush originmaster//push onto your github, then pull request can be made.