<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[Happy in Code]]></title><description><![CDATA[夜深人静之时，头发斑白的老程序员会蜷缩在床上，欣赏一段精彩的子程序，或者苦思冥想一个绝妙的宏结构；而那些年少轻狂的程序员，则可能正在通过终端与别人聊得不亦乐乎。]]></description><link>https://blog.csdn.net/hardwin</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; hardwin]]></copyright><item><title><![CDATA[Java设计模式（十一）：外观模式（门面模式）Facade]]></title><link>https://blog.csdn.net/hardwin/article/details/51557869</link><guid>https://blog.csdn.net/hardwin/article/details/51557869</guid><author>hardwin</author><pubDate>Wed, 01 Jun 2016 18:00:52 +0800</pubDate><description><![CDATA[1.概念
为子系统中的一组接口提供一个统一接口。Facade模式定义了一个高层接口，这个接口使得这子系统更容易使用。



2.UML







3.代码

下面是一个具体案例的代码：
package com.iter.devbox.facade;

/**
 * 子系统角色中的类
 * @author Shearer
 *
 */
public class M]]></description><category></category></item><item><title><![CDATA[Java设计模式（十）：装饰者模式Decorator]]></title><link>https://blog.csdn.net/hardwin/article/details/51557757</link><guid>https://blog.csdn.net/hardwin/article/details/51557757</guid><author>hardwin</author><pubDate>Wed, 01 Jun 2016 17:53:07 +0800</pubDate><description><![CDATA[装饰者模式：动态地将责任附加到对象上，若要扩展对象，装饰者模式提供了比继承更弹性的替代方案

要点： 装饰者与被装饰者拥有共同的超类，继承的目的是继承类型，而不是行为
装饰者包含一个超类的对象，这样，可以在被装饰者行为前或者行为后加上新的行为，甚至取代原有的行为

装饰者会使程序中出现很多小类，增加使用难度

使用场景：对象由主体+许多可选的部件或者功能构成，使用继承或者接口会产生很]]></description><category></category></item><item><title><![CDATA[Java设计模式（九）：组合模式composite]]></title><link>https://blog.csdn.net/hardwin/article/details/51531524</link><guid>https://blog.csdn.net/hardwin/article/details/51531524</guid><author>hardwin</author><pubDate>Sun, 29 May 2016 13:32:00 +0800</pubDate><description><![CDATA[package com.iter.devbox.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * 抽象构件
 * @author Shearer
 *
 */
public interface AbstractFile {
	void killVirus();  //杀毒
}
class ImageFile]]></description><category></category></item><item><title><![CDATA[Java设计模式（八）：桥接模式bridge]]></title><link>https://blog.csdn.net/hardwin/article/details/51527254</link><guid>https://blog.csdn.net/hardwin/article/details/51527254</guid><author>hardwin</author><pubDate>Sat, 28 May 2016 23:06:37 +0800</pubDate><description><![CDATA[桥接模式核心要点：
处理多层继承结构，处理多维度变化的场景，将各个维度设计成独立的继承结构，使各个维度可以独立的扩展在抽象层建立关联。


假设现在有这样的分类：电脑 ---  联想电脑，戴尔电脑，神州电脑 --- 台式机，笔记本 --- 联想台式机，联想笔记本
如果用继承的关系，类会特别多，增加品牌或者电脑类型也不好扩展。
于是我们把它用三个维度划分。电脑 --- 品牌 --- 类型]]></description><category></category></item><item><title><![CDATA[Java设计模式（七）：代理模式Proxy（静态代理模式+动态代理模式）]]></title><link>https://blog.csdn.net/hardwin/article/details/51519879</link><guid>https://blog.csdn.net/hardwin/article/details/51519879</guid><author>hardwin</author><pubDate>Fri, 27 May 2016 21:53:19 +0800</pubDate><description><![CDATA[静态代理




package com.iter.devbox.staticProxy;

public interface Star {
	
	public void sing();

}

package com.iter.devbox.staticProxy;

public class RealStar implements Star {

	@Override
	publi]]></description><category></category></item><item><title><![CDATA[Java设计模式（六）：适配器模式Adapter]]></title><link>https://blog.csdn.net/hardwin/article/details/51519093</link><guid>https://blog.csdn.net/hardwin/article/details/51519093</guid><author>hardwin</author><pubDate>Fri, 27 May 2016 19:40:40 +0800</pubDate><description><![CDATA[什么是适配器模式？

  将一个类的接口转换为客户希望的另外一个接口。Adapter模式使得原本由于接口不兼容而不能一起工作的那些类可以在一起工作。




模式中的角色



