当前位置: 首页 > news >正文

15、监测数据采集物联网应用开发步骤(11)

源码将于最后一遍文章给出下载

  1. 监测数据采集物联网应用开发步骤(10)

程序自动更新开发

前面章节写了部分功能模块开发:

  1. 日志或文本文件读写开发;
  2. Sqlite3数据库读写操作开发;
  3. 定时器插件化开发;
  4. 串口(COM)通讯开发;
  5. TCP/IP Client开发;
  6. TCP/IP Server 开发;
  7. modbus协议开发;

本章节啰嗦些,该解决方案最终业务成品有些需要部署在不同工控机或设备上,在实际应用过程中随时间推移有些需要升级迭代或修改bug,一旦安装部署设备点位达到一定数量,系统自动更新升级就是一个必要的步骤了。笔者开发的业务应用在相应的设备上安装已近千台设备,鉴于此增加了程序自动更新功能模块。

com.zxy.common.Com_Para.py中添加如下内容

#自动更新服务端文件夹地址
urlPath = ""
#程序版本号
version = ""

新建程序版本自动更新类com.zxy.autoUpdate.GetVersion.py
 

#! python3
# -*- coding: utf-8 -
'''
Created on 2017年05月10日
@author: zxyong 13738196011
'''import urllib.request,datetime
from com.zxy.adminlog.UsAdmin_Log import UsAdmin_Log
from com.zxy.common import Com_Para
from com.zxy.common.Com_Fun import Com_Fun
from com.zxy.interfaceReflect.A01_A1B2C3 import A01_A1B2C3
from com.zxy.z_debug import z_debug
from urllib.parse import urlparse#监测数据采集物联网应用--程序版本自动更新类
class GetVersion(z_debug):def __init__(self):pass#下载文件def SaveRemoteFile(self,inputFileName,inputLocalFileName):try:temResult = urllib.request.urlretrieve(Com_Para.urlPath+"/"+inputFileName,Com_Para.ApplicationPath+Com_Para.zxyPath+inputLocalFileName)except Exception as e:if str(type(self)) == "<class 'type'>":self.debug_in(self,repr(e)+"=>"+str(e.__traceback__.tb_lineno))#打印异常信息else:self.debug_in(repr(e)+"=>"+str(e.__traceback__.tb_lineno))#打印异常信息return temResult#保存版本号文件def SaveVersionFile(self,version_no,inputLocalFileName):temStrTFileName = Com_Para.ApplicationPath+Com_Para.zxyPath+inputLocalFileNametemFile = Nonetry: temFile = open(temStrTFileName, 'w',encoding=Com_Para.U_CODE)temFile.write(version_no)temFile.close()except Exception as e:if str(type(self)) == "<class 'type'>":self.debug_in(self,repr(e)+"=>"+str(e.__traceback__.tb_lineno))#打印异常信息else:self.debug_in(repr(e)+"=>"+str(e.__traceback__.tb_lineno))#打印异常信息finally:if temFile != None:temFile.close()#检测最新版本def CheckVersion(self):try:print("check new version..."+Com_Fun.GetTimeDef())#读取服务器端version.txt信息temResult = self.GetRequestWeb()if temResult == "":return 0temUL = UsAdmin_Log(Com_Para.ApplicationPath,temResult,0)#文件形式版本号管理temVersion = temUL.ReadFile(Com_Para.ApplicationPath+Com_Para.zxyPath + "version.txt")Com_Para.version = temVersion#数据库形式版本号管理temVersion = Com_Para.versiontemAryTem = []temVersion_No = ""temLastFile = ""#判断文件是否存在if temVersion == "" and temResult != "":print("local version none,downloading new version")temAryTem = temResult.split("\n")for temLine in temAryTem:temLine = temLine.replace("\r","").replace("\n","")temLastFile = temLineif temLine.find("version=") != -1:temVersion_No = temLineelif temLine != "":print("new version file download:"+temLine)self.SaveRemoteFile(temLine,"back/"+temLine)self.CopyFile(temLine)if temVersion_No != "":#文件形式版本管理     self.SaveVersionFile(temVersion_No,"version.txt")#数据库形式版本文件管理#将版本号insert入库 该处代码省略....Com_Para.version = temVersion_No    print("new version updated over:")#如果读到reboot.txt则需要重启设备if temLastFile.strip() == "reboot.txt":self.RebootProgram()return 0if temVersion_No != "":#文件形式版本管理     print("new version updated over:")self.SaveVersionFile(temVersion_No,"version.txt")#数据库形式版本文件管理#将版本号insert入库  该处代码省略....Com_Para.version = temVersion_Noelif temResult != "":#数据库形式版本号管理
#                 localVersion = Com_Para.version#文件形式版本号管理temAryTem = temVersion.split("\n")for temLine in temAryTem:temArySub = temLine.split("=")if len(temArySub) > 1 and temArySub[0] == "version":localVersion = temArySub[1]break bFlag = FalsetemAryTem = temResult.split("\n")for temLine in temAryTem:temLine = temLine.replace("\r","").replace("\n","")temLastFile = temLinetemArySub = temLine.split("=")if len(temArySub) > 1 and temArySub[0] == "version":try:if localVersion.find("=") != -1:iLV = int(localVersion.split("=")[1])else:iLV = int(localVersion)if localVersion != "" and iLV >= int(temArySub[1]):bFlag = Falseelse:temVersion_No = temLinebFlag = Trueexcept:bFlag = Falsebreakelse:if bFlag:self.SaveRemoteFile(temLine,"back/"+temLine)self.CopyFile(temLine)if temVersion_No != "":#文件形式版本管理     self.SaveVersionFile(temVersion_No,"version.txt") #数据库形式版本文件管理  #将版本号insert入库  该处代码省略....Com_Para.version = temVersion_Noprint("new version updated over:"+temVersion_No)if temLastFile.strip() == "reboot.txt":self.RebootProgram()return 0if (bFlag and temVersion_No != ""):#文件形式版本管理     self.SaveVersionFile(temVersion_No,"version.txt")#数据库形式版本文件管理  #将版本号insert入库  该处代码省略....Com_Para.version = temVersion_Noprint("new version updated over:")if bFlag and temLastFile.strip() == "reboot.txt":self.RebootProgram()return 0except Exception as e:if str(type(self)) == "<class 'type'>":self.debug_in(self,repr(e)+"=>"+str(e.__traceback__.tb_lineno))#打印异常信息else:self.debug_in(repr(e)+"=>"+str(e.__traceback__.tb_lineno))#打印异常信息return 1#重启设备def RebootProgram(self):        aa = A01_A1B2C3()if Com_Para.devsys.lower() == "linux": aa.param_value2 = "reboot -f"aa.CmdExecLinux()else:aa.param_value2 = "shutdown -r"aa.CmdExecWin()#文件更新def CopyFile(self,inputWebFile):temAryTem = inputWebFile.split("\n")for temLine in temAryTem:if temLine.find("=") == -1:aa = A01_A1B2C3()temFileName = temLine[0:temLine.find(".")]temFileAtt = temLine[temLine.find("."):len(temLine)].upper()if temFileAtt.upper() == ".ZIP":aa.param_value2 = "unzip -o "+Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temLine+" -d "+Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temFileName+Com_Para.zxyPathaa.param_value3 = Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temLineaa.param_value4 = Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temFileName+Com_Para.zxyPath#利用命令进行解压缩#aa.CmdExecLinux()#利用python自带解压缩模块aa.unzip_file()                     if Com_Para.devsys.lower() == "linux":                 aa.param_value2 = "cp -rf "+Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temFileName+Com_Para.zxyPath+"* "+Com_Para.ApplicationPath+Com_Para.zxyPathelse:aa.param_value2 = "xcopy "+Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temFileName+Com_Para.zxyPath+"*.* "+Com_Para.ApplicationPath+" /E /Y"aa.CmdExecLinux()#执行sql语句elif temFileAtt.upper() == ".SQL":aa.RunSqlFile(Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temLine)#执行更新数据接口elif temFileAtt.upper() == ".JSON":#JSON业务数据进行数据库结构更改或升级passelse:if Com_Para.devsys.lower() == "linux":                 aa.param_value2 = "cp -rf "+Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temLine+" "+Com_Para.ApplicationPath+Com_Para.zxyPathelse:aa.param_value2 = "copy "+Com_Para.ApplicationPath+Com_Para.zxyPath+"back"+Com_Para.zxyPath+temLine+" "+Com_Para.ApplicationPath+Com_Para.zxyPath+" /Y"aa.CmdExecLinux()#inputFlag网络链接是否正常def set_dSockList(self,inputFlag):urlp = urlparse(Com_Para.urlPath)if Com_Para.urlPath == "":return None                key = str(urlp.netloc.replace(":","|")) #存在if key not in list(Com_Para.dSockList.keys()):Com_Para.dSockList[key] = [0,datetime.datetime.now()]if inputFlag == False:objAry = Com_Para.dSockList[key]if objAry[0] <= 10:objAry[0] = objAry[0] + 1objAry[1] = datetime.datetime.now()Com_Para.dSockList[key] = objAryelse:Com_Para.dSockList[key] = [0,datetime.datetime.now()]    #判断上次链接时间频率是否合规def judge_dSock(self):urlp = urlparse(Com_Para.urlPath)if Com_Para.urlPath == "":return False                key = str(urlp.netloc.replace(":","|")) if key not in list(Com_Para.dSockList.keys()):Com_Para.dSockList[key] = [0,datetime.datetime.now()]objAry = Com_Para.dSockList[key]starttime = datetime.datetime.now()if objAry[0] <= 3:return Trueelif objAry[0] > 4 and starttime >= objAry[1] + datetime.timedelta(hours=12):return Trueelse:return Falsedef GetRequestWeb(self):temResult = ""try:#判断上次链接时间频率是否合规if not self.judge_dSock():return ""resp = urllib.request.urlopen(Com_Para.urlPath+"/version.txt",timeout=5)temResult = resp.read().decode(Com_Para.U_CODE)        except Exception as e:temLog = ""if str(type(self)) == "<class 'type'>":temLog = self.debug_info(self)+repr(e)else:temLog = self.debug_info()+repr(e)uL = UsAdmin_Log(Com_Para.ApplicationPath, temLog+"=>"+str(e.__traceback__.tb_lineno))uL.WriteLog()temResult = ""self.set_dSockList(False)return temResult

