ubuntu 安装 nodejs
添加源: curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - 安装: apt install -y nodejs PS: 可能出现警告: sudo: unable to resolve host 主机名 vim /etc/hosts 127.0.0.1 后面 添加 主机名
ubuntu配置DNS
vim /etc/network/interfaces 添加一行 dns-nameservers 114.114.114.114 cat /etc/resolv.conf 就多了一行 nameserver 114.114.114.114 DNS 修改成功 systemd-resolve --status 查看DNS 在最后
ubuntu配置swap
swapon -s 查看swap free -m 查看系统内存使用情况 df -h 查看磁盘使用情况 fallocate -l 4G /swapfile 创建swap文件4G chmod 600 /swapfile 设置权限保护 mkswap /swapfile 初始化为swap文件 swapon /swapfile 启用swap /etc/fstab 后加 /swapfile none swap sw 0 0 设置为启动自动挂载swap swapoff /swapfile ...
快速算根号
def f(s, k, x): a = k b = 1 for i in range(x): t = a a = a * a + b * b * s b = 2 * t * b return a / b math.sqrt(2) 1.4142135623730951 f(2, 1.5, 4) 1.4142135623730951
QString 实用方法
s.remove(QRegExp("\\s")); // 删除空白 s.split('-'); // 分割 s.remove("a", Qt::CaseInsensitive); // 删除全部a 不区分大小写 s.remove("a", Qt::CaseSensitive); // 删除全部a 区分大小写
ubuntu server note
python -i https://pypi.tuna.tsinghua.edu.cn/simple 快速源 shell grep -rn '内容' 路径 查找文件内容 netstat -tunlp 查看应用端口 sudo passwd user 修改user密码 apt-get update 更新软件库 sudo apt-get autoremove --purge name 卸载 htop 查看进程 kill PID * 关闭进程 -9 强杀 netstat -ap | grep ...
QAxObject QAxWidget 页面打开 用户自己关闭页面 进程变成后台进程不关闭 解决方案
/* Excel 为例 其他同理 QAxObject 打开的界面必须要 主动 delete 才能关闭后台 但保持打开的界面 怎么办呢 经过测试 其实也一样 提前 delete QAxObject 并不会关闭已打开的界面 而当用户手动关闭界面后 会自动关闭进程而不进入后台 */ QAxObject *excel = new QAxObject(); QAxObject *work_books = new QAxObject(); QAxObject *work_book = new ...
全局屏蔽 QSpinBox QComboBox QDoubleSpinBox 等的滚轮事件响应
/* 网上绝大多数方法 都是 重写类的 Event函数 然后还要提升或者全部修改 下面的方法除了有警告 其他完美 一个函数全局类似 将下面的函数直接放到 main.cpp 就可以全局屏蔽 其他控件 其他事件 都可以参考类似操作 */ void QComboBox::wheelEvent(QWheelEvent *e) { /* 全局 屏蔽 QComboBox 鼠标滚动 有警告 warning C4273: “QComboBox::wheelEvent”: dll 链接不一致 note: ...
c++ 类的静态模板函数 不写到 头文件 的方法
a.h #pragma once class A { public: static int a(); template <typename T> static T b(); }; a_t.h #pragma once #include "a.h" template <typename T> T A::b(){ T r; return r; } a.cpp #include "a.h" int A::a(){ int r; return r; }
Qt table 右击菜单判断位置
QPoint pos = QCursor::pos(); // 鼠标坐标 const int tableVerticalHeaderWidth = table->verticalHeader()->width(); // 纵向表头宽度 const int tableHorizontalHeaderHeight = table->horizontalHeader()->height(); // 横向表头高度 // 纵向表头 int verticalHeaderIndex = ...