目标接口(Target)：客户所期待的接口。目标可以是具体的或抽象的类，也可以是接口。需要适配的类(Adaptee)：需要适配的类或适配者类。适配器(Adapter)：通过包装一个需要适配的对象，把原]]></description><category></category></item><item><title><![CDATA[Java设计模式（五）：建造者模式Builder]]></title><link>https://blog.csdn.net/hardwin/article/details/51518805</link><guid>https://blog.csdn.net/hardwin/article/details/51518805</guid><author>hardwin</author><pubDate>Fri, 27 May 2016 19:04:16 +0800</pubDate><description><![CDATA[场景


我们要建造一个复杂的产品。比如：神舟飞船、iphone。这个复杂的产品的创建，有这样一个问题需要处理：




装配这些子组件是不是有个步骤问题？

实际开发中，我们所需要的对象构建时，也非常复杂，有很多步骤需要处理时。




建造者模式的本质




分离了对象子组件的单独构建（由Builder来负责）和装配（由Director）来负责。从而可]]></description><category></category></item><item><title><![CDATA[Java设计模式（四）：原型模式深拷贝的两种实现方式，以及和new对象的性能测试对比]]></title><link>https://blog.csdn.net/hardwin/article/details/51509197</link><guid>https://blog.csdn.net/hardwin/article/details/51509197</guid><author>hardwin</author><pubDate>Thu, 26 May 2016 17:44:13 +0800</pubDate><description><![CDATA[如果需要短时间创建大量对象，并且new的过程比较耗时，则可以考虑使用原型模式。
而采用clone的方式，相比序列号的方式，更高效。只不过，如果类中有成员变量是引用类型，也要一起进行clone！]]></description><category></category></item><item><title><![CDATA[Java设计模式（四）：原型模式Prototype]]></title><link>https://blog.csdn.net/hardwin/article/details/51502654</link><guid>https://blog.csdn.net/hardwin/article/details/51502654</guid><author>hardwin</author><pubDate>Wed, 25 May 2016 22:45:13 +0800</pubDate><description><![CDATA[原型模式是一种创建型设计模式,它通过复制一个已经存在的实例来返回新的实例,而不是新建实例.被复制的实例就是我们所称的原型,这个原型是可定制的.
原型模式多用于创建复杂的或者耗时的实例, 因为这种情况下,复制一个已经存在的实例可以使程序运行更高效,或者创建值相等,只是命名不一样的同类数据.

原型模式中的拷贝分为"浅拷贝"和"深拷贝":
浅拷贝: 对值类型的成员变量进行值的复制,对引用类型的]]></description><category></category></item><item><title><![CDATA[Java设计模式（三）：工厂模式（简单工厂模式、工厂方法模式、抽象工厂模式）]]></title><link>https://blog.csdn.net/hardwin/article/details/51483349</link><guid>https://blog.csdn.net/hardwin/article/details/51483349</guid><author>hardwin</author><pubDate>Mon, 23 May 2016 17:39:46 +0800</pubDate><description><![CDATA[简单工厂模式
package com.iter.devbox.factory.simplefactory;

public interface Car {
	public void run();
}

package com.iter.devbox.factory.simplefactory;

public class Audi implements Car {
	public void ru]]></description><category></category></item><item><title><![CDATA[Java设计模式（二）：单例模式的5种实现方式，以及在多线程环境下5种创建单例模式的效率]]></title><link>https://blog.csdn.net/hardwin/article/details/51480608</link><guid>https://blog.csdn.net/hardwin/article/details/51480608</guid><author>hardwin</author><pubDate>Mon, 23 May 2016 12:14:59 +0800</pubDate><description><![CDATA[这段时间从头温习设计模式。记载下来，以便自己复习，也分享给大家。


package com.iter.devbox.singleton;

/**
 * 饿汉式
 * @author Shearer
 *
 */
public class SingletonDemo1 {
	
	// 类的静态成员变量只初始化一次，天然是线程安全的
	private static final Singlet]]></description><category></category></item><item><title><![CDATA[Java设计模式（一）：单例模式，防止反射和反序列化漏洞]]></title><link>https://blog.csdn.net/hardwin/article/details/51477359</link><guid>https://blog.csdn.net/hardwin/article/details/51477359</guid><author>hardwin</author><pubDate>Sun, 22 May 2016 22:49:18 +0800</pubDate><description><![CDATA[一、懒汉式单例模式，解决反射和反序列化漏洞
package com.iter.devbox.singleton;

import java.io.ObjectStreamException;
import java.io.Serializable;

/**
 * 懒汉式（如何防止反射和反序列化漏洞）
 * @author Shearer
 *
 */
public class Singleto]]></description><category></category></item><item><title><![CDATA[CentOS7安装iptables防火墙]]></title><link>https://blog.csdn.net/hardwin/article/details/51298307</link><guid>https://blog.csdn.net/hardwin/article/details/51298307</guid><author>hardwin</author><pubDate>Mon, 02 May 2016 21:07:41 +0800</pubDate><description><![CDATA[CentOS7默认的防火墙不是iptables,而是firewalle.


