类型
索引的叶子节点上,已经包含要查询的数据,不需要回表去主索引查询数据。
唯一索引可能引起多读一次数据
subclass superclass The super keyword
IS-A Relationship
overridden methods /virtual method invocation
Abstract Class Interfaces
Producer extends and Consumer super
primitive types
variables=变量 arguments=参数 parameters methods=方法 constant pool field method data comment : There are two kinds of comments
4 类型、值、变量(Types, Values, and Variables) 4.1 类型和值的种类(The Kinds of Types and Values) 4.2 私有类型和值(Primitive Types and Values) 4.3 引用类型和值(Reference Types and Values) 4.4 类型变量(Type Variables)
类型变量是一个未限定的标识符,在类、接口、方法和构造函数体中作为类型使用。 T就是 Type Varialle
// <T extends Object>
// <T>
class Test {
<T extends C & I> void test(T t) {
t.mI(); // OK
t.mCPublic(); // OK
t.mCProtected(); // OK
t.mCPackage(); // OK
t.mCPrivate(); // Compile-time error
} }
4.5 Parameterized Types
4.6 Type Erasure
4.7 Reifiable Types
4.8 Raw Types
4.9 Intersection Types
4.10 Subtyping
Callable call()
The ForkJoinPool is basically a specialized implementation of ExecutorService
ZGC: Concurrent Thread-Stack Processing
For local, inter-process communication, Unix-domain sockets are both more secure and more efficient than TCP/IP loopback connections.
bug fixes.
JLS Java Language Specification
一组packages为了重用。 21 standard modules
Specification Grammars
2.1 Context-Free Grammars 2.2 The Lexical Grammar 2.3 The Syntactic Grammar 2.4 Grammar Notation
Lexical Structure
3.1 Unicode 3.2 Lexical Translations 3.3 Unicode Escapes 3.4 Line Terminators 3.5 Input Elements and Tokens 3.6 White Space 3.7 Comments 3.8 Identifiers 3.9 Keywords 3.10 Literals
4.1 The Kinds of Types and Values 4.2 Primitive Types and Values
statically typed language(静态类型语言): 变量和表达式在编译时就知道了。 strongly typed language(强类型语言)
primitive types:原始类型 boolean type numeric types: byte, short, int, long, char, float, # floating-point double reference types:引用类型 class types interface types array types type variables null type can always be assigned or cast to any reference type
Floating-Point Types, Formats, and Values
Each object is associated with a monitor, which is used by synchronized methods and the synchronized statement to provide control over concurrent access to state by multiple threads
Reifiable types
available at run time.
Raw Types
Variables
A variable is a storage location and has an associated type, sometimes called its compile-time type, that is either a primitive type or a reference type
class Point {
static int numPoints; // numPoints is a class variable
int x, y; // x and y are instance variables
int[] w = new int[10]; // w[0] is an array component
int setX(int x) { // x is a method parameter
int oldx = this.x; // oldx is a local variable
this.x = x;
return oldx;
}
}
the state of a object:
may only be assigned to once.
- poly expression
5.1.1 Identity Conversion 5.1.2 Widening Primitive Conversion 5.1.3 Narrowing Primitive Conversion 5.1.4 Widening and Narrowing Primitive Conversion
5.1.7 Boxing Conversion 5.1.8 Unboxing Conversion 5.1.9 Unchecked Conversion 5.1.10 Capture Conversion
5.1.11 String Conversion 5.1.12 Forbidden Conversions 5.1.13 Value Set Conversion
类型转换Determining the Meaning of a Name
- boxing conversion
- unboxing conversion
5.2 Assignment Contexts 5.3 Invocation Contexts 5.4 String Contexts 5.5 Casting Contexts 5.6 Numeric Contexts
6.1 Declarations 6.2 Names and Identifiers 6.3 Scope of a Declaration 6.4 Shadowing and Obscuring 6.4.1 Shadowing 6.4.2 Obscuring 6.5 Determining the Meaning of a Name 6.6 Access Control 6.6.1 Determining Accessibility 6.6.2 Details on protected Access 6.7 Fully Qualified Names and Canonical Names
Names and Identifiers Shadowing
Determining the Meaning of a Name
Access Control
Determining Accessibility public / protected / private
7.1 Package Members
7.2 Host Support for Modules and Packages
7.3 Compilation Units
7.4 Package Declarations
7.5 Import Declarations
members
interfaces
8.1 Class Declarations
final Classes
A class can be declared final if its definition is complete and no subclasses are desired or required.
strictfp Classes
be explicitly FP-strict (§15.4)
8.1.3 Inner Classes and Enclosing Instances 8.1.4 Superclasses and Subclasses 8.1.5 Superinterfaces
8.2 Class Members
Constructors, static initializers, and instance initializers are not members and therefore are not inherited.
8.3 Field Declarations
Each declarator in a FieldDeclaration declares one field. The Identifier in a declarator may be used in a name to refer to the field.
8.3.1 Field Modifiers
8.4 Method Declarations 8.4.1 Formal Parameters 8.4.2 Method Signature 8.4.3 Method Modifiers
8.4.4 Generic Methods 8.4.5 Method Result 8.4.6 Method Throws 8.4.7 Method Body 8.4.8 Inheritance, Overriding, and Hiding 8.4.9 Overloading
8.5 Member Tye Declarations 8.6 Instance Initializers 8.7 Static Initializers 8.8 Constructor Declarations 8.9 Enum Types
9.1 Interface Declarations 9.1.3 zsuperinterfaces and subinterfaces 9.2 Interface Members 9.3 Field (Constant) Declarations 9.4 Method Declarations 9.4.1 Inheritance and Overriding 9.4.2 Overloading
9.5 Member Type Declarations 9.6 Annotation Types
9.6.4 Predefined Annotation Types 9.7 Annotations 9.8 Functional Interfaces 9.9 Function Types
12.1 Java Virtual Machine Startup 12.2 Loading of Classes and Interfaces 12.3 Linking of Classes and Interfaces 12.4 Initialization of Classes and Interfaces 12.5 Creation of New Class Instances 12.6 Finalization of Class Instances 12.7 Unloading of Classes and Interfaces 12.8 Program Exit
13.1 The Form of a Binary 13.2 What Binary Compatibility Is and Is Not 13.3 Evolution of Packages and Modules 13.4 Evolution of Classes 13.5 Evolution of Interfaces
14.1 Normal and Abrupt Completion of Statements 14.2 Blocks 14.3 Local Class Declarations 14.4 Local Variable Declaration Statements 14.5 Statements 14.6 The Empty Statement 14.7 Labeled Statements 14.8 Expression Statements 14.9 The if Statement 14.10 The assert Statement 14.11 The switch Statement 14.12 The while Statement 14.13 The do Statement 14.14 The for Statement 14.15 The break Statement 14.16 The continue Statement 14.17 The return Statement 14.18 The throw Statement 14.19 The synchronized Statement 14.20 The try statement 14.21 The yield Statement 14.22 Unreachable Statements
15.1 Evaluation, Denotation, and Result 15.2 Forms of Expressions 15.3 Type of an Expression 15.4 FP-strict Expressions 15.5 Expressions and Run-Time Checks 15.6 Normal and Abrupt Completion of Evaluation 15.7 Evaluation Order 15.8 Primary Expressions 15.9 Class Instance Creation Expressions 15.10 Array Creation and Access Expressions 15.11 Field Access Expressions 15.12 Method Invocation Expressions 15.12.1 Compile-Time Step 1: Determine Class or Interface to Search 15.12.2 Compile-Time Step 2: Determine Method Signature 15.12.3 Compile-Time Step 3: Is the Chosen Method Appropriate? 15.12.4 Run-Time Evaluation of Method Invocation 15.13 Method Reference Expressions 15.14 Postfix Expressions 15.15 Unary Operators 15.16 Cast Expressions 15.17 Multiplicative Operators 15.18 Additive Operators 15.19 Shift Operators 15.20 Relational Operators 15.21 Equality Operators 15.22 Bitwise and Logical Operators 15.23 Conditional-And Operator && 15.24 Conditional-Or Operator || 15.25 Conditional Operator ? : 15.26 Assignment Operators 15.27 Lambda Expressions 15.28 switchExpressions 15.29 Constant Expressions
16.1 Definite Assignment and Expressions 16.2 Definite Assignment and Statements 16.2.1 Empty Statements 16.2.2 Blocks 16.2.3 Local Class Declaration Statements 16.3 Definite Assignment and Parameters 16.4 Definite Assignment and Array Initializers . . . 16.9 Definite Assignment, Constructors, and Instance Initializers
17.1 Synchronization
synchronization
17.2 Wait Sets and Notification 17.3 Sleep and Yield 17.4 Memory Model 17.4.1 Shared Variables 17.4.2 Actions 17.4.3 Programs and Program Order 17.4.4 Synchronization Order 17.4.5 Happens-before Order 17.4.6 Executions 17.4.7 Well-Formed Executions 17.4.8 Executions and Causality Requirements 17.4.9 Observable Behavior and Nonterminating Executions 17.5 final Field Semantics 17.6 Word Tearing 17.7 Non-Atomic Treatment of double and long
18.1 Concepts and Notation 18.1.1 Inference Variables 18.1.2 Constraint Formulas 18.2 Reduction
2.1 The class File Format 2.2 Data Types 2.3 Primitive Types and Values 2.4 Reference Types and Values 2.5 Run-Time Data Areas 2.6 Frames 2.7 Representation of Objects 2.8 Floating-Point Arithmetic 2.9 Specail Methods 2.10 Exceptions 2.11 Instruction Set Summary 2.12 Class Libraries 2.13 Public Design, Private Implementation
3.1 Format of Examples 3.2 Use of Constants, Local Variables, and Control Constructs 3.3 Arithmetic 3.4 Accessing the Run-Time Constant Pool 3.5 More Control Examples 3.6 Receiving Arguments 3.7 Invoking Methods 3.8 Working with Class Instances 3.9 Arrays 3.10 Compiling Switches 3.11 Operations on the Operand Stack 3.12 Throwing and Handling Exceptions 3.13 Compiling finally 3.14 Synchronization 3.15 Annotations 3.16 Modules
Cache vs Buffer
Object o = new Object();
"Thread-1" #12 prio=5 os_prio=31 tid=0x00007f90aa20b800 nid=0x5903 waiting on condition [0x000070000b218000] //Thread.sleep(n)
"Thread-0" #11 prio=5 os_prio=31 tid=0x00007f90a91b9000 nid=0x5703 in Object.wait() [0x000070000b115000] //o.wait();
"main" #1 prio=5 os_prio=31 tid=0x00007f90a901b000 nid=0x2903 waiting on condition [0x00007000099cd000] //Thread.sleep(n)
English | 中文 | 描述 |
---|---|---|
variables | 变量 | |
Static variables | 静态变量 | 所有实例,能被修改,is stored on the data segment area of memory and the same value is get shared to all instances of that class |
Constant variables | 常量/恒定变量 | 每个实例”一份”,但是不能修改值 |
Static Constant variables | 静态常量 | 所有实例只有“一份”,而且不能修改 |
Constant pool | 常量池 | holds all the constants (integer, string, etc.);不是java对象;是在class文件中(loading过程) |
String pool | string literal | 只有string;java对象 |
Version Control Systems are just that, software that provides versioning functionality (Git, Subversion, TFS Version Control) all fall into this category.
Software Configuration Management is a broader term that encompasses all the processes needed to build, package, and deploy software – this includes Version Control Systems. It does not refer to software per se.
Unstaged changes exist in our Working Directory, but Git hasn’t recorded them into its version history yet.
index/staged
HEAD
a reference to the last commit in the currently checked-out branch.
git diff
View difference between Stage and Working Directory
git diff --staged
View difference between HEAD and Stage --staged is a synonym of --cached
git diff HEAD
View difference between HEAD and Working Directory
git diff commmit-1 commit-2
View difference between commmit-1 and commmit-2
git-scm What is the difference between git diff HEAD vs. git diff –staged? What’s the difference between VCS and SCM? How to list all the files in a commit? about-collaborative-development-models
History of Cryptography
Block Ciphers(DES、AES)
Stream Ciphers
Evolution of Cryptography
Security Services of Cryptography
Electronic Code Book (ECB) Mode Analysis of ECB Mode Cipher Block Chaining (CBC) Mode Analysis of CBC Mode Cipher Feedback (CFB) Mode
Components of a Cryptosystem
Types of Cryptosystems
Challenge of Symmetric Key Cryptosystem
Asymmetric Key Encryption
encrypted decrypt
HMAC alongside AES (encrypt data)
In cryptography, a block cipher is a deterministic algorithm operating on fixed-length groups of bits, called blocks. It uses an unvarying transformation, that is, it uses a symmetric key.
HMAC is a nice MAC algorithm
a small change to a message should change the hash value so extensively(很小的变化,hash value变化很大)
message authentication codes (MACs) digital signatures / 使用private-key签名,使用public-key验证(verify)
The ideal cryptographic hash function has six main properties:
Pre-image attack resistant: a pre-image attack on cryptographic hash functions tries to find a message that has a specific hash value. A cryptographic hash function should resist attacks on its pre-image.
hash 分类
(Keyed cryptographic hash functions) HMAC
Efficiency of Operation 速度快,一般都比对称加密快
Cryptography
jwt 使用
MAC 信息传输、保存后,数据的完整性 G (key-generator) gives the key k on input 1n, where n is the security parameter. S (signing) outputs a tag t on the key k and the input string x. V (verifying) outputs accepted or rejected on inputs: the key k, the string x and the tag t.
Salting is an additional step during hashing, typically seen in association to hashed passwords, that adds an additional value to the end of the password that changes the hash value produced.
difference-encryption-hashing-salting Difference between salted hash and keyed hashing Encryption, hashing, salting – what’s the difference?
- Keyed hashing is usually used to build message authentication codes (MACs), the most common of which is the hashed-based MAC (HMAC).
- secret key
- should be as fast as possible
- 防篡改
- Salted hashing are intended to deter brute-force attacks , they are intentionally designed to be slow.
- 防暴力攻击(brute-force attacks)
- designed to be slow
- salts are not assumed to be secret.
Attacks
casbin