﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-ngaut-随笔分类-others</title><link>http://www.cppblog.com/ngaut/category/1628.html</link><description>asm/c/c++/......</description><language>zh-cn</language><lastBuildDate>Tue, 30 Oct 2012 20:41:28 GMT</lastBuildDate><pubDate>Tue, 30 Oct 2012 20:41:28 GMT</pubDate><ttl>60</ttl><item><title>[转]openFramework, Tokyo Workshop</title><link>http://www.cppblog.com/ngaut/archive/2011/05/23/146970.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Mon, 23 May 2011 05:48:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2011/05/23/146970.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/146970.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2011/05/23/146970.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/146970.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/146970.html</trackback:ping><description><![CDATA[<div><span style="font-family: 'MS Sans Serif', Geneva, sans-serif; font-size: 12px; line-height: 15px; "><h2><a href="http://imlab.cc/whale/?p=2495" rel="bookmark" style="text-decoration: none; color: #3f3f3f; ">openFramework, Tokyo Workshop</a></h2><div style="margin-bottom: 1em; "><a href="http://imlab.cc/whale/?p=2495" title="openFramework, Tokyo Workshop" style="text-decoration: none; color: #3f3f3f; "><img src="http://farm6.static.flickr.com/5028/5671454697_98835050e1_z.jpg" width="615" height="410" alt="SDIM0747" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /></a></div><div><p style="font-size: 12px; "><strong>10 小时的车轮战</strong></p><p style="font-size: 12px; ">昨天上下午两场工作坊天壤之别，上午 Zachary Lieberman 解说他的&#8220;艺术是对未来的 R&amp;D, 是通力的合作, Do it with others&#8221;，加上每次都能见到的 Eyebeam 中心跟早已经建起来的 openFrameworks Lab, 老生长谈，但每次看到 ofLab 还会继续羡慕，有一个场所可以给艺术家，黑客，工程师和科学家把因搭档而来的脑力碰撞转化为以艺术表达为诉求的实践。</p><p style="font-size: 12px; ">下午的 Advance section 变了个样，开始最近基于 openFrameworks 的实际项目介绍和运作讲解，一个是为澳大利亚某会议制作的视觉系统，全部由程序控制的基于 Data Visualization 概念的 VI 系统，概念不新鲜但因为艺术家出身又有 Parsons The New School for Design 的背景支持，视觉呈现做的极其好；另一个与 NIKE 的合作项目 Paint With Your Feet ，添加了对 GPS 数据的支持，继续数据可视化的概念但效果出众。联想到最近 MIT 的新 LOGO，事关视觉系统呈现又对自我突破有要求的设计师，学习使用程序来创作已经是必须要考虑的事了，这不是说对新技能的掌握，而是接受一个新的现实和尝试突破过去经验和系统留下的限制。</p><p style="font-size: 12px; ">Zachary Lieberman 公开了他在 Parsons 的两个授课课程网站，新的&nbsp;<a href="http://algo.thesystemis.com/" style="text-decoration: none; color: #3f3f3f; ">http://algo.thesystemis.com/</a>&nbsp;和稍旧的<a href="http://www.makingthingsmove.org/blog/" style="text-decoration: none; color: #3f3f3f; ">http://www.makingthingsmove.org/blog/</a>，有很多的例子可以参考，Parsons 学生很幸福。</p><p style="font-size: 12px; ">Kinect 做为一个已经渡过热潮的话题，现在积累出来极多的案例，Kyle McDonald 和 Zach Lieberman 在 NY ITP 春季期的课程用它在尝试制作廉价的 3D Scanner 并使用数据做 3D Printing，这里有课程 blog 可以看<a href="http://3dsav.blogspot.com/" style="text-decoration: none; color: #3f3f3f; ">http://3dsav.blogspot.com/</a>，新技术带来的尝试能够带来最直观的感官刺激，而附着其后的，对亲身发起者最重要的，是带来新的去探索，尝试和产出的机会，无论艺术创作，设计实践还是学术的研究，从而产出新的乐趣。</p><p style="font-size: 12px; "><strong>艺术家和设计师都在考虑着的东西</strong></p><p style="font-size: 12px; ">比如之于设计师，尤其是愿意扑身于这个社会，人群去做最形而下尝试的设计师类型，这些早就出现但正式成为设计与创作材料不久的东西，给了我们去尝试更深入探索的机会，无论是形而下的实施，还是之后可能会随之而来的形而上的思考。</p><p style="font-size: 12px; ">EyeWriter 是一个预示了新形态设计的典型例子，批量化生产的 PS3 Camera 和可以提供从最低端自制化软件的 openFrameworks 结合在一起，为实现最廉价同时也是因为设计师与工程师共同走完流程而把概念，原型与使用者体验的顺畅结合提供了可能。现在它成为了一个典范，基于最初兴趣的但却在最大程度上为他人而设计，开源的但完成了一个机构的建立。</p><p style="font-size: 12px; "><strong>OF 007</strong></p><p style="font-size: 12px; ">让人期待已久迟迟没有发布的新版本 OF 007 也做了介绍，为 OPENGL 的支持新添加了 ofxShader 库，让动画，3D 生成渲染跟 OPENCV 有了更大的效能转变。配合 Kinect 的 OPENNI 库 bug 还很多，容易崩溃 。有了更好的 web server 的支持，系统文件控制功能也做了补充，但跟 Processing 比起来，那条能够融会贯通整个程序原型制作的线还不够明显，对于非程序背景的人而言，目前 OF 依然是偏创作型的，更适合让艺术家走向的人完成作品原型，而不是像 Processing 一样可以足够完成一个设计产品原型的流程。</p></div></span></div><img src ="http://www.cppblog.com/ngaut/aggbug/146970.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2011-05-23 13:48 <a href="http://www.cppblog.com/ngaut/archive/2011/05/23/146970.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>winaoe 笔记</title><link>http://www.cppblog.com/ngaut/archive/2011/01/20/138960.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Thu, 20 Jan 2011 04:37:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2011/01/20/138960.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/138960.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2011/01/20/138960.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/138960.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/138960.html</trackback:ping><description><![CDATA[用gpxe启动时，先用shell的dhcp net0 来获取dhcp信息，然后用sanboot aoe:e0.0启动<img src ="http://www.cppblog.com/ngaut/aggbug/138960.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2011-01-20 12:37 <a href="http://www.cppblog.com/ngaut/archive/2011/01/20/138960.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>windows应用patch的笔记</title><link>http://www.cppblog.com/ngaut/archive/2010/08/26/124891.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Thu, 26 Aug 2010 14:24:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2010/08/26/124891.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/124891.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2010/08/26/124891.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/124891.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/124891.html</trackback:ping><description><![CDATA[如果遇到这个问题：<div><span  style="color: rgb(51, 51, 51); font-family: Verdana, Tahoma, Arial, Calibri, Geneva, sans-serif; font-size: 13px; ">/patch.exe -p1 &lt; xx.patch</span><br><div><span  style="color: rgb(51, 51, 51); font-family: Verdana, Tahoma, Arial, Calibri, Geneva, sans-serif; font-size: 13px; ">Assertion failed: hunk, file ../patch-2.5.9-src/patch.c line 354</span></div><div><span  style="color: rgb(51, 51, 51); font-family: Verdana, Tahoma, Arial, Calibri, Geneva, sans-serif; font-size: 13px; ">可以用这个命令来patch</span></div><div><span  style="color: rgb(51, 51, 51); font-family: Verdana, Tahoma, Arial, Calibri, Geneva, sans-serif; font-size: 13px; "><span  style="color: rgb(0, 49, 80); font-family: 'Bitstream Vera Sans', Verdana, Helvetica; line-height: 17px; ">patch -i xx.patch --verbose --binary</span></span></div></div><img src ="http://www.cppblog.com/ngaut/aggbug/124891.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2010-08-26 22:24 <a href="http://www.cppblog.com/ngaut/archive/2010/08/26/124891.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一些经典的学习资源</title><link>http://www.cppblog.com/ngaut/archive/2010/01/19/105992.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Tue, 19 Jan 2010 02:12:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2010/01/19/105992.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/105992.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2010/01/19/105992.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/105992.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/105992.html</trackback:ping><description><![CDATA[<div><font  color="#002C99">https://www.wiki-os.org/ &nbsp;开源siverlight webos</font></div><div><font  color="#002C99"><br></font></div><div><font  color="#002C99"><br></font></div><div><font  color="#002C99"><br></font></div><div><font  color="#002C99">36个引人注目的导航菜单</font></div><div><font  color="#002C99">http://news.cnblogs.com/n/47133/</font></div><div><font  color="#002C99"><br></font></div><div><font  color="#002C99"><br></font></div><div><font  color="#002C99">让图片"跳"起来</font></div><div><font  color="#002C99">http://www.cnblogs.com/gudao119/archive/2010/01/18/1650935.html</font></div><div><font  color="#002C99"><br></font></div><div><font  color="#002C99"><br></font></div><div><font  color="#002C99">网站导航设计趋势案例集合</font></div><div><font  color="#002C99">http://news.cnblogs.com/n/55187/</font></div><img src ="http://www.cppblog.com/ngaut/aggbug/105992.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2010-01-19 10:12 <a href="http://www.cppblog.com/ngaut/archive/2010/01/19/105992.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]交友社区网站架构_为什么要用非关系数据库？</title><link>http://www.cppblog.com/ngaut/archive/2009/12/29/104390.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Tue, 29 Dec 2009 10:14:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2009/12/29/104390.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/104390.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2009/12/29/104390.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/104390.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/104390.html</trackback:ping><description><![CDATA[<span  style="color: rgb(51, 51, 51); font-family: verdana, ����, Arial; font-size: 14px; line-height: 24px; ">随着互联网web2.0网站的兴起，非关系型的数据库现在成了一个极其热门的新领域，非关系数据库产品的发展非常迅速。而传统的关系数据库在应付web2.0网站，特别是超大规模和高并发的SNS类型的web2.0纯动态网站已经显得力不从心，暴露了很多难以克服的问题，例如：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">1、High performance - 对数据库高并发读写的需求</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">web2.0 网站要根据用户个性化信息来实时生成动态页面和提供动态信息，所以基本上无法使用动态页面静态化技术，因此数据库并发负载非常高，往往要达到每秒上万次读 写请求。关系数据库应付上万次SQL查询还勉强顶得住，但是应付上万次SQL写数据请求，硬盘IO就已经无法承受了。其实对于普通的BBS网站，往往也存 在对高并发写请求的需求，例如像JavaEye网站的实时统计在线用户状态，记录热门帖子的点击次数，投票计数等，因此这是一个相当普遍的需求。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">2、Huge Storage - 对海量数据的高效率存储和访问的需求</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">类 似Facebook，twitter，Friendfeed这样的SNS网站，每天用户产生海量的用户动态，以Friendfeed为例，一个月就达到了 2.5亿条用户动态，对于关系数据库来说，在一张2.5亿条记录的表里面进行SQL查询，效率是极其低下乃至不可忍受的。再例如大型web网站的用户登录 系统，例如腾讯，盛大，动辄数以亿计的帐号，关系数据库也很难应付。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">3、High Scalability &amp;&amp; High Availability- 对数据库的高可扩展性和高可用性的需求</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在 基于web的架构当中，数据库是最难进行横向扩展的，当一个应用系统的用户量和访问量与日俱增的时候，你的数据库却没有办法像web server和app server那样简单的通过添加更多的硬件和服务节点来扩展性能和负载能力。对于很多需要提供24小时不间断服务的网站来说，对数据库系统进行升级和扩展 是非常痛苦的事情，往往需要停机维护和数据迁移，为什么数据库不能通过不断的添加服务器节点来实现扩展呢？&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在上面提到的&#8220;三高&#8221;需求面前，关系数据库遇到了难以克服的障碍，而对于web2.0网站来说，关系数据库的很多主要特性却往往无用武之地，例如：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">1、数据库事务一致性需求</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">很多web实时系统并不要求严格的数据库事务，对读一致性的要求很低，有些场合对写一致性要求也不高。因此数据库事务管理成了数据库高负载下一个沉重的负担。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">2、数据库的写实时性和读实时性需求</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">对关系数据库来说，插入一条数据后立刻查询，是肯定可以读出来这条数据的，但是对于很多web应用来说，并不要求这么高的实时性，比方说我（JavaEye的robbin）发一条消息之后，过几秒乃至十几秒之后，我的订阅者才看到这条动态是完全可以接受的。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">3、对复杂的SQL查询，特别是多表关联查询的需求</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">任 何大数据量的web系统，都非常忌讳多个大表的关联查询，以及复杂的数据分析类型的复杂SQL报表查询，特别是SNS类型的网站，从需求以及产品设计角 度，就避免了这种情况的产生。往往更多的只是单表的主键查询，以及单表的简单条件分页查询，SQL的功能被极大的弱化了。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">因此，关系数据库在这些越来越多的应用场景下显得不那么合适了，为了解决这类问题的非关系数据库应运而生，现在这两年，各种各样非关系数据库，特别是键值数据库(Key-Value Store DB)风起云涌，多得让人眼花缭乱。前不久国外刚刚举办了<a href="http://journal.uggedal.com/nosql-east-2009---summary-of-day-1" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">NoSQL Conference</a>，各路NoSQL数据库纷纷亮相，加上未亮相但是名声在外的，起码有超过10个开源的NoSQLDB，例如：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Redis，Tokyo Cabinet，Cassandra，Voldemort，MongoDB，Dynomite，HBase，CouchDB，Hypertable， Riak，Tin， Flare， Lightcloud， KiokuDB，Scalaris， Kai， ThruDB，&nbsp; ......&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">这些NoSQL数据库，有的是用C/C++编写的，有的是用Java编写的，还有的是用Erlang编写的，每个都有自己的独到之处，看都看不过来了，<a href="http://robbin.javaeye.com/" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); "></a>也只能从中挑选一些比较有特色，看起来更有前景的产品学习和了解一下。这些NoSQL数据库大致可以分为以下的三类：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">一、满足极高读写性能需求的Kye-Value数据库：Redis，Tokyo Cabinet， Flare</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">高性能Key-Value数据库的主要特点就是具有极高的并发读写性能，Redis，Tokyo Cabinet， Flare，这3个Key-Value DB都是用C编写的，他们的性能都相当出色，但出了出色的性能，他们还有自己独特的功能：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">1、<a href="http://code.google.com/p/redis/" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">Redis</a>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Redis 是一个很新的项目，刚刚发布了1.0版本。Redis本质上是一个Key-Value类型的内存数据库，很像memcached，整个数据库统统加载在内 存当中进行操作，定期通过异步操作把数据库数据flush到硬盘上进行保存。因为是纯内存操作，Redis的性能非常出色，每秒可以处理超过10万次读写 操作，是我知道的性能最快的Key-Value DB。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Redis的出色之处不仅仅是性能，Redis最大的魅力是支持保存List 链表和Set集合的数据结构，而且还支持对List进行各种操作，例如从List两端push和pop数据，取List区间，排序等等，对Set支持各种 集合的并集交集操作，此外单个value的最大限制是1GB，不像memcached只能保存1MB的数据，因此Redis可以用来实现很多有用的功能， 比方说用他的List来做FIFO双向链表，实现一个轻量级的高性能消息队列服务，用他的Set可以做高性能的tag系统等等。另外Redis也可以对存 入的Key-Value设置expire时间，因此也可以被当作一个功能加强版的memcached来用。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Redis的主要缺点是数 据库容量受到物理内存的限制，不能用作海量数据的高性能读写，并且它没有原生的可扩展机制，不具有scale（可扩展）能力，要依赖客户端来实现分布式读 写，因此Redis适合的场景主要局限在较小数据量的高性能操作和运算上。目前使用Redis的网站有github，Engine Yard。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">2、<a href="http://1978th.net/" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">Tokyo Cabinet和Tokoy Tyrant</a>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">TC 和TT的开发者是日本人Mikio Hirabayashi，主要被用在日本最大的SNS网站mixi.jp上，TC发展的时间最早，现在已经是一个非常成熟的项目，也是Kye-Value 数据库领域最大的热点，现在被广泛的应用在很多很多网站上。TC是一个高性能的存储引擎，而TT提供了多线程高并发服务器，性能也非常出色，每秒可以处理 4-5万次读写操作。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">TC除了支持Key-Value存储之外，还支持保存Hashtable数据类型，因此很像一个简单的数据库 表，并且还支持基于column的条件查询，分页查询和排序功能，基本上相当于支持单表的基础查询功能了，所以可以简单的替代关系数据库的很多操作，这也 是TC受到大家欢迎的主要原因之一，有一个Ruby的项目<a href="http://github.com/tsukasaoishi/miyazakiresistance" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">miyazakiresistance</a>将TT的hashtable的操作封装成和ActiveRecord一样的操作，用起来非常爽。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">TC/TT 在mixi的实际应用当中，存储了2000万条以上的数据，同时支撑了上万个并发连接，是一个久经考验的项目。TC在保证了极高的并发读写性能的同时，具 有可靠的数据持久化机制，同时还支持类似关系数据库表结构的hashtable以及简单的条件，分页和排序操作，是一个很棒的NoSQL数据库。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">TC 主要的缺点是没有scale的能力，如果单机无法满足要求，只能通过主从复制的方式扩展，另外有人提到TC的性能会随着数据量的增加而下降，当数据量上亿 条以后，性能会有比较明显的下降。我（robbin）没有做过这样大数据量的测试，姑且存疑吧，我（robbin）准备有空的时候自己测试一下。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">这个是Tim Yang做的一个<a href="http://timyang.net/data/mcdb-tt-redis/" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">Memcached，Redis和Tokyo Tyrant的简单的性能评测，仅供参考</a>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">3、<a href="http://labs.gree.jp/Top/OpenSource/Flare-en.html" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">Flare</a>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">TC 是日本第一大SNS网站mixi开发的，而Flare是日本第二大SNS网站green.jp开发的，有意思吧。Flare简单的说就是给TC添加了 scale功能。他替换掉了TT部分，自己另外给TC写了网络服务器，Flare的主要特点就是支持scale能力，他在网络服务端之前添加了一个 node server，来管理后端的多个服务器节点，因此可以动态添加数据库服务节点，删除服务器节点，也支持failover。如果你的使用场景必须要让TC可 以scale，那么可以考虑flare。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">flare唯一的缺点就是他只支持memcached协议，因此当你使用flare的时候，就不能使用TC的table数据结构了，只能使用TC的key-value数据结构存储。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">二、满足海量存储需求和访问的面向文档的数据库：MongoDB，CouchDB</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">面向文档的非关系数据库主要解决的问题不是高性能的并发读写，而是保证海量数据存储的同时，具有良好的查询性能。MongoDB是用C++开发的，而CouchDB则是Erlang开发的：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">1、<a href="http://www.mongodb.org/display/DOCS/Home" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">MongoDB</a>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">MongoDB 是一个介于关系数据库和非关系数据库之间的产品，是非关系数据库当中功能最丰富，最像关系数据库的。他支持的数据结构非常松散，是类似json的 bjson格式，因此可以存储比较复杂的数据类型。Mongo最大的特点是他支持的查询语言非常强大，其语法有点类似于面向对象的查询语言，几乎可以实现 类似关系数据库单表查询的绝大部分功能，而且还支持对数据建立索引。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Mongo主要解决的是海量数据的访问效率问题，根据官方的文 档，当数据量达到50GB以上的时候，Mongo的数据库访问速度是MySQL的10倍以上。Mongo的并发读写效率不是特别出色，根据官方提供的性能 测试表明，大约每秒可以处理0.5万－1.5次读写请求。对于Mongo的并发读写性能，我（robbin）也打算有空的时候好好测试一下。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">因为Mongo主要是支持海量数据存储的，所以Mongo还自带了一个出色的分布式文件系统GridFS，可以支持海量的数据存储，但我也看到有些评论认为GridFS性能不佳，这一点还是有待亲自做点测试来验证了。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">最后由于Mongo可以支持复杂的数据结构，而且带有强大的数据查询功能，因此非常受到欢迎，很多项目都考虑用MongoDB来替代MySQL来实现不是特别复杂的Web应用，比方说<a href="http://blog.boxedice.com/2009/07/25/choosing-a-non-relational-database-why-we-migrated-from-mysql-to-mongodb/" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">why we migrated from MySQL to MongoDB</a>就是一个真实的从MySQL迁移到MongoDB的案例，由于数据量实在太大，所以迁移到了Mongo上面，数据查询的速度得到了非常显著的提升。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">MongoDB也有一个ruby的项目<a href="http://github.com/jnunemaker/mongomapper" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">MongoMapper</a>，是模仿Merb的DataMapper编写的MongoDB的接口，使用起来非常简单，几乎和DataMapper一模一样，功能非常强大易用。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">2、CouchDB&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">CouchDB 现在是一个非常有名气的项目，似乎不用多介绍了。但是我却对CouchDB没有什么兴趣，主要是因为CouchDB仅仅提供了基于HTTP REST的接口，因此CouchDB单纯从并发读写性能来说，是非常糟糕的，这让我立刻抛弃了对CouchDB的兴趣。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: medium; ">三、满足高可扩展性和可用性的面向分布式计算的数据库：Cassandra，Voldemort</span>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">面 向scale能力的数据库其实主要解决的问题领域和上述两类数据库还不太一样，它首先必须是一个分布式的数据库系统，由分布在不同节点上面的数据库共同构 成一个数据库服务系统，并且根据这种分布式架构来提供online的，具有弹性的可扩展能力，例如可以不停机的添加更多数据节点，删除数据节点等等。因此 像Cassandra常常被看成是一个开源版本的Google BigTable的替代品。Cassandra和Voldemort都是用Java开发的：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">1、<a href="http://incubator.apache.org/cassandra/" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">Cassandra</a>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Cassandra 项目是Facebook在2008年开源出来的，随后Facebook自己使用Cassandra的另外一个不开源的分支，而开源出来的 Cassandra主要被Amazon的Dynamite团队来维护，并且Cassandra被认为是Dynamite2.0版本。目前除了 Facebook之外，twitter和digg.com都在使用Cassandra。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Cassandra的主要特点就是它不是一个 数据库，而是由一堆数据库节点共同构成的一个分布式网络服务，对Cassandra的一个写操作，会被复制到其他节点上去，对Cassandra的读操 作，也会被路由到某个节点上面去读取。对于一个Cassandra群集来说，扩展性能是比较简单的事情，只管在群集里面添加节点就可以了。我看到有文章说 Facebook的Cassandra群集有超过100台服务器构成的数据库群集。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Cassandra也支持比较丰富的数据结构和功能强大的查询语言，和MongoDB比较类似，查询功能比MongoDB稍弱一些，twitter的平台架构部门领导Evan Weaver写了一篇文章介绍Cassandra：<a href="http://blog.evanweaver.com/articles/2009/07/06/up-and-running-with-cassandra/" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">http://blog.evanweaver.com/articles/2009/07/06/up-and-running-with-cassandra/</a>，有非常详细的介绍。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Cassandra 以单个节点来衡量，其节点的并发读写性能不是特别好，有文章说评测下来Cassandra每秒大约不到1万次读写请求，我也看到一些对这个问题进行质疑的 评论，但是评价Cassandra单个节点的性能是没有意义的，真实的分布式数据库访问系统必然是n多个节点构成的系统，其并发性能取决于整个系统的节点 数量，路由效率，而不仅仅是单节点的并发负载能力。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">2、<a href="http://project-voldemort.com/" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">Voldemort</a>&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Voldemort 是个和Cassandra类似的面向解决scale问题的分布式数据库系统，Cassandra来自于Facebook这个SNS网站，而 Voldemort则来自于Linkedin这个SNS网站。说起来SNS网站为我们贡献了n多的NoSQL数据库，例如 Cassandar，Voldemort，Tokyo Cabinet，Flare等等。Voldemort的资料不是很多，因此我没有特别仔细去钻研，Voldemort官方给出Voldemort的并发读 写性能也很不错，每秒超过了1.5万次读写。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">从Facebook开发Cassandra，Linkedin开发Voldemort， 我们也可以大致看出国外大型SNS网站对于分布式数据库，特别是对数据库的scale能力方面的需求是多么殷切。前面我（robbin）提到，web应用 的架构当中，web层和app层相对来说都很容易横向扩展，唯有数据库是单点的，极难scale，现在Facebook和Linkedin在非关系型数据 库的分布式方面探索了一条很好的方向，这也是为什么现在Cassandra这么热门的主要原因。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">如今，NoSQL数据库是个令人很兴 奋的领域，总是不断有新的技术新的产品冒出来，改变我们已经形成的固有的技术观念，我自己（robbin）稍微了解了一些，就感觉自己深深的沉迷进去了， 可以说NoSQL数据库领域也是博大精深的，我（robbin）也只能浅尝辄止，我（robbin）写这篇文章既是自己一点点钻研心得，也是抛砖引玉，希 望吸引对这个领域有经验的朋友来讨论和交流。&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-indent: 0px; ">从我（robbin）个人的兴趣来说，分布式数据库系统不是我能实际用到的技术，因此不 打算花时间深入，而其他两个数据领域（高性能NoSQLDB和海量存储NoSQLDB）都是我很感兴趣的，特别是Redis，TT/TC和MongoDB 这3个NoSQL数据库，因此我接下来将写三篇文章分别详细介绍这3个数据库。</p><p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-indent: 0px; ">转载<a href="http://robbin.javaeye.com/blog/524977" target="_blank" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51); ">自http://robbin.javaeye.com/blog/524977</a>&nbsp;</p></span>
<img src ="http://www.cppblog.com/ngaut/aggbug/104390.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2009-12-29 18:14 <a href="http://www.cppblog.com/ngaut/archive/2009/12/29/104390.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bitvisor用法</title><link>http://www.cppblog.com/ngaut/archive/2009/12/07/102727.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Mon, 07 Dec 2009 08:34:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2009/12/07/102727.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/102727.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2009/12/07/102727.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/102727.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/102727.html</trackback:ping><description><![CDATA[<div>bitvisor用法</div><div><br></div><div># tar xvfj bitvisor-0.2.tar.bz</div><div># cd bitvisor-0.2</div><div># make</div><div><br></div><div># cp bitvisor.elf /boot/</div><div><br></div><div>title BitVisor</div><div>root (hd0,0)</div><div>kernel /boot/bitvisor.elf</div><div><br></div><div>重启选择BitVisor启动项</div>
<img src ="http://www.cppblog.com/ngaut/aggbug/102727.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2009-12-07 16:34 <a href="http://www.cppblog.com/ngaut/archive/2009/12/07/102727.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>sql server msde 的安装说明</title><link>http://www.cppblog.com/ngaut/archive/2009/11/01/99924.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Sat, 31 Oct 2009 16:50:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2009/11/01/99924.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/99924.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2009/11/01/99924.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/99924.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/99924.html</trackback:ping><description><![CDATA[<div>MS SQL 中的MSDE的SETUP.INI檔說明</div><div>SETUP.INI中的內容如下：</div><div><br></div><div>[Options]</div><div>SAPWD="q12we34r"　SA的密碼</div><div>DISABLENETWORKPROTOCOLS=0　是束關閉網絡聯接，否</div><div>SECURITYMODE=SQL　SQL模式</div><div>;UPGRADE=1　是否是升級</div><div><br></div><div><br></div><div>1、MSDE的默认安装未加载TCPIP，要的话需要写一下setup.ini，加上下条&nbsp;</div><div>[Options]&nbsp;</div><div>DISABLENETWORKPROTOCOLS=0&nbsp;</div><div><br></div><div>2、默认实例名(同机器名)不可用，可能与上次安装后卸载不完整有关。比较简单的处理方法是在setup.ini中另指定一个实例名，只要和机器名不一样就行&nbsp;</div><div>[Options]&nbsp;</div><div>INSTANCENAME=server123&nbsp;</div><div><br></div><div>如果您的机器上没有安装MS SQLServer数据库，您可以选择下载微软MSDE组件进行安装，该安装包是微软发布的软件，网上随处可以找到，下载后默认进行安装即可，注意：MSDE安装后，必须重启机器，才能继续下面的安装。下面提供一个参考下载地址：http://download.microsoft.com/download/4/5/1/451d5d5c-69d4-40d5-b85d-f1d756cf46db/CHS_MSDE2000A.exe，如果安装MSDE出现&#8220;为了安全起见，要求使用强SA密码。请使用SAPWD开关提供同一密码。&#8221;的提示，请找到msde安装目录下的setup.ini，打开修改成下面这个样子</div><div>[Options]</div><div>SECURITYMODE=SQL</div><div>SAPWD=123456</div><div><br></div><div>其中SAPWD后的"123456"是你的sa的密码。（你也可以改成你自己的）。</div><div><br></div><div>这几天在忙着给一个程序打包,需要将MSDE打包,遇到一些问题,现总结如下,我比较懒,就大概写一些吧.</div><div>1.MSDE的安装:</div><div>MSDE如果默认安装的话,实例名和机器名是一致的,同时系统的SA密码会被设置为空.如果要对其做一些修改,可以通过修改目录下的SETUP.INI文件来实现,其中主要涉及以下几项:</div><div>[Options]</div><div>SECURITYMODE=SQL &nbsp; &nbsp; &nbsp;//登陆方式,SQL表示SQL登陆</div><div>INSTANCENAME=singlewks &nbsp; &nbsp; &nbsp;//实例名</div><div>DISABLENETWORKPROTOCOLS=1 &nbsp; &nbsp;//网络可访问性,0表示网络用户可访问,1表示不可以</div><div>DATADIR="c:\singlewks\Data" &nbsp; &nbsp; //数据文件存放位置</div><div>SAPWD=your_pwd &nbsp; &nbsp; //SA密码</div><div><br></div><div>2.对MSDE的管理:</div><div>由于MSDE没有SQL SERVER 2000 那样的管理界面,所以对于它的管理也就比较麻烦.不过我们可以通过OSQL工具对其进行管理.具体的操作,大家可以参考网上的一篇文章:转自msdn &nbsp;hl13571 的 Blog :http://hl13571.cnblogs.com/archive/2006/02/07/326362.html</div><div>例如:</div><div>osql -U sa -S enjoyai\lotto -Q "sp_password NULL,123,sa"</div><div><br></div><div>表示用sa登录, 登录到实例enjoyai\lotto,执行命令 sp_password NULL,123,sa</div>
<img src ="http://www.cppblog.com/ngaut/aggbug/99924.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2009-11-01 00:50 <a href="http://www.cppblog.com/ngaut/archive/2009/11/01/99924.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]How to configure SQL Server 2005 to allow remote connections</title><link>http://www.cppblog.com/ngaut/archive/2009/10/30/99852.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Fri, 30 Oct 2009 11:17:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2009/10/30/99852.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/99852.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2009/10/30/99852.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/99852.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/99852.html</trackback:ping><description><![CDATA[
来自：<a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277">http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277</a><div><br></div><div><span style="font-family: Verdana; font-size: 11px; "><div class="sbody" style="-webkit-box-sizing: border-box; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 195px; line-height: 1.5em; ">When you try to connect to an instance of Microsoft SQL Server 2005 from a remote computer, you may receive an error message. This problem may occur when you use any program to connect to SQL Server. For example, you receive the following error message when you use the SQLCMD utility to connect to SQL Server:<div class="kb_errormsgbody" style="-webkit-box-sizing: border-box; position: relative; overflow-x: auto; margin-bottom: 10px; "><div class="kb_errorcontent" style="-webkit-box-sizing: border-box; width: 548px; border-left-color: rgb(127, 186, 226); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 255, 255); "><div class="errormsg" style="-webkit-box-sizing: border-box; min-height: 20px; position: relative; padding-top: 10px; padding-right: 10px; padding-bottom: 20px; padding-left: 10px; width: 548px; color: rgb(51, 51, 51); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Sqlcmd: Error: Microsoft SQL Native Client: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.</div></div></div>This problem may occur when SQL Server 2005 is not configured to accept remote connections. By default, SQL Server 2005 Express Edition and SQL Server 2005 Developer Edition do not allow remote connections. To configure SQL Server 2005 to allow remote connections, complete all the following steps:<ul style="-webkit-box-sizing: border-box; position: relative; "><li style="-webkit-box-sizing: border-box; position: relative; ">Enable remote connections on the instance of SQL Server that you want to connect to from a remote computer.</li><li style="-webkit-box-sizing: border-box; position: relative; ">Turn on the SQL Server Browser service.</li><li style="-webkit-box-sizing: border-box; position: relative; ">Configure the firewall to allow network traffic that is related to SQL Server and to the SQL Server Browser service.</li></ul>This article describes how to complete each of these steps.<div class="topOfPage" style="-webkit-box-sizing: border-box; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277#top" style="-webkit-box-sizing: border-box; color: rgb(7, 103, 154); text-decoration: none; "><img src="http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif" alt="" style="-webkit-box-sizing: border-box; font-size: 7px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; vertical-align: text-bottom; margin-top: 0px; margin-right: 3px; margin-bottom: 0px; margin-left: 3px; ">Back to the top</a></div></div><h2 class="subTitle" id="tocHeadRef" style="-webkit-box-sizing: border-box; font-size: 16px; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: rgb(127, 186, 226); width: 745px; position: relative; cursor: pointer; overflow-x: hidden; overflow-y: hidden; "><div class="kb_tabs_toggle kb_tabs_toggle_open" style="-webkit-box-sizing: border-box; float: left; height: 11px; width: 11px; position: absolute; top: 10px; left: 7px; background-image: url(http://support.microsoft.com/library/images/support/cn/gsfx_kb_cluster.png); background-repeat: no-repeat; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; background-position: 0px -16px; "></div><span style="-webkit-box-sizing: border-box; background-image: url(http://support.microsoft.com/library/images/support/cn/gsfx_kb_tab.png); background-repeat: no-repeat; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(127, 186, 226); float: left; width: 175px; font-size: 11px; color: rgb(17, 95, 135); font-weight: normal; padding-top: 9px; padding-right: 0px; padding-bottom: 5px; padding-left: 22px; background-position: initial initial; "><a href="javascript:void(0);" style="-webkit-box-sizing: border-box; color: rgb(7, 103, 154); text-decoration: none; ">MORE INFORMATION</a></span></h2><div class="sbody" style="-webkit-box-sizing: border-box; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 195px; line-height: 1.5em; ">To enable remote connections on the instance of SQL Server 2005 and to turn on the SQL Server Browser service, use the SQL Server 2005 Surface Area Configuration tool. The Surface Area Configuration tool is installed when you install SQL Server 2005.<div class="topOfPage" style="-webkit-box-sizing: border-box; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277#top" style="-webkit-box-sizing: border-box; color: rgb(7, 103, 154); text-decoration: none; "><img src="http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif" alt="" style="-webkit-box-sizing: border-box; font-size: 7px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; vertical-align: text-bottom; margin-top: 0px; margin-right: 3px; margin-bottom: 0px; margin-left: 3px; ">Back to the top</a></div><h3 id="tocHeadRef" style="-webkit-box-sizing: border-box; font-size: 13px; margin-top: 15px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; ">Enable remote connections for SQL Server 2005 Express or SQL Server 2005 Developer Edition</h3>You must enable remote connections for each instance of SQL Server 2005 that you want to connect to from a remote computer. To do this, follow these steps:<ol style="-webkit-box-sizing: border-box; position: relative; "><li style="-webkit-box-sizing: border-box; position: relative; ">Click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Start</strong>, point to&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Programs</strong>, point to&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Microsoft SQL Server 2005</strong>, point to<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Configuration Tools</strong>, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">SQL Server Surface Area Configuration</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">On the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">SQL Server 2005 Surface Area Configuration</strong>&nbsp;page, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Surface Area Configuration for Services and Connections</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">On the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Surface Area Configuration for Services and Connections</strong>&nbsp;page, expand<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Database Engine</strong>, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Remote Connections</strong>, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Local and remote connections</strong>, click the appropriate protocol to enable for your environment, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Apply</strong>.&nbsp;<br style="-webkit-box-sizing: border-box; "><br style="-webkit-box-sizing: border-box; "><strong style="-webkit-box-sizing: border-box; ">Note</strong>&nbsp;Click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">OK</strong>&nbsp;when you receive the following message:<div class="message" style="-webkit-box-sizing: border-box; padding-top: 10px; padding-right: 30px; padding-bottom: 10px; padding-left: 30px; ">Changes to Connection Settings will not take effect until you restart the Database Engine service.</div></li><li style="-webkit-box-sizing: border-box; position: relative; ">On the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Surface Area Configuration for Services and Connections</strong>&nbsp;page, expand<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Database Engine</strong>, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Service</strong>, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Stop</strong>, wait until the MSSQLSERVER service stops, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Start</strong>&nbsp;to restart the MSSQLSERVER service.</li></ol><div class="topOfPage" style="-webkit-box-sizing: border-box; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277#top" style="-webkit-box-sizing: border-box; color: rgb(7, 103, 154); text-decoration: none; "><img src="http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif" alt="" style="-webkit-box-sizing: border-box; font-size: 7px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; vertical-align: text-bottom; margin-top: 0px; margin-right: 3px; margin-bottom: 0px; margin-left: 3px; ">Back to the top</a></div><h3 id="tocHeadRef" style="-webkit-box-sizing: border-box; font-size: 13px; margin-top: 15px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; ">Enable the SQL Server Browser service</h3>If you are running SQL Server 2005 by using an instance name and you are not using a specific TCP/IP port number in your connection string, you must enable the SQL Server Browser service to allow for remote connections. For example, SQL Server 2005 Express is installed with a default instance name of&nbsp;<var style="-webkit-box-sizing: border-box; ">Computer Name</var>\SQLEXPRESS. You are only required to enable the SQL Server Browser service one time, regardless of how many instances of SQL Server 2005 you are running. To enable the SQL Server Browser service, follow these steps.<br style="-webkit-box-sizing: border-box; "><br style="-webkit-box-sizing: border-box; "><strong style="-webkit-box-sizing: border-box; ">Important</strong>&nbsp;These steps may increase your security risk. These steps may also make your computer or your network more vulnerable to attack by malicious users or by malicious software such as viruses. We recommend the process that this article describes to enable programs to operate as they are designed to, or to implement specific program capabilities. Before you make these changes, we recommend that you evaluate the risks that are associated with implementing this process in your particular environment. If you choose to implement this process, take any appropriate additional steps to help protect your system. We recommend that you use this process only if you really require this process.<ol style="-webkit-box-sizing: border-box; position: relative; "><li style="-webkit-box-sizing: border-box; position: relative; ">Click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Start</strong>, point to&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Programs</strong>, point to&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Microsoft SQL Server 2005</strong>, point to<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Configuration Tools</strong>, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">SQL Server Surface Area Configuration</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">On the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">SQL Server 2005 Surface Area Configuration</strong>&nbsp;page, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Surface Area Configuration for Services and Connections</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">On the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Surface Area Configuration for Services and Connections</strong>&nbsp;page, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">SQL Server Browser</strong>, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Automatic</strong>&nbsp;for&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Startup type</strong>, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Apply</strong>.&nbsp;<br style="-webkit-box-sizing: border-box; "><br style="-webkit-box-sizing: border-box; "><strong style="-webkit-box-sizing: border-box; ">Note</strong>&nbsp;When you click the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Automatic</strong>&nbsp;option, the SQL Server Browser service starts automatically every time that you start Microsoft Windows.</li><li style="-webkit-box-sizing: border-box; position: relative; ">Click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Start</strong>, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">OK</strong>.</li></ol><strong style="-webkit-box-sizing: border-box; ">Note</strong>&nbsp;When you run the SQL Server Browser service on a computer, the computer displays the instance names and the connection information for each instance of SQL Server that is running on the computer. This risk can be reduced by not enabling the SQL Server Browser service and by connecting to the instance of SQL Server directly through an assigned TCP port. Connecting directly to an instance of SQL Server through a TCP port is beyond the scope of this article. For more information about the SQL Server Browser server and connecting to an instance of SQL Server, see the following topics in SQL Server Books Online:<ul style="-webkit-box-sizing: border-box; position: relative; "><li style="-webkit-box-sizing: border-box; position: relative; ">SQL Server Browser Service</li><li style="-webkit-box-sizing: border-box; position: relative; ">Connecting to the SQL Server Database Engine</li><li style="-webkit-box-sizing: border-box; position: relative; ">Client Network Configuration</li></ul><div class="topOfPage" style="-webkit-box-sizing: border-box; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277#top" style="-webkit-box-sizing: border-box; color: rgb(7, 103, 154); text-decoration: none; "><img src="http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif" alt="" style="-webkit-box-sizing: border-box; font-size: 7px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; vertical-align: text-bottom; margin-top: 0px; margin-right: 3px; margin-bottom: 0px; margin-left: 3px; ">Back to the top</a></div><h3 id="tocHeadRef" style="-webkit-box-sizing: border-box; font-size: 13px; margin-top: 15px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; ">Create exceptions in Windows Firewall</h3>These steps apply to the version of Windows Firewall that is included in Windows XP Service Pack 2 (SP2) and in Windows Server 2003. If you are using a different firewall system, see your firewall documentation for more information.&nbsp;<br style="-webkit-box-sizing: border-box; "><br style="-webkit-box-sizing: border-box; ">If you are running a firewall on the computer that is running SQL Server 2005, external connections to SQL Server 2005 will be blocked unless SQL Server 2005 and the SQL Server Browser service can communicate through the firewall. You must create an exception for each instance of SQL Server 2005 that you want to accept remote connections and an exception for the SQL Server Browser service.<br style="-webkit-box-sizing: border-box; "><br style="-webkit-box-sizing: border-box; ">SQL Server 2005 uses an instance ID as part of the path when you install its program files. To create an exception for each instance of SQL Server, you must identify the correct instance ID. To obtain an instance ID, follow these steps:<ol style="-webkit-box-sizing: border-box; position: relative; "><li style="-webkit-box-sizing: border-box; position: relative; ">Click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Start</strong>, point to&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Programs</strong>, point to&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Microsoft SQL Server 2005</strong>, point to<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Configuration Tools</strong>, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">SQL Server Configuration Manager</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">In SQL Server Configuration Manager, click the SQL Server Browser service in the right pane, right-click the instance name in the main window, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Properties</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">On the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">SQL Server Browser Properties</strong>&nbsp;page, click the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Advanced</strong>&nbsp;tab, locate the instance ID in the property list, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">OK</strong>.</li></ol>To open Windows Firewall, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Start</strong>, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Run</strong>, type&nbsp;<span class="userInput" style="-webkit-box-sizing: border-box; font-weight: bold; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">firewall.cpl</span>, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">OK</strong>.<h4 id="tocHeadRef" style="-webkit-box-sizing: border-box; font-size: 12px; margin-top: 10px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; ">Create an exception for SQL Server 2005 in Windows Firewall</h4>To create an exception for SQL Server 2005 in Windows Firewall, follow these steps:<ol style="-webkit-box-sizing: border-box; position: relative; "><li style="-webkit-box-sizing: border-box; position: relative; ">In Windows Firewall, click the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Exceptions</strong>&nbsp;tab, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Add Program</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">In the Add a Program window, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Browse</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">Click the C:\Program Files\Microsoft SQL Server\<var style="-webkit-box-sizing: border-box; ">MSSQL.1</var>\MSSQL\Binn\sqlservr.exe executable program, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Open</strong>, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">OK</strong>.&nbsp;<br style="-webkit-box-sizing: border-box; "><br style="-webkit-box-sizing: border-box; "><strong style="-webkit-box-sizing: border-box; ">Note</strong>&nbsp;The path may be different depending on where SQL Server 2005 is installed.<var style="-webkit-box-sizing: border-box; ">MSSQL.1</var>&nbsp;is a placeholder for the instance ID that you obtained in step 3 of the previous procedure.</li><li style="-webkit-box-sizing: border-box; position: relative; ">Repeat steps 1 through 3 for each instance of SQL Server 2005 that needs an exception.</li></ol><h4 id="tocHeadRef" style="-webkit-box-sizing: border-box; font-size: 12px; margin-top: 10px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; ">Create an exception for the SQL Server Browser service in Windows Firewall</h4>To create an exception for the SQL Server Browser service in Windows Firewall, follow these steps:<ol style="-webkit-box-sizing: border-box; position: relative; "><li style="-webkit-box-sizing: border-box; position: relative; ">In Windows Firewall, click the&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Exceptions</strong>&nbsp;tab, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Add Program</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">In the Add a Program window, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Browse</strong>.</li><li style="-webkit-box-sizing: border-box; position: relative; ">Click the C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe executable program, click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">Open</strong>, and then click&nbsp;<strong class="uiterm" style="-webkit-box-sizing: border-box; ">OK</strong>.&nbsp;<br style="-webkit-box-sizing: border-box; "><br style="-webkit-box-sizing: border-box; "><strong style="-webkit-box-sizing: border-box; ">Note</strong>&nbsp;The path may be different depending on where SQL Server 2005 is installed.</li></ol></div></span></div><img src ="http://www.cppblog.com/ngaut/aggbug/99852.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2009-10-30 19:17 <a href="http://www.cppblog.com/ngaut/archive/2009/10/30/99852.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]化学出身的计算机达人</title><link>http://www.cppblog.com/ngaut/archive/2009/09/10/95859.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Thu, 10 Sep 2009 14:29:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2009/09/10/95859.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/95859.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2009/09/10/95859.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/95859.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/95859.html</trackback:ping><description><![CDATA[

