Facade设计模式主要作用是因为有个很难使用的类,然后要设计一个新类,整理好这个类,使得其更好使用。
比如有类如此:
class MessyClass
{
char *name;
public:
MessyClass() : name(new char[3])
{
for (int i = 0; i < 3; i++)
{
name[i] = ' ';
}
}
...
分类:
其他好文 时间:
2014-06-20 13:11:10
阅读次数:
232
一、如果是每个线程都执行相同的代码,则可以使用同一个Runnable来实现共享public class MultiThreadShareData {
public static void main(String[] args) {
new Thread(new ShareData()).start();
new Thread(new ShareData()).start();
}
...
分类:
移动开发 时间:
2014-06-20 13:07:10
阅读次数:
260
Python的多线程有两种实现方法:
函数,线程类
1.函数:调用thread模块中的start_new_thread()函数来创建线程,以线程函数的形式告诉线程该做什么
2.线程类:调用threading模块,创建threading.Thread的子类来得到自定义线程类。
def f(name):
#定义线程函数
print "this is " + name...
分类:
编程语言 时间:
2014-06-20 12:05:41
阅读次数:
287
K-Nearest Neighbors
The algorithm caches all training samples and predicts the response for a new sample by analyzing a certain number (K) of the nearest neighbors of the sample using voting, calcu...
分类:
其他好文 时间:
2014-06-20 11:51:33
阅读次数:
337
1.expected identifier before numeric constant
一般情况下是枚举类型中的某个变量已经被#define定义过一次了,在项目空间中搜索你枚举类型中的所有变量类型,看看是否被#define过,如果被#define过,就把#define的删除或换个名字。
分类:
其他好文 时间:
2014-06-13 14:15:10
阅读次数:
201
JAVA线程 工作内存 主内存java内存模型中的八种操作:lock unlock read load
use assign store write八种基本操作必须满足的规则volatile当一个变量被定义成volatile之后,它将具备两种特性
一是保证此变量对所有线程的...
分类:
编程语言 时间:
2014-06-13 13:22:55
阅读次数:
294
题目——求两个整数的最大公约数
思路1、穷举算法
public static voidmain(String[] args) throws IOException {
Scannerscanner = new Scanner(System.in);
inta = scanner.nextInt();
intb = scanner.nextInt();
System.out.println(...
分类:
其他好文 时间:
2014-06-07 16:27:13
阅读次数:
253
function Class() {
this.name = "className";//全局变量
var propert = "class";//私有变量
this.add=function() {//定义的公用方法
alert(propert);
}
}
//初始化js对象
var class = new Class();
function Class2 () {...
分类:
编程语言 时间:
2014-06-07 14:35:05
阅读次数:
219
在做根据日期来检索的时候普通的格式化会出错,试了好多种只有一种可行
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
String time = "lostTime:["+sdf.format(new Date())+" TO "+sdf.format(new Date())+"]";...
分类:
其他好文 时间:
2014-06-07 12:48:43
阅读次数:
256
Saving HDU
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 31 Accepted Submission(s) : 15
Font: Times New Roman | Verdana | Georgia
Font Si...
分类:
其他好文 时间:
2014-06-07 12:28:15
阅读次数:
334