﻿<?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++博客-East's Blog</title><link>http://www.cppblog.com/eastsong/</link><description>At first, you may struggle to understand how to do each pratice. They may look easy on paper, but putting some practices into action may be difficult. Keep practicing until they're easy.</description><language>zh-cn</language><lastBuildDate>Tue, 07 Apr 2026 05:44:11 GMT</lastBuildDate><pubDate>Tue, 07 Apr 2026 05:44:11 GMT</pubDate><ttl>60</ttl><item><title>DriveBrowsing</title><link>http://www.cppblog.com/eastsong/archive/2008/12/22/70018.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Sun, 21 Dec 2008 16:21:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/12/22/70018.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/70018.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/12/22/70018.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/70018.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/70018.html</trackback:ping><description><![CDATA[CImageList:可以用于给TreeCtrl节点添加Icon<div><div><span class="Apple-tab-span" style="white-space:pre">	</span>创建ImageList 16 * 16的， 8色，初始化为9个，增长频率是9<br></div><div><span class="Apple-tab-span" style="white-space:pre">	</span>m_pImageList.Create(16, 16, ILC_COLOR8 | ILC_MASK, &#160;9, 9);</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>向ImageList中添加Icon<br></div><div><span class="Apple-tab-span" style="white-space:pre">	</span>m_pImageList.Add(pApp->LoadIcon(ICO_CDDRV));<br></div><div><span class="Apple-tab-span" style="white-space:pre">	</span>m_pImageList.Add(pApp->LoadIcon(ICO_CLSDFLD));</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>m_pImageList.Add(pApp->LoadIcon(ICO_DRIVE));</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>m_pImageList.Add(pApp->LoadIcon(ICO_FLOPPYDRV));</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>m_pImageList.Add(pApp->LoadIcon(ICO_MYCOMP));</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>m_pImageList.Add(pApp->LoadIcon(ICO_OPENFLD));</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>m_pImageList.Add(pApp->LoadIcon(ICO_TEXTFILE));</div><div>向TreeCtrl添加ImageList</div><div>GetTreeCtrl().SetImageList(&amp;m_pImageList , TVSIL_NORMAL);<br></div><div><h1><a name="fs.getlogicaldrives"></a>GetLogicalDrives Function</h1>
<p>
</p><p>Retrieves a bitmask representing the currently available disk drives.</p>
<p>&#160;</p><pre class="syntax" xml:space="preserve">DWORD WINAPI GetLogicalDrives(void);
</pre><pre class="syntax" xml:space="preserve"><h1><br></h1><h1><a name="fs.getdrivetype"></a>GetDriveType Function</h1><p>&#160;</p><p>Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or 
network drive.</p>
<p>To determine whether a drive is a USB-type drive, call <a href="http://go.microsoft.com/FWLink/?LinkId=94246" target="_blank"><strong>SetupDiGetDeviceRegistryProperty</strong></a> and specify the 
SPDRP_REMOVAL_POLICY property.</p>
<p>&#160;</p><pre class="syntax" xml:space="preserve">UINT WINAPI GetDriveType(
  __in          LPCTSTR <em><a class="synParam" onclick="showTip(this)" href="ms-help://ms.vscc.v90/MS.MSDNQTR.v90.en/fileio/fs/getdrivetype.htm">lpRootPathName</a></em>
);
</pre><pre class="syntax" xml:space="preserve"><br></pre></pre></div></div><img src ="http://www.cppblog.com/eastsong/aggbug/70018.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-12-22 00:21 <a href="http://www.cppblog.com/eastsong/archive/2008/12/22/70018.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MCI</title><link>http://www.cppblog.com/eastsong/archive/2008/12/20/69959.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Sat, 20 Dec 2008 15:43:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/12/20/69959.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/69959.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/12/20/69959.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/69959.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/69959.html</trackback:ping><description><![CDATA[<h1><a name="_win32_mcisendstring"></a>mciSendString</h1>
<p>The <strong>mciSendString</strong> function sends a command string to an MCI device. 
The device that the command is sent to is specified in the command string</p><p>mciSendString("set cdaudio door open",NULL,0,0);<br></p><p>mciSendString("set cdaudio door closed",NULL,0,0);<br></p><p><h1><a name="_win32_mci"></a>MCI</h1>
<p>The Media Control Interface (MCI) provides standard commands for playing 
multimedia devices and recording multimedia resource files. These commands are a 
generic interface to nearly every kind of multimedia device.&#160;</p></p><p><br></p><p><h1>NOTIFYICONDATA Structure &#160;产生类似托盘的效果</h1>
<hr size="1">

