旧版本应用与win10兼容

大多数早期windows版本创建的应用可以在win10下正常运行,但也有部分程序无法正常运行, 可以尝试通过兼容性设置解决. 修改高DPI设置 在使用一款windows客户端产品时,由于机器分辨率较高导致其中某一个可执行文件无法运行, 通过修改高DPI设置解决,下面是具体的解决方法: 环境说明: 操作环境: win10, 屏幕分辨路1920*1080 应用环境: 双琦弱视治疗系统v4.0.2 解决方式: 右击属性, 选择高优先级设置 弹出新对话框后,勾选替代高DPI缩放行为缩放执行, 并选择应用程序 Microsoft 帮助文档中整理设置兼容性的方法 设置 说明 兼容性模式 使用早期版本的 Windows 中的设置运行程序。如果你确信此程序是为某个特定版本的 Windows 设计(或用于该版本)的,请尝试使用此设置。 降低颜色模式 在程序中使用数量有限的一组颜色。某些旧版程序在设计时所用的颜色较少。 使用 640 × 480 的屏幕分辨率运行 如果此程序的图形出现锯齿或显示不正确,请尝试使用此设置。 更改高 DPI 设置 如果你的程序无法在具有高 DPI 显示屏的电脑上正常显示(其功能显得模糊或太大或太小),请选择“更改高 DPI 设置”,然后再尝试使用“属性”对话框中的以下选项之一: 选择要使用的 DPI 1. 在“程序 DPI”部分中,选中“使用此设置修复此程序的缩放问题,而不是‘设置’中的缩放问题”,以使用想要用于此程序的 DPI 设置。 注意 此操作只会更改你正在调整的应用的 DPI。如果你想要为所有应用调整此设置,请选择“开始”菜单 >“设置” >“高级缩放设置”,然后按照说明进行操作。 有关更改所有应用的设置的详细信息,请参阅修复显示模糊的应用。 若要“使用主显示器默认的 DPI” 请选择以下选项之一: - 已登录到 Windows -登录到 Windows 时使用为主显示器设置的 DPI。这是默认设置。 - 打开此程序 - 打开特定程序时使用为主显示器设置的 DPI。 更改应用程序的高 DPI 缩放模式 在“高 DPI 缩放替代”区域中,选中“覆盖高 DPI 缩放行为”,然后再尝试使用以下选项之一: - 应用程序 > - 禁用所有的 Windows 缩放设置,并仅使用应用开发人员的设置。在先前版本的 Windows 中,此选项被称为“高 DPI 设置时禁用显示缩放”。 - 系统 - 覆盖程序的 DPI 设置,让该程序像在低 DPI 显示屏上一样运行。在高 DPI 显示屏上,这将导致程序显示模糊。 - 系统(增强) >- Windows 将尝试对此程序使用增强的 DPI 缩放。因此,某些程序将以清晰的文本显示在高 DPI 显示屏上。这不适用于所有程序。 以管理员身份运行此程序 某些程序需要管理员权限才能正常运行。以管理员身份登录电脑以使用此选项。 更改所有用户的设置 将该程序的设置应用到电脑上的所有帐户,然后选择 需要管理员权限“更改所有用户的设置”。系统可能会提示你提供管理员密码或确认你的选择。 参考 使旧版应用或程序与 Windows 10 兼容

2019-08-20 · 1 min · 118 words

