【Django】4 Django模型

news2024/11/25 6:57:11

每个模型是一个Python 类,集成django.db.models.Modle类

该模型的每个属性表示一个数据库表字段

通过API 自动生成数据库访问 .../sign/modles.py 文件,通过模型完成表创建。

 TypeError: ForeignKey.__init__() missing 1 required positional argument: 'on_delete'

在创建一个新模型时 ,出现错误TypeError: ForeignKey.__init__() missing 1 required positional argument: ‘on_delete‘_爱吃龙虾的小黑的博客-CSDN博客

E:\data\python\djaongo_prj\guest>  python manage.py makeigrations sign
Traceback (most recent call last):
  File "E:\data\python\djaongo_prj\guest\manage.py", line 21, in <module>
    main()
  File "E:\data\python\djaongo_prj\guest\manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\__init__.py", line 416, in execute
    django.setup()
  File "D:\software\python3\anconda3\Lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "D:\software\python3\anconda3\Lib\site-packages\django\apps\registry.py", line 116, in populate
    app_config.import_models()
  File "D:\software\python3\anconda3\Lib\site-packages\django\apps\config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
  File "D:\software\python3\python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "E:\data\python\djaongo_prj\guest\sign\models.py", line 20, in <module>
    class Guest(models.Model):
  File "E:\data\python\djaongo_prj\guest\sign\models.py", line 21, in Guest
    event = models.ForeignKey(Event)  # 关联发布会id
TypeError: ForeignKey.__init__() missing 1 required positional argument: 'on_delete'

 必须要设置级联删除,也就是当你删除一条信息时,会级联的删除所有和这一条信息对应的另一张表的多个信息,也就是指定on_delete=models.CASCADE

event = models.ForeignKey(Event,on_delete=models.CASCADE)  # 关联发布会id

# 嘉宾
class Guest(models.Model):
    event = models.ForeignKey(Event,on_delete=models.CASCADE)  # 关联发布会id
    realname = models.CharField(max_length=64)  # 姓名
    phone = models.CharField(max_length=16)  # 手机号
    email = models.EmailField()  # 邮箱
    sign = models.BooleanField()  # 签到状态
    create_time = models.DateTimeField(auto_now=True)  # 创建时间(自动获取当前时间)

    class Meta:
        unique_together = ('phone', 'event')

    def __str__(self):
        return self.realname

 python manage.py makemigrations sign

E:\data\python\djaongo_prj\guest>  python manage.py makemigrations sign
System check identified some issues:

WARNINGS:
sign.Event: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
        HINT: Configure the DEFAULT_AUTO_FIELD setting or the SignConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
sign.Guest: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
        HINT: Configure the DEFAULT_AUTO_FIELD setting or the SignConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
Migrations for 'sign':
  sign\migrations\0001_initial.py
    - Create model Event
    - Create model Guest

  python manage.py migrate

E:\data\python\djaongo_prj\guest>  python manage.py migrate
System check identified some issues:

WARNINGS:
sign.Event: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
        HINT: Configure the DEFAULT_AUTO_FIELD setting or the SignConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
sign.Guest: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
        HINT: Configure the DEFAULT_AUTO_FIELD setting or the SignConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, sign
Running migrations:
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying sign.0001_initial... OK

E:\data\python\djaongo_prj\guest>

admin  后台 管理

from django.contrib import admin

# Register your models here.
#  admin 后台管理  创建的发布会和嘉宾表示同样可以通过Admin 后台管理
from  django.contrib  import  admin
from  sign.models import   Event ,Guest


# Register your models here.
class EventAdmin(admin.ModelAdmin):
    list_display = ['name', 'status', 'start_time','id']
    search_fields = ['name']    # 搜索功能
    list_filter = ['status']    # 过滤器


class GuestAdmin(admin.ModelAdmin):
    list_display = ['realname', 'phone','email','sign','create_time','event_id']
    list_display_links = ('realname', 'phone') # 显示链接
    search_fields = ['realname','phone']       # 搜索功能
    list_filter = ['sign']                 # 过滤器


