﻿<?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++博客-fengyue</title><link>http://www.cppblog.com/fengyue/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 14 Apr 2026 23:10:07 GMT</lastBuildDate><pubDate>Tue, 14 Apr 2026 23:10:07 GMT</pubDate><ttl>60</ttl><item><title>tomcat使用jdk1.6启动项目的报错</title><link>http://www.cppblog.com/fengyue/archive/2012/09/29/192440.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Sat, 29 Sep 2012 12:25:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2012/09/29/192440.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/192440.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2012/09/29/192440.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/192440.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/192440.html</trackback:ping><description><![CDATA[<p>2011-07-15 12:50 java.lang.ClassFormatError: Illegal class name "[L[Ljava/lang/String;;" in class file根据网上资料看<a href="http://fm928.blog.163.com/blog/static/748135201123115355946/">http://fm928.blog.163.com/blog/static/748135201123115355946/</a></p>
<p>在java服务（tomcat）启动时 增加参数增加参数-Xverify:none</p>
<p>catalina.bat最后<br />%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS%&nbsp; -Xverify:none&nbsp;&nbsp;&nbsp; %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%</p>
<p>就好了。应为jdk bug<br /></p><img src ="http://www.cppblog.com/fengyue/aggbug/192440.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2012-09-29 20:25 <a href="http://www.cppblog.com/fengyue/archive/2012/09/29/192440.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重温一下黄日华的风采</title><link>http://www.cppblog.com/fengyue/archive/2012/09/09/190027.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Sun, 09 Sep 2012 05:07:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2012/09/09/190027.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/190027.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2012/09/09/190027.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/190027.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/190027.html</trackback:ping><description><![CDATA[江湖浪子是由李鼎伦导演拍摄的电视剧。描写「江湖浪子」易水寒（黄日华），生性疏懒，刁钻古惑，不好武功实学，终日只顾招摇撞骗，投机取巧。无意间被牵涉入一宗江湖纠纷里，更被迫学成绝世武功，而误打误撞下更成为多派武学掌门人，令他苦恼不已。 其人又极重义气，尤好打不平，对女性更是无微不至，因此惹下无数孽缘。江湖浪子介绍如下：<br /><a href="http://baike.soso.com/v10518244.htm?ch=ch.bk.uc.mlink">http://baike.soso.com/v10518244.htm?ch=ch.bk.uc.mlink</a><img src ="http://www.cppblog.com/fengyue/aggbug/190027.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2012-09-09 13:07 <a href="http://www.cppblog.com/fengyue/archive/2012/09/09/190027.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何优化网站内部链接</title><link>http://www.cppblog.com/fengyue/archive/2012/09/09/190024.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Sun, 09 Sep 2012 04:15:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2012/09/09/190024.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/190024.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2012/09/09/190024.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/190024.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/190024.html</trackback:ping><description><![CDATA[<span style="font-family: Lucida Console">
<p>网站的内部链接也叫站内链接，它与网站的外部链接刚好相反，网站的内部链接的意思是在同一个网站域名下文章页面、频道页面、首页、Tag等相互之间的链接，这种做法我们也叫它为站内优化，当然这只是站内优化的一部分。v9527影视（<a href="http://www.v9527.com/">http://www.v9527.com/</a>）站长来说说怎么样优化网站内部链接。</p>
<p>　　一、如何做好网站内部链接</p>
<p>　　做得好的网站的内部链接是像一张蜘蛛网一样的，蜘蛛怎么爬都是畅通无阻的，不会出现那种走到某一个页面没有路的情况。网站的内部链接在文章内最好是以锚文本的方式表现，这样不仅引导蜘蛛爬行，还有利于提高网站权重。</p>
<p>　　网站内部链接主要实现方式：</p>
<p>　　1、导航：网站的栏目导航应该按照重要度来进行排序。重点要推的栏目链接放置在靠前面。</p>
<p>　　2、相似文章、TAG标签等： 在文章内容页列出与其相关的文章、热门的文章、推荐的文章、随机的文章、</p>
<p>　　3、面包屑：面包屑是最常见的内链方式，它能够很清楚的表达当前页面的级别。</p>
<p>　　二、网站内部链接的作用</p>
<p>　　1、加快收录</p>
<p>　　利用网站内部链接来引导蜘蛛爬行到那些没有被收录的页面，这样可以提高文章的收录速度.</p>
<p>　　2、增加pv值</p>
<p>　　我们在每一个文章页面都设置相关阅读内容的模板，这样用户进来网站之后，不需要再去使用搜索引擎搜索内容，而是用我们的相关内容来引导用户点击，从而增加网站PV值，提高网站质量。</p>
<p>　　三、网站内部链接给网站带来的好处</p>
<p>　　网站的内部链接搭建得好的话，能够传递每一个页面的权重，而且当你的网站文章页面够多时，某个页面获得内部链接越多的，PR值会相对高一点，而且排名往往也是比较好的。</p>
<p>　　一些大型平台的收录量都是比较多的，而且网站时间比较久，文章质量很好的，网站内部链接也做得够好，这就造成了现在一些大型平台的长尾词做得很好，如站长类网站：seowhy\A5\落伍者等。</p>
<p>　　所以站内优化，其实有一部分工作就是在优化网站的内部链接。因此我们在站内的上花的时间可能有时间比站外还要更多，绝不是一些人所说的那样：&#8220;seo就是发外链&#8221;。<a href="http://www.v9527.com/">http://www.v9527.com/</a></p>
</span><img src ="http://www.cppblog.com/fengyue/aggbug/190024.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2012-09-09 12:15 <a href="http://www.cppblog.com/fengyue/archive/2012/09/09/190024.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>推荐一个视频网站</title><link>http://www.cppblog.com/fengyue/archive/2012/08/18/187597.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Sat, 18 Aug 2012 07:02:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2012/08/18/187597.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/187597.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2012/08/18/187597.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/187597.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/187597.html</trackback:ping><description><![CDATA[最近发现一个网站不错，在这里能搜索很多电影网站的高清电影，不用记住多个视频网站网址，也不用播放器就可以看。在这里给大家共享一下：<br /><a href="http://www.v9527.com">http://www.v9527.com</a><img src ="http://www.cppblog.com/fengyue/aggbug/187597.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2012-08-18 15:02 <a href="http://www.cppblog.com/fengyue/archive/2012/08/18/187597.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何动态加载ActiveX控件</title><link>http://www.cppblog.com/fengyue/archive/2011/11/30/161206.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Wed, 30 Nov 2011 00:51:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2011/11/30/161206.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/161206.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2011/11/30/161206.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/161206.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/161206.html</trackback:ping><description><![CDATA[<p>我们的开发平台需要用第三方控件（ActiveX）时，一般采用的方法是，先在VC中的插入控件，VC会自动生成操作控件的类，然后创建一个控件，并处理对应的事件。如果控件接口变化，更新控件，需要重复操作且编译才能发布，比较麻烦。显然，动态加载ActiveX控件能解决这个问题。如果做过页面编程就会知道，页面脚本里边可以动态创建控件的。我们的开发平台是否也能动态创建控件呢，答案是肯定的。下面介绍一下如何动态加载ActiveX控件:<br />1.首先是获取到控件的GUID，可以通过配置。<br />2.获取控件的方法、事件等属性，方便后面的事件处理<br />3.采用CWnd::CreateControl创建控件实例，如果是通过脚本调用控件接口，可以将该控件添加到脚本引擎。<br />&nbsp;&nbsp; CreateControl原型如下：</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"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #000000">&nbsp;&nbsp;&nbsp;BOOL&nbsp;CreateControl(&nbsp;REFCLSID&nbsp;clsid,&nbsp;LPCTSTR&nbsp;pszWindowName,&nbsp;DWORD&nbsp;dwStyle,<br /><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">const</span><span style="color: #000000">&nbsp;POINT</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;ppt,&nbsp;</span><span style="color: #0000ff">const</span><span style="color: #000000">&nbsp;SIZE</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;psize,&nbsp;CWnd</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;pParentWnd,&nbsp;UINT&nbsp;nID,<br /><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />&nbsp;&nbsp;&nbsp;CFile</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;pPersist&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;NULL,&nbsp;BOOL&nbsp;bStorage&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;FALSE,&nbsp;BSTR&nbsp;bstrLicKey&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;NULL&nbsp;);<br /><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span></div>
<p>4.处理控件触发的事件<br />&nbsp;&nbsp; 重载父窗体的OnCmdMsg函数，处理对应的事件即可，OnCmdMsg原型如下：</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"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">virtual</span><span style="color: #000000">&nbsp;BOOL&nbsp;OnCmdMsg(UINT&nbsp;nID,&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;nCode,&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;pExtra,<br /><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />&nbsp;&nbsp;AFX_CMDHANDLERINFO</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;pHandlerInfo);<br /><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span></div>
<p>&nbsp;</p><img src ="http://www.cppblog.com/fengyue/aggbug/161206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2011-11-30 08:51 <a href="http://www.cppblog.com/fengyue/archive/2011/11/30/161206.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>memcached应用随笔</title><link>http://www.cppblog.com/fengyue/archive/2011/11/24/160897.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Thu, 24 Nov 2011 06:07:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2011/11/24/160897.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/160897.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2011/11/24/160897.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/160897.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/160897.html</trackback:ping><description><![CDATA[<div>Memcached 是一个高性能的分布式内存对象缓存系统，用于动态Web应用以减轻数据库负载。相信大家对它并不陌生，下面把我最近开发的项目中用到的一个例子分享出来，给大家一起学习。在访问memcached时，通过synchronized实现同步。在需要操作memcached的地方可以很方便地通过类CacheFactory进行。废话少说，直接贴上代码。
<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"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">&nbsp;1</span><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;org.apache.log4j.BasicConfigurator;<br /></span><span style="color: #008080">&nbsp;2</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;org.apache.log4j.Logger;<br /></span><span style="color: #008080">&nbsp;3</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top"  alt="" /><br /></span><span style="color: #008080">&nbsp;4</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;5</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;com.danga.MemCached.MemCachedClient;<br /></span><span style="color: #008080">&nbsp;6</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;com.danga.MemCached.SockIOPool;<br /></span><span style="color: #008080">&nbsp;7</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top"  alt="" /><br /></span><span style="color: #008080">&nbsp;8</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top"  alt="" /><br /></span><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img id="Codehighlighter1_162_228_Open_Image" onclick="this.style.display='none'; Codehighlighter1_162_228_Open_Text.style.display='none'; Codehighlighter1_162_228_Closed_Image.style.display='inline'; Codehighlighter1_162_228_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"><img id="Codehighlighter1_162_228_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_162_228_Closed_Text.style.display='none'; Codehighlighter1_162_228_Open_Image.style.display='inline'; Codehighlighter1_162_228_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top"></span><span id="Codehighlighter1_162_228_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/**&nbsp;*/</span><span id="Codehighlighter1_162_228_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /></span><span style="color: #008080">10</span><span style="color: #008000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;*&nbsp;memcache工厂类<br /></span><span style="color: #008080">11</span><span style="color: #008000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;*&nbsp;<br /></span><span style="color: #008080">12</span><span style="color: #008000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;*&nbsp;</span><span style="color: #808080">@author</span><span style="color: #008000">&nbsp;fengyue<br /></span><span style="color: #008080">13</span><span style="color: #008000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;*&nbsp;@date&nbsp;Feb&nbsp;16,&nbsp;2011<br /></span><span style="color: #008080">14</span><span style="color: #008000"><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />&nbsp;</span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /></span><span style="color: #008080">15</span><span style="color: #000000"><img id="Codehighlighter1_256_1372_Open_Image" onclick="this.style.display='none'; Codehighlighter1_256_1372_Open_Text.style.display='none'; Codehighlighter1_256_1372_Closed_Image.style.display='inline'; Codehighlighter1_256_1372_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"><img id="Codehighlighter1_256_1372_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_256_1372_Closed_Text.style.display='none'; Codehighlighter1_256_1372_Open_Image.style.display='inline'; Codehighlighter1_256_1372_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top"></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;CacheFactory&nbsp;</span><span id="Codehighlighter1_256_1372_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_256_1372_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">16</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #0000ff">private</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">final</span><span style="color: #000000">&nbsp;Logger&nbsp;logger&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;Logger.getLogger(CacheFactory.</span><span style="color: #0000ff">class</span><span style="color: #000000">);<br /></span><span style="color: #008080">17</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #0000ff">private</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;MemCachedClient&nbsp;memcache&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">null</span><span style="color: #000000">;<br /></span><span style="color: #008080">18</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">19</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">20</span><span style="color: #000000"><img id="Codehighlighter1_424_546_Open_Image" onclick="this.style.display='none'; Codehighlighter1_424_546_Open_Text.style.display='none'; Codehighlighter1_424_546_Closed_Image.style.display='inline'; Codehighlighter1_424_546_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_424_546_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_424_546_Closed_Text.style.display='none'; Codehighlighter1_424_546_Open_Image.style.display='inline'; Codehighlighter1_424_546_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top"></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;MemCachedClient&nbsp;getCache()&nbsp;</span><span id="Codehighlighter1_424_546_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_424_546_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">21</span><span style="color: #000000"><img id="Codehighlighter1_448_525_Open_Image" onclick="this.style.display='none'; Codehighlighter1_448_525_Open_Text.style.display='none'; Codehighlighter1_448_525_Closed_Image.style.display='inline'; Codehighlighter1_448_525_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_448_525_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_448_525_Closed_Text.style.display='none'; Codehighlighter1_448_525_Open_Image.style.display='inline'; Codehighlighter1_448_525_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top"></span><span style="color: #0000ff">if</span><span style="color: #000000">&nbsp;(memcache&nbsp;</span><span style="color: #000000">==</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">null</span><span style="color: #000000">)&nbsp;</span><span id="Codehighlighter1_448_525_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_448_525_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">22</span><span style="color: #000000"><img id="Codehighlighter1_484_523_Open_Image" onclick="this.style.display='none'; Codehighlighter1_484_523_Open_Text.style.display='none'; Codehighlighter1_484_523_Closed_Image.style.display='inline'; Codehighlighter1_484_523_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_484_523_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_484_523_Closed_Text.style.display='none'; Codehighlighter1_484_523_Open_Image.style.display='inline'; Codehighlighter1_484_523_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top"></span><span style="color: #0000ff">synchronized</span><span style="color: #000000">&nbsp;(CacheFactory.</span><span style="color: #0000ff">class</span><span style="color: #000000">)&nbsp;</span><span id="Codehighlighter1_484_523_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_484_523_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">23</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #0000ff">if</span><span style="color: #000000">&nbsp;(memcache&nbsp;</span><span style="color: #000000">==</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">null</span><span style="color: #000000">)<br /></span><span style="color: #008080">24</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />getInstance();<br /></span><span style="color: #008080">25</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">26</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">27</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">28</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">29</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;memcache;<br /></span><span style="color: #008080">30</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">31</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">32</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">33</span><span style="color: #000000"><img id="Codehighlighter1_584_1119_Open_Image" onclick="this.style.display='none'; Codehighlighter1_584_1119_Open_Text.style.display='none'; Codehighlighter1_584_1119_Closed_Image.style.display='inline'; Codehighlighter1_584_1119_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_584_1119_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_584_1119_Closed_Text.style.display='none'; Codehighlighter1_584_1119_Open_Image.style.display='inline'; Codehighlighter1_584_1119_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top"></span><span style="color: #0000ff">private</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;getInstance()&nbsp;</span><span id="Codehighlighter1_584_1119_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_584_1119_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">34</span><span style="color: #000000"><img id="Codehighlighter1_590_1028_Open_Image" onclick="this.style.display='none'; Codehighlighter1_590_1028_Open_Text.style.display='none'; Codehighlighter1_590_1028_Closed_Image.style.display='inline'; Codehighlighter1_590_1028_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_590_1028_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_590_1028_Closed_Text.style.display='none'; Codehighlighter1_590_1028_Open_Image.style.display='inline'; Codehighlighter1_590_1028_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top"></span><span style="color: #0000ff">try</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_590_1028_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_590_1028_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">35</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />BasicConfigurator.configure();<br /></span><span style="color: #008080">36</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />String&nbsp;serverI&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">10.185.23.17:13000</span><span style="color: #000000">"</span><span style="color: #000000">;<br /></span><span style="color: #008080">37</span><span style="color: #000000"><img id="Codehighlighter1_681_691_Open_Image" onclick="this.style.display='none'; Codehighlighter1_681_691_Open_Text.style.display='none'; Codehighlighter1_681_691_Closed_Image.style.display='inline'; Codehighlighter1_681_691_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_681_691_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_681_691_Closed_Text.style.display='none'; Codehighlighter1_681_691_Open_Image.style.display='inline'; Codehighlighter1_681_691_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">String[]&nbsp;servers&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_681_691_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_681_691_Open_Text"><span style="color: #000000">{&nbsp;serverI&nbsp;}</span></span><span style="color: #000000">;<br /></span><span style="color: #008080">38</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />SockIOPool&nbsp;pool&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;SockIOPool.getInstance();<br /></span><span style="color: #008080">39</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.setServers(servers);<br /></span><span style="color: #008080">40</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.setFailover(</span><span style="color: #0000ff">true</span><span style="color: #000000">);<br /></span><span style="color: #008080">41</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.setInitConn(</span><span style="color: #000000">10</span><span style="color: #000000">);<br /></span><span style="color: #008080">42</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.setMinConn(</span><span style="color: #000000">5</span><span style="color: #000000">);<br /></span><span style="color: #008080">43</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.setMaxConn(</span><span style="color: #000000">250</span><span style="color: #000000">);<br /></span><span style="color: #008080">44</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.setMaintSleep(</span><span style="color: #000000">30</span><span style="color: #000000">);<br /></span><span style="color: #008080">45</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.setNagle(</span><span style="color: #0000ff">false</span><span style="color: #000000">);<br /></span><span style="color: #008080">46</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.setSocketTO(</span><span style="color: #000000">3000</span><span style="color: #000000">);<br /></span><span style="color: #008080">47</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">48</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">49</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />pool.initialize();<br /></span><span style="color: #008080">50</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />memcache&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">new</span><span style="color: #000000">&nbsp;MemCachedClient();<br /></span><span style="color: #008080">51</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />memcache.add(</span><span style="color: #000000">"</span><span style="color: #000000">test</span><span style="color: #000000">"</span><span style="color: #000000">,&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">test1111111111111111111</span><span style="color: #000000">"</span><span style="color: #000000">);<br /></span><span style="color: #008080">52</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">53</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">54</span><span style="color: #000000"><img id="Codehighlighter1_1050_1117_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1050_1117_Open_Text.style.display='none'; Codehighlighter1_1050_1117_Closed_Image.style.display='inline'; Codehighlighter1_1050_1117_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1050_1117_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1050_1117_Closed_Text.style.display='none'; Codehighlighter1_1050_1117_Open_Image.style.display='inline'; Codehighlighter1_1050_1117_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(Exception&nbsp;e)&nbsp;</span><span id="Codehighlighter1_1050_1117_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1050_1117_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">55</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />logger.debug(</span><span style="color: #000000">"</span><span style="color: #000000">failed&nbsp;to&nbsp;init&nbsp;memcache<img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span style="color: #000000">"</span><span style="color: #000000">);<br /></span><span style="color: #008080">56</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />e.printStackTrace();<br /></span><span style="color: #008080">57</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">58</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">59</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">60</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">61</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">62</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080">63</span><span style="color: #000000"><img id="Codehighlighter1_1165_1370_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1165_1370_Open_Text.style.display='none'; Codehighlighter1_1165_1370_Closed_Image.style.display='inline'; Codehighlighter1_1165_1370_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1165_1370_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1165_1370_Closed_Text.style.display='none'; Codehighlighter1_1165_1370_Open_Image.style.display='inline'; Codehighlighter1_1165_1370_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top"></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;main(String[]&nbsp;argvs)&nbsp;</span><span id="Codehighlighter1_1165_1370_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1165_1370_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">64</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #008000">//</span><span style="color: #008000">往memcache存入缓存值</span><span style="color: #008000"><br /></span><span style="color: #008080">65</span><span style="color: #008000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">CacheFactory.getCache().set(</span><span style="color: #000000">"</span><span style="color: #000000">myloginkey&#8220;,&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">1</span><span style="color: #000000">"</span><span style="color: #000000">,&nbsp;new&nbsp;Date(3&nbsp;*&nbsp;60&nbsp;*&nbsp;60&nbsp;*&nbsp;1000));</span><span style="color: #000000"><br /></span><span style="color: #008080">66</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #008000">//</span><span style="color: #008000">取出值</span><span style="color: #008000"><br /></span><span style="color: #008080">67</span><span style="color: #008000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">CacheFactory.getCache().get(</span><span style="color: #000000">"</span><span style="color: #000000">myloginkey</span><span style="color: #000000">"</span><span style="color: #000000">);<br /></span><span style="color: #008080">68</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #008000">//</span><span style="color: #008000">删除</span><span style="color: #008000"><br /></span><span style="color: #008080">69</span><span style="color: #008000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">CacheFactory.getCache().delete(</span><span style="color: #000000">"</span><span style="color: #000000">myloginkey</span><span style="color: #000000">"</span><span style="color: #000000">);<br /></span><span style="color: #008080">70</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #0000ff">return</span><span style="color: #000000">;<br /></span><span style="color: #008080">71</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">72</span><span style="color: #000000"><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />}</span></span></div><br /></div><img src ="http://www.cppblog.com/fengyue/aggbug/160897.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2011-11-24 14:07 <a href="http://www.cppblog.com/fengyue/archive/2011/11/24/160897.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CString不是线程安全的</title><link>http://www.cppblog.com/fengyue/archive/2011/11/24/160878.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Thu, 24 Nov 2011 02:58:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2011/11/24/160878.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/160878.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2011/11/24/160878.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/160878.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/160878.html</trackback:ping><description><![CDATA[我们用MFC开发时经常会用到CString类，无可否认，CString类是很好用，但很少人注意到CString类不是线程安全的。一般地，界面编程都是在主线程，很少用到多线程，所以不会遇到什么问题。但是，当我们多个线程同时操作同一个CString类型变量时，就可能会出现内存地址错误，最终导致进程异常退出。内存错误导致的问题也很难调查，通常导致内存错误的地方没有马上报异常，而且在程序的其他地方才捕获异常。<br />CString类的Debug版本和Release版本不完全一样，Debug版本则直接分配（MFC在Debug版本有内存管理，主要是为了排错，内存泄漏等），CString类在Release版本会使用定长内存管理（CFixedAlloc类），主要管理是4个长度的内存，如下： 
<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"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">1</span><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #000000">AFX_STATIC&nbsp;CFixedAlloc&nbsp;_afxAlloc64(ROUND4(</span><span style="color: #000000">65</span><span style="color: #000000">*</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(TCHAR)</span><span style="color: #000000">+</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(CStringData)));<br /></span><span style="color: #008080">2</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />AFX_STATIC&nbsp;CFixedAlloc&nbsp;_afxAlloc128(ROUND4(</span><span style="color: #000000">129</span><span style="color: #000000">*</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(TCHAR)</span><span style="color: #000000">+</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(CStringData)));<br /></span><span style="color: #008080">3</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />AFX_STATIC&nbsp;CFixedAlloc&nbsp;_afxAlloc256(ROUND4(</span><span style="color: #000000">257</span><span style="color: #000000">*</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(TCHAR)</span><span style="color: #000000">+</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(CStringData)));<br /></span><span style="color: #008080">4</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />AFX_STATIC&nbsp;CFixedAlloc&nbsp;_afxAlloc512(ROUND4(</span><span style="color: #000000">513</span><span style="color: #000000">*</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(TCHAR)</span><span style="color: #000000">+</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(CStringData)));</span></div>这样做应该是防止内存碎片和提高效率，由于CString类都会重用分配的定长内存，所以一般异常的地方大多数也是在CString操作的地方。有兴趣可以看看CString类的实现。<br />避免这样的问题最简单的办法就是加锁或者不用CString类。加锁用临界区就可以，实现比较简单，在这里不多说。<br /><br /><img src ="http://www.cppblog.com/fengyue/aggbug/160878.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2011-11-24 10:58 <a href="http://www.cppblog.com/fengyue/archive/2011/11/24/160878.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>OGRE资源管理分析</title><link>http://www.cppblog.com/fengyue/archive/2011/11/23/160783.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Wed, 23 Nov 2011 03:07:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2011/11/23/160783.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/160783.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2011/11/23/160783.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/160783.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/160783.html</trackback:ping><description><![CDATA[<div>OGRE的文件系统比较复杂，不熟悉的人不知道怎么使用，经常出现找不到资源的问题，在这里简单介绍一下资源路径的设置：<br />资源路径可以通过程序设置也可以通过配置方式:<br /><strong>配置方式<br /></strong>resources.cfg就是用来配置资源的路径的，内容如下：<br /># Resource locations to be added to the 'boostrap' path<br /># This also contains the minimum you need to use the Ogre example framework<br />[Bootstrap]<br />Zip=../../Media/packs/OgreCore.zip 
<p># Resource locations to be added to the default path<br />[General]<br />FileSystem=../../Media<br />FileSystem=../../Media/fonts<br />FileSystem=../../Media/materials/programs<br />FileSystem=../../Media/materials/scripts<br />FileSystem=../../Media/materials/textures<br />FileSystem=../../Media/models<br />FileSystem=../../Media/overlays<br />FileSystem=../../Media/particle<br />FileSystem=../../Media/gui<br />FileSystem=../../Media/DeferredShadingMedia<br />Zip=../../Media/packs/cubemap.zip<br />Zip=../../Media/packs/cubemapsJS.zip<br />Zip=../../Media/packs/dragon.zip<br />Zip=../../Media/packs/fresneldemo.zip<br />Zip=../../Media/packs/ogretestmap.zip<br />Zip=../../Media/packs/skybox.zip<br /><br />Bootstrap、General就是资源组名称，FileSystem、Zip就是文件系统类型，表示压缩包还是文件系统。一般我们开发时都是使用文件系统，所以配置对应的路径就可以。OGRE是支持Zip压缩包的，如果要实现自己的压缩包需要实现对应的Archive的子类，实现对应接口就可以。可以参考ZipArchive、ZipArchiveFactory、ZipDataStream实现。<br /><br /><strong>程序方式<br /></strong>其实配置方式最终也是调用程序来设置的，resources.cfg只是指定了ResourceGroupManager::getSingleton().addResourceLocation的参数。<br />看下面的函数就很清楚了，就是读取resources.cfg，将配置的路径都添加到资源管理，设置完资源组路径，调用ResourceGroupManager::getSingleton().initialiseAllResourceGroups()初始化就可以，后续就可以直接加载资源，很简单吧。</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"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">&nbsp;1</span><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: #000000">&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">virtual</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;setupResources(</span><span style="color: #0000ff">void</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;2</span><span style="color: #000000"><img id="Codehighlighter1_41_1293_Open_Image" onclick="this.style.display='none'; Codehighlighter1_41_1293_Open_Text.style.display='none'; Codehighlighter1_41_1293_Closed_Image.style.display='inline'; Codehighlighter1_41_1293_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"><img id="Codehighlighter1_41_1293_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_41_1293_Closed_Text.style.display='none'; Codehighlighter1_41_1293_Open_Image.style.display='inline'; Codehighlighter1_41_1293_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_41_1293_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.cppblog.com/Images/dot.gif" /></span><span id="Codehighlighter1_41_1293_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;3</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;Load&nbsp;resource&nbsp;paths&nbsp;from&nbsp;config&nbsp;file</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;4</span><span style="color: #008000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ConfigFile&nbsp;cf;<br /></span><span style="color: #008080">&nbsp;5</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cf.load(mResourcePath&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">resources.cfg</span><span style="color: #000000">"</span><span style="color: #000000">);<br /></span><span style="color: #008080">&nbsp;6</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="color: #008080">&nbsp;7</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;Go&nbsp;through&nbsp;all&nbsp;sections&nbsp;&amp;&nbsp;settings&nbsp;in&nbsp;the&nbsp;file</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;8</span><span style="color: #008000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ConfigFile::SectionIterator&nbsp;seci&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;cf.getSectionIterator();<br /></span><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="color: #008080">10</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;secName,&nbsp;typeName,&nbsp;archName;<br /></span><span style="color: #008080">11</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">while</span><span style="color: #000000">&nbsp;(seci.hasMoreElements())<br /></span><span style="color: #008080">12</span><span style="color: #000000"><img id="Codehighlighter1_383_1287_Open_Image" onclick="this.style.display='none'; Codehighlighter1_383_1287_Open_Text.style.display='none'; Codehighlighter1_383_1287_Closed_Image.style.display='inline'; Codehighlighter1_383_1287_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_383_1287_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_383_1287_Closed_Text.style.display='none'; Codehighlighter1_383_1287_Open_Image.style.display='inline'; Codehighlighter1_383_1287_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_383_1287_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.cppblog.com/Images/dot.gif" /></span><span id="Codehighlighter1_383_1287_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">13</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;secName&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;seci.peekNextKey();<br /></span><span style="color: #008080">14</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ConfigFile::SettingsMultiMap&nbsp;</span><span style="color: #000000">*</span><span style="color: #000000">settings&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;seci.getNext();<br /></span><span style="color: #008080">15</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ConfigFile::SettingsMultiMap::iterator&nbsp;i;<br /></span><span style="color: #008080">16</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">&nbsp;(i&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;settings</span><span style="color: #000000">-&gt;</span><span style="color: #000000">begin();&nbsp;i&nbsp;</span><span style="color: #000000">!=</span><span style="color: #000000">&nbsp;settings</span><span style="color: #000000">-&gt;</span><span style="color: #000000">end();&nbsp;</span><span style="color: #000000">++</span><span style="color: #000000">i)<br /></span><span style="color: #008080">17</span><span style="color: #000000"><img id="Codehighlighter1_629_1277_Open_Image" onclick="this.style.display='none'; Codehighlighter1_629_1277_Open_Text.style.display='none'; Codehighlighter1_629_1277_Closed_Image.style.display='inline'; Codehighlighter1_629_1277_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_629_1277_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_629_1277_Closed_Text.style.display='none'; Codehighlighter1_629_1277_Open_Image.style.display='inline'; Codehighlighter1_629_1277_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_629_1277_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.cppblog.com/Images/dot.gif" /></span><span id="Codehighlighter1_629_1277_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">18</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typeName&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;i</span><span style="color: #000000">-&gt;</span><span style="color: #000000">first;<br /></span><span style="color: #008080">19</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;archName&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;i</span><span style="color: #000000">-&gt;</span><span style="color: #000000">second;<br /></span><span style="color: #008080">20</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #0000ff">#if</span><span style="color: #000000">&nbsp;OGRE_PLATFORM&nbsp;==&nbsp;OGRE_PLATFORM_APPLE</span><span style="color: #000000"><br /></span><span style="color: #008080">21</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;OS&nbsp;X&nbsp;does&nbsp;not&nbsp;set&nbsp;the&nbsp;working&nbsp;directory&nbsp;relative&nbsp;to&nbsp;the&nbsp;app,<br /></span><span style="color: #008080">22</span><span style="color: #008000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;In&nbsp;order&nbsp;to&nbsp;make&nbsp;things&nbsp;portable&nbsp;on&nbsp;OS&nbsp;X&nbsp;we&nbsp;need&nbsp;to&nbsp;provide<br /></span><span style="color: #008080">23</span><span style="color: #008000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;the&nbsp;loading&nbsp;with&nbsp;it's&nbsp;own&nbsp;bundle&nbsp;path&nbsp;location</span><span style="color: #008000"><br /></span><span style="color: #008080">24</span><span style="color: #008000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ResourceGroupManager::getSingleton().addResourceLocation(<br /></span><span style="color: #008080">25</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String(macBundlePath()&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">/</span><span style="color: #000000">"</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;archName),&nbsp;typeName,&nbsp;secName);<br /></span><span style="color: #008080">26</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #0000ff">#else</span><span style="color: #000000"><br /></span><span style="color: #008080">27</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ResourceGroupManager::getSingleton().addResourceLocation(<br /></span><span style="color: #008080">28</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;archName,&nbsp;typeName,&nbsp;secName);<br /></span><span style="color: #008080">29</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #0000ff">#endif</span><span style="color: #000000"><br /></span><span style="color: #008080">30</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">31</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">32</span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><img alt="" src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span></div>
<p><br />&nbsp;</p></div><img src ="http://www.cppblog.com/fengyue/aggbug/160783.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2011-11-23 11:07 <a href="http://www.cppblog.com/fengyue/archive/2011/11/23/160783.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用RenderMonkey进行shader开发</title><link>http://www.cppblog.com/fengyue/archive/2011/10/11/158020.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Tue, 11 Oct 2011 02:56:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2011/10/11/158020.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/158020.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2011/10/11/158020.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/158020.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/158020.html</trackback:ping><description><![CDATA[<div>&nbsp;&nbsp;&nbsp; 以前学习shader都是看书，比较难上手，最近发现要专心学习shader还是用RenderMonkey这样的工具(ATI开发的)，学习其中的shader例子就学会了自然就学会了shader编程。RenderMonkey能检查语法和预览，非常方便。不用自己写渲染程序进行预览，省很多力气。<br />&nbsp;&nbsp;&nbsp; RenderMoney用法很简单，界面类似VC，看到就会用的，不详细说明。<br />&nbsp;&nbsp;&nbsp; 目前最新的RenderMonkey版本为1.82，下载链接如下：<br />&nbsp;&nbsp;&nbsp; <a href="http://developer.amd.com/archive/gpu/rendermonkey/pages/default.aspx">http://developer.amd.com/archive/gpu/rendermonkey/pages/default.aspx</a><br />&nbsp;&nbsp;&nbsp; 安装非常简单，不断Next就可以。</div><img src ="http://www.cppblog.com/fengyue/aggbug/158020.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2011-10-11 10:56 <a href="http://www.cppblog.com/fengyue/archive/2011/10/11/158020.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>番茄鸡蛋是个好东西！！！</title><link>http://www.cppblog.com/fengyue/archive/2011/08/30/154706.html</link><dc:creator>风悦</dc:creator><author>风悦</author><pubDate>Tue, 30 Aug 2011 07:13:00 GMT</pubDate><guid>http://www.cppblog.com/fengyue/archive/2011/08/30/154706.html</guid><wfw:comment>http://www.cppblog.com/fengyue/comments/154706.html</wfw:comment><comments>http://www.cppblog.com/fengyue/archive/2011/08/30/154706.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/fengyue/comments/commentRss/154706.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/fengyue/services/trackbacks/154706.html</trackback:ping><description><![CDATA[<p><span style="color: #0000ff">&nbsp;&nbsp;&nbsp; 这几天牙痛，不知道是什么原因，感觉是碰伤过，好像又不是。吃饭碰到牙齿就痛，喝了几天粥。牙痛不是病，痛起来要命。昨天买了消炎药，看到说明书的副作用，不敢吃。今天中午去饭堂吃饭，本来打算喝粥的，但是想起昨天下午没下班肚子就咕咕叫。还是到二楼吃饭，选了比较软的菜，茄子番茄和水蛋。吃的时候，碰到牙齿，还是很痛。吃完了菜，饭几乎没动过。吃完饭回到公司，休息一下。也没怎么睡着，下午上班，感觉用手按牙齿也不痛了，真神奇。网上搜索一下看看是什么原因。<br /></span><span style="color: #0000ff">&nbsp;&nbsp;&nbsp; 将自己今天吃的东西搜索了一下：<br /></span><span style="color: #0000ff">&nbsp;&nbsp;&nbsp; 鸡蛋：口腔疾病指的是</span><span style="color: #ff0000">牙龈肿痛、牙周炎</span><span style="color: #0000ff">、慢性咽炎、溃疡性口疮、口腔溃疡等常见病。虽说不是大病，但也时时折磨人，孰不知身边的鸡蛋就可帮你解除痛苦。<br /></span><span style="color: #0000ff">&nbsp;&nbsp;&nbsp; 番茄：防止小儿佝偻病、夜盲症、眼干燥症。富含维生素A，能促进骨骼钙化，</span><span style="color: #ff0000">对牙齿组织的形成起重要作用，牙根炎、牙病</span><span style="color: #0000ff">、流鼻血和患出血性疾病的病人多吃番茄，有助于治疗。<br /></span><span style="color: #0000ff">&nbsp;&nbsp;&nbsp; 不知道是那个起作用，鸡蛋也有可能是人造蛋，因为昨天我也吃了鸡蛋，没感觉好转。我想估计是番茄起作用。<br />&nbsp;&nbsp;&nbsp;&nbsp;是药三分毒，能通过食物治疗治病，既无副作用，又省钱，何乐而不为？<br />&nbsp;&nbsp;&nbsp; 这是我真正的体会，希望对大家有帮助。</span></p><img src ="http://www.cppblog.com/fengyue/aggbug/154706.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/fengyue/" target="_blank">风悦</a> 2011-08-30 15:13 <a href="http://www.cppblog.com/fengyue/archive/2011/08/30/154706.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>