Unity的Excel转表工具

该Excel工具主要由Python语言完成,版本为3.x

主要功能:

1.转换后的数据存储结构为二进制。

2.excel文件可以选择多种数据类型:int、float、string、一维(int、float、string)、二维int、Map(int/int、int/string、int/float、string/int、string/float)

3.多个字段串联作为一个Key、单个字段作为一个Key

4.导出二进制(Unity使用),导出json(服务器使用)。

主要代码(Unity部分):

Config.py


# --------------------------------Excel--------------------------------
# Excel文件目录
EXCEL_DIR = "./Excel/"# excel文件的后缀
EXCEL_EXT = ".xlsx"# unity表格字段的过滤
UNITY_TABLE_FIELD_FILTER = ["cs", "c", "CS", "C"]# 服务器表格字段的过滤
SERVER_TABLE_FIELD_FILTER = ["cs", "s", "CS", "S"]# key的修饰符名字
KEY_MODIFIER_NAME = "KEY"# --------------------------------Unity--------------------------------# 数据文件名
DataFileName = "Tables.bytes"# 数据生成路径
UnityDataDir = "./../BilliardGame/Assets/Res/Tables/"# 代码生成路径
UnityCodeDir = "./../BilliardGame/Assets/Scripts/Billiard/Plugin/TableGenerate/"# --------------------------------Go--------------------------------# 数据文件名
JsonFileName = "table.json"# 代码生成路径
GoCodeDir = "./"

Excel2Unity.py

import os
import xlrd
from Config import EXCEL_DIR
from Config import EXCEL_EXT
from Config import UNITY_TABLE_FIELD_FILTER
from Config import UnityDataDir
from ConfigDataGen import ConfigDataGen
from UnityCodeGen import  UnityCodeGenclass Excel2Unity:# 构造函数def __init__(self):self.mExcelFiles = []  # 所有的excel文件# 外部处理函数def Process(self):self.RecursiveSearchExcel(EXCEL_DIR)self.ProcessExcelExportUnity()# 递归查找文件def RecursiveSearchExcel(self, path):for pathdir in os.listdir(path):  # 遍历当前目录fullpath = os.path.join(path, pathdir)if os.path.isdir(fullpath):self.RecursiveSearchExcel(fullpath)elif os.path.isfile(fullpath):if os.path.splitext(fullpath)[1] == EXCEL_EXT:self.mExcelFiles.append(fullpath)# 处理excel文件def ProcessExcelExportUnity(self):allbytesdata = bytes()# 处理每个文件for filename in self.mExcelFiles:print("导出Unity-文件名:%s" %filename)data = xlrd.open_workbook(filename)table = data.sheets()[0]fields = self.FilterFieldData(table, UNITY_TABLE_FIELD_FILTER)#增加多语言配置languageKeys = ["EN"]languageTables = []for x in data.sheets():if x != table and x.name in languageKeys:languageTables.append(x)# 数据cfgbytes = ConfigDataGen.Process(fields, table, languageTables)allbytesdata += cfgbytes# 代码UnityCodeGen.Process(filename, fields, table, languageTables)# 后处理ConfigDataGen.Save(allbytesdata, UnityDataDir)UnityCodeGen.GenConfigMangerCode(self.mExcelFiles)# 筛选字段数据def FilterFieldData(self, table, fieldfilter):fields = []for index in range(table.ncols):row = table.cell(1, index).valuefor field in fieldfilter:if row == field:fields.append(index)return fields

UnityCodeGen.py


