心如止水

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 2 3 4 5 6 7 ··· 9 下一页

2011年8月17日

摘要: 参考自:http://www.cnblogs.com/herbert/archive/2011/02/13/1953943.htmlProject Euler problem 16215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 21000? 计算 2 的 1000次方的所有数字的和?这个设计大数乘方问题,通用的思路就是采用数组来分段处理大数,分段表示大数。下面的算法中,我采用的是“万进制”,用数组来存储数据。原理如下: 先说计 阅读全文
posted @ 2011-08-17 16:35 cutebear 阅读(1271) 评论(0) 推荐(0) 编辑

2011年8月16日

摘要: Process Monitor是一款系统进程监视工具,Sysinternals被微软收购以后将原来著名的文件监视工具Filemon和注册表监视工具Regmon合并成了今天的Process Monitor。process monitor 下载地址:http://technet.microsoft.com/en-us/sysinternals/bb896645下面是一些使用process monitor的例子:Process Monitor - Hands-On Labs and Exampleshttp://blogs.technet.com/b/appv/archive/2008/01/24/ 阅读全文
posted @ 2011-08-16 13:56 cutebear 阅读(826) 评论(0) 推荐(0) 编辑

2011年8月12日

摘要: 根据预处理标识符执行方法。Conditional 特性是 ConditionalAttribute 的别名,可应用于方法或继承自Attribute类的子类。如果应用在其他类上会产生编译错误。Applying ConditionalAttribute to a method indicates to compilers that a call to the method should not be ... 阅读全文
posted @ 2011-08-12 15:38 cutebear 阅读(416) 评论(0) 推荐(0) 编辑

摘要: 这是转载的,觉得很不错,原文:http://www.cnblogs.com/xzwplus/archive/2008/03/30/1129452.html关于调试windows service, 其实这是一个老生常谈的问题了. 通常的处理办法是, 在service运行后, 在调试器中选择attach to process. 然而这种做法也有一定的局限性, 例如在service启动时的OnStart事件中的代码, 基本上很难调试. 往往当attach到我们的service的时候, 这部分代码已经执行过了. 于是, 有人提出, 可以另写一个project来调用这个OnStart方法, 或将OnSt 阅读全文
posted @ 2011-08-12 12:03 cutebear 阅读(509) 评论(0) 推荐(0) 编辑

2011年8月10日

摘要: 一个对象的延迟初始化意味着该对象的创建将会延迟至第一次使用该对象时。 (在本主题中,术语"延迟初始化"和"延迟实例化"是同义词。) 延迟初始化主要用于提高性能,避免浪费计算,并减少程序内存要求。 以下是最常见的方案: 有一个对象的创建开销很大,而程序可能不会使用它。 例如,假定您在内存中有一个 Customer 对象,该对象的 Orders 属性包含一个很大的 Order 对象数组,该数组需要数据... 阅读全文
posted @ 2011-08-10 17:07 cutebear 阅读(307) 评论(0) 推荐(0) 编辑

摘要: Code that runs under the control of the common language runtime (CLR) is called managed code, and code that runs outside the CLR is called unmanaged code. COM, COM+, C++ components, ActiveX components, and Microsoft Win32 API are examples of unmanaged code. .NET Framework 通过 Dllimport 属性提供了显式平台调用( P 阅读全文
posted @ 2011-08-10 15:18 cutebear 阅读(1134) 评论(0) 推荐(0) 编辑

2011年8月9日

摘要: 规则:枚举应该具有零值违反此规则的情况:未应用 System.FlagsAttribute 的枚举没有定义为零值的成员;或者应用了 FlagsAttribute 的枚举虽然定义了零值的成员,但其名称不是"None",或者该枚举定义了多个为零值的成员。 FlagsAttribute: 指示可以将枚举作为位(bit)处理,能进行位运算。位域通常用于由可组合出现的元素组成的列表,而枚举常数通常用于由互相... 阅读全文
posted @ 2011-08-09 15:09 cutebear 阅读(299) 评论(0) 推荐(0) 编辑

摘要: 规则: 属性不应该返回数组即使属性是只读的,该属性返回的数组也不是写保护的。 若要使数组不会被更改,属性必须返回数组的副本。如下面的代码,就违背了这个规则:public class Book { private string[] _Pages; public Book(string[] pages) { _Pages = pages; } public string[] Pages { get {... 阅读全文
posted @ 2011-08-09 11:38 cutebear 阅读(482) 评论(0) 推荐(1) 编辑

2011年8月4日

摘要: 参考自: http://www.cnblogs.com/zhouyinhui/archive/2009/08/27/1554943.html#commentform下面是自己写的一个例子:下载 阅读全文
posted @ 2011-08-04 17:22 cutebear 阅读(289) 评论(0) 推荐(0) 编辑

2011年7月29日

摘要: Original site: http://msdn.microsoft.com/en-us/magazine/cc163328.aspxWPF Threads Build More Responsive Apps With The Dispatcher 用Dispatcher构建快速响应的应用程序Shawn Wildermuth This article discusses: Threading in WPF Using the Dispatcher Non-UI thread handling Using timers This article uses the following t.. 阅读全文
posted @ 2011-07-29 17:22 cutebear 阅读(747) 评论(0) 推荐(0) 编辑

2011年7月28日

摘要: In following case:<Window x:Class="WpfApplication59.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWind... 阅读全文
posted @ 2011-07-28 17:51 cutebear 阅读(237) 评论(0) 推荐(0) 编辑

摘要: Application domains, which are represented by AppDomain objects, help provide isolation, unloading, and security boundaries for executing managed code. Use application domains to isolate tasks that might bring down a process. If the state of the AppDomain that's executing a task becomes unstable 阅读全文
posted @ 2011-07-28 09:29 cutebear 阅读(224) 评论(0) 推荐(0) 编辑

2011年7月27日

摘要: Below is a system defined delegate://Represents methods that will handle various routed events that //track property value changes. public delegate void RoutedPropertyChangedEventHandler<T>(object sen... 阅读全文
posted @ 2011-07-27 11:40 cutebear 阅读(881) 评论(0) 推荐(0) 编辑

2011年7月26日

摘要: // The following line causes the compiler to generate// a new delegate class named CheckAndPrintDelegate that// inherits from System.MulticastDelegate.public delegate void CheckAndPrintDelegate(string str); MulticastDelegate is a special class. Compilers can derive from this class, but you cannot de 阅读全文
posted @ 2011-07-26 11:26 cutebear 阅读(370) 评论(0) 推荐(0) 编辑

2011年7月22日

摘要: 为什么实现 WeakEvent 模式? 侦听事件可能会导致内存泄漏。侦听事件的一般方法是使用语言特定的语法,该语法将处理程序附加到源上的事件。例如,在 C# 中,该语法是:source.SomeEvent += new SomeEventHandler(MyEventHandler)。 此方法创建从事件源到事件侦听器的强引用。通常,为侦听器附加事件处理程序会导致侦听器具有对象生存期,该生存期受源的... 阅读全文
posted @ 2011-07-22 16:24 cutebear 阅读(385) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 9 下一页