12 2020 档案

摘要:写在前面 2019.12.21-12.22,我参加了 2020 全国硕士研究生招生考试初试。后来的结果算是意料之中,没考上,经过自己的一番思考之后,毅然决定毕业后直接工作。在参加 2020 年春招的时候,我写下了一篇文章:我选择直接工作,不读研。 现在是 2020 年 12 月,快接近 2020 年 阅读全文
posted @ 2020-12-30 23:11 Wonz 阅读(140) 评论(0) 推荐(0)
摘要:一、问题 因为前文提到工作中需要使用 Go 调 Python 脚本执行加解密,但是 Go 那边执行命令行输出的是 str 类型。因此需要转回 bytes 进行解密,但是发现转回 bytes 和原来的不一样。下面以一个小例子做演示。 old_bytes = b"=\x1di\xab\xc1~)]9H\ 阅读全文
posted @ 2020-12-23 22:47 Wonz 阅读(1272) 评论(1) 推荐(0)
摘要:一、场景 工作中的一个场景:Go 需要对信息加解密,但是研究了 GmSSL Go API 文档之后,发现是依赖于 CGO 的,同事配了半天环境没配成功。于是换了一个方法,选择 Go 调 Python 脚本执行加解密。之前我是写过 Python 对信息使用国密 sm2 算法进行加解密的,因此比较方便。 阅读全文
posted @ 2020-12-23 22:40 Wonz 阅读(7537) 评论(2) 推荐(0)
摘要:一、模板引擎 1. 模板中绑定基本数据、字符串、数值、布尔值 default.go: package controllers import ( "github.com/astaxie/beego" ) type MainController struct { beego.Controller } f 阅读全文
posted @ 2020-12-16 22:23 Wonz 阅读(281) 评论(0) 推荐(0)
摘要:一、动态路由 api.go: package controllers import ( "github.com/astaxie/beego" ) type ApiController struct { beego.Controller } // http://localhost:8080/api/1 阅读全文
posted @ 2020-12-16 22:18 Wonz 阅读(296) 评论(0) 推荐(0)
摘要:Beego 框架学习笔记 03:Put、Delete 一、Put 修改 goods.go: package controllers import ( "github.com/astaxie/beego" ) type GoodsController struct { // 首字母要大写 beego. 阅读全文
posted @ 2020-12-16 22:12 Wonz 阅读(219) 评论(0) 推荐(0)
摘要:一、Get article.go 里添加代码: package controllers import ( "fmt" "github.com/astaxie/beego" ) type ArticleController struct { // 首字母要大写 beego.Controller } f 阅读全文
posted @ 2020-12-16 22:00 Wonz 阅读(500) 评论(0) 推荐(0)
摘要:一、安装、新建项目 首先需要安装 beego 环境,安装 bee 脚手架等。具体可以参考我的这篇文章:Go 安装教程。 然后在文件夹下新建一个 beego 项目: bee new beegodemo 然后,需要进入 beegodemo 文件夹下,如果没有 go mod 文件,需要 init 一下: 阅读全文
posted @ 2020-12-16 21:54 Wonz 阅读(355) 评论(0) 推荐(0)
摘要:一、填充字符串 1. 位置 print("hello {0}, this is {1}.".format("world", "python")) # 根据位置下标进行填充 print("hello {}, this is {}.".format("world", "python")) # 根据顺序自 阅读全文
posted @ 2020-12-15 19:49 Wonz 阅读(4207) 评论(0) 推荐(0)
摘要:一、问题复现 运行 Django 项目的时候报错:django.db.utils.ProgrammingError: (1146, "Table 'tmsdata.sysMgr_syslog' doesn't exist")。 翻译一下就是表不存在的意思,其实就是数据库迁移出了问题,需要重新迁移一下 阅读全文
posted @ 2020-12-14 21:47 Wonz 阅读(3475) 评论(0) 推荐(0)
摘要:Django2.2报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 9737: illegal multibyte sequence 一、问题复现 File "D:\Python\Python37-32\lib 阅读全文
posted @ 2020-12-14 21:41 Wonz 阅读(392) 评论(0) 推荐(0)
摘要:一、方法 首先要进入 MySQL 服务,输入 mysql 发现报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)。 换成以下命令: $ mysql -u root -p 然后输入数 阅读全文
posted @ 2020-12-10 20:50 Wonz 阅读(1647) 评论(0) 推荐(0)
摘要:一、快速上手 下载源代码 我是下载到本地然后通过 Xftp 传到 Linux 环境里的。 然后解压至当前目录: $ unzip GmSSL-master.zip 编译与安装 Linux平台使用以下命令: $ ./config $ make $ sudo make install 安装完后查看版本: 阅读全文
posted @ 2020-12-10 20:32 Wonz 阅读(3048) 评论(0) 推荐(0)