Fix Wsl Missing System Vhd

Written on October 15, 2024

无法将磁盘“C:\Program Files\WSL\system.vhd”附加到 WSL2: 系统找不到指定的文件。 错误代码: Wsl/Service/CreateInstance/CreateVm/MountVhd/HCS/ERROR_FILE_NOT_FOUND

Solution:

  1. Download msi from Microsoft/WSL at Github (https://github.com/microsoft/WSL/releases)
  2. ...
Read More

Vlookup By Awk

Written on March 8, 2022

awk -F',' '{if(FNR==NR){arr[$1]=$2} if(FNR!=NR){print $1","arr[$1]}}' haystack.file target.file

FNR refers to the...

Read More

CSV文件输出

Written on December 29, 2015

excel打开utf-8编码的csv会乱码,wps则支持gbk、utf-8编码的csv。输出时需要把内容转码为gbk。 另,保存文件名,建议先url encode。这样ie可支持中文等字符。文件名则不一定要转换为gbk编码。以utf-8输出文件名,ie8、chrome实测通过。

Example written in PHP:


<?php header('Content-Type: text/csv; charset=gbk');...
Read More

在LNMP环境下定位常见问题

Written on October 8, 2015

适用环境

  1. linux
  2. nginx
  3. php
  4. mysql
  5. redis

定位常见问题,并不针对特定环境,思路正确即可。仅是本文所使用工具暂时只支持linux + nginx。

基础部署

  1. 对于linux + nginx环境,建议部署nginx访问日志分析监控脚本,实时了解业务运行状况。目前仅对CentOS6.3兼容,支持请求响应状态分析、请求响应时长分析。
  2. php-fpm开启slowlog记录(request_slowlog_timeout),用于分析造成慢请求的backtrace。
  3. ...
Read More