<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tingan's Weblog</title>
	<atom:link href="http://tingan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tingan.wordpress.com</link>
	<description>ubuntu, drupal,php,mysql,apache,javascript,xml,web</description>
	<lastBuildDate>Mon, 23 Nov 2009 22:54:03 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>zh-cn</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='tingan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/a0fffee2378a7f9018ebfd256bf7334b?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Tingan's Weblog</title>
		<link>http://tingan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://tingan.wordpress.com/osd.xml" title="Tingan&#8217;s Weblog" />
		<item>
		<title>Nutch 1.0 use experience</title>
		<link>http://tingan.wordpress.com/2009/11/23/nutch-1-0-use-experience/</link>
		<comments>http://tingan.wordpress.com/2009/11/23/nutch-1-0-use-experience/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 22:53:43 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/23/nutch-1-0-use-experience/</guid>
		<description><![CDATA[create a dmoz folder under the bin foldercreate a urls text file to contain the urls:http://www.britishhorrorfilms.co.uk/rillington.shtmlhttp://www.shoestring.org/mmi_revs/10-rillington-place.htmlhttp://www.tvguide.com/movies/database/ShowMovie.asp?MI=22983http://us.imdb.com/title/tt0066730/http://www.geocities.com/aaronbcaldwell/1984.htmlhttp://orwell.ru/a_life/movies/m84_01.htmhttp://www.britmovie.co.uk/genres/fiction/filmography/014.htmlhttp://adrianmco.batcave.net/1984.htmhttp://us.imdb.com/title/tt0114746/http://www.geocities.com/darkdaze18/http://apolloguide.com/mov_revtemp.asp?Title=13th+Warrior,+Thehttp://www.boxofficemojo.com/13thwarrior.htmlhttp://movie-reviews.colossus.net/movies/t/13th_warrior.htmlhttp://ter.air0day.com/13thwarrior.shtmlhttp://www.metacritic.com/video/titles/13thwarriorhttp://us.imdb.com/title/tt0120657/http://www.all-reviews.com/videos/thirteenth-warrior.htmhttp://www.haro-online.com/movies/13th_warrior.htmlhttp://www.rottentomatoes.com/movie-1091574/http://upcomingmovies.com/13thwarrior.htmlhttp://www.brunching.com/selfmade/selfmade-thirteenthwarrior.htmlhttp://www.filmtracks.com/titles/13th_warrior.htmlhttp://www.100girls.net/http://imdb.com/title/tt0214388/http://us.imdb.com/title/tt0146394/http://us.imdb.com/title/tt0085121/
tingan@tingan-laptop:~/download/spider/nutch/bin$ cd dmoz/tingan@tingan-laptop:~/download/spider/nutch/bin/dmoz$ lsurlstingan@tingan-laptop:~/download/spider/nutch/bin/dmoz$ gedit urlstingan@tingan-laptop:~/download/spider/nutch/bin/dmoz$ cd ..tingan@tingan-laptop:~/download/spider/nutch/bin$ ./nutch inject crawl-20091123183328/crawldb/ dmoz/Injector: startingInjector: crawlDb: crawl-20091123183328/crawldbInjector: urlDir: dmozInjector: Converting injected urls to crawl db entries.Injector: Merging injected urls into crawl db.Injector: done


       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=141&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>create a dmoz folder under the bin folder<br />create a urls text file to contain the urls:<br />http://www.britishhorrorfilms.co.uk/rillington.shtml<br />http://www.shoestring.org/mmi_revs/10-rillington-place.html<br />http://www.tvguide.com/movies/database/ShowMovie.asp?MI=22983<br />http://us.imdb.com/title/tt0066730/<br />http://www.geocities.com/aaronbcaldwell/1984.html<br />http://orwell.ru/a_life/movies/m84_01.htm<br />http://www.britmovie.co.uk/genres/fiction/filmography/014.html<br />http://adrianmco.batcave.net/1984.htm<br />http://us.imdb.com/title/tt0114746/<br />http://www.geocities.com/darkdaze18/<br />http://apolloguide.com/mov_revtemp.asp?Title=13th+Warrior,+The<br />http://www.boxofficemojo.com/13thwarrior.html<br />http://movie-reviews.colossus.net/movies/t/13th_warrior.html<br />http://ter.air0day.com/13thwarrior.shtml<br />http://www.metacritic.com/video/titles/13thwarrior<br />http://us.imdb.com/title/tt0120657/<br />http://www.all-reviews.com/videos/thirteenth-warrior.htm<br />http://www.haro-online.com/movies/13th_warrior.html<br />http://www.rottentomatoes.com/movie-1091574/<br />http://upcomingmovies.com/13thwarrior.html<br />http://www.brunching.com/selfmade/selfmade-thirteenthwarrior.html<br />http://www.filmtracks.com/titles/13th_warrior.html<br />http://www.100girls.net/<br />http://imdb.com/title/tt0214388/<br />http://us.imdb.com/title/tt0146394/<br />http://us.imdb.com/title/tt0085121/</p>
<p>tingan@tingan-laptop:~/download/spider/nutch/bin$ cd dmoz/<br />tingan@tingan-laptop:~/download/spider/nutch/bin/dmoz$ ls<br />urls<br />tingan@tingan-laptop:~/download/spider/nutch/bin/dmoz$ gedit urls<br />tingan@tingan-laptop:~/download/spider/nutch/bin/dmoz$ cd ..<br />tingan@tingan-laptop:~/download/spider/nutch/bin$ ./nutch inject crawl-20091123183328/crawldb/ dmoz/<br />Injector: starting<br />Injector: crawlDb: crawl-20091123183328/crawldb<br />Injector: urlDir: dmoz<br />Injector: Converting injected urls to crawl db entries.<br />Injector: Merging injected urls into crawl db.<br />Injector: done</p>
<p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=f2d9205a-54eb-87b0-b566-7d2e7a09f9ac" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=141&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/23/nutch-1-0-use-experience/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=f2d9205a-54eb-87b0-b566-7d2e7a09f9ac" medium="image" />
	</item>
		<item>
		<title>Ubuntu Nutch 1.0 Installation</title>
		<link>http://tingan.wordpress.com/2009/11/23/ubuntu-nutch-1-0-installation/</link>
		<comments>http://tingan.wordpress.com/2009/11/23/ubuntu-nutch-1-0-installation/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 20:27:23 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/23/ubuntu-nutch-1-0-installation/</guid>
		<description><![CDATA[1. download and install tomcat 5.5 or tomcat 6.0, you can install both.2. set JAVA_HOME, CLASSPATH environment variablesudo gedit .bashrc&#160; or sudo gedit .profileexport JAVA_HOME=/usr/lib/jvm/java-6-sun#export CATALINA_HOME=/usr/share/tomcat5.5export CATALINA_HOME=/home/tingan/download/Java/apache-tomcat-6.0.20export JAVA_BIN=$JAVA_HOME/binexport PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:/home/tingan/download/spider/nutch/lib:$CATALINA_HOME/common/lib/jsp-api.jar:$CATALINA_HOME/common/lib/servlet-api.jar&#160;in the process of run nutch command line, it shows the error that the java class .Exception in thread &#8220;main&#8221; java.lang.NoClassDefFoundError: org/apache/nutch/crawl/CrawlI copy the nutch-1.0.jar to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=135&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>1. download and install tomcat 5.5 or tomcat 6.0, you can install both.<br />2. set JAVA_HOME, CLASSPATH environment variable<br />sudo gedit .bashrc&nbsp; or sudo gedit .profile<br />export JAVA_HOME=/usr/lib/jvm/java-6-sun<br />#export CATALINA_HOME=/usr/share/tomcat5.5<br />export CATALINA_HOME=/home/tingan/download/Java/apache-tomcat-6.0.20<br />export JAVA_BIN=$JAVA_HOME/bin<br />export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin<br />export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:/home/tingan/download/spider/nutch/lib:$CATALINA_HOME/common/lib/jsp-api.jar:$CATALINA_HOME/common/lib/servlet-api.jar<br />&nbsp;<br />in the process of run nutch command line, it shows the error that the java class .<br />Exception in thread &#8220;main&#8221; java.lang.NoClassDefFoundError: org/apache/nutch/crawl/Crawl<br />I copy the nutch-1.0.jar to the $JAVA_HOME/lib/nutch.jar and add a line to the CLASSPATH variable.</p>
<p>3. test nutch command line<br />/home/tingan/download/spider/nutch/bin
<div style="margin:14pt 0 14.5pt;"><strong><font size="3"><font size="5">创建目录</font></font></strong></div>
<div><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>在nutch\bin 目录下创建一个urls目录，然后在目录里面新建一个文件，文件名为 “url.txt”,内容为你要爬行的网站如：<a href="http://www.sina.com.cn/">http://www.sina.com.cn</a>或者 http://133.40.188.130:8880/klms</div>
<div style="margin:14pt 0 14.5pt;"><strong><font size="3"><font size="5">3、修改nutch\conf\crawl-urlfilter.txt文件</font></font></strong></div>
<div style="text-indent:21pt;line-height:150%;margin:0 0 10.5pt;" align="left">打 开nutch\conf\crawl-urlfilter.txt文件，把MY.DOMAIN.NAME字符替换为url.txt内的url的域名，其实 更简单点，直接删除MY.DOMAIN.NAME这几个字就可以了，也就是说，只保存+^http://([a-z0-9]*\.)*这几个字就可以了， 表示所有http的网站都同意爬行。<br />如：+^http://([a-z0-9]*\.)*133.40.188.130:8880/</div>
<div style="line-height:150%;margin:0 0 10.5pt;" align="left">或者：+^http://([a-z0-9]*\.)*sina.com.cn/</div>
<div style="margin:14pt 0 14.5pt;"><strong><font size="3"><font size="5">4、修改nutch\conf\conf/nutch-site.xml文件</font></font></strong></div>
<div style="line-height:150%;margin:0 0 10.5pt;" align="left">&nbsp;&nbsp;<span>&nbsp;&nbsp;&nbsp;&nbsp; </span>打开nutch\conf\conf/nutch-site.xml文件，在内插入一下内容：<strong>注：如果是</strong><strong>sina.com.cn </strong><strong>则value </strong><strong>的值修改为：http://www.sina.com.cn</strong></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http.robots.agents</span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://133.40.188.130:8880/klms </span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http.agent.name</span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://133.40.188.130:8880/klms</span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http.agent.url</span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://133.40.188.130:8880/klms</span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div style="line-height:110%;text-align:left;margin:0 0 0 18pt;" align="left">&nbsp;</div>
<div style="line-height:150%;margin:0 0 10.5pt;" align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;把XXX之间的内容替换为其他字符，当然就算是不替换也无所谓，这里的设置，是因为nutch遵守了robots协议，在获取response时，把自己的相关信息提交给被爬行的网站，以供识别。</div>
<div style="margin:14pt 0 14.5pt;"><strong><font size="3"><font size="5">5、修改nutch\conf\nutch-default.xml </font></font></strong></div>
<div style="text-indent:21pt;line-height:150%;margin:0 0 10.5pt;" align="left">打开nutch\conf\nutch-default.xml 文件，找到http.agent.name ，然后把Value值随便设计一个。</div>
<div style="line-height:150%;margin:0 0 10.5pt;" align="left">http.agent.name</div>
<div style="line-height:150%;margin:0 0 10.5pt;" align="left">&nbsp;sina</div>
<div style="text-indent:5.25pt;line-height:150%;margin:0 0 10.5pt;" align="left">以上配置，是爬取intranet的配置方式。</div>
<div style="margin:14pt 0 14.5pt;"><strong><font size="3"><span style="font-size:22pt;line-height:156%;">6</span><span style="font-size:22pt;line-height:156%;">、执行</span><span style="font-size:22pt;line-height:156%;">nutch</span></font></strong></div>
<div style="text-indent:15.75pt;line-height:150%;margin:0 0 10.5pt;" align="left">由于配置nutch采用的是单独网站的配置方式，所以执行上我们也采用的是单网查询，全网查询在以后的内容中介绍。</div>
<div style="text-indent:15.75pt;line-height:150%;margin:0 0 10.5pt;" align="left">先看一看nutch给出的命令：nutch crawl urls -dir crawl -depth 3 -topN 50</div>
<div style="text-indent:15.75pt;line-height:150%;margin:0 0 10.5pt;" align="left">crawl：通知nutch.jar，执行crawl的main方法。</div>
<div style="text-indent:15.75pt;line-height:150%;margin:0 0 10.5pt;" align="left">urls：存放需要爬行的url.txt文件的目录，注意，这个名字需要和你的文件夹目录相同，如果你的文件夹为search，那这里也应该改成search。</div>
<div style="text-indent:15.75pt;line-height:150%;margin:0 0 10.5pt;" align="left">&nbsp;-dir crawl：爬行后文件保存的位置，可以在nutch/bin目录下找到。</div>
<div style="text-indent:15.75pt;line-height:150%;margin:0 0 10.5pt;" align="left">-depth 3：爬行次数，或者成为深度，不过还是觉得次数更贴切，建议测试时改为1。</div>
<div style="text-indent:15.75pt;line-height:150%;margin:0 0 10.5pt;" align="left">&nbsp;-topN 50：一个网站保存的最大页面数。</div>
<div style="text-indent:15.75pt;line-height:150%;margin:0 0 10.5pt;" align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;执行命令的步骤：</div>
<div style="text-indent:-18pt;line-height:150%;text-align:left;margin:0 0 10.5pt 50.25pt;" align="left"><span>1．<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"><font size="3">&nbsp; </font></span></span>进入cygwin界面。</div>
<div style="text-indent:-18pt;line-height:150%;text-align:left;margin:0 0 10.5pt 50.25pt;" align="left"><span>2．<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"><font size="3">&nbsp; </font></span></span>使用cd命令，进入nutch\bin路径下。</div>
<div style="text-indent:-18pt;line-height:150%;text-align:left;margin:0 0 10.5pt 50.25pt;" align="left"><span>3．<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"><font size="3">&nbsp; </font></span></span>执行：sh nutch crawl urls -dir crawl -depth 3 -topN 50</div>
<div style="text-indent:-18pt;line-height:150%;text-align:left;margin:0 0 10.5pt 50.25pt;" align="left"><span>4．<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"><font size="3">&nbsp; </font></span></span>具体的爬行日志可以在nutch/logs目录下看到，注意查找“INFO&nbsp; fetcher.Fetcher &#8211; fetching <a href="http://xxxxxxx/"><span style="color:windowtext;">http://XXXXXXX</span>”这样的内容，这里是抓去过程日志。</a></div>
<div style="margin:14pt 0 14.5pt;"><strong><font size="3"><font size="5">7、查询搜索：</font></font></strong></div>
<div style="text-indent:21pt;line-height:150%;margin:0 0 10.5pt;" align="left">nutch 提供了类似google、baidu的网页页面，在nutch压缩包下找到nutch-0.8.war文件，放到tomcat/webapps目录下，修 改webapps/nutch/WEB-INF/classes/nutch-site.xml文件内容如下：</div>
<div style="line-height:150%;margin:0 0 10.5pt;" align="left"></div>
<div style="line-height:150%;margin:0 0 10.5pt 21pt;" align="left">searcher.dir <br />/home/tingan/download/spider/nutch/bin/crawl-20091123183328 </div>
<div style="line-height:150%;margin:0 0 10.5pt;" align="left"></div>
<div style="line-height:150%;margin:0 0 10.5pt;" align="left">&nbsp;&nbsp;&nbsp;的内容是刚才爬行后的crawl目录位置，提供给客户端来查询。<br />/home/tingan/download/spider/nutch/bin/crawl-20091123183328<br />这个目录是在执行nutch/bin/nutch crawl url.txt后在bin文件夹中生成的内容文件夹。</p>
<p><b>中文乱码问题：</b></p>
<p>在Nutch的搜索框中输入中文，点击“搜索”按钮之后，可以看到搜索框中的关键字是乱码，搜索结果也为空。网上有很多文章都谈到了这个现象，这不 是Nutch的问题，而是Tomcat没有对uri做编码造成的。解决的办法也很简单，在Tomcat的安装目录下找 到”conf/server.xml”文件，在“Connector port=”8080″”那一节添加“URIEncoding=”UTF-8″ useBodyEncodingForURI=”true””就可以了。完整的配置可能是下面这个样子：</p>
<p> maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″<br />enableLookups=”false” redirectPort=”8443″ acceptCount=”100″<br />connectionTimeout=”20000″ disableUploadTimeout=”true”<br />URIEncoding=”UTF-8″ useBodyEncodingForURI=”true” /&gt;</p>
<p>/home/tingan/download/spider/nutch/bin/crawl-20091124001536</div>
<p>
<h3 class="close"><a href="http://www.javaeye.com/problems/2374">关于<span class="hilite1">nutch</span>-0.9在使用过程中的错误</a></h3>
<h4>悬赏：<span class="score">5</span> 发布时间：2008-08-07 提问人：<a href="http://zhaojuan8.javaeye.com/" target="_blank">zhaojuan8</a> (初级程序员) </h4>
<div class="content">    看log日志 
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><span class="hilite2">Java</span>代码   </div>
</div>
<ol class="dp-j" start="1">
<li><span><span>crawl&nbsp;started&nbsp;in:&nbsp;mydir&nbsp;&nbsp;</span></span></li>
<li><span>rootUrlDir&nbsp;=&nbsp;url&nbsp;&nbsp;</span></li>
<li><span>threads&nbsp;=&nbsp;<span class="number">4</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>depth&nbsp;=&nbsp;<span class="number">2</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Injector:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>Injector:&nbsp;crawlDb:&nbsp;mydir/crawldb&nbsp;&nbsp;</span></li>
<li><span>Injector:&nbsp;urlDir:&nbsp;url&nbsp;&nbsp;</span></li>
<li><span>Injector:&nbsp;Converting&nbsp;injected&nbsp;urls&nbsp;to&nbsp;crawl&nbsp;db&nbsp;entries.&nbsp;&nbsp;</span></li>
<li><span>Injector:&nbsp;Merging&nbsp;injected&nbsp;urls&nbsp;into&nbsp;crawl&nbsp;db.&nbsp;&nbsp;</span></li>
<li><span>Injector:&nbsp;done&nbsp;&nbsp;</span></li>
<li><span>Generator:&nbsp;Selecting&nbsp;best-scoring&nbsp;urls&nbsp;due&nbsp;<span class="keyword">for</span><span>&nbsp;fetch.&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>Generator:&nbsp;segment:&nbsp;mydir/segments/<span class="number">20080713015110</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;filtering:&nbsp;<span class="keyword">false</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;topN:&nbsp;<span class="number">2147483647</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;jobtracker&nbsp;is&nbsp;<span class="string">&#8216;local&#8217;</span><span>,&nbsp;generating&nbsp;exactly&nbsp;one&nbsp;partition.&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;Partitioning&nbsp;selected&nbsp;urls&nbsp;by&nbsp;host,&nbsp;<span class="keyword">for</span><span>&nbsp;politeness.&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;done.&nbsp;&nbsp;</span></li>
<li><span>Fetcher:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>Fetcher:&nbsp;segment:&nbsp;mydir/segments/<span class="number">20080713015110</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Fetcher:&nbsp;threads:&nbsp;<span class="number">4</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>fetching&nbsp;http:<span class="comment">//wwww.sina.com.cn/</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>fetch&nbsp;of&nbsp;http:<span class="comment">//wwww.sina.com.cn/&nbsp;failed&nbsp;with:&nbsp;org.apache.<span class="hilite1">nutch</span>.protocol.http.api.HttpException:&nbsp;<span class="hilite2">java</span>.net.UnknownHostException:&nbsp;wwww.sina.com.cn</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Fetcher:&nbsp;done&nbsp;&nbsp;</span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;db:&nbsp;mydir/crawldb&nbsp;&nbsp;</span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;segments:&nbsp;[mydir/segments/<span class="number">20080713015110</span><span>]&nbsp;&nbsp;</span></span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;additions&nbsp;allowed:&nbsp;<span class="keyword">true</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;URL&nbsp;normalizing:&nbsp;<span class="keyword">true</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;URL&nbsp;filtering:&nbsp;<span class="keyword">true</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;Merging&nbsp;segment&nbsp;data&nbsp;into&nbsp;db.&nbsp;&nbsp;</span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;done&nbsp;&nbsp;</span></li>
<li><span>Generator:&nbsp;Selecting&nbsp;best-scoring&nbsp;urls&nbsp;due&nbsp;<span class="keyword">for</span><span>&nbsp;fetch.&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>Generator:&nbsp;segment:&nbsp;mydir/segments/<span class="number">20080713015119</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;filtering:&nbsp;<span class="keyword">false</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;topN:&nbsp;<span class="number">2147483647</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;jobtracker&nbsp;is&nbsp;<span class="string">&#8216;local&#8217;</span><span>,&nbsp;generating&nbsp;exactly&nbsp;one&nbsp;partition.&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;Partitioning&nbsp;selected&nbsp;urls&nbsp;by&nbsp;host,&nbsp;<span class="keyword">for</span><span>&nbsp;politeness.&nbsp;&nbsp;</span></span></li>
<li><span>Generator:&nbsp;done.&nbsp;&nbsp;</span></li>
<li><span>Fetcher:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>Fetcher:&nbsp;segment:&nbsp;mydir/segments/<span class="number">20080713015119</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Fetcher:&nbsp;threads:&nbsp;<span class="number">4</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>fetching&nbsp;http:<span class="comment">//wwww.sina.com.cn/</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>fetch&nbsp;of&nbsp;http:<span class="comment">//wwww.sina.com.cn/&nbsp;failed&nbsp;with:&nbsp;org.apache.<span class="hilite1">nutch</span>.protocol.http.api.HttpException:&nbsp;<span class="hilite2">java</span>.net.UnknownHostException:&nbsp;wwww.sina.com.cn</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Fetcher:&nbsp;done&nbsp;&nbsp;</span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;db:&nbsp;mydir/crawldb&nbsp;&nbsp;</span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;segments:&nbsp;[mydir/segments/<span class="number">20080713015119</span><span>]&nbsp;&nbsp;</span></span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;additions&nbsp;allowed:&nbsp;<span class="keyword">true</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;URL&nbsp;normalizing:&nbsp;<span class="keyword">true</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;URL&nbsp;filtering:&nbsp;<span class="keyword">true</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;Merging&nbsp;segment&nbsp;data&nbsp;into&nbsp;db.&nbsp;&nbsp;</span></li>
<li><span>CrawlDb&nbsp;update:&nbsp;done&nbsp;&nbsp;</span></li>
<li><span>LinkDb:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>LinkDb:&nbsp;linkdb:&nbsp;mydir/linkdb&nbsp;&nbsp;</span></li>
<li><span>LinkDb:&nbsp;URL&nbsp;normalize:&nbsp;<span class="keyword">true</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>LinkDb:&nbsp;URL&nbsp;filter:&nbsp;<span class="keyword">true</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>LinkDb:&nbsp;adding&nbsp;segment:&nbsp;mydir/segments/<span class="number">20080713015110</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>LinkDb:&nbsp;adding&nbsp;segment:&nbsp;mydir/segments/<span class="number">20080713015119</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>LinkDb:&nbsp;done&nbsp;&nbsp;</span></li>
<li><span>Indexer:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>Indexer:&nbsp;linkdb:&nbsp;mydir/linkdb&nbsp;&nbsp;</span></li>
<li><span>Indexer:&nbsp;adding&nbsp;segment:&nbsp;mydir/segments/<span class="number">20080713015110</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Indexer:&nbsp;adding&nbsp;segment:&nbsp;mydir/segments/<span class="number">20080713015119</span><span>&nbsp;&nbsp;</span></span></li>
<li><span>Optimizing&nbsp;index.&nbsp;&nbsp;</span></li>
<li><span>Indexer:&nbsp;done&nbsp;&nbsp;</span></li>
<li><span>Dedup:&nbsp;starting&nbsp;&nbsp;</span></li>
<li><span>Dedup:&nbsp;adding&nbsp;indexes&nbsp;in:&nbsp;mydir/indexes&nbsp;&nbsp;</span></li>
<li><span><span class="hilite4">Exception</span>&nbsp;in&nbsp;thread&nbsp;<span class="string">&#8220;main&#8221;</span><span>&nbsp;<span class="hilite2">java</span>.<span class="hilite3">io</span>.IOException:&nbsp;<span class="hilite5">Job</span>&nbsp;failed!&nbsp;&nbsp;</span></span></li>
<li><span>&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;org.apache.hadoop.mapred.JobClient.runJob(JobClient.<span class="hilite2">java</span>:<span class="number">604</span><span>)&nbsp;&nbsp;</span></span></li>
<li><span>&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;org.apache.<span class="hilite1">nutch</span>.indexer.DeleteDuplicates.dedup(DeleteDuplicates.<span class="hilite2">java</span>:<span class="number">439</span><span>)&nbsp;&nbsp;</span></span></li>
<li><span>&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;org.apache.<span class="hilite1">nutch</span>.crawl.Crawl.main(Crawl.<span class="hilite2">java</span>:<span class="number">135</span><span>)&nbsp;&nbsp;</span></span></li>
</ol>
</div>
<pre style="display:none;" class="java">crawl started in: mydir rootUrlDir = url threads = 4 depth = 2 Injector: starting Injector: crawlDb: mydir/crawldb Injector: urlDir: url Injector: Converting injected urls to crawl db entries. Injector: Merging injected urls into crawl db. Injector: done Generator: Selecting best-scoring urls due for fetch. Generator: starting Generator: segment: mydir/segments/20080713015110 Generator: filtering: false Generator: topN: 2147483647 Generator: jobtracker is 'local', generating exactly one partition. Generator: Partitioning selected urls by host, for politeness. Generator: done. Fetcher: starting Fetcher: segment: mydir/segments/20080713015110 Fetcher: threads: 4 fetching http://wwww.sina.com.cn/ fetch of http://wwww.sina.com.cn/ failed with: org.apache.&lt;span class="hilite1"&gt;nutch&lt;/span&gt;.protocol.http.api.HttpException: &lt;span class="hilite2"&gt;java&lt;/span&gt;.net.UnknownHostException: wwww.sina.com.cn Fetcher: done CrawlDb update: starting CrawlDb update: db: mydir/crawldb CrawlDb update: segments: [mydir/segments/20080713015110] CrawlDb update: additions allowed: true CrawlDb update: URL normalizing: true CrawlDb update: URL filtering: true CrawlDb update: Merging segment data into db. CrawlDb update: done Generator: Selecting best-scoring urls due for fetch. Generator: starting Generator: segment: mydir/segments/20080713015119 Generator: filtering: false Generator: topN: 2147483647 Generator: jobtracker is 'local', generating exactly one partition. Generator: Partitioning selected urls by host, for politeness. Generator: done. Fetcher: starting Fetcher: segment: mydir/segments/20080713015119 Fetcher: threads: 4 fetching http://wwww.sina.com.cn/ fetch of http://wwww.sina.com.cn/ failed with: org.apache.&lt;span class="hilite1"&gt;nutch&lt;/span&gt;.protocol.http.api.HttpException: &lt;span class="hilite2"&gt;java&lt;/span&gt;.net.UnknownHostException: wwww.sina.com.cn Fetcher: done CrawlDb update: starting CrawlDb update: db: mydir/crawldb CrawlDb update: segments: [mydir/segments/20080713015119] CrawlDb update: additions allowed: true CrawlDb update: URL normalizing: true CrawlDb update: URL filtering: true CrawlDb update: Merging segment data into db. CrawlDb update: done LinkDb: starting LinkDb: linkdb: mydir/linkdb LinkDb: URL normalize: true LinkDb: URL filter: true LinkDb: adding segment: mydir/segments/20080713015110 LinkDb: adding segment: mydir/segments/20080713015119 LinkDb: done Indexer: starting Indexer: linkdb: mydir/linkdb Indexer: adding segment: mydir/segments/20080713015110 Indexer: adding segment: mydir/segments/20080713015119 Optimizing index. Indexer: done Dedup: starting Dedup: adding indexes in: mydir/indexes &lt;span class="hilite4"&gt;Exception&lt;/span&gt; in thread "main" &lt;span class="hilite2"&gt;java&lt;/span&gt;.&lt;span class="hilite3"&gt;io&lt;/span&gt;.IOException: &lt;span class="hilite5"&gt;Job&lt;/span&gt; failed! 	at org.apache.hadoop.mapred.JobClient.runJob(JobClient.&lt;span class="hilite2"&gt;java&lt;/span&gt;:604) 	at org.apache.&lt;span class="hilite1"&gt;nutch&lt;/span&gt;.indexer.DeleteDuplicates.dedup(DeleteDuplicates.&lt;span class="hilite2"&gt;java&lt;/span&gt;:439) 	at org.apache.&lt;span class="hilite1"&gt;nutch&lt;/span&gt;.crawl.Crawl.main(Crawl.&lt;span class="hilite2"&gt;java&lt;/span&gt;:135) </pre>
<p>crawl-urlfilter.txt 
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><span class="hilite2">Java</span>代码   </div>
</div>
<ol class="dp-j" start="1">
<li><span><span>#&nbsp;accept&nbsp;hosts&nbsp;in&nbsp;MY.DOMAIN.NAME&nbsp;&nbsp;</span></span></li>
<li><span>+^http:<span class="comment">//([a-z0-9]*\.)*sina.com.cn/</span><span>&nbsp;&nbsp;</span></span></li>
</ol>
</div>
<pre style="display:none;" class="java"># accept hosts in MY.DOMAIN.NAME +^http://([a-z0-9]*\.)*sina.com.cn/</pre>
<p>这个错误困扰了我半天时间,找了许多资料都不能解决,那位高人给看看 </p>
<p><strong>问题补充：</strong><br /><span class="hilite1">nutch</span>-site.xml的配置如下： <br />&lt;configuration&gt; <br />&lt;property&gt; &lt;name&gt;http.agent.name&lt;/name&gt; &lt;value&gt;ihooyo&lt;/value&gt; &lt;description&gt;&lt;/description&gt; &lt;/property&gt; &lt;property&gt; &lt;name&gt;http.agent.description&lt;/name&gt; &lt;value&gt;apersonblog&lt;/value&gt; &lt;description&gt;&lt;/description&gt; &lt;/property&gt; &lt;property&gt; &lt;name&gt;http.agent.url&lt;/name&gt; &lt;value&gt;www.sina.com.cn&lt;/value&gt; &lt;description&gt;&lt;/description&gt; &lt;/property&gt; &lt;property&gt; &lt;name&gt;http.agent.email&lt;/name&gt; &lt;value&gt;test@qq.com&lt;/value&gt; &lt;description&gt;&lt;/description&gt; &lt;/property&gt; <br />&lt;/configuration&gt;<br />
<hr /> <strong>该问题已经关闭: </strong>问题找到了，# accept hosts in MY.DOMAIN.NAME    +^http://([a-z0-9]*\.)*sina.com.cn/   直接改成 +^http://www.sina.com.cn/   好了       </div>
<p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=9bb9f66c-8752-8bc4-a865-5996c0734bca" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/135/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=135&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/23/ubuntu-nutch-1-0-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=9bb9f66c-8752-8bc4-a865-5996c0734bca" medium="image" />
	</item>
		<item>
		<title>Ubuntu Linux 8.04系统JAVA环境配置方法</title>
		<link>http://tingan.wordpress.com/2009/11/23/ubuntu-linux-8-04%e7%b3%bb%e7%bb%9fjava%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae%e6%96%b9%e6%b3%95/</link>
		<comments>http://tingan.wordpress.com/2009/11/23/ubuntu-linux-8-04%e7%b3%bb%e7%bb%9fjava%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 16:18:08 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/23/ubuntu-linux-8-04%e7%b3%bb%e7%bb%9fjava%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae%e6%96%b9%e6%b3%95/</guid>
		<description><![CDATA[1、首先安装JDK 
　　Java6 在命令行输入 apt-get install sun-Java6-jre sun-Java6-jdk 可以自行选择是否安装jre 
　　Java5 在命令行输入 apt-get install sun-Java5-jre sun-Java5-jdk 
　　多个jdk可以同时安装，而且可以随时更改当前的默认jdk 
　　在命令行输入 sudo update-alternatives &#8211;config Javac 来更改当前默认jdk 
　　sun-Java5-doc和sun-Java6-doc是jdk的文档的安装程序，但是不包括jdk文档。 
　　在安装jdk文档前，必须到sun的网站下载jdk文档。你下载的文档可以是任意语言，包括中文例如你 安装jdk5的文档，应该在安装前把下载的文档存放到/tmp/jdk-1_5_0-doc.zip；再例如你安装jdk6的文档，应该在安装前将下载的 文档存放到 /tmp/jdk-6-doc.zip。当然你也可以不在安装前做这件事情，因为安装的过程会提示你这么做，请注意看终端窗口的提示。 
　　写入环境变量 gedit /etc/environment 
　　在编辑器中加入 Java_HOME=/usr/lib/jvm/Java-6-sun 
　　classpath不必配置，错误的classpath会导致许多问题。jvm会知道自带的classpath。对于自定义的classpath，可以在运行、编译时加上-classpath参数来指定。至于环境变量，当你写的程序需要时再指定也不迟 
　　要使配置生效必须在命令行输入 . /etc/environment 
　　如果需要还要修改系统虚拟机的优先级顺序调整： sudo gedit /etc/jvm 
　　jdk安装完毕，在终端输入 Java －version 查看是否安装成功（或直接输入Java） 
　　2、安装　　
　　从tomcat官方网站下载绿色的即可，解压后运行bin目录下的startup.sh 
　　在浏览器输入http://localhost:8080 查看tomcat是否启动 
　　要关闭tomcat只要运行bin目录下shutdown.sh即可 
　　如果需要tomcat开机启动可以参照一下方法： 
　　修改/etc/rc.local 文件 gedit /etc/rc.local 加入 
　　Java_HOME=/usr/lib/jvm/Java-6-sun 
　　CLASSPATH=.:/usr/lib/jvm/Java-6-sun/lib [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=133&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>1、首先安装JDK </strong>
<p>　　<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>6 在命令行输入 apt-get install sun-<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>6-jre sun-<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>6-jdk 可以自行选择是否安装jre </p>
<p>　　<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>5 在命令行输入 apt-get install sun-<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>5-jre sun-<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>5-jdk </p>
<p>　　多个jdk可以同时安装，而且可以随时更改当前的默认jdk </p>
<p>　　在命令行输入 sudo update-alternatives &#8211;config <a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>c 来更改当前默认jdk </p>
<p>　　sun-<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>5-doc和sun-<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>6-doc是jdk的文档的安装程序，但是不包括jdk文档。 </p>
<p>　　在安装jdk文档前，必须到sun的网站下载jdk文档。你下载的文档可以是任意语言，包括中文例如你 安装jdk5的文档，应该在安装前把下载的文档存放到/tmp/jdk-1_5_0-doc.zip；再例如你安装jdk6的文档，应该在安装前将下载的 文档存放到 /tmp/jdk-6-doc.zip。当然你也可以不在安装前做这件事情，因为安装的过程会提示你这么做，请注意看终端窗口的提示。 </p>
<p>　　写入环境变量 gedit /etc/environment </p>
<p>　　在编辑器中加入 <a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>_HOME=/usr/lib/jvm/<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>-6-sun </p>
<p>　　classpath不必配置，错误的classpath会导致许多问题。jvm会知道自带的classpath。对于自定义的classpath，可以在运行、编译时加上-classpath参数来指定。至于环境变量，当你写的程序需要时再指定也不迟 </p>
<p>　　要使配置生效必须在命令行输入 . /etc/environment </p>
<p>　　如果需要还要修改系统虚拟机的优先级顺序调整： sudo gedit /etc/jvm </p>
<p>　　jdk安装完毕，在终端输入 <a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a> －version 查看是否安装成功（或直接输入<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>） </p>
<p>　　<strong>2、安装</strong>　　</p>
<p>　　从tomcat官方网站下载绿色的即可，解压后运行bin目录下的startup.sh </p>
<p>　　在浏览器输入http://localhost:8080 查看tomcat是否启动 </p>
<p>　　要关闭tomcat只要运行bin目录下shutdown.sh即可 </p>
<p>　　如果需要tomcat开机启动可以参照一下方法： </p>
<p>　　修改/etc/rc.local 文件 gedit /etc/rc.local 加入 </p>
<p>　　<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>_HOME=/usr/lib/jvm/<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>-6-sun </p>
<p>　　CLASSPATH=.:/usr/lib/jvm/<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>-6-sun/lib </p>
<p>　　JRE_HOME=/usr/lib/jvm/<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>-6-sun/jre </p>
<p>　　export JRE_HOME </p>
<p>　　export CLASSPATH </p>
<p>　　export <a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>_HOME </p>
<p>　　/home/allenwei/Tomcat/apache-tomcat-6.0.14/bin/startup.sh //你放tomcat的目录 </p>
<p>　　修改/etc/profile 输入 gedit /etc/profile，增加以下行： </p>
<p>　　<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>_HOME=/usr/lib/jvm/<a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>-6-sun </p>
<p>　　CATALINA_HOME=/home/test/Tomcat/apache-tomcat-6.0.14 </p>
<p>　　export <a href="http://server.zdnet.com.cn/files/list-0-0-166407-1-1.htm" title="Java">Java</a>_HOME CATALINA_HOME </p>
<p>　　重启系统后tomcat就可以随开机启动了 </p>
<p>　　<strong>3、安装mysql </strong></p>
<p>　　首先 sudo apt-get install mysql-server mysql-client </p>
<p>　　安装完成后输入 sudo /etc/init.d/mysql start 启动mysql </p>
<p>　　此时需要修改root的密码 </p>
<p>　　查看默认密码输入 sudo gedit /etc/mysql/debian.cnf 在［client］段可以看到用户名密码 </p>
<p>　　输入 mysql -uroot -p 登录，提示输入密码，输入在debian.cnf文件中的密码 </p>
<p>　　修改密码 输入 GRANT ALL PRIVILEGES ON *.* TO root@localhostIDENTIFIED BY &#8220;你要修改的密码&#8221; </p>
<p>　　此时mysql 的安装完成 </p>
<p>　　您也可以安装mysql 的图形化管理工具 sudo apt-get mysql-admin mysql-query-browser </p>
<p>　　<strong>4、eclipse 和 netbeans 的安装就很简单了，从官方网站上下载 deb包，安装即可。</strong>　</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=5ab0f194-d260-8c1f-89ef-5a02788546a2" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=133&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/23/ubuntu-linux-8-04%e7%b3%bb%e7%bb%9fjava%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=5ab0f194-d260-8c1f-89ef-5a02788546a2" medium="image" />
	</item>
		<item>
		<title>PHP URL query</title>
		<link>http://tingan.wordpress.com/2009/11/21/php-url-query/</link>
		<comments>http://tingan.wordpress.com/2009/11/21/php-url-query/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 22:46:11 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/21/php-url-query/</guid>
		<description><![CDATA[parse_url


 &#60;?php$url&#160;=&#160;'http://username:password@hostname/path?arg=value#anchor';
print_r(parse_url($url));
echo&#160;parse_url($url,&#160;PHP_URL_PATH);?&#62;  


The above example will output:



Array
(
    [scheme] =&#62; http
    [host] =&#62; hostname
    [user] =&#62; username
    [pass] =&#62; password
    [path] =&#62; /path
    [query] =&#62; arg=value
    [fragment] =&#62; anchor
)
&#60;big&#62;&#60;big&#62;&#60;b&#62;Http_build_query&#60;/b&#62;&#60;/big&#62;&#60;/big&#62;


 $data&#160;=&#160;array('foo'=&#62;'bar',&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;'baz'=&#62;'boom',&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;'cow'=&#62;'milk',&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;'php'=&#62;'hypertext&#160;processor');
echo&#160;http_build_query($data);&#160;//&#160;foo=bar&#38;baz=boom&#38;cow=milk&#38;php=hypertext+processorecho&#160;http_build_query($data,&#160;'',&#160;'&#38;amp;');&#160;//&#160;foo=bar&#38;amp;baz=boom&#38;amp;cow=milk&#38;amp;php=hypertext+processor
?&#62;  

http_build_url


 echo&#160;http_build_url("http://user@www.example.com/pub/index.php?a=b#files",&#160;&#160;&#160;&#160;array(&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;"scheme"&#160;=&#62;&#160;"ftp",&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;"host"&#160;=&#62;&#160;"ftp.example.com",&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;"path"&#160;=&#62;&#160;"files/current/",&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;"query"&#160;=&#62;&#160;"a=c"&#160;&#160;&#160;&#160;),&#160;&#160;&#160;&#160;HTTP_URL_STRIP_AUTH&#160;&#124;&#160;HTTP_URL_JOIN_PATH&#160;&#124;&#160;HTTP_URL_JOIN_QUERY&#160;&#124;&#160;HTTP_URL_STRIP_FRAGMENT);?&#62;  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=131&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h1 class="refname">parse_url</h1>
<p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color:rgb(0,0,0);"> <span style="color:rgb(0,0,187);">&lt;?php<br />$url&nbsp;</span><span style="color:rgb(0,119,0);">=&nbsp;</span><span style="color:rgb(221,0,0);">'http://username:password@hostname/path?arg=value#anchor'</span><span style="color:rgb(0,119,0);">;</p>
<p></span><span style="color:rgb(0,0,187);">print_r</span><span style="color:rgb(0,119,0);">(</span><span style="color:rgb(0,0,187);">parse_url</span><span style="color:rgb(0,119,0);">(</span><span style="color:rgb(0,0,187);">$url</span><span style="color:rgb(0,119,0);">));</p>
<p>echo&nbsp;</span><span style="color:rgb(0,0,187);">parse_url</span><span style="color:rgb(0,119,0);">(</span><span style="color:rgb(0,0,187);">$url</span><span style="color:rgb(0,119,0);">,&nbsp;</span><span style="color:rgb(0,0,187);">PHP_URL_PATH</span><span style="color:rgb(0,119,0);">);<br /></span><span style="color:rgb(0,0,187);">?&gt;</span> </span> </code></div>
</p></div>
<div class="example-contents para">
<p>The above example will output:</p>
</div>
<div class="example-contents screen">
<div class="cdata">
<pre>Array
(
    [scheme] =&gt; http
    [host] =&gt; hostname
    [user] =&gt; username
    [pass] =&gt; password
    [path] =&gt; /path
    [query] =&gt; arg=value
    [fragment] =&gt; anchor
)
&lt;big&gt;&lt;big&gt;&lt;b&gt;Http_build_query&lt;/b&gt;&lt;/big&gt;&lt;/big&gt;
</pre>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color:rgb(0,0,0);"> <span style="color:rgb(0,0,187);">$data&nbsp;</span><span style="color:rgb(0,119,0);">=&nbsp;array(</span><span style="color:rgb(221,0,0);">'foo'</span><span style="color:rgb(0,119,0);">=&gt;</span><span style="color:rgb(221,0,0);">'bar'</span><span style="color:rgb(0,119,0);">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(221,0,0);">'baz'</span><span style="color:rgb(0,119,0);">=&gt;</span><span style="color:rgb(221,0,0);">'boom'</span><span style="color:rgb(0,119,0);">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(221,0,0);">'cow'</span><span style="color:rgb(0,119,0);">=&gt;</span><span style="color:rgb(221,0,0);">'milk'</span><span style="color:rgb(0,119,0);">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(221,0,0);">'php'</span><span style="color:rgb(0,119,0);">=&gt;</span><span style="color:rgb(221,0,0);">'hypertext&nbsp;processor'</span><span style="color:rgb(0,119,0);">);</p>
<p>echo&nbsp;</span><span style="color:rgb(0,0,187);">http_build_query</span><span style="color:rgb(0,119,0);">(</span><span style="color:rgb(0,0,187);">$data</span><span style="color:rgb(0,119,0);">);&nbsp;</span><span style="color:rgb(255,128,0);">//&nbsp;foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor<br /></span><span style="color:rgb(0,119,0);">echo&nbsp;</span><span style="color:rgb(0,0,187);">http_build_query</span><span style="color:rgb(0,119,0);">(</span><span style="color:rgb(0,0,187);">$data</span><span style="color:rgb(0,119,0);">,&nbsp;</span><span style="color:rgb(221,0,0);">''</span><span style="color:rgb(0,119,0);">,&nbsp;</span><span style="color:rgb(221,0,0);">'&amp;amp;'</span><span style="color:rgb(0,119,0);">);&nbsp;</span><span style="color:rgb(255,128,0);">//&nbsp;foo=bar&amp;amp;baz=boom&amp;amp;cow=milk&amp;amp;php=hypertext+processor</p>
<p></span><span style="color:rgb(0,0,187);">?&gt;</span> </span> </code></div>
</p></div>
<h1 class="refname">http_build_url</h1>
<p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color:rgb(0,0,0);"> <span style="color:rgb(0,0,187);"></span><span style="color:rgb(0,119,0);">echo&nbsp;</span><span style="color:rgb(0,0,187);">http_build_url</span><span style="color:rgb(0,119,0);">(</span><span style="color:rgb(221,0,0);">"http://user@www.example.com/pub/index.php?a=b#files"</span><span style="color:rgb(0,119,0);">,<br />&nbsp;&nbsp;&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(221,0,0);">"scheme"&nbsp;</span><span style="color:rgb(0,119,0);">=&gt;&nbsp;</span><span style="color:rgb(221,0,0);">"ftp"</span><span style="color:rgb(0,119,0);">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(221,0,0);">"host"&nbsp;</span><span style="color:rgb(0,119,0);">=&gt;&nbsp;</span><span style="color:rgb(221,0,0);">"ftp.example.com"</span><span style="color:rgb(0,119,0);">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(221,0,0);">"path"&nbsp;</span><span style="color:rgb(0,119,0);">=&gt;&nbsp;</span><span style="color:rgb(221,0,0);">"files/current/"</span><span style="color:rgb(0,119,0);">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(221,0,0);">"query"&nbsp;</span><span style="color:rgb(0,119,0);">=&gt;&nbsp;</span><span style="color:rgb(221,0,0);">"a=c"<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(0,119,0);">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:rgb(0,0,187);">HTTP_URL_STRIP_AUTH&nbsp;</span><span style="color:rgb(0,119,0);">|&nbsp;</span><span style="color:rgb(0,0,187);">HTTP_URL_JOIN_PATH&nbsp;</span><span style="color:rgb(0,119,0);">|&nbsp;</span><span style="color:rgb(0,0,187);">HTTP_URL_JOIN_QUERY&nbsp;</span><span style="color:rgb(0,119,0);">|&nbsp;</span><span style="color:rgb(0,0,187);">HTTP_URL_STRIP_FRAGMENT<br /></span><span style="color:rgb(0,119,0);">);<br /></span><span style="color:rgb(0,0,187);">?&gt;</span> </span> </code></div>
</p></div>
<div class="example-contents para">
<p>The above example will output:</p>
</div>
<div class="example-contents screen">
<div class="cdata">
<pre>ftp://ftp.example.com/pub/files/current/?a=b&amp;a=c&lt;br /&gt;</pre>
</div></div>
<p></div>
</p></div>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=f691699e-2d48-82ad-9101-9598f0b378f5" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=131&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/21/php-url-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=f691699e-2d48-82ad-9101-9598f0b378f5" medium="image" />
	</item>
		<item>
		<title>Doxygen 使用</title>
		<link>http://tingan.wordpress.com/2009/11/21/doxygen-%e4%bd%bf%e7%94%a8/</link>
		<comments>http://tingan.wordpress.com/2009/11/21/doxygen-%e4%bd%bf%e7%94%a8/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 18:32:55 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/21/doxygen-%e4%bd%bf%e7%94%a8/</guid>
		<description><![CDATA[ubuntu中
sudo apt-get install doxygen&#160; doxygen-gui启动GUI程序doxywizard
Doxygen formatting conventions

Last modified: October 27, 2009 &#8211; 19:12

Doxygen is a documentation generation system. The documentation is extracted directly from the sources, which makes it much easier to keep the documentation consistent with the source code.
There is an excellent Doxygen manual at the Doxygen site. The following notes pertain to the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=129&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3 style="margin-left:0;text-indent:0;">ubuntu中</h3>
<p>sudo apt-get install doxygen&nbsp; doxygen-gui<br />启动GUI程序<br />doxywizard<br />
<h1 class="title node-type-book">Doxygen formatting conventions</h1>
<div class="clear-block">
<div class="modified info-page">Last modified: October 27, 2009 &#8211; 19:12</div>
</p></div>
<p>Doxygen is a documentation generation system. The documentation is extracted directly from the sources, which makes it much easier to keep the documentation consistent with the source code.</p>
<p>There is an excellent <a href="http://www.stack.nl/%7Edimitri/doxygen/manual.html" rel="nofollow">Doxygen manual</a> at the Doxygen site. The following notes pertain to the Drupal implementation of Doxygen.</p>
<h2 id="general">General documentation syntax</h2>
<p>To document a block of code, the syntax we use is:</p>
<pre>/**
 * Documentation here.
 */
</pre>
<p> Doxygen will parse any comments located in such a block. Our style is to use as few Doxygen-specific commands as possible, so as to keep the source legible. Any mentions of functions or file names within the documentation will automatically link to the referenced code, so typically no markup need be introduced to produce links.</p>
<h3>Text formatting (and API parser conformance)</h3>
<h4>Doxygen directives</h4>
<pre>/**&lt;br /&gt; * Summary here; one sentence on one line (even if it exceeds 80 chars).&lt;br /&gt; *&lt;br /&gt; * A more detailed description goes here.&lt;br /&gt; *&lt;br /&gt; * A blank line forms a paragraph. There should be no trailing white-space&lt;br /&gt; * anywhere.&lt;br /&gt; *&lt;br /&gt; * @param $first&lt;br /&gt; *   "@param" is a Doxygen directive to describe a function parameter. Like some&lt;br /&gt; *   other directives, it takes a term/summary on the same line, and a&lt;br /&gt; *   description (this text) indented by 2 spaces on the next line. All&lt;br /&gt; *   descriptive text should wrap at 80 chars.&lt;br /&gt; *   Newlines are NOT supported within directives; if a newline would be before&lt;br /&gt; *   this text, it would be appended to the general description above.&lt;br /&gt; * @param $second&lt;br /&gt; *   There should be no newline between multiple directives of the same type.&lt;br /&gt; *&lt;br /&gt; * @return&lt;br /&gt; *   "@return" is a different Doxygen directive to describe the return value of&lt;br /&gt; *   a function, if there is any.&lt;br /&gt; */&lt;br /&gt;</pre>
<h4>Lists</h4>
<pre> * @param $variables&lt;br /&gt; *   An associative array containing:&lt;br /&gt; *   - tags: An array of labels for the controls in the pager:&lt;br /&gt; *     - first: A string to use for the first pager element.&lt;br /&gt; *     - last: A string to use for the last pager element.&lt;br /&gt; *   - element: An optional integer to distinguish between multiple pagers on&lt;br /&gt; *     one page.&lt;br /&gt; *   Any further description - still belonging to the same param.&lt;br /&gt; * This no longer belongs to the param. There should be a newline before this&lt;br /&gt; * paragraph, but it was left out for clarity.&lt;br /&gt;</pre>
<p> Lists can appear everywhere in Doxygen, but the documentation parser requires to follow a strict syntax to make them appear correctly in the parsed HTML output:</p>
<ul>
<li>The list bullet/hyphen is aligned with (uses the same indentation level as) the paragraph before it, no newline before or after the list.</li>
<li>No newlines between list items.</li>
<li>Each list item starts with the key, followed by a colon, followed by a space, followed by the key description. The key description starts capitalized.</li>
<li>If a list item exceeds 80 chars, it needs to wrap, and the following lines need to be aligned with the key (intended by 2 more spaces).</li>
<li>If there should appear text after the list that still belongs to the block before the list, then it uses the same alignment/indentation as the initial text.</li>
<li>Again: within a Doxygen directive, blank lines are NOT supported.</li>
<li>Lists can appear within lists, and the same rules apply recursively.</li>
</ul>
<h4>Links</h4>
<pre>/**&lt;br /&gt; * @see foo_bar()&lt;br /&gt; * @see ajax.inc&lt;br /&gt; * @see MyModuleClass&lt;br /&gt; * @see &lt;a href="http://drupal.org/node/1354" title="http://drupal.org/node/1354" rel="nofollow"&gt;http://drupal.org/node/1354&lt;/a&gt;&lt;br /&gt; */&lt;br /&gt;</pre>
<p> The @see directive may be used to link to (existing) functions, files, or URLs. @see directives should always be placed on an own line.</p>
<pre>/**&lt;br /&gt; * See also @link group_name Link text @endlink&lt;br /&gt; */&lt;br /&gt;</pre>
<p> The @link directive may be used to output a HTML link, but also to link to Doxygen groups that are defined elsewhere via @defgroup.</p>
<h2 id="files">Documenting files</h2>
<p>It is good practice to provide a comment describing what a file does at the start of it. For example:</p>
<pre>&lt;?php&lt;br /&gt;// $Id: theme.inc,v 1.202 2004/07/08 16:08:21 dries Exp $&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * @file&lt;br /&gt; * The theme system, which controls the output of Drupal.&lt;br /&gt; *&lt;br /&gt; * The theme system allows for nearly all output of the Drupal system to be&lt;br /&gt; * customized by user themes.&lt;br /&gt; */&lt;br /&gt;</pre>
<p> The line immediately following the <code>@file</code> directive is a <strong>summary</strong> that will be shown in the <a href="http://api.drupal.org/api/files" rel="nofollow">list of all files</a> in the generated documentation. If the line begins with a verb, that verb should be in present tense, e.g., &#8220;Handles file uploads.&#8221; Further description may follow after a blank PHPDoc line.</p>
<p>In general, @file directives should not contain large descriptions, because those are better placed into @defgroup directives, so developers can look up high-level documentation by reading the &#8220;group&#8221; topic. See <a href="http://api.drupal.org/api/groups" title="http://api.drupal.org/api/groups" rel="nofollow">http://api.drupal.org/api/groups</a> for a list of API topics/groups.</p>
<p>To add CVS ID-Tags to your file, add a <code>// $Id$</code> to your file. CVS will automatically expand it to the format shown above. In the future, you don&#8217;t have to care about that as CVS will update these information automatically.</p>
<p>For .install files, the following template is used:</p>
<pre>/**&lt;br /&gt; * @file&lt;br /&gt; * Install, update and uninstall functions for the XXX module.&lt;br /&gt; */&lt;br /&gt;</pre>
<h2 id="functions">Documenting functions</h2>
<p>All functions that may be called by other files should be documented; private functions optionally may be documented as well. A function documentation block should immediately precede the declaration of the function itself, like so:</p>
<pre>/**&lt;br /&gt; * Verifies the syntax of the given e-mail address.&lt;br /&gt; *&lt;br /&gt; * Empty e-mail addresses are allowed. See RFC 2822 for details.&lt;br /&gt; *&lt;br /&gt; * @param $mail&lt;br /&gt; *   A string containing an email address.&lt;br /&gt; *&lt;br /&gt; * @return&lt;br /&gt; *   TRUE if the address is in a valid format.&lt;br /&gt; */&lt;br /&gt;function valid_email_address($mail) {&lt;br /&gt;</pre>
<p> The first line of the block should contain a brief description of what the function does, limited to 80 characters, and beginning with a verb in the form &#8220;Does such and such&#8221; (third person, as in &#8220;This function does such and such&#8221;, rather than second person imperative &#8220;Do such and such&#8221;). A longer description with usage notes should follow after a blank line, if more explanation is needed. Each parameter should be listed with a <code>@param</code> directive, with a description indented on the following line. After all the parameters, a <code>@return</code> directive should be used to document the return value if there is one. There is a blank line between the <code>@param</code> and <code>@return</code> directives. </p>
<p>Functions that are easily described in one line may omit these directives, as follows:</p>
<pre>/**&lt;br /&gt; * Converts an associative array to an anonymous object.&lt;br /&gt; */&lt;br /&gt;function array2object($array) {&lt;br /&gt;</pre>
<p> The parameters and return value must be described within this one-line description in this case.</p>
<h2 id="hooks">Documenting hook implementations</h2>
<p>Many modules consist largely of hook implementations. If the implementation is rather standard and does not require more explanation than the hook reference provides, a shorthand documentation form may be used:</p>
<pre>/**&lt;br /&gt; * Implements hook_help().&lt;br /&gt; */&lt;br /&gt;function blog_help($section) {&lt;br /&gt;  // ...&lt;br /&gt;}&lt;br /&gt;</pre>
<p> This generates a link to the hook reference, reminds the developer that this is a hook implementation, and avoids having to document parameters and return values that are the same for every implementation of the hook.</p>
<h2 id="forms">Documenting forms</h2>
<pre>/**&lt;br /&gt; * Form builder for the user login form.&lt;br /&gt; *&lt;br /&gt; * @param $msg&lt;br /&gt; *   The message to display.&lt;br /&gt; *&lt;br /&gt; * @see user_login_form_validate()&lt;br /&gt; * @see user_login_form_submit()&lt;br /&gt; * @ingroup forms&lt;br /&gt; */&lt;br /&gt;function user_login_form(&amp;$form_state, $msg = '')&lt;br /&gt;</pre>
<p>In order to provide a quick reference for themers, we tag all form builder functions so that Doxygen can group them together. The form builder function is defined as any function meant to be used as an argument for <code>drupal_get_form()</code>. To do this, add a grouping instruction to the documentation of the function. Additionally, while submit, validate and other handlers for the form are not meant to be in this group, you should provide a <code>@see</code> to provide an easy reference to handlers that are attached to the form.</p>
<pre>/**&lt;br /&gt; * Form validation handler for user_login_form().&lt;br /&gt; *&lt;br /&gt; * @see user_login_form()&lt;br /&gt; * @see user_login_form_submit()&lt;br /&gt; */&lt;br /&gt;function user_login_form_validate($form, &amp;$form_state) {&lt;br /&gt;  ...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Form submission handler for user_login_form().&lt;br /&gt; *&lt;br /&gt; * @see user_login_form()&lt;br /&gt; * @see user_login_form_validate()&lt;br /&gt; */&lt;br /&gt;function user_login_form_submit($form, &amp;$form_state) {&lt;br /&gt;  ...&lt;br /&gt;}&lt;br /&gt;</pre>
<h2 id="themeable">Documenting themeable functions</h2>
<p>In order to provide a quick reference for theme developers, we tag all themeable functions so that Doxygen can group them on one page. To do this, add a grouping instruction to the documentation of all such functions:</p>
<pre>/**&lt;br /&gt; * Formats a query pager.&lt;br /&gt; *&lt;br /&gt; * ...&lt;br /&gt; *&lt;br /&gt; * @ingroup themeable&lt;br /&gt; */&lt;br /&gt;function theme_pager($tags = array(), $limit = 10, $element = 0, $attributes = array()) {&lt;br /&gt;  ...&lt;br /&gt;}&lt;br /&gt;</pre>
<h2 id="templates">Documenting theme templates</h2>
<p>If a template and a preprocess function is used instead of a theming function, an empty function definition of the theme function that is not used should be placed in the contributed documentation (<code>contributions/docs/developer/theme.php</code>).</p>
<p>The template itself should be documented with a <code>@file</code> directive and contain a list of the variables that the <code>template_preprocess_HOOK</code> has prepared for it. If any of these variables contain data that is unsafe to output for XSS reasons, they should be documented; otherwise it can be assumed that variables available have already been appropriately filtered. Anything not listed should not be assumed to be safe to output. It should also contain a <code>@see</code> directive to link back to the preprocessor and the <code>theme_X</code> function.</p>
<pre>&lt;?php&lt;br /&gt;// $Id$&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * @file&lt;br /&gt; * Default theme implementation to display a list of forums.&lt;br /&gt; *&lt;br /&gt; * Available variables:&lt;br /&gt; * - $forums: An array of forums to display.&lt;br /&gt; *&lt;br /&gt; * Each $forum in $forums contains:&lt;br /&gt; * - $forum-&gt;is_container: Is TRUE if the forum can contain other forums. Is&lt;br /&gt; *   FALSE if the forum can contain only topics.&lt;br /&gt; * - $forum-&gt;depth: How deep the forum is in the current hierarchy.&lt;br /&gt; * - $forum-&gt;name: The name of the forum.&lt;br /&gt; * - $forum-&gt;link: The URL to link to this forum.&lt;br /&gt; * - $forum-&gt;description: The description of this forum.&lt;br /&gt; * - $forum-&gt;new_topics: True if the forum contains unread posts.&lt;br /&gt; * - $forum-&gt;new_url: A URL to the forum's unread posts.&lt;br /&gt; * - $forum-&gt;new_text: Text for the above URL which tells how many new posts.&lt;br /&gt; * - $forum-&gt;old_topics: A count of posts that have already been read.&lt;br /&gt; * - $forum-&gt;num_posts: The total number of posts in the forum.&lt;br /&gt; * - $forum-&gt;last_reply: Text representing the last time a forum was posted&lt;br /&gt; *   or commented in.&lt;br /&gt; *&lt;br /&gt; * @see template_preprocess_forum_list()&lt;br /&gt; */&lt;br /&gt;</pre>
<p> The <code>template_preprocess_HOOK</code> function should also contain appropriate <code>@see</code> directives.</p>
<h2 id="contrib">Documenting contributed modules and themes</h2>
<ul>
<li>Don&#8217;t use <code>@mainpage</code>. There can be only one <code>@mainpage</code> in the contributions repository, which is reserved for an index page of <em>all</em> contributes modules and themes.</li>
<li>Use Doxygen <em>Modules</em> (<code>@defgroup</code>, <code>@ingroup</code>, <code>@addtogroup</code>, see &#8220;Limitations and hints&#8221; below) sparingly. There are currently over 2,200 module directories in contrib, many of them consisting of more than one module. If each of these modules used just one <code>@defgroup</code>, there would be more than 2,200 entries in the global Module list. If each used more than one &#8230;</li>
<li>If you do use Doxygen <em>Modules</em>, make sure you give them a unique namespace, which would be your module&#8217;s name. E.g. <code>@defgroup views ...</code> for the views.module, <code>@defgroup views_ui ...</code> for the views_ui.module. <em>Don&#8217;t</em> use <a href="http://api.drupal.org/api/groups" rel="nofollow">group names which are defined in Drupal core</a> (hooks, themeable, file, batch, database, forms, form_api, format, image, validation, search, etc.).</li>
</ul>
<p>A recommended way of using Doxygen grouping in contributed modules and themes is the following:</p>
<pre>/**&lt;br /&gt; * @defgroup example Example module functionality&lt;br /&gt; * @{&lt;br /&gt; * Longer description of your module's API.&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Load an example.&lt;br /&gt; * ...&lt;br /&gt; */&lt;br /&gt;function example_load() ...&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Save an example.&lt;br /&gt; * ...&lt;br /&gt; */&lt;br /&gt;function example_save() ...&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * @} End of "defgroup example".&lt;br /&gt; */&lt;br /&gt;</pre>
<p> This defines the primary Doxygen group. The syntax is <code>@defgroup [internal_name] [Summary]</code>. The internal name has to be prefixed with the module name (unless it is located in Drupal core&#8217;s include files).</p>
<p>Other functions in other files (or even entirely different modules) can then declare <code>@ingroup example</code> to put themselves into the same group.</p>
<h2 id="hints">Limitations and hints</h2>
<p>Drupal&#8217;s Doxygen processing module, <a href="http://drupal.org/project/api" rel="nofollow">api.module</a>, currently only supports a small subset of <a href="http://www.stack.nl/%7Edimitri/doxygen/commands.html" rel="nofollow">all Doxygen commands</a> and makes some assumptions about the formatting of the source. Code to be processed by api.module is advised to stick to these <a href="http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/api/README.txt?view=markup" rel="nofollow">conventions</a>.</p>
<p>Api.module currently supports only one of Doxygen&#8217;s three <a href="http://www.stack.nl/%7Edimitri/doxygen/grouping.html" rel="nofollow">grouping mechanisms</a>: <a href="http://www.stack.nl/%7Edimitri/doxygen/grouping.html#modules" rel="nofollow">Modules</a> (<a href="http://www.stack.nl/%7Edimitri/doxygen/commands.html#cmddefgroup" rel="nofollow"><code>@defgroup</code></a>, <a href="http://www.stack.nl/%7Edimitri/doxygen/commands.html#cmdingroup" rel="nofollow"><code>@ingroup</code></a>, <a href="http://www.stack.nl/%7Edimitri/doxygen/commands.html#cmdaddtogroup" rel="nofollow"><code>@addtogroup</code></a>, <code>@{</code>, <code>@}</code>). When using those, please note the following:</p>
<ul>
<li>Modules <q cite="http://www.stack.nl/~dimitri/doxygen/grouping.html">work at a global level, creating a new page for each group</q>. They should be used only to group functions that provide some kind of API, which possibly spans multiple files. Or the other way round: they should <em>not</em> be used to group functions in a file when these functions are only used in that very file. Thats what <a href="http://www.stack.nl/%7Edimitri/doxygen/grouping.html#memgroup" rel="nofollow">Member Groups</a> are for (which unfortunately aren&#8217;t supported by api.module yet).</li>
<li><code>@defgroup</code>s can be defined only once &#8211; trying to define a second <code>@defgroup name</code> with a name already used will result in an error. Use <code>@defgroup name</code> in the &#8220;most important&#8221; section/file of that group and add to it from other places with <code>@addtogroup</code> / <code>@ingroup</code>.</li>
<li>The <code>name</code> in <code>@defgroup name Explaination of that group</code> must be <a href="http://www.stack.nl/%7Edimitri/doxygen/commands.html#cmddefgroup" rel="nofollow">single-word identifier</a>, like a PHP variable or function name. Or, as regular expression: <code>[a-zA-Z_][a-zA-Z0-9_]*</code>. Dots, hyphens, etc. are not allowed.</li>
</ul>
<p>To see how a real Doxygen processes and displays the current Drupal code documentation (both core and contrib), have a look at <a href="http://drupal.kollm.org/" rel="nofollow">ax&#8217; Drupal site</a>. Especially, look at the &#8220;doxygen error logs&#8221; and <a href="http://drupal.org/project/issues/drupal?components=documentation" rel="nofollow">help</a> improving Drupals code documentation.</p>
<h3 style="margin-left:0;text-indent:0;"><span lang="EN-US"><span><span style="font-family:&quot;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;">&nbsp;&nbsp; </span></span></span><!--[endif]--><span lang="EN-US"></span></h3>
<h3 style="margin-left:0;text-indent:0;"><span lang="EN-US">Doxygen</span><span style="font-family:华文楷体;">常用指令介绍</span></h3>
<p><span class="tpc_content">Doxygen注释风格</p>
<p>1 类的申明<br />/**<br /> * &nbsp;  class declaration<br /> */</p>
<p>2 变量申明<br />/**&lt; val’s brief. val&#8217;s details1. */</p>
<p>3 函数申明<br /> &nbsp;  /**<br /> &nbsp;  * a normal member taking two arguments and returning an integer value.<br /> &nbsp;  * @param a an integer argument.<br /> &nbsp;  * @param s a constant character pointer.<br /> &nbsp;  * @see Test()<br /> &nbsp;  * @see ~Test()<br /> &nbsp;  * @see testMeToo()<br /> &nbsp;  * @see publicVar()<br /> &nbsp;  * @return The test results<br /> &nbsp;  */</span></p>
<div class="MsoNormal" style="text-indent:21pt;"><span lang="EN-US">&nbsp;</span></div>
<div align="center">
<table class="MsoNormalTable" cellpadding="0" width="677" border="1">
<tbody>
<tr>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@file</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">档案的批注说明。</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
</tr>
<tr>
<td style="width:28.8%;padding:0;" valign="top" width="28%">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@author</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">作者的信息</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
</tr>
<tr>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@brief</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">用于<span lang="EN-US">class </span>或<span lang="EN-US">function</span>的简易说明<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">eg</span><span style="font-size:12pt;font-family:宋体;color:black;">：<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><code><span style="font-size:12pt;color:black;" lang="EN-US">@brief  </span></code><code><span style="font-size:12pt;color:black;">本函数负责打印错误信息串</span></code><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
</tr>
<tr>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@param</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">主要用于函数说明中，后面接参数的名字，然后再接关于该参数的说明</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
</tr>
<tr>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@return</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">描述该函数的返回值情况<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">eg:</span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@return </span><span style="font-size:12pt;font-family:宋体;color:black;">本函数返回执行结果，若成功则返回<span lang="EN-US">TRUE</span>，否则返回<span lang="EN-US">FLASE</span></span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
</tr>
<tr>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@retval</span><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
<td style="padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;">描述</span><span style="font-family:宋体;">返回值类型</span> <span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;" lang="EN-US">eg:</span></div>
<div class="MsoNormal" style="text-indent:0;"><code><span style="font-size:12pt;color:black;" lang="EN-US">@retval  NULL </span></code><code><span style="font-size:12pt;color:black;">空字符串。</span></code><span style="color:black;" lang="EN-US"><br />  </span><code><span style="font-size:12pt;color:black;" lang="EN-US">@retval  !NULL </span></code><code><span style="font-size:12pt;color:black;">非空字符串。</span></code><span style="font-size:12pt;font-family:宋体;" lang="EN-US"></span></div>
</td>
</tr>
<tr style="height:18.25pt;">
<td style="height:18.25pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@</span><a name="cmdnote"><span lang="EN-US">note</span></a><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US"></span></div>
</td>
<td style="height:18.25pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-family:宋体;">注解</span><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US"></span></div>
</td>
</tr>
<tr style="height:18.25pt;">
<td style="height:18.25pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><strong><span style="font-weight:normal;" lang="EN-US">@attention</span></strong><b><span lang="EN-US"></span></b></div>
</td>
<td style="height:18.25pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-family:宋体;">注意</span></div>
</td>
</tr>
<tr style="height:28.05pt;">
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@</span><span lang="EN-US">warning</span><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US"></span></div>
</td>
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">警告信息<span lang="EN-US"></span></span></div>
</td>
</tr>
<tr style="height:28.05pt;">
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@enum</span></div>
</td>
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">引用了某个枚举，<span lang="EN-US">Doxygen</span>会在该枚举处产生一个链接<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">eg</span><span style="font-size:12pt;font-family:宋体;color:black;">：<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@enum CTest::MyEnum</span></div>
</td>
</tr>
<tr style="height:28.05pt;">
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@var</span></div>
</td>
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">引用了某个变量，<span lang="EN-US">Doxygen</span>会在该枚举处产生一个链接<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">eg</span><span style="font-size:12pt;font-family:宋体;color:black;">：<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@var CTest::m_FileKey</span></div>
</td>
</tr>
<tr style="height:28.05pt;">
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@class</span></div>
</td>
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">引用某个类，<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">格式：<span lang="EN-US">@class &lt;name&gt;  [&lt;header-file&gt;] [&lt;header-name&gt;]</span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">eg:</span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">@class CTest  &#8220;inc/class.h&#8221;</span></div>
</td>
</tr>
<tr style="height:28.05pt;">
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:21pt;"><span lang="EN-US">@exception</span><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US"></span></div>
</td>
<td style="height:28.05pt;padding:0;" valign="top">
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;">可能产生的异常描述<span lang="EN-US"></span></span></div>
<div class="MsoNormal" style="text-indent:0;"><span style="font-size:12pt;font-family:宋体;color:black;" lang="EN-US">eg:</span></div>
<div class="MsoNormal" style="text-indent:0;"><span lang="EN-US">@exception </span><span style="font-family:宋体;">本函数执行可能会产生超出范围的异常<br /></span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=44594b74-7ead-8cc9-9a6a-0802870c3a3f" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=129&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/21/doxygen-%e4%bd%bf%e7%94%a8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=44594b74-7ead-8cc9-9a6a-0802870c3a3f" medium="image" />
	</item>
		<item>
		<title>Insert figure in Latex</title>
		<link>http://tingan.wordpress.com/2009/11/21/insert-figure-in-latex/</link>
		<comments>http://tingan.wordpress.com/2009/11/21/insert-figure-in-latex/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 09:33:43 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/21/insert-figure-in-latex/</guid>
		<description><![CDATA[psfig 
 Example:  
\noindent
\psfig{file=fig1.eps,width=\textwidth}
\noindent{{\bfseries Fig.~1} \ Example of the interesting object for which
we aim to obtain near-IR $J$ and $H$ surface photometry.}

 
 Note that in this example, we did not use a \begin{figure} &#8230; \end{figure} environment.  If you happen to have an EPS file in which  the figure was in landscape [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=127&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3><a name="SECTION00096300000000000000">psfig</a> </h3>
<p> <font size="-1">Example: </font> </p>
<pre>\noindent
\psfig{file=fig1.eps,width=\textwidth}
\noindent{{\bfseries Fig.~1} \ Example of the interesting object for which
we aim to obtain near-IR $J$ and $H$ surface photometry.}
</pre>
<blockquote><p><font size="-1"> </font></p></blockquote>
<p> <font size="-1">Note that in this example, we did not use a <code>\begin{figure}</code> &#8230; <code>\end{figure}</code> environment.  If you happen to have an EPS file in which  the figure was in landscape orientation, then you can add an <code>angle</code> option as follows: &lt;br /&gt;</font></p>
<p><font size="-1"><tt><img src="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" alt="$\backslash$" align="MIDDLE" border="0" height="37" width="15" />psfig{file=fig1.eps,width=<img src="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" alt="$\backslash$" align="MIDDLE" border="0" height="37" width="15" />textwidth,angle=-90}</tt></font></p>
<p></p>
<h3><a name="SECTION00096400000000000000"> <img src="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" alt="$\backslash$" align="MIDDLE" border="0" height="37" width="15" />epsfig</a> </h3>
<p> <font size="-1">Example: </font> </p>
<pre>\null&lt;br /&gt;\newcommand{\txw}{\textwidth}&lt;br /&gt;\begin{figure}[t!]&lt;br /&gt;\mbox{&lt;br /&gt;   \epsfig{file=fig1a.eps,width=0.325\txw,clip=}&lt;br /&gt;   \epsfig{file=fig1b.eps,width=0.325\txw,clip=}&lt;br /&gt;   \epsfig{file=fig1c.eps,width=0.325\txw,clip=}&lt;br /&gt;}\par&lt;br /&gt;\mbox{&lt;br /&gt;   \epsfig{file=fig1d.eps,width=0.325\txw,clip=}&lt;br /&gt;   \epsfig{file=fig1e.eps,width=0.325\txw,clip=}&lt;br /&gt;   \makebox[0.325\txw]{\rule{0pt}{0.325\txw}}   &lt;br /&gt;}&lt;br /&gt;\caption{{\sc Figure~1} Five out of six ain't bad.}&lt;br /&gt;\end{figure}&lt;br /&gt;\vfill\clearpage&lt;br /&gt;</pre>
<blockquote><p><font size="-1"> </font></p></blockquote>
<p> <font size="-1">Example of a full page, multi-panel figure. Five panels contain a figure, while the sixth was filled with a phantom space of the same width and height as the other panels.  All sizes are expressed as a fraction of the current textwidth. Should that at some point change, then the figures will automatically scale with that change. There is an empty <code>clip=</code> option in the <code>\epsfig</code> commands.  Should an EPS figure have been produced with copious amounts of white space around the area of interest or should you  happen to have a PS instead of EPS file (i.e, without a <code>%BoundingBox</code> statement), then a new BoundingBox may be specified, e.g.:</font><font size="-1"><tt>clip="[92 345 538 742]"</tt></font></p>
<h3><a name="SECTION00096200000000000000"> 8.6.2 <img src="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" alt="$\backslash$" align="MIDDLE" border="0" height="37" width="15" />plotone, <img src="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" alt="$\backslash$" align="MIDDLE" border="0" height="37" width="15" />plottwo, and     <img src="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" alt="$\backslash$" align="MIDDLE" border="0" height="37" width="15" />plotfiddle</a> </h3>
<p> <font size="-1">Example: </font> </p>
<pre>begin{figure} &lt;br /&gt;    \epsscale{0.85}&lt;br /&gt;    \plotone{sample.eps}&lt;br /&gt;    \caption{Sample figure showing important results.}&lt;br /&gt;\end{figure}&lt;br /&gt;</pre>
<blockquote><p><font size="-1"> </font></p></blockquote>
<pre>\begin{figure}&lt;br /&gt;\plottwo{fig2a.eps}{fig2b.eps}&lt;br /&gt;\caption{{\sc Fig.~2} (\emph{a}) field surrounding target \#1; (\emph{b})&lt;br /&gt;   detail of the inner 70~kpc.\label{targetfov}}&lt;br /&gt;\end{figure}&lt;br /&gt;</pre>
<blockquote><p><font size="-1"> </font></p></blockquote>
<p> <font size="-1">If you need to rotate or make other transformations to a figure, you may use the <code>\plotfiddle</code> command: </font> </p>
</p>
<pre>\plotfiddle{PSFILE}{VSIZE}{ROTANG}{HSCALE}{VSCALE}{HTRANS}{VTRANS}&lt;br /&gt;\plotfiddle{sample.eps}{2.6in}{-90.}{32.}{32.}{-250}{225}&lt;br /&gt;</pre>
<h3><a name="SECTION00096500000000000000"> <img src="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" alt="$\backslash$" align="MIDDLE" border="0" height="37" width="15" />includegraphics</a> </h3>
<p> <font size="-1">Example: </font> </p>
<p>\begin{figure}    \resizebox{\textwidth}{!}    {\includegraphics[bb=10 20 100 300,clip,angle=-90,width=\textwidth]{empty.eps}    \caption{Mostly empty field, demonstrating the need for a larger-aperture        telescope and high-throughput camera.}    \label{FigEmpty} \end{figure}
<pre></pre>
</p>
</p>
<div align="CENTER"><font size="-1"> <tt>   <br /></tt></font></div>
</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=b0659f01-0adc-8e60-bd8d-40ae6333b628" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=127&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/21/insert-figure-in-latex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" medium="image">
			<media:title type="html">$\backslash$</media:title>
		</media:content>

		<media:content url="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" medium="image">
			<media:title type="html">$\backslash$</media:title>
		</media:content>

		<media:content url="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" medium="image">
			<media:title type="html">$\backslash$</media:title>
		</media:content>

		<media:content url="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" medium="image">
			<media:title type="html">$\backslash$</media:title>
		</media:content>

		<media:content url="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" medium="image">
			<media:title type="html">$\backslash$</media:title>
		</media:content>

		<media:content url="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" medium="image">
			<media:title type="html">$\backslash$</media:title>
		</media:content>

		<media:content url="http://james.as.arizona.edu/%7Epsmith/proposals/SOinstructions/img5.png" medium="image">
			<media:title type="html">$\backslash$</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=b0659f01-0adc-8e60-bd8d-40ae6333b628" medium="image" />
	</item>
		<item>
		<title>ubuntu Java choose</title>
		<link>http://tingan.wordpress.com/2009/11/18/ubuntu-java-choose/</link>
		<comments>http://tingan.wordpress.com/2009/11/18/ubuntu-java-choose/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 13:41:13 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/18/ubuntu-java-choose/</guid>
		<description><![CDATA[
Java

   
Please do not make any edits to this article.  Its contents are currently under review and being merged with the Ubuntu Server Guide.  To find the Ubuntu Server Guide related to your specific version, please go to: 


https://help.ubuntu.com/ and click on Ubuntu Server Guide 








目录

Running Java under Ubuntu
Choosing the default [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=126&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><ul id="pagelocation">
<li><a class="backlink" href="https://help.ubuntu.com/community/Java?action=fullsearch&amp;context=180&amp;value=linkto%3A%22Java%22" rel="nofollow" title="点击对这个标题进行全文检索">Java</a></li>
</ul>
<p>  <!--3--><span class="anchor" id="top"></span> <span class="anchor" id="line-1"></span>
<p class="line867"><strong>Please do not make any edits to this article.  Its contents are currently under review and being merged with the <em>Ubuntu Server Guide</em>.  To find the Ubuntu Server Guide related to your specific version, please go to:</strong> <span class="anchor" id="line-2"></span><span class="anchor" id="line-3"></span></p>
<ul>
<li style="list-style-type:none;">
<p class="line891"><strong><a class="https" href="https://help.ubuntu.com/">https://help.ubuntu.com/</a> and click on <em>Ubuntu Server Guide</em></strong> <span class="anchor" id="line-4"></span><span class="anchor" id="line-5"></span></p>
</li>
</ul>
<div>
<table style="background:rgb(241,241,237) none repeat scroll 0 0;float:right;font-size:.9em;width:40%;margin:0 0 1em 1em;">
<tbody>
<tr>
<td style="padding:.5em;">
<div class="table-of-contents">
<p class="table-of-contents-heading">目录</p>
<ol>
<li><a href="https://help.ubuntu.com/community/Java#Running%20Java%20under%20Ubuntu">Running Java under Ubuntu</a></li>
<li><a href="https://help.ubuntu.com/community/Java#Choosing%20the%20default%20Java%20to%20use">Choosing the default Java to use</a></li>
</ol>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<p><span class="anchor" id="line-6"></span><span class="anchor" id="line-7"></span>
<p class="line874">Sun Microsystems developed Java, which is many things depending on who you ask. It is a language, and an execution environment and probably many more things. On this page Java refers to the software that executes programs compiled to Java byte codes (akin to machine language). <span class="anchor" id="line-8"></span><span class="anchor" id="line-9"></span></p>
<p class="line867">
<h2 id="Running Java under Ubuntu">Running Java under Ubuntu</h2>
<p> <span class="anchor" id="line-10"></span><span class="anchor" id="line-11"></span>
<p class="line862">In order to run Java programs and Java applets, you must have a Java environment installed. The GCJ flavor of Java is installed as default, and is usually fine for most purposes. If it is not installed, <a href="https://help.ubuntu.com/community/JavaInstallation">JavaInstallation</a> describes how to install some opensource flavors of Java. You may, however, have a need to run the Sun flavor of Java if something does not work correctly. <span class="anchor" id="line-12"></span><span class="anchor" id="line-13"></span></p>
<p class="line862">To get Sun Java under Ubuntu 7.04 or later running on Intel or PowerPC platform, you should enable the Universe repository in Add/Remove programs, and install either the <tt>openjdk-6-jre</tt> package or the <tt>sun-java6-bin</tt> package.  (Note:  PowerPC version is slow). <span class="anchor" id="line-14"></span><span class="anchor" id="line-15"></span></p>
<p class="line862">To get Sun Java under Ubuntu 6.06 or 6.10 running on Intel x86 platform, you should enable the Universe repository in Add/Remove programs, and install the <tt>sun-java5-bin</tt> package.   <span class="anchor" id="line-16"></span><span class="anchor" id="line-17"></span></p>
<p class="line874">Note: The same commands will work under Xubuntu/Kubuntu (using Add/Remove or the Adept Package Installer). <span class="anchor" id="line-18"></span><span class="anchor" id="line-19"></span><span class="anchor" id="line-20"></span></p>
<p class="line867">
<h2 id="Choosing the default Java to use">Choosing the default Java to use</h2>
<p> <span class="anchor" id="line-21"></span><span class="anchor" id="line-22"></span>
<p class="line874">Just installing new Java flavours does not change the default Java pointed to by /usr/bin/java.  You must explicitly set this: <span class="anchor" id="line-23"></span><span class="anchor" id="line-24"></span></p>
<ul>
<li>Open a Terminal window <span class="anchor" id="line-25"></span></li>
<li>
<p class="line862">Run <tt>sudo&nbsp;update-java-alternatives&nbsp;-l</tt> to see the current configuration and possibilities. <span class="anchor" id="line-26"></span></p>
</li>
<li>
<p class="line862">Run <tt>sudo&nbsp;update-java-alternatives&nbsp;-s&nbsp;XXXX</tt> to set the XXX java version as default.  For Sun Java 6 this would be <tt>sudo&nbsp;update-java-alternatives&nbsp;-s&nbsp;java-6-sun</tt> <span class="anchor" id="line-27"></span></p>
</li>
<li>
<p class="line862">Run <tt>java&nbsp;-version</tt> to ensure that the correct version is being called. <span class="anchor" id="line-28"></span><span class="anchor" id="line-29"></span></p>
</li>
</ul>
<p class="line874">You can also use the following command to interactively make the change; <span class="anchor" id="line-30"></span><span class="anchor" id="line-31"></span></p>
<ul>
<li>Open a Terminal window <span class="anchor" id="line-32"></span></li>
<li>
<p class="line862">Run <tt>sudo&nbsp;update-alternatives&nbsp;--config&nbsp;java</tt> <span class="anchor" id="line-33"></span></p>
</li>
<li>Follow the onscreen prompt </li>
</ul>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=342cf7e4-60fc-88f7-b23f-fbe03dc03097" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=126&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/18/ubuntu-java-choose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=342cf7e4-60fc-88f7-b23f-fbe03dc03097" medium="image" />
	</item>
		<item>
		<title>Doxygen</title>
		<link>http://tingan.wordpress.com/2009/11/17/doxygen/</link>
		<comments>http://tingan.wordpress.com/2009/11/17/doxygen/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 22:16:51 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/17/doxygen/</guid>
		<description><![CDATA[ubuntu agi doxygen doxygen-guidoxywizard to show up the GUI application.

       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=125&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>ubuntu <br />agi doxygen doxygen-gui<br />doxywizard to show up the GUI application.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=d4adcd20-7d5e-8ecc-ad99-251e2a961a81" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=125&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/17/doxygen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=d4adcd20-7d5e-8ecc-ad99-251e2a961a81" medium="image" />
	</item>
		<item>
		<title>Drupal Info file</title>
		<link>http://tingan.wordpress.com/2009/11/17/drupal-info-file/</link>
		<comments>http://tingan.wordpress.com/2009/11/17/drupal-info-file/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 21:57:34 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/17/drupal-info-file/</guid>
		<description><![CDATA[Info File Details

name (Required)
The displayed name of your module. It should follow the Drupal 6 capitalization standard: only the first letter of the first word is capitalized (&#8220;Example module&#8221;, not &#8220;example module&#8221; or &#8220;Example Module&#8221;).name = On this date
description (Required)
A short, preferably one line description that will tell the administrator what this module does on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=123&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3>Info File Details</h3>
<dl>
<dt><strong>name (Required)</strong></dt>
<dd>The displayed name of your module. It should follow the Drupal 6 capitalization standard: only the first letter of the first word is capitalized (&#8220;Example module&#8221;, not &#8220;example module&#8221; or &#8220;Example Module&#8221;).<br /><code>name = On this date</code></dd>
<dt><strong>description (Required)</strong></dt>
<dd>A short, preferably one line description that will tell the administrator what this module does on the module administration page. Remember, overly long descriptions can make this page difficult to work with, so please try to be concise. This field is limited to 255 characters.
<p><code>description = A block module that lists links to content such as blog entries or forum discussions that were created one week ago.</code></p>
<p>Note that special characters in this description must be substituted with the HTML entity values.  For example, use <code>description = This is my &amp;quot;crazy@email.com&amp;quot; email address</code> instead of <code>description = This is my "crazy@email.com" email address</code><br />If the description has single quotes or apostrophes in it then you can simply put the entire string inside double quotes. For example, <code>description = "Please don't use this unless you know what you are doing."</code></p>
</dd>
<dd></dd>
<dt><strong>core (Required)</strong></dt>
<dd>As of version 6.x, Drupal core will refuse to enable or run modules that aren&#8217;t explicitly written for the right version of core. The .info file must specify which Drupal core compatiblity any module or theme has been ported to. This is accomplished by means of the new core attribute in the .info files.</dd>
<div class="codeblock"><code>core = 6.x</code></div>
<p><strong>Note:</strong> the drupal.org packaging script automatically sets this value based on the Drupal core compatibility setting on each release node, so users downloading packaged releases from drupal.org will always get the right thing. However, for sites that deploy Drupal directly from CVS, it helps if this value is added to the .info files for the module. This is also a good way to indicate to users of each module what version of core the HEAD of CVS is compatibile with at any given time.</p>
<dt><strong>dependencies (Optional)</strong></dt>
<dd>There are a couple of extra options that may appear in the .info file, one of which are module dependencies. If a module requires another module to be enabled, list each module (filename) required in the following syntax:
<div class="codeblock"><code>dependencies[] = taxonomy<br />dependencies[] = comment</code></div>
<p>For the example module, these don&#8217;t apply and we will simply omit them. If dependencies are assigned for a module, Drupal will not allow it to be activated until the required dependencies are met.</p>
</dd>
<dt><strong>package (Optional)</strong></dt>
<dd>If a module has a package string, on the admin/build/modules page it will be listed with other modules with the same category. If a package string is not assigned, it will simply be listed in the &#8216;Other&#8217;. Not assigning a package for your module is perfectly ok; in general packages are best used for modules that are distributed together or are meant to be used together. If in doubt, leave this field blank.
<div class="codeblock"><code>package = "Your arbitrary grouping string"</code></div>
<p>Suggested examples of appropriate items for the package field: </p>
<ul>
<li>Audio</li>
<li>Bot</li>
<li>CCK</li>
<li>Chat</li>
<li>E-Commerce</li>
<li>Event</li>
<li>Feed Parser</li>
<li>Organic groups</li>
<li>Station</li>
<li>Video</li>
<li>Views</li>
<li>Voting (if it uses/requires VotingAPI)</li>
</ul>
</dd>
</dl>
<p>The files use the ini format and can include a <code>; $Id$</code> to have CVS insert the file ID information.</p>
<p>For more information on ini file formatting, see the <a href="http://php.net/parse_ini_file" rel="nofollow">PHP.net parse_ini_file documentation</a>. </p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=382743ad-bcb5-8d6a-ba41-6e3751ee892d" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=123&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/17/drupal-info-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=382743ad-bcb5-8d6a-ba41-6e3751ee892d" medium="image" />
	</item>
		<item>
		<title>不用iconv函数实现UTF-8编码转换GB2312的PHP函数</title>
		<link>http://tingan.wordpress.com/2009/11/16/%e4%b8%8d%e7%94%a8iconv%e5%87%bd%e6%95%b0%e5%ae%9e%e7%8e%b0utf-8%e7%bc%96%e7%a0%81%e8%bd%ac%e6%8d%a2gb2312%e7%9a%84php%e5%87%bd%e6%95%b0/</link>
		<comments>http://tingan.wordpress.com/2009/11/16/%e4%b8%8d%e7%94%a8iconv%e5%87%bd%e6%95%b0%e5%ae%9e%e7%8e%b0utf-8%e7%bc%96%e7%a0%81%e8%bd%ac%e6%8d%a2gb2312%e7%9a%84php%e5%87%bd%e6%95%b0/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 20:35:52 +0000</pubDate>
		<dc:creator>tingan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tingan.wordpress.com/2009/11/16/%e4%b8%8d%e7%94%a8iconv%e5%87%bd%e6%95%b0%e5%ae%9e%e7%8e%b0utf-8%e7%bc%96%e7%a0%81%e8%bd%ac%e6%8d%a2gb2312%e7%9a%84php%e5%87%bd%e6%95%b0/</guid>
		<description><![CDATA[





  					  
发布者：IT柏拉图  					
 


	



    如果使用 iconv()    函数转换编码就相比比较简单了，不过很多虚拟主机里并不支持这个组件，我在网上找半天，才找到一个gb2312转utf-8的方法，但不能逆向转换。
    这个函数如下：  
    /*******************************    //GB转UTF-8编码    *******************************/    function gb2utf8($gbstr) {    &#160;global $CODETABLE;    &#160;if(trim($gbstr)==&#8221;") return $gbstr;    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=121&subd=tingan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><table cellpadding="5" cellspacing="0" width="100%" border="0">
<tbody>
<tr>
<td colspan="3" class="ArticleTitle" align="center"></td>
</tr>
<tr>
<td align="left"><a href="http://prato.bokele.com/?ArticleID=15752" title="自己动手做一个SQL解释器">  					  <img src="http://prato.bokele.com/Themes/default/img/btn_prev_a.gif" border="0" /></a></td>
<td align="center"><font color="#999999">发布者：IT柏拉图</font>  					</td>
<td align="right"> <a href="http://prato.bokele.com/?ArticleID=15302" title="细细品味PHP程序的算法"><img src="http://prato.bokele.com/Themes/default/img/btn_next_a.gif" border="0" /></a></td>
</tr>
<tr>
<td colspan="3">	<br />
<table style="table-layout:fixed;" cellpadding="2" cellspacing="2" width="97%" align="center" border="0">
<tbody>
<tr>
<td>    如果使用 iconv()    函数转换编码就相比比较简单了，不过很多虚拟主机里并不支持这个组件，我在网上找半天，才找到一个gb2312转utf-8的方法，但不能逆向转换。
<p>    这个函数如下：  </p>
<p>    /*******************************<br />    //GB转UTF-8编码<br />    *******************************/<br />    function gb2utf8($gbstr) {<br />    &nbsp;global $CODETABLE;<br />    &nbsp;if(trim($gbstr)==&#8221;") return $gbstr;<br />    &nbsp;if(empty($CODETABLE)){<br />    &nbsp;&nbsp;$filename =    dirname(__FILE__).&#8221;/gb2312-utf8.table&#8221;;<br />    &nbsp;&nbsp;$fp = fopen($filename,&#8221;r&#8221;);<br />    &nbsp;&nbsp;while ($l = fgets($fp,15))<br />    &nbsp;&nbsp;{ $CODETABLE[hexdec(substr($l, 0, 6))] = substr($l,    7, 6); }<br />    &nbsp;&nbsp;fclose($fp);<br />    &nbsp;}<br />    &nbsp;$ret = &#8220;&#8221;;<br />    &nbsp;$utf8 = &#8220;&#8221;;<br />    &nbsp;while ($gbstr) {<br />    &nbsp;&nbsp;if (ord(substr($gbstr, 0, 1)) &gt; 127) {<br />    &nbsp;&nbsp;&nbsp;$thisW = substr($gbstr, 0, 2);<br />    &nbsp;&nbsp;&nbsp;$gbstr = substr($gbstr, 2,    strlen($gbstr));<br />    &nbsp;&nbsp;&nbsp;$utf8 = &#8220;&#8221;;<br />    &nbsp;&nbsp;&nbsp;@$utf8 =    u2utf8(hexdec($CODETABLE[hexdec(bin2hex($thisW)) -    0x8080]));<br />    &nbsp;&nbsp;&nbsp;if($utf8!=&#8221;"){<br />    &nbsp;&nbsp;&nbsp;&nbsp;for ($i = 0;$i &lt; strlen($utf8);$i +=    3)<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ret .= chr(substr($utf8, $i,    3));<br />    &nbsp;&nbsp;&nbsp;}<br />    &nbsp;&nbsp;}<br />    &nbsp;&nbsp;else<br />    &nbsp;&nbsp;{<br />    &nbsp;&nbsp;&nbsp;$ret .= substr($gbstr, 0, 1);<br />    &nbsp;&nbsp;&nbsp;$gbstr = substr($gbstr, 1,    strlen($gbstr));<br />    &nbsp;&nbsp;}<br />    &nbsp;}<br />    &nbsp;return $ret;<br />    }<br />    //Unicode转utf8<br />    function u2utf8($c) {<br />    &nbsp;for ($i = 0;$i &lt; count($c);$i++)<br />    &nbsp;&nbsp;$str = &#8220;&#8221;;<br />    &nbsp;if ($c &lt; 0&#215;80) {<br />    &nbsp;&nbsp;$str .= $c;<br />    &nbsp;} else if ($c &lt; 0&#215;800) {<br />    &nbsp;&nbsp;$str .= (0xC0 | $c &gt;&gt; 6);<br />    &nbsp;&nbsp;$str .= (0&#215;80 | $c &amp; 0&#215;3F);<br />    &nbsp;} else if ($c &lt; 0&#215;10000) {<br />    &nbsp;&nbsp;$str .= (0xE0 | $c &gt;&gt; 12);<br />    &nbsp;&nbsp;$str .= (0&#215;80 | $c &gt;&gt; 6 &amp; 0&#215;3F);<br />    &nbsp;&nbsp;$str .= (0&#215;80 | $c &amp; 0&#215;3F);<br />    &nbsp;} else if ($c &lt; 0&#215;200000) {<br />    &nbsp;&nbsp;$str .= (0xF0 | $c &gt;&gt; 18);<br />    &nbsp;&nbsp;$str .= (0&#215;80 | $c &gt;&gt; 12 &amp; 0&#215;3F);<br />    &nbsp;&nbsp;$str .= (0&#215;80 | $c &gt;&gt; 6 &amp; 0&#215;3F);<br />    &nbsp;&nbsp;$str .= (0&#215;80 | $c &amp; 0&#215;3F);<br />    &nbsp;}<br />    &nbsp;return $str;<br />    }  </p>
<p>    因为gb2312都是双字节的，因此转换为utf-8就相对比较简单，但反之有很麻烦了，我尝试了一下：  </p>
<p>    这样  </p>
<p>    function utf82gb($utfstr)<br />    {<br />    &nbsp;global $UC2GBTABLE;<br />    &nbsp;$okstr = &#8220;&#8221;;<br />    &nbsp;if(trim($utfstr)==&#8221;") return $utfstr;<br />    &nbsp;if(empty($UC2GBTABLE)){<br />    &nbsp;&nbsp;$filename =    dirname(__FILE__).&#8221;/gb2312-utf8.table&#8221;;<br />    &nbsp;&nbsp;$fp = fopen($filename,&#8221;r&#8221;);<br />    &nbsp;&nbsp;while($l = fgets($fp,15))<br />    &nbsp;&nbsp;{&nbsp;$UC2GBTABLE[hexdec(substr($l, 7, 6))] =    hexdec(substr($l, 0, 6));}<br />    &nbsp;&nbsp;fclose($fp);<br />    &nbsp;}<br />    &nbsp;$ulen = strlen($utfstr);<br />    &nbsp;for($i=0;$i&lt;$ulen;$i++)<br />    &nbsp;{<br />    &nbsp;&nbsp;if(ord($utfstr[$i])&lt;0&#215;81) $okstr .=    $utfstr[$i];<br />    &nbsp;&nbsp;else<br />    &nbsp;&nbsp;{<br />    &nbsp;&nbsp;&nbsp;if($ulen&gt;$i+2)<br />    &nbsp;&nbsp;&nbsp;{<br />    &nbsp;&nbsp;&nbsp;&nbsp;$utfc = substr($utfstr,$i,3);<br />    &nbsp;&nbsp;&nbsp;&nbsp;$c = &#8220;&#8221;;<br />    &nbsp;&nbsp;&nbsp;&nbsp;@$c =    dechex($UC2GBTABLE[utf82u_3($utfc)]+0&#215;8080);<br />    &nbsp;&nbsp;&nbsp;&nbsp;if($c!=&#8221;"){<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$okstr .=    chr(hexdec($c[0].$c[1])).chr(hexdec($c[2].$c[3]));<br />    &nbsp;&nbsp;&nbsp;&nbsp;}<br />    &nbsp;&nbsp;&nbsp;}<br />    &nbsp;&nbsp;&nbsp;else<br />    &nbsp;&nbsp;&nbsp;{ $okstr .= $utfstr[$i]; }<br />    &nbsp;&nbsp;}<br />    &nbsp; }<br />    &nbsp; $okstr = trim($okstr);<br />    &nbsp;&nbsp;return $okstr;<br />    }  </p>
<p>    function utf82u_3($c)<br />    {<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $n = (ord($c[0]) &amp; 0&#215;1f)    &lt;&lt; 12;<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $n += (ord($c[1]) &amp; 0&#215;3f)    &lt;&lt; 6;<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $n += ord($c[2]) &amp;    0&#215;3f;<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $n;<br />    }  </p>
<p>    按这种方法，大部份字符也算是能转换成功的了，不过总是有点不妥之处，我把程序改成这样子：  </p>
<p>    function utf82gb($utfstr)<br />    {<br />    &nbsp;global $UC2GBTABLE;<br />    &nbsp;$okstr = &#8220;&#8221;;<br />    &nbsp;if(trim($utfstr)==&#8221;") return $utfstr;<br />    &nbsp;if(empty($UC2GBTABLE)){<br />    &nbsp;&nbsp;$filename =    dirname(__FILE__).&#8221;/gb2312-utf8.table&#8221;;<br />    &nbsp;&nbsp;$fp = fopen($filename,&#8221;r&#8221;);<br />    &nbsp;&nbsp;while($l = fgets($fp,15))<br />    &nbsp;&nbsp;{&nbsp;$UC2GBTABLE[hexdec(substr($l, 7, 6))] =    hexdec(substr($l, 0, 6));}<br />    &nbsp;&nbsp;fclose($fp);<br />    &nbsp;}<br />    &nbsp;$okstr = &#8220;&#8221;;<br />    &nbsp;$utfstr = urlencode($utfstr);<br />    &nbsp;$ulen = strlen($utfstr);<br />    &nbsp;for($i=0;$i&lt;$ulen;$i++)<br />    &nbsp;{<br />    &nbsp;&nbsp;if($utfstr[$i]==&#8221;%&#8221;)<br />    &nbsp;&nbsp;{<br />    &nbsp;&nbsp;&nbsp;if($ulen&gt;$i+2){<br />    &nbsp;&nbsp;&nbsp;&nbsp;$hexnext =    hexdec(&#8220;0x&#8221;.substr($utfstr,$i+1,2));<br />    &nbsp;&nbsp;&nbsp;&nbsp;if($hexnext&lt;127){<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$okstr .= chr($hexnext);<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$i = $i+2;<br />    &nbsp;&nbsp;&nbsp;&nbsp;}<br />    &nbsp;&nbsp;&nbsp;&nbsp;else{<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($ulen&gt;=$i+9){<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$hexnext =    substr($utfstr,$i+1,8);<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$c = &#8220;&#8221;;<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@$c =    dechex($UC2GBTABLE[url_utf2u($hexnext)]+0&#215;8080);<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($c!=&#8221;"){<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $okstr .=    chr(hexdec($c[0].$c[1])).chr(hexdec($c[2].$c[3]));<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$i = $i+8;<br />    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />    &nbsp;&nbsp;&nbsp;&nbsp;}<br />    &nbsp;&nbsp;&nbsp;}<br />    &nbsp;&nbsp;&nbsp;else<br />    &nbsp;&nbsp;&nbsp;{ $okstr .= $utfstr[$i]; }<br />    &nbsp;&nbsp;}<br />    &nbsp;&nbsp;else if($utfstr[$i]==&#8221;+&#8221;)<br />    &nbsp;&nbsp;&nbsp;$okstr .= &#8221; &#8220;;<br />    &nbsp;&nbsp;else<br />    &nbsp;&nbsp;&nbsp;$okstr .= $utfstr[$i];<br />    &nbsp;}<br />    &nbsp;$okstr = trim($okstr);<br />    &nbsp;return $okstr;<br />    }<br />    //三字节的URL编码转成的utf8字符转为unicode编码<br />    function url_utf2u($c)<br />    {<br />    &nbsp;$utfc = &#8220;&#8221;;<br />    &nbsp;$cs = split(&#8220;%&#8221;,$c);<br />    &nbsp;for($i=0;$i&lt;count($cs);$i++){<br />    &nbsp;&nbsp;$utfc .= chr(hexdec(&#8220;0x&#8221;.$cs[$i]));<br />    &nbsp;}<br />    &nbsp;$n = (ord($utfc[0]) &amp; 0&#215;1f) &lt;&lt; 12;<br />    &nbsp; $n += (ord($utfc[1]) &amp; 0&#215;3f) &lt;&lt; 6;<br />    &nbsp; $n += ord($utfc[2]) &amp; 0&#215;3f;<br />    &nbsp;return $n;<br />    }  </p>
<p>    一测试，发现完全OK，而且速度居然比上一个方法要快，我真是搞不懂这是什么原因了  </p>
<p>    谁要 gb2312-utf8.table 这个文件请加我的QQ 2500875 IT柏拉图 或与 1877000 泡泡 联系  </p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=cbaabd20-f7f6-8dfe-b44b-429858936df0" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tingan.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tingan.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tingan.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tingan.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tingan.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tingan.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tingan.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tingan.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tingan.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tingan.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tingan.wordpress.com&blog=5187226&post=121&subd=tingan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tingan.wordpress.com/2009/11/16/%e4%b8%8d%e7%94%a8iconv%e5%87%bd%e6%95%b0%e5%ae%9e%e7%8e%b0utf-8%e7%bc%96%e7%a0%81%e8%bd%ac%e6%8d%a2gb2312%e7%9a%84php%e5%87%bd%e6%95%b0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7107faebd8ff58088d1b34577ab2a153?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tingan</media:title>
		</media:content>

		<media:content url="http://prato.bokele.com/Themes/default/img/btn_prev_a.gif" medium="image" />

		<media:content url="http://prato.bokele.com/Themes/default/img/btn_next_a.gif" medium="image" />

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=cbaabd20-f7f6-8dfe-b44b-429858936df0" medium="image" />
	</item>
	</channel>
</rss>