<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[chen3feng的专栏]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/chen3feng</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; chen3feng]]></copyright><item><title><![CDATA[colortail，让 tail 命令绚丽起来]]></title><link>https://blog.csdn.net/chen3feng/article/details/5954096</link><guid>https://blog.csdn.net/chen3feng/article/details/5954096</guid><author>chen3feng</author><pubDate>Wed, 20 Oct 2010 14:23:00 +0800</pubDate><description><![CDATA[<br />colorgcc, colormake, man, vim 等的彩色可能很多人都知道了，今天介绍  colortail，让 tail 命令也多彩起来。
<br />colortail 下载地址<br />http://joakimandersson.se/projects/colortail/<br />下载后 configure, make, make check, make install 就可以使用<br />除了用 -k 选项指定色彩配置文件外，跟 tail 命令都一样。<br /> ]]></description><category></category></item><item><title><![CDATA[让 less 显示 ANSI 控制字符]]></title><link>https://blog.csdn.net/chen3feng/article/details/5935147</link><guid>https://blog.csdn.net/chen3feng/article/details/5935147</guid><author>chen3feng</author><pubDate>Tue, 12 Oct 2010 11:08:00 +0800</pubDate><description><![CDATA[<br />为了醒目，我们常把信息比如日志以彩色输出到终端，这会用到 ANSI 彩色控制字符。<br />通常输出到文件的时候，为了分析或者查看方便（很多工具不识别），则往往不输出彩色。<br /> <br />其实输出彩色还是有些工具能查看的，比如 cat 就可以，还有就是 less 也是可以的，用 -R 选项即可：<br /> <br />       -R or --RAW-CONTROL-CHARS<br />
              Like -r, but only ANSI "color]]></description><category></category></item><item><title><![CDATA[在 Windows 上通过 SSH 协议挂载远程文件系统]]></title><link>https://blog.csdn.net/chen3feng/article/details/5929883</link><guid>https://blog.csdn.net/chen3feng/article/details/5929883</guid><author>chen3feng</author><pubDate>Sat, 09 Oct 2010 16:21:00 +0800</pubDate><description><![CDATA[linux 用户应该都知道 fuse 和 sshfs 这两个东西，fuse 方便以用户模式开发文件系统，而 sshfs 则是其应用，用来把远程的 ssh 主机 mount 到本地文件系统。不要只羡慕 Linux 用户，Windows 用户也有福音了，那就是Dokan 及其SSHFS。http://dokan-dev.net/en/download/还有一个类似的商业软件，叫 ExpanDrive，http://www.expandrive.com/windows/，感觉更好用一些。使用 sshfs 最大的好]]></description><category></category></item><item><title><![CDATA[用 sscanf 解析字符串时结尾的判断]]></title><link>https://blog.csdn.net/chen3feng/article/details/5779058</link><guid>https://blog.csdn.net/chen3feng/article/details/5779058</guid><author>chen3feng</author><pubDate>Sat, 31 Jul 2010 18:49:00 +0800</pubDate><description><![CDATA[常用 sscanf 解析字符串，处理错误也很简单：sscanf 会返回实际解析并赋值了的域的个数，判断一下是否和期望的一致即可。今天却遭遇一个解析地址的 bug，是由于地址本应该是“127.0.0.1:30000”被写成 “127.0.0.1:30000:127.0.0.1:30000”，原来用 sscanf 解析，判断结果等于5就认为正确，却没有判断额外的字符。修正：    bool Assign(const char* src)
    {
        unsigned int b1, b2, ]]></description><category></category></item><item><title><![CDATA[用 proxychains 做透明代理]]></title><link>https://blog.csdn.net/chen3feng/article/details/5774983</link><guid>https://blog.csdn.net/chen3feng/article/details/5774983</guid><author>chen3feng</author><pubDate>Thu, 29 Jul 2010 22:02:00 +0800</pubDate><description><![CDATA[有时候需要连接某机器，但是直接连被屏蔽了，虽然可以用代理来搞定一些应用程序，但是很多程序不支持代理，或者只支持某些类型的代理，这时候就可以试一试 proxychains 这个软件了。比如：svn 只支持 HTTP 代理，不支持 socks4 代理，svn+ssh 方式也挺麻烦的，可以用一个 socks 转 HTTP 代理软件的，需要在 ~/.subversion/servers 利配置，用 proxychains 这个东西就更方便。proxychains 用起来就像 time, strace, ccache]]></description><category></category></item><item><title><![CDATA[万恶的夏令时]]></title><link>https://blog.csdn.net/chen3feng/article/details/5774767</link><guid>https://blog.csdn.net/chen3feng/article/details/5774767</guid><author>chen3feng</author><pubDate>Thu, 29 Jul 2010 20:15:00 +0800</pubDate><description><![CDATA[<br />帮人调试一段代码，及其慢的代码，经调试发现是因为这个没有初始化造成的。<br />这个成员成员对性能影响极大，设置与不设置，性能差了一万倍。设置为 >0 的值时，会多做相当多的额外的复杂的操作。<br />
