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7WnuTCUq1meE6GkKc4D/cXmgpOyW/1SmBz3XjVIi/zprZ0zf3qH5mkphtg6ksjKgKjmx1cXfZAAX6wcDBNaCL+Ortep1Dh8xDUbqbBVNBL4jbiL3i3xsfNiyJgaZ5sX7i8tmStEpLbPwvHcByuf59qJhV/bZOl8KqJBETCDJcY6O2aqhTUy+9x93ThKs1GKrRPePrWPluud7ttlgtRveit/pcBrnQcXOl1rHq7ByB8CFAxNotRUYL9IF5n3wJOgkPojMy6jetQA5Ogc8Sm7RG6vg1yow==

CMake的目录输出

也许是CMake的版本问题,某些时候以下配置只需要配置其中一项就可以达到目的,有的根本无效。
—————————————————————-
———-这是Window的特色设置,在Linux中只需要一个CMAKE_INSTALL_PREFIX即可—————-
—————————————————————
以下是几乎百分百有效的配置。

SET(CMAKE_EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_EXECUTABLE_OUTPUT_PATH_DEBUG ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_EXECUTABLE_OUTPUT_PATH_RELEASE ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_PATH_DEBUG ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_PATH_RELEASE ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/bin)

Qt项目。
cmake -A x64 -T host=x64 ../wotermt生成vc工程。
cmake –build . –config Release采用Release编译。

openssl的编译

因为应用是跨平台,所以openssl的版本选择很重要,最好是应用使用的版本是与linux系统一致的。
当前Centos7.x已经开始使用1.0.2的版本,且官方也因为linux的广泛使用,也会一直维护该分支版。
打开其发布的版本页,找到1.0.2的最新版本:
https://github.com/openssl/openssl/releases

1.下载https://github.com/openssl/openssl/archive/OpenSSL_1_0_2u.tar.gz
2.解压并检查其下INSTALL.XXX文件,因为目标是WIN64,所以选择INSTALL.W64并按它的步骤下载相关组件及编译。
3.以下是摘取出来

 To build for Win64/x64:
 
 > perl Configure VC-WIN64A --prefix=c:\some\openssl\dir
 > ms\do_win64a
 > nmake -f ms\ntdll.mak
 > cd out32dll
 > ..\ms\test

4.仍需要下载并安装NASM工具,这个工具是INSTALL.WXX没有说及的。
http://www.nasm.us/pub/nasm/releasebuilds/2.14.02/
附带完整的编译脚本
build_static_openssl_x64.bat

echo "init vc env"
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
set path_script=%~dp0
set path=C:\Users\honey\AppData\Local\bin\NASM;%path%
cd /D %path_script%\openssl_1_0_2u
perl Configure VC-WIN64A --prefix=%path_script%\lib\static
call ms\do_win64a
nmake -f ms\nt.mak clean
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
nmake -f ms\nt.mak test

build_shared_openssl_x64.bat

echo "init vc env"
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
set path_script=%~dp0
set path=C:\Users\honey\AppData\Local\bin\NASM;%path%
cd /D %path_script%\openssl_1_0_2u
perl Configure VC-WIN64A --prefix=%path_script%\lib\shared
call ms\do_win64a
nmake -f ms\ntdll.mak clean
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak install
nmake -f ms\ntdll.mak test

the difference between vt100 and vt102

