将Sqlite3数据库挂在内存上处理

news2025/2/23 21:29:54

创作灵感:最近把小学生的口算题从2位数改到3位数,100以内四则运算练习(千纬数学)再次更新,选取难题-CSDN博客要不断刷题目,以前100以内的加减乘除也是这样刷出来的,代码如下:

import sqlite3
import random
from time import time
from pathlib import Path

#导入必要的库

resources_folder = Path(__file__).joinpath("../resources/").resolve()
db_filepath = resources_folder.joinpath("qwsx.db")
#db_filepath = '/storage/emulated/0/Pictures/qwsx.db'
#上面是数据库的存放位置,生成手机app请参考我以前的文章
#oppo版 需要用电脑调试应删除下面5行

def gettid(s1,fh,s2,dan):
    conn = sqlite3.connect(db_filepath, timeout=10, check_same_thread=False)
    c = conn.cursor()
    #如果公式存在,提取tid
    cursor = c.execute("SELECT count(tid) from ys where s1 = ? and fh = ? and s2 = ?;", (s1,fh,s2,))
    row = cursor.fetchone()
    ctid = row[0]
    #如果公式不存在,插入公式到数据库
    if ctid == 0:
        c.execute("INSERT INTO ys(s1,fh,s2,dan,cs,cuo) VALUES (?,?,?,?,0,0);", (s1,fh,s2,dan,))
        conn.commit()
    cursor = c.execute("SELECT tid from ys where s1 = ? and fh = ? and s2 = ? order by tid desc;", (s1,fh,s2,))
    row = cursor.fetchone()
    tid = row[0] 
    c.close()
    conn.close()
    return(tid)
#获取tid,题目的id
def settm(nd):    
    if nd ==1:
        jj = random.randint(0,1)
    elif nd ==2:
        jj = random.randint(0,3)
    if jj == 0:
        #为加法 
        s1 = random.randint(0,100)
        s2 = random.randint(0,(100 - s1))
        cvalue = str(s1) + "+" + str(s2) + "=" 
        dan = s1 + s2
        hd = 1
        tid = gettid(s1,jj,s2,dan)
        ii = random.randint(0,4) #0为提交答案
        if ii == 2:
            cvalue = "□+" + str(s2) + "=" + str(dan) + ",□为"
            dan = s1
        elif ii == 3:
            cvalue = str(s1) + "+□=" + str(dan) + ",□为"
            dan = s2
        elif ii ==4 and s2 > 0:#a+0=a,a-0=a,可以是+-
            cvalue = str(s1) + "□" + str(s2) + "=" + str(dan) + ",□为"
            dan = jj
            hd = 4 #hd4为符号
    elif jj ==1:
        s1 = random.randint(0,100)
        s2 = random.randint(0,s1)
        cvalue = str(s1) + "-" + str(s2) + "=" 
        dan = s1 - s2
        hd = 1
        tid = gettid(s1,jj,s2,dan)
        ii = random.randint(0,4) #0为提交答案
        if ii == 2:
            cvalue = "□-" + str(s2) + "=" + str(dan) + ",□为"
            dan = s1
        elif ii == 3:
            cvalue = str(s1) + "-□=" + str(dan) + ",□为"
            dan = s2
        elif ii ==4 and s2 > 0:#a+0=a,a-0=a,可以是+-
            cvalue = str(s1) + "□" + str(s2) + "=" + str(dan) + ",□为"
            dan = jj
            hd = 4 #hd4为符号
    elif jj ==2:
        #乘法
        s1 = random.randint(1,10)
        s2 = random.randint(0,int(100 / s1))
        cvalue = str(s1) + "×" + str(s2) + "="
        dan = s1 * s2
        hd = 1
        tid = gettid(s1,jj,s2,dan)
        ii = random.randint(0,4) #0为提交答案
        if ii == 2:
            cvalue = "□×" + str(s2) + "=" + str(dan) + ",□为"
            dan = s1
        elif ii == 3 and s2 > 0:#a*0=0,b*0=0
            cvalue = str(s1) + "×□=" + str(dan) + ",□为"
            dan = s2
        elif ii ==4 and s2 !=1 and s1 != 0:#a*=a,a/1=a;0*a=0,0/a=0
            cvalue = str(s1) + "□" + str(s2) + "=" + str(dan) + ",□为"
            dan = jj
            hd = 4 #hd4为符号
    elif jj ==3:
        s1 = random.randint(1,10)
        s2 = random.randint(0,int(100 / s1))
        s3 = s1
        dan = s1 * s2
        s1 = dan
        s2 = s3
        cvalue = str(s1) + "÷" + str(s2) + "=" 
        dan = int(s1 / s2)
        hd = 1
        tid = gettid(s1,jj,s2,dan)
        ii = random.randint(0,4) #0为提交答案
        if ii == 2:
            cvalue = "□÷" + str(s2) + "=" + str(dan) + ",□为"
            dan = s1
        elif ii == 3 and s1 > 0:#0/a=0
            cvalue = str(s1) + "÷□=" + str(dan) + ",□为"
            dan = s2
        elif ii ==4 and s2 !=1 and s1 !=0:#a*=a,a/1=a;0*a=0,0/a=0
            cvalue = str(s1) + "□" + str(s2) + "=" + str(dan) + ",□为"
            dan = jj
            hd = 4 #hd4为符号
    cid = 0
    return(jj,dan,hd,cid,tid,cvalue)

