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

wordpress后台更新后 前端没变化的解决方法
使用siteground主机的wordpress网站,会出现更新了网站内容和修改了php模板文件、js文件、css文件、图片文件后,网站没有变化的情况。 不熟悉siteground主机的新手,遇到这个问题,就很抓狂,明明是哪都没操作错误&#x…...
Python|GIF 解析与构建(5):手搓截屏和帧率控制
目录 Python|GIF 解析与构建(5):手搓截屏和帧率控制 一、引言 二、技术实现:手搓截屏模块 2.1 核心原理 2.2 代码解析:ScreenshotData类 2.2.1 截图函数:capture_screen 三、技术实现&…...
变量 varablie 声明- Rust 变量 let mut 声明与 C/C++ 变量声明对比分析
一、变量声明设计:let 与 mut 的哲学解析 Rust 采用 let 声明变量并通过 mut 显式标记可变性,这种设计体现了语言的核心哲学。以下是深度解析: 1.1 设计理念剖析 安全优先原则:默认不可变强制开发者明确声明意图 let x 5; …...

【Python】 -- 趣味代码 - 小恐龙游戏
文章目录 文章目录 00 小恐龙游戏程序设计框架代码结构和功能游戏流程总结01 小恐龙游戏程序设计02 百度网盘地址00 小恐龙游戏程序设计框架 这段代码是一个基于 Pygame 的简易跑酷游戏的完整实现,玩家控制一个角色(龙)躲避障碍物(仙人掌和乌鸦)。以下是代码的详细介绍:…...
《Playwright:微软的自动化测试工具详解》
Playwright 简介:声明内容来自网络,将内容拼接整理出来的文档 Playwright 是微软开发的自动化测试工具,支持 Chrome、Firefox、Safari 等主流浏览器,提供多语言 API(Python、JavaScript、Java、.NET)。它的特点包括&a…...
Objective-C常用命名规范总结
【OC】常用命名规范总结 文章目录 【OC】常用命名规范总结1.类名(Class Name)2.协议名(Protocol Name)3.方法名(Method Name)4.属性名(Property Name)5.局部变量/实例变量(Local / Instance Variables&…...

苍穹外卖--缓存菜品
1.问题说明 用户端小程序展示的菜品数据都是通过查询数据库获得,如果用户端访问量比较大,数据库访问压力随之增大 2.实现思路 通过Redis来缓存菜品数据,减少数据库查询操作。 缓存逻辑分析: ①每个分类下的菜品保持一份缓存数据…...
C++ 基础特性深度解析
目录 引言 一、命名空间(namespace) C 中的命名空间 与 C 语言的对比 二、缺省参数 C 中的缺省参数 与 C 语言的对比 三、引用(reference) C 中的引用 与 C 语言的对比 四、inline(内联函数…...
论文解读:交大港大上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化学习框架(一)
宇树机器人多姿态起立控制强化学习框架论文解析 论文解读:交大&港大&上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化学习框架(一) 论文解读:交大&港大&上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化…...
解决本地部署 SmolVLM2 大语言模型运行 flash-attn 报错
出现的问题 安装 flash-attn 会一直卡在 build 那一步或者运行报错 解决办法 是因为你安装的 flash-attn 版本没有对应上,所以报错,到 https://github.com/Dao-AILab/flash-attention/releases 下载对应版本,cu、torch、cp 的版本一定要对…...