常建57

路漫漫其修远兮。。。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2014年4月7日

摘要: 装饰模式:动态的给一个对象添加一些额外的职责。当然我们也可以通过继承来实现类似的功能,但是随着子类的增多,各种子类的组合会造成子类的急剧膨胀。Requirement: 假设客户有一个要求,需要打一个report,并且report 的header 和footer 各有3种,然后要求打出所有可能组合的report。Analysis: 当然纯粹的通过子类继承也可以实现,但是现在如果header 和footer各有10种呢,那么你就要有100个扩展类。但是通过使用装饰模式,你只要10 header 类+10个footer类(即20个类)就可以轻松搞定。下面我们以header 和footer 各有两.. 阅读全文
posted @ 2014-04-07 13:01 常建57 阅读(110) 评论(0) 推荐(0) 编辑

2014年4月5日

摘要: 本文直接使用.net 提供的接口来实现Observer Pattern(IObserver,IObservable)。 也可以自定义接口。如何实现:1.定义一个Subject Provider 类。 需要实现Subscribe()。2.定义一个Observer 类。 需要实现OnNext() 用来输出信息或者要执行的操作。 需要实现OnComplete() 完成后要执行的操作。 需要实现OnError() 万一出现错误,输出错误信息。下面提供一个我能想到的最简单的Sample,忽略所有其它细节,只关注Observer pattern。Sample:using System;usi... 阅读全文
posted @ 2014-04-05 20:19 常建57 阅读(191) 评论(0) 推荐(0) 编辑

2014年3月24日

摘要: Problem:“Unable to attach to the process. Another debugger might be attached to the process.”Solution:1.Debug->Windows->Processes(Ctrl+D,P). Now you will see the Processes window.2.Right Clickiexplore.exe and select "Detach process". And now you can debug your javascript successfully 阅读全文
posted @ 2014-03-24 11:11 常建57 阅读(156) 评论(0) 推荐(0) 编辑

2014年1月10日

摘要: Same:1.store unicode charactor.2. A charactor is stroed with 2 bytes.Different.1. nchar 会自动填充数据到定义的固定长度;nvarchar 是数据有多长就存多少数据。Example:Create a table like below and store "A" in the two column.CREATE TABLE [dbo].[AAAAA]( [name] [nchar](10) NULL, [newName] [nvarchar](10) NULL) ON [PRIMARY] R 阅读全文
posted @ 2014-01-10 10:44 常建57 阅读(97) 评论(0) 推荐(0) 编辑

2013年12月30日

摘要: scenerio: 远程登录 Windows server 2008 黑屏,别人那里一切正常。Solution:在黑屏界面,点击桌面,按住Ctrl+Alt+End键 -> Log Off. 然后一切正常。 阅读全文
posted @ 2013-12-30 11:18 常建57 阅读(564) 评论(0) 推荐(0) 编辑

2013年12月25日

摘要: Case:class A has a construct. class B is inherit from class A and B also has a construct. What's the order of the construct execute?Result: construct A -> construct B.Sample: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace TestInheri 阅读全文
posted @ 2013-12-25 22:39 常建57 阅读(333) 评论(0) 推荐(0) 编辑

摘要: Here is a sample about delegate and event.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace TestHeaterDelegateSample{ public class Program { public static void Main(string[] args) { Heater heater = new Heater(); Moni... 阅读全文
posted @ 2013-12-25 22:12 常建57 阅读(178) 评论(0) 推荐(0) 编辑

2013年12月11日

摘要: You can use the below command to implement it.SET TargetDBName="Database name"SET DataBaseServer="DB Server name"SET DbProjectPath="database project folder"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /t:Deploy /p:TargetDatabase=%TargetDBName%;TargetConnect 阅读全文
posted @ 2013-12-11 16:28 常建57 阅读(275) 评论(0) 推荐(0) 编辑

2013年12月1日

摘要: Case:同样的代码,本地开发环境(local is Chinese Simplify)可以成功运行,但是放到Windows Server 2008 R2(Local is United State) 上,同样的代码失败了。最后跑到server上用vs2012 获取最新代码发现所有的中文都是乱码。Solution1:只该代码,其它设置不变(server 上的是设置不是我们这些小兵想动就可以动的)。我写了两个方法。 1 public bool CompareChineseString(string flagString,string garbageString) 2 ... 阅读全文
posted @ 2013-12-01 19:50 常建57 阅读(419) 评论(0) 推荐(0) 编辑

2013年11月26日

摘要: public class Program { static void Main(string[] args) { Program p = new Program(); p.Test(); Console.ReadLine(); } public void Test() { List initPeopleList = new List(); People people = new People("Rich... 阅读全文
posted @ 2013-11-26 23:06 常建57 阅读(125) 评论(0) 推荐(0) 编辑