i = 0
while i < 1000000:
    settm(2)
    i=i+1

上面代码就是刷题100万次,让电脑随机出题。实际能够存入数据库的题目只有1万条。所以当初刷题的时候没有考虑计算机的运行效率和对资源的消耗,从上面程序看,每运行一次就要从硬盘读取数据库文件一次。这次不知道要刷题多少次才能将3位数以内的算式。问下deepseek:

官网的罢工:

用下国家超算平台DeepSeek的:

最终答案:

两个1至3位数相加或相减,得数在0到999范围内的所有算式共有 998,001 条。

再加上200以内的乘法和除法:

经过上述计算,我们得出所有满足条件的算式共有 2000 个。

除法应该在2000个以内。

下面是随机生成的代码:

import sqlite3
import random
from time import time
from pathlib import Path
import datetime
#导入必要的库

resources_folder = Path(__file__).joinpath("../resources/").resolve()
db_filepath = resources_folder.joinpath("qwsx.db")
#db_filepath = '/storage/emulated/0/Pictures/qwsx.db'
#上面是数据库的存放位置,生成手机app请参考我以前的文章
#oppo版 需要用电脑调试应删除下面5行
for j in range(0,10):
    # 连接到磁盘上的数据库
    disk_conn = sqlite3.connect(db_filepath)
    
    # 连接到内存数据库
    memory_conn = sqlite3.connect(':memory:')
    
    # 使用 backup API 将磁盘数据库复制到内存数据库
    disk_conn.backup(memory_conn)
    xt = 0
    def gettid(s1,fh,s2,dan):
        global xt
        conn = memory_conn
        c = conn.cursor()
        #如果公式存在,提取tid
        cursor = c.execute("SELECT count(tid) from ys where s1 = ? and fh = ? and s2 = ?;", (s1,fh,s2,))
        row = cursor.fetchone()
        ctid = row[0]
        #如果公式不存在,插入公式到数据库
        if ctid == 0:
            c.execute("INSERT INTO ys(s1,fh,s2,dan,cs,cuo) VALUES (?,?,?,?,0,0);", (s1,fh,s2,dan,))
            conn.commit()
            # print(s1,fh,s2,dan)
        else:
            # print('与数据库存在相同')
            xt = xt + 1
        cursor = c.execute("SELECT tid from ys where s1 = ? and fh = ? and s2 = ? order by tid desc;", (s1,fh,s2,))
        row = cursor.fetchone()
        tid = row[0] 
        c.close()
        return(tid)
    #获取tid,题目的id
    def settm(nd):    
        if nd ==1:
            jj = random.randint(0,1)
        elif nd ==2:
            jj = random.randint(0,3)
        if jj == 0:
            #为加法 
            s1 = random.randint(0,999)
            s2 = random.randint(0,(999 - s1))
            cvalue = str(s1) + "+" + str(s2) + "=" 
            dan = s1 + s2
            hd = 1
            tid = gettid(s1,jj,s2,dan)
            ii = random.randint(0,4) #0为提交答案
            if ii == 2:
                cvalue = "□+" + str(s2) + "=" + str(dan) + ",□为"
                dan = s1
            elif ii == 3:
                cvalue = str(s1) + "+□=" + str(dan) + ",□为"
                dan = s2
            elif ii == 4 and s2 > 0:#a+0=a,a-0=a,可以是+-
                cvalue = str(s1) + "□" + str(s2) + "=" + str(dan) + ",□为"
                dan = jj
                hd = 4 #hd4为符号
        elif jj ==1:
            s1 = random.randint(0,999)
            s2 = random.randint(0,s1)
            cvalue = str(s1) + "-" + str(s2) + "=" 
            dan = s1 - s2
            hd = 1
            tid = gettid(s1,jj,s2,dan)
            ii = random.randint(0,4) #0为提交答案
            if ii == 2:
                cvalue = "□-" + str(s2) + "=" + str(dan) + ",□为"
                dan = s1
            elif ii == 3:
                cvalue = str(s1) + "-□=" + str(dan) + ",□为"
                dan = s2
            elif ii ==4 and s2 > 0:#a+0=a,a-0=a,可以是+-
                cvalue = str(s1) + "□" + str(s2) + "=" + str(dan) + ",□为"
                dan = jj
                hd = 4 #hd4为符号
        elif jj ==2:
            #乘法
            s1 = random.randint(1,200)
            s2 = random.randint(0,int(200 / s1))
            cvalue = str(s1) + "×" + str(s2) + "="
            dan = s1 * s2
            hd = 1
            tid = gettid(s1,jj,s2,dan)
            ii = random.randint(0,4) #0为提交答案
            if ii == 2:
                cvalue = "□×" + str(s2) + "=" + str(dan) + ",□为"
                dan = s1
            elif ii == 3 and s2 > 0:#a*0=0,b*0=0
                cvalue = str(s1) + "×□=" + str(dan) + ",□为"
                dan = s2
            elif ii ==4 and s2 !=1 and s1 != 0:#a*=a,a/1=a;0*a=0,0/a=0
                cvalue = str(s1) + "□" + str(s2) + "=" + str(dan) + ",□为"
                dan = jj
                hd = 4 #hd4为符号
        elif jj ==3:
            s1 = random.randint(1,200)
            s2 = random.randint(0,int(200 / s1))
            s3 = s1
            dan = s1 * s2
            s1 = dan
            s2 = s3
            cvalue = str(s1) + "÷" + str(s2) + "=" 
            dan = int(s1 / s2)
            hd = 1
            tid = gettid(s1,jj,s2,dan)
            ii = random.randint(0,4) #0为提交答案
            if ii == 2:
                cvalue = "□÷" + str(s2) + "=" + str(dan) + ",□为"
                dan = s1
            elif ii == 3 and s1 > 0:#0/a=0
                cvalue = str(s1) + "÷□=" + str(dan) + ",□为"
                dan = s2
            elif ii ==4 and s2 !=1 and s1 !=0:#a*=a,a/1=a;0*a=0,0/a=0
                cvalue = str(s1) + "□" + str(s2) + "=" + str(dan) + ",□为"
                dan = jj
                hd = 4 #hd4为符号
        cid = 0
        return(jj,dan,hd,cid,tid,cvalue)
    print(datetime.datetime.now())
    i = 0
    while i < 50000:
        settm(1)
        i=i+1
    print(f'与原来数据库存在{xt}个相同。')
    print(datetime.datetime.now())
    # 将内存数据库的内容写回磁盘数据库
    memory_conn.backup(disk_conn)
    
    # 关闭连接
    disk_conn.close()
    memory_conn.close()

