Posts
All the articles I've posted.
博客文章增加TOC
Published: at 02:01 AM博客文章是使用Markdown写的,有了TOC(Table of Contents)阅读起来体验更好,TOC就是所有h1组成的标签目录,点击后调到相应的位置。 获取所有h1标签 我用的是githubmarkdown库,在renderer的Header方法中可以获取,存...
Chrome简单插件开发,自动初始化gitalk评论
Published: at 10:51 AMChrome简单插件开发——自动初始化gitalk评论 gitalk增加手动初始化评论 我给博客增加了gitalk评论,确实蛮方便好用的,但是没有初始评论需要管理员去创建,还好它提供了一个参数来手动创建 createIssueManually...
Redis常见问题和解答
Published: at 09:51 AMRedis 持久化机制 =========== Redis是一个支持持久化的内存数据库,通过持久化机制把内存中的数据同步到硬盘文件来保证数据持久化。当Redis重启后通过把硬盘文件重新加载到内存,就能达到恢复数据的目的。 实现:单独创建fork()一个子进程,将当前父进程的数据库数据复...
C++ 多线程有序锁和无序锁
Published: at 08:45 AM正常情况下如果多个线程被阻塞,当使用notifyall或者notifyone来唤醒被阻塞的线程时是无序的,你不能知道被唤醒的是哪个线程。当然你可能说我不在意被唤醒的线程是哪一个,但是有些场景需要控制被唤醒的顺序,即:先加锁的线程让它先被唤醒。 首先,这里讨论的不是简单的使...
QWebEngineView支持https
Published: at 02:11 AM问题 我有个本地网页,里面有https地址的图片,使用QWebEngineView load本地网页后图片显示不出来。 解决 从QWebEnginePage类派生出WebPage类实现certificateError接口,然后将WebPage设置给QWebEngineView。 代码 WebPage代码: // .h class WebPage publi...
常用端口号
Published: at 01:56 AM常用协议端口号情况如下: POP3:110端口,邮件收取。 SMTP:25端口,邮件发送。 FTP:20数据端口/21控制端口,文件传输协议。 HTTP:80端口,超文本传输协议,网页传输。 HTTPS:443。 DHCP:67端口,IP地址自动分配。 SNMP:161端口,简单网络管理协议。 DNS:53端口...
golang设计模式-命令模式
Published: at 01:35 AM介绍 命令(Command)模式是一种对象的行为型模式,类似于传统程序设计方法中的回调机制,它将一个请求封装为一个对象,从而使得可用不同的请求对客户进行参数化;对请求排队或者记录请求日志,以及支持可撤销的操作。命令模式是对命令的封装,将发出命令的责任和执行命令的责任...
Qt启动第三方控制台程序并读取输出内容
Published: at 09:42 AM使用QProcess来启动程序,下面使用同步方式来启动: 1. 准备好工作目录,将需要运行的程序放在工作目录下 2. 准备启动的命令行(如果有参数,要拼装好参数) 3. 设置工作目录(很重要) 4. 启动命令 5. 等待执行完成 6. 读取输出结果 代码演示了调用uploadimg.exe工具来...
golang上传图片文件
Published: at 09:29 AM使用golang来实现图片的上传,服务端我们使用gin框架来接收保存图片 服务端 服务端路由 router.POST("/uploadimage", controller.UploadImage) 服务端保存上传的图片 这里设置了一个简单的认证,上传文件的时候需要带一个pass字段里面存储了需要认证的字符串...
golang读取excel文档转换成json
Published: at 05:34 AM我们是使用github.com/tealeg/xlsx库实现的,用法比较简单: 1. 读取excel文件 2. 遍历sheets 3. 在每个sheet中再遍历每行 当然这个库还可以写入excel文档这里就不介绍了,有兴趣的可以去github上查看。 代码如下: package main import ( "encoding/json" ...