2011 年文章归档
共 137 篇文章
Map按value排序
List<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>( visitMap.entrySet()); // sort list Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() { public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) { return (o2.getValue() - o1.g…
2011-12-31 13:40 · Java
Myeclipse启动tomcat报错
错误:java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory 解决办法: Myeclipse 打开 tomcat configure paths 里的 Prepend to classpath 里加入 tomcat bin 目录里的所有jar包 错误:Socket bind failed: [730048] 解决办法:打开任务管理器,结束javaw.exe,再启动tomcat
2011-12-31 12:01 · Java
meta标签中获取charset
/** * get response charset * * @param responseBody * @return */ private String getResponseCharset(String responseBody) { String charset = "UTF-8"; String regex = "^(.*)(<meta\\s+http-equiv=\"Content-Type\" \\s+content=\"text/html;\\s*charset=)(\\w+(-?\\w)*)(\"\\s+/>.*)$ "; Pattern p = Pattern.compi…
2011-12-21 15:28 · Java
一台电脑开启多个msn
1.打开注册表编辑器(运行–>regedit) - 打开HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Live\Messenger 2.在Messenger里新建名为“MultipleInstances”的DWORD值,将值修改为 1。关闭 Regedit 即可。
2011-12-20 08:57 · Fun
HttpClient中文乱码
postMethod.addRequestHeader("Content-Type","text/html;charset=UTF-8");
2011-12-19 15:00 · Java
构造org.w3c.dom.Node
HTMLInputElement node = new HTMLInputElementImpl(new HTMLDocumentImpl(), "input"); node.setAttribute("type", type); node.setAttribute("name", name); node.setAttribute("value", value); 注:Node 是 HTMLInputElement 的祖先类
2011-12-16 11:20 · Java
给定一个url获取host
/** * get host of an url * @param urlString * @return */ public static String getHost(String urlString) { int index = urlString.indexOf("://"); if (index != -1) { urlString = urlString.substring(index + 3); } index = urlString.indexOf("/"); if (index != -1) { urlString = urlString.substring(0, inde…
2011-12-16 09:29 · Java
常见异常处理办法
1. getOutputStream() has already been called for this response jsp文件末尾添加两句话 out.clear(); out = pageContext.pushBody(); 2. java.lang.IncompatibleClassChangeError: Expecting non-static method 原因可能是静态方法没有用静态的方式去访问 3. java.lang.IllegalStateException 在response.sendRedirect("")方法后加return;语句即可,原因是在程序中两次调用…
2011-12-15 13:36 · Java
关键词和关键句排名算法
关键词和关键句排名算法:加权无向图 the application of graphbased ranking algorithms to natural language texts consists of the following main steps: 1. Identify text units that best define the task at hand, and add them as vertices in the graph. 2. Identify relations that connect such text units, and use these relat…
打可执行jar包
1.myeclipse可直接打runnable jar 2.myeclipse打成普通jar包 在MANIFEST.MF添加 Main-Class: com.xxx.ClassName
2011-11-29 14:07 · Java
实用网址收集
1.apache 所有项目 http://mirrors.directorymix.com/apache/ 2.鞋城 http://www.s.cn/ 3.solr 源码 http://lucene.apache.org/solr/version_control.html 4 solr jira https://issues.apache.org/jira/browse/SOLR-236 5solr wiki http://wiki.apache.org/solr/SimpleFacetParameters?highlight=%28facet%29 6自然语言处理 www.52nlp.cn…
2011-11-22 13:05 · Other
Word
1. trauma ['trɔ:mə; 'trau-] n. [外科] 创伤(由心理创伤造成精神上的异常);外伤 2. collared ['kɔləd] adj. 有领圈的;成卷的 3. flycatcher ['flai,kætʃə] n. 捕蝇器;捕蝇草;霸鹟科(等于tyrant flycatcher) 4. dickie ['diki] n. (小孩的)围嘴;(女性衬衫)的胸襟 adj. 不可靠的;低劣的 5. eccentricity [,eksen'trisəti] n. 古怪;怪癖;[数] 离心率 6. mutual ['mju:tʃuəl, -tjuəl] adj. 共同的;…
2011-11-21 08:56 · English
Phrase
1. question * It is out of question to arrive there on time. 准时到那里毫无问题。 * It is out of the question to rebuild the towers. 重建那座塔是不可能的。肯定建不了! * He is a good guy beyond question.He is just poor. 毫无疑问他是一个好人。他就是穷了点。 beyond question 是毫无疑问,无可争辩的意思 * It was to be expected that our present economic traumas…
2011-11-21 08:55 · English
Idiom
1. A bad conscience is a snake in one's heart. 做贼心虚。 2. Honesty is the best policy. 诚实为最上策。 3. There is nothing new under the sun. 若要人不知,除非己莫为。 这句话语出《圣经·传道书》第1章第9节。 原文是:“What has been will be again, what has been done will be done again; there is nothing new under the sun. ” 意思就是“已有的事,后必再有;已行的事,后必再…
2011-11-18 08:36 · English
中文数字unicode
一 七 三 九 二 五 八 六 四 零 \u4e00\u4e03\u4e09\u4e5d\u4e8c\u4e94\u516b\u516d\u56db\u96f6
2011-11-17 11:10 · Java
中文和unicode互相转换
package unicode; import java.util.regex.Matcher; import java.util.regex.Pattern; public class CodeChange { /* * 把中文字符串转换为十六进制Unicode编码字符串 */ public static String stringToUnicode(String s) { String str = ""; for (int i = 0; i < s.length(); i++) { int ch = (int) s.charAt(i); if (ch > 255) str += " \\…
2011-11-16 16:09 · Java
Famous quote
1. Fear not that the life shall come to an end, but rather fear that it shall never have a beginning. -- J.H. Newman 不要害怕你的生活将要结束,应该担心你的生活永远不会真正开始。 -- 纽曼 2. I would rather be certain of a good result than hopeful of a great one. -Warren Buffett 与其两鸟在林,还不如一鸟在手。 3. Ignorance is the curse of God, Know…
2011-11-16 12:22 · English