Qt文件和目录相关操作

1.相关说明

QCoreApplication类、QFile类、QDir、QTemporaryDir类、QTemporaryFile类、QFileSystemWatcher类的相关函数

2.相关界面

3.相关代码

#include "dialog.h"
#include "ui_dialog.h"
#include <QFileDialog>
#include <QTemporaryDir>
#include <QTemporaryFile>
#include <QFileSystemWatcher>Dialog::Dialog(QWidget *parent): QDialog(parent), ui(new Ui::Dialog)
{ui->setupUi(this);fileWatcher = NULL;
}Dialog::~Dialog()
{delete ui;
}// 打开一个文件
void Dialog::on_btnOpenFile_clicked()
{QString curDir = QCoreApplication::applicationDirPath();QString aFile = QFileDialog::getOpenFileName(this, "打开一个文件", curDir, "(*.cpp *.h *.c);;(*.*)");ui->lineEditFile->setText(aFile);
}
// 打开一个目录
void Dialog::on_btnOpenDir_clicked()
{QString curDir = QCoreApplication::applicationDirPath();QString aDir = QFileDialog::getExistingDirectory(this, "选择一个目录", curDir);ui->lineEditDir->setText(aDir);
}
// 清除文本框
void Dialog::on_btnClear_clicked()
{ui->plainTextEdit->clear();
}void Dialog::showBtnInfo(QObject *btn)
{QPushButton *theBtn = static_cast<QPushButton*>(btn);ui->plainTextEdit->appendPlainText(theBtn->text());ui->plainTextEdit->appendPlainText(theBtn->toolTip()+":");
}// applicationDirPath()
void Dialog::on_btnApplicationDirPath_clicked()
{showBtnInfo(sender());QString str = QCoreApplication::applicationDirPath();ui->plainTextEdit->appendPlainText(str);
}
// applicationFilePath()
void Dialog::on_btnApplicationFilePath_clicked()
{showBtnInfo(sender());QString str = QCoreApplication::applicationFilePath();ui->plainTextEdit->appendPlainText(str);
}
// applicationName()
void Dialog::on_btnApplicationName_clicked()
{showBtnInfo(sender());// QCoreApplication::setApplicationName("My App");QString str = QCoreApplication::applicationName();ui->plainTextEdit->appendPlainText(str);
}
// setApplicationName(QString)
void Dialog::on_btnSetApplicationName_clicked()
{showBtnInfo(sender());QCoreApplication::setApplicationName("My App");QString str = QCoreApplication::applicationName();ui->plainTextEdit->appendPlainText(str);
}
// libraryPaths()
void Dialog::on_btnLibraryPaths_clicked()
{showBtnInfo(sender());QStringList paths = QCoreApplication::libraryPaths();for(auto &path : paths){ui->plainTextEdit->appendPlainText(path);}
}
// organizationName()
void Dialog::on_btnOrganiazationName_clicked()
{showBtnInfo(sender());QCoreApplication::setOrganizationName("My Organization");QString orgName = QCoreApplication::organizationName();ui->plainTextEdit->appendPlainText(orgName);
}
// exit()
void Dialog::on_btnExit_clicked()
{QCoreApplication::exit();
}
// QFile::copy
void Dialog::on_btnQFileCopy_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString newFile = fileInfo.path()+"/"+fileInfo.baseName()+"--副本."+fileInfo.suffix();QFile::copy(sourceFile, newFile);ui->plainTextEdit->appendPlainText("源文件:"+sourceFile);ui->plainTextEdit->appendPlainText("副本:"+newFile);
}
// QFile::exists
void Dialog::on_btnQFileExists_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();if(QFile::exists(sourceFile)){ui->plainTextEdit->appendPlainText(sourceFile + ":存在");} else {ui->plainTextEdit->appendPlainText(sourceFile + ":不存在");}}
// QFile::remove
void Dialog::on_btnRemove_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();if(QFile::remove(sourceFile)){ui->plainTextEdit->appendPlainText("remove "+sourceFile+" 成功");} else {ui->plainTextEdit->appendPlainText("remove "+sourceFile+" 失败");}
}
// QFile::rename
void Dialog::on_btnQFileRename_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString newFile = fileInfo.path()+"/"+fileInfo.baseName()+"--新名称."+fileInfo.suffix();if(QFile::rename(sourceFile, newFile)){ui->plainTextEdit->appendPlainText("旧名称:"+sourceFile);ui->plainTextEdit->appendPlainText("新名称:"+newFile);} else {ui->plainTextEdit->appendPlainText("修改 "+sourceFile+" 失败");}
}
// QFile::moveToTrash
void Dialog::on_btnQFileMoveToTrash_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();if(QFile::exists(sourceFile) && QFile::moveToTrash(sourceFile)){ui->plainTextEdit->appendPlainText("删除文件到垃圾箱:"+sourceFile);} else {ui->plainTextEdit->appendPlainText("文件不存在");}
}
// file.copy
void Dialog::on_btnCopy_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString newFile = fileInfo.path()+"/"+fileInfo.baseName()+"--副本."+fileInfo.suffix();QFile file(sourceFile);// QFile::copy(sourceFile, newFile);if(file.copy(newFile)){ui->plainTextEdit->appendPlainText("源文件:"+sourceFile);ui->plainTextEdit->appendPlainText("副本:"+newFile);} else {ui->plainTextEdit->appendPlainText("复制文件失败:"+sourceFile);}}
// file.exists
void Dialog::on_btnExists_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFile file(sourceFile);if(file.exists()){ui->plainTextEdit->appendPlainText(sourceFile + ":存在");} else {ui->plainTextEdit->appendPlainText(sourceFile + ":不存在");}
}
// file.remove
void Dialog::on_btnRemove_2_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFile file(sourceFile);if(file.remove()){ui->plainTextEdit->appendPlainText("remove "+sourceFile+" 成功");} else {ui->plainTextEdit->appendPlainText("remove "+sourceFile+" 失败");}
}
// file.rename
void Dialog::on_btnRename_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString newFile = fileInfo.path()+"/"+fileInfo.baseName()+"--新名称."+fileInfo.suffix();QFile file(sourceFile);if(file.rename(newFile)){ui->plainTextEdit->appendPlainText("旧名称:"+sourceFile);ui->plainTextEdit->appendPlainText("新名称:"+newFile);} else {ui->plainTextEdit->appendPlainText("修改 "+sourceFile+" 失败");}
}
// file.moveToTrash
void Dialog::on_btnMoveToTrash_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFile file(sourceFile);if(file.exists() && file.moveToTrash()){ui->plainTextEdit->appendPlainText("删除文件到垃圾箱:"+sourceFile);} else {ui->plainTextEdit->appendPlainText("文件不存在");}
}
// absoluteFilePath()
void Dialog::on_btnAbsoluteFilePath_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString absfilePath = fileInfo.absoluteFilePath();ui->plainTextEdit->appendPlainText(absfilePath);
}
// absolutePath()
void Dialog::on_btnAbsolutePath_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString absfilePath = fileInfo.absolutePath();ui->plainTextEdit->appendPlainText(absfilePath);
}
// fileInfo.fileName()
void Dialog::on_btnFileName_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString fileName = fileInfo.fileName();ui->plainTextEdit->appendPlainText(fileName);
}
// fileInfo.filePath()
void Dialog::on_btnFilePath_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString filePath = fileInfo.filePath();ui->plainTextEdit->appendPlainText(filePath);
}
// fileInfo.size()
void Dialog::on_btnSize_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString fileSize = QString::number(fileInfo.size());ui->plainTextEdit->appendPlainText(fileSize+"Bytes");
}
// fileInfo.path()
void Dialog::on_btnPath_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString path = fileInfo.path();ui->plainTextEdit->appendPlainText(path);
}
// fileInfo.baseName()
void Dialog::on_btnBaseName_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString baseName = fileInfo.baseName();ui->plainTextEdit->appendPlainText(baseName);
}
// fileInfo.completeBaseName()
void Dialog::on_btnCompleteBaseName_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString completeBaseName = fileInfo.completeBaseName();ui->plainTextEdit->appendPlainText(completeBaseName);
}
// fileInfo.suffix()
void Dialog::on_btnSuffix_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString suffix = fileInfo.suffix();ui->plainTextEdit->appendPlainText(suffix);
}
// fileInfo.completeSuffix()
void Dialog::on_btnCompleteSuffix_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);QString completeSuffix = fileInfo.completeSuffix();ui->plainTextEdit->appendPlainText(completeSuffix);
}
// fileInfo.isDir()
void Dialog::on_btnIsDir_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);if(fileInfo.isDir()){ui->plainTextEdit->appendPlainText("目录");} else {ui->plainTextEdit->appendPlainText("非目录");}
}
// fileInfo.isFile()
void Dialog::on_btnIsFile_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);if(fileInfo.isFile()){ui->plainTextEdit->appendPlainText("文件");} else {ui->plainTextEdit->appendPlainText("非文件");}
}
// fileInfo.isExecutable()
void Dialog::on_btnIsExecutable_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);if(fileInfo.isExecutable()){ui->plainTextEdit->appendPlainText("执行文件");} else {ui->plainTextEdit->appendPlainText("非执行文件");}
}
// fileInfo.birthTime()
void Dialog::on_btnBirthTime_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);if(fileInfo.exists()){ui->plainTextEdit->appendPlainText("创建时间:"+fileInfo.birthTime().toString("yyyy-MM-dd hh:mm:ss"));}
}
// fileInfo.lastModified()
void Dialog::on_btnLastModified_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);if(fileInfo.exists()){ui->plainTextEdit->appendPlainText("最后修改时间:"+fileInfo.lastModified().toString("yyyy-MM-dd hh:mm:ss"));}
}
// fileInfo.lastRead()
void Dialog::on_btnLastRead_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);if(fileInfo.exists()){ui->plainTextEdit->appendPlainText("最后读取时间:"+fileInfo.lastRead().toString("yyyy-MM-dd hh:mm:ss"));}
}
// QFileInfo::exists(sourceFile)
void Dialog::on_btnStaticExists_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();if(QFileInfo::exists(sourceFile)){ui->plainTextEdit->appendPlainText("文件存在");} else {ui->plainTextEdit->appendPlainText("文件不存在");}
}
// fileInfo.exists()
void Dialog::on_btnDynamicExists_clicked()
{showBtnInfo(sender());QString sourceFile = ui->lineEditFile->text();QFileInfo fileInfo(sourceFile);if(fileInfo.exists()){ui->plainTextEdit->appendPlainText("文件存在");} else {ui->plainTextEdit->appendPlainText("文件不存在");}
}
// QDir::tempPath()
void Dialog::on_btnTempPath_clicked()
{showBtnInfo(sender());ui->plainTextEdit->appendPlainText("tempPath:"+QDir::tempPath());
}
// QDir::rootPath()
void Dialog::on_btnRootPath_clicked()
{showBtnInfo(sender());ui->plainTextEdit->appendPlainText("rootPath:"+QDir::rootPath());
}
// QDir::homePath()
void Dialog::on_btnHomePath_clicked()
{showBtnInfo(sender());ui->plainTextEdit->appendPlainText("homePath:"+QDir::homePath());
}
// QDir::drives()
void Dialog::on_btnDrives_clicked()
{showBtnInfo(sender());QFileInfoList filelist = QDir::drives();for(auto &fileInfo : filelist){ui->plainTextEdit->appendPlainText(fileInfo.path());}
}
// QDir::currentPath()
void Dialog::on_btnCurrentPath_clicked()
{showBtnInfo(sender());ui->plainTextEdit->appendPlainText("currentPath:"+QDir::currentPath());
}// QDir::setCurrent(ui->lineEditDir->text())
void Dialog::on_btnSetCurrent_clicked()
{showBtnInfo(sender());QDir::setCurrent(ui->lineEditDir->text());ui->plainTextEdit->appendPlainText("currentPath:"+QDir::currentPath());
}
// dir.mkdir(subDir)
void Dialog::on_btnMkdir_clicked()
{showBtnInfo(sender());QString subDir = "subdir";QDir dir(ui->lineEditDir->text());if(dir.mkdir(subDir)){ui->plainTextEdit->appendPlainText("创建成功:"+subDir);} else {ui->plainTextEdit->appendPlainText("创建失败:"+subDir);}
}
// dir.rmdir(subDir)
void Dialog::on_btnRmdir_clicked()
{showBtnInfo(sender());QString subDir = "subdir";QDir dir(ui->lineEditDir->text());if(dir.rmdir(subDir)){ui->plainTextEdit->appendPlainText("删除成功:"+subDir);} else {ui->plainTextEdit->appendPlainText("删除失败:"+subDir);}
}
// dir.remove(fileName)
void Dialog::on_btnRemove_3_clicked()
{showBtnInfo(sender());QString fileName = ui->lineEditFile->text();QDir dir(ui->lineEditDir->text());if(dir.remove(fileName)){ui->plainTextEdit->appendPlainText("删除成功:"+fileName);} else {ui->plainTextEdit->appendPlainText("删除失败:"+fileName);}
}
// dir.rename(fileName, newFile)
void Dialog::on_btnDirRename_clicked()
{showBtnInfo(sender());QString fileName = ui->lineEditFile->text();QFileInfo fileInfo(fileName);QDir dir(ui->lineEditDir->text());QString newFile = fileInfo.path()+"/"+fileInfo.baseName()+".XYZ";if(dir.rename(fileName, newFile)){ui->plainTextEdit->appendPlainText("源文件:"+fileName);ui->plainTextEdit->appendPlainText("修改后的文件:"+newFile);} else {ui->plainTextEdit->appendPlainText("修改失败");}
}
// lastDir.setPath(aDir)
void Dialog::on_btnSetPath_clicked()
{showBtnInfo(sender());QString curDir = QDir::currentPath();QDir lastDir(curDir);ui->plainTextEdit->appendPlainText("当前目录:"+lastDir.absolutePath());QString aDir = QFileDialog::getExistingDirectory(this, "选择一个目录",curDir);if(aDir.isEmpty()){return;}ui->lineEditDir->setText(aDir);lastDir.setPath(aDir);ui->plainTextEdit->appendPlainText("选择后的目录:"+lastDir.absolutePath());
}
// aDir.removeRecursively()
void Dialog::on_btnRemoveRecursively_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());if(aDir.removeRecursively()){ui->plainTextEdit->appendPlainText("递归删除成功");} else {ui->plainTextEdit->appendPlainText("递归删除失败");}
}
// aDir.absoluteFilePath(ui->lineEditFile->text())
void Dialog::on_btnAbsoluteFilePath_2_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());QString str = aDir.absoluteFilePath(ui->lineEditFile->text());ui->plainTextEdit->appendPlainText(str);
}
// aDir.absolutePath()
void Dialog::on_btnDirAbsolutePath_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());ui->plainTextEdit->appendPlainText(aDir.absolutePath());
}
// aDir.canonicalPath()
void Dialog::on_btnCanonicalPath_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());ui->plainTextEdit->appendPlainText(aDir.canonicalPath());
}
// aDir.filePath(ui->lineEditFile->text())
void Dialog::on_btnDirFilePath_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());QString filePath = aDir.filePath(ui->lineEditFile->text());ui->plainTextEdit->appendPlainText(filePath);
}
// aDir.path()
void Dialog::on_btnDirPath_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());ui->plainTextEdit->appendPlainText(aDir.path());
}
// aDir.dirName()
void Dialog::on_btnDirName_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());ui->plainTextEdit->appendPlainText(aDir.dirName());
}
// aDir.exists()
void Dialog::on_btnDirExists_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());if(aDir.exists()){ui->plainTextEdit->appendPlainText("存在:"+aDir.dirName());} else {ui->plainTextEdit->appendPlainText("不存在:"+aDir.dirName());}}
// aDir.isEmpty()
void Dialog::on_btnDirIsEmpty_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());if(aDir.isEmpty()){ui->plainTextEdit->appendPlainText("空文件夹:"+aDir.dirName());} else {ui->plainTextEdit->appendPlainText("非空文件夹:"+aDir.dirName());}
}
// aDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)
void Dialog::on_btnDirEntryList_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());QStringList strList = aDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);ui->plainTextEdit->appendPlainText(aDir.dirName()+"目录下的所有目录:");for(QString &dir : strList){ui->plainTextEdit->appendPlainText(dir);}
}
// aDir.entryList(QDir::Files)
void Dialog::on_btnFileEntryList_clicked()
{showBtnInfo(sender());QDir aDir(ui->lineEditDir->text());QStringList strList = aDir.entryList(QDir::Files);ui->plainTextEdit->appendPlainText(aDir.dirName()+"目录下的所有文件:");for(QString &dir : strList){ui->plainTextEdit->appendPlainText(dir);}
}
// 1.在系统临时目录下创建临时文件夹
void Dialog::on_btnCreateTmpDir_clicked()
{showBtnInfo(sender());ui->plainTextEdit->appendPlainText("QDir::tempPath()="+QDir::tempPath());QTemporaryDir dir;dir.setAutoRemove(true);ui->plainTextEdit->appendPlainText(dir.path());
}
// 1.在系统临时目录下创建临时文件
void Dialog::on_btnCreateTmpFile_clicked()
{showBtnInfo(sender());ui->plainTextEdit->appendPlainText("QDir::tempPath()="+QDir::tempPath());QTemporaryFile aFile;aFile.setAutoRemove(true);aFile.open();ui->plainTextEdit->appendPlainText(aFile.fileName());aFile.close();
}
// 2.在指定目录下创建临时文件夹
void Dialog::on_btnCreateTmpDir_2_clicked()
{showBtnInfo(sender());QString specDir = ui->lineEditDir->text();ui->plainTextEdit->appendPlainText("指定目录="+specDir);QTemporaryDir dir(specDir + "/TempDir_XXX");dir.setAutoRemove(false);ui->plainTextEdit->appendPlainText(dir.path());
}
// 2.在指定目录下创建临时文件
void Dialog::on_btnCreateTmpFile_2_clicked()
{showBtnInfo(sender());QString specDir = ui->lineEditDir->text();ui->plainTextEdit->appendPlainText("指定目录="+specDir);QTemporaryFile aFile(specDir+"/TempFile_XXX");aFile.setAutoRemove(false);aFile.open();ui->plainTextEdit->appendPlainText(aFile.fileName());aFile.close();
}
// 3.在当前目录下创建临时文件夹
void Dialog::on_btnCreateCurTmpDir_clicked()
{showBtnInfo(sender());ui->plainTextEdit->appendPlainText("当前路径="+QDir::currentPath());QTemporaryDir dir("SubDir_XXX");dir.setAutoRemove(false);ui->plainTextEdit->appendPlainText(dir.path());
}
// 3.在当前目录下创建临时文件
void Dialog::on_btnCreateCurTmpFile_clicked()
{showBtnInfo(sender());ui->plainTextEdit->appendPlainText("当前路径="+QDir::currentPath());QTemporaryFile aFile("CurTempFile_XXX.temp");aFile.setAutoRemove(false);aFile.open();ui->plainTextEdit->appendPlainText(aFile.fileName());aFile.close();
}
void Dialog::do_directoryChanged(const QString &path)
{ui->plainTextEdit->appendPlainText(path + "目录发生了变化");
}void Dialog::do_fileChanged(const QString &path)
{ui->plainTextEdit->appendPlainText(path+"文件发生了变化");
}
// addPath()并开始监视
void Dialog::on_btnAddPathWatcher_clicked()
{showBtnInfo(sender());if(fileWatcher == NULL){fileWatcher = new QFileSystemWatcher(this);}fileWatcher->addPath(ui->lineEditDir->text());fileWatcher->addPath(ui->lineEditFile->text());connect(fileWatcher, &QFileSystemWatcher::directoryChanged, this, &Dialog::do_directoryChanged);connect(fileWatcher, &QFileSystemWatcher::fileChanged, this, &Dialog::do_fileChanged);
}
// removePath()并停止监视
void Dialog::on_btnRemovePathWatcher_clicked()
{showBtnInfo(sender());fileWatcher->removePath(ui->lineEditDir->text());fileWatcher->removePath(ui->lineEditFile->text());disconnect(fileWatcher);
}
// directories()
void Dialog::on_btnDirectories_clicked()
{showBtnInfo(sender());for(auto &item : fileWatcher->directories()){ui->plainTextEdit->appendPlainText(item);}
}
// files()
void Dialog::on_btnFiles_clicked()
{showBtnInfo(sender());for(QString &item : fileWatcher->files()){ui->plainTextEdit->appendPlainText(item);}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/635223.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Ardupilot开源飞控之VTOL之旅:打印件清单

Ardupilot开源飞控之VTOL之旅&#xff1a;打印件清单 1. 源由2. 清单2.1 模拟VTX打印件2.2 摄像头打印件2.3 GPS & RC天线打印件2.4 飞控 & 电调打印件 3. 总结4. 参考资料 1. 源由 VTOL一直仍在角落吃灰&#xff0c;主要还是手头缺点经费&#xff0c;搞台3D打印机基本…

Kotlin 移动端多平台

支持多平台编程是 Kotlin 的主要优势之一。它减少了为不同平台编写和维护相同代码所花费的时间&#xff0c;同时保留了本机编程的灵活性和优势。 1. 基本概念 KMM&#xff1a;Kotlin Multiplatform for mobile&#xff08;移动设备的 Kotlin 多平台&#xff09; KMM 多平台的主…

16k+ start 一个开源的的监控系统部署教程

安装条件 Linux或macOS系统 4GB内存 开放 33014、33174、3183端口 1.安装 1、下载源码 首先使用 git 克隆源码到本地 git clone -b main https://github.com/SigNoz/signoz.git && cd signoz/deploy/ 方式1&#xff1a;运行 install.sh 脚本一键安装 ./install.s…

luffy商城项目(一)

企业项目类型 # 1 面向互联网用户&#xff1a;商城类项目 -微信小程序商城 # 2 面向互联网用户&#xff1a;二手交易类的 -咸鱼 -转转 # 3 公司内部项目&#xff1a;python写的重点 -oa系统 -打卡系统工资核算系统 -第三方公司做的&#xff1a…

leetCode-42.接雨水

&#x1f4d1;前言 本文主要是【算法】——算法模拟的文章&#xff0c;如果有什么需要改进的地方还请大佬指出⛺️ &#x1f3ac;作者简介&#xff1a;大家好&#xff0c;我是听风与他&#x1f947; ☁️博客首页&#xff1a;CSDN主页听风与他 &#x1f304;每日一句&#xff…

git提权

实验环境——vulnhub-dc2靶场 git提权 前提&#xff1a;用户可以使用sudo中git权限 查看sudo权限 sudo -l可以发现git命令存在sudo提权 基于此进行权限提升 方式&#xff1a; sudo git help config #在末行命令模式输入 !/bin/bash 或 !sh #完成提权 sudo git -p help…

直接发文!1D-2D-MTF-CNN-GRU-AT多通道图像时序融合的分类/故障识别程序!Excel导入,直接运行

​适用平台&#xff1a;Matlab2023版本及以上 本程序同时结合两篇国内顶级EI的方法&#xff1a;提出1D-2D-MTF-CNN-GRU-AT多通道图像时序融合的分类/故障识别程序&#xff01; ①中文EI期刊《电力自动化设备》12月29号网络首发文献&#xff1a;《基于格拉姆角场与并行CNN的并…

【PyTorch】PyTorch之Reduction Ops

文章目录 前言一、ARGMAX二、ARGMIN三、AMAX和AMIN四、ALL和ANY五、MAX和MIN六、MEAN七、MEDIAN八、NORM九、PROD十、STD十一、SUM十二、UNIQUE十三、VAR 前言 介绍pytorch的Reduction Ops。 一、ARGMAX torch.argmax(input, dim, keepdimFalse) → LongTensor Parameters&a…

突破Android开发瓶颈:6年Android开发者的实用建议

作为一名在Android领域摸爬滚打6年的老手&#xff0c;我想给那些在这个行业工作了3~5年的朋友们提供一些职业和技术上的建议。 许多开发者在职业生涯中都会遇到一个瓶颈期&#xff0c;尤其是当你在一个公司待了很长时间&#xff0c;感觉自己的技术和业务能力都无法得到提升时。…

多输入多输出 | Matlab实现基于LightGBM多输入多输出预测

多输入多输出 | Matlab实现基于LightGBM多输入多输出预测 目录 多输入多输出 | Matlab实现基于LightGBM多输入多输出预测预测效果基本介绍程序设计参考资料 预测效果 基本介绍 Matlab实现基于LightGBM多输入多输出预测&#xff08;完整源码和数据&#xff09; 1.data为数据集&a…

近期学习文章

DNSlog在渗透测试中的实战技巧 - 网安隐藏源IP&#xff0c;提高溯源难度的几种方案 - 网安FreeBuf网络安全行业门户 【漏洞公告】某平台一个有意思的CSRF // SecTrain安全博客 浅谈Web源码泄漏-安全客 - 安全资讯平台 红队-C2 Server基础构建 - 先知社区FreeBuf网络安全行业…

【电力电子在电力系统中的应用】2 CCM和DCM模式下Cuk电路的升降压工作状态

【仅供参考】 【2023.03西南交大电力电子在电力系统中的应用】 目录 0 仿真要求 1 仿真电路搭建及波形记录 1.1 CCM工作模式 1.1.1 升压模式 1.1.2 降压模式 1.2 DCM工作模式 1.2.1 升压模式 1.2.2 降压模式 1.3 改变开关频率和电容参数 1.3.1 改变开关频率 1.3.2 …

高清网络视频监控系统技术方案

目 录 一、概述 二、建设目标及需求 &#xff08;一&#xff09;建设总目标 &#xff08;二&#xff09;需求分析 三、设计依据与设计原则 &#xff08;一&#xff09;设计依据 &#xff08;二&#xff09;设计原则 四、建设方案设计 &#xff08;一&…

实用干货:最全的Loading动画合集网站!复制即用

大家好&#xff0c;我是大澈&#xff01; 本文约1000字&#xff0c;整篇阅读大约需要2分钟。 感谢关注微信公众号&#xff1a;“程序员大澈”&#xff0c;免费领取"面试礼包"一份&#xff0c;然后免费加入问答群&#xff0c;从此让解决问题的你不再孤单&#xff01…

01-开始Rust之旅

1. 下载Rust 官方推荐使用 rustup 下载 Rust&#xff0c;这是一个管理 Rust 版本和相关工具的命令行工具。下载时需要连接互联网。 这边提供了离线安装版本。本人学习的机器环境为&#xff1a; ubuntu x86_64&#xff0c;因此选用第②个工具链&#xff1b; 1. rust-1.75.0-x86_…

分布式ID(2):雪花算法生成ID

1 雪花算法简介 这种方案大致来说是一种以划分命名空间(UUID也算,由于比较常见,所以单独分析)来生成ID的一种算法,这种方案把64-bit分别划分成多段,分开来标示机器、时间等,比如在snowflake中的64-bit分别表示如下图(图片来自网络)所示: 41-bit的时间可以表示(1L&l…

【前端设计】流光按钮

欢迎来到前端设计专栏&#xff0c;本专栏收藏了一些好看且实用的前端作品&#xff0c;使用简单的html、css语法打造创意有趣的作品&#xff0c;为网站加入更多高级创意的元素。 css body{height: 100vh;display: flex;justify-content: center;align-items: center;background…

rbash环境变量提权

rbash为一个受限制的bash shell变体&#xff0c;限制用户在交互式环境中可使用的操作&#xff0c;以此提升系统安全性 可通过环境变量提权方式&#xff0c;越过此限制 export -p //查看环境变量 BASH_CMDS[a]/bin/sh;a //把/bin/sh给a /bin/bash export PATH$…

three.js从入门到精通系列教程009 - three.js创建球体和圆柱体

<!DOCTYPE html> <html><head><meta charset"UTF-8"><title>three.js从入门到精通系列教程009 - three.js创建球体和圆柱体</title><script src"ThreeJS/three.js"></script><script src"ThreeJS…

人工智能 | 自然语言处理的发展历程

github&#xff1a;https://github.com/MichaelBeechan CSDN&#xff1a;https://blog.csdn.net/u011344545 自然语言处理的发展 方向一&#xff1a;技术进步1. 基于规则的语法&#xff08;1950-1990&#xff09;2. 统计语言处理&#xff08;1990-2010&#xff09;3. 基于深度学…