<div>来自:&nbsp;<a href="http://blog.linjian.org/articles/chemistry-computer/">http://blog.linjian.org/articles/chemistry-computer/</a></div><div><br></div><div><span  style="font-family: Arial; color: rgb(51, 51, 51); font-size: 14px; line-height: 22px; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; ">　昨天的&nbsp;<a href="http://www.beijing-open-party.org/index.php/2009/08/beijing-open-party-2009-08-event-preview.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">Beijing Open Party</a>&nbsp;上，我听了<a href="http://chemhack.com/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">段炼</a>同学介绍&nbsp;<a href="http://code.google.com/webtoolkit/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">GWT</a>&nbsp;的主题。上个月认识他时，我还误以为他是<a href="http://www.bit.edu.cn/col183/article.htm1?id=35414" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">北理工新闻中心专职摄影的段炼老师</a>，但他的真实身份却是华东理工大学制药工程专业的学生，计算机只是其&#8220;业余爱好&#8221;。段炼的 ID&#8220;chemhack&#8221;不禁让我猜想他是不是有像<a href="http://mindhacks.cn/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">刘未鹏</a>的&#8220;mindhacks&#8221;那样的风范。听了他的演讲、看了他的 blog，发现他确实是一个有 hack 精神的人。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; ">　　这是我认识的又一位从事化学相关领域的计算机高手。本科玩<a href="http://blog.linjian.org/?s=%E5%8D%9A%E5%BC%88" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">计算机博弈</a>时，我认识了复旦大学化学系毕业的<a href="http://blog.csdn.net/auntyellow" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">黄晨</a>，他是<a href="http://www.elephantbase.net/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">象棋百科全书网站和象棋巫师软件</a>的作者，<a href="http://www.elephantbase.net/protocol/cchess_ucci.htm" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">UCCI</a>&nbsp;协议的制定者。后来参加<a href="http://zh.wikipedia.org/wiki/%E4%B8%AD%E5%9B%BD%E6%9C%BA%E5%99%A8%E5%8D%9A%E5%BC%88%E9%94%A6%E6%A0%87%E8%B5%9B" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">中国机器博弈锦标赛</a>时，我又有幸见到了中国电脑围棋的先行者、中山大学化学系退休的<a href="http://www.google.com/search?q=%E4%B8%AD%E5%B1%B1%E5%A4%A7%E5%AD%A6+%E9%99%88%E5%BF%97%E8%A1%8C" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">陈志行教授</a>（陈老先生已于 2008 年不幸病故）。他研制的《手谈》软件曾多次在国际赛事中夺冠，商业版本也畅销于日本等国。在我决定读研之前，曾想了解一下科研生活，师兄推荐给我的是名曰&#8220;学术科研第一站&#8221;，实为化学相关专业主导的<a href="http://emuch.net/bbs/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">小木虫论坛</a>，这个论坛也让我收益不少。在中科院研究生院集中教学期间，我又在计算机专业的课堂上认识了多位外专业的同学，他们有冶金化学的、化工自动化的、过程工程的，选择计算机类课程或出于实验室工作的需要，或出于个人兴趣。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; ">　　为什么会有这么多化学相关专业的朋友涉足了计算机领域呢？个人兴趣之外，或许最主要的因素是化学的很多研究需要以计算机作为海量数据采集、存储、分析、处理的工具。化学领域作为数据库、数据挖掘、网格计算等技术的重要应用，受益于计算机技术的发展，同时也对通过其复杂的需求引导着计算基础设施及算法的改进与发展。如今<a href="http://chemhack.com/cn/2009/08/chemoinformatics-101-chines/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">化学信息学</a>的引入就是要用计算机来解决化学信息存储与检索的子问题。但除了这些技术上的因素，计算机和化学有没有本质上的相通呢？计算机是公认的人造科学、技术科学，而化学一般被认为是自然科学，尽管它也包含了一些技术科学和工程技术领域的分支。但我的初中、高中化学老师都给我灌输过这种思想：化学只是一系列模型，方便描述自然现象的，有些概念并不反映真实的存在；还说中学化学讲的都是早期的经典模型，为了解释新的现象，模型总在不断修补。我的大学同学，爱好电子、物理与计算机的 m100 则直接认定&#8220;化学是骗人的&#8221;。但我想，无论化学家们的科学信仰和主观意愿如何，化学和计算机科学在客观呈现上有两点是共通的：一是抽象建模，二是实用主义。计算机中只有线性的指令流和数据流，人们用结构化编程语言和文件系统的抽象将它们变得易于理解和使用；同样化学元素也不是什么微观物质，但化学家可以用这一抽象来表示特定原子组成，构建宏观世界到微观世界的桥梁，便于统一研究物质的性质。这种方法论上的相似或许是化学专业的朋友们乐于钻研计算机的原因之一。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; ">　　学术的火花往往都是在交叉领域中迸发的，黄晨的《电脑象棋和量子化学——计算量子化学的新思路》（黄晨网站原文无法找到，请看&nbsp;<a href="http://www.google.com/search?hl=en&amp;q=%22%E7%94%B5%E8%84%91%E8%B1%A1%E6%A3%8B%E5%92%8C%E9%87%8F%E5%AD%90%E5%8C%96%E5%AD%A6%22+%22%E8%AE%A1%E7%AE%97%E9%87%8F%E5%AD%90%E5%8C%96%E5%AD%A6%E7%9A%84%E6%96%B0%E6%80%9D%E8%B7%AF%22+%22%E9%BB%84%E6%99%A8%22" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 84, 179); text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; ">google 到的转载结果</a>）就是一例有益的探索。做计算机的人，不要耻笑个别外专业人员写的蹩脚的代码，也不要不屑于倾听外行对计算机技术看似幼稚的见解。内行最容易犯的毛病就是被既有知识的&#8220;框框&#8221;限制住，多看看外行在本领域的工作，听听他们大胆的思路，也许就能为自己的科研创新另辟蹊径。</p><div><br></div></span></div><img src ="http://www.cppblog.com/ngaut/aggbug/95859.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2009-09-10 22:29 <a href="http://www.cppblog.com/ngaut/archive/2009/09/10/95859.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DBEntry.net使用sqlite的配置</title><link>http://www.cppblog.com/ngaut/archive/2009/08/19/93793.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Wed, 19 Aug 2009 02:53:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2009/08/19/93793.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/93793.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2009/08/19/93793.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/93793.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/93793.html</trackback:ping><description><![CDATA[<div style="background-color: rgb(238, 238, 238); font-size: 13px; border-left-color: rgb(204, 204, 204); padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000; ">&nbsp;&nbsp;</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">Lephone</span><span style="color: #FF0000; ">.Settings</span><span style="color: #0000FF; ">&gt;</span><span style="color: #000000; "><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">add&nbsp;</span><span style="color: #FF0000; ">key</span><span style="color: #0000FF; ">="AutoCreateTable"</span><span style="color: #FF0000; ">&nbsp;value</span><span style="color: #0000FF; ">="true"</span><span style="color: #FF0000; ">&nbsp;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; "><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">add&nbsp;</span><span style="color: #FF0000; ">key</span><span style="color: #0000FF; ">="DataBase"</span><span style="color: #FF0000; ">&nbsp;value</span><span style="color: #0000FF; ">="@SQLite&nbsp;:&nbsp;@~Test.db"</span><span style="color: #FF0000; ">&nbsp;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; "><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">add&nbsp;</span><span style="color: #FF0000; ">key</span><span style="color: #0000FF; ">="DbProviderFactory"</span><span style="color: #FF0000; ">&nbsp;value</span><span style="color: #0000FF; ">="System.Data.SQLite.SQLiteFactory,&nbsp;System.Data.SQLite,&nbsp;Version=1.0.65.0"</span><span style="color: #FF0000; ">&nbsp;</span><span style="color: #0000FF; ">/&gt;</span><span style="color: #000000; "><br>&nbsp;&nbsp;</span><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">Lephone.Settings</span><span style="color: #0000FF; ">&gt;</span></div>
<img src ="http://www.cppblog.com/ngaut/aggbug/93793.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2009-08-19 10:53 <a href="http://www.cppblog.com/ngaut/archive/2009/08/19/93793.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DbEntry.net 对事务的处理</title><link>http://www.cppblog.com/ngaut/archive/2009/04/05/78990.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Sun, 05 Apr 2009 01:37:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2009/04/05/78990.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/78990.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2009/04/05/78990.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/78990.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/78990.html</trackback:ping><description><![CDATA[public void UsingTransaction(IsolationLevel il, CallbackVoidHandler callback)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Scope&lt;ConnectionContext&gt;.Current != null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ConnectionContext et = Scope&lt;ConnectionContext&gt;.Current;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (et.IsolationLevel == il)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; callback();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NewTransaction(callback);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void NewTransaction(CallbackVoidHandler callback)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NewTransaction(IsolationLevel.ReadCommitted, callback);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void NewTransaction(IsolationLevel il, CallbackVoidHandler callback)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NewConnection(delegate<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ConnectionContext cc = ConProvider;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cc.BeginTransaction(il);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnBeginTransaction();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; callback();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cc.Commit();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnCommittedTransaction();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cc.Rollback();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finally<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnTransactionError();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><img src ="http://www.cppblog.com/ngaut/aggbug/78990.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2009-04-05 09:37 <a href="http://www.cppblog.com/ngaut/archive/2009/04/05/78990.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>etherboot 编译 来自 http://markmail.org/message/h4eyrkv5bfd5yila#query:Etherboot%20gcc%204.3+page:1+mid:h4eyrkv5bfd5yila+state:results</title><link>http://www.cppblog.com/ngaut/archive/2009/02/04/73027.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Wed, 04 Feb 2009 15:42:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2009/02/04/73027.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/73027.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2009/02/04/73027.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/73027.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/73027.html</trackback:ping><description><![CDATA[<table id="headers">
    <tbody>
        <tr>
            <th>Subject:</th>
            <td><a href="http://markmail.org/message/h4eyrkv5bfd5yila" class="subject">[<strong>Etherboot</strong>-developers] [PATCH] move RM_FRAGMENT to the beginning of undi.c</a></td>
            <td class="actions"><span class="actions mklink">Actions...</span></td>
        </tr>
        <tr>
            <th>From:</th>
            <td colspan="2">Glauber Costa (<span>glom<a class="email mklink">...</a>@redhat.com</span>)</td>
        </tr>
        <tr>
            <th>Date:</th>
            <td colspan="2">Oct 14, 2008  9:17:11 am</td>
        </tr>
        <tr>
            <th>List:</th>
            <td colspan="2"><span>net.sourceforge.lists.etherboot-developers</span></td>
        </tr>
    </tbody>
