springboot 中通过定时任务备份数据库并压缩传输到指定另外一台linux服务器得文件夹中 或 发送压缩包到指定邮箱

1、将JSch和邮件插件添加到项目pom文件中。Maven

<!--java 通过JSch操作Linux-->
<dependency><groupId>com.jcraft</groupId><artifactId>jsch</artifactId><version>0.1.55</version>
</dependency><!-- 邮件模板 -->
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-mail</artifactId>
</dependency>

2、数据备份相关的配置文件

#数据库备份配置
dbBackups:windowsDir: E:\test\ #windows本机得备份目录linuxDir: projectFiles/dbFile #linux本机得备份目录linuxServe: #要传输得服务器信息user: xxxhost: xxxpassword: xxxremoteDir: /home/ubuntu/20231127  #需要给权限测试直接给了 777

3、邮件的配置文件

spring:#邮件发送mail:host: smtp.qq.com #发送邮件服务器username: xxx@qq.com #QQ邮箱password: xxxxxxxxx #客户端授权码protocol: smtp #发送邮件协议default-encoding: utf-8from: xxxxx@qq.com #与上面的username保持一致properties:mail:smtp:auth: trueport: 587 #端口号465或587display:sendmail: Javen #可以任意sendname: Spring Boot Guide Email #可以任意starttls:enable: truerequired: truessl:enable: true

4、定时任务