新建操作系统执行指令接口类com.zxy.interfaceReflect.A01_A1B2C3.py

#! python3
# -*- coding: utf-8 -
'''
Created on 2017年05月10日
@author: zxyong 13738196011
'''import os, sys,zipfile,subprocess,tempfile
from urllib.parse import unquote
from com.zxy.common import Com_Para
from com.zxy.common.Com_Fun import Com_Fun
from com.zxy.z_debug import z_debug#监测数据采集物联网应用--操作系统执行指令接口类
class A01_A1B2C3(z_debug):strResult        = ""session_id       = ""param_name       = ""param_value1     = None  #1:同步更新设备时间param_value2     = None  #当前时间param_value3     = Noneparam_value4     = Noneparam_value5     = Noneparam_value6     = Noneparam_value7     = Noneparam_value8     = Noneparam_value9     = Noneparam_value10    = None#是否继续执行 1:继续执行 0:中断执行strContinue      = "0"strCmdValue     = ""def __init__(self):passdef init_start(self):       
#         /**************************************************/
#         //示例: 此处写业务逻辑,最后给 param_name,param_value1....重新赋值 
#         // param_name += Com_Fun.Get_New_GUID()
#         // param_value1 += Com_Fun.Get_New_GUID()
#         // param_value2 += Com_Fun.Get_New_GUID()
#         // ......#         /**************************************************/
#         //示例:若业务逻辑判断失败,不发送数据库接口请求并返回失败信息#strContinue      = "0" 表示拦截器判断接口执行结束,不需要入库操作,直接返回信息temValue = ""self.strContinue = "0"if self.param_value1 == "100" and Com_Para.devsys == "linux":temValue = self.CmdExecLinux(self)self.strResult = "命令结果:\r\n"for temR in temValue:self.strResult = self.strResult+temR.decode(Com_Para.U_CODE)+"\r\n"#100执行命令elif self.param_value1 == "100" and Com_Para.devsys == "windows":temValue = self.CmdExecWin(self)self.strResult = "{\""+self.param_name+"\":[{\"s_result\":\"1\",\"error_desc\":\"命令执行成功"+temValue+"\"}]}"#利用python自带解压缩def unzip_file(self):temzipfile = zipfile.ZipFile(self.param_value3, 'r')temzipfile.extractall(self.param_value4)        #重启程序def RestartPro(self):python = sys.executableos.execl(python,python,* sys.argv)#执行命令(Linux)def CmdExecLinux(self):out_temp = Nonetry:       temCommand = unquote(unquote(self.param_value2,Com_Para.U_CODE))out_temp = tempfile.SpooledTemporaryFile(max_size=10*1000)fileno = out_temp.fileno()obj = subprocess.Popen(temCommand,stdout=fileno,stderr=fileno,shell=True)obj.wait()            out_temp.seek(0)temResult = out_temp.readlines()              except Exception as e:temResult = repr(e)finally:if out_temp is not None:out_temp.close()return temResult#执行命令(Windows)def CmdExecWin(self):try:temCommand = unquote(unquote(self.param_value2,Com_Para.U_CODE))temResult = os.popen(temCommand).read()except Exception as e:temResult = repr(e)return temResult#更新设备时间(Windows)def ChangeDateWin(self):try:temDate = Com_Fun.GetDateInput('%Y-%m-%d', '%Y-%m-%d %H:%M:%S', unquote(unquote(self.param_value2.replace("+"," "),Com_Para.U_CODE)))temTime = Com_Fun.GetDateInput('%H:%M:%S', '%Y-%m-%d %H:%M:%S', unquote(unquote(self.param_value2.replace("+"," "),Com_Para.U_CODE)))temResult = os.system('date {} && time {}'.format(temDate,temTime))except:temResult = -1return temResult#更新设备时间(Linux)def ChangeDateLinux(self):try:            #将硬件时间写入到系统时间:#hwclock -s#将系统时间写入到硬件时间#hwclock -wtemCommand = unquote(unquote("date -s \""+self.param_value2.replace("+"," ").split(" ")[0]+"\"",Com_Para.U_CODE))temCommand = unquote(unquote("date -s \""+self.param_value2.replace("+"," ").split(" ")[1]+"\"",Com_Para.U_CODE))out_temp = tempfile.SpooledTemporaryFile(max_size=10*1000)fileno = out_temp.fileno()obj = subprocess.Popen(temCommand,stdout=fileno,stderr=fileno,shell=True)obj.wait()temCommand = unquote(unquote("hwclock -w",Com_Para.U_CODE))obj = subprocess.Popen(temCommand,stdout=fileno,stderr=fileno,shell=True)obj.wait()         out_temp.seek(0)temByt = out_temp.readlines()temResult = temByt[0].decode(Com_Para.U_CODE)if temResult == "" :temResult = "1"except Exception as e:temResult = "-1"        finally:if out_temp is not None:out_temp.close()return temResult

