<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feeds.feedsky.com/styles/temp01.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feeds.feedsky.com/csdn.net/LocalVar" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feeds.feedsky.com/csdn.net/LocalVar" type="application/rss+xml"></fs:self_link><lastBuildDate>Thu, 08 Jan 2009 16:55:00 GMT</lastBuildDate><title>局部变量的作用域</title><link>http://blog.csdn.net/LocalVar/</link><item><title>解决了一个困惑很久的bug</title><link>http://blog.csdn.net/LocalVar/archive/2009/01/08/3735372.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3735372.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3735372.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3735372</trackback:ping><description>让这个bug困扰了很久，前一段太忙只找了个临时解决方案而没有追究原因，今天终于把它搞清楚了。由于测试时只在多cpu系统上出现，我甚至一度怀疑它是cpu的bug 。  两个c/s结构的网络通讯程序，服务器端使用完成端口模型，客户端使用阻塞模型，双方以一种客户端发送命令，服务器端处理，然后返回应答的方式通讯。问题出在服务器端。以下是服务器端代码的大致处理逻辑：  long volatile g_busy = 0;void iocp_thread(){	while( GetQueuedCompletionStatus() )	{		if( InterlockedCompareExchange( &amp;g_busy, 1, 0 ) != 0 )			WSASend( &quot;服务器忙&quot; );		// 处理命令		ProcessCommand();		WSASend( &quot;应答信息&quot; );		InterlockedExchange( &amp;g_busy, 0 );	}}其中ProcessCommand需要互斥运行（这是简化的逻辑，实际上有很多不同的命令，有&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3735372.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Fri, 09 Jan 2009 00:55:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2009/01/08/3735372.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2009/01/08/3735372.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>发布一个小工具：EasyDump</title><link>http://blog.csdn.net/LocalVar/archive/2009/01/06/3721850.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3721850.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3721850.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3721850</trackback:ping><description>为了分析用户使用过程中出现的软件Bug，经常需要.dmp文件的帮助。一般我们会用WinDbg或adplus制作这个文件，可这两个工具都有点“太难”了，往往要费九牛二虎之力才能教会用户。而让程序在崩溃时自动转储或用Dr. Watson转储虽然使用简单，却只能做崩溃转储，对死锁之类的情况则无能为力。  所以我决定自己写一个小工具降低一下制作.dmp文件的难度，也就有了今天发布的这个EasyDump（轻松转储）。代码和可执行文件都放到google code（也是刚注册的，尝试一下:)）上去了，大家可以到http://code.google.com/p/easytools/下载。  程序还没有很好的测试过，如果有bug的话，应该可以直接在项目主页上报告。另外下一步考虑增加三个功能：首先是异常过滤，因为first chance异常太多了！如果选择了生成.dmp的话，一秒钟可能就有十个甚至更多的文件，设置了异常过滤后，可以把一些不关心的异常屏蔽掉，不生成文件。其次是如果没有second chance的话，就把first chance的文件直接删掉，也有助于减少不必要的文件。第三是界面的国际化，也发&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3721850.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Wed, 07 Jan 2009 00:31:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2009/01/06/3721850.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2009/01/06/3721850.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>编译选项的统一管理：Property Manager</title><link>http://blog.csdn.net/LocalVar/archive/2008/12/31/3664514.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3664514.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3664514.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3664514</trackback:ping><description>当一个solution中的project越来越多以后，管理编译选项，将成为一件很麻烦的事，单独对每个project进行设置不仅繁琐，而且容易出错。但实际上，visual studio已经为我们提过了统一的管理界面—Property Manager。  在visual studio中，每个c++ project的general属性页中，都有一项&quot;Inherited Project Property Sheets&quot;，我们可以在这里指定一个或多个Property Sheet（不要和GUI开发中的Property Sheet搞混了，完全两个概念）供项目继承。在被继承的属性表（父属性表）中，我们设置好默认选项，然后把project中对应的选项设置为&quot;inherit from parent or project defaults”就可以使用父属性表中的设置了。这样，在solution层面上准备一个Property Sheet，再让其下的所有project继承，即可实现编译选项的统一管理。  在visual studio的view菜单中选择property manage&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3664514.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Wed, 31 Dec 2008 19:01:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2008/12/31/3664514.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2008/12/31/3664514.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>C++/CLI的用途</title><link>http://blog.csdn.net/LocalVar/archive/2008/12/29/3637716.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3637716.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3637716.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3637716</trackback:ping><description>作为一个有着正常审美观的人，我简直无法忍受C++/CLI（以及managed c++）的丑陋。不过，近来发现，这个丑东西也还有点用，在把原生开发接口包装成托管开发接口时，比C#的互操作容易的多（互操作看了看，头大呀）。磕磕绊绊几天，终于把一个SDK开发包转换完成了。总结经验如下：  1. 对于clr中的引用类型，定义变量时要用个^符，如&quot;String^ var1&quot;、&quot;array^ var2&quot;、&quot;array^ strarr&quot;等，值类型不用。一个类型是值类型还是引用类型，取决于定义时用的是value struct/class还是ref struct/class。  2. 定义枚举要用enum struct/class, 否则是个原生枚举，C#里不能用。可指定数值类型和flags属性，如下：       [FlagsAttribute]        public enum class TestEnum : unsigne&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3637716.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Mon, 29 Dec 2008 23:38:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2008/12/29/3637716.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2008/12/29/3637716.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>用Windows Live Writer在csdn发布blog</title><link>http://blog.csdn.net/LocalVar/archive/2008/12/27/3622485.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3622485.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3622485.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3622485</trackback:ping><description>这两天往CSDN搬迁(准确的说是复制)BLOG，同时也开始把Windows Live Writer作为编辑器，发现确实比Web界面的编辑器好用多了。把这两天的使用经验记录下来，可能对像我一样的wlw初级用户有一点参考价值。  账户配置  选择“其它账户服务”，填入自己的blog地址，例如我的是“http://blog.csdn.net/localvar”。下一步中的日志类型选择“MetaWeblog API”，服务地址填“http://blog.csdn.net/localvar/services/metablogapi.aspx“即可，注意把其中的“localvar”换成自己的账号。  安装插件  由于经常贴代码，所以我安装了一个语法高亮插件“Syntax highlighted text”，但这个插件的英文版不支持中文，所以我又在这里下载了这个插件的中文版。插件的安装也很简单，解包后放在wlw的安装位置下的plugins文件夹中即可。  贴图  可以直接把图片拖放到wlw中，这样发布blog时，图片就自动上传了。但建议大家不要这样做，因为这样上传的图片会被放到一个名为“MetaWe&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3622485.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Sun, 28 Dec 2008 01:20:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2008/12/27/3622485.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2008/12/27/3622485.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>重张开业</title><link>http://blog.csdn.net/LocalVar/archive/2008/12/27/3620739.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3620739.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3620739.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3620739</trackback:ping><description>以前CSDN的Blog非常不好用，所以搬走了。最近发现改进了不少，虽然还有很多问题，但总体上已经相当不错了，所以决定重新回到这里（但原博客http://blog.vckbase.com/localvar将继续同步更新）。原来的烂摊子懒得收拾了，就连文章带评论一块删除了，一切从零开始。以前的老文章也重新贴上来，但日期用的仍是最初发布的时间。  请大家多多支持！&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3620739.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Sat, 27 Dec 2008 18:41:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2008/12/27/3620739.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2008/12/27/3620739.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>命令行下进行数字签名</title><link>http://blog.csdn.net/LocalVar/archive/2008/11/18/3647960.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3647960.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3647960.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3647960</trackback:ping><description>网上介绍数字签名的文章，大多使用signtool的signwizard命令实现，这种方式虽说简单，却需要人为干预，不能自动执行。msdn上说signtool的sign命令可以在命令行中完成签名，但描述的相当模糊，试了半天，终于找到了它的使用方法，一共执行四条命令即可，前三条一次性执行，最后生成一个个人证书(pfx)，最后一条用于实际签名，可以放在post build event中去自动执行。  1. makecert生成x.509证书和私钥, 会弹出界面要求输入两次密码, 我输的是123, 其中localvar studio是公司名    makecert /sv sign.pvk /n &quot;CN=localvar studio&quot; sign.cer  2. 把x.509证书转换为Software Publisher Certificate    cert2spc sign.cer sign.spc  3. 把pvk转换为pfx, 例子中的123是私钥密码    pvk2pfx -pvk sign.pvk -pi 123 -spc sign.spc -pfx sign.&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3647960.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Tue, 18 Nov 2008 15:43:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2008/11/18/3647960.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2008/11/18/3647960.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>多线程和函数里的静态变量</title><link>http://blog.csdn.net/LocalVar/archive/2008/05/29/3635067.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3635067.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3635067.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3635067</trackback:ping><description>试试下面这段代码的输出是什么?  #include &lt;stdio.h&gt;#include &lt;process.h&gt;#include &lt;windows.h&gt;class foo { public:     foo()     {         printf( &quot;before sleep\n&quot; );         Sleep( 1000 );         printf( &quot;after sleep\n&quot; );     }     void test()     {         printf( &quot;in test\n&quot; );     } }; foo* bar() {     static foo a;     return &amp;a; } unsigned __stdcall thread( void* ) {     foo* p = bar();     p-&gt;test&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3635067.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Thu, 29 May 2008 10:21:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2008/05/29/3635067.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2008/05/29/3635067.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>使用SVN实现版本号自增</title><link>http://blog.csdn.net/LocalVar/archive/2008/05/20/3621312.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3621312.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3621312.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3621312</trackback:ping><description>在《介绍一下SVN》一文中，我提到了自动递增版本号的功能，现在就来具体说明一下实现方法。虽然标题中说的是“使用SVN”，但我们实际用的是SVN的客户端工具TortoiseSVN中的SubWCRev程序。另外文中的例子也使用了Visual Studio的SVN插件VisualSVN，它并非必须，用了方便一些，不用也行。我平时主要使用C/C++语言，但考虑C#有更大的用户群，我的示例项目也采用了C#。  1. 生成一个名为autover的项目  注意项目的Properties文件夹下有一个名为AssemblyInfo.cs的文件，autover程序的版本号就写在它里面。   2. 创建模板文件  在windows的资源管理器中进入Properties文件夹，把AssemblyInfo.cs文件复制一份，命名为AssemblyInfo.template.cs，并把它加入到项目中来。   3. 修改AssemblyInfo.template.cs的属性  AssemblyInfo.template.cs文件是用来自动生成版本号的模板文件，它不应该被编译，所以我们要把它的Build Action&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3621312.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Tue, 20 May 2008 11:57:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2008/05/20/3621312.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2008/05/20/3621312.aspx</guid><dc:creator>张博民</dc:creator></item><item><title>SQLITE中原子提交的实现</title><link>http://blog.csdn.net/LocalVar/archive/2008/02/13/3620555.aspx</link><wfw:comment>http://blog.csdn.net/LocalVar/comments/3620555.aspx</wfw:comment><slash:comments>0</slash:comments><wfw:commentRss>http://blog.csdn.net/LocalVar/comments/commentRss/3620555.aspx</wfw:commentRss><trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=3620555</trackback:ping><description>原文链接  1.    引言  像SQLITE这样支持事务的数据库的一个重要特性是“原子提交”。原子提交意味着，一个事务中的所有修改动作要么全都发生，要么一个都不发生。有了原子提交，对一个数据库文件不同部分的多次写操作，就会像瞬间同时完成了一样。当然，现实中的存储器硬件会把写操作串行化，并且写每个扇区都会花上那么一小段时间，所以，绝对意义上的“瞬间同时完成”是不可能的。但SQLITE的原子提交逻辑还是让整个过程看起来像那么回事。  SQLITE保证，即使事务执行过程中发生了操作系统崩溃或掉电，整个事务也是原子的。本文描述了SQLITE实现原子提交时所采用的技术。  2.    对硬件的假设  虽然有的时候会使用闪存，但下文中，我们将把存储设备称为“磁盘”。  我们假设对磁盘的写操作是以“扇区”为单位的，也就是说不可能直接对磁盘进行小于一个扇区的修改，要想进行这类修改，你必须把整个扇区读进内存，进行所需的修改，然后再把整个扇区写回去。  对真正“磁盘”来说，读写操作的最小单位都是一&lt;img src =&quot;http://blog.csdn.net/LocalVar/aggbug/3620555.aspx&quot; width = &quot;1&quot; height = &quot;1&quot; /&gt;</description><pubDate>Wed, 13 Feb 2008 10:03:00 +0800</pubDate><author>张博民</author><comments>http://blog.csdn.net/LocalVar/archive/2008/02/13/3620555.aspx#Feedback</comments><guid isPermaLink="false">http://blog.csdn.net/LocalVar/archive/2008/02/13/3620555.aspx</guid><dc:creator>张博民</dc:creator></item></channel></rss>