python: more Layer Architecture and its Implementation in Python

2023-11-12

sql server:

--学生表
DROP TABLE DuStudentList
GO
create table DuStudentList
(
     StudentId INT IDENTITY(1,1) PRIMARY KEY,
     StudentName nvarchar(50),
     StudentNO varchar(50),                    --学号
     StudentBirthday datetime                  --学生生日     
  
)
go

model

"""
StudentListInfo.py
学生类
date 2023-06-16
edit: Geovin Du,geovindu, 涂聚文
ide:  PyCharm 2023.1 python 11
"""
 
import datetime
from datetime import date
import sys
import os
import Common
 
class StudentList(object):
    """
    学生实体类
    """
 
 
 
    def __init__(self,StudentId:int,StudentName:str, StudentNO:str,StudentBirthday:datetime.datetime):
        """
 
        :param StudentName:
        :param StudentNO:
        :param StudentBirthday:
        """
        self._StudentName=StudentName
        self._StudentNO=StudentNO
        self._StudentBirthday=StudentBirthday
        self._StudentId=StudentId
        self._age=0 #date.today().year-StudentBirthday.year #date.today().year-StudentBirthday.year #Common.Commond.calculateAge(date(StudentBirthday.year,StudentBirthday.month,StudentBirthday.day))
 
    def __init__(self,StudentId:int,StudentName:str, StudentNO:str,StudentBirthday:datetime.datetime,age:int):
        """
 
        :param StudentName:
        :param StudentNO:
        :param StudentBirthday:
        """
        self._StudentName=StudentName
        self._StudentNO=StudentNO
        self._StudentBirthday=StudentBirthday
        self._StudentId=StudentId
        self._age=age #date.today().year-StudentBirthday.year #date.today().year-StudentBirthday.year #Common.Commond.calculateAge(date(StudentBirthday.year,StudentBirthday.month,StudentBirthday.day))
 
    def __del__(self):
        """
 
        :return:
        """
        print(f"{self._StudentName}")
 
    def setStudentName(self,StudentName):
        """
 
        :param StudentName:
        :return:
        """
        self._StudentName = StudentName
 
 
    def getStudentName(self):
        """
 
        :return:
        """
        return self._StudentName
 
    def setStudentNO(self,StudentNO):
        """
 
        :param StudentNO:
        :return:
        """
        self._StudentNO=StudentNO
 
 
    def getStudentNO(self):
        """
 
        :return:
        """
        return self._StudentNO
 
    def setStudentId(self,StudentId):
        """
 
        :param StudentId:
        :return:
        """
        self._StudentId=StudentId
 
 
    def getStudentId(self):
        """
 
        :return:
        """
        return  self._StudentId
 
    def setStudentBirthday(self,StudentBirthday):
        """
 
        :param StudentBirthday:
        :return:
        """
        self._StudentBirthday = StudentBirthday
        dage =date.today().year-StudentBirthday.year# Common.Commond.calculate_age(StudentBirthday)
        self._age=dage
 
 
    def getStudentBirthday(self):
        """
 
        :return:
        """
        return self._StudentBirthday
 
    def setAge(self,age):
        """
 
        :param age:
        :return:
        """
        dage=1 #Common.Commond.calculate_age(StudentBirthday)
        self._age = age
 
 
    def getAge(self):
        """
 
        :return:
        """
        return self._age
 
    def __str__(self):
        """
 
        :return:
        """
        return f"{self._StudentId},{self._StudentName},{self._StudentNO},{self._StudentBirthday}{self._age}"

DAL

"""
StudentDALListDAL.py
数据业务处理层 Data Access Layer (DAL)
SQL Server 数据库操作
date 2023-06-21
edit: Geovin Du,geovindu, 涂聚文
ide: PyCharm 2023.1 python 11
"""
 
import os
import sys
from pathlib import Path
import re
import pymssql  #sql server
import Model.StudentListInfo
import UtilitieDB.MsSQLHelper
import Interface.IStudentList
 
