Linux shell编程学习笔记80:gzip命令——让文件瘦身
0 引言
在
Linux shell编程学习笔记76:tar命令——快照 & 备份(上)-CSDN博客
Linux shell编程学习笔记77:tar命令——快照 & 备份(下)_linux 系统快照-CSDN博客
Linux shell编程学习笔记78:cpio命令——文件和目录归档工具(上)-CSDN博客
Linux shell编程学习笔记79:cpio命令——文件和目录归档工具(下)-CSDN博客
中,我们分别介绍了用于文件和目录归档的tar和cpio命令,为了缩小归档文件的体积,我们还可以使用压缩软件对归档文件进行压缩。
在Windows系统中,我们常用的压缩软件有WinRAR、7-Zip、WinZip、PeaZip、Bandizip等。
在Linux系统中,常用的压缩软件有gzip,plzip、p7zip、pbzip2、ebzip等。
今天我们重点研究gzip。
1 gzip 的功能,帮助信息,格式,选项和参数说明
1.1 gzip 的功能
gzip 命令是 Linux 中流行的压缩工具,用于减小文件大小,同时保留其原始内容。它是 GNU Core Utilities 包的一部分,几乎在所有 Linux 发行版上都可用。
1.2 gzip 的帮助信息
我们可以使用 gzip -h 命令获取帮助信息。
1.2.1 bash中的gzip帮助信息
[purpleendurer @ bash ~] gzip
gzip: compressed data not written to a terminal. Use -f to force compression.
For help, type: gzip -h
[purpleendurer @ bash ~] gzip -h
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place).Mandatory arguments to long options are mandatory for short options too.-c, --stdout write on standard output, keep original files unchanged-d, --decompress decompress-f, --force force overwrite of output file and compress links-h, --help give this help-l, --list list compressed file contents-L, --license display software license-n, --no-name do not save or restore the original name and time stamp-N, --name save or restore the original name and time stamp-q, --quiet suppress all warnings-r, --recursive operate recursively on directories-S, --suffix=SUF use suffix SUF on compressed files-t, --test test compressed file integrity-v, --verbose verbose mode-V, --version display version number-1, --fast compress faster-9, --best compress better--rsyncable Make rsync-friendly archiveWith no FILE, or when FILE is -, read standard input.Report bugs to <bug-gzip@gnu.org>.
[purpleendurer @ bash ~]
1.2.2 银河麒麟(kylin)系统中的gzip帮助信息
[purpleendurer @ kylin ~] gzip -h
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place).Mandatory arguments to long options are mandatory for short options too.-c, --stdout write on standard output, keep original files unchanged-d, --decompress decompress-f, --force force overwrite of output file and compress links-h, --help give this help-k, --keep keep (don't delete) input files-l, --list list compressed file contents-L, --license display software license-n, --no-name do not save or restore the original name and time stamp-N, --name save or restore the original name and time stamp-q, --quiet suppress all warnings-r, --recursive operate recursively on directories-S, --suffix=SUF use suffix SUF on compressed files-t, --test test compressed file integrity-v, --verbose verbose mode-V, --version display version number-1, --fast compress faster-9, --best compress better--rsyncable Make rsync-friendly archiveWith no FILE, or when FILE is -, read standard input.Report bugs to <bug-gzip@gnu.org>.
[purpleendurer @ kylin ~]
1.3 gzip 的命令格式
gzip [选项]... [文件]...
1.4 gzip 的选项和参数说明
1.4.1 gzip的选项
选项 | 说明 | 备注 |
---|---|---|
-c, --stdout | 写入标准输出,保持原始文件不变 | |
-d, --decompress | 解压缩 | |
-f, --force | 强制覆盖输出文件并压缩链接 | |
-h, --help | 提供此帮助信息 | |
-k, --keep | 保留(不删除)输入文件 | 不是所有版本的gzip都支持此参数 已知1.5不支持,1.6支持 |
-l, --list | 列出压缩文件内容 | |
-L, --license | 显示软件许可证 | |
-n, --no-name | 不保存或恢复原始名称和时间戳 | |
-N, --name | 保存或恢复原始名称和时间戳 | |
-q, --quiet | 抑制所有警告 | |
-r、--recursive | 对目录递归操作 | |
-S, --suffix=SUF | 在压缩文件上使用后缀 SUF | |
-t, --test | 测试压缩文件的完整性 | 建议同时指定-v选项 |
-v, --verbose | 详细模式,显示详细的压缩或解压缩过程 | |
-V、--version | 显示版本号 | |
-1, --fast | 压缩速度更快 | |
-9, --best | 压缩得更好 | |
--rsyncable | 制作 rsync 友好的存档 |
1.4.2 gzip的参数
文件:表示要压缩或解压缩的一个或多个文件。
2 gzip使用实例
2.1 创建演示文件和目录
我们使用 echo 命令和输出重定向创建文件f1.txt 和 f2.txt,使用mkdir命令创建目录d1,再使用 echo 命令和输出重定向在目录d1下面创建文件fa.txt 和 fb.txt
[purpleendurer @ bash ~ ] echo "f1" > f1.txt
[purpleendurer @ bash ~ ] echo "f2" > f2.txt
[purpleendurer @ bash ~ ] mkdir d1
[purpleendurer @ bash ~ ] echo "d1fa" > d1/fa.txt
[purpleendurer @ bash ~ ] echo "d1fb" > d1/fb.txt
[purpleendurer @ bash ~ ] ls -R
.:
Code d1 f1.txt f2.txt./Code:./d1:
fa.txt fb.txt
[purpleendurer @ bash ~ ]
2.2 压缩单个文件
2.2.1 压缩单个文件后删除源文件
例如:使用gzip压缩当前目录下文件f1.txt的命令 :gzip f1.txt
[purpleendurer @ bash ~ ] ls
Code d1 f1.txt f2.txt
[purpleendurer @ bash ~ ] gzip f1.txt
[purpleendurer @ bash ~ ] ls
Code d1 f1.txt.gz f2.txt
[purpleendurer @ bash ~ ]
执行压缩命令后,我们会发现在当前目录下,被压缩的源文件f1.txt不见了,多了一个压缩后的目标文件 f1.txt.gz。
注意:在默认情况下,gzip压缩指定的文件,并为它加上 .gz
扩展名。源文件会被删除。
2.2.2 压缩单个文件后保留源文件
如果我们希望压缩文件后仍然保留源文件,该如何操作呢?
例如使用gzip压缩当前目录下文件f2.txt,压缩后不删除f2.tx
如果我们使用的gzip支持-k 选项,那么可以使用 -k 选项,命令为 :
gzip -k f2.txt
如果我们使用的gzip不支持-k 选项,那么可以使用-c选项结合输出重定向来操作,命令为:
gzip -c f2.txt > f2.txt.gz
[purpleendurer @ bash ~ ] ls
Code d1 f1.txt.gz f2.txt
[purpleendurer @ bash ~ ] gzip -k f2.txt
gzip: invalid option -- 'k'
Try `gzip --help' for more information.
[purpleendurer @ bash ~ ] gzip -c f2.txt > f2.txt.gz
gzip: f2.txt : No such file or directory
[purpleendurer @ bash ~ ] ls
Code d1 f1.txt.gz f2.txt f2.txt.gz
[purpleendurer @ bash ~ ]
在上面的操作中,我们先尝试了命令: gzip -k f2.txt ,但是很不幸的是,我们使用的gzip不支持-k选项。
接着我们尝试了命令:gzip -c f2.txt > f2.txt.gz,虽然我们收到了出错提示信息:
gzip: f2.txt : No such file or directory
但是,我们使用ls命令会发现压缩文件f2.txt.gz。
要想避免收到上面所说的出错提示信息。
我们可以使用命令:
gzip < f1.txt > f2.txt.gz
[purpleendurer @ bash ~ ] ls
Code d1 f1.txt f2.txt
[purpleendurer @ bash ~ ] gzip < f1.txt > f2.txt.gz
[purpleendurer @ bash ~ ] ls
Code d1 f1.txt f2.txt f2.txt.gz
[purpleendurer @ bash ~ ]
2.3 压缩多个文件
压缩当前目录下的文件f1.txt f2.txt,命令为:
gzip f1.txt f2.txt
[purpleendurer @ bash ~ ] ls
Code d1 f1.txt f2.txt f2.txt.gz
[purpleendurer @ bash ~ ] gzip f1.txt f2.txt
gzip: f2.txt.gz already exists; do you wish to overwrite (y or n)? y
[purpleendurer @ bash ~ ] ls
Code d1 f1.txt.gz f2.txt.gz
[purpleendurer @ bash ~ ]
在执行压缩命令的过程中,由于当前目录下已经存在文件f2.txt.gz,所以会提示是否覆盖该文件。
2.4 递归压缩目录树下的文件
为了实现递归压缩,我们要指定 -r 选项。
为了演示效果,我们在目录d1下再创建目录d2,在目录d2下创建文件fc.txt和fd.txt
[purpleendurer @ bash ~ ] mkdir d1/d2
[purpleendurer @ bash ~ ] echo "d2fc" > d1/d2/fc.txt
[purpleendurer @ bash ~ ] echo "d2fd" > d1/d2/fd.txt
[purpleendurer @ bash ~ ] ls -R
.:
Code d1 f1.txt f2.txt./Code:./d1:
d2 fa.txt fb.txt./d1/d2:
fc.txt fd.txt
[purpleendurer @ bash ~ ]
然后我们将目录d1及子目录下的文件进行压缩
[purpleendurer @ bash ~ ] ls -R
.:
Code d1 f1.txt f2.txt./Code:./d1:
d2 fa.txt fb.txt./d1/d2:
fc.txt fd.txt
[purpleendurer @ bash ~ ] gzip -rv d1
d1/d2/fd.txt: -40.0% -- replaced with d1/d2/fd.txt.gz
d1/d2/fc.txt: -40.0% -- replaced with d1/d2/fc.txt.gz
d1/fb.txt: -40.0% -- replaced with d1/fb.txt.gz
d1/fa.txt: -40.0% -- replaced with d1/fa.txt.gz
[purpleendurer @ bash ~ ] ls -R
.:
Code d1 f1.txt f2.txt./Code:./d1:
d2 fa.txt.gz fb.txt.gz./d1/d2:
fc.txt.gz fd.txt.gz
[purpleendurer @ bash ~ ]
为了更好地看到命令执行的过程和效果,我们指定了-v选项。
2.4 指定压缩速度
我们可以为gzip指定一个压缩速度,其速度范围值为1——9。
1 是最快的压缩,压缩率最低
9 是最慢的压缩,压缩率最高
默认是 6
2.4.1 汉字
我们先拿汉字试一下。
[purpleendurer @ bash ~ ] echo "LZ77 的基本原理:LZ77 以经常出现的字母组合(或较长的字符串)构建字典中的数据项,并且使用较短的数字(或符号)编码来代替比较复杂的数据 项。数据压缩时,将从待压缩数据中读入的源数据与字典中的数据项进行匹配,从中检索出相应的代码并输出。从而实现数据的压缩。" > f3.txt
[purpleendurer @ bash ~ ] gzip -1 -cv < f3.txt > f3-1.gz29.6%
[purpleendurer @ bash ~ ] gzip -4 -cv < f3.txt > f3-4.gz29.6%
[purpleendurer @ bash ~ ] gzip -9 -cv < f3.txt > f3-9.gz29.6%
[purpleendurer @ bash ~ ] gzip -cv < f3.txt > f3-9.gz29.6%
[purpleendurer @ bash ~ ]
我们先把一段汉字存放在文件 f3.txt中,然后分别指定压缩速度 1、4、9和默认(6)来进行压缩。
从命令执行信息来看,压缩率没有差别。
2.4.2 英文
我们再用常用英文单词试一下:
[purpleendurer @ bash ~ ] echo "I, you, he, she, it, we, they,be, have, do, go, make, see, take, get, give,person, time, day, year, way, man, woman, child, government, company,good, bad, big, little, new, old, happy, sad, beautiful, ugly,very, really, so, too, then, now, well, just, also, still,a, an, the,in, on, at, with, for, about, from, over, under, between,and, but, or, so, because, if, when, while, although, before, after,one, two, three, four, five, ten, hundred, thousand, million,hello, goodbye, please, thank you, sorry, excuse me, yes, no,I, you, he, she, it, we, they,be, have, do, go, make, see, take, get, give,person, time, day, year, way, man, woman, child, government, company,good, bad, big, little, new, old, happy, sad, beautiful, ugly,very, really, so, too, then, now, well, just, also, still,a, an, the,in, on, at, with, for, about, from, over, under, between,and, but, or, so, because, if, when, while, although, before, after,one, two, three, four, five, ten, hundred, thousand, million,hello, goodbye, please, thank you, sorry, excuse me, yes, no" > f4.txt
[purpleendurer @ bash ~ ] gzip -1 -cv < f4.txt > f4-1.gz70.7%
[purpleendurer @ bash ~ ] gzip -4 -cv < f4.txt > f4-4.gz71.0%
[purpleendurer @ bash ~ ] gzip -9 -cv < f4.txt > f4-9.gz71.0%
[purpleendurer @ bash ~ ] gzip -cv < f4.txt > f4-9.gz71.0%
[purpleendurer @ bash ~ ]
我们先把常用英文单词存放在文件 f4.txt中,然后分别指定压缩速度 1、4、9和默认(6)来进行压缩。
从4开始,压缩率没有变化。所以一般使用默认(6)就可以了。
2.5 测试压缩文件的完整性
我们可以使用选项-t或 --test来测试压缩文件的完整性。
例如:测试文件f3.txt.gz的完整性
[purpleendurer @ bash ~ ] gzip -cv < f3.txt > f3.txt.gz29.6%
[purpleendurer @ bash ~ ] gzip -t f3.txt.gz
[purpleendurer @ bash ~ ] gzip -tv f3.txt.gz
f3.txt.gz: OK
[purpleendurer @ bash ~ ]
可以看到, 执行命令:gzip -t f3.txt.gz 没反馈信息。
执行命令 gzip -tv f3.txt.gz 才看到反馈信息:
f3.txt.gz: OK
注意:为了看到测试结果,建议同时指定-v选项。
2.6 查看压缩文件的详细信息
我们可以指定 -l 选项可以查看 .gz 文件的详细信息。
例如,查看f3.txt.gz的详细信息
[purpleendurer @ bash ~ ] gzip -l f3.txt.gzcompressed uncompressed ratio uncompressed_name279 371 29.6% f3.txt
[purpleendurer @ bash ~ ]
2.7 解压文件
我们可以使用选项 -d 或--decompress 来对压缩文件进行 解压缩。
例如,对压缩文件 f3.txt.gz 进行 解压缩
[purpleendurer @ bash ~ ] ls
Code f3-1.gz f3-4.gz f3-9.gz f3.txt
[purpleendurer @ bash ~ ] gzip -c < f3.txt > f3.txt.gz
[purpleendurer @ bash ~ ] ls
Code f3-1.gz f3-4.gz f3-9.gz f3.txt f3.txt.gz
[purpleendurer @ bash ~ ] gzip -dv f3.txt.gz
gzip: f3.txt already exists; do you wish to overwrite (y or n)? nnot overwritten
[purpleendurer @ bash ~ ] gzip -dfv f3.txt.gz
f3.txt.gz: 29.6% -- replaced with f3.txt
[purpleendurer @ bash ~ ] ls
Code f3-1.gz f3-4.gz f3-9.gz f3.txt
[purpleendurer @ bash ~ ]
我们执行命令gzip -dv f3.txt.gz时,由于当前目录中存在文件f3.txt,会要求我们确定是否覆盖原有文件:
gzip: f3.txt already exists; do you wish to overwrite (y or n)?
我们输入n后,反馈信息:
not overwritten
没有覆盖原有文件。
如果我们不想接收和处理是否覆盖原有文件的信息,我们可以使用 -f选项强制覆盖原有文件。
所以我们执行命令 gzip -dfv f3.txt.gz 时 会直接覆盖原有文件f3.txt:
f3.txt.gz: 29.6% -- replaced with f3.txt
2.8 查看版本信息
我们可以使用-V选项查看当前使用的gzip版本信息。
2.8.1 测试用的bash中的gzip版本信息
[purpleendurer @ bash ~ ] gzip -V
gzip 1.5
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.Written by Jean-loup Gailly.
[purpleendurer @ bash ~ ]
2.8.2 银河麒麟(kylin)系统中的gzip版本信息
[purpleendurer @ kylin ~] gzip -v
gzip: compressed data not written to a terminal. Use -f to force compression.
For help, type: gzip -h
[purpleendurer @ kylin ~] gzip -V
gzip 1.6
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.Written by Jean-loup Gailly.
[purpleendurer @ kylin ~]
看来gzip的1.5版本不支持-k选项,而1.6版本支持-k选项。
2.9 查看软件许可证信息
我们可以使用-L 或 --license 选项 查看软件许可证信息。
2.9.1 测试用的bash中的gzip软件许可证信息
[purpleendurer @ bash ~ ] gzip -L
gzip 1.5
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
[purpleendurer @ bash ~ ]
显示的信息跟版本信息相似。
如果我们同时查看gzip版本和软件许可证信息会如何显示呢?
[purpleendurer @ bash ~ ] gzip -VL
gzip 1.5
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.Written by Jean-loup Gailly.
[purpleendurer @ bash ~ ]
显示的是软件许可证信息。
2.9.2 银河麒麟(kylin)系统中的gzipgzip软件许可证信息
[purpleendurer @ kylin ~] gzip -L
gzip 1.6
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
[purpleendurer @ kylin ~]
3 LZ77编码
gzip 使用 LZ77 编码来压缩和解压文件。
LZ 编码由以色列研究者 Jacob Ziv 和 Abraham Lempel 提出,是无损压缩的核心思想。LZ 是一个系列的算法,而其中最基本的就是两人在 1977年所发表的论文《A Universal Algorithm for Sequential Compression》 中提出的 LZ77 算法。
LZ77的核心思想:利用数据的重复结构信息来进行数据压缩。
而Huffman等基于统计的数据压缩编码需要先对数据进行字符频率统计,然后进行压缩。
LZ77 的基本原理:LZ77 以经常出现的字母组合(或较长的字符串)构建字典中的数据项,并且使用较短的数字(或符号)编码来代替比较复杂的数据项。数据压缩时,将从待压缩数据中读入的源数据与字典中的数据项进行匹配,从中检索出相应的代码并输出。从而实现数据的压缩。
LZ77 编码是一种基于字典及滑动窗口的无损压缩技术,广泛应用于通信传输。
相关文章:

Linux shell编程学习笔记80:gzip命令——让文件瘦身
0 引言 在 Linux shell编程学习笔记76:tar命令——快照 & 备份(上)-CSDN博客 Linux shell编程学习笔记77:tar命令——快照 & 备份(下)_linux 系统快照-CSDN博客 Linux shell编程学习笔记78&am…...

【字幕】恋上数据结构与算法之01为什么要学习数据结构与算法
视频地址:请查看01为什么要学习数据结构与算法_哔哩哔哩_bilibili 同志们好,我是小码哥的mj李明杰。非常欢迎大家来学习链上数据结构与算法,从今天开始呢就由我来带大家一起来学习和掌握这个数据结构与算法啊。在正式学习之前我们先来看一下…...

120页ppt丨集团公司战略规划内容、方法、步骤及战略规划案例研究
响应会员需求,晓零分享一份经典资料《120页ppt集团公司战略规划内容、方法、步骤及战略规划案例研究》,欢迎进入星球下载学习。 以下是对企业战略规划三个阶段八个步骤的详细解析: 一、阶段一:内外分析 项目启动和前期准备&…...

滚雪球学SpringCloud[2.3]:服务发现与负载均衡详解
全文目录: 前言1. Ribbon的使用与配置1.1 Ribbon 概述Ribbon 的核心功能: 1.2 Ribbon 的基本使用1.2.1 引入 Ribbon 依赖1.2.2 配置 RestTemplate 与 Ribbon1.2.3 示例:通过 Ribbon 调用服务 1.3 Ribbon 的配置选项 2. Ribbon的负载均衡策略2…...

商务英语口语之聚会宴饮常用口语柯桥培训到蓝天广场
吃饭一定要掌握的英语口语 邀请他人共进餐: Would you like to join me for dinner? 你愿意和我一起吃饭吗? Lets grab a bite to eat together. 我们一起去吃点东西吧。 How about having lunch with me? 和我一起吃午饭怎么样? 询问…...

【C#】VS插件
翻译 目前推荐较多的 可以单词发言,目前还在开发阶段 TranslateIntoChinese - Visual Studio Marketplace 下载量最高的(推荐) Visual-Studio-Translator - Visual Studio Marketplace 支持翻译的版本较多,在 Visual Studio 代码编辑器中通过 Googl…...

嵌入式C语言自我修养:C语言的面向对象编程思想
⭐关联知识点:C和C的区别 代码复用与分层思想 什么是代码复用呢? (1)函数级代码复用:定义一个函数实现某个功能,所有的程序都可以调用这个函数,不用自己再单独实现一遍,函数级的代…...

行车记录仪格式化了怎么恢复?专业恢复方法分享
行车记录仪作为现代驾驶的必备设备,它忠实记录着行车过程中的点点滴滴,是保障行车安全、处理交通事故的重要依据。然而,有时由于操作失误或其他原因,我们可能会不小心将行车记录仪进行格式化,导致宝贵的录像数据丢失。…...

C++中extern ”c“的理解
c中extern “C“的作用及理解_extern "c-CSDN博客...

红黑树的删除
文章目录 前言一.删除的节点左子树右子树都有二.删除的节点只有左/右子树删除调整操作 三.删除的节点没有孩子1.删除的节点为红色2.删除的节点为黑色1).兄弟节点为黑色(1).兄弟节点至少有一个红色的孩子节点LL型RR型RL型LR型 (2).兄弟节点没有孩子或所有孩子为黑色 2).兄弟节点…...

Vue3+setup实现父子组件单表增删改查写法模板
父组件写法 <el-card><!-- el-card 头部插槽 显示列表名和新增按钮 --><template #header><div class"table-header-container"><i class"fas fa-th" />角色列表(100)<span style"flex-grow…...

jmeter 录制APP脚本
一、手机 1、修改网络 代理选择手动→填写服务器主机名(电脑IP,如:192.1xx.x.xx)→服务器端口(任意未被占用端口,如:8888) 2、安装证书 手机浏览器访问服务器主机名:服务器端口&a…...

C++类与对象深度解析(一):从抽象到实践的全面入门指南
文章目录 C 类与对象——详细入门指南前言1. 类的定义1.1 类定义的基本格式示例代码解释 1.2 访问限定符示例代码解释 1.3 类域示例代码解释 1.4 成员命名规范常见的命名约定:示例:拓展: 1.5 class与struct的默认访问权限示例: 2.…...

docker拉取 jdk 8
docker pull openjdk:8docker run -d -it --name java-8 openjdk:8docker run -d -it --name java-8 openjdk:8 –name java-8 容器名,自定义的 openjdk:8 镜像名:标签名 , 使用 docker images 查看 2、查看已运行的容器实例: doc…...

机器学习VS深度学习
机器学习(Machine Learning, ML)和深度学习(Deep Learning, DL)是人工智能(AI)的两个子领域,它们有许多相似之处,但在技术实现和应用范围上也有显著区别。下面从几个方面对两者进行区…...

基于vue框架的宠物交流平台1n2n3(程序+源码+数据库+调试部署+开发环境)系统界面在最后面。
系统程序文件列表 项目功能:会员,宠物信息,宠物类型,团队信息,申请领养,团队申请,领养宠物 开题报告内容 基于Vue框架的宠物交流平台开题报告 一、项目背景 随着现代生活节奏的加快与人们情感需求的日益增长,宠物已成为众多家庭不可或缺的重要成员。…...

Rust 所有权 借用与引用
文章目录 发现宝藏1. 所有权(Ownership)2. 引用(References)2.1 不可变引用2.2 可变引用2.3 引用的规则 3. 悬垂引用(Dangling References)4. 借用(Borrowing)结论 发现宝藏 前些天…...

构建智能电商新生态:深度解析京东商品详情API的力量
在当今数字化浪潮中,智能电商系统已成为推动零售业转型升级的重要引擎。作为电商行业的领军者之一,京东凭借其庞大的商品数据库和先进的技术架构,为开发者与商家提供了丰富的API接口,其中商品详情API无疑是构建智能电商系统的关键…...

Golang | Leetcode Golang题解之第398题随机数索引
题目: 题解: type Solution []intfunc Constructor(nums []int) Solution {return nums }func (nums Solution) Pick(target int) (ans int) {cnt : 0for i, num : range nums {if num target {cnt // 第 cnt 次遇到 targetif rand.Intn(cnt) 0 {ans …...

使用注意力机制可以让你的模型更加灵活,但是需要额外的计算资源。rnn lstm bilstm attension
确实,使用注意力机制可以使模型更加灵活,但也确实需要额外的计算资源。注意力机制允许模型在处理序列数据时,能够动态地关注不同位置的重要性,从而更好地捕捉长依赖关系。下面是一个简单的注意力机制实现示例,可以帮助…...

git命令大全
简介:个人学习分享,如有错误,欢迎批评指正 一、Git操作流程 1、代码提交和同步代码 第零步: 工作区与仓库保持一致第一步: 文件增删改,变为已修改状态第二步: git add ,变为已暂存状态 $ git status $ git add --al…...

【数据仓库】数据仓库常见的数据模型——范式模型
目录 一、范式 1、第一范式 2、第二范式 3、第三范式 4、进一步范式化:BCNF、4NF 和 5NF 简介 (1)Boyce-Codd 范式(BCNF) (2)第四范式(4NF) (5&#x…...

【LeetCode每日一题】——LCR 078.合并 K 个升序链表
文章目录 一【题目类别】二【题目难度】三【题目编号】四【题目描述】五【题目注意】六【题目示例】七【题目提示】八【解题思路】九【时间频度】十【代码实现】十一【提交结果】 一【题目类别】 优先队列 二【题目难度】 困难 三【题目编号】 LCR 078.合并 K 个升序链表 …...

代码随想录算法训练营第五十九天 | dijkstra(堆优化版)精讲
目录 dijkstra(堆优化版)精讲 思路 堆优化细节 方法一: 最小堆优化 dijkstra(堆优化版)精讲 题目链接:卡码网:47. 参加科学大会 文章讲解:代码随想录 小明是一位科学家&#x…...

go语言后端开发学习(七)——如何在gin框架中集成限流中间件
一.什么是限流 限流又称为流量控制(流控),通常是指限制到达系统的并发请求数。 我们生活中也会经常遇到限流的场景,比如:某景区限制每日进入景区的游客数量为8万人;沙河地铁站早高峰通过站外排队逐一放行的…...

SpringBoot2:web开发常用功能实现及原理解析-整合EasyExcel实现Excel导入导出功能
1、工程包结构 主要是这5个Java类 2、导入EasyExcel包 这里同时贴出其他相关springboot的基础包 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><depend…...

CTFShow-信息搜集
Web1: 题目描述:开发注释未及时删除 。 打开题目后提示web1:where is flag? ctrlu读取源码。 Web2: 题目描述:js前台拦截 无效操作 打开题目后显示:无法查看源代码 右键无法用,…...

Facebook的虚拟现实功能简介:社交网络的新前沿
在科技飞速发展的今天,虚拟现实(VR)已经从科幻小说中的梦想变成了触手可及的现实。作为全球领先的社交平台,Facebook(现已更名为Meta)正大力推动虚拟现实技术的发展,以重新定义用户的社交体验。…...

Redis embstr 编码
embstr 编码 是 Redis 中一种优化存储小型字符串的编码方式。它是 Redis 内部存储字符串的多种方式之一,特别适用于存储长度不超过 44 字节的小字符串。...

【Elasticsearch系列二】安装 Kibana
💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…...