- 博客(12)
- 资源 (3)
- 收藏
- 关注
原创 BeautifulSoup使用
#python2.7 #BeautifulSoup4.0 import urllib import urllib2 from urllib import urlopen from BeautifulSoup import BeautifulSoup from urllib2 import HTTPErrordef getTitle(url): try: html = urlo
2015-12-30 09:42:03 459
原创 命令模式
// ConsoleApplication19.cpp : Defines the entry point for the console application. // #include "stdafx.h" /* 是一个抽象类,类中对需要执行的命令进行声明, 一般来说要对外公布一个execute方法用来执行命令*/ class Command { public: virtual void
2015-12-23 08:33:08 378
原创 备忘录模式
// ConsoleApplication19.cpp : Defines the entry point for the console application. //#include "stdafx.h"//C++后面使用的类要先声明?/*负责存储GameRole对象的内部状态,并可防止GameRole以外的其他对象访问备忘录Memento。 备忘录有两个接口,Caretaker只能看见备忘录的
2015-12-21 13:05:07 491
原创 工厂方法
class Product { public: virtual void Show()=0; };class ProductA:public Product { public: void Show() { cout<<"SHowA"<<endl; } };class ProductB:public Product { public: void
2015-12-21 08:30:54 484
原创 C++(简单工厂)
// ConsoleApplication18.cpp : Defines the entry point for the console application. //#include "stdafx.h"typedef enum Type { TypeA, TypeB, TypeC, } ProductType;class Product { public: vo
2015-12-18 08:27:54 650
原创 固定管线shader以及unity旋转四元数
Shader "Custom/fg" { Properties { _Color("Main Color", Color) = (1,1,1,1) _Ambient("Ambient",Color) = (1,1,1,1) _Specular("Specular",Color) = (1,1,1,1) _emmision("Emi
2015-12-10 23:24:20 900
原创 unity 延时调用方法
using UnityEngine; using System.Collections; using System.Collections.Generic; /// /// 使用Time.time控制时间间隔调用方法 /// public class ProcessControl { static System.Action _action; static float
2015-12-10 13:04:05 1773
原创 深入理解C#(一)
深入理解C# 1. list排序以及搜索 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication16 { public class Pro
2015-12-09 17:29:35 677
原创 模板方法
定义一个操作中的算法的骨架,而将一些步骤延迟到子类中。因此模板方法使得子类可以在不改变一个算法的结构的情况下重新定义该算法的某些特定变量。优点:把不变行为搬移到超类,去除子类中的重复代码。 C#实现 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System
2015-12-09 08:40:47 305
原创 观察者模式
双向耦合的例子class Subject { private List<Observer> observerList = new List<Observer>(); private string notifyContent; public void AddObserver(Observer o) { obse
2015-12-04 11:12:48 522
原创 重构之函数提取
Extract Method (提炼函数) public void AddFriendInfo(ulong dbid) { FriendData item = CFriendDataClass.instance.CurFriends[dbid]; if (item.onLine == 1) { GameObject go = N
2015-12-03 08:15:18 839
原创 状态模式
《重构》一书中第一章的例子中,讲到了用状态模式代替分支语句的判断。觉得有必要复习一下状态模式,状态模式解决的是当控制一个对象状态转换的条件表达式过于复杂的情况。把状态的逻辑判断转移到表示不同状态的一系列类中,可以把复杂的判断逻辑简单化。当一个对象的行为取决于它的状态,并且必须在运行时根据状态改变它的行为时,就可以考虑使用状态模式。 using System; using System.Colle
2015-12-01 08:45:03 484
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人