class StudentDal(Interface.IStudentList.IStudentList):
    """
    数据业务处理层  学生
    数据库连接可以放在这里,通过配置读取数据连接参数
    """
 
    def __init__(self):
        """
        构造函数,方法
        :param strserver:
        :param struser:
        :param strpwd:
        :param strdatabase:
        """
        self._strserver = ""
        self._struser = ""
        self._strpwd = ""
        self._strdatabase =""
 
    def selectSql(self):
        """
        查询数据 self._strserver, self._struser, self._strpwd, self._strdatabase
        :return:
        """
 
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper()
        row=myms.execute('select *,DATEDIFF(hour,StudentBirthday,GETDATE())/8766 as Age from DuStudentList;')
        return row
 
    def selectSqlOrder(self,order:str)->list:
        """
 
        :param order:  studenName desc/asc
        :return:
        """
        students=[]
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper()
        strsql=f"select * from DuStudentList order by {order};"
        row=myms.execute(f'select *,DATEDIFF(hour,StudentBirthday,GETDATE())/8766 as Age from DuStudentList order by {order};')
        return row
 
    def selectIdSql(self,StudentId:int):
        """
 
        :param StudentId: 主键ID
        :return:
        """
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper()
        row=myms.execute(f'select * from DuStudentList where StudentId={StudentId};')
        return row
    def selectProc(self):
        """
        存储过程
        :return:
        """
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper()
        args = ()
        row = myms.executeCallProc("proc_Select_StudentListAll",args)
        return row
 
    def selectIdProc(self,StudentId:int):
        """
        存储过程
        :param StudentId: 主键ID
        :return:
        """
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper()
        args = (StudentId,)
        row = myms.executeCallProc('dbo.proc_Select_StudentList', args)
        return row
 
    def addSql(self,info:Model.StudentListInfo.StudentList):
        """
        添加,要考虑添加返回ID值
        :param info:学生实体类
        :return:
        """
        myms=UtilitieDB.MsSQLHelper.MsSqlHelper();
        column=("StudentName","StudentNO","StudentBirthday")
        vales=[info.getStudentName(),info.getStudentNO(),info.getStudentBirthday()]
        myms.insertByColumnaAndValues("dbo.DuStudentList",column,vales)
 
    def addProc(self,info:Model.StudentListInfo.StudentList):
        """
        添加,要考虑添加返回ID值
        :param info:学生实体类
        :return:
        """
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper();
        args=(info.getStudentName(),info.getStudentNO(),info.getStudentBirthday())
        myms.insertCallProc("dbo.proc_Insert_StudentList",args)
 
    def addOutProc(self,info:Model.StudentListInfo.StudentList):
        """
        添加,要考虑添加返回ID值
        :param info:学生实体类
        :return: 返回增加的学生的ID
        """
        id=0
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper();
        outid = pymssql.output(int)
        args = (info.getStudentName(), info.getStudentNO(), info.getStudentBirthday(),outid)
        print(args)
        id=myms.insertOutCallProc("dbo.proc_Insert_StudentListOutput", args)
        return id
    def editSql(self,info:Model.StudentListInfo.StudentList):
        """
 
        :param info:学生实体类
        :return:
        """
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper();
        args = {"StudentName":f"{info.getStudentName()}","StudentNO":f"{info.getStudentNO()}","StudentBirthday":f"{info.getStudentBirthday()}"}  #"StudentId":6
        where = f"StudentId={info.getStudentId()}" #
        #print(args,where)
        myms.updateByKeyValues("DuStudentList",where,args)
 
    def editProc(self, info: Model.StudentListInfo.StudentList):
        """
 
        :param info: 学生实体类
        :return:
        """
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper();
        args = (info.getStudentId(),info.getStudentName(),info.getStudentNO(),info.getStudentBirthday())
        myms.updateProc("[dbo].[proc_Update_StudentList]",args)
 
 
    def delSql(self,StudentId:int):
        """
        sql语句删除
        :param StudentId: 主键ID
        :return:
        """
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper();
        where={f"StudentId":StudentId}
        myms.deleteByKeyValues("DuStudentList",where)
 
    def delProc(self, studentId):
        """
        删除 存储过程 删除多个ID,后面增加
        :param StudentId: 主键ID
        :return:
        """
        myms = UtilitieDB.MsSQLHelper.MsSqlHelper();
        args =studentId
        myms.deleteProc("dbo.proc_Delete_StudentList",args)

IDAL

