Lastest

vc++打包发布自带依赖dll

问题 相信很多人都遇到过vx项目打包发布出去之后,用户安装运行提示缺少mfc140u.dll(数字是vc版本决定的),然而奇怪的是很少有人讨论具体怎么解决这个问题 我尝试过的办法 静态发布 编译时候选择静态方式使用mfc,all done,打包之后的程序自带依赖 问题: 某些依赖组件只有dll,没有lib。别问我为什么,这里不做讨论。这时候就没办法使用静态方式的mfc了 安装启动vc发型包安装 innosetup打包安装程序时候,打包vc发型包,安装过程中进行安装。 [Files] Source: "D:\dep\mfc140u.dll"; DestDir: "{app}"; Flags: ignoreversion [Run] ;Filename: {tmp}\vc_redist.x86.exe; Parameters: "/q /passive /Q:a /c:""msiexec /q /i vcredist.msi"""; StatusMsg: "Installing VC++ 2017 Redistributables..." 问题: 装完要重启,不然找不到mfc140u.dll 安装包体积大 查看dll依赖,innosetup制作安装包时候拷贝 查看依赖 > cd c:\Program Files (x86)\Microsoft Visual...

从git历史删除中恢复某一个文件

有个功能点之前不需要,删掉了,现在又需要还得把他找回来。确定git能完成这项任务,但是学会之后并没有实操,早已经不记得了。 这里记录一下操作过程 git命令查看文件删除hash戳 git log --all --full-history upload\xxx.php 输出(已做处理,不要照抄): commit d6cd1e2bd19e03a81132a23b2025920577f84e37 Author: zzz zzz@qq.com Date: Wed Apr 11 11:11:11 2020 +0800 修改记录。。。。。 ok,我们明确知道删除改文件的commit是d6cd1e2bd19e03a81132a23b2025920577f84e37 2. 查看该提交文件记录 git show d6cd1e2bd19e03a81132a23b2025920577f84e37 upload\xxx.php 3. 找回文件,git checkout 后面指定hash,紧接着加一个"~1",表示从删除前的commit获取 git checkout d6cd1e2bd19e03a81132a23b2025920577f84e37~1 upload\xxx.php all done

Centos 7升级内核5.x

当前环境查看 uname -r 3.10.0-514.el7.x86_64 安装新版本内核 rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm yum --enablerepo=elrepo-kernel install kernel-ml -y 查看当前已安装内核 查看已安装版本 rpm -qa | grep kernel kernel-3.10.0-1062.18.1.el7.x86_64 kernel-tools-libs-3.10.0-1062.18.1.el7.x86_64 kernel-tools-3.10.0-1062.18.1.el7.x86_64 kernel-ml-devel-5.5.13-1.el7.elrepo.x86_64 kernel-3.10.0-957.el7.x86_64 kernel-headers-3.10.0-1062.18.1.el7.x86_64 kernel-ml-5.5.13-1.el7.elrepo.x86_64 卸载安装的内核 rpm -e kernel-ml-devel-5.5.13-1.el7.elrepo.x86_64 rpm -e kernel-ml-5.5.13-1.el7.elrepo.x86_64 查看启动项目 ...

php并发优化

服务器配置 8核e5-2630L 2.4ghz, 16g内存 20MB带宽 问题场景描述 jemter 300并发开始出现502错误 CPU利用率60% 内存利用率50% 网络流量1MB到1.5MB 分析 cpu和内存利用率不高,网络也没有耗尽。肯定是卡在IO上了。 netstat查看TIME_WAIT,数量正常 opcache查看,已开启,没问题 详细查看压测错误,发现压测过程中出现"SQL Error 1040: Too Many Connection"。既然超过连接数,那就查看限制多少连接吧。 mysql参数 max_connections = 2000; # 2000连接,没毛病,问题不在这 到底有多少连接。一看也是惊呆了,大量的sleep连接没有释放。好了这就是原因了。 解决 系统内同时使用了laravel orm,和pdo对象。系统二开,为了方便增加了laravel orm。 那就看看是谁没关闭连接吧。 去掉所有laraval orm的数据库操作,去掉laravel orm连接创建方法。运行测试,发现还是会保留大量sleep mysql connection 去翻pdo创建代码 // 目测就是这个ATTR_PERSISTENT => true了 $this->connection = new \PDO...

