0%

安装 wget 遇到了个报错

1
2
3
4
[root@ip-xxxxx centos]# yum install wget
CentOS Linux 8 - AppStream 51 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlis
t: No URLs in mirrorlist

原因

CentOS Linux 8 在 2022 年 12 月 31 日来到生命周期终点(End of Life,EoL)。即 CentOS Linux 8 操作系统版本结束了生命周期(EOL),Linux 社区已不再维护该操作系统版本。所以原来的 CentOS Linux 8 的 yum 源也都失效了!最终导致此问题的产生。

解决

1
2
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

参考文章

对应版本文件

去这找一下对应版本文件

https://www.python.org/downloads/source/

下载及安装

安装依赖

1
yum install gcc openssl-devel bzip2-devel libffi-devel -y

下载并解压文件

1
2
3
4
5
6
curl -O https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
tar -xzf Python-3.8.1.tgz
cd Python-3.8.1/
./configure --enable-optimizations
make altinstall
python3.8

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<sctipt>
import { watch,defineProps } from 'vue';
const props = defineProps({
bool: {
type: Boolean,
required: true
}
})

watch(
() => props.bool,
(newValue,oldValue) => {
console.log(newValue,oldValue)
}
)
</script>

参考文章

老项目用的 node-sass 版本比较低,要么降级 node 版本,要么更新依赖,我选择了更新依赖,这是期间碰到的问题及解决方案

Node Sass 升级

目前是直接升级依赖如下

1
2
"sass": "^1.52.3",
"sass-loader": "^10",

或者

1
2
"sass": "^1.52.3",
"sass-loader": "7.3.1",

SassError: expected selector 报错 ::v-deep 替换 /deep/

搜了一下:尝试用 ::v-deep 替换 /deep/ ,成功解决了问题。

某些预处理器(例如 Sass)可能无法>>>正确解析。

TypeError: token.type.endsWith is not a function vue eslint 问题解决

直接把 babel-eslint 降级, 写死为 ^8.2.2

更改前: “babel-eslint”: “^10.1.0”,

更改后: “babel-eslint”: “^8.2.2”,

删除 node_modules

yarn install

参考文章

问题

数据库里的值
123
456
789
想搜索的值是:abc123456
然后能匹配到数据库里的 123 或者 456,你们都是怎么做的?

解决

https://dev.mysql.com/doc/refman/8.0/en/fulltext-natural-language.html

建表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mysql> CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
) ENGINE=InnoDB;

Query OK, 0 rows affected (0.08 sec)

mysql> INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial, we show ...'),
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');

Query OK, 6 rows affected (0.01 sec)
Records: 6 Duplicates: 0 Warnings: 0

SELECT * FROM articles
WHERE MATCH (title,body)
AGAINST ('database' IN NATURAL LANGUAGE MODE);
+----+-------------------+------------------------------------------+
| id | title | body |
+----+-------------------+------------------------------------------+
| 1 | MySQL Tutorial | DBMS stands for DataBase ... |
| 5 | MySQL vs. YourSQL | In the following database comparison ... |
+----+-------------------+------------------------------------------+
2 rows in set (0.00 sec)

查询

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SELECT id, body, MATCH (title,body)
AGAINST ('Security implications of running MySQL as root'
IN NATURAL LANGUAGE MODE) AS score
FROM articles
WHERE MATCH (title,body)
AGAINST('Security implications of running MySQL as root'
IN NATURAL LANGUAGE MODE);

+----+-------------------------------------+-----------------+
| id | body | score |
+----+-------------------------------------+-----------------+
| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |
| 6 | When configured properly, MySQL ... | 1.3114095926285 |
+----+-------------------------------------+-----------------+
2 rows in set (0.00 sec)

Sqlite 也有,但是要切片查询。

找出占用端口的进程

1
2
lsof -i tcp:端口
kill 进程ID

想在 Centos 上跑 puppeteer,但是需要装一堆依赖。

发现了一个特别有意思的安装方法

1
yum install chromium

哈哈装 chromium 内核就可以自动装相关依赖了

检查是否支持这个 api

1
2
3
4
5
if ('BarcodeDetector' in window) {
console.log('Barcode Detector supported!');
} else {
console.log('Barcode Detector is not supported in this browser');
}

初始化构造函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const barcodeDetector = new BarcodeDetector({
formats: [
'aztec',
'code_128',
'code_39',
'code_93',
'codabar',
'data_matrix',
'ean_13',
'ean_8',
'itf',
'pdf417',
'qr_code',
'upc_a',
'upc_e',
],
});

查看支持的条码

1
2
3
4
5
6
7
8
async function checkIfFormatIsSupported(format) {
return await BarcodeDetector.getSupportedFormats().then(
(supportedFormats) => {
console.log(supportedFormats);
return supportedFormats.indexOf(format) !== -1;
}
);
}

识别条码

1
2
3
4
5
6
7
try {
const barcodes = await barcodeDetector.detect(image);
barcodes.forEach((barcode) => console.log(barcode));
} catch (e) {
// if the imageElement is invalid, the DOMException will be thrown
console.error('Barcode detection failed:', e);
}