The VT102 was a member of the “second generation” of the VT100 family.
The original VT100 was sold with a number of options that could be inserted
into the box. The most significant was the AVO, or Advanced Video Option,
which was pretty much just extra memory. The base VT100 supported a 24×80
mode and a 14×132 mode. It supported normal text plus one video attribute,
which could be either underlining or reverse-video – which one you got
depended on whether you selected an underline or box cursor. AVO gave you
24×132 mode and the full four video attributes (underline, reverse, bold,
blink). The VT100 also had a modem control option, providing extra RS-232
signals.
The VT102 was a closed system (no options) which provided the equivalent of
a VT100 plus AVO plus (I think) modem control. It also added one or two
new commands – if I remember correctly, “Insert Line” (open a new line,
scroll stuff below it down) and “Delete Line”, and perhaps “Insert” and
“Delete Character in Line”.
DEC many years ago *defined* “VT100 compatibility” as “equivalent to a
VT102”. All subsequent DEC products that claimed VT100 compatibility
actually supported the full 24×132 display mode, four video attributes, and
the additional commands. (Modem control is a separate issue – “VT100
compatibility” is usually taken to refer only to *software* compatibility.)
As far as I know, the industry has pretty much followed DEC’s definition,
except that many terminal emulators are incapable of properly supporting
the 132-wide mode due to limitations of their displays.
There is absolutely no difference between the keypads of VT100’s and
VT102’s.

ssh的连接复用

Host mini
   ControlPath ~/.ssh/master-%r@%h:%p
   ControlMaster auto
   ControlPersist yes
   HostName 192.168.10.104
   Port 22
   User abc

VC2017的运行时库提取

如果你是用Visual Studio 2015和2017来编写C或C++程序,那么就已经是基于UCRT的。
为了方便提取运行时库,请安装EveryThing搜索工具。
工具下载地址:https://www.voidtools.com/zh-cn/downloads/
以VC2017运行时库为例。
VC2017运行时库【UCRT库】包括以下几种文件。
Microsoft.VC141.CRT:
1.在EveryThing的输入界面搜索:Microsoft.VC141.CRT

2.再搜索ucrt,在Redist的子目录下,才是正常的UWP或ucrt库,文件一般是41个。

七牛日志分析

七牛日志格式

116.231.10.133 HIT 0 [07/May/2019:09:04:56 +0800] "GET http://wdl1.cache.wps.cn/per-plugin/dl/addons/pool/win-i386/wpsminisite_3.0.0.37.7z HTTP/1.1" 206 66372 "-" "-"

Qt的相关代码

int getDownloadSize(QString line) {
    int idx = line.indexOf("HTTP/1.1\"");
    if(idx > 0) {
        QString sub = line.mid(idx);
        QStringList sets = sub.split(" ");
        int size = sets.at(2).toInt();
        return size;
    }
    return 0;
}
 
 
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
 
    QString dpath("F:\\日志0508\\18");
 
    QDir d(dpath);
    QStringList fs = d.entryList();
    qint64 plug_total = 1;
    qint64 other_total = 1;
    for(int i = 0; i < fs.size(); i++) {
        QString f = fs.at(i);
        QFile file(dpath+"\\"+f);
        if(!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
            continue;
        }
        int linecnt = 0;
        while(!file.atEnd()) {
            QByteArray line = file.readLine();
            if(line.indexOf("wdl1.cache.wps.cn") < 0) {
                continue;
            }
            int idx = line.indexOf("win-i386");
            int size = getDownloadSize(line);
            qint64 skidx = file.pos();
            if(idx > 0) {
                plug_total += size;
            }else{
                other_total += size;
            }
            linecnt++;
            if(linecnt % 10000 == 0) {
                printf("\r\nlinecnt:%d - skidx:%lld - plug_total:%lld - other_total:%lld - ratio:%5f", linecnt, skidx, plug_total, other_total, double(plug_total) / double(other_total));
            }
        }
        printf("\r\nlinecnt:%d - plug_total:%lld - other_total:%lld - ratio:%5f", linecnt, plug_total, other_total, double(plug_total) / double(other_total));
    }
    printf("\r\nplug_total:%lld - other_total:%lld - ratio:%5f", plug_total, other_total, double(plug_total) / double(other_total));
    return a.exec();
}

fedora换阿里云镜像源

su -
cd /etc/yum.repos.d/
mv fedora.repo fedora.repo.backup
mv fedora-updates.repo fedora-updates.repo.backup
wget -O /etc/yum.repos.d/fedora.repo http://mirrors.aliyun.com/repo/fedora.repo
wget -O /etc/yum.repos.d/fedora-updates.repo http://mirrors.aliyun.com/repo/fedora-updates.repo
dnf clean all
dnf makecache