import os
from FieldFormat import FieldFormat
from Config import KEY_MODIFIER_NAME
from Config import EXCEL_DIR
from Config import UnityCodeDir
class UnityCodeGen:@staticmethoddef Tab(count):return "    " * count;# 代码生成函数@staticmethoddef Process(filepath, fields, table, languageTables):# -----------------------table cfg class-----------------------filecontent = "\n"filecontent += "//-----------------------------------------------\n"filecontent += "//              生成代码不要修改\n"filecontent += "//-----------------------------------------------\n"filecontent += "\n"filecontent += "using System.Collections.Generic;\n"filecontent += "using System.IO;\n"filecontent += "using System.Text;\n"filecontent += "using UnityEngine;\n"filecontent += "\n"tablebasename = os.path.basename(filepath)tablebasename = tablebasename.split(".")[0]tablebasename = tablebasename.split("_")[0]tableclassname = tablebasename + "Cfg"filecontent += "public class " + tableclassname + "\n"filecontent += "{\n"for index in fields:fielddesc = table.cell(0, index).valuefieldtype = table.cell(2, index).valuefieldname = table.cell(3, index).valuefieldvar = FieldFormat.Type2format[fieldtype][1]filecontent += UnityCodeGen.Tab(1) + "public " + fieldvar + " " + fieldname + ";"filecontent += UnityCodeGen.Tab(1) + "//		" + fielddesc + "\n"for x in languageTables:for xcol in range(x.ncols):if x.cell(3, xcol).value == table.cell(3, index).value :filecontent += UnityCodeGen.Tab(1) + "public " + "string" + " " + x.name + fieldname + ";"filecontent += UnityCodeGen.Tab(1) + "//        " + fielddesc + "\n"  # Deserialize函数filecontent += "\n"filecontent += UnityCodeGen.Tab(1) + "public void Deserialize (DynamicPacket packet)\n"filecontent += UnityCodeGen.Tab(1) + "{\n"for index in fields:fielddesc = table.cell(0, index).valuefieldtype = table.cell(2, index).valuefieldname = table.cell(3, index).valuefieldfunc = FieldFormat.Type2format[fieldtype][2]filecontent += UnityCodeGen.Tab(2) + fieldname + " = " + fieldfunc + ";\n"for x in languageTables:for xcol in range(x.ncols):if x.cell(3, xcol).value == table.cell(3, index).value :filecontent += UnityCodeGen.Tab(2) + x.name + fieldname + " = " + fieldfunc + ";\n"filecontent += UnityCodeGen.Tab(1) + "}\n"transposed = {}if len(languageTables) > 0:for i in range(languageTables[0].ncols):new_row = []for sheet in languageTables:new_row.append(sheet.name)transposed[languageTables[0].cell(3, i).value] = new_row for name in transposed:filecontent += UnityCodeGen.Tab(1) + "public string Get{0}\n".format(name,tableclassname)filecontent += UnityCodeGen.Tab(1) + "{\n"filecontent += UnityCodeGen.Tab(2) + "get\n"filecontent += UnityCodeGen.Tab(2) + "{\n"filecontent += UnityCodeGen.Tab(3) + "if(MultilingualUtil.CurrentLanguage == 0)\n"filecontent += UnityCodeGen.Tab(3) + "{\n"filecontent += UnityCodeGen.Tab(4) + "return {0};\n".format(name)filecontent += UnityCodeGen.Tab(3) + "}\n"for index in range(len(transposed[name])):filecontent += UnityCodeGen.Tab(3) + "if(MultilingualUtil.CurrentLanguage == (LANGUAGE_TYPE){0})\n".format(index+1)filecontent += UnityCodeGen.Tab(3) + "{\n"filecontent += UnityCodeGen.Tab(4) + "return {0};\n".format(transposed[name][index] + name)filecontent += UnityCodeGen.Tab(3) + "}\n"filecontent += UnityCodeGen.Tab(3) + "return null;\n"filecontent += UnityCodeGen.Tab(2) + "}\n"filecontent += UnityCodeGen.Tab(1) + "}\n"filecontent += "}\n"# -----------------------table cfg manager class-----------------------filecontent += "\n"tableclassmgrname = tablebasename + "CfgMgr"filecontent += "public class " + tableclassmgrname + "\n"filecontent += "{\n"filecontent += UnityCodeGen.Tab(1) + "private static " + tableclassmgrname + " mInstance;\n"filecontent += UnityCodeGen.Tab(1) + "\n"filecontent += UnityCodeGen.Tab(1) + "public static " + tableclassmgrname + " Instance\n"filecontent += UnityCodeGen.Tab(1) + "{\n"filecontent += UnityCodeGen.Tab(2) + "get\n"filecontent += UnityCodeGen.Tab(2) + "{\n"filecontent += UnityCodeGen.Tab(3) + "if (mInstance == null)\n"filecontent += UnityCodeGen.Tab(3) + "{\n"filecontent += UnityCodeGen.Tab(4) + "mInstance = new " + tableclassmgrname + "();\n"filecontent += UnityCodeGen.Tab(3) + "}\n"filecontent += UnityCodeGen.Tab(3) + "\n"filecontent += UnityCodeGen.Tab(3) + "return mInstance;\n"filecontent += UnityCodeGen.Tab(2) + "}\n"filecontent += UnityCodeGen.Tab(1) + "}\n"# 获得keylistkeylist = []for index in fields:value = table.cell(4, index).valueif value == KEY_MODIFIER_NAME:keylist.append(index)# 根据keylist判断keylen = keylist.__len__()uselist = (keylen != 1)filecontent += "\n"if uselist:filecontent += UnityCodeGen.Tab(1) + "private List<{0}> mList = new List<{0}>();\n".format(tableclassname)else:fieldtype = table.cell(2, keylist[0]).valuekeytype = FieldFormat.Type2format[fieldtype][1]filecontent += UnityCodeGen.Tab(1) + "private Dictionary<{0}, {1}> mDict = new Dictionary<{0}, {1}>();\n".format(keytype, tableclassname)filecontent += UnityCodeGen.Tab(1) + "\n"if uselist:filecontent += UnityCodeGen.Tab(1) + "public List<{0}> List\n".format(tableclassname)else:filecontent += UnityCodeGen.Tab(1) + "public Dictionary<{0}, {1}> Dict\n".format(keytype, tableclassname)filecontent += UnityCodeGen.Tab(1) + "{\n"if uselist:filecontent += UnityCodeGen.Tab(2) + "get {return mList;}\n"else:filecontent += UnityCodeGen.Tab(2) + "get {return mDict;}\n"filecontent += UnityCodeGen.Tab(1) + "}\n"# Deserialize函数filecontent += "\n"filecontent += UnityCodeGen.Tab(1) + "public void Deserialize (DynamicPacket packet)\n"filecontent += UnityCodeGen.Tab(1) + "{\n"filecontent += UnityCodeGen.Tab(2) + "int num = (int)packet.PackReadInt32();\n"filecontent += UnityCodeGen.Tab(2) + "for (int i = 0; i < num; i++)\n"filecontent += UnityCodeGen.Tab(2) + "{\n"filecontent += UnityCodeGen.Tab(3) + tableclassname + " item = new " + tableclassname + "();\n"filecontent += UnityCodeGen.Tab(3) +  "item.Deserialize(packet);\n"if uselist:filecontent += UnityCodeGen.Tab(3) + "mList.Add(item);\n"else:keyname = table.cell(3, keylist[0]).valuefilecontent += UnityCodeGen.Tab(3) + "if (mDict.ContainsKey(item.{0}))\n".format(keyname)filecontent += UnityCodeGen.Tab(3) + "{\n"filecontent += UnityCodeGen.Tab(4) + "mDict[item.{0}] = item;\n".format(keyname)filecontent += UnityCodeGen.Tab(3) + "}\n"filecontent += UnityCodeGen.Tab(3) + "else\n"filecontent += UnityCodeGen.Tab(3) + "{\n"filecontent += UnityCodeGen.Tab(4) + "mDict.Add(item.{0}, item);\n".format(keyname)filecontent += UnityCodeGen.Tab(3) + "}\n"filecontent += UnityCodeGen.Tab(2) + "}\n"filecontent += UnityCodeGen.Tab(1) + "}\n"#  GetData函数if keylen == 1:     # 有一个key值使用dict取值fieldtype = table.cell(2, keylist[0]).valuekeytype = FieldFormat.Type2format[fieldtype][1]keyname = table.cell(3, keylist[0]).valuefilecontent += UnityCodeGen.Tab(1) + "\n"filecontent += UnityCodeGen.Tab(1) + "public {0} GetDataBy{1}({2} {3})\n".format(tableclassname, keyname, keytype, keyname.lower())filecontent += UnityCodeGen.Tab(1) + "{\n"filecontent += UnityCodeGen.Tab(2) + "if(mDict.ContainsKey({0}))\n".format(keyname.lower())filecontent += UnityCodeGen.Tab(2) + "{\n"filecontent += UnityCodeGen.Tab(3) + "return mDict[{0}];\n".format(keyname.lower())filecontent += UnityCodeGen.Tab(2) + "}\n"filecontent += UnityCodeGen.Tab(2) + "\n"filecontent += UnityCodeGen.Tab(2) + "return null;\n"filecontent += UnityCodeGen.Tab(1) + "}\n"elif keylen > 1:    # 有多个key值filecontent += UnityCodeGen.Tab(1) + "\n"filecontent += UnityCodeGen.Tab(1) + "public " + tableclassname + " GetDataBy"keycount = 0for keyindex in keylist:keyval = table.cell(3, keyindex).valuefilecontent += keyvalif keycount < (keylen - 1):filecontent += "And"keycount += 1filecontent += "("keycount = 0for keyindex in keylist:keytype = table.cell(2, keyindex).valuekeytype = FieldFormat.Type2format[keytype][1]keyval = table.cell(3, keyindex).valuekeyval = keyval.lower()filecontent += keytype + " " + keyvalif keycount < (keylen - 1):filecontent += ", "keycount += 1filecontent += ")\n"filecontent += UnityCodeGen.Tab(1) + "{\n"filecontent += UnityCodeGen.Tab(2) + "foreach (" + tableclassname + " data in mList)\n"filecontent += UnityCodeGen.Tab(2) + "{\n"filecontent += UnityCodeGen.Tab(3) + "if ("keycount = 0for keyindex in keylist:keyval1 = table.cell(3, keyindex).valuekeyval2 = keyval1.lower()filecontent += "data." + keyval1 + " == " + keyval2if keycount < (keylen - 1):filecontent += " && "keycount += 1filecontent += ")\n"filecontent += UnityCodeGen.Tab(3) + "{\n"filecontent += UnityCodeGen.Tab(4) + "return data;\n"filecontent += UnityCodeGen.Tab(3) + "}\n"filecontent += UnityCodeGen.Tab(2) + "}\n"filecontent += UnityCodeGen.Tab(2) + "\n"filecontent += UnityCodeGen.Tab(2) + "return null;\n"filecontent += UnityCodeGen.Tab(1) + "}\n"for name in transposed:filecontent += UnityCodeGen.Tab(1) + "public string GetMultiLang{0}({1} cfg)\n".format(name,tableclassname)filecontent += UnityCodeGen.Tab(1) + "{\n"filecontent += UnityCodeGen.Tab(2) + "if(MultilingualUtil.CurrentLanguage == 0)\n"filecontent += UnityCodeGen.Tab(2) + "{\n"filecontent += UnityCodeGen.Tab(3) + "return cfg.{0};\n".format(name)filecontent += UnityCodeGen.Tab(2) + "}\n"for index in range(len(transposed[name])):filecontent += UnityCodeGen.Tab(2) + "if(MultilingualUtil.CurrentLanguage == (LANGUAGE_TYPE){0})\n".format(index+1)filecontent += UnityCodeGen.Tab(2) + "{\n"filecontent += UnityCodeGen.Tab(3) + "return cfg.{0};\n".format(transposed[name][index] + name)filecontent += UnityCodeGen.Tab(2) + "}\n"filecontent += UnityCodeGen.Tab(2) + "return null;\n"filecontent += UnityCodeGen.Tab(1) + "}\n"filecontent += "}\n"# 保存path = filepath.replace(EXCEL_DIR, "")path = UnityCodeDir + pathpath = os.path.splitext(path)[0]path = path.split("_")[0]path = path + "Cfg" + ".cs"# 生成文件目录, 不重复创建目录filedir = os.path.dirname(path)if os.path.exists(filedir) == False:os.makedirs(filedir)file = open(path, "wb")file.write(filecontent.encode())file.close()# 生成配置管理类@staticmethoddef GenConfigMangerCode(files):path = UnityCodeDir + "ConfigManager.cs"filecontent = "\n"filecontent += "//-----------------------------------------------\n"filecontent += "//              生成代码不要修改\n"filecontent += "//-----------------------------------------------\n"filecontent += "\n"filecontent += "using System.Collections;\n"filecontent += "using System.Collections.Generic;\n"filecontent += "using UnityEngine;\n"filecontent += "using System.IO;\n"filecontent += "\n"filecontent += "public class ConfigManager\n"filecontent += "{\n"# 生成字段for file in files:tablebasename = os.path.basename(file)tablebasename = tablebasename.split(".")[0]tablebasename = tablebasename.split("_")[0]filecontent += UnityCodeGen.Tab(1) + "public static " + tablebasename + "CfgMgr "filecontent += "_"+tablebasename+"CfgMgr"filecontent += " = " +tablebasename+"CfgMgr.Instance; \n"# Deserialize函数filecontent += UnityCodeGen.Tab(1) + "private static void Deserialize(DynamicPacket dynamicPacket)\n"filecontent += UnityCodeGen.Tab(1) + "{\n"for file in files:tablebasename = os.path.basename(file)tablebasename = tablebasename.split(".")[0]tablebasename = tablebasename.split("_")[0]filecontent += UnityCodeGen.Tab(2) + tablebasename + "CfgMgr.Instance.Deserialize(dynamicPacket);\n"filecontent += UnityCodeGen.Tab(1) + "}\n"# LoadCsv函数filecontent += UnityCodeGen.Tab(1) + "\n"filecontent += UnityCodeGen.Tab(1) + "public static void LoadConfig(string cfgdatapath)\n"filecontent += UnityCodeGen.Tab(1) + "{\n"filecontent += UnityCodeGen.Tab(2) + "FileStream fileStream = new FileStream(cfgdatapath, FileMode.Open, FileAccess.Read);\n"filecontent += UnityCodeGen.Tab(2) + "BinaryReader binaryReader = new BinaryReader(fileStream);\n"filecontent += UnityCodeGen.Tab(2) + "int cnt = binaryReader.ReadInt32();\n"filecontent += UnityCodeGen.Tab(2) + "byte[] bytes = binaryReader.ReadBytes(cnt);\n"filecontent += UnityCodeGen.Tab(2) + "DynamicPacket dynamicPacket = new DynamicPacket(bytes);\n"filecontent += UnityCodeGen.Tab(2) + "Deserialize(dynamicPacket);\n"filecontent += UnityCodeGen.Tab(2) + "binaryReader.Close();\n"filecontent += UnityCodeGen.Tab(2) + "fileStream.Close();\n"filecontent += UnityCodeGen.Tab(1) + "}\n"# LoadCsv函数filecontent += UnityCodeGen.Tab(1) + "\n"filecontent += UnityCodeGen.Tab(1) + "public static void LoadConfig(byte[] bytes)\n"filecontent += UnityCodeGen.Tab(1) + "{\n"filecontent += UnityCodeGen.Tab(2) + "byte[] newBytes = new byte[bytes.Length];\n"filecontent += UnityCodeGen.Tab(2) + "for (int i = 4; i < bytes.Length; i++)\n"filecontent += UnityCodeGen.Tab(2) + "{\n"filecontent += UnityCodeGen.Tab(3) + "newBytes[i - 4] = bytes[i];\n"filecontent += UnityCodeGen.Tab(2) + "}\n"filecontent += UnityCodeGen.Tab(2) + "DynamicPacket dynamicPacket = new DynamicPacket(newBytes);\n"filecontent += UnityCodeGen.Tab(2) + "Deserialize(dynamicPacket);\n"filecontent += UnityCodeGen.Tab(1) + "}\n"filecontent += "}\n"# 保存file = open(path, "wb")file.write(filecontent.encode())file.close()