admin.site.register(Event, EventAdmin)
admin.site.register(Guest, GuestAdmin)



Microsoft Windows [版本 10.0.19045.3448]
(c) Microsoft Corporation。保留所有权利。

E:\data\python\djaongo_prj\guest>python   manage.py shell
Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.10.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]:

In [1]:

In [1]: from sign.models import Event,Guest

In [2]: Event.objects.all()
Out[2]: <QuerySet [<Event: 小米5发布会>]>

In [3]:

from sign.models import Event,Guest  导入模块

 Event.objects.all()   所有对象

配置 MySQL  

 pip  install pymysql

数据库创建表

报错 [Err] 1055 - Expression #1 of ORDER BY

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated_Ricardo · M · YUAN的博客-CSDN博客

 

在配置文件的末尾加上这段代码:
[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

 

CREATE TABLE `sign_event` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL COMMENT '名称',
  `limit` int DEFAULT NULL COMMENT 'limit',
  `status` varchar(1) DEFAULT '1' COMMENT '状态   0:隐藏   1:显示',
  `address` varchar(500) DEFAULT NULL COMMENT '地址',
   start_time DATE,
   create_time DATE,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='系统配置信息表';
CREATE TABLE `sign_guest` (
  `event_id` int NOT NULL ,
  `realname` varchar(50) DEFAULT NULL COMMENT '名称',
  `phone` varchar(11) COMMENT '手机号',
  `email` varchar(50) ,
  `sign` VARCHAR(1) DEFAULT '1' COMMENT '状态   0:隐藏   1:显示',
   create_time DATE,
  PRIMARY KEY (`event_id`,`phone`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='嘉宾表';

insert into  sign_guest(realname,phone,email,sign,event_id,create_time)values("tom","12344444","1111@qq.com",1,123456,now())


select * from sign_guest

 

from pymysql import cursors, connect

# 连接数据库
conn = connect(host='192.168.56.10', user='root', password='root',
               db='guest', charset='utf8mb4', cursorclass=cursors.DictCursor)

try:
    with conn.cursor() as cursors:
        # 创建嘉宾数据
        sql = 'insert into  sign_guest(realname,phone,email,sign,event_id,create_time)values("tom2","12344444","1111@qq.com",1,123456,now())'
        cursors.execute(sql)
    conn.commit()
    with conn.cursor() as cursor:
        # 查询
        sql = "select  *  from sign_guest where phone=%s"
        cursor.execute(sql, ('12344444',))
        res = cursor.fetchone()
        print(res)
finally:
    conn.close()

 

 Django 连接 mysql 


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

 

 

 

import pymysql
pymysql.install_as_MySQLdb()

"""
如果你使用pymysql驱动的话,上面两行必须添加。
"""

 

E:\data\python\djaongo_prj\guest> python  manage.py migrate
Traceback (most recent call last):
  File "E:\data\python\djaongo_prj\guest\manage.py", line 21, in <module>
    main()
  File "E:\data\python\djaongo_prj\guest\manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\commands\migrate.py", line 100, in handle
    self.check(databases=[database])
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\management\base.py", line 485, in check
    all_issues = checks.run_checks(
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\checks\registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "D:\software\python3\anconda3\Lib\site-packages\django\core\checks\model_checks.py", line 36, in check_all_models
    errors.extend(model.check(**kwargs))
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\models\base.py", line 1558, in check
    *cls._check_indexes(databases),
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\models\base.py", line 2002, in _check_indexes
    connection.features.supports_expression_indexes
  File "D:\software\python3\anconda3\Lib\site-packages\django\utils\functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\mysql\features.py", line 317, in supports_expression_indexes
    not self.connection.mysql_is_mariadb
  File "D:\software\python3\anconda3\Lib\site-packages\django\utils\functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\mysql\base.py", line 439, in mysql_is_mariadb
    return "mariadb" in self.mysql_server_info.lower()
  File "D:\software\python3\anconda3\Lib\site-packages\django\utils\functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\mysql\base.py", line 425, in mysql_server_info
    return self.mysql_server_data["version"]
  File "D:\software\python3\anconda3\Lib\site-packages\django\utils\functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\mysql\base.py", line 399, in mysql_server_data
    with self.temporary_connection() as cursor:
  File "D:\software\python3\python310\lib\contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\base\base.py", line 705, in temporary_connection
    with self.cursor() as cursor:
  File "D:\software\python3\anconda3\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\base\base.py", line 330, in cursor
    return self._cursor()
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\base\base.py", line 306, in _cursor
    self.ensure_connection()
  File "D:\software\python3\anconda3\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\base\base.py", line 289, in ensure_connection
    self.connect()
  File "D:\software\python3\anconda3\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\base\base.py", line 272, in connect
    self.init_connection_state()
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\mysql\base.py", line 257, in init_connection_state
    super().init_connection_state()
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\base\base.py", line 239, in init_connection_state
    self.check_database_version_supported()
  File "D:\software\python3\anconda3\Lib\site-packages\django\db\backends\base\base.py", line 214, in check_database_version_supported
    raise NotSupportedError(
django.db.utils.NotSupportedError: MySQL 8 or later is required (found 5.7.36).

E:\data\python\djaongo_prj\guest>

 

django.db.utils.NotSupportedError: MySQL 8 or later is required (found 5.7.36).

django.db.utils.NotSupportedError: MySQL 8 or later is required (found 5.7.2)简单快速的解决办法_疯狂的小强呀的博客-CSDN博客

这个问题是说我们的Django框架版本比较新,已经不支持MySQL老版本5.7.2了,MySQL8或者更新的版本才是我们需要的或者说匹配的。

解决方案

从问题出发的解决方案有两个,①卸载老版本的MySQL,安装项目支持的新版本 ②降低Django框架的版本

pip uninstall django 

pip install django==2.1.13 

 要重启pycharm

Error: [WinError 10013] 以一种访问权限不允许的方式做了一个访问套接字的尝试。

Django-解决报错Error: [WinError 10013] 以一种访问权限不允许的方式做了一个访问套接字的尝试。_Python454的博客-CSDN博客 

 E:\data\python\djaongo_prj\guest>netstat -aon|findstr "8000"
  TCP    0.0.0.0:8000           0.0.0.0:0              LISTENING       14756
  UDP    0.0.0.0:8000           *:*

PID =14756

任务管理器 详细信息

 

 

D:\software\python3\python310\python.exe E:/data/python/djaongo_prj/guest/manage.py runserver 127.0.0.1:8001
D:\software\python3\anconda3\Lib\site-packages\numpy\__init__.py:138: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init
D:\software\python3\anconda3\Lib\site-packages\numpy\__init__.py:138: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init
Performing system checks...

System check identified no issues (0 silenced).

You have 16 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions, sign.
Run 'python manage.py migrate' to apply them.
October 02, 2023 - 21:57:38
Django version 2.1.13, using settings 'guest.settings'
Starting development server at http://127.0.0.1:8001/
Quit the server with CTRL-BREAK.

 设置  runserver 127.0.0.1:8001

 启动成功

 删除 数据库中 sign_event  表

python  manage.py migrate

  File "D:\software\python3\anconda3\Lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "D:\software\python3\anconda3\Lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
django.db.utils.OperationalError: (1050, "Table 'sign_event' already exists")

E:\data\python\djaongo_prj\guest>python  manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, sign
Running migrations:
  Applying sign.0001_initial... OK

E:\data\python\djaongo_prj\guest>

重新生成后台管理admin

 python manage.py createsuperuser

E:\data\python\djaongo_prj\guest>python manage.py createsuperuser
Username (leave blank to use 'administrator'): admin
Email address: 11111@qq.com
Password:
Password (again):
Superuser created successfully.

 http://127.0.0.1:8001/admin/

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

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

相关文章

ChatGPT多模态升级,支持图片和语音,体验如何?

一、前言 9 月 25 日&#xff0c;ChatGPT 多模态增加了新的语音功能和图像功能。这些功能提供了一种新的、更直观的界面&#xff0c;允许我们与 ChatGPT 进行语音对话或展示我们正在谈论的内容。 ChatGPT 现在可以看、听、和说话了&#xff0c;而不单单是一个文本驱动的工具了。…

算法通过村第十一关-位运算|白银笔记|高频题目

文章目录 前言1. 位移的妙用1.1 位1的个数1.2 比特位计算1.3 颠倒无符号整数 2. 位实现加减乘除专题2.1 位运算实现加法2.2 递归乘法 总结 前言 提示&#xff1a;他不是不想多明白些&#xff0c;但是每每在该用脑子的时候&#xff0c;他用了感情。 --老舍《黑白李》 与位运算和…

Centos7安装php-fpm

目录 第一步&#xff1a;查看系统IP地址和网卡名称 第二步&#xff1a;更改网络配置模式 第三步、重启network 查看iptablies ,将第十行&#xff0c;十一行删除 第四步&#xff1a;关闭config 第五步&#xff1a;创建nginx 文件夹 查看目录下的文件 进入nginx文件夹 第…

基于java的鲜花销售系统/网上花店

摘 要 本毕业设计的内容是设计并且实现一个基于Spring Boot框架的驿城鲜花销售系统。它是在Windows下&#xff0c;以MYSQL为数据库开发平台&#xff0c;Tomcat网络信息服务作为应用服务器。驿城鲜花销售系统的功能已基本实现&#xff0c;主要包括首页、个人中心、用户管理、鲜…

【VIM】初步认识VIM-2

2-6 Vim 如何搜索替换_哔哩哔哩_bilibili 1-6行将self改成this 精确替换quack单词为交

CSS基础语法第二天

目录 一、复合选择器 1.1 后代选择器 1.2 子代选择器 1.3 并集选择器 1.4 交集选择器 1.4.1超链接伪类 二、CSS特性 2.1 继承性 2.2 层叠性 2.3 优先级 基础选择器 复合选择器-叠加 三、Emmet 写法 3.1HTML标签 3.2CSS 四、背景属性 4.1 背景图 4.2 平铺方式 …

NPDP产品经理知识(市场调研-文化,团队,领导力)

--- VOC --- 市场调研的关键步骤 1.> 定义问题 2.>定义结果的准确度 3.>收集数据 4.>分析和解读数据 5.>得出结论 6.>实施 --- 二级市场研究/一级市场研究 --- 定性 > 焦点小组 > 深度访谈 > 人种学(On-Site In-Home) > 客户…

基于web的医院预约挂号系统/医院管理系统

摘 要 随着信息技术和网络技术的飞速发展&#xff0c;人类已进入全新信息化时代&#xff0c;传统管理技术已无法高效&#xff0c;便捷地管理信息。为了迎合时代需求&#xff0c;优化管理效率&#xff0c;各种各样的管理系统应运而生&#xff0c;各行各业相继进入信息管理时代&a…

【ElasticSearch 集群】Linux安装ElasticSearch集群(图文解说详细版)

上次我们讲了linux环境安装ElasticSearch Linux安装ElasticSearch以及Ik分词器&#xff08;图文解说详细版&#xff09; 这次我们来将一下ElasticSearch的集群安装 安装es的前置条件&#xff1a; Linux安装Java环境&#xff08;OracleJDK&#xff09; 这次我们安装的是Elasti…

GraphQL全面深度讲解

目录 一、GraphQL 是什么 二、GraphQL 规范 数据模型 字段 参数 三、运行示例 四、优势和劣势 优势 劣势 一、GraphQL 是什么 GraphQL 是一种用于 API 的查询语言&#xff0c;也是一个基于服务端的运行引擎。 GraphQL 提供了一套完整的规范和描述用于查询 API&#xf…

Django基础入门操作 (Django-01)

一 背景介绍 Django是一个开源的 Web应用框架&#xff0c;由Python写成。采用了MTV的框架模式&#xff0c;它最初是被用来做CMS&#xff08;内容管理系统&#xff09;软件。 官方中文文档&#xff1a;Django 文档 | Django 文档 | Django 应用&#xff1a;做内容管理系统(新…

JUC第十三讲:JUC锁: ReentrantLock详解

JUC第十三讲&#xff1a;JUC锁: ReentrantLock详解 本文是JUC第十三讲&#xff0c;JUC锁&#xff1a;ReentrantLock详解。可重入锁 ReentrantLock 的底层是通过 AbstractQueuedSynchronizer 实现&#xff0c;所以先要学习上一章节 AbstractQueuedSynchronizer 详解。 文章目录 …

数据结构与算法基础(青岛大学-王卓)(8)

哎呀呀&#xff0c;sorry艾瑞波地&#xff0c;这次真的断更一个月了&#xff0c;又发生了很多很多事情&#xff0c;秋风开始瑟瑟了&#xff0c;老父亲身体查出肿瘤了&#xff0c;有病请及时就医&#xff0c;愿每一个人都有一个健康的身体&#xff0c;God bless U and FAMILY. 直…

实现简单BS架构案例

BS架构简单通俗理解 就是 浏览器–服务器模式&#xff0c;浏览器 充当 我们的客户端。 目录 简单BS架构实现案例基本原理视图访问规则案例要求改造前服务端线程模版类 改造后(优化)优化策略服务端线程模版类 参考视频 简单BS架构实现案例 基本原理视图 注&#xff1a;服务器必…

【VsCode】SSH远程连接Linux服务器开发,搭配cpolar内网穿透实现公网访问

文章目录 前言1、安装OpenSSH2、vscode配置ssh3. 局域网测试连接远程服务器4. 公网远程连接4.1 ubuntu安装cpolar内网穿透4.2 创建隧道映射4.3 测试公网远程连接 5. 配置固定TCP端口地址5.1 保留一个固定TCP端口地址5.2 配置固定TCP端口地址5.3 测试固定公网地址远程 前言 远程…

奥斯卡·王尔德

奥斯卡王尔德 奥斯卡王尔德&#xff08;Oscar Wilde&#xff0c;1854年10月16日—1900年11月30日&#xff09;&#xff0c;出生于爱尔兰都柏林&#xff0c;19世纪英国&#xff08;准确来讲是爱尔兰&#xff0c;但是当时由英国统治&#xff09;最伟大的作家与艺术家之一&#xf…

【Java 进阶篇】JDBC ResultSet 遍历结果集详解

在Java数据库编程中&#xff0c;经常需要执行SQL查询并处理查询结果。ResultSet&#xff08;结果集&#xff09;是Java JDBC中用于表示查询结果的关键类之一。通过遍历ResultSet&#xff0c;我们可以访问和操作从数据库中检索的数据。本文将详细介绍如何使用JDBC来遍历ResultSe…

手把手教你做个智能加湿器(一)

一、前言 目前常见的加湿器类电子产品一般是由PCBA和外壳组成&#xff0c;我们将从PCB设计&#xff0c;然后编写软件&#xff0c;接着设计外壳&#xff0c;设计出一个完整的产品出来。 需要使用到软件&#xff1a; Altium Designer 17 SolidWorks 2019 Keil 4 二…

C++--位图和布隆过滤器

1.什么是位图 所谓位图&#xff0c;就是用每一位来存放某种状态&#xff0c;适用于海量数据&#xff0c;数据无重复的场景。通常是用来判断某个数据存不存在的。比如int 有32位&#xff0c;就可以存放0到31这32个数字在不在某个文件中。当然&#xff0c;其他类型也可以。 2.位…

Python|OpenCV-如何给目标图像添加边框(7)

前言 本文是该专栏的第7篇,后面将持续分享OpenCV计算机视觉的干货知识,记得关注。 在使用opencv处理图像的时候,会不可避免的对图像的一些具体区域进行一些操作。比如说,想要给目标图像创建一个围绕图像的边框。简单的来说,就是在图片的周围再填充一个粗线框。具体效果,…