golang chan的用法

实验目的 chan相关前置知识点,请参考本文底部链接。墙裂推荐阅读。 假设系统内除了主线程之外,有四个线程connector,sender,receiver,heartbeat connector,负责建立网络连接,在连接断开的时候进行重连 sender,负责发送数据报 receiver,负责接收数据报 heartbeat,负责监控心跳 如何启动connector connector需要等待ConnectorNotifier,值为1连接,值为2重连 建立连接之后,发送三次ConnectorConnected,通知sender, sender,receiver可以开工 var ConnectorConnected chan int = make(chan int, 3) // 已连接通知 func connector(){ ..... // 成功之后发送三次通告 ConnectorConnectedNotifier <- 1 ConnectorConnectedNotifier <- 1 ConnectorConnectedNotifier <- 1 } 如何启动sender, receiver,以及heartbeat 等待ConnectorConnectedNotifier,收到...

typecho调用二级分类文章group by incompatible with sql_mode=only_full_group_by错误

分析 调用typecho二级分类文章列表显示data base query error 代码目录下搜索"Database Server Error",找到文件var/Typecho/Common.php 282行附近 var/Typecho/Common.php if ($isException && $exception instanceof Typecho_Db_Exception) { $code = 500; @error_log($message); //覆盖原始错误信息 $message = 'Database Server Error'; if ($exception instanceof Typecho_Db_Adapter_Exception) { $code = 503; $message = 'Error establishing a database connection'; } else if ($exception instanceof Typecho_Db_Query_Exception) { $message = 'Database Query Error'; // 增加va...

鸡兔同笼问题的一种解法

问题 假设有鸡和兔子总共80只,总共280只脚,问有多少只鸡,多少只兔子 解答 让所有的鸡和兔子抬起一只脚,那么还有280-80=200,还有200只脚在地上 让所有的鸡和兔子再抬起一只脚,那么地上还有200-80=120只脚。 这时候,所有的鸡已经坐在地上了。剩下的兔子还有两只脚着地,对应省的120只脚。 所以,笼子里120/2=60兔子 有80-60 = 20只鸡 公式化 假设有A和B两种动物。每只动物A有m只脚,每只动物B有n只脚,有m>n。假设A和B总共有S只,总共有脚P只。 那只要让所有动物抬起n只脚,剩下的酒都是动物A的脚。 剩下脚的数量为:P - Sn = 280 - 802 = 120 只脚 剩下的都是动物A,每只有m只脚,还有m-n只脚在地上 所以A动物有 x = (P - S*n)/(m-n) 只 = 120/(4-2) = 60 只 B动物有 y = S - x 只 = 80 - 60 = 20 只 x = (P - S*n)/(m-n) y = S - x

Android tools:replace用法

使用场景,为什么需要Android tools:replace 假设我们使用了第三方android module,这个module处于某种原因在开发的时候使用了app_name。比如下面这样 <application android:icon="@mipmap/ic_launcher" android:allowBackup="true" android:backupAgent="com.github.shadowsocks.ConfigBackupHelper" android:extractNativeLibs="true" android:label="@string/app_name" android:supportsRtl="true" android:networkSecurityConfig="@xml/network_security_config" android:banner="@mipmap/banner"> ........ </application> 我们自己app也有指定android:label,那么就会产生冲突报错大致如下 Manifest merger failed : Attribut...

flutter插件引用aar导致Duplicate class android.support.v4.app.INotificationSideChannel

错误信息 Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:28.0.0) Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:28.0.0) Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:28.0.0) Duplicate class android.su...

kotlin中when的用法

when是什么 when用于在kotlin中实现类c语言中的switch关键字 when怎么用 when (x) { 1 -> print("x == 1") 2 -> print("x == 2") else -> { // Note the block print("x is neither 1 nor 2") } } 差不多是类C语言中这么个意思 swicth(x){ case 1: ....... break; case 2: ....... break; default: // kotlin else ....... break; } 帮助 https://kotlinlang.org/docs/reference/control-flow.html