What
Singleton:保证一个类仅有一个实例,并提供一个访问它的全局访问点。
Why
Singletion是我比较熟悉的设计模式之一,在平常的开发过程中,也曾几次用到,它主要适用于如下场景:
1、当类只能有一个实例而且客户可以从一个众所周知的访问点访问它时。
2、当这个唯一实例应该是通过子类可扩展的,并且客户应该无需更改代码就能使用一个扩展的实例时。
在系统...
分类:
其他好文 时间:
2014-08-14 23:54:36
阅读次数:
210
下面有一段html文档
Introduction to the DOM
There are a number of reasons why the DOM is awesome, here are some:
It can be found everywhere.
It's easy to use.
It can...
分类:
编程语言 时间:
2014-08-14 14:09:48
阅读次数:
148
Why is worldwide vogue a hugely cheap ghd hair straighteners a mode evergreen. Pendants: Bohemian ghd Straightener sale growth is hardly only about we...
分类:
其他好文 时间:
2014-08-12 16:18:24
阅读次数:
332
In this post, I’ll detail how to catch specific key presses and why this can be useful. This is another in my series of “requested” tutorials. There r...
分类:
编程语言 时间:
2014-08-11 02:46:11
阅读次数:
467
What
Prototype:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象。
Why
Prototype适用于在一个类的实例有几种不同的状态组合的一种时,建立相应的数目的原型并克隆她们,要比每次使用合适的状态创建它们方便一些,或者为了避免创建一个与产品类层次平行的工厂类层次时,要实例化一的类在运行时动态指定时。
How
假设如下场景:有一个复...
分类:
其他好文 时间:
2014-08-09 18:48:18
阅读次数:
235
Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.
Given a sequence a consisting of n integ...
分类:
其他好文 时间:
2014-08-09 11:42:48
阅读次数:
311
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the...
分类:
其他好文 时间:
2014-08-09 11:38:57
阅读次数:
147
Any class that manages a resource (awrapper, like a smart pointer) needs to implementThe Big Three. While the goals and implementation of the copy-con...
分类:
其他好文 时间:
2014-08-08 15:51:06
阅读次数:
262
当遇到一个新的知识时,可以通过what-why-how的方式去学习它,下面就通过这种方式去学习下数据库索引。
什么是数据库索引?
定义1:索引是对数据库表中一列或多列的值进行排序的一种结构,使用索引可快速访问数据库表中的特定信息。
定义2:索引是与表或视图关联的磁盘上结构,可以加快从表或视图中检索行的速度。索引包含由表或视图中的一列或多列生成的键。这些键存储在一个结构...
分类:
数据库 时间:
2014-08-05 14:08:49
阅读次数:
203
I want to detect where a MouseEvent has
occurred, in coordinates relative to the clicked element. Why? Because I want to add an absolutely positioned child element
at the clicked location.
I kn...
分类:
Web程序 时间:
2014-08-05 11:09:29
阅读次数:
293