sysctl-查询修改Linux内核参数

 sysctl命令可以_实时_(runtime)查看和修改linux 内核参数。这个命令可以在大多数发行版本找到, 另外内核参数,也可以通过procfs 文件系统,在 /proc/sys/kernel下 进行查看和修改。 查看指定参数 # sysctl kernel.sched_child_runs_firstkernel.sched_child_runs_first = 0 查看所有参数 # sysctl -a |moresysctl: reading key "net.ipv6.conf.all.stable_secret"sysctl: reading key "net.ipv6.conf.default.stable_secret"abi.vsyscall32 = 1crypto.fips_enabled = 0debug.exception-trace = 1debug.kprobes-optimization = 1 修改指定参数 # sysctl -w kernel.sched_child_runs_first=1 kernel.sched_child_runs_first = 1 注意等号前后不能有空格 修改含多个值的参数 # sysctl -w net.ipv4.ip_local_port_range="1025 60999"net.ipv4.ip_local_port_range = 1025 60999 通过修改procfs 文件系统实现 修改指定参数 # echo 1 > /proc/sys/kernel/sched_child_runs_first# sysctl kernel.sched_child_runs_firstkernel.sched_child_runs_first = 1 修改含多个值的参数 # echo "32768 60999" > /proc/sys/net/ipv4/ip_local_port_range# sysctl net.ipv4.ip_local_port_rangenet.ipv4.ip_local_port_range = 32768 60999 持久化设置 以上修改是临时性的,机器重启后失效,如果要持久化保存,可修改/etc/sysctl.conf # cat /etc/sysctl.confkernel.sched_child_runs_first=1 修改完毕后,使用以下命令使得参数立即生效 ...

2019-08-06 · 1 min · 207 words

kill多个同名进程

问题: 本周在配合系统测试过程中,发现系统报文接收异常, 排查过程中发现应用进程启动异常。 当时状态模拟如下: [root@centosgpt server]# ps -ef|grep daemon dbus 934 1 0 Jul22 ? 00:01:15 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation root 941 1 0 Jul22 ? 00:00:15 /usr/sbin/NetworkManager --no-daemon root 81345 1 0 09:27 ? 00:00:00 daemon root 81348 1 0 09:27 ? 00:00:00 daemon root 81351 1 0 09:27 ? 00:00:00 daemon root 81354 1 0 09:27 ? 00:00:00 daemon root 81357 1 0 09:28 ? 00:00:00 daemon root 81360 1 0 09:28 ? 00:00:00 daemon status root 81364 1 0 09:28 ? 00:00:00 daemon start root 81367 1 0 09:28 ? 00:00:00 daemon status root 81370 1 0 09:28 ? 00:00:00 daemon root 81372 80347 0 09:28 pts/2 00:00:00 grep --color=auto daemon daemon status, daemon start 都属于异常进程。 ...

2019-07-26 · 3 min · 488 words

查看进程运行时间及上下文切换次数

运行环境: CentOS Linux release 7.5.1804 (Core)Linux centosgpt 5.2.0-rc4 #1 SMP Sun Jun 16 13:25:49 CST 2019 x86_64 x86_64 x86_64 GNU/Linux 进程的运行时间: 通过ps 查看 [root@centosgpt ~]# ps -o etime= -p "$$" 55:12 其中"$$"可以替换成具体的进程id, etime后的等号 man ps -o format ... If all column headers are empty (ps -o pid= -o comm=) then the header line will not be output. ... 上下文切换次数: 通过proc文件 /proc/{pid}/status [root@centosgpt ~]# grep ctxt /proc/1177/status voluntary_ctxt_switches: 248 nonvoluntary_ctxt_switches: 2 volutary_ctxt_switches : 表示主动调度; 发生场景 等待IO或资源 调用__schedule,主动让出cpu nonvolutary_ctxt_switches : 表示抢占式调度,; 发生场景:1时间片用完了, 需要切换到其他进程; 2 发生在高优先级进程被唤醒。 通过sysstat 前提:安装sysstat: ...

2019-07-20 · 2 min · 283 words

python 解压指定路径下zip文件