import com.jcraft.jsch.*;
import com.jcraft.jsch.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;import javax.mail.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;/*** 数据库备份* 支持几个常用的特殊符号:*     *:表示任何时间触发任务*     ,:表示指定的时间触发任务*     -:表示一段时间内触发任务*     /:表示从哪一个时刻开始,每隔多长时间触发一次任务。*     ?:表示用于月中的天和周中的天两个子表达式,表示不指定值。** cron表达式参数具体含义:*     秒,取值范围:0-59,支持*、,、-、/。*     分,取值范围:0-59,支持*、,、-、/。*     时,取值范围:0-23,支持*、,、-、/。*     日期,取值范围:1-31,支持*、,、-、/。比秒多了?,表示如果指定的星期触发了,则配置的日期变成无效。*     月,取值范围:1-12,支持*、,、-、/。*     星期,取值范围:1~7,1代表星期天,6代表星期六,其他的以此类推。支持*、,、-、/、?。比秒多了?,表示如果指定的日期触发了,则配置的星期变成无效。** 常见cron表达式使用举例:*     0 0 0 1 * ?  每月1号零点执行*     0 0 2 * * ?  每天凌晨2点执行*     0 0 2 * * ?  每天凌晨2点执行*     0 0/5 11 * * ? 每天11点-11点55分,每隔5分钟执行一次*     0 0 18 ? * WED 每周三下午6点执行*/@Configuration      //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class DBBackupsTask {//读取yml配置@Autowiredprivate Environment environment;//邮件服务@Autowiredpublic EmailSendImpl emailSendImpl;//备份数据库并发送到邮箱@Scheduled(cron = "0/10 * * * * ?")private void dbEmailTask() {System.out.println("执行静态定时任务备份数据库开始时间: " + LocalDateTime.now());//通过util下的Date包实现Date date = new Date();SimpleDateFormat dateFormat= new SimpleDateFormat("yyyyMMddhhmmss");String format = dateFormat.format(date);String backupFileName  = "backup_file_"+format + ".sql";try {String command = "";String fileDir = "";if(ZipUtils.isWindows()){fileDir = environment.getProperty("dbBackups.windowsDir"); // E:\test\ 文件备份位置 这里配置文件读取了command = "cmd /c mysqldump -uroot -p123456 forum_cs > " + fileDir + backupFileName;}else{fileDir = environment.getProperty("dbBackups.linuxDir"); // projectFiles/dbFile 文件备份位置 这里配置文件读取了command = "mysqldump -uroot -p123456 forum_cs > "  + fileDir + backupFileName;}Process process = Runtime.getRuntime().exec(command);// 等待命令执行完成int exitCode = process.waitFor();if(exitCode != 0){System.err.println("备份数据库失败时间: exitCode="+ exitCode +" - "+ LocalDateTime.now());}//成功则将数据压缩并发送给管理员邮箱String to = "xxxxxxx@qq.com";String subject = "邮件通知";String content = "数据库备份成功! 备份时间:" + format;// 读取备份文件并压缩String filePath = fileDir + backupFileName ;String zipFilePath = fileDir;String fileName = "backup_file_" + format ;ZipUtils.fileToZip(filePath,zipFilePath,fileName);emailSendImpl.sendAttachmentsMail(to,subject,content,zipFilePath+fileName+".zip");System.out.println("执行静态定时任务备份数据库结束时间: " + LocalDateTime.now());} catch (IOException | InterruptedException | MessagingException e) {e.printStackTrace();}}//备份数据库并发送到指定的服务器地址 测试每十秒@Scheduled(cron = "0/10 * * * * ?")private void dbServerTask() {System.out.println("执行静态定时任务备份数据库开始时间: " + LocalDateTime.now());//通过util下的Date包实现Date date = new Date();SimpleDateFormat dateFormat= new SimpleDateFormat("yyyyMMddhhmmss");String format = dateFormat.format(date);String backupFileName  = "backup_file_"+format + ".sql";try {String command = "";String fileDir = "";if(ZipUtils.isWindows()){fileDir = environment.getProperty("dbBackups.windowsDir"); // 文件备份位置 这里配置文件读取了command = "cmd /c mysqldump -uroot -p123456 forum_cs > " + fileDir + backupFileName;}else{fileDir = environment.getProperty("dbBackups.linuxDir"); // 文件备份位置 这里配置文件读取了command = "mysqldump -uroot -p123456 forum_cs > "  + fileDir + backupFileName;}Process process = Runtime.getRuntime().exec(command);// 等待命令执行完成int exitCode = process.waitFor();if(exitCode != 0){System.err.println("备份数据库失败时间: exitCode="+ exitCode +" - "+ LocalDateTime.now());}// 读取备份文件并压缩String filePath = fileDir + backupFileName ;String zipFilePath = fileDir;String fileName = "backup_file_" + format ;ZipUtils.fileToZip(filePath,zipFilePath,fileName);//向指定服务器发送文件备份this.fileTransfer(zipFilePath + fileName + ".zip" );System.out.println("执行静态定时任务备份数据库结束时间: " + LocalDateTime.now());} catch (IOException | InterruptedException | JSchException e) {e.printStackTrace();}}/*** 向指定服务器发送文件备份* @throws IOException* @throws JSchException*/public void fileTransfer(String localFile) throws IOException, JSchException {String user = environment.getProperty("dbBackups.linuxServe.user"); //"ubuntu"; // 你的Linux用户名String host = environment.getProperty("dbBackups.linuxServe.host"); //"192.168.137.155"; // 你的Linux服务器主机名或IPint port = 22; // SSH运行的端口String password = environment.getProperty("dbBackups.linuxServe.password"); //"ubuntu"; // 你的Linux密码String remoteDir = environment.getProperty("dbBackups.linuxServe.remoteDir"); //"/home/ubuntu/20231127"; // 你在Linux服务器上的远程目录路径 需要给权限JSch jsch = new JSch();Session session = null;try {// 建立SSH会话session = jsch.getSession(user, host, port);// 连接认证session.setPassword(password);session.setConfig("StrictHostKeyChecking", "no");session.connect();// 打开一个SFTP通道Channel channel = session.openChannel("sftp");channel.connect();ChannelSftp sftp = (ChannelSftp) channel;// 进行文件传输sftp.put(new FileInputStream(localFile), remoteDir + "/" + localFile.substring(localFile.lastIndexOf("\\") + 1));// 关闭连接channel.disconnect();session.disconnect();} catch (JSchException | SftpException | IOException e) {e.printStackTrace();}}}

5、邮件发送工具类

