Recent Posts

运行程序时添加时间限制

问题

因为有个临时的需求,所以开了服务并监听在某个公网端口上,然后忘了关了 …… 直到很久才想起 ……

解决

对于类似的使用 …

vim 里打开 file:line

0x00

Linux 里,很多工具都会按文件加行号file:line)的格式输出,比如 grep

$ grep -nr "Sanitize in progress..."
drivers/mmc/core/mmc_ops.c:1008:     pr_debug("%s: Sanitize in progress...\n", mmc_hostname(host));

又比如 Linux 动态 …

Linux Virtual Memory Split with 3.5G/0.5G

问题

项目里用到的一款开发板,配置的是 32 位 ARM 处理器。因为业务程序相关方面的实际开销,需要在用户态虚拟地址空间 …

Using RCS Keywords in Perforce

使用 svn 时,有时会把版本管理系统的信息嵌入到代码里,比如版本号、最近修改时间,等等。在软件调试时,这会很有帮助。因为 …

混用不同版本的 libc 造成程序崩溃

程序发生崩溃,调试器提示崩溃发生在 libc 的 free() 函数里面:

Debug Assertion Failed: _CrtIsValidHeapPointer(pUserData)

初步判断,可能是堆(Heap)被写坏了。

于是修改代码,在程序 …

Highlight All Occurrences of Selected Word

在选中某个单词(比如变量、函数、自定义类型,等等)时,如果能把屏幕上所有出现这个单词的地方,都高亮显示出来,对于程序 …

Remove Trailing Whitespace in Visual Studio

编程习惯里通常会建议删除行尾的空格。在 Visual Studio 里,可以通过 Ctrl+K, Ctrl+\ 的按键操作来实现。

不过每次通过手动的方式,未免有 …

What is ULP?

The maximum relative error is defined as ulp (units in the last place).

The ULP is defined as follows:

If x is a real number that lies between two finite consecutive
floating-point numbers a and b, without being equal to one of them,
then ulp(x) = |b - a|, otherwise ulp …

Find the file by inode number

在命令行下会遇到一些文件名里包含有中文、符号或者某些奇怪字符的文件,如果命令的自动补全不完整,键盘操作起来 …

Set Event Callback in OpenCL

这个 API 用来注册回调函数,在(Event 对应的)Command 执行到指定状态时,回调函数会被触发。这个 API 在使用及实现上不是很复杂。 以下 …