Edmund's zone

导航

2011年7月14日 #

修改VC++工程framework版本

摘要: 在C++/CLI中修改VC++的framework版本,由于VS2010不支持像C#项目文件的那种直接的下拉框模式,我们需要在.vcxproj文件中修改目标版本(TargetFrameWorkVersion),具体操作如下:1.如果采用vs的IDE来修改,需要先把你要修改的项目工程unload,然后右键,选中“Edit”目标项目,在ProjectGuid下面添加你需要的版本,如下图:其中IDE... 阅读全文

posted @ 2011-07-14 09:03 Edmund Li 阅读(793) 评论(0) 推荐(0) 编辑

2011年7月12日 #

断点不能加载

摘要: C#调用C++/CLI 的代码中,C++的代码总不能跟踪。其中我的C#是新代码,而C++则是同事发给我的现在程序中已经使用的代码。我现在要做到就是把C++的大部分东西推到重来。由于进度紧张,连C++的项目文件都没有没有改,这导致浪费了一整天的时间。在debug的状态下,查看Modules的信息,发现那个C++总是调用别人的dll,而symbol file里面的信息也不是我正在调试的pdb文件。郁闷,郁闷。。。在dll上面点击右键,加载symbol,总是说mismatch。!!!!咋回事??把module里面显示的路径改个名字,再看,竟然又到了改后的目录里面!!说明不是工程设置的错误。唉。。。两 阅读全文

posted @ 2011-07-12 16:48 Edmund Li 阅读(377) 评论(0) 推荐(0) 编辑

2011年7月8日 #

Decorator Pattern

摘要: Time for Decorator pattern:Use Espresso, DarkRoast and HouseBlend coffee as the ConcreteComponent, Soy, Mocha and Whip as the ConcreteDecorate.Here is the code:using System;namespace DecoratorPattern{ class Program { static void Main(string[] args) { Beverage beverage = new Espresso(); Console.Write 阅读全文

posted @ 2011-07-08 08:49 Edmund Li 阅读(200) 评论(0) 推荐(0) 编辑

2011年7月4日 #

5 Tips for creating good code every day[转]

摘要: Being a good developer is like being any other good professional, it’s all it’s about doing as much quality work as possible. There is a popular sentence that summarises it: “Do it. Do it right. Do it right now”.1.- Have your own to do list for the day.The best approach to complete complex activitie 阅读全文

posted @ 2011-07-04 14:15 Edmund Li 阅读(162) 评论(0) 推荐(0) 编辑

2011年6月30日 #

策略模式

摘要: 今天研究一下策略模式。示例程序如下:Strategy.csnamespace StrategyPatternExample{ public interface Strategy { int Execute(int a, int b); }}Context.csnamespace StrategyPatternExample{ public class Context { private Strategy strategy; public Context(Strategy strategy) { this.strategy = strategy; } public int ExecuteStra 阅读全文

posted @ 2011-06-30 09:31 Edmund Li 阅读(247) 评论(0) 推荐(0) 编辑

2011年1月13日 #

输出1到1000的数

摘要: 最近经常见这道题:请把从1到1000的数打印出来,但你不能使用任何的循环语句或是条件语句。更不能写1000个printf或是cout。用C/C++语言。自己用C++试了一下,怎么也不会抛出异常,难道不对?看代码:[代码]调试使用:Visual studio 2008 Command Prompt,cl /EHsc后直接用cl也不行,都能打印到85721这个值。难道编译器对分母为零熟视无睹???然后直接把代码拷贝到vs2008的编译器里面,还是如此。郁闷中,随手把第一行“#include windows.h 删除,竟然能打印到1000了!why?你干啥了,Windows.h?另外,在不删除W 阅读全文

posted @ 2011-01-13 17:50 Edmund Li 阅读(451) 评论(7) 推荐(0) 编辑

2011年1月12日 #

观察者模式

摘要: 观察者模式 阅读全文

posted @ 2011-01-12 22:28 Edmund Li 阅读(307) 评论(0) 推荐(0) 编辑

2011年1月9日 #

单例模式(Singleton)

摘要: 最近用到了单例模式。在这里做个总结,整理思路。使用情形:在调用form时,可能出现此form已经被初始化了,但是调用者并不知道,重新new了一个新的form,导致调用者的混乱。使用了singleton模式,做到了在内存中只有一个form,避免多次new。Form's Singleton下面介绍一下通用的情形:单例模式(singleton):保证一个类仅有一个实例,并提供一个访问它的全局访问点。简单的说,单例模式是对唯一实例的受控访问。下面是在多线程时的单例模式示例代码:[代码]对于多线程的实现,在实际中还有采用静态初始化的方式,代码如下:[代码]当需要释放此instance或者form时,须要 阅读全文

posted @ 2011-01-09 15:40 Edmund Li 阅读(315) 评论(0) 推荐(0) 编辑

2010年9月15日 #

sprite

摘要: Sprite means a group of pixels that are moved and displayed as a single unit, a kind of graphical object."The term 'sprite' is a holdover from older computer and game machines. These older boxes were ... 阅读全文

posted @ 2010-09-15 22:30 Edmund Li 阅读(426) 评论(0) 推荐(0) 编辑

2010年8月4日 #

Solve 'starting debugger causes Visual Studio internal error'

摘要: Microsoft Visual Studio has encountered an internal error Microsoft Visual Studio may be unstable now. It is recommended that you save all files and exit. 阅读全文

posted @ 2010-08-04 15:54 Edmund Li 阅读(1457) 评论(2) 推荐(0) 编辑