版本更新测试案例MonitorDataCmd.py主文件中编写:

from com.zxy.autoUpdate.GetVersion import GetVersion

在    if __name__ == '__main__':下添加

        #版本更新测试Com_Para.urlPath = "http://localhost:8080/testweb/updtest/"gv = GetVersion()    gv.CheckVersion()print("=>版本更新完成")

程序文件新建back文件夹临时存放下载更新包的zip文件;

版本更新服务端文件信息

版本更新服务端版本号信息

运行结果设备端更新之后新增文件

更新文件已下载并自动解压缩成功。

print打印出的内容

相关文章:

15、监测数据采集物联网应用开发步骤(11)

源码将于最后一遍文章给出下载 监测数据采集物联网应用开发步骤(10) 程序自动更新开发 前面章节写了部分功能模块开发&#xff1a; 日志或文本文件读写开发;Sqlite3数据库读写操作开发;定时器插件化开发;串口(COM)通讯开发;TCP/IP Client开发;TCP/IP Server 开发;modbus协议…...

Pygame中Trivia游戏解析6-2

3.1.2 读取保存题目的文件 在Trivia类的__init__()方法中&#xff0c;对各变量初始化完成之后&#xff0c;读取保存题目的文件&#xff0c;代码如下所示。 f open(filename, "r", encodingutf8) trivia_data f.readlines() f.close() 其中&#xff0c;open()函数…...