完整项目链接:https://github.com/dazhu-z/UnityExcelTool

如果遇到打开文件失败类的问题

可以先创建对应文件夹

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

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

相关文章

Hive基础知识(十九):Hive 自定义函数

1. 自定义函数 1&#xff09;Hive 自带了一些函数&#xff0c;比如&#xff1a;max/min 等&#xff0c;但是数量有限&#xff0c;自己可以通过自定义 UDF 来方便的扩展。 2&#xff09;当 Hive 提供的内置函数无法满足你的业务处理需要时&#xff0c;此时就可以考虑使用用户自…

xcode15 升级大坑

Q&#xff1a;iOS17 SDK 模拟器 7个多G,一直安装失败&#xff0c;都是网络中断&#xff0c;试了第六次竟然硬生生下载并安装成功。如果实在不成功尝试一下步骤&#xff1a; 1.直接在Apple官网找到你要下载的文件&#xff0c;https://developer.apple.com/download/all/ 2.下…

golang常用库之-godotenv库从.env文件读取配置数据

文章目录 golang常用库之-从.env文件读取配置数据godotenv库使用 golang常用库之-从.env文件读取配置数据 godotenv库从.env文件中读取配置&#xff0c; 然后存储到程序的环境变量中。在代码中可以使用读取非常方便。 godotenv库 官方&#xff1a;https://pkg.go.dev/github…

