xxx
5
.vscode/settings.json
vendored
@@ -18,5 +18,8 @@
|
|||||||
"quickfix.biome": "always",
|
"quickfix.biome": "always",
|
||||||
"source.organizeImports.biome": "always"
|
"source.organizeImports.biome": "always"
|
||||||
},
|
},
|
||||||
"frontMatter.dashboard.openOnStart": false
|
"frontMatter.dashboard.openOnStart": false,
|
||||||
|
"[markdown]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BIN
public/api/i/2025/08/12/h1jv9s-1.webp
Executable file
|
After Width: | Height: | Size: 16 KiB |
BIN
public/api/i/2025/08/12/h9knpj-1.webp
Executable file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/api/i/2025/08/12/h9qh26-1.webp
Executable file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
public/api/i/2025/08/12/h9ujzp-1.webp
Executable file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
public/api/i/2025/08/13/xu7b2n-1.webp
Executable file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
public/api/i/2025/08/15/5dxy1-1.webp
Executable file
|
After Width: | Height: | Size: 24 KiB |
BIN
public/api/i/2025/08/17/julgjy-1.webp
Executable file
|
After Width: | Height: | Size: 31 KiB |
BIN
public/api/i/2025/09/07/xy0628-1.webp
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
public/api/i/2025/09/07/xz52lm-1.webp
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
public/api/i/2025/09/07/yscnoh-1.webp
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/api/i/2025/09/07/yu38tz-1.webp
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/api/i/cache/20250812.jpg
vendored
Executable file
|
After Width: | Height: | Size: 325 KiB |
BIN
public/api/i/cache/EasyImage_int_2bf4769c25f25ba1291007ee259b8a0d.workcontrol.txt
vendored
Executable file
BIN
public/api/i/cache/EasyImage_int_5eb2909882f5c0f27ca9fec1af02cd57.workcontrol.txt
vendored
Executable file
BIN
public/api/i/cache/EasyImage_int_d9a3ea24492f543c768ad842b3a224f4.workcontrol.txt
vendored
Executable file
BIN
public/api/i/cache/EasyImage_int_de14fb41139ed40378d681c97c531d80.workcontrol.txt
vendored
Executable file
59
src/content/posts/中间件/MySQL/MySQL-VARCHAR支持的最大长度.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
title: MySQL-VARCHAR支持的最大长度
|
||||||
|
published: 2025-09-07
|
||||||
|
description: ''
|
||||||
|
image: ''
|
||||||
|
tags: ['MySQL', 'VARCHAR']
|
||||||
|
category: '中间件 > MySQL'
|
||||||
|
draft: false
|
||||||
|
lang: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
MySQL中,最大行长度限制为65535字节,如果一行中仅仅有一个varchar字段,它的最大长度是多少呢?
|
||||||
|
(InnoDB/MyISAM 中一行最大长度限制是 65535 字节(65 KB 左右)。)
|
||||||
|
长度> 255,存储varchar长度需要2字节,长度<255,存储varchar长度需要1字节。
|
||||||
|
|
||||||
|
所以
|
||||||
|
- 当长度>255且非空的时候,可以存储65535 - 2 = 65533 字节。
|
||||||
|
- 当长度>255且可以为空的时候,可以存储65535 - 2 - 1(存储NULL标志) = 65532字节。
|
||||||
|
- 当长度<255且非空的时候,可以存储65535 - 1 = 65534 字节。
|
||||||
|
- 当长度<255且可以为空的时候,可以存储65535 - 1 - 1(存储NULL标志) = 65533字节。
|
||||||
|
|
||||||
|
如果只有一个 VARCHAR 字段
|
||||||
|
|
||||||
|
假设表里只有这一列:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE TABLE t (
|
||||||
|
v VARCHAR(N)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
```
|
||||||
|
|
||||||
|
行最大长度:65535 字节。
|
||||||
|
|
||||||
|
除了数据外,还有:
|
||||||
|
|
||||||
|
NULL 标志位(至少 1 字节,即使只有一列)。
|
||||||
|
|
||||||
|
VARCHAR 长度字节(1 或 2)。
|
||||||
|
|
||||||
|
所以最大能用来存储 v 的 = 65535 - 1 (NULL 标志) - 2 (长度字节) = 65532 字节。
|
||||||
|
|
||||||
|
因此:
|
||||||
|
|
||||||
|
✅ 单列 VARCHAR 最大可定义为 VARCHAR(65532)
|
||||||
|
|
||||||
|
|
||||||
|
> 如果是非null,就不需要占用那一字节null标志位了
|
||||||
|
```sql
|
||||||
|
CREATE TABLE t (
|
||||||
|
v VARCHAR(N) NOT NULL
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
```
|
||||||
|
|
||||||
|
这里N就可以是65533了
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
21
src/content/posts/中间件/MySQL/MySQL中CHAR和VARCHAR的区别.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
title: MySQL中CHAR和VARCHAR的区别
|
||||||
|
published: 2025-09-07
|
||||||
|
description: ''
|
||||||
|
image: ''
|
||||||
|
tags: ['MySQL', 'CHAR', 'VARCHAR']
|
||||||
|
category: '中间件 > MySQL'
|
||||||
|
draft: false
|
||||||
|
lang: ''
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# CHAR(n)
|
||||||
|
char(n) 是固定长度的字符串,CHAR列的长度是固定的,即使存储的字符串长度小于定义的长度,MySQL也会在字符串的末尾填充空格以达到指定的长度。
|
||||||
|
|
||||||
|
# VARCHAR(n)
|
||||||
|
可变长度的字符串,varchar列的长度是可变的,存储的字符串长度与实际数据长度相等,并且在存储数据的时候会额外增加1到2个字节(字符串长度超过255,就用两个字节) 用于存储字符串的长度信息。
|
||||||
|
|
||||||
|
理论上char比varchar会快,因为varchar长度不固定,处理需要多一次运算,但是实际上这种运算耗时微乎其微,而固定大小在很多场景下比较浪费空间,除非存储的字符确认是固定大小或者本身就很短,不然业务上推荐使用varchar.
|
||||||
|
|
||||||
30
src/content/posts/中间件/MySQL/MySQL事务隔离级别.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
title: MySQL事务隔离级别
|
||||||
|
published: 2025-09-07
|
||||||
|
description: ""
|
||||||
|
image: ""
|
||||||
|
tags: ["事务隔离级别", "MySQL"]
|
||||||
|
category: "中间件 > MySQL"
|
||||||
|
draft: false
|
||||||
|
lang: ""
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# 1 读未提交(脏读,不可重复读,幻读 问题)
|
||||||
|
|
||||||
|
最低的事务隔离级别,在这个事务隔离级别下,一个事务能看到另外一个事务未提交的数据修改,会导致 **脏读** 的问题(读取到其他事务未提交的数据)
|
||||||
|
|
||||||
|
# 2 读已提交(不可重复读,幻读)
|
||||||
|
|
||||||
|
这个事务隔离级别虽然解决了脏读问题,也就是只能读取到另外一个事务已经提交的数据,读取不到另外一个事务没有提交的数据,但是它有**不可重复读**的问题(同一个事务中,相同的查询会返回不同的结果)
|
||||||
|
|
||||||
|
# 3 可重复读(幻读) MySQL 默认事务隔离级别
|
||||||
|
|
||||||
|
这个事务隔离级别,使用 MVCC(快照读)的方式,解决了不可重复读的问题,但是还是有**幻读**的问题(幻读也就是在一个事务中,读取到另外一个事务插入的行,导致这个事务查询到的结果集行数不同)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# 4 串行化
|
||||||
|
|
||||||
|
最高的事务隔离级别,使用排他锁(Exclusive Lock)来保证事务的完全隔离。
|
||||||
44
src/content/posts/中间件/MySQL/MySQL索引类型有哪些.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
title: MySQL索引类型有哪些
|
||||||
|
published: 2025-08-14
|
||||||
|
description: ''
|
||||||
|
image: ''
|
||||||
|
tags: [索引, MySQL]
|
||||||
|
category: '中间件 > MySQL'
|
||||||
|
draft: false
|
||||||
|
lang: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
# MySQL索引类型有哪些
|
||||||
|
|
||||||
|
## 按数据结构分
|
||||||
|
分为
|
||||||
|
- B-Tree索引
|
||||||
|
- Hash索引
|
||||||
|
- Full-text索引
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
创建表的时候,InnoDB存储引擎会根据不同的场景选择不同的列作为索引:
|
||||||
|
- 有主键:会使用主键作为聚簇索引的索引键
|
||||||
|
- 没有主键: 选择第一个不包含NULL值的唯一列作为聚簇索引的索引键
|
||||||
|
- 上面两个都没有的情况下,InnoDB会自动生成一个隐式自增id列作为聚簇索引的索引键。
|
||||||
|
|
||||||
|
其他索引都属于辅助索引,也就是非聚簇索引或者二级索引。
|
||||||
|
## 按物理存储分
|
||||||
|
分为
|
||||||
|
- 聚簇索引(主键索引)
|
||||||
|
- 二级索引(辅助索引)
|
||||||
|
|
||||||
|
## 按字段特性分
|
||||||
|
|
||||||
|
- 主键索引
|
||||||
|
- 唯一索引
|
||||||
|
- 普通索引
|
||||||
|
- 前缀索引
|
||||||
|
|
||||||
|
主键索引是唯一的,且不允许为NULL。每个表只能有一个主键索引。
|
||||||
|
|
||||||
|
## 按字段个数分
|
||||||
|
- 单列索引
|
||||||
|
- 联合索引
|
||||||
23
src/content/posts/工作/flowable学习.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
title: flowable学习
|
||||||
|
published: 2025-08-12
|
||||||
|
description: ''
|
||||||
|
image: ''
|
||||||
|
tags: [Flowable,流程引擎,工作流]
|
||||||
|
category: '工作'
|
||||||
|
draft: false
|
||||||
|
lang: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
发布流程后,会在下面几张表里有记录
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
103
src/content/posts/数据结构与算法/动态规划解题思路.md
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
---
|
||||||
|
title: 动态规划解题思路
|
||||||
|
published: 2025-08-17
|
||||||
|
description: ''
|
||||||
|
image: ''
|
||||||
|
tags: [动态规划,数据结构与算法]
|
||||||
|
category: '数据结构与算法'
|
||||||
|
draft: false
|
||||||
|
lang: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
# 动态规划解题思路
|
||||||
|
|
||||||
|
## 斐波那契数列
|
||||||
|
暴力递归
|
||||||
|
```java
|
||||||
|
// f(n) 计算第 n 个斐波那契数
|
||||||
|
static int fib(int n) {
|
||||||
|
if(n <= 1 && n >= 0) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
return fib(n - 1) + fib(n - 2);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
使用Memo数组存储,避免重复计算
|
||||||
|
```java
|
||||||
|
|
||||||
|
static long fib2(int n) {
|
||||||
|
long[] memo = new long[n + 1];
|
||||||
|
Arrays.fill(memo,-1);
|
||||||
|
return dp(memo,n);
|
||||||
|
|
||||||
|
}
|
||||||
|
static long dp(long[] memo,int n) {
|
||||||
|
if(n == 0 || n == 1) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
if(memo[n] != -1) {
|
||||||
|
return memo[n];
|
||||||
|
}
|
||||||
|
memo[n] = dp(memo,n - 1) + dp(memo,n - 2);
|
||||||
|
return memo[n];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 零钱兑换
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```java
|
||||||
|
class Solution {
|
||||||
|
public int coinChange(int[] coins, int amount) {
|
||||||
|
int[] dp = new int[amount + 1];
|
||||||
|
Arrays.fill(dp,amount + 1);
|
||||||
|
dp[0] = 0;
|
||||||
|
for(int i = 0;i<dp.length;i++) {
|
||||||
|
for(int coin : coins) {
|
||||||
|
if(i - coin < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
dp[i] = Math.min(dp[i],1 + dp[i - coin]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (dp[amount] == amount + 1) ? -1 : dp[amount];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```java
|
||||||
|
class Solution {
|
||||||
|
int[] memo;
|
||||||
|
|
||||||
|
public int coinChange(int[] coins, int amount) {
|
||||||
|
memo = new int[amount + 1];
|
||||||
|
// 备忘录初始化为一个不会被取到的特殊值,代表还未被计算
|
||||||
|
Arrays.fill(memo, -666);
|
||||||
|
|
||||||
|
return dp(coins, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
int dp(int[] coins, int amount) {
|
||||||
|
if (amount == 0) return 0;
|
||||||
|
if (amount < 0) return -1;
|
||||||
|
// 查备忘录,防止重复计算
|
||||||
|
if (memo[amount] != -666)
|
||||||
|
return memo[amount];
|
||||||
|
|
||||||
|
int res = Integer.MAX_VALUE;
|
||||||
|
for (int coin : coins) {
|
||||||
|
// 计算子问题的结果
|
||||||
|
int subProblem = dp(coins, amount - coin);
|
||||||
|
// 子问题无解则跳过
|
||||||
|
if (subProblem == -1) continue;
|
||||||
|
// 在子问题中选择最优解,然后加一
|
||||||
|
res = Math.min(res, subProblem + 1);
|
||||||
|
}
|
||||||
|
// 把计算结果存入备忘录
|
||||||
|
memo[amount] = (res == Integer.MAX_VALUE) ? -1 : res;
|
||||||
|
return memo[amount];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||