小明思考

高性能服务器端计算
posts - 59, comments - 291, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

2008年4月18日

     摘要: VS2005 SP1的编译兼容性问题  阅读全文

posted @ 2008-04-18 18:01 小明 阅读(1094) | 评论 (0)编辑 收藏

2008年3月12日

     摘要: 使用完成端口的一些基本技巧  阅读全文

posted @ 2008-03-12 11:51 小明 阅读(1395) | 评论 (6)编辑 收藏

2008年3月10日

     摘要: 多进程服务端实现-共享socket  阅读全文

posted @ 2008-03-10 14:09 小明 阅读(1404) | 评论 (2)编辑 收藏

2007年10月12日

     摘要: 如何写printf的wrapper函数  阅读全文

posted @ 2007-10-12 14:13 小明 阅读(1268) | 评论 (0)编辑 收藏

2007年6月19日

     摘要:   阅读全文

posted @ 2007-06-19 16:31 小明 阅读(1676) | 评论 (0)编辑 收藏

2007年6月6日

     摘要:   阅读全文

posted @ 2007-06-06 17:44 小明 阅读(2754) | 评论 (4)编辑 收藏

2007年5月15日

     摘要: 从lua源码中学到的一点小东西  阅读全文

posted @ 2007-05-15 13:38 小明 阅读(3031) | 评论 (6)编辑 收藏

2007年5月5日

     摘要: D3D的摄像机动画  阅读全文

posted @ 2007-05-05 07:55 小明 阅读(616) | 评论 (1)编辑 收藏

2007年5月4日

     摘要: D3D的画线能力  阅读全文

posted @ 2007-05-04 13:33 小明 阅读(1072) | 评论 (0)编辑 收藏

     摘要: D3D的画点能力  阅读全文

posted @ 2007-05-04 12:19 小明 阅读(1098) | 评论 (0)编辑 收藏

2007年4月5日

     摘要: C++源文件编码问题  阅读全文

posted @ 2007-04-05 15:30 小明 阅读(2315) | 评论 (5)编辑 收藏

2007年4月4日

     摘要: UltraEdit的一个Bug  阅读全文

posted @ 2007-04-04 13:51 小明 阅读(1581) | 评论 (5)编辑 收藏

     摘要: 如何让指针指向自己  阅读全文

posted @ 2007-04-04 12:16 小明 阅读(1668) | 评论 (7)编辑 收藏

2007年3月13日

     摘要: Windbg(CDB) 新手指南  阅读全文

posted @ 2007-03-13 14:39 小明 阅读(2262) | 评论 (0)编辑 收藏

2007年3月8日

也许有人不知道CDB是什么,CDB是windbg的小兄弟,基于command line,对于我这个比较喜欢用command line的人,CDB比windbg更容易上手。

象GDB,CDB这些工具,命令都很多,但是我们只要熟记最常用的"三板斧"就可以工作了。

1.启动
   1)直接调试:  
      gdb program [core]
      cdb program or cdb -z DumpFile
   2)attach方式
      gdb attach pid
      cdb -pn ExeName or cdb -p pid

2.显示堆栈
   GDB: bt
   CDB: k

3. 设置断点
   GDB: b [file:]line
   CDB: bp 'file:line'

4. 运行/继续运行
   GDB: run [arglist] 
             c   继续运行 
   CDB: g

5. 单步
   GDB : n (step over) s (step into)
   CDB : p

6. 打印变量的值
    GDB : p expr
    CDB: ? expr

说老实话,CDB过于复杂,学起来比GDB难.

BTW:用CDB之前设置一下symbol的path
set _NT_SYMBOL_PATH=srv*c:\symbols*http://msdl.microsoft.com/download/symbols
   
   

posted @ 2007-03-08 14:33 小明 阅读(1314) | 评论 (0)编辑 收藏

2006年12月27日

     摘要: [STL] loop & erase   阅读全文

posted @ 2006-12-27 18:01 小明 阅读(2531) | 评论 (10)编辑 收藏

2006年11月8日

项目需要,写了一个帮助L10N的工程师计算utf8的小工具(html page)。如下

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> An utf8 count tool  </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf16">
<script>
    
function utf16to8(str) {
        
var out, i, len, c;

        out 
= "";
        len 
= str.length;
        
for(i = 0; i < len; i++) {
        c 
= str.charCodeAt(i);
        
if ((c >= 0x0001&& (c <= 0x007F)) {
            out 
+= str.charAt(i);
        } 
else if (c > 0x07FF) {
            out 
+= String.fromCharCode(0xE0 | ((c >> 12& 0x0F));
            out 
+= String.fromCharCode(0x80 | ((c >>  6& 0x3F));
            out 
+= String.fromCharCode(0x80 | ((c >>  0& 0x3F));
        } 
else {
            out 
+= String.fromCharCode(0xC0 | ((c >>  6& 0x1F));
            out 
+= String.fromCharCode(0x80 | ((c >>  0& 0x3F));
        }
        }
        
return out;
    }
    
function count()
    {
        
var temp = f1.value;
        temp
=temp.replace(/\\r/g,"\r");
        temp
=temp.replace(/\\n/g,"\n");
        result.innerHTML
=utf16to8(temp).length;
    }
</script>
</HEAD>

<BODY>
<TEXTAREA id="f1" NAME="f1" ROWS="10" COLS="50"></TEXTAREA>
<br/>
<INPUT TYPE="button" value="count length" onclick="count()">
<div id="result"></div>
</BODY>
</HTML>

posted @ 2006-11-08 13:32 小明 阅读(1177) | 评论 (0)编辑 收藏

2006年9月29日

     摘要: snprintf的正确用法和错误用法  阅读全文

posted @ 2006-09-29 10:27 小明 阅读(5133) | 评论 (4)编辑 收藏

2006年9月28日

     摘要: 工程师必备  阅读全文

posted @ 2006-09-28 15:30 小明 阅读(1651) | 评论 (2)编辑 收藏

2006年9月27日

     摘要: 介绍识别字符编码的小技巧  阅读全文

posted @ 2006-09-27 10:00 小明 阅读(1344) | 评论 (2)编辑 收藏