大道至简

人生苦短,我用Python.

LeetCode-Alg-235-Lowest Common Ancestor of a Binary Search Tree

LeetCode-Alg-235-Lowest Common Ancestor of a Binary Search Tree

1、题目 Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined...

LeetCode-Alg-108-Convert Sorted Array to Binary Search Tree

LeetCode-Alg-108-Convert Sorted Array to Binary Search Tree

1、题目 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined as a binary tree in which the dep...

Netty学习笔记

Netty学习笔记

1.Netty介绍 Netty是一个开源的、基于Java的高性能IO工具,与使用标准java实现相同的功能相比使用Netty可以构建可拓展,强大的网络应用变的更容易,Netty还包含一些特定于 操作系统的优化,例如在Linux上使用Epoll库 2.Netty优势 3.Netty工具集

HTTPS学习

HTTPS学习笔记

1. HTTP HTTP是构建于TCP/IP协议之上的应用层协议,HTTP协议是无状态的,传输层通过TCP协议进行可靠传输,网络层依靠 IP协议进行路由寻址。 客户端向服务器发送请求,服务器对其进行响应,整个过程中没有对数据进行加密,全部以明文方式传输,如果我们使用抓包工具 对HTTP协议的数据包进行抓取就能从中获取到传输的信息,如果中间人对数据进行截获并篡改了数据就会带来信息的泄露。...

Mysql重置密码

Mysql重置root密码

centos7安装完mysql无默认密码 我们在安装mysql5.7后,会在日志文件中给出默认的随机密码,但是有时候却没有,这个时候我们可以取消mysql的默认密码,进入后直接修改密码。 取消默认密码 编辑mysql的配置文件/etc/my.cnf 在 [mysqld] 小节下添加一行: skip-grant-tables=1; 重启mysql systemctl restart ...

Mysql5.7主从配置

Mysql5.7配置主从同步

前提 假设我们以将安装好了mysql(这里我们使用的版本是5.7.25),系统环境为centos7,master和slave机器IP如下: master 192.168.10.101 slave 192.168.10.61 1、配置master 1.1 编辑/etc/my.cnf文件 在文件增加如下配置 [mysqld] server-id=101 # 通常为本机ip后几位 ...

使用FormData上传文件和其它参数,SpringMVC后端获取参数为null的解决方法

FormData上传文件+其它参数,Spring后端获取不到

1、问题产生 在写一个基于SpringMVC的前后端分离的项目中,前端通过Ajax的POST方法将文件上传到后端,前端上传的除了文件 还有其它字段,于是使用FormData对象来存储并post到后端; 后端的controller中通过request.getParameter(“key”)来获取前端提交的数据,但是遇到问题就是获取的值一直为NULL。 前端请求的代码: var formD...

Centos7搭建ES集群

ES集群搭建

搭建环境 本次实验准备了6台Centos7的虚拟机来搭建ES集群环境,虚拟机内网IP如下: master1 192.168.10.55 master2 192.168.10.108 data1 192.168.10.59 data2 192.168.10.60 client 192.168.10.54 ingest 192.168.10.61 ES中节点分为四种类型: 1) 主节点...

LeetCode-Alg-536-Binary-Tree-Tilt

计算二叉树的坡度

1、题目 Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right...

LeetCode-Alg-226-Invert-Binary-tree

LeetCode-Alg-226-Invert-Binary-tree

1、题目 Invert a binary tree. Example: Input: 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This prob...

< script src = " / js / bootstrap.min.js " >