Dedian |
|
|||
-- 關(guān)注搜索引擎的開發(fā) |
日歷
統(tǒng)計
導(dǎo)航常用鏈接留言簿(8)隨筆分類(45)
隨筆檔案(82)
文章檔案(2)Java Spaces搜索積分與排名
最新評論
閱讀排行榜評論排行榜 |
1. Getting the IP Address of a Hostnametry 2. Getting the Hostname of an IP AddressThis example attempts to retrieve the hostname for an IP address. Note thatgetHostName() may not succeed, in which case it simply
returns the IP address.
try { 3. Getting the IP Address and Hostname of the Local Machinetry { 12. The Morris worm 11. Google search rank 10. Apollo guidance system 9. Excel spreadsheet 8. Macintosh OS 7. Sabre system 6. Mosaic browser 5. Java language 4. IBM System 360 OS 3. gene-sequencing software at the Institute for Genomic Research 2. IBM's System R 1. Unix System III How r u thinking? 下面是本人的一些大致的翻譯: ------------------------------------------------------------ 大伙都知道,Google是運行在很多的Linux(GNU)系統(tǒng)的服務(wù)器上的,而這只是它支持免費軟件的一個方面。其他的比如,Summer of Code, 現(xiàn)在已成為一個生產(chǎn)很多優(yōu)秀代碼和項目的孵化基地,并且最近開放的Code Repository, 大有取代sourceforge.net(筆者注:廣大開源的據(jù)點)之趨勢。一方面,Google貢獻出它的Picasa(Linux(GNU)平臺)(筆者注:一個圖片管理軟件),并被Wine(筆者注:Linux/Unix上的Windows,建于x-window之上)所使用;另一方面,Google也贊助一些開源項目,如Sri Lanka,大概有$25,000之多。 ? 當(dāng)然,Google也會秘密地進行一些開源的資助。比如,令我們大伙驚訝的Mozilla Foundation(筆者注:大家熟悉的另一瀏覽器Firefox)居然在去年有賺到72個million?-- 就是在Firefox上把Google的搜索引擎作為缺省的搜索引擎。 2005年的1月份,Google把Ben Goodger招為靡下。此人乃Firefox的首席工程師,并且是幾個主要開源編碼者之一。到了年末,Guido van Rossum, Python的始創(chuàng)人,也加入了Google。最近,Linux2.6核心的維護人,Andrew Morton也宣稱即將離開OSDL并投奔到Google. 所有的這些,都意味著開源領(lǐng)域的大變遷。 記得在最初的那些年代里,人們都為著自己的興趣愛好在業(yè)余時間里一邊工作一邊學(xué)習(xí)地奮力地寫著自己的代碼。突然,第一個.com的時代來臨,不少早期的開源公司開始聘請頂級程序員:如核心編碼員Alan Cox, David Miller,Stephen Tweedie等人紛紛來到Red Hat, 還有一些去了Linuxcare。 隨著第一個.com泡沫經(jīng)濟的破滅,高手們被迫紛紛尋找新的工作,不少人去了新興之秀OSDL。基于這樣的一個背景,Google的興起以及大攬人才意味著早期公司廣具人才的模式的回歸。當(dāng)然,這次他們的工作都間接的有關(guān)于Google的主要市場策略。 Google的策略是精明的,看看最近招的人,Goodger和Morton,一個是瀏覽器,一個是操作系統(tǒng)。無不顯示出其與Microsoft暗暗較勁的決心。 當(dāng)然還有另一方面的原因,可能不是那么明顯,那就是最近的一些爭論,關(guān)于Google能否履行其最初對開源領(lǐng)域許下的諾言。矛頭指向Google是否應(yīng)該公開它的源碼?因為Google用了不少開源的東西。 所以,從某種角度上講,招一些開源黑客人士入帳遠遠比把代碼隨處發(fā)布好的多。 那些關(guān)于用了開源的代碼的公司是不是也應(yīng)該開放他們的代碼的爭論不僅僅涉及到Google。其他的一些主要得益者如Yahoo, 其最近正活躍于收購一些Web 2.0的公司如Flickr 和Del.icio.us,這些都很顯然有著開源的印記,當(dāng)然它沒有Google那樣與開源的關(guān)系那么源遠流長,不過Yahoo也開始著手吸引開源人才。 Well, on a technical layer, I'd like to shed some lights on so-called web standard trends 1. front end -- ???????? CSS ----> layout ?????????XML ----> data? ?????????XHTML ----> markup ?????????Javascript & DOM ----> behavior + XMLHttpRequest?--> AJAX ? 2. back end --? ?????????some open source projects such as Ruby on Rail... let me know how you are thinking... 下面是筆者在工作之余,翻譯其一篇2年前的訪談錄,原文(Doug Cutting Interview)在網(wǎng)上Google一下就容易找到。希望對搜索引擎開發(fā)的初學(xué)者起到一個拋磚引玉的效果。 (注:翻譯水平有限,不求雅,只求信,達。希望見諒) 1。請問你以何為生?你是如何開始從事搜索引擎開發(fā)的? 我主要在家從事兩個與搜索有關(guān)的開源項目的開發(fā): Lucene和Nutch.?錢主要來自于一些與這些項目相關(guān)的一些合同中。目前Yahoo! Labs?有一部分贊助在Nutch上。這兩個項目還有一些其他的短期合同?。 2。你能大概給我們講解一下Nutch嗎?以及你將在哪方面運用它? 我還是先說一下Lucene吧。Lucene其實是一個提供全文文本搜索的函數(shù)庫,它不是一個應(yīng)用軟件。它提供很多API函數(shù)讓你可以運用到各種實際應(yīng)用程序中。現(xiàn)在,它已經(jīng)成為Apache的一個項目并被廣泛應(yīng)用著。這里列出一些已經(jīng)使用Lucene的系統(tǒng)。 Nutch是一個建立在Lucene核心之上的Web搜索的實現(xiàn),它是一個真正的應(yīng)用程序。也就是說,你可以直接下載下來拿過來用。它在Lucene的基礎(chǔ)上加了網(wǎng)絡(luò)爬蟲和一些和Web相關(guān)的東東。其目的就是想從一個簡單的站內(nèi)索引和搜索推廣到全球網(wǎng)絡(luò)的搜索上,就像Google和Yahoo一樣。當(dāng)然,和那些巨人競爭,你得動一些腦筋,想一些辦法。我們已經(jīng)測試過100M的網(wǎng)頁,并且它的設(shè)計用在超過1B的網(wǎng)頁上應(yīng)該沒有問題。當(dāng)然,讓它運行在一臺機器上,搜索一些服務(wù)器,也運行的很好。 3。在你看來,什么是搜索引擎的核心元素?也就說,一般的搜索引擎軟件可以分成哪幾個主要部分或者模塊? 讓我想想,大概是如下幾塊吧: ?-- 攫取(fetching):就是把被指向的網(wǎng)頁下載下來。 ?-- 數(shù)據(jù)庫:保存攫取的網(wǎng)頁信息,比如那些網(wǎng)頁已經(jīng)被攫取,什么時候被攫取的以及他們又有哪些鏈接的網(wǎng)頁等等。 ?-- 鏈接分析:對剛才數(shù)據(jù)庫的信息進行分析,給每個網(wǎng)頁加上一些權(quán)值(比如PageRank,WebRank什么的),以便對每個網(wǎng)頁的重要性有所估計。不過,在我看來,索引那些網(wǎng)頁標記(Anchor)里面的內(nèi)容更為重要。(這也是為什么諸如Google Bombing如此高效的原因) ?-- 索引(Indexing): 就是對攫取的網(wǎng)頁內(nèi)容,以及鏈入鏈接,鏈接分析權(quán)值等信息進行索引以便迅速查詢。 ?-- 搜索(Searching): 就是通過一個索引進行查詢?nèi)缓蟀凑站W(wǎng)頁排名顯示。 當(dāng)然,為了讓搜索引擎能夠處理數(shù)以億計的網(wǎng)頁,以上的模塊都應(yīng)該是分布式的。也就是說,可以在多臺機器上并行運行。 4。你剛才說大家可以立馬下載Nutch運行在自己的機器上。這是不是說,即便那些對Apache服務(wù)器沒有掌控權(quán)的網(wǎng)站管理員在短時間內(nèi)就可以使用Nutch? 很不幸,估計他們大都沒戲。因為Nutch還是需要一個Java servlet的容器(筆者注:比如Tomcat)。而這個有些ISP支持,但大都不支持。(筆者注: 只有對Apache服務(wù)器有掌控權(quán),你才能在上面安裝一個Tomcat之類的東東) 5。我可以把Lucene和Google Web API結(jié)合起來嗎?或者和其他的一些我先前寫過的應(yīng)用程序結(jié)合起來? 有那么一幫人已經(jīng)為Nutch寫了一些類似Google的API, 但還沒有一個融入現(xiàn)在的系統(tǒng)。估計不久的將來就行了。 6。你認為目前實現(xiàn)一個搜索引擎最大的障礙在哪里?是硬件,存儲障礙還是排名算法?還有,你能不能告訴我大概需要多大的空間搜索引擎才能正常工作,就說我只想寫一個針對搜索成千上百萬的RSS feeds的一個搜索引擎吧。 Nutch大概一個網(wǎng)頁總共需要10kb的空間吧。Rss feeds的網(wǎng)頁一般都比較小(筆者注: Rss feeds都是基于xml的文本網(wǎng)頁,所以不會很大),所以應(yīng)該更好處理吧。當(dāng)然Nutch目前還沒有針對RSS的支持。(筆者注:實際上,API里面有針對RSS的數(shù)據(jù)結(jié)構(gòu)和解析) 7。從Yahoo! Labs拿到資金容易嗎?哪些人可以申請?你又要為之做出些什么作為回報? 我是被邀請的,我沒有申請。所以我不是很清楚個中的流程。 8。Google有沒有表示對Nutch感興趣? 我和那邊的一些家伙談過,包括Larry Page(筆者注: Google兩個創(chuàng)始人之一)。他們都很愿意提供一些幫助,但是他們也無法找到一種不會幫助到他們競爭對手的合適方式。 9。你有實現(xiàn)你自己的PageRank或者WebRank算法系統(tǒng)在你的Nutch里嗎?什么是你做網(wǎng)頁排名(Ranking)的考慮? 是的,Nutch里面有一個鏈接分析模塊。它是可選的,因為對于站內(nèi)搜索來說,網(wǎng)頁排名是不需要的。 10。我想你以前有聽說過,就是對于一個開源的搜索引擎,是不是意味著同樣會給那些搞搜索引擎優(yōu)化(SEO)的黑客們有機可趁? 恩,有可能。 就說利用反向工程破解的非開源搜索引擎中的最新的反垃圾信息檢測算法需要大概6個月的時間。對于一個開放源碼的搜索引擎來說,破解將會更快。但不管怎么說,那些制造垃圾信息者最終總能找到破解辦法,唯一的區(qū)別就是破解速度問題。所以最好的反垃圾信息技術(shù),不管開源也好閉源也好,就是讓別人知道了其中的機制之后也能繼續(xù)工作那一種。 還有,如果這六月中你是把檢測出來的垃圾信息從你的索引中移除,他們無計可施,他們只能改變他們的站點。如果你的垃圾信息檢測是基于對一些網(wǎng)站中好的和壞的例子的統(tǒng)計分析,你可以徹夜留意那些新的垃圾信息模式并在他們有機會反應(yīng)之前將他們移除。 開源會使得禁止垃圾信息的任務(wù)稍稍艱巨一點,但不是使之成為不可能。況且,那些閉源的搜索引擎也并沒有秘密地解決這些問題。我想閉源的好處就是不讓我們看到它其實沒有我們想象的那么好。 11。Nutch和分布式的網(wǎng)絡(luò)爬蟲Grub相比怎么樣?你是怎么想這個問題的? 我能說的就是,Grub是一個能夠讓網(wǎng)民們貢獻一點自己的硬件和帶寬給巨大的LookSmart的爬行任務(wù)的一個工程。它只有客戶端是開源,而服務(wù)端沒有。所以大家并不能配置自己的Grub服務(wù),也不能訪問到Grub收集的數(shù)據(jù)。 更一般意義的分布式網(wǎng)絡(luò)爬行又如何?當(dāng)一個搜索引擎變得很大的時候,其爬行上的代價相對搜索上需要付出的代價將是小巫見大巫。所以,一個分布式爬蟲并不能是顯著降低成本,相反它會使得一些已經(jīng)不是很昂貴的東西變得很復(fù)雜(筆者注:指pc和硬盤之類的硬件)。所以這不是一個便宜的買賣。 廣泛的分布式搜索是一件很有趣的事,但我不能肯定它能否實現(xiàn)并保持速度足夠的快。一個更快的搜索引擎就是一個更好的搜索引擎。當(dāng)大家可以任意快速更改查詢的時候,他們就更能在他們失去耐心之前頻繁找到他們所需的東西。但是,要建立一個不到1秒內(nèi)就可以搜索數(shù)以億計的網(wǎng)頁的廣泛的分布式搜索引擎是很難的一件事,因為其中網(wǎng)絡(luò)有很高的延時。大都的半秒時間或者像Google展示它的查詢那樣就是在一個數(shù)據(jù)中心的網(wǎng)絡(luò)延時。如果你讓同樣一個系統(tǒng)運行在千家萬戶的家里的PC上,即便他們用的是DSL和Cable上網(wǎng),網(wǎng)絡(luò)的延時將會更高從而使得一個查詢很可能要花上幾秒鐘甚至更長的時間。從而他也不可能會是一個好的搜索引擎。 12。你反復(fù)強調(diào)速度對于搜索引擎的重要性,我經(jīng)常很迷惑Google怎么就能這么快地返回查詢結(jié)果。你認為他們是怎么做到的呢?還有你在Nutch上的經(jīng)驗看法如何? 我相信Google的原理和Nutch大抵相同:就是把查詢請求廣播到一些節(jié)點上,每個節(jié)點返回一些頁面的頂級查詢結(jié)果。每個節(jié)點上保存著幾百萬的頁面,這樣可以避免大多查詢的磁盤訪問,并且每個節(jié)點可以每秒同時處理成十上百的查詢。如果你想獲得數(shù)以億計的頁面,你可以把查詢廣播到成千的節(jié)點上。當(dāng)然這里會有不少網(wǎng)絡(luò)流量。 具體的在這篇文章( www.computer.org/ micro/mi2003/ m2022.pdf)中有所描述。 13。你剛才有提到垃圾信息,在Nutch里面是不是也有類似的算法?怎么區(qū)別垃圾信息模式比如鏈接場(Linkfarms)(筆者注:就是一群的網(wǎng)頁彼此互相鏈接,這是當(dāng)初在1999年被一幫搞SEO弄出來的針對lnktomi搜索引擎的使網(wǎng)頁的排名得到提高的一種Spamdexing方法)和那些正常的受歡迎的站點鏈接。 這個,我們還沒有騰出時間做這塊。不過,很顯然這是一個很重要的領(lǐng)域。在我們進入鏈接場之前,我們需要做一些簡單的事情:察看詞匯填充(Word stuffing)(筆者注:就是在網(wǎng)頁里嵌入一些特殊的詞匯,并且出現(xiàn)很多的次,甚至上百次,有些是人眼看不到的,比如白板寫白字等伎倆,這也是Spamdexing方法的一種),白板寫白字(White-on-white text),等等。 我想在一般意義上來說(垃圾信息檢測是其中的一個子問題),搜索質(zhì)量的關(guān)鍵在于擁有一個對查詢結(jié)果手工可靠評估的輔助措施。這樣,我們可以訓(xùn)練一個排名算法從而產(chǎn)生更好的查詢結(jié)果(垃圾信息的查詢結(jié)果是一種壞的查詢結(jié)果)。商業(yè)的搜索引擎往往會雇傭一些人進行可靠評估。Nutch也會這樣做,但很顯然我們不能只接受那些友情贊助的評估,因為那些垃圾信息制造者很容易會防止那些評估。因此我們需要一種手段去建立一套自愿評估者的信任體制。我認為一個平等評論系統(tǒng)(peer-review system),有點像Slashdot的karma系統(tǒng), 應(yīng)該在這里很有幫助。 14。你認為搜索引擎在不久的將來路在何方?你認為從一個開發(fā)者的角度來看,最大的障礙將在哪里? 很抱歉,我不是一個想象力豐富的人。我的預(yù)測就是在未來的十年里web搜索引擎將和現(xiàn)在的搜索引擎相差無幾?,F(xiàn)在應(yīng)該屬于平穩(wěn)期。在最初的幾年里,網(wǎng)絡(luò)搜索引擎確實曾經(jīng)發(fā)展非常迅速。源于1994年的網(wǎng)絡(luò)爬蟲使用了標準的信息析取方法。直到1998年Google的出現(xiàn),其間更多的基于Web的方法得到了發(fā)展。從那以后,新方法的引入大大放慢了腳步。那些樹枝低的果實已被收獲。創(chuàng)新只有在剛發(fā)展的時候比較容易,越到后來越成熟,越不容易創(chuàng)新。網(wǎng)絡(luò)搜索引擎起源于上個世紀90年代,現(xiàn)在儼然已成一顆搖錢樹,將來很快會走進人們的日常生活中。 至于開發(fā)上的挑戰(zhàn),我認為操作上的可靠性將是一個大的挑戰(zhàn)。我們目前正在開發(fā)一個類似GFS(Google的文件系統(tǒng))的東西。它是巨型搜索引擎不可缺少的基石:你不能讓一個小組件的錯誤導(dǎo)致一個大的癱瘓。你應(yīng)該很容易的讓系統(tǒng)擴展,只需往硬件池里加更多硬件而不需繁縟的重新配置。還有,你不需要一大坨的操作人員完成,所有的一切將大都自己搞定。 ----------------完---------------------- --? Getting Ready to Use CVSFirst set the variable CVSROOT to /class/`username`/cvsroot[Or any other directory you wish] [For csh/tcsh: setenv CVSROOT ~/cvsroot] [For bash/ksh: CVSROOT=~/cvsroot;export CVSROOT] Next run cvsinit. It will create this directory along with the subdirectory CVSROOT and put several files into CVSROOT. -- How to put a project under CVSA simple program consisting of multiple files is in /workspaces/project.To put this program under cvs first cd to /workspaces/project Next cvs import -m "Sample Program" project sample start CVS should respond with N project/Makefile N project/main.c N project/bar.c N project/foo.c No conflicts created by this import If your were importing your own program, you could now delete the original source. (Of course, keeping a backup is always a good idea) -- Basic CVS UsageNow that you have added 'project' to your CVS repository, you will want to be able to modify the code.To do this you want to check out the source. You will want to cd to your home directory before you do this. cd cvs checkout project CVS should respond with cvs checkout: Updating project U project/Makefile U project/bar.c U project/foo.c U project/main.c This creates the project directory in your home directory and puts the files: Makefile, bar.c, foo.c, and main.c into the directory along with a CVS directory which stores some information about the files. You can now make changes to any of the files in the source tree. Lets say you add a printf("DONE\n"); after the function call to bar() [Or just cp /class/bfennema/project_other/main2.c to main.c] Now you have to check in the new copy cvs commit -m "Added a DONE message." main.c CVS should respond with Checking in main.c; /class/'username'/cvsroot/project/main.c,v <-- main.c new revision: 1.2; previous revision: 1.1 done Note, the -m option lets you define the checking message on the command line. If you omit it you will be placed into an editor where you can type in the checking message. -- Using CVS with Multiple DevelopersTo simulate multiple developers, first create a directory for your second developer.Call it devel2 (Create it in your home directory). Next check out another copy of project.
[Or copy /class/bfennema/project_other/bar2.c to bar.c] Next, check in bar.c as developer two.
[Probably /class/'username'/project] Now look at bar.c. As you can see, the change made by developer one has no been integrated into your version. For that to happen you must cvs update bar.c CVS should respond with U bar.c Now look at bar.c. It should now be the same as developer two's. Next, edit foo.c as the original developer and add printf("YOU\n"); after the printf("FOO\n"); [Or copy /class/bfennema/project_other/foo2.c to foo.c] Then check in foo.c
Add printf("TOO\n"); after the printf("FOO\n"); [Or copy /class/bfennema/project_other/foo3.c to foo.c] Now type cvs status foo.c CVS should respond with =================================================================== File: foo.c Status: Needs Merge Working revision: 1.1.1.1 'Some Date' Repository revision: 1.2 /class/'username'/cvsroot/project/foo.c,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none)The various status of a file are: Up-to-date
Therefore, this is telling use we need to merge our changes with the changes made by developer one. To do this cvs update foo.c CVS should respond with RCS file: /class/'username'/cvsroot/project/foo.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 Merging differences between 1.1.1.1 and 1.2 into foo.c rcsmerge: warning: conflicts during merge cvs update: conflicts found in foo.c C foo.c Since the changes we made to each version were so close together, we must manually adjust foo.c to look the way we want it to look. Looking at foo.c we see: void foo() { printf("FOO\n"); <<<<<<< foo.c printf("TOO\n"); ======= printf("YOU\n"); >>>>>>> 1.2 } We see that the text we added as developer one is between the ======= and the >>>>>>> 1.2. The text we just added is between the ======= and the <<<<<<< foo.c To fix this, move the printf("TOO\n");to after the printf("YOU\n");line and delete the additional lines the CVS inserted. [Or copy /class/bfennema/project_other/foo4.c to foo.c] Next, commit foo.c cvs commit -m "Added TOO" foo.c Since you issued a cvs update command and integrated the changes made by developer one, the integrated changes are committed to the source tree. -- Additional CVS CommandsTo add a new file to a module:
Removing files from a module:
For more information see the cvs man pages or the cvs.ps file in cvs-1.7/doc. --------------- copy from http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/cvs/ http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html When reading GData source code, you will find that there are lots of generic-style code in it, which is one of several extensions of JDK 1.5. If you are using java 1.5 compiler, it is surely deserved to get some ideas about generic. Be noticed that Java generic looks like C++ Temple, but is quite different. http://java.sun.com/j2se/1.5.0/docs/guide/language/index.html Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 12 ?at java.lang.String.substring(Unknown Source) ?at sun.net.www.ParseUtil.unescape(Unknown Source) ?at sun.net.www.ParseUtil.decode(Unknown Source) ?at sun.net.www.ParseUtil.toURI(Unknown Source) ?at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) ?at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) follow is simple testing code: ? private static final String urlstring = " ???URL url = new URL(urlstring); ??? ???URLConnection con = url.openConnection(); ??? ???con.connect(); since there?are no other explicit exceptions except MalformedURLException & IOException mentioned to catch for this code, I am not sure if it is a bug in Java for URL parsing... anybody got some idea about that? P.S. ok, somebody has pointed out that Runtime exceptions, like java.lang.StringIndexOutOfBoundsException, do not have to be declared, but they can be thrown. So i need catch StringIndexOutOfBoundsException this exception for my code. But in my understanding, the function should catch all the exceptions from lower functions, and then throw out if it can not handle them, thus we can catch those exception from deep functions. I am not sure Runtime exceptions are exceptional ... 1. Duplicate URL Elimination: ??? a. Host name aliases --> DNS Resolver ??? b. Omitted port numbers ??? c. Alternative paths on the same host ??? d. replication across difference host ??? e. non-sense links or session IDs embedded in URLs ? 2. Reachable of URL 3. Distributed Storage of URL Inventory and relative synchronization problem 4. Fetch strategies for URL Frontier or Fetchor to get activate links for parsing 5. Scheduler for fetching and updating URL collection: multi-thread or single thread on each pc, when to decide re-parsing a page 7. URL-Seen test: if that page has been parsed and should it re-parse? which should be done before entering URL frontier... 8. Extensibility issues for those modules: Fetcher, Extractor/Filters, Collector... 9. Checkpointing for crawlering interupted: how to resume the crawler job, how to split crawler jobs and distribute to different machines seems that I need couple days to refine my systen architecture design... |
![]() |
|
Copyright © Dedian | Powered by: 博客園 模板提供:滬江博客 |