这样要形成一个随机的表,太慢了,运行了半天:

2025-02-12 23:19:25.515728
与原来数据库存在25585个相同。
2025-02-13 00:10:52.646772
2025-02-13 00:10:52.894585
与原来数据库存在26770个相同。
2025-02-13 01:04:37.832301
2025-02-13 01:04:38.108767
与原来数据库存在27902个相同。
2025-02-13 02:01:26.172076
2025-02-13 02:01:26.429696
与原来数据库存在28961个相同。
2025-02-13 03:01:18.825697
2025-02-13 03:01:19.081742
与原来数据库存在30000个相同。
2025-02-13 04:03:55.562965
2025-02-13 04:03:55.833989
与原来数据库存在30767个相同。
2025-02-13 05:09:20.222007
2025-02-13 05:09:20.711048
与原来数据库存在31616个相同。
2025-02-13 06:16:58.876971
2025-02-13 06:16:59.169436
与原来数据库存在32288个相同。
2025-02-13 07:27:02.256963
2025-02-13 07:27:02.546013
与原来数据库存在33187个相同。
2025-02-13 08:42:14.837606
2025-02-13 08:42:15.139579
与原来数据库存在33747个相同。
2025-02-13 09:57:30.281790

而且,接下来要生成数据库不存在的公式,将越来越少。所以不如按顺序全部生成,不用1分钟就完成:

