摘要: 代码讲解: 1.检查数据库文件是否存在,如果不存在就创建数据库文件 2.创建 person 表(等下的操作就是操作这个表) 3.查询出 person 表中所有的数据,并显示出来 Pro 文件 添加 SQL QT += sql .h 头文件 #include <QtSql/QSqlDatabase> 阅读全文
posted @ 2021-08-19 23:29 十一的杂文录 阅读(872) 评论(0) 推荐(0) 编辑
摘要: 一、写入注册表 #include <QSettings> //实例 QSettings //参数 1:注册表位置 //参数 2:操作 windows 注册表 QSettings::NativeFormat //说明:QSettings::IniFormat 读写 ini 格式的配置文件,前面用过。 阅读全文
posted @ 2021-08-19 23:07 十一的杂文录 阅读(2121) 评论(0) 推荐(0) 编辑
摘要: 如图,在编译代码时,出现报错:RC1004 unexpected end of file found 原因是,cpp最后要多一行才行,不然就会报这个错误 错误示例: int main() { return 0; } 正确示例 int main() { return 0; } // 在最后在留一行,这 阅读全文
posted @ 2021-08-18 09:34 十一的杂文录 阅读(388) 评论(0) 推荐(0) 编辑
摘要: 操作文件,无非就是读与写,以下为Qt读写ini文件的代码。 demo: #include "widget.h" #include <QApplication> #include <QDebug> #include <QSettings> /*QSettings * // 方法一:可以设置ini文件保 阅读全文
posted @ 2021-08-01 18:50 十一的杂文录 阅读(756) 评论(0) 推荐(0) 编辑
摘要: --转载自:林肯李 该文章写的很好,特转载留待后期备用 背景 在开发 CMS 时,经常需要标记谁创建了记录。Django 为我们提供了一个很好的管理界面。但是当我们只使用默认值时,用户需要自己选择他们是谁。我们想为他们自动选择,他们不能假装是其他人。 代码 在 django models.py 中, 阅读全文
posted @ 2021-07-27 16:53 十一的杂文录 阅读(475) 评论(0) 推荐(0) 编辑
摘要: 这个问题百度了一下,各种各样的的回答都有,试了好多种方法,终于解决这个问题 解决方法: 1.在项目根目录下,新建 vue.config.js, 在文件中输入: module.exports = { publicPath: process.env.NODE_ENV 'production' ? './ 阅读全文
posted @ 2021-07-18 12:54 十一的杂文录 阅读(892) 评论(2) 推荐(0) 编辑
摘要: 网上有资料但是不全,所以这里记录一份比较全的 1.创建项目 2.编辑 demo.cpp 这里写button用来做国际化示例,运行软件后是这个样子 #include "demo.h" #include "ui_demo.h" #include <QPushButton> demo::demo(QWid 阅读全文
posted @ 2021-07-14 16:51 十一的杂文录 阅读(478) 评论(1) 推荐(0) 编辑
摘要: FAQ1:在使用pip3安装库的时候,提示需要升级pip pip3 install --upgrade pip FAQ2:在创建软链接时,提示:ln: failed to create symbolic link ‘/usr/bin/python3’: File exists 我们可以在参数中加个 阅读全文
posted @ 2021-07-11 16:08 十一的杂文录 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 服务器是使用的阿里云的centos 7.6 项目使用的是 Python3.9.5 + Django 3.2.4 目标:将django项目部署到centos上,centos + Python + django + uwsgi + nginx Python下载地址:https://www.python. 阅读全文
posted @ 2021-07-11 15:37 十一的杂文录 阅读(301) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi 阅读全文
posted @ 2021-06-27 00:43 十一的杂文录 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 有时候我们的网页会被别人内嵌别人的网页 iframe 中,我们只需要在页面中增加以下js就可以让我们的页面内容单独显示出来,不被嵌入到 iframe中 核心JS代码 <script> if(top.location != self.location){ // 检查当前页面是否处于浏览器顶层 top. 阅读全文
posted @ 2021-06-06 19:52 十一的杂文录 阅读(145) 评论(0) 推荐(0) 编辑
摘要: win7电脑 IE浏览器 开发人员工具,不能切换IE版本 这个是IE浏览器的问题,需要安装个微软件东西就可以解决这个问题了。亲测有效 64位下载地址:https://wwi.lanzoui.com/i71Ohpqcfle(我放在蓝奏云) 阅读全文
posted @ 2021-06-03 09:23 十一的杂文录 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 当页面失去焦点(切换到其他标签页 / 切换到其他软件),触发失焦事件,然后动态删除element 兼容IE8 if(window.ActiveXObject){ window.attachEvent('onblur', function(){ document.getElementById('Elo 阅读全文
posted @ 2021-05-29 10:20 十一的杂文录 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 核心代码 import compileall compileall.compile_file("a.py", legacy=True, force=True) 演示步骤 1.新建 a.py,定义一个函数,供其他程序调用 # a.py 定义一个函数,提供给其他程序调用 def func(n1, n2) 阅读全文
posted @ 2021-05-25 01:05 十一的杂文录 阅读(582) 评论(0) 推荐(0) 编辑
摘要: // 鼠标移动出现雪花.html <!DOCTYPE html> <html> <head> <title></title> <script src="https://wow.techbrood.com/libs/jquery/jquery-1.11.1.min.js"></script> </he 阅读全文
posted @ 2021-05-05 21:25 十一的杂文录 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 新建js文件,将代码复制到js文件中,然后在HTML文件中引入js,这样鼠标点击后就可以出现爱心 // js.js !function(e, t, a) { function r() { for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t. 阅读全文
posted @ 2021-05-05 21:22 十一的杂文录 阅读(295) 评论(0) 推荐(0) 编辑
摘要: <div id="first"> <p>带背景颜色的小三角实现是比较简单的</p> <span id="top"></span> </div> <style> #top{ position:absolute; width:0px; height:0px; line-height:0px; borde 阅读全文
posted @ 2021-05-05 21:19 十一的杂文录 阅读(405) 评论(0) 推荐(0) 编辑
摘要: 这是来自一个妹子的需求,需要将多张图片拼接成一张长图 我是使用pillow这个库来实现的,下面的简单的代码,操作比较简单,代码还有优化的空间 def test(dirpath): ims = [Image.open(os.path.join(dirpath, i)) for i in os.list 阅读全文
posted @ 2021-05-04 16:36 十一的杂文录 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 发送的是带附件的邮件,发送完成后,去检查发现,附件变成二进制文件了 出错的代码主要是这一句: att1["Content-Disposition"] = 'attachment; filename="test.txt"' 只要改正这里就可以了 问题代码 att1 = MIMEText(open('t 阅读全文
posted @ 2021-04-23 01:09 十一的杂文录 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 设置抄送人,非常简单,只需要添加一条信息就可以了,例: cc_list = ['xx@xxx.cn', 'xx@xxx.cn'] msg['Cc'] = ','.join(cc_list) smtp.sendmail(name, to_list + cc_list, msg.as_string()) 阅读全文
posted @ 2021-04-23 01:00 十一的杂文录 阅读(3379) 评论(0) 推荐(1) 编辑
摘要: 在使用腾讯企业邮箱发送邮件时出现报错:AttributeError: 'list' object has no attribute 'encode' 原因:收件人不能用列表存储数据,需要转为字符串,以逗号分割 解决方法: 将收件人列表转为字符串,以逗号分割 to_list = ['a@xx.com' 阅读全文
posted @ 2021-04-23 00:53 十一的杂文录 阅读(5299) 评论(0) 推荐(0) 编辑
摘要: 快速的统计出字符出现的次数,并以字典显示出来 import pprint msg = 'It was a bright cold day in April, and the clocks were strikingthirteen' count = dict() for i in msg: coun 阅读全文
posted @ 2021-04-18 16:42 十一的杂文录 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Windows版 格式化代码(可以去除多余空格):Alt + shift + F 折叠代码:ctrl + shift + 【 展开代码:ctrl + shift + 】 向上复制行:Alt + shift + UP 向下复制行:Alt + shift + DOWN 单词选中: ctrl + D 展开 阅读全文
posted @ 2021-04-17 20:56 十一的杂文录 阅读(60) 评论(0) 推荐(0) 编辑
摘要: win7系统部署django项目,在Windows电脑上我使用的是 Apache + mod_wsgi 来部署的 # 背景 Python 3.8.3 Django 3.1.7 Apache v16 mod_wsgi 3.8DB:sqlite3 # 部署前的检查 1.检查下Python的版本 2.检查 阅读全文
posted @ 2021-04-01 00:21 十一的杂文录 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 做了一个小网站,主要是为了简单工作,只需要公司局域网访问,所以部署在自己的台式机上。 网站是用django 3.x版本开发的,电脑是win7系统,所以是用的Apache部署的 部署的啥问题都没有,检查了两三个小时。。。 一直想不通为啥 打开网页就是转圈圈,看log日志也没啥提醒,后面还是百度才知道, 阅读全文
posted @ 2021-03-19 02:15 十一的杂文录 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 一、搭建环境,准备数据 1.1:新建项目 django-admin startproject Test 1.2:新建app python manage.py startapp app 1.3:设置 settings.py # settings.py # 允许访问的ip地址 ALLOWED_HOSTS 阅读全文
posted @ 2021-03-16 22:42 十一的杂文录 阅读(2170) 评论(2) 推荐(0) 编辑
摘要: Coverage 一个专门用来检查代码覆盖率的工具,他的使用非常简单,有两种使用方法:[命令行运行,配合测试套件使用] 安装: pip install coverage 一、准备素材 main.py def get_status(score): if score >= 90: return '优秀' 阅读全文
posted @ 2021-03-15 01:03 十一的杂文录 阅读(1879) 评论(0) 推荐(0) 编辑
摘要: SQL按年月日进行分组 select count(project_name), create_at from table_a group by date_format(create_at, '%Y%m%d'); 阅读全文
posted @ 2021-03-15 00:21 十一的杂文录 阅读(825) 评论(0) 推荐(0) 编辑
摘要: 使用Python可以轻松的查询出上周几是多少号,这周几是什么多少号,以下是查询上周五的示例: import datetime, calendar last = datetime.date.today() oneday = datetime.timedelta(days=1) while last.w 阅读全文
posted @ 2021-03-15 00:16 十一的杂文录 阅读(414) 评论(0) 推荐(0) 编辑
摘要: # 清屏 >> cls # 查看进程 >> tasklist # 结束进程 >> tskill <pid> # 查询WIFI列表所有WIFI的信息 >> netsh wlan show networks # 查询无线网卡,当前连接网络详细信息 >> netsh wlan show interface 阅读全文
posted @ 2021-03-14 22:27 十一的杂文录 阅读(59) 评论(0) 推荐(0) 编辑