万恶的夏令时。想节约能源，调整一下作息时间就是了，居然调整时间，这种做法跟我以前怕迟到把表拨快5分钟一样山寨。]]></description><category></category></item><item><title><![CDATA[服务器程序不要用 select 函数，可能会因越界而崩溃]]></title><link>https://blog.csdn.net/chen3feng/article/details/5756738</link><guid>https://blog.csdn.net/chen3feng/article/details/5756738</guid><author>chen3feng</author><pubDate>Fri, 23 Jul 2010 00:55:00 +0800</pubDate><description><![CDATA[<br />select 效率问题大家都知道，但是 select 正确性问题，很少有人讨论，特地点出来。<br />
linux 下 fd_set 是个 1024
 位的位图，每个位代表一个 fd 的值，这也是效率低的原因。<br />
性能问题且不提，正确性问题则更值得重视。<br /><br />
因为这是一个 
1024 位的位图，因此当进程内的 fd 值 >= 1024 时，就会越界，可能会造成崩溃。对于服务器程序，fd >= 1024 
很容易达到，只要连接数 + 打开的文件数足够大即]]></description><category></category></item><item><title><![CDATA[让 flock 支持多个命令外部和内部命令的方法]]></title><link>https://blog.csdn.net/chen3feng/article/details/5706730</link><guid>https://blog.csdn.net/chen3feng/article/details/5706730</guid><author>chen3feng</author><pubDate>Thu, 01 Jul 2010 12:39:00 +0800</pubDate><description><![CDATA[让 flock 支持多个命令外部和内部命令的方法
flock 是个外部，只支持外部命令，且不支持多个命令。
这样就可以了
# 把要执行的命令序列写成函数
$ function xxxx() { sleep 3; echo xxxx; }
# 导出给子进程
$ export -f xxxx
# OK 了
$ flock a.cpp /bin/bash /dev/stdin 
类似的方法可以推广到其他能执行命令的外部命令，比如 /usr/bin/time]]></description><category></category></item><item><title><![CDATA[实测多线程并发对随机读取的性能提升]]></title><link>https://blog.csdn.net/chen3feng/article/details/5706726</link><guid>https://blog.csdn.net/chen3feng/article/details/5706726</guid><author>chen3feng</author><pubDate>Thu, 01 Jul 2010 12:38:00 +0800</pubDate><description><![CDATA[<br />机器是4core, 单cpu，文件大小 15GiB，分成 N 个线程共随机读取一万次，SUSE10, Linux 2.6.16 内核<br />
初始机器负载基本为空，线程个数与耗时的关系如下：<br /><br />
线程个数 耗时<br />
0        31.3s<br />
1        31.3s<br />
2        25.5s<br />
4        20.2s<br />
8        16.5s<br />
12       15.0]]></description><category></category></item><item><title><![CDATA[自动设置 vim 的终端编码]]></title><link>https://blog.csdn.net/chen3feng/article/details/5706714</link><guid>https://blog.csdn.net/chen3feng/article/details/5706714</guid><author>chen3feng</author><pubDate>Thu, 01 Jul 2010 12:33:00 +0800</pubDate><description><![CDATA[<br />vim 用 termencoding 选项控制输出时的编码，这个选项默认为空，也就是不进行转换，<br />
这导致我在 GB 编码的终端下打开 UTF-8 文件，虽然能识别出来，显示却是乱码。<br />
设置终端编码当然可以，不过还是要相应设置 locale，比较麻烦。<br /><br />
通常终端编码和 LOCALE 的设置一致，因此可以借用一下这个设置：<br /><br />
let &termencoding = substitute($LC_ALL, "[a-zA-Z_]]></description><category></category></item><item><title><![CDATA[检查 Linux 下线程库的类型]]></title><link>https://blog.csdn.net/chen3feng/article/details/5706706</link><guid>https://blog.csdn.net/chen3feng/article/details/5706706</guid><author>chen3feng</author><pubDate>Thu, 01 Jul 2010 12:30:00 +0800</pubDate><description><![CDATA[linux 下有 linuxthreads 和 NPTL，nptl 比 linuxthreads 先进，目前新内核都支持 ntpl，相应的 glibc 也支持，遇到老的机器，用的还是 linuxthreads，虽然二者二进制兼容，但是某些细节上还是不同，问题现实存在，无奈也得解决。方法是用 confstr 来读取系统的配置信息：#include static bool CheckNptl(){
    char buf[32];
    confstr(_CS_GNU_LIBPTHREAD_VERSIO]]></description><category></category></item><item><title><![CDATA[gcc 下获得程序名]]></title><link>https://blog.csdn.net/chen3feng/article/details/5706675</link><guid>https://blog.csdn.net/chen3feng/article/details/5706675</guid><author>chen3feng</author><pubDate>Thu, 01 Jul 2010 12:21:00 +0800</pubDate><description><![CDATA[Windows 上我们可以用 GetMuduleName 获得可执行文件的名字。Linux 下应该是 /proc/self/exe，如果只需要获得大概的名字用作帮助信息和诊断报告等，可以用 program_invocation_name 或者 