"""
IStudentList.py
接口层 Interface Data Access Layer
IDAL(Interface Data Access Layer)DAL的接口层
date 2023-06-19
edit: Geovin Du,geovindu, 涂聚文
ide:  PyCharm 2023.1 python 11
"""
from __future__ import annotations
from abc import ABC, abstractmethod
import os
import sys
import Model.StudentListInfo
 
class IStudentList(ABC):
    """
 
    """
 
    @classmethod
    def __subclasshook__(cls, subclass):
        return (hasattr(subclass, 'load_data_source') and
                callable(subclass.load_data_source) and
                hasattr(subclass, 'extract_text') and
                callable(subclass.extract_text) or
                NotImplemented)
 
    @abstractmethod
    def selectSql(self):
        """
 
        :return:
        """
        pass
 
    @abstractmethod
    def selectSqlOrder(self, order: str) -> list:
        """
 
        :param order:
        :return:
        """
        pass
 
    @abstractmethod
    def selectIdSql(self, StudentId: int):
        """
 
        :param StudentId:
        :return:
        """
        pass
 
    @abstractmethod
    def selectProc(self):
        """
 
        :return:
        """
        pass
 
    @abstractmethod
    def selectIdProc(self, StudentId: int):
        """
 
        :param StudentId:
        :return:
        """
        pass
 
    @abstractmethod
    def addSql(self, info: Model.StudentListInfo.StudentList):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def addProc(self, info: Model.StudentListInfo.StudentList):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def addOutProc(self, info: Model.StudentListInfo.StudentList):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def editSql(self, info: Model.StudentListInfo.StudentList):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def editProc(self, info: Model.StudentListInfo.StudentList):
        """
 
        :param info:
        :return:
        """
        pass
 
    @abstractmethod
    def delSql(self, StudentId: int):
        """
 
        :param StudentId:
        :return:
        """
        pass
 
    @abstractmethod
    def delProc(self, studentId):
        """
 
        :param studentId:
        :return:
        """
        pass

BLL

"""
StudentListBLL.py
业务层 Business Logic Layer (BLL)
date 2023-06-19
edit: Geovin Du,geovindu, 涂聚文
ide:  PyCharm 2023.1 python 11
"""
 
import os
import sys
from pathlib import Path
import re
import pymssql  #sql server
from datetime import date
import DAL.StudentListDAL
#import DAL.ConfigDAL
import Model.StudentListInfo
import Interface.IStudentList
import Factory.AbstractFactory
 
