C#文件拷贝工具
目录
工具介绍
工具背景
4个文件介绍
CopyTheSpecifiedSuffixFiles.exe.config
DataSave.txt
拷贝的存储方式
文件夹介绍
源文件夹
目标文件夹
结果
使用 *.mp4
使用 *.*
重名时坚持拷贝
可能的报错
C#代码如下
Form1.cs
Form1.cs设计
APP.config
Program.cs
Form1.Designer.cs
工具介绍
工具背景
你知道为啥我今天突然写这个吗?
我昨天下载视频,发现他全部都是分文件夹存的,一个一个开太麻烦了呢,今天就写了这个哈哈哈,全部拿出来,一下子就能全部添加到播放列表了!
只拷贝指定文件后缀的东西到新的文件夹里面,不管你原来的文件夹里面都多少个子文件夹都能给你把需要的文件复制出来(但是不会复制子文件夹,即不会复制原来的存储结构,我特意这么做的)!
你上次选的这四个选项,他会记住,后面再打开就是上次的位置。
4个文件介绍
CopyTheSpecifiedSuffixFiles.exe.config
相信你一眼就能看出来这个是干什么的了,没错!这个是这个软件的默认配置,当然你也可以在DataSave.txt中改动。
DataSave.txt
一开始是没有的,后面自动生成的哦~
拷贝的存储方式
1. 保留原文件(保留目标文件夹的重名文件)
2. 替换文件(替换目标文件夹的重名文件)
3. 保留并自动增加文件名称(拷贝的时候,后面会在后面加上_1区分,如下图)
只拷贝指定文件后缀的东西到新的文件夹里面,不管你原来的文件夹里面都多少个子文件夹都能给你把需要的文件复制出来(但是不会复制子文件夹,即不会复制原来的存储结构,我特意这么做的)!(重要的事情说两遍!为啥不说三遍?哈哈哈 因为没有因为 0.o)
文件夹介绍
源文件夹
目标文件夹
结果
使用 *.mp4
使用 *.*
重名时坚持拷贝
可能的报错
因为你缺失这个东西,下载下就行了,一个底层的小玩意儿
C#代码如下
不想一点点弄可以直接下载上传的资源。
Form1.cs
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;namespace CopyTheSpecifiedSuffixFiles
{public partial class frmCopyFiles : Form{public frmCopyFiles(){InitializeComponent();}private Stopwatch stopwatch = new Stopwatch();public void btnCopy_Click(object sender, EventArgs e){// 创建 Stopwatch 对象stopwatch = new Stopwatch();// 开始计时stopwatch.Start();lblResDesc.ForeColor = System.Drawing.Color.Red;lblResDesc.Text = "正在拷贝,请稍等...";this.Refresh();string sourceFolderPath = txtSourceFolderPath.Text;string destinationFolderPath = txtDestinationFolderPath.Text;// 检查文件夹是否存在,不存在直接创建空的文件夹if (!Directory.Exists(sourceFolderPath)) Directory.CreateDirectory(sourceFolderPath);if (!Directory.Exists(destinationFolderPath)) Directory.CreateDirectory(destinationFolderPath);// 编辑txt文件并写入两个字符串string filePath = "DataSave.txt";// 写入文件using (StreamWriter writer = new StreamWriter(filePath)){writer.WriteLine(sourceFolderPath);writer.WriteLine(destinationFolderPath);writer.WriteLine(cboSuffixSelect.Text);writer.WriteLine(txtSuffixInfo.Text);writer.Flush(); // 刷新缓冲区,确保数据被写入文件}// 拷贝目标文件夹内部所有的.mp4文件至新文件夹中CopyFiles(sourceFolderPath, destinationFolderPath);lblResDesc.ForeColor = System.Drawing.Color.Green;lblResDesc.Text = "文件拷贝完成!";// 停止计时stopwatch.Stop();// 获取耗时TimeSpan elapsedTime = stopwatch.Elapsed;MessageBox.Show("文件拷贝完成!\n" + "程序执行耗时: " + Math.Round(elapsedTime.TotalMilliseconds / 1000, 1) + " 秒");}// 递归拷贝目标文件夹及其子文件夹中的所有.mp4文件至新文件夹中public void CopyFiles(string sourceFolderPath, string destinationFolderPath){int fileCount = 1; // 记录已存在的文件数量// 获取文件列表string[] files = Directory.GetFiles(sourceFolderPath, txtSuffixInfo.Text);foreach (string file in files){string fileName = Path.GetFileName(file);string destinationFilePath = Path.Combine(destinationFolderPath, fileName);if (File.Exists(destinationFilePath)){string input = cboSuffixSelect.Text;if (input == "1. 保留原文件"){continue; // 保留原文件,跳过拷贝}else if (input == "2. 替换文件"){File.Copy(file, destinationFilePath, true); // 替换文件}else if (input == "3. 保留并自动增加文件名称"){string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName);string fileExtension = Path.GetExtension(fileName);string newFileName = $"{fileNameWithoutExtension}_{fileCount}{fileExtension}";fileCount++;destinationFilePath = Path.Combine(destinationFolderPath, newFileName);try{File.Copy(file, destinationFilePath); // 拷贝文件}catch (Exception e){MessageBox.Show(e.Message);}}else{MessageBox.Show("请输入正确的选项!");Application.Exit();}}else{File.Copy(file, destinationFilePath); // 拷贝文件}}string[] subDirectories = Directory.GetDirectories(sourceFolderPath);foreach (string subDirectory in subDirectories){CopyFiles(subDirectory, destinationFolderPath);}}public void Form1_Load(object sender, EventArgs e){// 添加选项到 ComboBoxcboSuffixSelect.Items.Add("1. 保留原文件");cboSuffixSelect.Items.Add("2. 替换文件");cboSuffixSelect.Items.Add("3. 保留并自动增加文件名称");// 设置默认选中项cboSuffixSelect.SelectedIndex = 2;// 创建一个txt文件并写入两个字符串string filePath = "DataSave.txt";// 检查文件是否存在if (!File.Exists(filePath)){// 创建文件并写入初始内容using (StreamWriter writer = new StreamWriter(filePath)){writer.WriteLine(ConfigurationManager.AppSettings["SourceFolderPath"]);writer.WriteLine(ConfigurationManager.AppSettings["DestinationFolderPath"]);writer.WriteLine(ConfigurationManager.AppSettings["CopyStytle"]);writer.WriteLine(ConfigurationManager.AppSettings["SuffixType"]);}}// 读取文件并输出每行内容using (StreamReader reader = new StreamReader(filePath)){txtSourceFolderPath.Text = reader.ReadLine(); // 读取第一行内容txtDestinationFolderPath.Text = reader.ReadLine(); // 读取第二行内容cboSuffixSelect.Text = reader.ReadLine();txtSuffixInfo.Text = reader.ReadLine();}}public void btnChooseSourcePath_Click(object sender, EventArgs e){FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();// 设置对话框的描述文本folderBrowserDialog.Description = "选择文件夹";// 显示对话框并获取用户选择的路径DialogResult result = folderBrowserDialog.ShowDialog();if (result == DialogResult.OK){string selectedFolderPath = folderBrowserDialog.SelectedPath;txtSourceFolderPath.Text = selectedFolderPath;}}public void btnChooseTargetPath_Click(object sender, EventArgs e){FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();folderBrowserDialog.Description = "选择文件夹";DialogResult result = folderBrowserDialog.ShowDialog();if (result == DialogResult.OK){string selectedFolderPath = folderBrowserDialog.SelectedPath;txtDestinationFolderPath.Text = selectedFolderPath;}}private void btnClose_Click(object sender, EventArgs e){Application.Exit();}}
}
Form1.cs设计
APP.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration><appSettings><!--源文件夹--><add key="SourceFolderPath" value="D:\Code_VS2019\测试文件夹"/><!--目标文件夹--><add key="DestinationFolderPath" value="C:\Users\xxxxx\Desktop\拷贝结果"/><!--复制方式--><add key="CopyStytle" value="3. 保留并自动增加文件名称"/><!--后缀格式--><add key="SuffixType" value="*.mp4"/></appSettings><startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
</configuration>
Program.cs
using System;
using System.Windows.Forms;namespace CopyTheSpecifiedSuffixFiles
{static class Program{/// <summary>/// 应用程序的主入口点。/// </summary>[STAThread]static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new frmCopyFiles());}}
}
Form1.Designer.cs
namespace CopyTheSpecifiedSuffixFiles
{partial class frmCopyFiles{/// <summary>/// 必需的设计器变量。/// </summary>private System.ComponentModel.IContainer components = null;/// <summary>/// 清理所有正在使用的资源。/// </summary>/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>protected override void Dispose(bool disposing){if (disposing && (components != null)){components.Dispose();}base.Dispose(disposing);}#region Windows 窗体设计器生成的代码/// <summary>/// 设计器支持所需的方法 - 不要修改/// 使用代码编辑器修改此方法的内容。/// </summary>private void InitializeComponent(){this.btnCopy = new System.Windows.Forms.Button();this.cboSuffixSelect = new System.Windows.Forms.ComboBox();this.txtSourceFolderPath = new System.Windows.Forms.TextBox();this.txtDestinationFolderPath = new System.Windows.Forms.TextBox();this.lblSourceDesc = new System.Windows.Forms.Label();this.lblTargetDesc = new System.Windows.Forms.Label();this.btnChooseSourcePath = new System.Windows.Forms.Button();this.btnChooseTargetPath = new System.Windows.Forms.Button();this.lblSaveSelectDesc = new System.Windows.Forms.Label();this.lblSuffixSelectDesc = new System.Windows.Forms.Label();this.txtSuffixInfo = new System.Windows.Forms.TextBox();this.lblSuffixInfoDesc = new System.Windows.Forms.Label();this.lblResDesc = new System.Windows.Forms.Label();this.btnClose = new System.Windows.Forms.Button();this.SuspendLayout();// // btnCopy// this.btnCopy.AutoSize = true;this.btnCopy.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnCopy.Location = new System.Drawing.Point(494, 52);this.btnCopy.Name = "btnCopy";this.btnCopy.Size = new System.Drawing.Size(107, 52);this.btnCopy.TabIndex = 0;this.btnCopy.Text = "拷贝";this.btnCopy.UseVisualStyleBackColor = true;this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);// // cboSuffixSelect// this.cboSuffixSelect.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.cboSuffixSelect.FormattingEnabled = true;this.cboSuffixSelect.Location = new System.Drawing.Point(107, 148);this.cboSuffixSelect.Name = "cboSuffixSelect";this.cboSuffixSelect.Size = new System.Drawing.Size(198, 22);this.cboSuffixSelect.TabIndex = 1;// // txtSourceFolderPath// this.txtSourceFolderPath.Location = new System.Drawing.Point(107, 40);this.txtSourceFolderPath.Name = "txtSourceFolderPath";this.txtSourceFolderPath.Size = new System.Drawing.Size(302, 21);this.txtSourceFolderPath.TabIndex = 2;// // txtDestinationFolderPath// this.txtDestinationFolderPath.Location = new System.Drawing.Point(107, 94);this.txtDestinationFolderPath.Name = "txtDestinationFolderPath";this.txtDestinationFolderPath.Size = new System.Drawing.Size(300, 21);this.txtDestinationFolderPath.TabIndex = 3;// // lblSourceDesc// this.lblSourceDesc.AutoSize = true;this.lblSourceDesc.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.lblSourceDesc.Location = new System.Drawing.Point(27, 42);this.lblSourceDesc.Name = "lblSourceDesc";this.lblSourceDesc.Size = new System.Drawing.Size(76, 16);this.lblSourceDesc.TabIndex = 4;this.lblSourceDesc.Text = "源文件夹";// // lblTargetDesc// this.lblTargetDesc.AutoSize = true;this.lblTargetDesc.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.lblTargetDesc.Location = new System.Drawing.Point(12, 96);this.lblTargetDesc.Name = "lblTargetDesc";this.lblTargetDesc.Size = new System.Drawing.Size(93, 16);this.lblTargetDesc.TabIndex = 5;this.lblTargetDesc.Text = "目标文件夹";// // btnChooseSourcePath// this.btnChooseSourcePath.AutoSize = true;this.btnChooseSourcePath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnChooseSourcePath.Location = new System.Drawing.Point(415, 37);this.btnChooseSourcePath.Name = "btnChooseSourcePath";this.btnChooseSourcePath.Size = new System.Drawing.Size(52, 26);this.btnChooseSourcePath.TabIndex = 6;this.btnChooseSourcePath.Text = "选择";this.btnChooseSourcePath.UseVisualStyleBackColor = true;this.btnChooseSourcePath.Click += new System.EventHandler(this.btnChooseSourcePath_Click);// // btnChooseTargetPath// this.btnChooseTargetPath.AutoSize = true;this.btnChooseTargetPath.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnChooseTargetPath.Location = new System.Drawing.Point(415, 91);this.btnChooseTargetPath.Name = "btnChooseTargetPath";this.btnChooseTargetPath.Size = new System.Drawing.Size(52, 26);this.btnChooseTargetPath.TabIndex = 7;this.btnChooseTargetPath.Text = "选择";this.btnChooseTargetPath.UseVisualStyleBackColor = true;this.btnChooseTargetPath.Click += new System.EventHandler(this.btnChooseTargetPath_Click);// // lblSaveSelectDesc// this.lblSaveSelectDesc.AutoSize = true;this.lblSaveSelectDesc.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.lblSaveSelectDesc.Location = new System.Drawing.Point(27, 151);this.lblSaveSelectDesc.Name = "lblSaveSelectDesc";this.lblSaveSelectDesc.Size = new System.Drawing.Size(76, 16);this.lblSaveSelectDesc.TabIndex = 8;this.lblSaveSelectDesc.Text = "存储方式";// // lblSuffixSelectDesc// this.lblSuffixSelectDesc.AutoSize = true;this.lblSuffixSelectDesc.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.lblSuffixSelectDesc.Location = new System.Drawing.Point(27, 205);this.lblSuffixSelectDesc.Name = "lblSuffixSelectDesc";this.lblSuffixSelectDesc.Size = new System.Drawing.Size(76, 16);this.lblSuffixSelectDesc.TabIndex = 9;this.lblSuffixSelectDesc.Text = "填入后缀";// // txtSuffixInfo// this.txtSuffixInfo.Location = new System.Drawing.Point(107, 203);this.txtSuffixInfo.Name = "txtSuffixInfo";this.txtSuffixInfo.Size = new System.Drawing.Size(131, 21);this.txtSuffixInfo.TabIndex = 10;// // lblSuffixInfoDesc// this.lblSuffixInfoDesc.AutoSize = true;this.lblSuffixInfoDesc.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.lblSuffixInfoDesc.ForeColor = System.Drawing.Color.DodgerBlue;this.lblSuffixInfoDesc.Location = new System.Drawing.Point(270, 206);this.lblSuffixInfoDesc.Name = "lblSuffixInfoDesc";this.lblSuffixInfoDesc.Size = new System.Drawing.Size(122, 14);this.lblSuffixInfoDesc.TabIndex = 11;this.lblSuffixInfoDesc.Text = "填入格式:*.mp4";// // lblResDesc// this.lblResDesc.AutoSize = true;this.lblResDesc.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.lblResDesc.ForeColor = System.Drawing.Color.Green;this.lblResDesc.Location = new System.Drawing.Point(338, 151);this.lblResDesc.Name = "lblResDesc";this.lblResDesc.Size = new System.Drawing.Size(263, 16);this.lblResDesc.TabIndex = 12;this.lblResDesc.Text = "请选择相应参数并点击拷贝按钮!";// // btnClose// this.btnClose.AutoSize = true;this.btnClose.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.btnClose.Location = new System.Drawing.Point(494, 184);this.btnClose.Name = "btnClose";this.btnClose.Size = new System.Drawing.Size(107, 52);this.btnClose.TabIndex = 13;this.btnClose.Text = "关闭";this.btnClose.UseVisualStyleBackColor = true;this.btnClose.Click += new System.EventHandler(this.btnClose_Click);// // frmCopyFiles// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.ClientSize = new System.Drawing.Size(614, 258);this.Controls.Add(this.btnClose);this.Controls.Add(this.lblResDesc);this.Controls.Add(this.lblSuffixInfoDesc);this.Controls.Add(this.txtSuffixInfo);this.Controls.Add(this.lblSuffixSelectDesc);this.Controls.Add(this.lblSaveSelectDesc);this.Controls.Add(this.btnChooseTargetPath);this.Controls.Add(this.btnChooseSourcePath);this.Controls.Add(this.lblTargetDesc);this.Controls.Add(this.lblSourceDesc);this.Controls.Add(this.txtDestinationFolderPath);this.Controls.Add(this.txtSourceFolderPath);this.Controls.Add(this.cboSuffixSelect);this.Controls.Add(this.btnCopy);this.Name = "frmCopyFiles";this.Text = "文件拷贝工具";this.Load += new System.EventHandler(this.Form1_Load);this.ResumeLayout(false);this.PerformLayout();}#endregionprivate System.Windows.Forms.Button btnCopy;private System.Windows.Forms.ComboBox cboSuffixSelect;private System.Windows.Forms.TextBox txtSourceFolderPath;private System.Windows.Forms.TextBox txtDestinationFolderPath;private System.Windows.Forms.Label lblSourceDesc;private System.Windows.Forms.Label lblTargetDesc;private System.Windows.Forms.Button btnChooseSourcePath;private System.Windows.Forms.Button btnChooseTargetPath;private System.Windows.Forms.Label lblSaveSelectDesc;private System.Windows.Forms.Label lblSuffixSelectDesc;private System.Windows.Forms.TextBox txtSuffixInfo;private System.Windows.Forms.Label lblSuffixInfoDesc;private System.Windows.Forms.Label lblResDesc;private System.Windows.Forms.Button btnClose;}
}
相关文章:

C#文件拷贝工具
目录 工具介绍 工具背景 4个文件介绍 CopyTheSpecifiedSuffixFiles.exe.config DataSave.txt 拷贝的存储方式 文件夹介绍 源文件夹 目标文件夹 结果 使用 *.mp4 使用 *.* 重名时坚持拷贝 可能的报错 C#代码如下 Form1.cs Form1.cs设计 APP.config Program.c…...

Redis——Java中的客户端和API
Java客户端 在大多数的业务实现中,我们还是使用编码去操作Redis,对于命令的学习只是知道这些数据库可以做什么操作,以及在后面学习到了Java的API之后知道什么方法对应什么命令即可。 官方推荐的Java的客户端网页链接如下: 爪哇…...

Brief. Bioinformatics2021 | sAMP-PFPDeep+:利用三种不同的序列编码和深度神经网络预测短抗菌肽
文章标题:sAMP-PFPDeep: Improving accuracy of short antimicrobial peptides prediction using three different sequence encodings and deep neural networks 代码:https://github.com/WaqarHusain/sAMP-PFPDeep 一、问题 短抗菌肽(sAMPs)&#x…...

问道管理:华为产业链股再度拉升,捷荣技术6连板,华力创通3日大涨近70%
华为产业链股6日盘中再度拉升,到发稿,捷荣技能涨停斩获6连板,华映科技亦涨停收成3连板,华力创通大涨超19%,蓝箭电子涨约11%,力源信息涨超4%。 捷荣技能盘中再度涨停,近7日已累计大涨超90%。公司…...

面试设计模式-责任链模式
一 责任链模式 1.1 概述 在进行请假申请,财务报销申请,需要走部门领导审批,技术总监审批,大领导审批等判断环节。存在请求方和接收方耦合性太强,代码会比较臃肿,不利于扩展和维护。 1.2 责任链模式 针对…...

Qt 开发 CMake工程
Qt 入门实战教程(目录) 为何要写这篇文章 目前CMake作为C/C工程的构建方式在开源社区已经成为主流。 企业中也是能用CMake的尽量在用。 Windows 环境下的VC工程都是能不用就不用。 但是,这个过程是非常缓慢的,所以࿰…...

2.k8s账号密码登录设置
文章目录 前言一、启动脚本二、配置账号密码登录2.1.在hadoop1,也就是集群主节点2.2.在master的apiserver启动文件添加一行配置2.3 绑定admin2.4 修改recommended.yaml2.5 重启dashboard2.6 登录dashboard 总结 前言 前面已经搭建好了k8s集群,现在设置下…...
【代表团坐车】Python 实现-附ChatGPT解析
1.题目 某组织举行会议,来了多个代表团同时到达,接待处只有一辆汽车,可以同时接待多个代表团,为了提高车辆利用率,请帮接待员计算可以坐满车的接待方案,输出方案数量。 约束: 1.一个团只能上一辆车,并且代表团人数(代表团数量小于30,每人代表团人数小于30)小于汽车容量…...
【Java】x-easypdf: 一种简单易用的PDF处理库
引言 在处理和生成PDF文档时,有许多库可供选择。其中,x-easypdf是一种简单易用的PDF处理库,可以帮助开发人员轻松地创建、编辑和操作PDF文档。本文将介绍x-easypdf的基本概念、安装方法、主要功能以及使用示例。 安装x-easypdf 要使用x-ea…...

1 Linux输入子系统
1 Linux输入子系统 https://www.cnblogs.com/beijiqie1104/p/11418082.html Linux input 子系统详解 https://www.cnblogs.com/yikoulinux/p/15208238.html...

Zabbix 利用 Grafana 进行图形展示
安装grafana和插件 配置zabbix数据源 导入模版 查看数据 1.安装grafana wget https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm/Packages/grafana-10.0.0-1.x86_64.rpm [rootrocky8 apps]# yum install grafana-10.0.0-1.x86_64.rpm [rootrocky8 apps]# systemctl sta…...

【LeetCode周赛】LeetCode第362场周赛
LeetCode第362场周赛 与车相交的点判断能否在给定时间到达单元格将石头分散到网格图的最少移动次数 与车相交的点 给你一个下标从 0 开始的二维整数数组 nums 表示汽车停放在数轴上的坐标。对于任意下标 i,nums[i] [starti, endi] ,其中 starti 是第 i…...

Leetcode128. 最长连续序列
力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台 给定一个未排序的整数数组 nums ,找出数字连续的最长序列(不要求序列元素在原数组中连续)的长度。 请你设计并实现时间复杂度为 O(n) 的算法解决此问题。 题解&#…...

K8S:kubeadm搭建K8S+Harbor 私有仓库
文章目录 一.部署规划1.主机规划2.部署流程 二.kubeadm搭建K8S1.环境准备2.安装docker3. 安装kubeadm,kubelet和kubectl4.部署K8S集群(1)初始化(2)部署网络插件flannel(3)创建 pod 资源 5.部署 …...

MaskVO: Self-Supervised Visual Odometry with a Learnable Dynamic Mask 论文阅读
论文信息 题目:MaskVO: Self-Supervised Visual Odometry with a Learnable Dynamic Mask 作者:Weihao Xuan, Ruijie Ren, Siyuan Wu, Changhao Chen 时间:2022 来源: IEEE/SICE International Symposium on System Integration …...
面试求职-面试注意事项
面试技巧和注意事项有哪些? 面试是找工作过程中最重要的一个环节,因为面试成功,你才有可能得到一份工作。求职面试技巧有哪些呢?首先,我们来看看面试注意事项。 企业了解 1、面试前有没有仔细了解过对应企业的情况,…...
sm2 签名验签
目前发现 sm2 有很多实现,比如 gmssl, openssl 1.1.1 ,openssl 3.0,各种代码库实现等等。实践中发现这些实现会出现不能互相验签的情况。后续研究一下。 网上的一些资料,给出了一些 openssl 指令,但是没有标明 openssl 的版本&…...

如何检查Windows 11笔记本电脑电池健康状况
如果你拥有一台运行微软最新操作系统的便携式电脑,那么检查Windows 11笔记本电脑的电池健康状况可能很重要。 电池寿命显然是一件大事,无论你是在最好的商务笔记本电脑上工作,还是在目前市场上最好的游戏笔记本电脑上享受马拉松式的Starfiel…...
编程大师-分布式
分布式锁 mysql redis 【IT老齐122】不只setnx,两张图说清Redisson的Redis分布式锁实现_哔哩哔哩_bilibili zk 用这种方式去实现,zookeeper分布式锁,你会吗?_哔哩哔哩_bilibili...

内网隧道代理技术(二十三)之 DNS隧道反弹Shell
DNS隧道反弹Shell DNS隧道 DNS协议是一种请求、应答协议,也是一种可用于应用层的隧道技术。DNS隧道的工作原理很简单,在进行DNS查询时,如果查询的域名不在DNS服务器本机缓存中,就会访问互联网进行查询,然后返回结果。如果在互联网上有一台定制的服务器,那么依靠DNS协议…...

华为云AI开发平台ModelArts
华为云ModelArts:重塑AI开发流程的“智能引擎”与“创新加速器”! 在人工智能浪潮席卷全球的2025年,企业拥抱AI的意愿空前高涨,但技术门槛高、流程复杂、资源投入巨大的现实,却让许多创新构想止步于实验室。数据科学家…...

【力扣数据库知识手册笔记】索引
索引 索引的优缺点 优点1. 通过创建唯一性索引,可以保证数据库表中每一行数据的唯一性。2. 可以加快数据的检索速度(创建索引的主要原因)。3. 可以加速表和表之间的连接,实现数据的参考完整性。4. 可以在查询过程中,…...

Vue3 + Element Plus + TypeScript中el-transfer穿梭框组件使用详解及示例
使用详解 Element Plus 的 el-transfer 组件是一个强大的穿梭框组件,常用于在两个集合之间进行数据转移,如权限分配、数据选择等场景。下面我将详细介绍其用法并提供一个完整示例。 核心特性与用法 基本属性 v-model:绑定右侧列表的值&…...

3.3.1_1 检错编码(奇偶校验码)
从这节课开始,我们会探讨数据链路层的差错控制功能,差错控制功能的主要目标是要发现并且解决一个帧内部的位错误,我们需要使用特殊的编码技术去发现帧内部的位错误,当我们发现位错误之后,通常来说有两种解决方案。第一…...

Day131 | 灵神 | 回溯算法 | 子集型 子集
Day131 | 灵神 | 回溯算法 | 子集型 子集 78.子集 78. 子集 - 力扣(LeetCode) 思路: 笔者写过很多次这道题了,不想写题解了,大家看灵神讲解吧 回溯算法套路①子集型回溯【基础算法精讲 14】_哔哩哔哩_bilibili 完…...

1.3 VSCode安装与环境配置
进入网址Visual Studio Code - Code Editing. Redefined下载.deb文件,然后打开终端,进入下载文件夹,键入命令 sudo dpkg -i code_1.100.3-1748872405_amd64.deb 在终端键入命令code即启动vscode 需要安装插件列表 1.Chinese简化 2.ros …...
OpenPrompt 和直接对提示词的嵌入向量进行训练有什么区别
OpenPrompt 和直接对提示词的嵌入向量进行训练有什么区别 直接训练提示词嵌入向量的核心区别 您提到的代码: prompt_embedding = initial_embedding.clone().requires_grad_(True) optimizer = torch.optim.Adam([prompt_embedding...

学习STC51单片机32(芯片为STC89C52RCRC)OLED显示屏2
每日一言 今天的每一份坚持,都是在为未来积攒底气。 案例:OLED显示一个A 这边观察到一个点,怎么雪花了就是都是乱七八糟的占满了屏幕。。 解释 : 如果代码里信号切换太快(比如 SDA 刚变,SCL 立刻变&#…...
CSS设置元素的宽度根据其内容自动调整
width: fit-content 是 CSS 中的一个属性值,用于设置元素的宽度根据其内容自动调整,确保宽度刚好容纳内容而不会超出。 效果对比 默认情况(width: auto): 块级元素(如 <div>)会占满父容器…...

算法:模拟
1.替换所有的问号 1576. 替换所有的问号 - 力扣(LeetCode) 遍历字符串:通过外层循环逐一检查每个字符。遇到 ? 时处理: 内层循环遍历小写字母(a 到 z)。对每个字母检查是否满足: 与…...