java 实现命令行模式

命令模式是一种行为设计模式&#xff0c;它允许您将请求封装为对象&#xff0c;以便您可以将其参数化、队列化、记录和撤销。在 Java 中实现命令模式涉及创建一个命令接口&#xff0c;具体命令类&#xff0c;以及一个接收者类&#xff0c;该接收者类执行实际操作。下面是一个简…...

A - Orac and Models(最长上升子序列——加强版)

There are nn models in the shop numbered from 11 to nn, with sizes s_1, s_2, \ldots, s_ns1​,s2​,…,sn​. Orac will buy some of the models and will arrange them in the order of increasing numbers (i.e. indices, but not sizes). Orac thinks that the obtai…...

【python手写算法】逻辑回归实现分类(含公式推导)

公式推导&#xff1a; 代码实现&#xff1a; # codingutf-8 import matplotlib.pyplot as plt import numpy as npdef f(w1,x1,w2,x2,b):zw1*x1w2*x2breturn 1/(1np.exp(-z)) if __name__ __main__:X1 [12.46, 0.25, 5.22, 11.3, 6.81, 4.59, 0.66, 14.53, 15.49, 14.43,2.1…...

【2023高教社杯数学建模国赛】ABCD题 问题分析、模型建立、参考文献及实现代码

【2023高教社杯数学建模国赛】ABCD题 问题分析、模型建立、参考文献及实现代码 1 比赛时间 北京时间&#xff1a;2023年9月7日 18:00-2023年9月10日20:00 2 思路内容 可以参考我提供的历史竞赛信息内容&#xff0c;最新更新我会发布在博客和知乎上&#xff0c;请关注我获得最…...