安装iptable iptable-service



#先检查是否安装了iptables
service iptables status


#安装iptables
yum install -y iptables


#升级iptables
yum update iptables]]></description><category></category></item><item><title><![CDATA[zookeeper集群的搭建]]></title><link>https://blog.csdn.net/hardwin/article/details/51298250</link><guid>https://blog.csdn.net/hardwin/article/details/51298250</guid><author>hardwin</author><pubDate>Mon, 02 May 2016 20:53:34 +0800</pubDate><description><![CDATA[zookeeper版本：  
Release 3.4.8(stable)操作系统：  
[root@lena101 zookeeper]# cat /etc/redhat-release  
CentOS Linux release 7.1.1503 (Core) 我用的是三台虚拟机。查看IP地址： 
[root@lena101 zookeeper]# hostname -i三台虚拟机IP地址：]]></description><category></category></item><item><title><![CDATA[11 Rules All Programmers Should Live By]]></title><link>https://blog.csdn.net/hardwin/article/details/45668757</link><guid>https://blog.csdn.net/hardwin/article/details/45668757</guid><author>hardwin</author><pubDate>Tue, 12 May 2015 14:02:34 +0800</pubDate><description><![CDATA[From： http://simpleprogrammer.com/2015/03/16/11-rules-all-programmers-should-live-by/



I am a person who tends to live by rules.
Now granted, they are mostly rules I set for myself—but they are]]></description><category></category></item><item><title><![CDATA[Learning how to learn: How to teach yourself。]]></title><link>https://blog.csdn.net/hardwin/article/details/45667287</link><guid>https://blog.csdn.net/hardwin/article/details/45667287</guid><author>hardwin</author><pubDate>Tue, 12 May 2015 11:30:01 +0800</pubDate><description><![CDATA[Learning how to learn: How to teach yourself。


10-step process：


Steps 1–6: Do these once


Step 1: Get the big picture


Step 2: Determine scope


Step 3: Define success


Step 4:]]></description><category></category></item><item><title><![CDATA[不自信的人，总是憧憬别人]]></title><link>https://blog.csdn.net/hardwin/article/details/32984167</link><guid>https://blog.csdn.net/hardwin/article/details/32984167</guid><author>hardwin</author><pubDate>Sat, 21 Jun 2014 22:17:21 +0800</pubDate><description><![CDATA[看见一人的QQ签名是：
独步天下，吾心自洁，]]></description><category></category></item><item><title><![CDATA[2014年，珍惜时间、好好把握！]]></title><link>https://blog.csdn.net/hardwin/article/details/20480501</link><guid>https://blog.csdn.net/hardwin/article/details/20480501</guid><author>hardwin</author><pubDate>Tue, 04 Mar 2014 19:52:46 +0800</pubDate><description><![CDATA[今年是很重要的一年。之前经历了从java编程转C++游戏编程，去年因为个人朋友关系，又回到java的阵营。够折腾的！
都是做技术。没有本质的区别。虽然工作离开了C++，喜欢的话，业余时间依然可以研究C++。人总该除了工作之外，有些别的非做不可的事（因为爱好）。
磨练耐心。
再棘手的问题，多查阅与研究，总有解决的办法。
java领域的各种框架也好，工具也好，会使用是初级程序员的级别。作为想做]]></description><category></category></item><item><title><![CDATA[primefaces4 翻页时更新分页footer，totalRecords的更新]]></title><link>https://blog.csdn.net/hardwin/article/details/20480109</link><guid>https://blog.csdn.net/hardwin/article/details/20480109</guid><author>hardwin</author><pubDate>Tue, 04 Mar 2014 19:38:01 +0800</pubDate><description><![CDATA[datatable 分页时发现，两个浏览器，其中一个添加数据后，另外那个翻到另一页，表格的内容变了，新增的数据有显示，但是总记录数没有更新，以致总页数不会更新。
找了一天，才找到解决办法。


			<p:dataTable var="recipe" value="#{recipeBean.model}"
				filterEvent="enter" rowKey="#{recipe.i]]></description><category></category></item><item><title><![CDATA[JSF + Primefaces表单验证]]></title><link>https://blog.csdn.net/hardwin/article/details/17584345</link><guid>https://blog.csdn.net/hardwin/article/details/17584345</guid><author>hardwin</author><pubDate>Thu, 26 Dec 2013 15:35:59 +0800</pubDate><description><![CDATA[正则表达式匹配为空或者正整数：   
^([0-9]{1}|[1-9]{1}[0-9]{0,}|)$


如果是表单做了值绑定，最好是绑定的字符串类型，否则可能被转化器将空字符串以null返回。
		<p:dialog header="广告修改" widgetVar="updateDlg" resizable="true"
			height="400" width="600" show]]></description><category></category></item></channel></rss>