import sqlite3
import random
from time import time
from pathlib import Path
import datetime
#导入必要的库

resources_folder = Path(__file__).joinpath("../resources/").resolve()
db_filepath = resources_folder.joinpath("qwsx.db")
#db_filepath = '/storage/emulated/0/Pictures/qwsx.db'
#上面是数据库的存放位置,生成手机app请参考我以前的文章
#oppo版 需要用电脑调试应删除下面5行

# 连接到磁盘上的数据库
disk_conn = sqlite3.connect(db_filepath)

# 连接到内存数据库
memory_conn = sqlite3.connect(':memory:')

# 使用 backup API 将磁盘数据库复制到内存数据库
disk_conn.backup(memory_conn)

def gettid(s1,fh,s2,dan):
    conn = memory_conn
    c = conn.cursor()
    #如果公式存在,提取tid
    c.execute("INSERT INTO ysall(s1,fh,s2,dan,cs,cuo) VALUES (?,?,?,?,0,0);", (s1,fh,s2,dan,))
    conn.commit()
    c.close()
    return(1)
#获取tid,题目的id
def settm(jj):
    if jj == 0:
        #为加法 
        for s1 in range(0,1000):
            for s2 in range(0,(1000 - s1)):
                dan = s1 + s2
                tid = gettid(s1,jj,s2,dan)
                cvalue = str(s1) + "+" + str(s2) + "=" + str(dan)
                print(cvalue)
    elif jj ==1:
        for s1 in range(0,1000):
            for s2 in range(0,s1 + 1):
                dan = s1 - s2
                tid = gettid(s1,jj,s2,dan)
                cvalue = str(s1) + "-" + str(s2) + "=" + str(dan)
                print(cvalue)
    elif jj ==2:
        #乘法
        for s1 in range(1,201):
            for s2 in range(0,int(200 / s1) + 1):
                dan = s1 * s2
                tid = gettid(s1,jj,s2,dan)
                cvalue = str(s1) + "×" + str(s2) + "=" + str(dan)
                print(cvalue)

    elif jj ==3:
        ii = 0
        for s1 in range(1,201):
            # print(s1)
            s3 = s1
            for s2 in range(0,int(200 / s1) + 1):
                ii = ii + 1
                # print(s3)
                dan = s1 * s2
                ss1 = dan
                ss2 = s3
                sdan = int(ss1 / ss2)
                tid = gettid(ss1,jj,ss2,sdan)
                cvalue = str(ss1) + "÷" + str(ss2) + "=" + str(sdan)
                print(cvalue)
        print(ii)
    return(jj,dan,tid,cvalue)
print(datetime.datetime.now())
settm(3)
print(datetime.datetime.now())
# 将内存数据库的内容写回磁盘数据库
memory_conn.backup(disk_conn)