class StudentBll(object):
    """
    学生信息操作业务类
    """
 
 
    dal=Factory.AbstractFactory.AbstractFactory.createStudentList
    #dal =DAL.StudentListDAL.StudentDal() #Factory.AbstractFactory.AbstractFactory.createStudentList()#
    """
    类属性 操作DAL
    """
    def __init__(self):
        """
 
        """
        self._name = "geovindu"
 
 
 
    def __del__(self):
        print(f"{self._name}挂失了")
 
    def selectSql(cls)->list:
        """
        元组数据
        :return: list 学生列表
        """
        students = []
 
 
        data = cls.dal().selectSql()
        stus = list(data)  # 如C# 强制转换
        '''
        for a in data:
            for i in a:
                print("II",i[0],i[1],i[2],i[3],i[4])
        '''
        #print(stus)
        for ii in stus:
            for i in ii:
                students.append(Model.StudentListInfo.StudentList(i[0],i[1],i[2],i[3],i[4]))
        return students
 
    def selectSqlOrder(cls, order: str)->list:
        """
        元组数据
        :param order: studenName desc/asc
        :return:
        """
        studentsorder = []
        students=[]
        data = cls.dal().selectSqlOrder(order)
        (studentsorder) = data # 如C# 强制转换
        '''
        for i in range(len(studentsorder)):
            print("rrr",type(studentsorder[i]))
            for duobj in studentsorder[i]:
                print(type(duobj))
                print(duobj)
        '''
        for obj in studentsorder:
            for i in obj:
                students.append(Model.StudentListInfo.StudentList(i[0], i[1], i[2], i[3],i[4]))
        return students
 
 
    def selectIdSql(cls,StudentId:int)->list:
        """
 
        :param StudentId:学生ID
        :return:
        """
        students = []
        data = cls.dal().selectIdSql(StudentId)
        students=data
        for ii in students:
            for i in ii:
                students.append(Model.StudentListInfo.StudentList(i[0],i[1],i[2],i[3]))
        return students
 
 
    def selectProc(cls):
        """
 
        :return:
        """
        students=[]
        data = cls.dal().selectProc()
        for i in data:
            students.append(Model.StudentListInfo.StudentList(i[0],i[1],i[2],i[3],i[4]))
        return students
 
    def selectIdProc(cls,StudentId:int)->list:
        """
 
        :param StudentId:
        :return:
        """
        students = []
        data = cls.dal().selectIdProc(StudentId)
        for i in data:
            students.append(Model.StudentListInfo.StudentList(i[0],i[1],i[2],i[3]))
        return students
 
    def addSql(cls,info:Model.StudentListInfo.StudentList):
        """
 
        :param info:学生实体类
        :return:
        """
        cls.dal.addSql(info)
 
    def addProc(cls,info:Model.StudentListInfo.StudentList):
        """
 
        :param info:学生实体类
        :return:
        """
        #print(info)
        cls.dal().addProc(info)
 
    def addOutProc(cls,info:Model.StudentListInfo.StudentList)->int:
        """
 
        :param info: 学生实体类
        :return: 返回增加的学生ID
        """
        print(info)
        return cls.dal().addOutProc(info)
 
    def editSql(cls,info:Model.StudentListInfo.StudentList):
        """
 
        :param info:学生实体类
        :return:
        """
        #print(info)
        cls.dal().editSql(info)
 
    def editProc(cls, info: Model.StudentListInfo.StudentList):
        """
 
        :param info:学生实体类
        :return:
        """
        cls.dal().editProc(info)
 
    def delSql(cls, StudentId: int):
        """
 
        :param StudentId:
        :return:
        """
        cls.dal().delSql(StudentId)
 
    def delProc(cls, StudentId):
        """
 
        :param StudentId:
        :return:
        """
        cls.dal().delProc(StudentId)

UI

"""
StudentUI.py
读文件类
date 2023-06-24
edit: Geovin Du,geovindu, 涂聚文
ide:  PyCharm 2023.1 python 11
 
"""
 
import datetime
import sys
import os
from tkinter import ttk
from tkinter import *
from tkinter.ttk import *
from ttkbootstrap import Style  # pip install ttkbootstrap
import random
import Model.StudentListInfo
import BLL.StudentListBLL
 
class StudentUi(object):
 
    global tree
    stubll = BLL.StudentListBLL.StudentBll()
 
    def __init__(self):
        self.name="geovindu"
 
    def __del__(self):
        print(f"{self.name}")
 
    def delete(cls):
        #global tree
        curItem = cls.tree.focus()
        val=cls.tree.item(curItem)['values'][0]  #id
        print(val)
        print(cls.tree.selection())
        cls.tree.delete(cls.tree.selection())
        cls.stubll.delSql(val)  #需要删除关联的数据才可以删除
 
        #cls.stubll.delSql()
 
    def main(cls):
        """
        窗体绑定数据
        :return:
        """
 
 
        style=Style(theme='darkly') #定义窗口样式
        window=style.master
        window.title("学生管理")
        # win = Tk()
        screenWidth = window.winfo_screenwidth()
        screenHeight = window.winfo_screenheight()
        width=100
        height=600
        x=int((screenWidth-width)/2)
        y=int((screenHeight-height)/2)
        window.geometry('{}x{}+{}+{}'.format(width,height,x,y))
        #Treeview 控件
        cls.tree=ttk.Treeview(master=window,style='success.Treeview',height=25,show='headings')
        cls.tree.pack()
        #定义列
        cls.tree['columns']=("StudentId","StudentName","StudentNO","StudentBirthday","Age")
        #设置列属性,列不显示
        cls.tree.column("StudentId",width=150,minwidth=100,anchor=S)
        cls.tree.column("StudentName", width=150, minwidth=100, anchor=S)
        cls.tree.column("StudentNO", width=150, minwidth=100, anchor=S)
        cls.tree.column("StudentBirthday", width=150, minwidth=100, anchor=S)
        cls.tree.column("Age", width=150, minwidth=100, anchor=S)
        #设置表头
        cls.tree.heading("StudentId",text="序号")
        cls.tree.heading("StudentName", text="姓名")
        cls.tree.heading("StudentNO", text="学号")
        cls.tree.heading("StudentBirthday", text="出生日期")
        cls.tree.heading("Age", text="年龄")
        # stubll = BLL.StudentListBLL.StudentBll()
        geovindu = cls.stubll.selectSqlOrder("Age asc")  # list()
        #treeView控件绑定数据
        i=1
        for Model.StudentListInfo.StudentList in geovindu:
            cls.tree.insert("",i,text="2",values=(Model.StudentListInfo.StudentList.getStudentId(),Model.StudentListInfo.StudentList.getStudentName(),Model.StudentListInfo.StudentList.getStudentNO(),Model.StudentListInfo.StudentList.getStudentBirthday(),Model.StudentListInfo.StudentList.getAge()))
            i+=1
        #删除按钮
        ttk.Button(window,text="删除",style='success,TButton',command=cls.delete).pack(side='left',padx=5,pady=10)
        window.mainloop()