program_invocation_short_name 
。program_invocation_name 
是进程被命令行启动时调用的名字，也就是 argv[0]。
program_invocation_short_name 是
program_in]]></description><category></category></item><item><title><![CDATA[写了个 C++ 名字的 demangle 函数]]></title><link>https://blog.csdn.net/chen3feng/article/details/5701718</link><guid>https://blog.csdn.net/chen3feng/article/details/5701718</guid><author>chen3feng</author><pubDate>Tue, 29 Jun 2010 14:06:00 +0800</pubDate><description><![CDATA[<br />当然不是自己解码的，不过有神人这么做：<br />
http://hi.baidu.com/avengine/blog/item/9b7147a94c78c4fc1e17a2f7.html<br /><br />
还有这个<br />
http://sourceforge.net/projects/php-ms-demangle/<br />
是抄的 wine 的。<br /><br />
搞这个是为了解决 gcc typeinfo::name 返回的不是原始名字的问题。<br /><]]></description><category></category></item><item><title><![CDATA[用猥琐的方式解决了 glibc 版本兼容]]></title><link>https://blog.csdn.net/chen3feng/article/details/5701707</link><guid>https://blog.csdn.net/chen3feng/article/details/5701707</guid><author>chen3feng</author><pubDate>Tue, 29 Jun 2010 14:04:00 +0800</pubDate><description><![CDATA[<br />2.6内核下编译的程序，放到2.4内核下运行不了。找不到 __stack_chk_fail@@GLIBC_2.4<br />

因为老机器上的 glibc 版本是 2.3.4，于是猥琐地解决了这个问题：<br /><br />

extern "C" void dummp_stack_chk_fail(){}<br />

__asm__(".symver dummp_stack_chk_fail, __stack_chk_fail@@GLIBC_2.4");<br />

