- 博客(143)
- 问答 (2)
- 收藏
- 关注
原创 反射实现 AOP 动态代理模式(Spring AOP 的实现 原理)
好长时间没有用过Spring了. 突然拿起书.我都发现自己对AOP都不熟悉了.其实AOP的意思就是面向切面编程.OO注重的是我们解决问题的方法(封装成Method),而AOP注重的是许多解决解决问题的方法中的共同点,是对OO思想的一种补充!还是拿人家经常举的一个例子讲解一下吧:比如说,我们现在要开发的一个应用里面有很多的业务方法,但是,我们现在要对这个方法的执行做全面监控,或部分监控.也许我们就会...
2009-06-09 13:52:01
195
原创 Resin 3 LOG 设置
<stdout-log path='${resin.home}/log/stdout.log'archive-format="stdout-%Y_%m_%d.log"rollover-period='1D'rollover-size='1mb'/><stderr-log path='${resin.home}/log/stderr.log'archive-format="stde...
2009-06-04 11:51:22
193
原创 Servlet和ThreadLocal的测试
作者:中国IT实验室 来源:中国IT实验室 public class TestThreadServlet extends HttpServlet { private static ThreadLocal thread = new ThreadLocal(); private int flag = 0; public void doG...
2009-05-27 15:30:56
220
原创 技巧:利于ThreadLocal模式管理Session
作者:dxaw 来源:赛迪网 在利用Hibernate开发DAO模块时,我们和Session打的交道最多,所以如何合理的管理Session,避免Session的频繁创建和销毁,对于提高系统的性能来说是非常重要的,以往是通过eclipse的插件来自动完成这些代码的,当然效果是不错的,但是总是觉得不爽(没有读懂那些冗长的代码),所以现在打算自己实现Session管理的代码。 我们知道Ses...
2009-05-27 15:28:48
175
原创 运用Filter,ThreadLocal和Reflection,实现form到bean的填充
开发者在线 Builder.com.cn 更新时间:2008-02-28作者:Nurhachi Jang 来源:优快云做过web开发的人可能都有这种感觉,不时的需要从request中提取参数及数据,如果有一种方式可以省却这一步骤,是否会令你的开发工作更愉悦呢?本文在此做了如下的探讨。很显然,从request中提取参数需要一个尽职尽责的,但是又很优雅的让我们感觉不到它的辛苦工作的模块来实现,它...
2009-05-27 15:27:18
156
原创 通通透透理解ThreadLocal
开发者在线 Builder.com.cn 更新时间:2007-05-29作者:闹市孤僧 来源:概述我们知道Spring通过各种DAO模板类降低了开发者使用各种数据持久技术的难度。这些模板类都是线程安全的,也就是说,多个DAO可以复用同一个模板实例而不会发生冲突。我们使用模板类访问底层数据,根据持久化技术的不同,模板类需要绑定数据连接或会话的资源。但这些资源本身是非线程安全的,也就是说它...
2009-05-27 15:24:31
166
原创 centos 5.2中安装LAMP
wget至以下目录:/tmp----------------------网站如下:http://www.apache.orghttp://www.php.nethttp://www.mysql.comhttp://www.shanghuo.net/?action=show&id=241http://blog.chinaunix.net/u/249/showart...
2009-05-22 14:52:52
180
原创 基于CentOS的LAMP
基于CentOS的LAMP 作者:NetSeek 大纲:一、系统安装二、编译安装基本环境三、配置虚拟主机及基本性能调优四、基本安全设置五、附录及相关介绍一、系统安装1. 分区 /boot 100M左右 SWAP 物理内存的2倍(如果你的物理内存大于4G以上,分配4G即可) / 15G ...
2009-05-22 14:50:23
158
原创 http header详解
HTTP(HyperTextTransferProtocol)是超文本传输协议的缩写,它用于传送WWW方式的数据,关于HTTP协议的详细内容请参考RFC2616。HTTP协议采用了请求/响应模型。客户端向服务器发送一个请求,请求头包含请求的方法、URI、协议版本、以及包含请求修饰符、客户信息和内容的类似于MIME的消息结构。服务器以一个状态行作为响应,相应的内容包括消息协议的版本,成功或者错误...
2009-01-19 12:19:56
116
junit实现测试类(在Spring2.5中)
第一步:创建JAVA项目,也可以是Web项目,加入Spring2.5的Core Lib 创建注入类(测试用) 修改applicationContext.xml文件 内容如下: 注入类:package nell;public class Animal { private String one; private String twe; public String get...
2009-01-17 15:14:54
162
HttpClient Examples:Custom protocol interceptors
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Custom protocol interceptors This example shows the use of protocol interceptors to transparently modify properties of HTTP messages se...
2009-01-15 14:06:11
130
HttpClient Examples:Custom SSL context
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Custom SSL context This example demonstrates how to create secure connections with a custom SSL context. 自定义SSL内容 这个例子示范怎样用自定义SSL内容...
2009-01-15 13:58:03
239
HttpClient Examples:Threaded request execution
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Threaded request execution An example that executes HTTP requests from multiple worker threads. 线程请求执行 一个多线程程执行HTTP请求的例子。 package...
2009-01-15 13:54:35
166
HttpClient Examples:Form based logon
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Form based logon This example demonstrates how HttpClient can be used to perform form-based logon. 基于表单登录这个例子示范怎样的HttpClient被用于执行基于表...
2009-01-15 13:49:47
140
HttpClient Examples:Custom execution context
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Custom execution context This example demonstrates the use of a local HTTP context populated custom attributes. 自定义执行内容这个实例示范用用户自定义本...
2009-01-15 13:46:06
144
HttpClient Examples:Chunk encoded POST
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Chunk encoded POST This example shows how to stream out a request entity using chunk encoding. 块编码POST 这个例子显示怎样用块编码请求对象过来的流(流是输入输出流...
2009-01-15 12:36:25
509
HttpClient Examples:Proxy authentication
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Proxy authenticationA simple example showing execution of an HTTP request over a secure connection tunneled through an authenticating p...
2009-01-15 12:26:20
201
HttpClient Examples:Request via a proxy
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Request via a proxy This example demonstrates how to send an HTTP request via a proxy. 请求通过一个代理 这个例子示范怎样去发送一个HTTP请求通过一个代理 package...
2009-01-15 12:19:12
278
HttpClient Examples:Client authentication
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Client authenticationThis example uses HttpClient to execute an HTTP request against a target site that requires user authentication. ...
2009-01-15 12:14:12
127
HttpClient Examples:Abort method
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Abort method This example demonstrates how to abort an HTTP request before its normal completion. 中止方法这个实例示范怎样中止一个HTTP请求在正常完成前。 pa...
2009-01-15 12:06:05
300
HttpClient Examples:Manual connection release
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Manual connection releaseThis example demonstrates how to ensure the release of the underlying HTTP connection back to the connection m...
2009-01-15 11:54:14
134
HttpClient Examples:Response handling
官方主頁:http://hc.apache.org/ ComponentsHttpCore HttpClient Response handling This example demonstrates how to process HTTP responses using a response handler. This is the recommended way of exec...
2009-01-15 11:44:42
118
原创 使用commons-codec包加密字符串(MD5,SHA1,BASE64)
commons-codec包可以从apache下载,最新版是1.3不可逆算法1.MD5String str = "abc";DigestUtils.md5Hex(str);附.net生成MD5的方法,生成内容跟java一致:String str = "abc";FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5...
2009-01-13 13:56:37
165
原创 Java对称加密编码:BESA64
package cn.lake.util;import sun.misc.BASE64Decoder;/** * Java对称加密编码:BESA64 * * @author lake_xie * */public class B64Demo { public B64Demo() { } // 将 s 进行 BASE64 编码 public static Strin...
2009-01-13 10:58:50
248
原创 Java对称加密编码:IDEA
package cn.lake.util;/** * Java对称加密编码:IDEA * * @author lake_xie * */class IDEADemo { /* 源数据 */ private byte m_string[]; /* 目标数据 */ private byte c_string[]; /* 密钥 */ private byte k_str...
2009-01-13 10:55:48
161
原创 Java调用Linux命令
Java可以直接调用Linux命令,形式如下: Runtime.getRuntime().exec(command) 举例:运行ls,top命令可以这样: Runtime.getRuntime().exec("ls"); 但是这样执行时没有任何输出,原因: 调用Runtime.exec方法将产生一个本地的进程,并返回一个Process子类的实例,(注意:Runtime.getRu...
2009-01-13 10:47:41
406
原创 刷新本页与父页的两条代码
window.location.reload(); //本页 window.opener.location.reload(); //父页
2009-01-13 10:46:12
97
原创 用java获得你电脑中的cpu数量
System.out.println("你的电脑cpu数量为:"+Runtime.getRuntime().availableProcessors()); 簡簡單單!
2009-01-13 10:41:49
504
Linux下MySQL的启动与停止
一:停止:# mysqladmin -r root -p123456 shutdown其中用户是root,密码是123456二:启动:假设我们不知是启动还是停止先查看状态:# /etc/rc.d/init.d/mysql status如果显示[FAILED]说明是停止的我们来启动:#service mysql start 自动启动 1)察看mysql是否在自动启动列表中 ...
2008-12-19 23:58:12
197
原创 配置SSH密钥证书服务器
目前有一台服务器LINUX系统,采用SSH登陆,没有启动密钥证书服务,为了安全,现在想在服务器上启用密钥证书服务问题可能在SSH配置文件中有问题?配置如下,一、生成密钥#ssh-keygen -b 1024 -t dsaGenerating public/private dsa key pair.Enter file in which to save the key (/root/.ssh/id_...
2008-12-19 12:18:37
270
原创 iftop 查看你的网卡流量
我用的是RHEL5U1 ,需要安装 byacc 和flex这2个包rpm -ivh byacc-1.9-29.2.2.i386.rpmrpm -ivh flex-2.5.4a-41.fc6.i386.rpm 另外还需要libpcapwget ftp://ftp.lmd.ens.fr/pub/devil/devel/sources/1.2/libpcap-0.9.8.tar.gztar ...
2008-12-19 12:18:03
210
原创 linux查看网口流量的脚本
通过本脚本,发现bash确实在算术运算方面比老的shell要强大,为此需要开始学习bash,以利用它强大的功能。不过bash中的for语句功能和c中差异比较大。# cat stream #! /bin/bash# Write by Neil.xu qq:37391319 email: xurongzhong@gmail.com# 2008-8-19 we need to monitor stre...
2008-12-19 12:16:51
254
原创 MySQL Master-Master Replication Manager
DescriptionMMM (MySQL Master-Master Replication Manager) is set of flexible scripts to perform monitoring and management of MySQL Masrter-Master replication cluster configurations.VersionsCurrent ...
2008-12-19 12:12:05
198
原创 apache 压力测试
1.apache安装 下载: 从Apache官方网站http://httpd.apache.org/download.cgi下载httpd-2.0.58.tar.gz。 安装: 先解压缩tar文件 tar -zxvf httpd-2.0.58.tar.gz ./configure --prefix=/usr/local/apache2test --enable-so -...
2008-12-19 12:08:13
268
原创 [爱情] 女友跟人跑了,网友安慰楼主..
转贴 [爱情] 女友跟人跑了,网友安慰楼主..我和我老婆是大学里认识的,大2的时候,我们在同一个学院,故事很平常,朋友租房子我去帮忙抬东西,朋友的朋友也去帮忙,这样我就认识了朋友的朋友,也就是老婆。大学的生活很快,日子过去。我是个穷人,家里没有钱,父母以前是工人,现在下岗了在外打工,虽然穷,但是日子过得很快乐,我和老婆也是一样,最让她感动的是2003年我节约钱给她买了她很喜欢的那双 NIKE的...
2008-12-19 11:49:37
169
原创 MySQL 压力测试工具super smack
refers to:http://blog.chinaunix.net/u/504/showart_1108476.html1. 源:http://vegan.net/tony/supersmack/ 2. 安装: 注意在编译时,可以先把对应的libmysqlclient.so.*拷贝到/usr/lib 3. 测试:[root@DB_Backup smacks]# super-s...
2008-12-19 11:45:32
180
原创 自动检查mysql运行状态
要求在中心管理服务器上写一个脚本每天在规定时间自动检查公司所有mysql server运行状态,然后发到指定的邮箱。我们公司所有mysql server版本为5.0.25,操作系统是centos 4.6,所有mysql server都是下载tar包重新编译。以下是我具体操作过程。前提条件:1.在每台mysql服务器上为中心管理服务器新建一个用户。以便它有权查看服务器的运行状况。mysql>g...
2008-12-19 11:42:14
436
原创 linux远程访问权限控制(hosts.allow和hosts.deny)
refers to:http://www.91linux.com/html/article/guanli/20070625/2952.html /etc/hosts.allow和/etc/hosts.deny两个文件是控制远程访问设置的,通过他可以允许或者拒绝某个ip或者ip段的客户访问linux的某项服务。比如SSH服务,我们通常只对管理员开放,那我们就可以禁用不必要的IP,而只开放管理员...
2008-12-19 11:40:03
1414
原创 mtop 实时监控 MySQL
refers to:http://blog.chinaunix.net/u/504/showart_1666344.htmlmtop 实时监控 MySQLRequires the following perl modules: Module Available At ------------ ---------------------------...
2008-12-19 11:34:02
196
原创 MySQL Master-Slave架构下使用MMM的必要性
MySQL Master-Slave架构下使用MMM的必要性 MySQL本身没有提供replication failover的解决方案(见How can I use replication to provide redundancy or high availability?)如何使Replication方案具有HA?答案是MMM(MySQL Master-Master Replication ...
2008-12-19 11:30:59
183
空空如也
JAVA实现获取QQ通讯录功能
2009-01-17
数据转移OOM的问题(急)
2009-01-11
TA创建的收藏夹 TA关注的收藏夹
TA关注的人