<p>Contains information that the system needs to process taskbar status area 
messages.</p></p><img src ="http://www.cppblog.com/eastsong/aggbug/69959.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-12-20 23:43 <a href="http://www.cppblog.com/eastsong/archive/2008/12/20/69959.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>显示系统中所有进程</title><link>http://www.cppblog.com/eastsong/archive/2008/12/20/69952.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Sat, 20 Dec 2008 15:13:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/12/20/69952.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/69952.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/12/20/69952.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/69952.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/69952.html</trackback:ping><description><![CDATA[CreateToolhelp32Snapshot ：对系统中的进程&#8220;拍照&#8221;<div>Takes a snapshot of the specified processes, as well as the heaps, modules, 
and threads used by these processes.<div><p>&#160;</p><pre class="syntax" xml:space="preserve">HANDLE WINAPI CreateToolhelp32Snapshot(
  __in          DWORD <em><a class="synParam" onclick="showTip(this)" href="ms-help://ms.vscc.v90/MS.MSDNQTR.v90.en/dllproc/base/createtoolhelp32snapshot.htm">dwFlags</a></em>,
  __in          DWORD <em><a class="synParam" onclick="showTip(this)" href="ms-help://ms.vscc.v90/MS.MSDNQTR.v90.en/dllproc/base/createtoolhelp32snapshot.htm">th32ProcessID</a></em>
);
</pre><pre class="syntax" xml:space="preserve"><pre class="syntax" xml:space="preserve">Process32First : 枚举第一个进程</pre></pre><pre class="syntax" xml:space="preserve"><p>Retrieves information about the first process encountered in a system 
snapshot.</p>
<p>&#160;</p><pre class="syntax" xml:space="preserve">BOOL WINAPI Process32First(
  __in          HANDLE <em><a class="synParam" onclick="showTip(this)" href="ms-help://ms.vscc.v90/MS.MSDNQTR.v90.en/dllproc/base/process32first.htm">hSnapshot</a></em>,
  __in_out      LPPROCESSENTRY32 <em><a class="synParam" onclick="showTip(this)" href="ms-help://ms.vscc.v90/MS.MSDNQTR.v90.en/dllproc/base/process32first.htm">lppe</a></em>
);
</pre><pre class="syntax" xml:space="preserve"><br></pre><pre class="syntax" xml:space="preserve">Process32Next : 递归枚举随后的进程<br></pre><pre class="syntax" xml:space="preserve"><p>Retrieves information about the next process recorded in a system 
snapshot.</p>
<p>&#160;</p><pre class="syntax" xml:space="preserve">BOOL WINAPI Process32Next(
  __in          HANDLE <em><a class="synParam" onclick="showTip(this)" href="ms-help://ms.vscc.v90/MS.MSDNQTR.v90.en/dllproc/base/process32next.htm">hSnapshot</a></em>,
  __out         LPPROCESSENTRY32 <em><a class="synParam" onclick="showTip(this)" href="ms-help://ms.vscc.v90/MS.MSDNQTR.v90.en/dllproc/base/process32next.htm">lppe</a></em>
);
</pre></pre></pre></div></div><img src ="http://www.cppblog.com/eastsong/aggbug/69952.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-12-20 23:13 <a href="http://www.cppblog.com/eastsong/archive/2008/12/20/69952.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AOP</title><link>http://www.cppblog.com/eastsong/archive/2008/12/20/69946.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Sat, 20 Dec 2008 14:47:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/12/20/69946.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/69946.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/12/20/69946.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/69946.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/69946.html</trackback:ping><description><![CDATA[