输出“

 

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

python: more Layer Architecture and its Implementation in Python 的相关文章

  • python 中分割字符串以获得一个值?

    需要帮助 假设我在名为 input 的变量中有一个字符串 Sam Person name kind input split 通过执行上述操作 我得到两个具有不同字符串 Sam 和 Person 的变量 有没有办法只获取第一个值 name S
  • 优化 Keras 以使用所有可用的 CPU 资源

    好吧 我真的不知道我在说什么 所以请耐心听我说 我正在使用 Theano 后端运行 Keras 以在 MNIST 图像上运行基本的神经网络 目前只是一个教程 过去 我一直使用我的旧 HP 笔记本电脑 因为我有 Windows 和 Ubunt
  • 在 PHP 中将十进制/双精度/浮点值与 PDO 绑定的最佳方法是什么?

    看来类常量只涵盖PDO PARAM BOOL PDO PARAM INT and PDO PARAM STR用于绑定 您只是将十进制 浮点 双精度值绑定为字符串还是有更好的方法来处理它们 MySQLi 允许使用 d 类型表示 double
  • Python igraph:从图中删除顶点

    我正在使用安然电子邮件数据集 并尝试删除没有 enron com 的电子邮件地址 即我只想拥有安然电子邮件 当我尝试删除那些没有 enron com 的地址时 一些电子邮件由于某些原因被跳过 下面显示了一个小图 其中顶点是电子邮件地址 这是
  • 无法打开 Python。错误 0xc000007b

    我最近一直在学习 Python 3 我在我的上网本 32 位 Windows 7 上创建简单的小程序没有任何问题 当我将它安装在我的上网本上时 我没有遇到任何问题 但现在我已经开始使用它了 我想将它安装在我的台式机上 并且我有一个 我的桌面
  • spacy 如何使用词嵌入进行命名实体识别 (NER)?

    我正在尝试使用以下方法训练 NER 模型spaCy识别位置 人 名和组织 我试图理解如何spaCy识别文本中的实体 但我无法找到答案 从这个问题 https github com explosion spaCy issues 491在 Gi
  • 如何使用Python的super()来更新父值?

    我对继承很陌生 之前所有关于继承和 Python 的 super 函数的讨论都有点超出我的理解 我当前使用以下代码来更新父对象的值 usr bin env python test py class Master object mydata
  • 如何在Python和Selenium中通过标签名称或id获取元素[重复]

    这个问题在这里已经有答案了 我正在尝试使用 Python 和 Selenium 获取输入 但它向我显示错误 我该如何解决这个错误 inputElement send keys getStock getStocklFunc 0 Error i
  • Matplotlib Scatter - ValueError:RGBA 序列的长度应为 3 或 4

    我正在尝试为我的功能绘制图表 但不断收到此错误 ValueError RGBA sequence should have length 3 or 4 每当我只有 6 种形状时 代码就可以完美运行 但现在我将其增加到 10 种 它就不起作用了
  • 如何有效地从 loadmat 函数生成的嵌套 numpy 数组中提取值?

    python中是否有更有效的方法从嵌套的python列表中提取数据 例如A array array 12000000 dtype object 我一直在使用A 0 0 0 0 当你有很多像 A 这样的数据时 这似乎不是一个有效的方法 我也用
  • 在 MacO 和 Linux 上安装 win32com [重复]

    这个问题在这里已经有答案了 我的问题很简单 我可以安装吗win32com蟒蛇API pywin32特别是 在非 Windows 操作系统上 我一直在Mac上尝试多个版本pip install pywin32 都失败了 下面是一个例子 如果你
  • Airflow Python 单元测试?

    我想为我们的 DAG 添加一些单元测试 但找不到任何单元测试 有 DAG 单元测试框架吗 有一个端到端的测试框架存在 但我猜它已经死了 https issues apache org jira browse AIRFLOW 79 https
  • 导入错误:没有名为 google.auth 的模块

    当我尝试导入时firebase admin in python 2 7我收到错误 导入错误 没有名为 google auth 的模块 这是Docker文件 https github com ammaratef45 Attendance bl
  • 查找给定节点的最高权重边

    我在 NetworkX 中有一个有向图 边缘的权重从 0 到 1 表示它们发生的概率 网络连通性非常高 所以我想修剪每个节点的边缘 只保留最高概率的节点 我不确定如何迭代每个节点并仅保留最高权重in edges在图中 有没有一个networ
  • Flask WTForms 使用变量自动填充 StringField

    我有一个表格 我想用上一页收到的信息自动填充一些字段 但如果他们想调整它 它需要是可更改的 我正在为我的 SelectField 使用动态创建的列表 但添加 StringField 并不成功 请参阅下面的我的代码 forms py clas
  • 为什么实现 __iter__ 的对象不被识别为可迭代的?

    假设您使用包装对象 class IterOrNotIter def init self self f open tmp toto txt def getattr self item try return self getattribute
  • Python 3.2 中 **kwargs 和 dict 有什么区别?

    看起来Python的很多方面都只是功能的重复 除了我在 Python 中的 kwargs 和 dict 中看到的冗余之外 还有什么区别吗 参数解包存在差异 许多人使用kwargs 并通过dict作为论据之一 使用参数解包 Prepare f
  • 哪个是识别关系或非识别关系中的子表?

    在表之间的识别和非识别关系的上下文中 MySQL 文档大量将表称为父表和子表 如何判断哪个表是父表 哪个表是子表 子表 A K A 弱实体 http en wikipedia org wiki Weak entity 是一个表 其主键属性d
  • 来自 django 教程 was_published_recently.admin_order_field = 'pub_date'

    From Django 教程 https www jetbrains com help pycharm 2017 1 creating and running your first django project html d28041e21
  • Django South - 将 null=True 字段转换为 null=False 字段

    我的问题是 转变的最佳做法是什么null True场变成null False使用 Django South 的字段 具体来说 我正在与ForeignKey 你应该先写一个数据迁移 http south aeracode org docs t