图的搜索。

用邻接表作为图的存储结构建立一个图&#xff0c;并对此图分别进行深度优先搜索和广度优先搜索遍历。 #include<stdio.h> #include<stdlib.h> #define MAX_VERTEM_NUM 10 #define INFINITY 32768 typedef enum{ DG,DN,UDG,UDN }graghKind; //digraph D…

【AI应用探讨】—小型神经网络应用场景

目录 1. 移动设备 2. 物联网设备 3. 无人驾驶 4. 可穿戴设备 5. 其他领域 1. 移动设备 a. 图像识别 用例&#xff1a;在智能手机和平板电脑上运行的实时图像识别应用&#xff0c;如人脸识别、物体识别等。优势&#xff1a;小型神经网络能够在这些设备上快速运行&#xff…

Visual Studio Code 配置 java/maven 环境(Windows版)

在Windows版Visual Studio Code&#xff08;VS Code&#xff09;中配置Java和Maven环境&#xff0c;可以按照以下步骤进行&#xff1a; 1. 安装JDK 确保已经安装了JDK 8或更高版本。建议访问Oracle官网或OpenJDK官网下载相应版本的JDK。安装JDK后&#xff0c;配置系统环境变量…

OpenFeign 的请求处理流程

流程 1. 定义 Feign 客户端接口 首先&#xff0c;开发者需要定义一个 Feign 客户端接口&#xff0c;并使用 FeignClient 注解进行配置。例如&#xff1a; FeignClient(name "aService", url "http://localhost:8080") public interface ServiceProvid…