# 关闭连接
disk_conn.close()
memory_conn.close()

在对这些数据进行随机写入:

# -*- coding: utf-8 -*-
"""
Created on Thu Feb 13 10:47:16 2025

@author: YBK
"""
import sqlite3
import random
from pathlib import Path

resources_folder = Path(__file__).joinpath("../resources/").resolve()
db_filepath = resources_folder.joinpath("qwsx.db")
# 连接到磁盘上的数据库
disk_conn = sqlite3.connect(db_filepath)
# 连接到内存数据库
memory_conn = sqlite3.connect(':memory:')
# 使用 backup API 将磁盘数据库复制到内存数据库
disk_conn.backup(memory_conn)

conn = memory_conn
c = conn.cursor()
#如果公式存在,提取tid
cursor = c.execute("SELECT tid from ysall;")
rows = cursor.fetchall()
ysshun = [row[0] for row in rows]
print(len(ysshun))
random.shuffle(ysshun)
for tid in ysshun:
    cursor = c.execute("SELECT s1,fh,s2,dan from ysall where tid = ?;",(tid,))
    row = cursor.fetchone()
    c.execute("INSERT INTO ys(s1,fh,s2,dan,cs,cuo) VALUES (?,?,?,?,0,0);", (row[0],row[1],row[2],row[3],))
    conn.commit()
c.close
    
# 将内存数据库的内容写回磁盘数据库
memory_conn.backup(disk_conn)

# 关闭连接
disk_conn.close()
memory_conn.close()

不用1分钟就能完成。

######################################################

因为我原来数据库有2位数的加减乘除算式,所以这次只是将3位数的算式加上去,为保留原有数据的内容,只需要对原来数据中没有的数据加上去就可以,为了提高速度,在生成随机列表后,对原有公式一致的tid删除即可,删除1万来行。

# -*- coding: utf-8 -*-
"""
Created on Thu Feb 13 10:47:16 2025

@author: YBK
"""
import sqlite3
import random
from pathlib import Path

resources_folder = Path(__file__).joinpath("../resources/").resolve()
db_filepath = resources_folder.joinpath("qwsx.db")
# 连接到磁盘上的数据库
disk_conn = sqlite3.connect(db_filepath)
# 连接到内存数据库
memory_conn = sqlite3.connect(':memory:')
# 使用 backup API 将磁盘数据库复制到内存数据库
disk_conn.backup(memory_conn)

conn = memory_conn
c = conn.cursor()
#如果公式存在,提取tid
cursor = c.execute("SELECT tid from ysall;")
rows = cursor.fetchall()
ysshun = [row[0] for row in rows]
print(len(ysshun))
random.shuffle(ysshun)
#找出所有旧数据库有的tid,在列表中删除掉
cursor = c.execute("SELECT s1,fh,s2,dan from ys;")
rows = cursor.fetchall()
for row in rows:
    s1 = row[0]
    fh = row[1]
    s2 = row[2]
    cursor = c.execute("SELECT tid from ysall where s1 = ? and fh = ? and s2 = ?;", (s1,fh,s2,))
    row = cursor.fetchone()
    if row:
        ctid = row[0]        
        ysshun.remove(ctid)
        print(f'删除{ctid}')
    else:
        print(f'{s1},{fh},{s2}不存在') 
#插入删除已经有的公式后没有的数据
for tid in ysshun:
    cursor = c.execute("SELECT s1,fh,s2,dan from ysall where tid = ?;",(tid,))
    row = cursor.fetchone()
    s1 = row[0]
    fh = row[1]
    s2 = row[2]
    dan = row[3]
    c.execute("INSERT INTO ys(s1,fh,s2,dan,cs,cuo) VALUES (?,?,?,?,0,0);", (s1,fh,s2,dan,))
    conn.commit()
c.close
    
# 将内存数据库的内容写回磁盘数据库
memory_conn.backup(disk_conn)

# 关闭连接
disk_conn.close()
memory_conn.close()

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

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

相关文章

electron.vite 项目创建以及better-sqlite3数据库使用

