ITeye博客

tianyalinfeng

tianyalinfeng · 共 355 篇文章

maven

mvn package -DskipTests 跳过测试阶段

2011-09-16 16:21 · Java · 评论(0)

hibernate annotation

@Entity将一个Javabean类声明为一个实体的数据库表映射类...也可以成为持久化POJO类,最好实现序列化 @Id注释为主键类的定义,定义在对应属性的get方法之上 @Table是类一级的注解,定义在@Entity下,为实体bean映射表,目录和schema的名字,默认为实体bean的类名,不带包名 其中uniqueConstraints能够结合@uniqueConstraint 进行列的唯一约束,多个 @Version 用于在实体类中添加对乐观锁的支持,定义在getVesion方法之上 @Basic 实体Bean中所有的非Static 非transient的属性都可以被持久化,没…

2011-09-15 11:37 · Java · 评论(0)

hibernate 连接池配置

在hibername.cfg.xml中配置 <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> <property name="hibernate.c3p0.max_size">30</property> <property name="hibernate.c3p0.min_size">5</property> <property name="hibernate.c3p0.timeout">5000</property> …

2011-09-09 14:28 · Java · 评论(0)

blogToString & stringToBlob

/** * transfer blob to string * * @param blob * @return string */ private String blobToString(Blob blob) { try { byte[] compressed = blob.getBytes(1, (int) blob.length()); byte[] uncompressed = Snappy.uncompress(compressed); String result = new String(uncompressed, "UTF-8"); return result; } catch …

2011-09-09 13:42 · Java · 评论(0)

主线程等待多个子线程结束

//主线程定义 public CountDownLatch m_threadSignal; //主线程初始化 m_threadSignal = new CountDownLatch(10); //主线程等待 // wait for all started threads (rendevouz) try { m_threadSignal.await(); } catch (InterruptedException e) { LOG.error("can't wait for threads", e); } //子线程中将总线程数减一 m_threadSignal.countDown();

2011-08-30 19:21 · Java · 评论(0)

判断字符串是否为空

/** * Checks if an string is empty. */ public static boolean isEmpty(String str) { return (str == null) || (str.trim().length() == 0); }

2011-08-29 13:22 · Java · 评论(0)

replace non-printing

java version ? public static String replace(String input) { String re = "[\u0000-\u0009\u000b-\u001f\ue000-\uf8ff]"; Pattern p = Pattern.compile(re); Matcher m = p.matcher(input); String output = m.replaceAll(""); return output; } PHP version ? function replaceIllegalcharset($input){ return preg_re…

2011-08-27 20:32 · Java · 评论(0)

vmware linux can not display chinese characters correctly

install fonts-chinese and fonts-ISO8859-2-75dpi-1.0-17.1 relogin ok

2011-08-14 06:59 · Linux · 评论(0)

vmware linux 不能上网

可以用NAT方式 另外要用7.1版本的vmware,6.x本身就有问题

2011-08-13 04:31 · Linux · 评论(0)

linux vmware tools 安装后没有效果

执行 vmware-config-tools.pl 后重启

2011-08-13 01:18 · Linux · 评论(0)

HttpURLConnection 获取不到 Location

*HttpURLConnection.setFollowRedirects(false);//关闭重定向后就可以取得Location的值 *在一次请求之后若需要继续请求其他地址,必须取用这次请求的结果,取页面内容或者取响应头信息都行 BufferedReader in = new BufferedReader(new InputStreamReader( http_con.getInputStream(), "utf-8")); http_con.getHeaderField("Location"); 这样可以保证下次请求可以取到正确的结果,因为第一次请求可能写入cookie或者做了其他操作

2011-08-11 18:02 · 评论(0)

新概念英语第三册Lesson 17

The longest suspension bridge in the world How is the bridge supported? Verrazano, an Italian about whom little is known, sailed into New York Harbour in 1524 and named it Angouleme. He described it as 'a very agreeable situation located within two small hills in the midst of which flowed a great r…

2011-08-11 11:33 · English · 评论(0)

google map api

1.接口 http://maps.google.com/maps/geo?output=xml&key=abcdefg&q=suzhou 2. google map 事例之一 http://gmaps-samples-v3.googlecode.com/svn/trunk/geocoder/v3-geocoder-tool.html

2011-08-02 15:13 · Java · 评论(0)

jupiter 的使用

在项目中使用Jupiter时,需要先进行配置。所有配置信息都保存在一个.jupiter文件中,并需将之提交到SVN/CVS系统。 a) 个人走查(Individual Phase) 代码走查者在本地对代码进行走查,然后建立相关的Review Issue。走查结果会自动保存在一个以.review为扩展名的XML文件中。该文件保存在Eclipse项目所在目录的某个子目录下,通常是项目根目 录下的Review子目录。走查完毕,走查者须将.review文件提交到SVN/CVS系统 b) 团队走查(Team Phase) 个人更新本地工程以获得其他走查者的.review文件,然后选择“Team Pha…

2011-08-02 10:17 · Java · 评论(0)

myeclipse 9.0 jupiter 插件安装

1.下载jupiter jar包 http://code.google.com/p/jupiter-eclipse-plugin/downloads/list 2.将jar文件直接放进文件夹C:\Program Files\MyEclipse\MyEclipse 9\dropins 3.重启myeclipse

2011-08-02 09:13 · Java · 评论(0)