mongodb清理删除历史数据
批量清理mongodb历史数据
清理程序的原来
-
目前项目组上很多平台上线历史数据积压,导致入库查询数据缓慢,历史数据有些已经归档,进行历史数据清理删除。 -
之前临时写shell脚本,太简陋,重新使用Python进行改造,新增备份功能,和配置文件删除指定字段和时间范围内数据。
代码篇
#!/usr/local/python3/bin/python3
import configparser,logging.config,sys,os,subprocess
import pymongo,ast
# from pymongo import MongoClient
from datetime import datetime,timedelta
from urllib import parse
def init_mongodb(MongoDBAuth):
if mongodb_auth:
username = parse.quote_plus(mongodb_user)
password = parse.quote_plus(mongodb_passwd)
ConnPasswd = "mongodb://" + username + ":" + password + "@" + mongodb_ip + ":" + mongodb_port + "/"
try:
clients = pymongo.MongoClient(ConnPasswd)
logger.info("init mongodb conn: " + ConnPasswd)
return clients
except Exception as e:
logger.info("use mongodb user pass conn err: " + str(e))
return False
else:
try:
clients = pymongo.MongoClient(mongodb_ip, int(mongodb_port))
logger.info("init mongodb conn: " + mongodb_ip +":" +mongodb_port)
return clients
except Exception as e:
logger.info("use mongodb user pass conn err: " + str(e))
return False
#查看出全部db
def get_mongodb_dbname():
db_names_list = []
db_names = mongo_client.list_database_names()
for db_name in db_names:
db_names_list.append(db_name)
for filter_dbname in need_filter_dbname_list:
if filter_dbname in db_names_list:
db_names_list.remove(filter_dbname)
logger.info("delete need filter dbname: " + filter_dbname)
# logger.info("get all db_name: " +str(db_names_list))
return db_names_list
#查询出db中全部表
def get_mongodb_tables(entid):
db_collections_list = []
db=mongo_client[entid]
collections = db.list_collection_names()
for collection in collections:
db_collections_list.append(collection)
logger.debug("get " + entid + " all collections: " +str(db_collections_list))
return db_collections_list
#查询集合中索引索引和是否分片
def get_index_key_tables(entid,collection_name):
index_list = []
formatted_results = []
db=mongo_client[entid]
collection=db[collection_name]
indexes = collection.list_indexes()
ns_name = entid + "." + collection_name
for result in indexes:
formatted_result = {k.upper(): v for k, v in result.items()}
each_key = formatted_result.get("KEY")
ns_name = formatted_result.get("NS")
ok_index = {key: value for key, value in each_key.items()}
index_list.append(ok_index)
index_list = result = [d for d in index_list if not (isinstance(d, dict) and '_id' in d and d['_id'] == 1)]
collection_stats = db.command("collstats", collection_name)
collection_sharded = collection_stats.get("sharded", False)
if len(index_list) != 0:
logger.debug("get collection " + ns_name + " index: " +str(index_list))
#logger.info("get now In the collection " + ns_name + " sharded status: " +str(collection_sharded))
return index_list,collection_sharded
#创建集合索引
def craete_index(entid,collection_name,index):
db=mongo_client[entid]
collection=db[collection_name]
logger.info("need craete index: " + entid +"."+collection_name + " : "+ str(index))
# index = (list(index.keys())[0], list(index.values())[0])
index = [(k, v) for k, v in index.items()]
result = collection.create_index(index)
logger.info("mongodb " +entid +"."+collection_name + " create index return msg: " + str(result) )
#查看对应dbname是否已经是shards,弃用
def is_database_sharded(database_name):
db = mongo_client["admin"]
sharded_databases = db.command("listshards")["shards"]
for shard in sharded_databases:
if database_name in db.command("listdatabases")["databases"]:
return True
return False
#创建分片索引片键
def create_sharded_func(entid, collection_name, shard_key):
db = mongo_client["admin"]
collection_path = '{}.{}'.format(entid, collection_name)
logger.info("need craete sharded key : " + collection_path + " : " + str(shard_key))
sharding_colunm,sharding_type = "",""
for key, value in shard_key.items():
sharding_colunm= key
sharding_type = value
try:
db.command('enableSharding', entid)
except Exception as e:
logger.error("create dbname sharded key error: return: " + str(e))
try:
result = db.command('shardCollection', collection_path,key = {sharding_colunm:sharding_type})
logger.info(entid + "." + collection_path + " create sharded key return: " + str(result))
except Exception as e:
logger.error("create sharded key error: return: " + str(e))
#读取文件获取对应索引和片键key信息
def read_file_index(index_file):
index_list = []
Shard_list = []
with open(index_file, 'r') as f:
for line in f.readlines():
line = line.replace(" ", "")
#通过mongodbShard: 来区分那个片键的可以,写
# print(line)
if "mongodbShard:" not in line:
table, key_str = line.strip().split("=")
key = ast.literal_eval(key_str)
index_list.append({table: key})
else:
Shard_key_str = line.strip().split("mongodbShard:")[1]
Shard_key_str = ast.literal_eval(Shard_key_str)
Shard_list.append(Shard_key_str)
return index_list,Shard_list
#获取多少天前的时间戳
def get_timestamp_days_ago(get_days):
# 获取当前日期和时间
now = datetime.now()
# 减去30天
date_30_days_ago = now - timedelta(days=int(get_days))
# 将结果转换为当天的整点00:00:00
date_start_of_day = date_30_days_ago.replace(hour=0, minute=0, second=0, microsecond=0)
# 将结果转换为时间戳
timestamp = int(date_start_of_day .timestamp())
return timestamp
#判断字符串类型和长度对应返回需要删除的时间字段值
def if_string_type(data_stamp):
del_timestamp = ""
get_need_del_timestamp = get_timestamp_days_ago(int(Del_day))
if isinstance(data_stamp, str) and len(data_stamp) == 10:
del_timestamp = str(get_need_del_timestamp)
if isinstance(data_stamp, str) and len(data_stamp) == 13:
del_timestamp = str(get_need_del_timestamp) + "000"
if isinstance(data_stamp, int) and len(str(data_stamp)) == 10:
del_timestamp = get_need_del_timestamp
if isinstance(data_stamp, int) and len(str(data_stamp)) == 13:
del_timestamp = int(get_need_del_timestamp) * 1000
return del_timestamp
#获取该集合中一条数据
def get_one_data(entid,collection_name):
db=mongo_client[entid]
collection=db[collection_name]
Filter_conditions_key = str(need_del_table_field)
result = collection.find_one({}, {**{Filter_conditions_key: 1}, '_id': 0})
if result and Filter_conditions_key in result:
start_time_value = result.get(Filter_conditions_key)
logger.debug("get "+ entid + "." + collection_name + " Corresponding " +Filter_conditions_key + " field value: " + str(start_time_value) )
return start_time_value
else:
# logger.info("No " +Filter_conditions_key + " field found in the document. return: " + str(result) )
return False
# 按照日期删除该集合中历史数据
def del_data(entid,collection_name,get_del_timestamp):
db=mongo_client[entid]
collection=db[collection_name]
Filter_conditions_key = str(need_del_table_field)
Filter_conditions_value = get_del_timestamp
try:
result = collection.delete_many({Filter_conditions_key: {"$lt": Filter_conditions_value}})
logger.info(entid +" run sql: db"+"."+collection_name+".remove({"+Filter_conditions_key+ ":"+"{$lt:"+str(Filter_conditions_value) +"})")
if result.deleted_count > 0:
logger.info("By date delete " + str(entid) + "." + collection_name + " less than " + str(get_del_timestamp) + " del document count: " + str(result.deleted_count))
except Exception as e:
logger.error("Error occurred while deleting documents: " + str(e))
# 删除该集合中全部历史数据
def del_all_data(entid,collection_name):
db=mongo_client[entid]
collection=db[collection_name]
try:
result = collection.delete_many({})
if result.deleted_count > 0:
logger.info(entid + " run sql: db"+"."+collection_name+".remove({})")
logger.info(entid + "." + collection_name + " del all document count: " + str(result.deleted_count))
except Exception as e:
logger.info(entid + "." + collection_name + " del all document error: " + str(result) )
# 备份数据
def dump_mongodb_data(dbname,table,not_quiet_dump,del_time):
status_info = ["1"]
if is_del_bakcup_data:
if os.path.exists(mongodump_command_path):
run_status = " && echo $?"
run_commnd = ""
if not_quiet_dump:
if mongodb_auth:
#run_commnd = mongodump_command_path + " -h " + mongodb_ip + ":" + str(mongodb_port) + " --authenticationDatabase=" +mongodb_auth_db + " -u " + mongodb_user + " -p " + mongodb_passwd + " -d " + dbname + " -c " + table + " -q '{" + need_del_table_field + ": {" + + "}}'" + " -o " + bakcup_dir_path
run_command = f"{mongodump_command_path} -h {mongodb_ip}:{mongodb_port} --authenticationDatabase={mongodb_auth_db} -u {mongodb_user} -p {mongodb_passwd} -d {dbname} -c {table} -q '{{\"{need_del_table_field}\": {{\"$lt\": \"{del_time}\"}}}}' -o {bakcup_dir_path}"
else:
# run_commnd = mongodump_command_path + " -h " + mongodb_ip + ":" + str(mongodb_port) + " -d " + dbname + " -c " + table + " -o " + bakcup_dir_path
run_commnd = f"{mongodump_command_path} -h {mongodb_ip}:{mongodb_port} -d {dbname} -c {table} -q '{{\"{need_del_table_field}\": {{\"$lt\": \"{del_time}\"}}}}' -o {bakcup_dir_path}"
else:
if mongodb_auth:
# run_commnd = mongodump_command_path + " -h " + mongodb_ip + ":" + str(mongodb_port) + " --authenticationDatabase=" +mongodb_auth_db + " -u " + mongodb_user + " -p " + mongodb_passwd + " -d " + dbname + " -c " + table + " -o " + bakcup_dir_path
run_command = f"{mongodump_command_path} -h {mongodb_ip}:{mongodb_port} --authenticationDatabase={mongodb_auth_db} -u {mongodb_user} -p {mongodb_passwd} -d {dbname} -c {table} -o {bakcup_dir_path}"
else:
# run_commnd = mongodump_command_path + " -h " + mongodb_ip + ":" + str(mongodb_port) + " -d " + dbname + " -c " + table + " -o " + bakcup_dir_path
run_commnd = f"{mongodump_command_path} -h {mongodb_ip}:{mongodb_port} -d {dbname} -c {table} -o {bakcup_dir_path}"
logger.info("run command: " + run_commnd)
try:
msg = os.popen(run_commnd + run_status)
status_info = [line.strip() for line in msg.readlines()]
logger.info("mongodump command result: " + str(status_info))
except Exception as e:
logger.error("mongodump command error: " + str(e))
else:
logger.info("mongodump command file not exists ," + mongodump_command_path)
else:
logger.debug("config file not set is_del_bakcup_data = True, not dump data")
return status_info
if __name__=="__main__":
cfgpath = "./cfg/config.ini"
conf = configparser.ConfigParser()
conf.read(cfgpath)
mongodb_ip = conf.get("main", "mongodb_ip")
mongodb_port = conf.get("main", "mongodb_port")
mongodb_auth = conf.getboolean("main", "mongodb_auth")
mongodb_user = conf.get("main", "mongodb_user")
mongodb_passwd = conf.get("main", "mongodb_passwd")
mongodb_auth_db = conf.get("main", "mongodb_auth_db")
need_filter_dbname = conf.get("main", "need_filter_dbname")
is_del_bakcup_data = conf.getboolean("main", "is_del_bakcup_data")
bakcup_dir_path = conf.get("main", "bakcup_dir_path")
mongodump_command_path = conf.get("main", "mongodump_command_path")
Del_day = conf.get("main", "Del_day")
need_del_table_field = conf.get("main", "need_del_table_field")
need_del_table_list = conf.get("main", "need_del_table_list")
need_del_table_list = [item for item in need_del_table_list.split(",") if item != '']
need_del_null_table_list = conf.get("main", "need_del_null_table_list")
need_del_null_table_list = [item for item in need_del_null_table_list.split(",") if item != '']
auth_get_entid = conf.getboolean("main", "auth_get_entid")
need_filter_dbname_list = [item for item in need_filter_dbname.split(",") if item != '']
#获取配置项
all_ent_id = conf.get("main", "ent_id")
get_dbname_list = all_ent_id.split(",")
logging.config.fileConfig("./cfg/logger.conf")
logger = logging.getLogger("rotatfile")
# 初始化 MongoDB
mongo_client = init_mongodb(mongodb_auth)
if mongo_client:
logger.info("MongoDB init successfully")
else:
logger.error("Failed to initialize MongoDB")
sys.exit(10)
if auth_get_entid:
get_dbname_list = get_mongodb_dbname()
logger.info("get all dbname list: " + str(get_dbname_list))
else:
logger.info("file get dbname list: " + str(get_dbname_list))
for dbname in get_dbname_list:
get_end_all_table = get_mongodb_tables(dbname)
for table in need_del_table_list:
get_one_data_mes = get_one_data(dbname,table)
if table in get_end_all_table:
get_index_key_tables(dbname,table)
else:
logger.error(dbname + " not have table: " + table)
continue
# break
#删除按照日期数据
if get_one_data_mes:
get_del_timestmap = if_string_type(get_one_data_mes)
if dump_mongodb_data(dbname,table,True,get_del_timestmap)[0] == '0' or is_del_bakcup_data == False:
if get_del_timestmap:
del_data(dbname,table,get_del_timestmap)
else:
logger.error("get del timestmap fail")
else:
if is_del_bakcup_data == False:
logger.error("is_del_bakcup_data seting False, dump mongodb data fail")
else:
logger.error("dump mongodb data fail, but is del backup data")
for null_table in need_del_null_table_list:
if dump_mongodb_data(dbname,null_table,False,"1")[0] == '0' or is_del_bakcup_data == False:
if null_table in get_end_all_table:
#删除全部历史数据
del_all_data(dbname,null_table)
else:
logger.error( dbname + " not have table: " + null_table)
else:
if is_del_bakcup_data == False:
logger.error("is_del_bakcup_data seting False, dump mongodb data fail")
else:
logger.error("dump mongodb data fail, but is del backup data")
mongo_client.close()
logger.info("MongoDB closed")
配置文件篇
-
该配置项大概使用说明 -
支持删除指定时间前,进行数据备份在删除,根据不同配置项进行配置; -
同理可支持不进行备份,也可以清理删除,根据不同配置项进行配置; -
根据字段来查询过滤。
-
[DEFAULT]
mongodb_ip = 10.130.47.197
mongodb_port = 40000
mongodb_auth = False
mongodb_user = admin
mongodb_passwd = test@123
mongodb_auth_db = admin
#从全部dbname中进行过滤不需要处理的dbname,使用逗号分割
need_filter_dbname = local,config,admin
#指定需要按照日期删除的集合,使用逗号分割
need_del_table_list = new_r_ags_e_back,call_detail_back
#指定需要按照日期删除的集合字段过滤
need_del_table_field = start_time
#指定清空删除的集合,使用逗号分割
need_del_null_table_list = call_duration_cache,duration_cache
[main]
#是否自动获取对应mongodb中全部dbname
auth_get_entid = False
#从配置文件中获取dbname
ent_id = 20241205,20250107
#需要删除多少天以前的数据
Del_day = 97
#是否需要备份数据
is_del_bakcup_data = False
#备份目录
bakcup_dir_path = ./data
#备份命令路径
mongodump_command_path = /home/devops/Python/Mongodb_del_history/mongodump
脚本运行
-
脚本运行
[devops@db1 Mongodb_del_history]$ tar xf Mongodb_del_history.tar.gz
[devops@db1 Mongodb_del_history]$ cd Mongodb_del_history
[devops@db1 Mongodb_del_history]$ nohup ./del_history_data &
2025-01-06 14:15:01 139749303605056 del_history_data.py:24 INFO init mongodb conn: 10.130.47.197:40000
2025-01-06 14:15:01 139749303605056 del_history_data.py:303 INFO MongoDB init successfully
2025-01-06 14:15:01 139749303605056 del_history_data.py:39 INFO delete need filter dbname: local
2025-01-06 14:15:01 139749303605056 del_history_data.py:310 INFO get all dbname list: ['0103290010', '0103290012', '0103290013', '0103290015']
2025-01-06 14:15:01 139749303605056 del_history_data.py:321 ERROR 0103290010 not have table: jhk_task_status
2025-01-06 14:15:01 139749303605056 del_history_data.py:321 ERROR 0103290010 not have table: sd_call_detail_back
2025-01-06 14:15:01 139749303605056 del_history_data.py:229 INFO run command: /home/devops/Python/Mongodb_del_history/mongodump -h 10.130.47.197:40000 -d 0103290010 -c call_duration_cache -o ./data
2025-01-06 14:15:01 139749303605056 del_history_data.py:233 INFO mongodump command result: ['0']
2025-01-06 14:15:01 139749303605056 del_history_data.py:229 INFO run command: /home/devops/Python/Mongodb_del_history/mongodump -h 10.130.47.197:40000 -d 0103290010 -c duration_cache -o ./data
2025-01-06 14:15:01 139749303605056 del_history_data.py:233 INFO mongodump command result: ['0']
2025-01-06 14:15:01 139749303605056 del_history_data.py:347 INFO MongoDB closed
二进制文件程序下载
-
使用链接下载
wget https://zhao138969.com/LinuxPackage/Python/del_history_data
本文由 mdnice 多平台发布
相关文章:
mongodb清理删除历史数据
批量清理mongodb历史数据 清理程序的原来 目前项目组上很多平台上线历史数据积压,导致入库查询数据缓慢,历史数据有些已经归档,进行历史数据清理删除。 之前临时写shell脚本,太简陋,重新使用Python进行改造,…...
C++字体库开发之字体回退策略十六
回退表 { "blocks": [ "UBLOCK_BASIC_LATIN", ], "font": { "family": "Noto Sans SC", "style": [ { "name": "Thin", …...

IO进程day3
一、思维导图 二、作业1 使用C语言编写一个简易的界面,界面如下 1:标准输出流 2:标准错误流 3:文件流 要求:按1的时候,通过printf输出数据,按2的时候,通过perror输出数据,…...

【多线程初阶篇¹】线程理解| 线程和进程的区别
目录 一、认识线程Thread 1.为啥引入线程 2.线程理解 🔥 3.面试题:线程和进程的区别 一、认识线程Thread 1.为啥引入线程 为了解决进程太重量的问题 解释(为什么说线程比进程更轻量?/为什么说线程创建/销毁开销比进程小&#…...

wireshark排除私接小路由
1.wireshark打开,发现了可疑地址,合法的地址段DHCP是192.168.100.0段的,打开后查看发现可疑地址段,分别是,192.168.0.1 192.168.1.174 192.168.1.1。查找到它对应的MAC地址。 ip.src192.168.1.1 2.通过show fdb p…...

Docker 从入门到精通
文章目录 Ubuntu 安装Docker步骤前言1. 进入Docker官网,进入开发者页面2. 选择适合自己的安装方式3. 安装 Docker1.更新系统包,安装插件,创建秘钥及目录2.安装 Docker 软件包3.设置开机启动4.通过运行 hello-world 镜像验证安装是否成功 常见…...

uni app 写的 小游戏,文字拼图?文字拼写?不知道叫啥
从下方的偏旁部首中选在1--3个组成上面文章中的文字,完成的文字标红 不喜勿喷 《满江红》 其中用到了两个文件 strdata.json parameters.json 这两个文件太大 放到资源中了 资源文件 <template><view class"wenzi_page_main"><view c…...

Qt监控系统远程网络登录/请求设备列表/服务器查看实时流/回放视频/验证码请求
一、前言说明 这几个功能是近期定制的功能,也非常具有代表性,核心就是之前登录和设备信息都是在本地,存放在数据库中,数据库可以是本地或者远程的,现在需要改成通过网络API请求的方式,现在很多的服务器很强…...

案例研究:UML用例图中的结账系统
在软件工程和系统分析中,统一建模语言(UML)用例图是一种强有力的工具,用于描述系统与其用户之间的交互。本文将通过一个具体的案例研究,详细解释UML用例图的关键概念,并说明其在设计结账系统中的应用。 用…...
二叉树的层次遍历
二叉树的层次遍历 描述 给你一个二叉树,请你返回其按 层次遍历 得到的节点值(即逐层地,从做到右访问所有节点) 代码 通过两个数组来交替打印 class Solution(object):def levelOrder(self, root):if root None:return []sta…...
docker推送本地仓库报错
(base) rootainode3:~# dp 192.168.2.186:5000/bert-deepspeed:latest The push refers to repository [192.168.2.186:5000/bert-deepspeed] Get "http://192.168.2.186:5000/v2/": dial tcp 192.168.2.186:5000: connect: connection refused排查思路如下ÿ…...
Python中的asyncio:高效的异步编程模型
随着互联网应用的快速发展,程序的响应性和处理效率成为衡量系统性能的重要指标。传统的同步编程模型在面对高并发和IO密集型任务时,常常显得捉襟见肘,难以满足现代应用的需求。Python的asyncio库作为一种高效的异步编程模型,为开发…...

Oopsie【hack the box】
Oopsie 解题流程 文件上传 首先开启机器后,我们先使用 nmap -sC -SV来扫描一下IP地址: -sC:使用 Nmap 的默认脚本扫描(通常是 NSE 脚本,Nmap Scripting Engine)。这个选项会自动执行一系列常见的脚本&am…...
详细介绍 React 中 i18n 的完整使用流程:
接下来按照步骤,让我们来完成! // 1. 首先安装必要的依赖 // npm install i18next react-i18next i18next-http-backend i18next-browser-languagedetector// 2. 创建 i18n 配置文件 (src/i18n/index.js) import i18n from i18next import { initReactI…...

部署:上传项目代码 配置数据库
一、上传代码 1、使用git 可以使用Git Clone。使用前,在服务器上也要创建秘钥对。这里的密钥对,是专门用来读取Git仓库的。 在宝塔上,点击终端。进来后,运行 ssh-keygen还是一路回车,密钥对就建好了。 接着用命令…...

C++—9、如何在Microsoft Visual Studio中调试C++
本文通过实例操作来介绍 Visual Studio 调试器的功能。调试器在运行过程中可提供许多方法让你查看代码的情况。 你可以逐步浏览代码、查看变量中存储的值、设置对变量的监视以查看值何时改变、检查代码的执行路径、查看代码分支是否正在运行等等。本实例主要是设置断点及查看内…...
11. C 语言 作用域与变量使用技巧
本章目录: 前言一、作用域的分类局部变量示例: 全局变量示例:示例: 形式参数示例: 二、作用域的细节与常见误区块级作用域示例: 静态变量与全局变量的对比示例: 未初始化变量的影响示例: 三、实…...

【机器学习案列】学生抑郁可视化及预测分析
🧑 博主简介:曾任某智慧城市类企业算法总监,目前在美国市场的物流公司从事高级算法工程师一职,深耕人工智能领域,精通python数据挖掘、可视化、机器学习等,发表过AI相关的专利并多次在AI类比赛中获奖。CSDN…...
Perl语言的循环实现
Perl语言的循环实现 引言 Perl是一种强大的脚本语言,以其灵活的语法和强大的文本处理能力著称。无论是在系统管理、网络编程,还是在Web应用开发中,Perl都广泛应用于各种领域。循环是编程语言中一个极其重要的概念,它允许程序重复…...
SpringBoot项目——使用Spark对爬虫爬取下的数据进行清洗
随着互联网信息呈爆炸式增长,爬虫技术被广泛用于从海量网页中抓取有价值的数据。然而,爬取到的数据往往存在格式不规范、重复、噪声等诸多问题,需要高效的数据清洗流程来保障数据质量,Spark 在其中发挥了关键作用。 什么是Spark …...

Swift 协议扩展精进之路:解决 CoreData 托管实体子类的类型不匹配问题(下)
概述 在 Swift 开发语言中,各位秃头小码农们可以充分利用语法本身所带来的便利去劈荆斩棘。我们还可以恣意利用泛型、协议关联类型和协议扩展来进一步简化和优化我们复杂的代码需求。 不过,在涉及到多个子类派生于基类进行多态模拟的场景下,…...

SCAU期末笔记 - 数据分析与数据挖掘题库解析
这门怎么题库答案不全啊日 来简单学一下子来 一、选择题(可多选) 将原始数据进行集成、变换、维度规约、数值规约是在以下哪个步骤的任务?(C) A. 频繁模式挖掘 B.分类和预测 C.数据预处理 D.数据流挖掘 A. 频繁模式挖掘:专注于发现数据中…...
2024年赣州旅游投资集团社会招聘笔试真
2024年赣州旅游投资集团社会招聘笔试真 题 ( 满 分 1 0 0 分 时 间 1 2 0 分 钟 ) 一、单选题(每题只有一个正确答案,答错、不答或多答均不得分) 1.纪要的特点不包括()。 A.概括重点 B.指导传达 C. 客观纪实 D.有言必录 【答案】: D 2.1864年,()预言了电磁波的存在,并指出…...

[ICLR 2022]How Much Can CLIP Benefit Vision-and-Language Tasks?
论文网址:pdf 英文是纯手打的!论文原文的summarizing and paraphrasing。可能会出现难以避免的拼写错误和语法错误,若有发现欢迎评论指正!文章偏向于笔记,谨慎食用 目录 1. 心得 2. 论文逐段精读 2.1. Abstract 2…...

04-初识css
一、css样式引入 1.1.内部样式 <div style"width: 100px;"></div>1.2.外部样式 1.2.1.外部样式1 <style>.aa {width: 100px;} </style> <div class"aa"></div>1.2.2.外部样式2 <!-- rel内表面引入的是style样…...
C++.OpenGL (10/64)基础光照(Basic Lighting)
基础光照(Basic Lighting) 冯氏光照模型(Phong Lighting Model) #mermaid-svg-GLdskXwWINxNGHso {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-GLdskXwWINxNGHso .error-icon{fill:#552222;}#mermaid-svg-GLd…...

多模态大语言模型arxiv论文略读(108)
CROME: Cross-Modal Adapters for Efficient Multimodal LLM ➡️ 论文标题:CROME: Cross-Modal Adapters for Efficient Multimodal LLM ➡️ 论文作者:Sayna Ebrahimi, Sercan O. Arik, Tejas Nama, Tomas Pfister ➡️ 研究机构: Google Cloud AI Re…...

如何理解 IP 数据报中的 TTL?
目录 前言理解 前言 面试灵魂一问:说说对 IP 数据报中 TTL 的理解?我们都知道,IP 数据报由首部和数据两部分组成,首部又分为两部分:固定部分和可变部分,共占 20 字节,而即将讨论的 TTL 就位于首…...

GC1808高性能24位立体声音频ADC芯片解析
1. 芯片概述 GC1808是一款24位立体声音频模数转换器(ADC),支持8kHz~96kHz采样率,集成Δ-Σ调制器、数字抗混叠滤波器和高通滤波器,适用于高保真音频采集场景。 2. 核心特性 高精度:24位分辨率,…...

均衡后的SNRSINR
本文主要摘自参考文献中的前两篇,相关文献中经常会出现MIMO检测后的SINR不过一直没有找到相关数学推到过程,其中文献[1]中给出了相关原理在此仅做记录。 1. 系统模型 复信道模型 n t n_t nt 根发送天线, n r n_r nr 根接收天线的 MIMO 系…...