1.安装electron.vite npm create quick-start/electronlatest中文官网&#xff1a;https://cn.electron-vite.org/ 2. 安装项目依赖 npm i3.修改 electron-builder 配置文件 appId: com.electron.app productName: text33 directories:buildResources: build files:- !**/.v…

C++,STL容器适配器,stack:栈深入解析

文章目录 一、容器概览与核心特性核心特性速览二、底层实现原理1. 容器适配器设计2. 默认容器对比三、核心操作详解1. 容器初始化2. 元素操作接口3. 自定义栈实现四、实战应用场景1. 括号匹配校验2. 浏览器历史记录管理五、性能优化策略1. 底层容器选择基准2. 内存预分配技巧六…

Vue笔记(十)

一、AI的基本认知 二、ChatGPT的基本使用 三、AI插件--Copilot入门 1.Copilot是由OpenAI和GitHub合作开发的AI编程辅助插件&#xff0c;基于大量代码训练&#xff0c;能根据上下文自动生成代码建议。 2.安装与配置&#xff1a;在常用代码编辑器&#xff08;如Visual Studio Cod…

Ubuntu下载安装Docker-Desktop

下载 Ubuntu | Docker Docs 预备工作 Ubuntu增加docker apt库-CSDN博客 安装 sudo apt-get updatesudo apt install gnome-terminal# sudo apt install -y docker-composesudo apt-get install ./docker-desktop-amd64.deb 测试 sudo docker run hello-worldHello from D…

DeepSeek 突然来袭,AI 大模型变革的危机与转机藏在哪?

随着人工智能技术的飞速发展&#xff0c;大模型领域不断涌现出具有创新性的成果。DeepSeek 的横空出世&#xff0c;为 AI 大模型领域带来了新的变革浪潮。本文将深入探讨 DeepSeek 出现后 AI 大模型面临的危机与转机。 冲冲冲&#xff01;&#xff01;&#xff01; 目录 一、…

C#运动控制——轴IO映射

1、IO映射的作用 该功能允许用户对专用 IO 信号的硬件输入接口进行任意配置&#xff0c;比如轴的急停信号&#xff0c;通过映射以后&#xff0c;可以将所有轴的急停信号映射到某一个IO输入口上&#xff0c;这样&#xff0c;我们只要让一个IO信号有效就可以触发所有轴的急停。 进…

ArrayList、LinkedList、HashMap、HashTable、HashSet、TreeSet

集合族谱 在这些集合中&#xff0c;仅有vector和hashtable是线程安全的&#xff0c;其内部方法基本都有synchronized修饰。 ArrayList 底层采用Object数组实现&#xff0c;实现了RandomAccess接口因此支持随机访问。插入删除操作效率慢。 ArrayList需要一份连续的内存空间。 A…

DeepSeek 指导手册(入门到精通)

第⼀章&#xff1a;准备篇&#xff08;三分钟上手&#xff09;1.1 三分钟创建你的 AI 伙伴1.2 认识你的 AI 控制台 第二章&#xff1a;基础对话篇&#xff08;像交朋友⼀样学交流&#xff09;2.1 有效提问的五个黄金法则2.2 新手必学魔法指令 第三章&#xff1a;效率飞跃篇&…

2024 CyberHost 语音+图像-视频

项目&#xff1a;CyberHost: Taming Audio-driven Avatar Diffusion Model with Region Codebook Attention 音频驱动的身体动画面临两个主要挑战&#xff1a;&#xff08;1&#xff09;关键人体部位&#xff0c;如面部和手部&#xff0c;在视频帧中所占比例较小&#x…

Rasa学习笔记

一、CALM 三个关键要素&#xff1a; 业务逻辑&#xff1a;Flow&#xff0c;描述了AI助手可以处理的业务流程对话理解&#xff1a;旨在解释最终用户与助手沟通的内容。此过程涉及生成反映用户意图的命令&#xff0c;与业务逻辑和正在进行的对话的上下文保持一致。自动对话修复…

Android 系统面试问题