Python | Leetcode Python题解之第169题多数元素

题目&#xff1a; 题解&#xff1a; class Solution:def majorityElement(self, nums: List[int]) -> int:count 0candidate Nonefor num in nums:if count 0:candidate numcount (1 if num candidate else -1)return candidate

linux下编译安装python3

目录 一、注意事项 二、安装前依赖安装 三、下载python3 四、编译安装 五、查看是否安装成功 一、注意事项 linux下一般会自带python2&#xff0c;很多程序会依赖python2,所以要在python2基础上安装python3 二、安装前依赖安装 yum -y install zlib* yum install libffi-d…

Jotai-灵活的、细粒度的 React 状态管理库

一、Jotai是什么&#xff1f; Jotai 是一个用于 React 的轻量级状态管理库&#xff0c;名字来源于日语中的 "状態" (Jōtai)&#xff0c;意思是“状态”。它的设计目标是提供一种简单、灵活且强大的方式来管理 React 应用中的状态&#xff0c;特别适合处理复杂的状态…

【漏洞复现】用友 U9 PatchFile.asmx 任意文件上传漏洞

免责声明&#xff1a; 本文内容旨在提供有关特定漏洞或安全漏洞的信息&#xff0c;以帮助用户更好地了解可能存在的风险。公布此类信息的目的在于促进网络安全意识和技术进步&#xff0c;并非出于任何恶意目的。阅读者应该明白&#xff0c;在利用本文提到的漏洞信息或进行相关测…