yum安装mysql5.7散记

## 数据源安装 $ yum -y install wget $ wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm $ yum localinstall mysql57-community-release-el7-8.noarch.rpm $ yum repolist enabled | grep "mysql.*-community.*" $ yum install mysql-…...

DNS解析

1.DNS介绍 DNS 表示域名系统。此系统实质上是用于整理和识别各个域名的网络电话簿。电话簿将“Acme Pizza”之类的名称转换为要拨打的正确电话号码&#xff0c;而 DNS 将“www.google.com”之类的网络地址转换为托管该网站的计算机的物理 IP 地址&#xff0c;如“74.125.19.147…...

从jdk8 升级到jdk17的问题总结

目录 1. java.lang.reflect.InaccessibleObjectException: 2. java.lang.UnsatisfiedLinkError in autosys 3. java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser 4. java.lang.UnsatisfiedLinkError: **…...

一百七十二、Flume——Flume采集Kafka数据写入HDFS中(亲测有效、附截图)

一、目的 作为日志采集工具Flume&#xff0c;它在项目中最常见的就是采集Kafka中的数据然后写入HDFS或者HBase中&#xff0c;这里就是用flume采集Kafka的数据导入HDFS中 二、各工具版本 &#xff08;一&#xff09;Kafka kafka_2.13-3.0.0.tgz &#xff08;二&#xff09;…...

pnpm 升级

1. 在以下路径下删除pnpm包 2. 执行which pnpm&#xff0c;在结果目录中删除pnpm 3. sudo npm install -g pnpm 重新安装&#xff0c;node默认使用16...

有关使用HttpServletRequest的Cookie的设置和获取

文章目录 小结问题和解决参考 小结 介绍了如何在HttpServletRequest中对Cookie的进行设置和获取。 问题和解决 在服务器端的HttpServletRequest中对Cookie的进行设置后&#xff0c;客户端在接下来的请求中会携带此设置好的Cookie&#xff0c;所以可以在服务器端接收请求时提…...

关于 Nginx 的哪些事

关于 Nginx 的哪些事 1、Nginx 主要功能2、Nginx 的常用命令2.1、启动Nginx2.2、停止 Nginx2.3、重新加载Nginx 配置2.4、检查Nginx配置文件2.5、指定配置文件2.6、检查Nginx版本2.7、显示Nginx帮助信息 3、Nginx 配置文件 nginx.conf3.1、Nginx 配置文件&#xff08;nginx.con…...

插入排序——希尔排序

1、简述&#xff1a; 希尔排序(Shells Sort)是插入排序的一种又称“缩小增量排序”&#xff08;Diminishing Increment Sort&#xff09;&#xff0c;是直接插入排序算法的一种更高效的改进版本。希尔排序是非稳定排序算法。该方法因 D.L.Shell 于 1959 年提出而得名。 希尔排…...

