• 20191022


    主模块,次模块:
    if __n
    ame__ == "__main__":
     
     当前模块的测试

    e
    num 转化为int
    e
    num Color { red, white, blue }; 
      
    void f() 

       int n; 
       n = red;    // change n to 0 
       n = white;  // change n to 1 
       n = blue;   // change n to 2 
    }  

    py是源文件 pyc编译后的文件 pyo 是源文件优化后的文件 pyd其他语言编写的python库
    import py_compile
    py_co
    mplie.compile(r"H: est est.py")
    编译整个文件夹
    impor
    t compileall
    compileall.comile_dir(dirpath)
    python -O -m py_complie file.py

     player = new QMediaPlayer;
        videoWidget = new QVideoWidget;
        player->setVideoOutput(videoWidget);
        player->setMedia(QUrl::fromLocalFile("1.mp4"));
        videoWidget->show();
        player->play();

     xml文件:
     
    write(){
      QFile file("xx.xml");
      file.open();
      QDomDocument doc;
      QDomProcessingInstruction instruction;
          instruction = doc.createProcessingInstruction("xml","version="1.0" encoding="UTF-8"");
          doc.appendChild(instruction);

     }
     

     
    void DomXml::XmlWrite(const QString& filename){
        QFile file(filename);
        if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
            return;
        QDomDocument doc;
        QDomProcessingInstruction instruction;
        instruction = doc.createProcessingInstruction("xml","version="1.0 "encoding="UTF-8"");
        doc.appendChild(instruction);  ///第一行

        QDomElement root = doc.createElement(tr("上海地铁一号线"));  ///第二行
        do
    c.appendChild(root);
        QDomElement station = doc.createElement(tr("站点"));
        QDomAttr id = doc.createAttribute(tr("编号"));
        QDomElement name = doc.createElement(tr("站点名字"));

        QDomElement pushname = doc.createElement(tr("按钮名称"));

        ///设置属性
     
      QDomText text;
        id.setValue(tr("1"));
        station.setAttributeNode(id);
        text = doc.createTextNode(tr("莘庄"));
        name.appendChild(text);
        text = doc.createTextNode(tr("XZstation"));
        pushname.appendChild(text);

        station.appendChild(name);
        station.appendChild(pushname);
        root.appendChild(station);

        station = doc.createElement(tr("站点"));
        id = doc.createAttribute(tr("编号"));
        name = doc.createElement(tr("站点名字"));

        pushname = doc.createElement(tr("按钮名字"));

        id.setValue(tr("2"));
        station.setAttributeNode(id);
        text = doc.createTextNode(tr("外环路"));

        name.appendChild(text);
        text = doc.createTextNode(tr("WHroadstation"));
        pushname.appendChild(text);
        station.appendChild(name);
        station.appendChild(pushname);
        root.appendChild(station);
        QTextStream out(&file);
        doc.save(out,4);
        file.close();
    }
    void DomXml::XmlReader(const QString &filename){
        QDomDocument doc;
        QFile file(filename);
        file.open(QIODevice::ReadOnly);
        doc.setContent(&file);

        QDomElement docElem = doc.documentElement();
        QDomNode n = docElem.firstChild();
        while(!n.isNull()){
            QDomElement e = n.toElement();
     
            qDebug()<<e.tagName()<<":"<<e.text();
            qDebug()<<"test"<<endl;
            n = n.nextSibling();
      }
        file.close();
    }
     

    Nginx常用功能
    1、Http代理,反向代理:作为web服务器最常用的功能之一,尤其是反向代理。
    2、负载均衡
    Nginx提供的负载均衡策略有2种:内置策略和扩展策略。内置策略为轮询,加权轮询,Ip hash。扩展策略,就天马行空,只有你想不到的没有他做不到的啦
     
    去掉vim中下划线  synstax  off
    [ -f "$f1" -a -f "$f2" ] && echo 1 || echo 0
    -a and -o  or  -!
    [] 中用 -a -o ,!
    [[]]  用&& || !
    test  [] 相同
    #参数个数判断
    [ $# -ne 2]&&{
        echo "USEAGE: num1 num2"
    }
    判断是不是整数
    [ "`echo "123a"|sed -r 's#[^0-9]##g'`" = "123" ]&& echo 1||echo 0
    1
    :%sg#$1#$b#

    cur_free=`free -m|awk '/buffers//{print $NF}'`
     
    lamp和lnmp都是用来运行php网站的。 一个是apache,一个是nginx,
     
    监控磁盘,数据库,服务,内存 ``取值
    ss/netstat/lsof
    ss -lntup   端口监控
    telnet ssh nc nmap
    ps -ef
    ps -ef|grep mysql|wc -l  监控进程
    1 wget/curl
    2>dev/null|grep
    web服务:
    curl -I -s -o /dev/null -w "%{http_code}"
    if [ -z "$a" -o -z "$b"]
        then;

    ser -r ''
    网站目录的增删改查:
    思想: 看一下文件是否被串改,
    find /var/www/html/ -type f|xargs md5sum >/tmp/md5
    if []
    then
    数据库中间件:
    $0  文件名及路径
    $1,$2 第一个参数第二个参数
    $* 把参数集合成一个参数
    $# 参数个数
    $? 上次的运行的返回值
    $$ 脚本的pid
    .和source 放在父进程进程把配置文件加载到 bash sh放在子进程
    取标量的长度:
    echo $a|wc -L
    echo ${#a} 变量的字串
    expr length
    awk length
    整数计算
    expr(())   let  bc $[] awk  typeset
    ''  ""  , 区别:  '' 所见即所得  "" 
    调用变量的意思:
    (())
    bc 运算
    i=`echo $i+1|bc`
    action
    main $*
    wget -T 超时  --spider -t 2 请求次数 $1 &>/dev/null
     
    开机启动顺序
    %s#yyyy#kkk#g
     
     
     
     
     
     
     
     
     
  • 相关阅读:
    Yarn的运行原理(执行流程)
    Hive 表类型简述
    hive 表类型
    Hadoop小知识点总结1
    电商交易项目案例
    乘用车辆和商用车辆销售数据分析
    搜狗搜索日志分析系统
    mysql group by 对多个字段进行分组
    group by
    输出GPLT
  • 原文地址:https://www.cnblogs.com/countryboy666/p/11717597.html
Copyright © 2020-2023  润新知