import javax.mail.MessagingException;public interface EmailSend {/*** 发送文本邮件* @param to* @param subject* @param content*/public void sendSimpleMail(String to, String subject, String content);public void sendSimpleMail(String to, String subject, String content, String... cc);/*** 发送HTML邮件* @param to* @param subject* @param content* @throws MessagingException*/public void sendHtmlMail(String to, String subject, String content) throws MessagingException;public void sendHtmlMail(String to, String subject, String content, String... cc);/*** 发送带附件的邮件* @param to* @param subject* @param content* @param filePath* @throws MessagingException*/public void sendAttachmentsMail(String to, String subject, String content, String filePath) throws MessagingException;public void sendAttachmentsMail(String to, String subject, String content, String filePath, String... cc);/*** 发送正文中有静态资源的邮件* @param to* @param subject* @param content* @param rscPath* @param rscId* @throws MessagingException*/public void sendResourceMail(String to, String subject, String content, String rscPath, String rscId) throws MessagingException;public void sendResourceMail(String to, String subject, String content, String rscPath, String rscId, String... cc);}
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.FileSystemResource;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;import javax.annotation.PostConstruct;
import javax.mail.MessagingException;
import javax.mail.Transport;
import javax.mail.internet.MimeMessage;
import java.io.File;@Component
public class EmailSendImpl implements EmailSend {@Autowiredpublic JavaMailSender mailSender;@Value("${spring.mail.from}")public String from;/*** 发送文本邮件** @param to* @param subject* @param content*/@Overridepublic void sendSimpleMail(String to, String subject, String content) {SimpleMailMessage message = new SimpleMailMessage();message.setFrom(from);message.setTo(to);message.setSubject(subject);message.setText(content);mailSender.send(message);}@Overridepublic void sendSimpleMail(String to, String subject, String content, String... cc) {SimpleMailMessage message = new SimpleMailMessage();message.setFrom(from);message.setTo(to);message.setCc(cc);message.setSubject(subject);message.setText(content);mailSender.send(message);}/*** 发送HTML邮件* @param to* @param subject* @param content*/@Overridepublic void sendHtmlMail(String to, String subject, String content) throws MessagingException {MimeMessage message = mailSender.createMimeMessage();//true表示需要创建一个multipart messageMimeMessageHelper helper = new MimeMessageHelper(message, true);helper.setFrom(from);helper.setTo(to);helper.setSubject(subject);helper.setText(content, true);mailSender.send(message);}/*** 获取邮件的正文* @return*/public String getContent(Integer number){String str = "<body style=\"text-align: center;margin-left: auto;margin-right: auto;\">\n"+ "	<div id=\"welcome\" style=\"text-align: center;position: absolute;\" >\n"+"		<h3>欢迎使用</h3>\n"+"		<span>万千风景,不及见你一面</span>"+ "		<div\n"+ "			style=\"text-align: center; padding: 10px\"><a style=\"text-decoration: none;\" href=\"#\" target=\"_bank\" ><strong>最美的事就是与你一起,看遍万千风景</strong></a></div>\n"+ "		<div\n" + "			style=\"text-align: center; padding: 4px\">您的验证码:"+ number+"</div>\n"+ "	</div>\n" + "</body>";return str;}@Overridepublic void sendHtmlMail(String to, String subject, String content, String... cc) {}/*** 发送带附件的邮件* @param to* @param subject* @param content* @param filePath*/public void sendAttachmentsMail(String to, String subject, String content, String filePath) throws MessagingException {MimeMessage message = mailSender.createMimeMessage();MimeMessageHelper helper = new MimeMessageHelper(message, true);helper.setFrom(from);helper.setTo(to);helper.setSubject(subject);helper.setText(content, true);FileSystemResource file = new FileSystemResource(new File(filePath));String fileName = filePath.substring(filePath.lastIndexOf(File.separator));helper.addAttachment(fileName, file);mailSender.send(message);}@Overridepublic void sendAttachmentsMail(String to, String subject, String content, String filePath, String... cc) {}/*** 发送正文中有静态资源(图片)的邮件** @param to* @param subject* @param content* @param rscPath* @param rscId*/public void sendResourceMail(String to, String subject, String content, String rscPath, String rscId) throws MessagingException {MimeMessage message = mailSender.createMimeMessage();MimeMessageHelper helper = new MimeMessageHelper(message, true);helper.setFrom(from);helper.setTo(to);helper.setSubject(subject);helper.setText(content, true);FileSystemResource res = new FileSystemResource(new File(rscPath));helper.addInline(rscId, res);mailSender.send(message);}@Overridepublic void sendResourceMail(String to, String subject, String content, String rscPath, String rscId, String... cc) {}}

6、zip压缩工具类


import org.springframework.stereotype.Component;import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;/*** zip工具类** @author cdj* @date 2018年8月24日 上午10:03:15*/
@Component
public class ZipUtils {/*** 将存放在sourceFilePath目录下的源文件,打包成fileName名称的zip文件,并存放到zipFilePath路径下** @param sourceFilePath*            :待压缩的文件路径* @param zipFilePath*            :压缩后存放路径* @param fileName*            :压缩后文件的名称* @return*/public static boolean folderToZip(String sourceFilePath, String zipFilePath, String fileName) {boolean flag = false;File sourceFile = new File(sourceFilePath);FileInputStream fis = null;BufferedInputStream bis = null;FileOutputStream fos = null;ZipOutputStream zos = null;if (sourceFile.exists() == false) {System.out.println("待压缩的文件目录:" + sourceFilePath + "不存在.");} else {try {File zipFile = new File(zipFilePath + "/" + fileName + ".zip");if (zipFile.exists()) {System.out.println(zipFilePath + "目录下存在名字为:" + fileName + ".zip" + "打包文件.");} else {File[] sourceFiles = sourceFile.listFiles();if (null == sourceFiles || sourceFiles.length < 1) {System.out.println("待压缩的文件目录:" + sourceFilePath + "里面不存在文件,无需压缩.");} else {fos = new FileOutputStream(zipFile);zos = new ZipOutputStream(new BufferedOutputStream(fos));byte[] bufs = new byte[1024 * 10];for (int i = 0; i < sourceFiles.length; i++) {// 创建ZIP实体,并添加进压缩包ZipEntry zipEntry = new ZipEntry(sourceFiles[i].getName());zos.putNextEntry(zipEntry);// 读取待压缩的文件并写进压缩包里fis = new FileInputStream(sourceFiles[i]);bis = new BufferedInputStream(fis, 1024 * 10);int read = 0;while ((read = bis.read(bufs, 0, 1024 * 10)) != -1) {zos.write(bufs, 0, read);}}flag = true;}}} catch (FileNotFoundException e) {e.printStackTrace();throw new RuntimeException(e);} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);} finally {// 关闭流try {if (null != bis)bis.close();if (null != zos)zos.close();} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);}}}return flag;}/*** 将sourceFilePath文件,打包成fileName名称的zip文件,并存放到zipFilePath路径下** @param sourceFilePath*            :待压缩的文件路径* @param zipFilePath*            :压缩后存放路径* @param fileName*            :压缩后文件的名称* @return*/public static boolean fileToZip(String sourceFilePath, String zipFilePath, String fileName) {boolean flag = false;File sourceFile = new File(sourceFilePath);FileInputStream fis = null;BufferedInputStream bis = null;FileOutputStream fos = null;ZipOutputStream zos = null;if (sourceFile.exists() == false) {System.out.println("待压缩的文件:" + sourceFilePath + "不存在.");} else {try {File zipFile = new File(zipFilePath + "/" + fileName + ".zip");if (zipFile.exists()) {System.out.println(zipFilePath + "目录下存在名字为:" + fileName + ".zip" + "打包文件.");} else {fos = new FileOutputStream(zipFile);zos = new ZipOutputStream(new BufferedOutputStream(fos));byte[] bufs = new byte[1024 * 10];// 创建ZIP实体,并添加进压缩包ZipEntry zipEntry = new ZipEntry(sourceFile.getName());zos.putNextEntry(zipEntry);// 读取待压缩的文件并写进压缩包里fis = new FileInputStream(sourceFile);bis = new BufferedInputStream(fis, 1024 * 10);int read = 0;while ((read = bis.read(bufs, 0, 1024 * 10)) != -1) {zos.write(bufs, 0, read);}flag = true;}} catch (FileNotFoundException e) {e.printStackTrace();throw new RuntimeException(e);} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);} finally {// 关闭流try {if (null != bis)bis.close();if (null != zos)zos.close();} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);}}}return flag;}/***  将流的内容打包成fileName名称的zip文件,并存放到zipFilePath路径下* @param fis* @param streamfilename* @param zipFilePath 压缩后存放路径* @param fileName 压缩后文件的名称* @return*/public static boolean streamToZip(InputStream fis, String streamfilename, String zipFilePath, String fileName) {boolean flag = false;BufferedInputStream bis = null;FileOutputStream fos = null;ZipOutputStream zos = null;try {File zipFile = new File(zipFilePath + "/" + fileName + ".zip");if (zipFile.exists()) {System.out.println(zipFilePath + "目录下存在名字为:" + fileName + ".zip" + "打包文件.");} else {fos = new FileOutputStream(zipFile);zos = new ZipOutputStream(new BufferedOutputStream(fos));byte[] bufs = new byte[1024 * 10];// 创建ZIP实体,并添加进压缩包ZipEntry zipEntry = new ZipEntry(streamfilename);zos.putNextEntry(zipEntry);// 读取待压缩的文件并写进压缩包里bis = new BufferedInputStream(fis, 1024 * 10);int read = 0;while ((read = bis.read(bufs, 0, 1024 * 10)) != -1) {zos.write(bufs, 0, read);}flag = true;}zos.close();} catch (FileNotFoundException e) {e.printStackTrace();throw new RuntimeException(e);} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);} finally {// 关闭流try {if (null != bis)bis.close();if (null != zos)zos.close();} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);}}return flag;}/*** 将流转成zip文件输出* @param inputstream*            文件流* @param streamfilename*            流文件的名称* @param fileName zip包的名称* @param response* @return*/public static boolean streamToZipStream(InputStream inputstream, String streamfilename, String fileName,HttpServletResponse response) {boolean flag = false;BufferedInputStream bis = null;FileOutputStream fos = null;ZipOutputStream zos = null;OutputStream out = null;try {out = response.getOutputStream();response.reset();response.setHeader("Content-Disposition","attachment;filename=" + new String(fileName.getBytes("GB2312"), "ISO-8859-1"));response.setContentType("application/octet-stream; charset=utf-8");response.setCharacterEncoding("UTF-8");zos = new ZipOutputStream(out);byte[] bufs = new byte[1024 * 10];// 创建ZIP实体,并添加进压缩包ZipEntry zipEntry = new ZipEntry(streamfilename);zos.putNextEntry(zipEntry);// 读取待压缩的文件并写进压缩包里bis = new BufferedInputStream(inputstream, 1024 * 10);int read = 0;while ((read = bis.read(bufs, 0, 1024 * 10)) != -1) {zos.write(bufs, 0, read);}flag = true;zos.close();} catch (FileNotFoundException e) {e.printStackTrace();throw new RuntimeException(e);} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);} finally {// 关闭流try {if (null != bis)bis.close();if (null != zos)zos.close();if (null != out)out.close();} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);}}return flag;}/*** 将多个流转成zip文件输出* @param listStream*            文件流实体类对象* @param fileName zip包的名称* @param response* @return*/public static boolean listStreamToZipStream(List<ZipStreamEntity> listStream, String fileName, HttpServletResponse response) {boolean flag = false;BufferedInputStream bis = null;FileOutputStream fos = null;ZipOutputStream zos = null;OutputStream out = null;try {out = response.getOutputStream();response.reset();response.setHeader("Content-Disposition","attachment;filename=" + new String(fileName.getBytes("GB2312"), "ISO-8859-1"));response.setContentType("application/octet-stream; charset=utf-8");response.setCharacterEncoding("UTF-8");zos = new ZipOutputStream(out);byte[] bufs = new byte[1024 * 10];for (ZipStreamEntity zipstream : listStream) {String streamfilename = zipstream.getName();// 创建ZIP实体,并添加进压缩包ZipEntry zipEntry = new ZipEntry(streamfilename);zos.putNextEntry(zipEntry);// 读取待压缩的文件并写进压缩包里bis = new BufferedInputStream(zipstream.getInputstream(), 1024 * 10);int read = 0;while ((read = bis.read(bufs, 0, 1024 * 10)) != -1) {zos.write(bufs, 0, read);}}flag = true;zos.close();} catch (FileNotFoundException e) {e.printStackTrace();throw new RuntimeException(e);} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);} finally {// 关闭流try {if (null != bis)bis.close();if (null != zos)zos.close();if (null != out)out.close();} catch (IOException e) {e.printStackTrace();throw new RuntimeException(e);}}return flag;}/*** 判断当前系统是否为windows* @return*/public static boolean isWindows() {return System.getProperties().getProperty("os.name").toUpperCase().indexOf("WINDOWS") != -1;}
}

7、zip流文件实体类

/*** zip相关  流文件实体类*/
public class ZipStreamEntity {public String name;public InputStream inputstream;public ZipStreamEntity() {super();// TODO Auto-generated constructor stub}public ZipStreamEntity(String name, InputStream inputstream) {super();this.name = name;this.inputstream = inputstream;}public String getName() {return name;}public void setName(String name) {this.name = name;}public InputStream getInputstream() {return inputstream;}public void setInputstream(InputStream inputstream) {this.inputstream = inputstream;}}

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

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

相关文章

ElementPlusError: [ElPagination] 你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档

使用element table出现这个错误好几回了&#xff0c;今天把它记录一下&#xff0c;并把错误原因复盘一遍。具体如下&#xff1a; 错误截图 原因 其实这个错误挺迷的&#xff0c;我把各种情况都测试了一遍&#xff0c;最后发现是因为给 翻页参数 total 传值错误导致的。 总结…

实时沟通,实时增长:企业使用WhatsApp Business的不二选择

在数字化浪潮中&#xff0c;WhatsApp Business崭露头角&#xff0c;成为企业与客户之间沟通的新利器。今天运营坛将和大家深入探讨WhatsApp Business在2023年为企业带来的机遇&#xff0c;从增长率、客户群体、功能特性以及优势等方面剖析为何企业需要充分利用这一强大工具。 W…

鸿蒙4.0开发笔记之ArkTS装饰器语法基础@Builder组件内自定义构建函数与@Styles自定义组件重用样式(十)

文章目录 一、Builder自定义构建函数1、什么是自定义构建函数2、组件内定义构建函数3、组件外定义构建函数4、Builder装饰器练习 二、Styles重用样式函数1、重用样式的作用2、组件内定义Styles3、组件外定义4、Styles装饰器练习5、注意要点 一、Builder自定义构建函数 1、什么…

微信小程序 slider 翻转最大和最小值

微信小程序 slider 翻转最大和最小值 场景代码示例index.wxmlindex.jsutil.js 参考资料 场景 我想使用 slider 时最左边是 10 最右是 -10。 但是想当然的直接改成<slider min"10" max"-10" step"1" /> 并没用。 查了文档和社区也没有现成…

netstat和ps命令

查看端口占用情况 netstat -apn | grep 9091 Proto Recv-Q Send-Q Local Address Foreign Address State tcp6 0 0 127.0.0.1:9091 127.0.0.1:36644 ESTABLISHED 83369/./pushgateway意思为 127.0.0.1:36644 通过进…

开会的流程和步骤:高效率的组织好一场会议的9种方法

九种让你的会议更有效的方法&#xff1a;1.明确会议目的&#xff1b;2.设计会议议程&#xff1b;3.邀请合适的人&#xff1b;4.有效开场&#xff1b;5.建立基本会议规则&#xff1b;6.把不相关的话题先搁置一边&#xff1b;7.管理参与者的行为&#xff1b;8.改进和持续跟踪&…

虚幻学习笔记4—文本内容处理

一、前言 本文使用的虚幻引擎5.3.2&#xff0c;在虚幻中已经集成了很多可以直接处理多样化文本的蓝图&#xff0c;比如格式化动态显示、浮点数多样化等。 二、实现 2.1、格式化文本显示动态内容&#xff1a;在设置某个文本时可以使用“Format Text”蓝图设置自定义可以的显示…

建立ISO 27001,能给企业带来哪些好处?

在当今信息时代&#xff0c;企业面临着越来越多的信息安全挑战。为了应对这些挑战&#xff0c;许多企业开始寻求ISO27001信息安全管理体系标准的帮助。本文将详细解答ISO27001建立后能给企业带来哪些好处&#xff0c;并为您详解ISO27001标准及其认证过程。 1. 提升企业信息安全…

Django 模板引擎 (四)

一、Django模板引擎 一个强大的工具&#xff0c;用于在HTML页面中嵌入动态内容。它使用一种被称为Django模板语言&#xff08;Django Template Language&#xff09;的简单而强大的语法来处理模板。该模板语言使用”{% %}”进行标记&#xff0c;用于执行各种操作。 二、Django…

【论文精读】HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Face

HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Face 前言Abstract1 Introduction2 Related Works3 HuggingGPT3.1 Task PlanningSpecification-based InstructionDemonstration-based Parsing 3.2 Model SelectionIn-context Task-model Assignment 3…

测试需要写测试用例吗?(从不同角度下剖析问题)

前言 最近在网上看到关于这样的一个话题“测试需要写测试用例吗&#xff1f;”&#xff0c;引起了很多同学的讨论。这段话是这样的&#xff1a; 测试用例主要作用&#xff1a;有效地评估软件的质量&#xff0c;测试用例质量体现了测试的质量。 下面摘取一部分同学的观点&…

如何理解程序之间的解耦和元注解的应用?

1.如何理解程序之间的解耦&#xff1f; 我的理解是解耦是将有联系的代码或者有依赖的代码之间 通过中间的方式去处理而不是写成固定的方式&#xff0c;而是通过统一的定义的某种方式去结合这些依赖关系&#xff0c;比如使用反射机制 2.解耦是将代码之间的依赖关系降低到最小&…

记录labelImg上手过程

一、安装 Labelimg&#xff08;目标检测标注工具&#xff09;安装_labelimg安装_向南不向北的博客-CSDN博客 二、打开 进入anaconda虚拟环境后&#xff0c;cd到labelimg文件夹&#xff0c;然后输入命令 python labelImg.py 三、基础设置 打标工具labelimg安装和使用教程-C…

【知识】稀疏矩阵是否比密集矩阵更高效?

转载请注明出处&#xff1a;小锋学长生活大爆炸[xfxuezhang.cn] 问题提出 有些地方说&#xff0c;稀疏图比密集图的计算效率更高&#xff0c;真的吗&#xff1f; 原因猜想 这里的效率高&#xff0c;应该是有前提的&#xff1a;当使用稀疏矩阵的存储格式(如CSR)时&#xff0c;计…

【2019年数据结构真题】

【2019统考真题】设线性表L (a1&#xff0c;a2&#xff0c;a3&#xff0c;…&#xff0c;an-2&#xff0c;an-1&#xff0c;an)采用带头结点的单链表保存&#xff0c;链表中的结点定义如下&#xff1a; typedef struct node{int data;struct node*next; }NODE;请设计一个空间复…

酷狗音乐app 评论signature

文章目录 声明目标加密参数定位翻页逻辑代码实现 声明 本文章中所有内容仅供学习交流&#xff0c;严禁用于商业用途和非法用途&#xff0c;否则由此产生的一切后果均与作者无关&#xff0c;若有侵权&#xff0c;请私信我立即删除&#xff01; 目标 复制curl转python # -*- c…

供应链大事记 | 2024第二届中国供应链碳中和峰会来了!

背景 当下&#xff0c;全球气候变化、环境污染、资源紧张问题加剧&#xff0c;世界各国致力于推动碳达峰、碳中和&#xff0c;绿色低碳发展已成为全球共识。我国也于2020年明确提出“3060双碳目标”&#xff0c;经济结构、能源结构、产业结构亟待转型升级&#xff0c;各重点行…

熟悉SVN基本操作-(SVN相关介绍使用以及冲突解决)

一、SVN相关介绍 1、SVN是什么? 代码版本管理工具它能记住你每次的修改查看所有的修改记录恢复到任何历史版本恢复已经删除的文件 2、SVN跟Git比&#xff0c;有什么优势 使用简单&#xff0c;上手快目录级权限控制&#xff0c;企业安全必备子目录checkout&#xff0c;减少…

体脂称方案设计——电子秤方案芯片CS1231

电子秤与我们日常生活息息相关&#xff0c;智能科技化的生活形成万物互联的模式。测量精度领域随着大市场的发展也进入到发展高峰时期&#xff0c;电子秤从开始的弹簧压力测物体重量走向更为智能的测体脂、人体成分等相关的测量。所以在做方案开发中它的功能也在更新和智能化。…

Git——工作区管理

如何管理工作目录&#xff0c;以便用户可以更高效地新建提交。如何在处理工作区和暂存区文件的过程中修复错误&#xff0c;以及如何修复最近一次提交记录中的问题&#xff1b;同时还会了解到如何安全地使用暂存机制和多个工作目录处理工作流中的中断问题。 主要内容有以下几点…