C语言之初阶总结篇

目录 NO.1 NO.2 NO.3 NO.4 NO.5 NO.6 NO.7 NO.8 NO.9 NO.10 NO.11 NO.12.概念tips NO.13.求最小公倍数 NO.14.最大公因数 NO.15.输入读取字符串 NO.16.倒置字符串 今天是一些C语言题目&#xff0c;最近天气炎热&#xff0c;多喝水。 NO.1 下面程序执行后&am…...

Android签名查看

查看签名文件信息 第一种方法&#xff1a; 1.打开cmd&#xff0c;执行keytool -list -v -keystore xxx.keystore&#xff0c;效果如下图&#xff1a; 第二种方法: 1.打开cmd&#xff0c;执行 keytool -list -v -keystore xxxx.keystore -storepass 签名文件密码&#xff0…...

Educational Codeforces Round 3

目录 A. USB Flash Drives B. The Best Gift C. Load Balancing D. Gadgets for dollars and pounds A. USB Flash Drives #include<bits/stdc.h>using namespace std; const int N1e65; typedef long long ll; typedef pair<ll,ll> pll; typedef array<int…...

Docker Compose常用命令

常用命令 1.1 restart, start, stop-- 启动和停止服务 命令必须在 docker-compose.yml文件所在的目录下执行。 # 前台启动, 启动项目中的所有服务。 $. docker-compose up# 后台启动, 启动所有服务并在后台运行。 $. docker-compose up -d# 停止所有服务。 $. docker-compose …...

C++——智能指针

智能指针 文章目录 智能指针内存泄漏智能指针解决内存泄漏问题智能指针的使用及原理RAII智能指针对象的拷贝问题 C中的智能指针auto_ptrunique_ptrshared_ptrweak_ptr定制包装器C11和boost中智能指针的关系 内存泄漏 什么是内存泄漏&#xff1a;内存泄漏指因为疏忽或错误造成程…...

CVE-2023-3836:大华智慧园区综合管理平台任意文件上传漏洞复现

文章目录 CVE-2023-3836&#xff1a;大华智慧园区综合管理平台任意文件上传漏洞复现0x01 前言0x02 漏洞描述0x03 影响范围0x04 漏洞环境0x05 漏洞复现1.访问漏洞环境2.构造POC3.复现 CVE-2023-3836&#xff1a;大华智慧园区综合管理平台任意文件上传漏洞复现 0x01 前言 免责声…...

LAMP搭建WordPress

L linux A apache hhtpd M mysql/maridb P PHP1、 安装php yum -y install php php-fpm php-server php-mysql1.1、 启动php-fpm并自启 systemctl enable php-fpm --now[rootecs-1cee ~]# systemctl status php-fpm ● php-fpm.service - The PHP FastCGI Process ManagerLoa…...

【数学建模竞赛】预测类赛题常用算法解析

解析常见的预测类算法 灰色预测模型 灰色预测模型是一种利用少量的、不完全的信息&#xff0c;建立数学模型并进行预测的方法。该方法通过对系统行为特征的发展变化规律进行估计预测&#xff0c;同时也可以对行为特征的异常情况发生的时刻进行估计计算&#xff0c;并研究特定…...

