下载镜像、创建网桥 docker pull redis:6.2.7 docker network create --driver bridge --subnet 172.18.0.0/16 --gateway 172.18.0.1 chirpstack-docker_defaul...
分类 软件开发 下的文章
解决向 Jenkins( Windows) 添加 Git 仓库时报错的问题
向 Jenkins( Windows) 添加 Git 仓库时总是报错,当添加 HTTPS 仓库地址时报错: Failed to connect to repository : Command "C:\Program Files\Git\bin\git.exe ls-remote -h -- >https://git.***.com/gitlab/git.git HEAD" returned status code 128: stdout: stderr: fatal: unable to access 'https://git.***.com/gitlab/git.git/': OpenSSL SSL_connect: >SSL_ERROR_SYSCALL in connection to git.***.com:443 当添加 SSH 仓库地址时报错: Failed to connect to repository : Command "C:\Program Files\Git\bin\git.exe ls-remote -h -- >git@git.***.com:gitlab/git.git HEAD" returned status code 128: stdout: stderr: Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists...
Qt 5.15.0 静态编译
配置环境 下载源码 http://download.qt.io/archive/qt/5.15/5.15.0/single/ 下载 zip 包(下载过 tar.xz 包,在 Windows 上用 7zip 解压后竟然缺少文件,而且还没有错误提示) 编译前需要安装:Perl、Python、Ruby 并确保他们的可执行路径在 Path 变量中。 Python 要安装 2.7.5 及以后的 2.7 版本,python3 是不行的。用于编译 QtWebEngine Python2.7.x 装好后把路径 C:\Python27 添加到 path,把可执行程序 python.exe 重命名为 python2.exe 安装 clang,生成 Qt 文档要用。 下载 jom https://wiki.qt.io/Jom 替代 nmake,可支持多核编译,加快编译速度。 msvc2019 版 打开 VS 自带的命令提示窗口 编译 openssl Windows 上编译需要使用 Perl 安装 perl ActivePerl (5.26、5.28)装上后配置 openssl 时用提示缺少 Win32::Console 模组,用于安装模组的 cpan 命令又需要这个模组,这也太矛盾了吧!网上也有不少人遇到这个问题,难道发布时就不测测?好奇怪呀。所以最后安装了 StrawberryPerl 5.28.2.1,一切正常。 下载 openssl 源码:https://github.com/openssl/openssl 下载 NASM 汇编编译器:https://www.nasm.us/ set path=C:\Users\Matt\AppData\Local\bin\NASM;%path% 编译静态链接库版本: perl Configure VC-WIN64A --prefix=D:\Qt\openssl-OpenSSL_1_1_1-stable\release\vc_x64_static --openssldir=D:\Qt\openssl-OpenSSL_1_1_1-stable\release\vc_x64_static no-asm no-shared # no-shared 编译成静态库 nmake nmake test 测试编译结果 Result: PASS nmake install 编译 Qt set LLVM_INSTALL_DIR=C:\Program Files\LLVM set path=D:\Qt\jom_1_1_3;%path% configure -opensource -confirm-license -static -debug-and-release -prefix "D:\Qt\kits\Qt5.15.0_MSVC2019_x64_static" -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sqlite -openssl-linked OPENSSL_PREFIX=“D:\Qt\openssl-OpenSSL_1_1_1-stable\release\vc_x64_static" -skip qtwebengine -nomake examples -nomake tests 如果想重新配置,手动删除源码根目录的 config.cache。 配置完后提示: Qt is now configured for building. Just run 'nmake'. Once everything is built, you must run 'nmake install'. Qt will be installed into 'D:\Qt\kits\Qt5.15.0_MSVC2019_x64_static'. Prior to reconfiguration, make sure you remove any leftovers from the previous build. 编译: nmake nmake install Qt is now configured for building. Just run 'jom'. Once everything is built, you must run 'jom install'. Qt will be installed into 'D:\Qt\kits\Qt5.15.0_MSVC2019_x64_static'. Prior to reconfiguration, make sure you remove any leftovers from the previous build. 编译: jom -j 12 jom install MinGW 版 打开 mingw32 版 Qt 附带的命令行工具: configure -opensource -confirm-license -static -release -platform win32-g++ -prefix "D:\Qt\build\Qt5.15.0_MinGW_x86" -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sqlite -nomake examples -nomake tests 配置完后提示: Qt is now configured for building. Just run 'mingw32-make'. Once everything is built, you must run 'mingw32-make install'. Qt will be installed into 'D:\Qt\build\Qt5.15.0_MinGW_x86'. Prior to reconfiguration, make sure you remove any leftovers from the previous build. 编译: mingw32-make -j8 mingw32-make instal...
使 DiscuzX 3.4 论坛支持代码高亮的改造方法
这里使用了 highlight.js,它的特点: 支持 196 种语言,242 种样式(绝大多数用不上) 自动语言探测(正确率似乎一般) 支持使用任意 HTML 标记 兼容任意 js 框架 只需要知道它足够牛就OK了。 可以通过 CDN 加速服务器引用: <link href="https://cdn.bootcdn.net/ajax/libs/highlight.js/11.2.0/styles/default.min.css" rel="stylesheet"> <script src="https://cdn.bootcdn.net/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script> 如果需要裁剪定制一些语言,可以直接在官网下载页面(https://highlightjs.org/download/)操作: 下载后将 highlight.min.js 和样式表 default.min.css (也可以换用其他样式表)上传到服务...
在 C++ Builder 中使位图背景透明的方法
本文提供一种使用 Graphics::TBitmap 的方法使位图背景透明化,直接上代码: Graphics::TBitmap *bm = new Graphics::TBitmap; bm->Transparent = true; bm->TransparentMode = tmFixed; bm->TransparentColor = clWhite; MForm->ImageList1->GetBitmap(2, bm); this->Canvas->Draw(10, 100, bm); delete bm; TransparentMode:设置透明模式 tmAuto:使用图片左下角像素的颜色作为透明颜色 tmFixed:使用 TransparentColor 属性指定的颜色作为透明...
QtMqtt 库的使用
QtMqtt 库是官方的 mqtt 库,但是是属于 Qt for Automation 商业套件的。需要下载源码自己编译才能用。 源码:https://github.com/qt/qtmqtt 文档:https://doc.qt.io/QtMQTT/qmqttclient.html 编译成静态库 在 Qt5.15.0_MSVC2019_x64_static\include 创建 QtMqtt 文件夹,将头文件从源码 src 文件夹拷贝过去。 set path=D:\Qt\kits\Qt5.15.0_MSVC2019_x64_static\bin;%path% qmake nmake nmake install nmake docs 使用的时候 pro 文件加 QT += mqtt MQTT Broker 非加密测试: broker:test.mosquitto.org 1883 MQTT Broker 单向向认证测试: broker:test.mosquitto.org 8883 MQTT Broker 双向认证测试: broker:test.mosquitto.org 8884 证书生成与注册 http://test.mosquitto.org/ssl/ 生成私钥: openssl genrsa -out client.key 生成客户端证书: openssl req -out client.csr -key client.key -new 在服务器上添加证书...
Qt JSON 库
Qt 的 JSON 库由几种对象和相应的头文件组成,主要的有: QJsonDocument 该类用于操作 JSON 文档。 从文件到文档对象实例: QJsonDocument jDoc(QJsonDocument::fromJson(file.readAll())) 此外还有 fromBinaryData() 或 fromRawData() 方法。 JSON 对象 obj 到 文档 到文件: QJsonDocument jDoc(obj); file.write(jDoc.toJson(QJsonDocument::Indented)); QJsonObject QJsonObject 是一个重要的类型,它就是 JSON 中的“对象”概念。一个对象就是一个键值对。 使用 insert() 插入一个键值对或覆盖一个已存在的键值对还可以删掉一个键值对, 用 remove() 可以删除一个键值对。 QJsonArray 它是 JSON 数组类,可以存储多个没有键的值(QJsonValue) QJsonValue QJsonValue 也是一个重要的常用类型,它是键值对的值或是数组的值。而值可以是一个键值对,也可以是一个数组,还可以是其它类型: bool(QJsonValue::Bool) double(QJsonValue::Double) string(QJsonValue::String) array(QJsonValue::Array) object(QJsonValue::Object) null(QJsonValue::Null) 要操作一个对象类型的值,要先把值转换成对象副本才可以: QJsonValue.toObject() 所以不能直接修改一个值 ValueA 下面的某个键的值 ValueB,只能将这个值 ValueA 转换成 ObjectA 然后修改 Object 的某个键的值 ValueB,然后再用对象 ObjectA 覆盖 ValueA(可以用 insert 方法)。如果要修改多层次的某个值,就要采用递归的方法一级一级找到要修改的值,然后用高层次的对象覆盖。这点就比 python 的 json 数据操作麻烦...