上一页 1 2 3 4 5 6 7 8 ··· 29 下一页
摘要: Runnbale封装一个异步运行的任务,可以把它想象成一个没有任何参数和返回值的异步方法。Callable和Runnable相似,但是它有返回值。Callable接口是参数化的类型,只有一个方法callpublic interface Callable {V call() throws Exception;}类型参数就是返回值的类型,例如:Callable表示最终返回一个String的异步操作(计算)Runnbale封装一个异步运行的任务,可以把它想象成一个没有任何参数和返回值的异步方法。Callable和Runnable相似,但是它有返回值。Callable接口是参数化的类型,只有一个方法c 阅读全文
posted @ 2014-01-07 18:02 google4y 阅读(311) 评论(0) 推荐(0) 编辑
摘要: 原文地址:http://blog.sina.com.cn/s/blog_4b9eab320100slyw.html可以看作命令行浏览器1、开启gzip请求curl -I http://www.sina.com.cn/ -H Accept-Encoding:gzip,defalte2、监控网页的响应时间curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http: 阅读全文
posted @ 2014-01-07 17:17 google4y 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Posted on2011-05-14所谓BOM,全称是Byte Order Mark,它是一个Unicode字符,通常出现在文本的开头,用来标识字节序(Big/Little Endian),除此以外还可以标识编码(UTF-8/16/32),如果出现在文本中间,则解释为zero width no-break space。注:Unicode相关知识的详细介绍请参考UTF-8, UTF-16, UTF-32 & BOM。 对于UTF-8/16/32而言,它们名字中的8/16/32指的是编码单位是多少位的,也就是说,它们的编码单位分别是8/16/32位,换算成字节就是1/2/4字节,如果是多 阅读全文
posted @ 2014-01-07 16:48 google4y 阅读(553) 评论(0) 推荐(0) 编辑
摘要: 背景:java普通的文件读取方式对于bom是无法正常识别的。 使用普通的InputStreamReader,如果采用的编码正确,那么可以获得正确的字符,但bom仍然附带在结果中,很容易导致数据处理出错。另外,对于存在BOM头的文件,无法猜测它使用的编码。目标:实现一种方式,可对BOM头进行捕捉和过滤解决方案有二:一、 使用apache的工具类,以BOMStream为例: BOMStream,api参考:http://commons.apache.org/io/apidocs/org/apache/commons/io/input/BOMInputStream.html 该类的构造方式: BO. 阅读全文
posted @ 2014-01-07 16:45 google4y 阅读(650) 评论(0) 推荐(0) 编辑
摘要: ServletRequest的getServletContext方法是Servlet3.0添加的,这个可以看一下官方文档http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getServletContext()而Tomcat6只支持到Servlet2.5看它的官方文档可以知道,要用J2EE6的话得换成Tomcat7http://tomcat.apache.org/tomcat-6.0-doc/index.html旧版本需要先用request拿到HttpSession或者通过Servlet自身拿到Servle 阅读全文
posted @ 2014-01-06 16:52 google4y 阅读(1565) 评论(1) 推荐(1) 编辑
摘要: import java.io.File;import java.util.ArrayList;import java.util.List;import java.util.Queue;/** * @author tiwson 2010-06-02 * */public class FileSearcher { /** * 递归查找文件 * @param baseDirName 查找的文件夹路径 * @param targetFileName 需要查找的文件名 * @param fileList 查找到的文件集合 */ public s... 阅读全文
posted @ 2014-01-06 16:51 google4y 阅读(568) 评论(0) 推荐(0) 编辑
摘要: package com.lanp;import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.util.zip.ZipEntry;import java.util.zip.ZipOutputStrea 阅读全文
posted @ 2014-01-06 16:50 google4y 阅读(371) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/liangoo7/article/details/7882773java中写.txt文件,实现换行的几种方法:1.使用java中的转义符"\r\n":Java代码 Stringstr="aaa";str+="\r\n"; 这样在str后面就有换行了. 注意:\r,\n的顺序是不能够对换的,否则不能实现换行的效果.2.BufferedWriter的newline()方法:Java代码 FileOutputStreamfos=newFileOutputStream("c;\\11.txt 阅读全文
posted @ 2014-01-06 09:56 google4y 阅读(32865) 评论(0) 推荐(0) 编辑
摘要: 技术前提:我们使用iBatis作为持久层方案技术场景: 假设我们有两张表,一张主表Main,一张子表Sub,并且主表的主键是由数据库维护的自增长的主键,子表中有一个字段引用这个主键,那么当我们插入主表数据后,就需要马上返回这个自增长的主键。解决方案: 可以在insert时通过iBatis的selectKey返回那个主键。 selectKey有3个主要的属性: 1)resultClass:返回的主键的数据类型,跟sqlMap中的数据类型一致; 2)type:表示主键在insert之前或之后生成(取决于数据库的主键生成策略),取值分别为[pre|post],非必须,未填写时如果在insert之前表 阅读全文
posted @ 2014-01-02 22:57 google4y 阅读(4770) 评论(0) 推荐(0) 编辑
摘要: 本文选自http://freshclickmedia.co.uk/2013/09/installing-redis-on-windows/Getting started withRedison Windows is easy:1. Download the latest .exe package fromhttps://github.com/rgl/redis/downloads(choose the appropriate latest 32 or 64 bit version).2. Running the exe will install Redis as a service and i 阅读全文
posted @ 2013-12-30 18:10 google4y 阅读(212) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 29 下一页
不在家,就在公司,不在公司,就在去公司的路上,無家無根,如風如萍,只有漂