一.android gki和非gki的区别 Android GKI&#xff08;Generic Kernel Image&#xff09;和非GKI内核的主要区别在于内核设计和模块化程度&#xff0c;具体如下&#xff1a; 1. 内核设计 GKI&#xff1a;采用通用内核设计&#xff0c;与设备硬件分离&#xff0c;核心功能统一…

bitcoinjs学习1—P2PKH

1. 概述 在本学习笔记中&#xff0c;我们将深入探讨如何使用 bitcoinjs-lib 库构建和签名一个 P2PKH&#xff08;Pay-to-PubKey-Hash&#xff09; 比特币交易。P2PKH 是比特币网络中最常见和最基本的交易类型之一&#xff0c;理解其工作原理是掌握比特币交易构建的关键。 想要详…

【论文笔记】Are Self-Attentions Effective for Time Series Forecasting? (NeurIPS 2024)

官方代码https://github.com/dongbeank/CATS Abstract 时间序列预测在多领域极为关键&#xff0c;Transformer 虽推进了该领域发展&#xff0c;但有效性尚存争议&#xff0c;有研究表明简单线性模型有时表现更优。本文聚焦于自注意力机制在时间序列预测中的作用&#xff0c;提…

瑞芯微开发板/主板Android调试串口配置为普通串口方法 深圳触觉智能科技分享

本文介绍瑞芯微开发板/主板Android调试串口配置为普通串口方法&#xff0c;不同板型找到对应文件修改&#xff0c;修改的方法相通。触觉智能RK3562开发板演示&#xff0c;搭载4核A53处理器&#xff0c;主频高达2.0GHz&#xff1b;内置独立1Tops算力NPU&#xff0c;可应用于物联…

Redis 数据类型 Hash 哈希

在 Redis 中&#xff0c;哈希类型是指值本⾝⼜是⼀个键值对结构&#xff0c;形如 key "key"&#xff0c;value { { field1, value1 }, ..., {fieldN, valueN } }&#xff0c;Redis String 和 Hash 类型⼆者的关系可以⽤下图来表⽰。 Hash 数据类型的特点 键值对集合…

IntelliJ IDEA 2024.1.4版无Tomcat配置

IntelliJ IDEA 2024.1.4 (Ultimate Edition) 安装完成后&#xff0c;调试项目发现找不到Tomcat服务&#xff1a; 按照常规操作添加&#xff0c;发现服务插件中没有Tomcat。。。 解决方法 1、找到IDE设置窗口 2、点击Plugins按钮&#xff0c;进入插件窗口&#xff0c;搜索T…

连锁收银系统的核心架构与技术选型

在连锁门店的日常运营里&#xff0c;连锁收银系统扮演着极为重要的角色&#xff0c;它不仅承担着交易结算的基础任务&#xff0c;还关联着库存管理、会员服务、数据分析等多个关键环节。一套设计精良的核心架构与合理的技术选型&#xff0c;是保障收银系统高效、稳定运行的基础…

CSS 小技巧 —— CSS 实现 Tooltip 功能-鼠标 hover 之后出现弹层

CSS 小技巧 —— CSS 实现 Tooltip 功能-鼠标 hover 之后出现弹层 1. 两个元素实现 <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><title>纯 CSS 实现 Tooltip 功能-鼠标 hover 之后出现弹层</titl…

19.4.2 -19.4.4 新增、修改、删除数据

版权声明&#xff1a;本文为博主原创文章&#xff0c;转载请在显著位置标明本文出处以及作者网名&#xff0c;未经作者允许不得用于商业目的。 需要北风数据库的请留言自己的信箱。 19.4.2 新增数据 数据库数据的新增、修改和删除不同于查询&#xff0c;查询需要返回一个DbD…

haproxy详解笔记

一、概述 HAProxy&#xff08;High Availability Proxy&#xff09;是一款开源的高性能 TCP/HTTP 负载均衡器和代理服务器&#xff0c;用于将大量并发连接分发到多个服务器上&#xff0c;从而提高系统的可用性和负载能力。它支持多种负载均衡算法&#xff0c;能够根据服务器的…