概述: 项目变更版本需要源码包, 检查关键代码是否缺失,其中有一个步骤需要进入指定目录解压所有.ZIP压缩包 问题: 1. 并行处理; 2. zipfile extract后中文名称乱码; 解决: 并行处理使用 ,参考之前的扫描端口的套路修改; zipfile 解压乱码,踏着前人的足迹,查看了下python zipfile 源码open 函数中 如果zinfo.flag_bits 不是utf-8 都默认设为cp437 def open(self, name, mode="r", pwd=None, *, force_zip64=False): ... if zinfo.flag_bits & 0x800: # UTF-8 filename fname_str = fname.decode("utf-8") else: fname_str = fname.decode("cp437") ... ZIP File Format Specification 中描述 APPENDIX D - Language Encoding (EFS) ------------------------------------ D.1 The ZIP format has historically supported only the original IBM PC character encoding set, commonly referred to as IBM Code Page 437. This limits storing file name characters to only those within the original MS-DOS range of values and does not properly support file names in other character encodings, or languages. To address this limitation, this specification will support the following change. 代码: import os import zipfile from queue import Queue import time import threading from pathlib import Path print_lock = threading.Lock() def unzip(file): file_name, ext = os.path.splitext(file) if ext == ".zip": try: f = zipfile.ZipFile(file, 'r') for fn in f.namelist(): extract_path = Path(f.extract(fn)) extract_path.replace(fn.encode('cp437').decode('gbk')) with print_lock: print(file, 'unzip ok') except: with print_lock: print(file, 'unzip error') pass def threader(): while True: worker = q.get() unzip(worker) q.task_done() def create_thread( threadnums ): for x in range(threadnums): t = threading.Thread(target=threader) t.daemon = True t.start() if __name__ == "__main__": q = Queue() startTime = time.time() path = os.getcwd()+'\\源码' os.chdir(path) file_list = os.listdir(path) print(file_list) create_thread(100) for unzipfile in file_list: q.put(unzipfile) q.join() print('Time taken:', time.time()-startTime) 参考: python zipfile extract 解压 中文文件名 ...

2019-07-12 · 2 min · 240 words

获取进程信息相关命令

任务ID: pid: 进程ID tid:线程ID tgid:主线程ID 显示线程需要增加 L参数 ps -eLo pid,tid,tgid,pgrp,args 任务状态: 进程状态描述: D uninterruptible sleep (usually IO) R running or runnable (on run queue) S interruptible sleep (waiting for an event to complete) T stopped by job control signal t stopped by debugger during the tracing W paging (not valid since the 2.6.xx kernel) X dead (should never be seen) Z defunct (“zombie”) process, terminated but not reaped by its parent ...

2019-07-03 · 2 min · 350 words

文件签名及校验方法

概述: 在上网下载镜像或安装文件时经常会看到MD5,SHA-1,SHA-256 ,signature,一起显示,这些文件帮助我们验证下载的文件是否损坏或者被篡改以及文件的真实性, 散列值可以使用windows, macOS,Linux内置命令进行验证。 文件签名可以使用工具gpg进行校验。 校验 完整性校验 通过文件散列来判断文件下载或移动后,是否有损坏, 可以用MD5, SHA1,SHA256,SHA224, SHA384等。我平时工作中用到的是MD5,判断相关版本文件是否修改。 LINUX md5sum,sha1sum, sha256sum md5sum /path/to/file sha1sum /path/to/file sha256sum /path/to/file WINDOWS certutil, Get-FileHash(需要使用windows Powershell) certutil -hashfile yourfilenameaddress MD5 certutil -hashfile yourfilenameaddress SHA1 certutil -hashfile yourfilenameaddress SHA256 Get-FileHash C:\path\to\file.iso -Algorithm MD5 Get-FileHash C:\path\to\file.iso -Algorithm SHA1 Get-FileHash C:\path\to\file.iso -Algorithm SHA256 Get-FileHash C:\path\to\file.iso -Algorithm SHA384 Get-FileHash C:\path\to\file.iso -Algorithm SHA512 Get-FileHash C:\path\to\file.iso -Algorithm MACTripleDES Get-FileHash C:\path\to\file.iso -Algorithm RIPEMD160 MACOS md5 ,shasum md5 /path/to/file shasum /path/to/file shasum -a 1 /path/to/file shasum -a 256 /path/to/file 真实性校验 使用gpg工具 , 主要分为两步 ...