幂等的实现方案

幂等在开发中的概念 对于同一个系统&#xff0c;在同样条件下&#xff0c;一次请求和重复多次请求对资源的影响是一致的&#xff0c;就称该操作为幂等的。 常见的幂等的例子 银行系统中&#xff0c;一笔转账应当只扣一次钱。 商城系统中&#xff0c;一个订单只能提交一次&a…

PostgreSQL逻辑备份-pg_dumpall

pg_dumpall 用于将所有数据库转储到一个文本文件中。该文本文件包含可用作恢复数据 库的 SQL 命令。它通过为集群中的每个数据库调用 pg_dump 来做到这一点。 pg_dumpall 还转储所有数据库共有的全局对象&#xff0c;即数据库角色和表空间&#xff08;pg_dump 不 保存这些对…

LeetCode刷题(739/496/503)/华为od转盘寿司-单调栈

739.每日温度 给定一个整数数组 temperatures &#xff0c;表示每天的温度&#xff0c;返回一个数组 answer &#xff0c;其中 answer[i] 是指对于第 i 天&#xff0c;下一个更高温度出现在几天后。如果气温在这之后都不会升高&#xff0c;请在该位置用 0 来代替。 示例 1: 输…

IDEA引入本地jar包的两种方法(idea程序引入和maven)_idea 引入jar-CSDN博客