随机推荐

  • C++运算符重载(简单易懂)

    一 运算符重载 对已有的运算符进行重新定义 赋予另一种功能以适用不同的数据类型 1 加号运算符 重载 创建类 Person class Person public 1 成员函数重载 号 本质 Person p3 p1 operator p2
  • 结构体(struct)继承——[C++语言中]

    在C 语言中 struct对C语言中的strcut进行了扩充 已经不仅仅是一个包含不同数据类型的数据结构体了 在C 语言中 strcut可以包含成员函数 可以实现继承 可以实现多态 在C 语言中 结构体struct与类class的最本质区别
  • JavaScript设计模式(二)——简单工厂模式、抽象工厂模式、建造者模式

    个人简介 个人主页 前端杂货铺 学习方向 主攻前端方向 正逐渐往全干发展 个人状态 研发工程师 现效力于中国工业软件事业 人生格言 积跬步至千里 积小流成江海 推荐学习 前端面试宝典 Vue2 Vue3 Vue2 3项目实战 Node js
  • Git查看和编辑配置并设置默认编辑器为VSCode

    1 查看已有配置 使用命令 git config list show origin 查看已有的配置 file D Git etc gitconfig diff astextplain textconv astextplain file D
  • 如何剪辑视频?方法来了,零基础也能学会!

    视频怎么剪辑呀 刚刚用录屏软件录制了一段视频 但是录进去了很多不需要的画面 需要进行修改 可是不知道视频怎么剪辑 有没有人知道剪辑视频的方法 推荐一下 剪辑视频是一门重要的技能 无论是在日常生活中还是工作中 都需要用到 从个人Vlog到专业
  • 给我写一段nginx代码

    server listen 80 server name example com location root var www example index index html index htm
  • (Struts2学习篇)Struts2标签库(表单标签)

    一 jsp页面代码 index jsp
  • CSS实现DIV的水平与垂直居中

    使用CSS样式实现DIV的水平与垂直居中 1 使用 div 标签的 align 属性实现水平居中 HTML中的 div 标签的 align 属性用于规定 div 元素中的内容的水平对齐方式 所有浏览器都支持 align 属性 语法 div
  • prometheus中常用的查询

    prometheus server 可以通过HTTPAPI的方式进行查询 官网链接https prometheus io docs prometheus latest querying basics 我这边主要用到的是实时查询 当然prom
  • Mybatis注意小笔记

    映射文件中的namespace是用于绑定Dao接口的 即面向接口编程 1 接口式编程 原生 Dao gt DaoImpl mybatis Mapper gt xxMapper xml 2 SqlSession代表和数据库的一次会话 用完必须
  • Leetcode617. 合并二叉树(C语言)

    Leetcode617 合并二叉树 C语言 数据结构 树 算法与数据结构参考 题目 给定两个二叉树 将它们中的一个覆盖到另一个上时 两个二叉树的一些节点便会重叠 如果两个节点重叠 那么将他们的值相加作为节点合并后的新值 否则不为 NULL
  • 想学设计模式、想搞架构设计,先学学 UML 系统建模吧

    UML 系统建模 1 概述 1 1 课程概述 汇集 UML 及其相关的一些话题 回顾 UML 相关的符号与概念 以电商订单相关业务为例 借助 UML 完成系统建模 将 UML 变成提升建模效率 表达架构思想的工具 1 2 什么是 UML U
  • 二分查找C++实现

    非递归方式代码 区间范围 left right 左闭右闭 时间复杂度为O logn include
  • Debian 安装 ldac

    需要将系统本来的PulseAudio ALSA JACK同时更换到 pipewire 如果没有支持LDAC aptX的设备不建议折腾 系统 Debian 11 Gnome 声卡 Intel HDA 蓝牙 支持蓝牙5 0 1 更换PulseA
  • 终止代码:DRIVER_IRQL_NOT_LESS_OR_EQUAL 失败的操作:CH341S64.SYS

    终止代码 DRIVER IRQL NOT LESS OR EQUAL 失败的操作 CH341S64 SYS Python串口程序致使电脑蓝屏自动重启 CH430驱动有问题 Python串口程序致使电脑蓝屏自动重启 最近在做一个项目 其中有一
  • Redis入门——Key、五大数据类型图文详解

    文章目录 1 Redis简介 2 Redis常见命令 3 Redis Key关键字 4 五大数据类型简介 4 1 String 字符串 4 2 List 列表 4 3 Set 4 3 Hash 4 4 ZSet 1 Redis简介 Redi
  • 什么是索引?MySQL常见的几种索引类型和原理

    来源 素文宅博客 地址 https blog yoodb com yoodb article detail 1536 在关系数据库中 索引是一种单独的 物理的对数据库表中一列或多列的值进行排序的一种存储结构 它是某个表中一列或若干列值的集合
  • Java---JUC并发篇(多线程详细版)

    Java 多线程 1 并发基础 线程篇 1 1 java线程状态及线程状态之间的转化 1 2 操作系统层面有5种状态 2 线程池的核心参数 7个核心参数 3 sleep与wait方法对比 4 lock锁与synchronized锁区别 5
  • docker启动容器及启动一个挂载数据卷的容器

    在docker运行容器前可以先使用docker images列出本地镜像 docker运行容器前需要本地存在对应的镜像 如果本地不存在该镜像 Docker会从镜像仓库下载此镜像 先创建 usr share nginx html 目录 创建数
  • python: more Layer Architecture and its Implementation in Python

    sql server 学生表 DROP TABLE DuStudentList GO create table DuStudentList StudentId INT IDENTITY 1 1 PRIMARY KEY StudentName