2013年4月21日

观察者模式

摘要: 1 #include <iostream> 2 #include <list> 3 #include <string> 4 using namespace std; 5 6 class Observer; 7 class Subject; 8 9 class Observer10 {11 public:12 virtual void update(Subject *) = 0;13 };14 15 class Subject16 {17 public:18 virtual void registerObserver(Observer *) = 0;19 vi 阅读全文

posted @ 2013-04-21 01:29 I AM A JOKER 阅读(183) 评论(0) 推荐(0)

2013年4月12日

DES加密

摘要: DES加密解释见qq空间http://user.qzone.qq.com/240011742/infocenter#!app=2&via=QZ.HashRefresh&pos=1365766516这里只给出代码(STL版本): 1 //des.h 2 #pragma once 3 #include <bitset> 4 #include <iostream> 5 6 const int ip[] = { 7 58, 50, 42, 34, 26, 18, 10, 2, 8 60, 52, 44, 36, 28, 20, 12, 4, 9 62,... 阅读全文

posted @ 2013-04-12 19:34 I AM A JOKER 阅读(207) 评论(0) 推荐(0)

2013年4月10日

半路出家学Python

摘要: 1.计时器模块 1 #!/usr/bin/env python3 2 #encoding=cp936 3 4 import time, sys 5 trace = lambda *args: None 6 timefunc = time.clock if sys.platform == "win32" else time.time 7 8 def timer(func, *pargs, _reps=1000, **kargs): 9 trace(func, pargs, kargs, _reps)10 start = timefunc()11 for i in ra... 阅读全文

posted @ 2013-04-10 22:54 I AM A JOKER 阅读(165) 评论(0) 推荐(0)

导航