- 博客(83)
- 资源 (6)
- 收藏
- 关注
原创 Java - List<?> 泛型
伪代码public void test(String filePath) { // Step 1. convert file to data list Map<String, List<?>> map = getUserList(filePath); if (map == null) { throw new GlobalException("集合为空!"); } List<Apple> appleList = (List<Apple>)
2021-03-26 15:10:34 507
原创 MySQL - Failed to open the referenced table XXX
问题复现CREATE TABLE `master_role` ( `id` INTEGER NOT NULL AUTO_INCREMENT COMMENT 'ID', `role` VARCHAR(50) CHARACTER SET latin1 NOT NULL COMMENT 'Role', `active` TINYINT NOT NULL COMMENT 'Active', PRIMARY KEY (`id`))ENGINE = InnoDBDEFAULT CHARSET
2021-03-26 14:48:37 11353 7
原创 MySQL - 编码
什么是编码?计算机使用0和1来存储文本,比如字符“C”被存成“01000011”。计算机显示"C"时经过2个步骤:步骤1:读取“01000011” (2进制码),计算得到67。步骤2:计算机在Unicode字符集中查找67,找到了“C”。Unicode字符集是几乎所有网络都在使用的。Unicode字符集包含了上百万个字符。最简单的编码是UTF-32,每个字符使用32位。UTF-8可以节省空间,在UTF-8中,字符“C”只需要8位,一些不常用的字符,比如“”需要32位。其他的字符可
2021-03-26 14:04:34 116
原创 MySQL - 3719 ‘utf8‘ is currently an alias for the character set UTF8MB3
Warning Description3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.MySQL Script with warningCREATE TABLE `user` ( `id
2021-03-26 13:36:52 3293 1
原创 MySQL - 1681 Integer display width is deprecated and will be removed in a future release
1681 Integer display width is deprecated and will be removed in a future releaseMySQL VersionMySQL Version:8.0.18SQL Script (with warning)CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `role` varchar(50) CHARACTER SE.
2021-03-26 13:23:05 8275 1
原创 MySQL - Default 常量
说明MYSQL的默认值仅支持常量,不支持公式或者变量。除了timestamp可以设置默认值为current_timestamp之外,其它均不可。新建表 userCREATE TABLE `user` ( `email` varchar(150) NOT NULL COMMENT 'Email', `active` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Active', `updated_time` TIMESTAMP DEFA...
2021-03-26 10:15:43 279
原创 Java - 读取UTF-8-BOM文件,第一个字段值为Null
问题复现Phone.java@Data@NoArgsConstructor@AllArgsConstructorpublic class Phone { private String brand; private String type;}PhoneTest.javaimport cn.hutool.core.io.IORuntimeException;import cn.hutool.core.io.file.FileReader;import com.al
2021-03-25 16:40:19 452
原创 Java - 继承 & 多态
About InheritanceInheritance relationship can be described as Parent/Child Base / Derived Superclass / sub class --> Preferred Java vocabulary Inheritance in JavaRelationship between multiple classes Java supports single inheritance Each cl
2021-03-25 09:50:10 74
原创 Java - Variable Type
Variable TypePrimitive TypeWhat is Primitive Type?Numbers, characters, and booleans Stored in fastest available memory Primitive data type names are all lowercase Not a primitice: StringEach Primitive type has a class called wrapped class.O
2021-03-24 14:31:37 152
原创 Java - Garbage Collector
JavaGarbage CollectorRuns in its own thread Can destroy dereferenced objects, but not required Cannot force garbage collectionSystem MethodsSystem.gc() & Runtime.gc() can request garbage collection, but there's no guarantee it will happen. Out.
2021-03-24 14:29:24 105
原创 Java - Encapsulation 封装
Benefits of EncapsulationBreaking functionality into small, maintainable units Grouping functions and data together Supporting testing of software at a granular【细粒度的】 levelDemo of Unencapsulated Codepublic static void main(String[] args) { Olive[]
2021-03-24 14:27:40 130
原创 Java - Passing Value
Passing Value to MethodsIn Java, variables are always passed by copy!Passing to a method by copy:Method receives a copy of the variable. Passing to a method by reference:Method receives a reference of the original object.Pass By copyCopy only w..
2021-03-24 14:14:43 135
原创 Java - introduction of Java
Compare Java with C++Compare Java with Java ScriptAnalyze a class (Main.java)package com.example;public class Main() { public static void main(String[] args) { System.out.println("Hello World"); }}Java Commandjava: runtime javac: co
2021-03-22 17:32:16 123
原创 MySQL - datetime vs timestamp
转载1.datetime与timestamp区别2.datetime与timestamp的区别及使用选择
2021-03-21 19:45:58 127
原创 Java - @JsonProperty
@JsonProperty介绍作用@JsonProperty 用于属性上,将属性的名称序列化为另外一个名称。实例LoginController.java@RestControllerpublic class LoginController { @GetMapping("test01") public ResponseEntity<ResponseResult<User>> test01() { User user = User.
2021-03-19 16:10:06 391
原创 Java - @Builder 创建对象
@Builderbuilder()来自Lombok中的@Builder, 上图列出了引入@Builder前后的区别。实例User.javaimport lombok.AllArgsConstructor;import lombok.Builder;import lombok.Data;import lombok.NoArgsConstructor;@Data@Builder@NoArgsConstructor@AllArgsConstructorpublic clas
2021-03-19 15:45:04 635
原创 Java - enum ‘@Data‘ is only supported on a class type
问题代码@Datapublic enum ResultStatusType { ...}报错如下'@Data' is only supported on a class type原因分析@Data只能写在class中,无法写在enum上,写上@Getter就行。@Getterpublic enum ResultStatusType { ...}...
2021-03-19 10:34:28 2366
原创 Java - 自定义注解
注解(Annotation) 的概念jdk1.5 新增的功能 本质是在代码中做标记,这些标记可以在编译、类加载、JVM运行时被读取。开发者在不改变原有逻辑的情况下,在源文件(source)中嵌入补充信息。常用的注解@Documented: 生成文档相关的注解 在编译时进行格式检查(JDK内置的3个基本注解) @Override: 限定重写父类方法,限于方法 @Deprecated: 表示所修饰的元素(类、方法等)已过时。 @SuppressWarnings: 抑制编译器警告。
2021-03-17 19:43:03 127
原创 Java - OS 参数校验
public static boolean commandIsSafe(String parameter) { parameter = parameter.trim(); if (parameter.length() == 0) { return false; } StringBuilder safeParam = new StringBuilder(); String whiteCharList = "ABCDEFGHIJKLMNOPQRST..
2021-03-17 17:28:25 139
原创 Spring Boot - Spring Security
基本概念Spring Security provides HTTP basic auth. When you bring in the Spring Security starter, just introducing that gives you basic authentication on all of your endpoints, with the exception of some of the commonly ignored ones that are in the static dir
2021-03-16 11:39:28 111
原创 MySQL - serverTimezone=UTC
application-dev.yml 中MySQL配置如下:url: jdbc:mysql://localhost:3306/platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false&autoReconnect=true&fa
2021-03-16 11:08:47 1868
原创 Java - Improper Neutralization of Input leads to Reflected File Download
DescriptionRule:Improper Neutralization of Input leads to Reflected File DownloadVulnerability Type:InjectionReflected File Download (RFD) is a web attack vector that enables attackers to gain complete control over a victim’s machine. It happens w..
2021-03-15 16:58:45 183
原创 Java - Avoid loops without an initiator and an increase
DescriptionRule:Avoid loops without an initiator and an increaseA for loop without initialiser and increment expressions is confusing and error prone. Making the loop less comprehensible, opening the possibility for an "infinite loop" bug. Loops with.
2021-03-15 16:02:17 133
原创 Java - stream
StreamStreams provide a clean and simple way to iterate over a collection in Java. Instead of using a forEach loop, streams allow functional programming techniques to be used. These streams are not to be confused with input and output streams which are s
2021-03-15 13:04:56 110 1
原创 Java - 函数式编程
什么是函数式接口所谓的函数式接口,当然首先是一个接口,然后就是在这个接口里面只能有一个抽象方法。这种类型的接口也称为SAM接口,即Single Abstract Method interfaces@FunctionalInterface注解Java 8为函数式接口引入了一个新注解@FunctionalInterface,主要用于编译级错误检查,加上该注解,当你写的接口不符合函数式接口定义的时候,编译器会报错。加不加@FunctionalInterface对于接口是不是函数式接口没有影响,该注
2021-03-15 11:35:46 106 1
原创 Java - collections
Collection|___ Set|___ List|___Queue|___ Map |___ LinkedHashMapSetNo duplicates UnorderedListDuplicates allowed Order is significantQueueFor "first in, first out" operations Like a real-life queueMapDoes not extend Colle...
2021-03-15 10:48:35 87
原创 Idea - R6025 pure virtual function
解决办法:1、开始–运行–输入cmd2、输入 cd %windir%\system32 (进入windows安装目录的system32文件夹)3、输入 Regsvr32 Msxml3.dll4、上述故障全部解决
2021-03-14 23:16:35 752
原创 Java - generic 泛型
The advantages of using generics means that the compiler checks that only strings are added to the list which makes the code safer.List names = new ArrayList();names.add("Bill");String name = (String)names.get(0);System.out.println("First name:" + na
2021-03-13 17:16:34 65
原创 Docker
Docker简介Docker是基于Go语言实现的云开源项目,诞生于2013年初,最初发起者是dotClouw公司。Docker 自开源后受到广泛的关注和讨论,目前已有多个相关项目,逐断形成了围Docker的生态体系。dotCloud 公司后来也改名为Docker Ine。Docker是一个开源的容器引擎,它有助于更快地交付应用。 Docker可将应用程序和基础设施层隔离,并且能将基础设施当作程序一样进行管理。使用 Docker可更快地打包、测试以及部署应用程序,并可以缩短从编写到部署运行代码的周期。
2021-03-12 11:43:58 95
原创 git - git 本质解析
Git is a content-addressable(内容寻址) file system. Core part is key-value data store. After inserting date into DB, git will return a hash value which is used to access data.C:\Projects\git>echo "20201210 23:01" | git hash-object -w --stdin c273219f6e
2021-03-12 11:26:37 205
原创 Git - git 入门
本地提文件到远程仓库Step1: create folder named git within C:\Projectscd C:\Projects\git Step2: init a git content.C:\Projects\git>git init Initialized empty Git repository in C:/Projects/git/.git/ Step3: a new git repository without branch master,
2021-03-12 10:41:45 348
原创 Linux - 安装Jenkins
Install Jenkins with Docker1. cd /opt/ 2. mkdir jenkins 3. chown -R 1000:1000 /opt/jenkins/ 4. docker run -p 9090:8080 -p 50000:50000 --name jenkins --privileged=true -v /opt/jenkins:/var/jenkins_home -itd jenkins/jenkins:latest 5. sudo docker
2021-03-12 09:58:51 101
原创 Linux - 管道命令
grep管道命令(|),将左侧命令的标准输出转换为标准输入,提供给右侧命令作为参数。grep接受标准输入作为参数。grep root /etc/password等价于cat /etc/password | grep root大多数命令不接受标准输入作为参数,只能直接在命令行输入参数。echo命令不接受管道参数。echo "hello world" | echo # 不会有输出echo "hello world" # 输出"hello world"xargsxargs
2021-03-12 09:55:13 165
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人