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协议…...

业务系统对接大模型的基础方案:架构设计与关键步骤
业务系统对接大模型:架构设计与关键步骤 在当今数字化转型的浪潮中,大语言模型(LLM)已成为企业提升业务效率和创新能力的关键技术之一。将大模型集成到业务系统中,不仅可以优化用户体验,还能为业务决策提供…...

智慧医疗能源事业线深度画像分析(上)
引言 医疗行业作为现代社会的关键基础设施,其能源消耗与环境影响正日益受到关注。随着全球"双碳"目标的推进和可持续发展理念的深入,智慧医疗能源事业线应运而生,致力于通过创新技术与管理方案,重构医疗领域的能源使用模式。这一事业线融合了能源管理、可持续发…...
Qt Widget类解析与代码注释
#include "widget.h" #include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget) {ui->setupUi(this); }Widget::~Widget() {delete ui; }//解释这串代码,写上注释 当然可以!这段代码是 Qt …...
【算法训练营Day07】字符串part1
文章目录 反转字符串反转字符串II替换数字 反转字符串 题目链接:344. 反转字符串 双指针法,两个指针的元素直接调转即可 class Solution {public void reverseString(char[] s) {int head 0;int end s.length - 1;while(head < end) {char temp …...

智能分布式爬虫的数据处理流水线优化:基于深度强化学习的数据质量控制
在数字化浪潮席卷全球的今天,数据已成为企业和研究机构的核心资产。智能分布式爬虫作为高效的数据采集工具,在大规模数据获取中发挥着关键作用。然而,传统的数据处理流水线在面对复杂多变的网络环境和海量异构数据时,常出现数据质…...
使用Matplotlib创建炫酷的3D散点图:数据可视化的新维度
文章目录 基础实现代码代码解析进阶技巧1. 自定义点的大小和颜色2. 添加图例和样式美化3. 真实数据应用示例实用技巧与注意事项完整示例(带样式)应用场景在数据科学和可视化领域,三维图形能为我们提供更丰富的数据洞察。本文将手把手教你如何使用Python的Matplotlib库创建引…...

边缘计算网关提升水产养殖尾水处理的远程运维效率
一、项目背景 随着水产养殖行业的快速发展,养殖尾水的处理成为了一个亟待解决的环保问题。传统的尾水处理方式不仅效率低下,而且难以实现精准监控和管理。为了提升尾水处理的效果和效率,同时降低人力成本,某大型水产养殖企业决定…...

PydanticAI快速入门示例
参考链接:https://ai.pydantic.dev/#why-use-pydanticai 示例代码 from pydantic_ai import Agent from pydantic_ai.models.openai import OpenAIModel from pydantic_ai.providers.openai import OpenAIProvider# 配置使用阿里云通义千问模型 model OpenAIMode…...
统计学(第8版)——统计抽样学习笔记(考试用)
一、统计抽样的核心内容与问题 研究内容 从总体中科学抽取样本的方法利用样本数据推断总体特征(均值、比率、总量)控制抽样误差与非抽样误差 解决的核心问题 在成本约束下,用少量样本准确推断总体特征量化估计结果的可靠性(置…...
JS设计模式(5): 发布订阅模式
解锁JavaScript发布订阅模式:让代码沟通更优雅 在JavaScript的世界里,我们常常会遇到这样的场景:多个模块之间需要相互通信,但是又不想让它们产生过于紧密的耦合。这时候,发布订阅模式就像一位优雅的信使,…...