Home

IDEA基于Eclipse keymap的常用快捷键

常用快捷键 Ctrl + Space 代码智能提示 Ctrl + G 找到调用此类、方法或变量的位置 Ctrl + Shift + Space 查看类或方法的详细信息,可输入参数列表 Ctrl + Q 快速返回最近修改的地方 Ctrl + E 快速打开最近打开过的文件 Alt + Insert 生成代码(getter setter constructor),重写方法(equals hashCode) Ctrl + T 快速找抽象类或接口的实现类 Ctrl + Shift + R 快速找文件 Ctrl + Shift + T 快速找类 F3 跳到声明 Ctrl + F3 / Ctrl + O 当前文件outline Alt + Shif...

Read more

Java容器HashMap源码分析

本文源码基于JDK8 数据结构 HashMap的基础数据结构为一个链表数组 transient Node<K,V>[] table; 内部类Node代表链表节点,同时实现了接口Map.Entry,链表的一个节点也就是一个键值对 static class Node<K,V> implements Map.Entry<K,V> { final int hash; final K key; V value; Node<K,V> next; Node(int hash, K key, V value, Node<K,V> next) { ...

Read more

web.xml代码模板

web.xml 3.0版本 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 3.0//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name></display-name> </web-app> web.xml 3.1版本 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSc...

Read more

certbot使用

基础环境 基于Cent OS 7操作系统,Docker以及Nginx,Nginx与certbot分别安装在不同的Docker容器中 域名所有权验证 Nginx设置 Nginx启动时增加两个数据卷,读取域名所有权验证内容以及证书与密钥 docker stop nginx docker rm nginx docker run -p 80:80 --name nginx \ --restart always \ -v /opt/volume/nginx/conf:/etc/nginx \ -v /opt/volume/nginx/html:/usr/share/nginx/html \ -v /opt/volume/nginx/log:/var/log/nginx \ -v /e...

Read more

单例模式的实现

提前初始化 静态初始化 Singleton类加载过程中静态初始化阶段初始化单例对象,单例对象被安全发布。执行类加载前会先获取锁,保证同一时间只有一个线程执行Singleton的类加载操作。每个线程在使用Singleton类之前都至少获取一次这个锁以确保这个类已经加载 public class Singleton { public static Singleton singleton = new Singleton(); private Singleton() {} public static Singleton getSingleton() { return singleton; } } 延迟初始化 监视器锁 利用监视器...

Read more

CSS盒模型高度与宽度

width属性和height属性 width属性指定盒模型内容区的宽度 height属性指定盒模型内容区的高度 实际占有宽度与高度 W3C标准盒模型实际占有宽度为 margin-left + border-left + padding-left + width + padding-right + border-right + margin-right W3C标准盒模型实际占有高度为 margin-top + border-top + padding-top + height + padding-bottom + border-bottom + margin-bottom W3C标准盒模型与IE盒模型的区别 W3C标准盒模型的内容区不包含内边距padding、边框bor...

Read more

CentOS防火墙firewall使用

CentOS防火墙结构 CentOS7以后默认使用firewall配置防火墙规则 firewall与iptables都只用于安全规则的配置,真正根据安全规则工作的是Linux内核的netfilter firewall防火墙区域 相当于预设的规则策略,默认为public firewall服务命令 # 安装firewalld yum install firewalld # 开启服务 systemctl start firewalld # 关闭服务 systemctl stop firewalld # 开机启动服务 systemctl enable firewalld # 关闭开机启动服务 systemctl disable firewalld # 查看防火墙状态 sys...

Read more

Java线程中断

概述 Java线程中断机制是线程间的一种协作机制,通常用于一条线程通知另外一条线程终止。被通知终止的线程并不是马上终止,而是在合适的时刻对通知进行响应并安全终止 核心方法 thread.interrupt() 将线程thread的中断状态标记为中断 thread.isInterrupted() 获取线程thread的中断状态 Thread.interrupted() 获取当前线程的中断状态,且将当前线程的中断状态标记为非中断 响应中断 循环检查响应 public class InterruptibleThread extends Thread { @Override public void run() { // ...

Read more

CSRF攻击原理

CSRF概述 CSRF全称Cross-Site Request Forgery,跨站请求伪造,也可缩写为XSRF CSRF是一种挟制用户在当前已登录的Web应用程序上执行非本意的操作的攻击方法。这利用了web中用户身份验证的一个漏洞:简单的身份验证只能保证请求是发自某个用户的浏览器,却不能保证请求本身是用户自愿发出的。 CSRF攻击例子 用户通过浏览器访问A站点,A站点通过某种方式向B站点发起请求,假如浏览器中当前还记录着有效的B站点登录信息,如cookie中存在JSESSIONID或remember-me,且浏览器不阻止这种请求,则总体而言,在用户不知情的情况下,浏览器向B站点发起了一次请求 假如一家银行用以执行转账操作的URL地址如下: https://ba...

Read more

MySQL数据库定时备份

挂载Docker数据卷 挂载用于放置备份数据脚本的数据卷,如不需要在容器内访问备份的数据库脚本,则不需要挂载 docker run -p 3306:3306 --name mysql \ --restart always \ --network language-trainer \ -v /opt/volume/mysql/log:/var/log/mysql \ -v /opt/volume/mysql/data:/var/lib/mysql \ -v /opt/volume/mysql/conf:/etc/mysql \ -v /opt/volume/mysql/bak:/var/bak \ -e MYSQL_ROOT_PASSWORD=mysqlrootroot \ -d m...

Read more