|
1,FileZilla FileZilla is a fast FTP and SFTP client for Windows with a lot of features. FileZilla Server is a reliable FTP server. http://sourceforge.net/project/showfiles.php?group_id=215582,Xmanager 使用Xmanager?遠程連接Solaris的方法怎樣通過Xmanager連接到(RedHat)Linux系統3,WINE 剛剛步入Linux,難免要有時利用一下Windows的程序資源,Wine提供了一個用來運行Windows程序的平臺。
Wine (Wine Is Not an Emulator)[即Wine不僅僅是一個模擬器]是一個在X和UNIX之上的,Windows 3.x
和 Windows
APIs的實現.它是一個Windows兼容層,用通俗的話說,就是一個Windows模擬器,這個層即提供了一個用來從Windows源進出到UNIX
的開發工具包(Winelib),也提供了一個程序加載器,該加載器允許不用任何修改Windows
3.1/95/NT的二進制文件,就可以運行在Intel Unix及其衍生版本下.Wine可以工作在絕大多數的UNIX版本下,包括Linux,
FreeBSD, 和 Solaris. Wine不需要Microsoft Windows,
因為這是一個完全由百分之百的免費代碼組成的,可以選擇的實現 4,Putty是一個免費的、Windows 32平臺下的telnet、rlogin和ssh客戶端,但是功能絲毫不遜色于商業的
telnet類工具。用它來遠程管理Linux十分好用。 從windows訪問linux,除了samba之外,日常操作用得最多的大概就是PuTTY和SecureCRT Putty是免費的,SecureCRT是收費的(當然,有破解版)。 Putty缺省配置就很好看很好用,SecureCRT的缺省配置不是為linux準備的而且很難看。 Putty拿來就可以立刻使用,SecureCRT需要經過復雜的配置之后才好用 putty使用方法,中文教程5, rsync ? 可用來同步代碼到多個服務器上或作鏡像備份
htop 是一個 Linux 下的交互式的進程瀏覽器,可以用來替換Linux下的top命令。 IPTraf是一個使用簡單的網絡狀況監視工具。
??? import
?org.cyberneko.html.parsers.DOMFragmentParser; ???? import org.apache.html.dom.HTMLDocumentImpl; ????
import
?org.w3c.dom.DocumentFragment; ????
import
?org.w3c.dom.Node; ????
import
?org.w3c.dom.NodeList; ????
import
?org.xml.sax.InputSource; ????
import
?org.xml.sax.SAXException;
????
/**
?????*?從html中抽取純文本 ?????*? ?????*?
@param
?content ?????*?
@return
?????*?
@throws
?UnsupportedEncodingException ?????
*/
????
public
?String?extractTextFromHTML(String?content) ????????????
throws
?UnsupportedEncodingException?{ ????????DOMFragmentParser?parser?
=
?
new
?DOMFragmentParser(); ????????DocumentFragment?node?
=
?
new
?HTMLDocumentImpl().createDocumentFragment(); ????????InputStream?is?
=
?
new
?ByteArrayInputStream(content.getBytes()); ????????
try
?{ ????????????parser.parse(
new
?InputSource(is),?node); ????????}?
catch
?(IOException?e)?{ ????????????e.printStackTrace(); ????????}?
catch
?(SAXException?se)?{ ????????????se.printStackTrace(); ????????}
????????StringBuffer?newContent?
=
?
new
?StringBuffer(); ????????
this
.getText(newContent,?node);
????????String?str?
=
?(
new
?String( ????????????????newContent.toString().getBytes(
"
Windows-1252
"
),?
"
GBK
"
)); ????????
return
?str; ????}
????
private
?
void
?getText(StringBuffer?sb,?Node?node)?{ ????????
if
?(node.getNodeType()?
==
?Node.TEXT_NODE)?{ ????????????sb.append(node.getNodeValue()); ????????} ????????NodeList?children?
=
?node.getChildNodes(); ????????
if
?(children?
!=
?
null
)?{ ????????????
int
?len?
=
?children.getLength(); ????????????
for
?(
int
?i?
=
?
0
;?i?
<
?len;?i
++
)?{ ????????????????getText(sb,?children.item(i)); ????????????} ????????} ????}
1,nekohtml1.9.6.1版本用到了jdk5的Arrays.hashCode等方法,為兼容jdk1.4, ? 故采用nekohtml1.9.6版本 2,需要xerces.jar支持 3, ?? http://hi.baidu.com/walkandsing/blog/item/f5743634c6ba2e3a5bb5f5e5.html ?? http://blog.csdn.net/zhou2002/archive/2008/01/19/2053911.aspx ?? http://playfish.javaeye.com/blog/150184 4, python解析html http://lenciel.cn/docs/python-parser-of-xml/ http://hi.baidu.com/javalang/blog/item/84bac4bf731fb80f18d81fe1.html ruby用hpricot
1,刪索引時如果解鎖,會不會有問題? ??? IndexReader reader = IndexReader.open(directory); ?? ???? ??? if (IndexReader.isLocked(directory)) { ?? ???? ??? ??? IndexReader.unlock(directory); ?? ???? ??? } ?? ???? ??? reader.deleteDocuments(term); ?? ???? ??? reader.close(); 2,到底是reader.deleteDocuments(term)還是writer.deleteDocuments(term) 3,writer.setUseCompoundFile(true) 創建索引庫時,會合并多個 Segments 文件到一個 .cfs 中。此方式有助于減少索引文件數量,減少同時打開的文件數量。
可以使用 CompoundFileReader 查看 .cfs 文件內容。
CompoundFileReader reader = new CompoundFileReader(FSDirectory.GetDirectory("y:\\index", false), "_1oa.cfs");
foreach (string filename in reader.List())
{
Console.WriteLine(filename);
}
1, 某人設計的中文分詞算法2, Lucene中文分詞組件 JE-Analysis 1.5.13, 轉一篇lucene的使用的文章,寫的比較全?? lucene使用與優化4, 基于字符串匹配的中文分詞5, 計算所開源的FirteX介紹6, 庖丁分詞 ?? http://www.javaeye.com/topic/49441?page=1 ?? http://qieqie.javaeye.com/blog/126943 ?? http://code.google.com/p/paoding/ ?? http://groups.google.com/group/paoding/topics 7, http://www.chedong.com/tech/lucene.html(車東) 8,http://blog.donews.com/withshare/archive/2007/06/10/1173923.aspx
1,求一段時間內共跨越了多少天(例如求平均日訪問量時要用到) select to_date(to_char(max(t.logdate), 'yyyy-MM-dd'), 'yyyy-MM-dd') - ????????????????????????????? to_date(to_char(min(t.logdate), 'yyyy-MM-dd'),'yyyy-MM-dd') + 1 ???????????????????????? from tb_log t 2, Add_months(d,n)?當前日期d后推n個月(n可以為負數) ?? 當找不到某月的匹配日時取該月最后一天。例如3-31后推1個月為4-30 3,last_day(d)? 某日期d所在月份的最后一天 4,轉換某日期為'yyyy-m-d'格式 ??? select to_char(sysdate, 'yyyy') || '-' || to_number(to_char(sysdate, 'mm')) || '-' || ?????? to_number(to_char(sysdate, 'dd')) from dual 5,查詢系統時間戳的毫秒值SELECT (SYSDATE - TO_DATE('1970-1-1 8', 'YYYY-MM-DD HH24')) * 86400000 + ?????? TO_NUMBER(TO_CHAR(SYSTIMESTAMP(3), 'FF')) AS MILLIONS ? FROM DUAL 見http://yangtingkun.itpub.net/post/468/244564
6,oracle函數處理字符串時,下標是從1開始的。
7,
INSTR方法的格式為 INSTR(源字符串, 目標字符串, 起始位置, 匹配序號)? (注: 起始位置是從1開始,不能從0開始) 例如:INSTR('CORPORATE FLOOR','OR', 3, 2)中,源字符串為'CORPORATE FLOOR', 目標字符串為'OR',起始位置為3,取第2個匹配項的位置。 默認查找順序為從左到右。當起始位置為負數的時候,從右邊開始查找。 所以SELECT INSTR('CORPORATE FLOOR', 'OR', -1, 1) "Instring" FROM DUAL的顯示結果是 Instring —————— 14 注:INSTR('test','a')得到的是0,而不是-1參考: http://df41.spaces.live.com/blog/cns!D064C4537B2605A6!317.entry http://hi.baidu.com/fgfd0/blog/item/7a48d5f9155a0059252df2dc.html
8,to_date時報"格式代碼出現兩次" ?? 原因是"You are using MM twice"
9,substr( string, start_position, [length])? 下標從1開始 substr('This is a test', 6, 2)?? would return 'is' substr('This is a test', 6)????? would return 'is a test' substr('TechOnTheNet', 1, 4)???? would return 'Tech' substr('TechOnTheNet', -3, 3)??? would return 'Net' substr('TechOnTheNet', -6, 3)??? would return 'The' substr('TechOnTheNet', -8, 2)??? would return 'On'
10,select to_date(2008-03-14 14:49:37,'yyyy-MM-dd hh24:mi')? from dual 報錯:ora-01830錯誤:日期格式圖片在轉換整個輸入字符串之前結束 原因是格式化的字符竄長度大于格式化標準(yyyy-MM-dd hh24:mi)的長度 注意:月份的mm大小寫不一樣,hh24和hh不一樣,分鐘用mi而不是mm
11,lengthb查看字節數
12,case的用法 select case when t.classtype = 1 then ????????? '名稱一' ???????? when t.classtype = 2 then ????????? '名城二' ?????? end name from tb_test t
13, where?? t.fsdate <= to_date('2007-12-15','yyyy-mm-dd') ?where?? to_char(t.fsdate,'yyyy-mm-dd')<='2007-12-15'
14,decode
decode(條件,值1,翻譯值1,值2,翻譯值2,...值n,翻譯值n,缺省值) 15,跨多少月 select to_char(add_months(to_date('1999-2', 'yyyy-mm'), (rownum - 1)), 'YYYY-MM') as TEMPMONTH from dual connect by rownum < months_between(to_date('2009-9', 'yyyy-mm'), to_date('1999-2', 'yyyy-mm')) + 2 16,統計字符串中某個字符出現的次數 SELECT LENGTHB('ABCDEFGEFGDBE')-LENGTHB(REPLACE('ABCDEFGEFGDBE','E','')) FROM DUAL; http://windows9834.blog.163.com/blog/static/2734500420103154920954/
http://blog.csdn.net/buglu/archive/2006/07/21/953890.aspx http://blog.tom.com/monkeylikebanana/article/458.html http://blog.sina.com.cn/s/blog_5377fe0f010004eb.html http://www.tkk7.com/amigoxie/archive/2007/09/30/149765.html http://ltc603.javaeye.com/blog/30207
http://www.tkk7.com/sunjavaee/archive/2006/05/31/49373.html http://www.tkk7.com/xfcy2003/archive/2008/02/17/180361.html http://ibm-websphere.group.javaeye.com/group/topic/2498
ActiveMQ+Jenck是一個withdout?Application?Server,但效能一樣不減的Message? Drivern?POJO的JMS組合方案。
1,after(html) after(elem)? after(elems) ? 將指定的元素插入到某元素后。 ? before(html) before(elem)? before(elems)與之相反 2,append(html) append(elem)? append(elems) ? 將指定的元素插入到某元素內部的末尾位置 ? appendTo與之相反,但似乎只能使用appendTo(elem) 3,prepend (html)? prepend (elem)? prepend (elems)?? ? 將指定的元素插入到某元素內部的開始位置,注意與append的區別 4, wrap(htm) ? 將匹配對象包含在給出的html代碼內
5,next <script type="text/javascript"> $(document).ready(function() { ??? $('#t').find('dd').end().find('dt').click(function() { ???????? $(this).next().css("background","#f00"); ???????? ???? }); }); </script> ??? <dl id="t"> ??? ??? <dt>點這里測試1?</dt> ??? ??? <dd>1111111111111111</dd>
??? ??? <dt>點這里測試2?</dt> ??? ??? <dd>2222222222222222</dd> ??? ??? ??? </dl> ? http://tzangms.com/blog/programming/984
http://www.tkk7.com/wangxinsh55/archive/2007/06/25/126166.html
6,深度,遞歸式的 .extend() 新的extend()允許你更深度的合并鑲套對象。下面的例子是一個很好的證明。 ??? // 以前的 .extend()?? ?? jQuery.extend(?? ???? { name: “John”, location: { city: “Boston” } },?? ???? { last: “Resig”, location: { state: “MA” } }?? ?? );?? ??? // 結果:?? ??? // => { name: “John”, last: “Resig”, location: { state: “MA” } } ? // 新的更深入的 .extend()?? ?? jQuery.extend( true,?? ?? { name: “John”, location: { city: “Boston” } },?? ???? { last: “Resig”, location: { state: “MA” } }?? ? );?? ? // 結果?? ?? // => { name: “John”, last: “Resig”,?? ? //????? location: { city: “Boston”, state: “MA” } }?
7,1.2.3版本和1.2.1版本的remove方法的區別 1.2.1版本
remove: function(a){ if ( !a || jQuery.filter( a, [this] ).r.length ) { ?jQuery.removeData( this ); ?this.parentNode.removeChild( this ); } }, 1.2.3版本 remove: function( selector ) { ??if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { ???// Prevent memory leaks ???jQuery( "*", this ).add(this).each(function(){ ????jQuery.event.remove(this); ????jQuery.removeData(this); ???}); ???if (this.parentNode) ????this.parentNode.removeChild( this ); ??} ?} 見http://www.blog.edu.cn/user2/50271/archives/2007/1963499.shtml http://pyrolupus.com/demo/jqremovebug.php http://dev.jquery.com/changeset/3790
8,? extend()使用詳解(不考慮深度的extend)
$.extend(target, prop1, propN) 用一個或多個其他對象來擴展一個對象(即第一個參數),返回這個最初的、并且被修改過的對象。這是簡單的實現繼承的一大方法.
- target (Object): 要擴展的對象
- prop1 (Object): 要與第一個對象合并的對象
- propN (Object): (可選) 更多要與第一個對象合并的對象
合并defaults和options, 但不修改defaults,返回合并后的對象 var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; var settings = jQuery.extend({}, defaults, options); 結果 :settings == { validate: true, limit: 5, name: "bar" },defaults沒有被修改
1,JQuery對象和DOM對象如何轉換 ? JQuery對象才能使用JQuery定義的方法;DOM對象才能使用DOM對象的方法;二者不可以混淆。 ? DOM對象通過$操作則可以轉成JQuery對象。例如: ? $(document.getElementById("msg"))
? JQuery對象轉成DOM對象則較復雜一些。由于JQuery對象本身也是集合,所以必須通過索引的方式來轉成DOM對象。例如: ? $("#msg")[0]
$("div").eq(1)[0]
$("div").get(0)
$("td")[5]
2,JQuery的get方法和eq方法的區別 ? eq返回的是jquery對象; ? get(n)和索引返回的是dom元素對象。 ? $("div").eq(2).html();??????????????? //調用jquery對象的方法 ? $("div").get(2).innerHTML;??? //調用dom方法
3,在事件處理程序中如何得到事件的發出者
在事件處理程序中可以申明一個event對象的方式來抓取事件的發出者。 $(document).ready(function(){ ???????$("a.week").click(function(event){ ??????????var?uri?=?"cWtc.do?"; ??????????var?params?=?"action=blankWtc&wd="?+?$(event.target).text(); ??????????window.location.href=uri?+?params;?????????? ???????});?????? });? 4,JavaScript只擁有單一的、全局的名稱空間(即window對象),而很多程序員(以及一些庫)恣意地為之添加各種東西。 要知道全局變量是魔鬼!聰明的開發人員,會使用類似組件模式的技術,來盡力減少全局對象的數量。 jQuery僅向全局名稱空間引入一個標記:jQuery函數/對象。其余的要么是jQuery的直接屬性,要么就是調用jQuery函數所返回的對象的方法。 5,兩個select ,都是多選的,要求一個按鈕,點擊時將list1中所有選中的項復制到list2中,而且在list2中已經存在的項就不再添加 http://www.javaeye.com/topic/191788function?copy_onclick(){?? ?$("#list1?option:selected").each(function?()?{?? ??$(document.createElement("option"))?? .attr("value",$(this).val())?? ?.text($(this).val())?? ?.appendTo('#list2:not(:has(option[value=\''+$(this).val()+'\']))');?? ??});???}?? 6, http://space.flash8.net/space/?18713/action_viewspace_itemid_328089.html http://hi.baidu.com/yandavid/blog/item/9f64c033dc623b40ac4b5fda.html http://www.cssrain.cn/article.asp?id=235 http://www.shineblog.com/user6/mprogram/archives/2008/937200.shtml 框處理 John Resig 的主頁 http://ejohn.org/Mike Hostetler的 http://amountaintop.com/blog/mike
1,hibernate在進行復雜查詢的情況下一樣可以直接得到一個Map的list: select new Map(a.id as id,a.name as name,b.type as type) from A a,B b where a.id=b.aId; ... List mapList=query.list(); .... 在jsp頁面可以和使用普通的JavaBean一樣的方式輸出 <c:forEach items="${mapList}" var="m"> <tr> <td> <c:out value="${m.id}"/> </td> <td> <c:out value="${m.name}"/> </td> <td> <c:out value="${m.type}"/> </td> </tr> </c:forEach> 這樣的處理也是很簡潔的 select new MyObj(id,name,deptid,deptName) from tb_usr,tb_dept where ..... 這種方式要求MyObj類有對應的構造方法 2.HQL supports subqueries in the where clause. We can’t think of many good uses for subqueries in the from clause, although select clause subqueries might be a nice future extension. 不支持from后的子查詢,支持where子查詢 http://blog.zol.com.cn/655/article_654256.html 3, String sql="select {fi.*} from FuncInfo fi " + ?? "left join RoleSubFunc rsf on fi.FuncId=rsf.FuncId "+ ?????? "left join RoleInfo ri on rsf.RoleId=ri.RoleId "+ ?????? "left join UserRole ur on ri.RoleId=ur.RoleId "+ ?????? "where ur.UserId='"+userId+"'";//可以無限向上找父級 ?List list =session.createSQLQuery(sql).addEntity("fi", FuncInfo.class).list(); 4, 為什么Hibernate 3中的HQL無法查詢漢字 使用同樣的代碼和配置文件,在Hibernate 2上完全沒有問題,在Hibernate 3中,使用如下HQL查詢,無法得到正確的結果集: String hql = "from story where title like '%漢字%'"; Query q = session.createQuery(hql); 但用下面的HQL查詢,卻可以得到正確結果集: String hql = " from story where title like '%english%'"; Query q = session.createQuery(hql); 答:如果采用的是拼接HQL的方式,從Hibernate 2升級到Hibernate 3確實會出現漢字亂碼問題。在控制臺中可以看到,SQL的漢字部分變成了亂碼: [DEBUG] 2005-08-14 14:33:58 org.hibernate.SQL - "select story0_.content from story as story0_ where story0_.title like '%&–°é—&&?¨&€?' 在Hibernate中,查詢時應盡量使用占位符的寫法(如下),這樣既可以避免亂碼問題,又可以避免潛在的SQL注入攻擊: getHibernate().find("from story where title like ? ", "%漢字%") 注:用"update TbTest set name='張三' "也會有類似的問題,要改為占位符的寫法 http://xqfy1983.blog.sohu.com/61054398.html
5,使用Hibernate.DATE時,得到的時間不帶分秒。 ? 可以考慮使用Hibernate.CALENDAR,實際類型是java.util.GregorianCalendar,然后再getTime() 6,報表查詢? select new Table(t1.a,t2.b ...)? from ..... ? select new Object(vo.id,vo.name) from VO vo ? 這種寫法需事先寫好構造方法 7,List cats = sess.createSQLQuery("select {cat.*} from cats cat") ? ? ? ? .addEntity("cat", Cat.class); ? ? ? ? .setMaxResults(50); ? ? ? ? .list(); 8,貌似hibernate添加或修改對象,如果字符串類型的屬性的值為空字符串(大小為0),則自動當null處理 9,如果在hbm中某屬性設為not null,然后如果po中的該屬性為null,則hibernate會拋異常 ? 但如果在hbm中設置屬性的長度,而實際的長度超過了,hibernate不會拋異常 10,如果要使生成得sql不是每次都包括所有的列,可配置參數實現: <class name="onlyfun.caterpillar.User" table="T_USER" dynamic-insert="true" dynamic-update="true"> 來源:http://caterpillar.onlyfun.net/Gossip/HibernateGossip/DynamicSQL.html 但并不是設置了dynamic-update=true就會有效果,要生效是有條件的. (1)同一session內,對已經persisit的對象進行update。 但有一奇怪現象,例如memo字段原來為空,o.setMemo(null),生成的update的sql還是會有set memo=null的語句,不知道為什么 (2)不同session之間,update傳入的對象是另一個session中的persist對象,然后merge http://qbar.qq.com/u2011541/19.htm http://xuliangyong.javaeye.com/blog/74696 11,
http://yuonch.javaeye.com/blog/89859 http://yuonch.javaeye.com/blog/90727
12,
session.createQuery("delete from Company where id=1").executeUpdate(); 這種寫法必須配置org.hibernate.hql.ast.ASTQueryTranslatorFactory,否則會報
HibernateQueryException: query must begin with SELECT or FROM 見http://czg185960.spaces.live.com/blog/cns!32A09070624FB42C!208.entry
|