<div>分散关注</div><div>将通用需求功能从不相关类之中分离出来；同时，能够使得很多类共享一个行为，一旦行为发生变化，不必修改很多类，只要修改这个行就可以啦。</div><div>Aop就是这种实现分散关注的编程方法，它将&#8220;关注&#8221;封装在&#8220;方面&#8221;中。</div><div>AOP是OOP的延续，是Aspect Oriented Programming 的缩写，意思是面向方面编程。AOP是GOF设计模式的延续，设计模式孜孜不倦追求的是调用者和被调用者之间的解耦，AOP可以说也是这种目标的一中实现。</div><div><span  style="color: rgb(33, 33, 33); font-family: Verdana; font-size: 14px; line-height: 21px; -webkit-border-horizontal-spacing: 13px; -webkit-border-vertical-spacing: 13px; "><p>举例：假设有在一个应用系统中，有一个共享的数据必须被并发同时访问，首先，将这个数据封装在数据对象中，称为Data Class，同时，将有多个访问类，专门用于在同一时刻访问这同一个数据对象。</p><p>　　为了完成上述并发访问同一资源的功能，需要引入锁Lock的概念，也就是说，某个时刻，当有一个访问类访问这个数据对象时，这个数据对象必须上锁Locked，用完后就立即解锁unLocked，再供其它访问类访问。</p><p>　　使用传统的编程习惯，我们会创建一个抽象类，所有的访问类继承这个抽象父类，如下：</p><center></center><div align="center" style="font-family: Verdana; font-size: 12px; "></div><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" style="font-family: Verdana; font-size: 12px; "><tbody><tr><td bgcolor="#CCCCCC" style="font-family: Verdana; font-size: 12px; "><p>abstract class Worker{</p><p>　　abstract void locked();<br>　　abstract void accessDataObject();<br>　　abstract void unlocked();</p><p>}</p></td></tr></tbody></table><br>　　缺点：<ul style="font-size: 14px; color: rgb(0, 0, 0); list-style-type: square; "><li style="font-size: 14px; color: rgb(0, 0, 0); ">accessDataObject()方法需要有&#8220;锁&#8221;状态之类的相关代码。</li><li style="font-size: 14px; color: rgb(0, 0, 0); ">Java只提供了单继承，因此具体访问类只能继承这个父类，如果具体访问类还要继承其它父类，比如另外一个如Worker的父类，将无法方便实现。</li><li style="font-size: 14px; color: rgb(0, 0, 0); ">重用被打折扣，具体访问类因为也包含&#8220;锁&#8221;状态之类的相关代码，只能被重用在相关有&#8220;锁&#8221;的场合，重用范围很窄。<br><br>仔细研究这个应用的&#8220;锁&#8221;，它其实有下列特性：</li><li style="font-size: 14px; color: rgb(0, 0, 0); ">&#8220;锁&#8221;功能不是具体访问类的首要或主要功能，访问类主要功能是访问数据对象，例如读取数据或更改动作。</li><li style="font-size: 14px; color: rgb(0, 0, 0); ">&#8220;锁&#8221;行为其实是和具体访问类的主要功能可以独立、区分开来的。</li><li style="font-size: 14px; color: rgb(0, 0, 0); ">&#8220;锁&#8221;功能其实是这个系统的一个纵向切面，涉及许多类、许多类的方法。如下图：<br><img src="http://www.jdon.com/AOPdesign/images/lock.png" width="250" height="258">&#160;<br></li></ul><p>　　因此，一个新的程序结构应该是关注系统的纵向切面，例如这个应用的&#8220;锁&#8221;功能，这个新的程序结构就是aspect（方面）</p><p>　　在这个应用中，&#8220;锁&#8221;方面（aspect）应该有以下职责：</p><p>　　提供一些必备的功能，对被访问对象实现加锁或解锁功能。以保证所有在修改数据对象的操作之前能够调用lock()加锁，在它使用完成后，调用unlock()解锁。</p><p><strong>AOP应用范围</strong><br><br>　　很明显，AOP非常适合开发J2EE容器服务器，目前JBoss 4.0正是使用AOP框架进行开发。<br>　　具体功能如下：<br>Authentication 权限<br>Caching 缓存<br>Context passing 内容传递<br>Error handling 错误处理<br>Lazy loading　懒加载<br>Debugging　　调试<br>logging, tracing, profiling and monitoring　记录跟踪　优化　校准<br>Performance optimization　性能优化<br>Persistence　　持久化<br>Resource pooling　资源池<br>Synchronization　同步<br>Transactions 事务</p><p><strong>AOP有必要吗？</strong></p><p>　　当然，上述应用范例在没有使用AOP情况下，也得到了解决，例如JBoss 3.XXX也提供了上述应用功能，但是没有使用AOP。</p><p>　　但是，使用AOP可以让我们从一个更高的抽象概念来理解软件系统，AOP也许提供一种有价值的工具。可以这么说：因为使用AOP结构，现在JBoss 4.0的源码要比JBoss 3.X容易理解多了，这对于一个大型复杂系统来说是非常重要的。</p><p>　　从另外一个方面说，好像不是所有的人都需要关心AOP，它可能是一种架构设计的选择，如果选择J2EE系统，AOP关注的上述通用方面都已经被J2EE容器实现了，J2EE应用系统开发者可能需要更多地关注行业应用方面aspect。</p></span></div><img src ="http://www.cppblog.com/eastsong/aggbug/69946.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-12-20 22:47 <a href="http://www.cppblog.com/eastsong/archive/2008/12/20/69946.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>软件能力成熟度模型</title><link>http://www.cppblog.com/eastsong/archive/2008/12/17/69658.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Wed, 17 Dec 2008 09:43:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/12/17/69658.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/69658.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/12/17/69658.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/69658.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/69658.html</trackback:ping><description><![CDATA[一 基本概念<br><br>软件过程（Software Process）<br>软件过程可定义为企业设计，研制和维护软件产品及相关资料文档的全部生<br>产活动和工程管理活动。<br><br>软件过程能力（Software Process Capablility）<br>企业实施软件过程所能实现预期目标的程度。它可用于预测企业的软件过程水平。<br><br>软件过程行为（Software Process Performance）<br>企业在项目开发中遵循软件过程所能得到的实际结果。<br><br>软件过程成熟度（Software Process Maturity）<br>软件过程行为可被定义，预测和控制并持续行提高的程度。它主要用来表明不同项目所遵循的软件过程的一致性。<br><br>软件能力成熟度等级（Software Capablility Maturity levels）<br>企业的软件开发在由低到高成熟化演进过程中所普遍面临的具有一定成熟度特征的平台。<br><br>成熟与不成熟（Mature and Immature）<br>不成熟的标志有-&nbsp; 没有明确的软件过程体系可以依据，无法对生产进行预测；不严格执行生产过程；质量无法保证；无健全的过程控制及质量控制体系；项目开发没有准则可遵循；开发结果主要依据项目小组及个人的带有主观因素的能力发挥。<br>成熟的标志有-项目开发是依据企业早已明确的过程准则来实施；开发结果较少的依赖个人能力和自然因素；项目由过程控制并可对整个生产作出预测；产品质量得到有效的监控（）；过去的开发项目中所获经验得以积累并可系统地用于现行和未来的项目之中。<br><br>配置管理（Configuration Management）<br>包括以下管理行为： 对某个配置项的功能和物理特性进行识别和编档；对这些特征的变动进行控制；对变动和事实进行记录、汇报；验证需求计划的实现。<br><br>偏差（Deviation）<br>针对开发中的计划、标准、规划等的明显偏离和变动。<br><br>同业复审（Peer Review）<br>软件项目开发成员的同行遵循某一规则对项目产品所作的检查，用于发现缺陷所在。<br><br>风险管理（Risk Management）<br>运用风险概率方法分析评估项目开发设计中的各类风险，包括风险识别，风险分析，风险等级排序和风险控制。<br><br>软件工程过程组（Software Engineering Process Group）<br>协助开发机构对所采纳的软件过程进行制定、分析、监控和改进的专家组。<br>它应该直接向机构的最高领导层负责。<br><br>软件生命周期（Software Life Cycle）<br>指软件开发所涉及的全过程，包括从产品设计到产品终结的整个周期，一般分为概念阶段，需求阶段，设计阶段，实施阶段，测试阶段，安装调试阶段，运行维护阶段，终止阶段。<br><br>软件需求（Software Requirement）<br>用户为实现某种目标或者解决某种问题要求软件给予满足的条件。<br>
<img src ="http://www.cppblog.com/eastsong/aggbug/69658.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-12-17 17:43 <a href="http://www.cppblog.com/eastsong/archive/2008/12/17/69658.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Intrusion detection system</title><link>http://www.cppblog.com/eastsong/archive/2008/12/16/69608.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Tue, 16 Dec 2008 14:52:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/12/16/69608.html</guid><description><![CDATA[&#160;&#160; &#160;侵入检测系统是用来通过网络检测非法访问、操作的软件或者硬件系统。攻击的形势大都是以黑客、恶意软件等。侵入检测系统不能在加密的网络中检测攻击。侵入检测系统被用来检测几种类型的恶意行为，这些恶意行为能获得计算机系统的信任。他们会攻击网络的脆弱服务，应用程序的数据驱动，提升权限，未经授权的登陆，访问敏感文件和恶意软件等（病毒，木马或者蠕虫）。IDS由几部分构成：传感器，产生安全事件；控制台程序，监视事件和警告、控制传感器；中心发动机，记录传感器登陆事件和使用系统规则产生来自安全事件的警告。有几种方式划分IDS，取决于传感器的类型和位置以及发动机产生警告的方法。很多简单IDS的实现都是将这三部分组件合并成一个简单的设备或者装置。侵入检测系统的类型： 在以网络为基础的侵入检测系统中，由于传感器是网络的瓶颈而被监视，通常在隔离区或者网络边界中。传感器捕获网络信息流量并且分析恶意流量中包的数据内容。在系统中,PIDS和APIDS被用来监视网络流量和协议，非法或者不当的网络流量或者语言结构。在以主机为基础的系统中，传感器有软件代理构成，用来监视主机的所有活动。 &#160;网络侵入检测系统是一个独立的平台。能够通过检查网络流量和监视多个主机来辨别侵入。<img src ="http://www.cppblog.com/eastsong/aggbug/69608.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-12-16 22:52 <a href="http://www.cppblog.com/eastsong/archive/2008/12/16/69608.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Design Pattern - Chapter One 简单工厂模式</title><link>http://www.cppblog.com/eastsong/archive/2008/11/03/65871.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Mon, 03 Nov 2008 11:44:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/11/03/65871.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/65871.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/11/03/65871.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/65871.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/65871.html</trackback:ping><description><![CDATA[简单工厂： 用一个单独的类来做创造实例的过程，就是工厂。<br><br>优点：在于工厂类中包含了必要的逻辑判断，根据客户端的选择条件动态实例化相关的类，对于客户端来说，去除了与具体产品的依赖。<br><br>例子：实现计算器代码<br><br>1 计算和显示分开<br>2 灵活地修改和扩展（开放封闭原则）<br>3 单一原则（加减乘除各个自成一类）<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : IOperation.h<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: interface of operation<br>*/<br><br>#if !defined _IOPERATION_H_<br>#define _IOPERATION_H_<br><br>class IOperation<br>{<br>public:<br>&nbsp;&nbsp;&nbsp; IOperation(double _doubleA = 0, double _doubleB = 0);<br>&nbsp;&nbsp;&nbsp; virtual ~IOperation(){};<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; virtual double Execute() = 0;<br><br>&nbsp;&nbsp;&nbsp; void SetA(double _doubleA);<br>&nbsp;&nbsp;&nbsp; double GetA();<br><br>&nbsp;&nbsp;&nbsp; void SetB(double _doubleB);<br>&nbsp;&nbsp;&nbsp; double GetB();<br><br>protected:<br>private:<br>&nbsp;&nbsp;&nbsp; double m_doubleA;<br>&nbsp;&nbsp;&nbsp; double m_doubleB;<br><br>};<br><br>#endif<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : IOperation.cpp<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the realization of IOperation<br>*/<br><br>#include "IOperation.h"<br><br><br>IOperation::IOperation(double _doubleA /* = 0 */, double _doubleB /* = 0 */)<br>{<br>&nbsp;&nbsp;&nbsp; m_doubleA = _doubleA;<br>&nbsp;&nbsp;&nbsp; m_doubleB = _doubleB;<br>}<br><br>void IOperation::SetA(double _doubleA)<br>{<br>&nbsp;&nbsp;&nbsp; m_doubleA = _doubleA;<br>}<br>double IOperation::GetA()<br>{<br>&nbsp;&nbsp;&nbsp; return m_doubleA;<br>}<br><br>void IOperation::SetB(double _doubleB)<br>{<br>&nbsp;&nbsp;&nbsp; m_doubleB = _doubleB;<br>}<br><br>double IOperation::GetB()<br>{<br>&nbsp;&nbsp;&nbsp; return m_doubleB;<br>}<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : CAdd.h<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the declaration of Add operation<br>*/<br>#if !defined _CADD_H_<br>#define _CADD_H_<br><br>#include "IOperation.h"<br><br>class CAdd : public IOperation<br>{<br>public:<br>&nbsp;&nbsp;&nbsp; virtual double Execute();<br>protected:<br>private:<br>};<br><br>#endif<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : CAdd.cpp<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the realization of Add operation<br>*/<br><br>#include "CAdd.h"<br><br>double CAdd::Execute()<br>{<br>&nbsp;&nbsp;&nbsp; return GetA() + GetB();<br>}<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : CSub.h<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the declaration of sub operation<br>*/<br>#if !defined _CSUB_H_<br>#define&nbsp; _CSUB_H_<br><br>#include "IOperation.h"<br><br>class CSub : public IOperation<br>{<br>public:<br>&nbsp;&nbsp;&nbsp; virtual double Execute();<br>protected:<br>private:<br>};<br><br>#endif<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : CSub.h<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the realization of sub operation<br>*/<br><br>#include "CSub.h"<br><br>double CSub::Execute()<br>{<br>&nbsp;&nbsp;&nbsp; return GetA() - GetB();<br>}<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : CMul.h<br>*&nbsp;&nbsp;&nbsp; Author&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the declaration of mul operation<br>*/<br>#if !defined _CMUL_H_<br>#define&nbsp; _CMUL_H_<br><br>#include "IOperation.h"<br><br>class CMul : public IOperation<br>{<br>public:<br>&nbsp;&nbsp;&nbsp; virtual double Execute();<br>protected:<br>private:<br>};<br><br>#endif<br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : CMul.cpp<br>*&nbsp;&nbsp;&nbsp; Author&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the realization of mul operation<br>*/<br>#include "CMul.h"<br><br>double CMul::Execute()<br>{<br>&nbsp;&nbsp;&nbsp; return GetA() * GetB();<br>}<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : CDiv.h<br>*&nbsp;&nbsp;&nbsp; Author&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the declaration of div operation<br>*/<br>#if !defined _CDIV_H_<br>#define _CDIV_H_<br><br>#include "IOperation.h"<br><br>class CDiv : public IOperation<br>{<br>public:<br>&nbsp;&nbsp;&nbsp; virtual double Execute();<br>protected:<br>private:<br>};<br><br>#endif<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : CDiv.cpp<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: the realization of div operation<br>*/<br>#include "CDiv.h"<br><br>double CDiv::Execute()<br>{<br>&nbsp;&nbsp;&nbsp; if (0 != GetB())<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return GetA() / GetB();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; * I do not know how to throw the exception using c++<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //throw Exception();<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 0;<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : OperationFactory.h<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: factory of create operation object<br>*/<br><br>#if !defined _OPERATION_FACTORY_H_<br>#define _OPERATION_FACTORY_H_<br><br>#include "IOperation.h"<br><br>class OperationFactory<br>{<br>public:<br>&nbsp;&nbsp;&nbsp; static IOperation * CreateOperation(char&nbsp; op);<br>protected:<br>private:<br>};<br><br>#endif<br><br>/**<br>*&nbsp;&nbsp;&nbsp; File&nbsp;&nbsp;&nbsp; : OperationFactory.cpp<br>*&nbsp;&nbsp;&nbsp; Author&nbsp;&nbsp;&nbsp; : Eastsong<br>*&nbsp;&nbsp;&nbsp; Date&nbsp;&nbsp;&nbsp; : 11/3/2008<br>*&nbsp;&nbsp;&nbsp; Function: factory of create operation object<br>*/<br><br>#include "OperationFactory.h"<br>#include "CAdd.h"<br>#include "CSub.h"<br>#include "CMul.h"<br>#include "CDiv.h"<br><br>IOperation * OperationFactory::CreateOperation( char op)<br>{<br>&nbsp;&nbsp;&nbsp; IOperation * operation = 0;<br><br>&nbsp;&nbsp;&nbsp; switch(op)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; case '+' :<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; operation = new CAdd();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; case '-':<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; operation = new CSub();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; case '*':<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; operation = new CMul();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; case '/':<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; operation = new CDiv();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; default:<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; return operation;<br>}<br><br><img src ="http://www.cppblog.com/eastsong/aggbug/65871.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-11-03 19:44 <a href="http://www.cppblog.com/eastsong/archive/2008/11/03/65871.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转： 史上最牛夫妻生活协议</title><link>http://www.cppblog.com/eastsong/archive/2008/11/02/65744.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Sun, 02 Nov 2008 03:53:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/11/02/65744.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/65744.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/11/02/65744.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/65744.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/65744.html</trackback:ping><description><![CDATA[&nbsp;史上最牛夫妻生活协议<br>&nbsp; 1.吵架不当着父母，亲戚，邻居的面吵，在公共场所给对方面子。<br>&nbsp;<br>&nbsp; 2.不管谁对谁错，只要一吵架，男方必须先轻声轻气哄女方一次，女方才能马上冷静下来，否则女方一看到男方哇啦哇啦女方也忍不住哇啦哇啦，一旦造成严重后果，全部由男方负责。<br>&nbsp;<br>&nbsp; 3.在家里吵架不准一走了之，实在要走不得走出小区，不许不带手机和关机。<br>&nbsp;<br>&nbsp; 4.尊敬对方的父母长辈，吵架不开心不能对父母无礼。<br>&nbsp;<br>&nbsp; 5.有错一方要主动道歉，无错一方在有错方道歉并补偿后要尽快原谅对方。<br><br>&nbsp;<br>&nbsp; 6.双方都有错时要互相检讨，认识到错误并道歉后由男方主动提出带女方出去散心。<br>&nbsp;<br>&nbsp; 7.要出气不准砸东西，只能吃东西，实在手痒只能砸枕头。<br>&nbsp;<br>&nbsp; 8.吵架尽量不隔夜，晚上睡觉时男方必须主动抱女方，女方生气百般推让男方也不能就此放弃，一定要哄到女方睡着，做上美梦。。。<br><br>&nbsp;<br>&nbsp; 9.每周都要给对方按摩一次，因为大家经常吵架都很辛苦，男方手艺不好的话可以跟盲人师傅学，严禁和发廊女学！<br>&nbsp;<br>&nbsp; 10.吵架时男方不准挂电话，如果挂了要马上打回去，并表示歉意，吵架时女方如果挂了电话，男方必须在1分钟内打给女方，电话不通打手机，总之不能气绥，屡挂屡打，但是女方也要给男方面子，每次挂电话次数不大于5次。<br><br>（公约条款暂时为以上这几条，可由女方无理由无时间限制的更改，男方有权利提出异议，但是异议是否被采纳最终解释权在女方手里）<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; <br><img src ="http://www.cppblog.com/eastsong/aggbug/65744.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-11-02 11:53 <a href="http://www.cppblog.com/eastsong/archive/2008/11/02/65744.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Design Pattern</title><link>http://www.cppblog.com/eastsong/archive/2008/10/31/65629.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Fri, 31 Oct 2008 08:18:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/10/31/65629.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/65629.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/10/31/65629.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/65629.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/65629.html</trackback:ping><description><![CDATA[看完大话设计模式有好一段时间了，不过总觉得理解的不透彻，可是重新翻看又说不明白哪里不理解。<br>大话设计模式基本涵盖了目前流行的大部分设计模式，现在脑子里能想起来的有：<br>简单工厂、策略模式、工厂模式、桥接模式、享元模式、模板、观察者、单键模式、抽象、代理、指导者、命令<br>其中里面还讲到一些设计原则，如：DSP、LSP、OCP等。<br>在项目设计中，我也尝试去应用了里面的一些模式，遇到问题，就比较着看和大话模式里那种比较相似，就应用上了。<br>到底如何才是真正理解设计模式了呢？有的时候我是很糊涂。<br><br><img src ="http://www.cppblog.com/eastsong/aggbug/65629.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-10-31 16:18 <a href="http://www.cppblog.com/eastsong/archive/2008/10/31/65629.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>为了做件有成就的事</title><link>http://www.cppblog.com/eastsong/archive/2008/10/30/65553.html</link><dc:creator>eastsong</dc:creator><author>eastsong</author><pubDate>Thu, 30 Oct 2008 05:15:00 GMT</pubDate><guid>http://www.cppblog.com/eastsong/archive/2008/10/30/65553.html</guid><wfw:comment>http://www.cppblog.com/eastsong/comments/65553.html</wfw:comment><comments>http://www.cppblog.com/eastsong/archive/2008/10/30/65553.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/eastsong/comments/commentRss/65553.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/eastsong/services/trackbacks/65553.html</trackback:ping><description><![CDATA[昨天去听了超图的校园宣讲会，无非都是宣扬些本公司的现状，未来的发展，以及招聘人员来到本公司后的待遇等等。我没太自己关注这些，大部分时间是在看新买的Multithreading Appinlication in Windows，最近很爱看书。不过宣讲人说了句话，让我印象很是深刻，他说，时不时就该做些有成就的事，否则时间长了，人都会颓废的，原话不是这么说的，大意而已。我觉得这句话很有道理，在学校这么长时间，从来没觉得什么事让自己感觉很有成就；工作了这么久也是一样，天天想着完成任务就好，从来没想过应该超前完成点任务。大部分仅仅是为了维持生活现状，得过且过而已。时间长了，反而觉得很是无聊，没有什么新意。<br>受这句话的启发，我决定今天就该做点有成就感的事情，把前两天拖拉的工作完成了。其实任务说起来很简单：项目在开发中用到了sqlite3.dll，不过在引用这个dll时，项目中用的是在project、setting 中设置的方式，（dll调用分两种，不清楚这种调用是隐式的还是显示的，没分清），所以项目程序只有在sqlite3.dll 存在的情况下，才可以运行，否则运行不起来，会报错。 项目中我的任务是做升级程序Updater.exe，在升级程序中也需要升级数据库，因此也使用了sqlite3.dll，也是按的前面的调用方式。这种调用方式带来的弊端是updater.exe在升级主程序时，可能会出现问题，sqlite3.dll的升级可能失败（正在被updater.exe使用）。我曾想试着按另外一种方式调用sqlite3.dll导出的函数，但终究觉得导出函数的方式很复杂，而且sqlite3的导出函数封装的不好，写起来很费劲（这之前由于sqlite3.h 封装不好，我们项目组一直引用它的一个封装类CppSqlite3）。<br>如果按着sqlite3 导出函数（LoadLibrary，FreeLibrary）这种方式来做的话，问题来了：<br>1 导出函数的指针必须拿到<br>2 以前写的代码引用到CppSqlite3 的最好不要影响到<br><br>想了很久，终于我想到一个方法来解决这个问题，遂开始实施（后面在描述解决过程吧），可是由于导出函数太多，写的我都快吐血了，一直到了早上五点，还没全部弄完，实在是坚持不住了，就想赶紧睡会吧，一会还得上班呢。遂倒头睡去，没成想在睁开眼睛时，已是8点多了。<br><br><br><br><img src ="http://www.cppblog.com/eastsong/aggbug/65553.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/eastsong/" target="_blank">eastsong</a> 2008-10-30 13:15 <a href="http://www.cppblog.com/eastsong/archive/2008/10/30/65553.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>