简单工厂模式(Simple Factory Pattern)属于创建型模式,又叫做静态工厂方法模式(Static FactoryMethod Pattern),但是不属于23GOF设计模式之一。简单工厂模式是由一个工厂对象决定创建出哪一种产品类的实例。
走别人的的路,不如自己 to do (不如的意思是更)。先敲书上的例子,第一遍也许不懂,第二遍就清晰很多,第三遍就觉得自己能写点东西出来。不要总是觉得自己看不懂,学不好,只有先学了才能更好。没有之前的8个馒头,就没有第9个馒头的饱(好撑啊~~)...
分类:
其他好文 时间:
2014-05-26 05:51:44
阅读次数:
224
【题目】
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
【题意】
给定一个nXn的二维矩阵,按时钟方向旋转90度,不能使用额外的数据结构
【思路】
从外向内逐层旋转...
分类:
其他好文 时间:
2014-05-26 05:50:25
阅读次数:
266
Agri-NetTime Limit: 1000MSMemory Limit:
10000KTotal Submissions: 37109Accepted: 14982DescriptionFarmer John has been
elected mayor of his town! One of...
分类:
其他好文 时间:
2014-05-26 02:40:43
阅读次数:
236
后退+刷新在C#
Web程序中,如为页面按钮写返回上一页代码this.RegisterClientScriptBlock("E",
"");其中,history.go(-2),要写为-2,因在按钮事件触发前,已刷新一次页面,所以应是-2。Response.Write("");此处也要写为“-2”。....
分类:
编程语言 时间:
2014-05-26 02:24:07
阅读次数:
383
I/O是input/output的缩写,即输入输出端口。从 文件、键盘、网络
等输入到java程序,再从java程序输出到 文件、显示器、网络等分类:1、输入流 和 输出流2、字节流 和 字符流3、节点流 和
处理流核心方法:read、write字节流例子:文件读取//导入io包import jav...
分类:
编程语言 时间:
2014-05-26 02:16:11
阅读次数:
313
题目如下:
Problem D: Hartals
A social research organization has determined a simple set of parameters to simulate the behavior of the political parties of our country. One of the ...
分类:
其他好文 时间:
2014-05-24 23:10:01
阅读次数:
317
【题目】
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] has the largest sum = 6.
【题意】
给定一个数组,找出和最大的子数组,返回...
分类:
其他好文 时间:
2014-05-24 22:19:17
阅读次数:
260
socket模型:
1、阻塞模型
一个单进程accept阻塞,接收到客户端请求后,read消息,处理write返回,然后循环继续accept。
这种模型最最简单,不实际,没什么实际用途,对于新手教学还行。
2、多进程(线程)模型
主进程循环accept阻塞,接收到客户端请求后,fork子进程处理,子进程read阻塞,接收客户端消息并响应。
这种模型是我使用到...
分类:
其他好文 时间:
2014-05-24 19:50:08
阅读次数:
274
1.gemFile
在rails 4 之后没有grop 了 要记得哦
# group :assets do
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
# end
# 页面渲染
gem 'jquery-rails' #这个
gem 'exe...
分类:
Web程序 时间:
2014-05-24 18:00:06
阅读次数:
435
A bit is a binary digit, taking a logical value of either 1 or 0 (also referred to as "true" or "false" respectively). And every decimal number has a binary representation which is actually a series o...
分类:
其他好文 时间:
2014-05-24 17:19:41
阅读次数:
335