2019-06-27 · 3 min · 502 words

insmod: ERROR: could not insert module *.ko: Unknown symbol in module

问题: 在实际编译运行 什么是RCU :API 中的例子 **rcu_example**时报错 [root@centosgpt rcu]# insmod list_rcu.ko insmod: ERROR: could not insert module list_rcu.ko: Unknown symbol in module [root@centosgpt rcu]# dmesg|tail [13084.720516] list_rcu: Unknown symbol synchronize_rcu (err -2) [13084.720561] list_rcu: Unknown symbol call_rcu (err -2) 原因: 在写代码的时候漏掉了原来例子中的 MODULE_LICENSE(“GPL”); __class_create函数仅为 GPL模块导出(标记为使用 EXPORT_SYMBOL_GPL导出)的模块, 需要使用MODULE_LICENSE(“GPL”),才能使用相关功能。 /kernel/rcu/tree.c ... void synchronize_rcu(void) { RCU_LOCKDEP_WARN(lock_is_held(&rcu_bh_lock_map) || lock_is_held(&rcu_lock_map) || lock_is_held(&rcu_sched_lock_map), "Illegal synchronize_rcu() in RCU read-side critical section"); if (rcu_blocking_is_gp()) return; if (rcu_gp_is_expedited()) synchronize_rcu_expedited(); else wait_rcu_gp(call_rcu); } EXPORT_SYMBOL_GPL(synchronize_rcu); ... void call_rcu(struct rcu_head *head, rcu_callback_t func) { __call_rcu(head, func, -1, 0); } EXPORT_SYMBOL_GPL(call_rcu); 参考: How to Resolve – insmod: ERROR: could not insert module hello.ko: Unknown symbol in module – unknown symbol class_unregister ...

2019-06-17 · 1 min · 107 words

shell16进制hex和10进制转换

方法: 1 bc命令 [root@centosgpt ~]# echo “ibase=16; FF” |bc 255 2. bash [root@centosgpt ~]# echo $((0xFF)) 255 3. printf [root@centosgpt ~]# printf “%d\n” 0xFF 255 4. dc [root@centosgpt ~]# dc -e ‘16i FF p’ 255 限制: 其中bc,dc 可以不受整数位数限制 如:64-bit integer limit of 2^64, 当大于64位时验证下各个脚本的处理结果 1 bc [root@centosgpt ~]# echo “ibase=16; 7FFFFFFFFFFFFFFFF” |bc 147573952589676412927 2 echo [root@centosgpt ~]# echo $((0x7FFFFFFFFFFFFFFFF)) -1 3. printf [root@centosgpt ~]# printf “%ld\n” 0x7FFFFFFFFFFFFFFFF -bash: printf: warning: 0x7FFFFFFFFFFFFFFFF: Numerical result out of range 9223372036854775807 ...

2019-06-14 · 1 min · 89 words

Vmware + Centos7 + NAT 方式连接公网

使用gdb调试时, Missing separate debuginfos, use: debuginfo-install glibc-2.17-260.el7.x86_64, 需要虚拟机联网更新。 环境: 操作系统:Windows 10 Vmware: 12.5.5 build-5234757 Centos 7 : Linux centosgpt 5.2.0-rc2 可以使用自动获取ip或者配置静态地址两种方式: DHCP模式: 1 VMware 配置: VMware中使用动态分配IP的需要勾选 编辑->虚拟网络编辑器->VMnet信息中->使用本地DHCP服务将IP地址分配给虚拟机 2 主动获取动态IP, 使用dhclient动态获取IP , 增加-v参数显示相关日志。 sudo dhclient –v 设置开机自动处理服务: 增加文件 /etc/init.d/net-autostart #!/bin/bash # Solution for No Internet Connection from VMware # ### BEGIN INIT INFO # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO dhclient -v 给文件增加权限 chmod 755 net-autostart 增加系统服务 chkconfig --add net-autostart ...

2019-06-06 · 1 min · 106 words