上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 72 下一页
摘要: using System; class SingletonPattern { // Singleton Pattern Judith Bishop Nov 2007 // The public property protects the private constructor public class Singleton { // Private constructor Singleton () { } // Nested class for lazy instantiation class SingletonCreator { static SingletonCreator () {... 阅读全文
posted @ 2012-05-14 21:26 ChaunceyHao 阅读(122) 评论(0) 推荐(0)
摘要: using System; // Singleton PatternJudith Bishop Nov 2007 // Generic version public class Singleton <T> where T : class, new(){ Singleton() { } class SingletonCreator { static SingletonCreator () {} // Private object instantiated with private constructor internal static readonly T instance = ne 阅读全文
posted @ 2012-05-14 21:26 ChaunceyHao 阅读(135) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; namespace PrototypePattern { // Prototype Pattern Judith Bishop Dec 2006 // Serialization is used for the deep copy option [Serializable()] public abstract cla... 阅读全文
posted @ 2012-05-14 21:24 ChaunceyHao 阅读(187) 评论(0) 推荐(0)
摘要: using System; class SingletonPattern { // Singleton Pattern Judith Bishop Dec 2006 // The public property protects the private constructor public sealed class Singleton { // Private Constructor Singleton() { } // Private object instantiated with private constructor static readonly Singleton inst... 阅读全文
posted @ 2012-05-14 21:24 ChaunceyHao 阅读(131) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.Runtime.Serialization; using PrototypePattern; // Prototype Pattern Judith Bishop Dec 2006 // The AbstractProtoype is represented by the ICloneable interface // Serializable is used for the deep copy option [Serializable()] // Helper cla.. 阅读全文
posted @ 2012-05-14 21:23 ChaunceyHao 阅读(263) 评论(0) 推荐(0)
摘要: using System; using System.Collections; class FactoryPattern { // Factory Method Pattern Judith Bishop 2006 // Example of exporting from different suppliers interface IProduct { string ShipFrom(); } class ProductA : IProduct { public String ShipFrom () { return " from South Africa"; } } cl 阅读全文
posted @ 2012-05-14 21:11 ChaunceyHao 阅读(119) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.IO; using PrototypePattern; namespace CompositePattern { // The Interface public interface IComponent <T> { void Add(IComponent <T> c); IComponent <T> Remove(T s); string Display(int depth); IComponent <T> Find(T s) 阅读全文
posted @ 2012-05-14 21:07 ChaunceyHao 阅读(183) 评论(0) 推荐(0)
摘要: using System; // Facade Pattern Judith Bishop Dec 2006 // Sets up a library of three systems, accessed through a // Facade of two operations // Compile with csc /t:library /out:FacadeLib.dll Facade2.cs namespace FacadeLib { internal class SubsystemA { internal string A1() { return "Subsystem A, 阅读全文
posted @ 2012-05-14 20:39 ChaunceyHao 阅读(127) 评论(0) 推荐(0)
摘要: using System; using FacadeLib; // Compile with csc /r:FacadeLib.dll Facade2Main.cs class FacadePattern1 { class Client { public void ClientMain () { Facade.Operation1(); Facade.Operation2(); } } static void Main() { new Client().ClientMain(); }} /* Output:Operation 1Subsystem A, Method A1Subsyste... 阅读全文
posted @ 2012-05-14 20:35 ChaunceyHao 阅读(163) 评论(0) 推荐(0)
摘要: using System; using EngineeringService; // Two-way Adapter Pattern Pierre-Henri Kuate and Judith Bishop Aug 2007 // Embedded system for a SeaBird flying plane namespace EngineeringService { //ITarget interface public interface IAircraft { bool Airborne {get;} void TakeOff(); int Height {get;} }... 阅读全文
posted @ 2012-05-14 20:34 ChaunceyHao 阅读(171) 评论(0) 推荐(0)
摘要: using System; // Adapter Pattern - Simple Judith Bishop Aug 2006 // Simplest adapter using interfaces and inheritance // Existing way requests are implemented class Adaptee { // Provide full precision public double SpecificRequest (double a, double b) { return a/b; } } // Required standard for ... 阅读全文
posted @ 2012-05-14 20:33 ChaunceyHao 阅读(157) 评论(0) 推荐(0)
摘要: using System; // Adapter Pattern - Pluggable Judith Bishop Aug 2006 // Adapter can accept any number of pluggable adaptees and targets // and route the requests via a delegate, in some cases using the // anonymous delegate construct // Existing way requests are implemented class Adaptee { public... 阅读全文
posted @ 2012-05-14 20:32 ChaunceyHao 阅读(169) 评论(0) 推荐(0)
摘要: using System;namespace Wrox.ProCSharp.Basics{ public enum TimeOfDay { Morning = 0, Afternoon = 1, Evening = 2 } class EnumExample { public static int Main() { WriteGreeting(TimeOfDay.Morning); return 0; } static void WriteGreeting(TimeOfDay timeOfDay) { switch(timeOfDay) { case TimeOfDa... 阅读全文
posted @ 2012-05-14 15:58 ChaunceyHao 阅读(106) 评论(0) 推荐(0)
摘要: using System;namespace Wrox.ProCSharp.Basics{ class MainEntryPoint { static void Main(string[] args) { Console.WriteLine("Type in a string"); string input; input = Console.ReadLine(); if (input == "") { Console.WriteLine("You typed in an empty string"); } else if (input 阅读全文
posted @ 2012-05-14 15:48 ChaunceyHao 阅读(131) 评论(0) 推荐(0)
摘要: using System;using Microsoft.Web.Administration;class Program{ static void Main(string[] args) { ServerManager mgr = new ServerManager(); ApplicationPool myAppPool = mgr.ApplicationPools.Add("MyAppPool"); myAppPool.AutoStart = true; myAppPool.Cpu.Action = ProcessorAction.KillW3wp; myAppPoo 阅读全文
posted @ 2012-05-14 15:46 ChaunceyHao 阅读(127) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 5 - Event-based Programming// File: PageCommand.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;namespace ControlsBookLib.Ch05{ public enum PageDirection { Left = 0, Right = 1 } public delegate void Pa 阅读全文
posted @ 2012-05-14 00:33 ChaunceyHao 阅读(134) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 5 - Event-based Programming// File: LifecycleControl.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;using System.Web.UI;using System.Collections.Specialized;using System.Diagnostics;namespace Controls 阅读全文
posted @ 2012-05-14 00:14 ChaunceyHao 阅读(136) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 6 - Control Styles// File: FancyLabel.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.ComponentModel;namespace Controls 阅读全文
posted @ 2012-05-13 23:43 ChaunceyHao 阅读(115) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 9 - Integrating Client-Side Script// File: PhoneValidator.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;using System.Web.UI;using System.Web.UI.WebControls;using System.Text.RegularExpressions;namesp 阅读全文
posted @ 2012-05-13 23:27 ChaunceyHao 阅读(241) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 5 - Event-based Programming// File: TextChanged.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;namespace ControlsBookLib.Ch05{ public delegate void TextChangedEventHandler(object o, TextChangedEventAr 阅读全文
posted @ 2012-05-13 23:24 ChaunceyHao 阅读(137) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 5 - Event-based Programming// File: CustomEventTextbox.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;using System.Web;using System.Web.UI;using System.Collections.Specialized;using System.ComponentMo 阅读全文
posted @ 2012-05-13 23:22 ChaunceyHao 阅读(101) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 5 - Event-based Programming// File: Pager.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;using System.ComponentModel;using System.Web.UI;using System.Web.UI.WebControls;using ControlsBookLib.Ch12.Desi 阅读全文
posted @ 2012-05-13 23:21 ChaunceyHao 阅读(138) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 4 - State Management// File: StatelessLabel.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;using System.Web.UI;using System.ComponentModel;namespace ControlsBookLib.Ch04{ [ToolboxData("<{0}:St 阅读全文
posted @ 2012-05-13 23:18 ChaunceyHao 阅读(112) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 4 - State Management// File: Textbox.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;using System.Web;using System.Web.UI;using System.Collections.Specialized;using System.ComponentModel;namespace Cont 阅读全文
posted @ 2012-05-13 23:15 ChaunceyHao 阅读(126) 评论(0) 推荐(0)
摘要: // Title: Building ASP.NET Server Controls//// Chapter: 4 - State Management// File: StatefulLabel.cs// Written by: Dale Michalk and Rob Cameron//// Copyright ?2003, Apress L.P.using System;using System.Web.UI;using System.ComponentModel;namespace ControlsBookLib.Ch04{ [ToolboxData("<{0}:Sta 阅读全文
posted @ 2012-05-13 23:13 ChaunceyHao 阅读(93) 评论(0) 推荐(0)
摘要: using System;using System.IO;using System.Collections.Generic;using System.Linq;using System.Data;using System.Data.SqlClient;using System.Text;using System.Xml.Linq;using System.Windows.Forms;using Microsoft.Win32;using PowerPoint = Microsoft.Office.Interop.PowerPoint;using Office = Microsoft.Offic 阅读全文
posted @ 2012-05-13 23:12 ChaunceyHao 阅读(171) 评论(0) 推荐(0)
摘要: using System;using System.IO;using System.Text;using System.Data;using System.Reflection;using System.Diagnostics;using System.Collections;//using cfg = System.Configuration; /// <summary> /// 说 明:Excel输出打印模块 /// 暂时不提供操作Excel对象样式方法,样式可以在Excel模板中设置好 /// </summary> public class ExcelHelper 阅读全文
posted @ 2012-05-11 23:04 ChaunceyHao 阅读(1069) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace FlyweightPattern { // Flyweight Pattern Judith Bishop Sept 07 // Defined for state which is images // IFlyweight Interface public interface IFlyweight { void Load (string filename); void Dis.. 阅读全文
posted @ 2012-05-11 17:23 ChaunceyHao 阅读(203) 评论(0) 推荐(0)
摘要: IKVM.NET(IKVM)是个面向.NET与Mono平台的JVM,用户可以通过它直接运行Java应用。近日,来自微软的Erik Meijer与IKVM创建者Jeroen Frijters讨论了该项目的几个方面。此次讨论的涉及面非常广,从IKVM的内核谈到了该项目的未来目标。其要点如下所示: Frijters从2002年该项目启动开始就作为项目的主开发者。此次讨论首先从Frijters介绍IKVM是如何成为Mono项目的一部分 (形成一种双赢的局面,两个项目可以彼此贡献补丁)开始。从架构上来说,IKVM在.NET上完全实现出了Java的内存模型。Frijters尝试尽量 不使用包装器,在某些情 阅读全文
posted @ 2012-05-11 17:01 ChaunceyHao 阅读(410) 评论(0) 推荐(0)
摘要: Google本月初发布了企业级大数据分析的云服务——BigQuery为正式付费产品,这是Google迈向企业级云计算领域的关键一步。BigQuery本质上是一个云平台基础服务PaaS,旨在实时处理TB级别的大数据,并提供UI界面和Rest API两种访问方式。 BigQuery的产品经理Ju-kay Kwek,在博客和采访中是这样评价自己的产品: BigQuery可以使得企业用户,在不需要投资任何软硬件的情况下,获得实时处理海量数据的能力,5个TB的数据可以在15秒返回结果。 BigQuery团队的工程师haberman,在Hack News社区发表评论: 从技术的角度,BigQuer... 阅读全文
posted @ 2012-05-11 17:01 ChaunceyHao 阅读(443) 评论(0) 推荐(0)
摘要: 现在已经出现了一个静态编译的Ruby变体,用于构建面向iOS设备的应用。该语言叫做RubyMotion,来自于HipByte的这门语言与工具链完全遵循Apple的App Store指导方针。为了做到这一点,他们不得不去掉了JIT编译器与解释器,这会导致一些Ruby开发者觉得非常受限制。 其工具支持非常弱。RubyMotion并没有任何IDE支持。HipByte希望开发者使用自己的文本编辑器与命令行终端来完成大多数开发任务。 运行时则要好很多。RubyMotion完全支持多线程编程而不会遇到全局解释器锁的不便。它甚至为Grand Central Dispatch(Apple 的用于并发与并行编程 阅读全文
posted @ 2012-05-11 16:44 ChaunceyHao 阅读(189) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using FlyweightPattern; // The Client class Client { // Shared state - the images static FlyweightFactory album = new FlyweightFactory(); // Unshared state - the groups static Dictionary <string,List 阅读全文
posted @ 2012-05-11 16:26 ChaunceyHao 阅读(125) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.Text; // for StringBuilder namespace CompositePattern { // The Interface public interface IComponent <T> { void Add(IComponent <T> c); IComponent <T> Remove(T s); string Display(int depth); IComponent <T> Find(T s); 阅读全文
posted @ 2012-05-11 16:24 ChaunceyHao 阅读(215) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.IO; using CompositePattern; // Composite Pattern Judith Bishop August 2007 // The pattern is generic, and an example is given for a real world client // The Client class CompositePatternExample { static void Main () { IComponent <string 阅读全文
posted @ 2012-05-11 16:23 ChaunceyHao 阅读(319) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; // Proxy Pattern Example Judith Bishop Aug 2007 // Sets up a SpaceBook page with registration and authentication class SpaceBookSystem { // The Subject private class SpaceBook { static SortedList <string,SpaceBook> community = new SortedList < 阅读全文
posted @ 2012-05-11 14:23 ChaunceyHao 阅读(159) 评论(0) 推荐(0)
摘要: using System; // Proxy Pattern Judith Bishop Dec 2006 // Shows virtual and protection proxies class SubjectAccessor { public interface ISubject { string Request (); } private class Subject { public string Request() { return "Subject Request " + "Choose left door\n"; } } public cl 阅读全文
posted @ 2012-05-11 14:23 ChaunceyHao 阅读(111) 评论(0) 推荐(0)
摘要: using System; //Decorator Pattern Judith Bishop Dec 2006 // Shows two decorators and the output of various // combinations of the decorators on the basic component interface IComponent { string Operation(); } class Component : IComponent { public string Operation () { return "I am walking " 阅读全文
posted @ 2012-05-11 14:15 ChaunceyHao 阅读(120) 评论(0) 推荐(0)
摘要: using System; using System.Reflection; using ObjectStructure; // Visitor Pattern - Example Judith Bishop October 2007 // Sets up an object structure and visits it // in two ways - for counting using reflection namespace ObjectStructure { class Element { public Element Next {get; set;} public Elem... 阅读全文
posted @ 2012-05-11 14:13 ChaunceyHao 阅读(137) 评论(0) 推荐(0)
摘要: using System; class BridgePattern { // Bridge Pattern Judith Bishop Dec 2006, Aug 2007 // Shows an abstraction and two implementations proceeding independently class Abstraction { Bridge bridge; public Abstraction (Bridge implementation) { bridge = implementation; } public string Operation () { re.. 阅读全文
posted @ 2012-05-10 17:29 ChaunceyHao 阅读(163) 评论(0) 推荐(0)
摘要: using System;using System.Collections.Generic; // Bridge Pattern Example Judith Bishop Dec 2006, Aug 2007 // Extending SpaceBook with a second implementation via a Portal // Abstraction class Portal { Bridge bridge; public Portal (Bridge aSpaceBook) { bridge = aSpaceBook; } public void Add(string... 阅读全文
posted @ 2012-05-10 17:28 ChaunceyHao 阅读(157) 评论(0) 推荐(0)
上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 72 下一页