tianyalinfeng
tianyalinfeng · 共 355 篇文章
mongodb 查询
*查询gridfs 中 存在字段title的所有对象 DBCollection dbcol = db.getCollection("gridfs"); DBCursor cursor = dbcol.find(new BasicDBObject("title",new BasicDBObject("$ne",null)));
2011-07-29 17:49 · Java · 评论(0)
hibernate mysql 乱码
hibernate.cfg.xml 文件中加入如下代码 <!-- Supported UTF-8 character set --> <property name="connection.useUnicode">true</property> <property name="connection.characterEncoding">UTF-8</property>
2011-07-29 09:37 · Java · 评论(0)
BlockingQueue & LinkedBlockingQueue
import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; class Producer implements Runnable { private final BlockingQueue queue; private int size=0; Producer(BlockingQueue q) { queue = q; } public void run() { try { while (true&&size++<=10) { queue.put(produce());…
2011-07-27 17:15 · Java · 评论(0)
Rational Rose 关闭不了,java.lang.classNotfoundexception
1. 在运行中输入regedit回车,打开注册表编辑器 2. 找到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Java VM表项 3. 在右边一栏中,双击TrustedClasspath [REG_SZ] (没有则需要自己新建一个表项) 4. 添加值 c:\windows\java\trustlib\rosedatamodeler.zip;c:\windows\java\trustlib\comwrappers.zip;c:\windows\java\trustlib\xerces
2011-07-26 09:18 · 评论(0)
Chain of responsibility
public class Handler { private Handler successor; public void setSuccessor(Handler successor) { this.successor = successor; } public Handler getSuccessor() { return successor; } public void handleRequest(char c) { if(successor != null) successor.handleRequest(c); } } public class NumberHandler exte…
2011-07-25 12:32 · Java · 评论(0)
embeded mysql 用法示例
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import com.mysql.management.driverlaunched.ServerLauncherSocketFactory; public class ConnectorMXJTestExample { public static void main(String[] args) throws Exception { String hostColonP…
2011-07-22 17:00 · Java · 评论(0)
新概念英语第三册Lesson 16
Mary had a little lamb Mary and her husband Dimitri lived in the tiny village of Perachora in southern Greece. One of Mary's prize possessions was a little white lamb which her husband had given her. She kept it tied to a tree in a field during the day and went to fetch it every evening. One evenin…
2011-07-22 11:14 · English · 评论(0)
新概念英语第三册Lesson 15
Fifty pence worth of trouble Did George get anything for his fifty pence? What? Children always appreciate small gifts of money. Mum or dad, of course, provide a regular supply of pocket money, but uncles and ants are always a source of extra income. With some children, small sums go a long way. If…
2011-07-22 09:21 · English · 评论(0)
新概念英语第三册Lesson 14
A noble gangster How did Haywood make in times of peace? There was a time when the owners of shops and businesses in Chicago had to pay large sums of money to gangsters in return for 'protection.' If the money was not paid promptly, the gangsters would quickly put a man out of business by destroyin…
2011-07-22 09:12 · English · 评论(0)
java 路径
System.out.println(LegalTransactionHistoryTransferTest.class.getClassLoader().getResource("")); System.out.println(ClassLoader.getSystemResource("")); System.out.println(LegalTransactionHistoryTransferTest.class.getResource("")); System.out.println(LegalTransactionHistoryTransferTest.class.getResou…
2011-07-21 10:27 · 评论(0)
hibernate 复合主键 多对多 级联保存
package com.patsnap.hibernate.beans; import java.io.Serializable; import java.util.List; public class Patent implements Serializable{ private String pn; private String apno; private List<LegalStatus> legalStatus; public List<LegalStatus> getLegalStatus() { return legalStatus; } public void setLegal…
2011-07-18 16:39 · Java · 评论(0)
htmlparser 注册多个自定义标签
Tag[] tags = { new bTag(), new brTag() }; PrototypicalNodeFactory factory = new PrototypicalNodeFactory(tags); factory.registerTags(); parser.setNodeFactory(factory);
2011-07-15 10:36 · Java · 评论(0)
htmlparser 自定义标签
//构造自定义标签类 static class bTag extends CompositeTag { private static final String[] mIds = new String[] {"B"}; public String[] getIds (){ return (mIds); } } //注册自定义标签 PrototypicalNodeFactory factory = new PrototypicalNodeFactory(); factory.registerTag(new bTag()); parser.setNodeFactory(factory); //获取…
2011-07-14 18:04 · Java · 评论(0)
新概念英语第三册Lesson 13
It's only me What did the man expect to find under the stairs? After her husband had gone to work. Mrs. Richards sent her children to school and went upstairs to her bedroom. She was too excited to do any housework that morning, for in the evening she would be going to a fancy-dress party with her …
2011-07-14 14:02 · English · 评论(0)