zoukankan      html  css  js  c++  java
  • Memo-Tech

    Qt

    install Qt on Ubuntu

    • Download *.run file;
    • Click downloaded file to install. Note that gcc module is also required;
    • Open Qt Creator and try to compile a project;
    • If it reports cannot find -lGL, do the following things:
      • Open terminal and run locate libGL
      • If the library is missing, install via libgl1-mesa-dev package
      • run sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so(choose a url listed by locate libGL)

    deploy on linux

    配置Qt

    ~/.bashrc中加入

    export PATH=/home/mas/Qt/5.14.2/gcc_64/bin:$PATH
    export LD_LIBRARY_PATH=/home/mas/Qt/5.14.2/gcc_64/lib:$LD_LIBRARY_PATH
    export QT_PLUGIN_PATH=/home/mas/Qt/5.14.2/gcc_64/plugins:$QT_PLUGIN_PATH
    export QML2_IMPORT_PATH=/home/mas/Qt/5.14.2/gcc_64/qml:$QML2_IMPORT_PATH
    

    然后执行source ~/.bashrc

    编译linuxdeployqt

    cd ~
    git clone https://github.com/probonopd/linuxdeployqt.git
    cd linuxdeployqt
    

    tools/linuxdeployqt/main.cpp中的下述代码注释掉

    // openSUSE Leap 15.0 uses glibc 2.26 and is used on OBS
        /*if (strverscmp (glcv, "2.27") >= 0) {  //注释版本检查
          qInfo() << "ERROR: The host system is too new.";
          qInfo() << "Please run on a system with a glibc version no newer than what comes with the oldest";
          qInfo() << "currently still-supported mainstream distribution (xenial), which is glibc 2.23.";
          qInfo() << "This is so that the resulting bundle will work on most still-supported Linux distributions.";
          qInfo() << "For more information, please see";
          qInfo() << "https://github.com/probonopd/linuxdeployqt/issues/340";
          return 1;
        }*/
    

    使用Qt编译之

    发布Qt程序

    以已编译好的程序2048为例

    cp 2048 ../2048-release
    cd ../2048-release
    linuxdeployqt 2048 -appimage
    

    https://www.jb51.net/article/164480.htm

    C++

    • explicit: 在类构造函数加此关键字可以禁止隐式类型转换.
    • protected: 此标记下的类成员不可被类外函数调用, 但可以被继承类调用.

    maintenance tool

    手动添加​储存库要定位一个储存有QT在线安装镜像的地址,这可难坏我了,但是经过不懈努力还是被我找到了http://download.qt.io/static/mirrorlist/,显示了各国的qt镜像站点,中国有四个,我用的是中科大的站,点击HTTP会进入一个网络文件夹。
    然后依次进入/online/qtsdkrepository/windows_x86/root/qt/,在这个界面复制一下当前地址框地址
    在储存库中选择临时储存库
    点击添加,在编辑界面写入刚刚复制的地址http://mirrors.ustc.edu.cn/qtproject/online/qtsdkrepository/windows_x86/root/qt/添加后可以进行一次网络测速,看是否连通。

    pixel & point

    • a pixel is a "picture element"(pix-el) in image. A 10x10 image is made up of a set of pixels in a grid 10 wide by 10 high, totaling 100 pixels.
    • a point(pt) is (frac{1}{72})inch
    • If a image is 72ppi(pixel per inch), then 1pt = 1 pixel.
    • 理想情况下, (1pt = frac{1}{72}inch). 但point的实际尺寸由系统决定, 例如, 当系统调整缩放比例时, (1pt)的实际大小也会随之改变.
    • 在Qt中, 设备的DPI(Dot Per Inch, 约等于Pixel Per Inch, 即PPI)可以通过QScreen类获取. physicalDotsPerInch给出物理DPI, 而logicalDotsPerInch给出逻辑DPI(字体的pointSize就是由逻辑DPI计算得到的). 一般使用逻辑DPI.

    QTextDocument

    https://www.cnblogs.com/techiel/p/8058430.html

    QTextCursor

    • access and modify QTextDocument;
    • mimic the behavior of a cursor in a text editor;
    • current character: the character immediately before the cursor position();
    • current block: the block that contains the cursor position();
    • selection: the text between anchor() and position()

    QSessionManager

    • session manager tracks a session;
    • session = {(application, state)}
    • state = {documents opened, position and size, etc.}

    QT_BEGIN_NAMESPACE

    //qglobal.h
    # define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE {
    # define QT_END_NAMESPACE }
    

    Qt 随机数

    #include <QDateTime>
    int main () {
    	qsrand(QDateTime::currentDateTime().toTime_t());
    }
    

    添加图标

    1. .ico文件添加到对应的文件夹内
    2. .pro文件中添加RC_ICONS = yourIcon.ico

    LaTex

    pandoc

    pandoc is a powerful tool for markdown - latex conversion.

    markdown to latex

    pandoc example.md -o example.tex --listings
    --listings will produce syntax highlighting for code blocks.
    --number-sections or -N will number the sections

    depth of TOC and section number

    setcounter{tocdepth}{1} %stop at section
    setcounter{secnumdepth}{3} %stop at subsubsection
    
    egin{document}
    %...
    end{document}
    
    name depth
    part -1
    chapter 0
    section 1
    subsection 2
    subsubsection 3
    paragraph 4
    subparagraph 5

    TikZ/PGF

    mathcha.io

    Drawing a binary tree

    % use lualatex to compile
    documentclass[tikz,border=5]{standalone}
    usetikzlibrary{graphs,graphdrawing,arrows.meta}
    usegdlibrary{trees}
    egin{document}
    egin{tikzpicture}[>=Stealth]
    graph[binary tree layout,nodes={circle, draw}]{
      a -> {   
        b -> { 
          c -> { 
            d -> { e, f }, 
            / %/表示空结点 
          }, 
        h -> { i, j }
        },
        k -> {
          l -> {
            m -> { n, o },
            p -> { q, } %缺省表示结点不存在
          }, 
          s -> {
            v -> {w, x},
            y -> {z}
          }
        }
      }
    };
    end{tikzpicture}
    end{document}
    

    see Drawing binary trees with LaTeX labels
    线条控制

    调整段落边距

    egin{adjustwidth}{1cm}{0cm}
    % text
    end{adjustwidth}
    

    ubuntu/linux杂记

    vimrc

    set nu
    set ts=4 sw=4 smarttab cin
    syntax on
    
    set nobackup
    set noswapfile
    
    map <F6> :call C_R()<CR>
    func! C_R()
    exec "w"
    exec "!g++ -std=c++11 % -o %<"
    exec "! ./%<"
    endfunc
    
    map <F7> :call C_R_T()<CR>
    func! C_R_T()
    exec "w"
    exec "!g++ -std=c++11 % -o %<"
    exec "! ./%< < ./%<.in"
    endfunc
    

    Remove firefox completely

    sudo apt-get purge firefox
    sudo rm -rf ~/.mozilla/firefox/ /etc/firefox/ /usr/lib/firefox/ /usr/lib/firefox-addons/
    

    Removing Firefox in Ubuntu with all add-ons like it never existed

    用nohup在服务器上后台运行程序

    nohup [command] &
    注意此命令执行后不能直接关闭终端, 而应当用exit手动终止连接后关闭终端.

    如何创建自己的bash命令

    1. $HOME下创建一个bin文件夹
    2. ~/.bashrc中添加export PATH=$PATH":$HOME/bin"
    3. . ~/.bashrc
    4. bin中创建脚本,格式如:
    #!/bin/bash
    [script]
    
    1. chmod +x [name of your script]

    来源

    在目标服务器上执行批量的命令

    #!/bin/bash
    ssh root@192.168.0.23 << remotessh
    killall -9 java
    cd /data/apache-tomcat-7.0.53/webapps/
    exit
    remotessh
    

    远程执行的内容在<< remotesshremotessh之间, remotessh可以随便修改成其他形式. exit退出远程节点. 如果不想日志文件在本机出现可以修改配置
    ssh root@192.168.0.23 > /dev/null 2>&1 < < remotessh

    bash: passing parameters

    1. Basically, if you want your customized bash command to accept some parameters, some files for example, put a reference to them using "$1", "$2", etc. Note that bash allows autocomplete of filenames itself.
    2. We can use < or > to redirect stdin and stdout for c++ executable. We should use echo, however, in order to pass some input to our executable. For instance, echo 1 "hello" 2 > ./your_executable.

    wget

    download a full site : wget --random-wait -r -p -e robots=off -U mozilla www.example.com

    查看硬盘

    df -h

    Anbox

    见官方文档

    PDF工具

    需要安装poppler-utils

    desciption of poppler-utils

    Poppler is a PDF rendering library based on Xpdf PDF viewer.
    This package contains command line utilities (based on Poppler) for getting information of PDF documents, convert them to other formats, or manipulate them:

    • pdfdetach -- lists or extracts embedded files (attachments)
    • pdffonts -- font analyzer
    • pdfimages -- image extractor
    • pdfinfo -- document information
    • pdfseparate -- page extraction tool
    • pdfsig -- verifies digital signatures
    • pdftocairo -- PDF to PNG/JPEG/PDF/PS/EPS/SVG converter using Cairo
    • pdftohtml -- PDF to HTML converter
    • pdftoppm -- PDF to PPM/PNG/JPEG image converter
    • pdftops -- PDF to PostScript (PS) converter
    • pdftotext -- text extraction
    • pdfunite -- document merging tool

    LaTex

    sudo apt-get install texlive-full
    sudo apt-get install texlive-xetex
    sudo apt-get install texlive-lang-chinese
    //sudo apt-get install texstudio
    

    win10下linux子系统

    安装

    1. 开启开发者模式
    2. 通过Win10任务栏中的Cortana搜索框搜索打开“启用或关闭Windows功能”,向下滚动列表,即可看到“适用于Linux的Windows子系统(Beta)”项。打开。
    3. 在应用商店下载ubuntu18

    文件浏览器

    浏览当前文件夹explorer.exe .

    终端美化——cmder

    1. 下载cmder-mini.zip并解压
    2. Cmder.exe所在文件夹添加到环境变量中
    3. cmd中键入Cmder.exe /REGISTER ALL以在任意文件夹下右键打开cmd
    4. 设置cmder:
      • General: scheme改为xterm,startup task改为{WSL::bash}
      • Appearance: 勾选Hide caption always
      • Tab bar: 去选Tabs on bottom,Tab double click actions - Tab bar改为Open new shell

    linux服务器密钥

    1. ssh-keygen
    2. ssh-copy-id -i ~/.ssh/*.pub root@?.?.?.?

    Ubuntu服务器建站

    安装wordpress: https://www.zhihu.com/question/35279626

    查看进程

    ps -aux
    

    win10装机

    工具:微PE(00002-20190618-WePE_64_V2.0.exe),win10iso文件(00002-20190618-Win10_1903_V1_Chinese(Simplified)_x64.iso)

    1. 下载微PE,插上U盘并将微PE安装到U盘上。微PE安装程序不要放在U盘上。
    2. 将iso文件拖入U盘内
    3. 重启进入PE系统
    4. 格式化C盘
    5. CGI备份还原Windows安装器安装。其中,Windows安装器中,引导驱动器安装在一个百兆级别的小盘里(比如Z盘),安装磁盘为C盘
    6. 上一步完成后,关机,拔出U盘,开机,进入win10系统设置界面
    7. 使用驱动精灵快速安装必要驱动

    开机密码设置设置-账户-账户设置-改用本地账户登录

    密码与安全

    • 00001-20190613-echo.cpp提供文档加密算法,加密方式由个人秘钥唯一决定。主要用于对密码生成算法代码的加密。
    • 00001-20190613-gen_enc解密后可以得到核心的密码生成算法,整合了一代和二代的算法。
    • 待解决:将rand函数源代码整合到代码中,加强程序的跨平台适应性

    生成伪单词

    I split a word into syllables, and a syllable into a consonant and a vowel, or a single vowel sometimes, if it is the first syllable of a word.
    Both the consonant and vowel are defined in a generalized way:

    • a consonant is a string composed of consonant characters
    • a vowel is basically a string composed of vowel characters, including a,e,i,o,u,y, with or without an appendix composed of consonant characters

    The criterion for judgement is based on pronunciation rule.
    y is a special character which can both be a vowel or a consonant.

    1. I assert y a vowel if and only if it is not the first character and if it is preceded by a consonant
    2. I assert a string of consonant characters a consonant if and only if it is the maximal prefix of some word satisfying the preceding definition. Note that y should be considered specially
    3. I assert a string of consonant characters a appendix of a vowel, if and only if it is the maximal appendix of some word preceded by a vowel

    In order to generate an artificial word,

    1. I wish to get a list of vowels, of consonants, of vowel appendices, alongside the probability of each element
    2. In the same time, I have to determine the probability that a vowel has an appendix composed of consonant characters
    3. I also have to determine the probability that a word is leaded by single vowel

    Task 1 & 3 are straightforward: stick to the definition and do an analysis on the list of English words.
    Task 2 requires splitting words into syllables using the outcome of Task 1. I first split a word into vowels and substrings of consonant characters. If a substring is at the back of the word, mark it an appendix. As for those between two vowels, scan for the longest appendix that form a consonant, by inspecting the consonant list. Once it is done, the rest of the substring is marked as an appendix. By doing so, some new appendices could be found.

    生成随机数

    I decide to settle 3 main problems:

    1. the aimed algorithm must accept a sequence of 0 and 1, and generate an infinite sequence of 0 and 1 which is most random-like
    2. I must determine whether or not a sequence is random-like. A sequence 0101..., for example, is definitely not random-like
    3. It has to be made sure that the outcome strongly depend on the income. That is, the algorithm must be an injective function

    Above was my initial aspiration. Yet after some inquiry in depth, I recognized that the whole thing itself forms a systematic subject, indicating that I'd better give up my daydreams at least for now. Nevertheless, my interest about the related subjects has been aroused.

    A temporary random system is based on the knowledge of primitive root.

    文档加密

    模拟手写体

    字体 陈旭东字体

    Sub 字体修改()
    '
    ' 字体修改 宏
    '
        Dim R_Character As Range
    
        Dim FontSize(5)
        ' 字体大小在5个值之间进行波动,可以改写
        FontSize(1) = "14"
        FontSize(2) = "15"
        FontSize(3) = "16"
        FontSize(4) = "17"
        FontSize(5) = "18"
    
        Dim FontName(1)
        '字体名称在三种字体之间进行波动,可改写,但需要保证系统拥有下列字体
        FontName(1) = "CXD6763_Newest"
        'FontName(2) = "萌妹子体"
        'FontName(3) = "李国夫手写体"
    
        Dim ParagraphSpace(5)
        '行间距 在一定以下值中均等分布,可改写
        ParagraphSpace(1) = "23"
        ParagraphSpace(2) = "23.5"
        ParagraphSpace(3) = "24"
        ParagraphSpace(4) = "24.5"
        ParagraphSpace(5) = "25"
    
        '不懂原理的话,不建议修改下列代码
    
        For Each R_Character In ActiveDocument.Characters
    
            VBA.Randomize
    
            'R_Character.Font.Name = FontName(Int(VBA.Rnd * 3) + 1)
            R_Character.Font.Name = "CXD6763_Newest"
    
            R_Character.Font.Size = FontSize(Int(VBA.Rnd * 5) + 1)
    
            R_Character.Font.Position = Int(VBA.Rnd * 3) + 1
    
            R_Character.Font.Spacing = 0
    
        Next
    
        Application.ScreenUpdating = True
    
        For Each Cur_Paragraph In ActiveDocument.Paragraphs
    
            Cur_Paragraph.LineSpacing = ParagraphSpace(Int(VBA.Rnd * 5) + 1)
    
        Next
            Application.ScreenUpdating = True
    
    End Sub
    

    注意 宏运行完后要把字体改为紧缩-2磅,以上操作都在office2019下完成。

    浏览器视频无法播放?

    禁用硬件加速。以Opera为例,在搜索框中键入opera://flags,禁用Hardware-accelerated video decode

    浏览器插件

    1. Install Chrome Extensions - 作者: Opera Software
    2. 简悦 - SimpRead - 作者: Kenshin Wang
    3. FVD Video Downloader - 作者: NimbusWeb

    Virtual Private Network

    最后更新: 2020/6/16

    名称 最优套餐/年 每月/USD 详情 备注
    Panda 2 2.49 SSR, 3台设备, 全平台
    Lets 1.02 2.61 3秒连接, 全局加速/智能分流, 12国, 2台设备, Win/And/iOS/Mac 先买(n)年青铜会员, 再买一周铂金会员. 可能不安全.
    CyberGhost 3 2.75 59国, 7台设备, 全平台, 不支持支付宝 赠送2个月
    Nord 2 3.49 59国, 6台设备, 全平台
    Express 1 8.33 稳定, 不限速, 94国, 5台设备, 全平台 首次赠送3个月(6.77/月)
  • 相关阅读:
    js web简单的路由管理器
    Flutter Android Toast Message(flutter访问Android Toast Message)
    web 常用开发工具
    vim 常用指令
    Bootstrap5 多级dropdown
    nginx proxy
    asm align 对齐数据
    nodejs stream 创建读写流
    asm FPU 寄存器
    Nestjs 上传文件到七牛云
  • 原文地址:https://www.cnblogs.com/maoruimas/p/12316154.html
Copyright © 2011-2022 走看看