IDEA引入本地jar包的两种方法&#xff08;idea程序引入和maven&#xff09;_idea 引入jar-CSDN博客

互联网应用主流框架整合之Spring Boot开发

Spring Boot数据库开发 通常SpringBoot数据库开发&#xff0c;会引入spring-boot-starter-jdbc&#xff0c;而如果引入了spring-boot-starter-jdbc&#xff0c;但没有可用的数据源或者没有配置&#xff0c;那么在运行Spring Boot时会出现异常&#xff0c;因为spring-boot-star…

微积分-导数2(导数函数)

在前面的部分中&#xff0c;我们考虑了函数 f f f在固定点 a a a处的导数&#xff1a; f ′ ( a ) lim ⁡ h → 0 f ( a h ) − f ( a ) h \begin{equation}f(a) \lim_{h \to 0} \frac{f(ah) - f(a)}{h}\end{equation} f′(a)h→0lim​hf(ah)−f(a)​​​ 如果我们将等式中…

Activity中Window与View的关系

本文主要记录在Activity中View与Window相互作用关系&#xff0c;以及如何管理Window的展示、删除和更新。 创建Window ActivityThread收到launchActivity消息后&#xff0c;会调用performLaunchActivity方法开始创建Activity相关流程 private Activity performLaunchActivit…

服务器“雪崩”的常见原因和解决方法 (C++)

在C服务器编程中&#xff0c;"雪崩"现象指的是服务器在高并发请求的情况下&#xff0c;由于资源&#xff08;如线程、文件描述符、内存等&#xff09;耗尽或锁争用等问题&#xff0c;导致服务器性能急剧下降&#xff0c;甚至完全失去响应的情况。这种现象会连带影响其…

Redis持久化(RDB、AOF)详解

Redis持久化详解 一、Redis为什么需要持久化&#xff1f; Redis 是一个基于内存的数据库&#xff0c;拥有极高的读写性能&#xff0c;但是内存中的数据在断电或服务器重启时会全部丢失&#xff0c;因此需要一种持久化机制来将数据保存到硬盘上&#xff0c;以便在需要时进行恢复…