这样]]></description><category></category></item><item><title><![CDATA[以后在这里写技术 blog 好了]]></title><link>https://blog.csdn.net/chen3feng/article/details/5701696</link><guid>https://blog.csdn.net/chen3feng/article/details/5701696</guid><author>chen3feng</author><pubDate>Tue, 29 Jun 2010 14:02:00 +0800</pubDate><description><![CDATA[<br />livespace 被 Shielded很久，懒得翻墙，悲剧。]]></description><category></category></item><item><title><![CDATA[用 LD_PRELOAD 挽救被误删的 libc.so.6]]></title><link>https://blog.csdn.net/chen3feng/article/details/5701680</link><guid>https://blog.csdn.net/chen3feng/article/details/5701680</guid><author>chen3feng</author><pubDate>Tue, 29 Jun 2010 13:56:00 +0800</pubDate><description><![CDATA[
用 LD_PRELOAD 挽救被误删的 libc.so.6
libc.so.6 的符号链接被同事误删，。
libc.so.6，不仅包含了普通的 C 运行库，还包含了系统调用的封装。
就像 Windows 系统上的 kernel32.dll 一样重要。被误删后，几乎所有新的进程都起不来，因为几乎所有的程序都依赖 libc.so.6。
因此 scp, cz, cp, ln 统统不管用。
用写一个这样的文件或许有效。$ cat /usr/lib/libc.so/* GNU ld script   U]]></description><category></category></item><item><title><![CDATA[NDIS简介]]></title><link>https://blog.csdn.net/chen3feng/article/details/476816</link><guid>https://blog.csdn.net/chen3feng/article/details/476816</guid><author>chen3feng</author><pubDate>Sat, 10 Sep 2005 07:55:00 +0800</pubDate><description><![CDATA[to be done]]></description><category></category></item><item><title><![CDATA[通过使用类型库提高VB调用DLL函数的性能]]></title><link>https://blog.csdn.net/chen3feng/article/details/9417</link><guid>https://blog.csdn.net/chen3feng/article/details/9417</guid><author>chen3feng</author><pubDate>Thu, 16 Jan 2003 08:53:00 +0800</pubDate><description><![CDATA[  本文始发于水木清华BBS(smth.org),转载请保留有关信息,谢谢! 通过使用类型库提高VB调用DLL函数的性能RoachCock@smth mailto:chen3feng@163.com, chen3fengx@163.com, chen3fengx@hotmail.com   VB虽然是个很好玩的东西,但是自身功能有限,限制了VB在某些方面的应用. MS提供了两种两种方式来增]]></description><category></category></item><item><title><![CDATA[利用动态创建自动化接口实现VB的函数指针调用]]></title><link>https://blog.csdn.net/chen3feng/article/details/9416</link><guid>https://blog.csdn.net/chen3feng/article/details/9416</guid><author>chen3feng</author><pubDate>Mon, 06 Jan 2003 10:01:00 +0800</pubDate><description><![CDATA[发信人: RoachCock (chen3feng), 信区: MicrosoftTRD 标  题: 我的 VB的函数指针调用 发信站: BBS 水木清华站 (Fri Jan  3 14:54:25 2003), 转信   本文首发于水木清华BBS MicrosoftTRD版，转载请保留有关信息   作者chen3feng(RoachCock@smth.org) email: chen3feng@]]></description><category></category></item><item><title><![CDATA[定长字符串模板类]]></title><link>https://blog.csdn.net/chen3feng/article/details/9415</link><guid>https://blog.csdn.net/chen3feng/article/details/9415</guid><author>chen3feng</author><pubDate>Sat, 02 Nov 2002 00:06:00 +0800</pubDate><description><![CDATA[本文始发于水木清华BBS,转载请保留作者信息,谢谢Auther: chen3feng (RoachCock@smth)email:  chen3feng@163.com  mailto:chen3fengx@163.com  chen3feng@hotmail.com 发信人: RoachCock (chen3feng), 信区: CPlusPlus 标  题: [代码]定长字符串模板]]></description><category></category></item></channel></rss>