</table>
<p>I'm currently facing a compile problem with <strong>gcc</strong> <strong>4.3</strong>.0 at undi.c
Looking at the generated code, it seems <strong>gcc</strong> is inlining _undi_call into
_undi_call_silent, thus making rm_undi_call be defined twice.
</p>
<p>Using <strong>gcc</strong> option -fno-inline also fixes this, but then the compiler won't
do any kind of inlining, even "good" ones, so this fix seem to do the right<br>thing.
</p>
<p>Signed-off-by: Glauber Costa &lt;<span>glom<a class="email mklink">...</a>@redhat.com</span>&gt;
</p>
<p>---
src/arch/i386/drivers/net/undi.c |   27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
</p>
<p>diff --git a/src/arch/i386/drivers/net/undi.c b/src/arch/i386/drivers/net/undi.c
index 084fc18..1ffea43 100644
--- a/src/arch/i386/drivers/net/undi.c
+++ b/src/arch/i386/drivers/net/undi.c
@@ -33,6 +33,19 @@ $Id$
/* E820 map mangler */
#include "hidemem.h"
</p>
<p>+RM_FRAGMENT(rm_undi_call,
+	"popw %di\n\t"			/* %es:di = routine */
+	"popw %es\n\t"
+	"pushw %cs\n\t"			/* set up return address */
+	"call 1f\n\t1:popw %bx\n\t"
+	"leaw (2f-1b)(%bx), %ax\n\t"
+	"pushw %ax\n\t"
+	"pushw %es\n\t"			/* routine address to stack */
+	"pushw %di\n\t"
+	"lret\n\t"			/* calculated lcall */
+	"\n2:\n\t"			/* continuation point */
+);
+
/* NIC specific static variables go here */
static undi_t undi = {
.pnp_bios         = NULL,
@@ -403,21 +416,9 @@ static PXENV_EXIT_t _undi_call ( uint16_t routine_seg,
{ routine_off, routine_seg }, st0, st1, st2
};
</p>
<p>-	RM_FRAGMENT(rm_undi_call,
-		"popw %di\n\t"			/* %es:di = routine */
-		"popw %es\n\t"
-		"pushw %cs\n\t"			/* set up return address */
-		"call 1f\n\t1:popw %bx\n\t"
-		"leaw (2f-1b)(%bx), %ax\n\t"
-		"pushw %ax\n\t"
-		"pushw %es\n\t"			/* routine address to stack */
-		"pushw %di\n\t"
-		"lret\n\t"			/* calculated lcall */
-		"\n2:\n\t"			/* continuation point */
-	);
</p>
<p> 	/* Parameters are left on stack: set out_stack = in_stack */
-	ret = real_call ( rm_undi_call, &amp;in_stack, &amp;in_stack );
+	ret = real_call ( rm_undi_call, &amp;in_stack, &amp;in_stack );
</p>
<p> 	/* UNDI API calls may rudely change the status of A20 and not
* bother to restore it afterwards.  Intel is known to be
</p>
<div class="footer signature">
<p>--
1.5.5.1
</p>
</div><img src ="http://www.cppblog.com/ngaut/aggbug/73027.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2009-02-04 23:42 <a href="http://www.cppblog.com/ngaut/archive/2009/02/04/73027.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]udpcast</title><link>http://www.cppblog.com/ngaut/archive/2008/10/27/65265.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Mon, 27 Oct 2008 15:39:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2008/10/27/65265.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/65265.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2008/10/27/65265.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/65265.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/65265.html</trackback:ping><description><![CDATA[<pre>Guofu,<br>  Following is what I got from  Alain long time ago.  Hope this helps.<br>   <br>  Thanks,<br>  Sai<br>   <br>  *****************************************************************<br>  There are no format documents yet about the protocol. The protocol is<br>not based on an RFC, but is homegrown specifically for udpcast.<br><br>Updcast uses two UDP port numbers, 9000 and 9001.<br><br>The receiver listens on 9000 (portbase), the sender on 9001 <br>(portbase+1)<br><br>The protocol runs as follows:<br><br>1. When the sender starts up, it broadcast a CMD_HELLO message to the<br>local network broadcast address<br><br>2. When the receiver starts up, or whenever it receives a CMD_HELLO<br>message, it sends a CMD_CONNECT_REQ address. If the CMD_CONNECT_REQ is<br>sent at startup, it is broadcast; else it is sent to the server's<br>address (as deducted from the CMD_HELLO message).<br><br>This allows the rendez-vous to be established no matter whether the<br>client or the server first starts up. Additionnally, the server can be<br>set up to periodically send its CMD_HELLO message (interesting for<br>asynchronous mode, see below).<br><br><br>3. The server replies to each CMD_CONNECT_REQ with a CMD_CONNECT_REPLY<br>(unicasted to the client who sent the CMD_CONNECT_REQ). The connect<br>reply contains the client number that the server assigned to that<br>client (clNr), the block size (size of packed), a bitmask of<br>capabilities, and the multicast address to be used for the actual data<br>transfer transfer.<br><br>At this stage, server and client know about each other, and are ready<br>to start the transfer. For convenience, the transfer may either be<br>started at the server, or at any participating client.<br><br>4. If transfer start is initiated by a client, it sends the server a<br>CMD_GO message.<br><br>5. If the transfer start is initiated by the server (or, after<br>reception of the CMD_GO message from a client), the server starts<br>transfering data by sending CMD_DATA packets. The reception of the<br>first CMD_DATA packet is a signal to all clients that now the<br>rendez-vous phase is over, and that the transfer has started.<br><br>The data is subdivided into slices, which are themselves subdivided<br>into stripes (only in FEC mode), which are subdivided in network<br>packets, which are made up of bytes.<br><br>A CMD_DATA packet contains the slice number (sliceNo), the block<br>number within that slice (blockNo), and the total number of bytes in<br>the slice, and then the data itself.<br><br>After each slice has been transmitted, lost packets are handled.<br><br>In FEC mode, lost packets are recovered by the client by using the<br>error correction packets included in each slice.<br><br>A CMD_FEC packet contains the number of stripes in the slice, the<br>slice number, the block number, and the number of bytes.<br><br><br>In non-FEC mode, the server asks each client to acknowledge at the end<br>of the slice (CMD_REQACK). The CMD_REQACK contains the identifier of<br>the slice to be acknowleged (sliceNo), the number of bytes in that<br>slice (bytes), and a retransmission counter. The clients reply to the<br>CMD_REQACK either with a CMD_OK (if they received everything) or with<br>a CMD_RETRANSMIT (if packets were missed). Both the CMD_OK and<br>CMD_RETRANSMIT message contain the sliceNo. The CMD_RETRANSMIT message<br>contains also a bitmap of the missed packets, and the retransmit id.<br><br>In response the CMD_RETRANSMIT messages, the server will retransmit<br>packets that have been missed by at least one client, increments the<br>rxmit counter and then send another CMD_REQACK. The rxmit counter is<br>used to discard late CMD_RETRANSMIT messages: indeed, after a round of<br>retransmission, CMD_RETRANSMIT messages from the previous round should<br>be ignored, or else the server may resend packets that have been<br>received in this round.<br><br>Clients may leave a transmission by sending a CMD_DISCONNECT. Sending<br>the CMD_DISCONNECT is important, or else the server will needlessly<br>wait for the acknowledgments of these clients. However, if a client<br>crashes without sending a CMD_DISCONNECT, the server has a timeout to<br>detect this situation, and continue with the other clients ("The<br>client #n has been dropped by the server").<br><br>When all clients have received all packets (i.e. all clients have send<br>a CMD_OK for that slice), the sender moves on to the next slice, until<br>end of file is reached. The server signals end of transfer by sending<br>a slice of zero bytes.<br><br>Including slice size in every packet, and number of stripes in every<br>FEC packet may seem redundant. However, this is needed in order to<br>make the protocol robust in cases of packet loss: if the number of<br>bytes was only in the first or in the last packet, then the loss of<br>that packet would make it hard to recover, because not only the data<br>was lost, but also the meta-data needed to reconstruct that<br>slice. This is especially relevant in FEC mode.<br><br>FEC mode is intended for unidirectional (asynchronous mode). In this<br>mode, there are no acknowledgments, and no retransmissions. This is<br>intended for situations where no receiver-to-sender communication is<br>possible, or where the latency of such a communication would be<br>prohibitively high, such as multicast over satellite.<br><br>The server sends (one or several) CMD_HELLO which includes the<br>multicast address it intends to use, and then starts with the<br>data. Each slice not only contains the data, but also a configurable<br>number of redundant "error correction" packets.<br><br>FEC mode uses an algorithm based on Vandermonde matrices to<br>recalculate the contents of any lost packets. The algorithm is chosen<br>such that all k data packets may be restored as long as the receiver<br>has gotten at least k packets (be it data or FEC). For example, with<br>k-3 data packets, and 3 FEC packets, all k data packets may be<br>reconstructed. K is a parameter of the algorithm, and the higher the<br>value for k, the more computation intensive the algorithm<br>is. Moreover, values of k greater than 128 are not supported. For that<br>reason, each slice (which may be up to 1024 packets) is subdivided in<br>several stripes (of at most 128 packets), which are interleaved<br>(i.e. first comes 1st packet of 1st stripe, than 1st packet of 2nd<br>stripe, ..., then 1st packet of last stripe, than 2nd packet of 1st<br>stripe, etc.) That way a burst loss of packets (for instance, 6<br>packets in a row) won't overly impact one stripe but will rather be<br>spread out among several. Indeed, if udp-sender has been set up to<br>include l redundant packets per stripe, it must be avoided at all cost<br>that more than l packets are lost per stripe, or otherwise the loss in<br>uncrecoverable.<br><br>Additional complications in the protocol arise from the fact that a<br>first version of the protocol used the native byte ordering from Intel<br>processors, rather than use the network byte order. This made udpcast<br>unportable to non-PC architectures. This was changed two years ago;<br>however in order to stay compatible with older versions, the receiver<br>and sender are able to detect that packets with the "wrong" byte order<br>have been received, and are able to correct for that: if the message<br>code (CMD_*) doesn't make sense in network byte order, udpcast tries<br>to interpret it in Intel byte order, and if that matches a known code,<br>the packet is byte-swapped.<br><br><br>Regards,<br><br>Alain<br></pre><img src ="http://www.cppblog.com/ngaut/aggbug/65265.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2008-10-27 23:39 <a href="http://www.cppblog.com/ngaut/archive/2008/10/27/65265.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>小心vmware6.0和vs2008的冲突</title><link>http://www.cppblog.com/ngaut/archive/2008/10/22/64683.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Wed, 22 Oct 2008 02:35:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2008/10/22/64683.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/64683.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2008/10/22/64683.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/64683.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/64683.html</trackback:ping><description><![CDATA[如果安装vmware6.0后，vs2008打开工程后自动关闭，卸载vmware试试，偶被这个问题小郁闷了一把
<img src ="http://www.cppblog.com/ngaut/aggbug/64683.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2008-10-22 10:35 <a href="http://www.cppblog.com/ngaut/archive/2008/10/22/64683.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>发一个招聘贴</title><link>http://www.cppblog.com/ngaut/archive/2008/09/19/62309.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Fri, 19 Sep 2008 14:06:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2008/09/19/62309.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/62309.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2008/09/19/62309.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/62309.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/62309.html</trackback:ping><description><![CDATA[要求:<br>1. 熟悉汇编语言，c/c++，熟悉80x86体系架构，实模式，保护模式<br>2. 良好的数据结构与算法基础<br>3. 熟悉MFC或者STL<br>4. 工作地点在武汉<br>5. 学历不限，英语不限，人品良好，有团队精神<br>6. 特别优秀者，只需具备：人品良好，有团队精神<br><br>有以下经验优先：<br>1. os引导程序开发， os开发<br>2. bios开发经验<br>3. 熟悉Linux裁剪，Linux内核<br>4. 有编译器开发经验<br><br>tel:13554674976&nbsp; 刘先生<br><br> <img src ="http://www.cppblog.com/ngaut/aggbug/62309.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2008-09-19 22:06 <a href="http://www.cppblog.com/ngaut/archive/2008/09/19/62309.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]Bug管理的经验和实践[转载]</title><link>http://www.cppblog.com/ngaut/archive/2008/09/09/61354.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Tue, 09 Sep 2008 00:07:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2008/09/09/61354.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/61354.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2008/09/09/61354.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/61354.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/61354.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: [转载]孟岩：刘振飞，你好。我知道你以前是方正出版印刷系统的核心开发人员，后来来到微软的Office开发组。我认识你的时候你还在微软工作，状态似乎不错。为什么后来又离开微软了呢？&nbsp;刘振飞：93年到96年，我在北大计算机研究所读研。96年毕业后，我留在所里继续从事方正核心产品世纪RIP --- PSPNT的研发、维护、升级（还有外围软件开发比如新女娲补字NewNW、PDF流程系...&nbsp;&nbsp;<a href='http://www.cppblog.com/ngaut/archive/2008/09/09/61354.html'>阅读全文</a><img src ="http://www.cppblog.com/ngaut/aggbug/61354.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2008-09-09 08:07 <a href="http://www.cppblog.com/ngaut/archive/2008/09/09/61354.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> Driver Development Part 1: Introduction to Drivers [codeproject]</title><link>http://www.cppblog.com/ngaut/archive/2008/04/14/47077.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Mon, 14 Apr 2008 13:38:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2008/04/14/47077.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/47077.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2008/04/14/47077.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/47077.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/47077.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Download source files - 10.4 Kb IntroductionThis tutorial will attempt to describe how to write a simple devicedriver for Windows NT. There are various resources and tutorials on theinternet...&nbsp;&nbsp;<a href='http://www.cppblog.com/ngaut/archive/2008/04/14/47077.html'>阅读全文</a><img src ="http://www.cppblog.com/ngaut/aggbug/47077.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2008-04-14 21:38 <a href="http://www.cppblog.com/ngaut/archive/2008/04/14/47077.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转载]打造最快的Hash表(和Blizzard的对话)</title><link>http://www.cppblog.com/ngaut/archive/2008/02/27/43329.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Wed, 27 Feb 2008 03:39:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2008/02/27/43329.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/43329.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2008/02/27/43329.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/43329.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/43329.html</trackback:ping><description><![CDATA[<p>開元最近学习了一下Blizzard的MPQ文件格式，颇有一些心得，其中一条就是对HastTable的理解，很想写出来给大家共享，感谢Justin Olbrantz的文章《Inside MoPaQ》，大多认识来源于此。 <br><br><br>先提一个简单的问题，如果有一个庞大的字符串数组，然后给你一个单独的字符串，让你从这个数组中查找是否有这个字符串并找到它，你会怎么做？<br><br>有一个方法最简单，老老实实从头查到尾，一个一个比较，直到找到为止，我想只要学过程序设计的人都能把这样一个程序作出来，但要是有程序员把这样的程序交给用户，我只能用无语来评价，或许它真的能工作，但...也只能如此了。<br><br>最合适的算法自然是使用HashTable（哈希表），先介绍介绍其中的基本知识，所谓Hash，一般是一个整数，通过某种算法，可以把一个字符串"压缩" 成一个整数，这个数称为Hash，当然，无论如何，一个32位整数是无法对应回一个字符串的，但在程序中，两个字符串计算出的Hash值相等的可能非常小，下面看看在MPQ中的Hash算法<br><br>unsigned long HashString(char *lpszFileName, unsigned long dwHashType)<br>{ <br>unsigned char *key = (unsigned char *)lpszFileName;<br>unsigned long seed1 = 0x7FED7FED, seed2 = 0xEEEEEEEE;<br>int ch;<br><br>while(*key != 0)<br>{ <br>&nbsp;&nbsp;ch = toupper(*key++);<br><br>seed1 = cryptTable[(dwHashType &lt;&lt; 8) + ch] ^ (seed1 + seed2);<br>seed2 = ch + seed1 + seed2 + (seed2 &lt;&lt; 5) + 3; <br>}<br>return seed1; <br>} <br><br>Blizzard的这个算法是非常高效的，被称为"One-Way Hash"，举个例子，字符串"unitneutralacritter.grp"通过这个算法得到的结果是0xA26067F3。<br>是不是把第一个算法改进一下，改成逐个比较字符串的Hash值就可以了呢，答案是，远远不够，要想得到最快的算法，就不能进行逐个的比较，通常是构造一个哈希表(Hash Table)来解决问题，哈希表是一个大数组，这个数组的容量根据程序的要求来定义，例如1024，每一个Hash值通过取模运算 (mod)对应到数组中的一个位置，这样，只要比较这个字符串的哈希值对应的位置又没有被占用，就可以得到最后的结果了，想想这是什么速度？是的，是最快的O(1)，现在仔细看看这个算法吧<br>int GetHashTablePos(char *lpszString, SOMESTRUCTURE *lpTable, int nTableSize)<br>{ <br>int nHash = HashString(lpszString), nHashPos = nHash % nTableSize;<br><br>if (lpTable[nHashPos].bExists &amp;&amp; !strcmp(lpTable[nHashPos].pString, lpszString)) <br>&nbsp;&nbsp;return nHashPos; <br>else <br>&nbsp;&nbsp;return -1; //Error value <br>} <br><br>看到此，我想大家都在想一个很严重的问题："如果两个字符串在哈希表中对应的位置相同怎么办？",毕竟一个数组容量是有限的，这种可能性很大。解决该问题的方法很多，我首先想到的就是用"链表",感谢大学里学的数据结构教会了这个百试百灵的法宝，我遇到的很多算法都可以转化成链表来解决，只要在哈希表的每个入口挂一个链表，保存所有对应的字符串就OK了。<br><br>事情到此似乎有了完美的结局，如果是把问题独自交给我解决，此时我可能就要开始定义数据结构然后写代码了。然而Blizzard的程序员使用的方法则是更精妙的方法。基本原理就是：他们在哈希表中不是用一个哈希值而是用三个哈希值来校验字符串。<br><br>中国有句古话"再一再二不能再三再四"，看来Blizzard也深得此话的精髓，如果说两个不同的字符串经过一个哈希算法得到的入口点一致有可能，但用三个不同的哈希算法算出的入口点都一致，那几乎可以肯定是不可能的事了，这个几率是1:18889465931478580854784，大概是10的 22.3次方分之一，对一个游戏程序来说足够安全了。<br><br>现在再回到数据结构上，Blizzard使用的哈希表没有使用链表，而采用"顺延"的方式来解决问题，看看这个算法：<br>int GetHashTablePos(char *lpszString, MPQHASHTABLE *lpTable, int nTableSize)<br>{ <br>const int HASH_OFFSET = 0, HASH_A = 1, HASH_B = 2;<br>int nHash = HashString(lpszString, HASH_OFFSET);<br>int nHashA = HashString(lpszString, HASH_A);<br>int nHashB = HashString(lpszString, HASH_B);<br>int nHashStart = nHash % nTableSize, nHashPos = nHashStart;<br><br>while (lpTable[nHashPos].bExists)<br>{ <br>&nbsp;&nbsp;if (lpTable[nHashPos].nHashA == nHashA &amp;&amp; lpTable[nHashPos].nHashB == nHashB) <br>&nbsp;&nbsp; return nHashPos; <br>&nbsp;&nbsp;else <br>&nbsp;&nbsp; nHashPos = (nHashPos + 1) % nTableSize;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;if (nHashPos == nHashStart) <br>&nbsp;&nbsp; break; <br>}<br><br>return -1; //Error value <br>} <br><br>1. 计算出字符串的三个哈希值（一个用来确定位置，另外两个用来校验)<br>2. 察看哈希表中的这个位置<br>3. 哈希表中这个位置为空吗？如果为空，则肯定该字符串不存在，返回<br>4. 如果存在，则检查其他两个哈希值是否也匹配，如果匹配，则表示找到了该字符串，返回<br>5. 移到下一个位置，如果已经越界，则表示没有找到，返回<br>6. 看看是不是又回到了原来的位置，如果是，则返回没找到<br>7. 回到3<br><br>怎么样，很简单的算法吧，但确实是天才的idea, 其实最优秀的算法往往是简单有效的算法，<br>Blizzard被称为最卓越的游戏制作公司，不愧于此。</p>
<img src ="http://www.cppblog.com/ngaut/aggbug/43329.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2008-02-27 11:39 <a href="http://www.cppblog.com/ngaut/archive/2008/02/27/43329.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]Delphi多线程下的ADO编程</title><link>http://www.cppblog.com/ngaut/archive/2008/02/26/43253.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Tue, 26 Feb 2008 05:49:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2008/02/26/43253.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/43253.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2008/02/26/43253.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/43253.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/43253.html</trackback:ping><description><![CDATA[<p align=center><strong><span>Delphi</span></strong><strong><span>多线程下的</span></strong><strong><span>ADO</span></strong><strong><span>编程</span></strong><strong></strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong><span>前言：</span></strong><strong></strong></p>
<p><span>几个月前接到一个任务：将一后台程序访问数据库的方式从</span><span>BDE</span><span>改为</span><span>ADO</span><span>，原因是由于业务量的增加，通过</span><span>BDE</span><span>不论是向数据库写入数据还是从数据库中读出数据的速度都变得无法忍受，大家都知道</span><span>ADO</span><span>在数据库访问速度方面比</span><span>BDE</span><span>要快的多了（我写了一个测试程序使用</span><span>ADO</span><span>比使用</span><span>BDE</span><span>快了近</span><span>100</span><span>倍</span><span>!</span><span>）。这个任务还不简单嘛，只要将</span><span>BDE</span><span>的控件更换成</span><span>ADO</span><span>的再修改一些代码不就搞定了！我当时确实是这么想的，而且用了不到一个小时就搞定，测试运行一段没问题，大功告成了，我想。谁知道一个恶梦就此开始，我的愚昧无知使我在程序中埋下了一个超级炸弹，它的威力不次于</span><span>9.11</span><span>撞击世贸大厦的两架客机，整个系统被它无情的催跨。程序在运行很长一段时间候捕获到一系列的异常：</span></p>
<p><span>OLE error 800A0E7F</span></p>
<p><span>Access violation at address 00135770. Write of address 005D8B78</span></p>
<p><span>Access violation at address 00178EC6. Read of address FFFFFFFF</span></p>
<p><span>Access violation at address 1F499BDD in module 'msado15.dll'. Read of address 0000000C</span></p>
<p><span>&#8230;&#8230;.</span></p>
<p><span>接下来我们的系统就像世贸大厦一下悲壮的倒下了。</span></p>
<p>&nbsp;</p>
<p><strong><span>为什么？</span></strong><strong></strong></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span>为什么？程序在为改动之前使用</span><span>BDE</span><span>运行得好好的，我并没有更改程序的结构啊？我十分的迷惑，当然要想解决问题一切都得从错误代码开始。</span></p>
<p><span><span>&nbsp;&nbsp; </span>OLE error 800A0E7F</span><span>：什么咚咚来的？它什么意思？什么原因引起的？我找了半天也没有在我的系统里找到它的说明，好在现在网络发达，也许有人遇到跟我一样的问题吧，于是我用</span><span>OLE error 800A0E7F</span><span>作为关键字搜了一下，嘿嘿，果真被我找到了：</span></p>
<p><span>&gt;</span><em><span>0x800A0E7F Operation cannot be performed while executing </span></em><span><br><em>&gt; asynchronously.</em></span></p>
<p><span>异步执行时操作不能被执行（完成），还是不太清楚错误的原因，于是我在一个网站发布了帖子求助，一些人告诉我</span><span>ADO</span><span>线程不安全，需要线程同步，事实上我的程序做了同步，而且针对不同的应用使用了多个</span><span>ADOConnection</span><span>，我想我应该自己动手来好好研究一下这个问题了，它很意思。接下来我该好好分析我的程序并做一系列的测试来找到那个炸弹。</span></p>
<p>&nbsp;</p>
<p><strong><span>找出炸弹</span></strong><strong></strong></p>
<p><strong>&nbsp;</strong></p>
<p><span><span>&nbsp;&nbsp;&nbsp; </span></span><span>在我的程序里所有访问数据库都是通过一个</span><span>DataModule</span><span>单元</span><span>TDataModule1</span><span>类提供的接口来完成，共有三个线程使用到了</span><span>TDataModule1</span><span>的对象</span><span>DataModule1</span><span>，</span><span>DataModule1</span><span>是一全局变量，下面是数据库的访问模式的结构模型图。（实际结构要复杂很多）</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><strong><span>数据库：</span></strong></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>ADOConnection1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>ADOConnection2 </span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>Table1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>Table2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>ADOQuery1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>②</span><span>ADOQuery3</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>ADOProcedure1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>ADOProcedure2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>UpdateQuery</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>③</span><span>ADOQuery2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br clear=all>
<p align=center><span>图</span><span>1</span></p>
<p><span>说明：</span></p>
<p>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>UpdateQuery</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
&nbsp;</p>
<br clear=all>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ADOQuery</span><span>控件用来修改</span><span>table2</span><span>记录，</span><span>①代表为线程</span><span>1</span><span>所有，</span></p>
<p><span>白色代表使用频率很低（颜色越深说明使用频率越高）</span></p>
<p>&nbsp;</p>
<p>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>③</span><span>ADOQuery2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
&nbsp;</p>
<br clear=all>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span>查询</span><span>table2</span><span>，</span><span>③代表为线程</span><span>3</span><span>所有，使用频率较高</span></p>
<p>&nbsp;</p>
<p>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>②</span><span>ADOQuery3</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
&nbsp;</p>
<br clear=all>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span>查询</span><span>table2</span><span>，</span><span>③代表为线程</span><span>2</span><span>所有，使用频率很高</span></p>
<p>&nbsp;</p>
<p>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>ADOProcedure1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ADO</span><span>存储过程控件向表</span><span>table2</span><span>插入数据，属于线程</span><span>1</span><span>频繁使用</span></p>
<p>&nbsp;</p>
<p>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>ADOProcedure2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
&nbsp;</p>
<br clear=all>
<p><span>修改</span><span>ADOProcedure1</span><span>插入的记录，属于线程</span><span>1</span><span>频繁使用</span></p>
<p>&nbsp;</p>
<p><span>其中线程</span><span>3</span><span>和线程</span><span>2</span><span>使用</span><span>ADO</span><span>控件时没有加锁，而线程</span><span>1</span><span>的所有访问都加锁了（这样做毫无作用）</span></p>
<p>&nbsp;</p>
<p><span>程序的结构出来了，问题在哪里呢？接下来我写了一个小小的测试程序，该程序的结构与上面相同，它拥有三个线程和一个</span><span>DataMoule</span><span>单元，线程一通过</span><span>ADOQuery1</span><span>查询数据库</span><span>DBTest</span><span>的</span><span>table1</span><span>的记录，线程二通过</span><span>ADOQuery2</span><span>向</span><span>table1</span><span>中插入记录，线程三通过</span><span>ADOQuery3</span><span>修改</span><span>table1</span><span>中最后一条记录的某个字段。</span><span>ADOQuery1</span><span>、</span><span>ADOQuery2</span><span>、</span><span>ADOQuery3</span><span>都通过</span><span>ADOConnection1</span><span>与数据库</span><span>DBTest1</span><span>建立连接，一开始，所有的线程都不做同步，运行，</span><span>OK!</span><span>错误出来了其中两个错误正是我所想要的，这就是我的程序报的错啊。</span></p>
<p>&nbsp;</p>
<p>&#160;</p>
<p align=center><span>图二</span></p>
<p>&nbsp;</p>
<p><span>接下来我将三个</span><span>ADOQuery</span><span>都加上锁，再运行没问题，我又将</span><span>ADOQuery</span><span>分别通过三个不同的</span><span>ADOConnection</span><span>来连接数据库且不加锁也没有问题。看来我是找到那个可恶的炸弹了，怎么拆了它？</span></p>
<p>&nbsp;</p>
<p><strong><span>排除炸弹</span></strong><strong></strong></p>
<p><strong>&nbsp;</strong></p>
<p><span>炸弹找到了，我该怎么拆它？是简单的做线程同步还是每个线程都是用一个</span><span>ADOConnection</span><span>？这下我再也不敢蛮干了，我得好好看看这方面的资料，在</span><span>Delphi</span><span>帮助文档，《</span><span>Using the main VCL thread</span><span>》我找到了下面一段话：</span></p>
<p><span>&#8230;&#8230;</span></p>
<p><span>Data access components are thread-safe as long as each thread has its own database session component. The one exception to this is when you are using Access drivers. Access drivers are built using the Microsoft ADO library, which is not thread-safe.</span></p>
<p><span>&#8230;..</span></p>
<p><span>同样在</span><span>Delphi</span><span>的帮助文档《</span><span>Managing multiple sessions</span><span>》中给我明确的建议：</span></p>
<p><span>&#8230;&#8230;</span></p>
<p><span>If you create a single application that uses multiple threads to perform database operations, you must create one additional session for each thread.</span></p>
<p><span>&#8230;..</span></p>
<p><strong><span>喔找到了：</span></strong><strong><span>ADO</span></strong><strong><span>控件是线程不安全的，所以如果你的程序是使用多线程访问数据库的话你应该确保每个线程都有自己的会话。</span></strong><strong></strong></p>
<p><span>事实上在另外一本书《</span><span>Delphi 4</span><span>编程技术内幕》一书在谈到<em>线程安全数据库访问</em>也有相同的建议，不过台湾李维先生在他的</span><span>《</span><span>Delphi 5.X ADO/MTS/COM+</span><span>高级程序设计篇》却说，<strong>如果你的程序不是连接多个数据库的话，最好同一数据库使用一个连接，不要使用多个连接</strong>。怎么办？谁对谁错？为什么要使用一个连接呢？这主要是从服务器来考虑，因为数据库服务器需要为每个连接分配一定的资源并对其进行维护，连接数越多服务器方所耗的资源就越多，服务器的性能也就越差，所以要尽可能的减少客户端的连接数。好在我的程序是作为服务器程序增加一些连接对数据库服务器的影响不会很大，现在我可以重新设置我的数据库访问结构模型了</span></p>
<p>&nbsp;</p>
<p>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><strong><span>数据库：</span></strong></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>ADOConnection1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>ADOConnection2 </span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>Table1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>Table2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>ADOQuery1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>②</span><span>ADOQuery3</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>ADOProcedure1</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>ADOProcedure2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>①</span><span>UpdateQuery</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>③</span><span>ADOQuery2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
<table cellSpacing=0 cellPadding=0 width="100%">
    <tbody>
        <tr>
            <td>
            <div>
            <p><span>ADOConnection2</span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br clear=all>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p align=center><span>图三</span></p>
<p align=center>&nbsp;</p>
<p><span>我增加了一个</span><span>ADOConnection</span><span>以保证每个线程都有一个自己连接</span><span>(</span><span>会话</span><span>)</span><span>，从而避免出现资源冲突，我的问题是不是解决了呢？是的，这个问题已经解决了，将我的程序与数据库放在同一台机器上运行没有问题，但是当程序与数据库服务器不在同一台机器上运行时会出现一个新的问题。</span></p>
<p>&nbsp;</p>
<p><strong><span>[DBNMPNTW]ConnectionWrite(writeFile())</span></strong><strong><span>错误</span></strong><strong></strong></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span>这个错误不是多线程引起的，而是</span><span>Micrsoft</span><span>自己的一个问题，产生该问题的原因可能是因为网络异常而引起的，可以通过</span><span>SQLServer</span><span>客户端的默认的网络协议</span><span>named pipes network propocol </span><span>改为</span><span> TCP/IP </span><span>Sockets</span><span>，</span><span>具体做法请参考</span><span>Micrsoft</span><span>技术支持网站的《</span><strong><span>Microsoft Knowledge Base Article&nbsp;-&nbsp;Q178040</span></strong><span>》</span></p>
<p>&nbsp;</p>
<p><strong><span>总结</span></strong><strong></strong></p>
<p><strong><span><span>&nbsp;&nbsp; </span></span></strong><span>由于</span><span>ADO</span><span>控件的线程不安全性（事实上这种不安全性是来自</span><span>Micrsoft ADO Library</span><span>，所以在其它开发工具中也存在同样的问题）因此在使用多线程</span><span>ADO</span><span>编程时应该注意一下问题：</span></p>
<p>&nbsp;</p>
<p><strong><span>第一：要保证每个线程都拥有自己的会话。</span></strong><strong></strong></p>
<p><strong><span>第二：作为客户端程序应该尽可能的减少与数据库库服务器的连接数。</span></strong><strong></strong></p>
<p><strong><span>第三：在退出线程之前确保释放所有的资源。</span></strong><strong></strong></p>
<p><strong>&nbsp;</strong></p>
<p><span>参考文献：</span></p>
<p><span>1、</span><span>李维</span><span>《</span><span>Delphi 5.X ADO/MTS/COM+</span><span>高级程序设计篇》</span><span> </span><span>机械工业出版社</span><span> 2000</span><span>。</span></p>
<p><span>2、</span><span>Charlie Calvert</span><span>《</span><span>Delphi 4</span><span>编程技术内幕》潇湘工作室</span><span> </span><span>译</span><span> </span><span>机械工业出版社</span><span> 1999</span></p>
<img src ="http://www.cppblog.com/ngaut/aggbug/43253.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2008-02-26 13:49 <a href="http://www.cppblog.com/ngaut/archive/2008/02/26/43253.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>boost asio 0.39发布了</title><link>http://www.cppblog.com/ngaut/archive/2007/12/16/38634.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Sun, 16 Dec 2007 14:04:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2007/12/16/38634.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/38634.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2007/12/16/38634.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/38634.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/38634.html</trackback:ping><description><![CDATA[boost asio 0.39发布了，看来即将进入boost 1.35了
<img src ="http://www.cppblog.com/ngaut/aggbug/38634.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2007-12-16 22:04 <a href="http://www.cppblog.com/ngaut/archive/2007/12/16/38634.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]今年的十个佳句出炉啦</title><link>http://www.cppblog.com/ngaut/archive/2007/10/23/34936.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Tue, 23 Oct 2007 11:14:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2007/10/23/34936.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/34936.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2007/10/23/34936.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/34936.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/34936.html</trackback:ping><description><![CDATA[<br>1、钱不是问题，问题是没钱。<br>2、钻石恒久远，一颗就破产。<br>3、水能载舟，亦能煮粥。<br>4、一山不能容二虎，除非一公和一母。<br>5、火可以试金，金可以试女人，女人可以试男人。<br>6、烧香的不一定是和尚，还可能是熊猫。<br>7、喝醉了我谁也不服，我就扶墙。<br>8、我就像一只趴在玻璃上的苍蝇，前途光明，出路没有。<br>9、避孕的效果：不成功，便成人。<br>10、问世间情为何物？一物降一物&nbsp; 
<img src ="http://www.cppblog.com/ngaut/aggbug/34936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2007-10-23 19:14 <a href="http://www.cppblog.com/ngaut/archive/2007/10/23/34936.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>当asio::async_read与socket的async_read_some的区别</title><link>http://www.cppblog.com/ngaut/archive/2007/06/29/27221.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Fri, 29 Jun 2007 07:37:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2007/06/29/27221.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/27221.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2007/06/29/27221.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/27221.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/27221.html</trackback:ping><description><![CDATA[今天用asio写一个简单的server时，<br>当连接成功时做如下工作<br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="COLOR: #008080">1</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;asio::async_read(socket_,&nbsp;asio::buffer(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">m_packet,&nbsp;</span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000">(m_packet)),<br></span><span style="COLOR: #008080">2</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;boost::bind(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">tcp_connection::HandleReadCardKey,&nbsp;shared_from_this(),<br></span><span style="COLOR: #008080">3</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;asio::placeholders::error));</span></div>
但HandleReadCardKey始终没有被回调，除非remote point断开连接<br><br>最后用下面的代码搞定：<br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="COLOR: #008080">1</span>&nbsp;<span style="COLOR: #000000">socket_.async_read_some(asio::buffer(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">m_packet,&nbsp;</span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000">(m_packet)),<br></span><span style="COLOR: #008080">2</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;boost::bind(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">tcp_connection::HandleReadCardKey,&nbsp;shared_from_this(),<br></span><span style="COLOR: #008080">3</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;asio::placeholders::error));</span></div>
记下，免得以后忘记了<br><br>总结一下：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;asio::async_read通常用户读取指定长度的数据，读完或出错才返回。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;而socket的async_read_some读取到数据或出错就返回，不一定读完了整个包。&nbsp;&nbsp;&nbsp;<br><br>
<img src ="http://www.cppblog.com/ngaut/aggbug/27221.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2007-06-29 15:37 <a href="http://www.cppblog.com/ngaut/archive/2007/06/29/27221.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]嵌入式Linux研究－对几种典型的系统的内核配置方案</title><link>http://www.cppblog.com/ngaut/archive/2007/06/20/26713.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Wed, 20 Jun 2007 12:32:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2007/06/20/26713.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/26713.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2007/06/20/26713.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/26713.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/26713.html</trackback:ping><description><![CDATA[<h5>
<p><span><font face="Times New Roman">1.</font></span><span>对于一般</span><span><font face="Times New Roman">PC</font></span><span>的普通内核配置</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>对于一般的用户而言，对于</span><span><font face="Times New Roman">Linux</font></span><span>内核的效率和大小的要求都不高。因此一般不对内核重新配置，因为</span><span><font face="Times New Roman">Linux</font></span><span>安装程序会在安装时对大部分设置按照安装的需求和实际的硬件做缺省设置。这样的内核会比实际需要的繁冗，有很多模块加载后根本就没有用到，但是因为现在的</span><span><font face="Times New Roman">PC</font></span><span>的内存一般都是上百</span><span><font face="Times New Roman">MB</font></span><span>，而一个</span><span><font face="Times New Roman">Linux</font></span><span>内核再大也就是几百</span><span><font face="Times New Roman">K</font></span><span>，因此对于一般用户而言，无需再重新编译内核了。</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>在一台</span><span><font face="Times New Roman">P3-566</font></span><span>的</span><span><font face="Times New Roman">Dell</font></span><span>机器安装</span><font face="Times New Roman"><span>Red-Hat</span><span>7.2,</span></font><span>内核版本为</span><font face="Times New Roman"><st1:chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899"><span>2.4.6</span></st1:chsdate><br><br><span></span></font><span>以下是一些该机的配置：</span><span><br><br></span><span><font face="Times New Roman">Loadablemodulesupport:Y<br><br>Networkingsupport:Y<br><br>PCIsupport:Y<br><br>SystemVIPC</font></span><span>：</span><span><font face="Times New Roman">Y</font></span><span>因为可以做一些基于</span><font face="Times New Roman"><span>System</span><span>V</span></font><span>的程序</span><span><br><br></span><span><font face="Times New Roman">Kernelsupportfora.outbinaries:Y<br><br>KernelsupportforELFbinaries:Y<br><br>Blockdevices</font></span><span>：对此根据该机的硬件做了相应的配置，去除一些本机没有的硬件设备的支持模块。如</span><font face="Times New Roman"><span>:Loopback</span><span>d</span><span>evice</span></font><span><font face="Times New Roman">support<br><br>Networkingoptions:<br><br>Packetsocket:Y<br><br>TCP/IPnetworking:Y<br><br>Networkfirewalls:Y<br><br>TheIPXprotocol:Y<br><br>Networkdevicesupport:<br><br>Networkdevicesupport:Y<br><br>Ethernet(10or100Mb/s):Y<br><br>Characterdevice<br><br>Virtualterminal:Y</font></span><span><br><br></span><span><font face="Times New Roman">Supportforconsoleonvirtualterminal:Y<br><br>Filesystems<br><br>Secondextendedfssupport:Y<br><br>VFATfssupport:m</font></span><span>笔者有时会用到该机上的</span><span><font face="Times New Roman">VFAT</font></span><span>分区</span><span><font face="Times New Roman"><br><br>/procfilesystemsupportY<br><br>ISO9660cdromfilesystemsupport:m<br><br>NetworkFileSystems<br><br>NFSfilesystemsuppor</font></span><span><font face="Times New Roman">t:Y<br><br></font></span><span><font face="Times New Roman">SMBfilesystemsupport:m<br><br>Consoledrivers<br><br>VGAtextconsole:Y<br><br>Videomodeselectionsupport:Y<br><br>VESAVGAgraphicsconsole:Y<br><br>Kernelhacking<br><br>MagicSysRqkey:Y<br><br></font></span><span>还有一些缺省的设置笔者没有改。这样编译出来的版本有</span><span><font face="Times New Roman">700K.</font></span><span>经过笔者调试过没有出现什么问题。</span><span><br><br><font face="Times New Roman">2.PDA</font></span><span>的内核设置</span><span><br><br></span><font face="Times New Roman"><span>PDA(Per</span><span>sonal</span><span>DigitalAssist)</span></font><span>如：手机，快译通，文曲星等等。这类系统要求系统稳定，内核小而且效率高，常常需要一些特殊的硬件支持。对进程调度、文件系统要求单一，有些就是单进程系统。对网络的支持由根据需要确定。</span><span><font face="Times New Roman">RedHat</font></span><span>的内核无法直接用来设计一些特殊要求的</span><span><font face="Times New Roman">PDA,</font></span><span>一般还要加入对硬件的特定模块。</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>可作如下设置：</span><span><br><br></span><span><font face="Times New Roman">Networkingsupport:Y:</font></span><span>一般</span><span><font face="Times New Roman">PDA</font></span><span>都支持上网更新功能</span><span><br><br></span><font face="Times New Roman"><span>KernelsupportforELFbinaries:Y<br><br>Compileas</span><span>ELF</span><span>&#8211;ifyourGCCisELF-GCC:Y</span></font><span>这两个设置使系统的执行文件都为</span><span><font face="Times New Roman">ELF<br><br></font></span><span><font face="Times New Roman">AdvancedPowerManagerBiossupport:Y<br><br>Blockdevices:</font></span><span>应该加入对硬件特殊的支持模块</span><span><br><br></span><span><font face="Times New Roman">Networkingoptions<br><br>Packetsocket<br><br>FileSystem<br><br>Secondextendedfssupport:Y<br><br></font></span><span>另外的一些功能为</span><span><font face="Times New Roman">N,</font></span><span>当然一些功能必须选择用来支持上述的模块。编译后为</span><span><font face="Times New Roman">100KB---400KB<br><br>3.</font></span><span>小型嵌入式系统的内核配置</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>一个小型的嵌入式</span><span><font face="Times New Roman">Linux</font></span><span>系统只需要下面三个基本元素：</span><span><br><br></span><span><font face="Times New Roman"><br></font></span><span>引导工具</span><span><font face="Times New Roman"><br>Linux</font></span><span>微内核，由内存管理、进程管理和事务处理构成</span><span><font face="Times New Roman"><br></font></span><span>初始化进程</span><font face="Times New Roman"><span> <br></span><span></span></font><span>如果要让它能干点什么且继续保持小型化，还得加上：</span><span><br><br></span><span><font face="Times New Roman"><br></font></span><span>硬件驱动程序</span><span><font face="Times New Roman"><br></font></span><span>提供所需功能的一个或更多应用程序。</span><font face="Times New Roman"><span> <br></span><span></span></font><span>再增加功能，或许需要这些：</span><span><font face="Times New Roman"></font></span><span>一个文件系统（也许在</span><span><font face="Times New Roman">ROM</font></span><span>或</span><span><font face="Times New Roman">RAM</font></span><span>）中</span><span><font face="Times New Roman">TCP/IP</font></span><span>网络堆栈对该种系统</span><span><font face="Times New Roman">,</font></span><span>做了不同的设置</span><font face="Times New Roman"><span>:<br><br></span><span></span></font><span>不要</span><span><font face="Times New Roman">floppy</font></span><span>；不要</span><span><font face="Times New Roman">SMP</font></span><span>、</span><span><font face="Times New Roman">MTRR</font></span><span>；不要</span><font face="Times New Roman"><span>Network</span><span>ing</span></font><span>、</span><span><font face="Times New Roman">SCSI</font></span><span>；把所有的</span><span><font face="Times New Roman">blockdevice</font></span><span>移除，只留下</span><span><font face="Times New Roman">IDEdevice</font></span><span>；把所有的</span><span><font face="Times New Roman">characterdevice</font></span><span>移除；把所有的</span><span><font face="Times New Roman">filesystem</font></span><span>移除，只留下</span><span><font face="Times New Roman">minix</font></span><span>；不要</span><span><font face="Times New Roman">sound</font></span><span>支援。这样己经把所有的选项都移除了。这样做之后，得到了一个</span><span><font face="Times New Roman">188K</font></span><span>的核心</span><font face="Times New Roman"><span>.<br><br></span><span></span></font><span>把下列两个档案中的</span><span><font face="Times New Roman">-O3,-O2</font></span><span>用</span><span><font face="Times New Roman">-Os</font></span><span>取代。</span><span><br><br></span><span><font face="Times New Roman">./Makefile<br>./arch/i386/kernel/<br>Makefile<br><br></font></span><span>这样一来，整个核心变小了</span><span><font face="Times New Roman">9K</font></span><span>，成为</span><span><font face="Times New Roman">179K</font></span><span>。</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>不过这个核心恐怕很难发挥</span><span><font face="Times New Roman">Linux</font></span><span>的功能，因此把网络加回去。把</span><font face="Times New Roman"><span>General</span><span>setup</span></font><span>中的</span><span><font face="Times New Roman">networksupport</font></span><span>加回去，重新编译，核心变成</span><span><font face="Times New Roman">189K</font></span><span>。</span><span><font face="Times New Roman">10K</font></span><span>就加上个</span><span><font face="Times New Roman">TCP/IPstack</font></span><span>。</span><span><font face="Times New Roman"></font></span><span>有</span><span><font face="Times New Roman">stack</font></span><span>没有</span><span><font face="Times New Roman">driver</font></span><span>也是枉然，把</span><span><font face="Times New Roman">embeddedboard</font></span><span>常用的</span><span><font face="Times New Roman">RTL8139</font></span><span>的</span><span><font face="Times New Roman">driver</font></span><span>加回去，</span><font face="Times New Roman"><span>195K.<br><br></span><span></span></font><span>如果你需要</span><span><font face="Times New Roman">DOS</font></span><span>档案系统，那大小成为</span><span><font face="Times New Roman">213K</font></span><span>。如果</span><span><font face="Times New Roman">minix</font></span><span>用</span><span><font face="Times New Roman">ext2</font></span><span>换代，则大小成长至</span><span><font face="Times New Roman">222K</font></span><span>。</span><span><br><br></span><span><font face="Times New Roman">Linux</font></span><span>所需的内存大约在</span><span><font face="Times New Roman">600K</font></span><span>～</span><span><font face="Times New Roman">800K</font></span><span>之间。</span><span><font face="Times New Roman">1MB</font></span><span>内存就可能可以开机了，但不太有用，因为连载入</span><span><font face="Times New Roman">C</font></span><span>程序库都有困难。</span><span><font face="Times New Roman">2MB</font></span><span>内存应该就可以做点事了，但要到</span><span><font face="Times New Roman">4MB</font></span><span>以上才可以执行一个比较完整的系统。</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>因为</span><span><font face="Times New Roman">Linux</font></span><span>的</span><font face="Times New Roman"><span>filesystem</span><span></span></font><span>相当大，大约在</span><span><font face="Times New Roman">230K</font></span><span>左右，占了</span><span><font face="Times New Roman">1/3</font></span><span>的体积。内存管理占了</span><span><font face="Times New Roman">80K</font></span><span>，和核心其它部分的总和差不多。</span><font face="Times New Roman"><span>TCP/IP</span><span>stack</span></font><span>占了</span><span><font face="Times New Roman">65K</font></span><span>，驱动程序占了</span><span><font face="Times New Roman">120K</font></span><span>。</span><font face="Times New Roman"><span>SysV</span><span>IPC</span></font><span>占了</span><span><font face="Times New Roman">21K</font></span><span>，必要的话可以拿掉，核心档应该可以再小个</span><span><font face="Times New Roman">10K</font></span><span>左右。</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>如果要裁剪核心大小，应该动那里呢</span><font face="Times New Roman"><span>?</span><span></span></font><span>答案很明显，当然是文件系统。</span><font face="Times New Roman"><span>Linux</span><span></span></font><span>的</span><span><font face="Times New Roman">VFS</font></span><span>简化了档案系统的设计，</span><font face="Times New Roman"><span>buffer</span><span>cache,directorycache</span></font><span>增加了系统的效率。但这些</span><span><font face="Times New Roman">embedded</font></span><span>系统根本就用处不大。如果可以把它们拿掉，核心可以马上缩小</span><span><font face="Times New Roman">20K</font></span><span>左右。如果跳过整个</span><span><font face="Times New Roman">VFS</font></span><span>，直接将文件系统写成一个</span><span><font face="Times New Roman">driver</font></span><span>的型式，应该可以将</span><span><font face="Times New Roman">230K</font></span><span>缩减至</span><span><font face="Times New Roman">50K</font></span><span>左右。整个核心缩到</span><span><font face="Times New Roman">100K</font></span><span>左右。</span><span><br><br><font face="Times New Roman">4.</font></span><span>工控机的内核配置</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>对于工控机内核</span><span><font face="Times New Roman">,</font></span><span>对于内核的大小要求并不严格</span><span><font face="Times New Roman">,</font></span><span>关键的是正确性</span><span><font face="Times New Roman">,</font></span><span>健壮性和实时性</span><span><font face="Times New Roman">(</font></span><span>某些机子要求实时性较高</span><span><font face="Times New Roman">).</font></span><span>对文件系统要求单一</span><span><font face="Times New Roman">,</font></span><span>但保证正确性</span><span><font face="Times New Roman">.</font></span><span>网络按需设置。</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>可作如下配置</span><span><font face="Times New Roman">:<br><br></font></span><span><font face="Times New Roman">Symmetricmulti-processingsupport:Y<br><br>Loadablemodulesupport:N</font></span><span>工控机一般将可能用到的模块都全部装入内存</span><span><font face="Times New Roman">.<br><br></font></span><span><font face="Times New Roman">Networkingsupport:Y<br><br>SystemVIPC:Y<br><br>KernelsupplyforELFbinaries:Y<br><br>Blockdevices:</font></span><span>根据具体硬件配置</span><span><br><br></span><span><font face="Times New Roman">Networkingoptions<br><br>packetsock</font></span><font face="Times New Roman"><span>et:Y<br><br></span><span></span></font><span>根据具体需要</span><span><font face="Times New Roman">,</font></span><span>一般工控机是通过</span><span><font face="Times New Roman">LAN</font></span><span>连接</span><span><font face="Times New Roman">,</font></span><span>与外界隔离故要</span><span><font face="Times New Roman">IPX</font></span><span>协议</span><span><font face="Times New Roman">,</font></span><span>另外</span><span><font face="Times New Roman">Tcp/ip</font></span><span>一般也需要</span><span><font face="Times New Roman">.<br><br></font></span><span><font face="Times New Roman">QoSand/orfairqueueing:Y<br><br>QoS(QualityOfService)andfairqueueling</font></span><span>是一种排定某种封包先送的网络线程表</span><span><font face="Times New Roman">,</font></span><span>可同时针对多个网络封包处理并依优先处理顺序来排序</span><span><font face="Times New Roman">,</font></span><span>称之为</span><font face="Times New Roman"><span>packet</span><span>schedulers.</span></font><span>此功能特别是针对实时系统时格外重要</span><span><font face="Times New Roman">,</font></span><span>当多个封包同时送到网络设备时</span><span><font face="Times New Roman">,Kernel</font></span><span>可以适当的决定出哪一个封包必须优先处理</span><span><font face="Times New Roman">.</font></span><span>因此</span><span><font face="Times New Roman">Kernel</font></span><span>提供数种</span><span><font face="Times New Roman">packet</font></span><span><font face="Times New Roman">schedulingalgorithm.<br><br>Filesystems<br><br>SecondExtendedfssupport:Y<br><br></font></span><span>其余配置和小型嵌入式系统差别不大</span><span><font face="Times New Roman">.</font></span><span>同一台机器上编译出来的内核大小为</span><span><font face="Times New Roman">800</font></span><span>多</span><span><font face="Times New Roman">KB</font></span><span>。</span><span><br><br><font face="Times New Roman">5.</font></span><span>服务器的内核配置</span><span><font face="Times New Roman">:<br><br></font></span><span><font face="Times New Roman"> <br></font></span><span>服务器的内核对网络设置和进程调度都非常关键</span><span><font face="Times New Roman">.</font></span><span>做如下配置</span><span><font face="Times New Roman">:<br><br></font></span><span><font face="Times New Roman">Symmetricmulti-processingsupport:Y<br><br>Loadablemodulesupport:Y</font></span><span><br><br></span><span><font face="Times New Roman">Networkingsupport:Y<br><br>Networkingoption<br><br>Packetsocket:Y</font></span><span>。</span><span><br><br></span><span><font face="Times New Roman">TCP/IPnetworkeing:Y<br><br>Networkfirewalls:</font></span><span>是否采用网络防火墙。如果计算机想当</span><font face="Times New Roman"><span>firewalls</span><span>server</span></font><span>或者是处于</span><font face="Times New Roman"><span>TCP/IP</span><span></span></font><span>通信协议的网络的网路结构下，这一项要选</span><font face="Times New Roman"><span>[Y]<br><br></span><span>Networkaliasing[Y/m/n/?]:</span></font><span>一台网络上的计算机可以拥有多组</span><span><font face="Times New Roman">IP</font></span><span>地址。如果计算机想拥有多个</span><span><font face="Times New Roman">IP</font></span><span>地址，就选择</span><font face="Times New Roman"><span>[Y].<br><br></span><span>IP:forwarding/gatewaying[Y/m/n/?]:</span></font><span>假如用户想当路由器的话，选择</span><span><font face="Times New Roman">[Y],</font></span><span>但先决条件是有</span><span><font face="Times New Roman">&#8220;</font></span><span>两张</span><span><font face="Times New Roman">&#8221;</font></span><span>网卡，一张对外部网络、一张对内部网络，并且使用的</span><span><font face="Times New Roman">ISP</font></span><span>那一端也必须设定</span><span><font face="Times New Roman">routing</font></span><span>，允许用户这台路由器才行。</span><span><br><br></span><span><font face="Times New Roman">IP:multicasting:</font></span><span>可以一次就完成传送一个</span><span><font face="Times New Roman">packet</font></span><span>到好几台计算机的操作。</span><span><br><br></span><span><font face="Times New Roman">IP:syn_cookies:</font></span><span>一种保护措施，将各种</span><span><font face="Times New Roman">TCP/IP</font></span><span>的通信协议加密，防止</span><span><font face="Times New Roman">Attacker</font></span><span>攻击用户的计算机，并且可以纪录企图攻击用户的计算机的</span><span><font face="Times New Roman">IP</font></span><span>地址。</span><span><br><br></span><span><font face="Times New Roman">IP:firewalling:</font></span><span>该台计算机是否是防火墙服务器。</span><span><br><br></span><span><font face="Times New Roman">IP:firewallpacketlogging:</font></span><span>是否由</span><span><font face="Times New Roman">klogd</font></span><span>记录防火墙服务器到底接收了哪些</span><span><font face="Times New Roman">Packet</font></span><span>。</span><span><br><br></span><span><font face="Times New Roman">IP:masquerading:</font></span><span>可以将内部网络的计算机送出去的封包，通过防火墙服务器直接传递给远端的计算机，而远端的计算机看到的就是接收到的防火墙服务器送过来的封包，而不是从内部的计算机送过来的。这样如果内部只有一台计算机可以上网，其余的机器可以通过这台机子的防火墙服务器向外连线。选择这个选项必需先确定先前的</span><font face="Times New Roman"><span>Network</span><span>FirewallsIP:forwarding/gatewayingIP</span></font><span>：</span><font face="Times New Roman"><span>firewalling</span><span></span></font><span>这三个选项选</span><span><font face="Times New Roman">[Y]</font></span><span>。以及下一个选项</span><span><font face="Times New Roman">IP</font></span><span>：</span><font face="Times New Roman"><span>always</span><span>deframent</span></font><span>也要选</span><font face="Times New Roman"><span>[Y].<br><br></span><span>IP:ICMPmasquerading:</span></font><span>一般</span><font face="Times New Roman"><span>masquerading</span><span></span></font><span>只提供处理</span><font face="Times New Roman"><span>TCP,UDP</span><span>packets,</span></font><span>若要让</span><font face="Times New Roman"><span>masqurerading</span><span></span></font><span>也能处理</span><font face="Times New Roman"><span>ICMP</span><span>packets,</span></font><span>这个选项要选</span><font face="Times New Roman"><span>[Y].<br><br></span><span>IP:alwaysdefragment:</span></font><span>可将接收到的</span><font face="Times New Roman"><span>packet</span><span>fragm</span><span>ents</span></font><span>重新组合回原来那个封包。</span><span><br><br></span><span><font face="Times New Roman">IP:accounting:</font></span><span>统计</span><font face="Times New Roman"><span>IP</span><span>packet</span></font><span>的流量，也就是网络的流通情况。</span><span><br><br></span><span><font face="Times New Roman">IP:optimizeasrouternothost:</font></span><span>可以关闭</span><span><font face="Times New Roman">copy&amp;checksum</font></span><span>技术，防止流量大的服务器的</span><font face="Times New Roman"><span>IP</span><span>packets</span></font><span>丢失。</span><span><br><br></span><span><font face="Times New Roman">IP:tunneling:</font></span><span>可在不同网域中使用</span><span><font face="Times New Roman">linux,</font></span><span>且都不用改</span><span><font face="Times New Roman">IP</font></span><span>就可以直接上网了。适合于笔记本型计算机用户。</span><span><br><br></span><span><font face="Times New Roman">IP:ReverseARP:</font></span><span>主要是提供</span><span><font face="Times New Roman">bootp</font></span><span>的功能，让计算机从可以从网卡的</span><font face="Times New Roman"><span>Boot</span><span>Ram</span></font><span>启动。</span><span><br><br></span><span><font face="Times New Roman">IP:DisablePathMTUDiscovery:</font></span><span>是否取消</span><font face="Times New Roman"><span>Path</span><span>MTUDiscovery.MTU</span></font><span>有助于处理拥挤的网络。</span><span><br><br></span><span><font face="Times New Roman">TheIPXprotocol:IPX</font></span><span>为</span><font face="Times New Roman"><span>Netware</span><span></span></font><span>网络使用的通讯协议。</span><span><br><br></span><span><font face="Times New Roman"></font></span><span>其余根据需要设置。编译出的内核为</span><span><font face="Times New Roman">800K</font></span><span>。</span></p>
</h5>
<img src ="http://www.cppblog.com/ngaut/aggbug/26713.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2007-06-20 20:32 <a href="http://www.cppblog.com/ngaut/archive/2007/06/20/26713.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>《自己动手写嵌入式操作系统》源代码</title><link>http://www.cppblog.com/ngaut/archive/2007/06/19/26628.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Tue, 19 Jun 2007 07:32:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2007/06/19/26628.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/26628.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2007/06/19/26628.html#Feedback</comments><slash:comments>14</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/26628.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/26628.html</trackback:ping><description><![CDATA[经常有朋友发邮件问我要源代码，一个个的发太麻烦，干脆放上来吧
http://www.cppblog.com/Files/ngaut/HELLOCN_SRCCODE.zip<img src ="http://www.cppblog.com/ngaut/aggbug/26628.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2007-06-19 15:32 <a href="http://www.cppblog.com/ngaut/archive/2007/06/19/26628.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决error C2011: 'fd_set' : 'struct' type redefinition问题</title><link>http://www.cppblog.com/ngaut/archive/2007/04/23/22658.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Mon, 23 Apr 2007 09:15:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2007/04/23/22658.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/22658.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2007/04/23/22658.html#Feedback</comments><slash:comments>8</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/22658.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/22658.html</trackback:ping><description><![CDATA[<p>在所有的#include &lt;windows.h&gt;前使用#define WIN32_LEAN_AND_MEAN，如：</p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">&nbsp;WIN32_LEAN_AND_MEAN</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">windows.h</span><span style="COLOR: #000000">&gt;</span></div>
<img src ="http://www.cppblog.com/ngaut/aggbug/22658.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2007-04-23 17:15 <a href="http://www.cppblog.com/ngaut/archive/2007/04/23/22658.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>与妻书---林觉民</title><link>http://www.cppblog.com/ngaut/archive/2007/02/24/18944.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Sat, 24 Feb 2007 07:01:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2007/02/24/18944.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/18944.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2007/02/24/18944.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/18944.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/18944.html</trackback:ping><description><![CDATA[
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;与妻书&nbsp; <br>&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;林觉民&nbsp; <br>&nbsp; <br>&nbsp;意映卿卿如晤：吾今以此书与汝永别矣！吾作此书时，尚为世中一人；汝看此&nbsp; <br>书时，吾已成为阴间一鬼。吾作此书，泪珠和笔墨齐下，不能书竟，而欲搁笔。又&nbsp; <br>恐汝不察吾衷，谓吾忍舍汝而死，谓吾不知汝之不欲吾死也，故遂忍悲为汝言之。&nbsp; <br>&nbsp; <br>&nbsp;吾至爱汝！即此爱汝一念，使吾勇于就死也！吾自遇汝以来，常愿天下有情人&nbsp; <br>都成眷属，然遍地腥云，满街狼犬，称心快意，几家能够？司马青衫，吾不能学太&nbsp; <br>上之忘情也。语云，仁者&#8220;老吾老以及人之老，幼吾幼以及人之幼&#8221;。吾充吾爱汝&nbsp; <br>之心，助天下人爱其所爱，所以敢先汝而死，不顾汝也。汝体吾此心，于悲啼之余，&nbsp; <br>亦以天下人为念，当亦乐牺牲吾身与汝身之福利，为天下人谋永福也。汝其勿悲。&nbsp; <br>&nbsp;汝忆否四五年前某夕，吾尝语曰：&#8220;与使吾先死也，无宁汝先吾而死。&#8221;汝初&nbsp; <br>闻言而怒，后经吾婉解，虽不谓吾言为是，而亦无辞相答。吾之意盖谓以汝之弱，&nbsp; <br>必不能禁失吾之悲，吾先死留苦与汝，吾心不忍，故宁请汝先死，吾担悲也。嗟夫，&nbsp; <br>谁知吾卒先汝而死乎！&nbsp; <br>&nbsp; <br>&nbsp;吾真不能忘汝也！回忆后街之屋，入门穿廊，过前后厅，又三四折有小厅，厅&nbsp; <br>旁一室为吾与汝双栖之所。初婚三四个月，适冬之望日前后，窗外疏梅筛月影，依&nbsp; <br>稀掩映，吾与汝并肩携手，低低切切，何事不语，何情不诉！及今思之，空余泪痕！&nbsp; <br>又回忆六七年前，吾之逃家复归也，汝泣告我：&#8220;望今后有远行，必以告妾，妾愿&nbsp; <br>随君行。&#8221;吾亦既许汝矣。前十余日回家，即欲乘便以此行之事语汝，及与汝相对，&nbsp; <br>又不能启口；且以汝之有身也，更恐不胜悲，故惟日日呼酒买醉。嗟夫！当时余心&nbsp; <br>之悲，盖不能以寸管形容之。&nbsp; <br>&nbsp; <br>&nbsp;吾诚愿与汝相守以死。第以今日事势观之，天灾可以死，盗贼可以死，瓜分之&nbsp; <br>日可以死，奸官污吏虐民可以死，吾辈处今日之中国，国中无地无时不可以死！到&nbsp; <br>那时使吾眼睁睁看汝死，或使汝眼睁睁看我死，吾能之乎！抑汝能之乎！即可不死，&nbsp; <br>而离散不相见，徒使两地眼成穿而骨化石，试问古来几曾见破镜能重圆，则较死为&nbsp; <br>苦也。将奈之何？今日吾与汝幸双健；天下人人不当死而死，与不愿离而离者，不&nbsp; <br>可数计；钟情如我辈者，能忍之乎？此吾所以敢率性就死不顾汝也！吾今死无余憾，&nbsp; <br>国事成不成，自有同志者在。依新已五岁，转眼成人，汝其善抚之，使之肖我。汝&nbsp; <br>腹中之物，吾疑其女也，女必像汝，吾心甚慰；或又是男，则亦教其以父志为志，&nbsp; <br>则我死后，尚有二意洞在也，甚幸甚幸！&nbsp; <br>&nbsp; <br>&nbsp;吾家后日当甚贫，贫无所苦，清静过日而已。&nbsp; <br>&nbsp; <br>&nbsp;吾今与汝无言矣！吾居九泉之下，遥闻汝哭声，当哭相和也。吾平日不信有鬼，&nbsp; <br>今则又望其真有。今人又言心电感应有道，吾亦望其言是实，则吾之死，吾灵尚依&nbsp; <br>依旁汝也，汝不必以无侣悲！&nbsp; <br>&nbsp; <br>&nbsp;吾生平未尝以吾所志语汝，是吾不是处。然语之，又恐汝日日为吾担忧。吾牺&nbsp; <br>牲百死而不辞，而使汝担忧，的的非吾所忍。吾爱汝至，所以为汝谋者惟恐未尽。&nbsp; <br>汝幸而偶我，又何不幸而生今日之中国！吾幸而得汝，又何不幸而生今日之中国，&nbsp; <br>卒不忍独善其身！嗟夫！巾短情长，所未尽者尚有万千，汝可摹拟得之。吾今不能&nbsp; <br>见汝矣！汝不能舍吾，其时时于梦中寻我乎！一恸！&nbsp; <br>&nbsp; <br>&nbsp;辛亥三月念六夜四鼓，意洞手书。&nbsp; <br>&nbsp; <br>&nbsp;家中诸母皆通文，有不解处，望请其指教。当尽吾意为幸&nbsp; <br><img src ="http://www.cppblog.com/ngaut/aggbug/18944.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2007-02-24 15:01 <a href="http://www.cppblog.com/ngaut/archive/2007/02/24/18944.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决unresolved external symbol "public: int __thiscall CWnd::KillTimer(unsigned int)" (?KillTimer@CWnd@@QAEHI@Z)问题</title><link>http://www.cppblog.com/ngaut/archive/2007/02/23/18933.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Fri, 23 Feb 2007 15:48:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2007/02/23/18933.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/18933.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2007/02/23/18933.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/18933.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/18933.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 解决KillTimer link失败的问题&nbsp;&nbsp;<a href='http://www.cppblog.com/ngaut/archive/2007/02/23/18933.html'>阅读全文</a><img src ="http://www.cppblog.com/ngaut/aggbug/18933.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2007-02-23 23:48 <a href="http://www.cppblog.com/ngaut/archive/2007/02/23/18933.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>老老实实从头做起</title><link>http://www.cppblog.com/ngaut/archive/2006/12/24/16798.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Sun, 24 Dec 2006 10:40:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2006/12/24/16798.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/16798.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2006/12/24/16798.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/16798.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/16798.html</trackback:ping><description><![CDATA[
记于圣诞前夕2006.12.24晚<img src ="http://www.cppblog.com/ngaut/aggbug/16798.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2006-12-24 18:40 <a href="http://www.cppblog.com/ngaut/archive/2006/12/24/16798.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>偶尔的思绪和收获</title><link>http://www.cppblog.com/ngaut/archive/2006/12/18/16577.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Mon, 18 Dec 2006 05:22:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2006/12/18/16577.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/16577.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2006/12/18/16577.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/16577.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/16577.html</trackback:ping><description><![CDATA[
		<p>成功法则：<br />付出终有收获，一点小的付出会带来更多的收获.</p>
		<p> </p>
		<p>我们的学生到底为什么不行，缺乏好的老师，还是努力不够。<br />应该缺乏的是信心和思考，而不是被动的接受。<br /><br /><br />陈安之：<br />当你成为行业第一的时候，金钱和荣誉挡都挡不住。<br /><br /><br /><br /><a href="http://112339223.qzone.qq.com/">思想有多远，我们就能走多远，其实是要个前提的：尽力不停的走</a></p>
<img src ="http://www.cppblog.com/ngaut/aggbug/16577.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2006-12-18 13:22 <a href="http://www.cppblog.com/ngaut/archive/2006/12/18/16577.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一点感悟：在一个项目尚未完成时不宜调走项目组成员</title><link>http://www.cppblog.com/ngaut/archive/2006/11/16/15204.html</link><dc:creator>ngaut</dc:creator><author>ngaut</author><pubDate>Thu, 16 Nov 2006 02:28:00 GMT</pubDate><guid>http://www.cppblog.com/ngaut/archive/2006/11/16/15204.html</guid><wfw:comment>http://www.cppblog.com/ngaut/comments/15204.html</wfw:comment><comments>http://www.cppblog.com/ngaut/archive/2006/11/16/15204.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ngaut/comments/commentRss/15204.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ngaut/services/trackbacks/15204.html</trackback:ping><description><![CDATA[当其它成员接受被调走组员的工作的时候，往往有大量的疑问需要请教已经调走的组员，通常因为问得太多导致被调走的组员有较多意见，而接手的组员也因为疑问太多有较多已经，特别是当负责模块差别较大的时候。<img src ="http://www.cppblog.com/ngaut/aggbug/15204.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ngaut/" target="_blank">ngaut</a> 2006-11-16 10:28 <a href="http://www.cppblog.com/ngaut/archive/2006/11/16/15204.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>