OFDM 系统在 AWGN 信道下对不同载波频率偏移 (CFO) 的 BER 灵敏度研究(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…...

go基础07-了解map实现原理并高效使用

对于C程序员出身的Gopher来说&#xff0c;map类型是和切片、interface一样能让他们感受到Go语言先进性的重要语法元素。map类型也是Go语言中最常用的数据类型之一。 go 中 map 怎么表现&#xff1f; 一些有关Go语言的中文教程或译本将map称为字典或哈希表&#xff0c;但在这里…...

SpringMVC进阶:常用注解、参数传递和请求响应以及页面跳转

目录 一、常用注解 1.1.RequestMapping 1.2.RequestParam 1.3.ModelAttribute 1.4.SessionAttributes 1.5.RequestBody 1.6.RequestHeader 1.7.PathVariable 1.8.CookieValue 二、参数传递 2.1.基础类型String 2.2.复杂类型 2.3.RequestParam 2.4.PathVariable 2…...

nacos - centos7.x环境单机与集群快速部署

参考官网:https://nacos.io/zh-cn/docs/what-is-nacos.html 官方集群部署手册:https://nacos.io/zh-cn/docs/cluster-mode-quick-start.html 【单机部署】 1.下载 & 解压到安装目录 下载:wget -c https://github.com/alibaba/nacos/releases/download/2.1.2/nacos-ser…...

文心一言初体验,和ChatGPT语言理解能力比较

文章目录 第一个考验&#xff0c;语义理解第二个考验&#xff0c;历史问题的回答推荐阅读 百度旗下AI大模型文心一言宣布向全社会全面开放,所有用户都可以体验这款AI大模型了。要比较这两个语言模型&#xff0c;我们先设计好题目。 第一个考验&#xff0c;语义理解 题目1&…...

浏览器进程,性能指标,性能优化

目录 浏览器进程&#xff1a;多进程 主进程&#xff1a;显示、交互&#xff0c;增删进程 UI进程&#xff1a;控制地址栏、书签、前进后退 存储进程&#xff1a;cookie&#xff0c;webstorage&#xff0c;indexDB 渲染进程&#xff1a;每个标签页或窗口都有一个独立的渲染进…...

Python基础set集合定义与函数

set集合 集合的特点&#xff1a; 1.集合是无序 2.集合是去重 定义一个空集合 name_set set() 定义一个非空集合 name_set {a, b, c} 关系测试&#xff1a; 交集&#xff0c;并集&#xff0c;差集&#xff0c;对称差集 1.交集&#xff1a;intersection() 或者 & …...

【大数据之Kafka】九、Kafka Broker之文件存储及高效读写数据

1 文件存储 1.1 文件存储机制 Topic是逻辑上的概念&#xff0c;而partition是物理上的概念&#xff0c;每个partition对应于一个log文件&#xff0c;该log文件中存储的是Producer生产的数据。 Producer生产的数据会被不断追加到该log文件末端&#xff0c;为防止log文件过大导致…...

免费做会计试题网站/优秀网站设计欣赏

1、维度建模相关概念 1.1、度量和环境 维度建模支持对因为过程的支持&#xff0c;这是通过对业务过程度量进行建模来实现的。 那么&#xff0c;什么是度量呢&#xff1f;实际上&#xff0c;通过和业务方、需求方交谈、或者阅读报表、图表等&#xff0c;可以很容易地识别度量。 …...

用什么l软件做网站了/seo搜索引擎优化平台

</pre>基于目前业务的版本&#xff0c;使用的maven 及tomcat <p></p><p>如果我们使用 Jenkins 发布是比较好的&#xff0c;但是存在一定的问题&#xff0c;就是需要学习时间&#xff0c;</p><p>基于我们的项目&#xff0c;我使用python 自…...

温州外贸公司网站建设公司排名/世界十大网站排名

java基础之抽象类&#xff1a; 一、父类不确定性&#xff1a;&#xff08;所谓抽象方法就是没有实现的方法&#xff0c;也就是没有方法体的方法&#xff09; 1.当父类的某些方法&#xff0c;需要声明&#xff0c;但是又不确定如何实现是&#xff0c;可以将其声明为抽象方法&am…...

wordpress选项卡插件/全网搜索

一 checkinstall 简介&#xff0c;及所需环境 1 Checkinstall 是一个能从 tar.gz类的源代码自动生成RPM&#xff0f;Debian或Slackware安装包的程序。这样使你能用几乎所有的 tar.gz 类的源代码生成“干净”的安装或者卸载包。 2 OS&#xff1a; rhel 6.4 x86_64 3 chechinstal…...

源代码如何做网站/怎么做互联网推广

题目&#xff1a; 给定一个n个点m条边的有向图&#xff0c;图中可能存在重边和自环&#xff0c;所有边权均为非负值。 请你求出1号点到n号点的最短距离&#xff0c;如果无法从1号点走到n号点&#xff0c;则输出-1。 输入格式 第一行包含整数n和m。 接下来m行每行包含三个整…...

搭建动态网站的步骤/网络销售怎么学

初始化 RocksDB.loadLibrary();//加载jniRocksDB db RocksDB.open(options, db_path_not_found)//打开数据库使用 单条插入 db.put("hello".getBytes(), "world".getBytes());批量插入 try (final WriteOptions writeOpt new WriteOptions()) {for (int …...