<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>biaoming</title>
    <description></description>
    <link>http://biaoming.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
          <item>
        <title>解决grails报java.lang.SecurityException:Prohibited问题</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/234094" style="color:red;">http://biaoming.javaeye.com/blog/234094</a>&nbsp;
          发表时间: 2008年08月28日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>今天有时间挨个找关于影响grails的问题，执行命令grails -v就报java.lang.SecurityException:Prohibited package name:java.lang，原来是我在设置CLASSPATH时填写太详细，把所有jdk的lib下的jar包都加入，现在一个一个检查，发现是rt.jar包影响，删除之后grails -v就正常</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/234094#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 28 Aug 2008 18:06:08 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/234094</link>
        <guid>http://biaoming.javaeye.com/blog/234094</guid>
      </item>
          <item>
        <title>tapestry5在runjettyrun报找不到logger的解决方法</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/233950" style="color:red;">http://biaoming.javaeye.com/blog/233950</a>&nbsp;
          发表时间: 2008年08月28日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>在VM argsuments增加以下配置就可解决<br />
-Dorg.mortbay.jetty.webapp.parentLoaderPriority=true<br /></p>
<p>&nbsp;</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/233950#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 28 Aug 2008 14:33:28 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/233950</link>
        <guid>http://biaoming.javaeye.com/blog/233950</guid>
      </item>
          <item>
        <title>常去的讨论</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/232206" style="color:red;">http://biaoming.javaeye.com/blog/232206</a>&nbsp;
          发表时间: 2008年08月25日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <div style="line-height: 160%;"><span style="font-size: 9pt; line-height: 160%; color: #222222;">我推荐如下这些论坛，或许真能帮助您，做论坛，都是赔本的买卖，不收费还帮助你学习，得向斑竹们致敬啊。我总结了一条</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">做</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">的</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">做硬件和软件都是苦力活</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">只有做管理的才是白领呀</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">! </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">以下论坛从第</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">1</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">名开始介绍，前面分别是是管理、财经、商务类别的老大</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">当然还有许多业界知名的论坛，主要有点偏门，这个不做概述，呵呵。</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
<br />
NO.1</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">世界经理人社区</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://bbs.icxo.com/" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://bbs.icxo.com/</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">管理人士</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">特别是</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">CEO/CIO/CTI/CHO/CFO</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">等高级经理</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">精英必需懂管理</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">否则永远是小程序员</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">! bbs.icxo.com</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">可能是最好的管理社区了</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">商业领袖、商业新知、创业论坛、职场生涯等栏目可以说在页界非常有名气</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">! </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">如果你是或想当大公司的职业经理人，或想开始创业</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">推荐去看看。</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★★★★</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
NO.2</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">华尔街社区</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://bbs.wswire.com/" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://bbs.wswire.com/</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">需要阅读财经文章</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">人士</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">特别是</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">媒体</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">/</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">策划</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">/</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">创业</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">/</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">者</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">如果你是关注财经可科技</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">特别是</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">NASDAQ</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">和</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">VC</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">的人士</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">建议去华尔街社区</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">bbs.wswire.com.</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">在华尔街社区你可能经常碰到</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">IT/VC</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">大佬</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">.</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">在跟踪国际市场行情变化等方面独树一帜。</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"> <br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★★★☆</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
<br />
NO.3 </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">世界经营者社区</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://bbs.bosslink.com/" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://bbs.bosslink.com/</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">贸易采购人士</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">, </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">特别是</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">和电子商务人士</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">评论类比较多，基本上在其他媒体上看到的评论，这里都会有，要想了解</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">发展的情况，就来这里看看。站有比较全面丰富的各类管理文章，从管理理念、方法和实践指导，从战略、运作到市场营销、人力资源等等，大分类明确，能一站式学习</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">!<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★★☆☆</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
<br />
NO. 4 </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">菊花论坛</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://www.sharecenter.net/" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://www.sharecenter.net/</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">网络工程师</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">之所以我喜欢是这个网站很多做</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">CISCO</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">工程都知道，也是别人介绍我去的，时间非常久了，颜色比较暗谈，属于忧郁型。</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★★☆☆</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
NO.5 IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">售前论坛</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://www.sysvs.com/bbs" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://www.sysvs.com/bbs</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">售前及技术顾问</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">业界知名的售前技术顾问论坛，比较新异的知识点，各个</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">IT</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">行业版快划分也比较好，也非常专业，绝对是我稀饭</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">(</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">喜欢</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">)</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">的风格，网站风格业内罕见，也有很多专业文章，没有地方灌水，厉害。</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★★☆☆</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
<br />
NO.6 HUIHOO</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">论坛</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://www.huihoo.com/forum/" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://www.huihoo.com/forum/</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">中间件开发者</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">人气不错，版面风格独特，在开源，中间件，工作流方面非常不错，问题讨论都非常深刻、也很专业。速度一般</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">;<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★★☆☆</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
<br />
NO.7 JAVA</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">世界</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://bbs.chinajavaworld.com/" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://bbs.chinajavaworld.com/</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: JAVA</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">开发</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: JAVA</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">方面非常综合的论坛了，牛人也很多，是一个难得的</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">JAVA</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">论坛，涉及你想象的关于</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">JAVA</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">目前任何技术。速度还可以。</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★★☆☆</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
NO.8 UNIX</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">论坛</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://bbs.chinaunix.net/forum/" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://bbs.chinaunix.net/forum/</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">系统工程师</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">:</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">这里的特色就是操作系统方面在业界是最著名的，牛人不少，目前，在数据库，网络方面也颇有建树，当然灌水方面也不赖，呵呵，属于温柔性</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★☆☆☆</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
NO.9 itpub</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">论坛</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">:www.itpub.net<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">数据库开发人员</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">数据库方面是非常著名的，牛人不少，不过，现在比较杂，什么都做，网络，操作系统，行业应用，到体育贴图，当然有些也不错，人气非常高，特别是灌水方面。评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">:</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">强，速度一般</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">.<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★☆☆☆</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
NO.10 CSDN</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">技术社区</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　网址</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: <a href="http://community.csdn.net/" target="_blank"><span style="line-height: 160%; text-decoration: none; color: #222222;">http://community.csdn.net/</span>
</a>
<br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　对象</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">只适合软件开发者</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　特色</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">技术开发最全面的论坛，里面可以遇到很多牛人，版面也很全，什么</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">J2EE</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">，</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">.NET</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">啊，该有的全上，在这里基本上可以提出任何问题，人气也是最旺的，不过一般提出的意见都有正方两面的，所以最终解决问题，还是靠自己。专业，很牛逼，就是速度慢。</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;"><br />
</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">　　评价</span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">: </span>
<span style="font-size: 9pt; line-height: 160%; color: #222222;">★★☆☆☆</span>
</div>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/232206#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 25 Aug 2008 09:25:30 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/232206</link>
        <guid>http://biaoming.javaeye.com/blog/232206</guid>
      </item>
          <item>
        <title>收藏一篇很有用的线程实例</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/224938" style="color:red;">http://biaoming.javaeye.com/blog/224938</a>&nbsp;
          发表时间: 2008年08月06日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><a href="http://java.sun.com/javase/6/" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">&nbsp;&nbsp;&nbsp; JDK6 </span>
</span>
</a>
已经发布了，而对于<a href="http://java.sun.com/j2se/1.5.0/" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">JDK5</span>
</span>
</a>
的新特性还来不及使用，虽然在项目中还没有使用，但可以写一些Demo体验一下Tiger的魅力，现在的时代就是体验的时代，事事都要亲历亲为才能有发言权，怎么有点毛主席&ldquo;实事求是&rdquo;的感觉。</p>
<p>JDK5中的一个亮点就是将<a href="http://gee.cs.oswego.edu/dl/" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">Doug Lea</span>
</span>
</a>
的<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">并发库</span>
</span>
</a>
引入到Java标准库中。Doug Lea确实是一个牛人，能教书，能出书，能编码，不过这在国外还是比较普遍的，而国内的教授们就相差太远了。</p>
<p>一般的服务器都需要线程池，比如Web、FTP等服务器，不过它们一般都自己实现了线程池，比如以前介绍过的<a href="http://tomcat.apache.org/" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">Tomcat</span>
</span>
</a>
、Resin和Jetty等，现在有了JDK5，我们就没有必要重复造车轮了，直接使用就可以，何况使用也很方便，性能也非常高。</p>
<pre name="code" class="java">package concurrent;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class TestThreadPool {
  public static void main(String args[]) throws InterruptedException {
    // only two threads
    ExecutorService exec = Executors.newFixedThreadPool(2);
    for(int index = 0; index &lt; 100; index++) {
      Runnable run = new Runnable() {
        public void run() {
          long time = (long) (Math.random() * 1000);
          System.out.println(&quot;Sleeping &quot; + time + &quot;ms&quot;);
            try {
              Thread.sleep(time);
            } catch (InterruptedException e) {
            }
        }
      };
      exec.execute(run);
    }
    // must shutdown
    exec.shutdown();
  }
}</pre>
&nbsp;
<p>&nbsp;&nbsp;&nbsp;&nbsp;上面是一个简单的例子，使用了2个大小的线程池来处理100个线程。但有一个问题：在for循环的过程中，会等待线程池有空闲的线程，所以
主线程会阻塞的。
为了解决这个问题，一般启动一个线程来做for循环，就是为了避免由于线程池满了造成主线程阻塞。不过在这里我没有这样处理。[重要修正：经过测试，即使
线程池大小小于实际线程数大小，线程池也不会阻塞的，这与Tomcat的线程池不同，它将Runnable实例放到一个&ldquo;无限&rdquo;的
BlockingQueue中，所以就不用一个线程启动for循环，Doug Lea果然厉害]</p>
<p>另外它使用了Executors的静态函数生成一个固定的线程池，顾名思义，线程池的线程是不会释放的，即使它是Idle。这就会产生性能问题，比
如如果线
程池的大小为200，当全部使用完毕后，所有的线程会继续留在池中，相应的内存和线程切换（while(true)+sleep循环）都会增加。如果要避
免这个问题，就必须直接使用ThreadPoolExecutor()来构造。可以像Tomcat的线程池一样设置&ldquo;最大线程数&rdquo;、&ldquo;最小线程数&rdquo;和&ldquo;空
闲线程keepAlive的时间&rdquo;。通过这些可以基本上替换Tomcat的线程池实现方案。</p>
<p>需要注意的是线程池必须使用shutdown来显式关闭，否则主线程就无法退出。shutdown也不会阻塞主线程。</p>
<p><span class="first-letter">许</span>
多
长时间运行的应用有时候需要定时运行任务完成一些诸如统计、优化等工作，比如在电信行业中处理用户话单时，需要每隔1分钟处理话单；网站每天凌晨统计用户
访问量、用户数；大型超时凌晨3点统计当天销售额、以及最热卖的商品；每周日进行数据库备份；公司每个月的10号计算工资并进行转帐等，这些都是定时任
务。通过 java的并发库<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">concurrent</span>
</span>
</a>
可以轻松的完成这些任务，而且非常的简单。</p>
<pre name="code" class="java">package concurrent;
import static java.util.concurrent.TimeUnit.SECONDS;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
public class TestScheduledThread {
  public static void main(String[] args) {
    final ScheduledExecutorService scheduler = Executors
        .newScheduledThreadPool(2);
    final Runnable beeper = new Runnable() {
      int count = 0;
      public void run() {
        System.out.println(new Date() + &quot; beep &quot; + (++count));
      }
    };
    // 1秒钟后运行，并每隔2秒运行一次
    final ScheduledFuture&lt;?&gt; beeperHandle = scheduler.scheduleAtFixedRate(
        beeper, 1, 2, SECONDS);
    // 2秒钟后运行，并每次在上次任务运行完后等待5秒后重新运行
    final ScheduledFuture&lt;?&gt; beeperHandle2 = scheduler
        .scheduleWithFixedDelay(beeper, 2, 5, SECONDS);
    // 30秒后结束关闭任务，并且关闭Scheduler
    scheduler.schedule(new Runnable() {
      public void run() {
        beeperHandle.cancel(true);
        beeperHandle2.cancel(true);
        scheduler.shutdown();
      }
    }, 30, SECONDS);
  }
}</pre>
&nbsp;
<p>为了退出进程，上面的代码中加入了关闭Scheduler的操作。而对于24小时运行的应用而言，是没有必要关闭Scheduler的。</p>
<p><span class="first-letter">&nbsp;&nbsp;&nbsp;&nbsp;在</span>
实际应用中，有时候需要多个线程同时工作以完成同一件事情，而且在完成过程中，往往会等待其他线程都完成某一阶段后再执行，等所有线程都到达某一个阶段后再统一执行。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;比如有几个旅行团需要途经深圳、广州、韶关、长沙最后到达武汉。旅行团中有自驾游的，有徒步的，有乘坐旅游大巴的；这些旅行团同时出发，并且每到一个目的地，都要等待其他旅行团到达此地后再同时出发，直到都到达终点站武汉。</p>
<p>这时候<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CyclicBarrier.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">CyclicBarrier</span>
</span>
</a>
就可以派上用场。CyclicBarrier最重要的属性就是参与者个数，另外最要方法是await()。当所有线程都调用了await()后，就表示这些线程都可以继续执行，否则就会等待。</p>
<pre name="code" class="java">package concurrent;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class TestCyclicBarrier {
  // 徒步需要的时间: Shenzhen, Guangzhou, Shaoguan, Changsha, Wuhan
  private static int[] timeWalk = { 5, 8, 15, 15, 10 };
  // 自驾游
  private static int[] timeSelf = { 1, 3, 4, 4, 5 };
  // 旅游大巴
  private static int[] timeBus = { 2, 4, 6, 6, 7 };
  
  static String now() {
    SimpleDateFormat sdf = new SimpleDateFormat(&quot;HH:mm:ss&quot;);
    return sdf.format(new Date()) + &quot;: &quot;;
  }

  static class Tour implements Runnable {
    private int[] times;
    private CyclicBarrier barrier;
    private String tourName;
    public Tour(CyclicBarrier barrier, String tourName, int[] times) {
      this.times = times;
      this.tourName = tourName;
      this.barrier = barrier;
    }
    public void run() {
      try {
        Thread.sleep(times[0] * 1000);
        System.out.println(now() + tourName + &quot; Reached Shenzhen&quot;);
        barrier.await();
        Thread.sleep(times[1] * 1000);
        System.out.println(now() + tourName + &quot; Reached Guangzhou&quot;);
        barrier.await();
        Thread.sleep(times[2] * 1000);
        System.out.println(now() + tourName + &quot; Reached Shaoguan&quot;);
        barrier.await();
        Thread.sleep(times[3] * 1000);
        System.out.println(now() + tourName + &quot; Reached Changsha&quot;);
        barrier.await();
        Thread.sleep(times[4] * 1000);
        System.out.println(now() + tourName + &quot; Reached Wuhan&quot;);
        barrier.await();
      } catch (InterruptedException e) {
      } catch (BrokenBarrierException e) {
      }
    }
  }

  public static void main(String[] args) {
    // 三个旅行团
    CyclicBarrier barrier = new CyclicBarrier(3);
    ExecutorService exec = Executors.newFixedThreadPool(3);
    exec.submit(new Tour(barrier, &quot;WalkTour&quot;, timeWalk));
    exec.submit(new Tour(barrier, &quot;SelfTour&quot;, timeSelf));
    exec.submit(new Tour(barrier, &quot;BusTour&quot;, timeBus));
    exec.shutdown();
  }
}</pre>
&nbsp;
<p>运行结果：<br />
00:02:25: SelfTour Reached Shenzhen<br />
00:02:25: BusTour Reached Shenzhen<br />
00:02:27: WalkTour Reached Shenzhen<br />
00:02:30: SelfTour Reached Guangzhou<br />
00:02:31: BusTour Reached Guangzhou<br />
00:02:35: WalkTour Reached Guangzhou<br />
00:02:39: SelfTour Reached Shaoguan<br />
00:02:41: BusTour Reached Shaoguan</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<span class="first-letter">并</span>
发库中的<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/BlockingQueue.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">BlockingQueue</span>
</span>
</a>
是一个比较好玩的类，顾名思义，就是阻塞队列。该类主要提供了两个方法put()和take()，前者将一个对象放到队列中，如果队列已经满了，就等待直到有空闲节点；后者从head取一个对象，如果没有对象，就等待直到有可取的对象。</p>
<p>下
面的例子比较简单，一个读线程，用于将要处理的文件对象添加到阻塞队列中，另外四个写线程用于取出文件对象，为了模拟写操作耗时长的特点，特让线程睡眠一
段随机长度的时间。另外，该Demo也使用到了线程池和原子整型（AtomicInteger），AtomicInteger可以在并发情况下达到原子化
更新，避免使用了synchronized，而且性能非常高。由于阻塞队列的put和take操作会阻塞，为了使线程退出，特在队列中添加了一个&ldquo;标
识&rdquo;，算法中也叫&ldquo;哨兵&rdquo;，当发现这个哨兵后，写线程就退出。</p>
<p>当然线程池也要显式退出了。</p>
<pre name="code" class="java">package concurrent;
import java.io.File;
import java.io.FileFilter;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;

public class TestBlockingQueue {
  static long randomTime() {
    return (long) (Math.random() * 1000);
  }

  public static void main(String[] args) {
    // 能容纳100个文件
    final BlockingQueue&lt;File&gt; queue = new LinkedBlockingQueue&lt;File&gt;(100);
    // 线程池
    final ExecutorService exec = Executors.newFixedThreadPool(5);
    final File root = new File(&quot;F:\\JavaLib&quot;);
    // 完成标志
    final File exitFile = new File(&quot;&quot;);
    // 读个数
    final AtomicInteger rc = new AtomicInteger();
    // 写个数
    final AtomicInteger wc = new AtomicInteger();
    // 读线程
    Runnable read = new Runnable() {
      public void run() {
        scanFile(root);
        scanFile(exitFile);
      }

      public void scanFile(File file) {
        if (file.isDirectory()) {
          File[] files = file.listFiles(new FileFilter() {
            public boolean accept(File pathname) {
              return pathname.isDirectory()
                  || pathname.getPath().endsWith(&quot;.java&quot;);
            }
          });
          for (File one : files)
            scanFile(one);
        } else {
          try {
            int index = rc.incrementAndGet();
            System.out.println(&quot;Read0: &quot; + index + &quot; &quot;
                + file.getPath());
            queue.put(file);
          } catch (InterruptedException e) {
          }
        }
      }
    };
    exec.submit(read);
    // 四个写线程
    for (int index = 0; index &lt; 4; index++) {
      // write thread
      final int NO = index;
      Runnable write = new Runnable() {
        String threadName = &quot;Write&quot; + NO;
        public void run() {
          while (true) {
            try {
              Thread.sleep(randomTime());
              int index = wc.incrementAndGet();
              File file = queue.take();
              // 队列已经无对象
              if (file == exitFile) {
                // 再次添加&quot;标志&quot;，以让其他线程正常退出
                queue.put(exitFile);
                break;
              }
              System.out.println(threadName + &quot;: &quot; + index + &quot; &quot;
                  + file.getPath());
            } catch (InterruptedException e) {
            }
          }
        }
      };
      exec.submit(write);
    }
    exec.shutdown();
  }
}</pre>
&nbsp;
<p><span class="first-letter">从</span>
名字可以看出，<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CountDownLatch.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">CountDownLatch</span>
</span>
</a>
是一个倒数计数的锁，当倒数到0时触发事件，也就是开锁，其他人就可以进入了。在一些应用场合中，需要等待某个条件达到要求后才能做后面的事情；同时当线程都完成后也会触发事件，以便进行后面的操作。</p>
<p>CountDownLatch最重要的方法是countDown()和await()，前者主要是倒数一次，后者是等待倒数到0，如果没有到达0，就只有阻塞等待了。</p>
<p>一个CountDouwnLatch实例是不能重复使用的，也就是说它是一次性的，锁一经被打开就不能再关闭使用了，如果想重复使用，请考虑使用<a href="http://tenyears.cn/?p=125" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">CyclicBarrier</span>
</span>
</a>
。</p>
<p>下面的例子简单的说明了CountDownLatch的使用方法，模拟了100米赛跑，10名选手已经准备就绪，只等裁判一声令下。当所有人都到达终点时，比赛结束。</p>
<p>同样，线程池需要显式shutdown。</p>
<pre name="code" class="java">package concurrent;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class TestCountDownLatch {
  public static void main(String[] args) throws InterruptedException {
    // 开始的倒数锁
    final CountDownLatch begin = new CountDownLatch(1);
    // 结束的倒数锁
    final CountDownLatch end = new CountDownLatch(10);
    // 十名选手
    final ExecutorService exec = Executors.newFixedThreadPool(10);
    for(int index = 0; index &lt; 10; index++) {
      final int NO = index + 1;
      Runnable run = new Runnable(){
        public void run() {
          try {
            begin.await();
            Thread.sleep((long) (Math.random() * 10000));
            System.out.println(&quot;No.&quot; + NO + &quot; arrived&quot;);
          } catch (InterruptedException e) {
          } finally {
            end.countDown();
          }
        }
      };
      exec.submit(run);
    }
    System.out.println(&quot;Game Start&quot;);
    begin.countDown();
    end.await();
    System.out.println(&quot;Game Over&quot;);
    exec.shutdown();
  }
}</pre>
&nbsp;
<p>运行结果:<br />
Game Start<br />
No.4 arrived<br />
No.1 arrived<br />
No.7 arrived<br />
No.9 arrived<br />
No.3 arrived<br />
No.2 arrived<br />
No.8 arrived<br />
No.10 arrived<br />
No.6 arrived<br />
No.5 arrived<br />
Game Over </p>
<p><span class="first-letter">有</span>
时
候在实际应用中，某些操作很耗时，但又不是不可或缺的步骤。比如用网页浏览器浏览新闻时，最重要的是要显示文字内容，至于与新闻相匹配的图片就没有那么重
要的，所以此时首先保证文字信息先显示，而图片信息会后显示，但又不能不显示，由于下载图片是一个耗时的操作，所以必须一开始就得下载。</p>
<p>Java的<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">并发库</span>
</span>
</a>
的<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Future.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">Future</span>
</span>
</a>
类
就可以满足这个要求。Future的重要方法包括get()和cancel()，get()获取数据对象，如果数据没有加载，就会阻塞直到取到数据，而
cancel()是取消数据加载。另外一个get(timeout)操作，表示如果在timeout时间内没有取到就失败返回，而不再阻塞。</p>
<p>下面的Demo简单的说明了Future的使用方法：一个非常耗时的操作必须一开始启动，但又不能一直等待；其他重要的事情又必须做，等完成后，就可以做不重要的事情。</p>
<pre name="code" class="java">package concurrent;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class TestFutureTask {
  public static void main(String[] args)throws InterruptedException,
      ExecutionException {
    final ExecutorService exec = Executors.newFixedThreadPool(5);
    Callable&lt;String&gt; call = new Callable&lt;String&gt;() {
      public String call() throws Exception {
        Thread.sleep(1000 * 5);
        return &quot;Other less important but longtime things.&quot;;
      }
    };
    Future&lt;String&gt; task = exec.submit(call);
    // 重要的事情
    Thread.sleep(1000 * 3);
    System.out.println(&quot;Let's do important things.&quot;);
    // 其他不重要的事情
    String obj = task.get();
    System.out.println(obj);
    // 关闭线程池
    exec.shutdown();
  }
}</pre>
&nbsp;
<p>运行结果：<br />
Let's do important things.<br />
Other less important but longtime things.</p>
<p>&nbsp;</p>
<p><span class="first-letter">考</span>
虑以下场景：浏览网页时，浏览器了5个线程下载网页中的图片文件，由于图片大小、网站访问速度等诸多因素的影响，完成图片下载的时间就会有很大的不同。如果先下载完成的图片就会被先显示到界面上，反之，后下载的图片就后显示。</p>
<p>Java的<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">并发库</span>
</span>
</a>
的<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CompletionService.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">CompletionService</span>
</span>
</a>
可
以满足这种场景要求。该接口有两个重要方法：submit()和take()。submit用于提交一个runnable或者callable，一般会提
交给一个线程池处理；而take就是取出已经执行完毕runnable或者callable实例的Future对象，如果没有满足要求的，就等待了。
CompletionService还有一个对应的方法poll，该方法与take类似，只是不会等待，如果没有满足要求，就返回null对象。</p>
<pre name="code" class="java">package concurrent;

import java.util.concurrent.Callable;
import java.util.concurrent.CompletionService;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class TestCompletionService {
  public static void main(String[] args) throws InterruptedException,
      ExecutionException {
    ExecutorService exec = Executors.newFixedThreadPool(10);
    CompletionService&lt;String&gt; serv = 
      new ExecutorCompletionService&lt;String&gt;(exec);

    for (int index = 0; index &lt; 5; index++) {
      final int NO = index;
      Callable&lt;String&gt; downImg = new Callable&lt;String&gt;() {
        public String call() throws Exception {
          Thread.sleep((long) (Math.random() * 10000));
          return &quot;Downloaded Image &quot; + NO;
        }
      };
      serv.submit(downImg);
    }

    Thread.sleep(1000 * 2);
    System.out.println(&quot;Show web content&quot;);
    for (int index = 0; index &lt; 5; index++) {
      Future&lt;String&gt; task = serv.take();
      String img = task.get();
      System.out.println(img);
    }
    System.out.println(&quot;End&quot;);
    // 关闭线程池
    exec.shutdown();
  }
}</pre>
&nbsp;
<p>运行结果:<br />
Show web content<br />
Downloaded Image 1<br />
Downloaded Image 2<br />
Downloaded Image 4<br />
Downloaded Image 0<br />
Downloaded Image 3<br />
End</p>
<p>&nbsp;</p>
<p><a>操作系统的信号量是个很重要的概念，在进程控制方面都有应用。</a>
<a href="http://java.sun.com/" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">Java</span>
</span>
</a>
<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">并发库</span>
</span>
</a>
的<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Semaphore.html" target="_blank"><span style="text-decoration: underline;"><span style="color: #0000ff;">Semaphore</span>
</span>
</a>
可以很轻松完成信号量控制，Semaphore可以控制某个资源可被同时访问的个数，acquire()获取一个许可，如果没有就等待，而release()释放一个许可。比如在Windows下可以设置共享文件的最大客户端访问个数。 </p>
<p>Semaphore维护了当前访问的个数，提供同步机制，控制同时访问的个数。在数据结构中链表可以保存&ldquo;无限&rdquo;的节点，用Semaphore可以实现有限大小的链表。另外重入锁ReentrantLock也可以实现该功能，但实现上要负责些，代码也要复杂些。</p>
<p>下面的Demo中申明了一个只有5个许可的Semaphore，而有20个线程要访问这个资源，通过acquire()和release()获取和释放访问许可。</p>
<pre name="code" class="java">package concurrent;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;

public class TestSemaphore {
  public static void main(String[] args) {
    // 线程池
    ExecutorService exec = Executors.newCachedThreadPool();
    // 只能5个线程同时访问
    final Semaphore semp = new Semaphore(5);
    // 模拟20个客户端访问
    for (int index = 0; index &lt; 20; index++) {
      final int NO = index;
      Runnable run = new Runnable() {
        public void run() {
          try {
            // 获取许可
            semp.acquire();
            System.out.println(&quot;Accessing: &quot; + NO);
            Thread.sleep((long) (Math.random() * 10000));
            // 访问完后，释放
            semp.release();
          } catch (InterruptedException e) {
          }
        }
      };
      exec.execute(run);
    }
    // 退出线程池
    exec.shutdown();
  }
}

</pre>
<p>&nbsp;运行结果：<br />
Accessing: 0<br />
Accessing: 1<br />
Accessing: 2<br />
Accessing: 3<br />
Accessing: 4<br />
Accessing: 5<br />
Accessing: 6<br />
Accessing: 7<br />
Accessing: 8<br />
Accessing: 9<br />
Accessing: 10<br />
Accessing: 11<br />
Accessing: 12<br />
Accessing: 13<br />
Accessing: 14<br />
Accessing: 15<br />
Accessing: 16<br />
Accessing: 17<br />
Accessing: 18<br />
Accessing: 19</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/224938#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 06 Aug 2008 11:58:07 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/224938</link>
        <guid>http://biaoming.javaeye.com/blog/224938</guid>
      </item>
          <item>
        <title>urlrewrite-3.1.0的不足</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/222138" style="color:red;">http://biaoming.javaeye.com/blog/222138</a>&nbsp;
          发表时间: 2008年07月31日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>我在使用urlrewrite过程中，觉得很强大，但对.htaccess支持得不好好。</p>
<p>由于urlrewrite.xml还是强重量，而且喜欢apache，所以选择用.htaccess。当把modRewriteConf值设置为true，就启用.htaccess，目前只支持RewriteLogLevel，RewriteLog，RewriteRule，也算基本够用吧。</p>
<p>&lt;init-param&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;modRewriteConf&lt;/param-name&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-value&gt;true&lt;/param-value&gt;<br />
&lt;/init-param&gt;</p>
<p>&nbsp;</p>
<p>但是一配置htaccess就启动不了，报org.tuckey.web.filters.urlrewrite.UrlRewriteFilter ERROR: Conf failed to load，后来是Conf构造方法把docProcessed设置为true就可以，目前暂时不发现有什么影响。</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/222138#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 31 Jul 2008 12:09:36 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/222138</link>
        <guid>http://biaoming.javaeye.com/blog/222138</guid>
      </item>
          <item>
        <title>我老家最牛的房子</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/216881" style="color:red;">http://biaoming.javaeye.com/blog/216881</a>&nbsp;
          发表时间: 2008年07月21日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>很酷的房子建造，估计现在这些在石头上的房子应该也没人住了，可以放粮食，保存些东西，以防止火灾之类的迫害，很有特点。</p>
<p><a href="http://www.545300.cn/blog/article/view/69.jhtml?domain=biaowen" target="_blank">http://www.545300.cn/blog/article/view/69.jhtml?domain=biaowen</a></p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/216881#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 21 Jul 2008 13:07:25 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/216881</link>
        <guid>http://biaoming.javaeye.com/blog/216881</guid>
      </item>
          <item>
        <title>不宜熬夜的原因</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/216056" style="color:red;">http://biaoming.javaeye.com/blog/216056</a>&nbsp;
          发表时间: 2008年07月18日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>干我们这一行的，熬夜是家常便饭。<br />
其实，熬夜是百害而无一利的。为什么这么说呢？看看下面就知道了：<br />
一、晚上9-11点为免疫系统（淋巴）排毒时间，此段时间应安静或听音乐 。<br />
二、晚间11-凌晨1点，肝的排毒，需在熟睡中进行。 <br />
三、凌晨1-3点，胆的排毒，亦同。 <br />
四、凌晨3-5点，肺的排毒。此即为何咳嗽的人在这段时间咳得最剧烈，因排毒动作已走到肺；不应用止咳药，以免抑制废积物的排除。<br />
五、凌晨5-7点，大肠的排毒，应上厕所排便。<br />
六、凌晨7-9点，小肠大量吸收营养的时段，应吃早餐。疗病者最好早吃，在６点半前，养生者在７点半前，不吃早餐者应改变习惯，即使拖到９、10点吃都比不吃好。<br />
七、半夜至凌晨４点为脊椎造血时段，必须熟睡，不宜熬夜。<br />
朋友，你还会熬夜吗？</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/216056#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 18 Jul 2008 11:14:14 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/216056</link>
        <guid>http://biaoming.javaeye.com/blog/216056</guid>
      </item>
          <item>
        <title>单个线程对多个线程的唤醒</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/216018" style="color:red;">http://biaoming.javaeye.com/blog/216018</a>&nbsp;
          发表时间: 2008年07月18日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <div class="MsoNormal" style="text-indent: 21pt;"><span style="font-family: 宋体;">模拟两个线程之间的协作。</span>
<span lang="EN-US">Athele</span>
<span style="font-family: 宋体;">类有两个同步方法</span>
<span lang="EN-US">prepare()</span>
<span style="font-family: 宋体;">和</span>
<span lang="EN-US">go()</span>
<span style="font-family: 宋体;">。标志位</span>
<span lang="EN-US">start</span>
<span style="font-family: 宋体;">用于判断当前线程是否需要</span>
<span lang="EN-US">wait()</span>
<span style="font-family: 宋体;">。</span>
<span lang="EN-US">Referee</span>
<span style="font-family: 宋体;">类的实例首先启动所有的</span>
<span lang="EN-US">Athele</span>
<span style="font-family: 宋体;">类实例，使其进入</span>
<span lang="EN-US">wait()</span>
<span style="font-family: 宋体;">状态，在一段时间后，改变标志位并</span>
<span lang="EN-US">notifyAll()</span>
<span style="font-family: 宋体;">所有处于</span>
<span lang="EN-US">wait</span>
<span style="font-family: 宋体;">状态的</span>
<span lang="EN-US">Athele</span>
<span style="font-family: 宋体;">线程。</span>
<pre name="code" class="java">import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.TimeUnit;
 
class Athlete implements Runnable {
    private boolean start = false;
    private final int id;
 
    public Athlete(int id) {
       this.id = id;
    }
 
    public boolean equals(Object o) {
       if (!(o instanceof Athlete))
           return false;
       Athlete athlete = (Athlete) o;
       return id == athlete.id;
    }
 
    public String toString() {
       return &quot;Athlete&lt;&quot; + id + &quot;&gt;&quot;;
    }
 
    public int hashCode() {
       return new Integer(id).hashCode();
    }
 
    public synchronized void prepare() throws InterruptedException {
       System.out.println(this + &quot; ready!&quot;);
       while (start == false)
           wait();
       if (start == true)
           System.out.println(this + &quot; go!&quot;);
    }
 
    public synchronized void go() {
       start = true;
       notifyAll();
    }
 
    public void run() {
       try {
           prepare();
       } catch (InterruptedException e) {
           //maybe should notify the referee
           System.out.println(this+&quot; quit the game&quot;);
       }
    }
}
 
class Referee implements Runnable {
    private Set&lt;Athlete&gt; players = new HashSet&lt;Athlete&gt;();
 
    public void addPlayer(Athlete one) {
       players.add(one);
    }
 
    public void removePlayer(Athlete one) {
       players.remove(one);
    }
 
    public void ready() {
       Iterator&lt;Athlete&gt; iter = players.iterator();
       while (iter.hasNext())
           new Thread(iter.next()).start();
    }
 
    public void action() {
       Iterator&lt;Athlete&gt; iter = players.iterator();
       while (iter.hasNext())
           iter.next().go();
    }
 
    public void run() {
       ready();
       try {
           TimeUnit.SECONDS.sleep(1);
       } catch (InterruptedException e) {
           e.printStackTrace();
       }
       action();
    }
}
 
public class Game {
    public static void main(String[] args) {
       Referee referee = new Referee();
       for (int i = 0; i &lt; 10; i++)
           referee.addPlayer(new Athlete(i));
       new Thread(referee).start();
    }
}</pre>
&nbsp;</div>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/216018#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 18 Jul 2008 10:00:47 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/216018</link>
        <guid>http://biaoming.javaeye.com/blog/216018</guid>
      </item>
          <item>
        <title>我的第三个ruby on rails网站发布了</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/208123" style="color:red;">http://biaoming.javaeye.com/blog/208123</a>&nbsp;
          发表时间: 2008年06月26日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>网址是<a href="http://www.qubei.com" target="_blank">http://www.qubei.com</a>
,专门记录北京奥运.<a href="http://www.qubei.com" target="_blank"><br />
</a>
</p>
<p>这个网站是用ruby on rails开发,不加美工,一天就能完成.开发效率真快.</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/208123#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 26 Jun 2008 10:13:47 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/208123</link>
        <guid>http://biaoming.javaeye.com/blog/208123</guid>
      </item>
          <item>
        <title>Rmagick version</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/207970" style="color:red;">http://biaoming.javaeye.com/blog/207970</a>&nbsp;
          发表时间: 2008年06月25日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          "thumb" => "50x50" : 表示默认宽度50，高度自适应<br />"thumb" => "50x50!" : "!"表示强制50*50<br />"thumb" => "50x50>" : ">"表示如果图片本来就小，就不用放大
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/207970#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 25 Jun 2008 17:55:21 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/207970</link>
        <guid>http://biaoming.javaeye.com/blog/207970</guid>
      </item>
          <item>
        <title>在Debian上部署Rails Apache+fcgi</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/207400" style="color:red;">http://biaoming.javaeye.com/blog/207400</a>&nbsp;
          发表时间: 2008年06月24日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Confach 发表于 September 26, 2007 3:26 pm<br /><br />版权信息 :可以任意转载, 转载时请务必以超链接形式标明文章 原始出处和作者信息.<br /><br />网址：http://www.36sign.com/blog/working/how-to-deploy-rails-with-apache-and-cgi.html<br /><br />Rails+Apache2+fcgid安装<br /><br />安装Ruby<br /><br />tar xzvf ruby-1.8.6.tar.gz<br />cd ruby-1.8.6<br />./configure<br />make<br />make install<br /><br />&nbsp;&nbsp;&nbsp; <br />检查一下ruby是否安装,输入: <br /><br />ruby -v<br />安装zlib<br /><br />tar xvzf&nbsp; zlib-1.2.3.tar.gz<br />cd zlib-1.2.3<br />./configure<br />make<br />make install<br />安装rubygem&nbsp;&nbsp; <br /><br />tar xzvf rubygems-0.9.4.tgz<br />cd rubygems-0.9.4<br />ruby setup.rb<br /><br />为了看是否安装上,输入:<br /><br />gem -v<br />Rails<br /><br />gem install rails -y<br /><br /> 有的时候可能因为网速问题装不上,请耐心多试记下.<br />测试<br /><br />rails testRails<br />cd testRails<br />ruby script/server<br /><br /><br /><br /><br /><br />会有如下显示: <br />=> Booting WEBrick…<br />=> Rails application started on http://0.0.0.0:3000=> Ctrl-C to shutdown server; call with –help for options<br />[2007-08-15 08:02:04] INFO&nbsp; WEBrick 1.3.1<br />[2007-08-15 08:02:04] INFO&nbsp; ruby 1.8.6 (2007-03-13) [i686-linux]<br />[2007-08-15 08:02:04] INFO&nbsp; WEBrick::HTTPServer#start: pid=16306 port=3000<br />ImageMagick<br /><br />tar xzvf ImageMagick-6.3.5-6.tar.gz<br />cd ImageMagick-6.3.5<br />./configure<br />make<br />make install<br /><br />看是否安装成功,输入:<br /><br />usr/local/bin/convert logo: logo.gif<br /><br />安装RMagick<br /><br />tar xvzf RMagick-1.15.10.tar.gz<br />cd RMagick-1.15.10<br />./configure<br />make<br />make install<br />安装fcgi<br /><br />由于ruby的fcgi支持库需要在编译的时候联接FCGI的系统库，因此我们需要先安装FCGI库，下载FCGI源代码发行包：<br /><br />http://www.fastcgi.com/dist/<br /><br />tar xzvf fcgi-2.4.0.tar.gz<br /><br />cd fcgi-2.4.0<br /><br />./configure –prefix=/usr/local/fcgi<br /><br />make && make install<br /><br />安装fcgid<br /><br />apt-get install libapache2-mod-fcgid <br />/etc/init.d/apache2 force-reload<br /> 安装fcgi for ruby<br /><br />gem install fcgi<br />配置apache<br /><br />可以如下<br /><br />&nbsp;&nbsp; NameVirtualHost *<br />&lt;IfModule mod_fcgid.c><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddHandler fcgid-script .fcgi<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SocketPath /var/lib/apache2/fcgid/sock<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DefaultInitEnv&nbsp; RAILS_ENV production<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IdleTimeout 600<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProcessLifeTime 3600<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MaxProcessCount 8<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DefaultMinClassProcessCount 3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DefaultMaxClassProcessCount 3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCConnectTimeout 8<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCCommTimeout 48<br />&nbsp;&nbsp; &lt;/IfModule><br /><br />&lt;VirtualHost *><br />&nbsp;&nbsp;&nbsp; ServerAdmin webmaster@localhost<br />&nbsp;&nbsp;&nbsp; #ServerName localhost<br />&nbsp;&nbsp;&nbsp; DocumentRoot /path/to/app/public/<br />&nbsp;&nbsp;&nbsp; ErrorLog /xxx/log/httpd-error_log<br />&nbsp;&nbsp;&nbsp; CustomLog /xxx/log/httpd-access_log common<br />&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp; &lt;Directory&nbsp; /path/to/app/public/><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Options ExecCGI FollowSymLinks<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AllowOverride all<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Order allow,deny<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Allow from all<br />&nbsp;&nbsp; &lt;/Directory><br />&lt;/VirtualHost><br />配置应用程序<br /><br />编辑.htaccess文件<br /><br />注释 AddHandler cgi-script .cgi以及AddHandler fastcgi-script .fcgi,增加AddHandler fcgid-script .fcgi.<br /><br />将RewriteRule ^(.*)$ dispatch.cgi [QSA,L]改为RewriteRule ^(.*)$ dispatch.fcgi [QSA,L].<br /><br />可以如下:<br /><br /># General Apache options<br /><br />AddHandler fcgid-script .fcgi<br /><br />Options +FollowSymLinks +ExecCGI<br /><br />RewriteEngine On<br /><br />RewriteRule ^$ index.html [QSA]<br /><br />RewriteRule ^([^.]+)$ $1.html [QSA]<br /><br />RewriteCond %{REQUEST_FILENAME} !-f<br /><br />RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]<br /><br />ErrorDocument 500 "&lt;h2>Application error&lt;/h2>Rails application failed to start properly"<br /><br />编辑dispatch.fcgi<br /><br />加入<br /><br />require ‘fcgi_handler’<br /><br />require ‘rubygems’<br /><br />require_gem ‘fcgi’<br /><br />需要注意的是,我们一般都是在windows平台开发,然后部署到linux上去,如果您属于这种情况,请注意文件的第一行编译器的设置.windows上可能是:<br /><br />#! C:\ruby\bin\ruby<br /><br />需要改成<br /><br />#! /usr/local/bin/ruby<br /><br />问题解答<br /><br />Q:如果C编译器没有安装,应该如何安装呢?&nbsp;&nbsp; <br />A:在debian上使用如下命令:<br /><br />apt-get install build-essential<br /><br />&nbsp; <br />Q:如果出现以下错误:<br /><br />&lt;— lib<br />/usr/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:4:in `require’: no such file to load — zlib (LoadError)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:4<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:8:in `require’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:8<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:504:in `require’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:504<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /home/confach/pkgs/rubygems-0.9.4/./post-install.rb:81:in `require’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /home/confach/pkgs/rubygems-0.9.4/./post-install.rb:81:in `install_sources’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /home/confach/pkgs/rubygems-0.9.4/./post-install.rb:116:in `run_hook’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from setup.rb:1526:in `exec_task_traverse’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from setup.rb:1342:in `exec_install’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from setup.rb:1000:in `exec_install’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from setup.rb:814:in `invoke’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from setup.rb:773:in `invoke’<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from setup.rb:1578<br /><br /> 我该怎么办?<br /><br />A:说明zlib无法加载.解决方案:<br /><br />cd ruby-1.8.6/ext/zlib/<br />ruby extconf.rb –with-zlib-include=/usr/include –with-zlib-lib=/usr/lib<br />make<br />make install<br /><br />Q:如果利用查看fcgi for ruby是否已经装上?<br />A:请调用gem list,看是否fcgi在其中<br /><br />Q:如果我利用gem install fcgi 安装不上怎么办?<br />A:很简单,下载其源代码然后进行安装:<br />&nbsp;&nbsp;&nbsp; <br /><br />然后就可以安装ruby的fcgi支持库了，下载ruby-fcgi-0.8.7.tar.gz：<br /><br /> <br /><br />http://rubyforge.org/projects/fcgi/<br /><br />tar xzvf ruby-fcgi-0.8.7.tar.gz<br /><br />cd ruby-fcgi-0.8.7<br /><br />ruby install.rb config — –with-fcgi-include=/usr/local/include –with-fcgi-lib=/usr/local/lib<br /><br />ruby install.rb setup<br /><br />ruby install.rb install<br /><br /><br />&nbsp; 需要注意的是,还是安装上fastcgi.<br /><br />Q:如我我遇到如下错误怎么办?<br /><br />mod_fcgid: can’t apply process slot for "xxx/xxx/public/dispatch.fcgi"<br /><br /> A:这个比较简单,修改一下Apache的日志目录权限,例如chmod 755 /var/log/apache2<br /><br />Q:如果遇见如下错误怎么办?<br /><br />Premature end of script headers: dispatch.fcgi<br /><br />A:请先检查一下该文件的配置以及.htaccess.如果问题依旧,请修改一下dispatch.fcgi的权限,至少是755更多详情，参考我的另一文章：<br /><br />"Premature end of script headers: dispatch.fcgi"终极解决方案<br /><br />.<br /><br />Q:如果提示RewriteEngine拼写错误,或者没有启用该功能怎么处理?<br /> A:非常简单,那是因为apache的rewrite模块没有加载.请先检查rewrite模块是否已经安装.然后执行下面的命令:<br /><br />cd /etc/apache3/mods-available<br />&nbsp;&nbsp;&nbsp;&nbsp; nano -e rewrite.load<br /><br />输入<br /><br />LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so<br /><br />Ctrl+X保存<br /><br />cd ..<br />ln -s mods-available/rewrite.load mods-enabled<br /><br />然后重启apache<br /><br />/etc/init.d/apache2 restart<br /><br />Q: 如何选择fastcgi和fcgid呢?<br />A:很简单,如果是apache1.x,选用fastcgi,如果是apache2.x,请选用fcgid<br /><br />Q:对系统有什么要求?<br />A:建议采用2.6版本的内核<br /><br />&nbsp;&nbsp; <br />Q:怎么使用ImageMagick无法显示图片?<br /><br />A:请先调用<br /><br />/usr/local/bin/convert logo: logo.gif<br /><br /><br />如果没法生成或者生成的gif文件无效,请重新安装ImageMagick.在安装之前请安装jpeg,freetype,png,tiff等库.<br /><br />Q:如果访问网站显示的是dispatch.fcgi的源内容，怎么办？<br /><br />A:一般来说，有2个理由导致：<br /><br />&nbsp;&nbsp; 1.&nbsp;&nbsp;&nbsp; 没有安装fcgi module。因为没有安装，访问时没法解析。关于安装的问题，参见上面安装fcgi这一节。<br />&nbsp;&nbsp; 2. 或者是apache不同版本造成的。<br /><br /><br /><br />问题一,在安装fcgi是时出错.<br />checking for fcgiapp.h... no<br /><br />就执行apt-get install libfcgi-dev
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/207400#comments" style="color:red;">已有 <strong>1</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Tue, 24 Jun 2008 11:44:32 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/207400</link>
        <guid>http://biaoming.javaeye.com/blog/207400</guid>
      </item>
          <item>
        <title>hibernate usertype 如何得知自身实体状态</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/190471" style="color:red;">http://biaoming.javaeye.com/blog/190471</a>&nbsp;
          发表时间: 2008年05月07日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          hibernate usertype优劣网上有不少说法，下面是我的感受。<br />好处是能自定义符合自己的类型，特别是在重构或者开发基于以前数据库设计的。<br />坏处是，用了usertype之后就依赖于hibernate，不方便移植到jpa。<br /><br />现在我有这么一个需求，在UserBean有个photo，用于保存用户图片，以前都是在action处理，然后把图片的相对地址保存到user表。但现在发现都依赖于action，每处理有图片或者附件的bean时都要在action进行相应操作，所以想用hibernate usertype来处理图片或者附件上传问题。<br />我的FileUserType实现了UserType, ParameterizedType两个操作。在nullSafeSet方法先保存到文件系统，然后再文件相对地址插入库，在nullSafeGet根据库的相对地址实例File，然后set到UserBean。就是完成了插入和读。但现在发布更新和删除没办法在这里处理，我的更新思路是先删除文件系统的文件，然后再上传，表字段的值直接更新就行了。删除也是先删除文件系统的文件。但我发现在实现了UserType接口没有提供得知状态（插入、更新、删除）的方法，或者我现在用的还不对，现在我就想知道有没有办法在得知这些状态。暂不考虑用eventListeners。
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/190471#comments" style="color:red;">已有 <strong>2</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 07 May 2008 09:37:10 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/190471</link>
        <guid>http://biaoming.javaeye.com/blog/190471</guid>
      </item>
          <item>
        <title>融水互动又发布新版本了</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/190008" style="color:red;">http://biaoming.javaeye.com/blog/190008</a>&nbsp;
          发表时间: 2008年05月06日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>在我们的努力些，<a href="http://www.545300.cn" title="融水互动">融水互动</a>
发布了&beta;1.6，主要是修复一些已发布的BUG，还增加了数字效验。</p>
<p>但还存在很多问题，在下个版本站我们会做一些功能的增强，以前引入图片图片安全保护和版权问题。</p>
<p>技术问题暂时不公开，不过离不开javaeyec的帮助，在这我学习到更多技术。</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/190008#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Tue, 06 May 2008 09:40:51 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/190008</link>
        <guid>http://biaoming.javaeye.com/blog/190008</guid>
      </item>
          <item>
        <title>发现一个在线学习groovy的好网站</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/188507" style="color:red;">http://biaoming.javaeye.com/blog/188507</a>&nbsp;
          发表时间: 2008年04月30日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><a href="http://www.groovyland.net/groovylive/shell" target="_blank">http://www.groovyland.net/groovylive/shell</a></p>
<p>可以按照提示一边学习一边看效果,非常方便.</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/188507#comments" style="color:red;">已有 <strong>2</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 30 Apr 2008 18:00:11 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/188507</link>
        <guid>http://biaoming.javaeye.com/blog/188507</guid>
      </item>
          <item>
        <title>重定向对SEO的影响</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/188506" style="color:red;">http://biaoming.javaeye.com/blog/188506</a>&nbsp;
          发表时间: 2008年04月30日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>&nbsp;&nbsp;&nbsp;&nbsp; 在我们的网站建设中，时常会遇到需要网页重定向的情况：象网站调整，如改变网页目录结构，网页被移到一个新地址，再或者，网页扩展名改变，如因应用需要把.jsp改成.html或.shtml，在这种情况下，如果不做重定向，则用户收藏夹或搜索引擎数据库中旧地址只能让访问客户还会得到一个404页面错误信息，访问流量白白丧失；再如某些注册了多个域名的网站，也需要通过重定向让访问这些域名的用户自动跳转到主站点，等等。<br />
<br />
　　页面永久性移走（301重定向）是一种非常重要的&ldquo;自动转向&rdquo;技术。<br />
<br />
　　301重定向可促进搜索引擎优化效果<br />
<br />
　　从搜索引擎优化角度出发，301重定向是网址重定向最为可行的一种办法。当网站的域名发生变更后，搜索引擎只对新网址进行索引，同时又会把旧地址下原有的外部链接如数转移到新地址下，从而不会让网站的排名因为网址变更而收到丝毫影响。同样，在使用301永久性重定向命令让多个域名指向网站主域时，亦不会对网站的排名产生任何负面影响。<br />
<br />
　　302重定向可影响搜索引擎优化效果<br />
<br />
　　迄今为止，能够对302重定向具备优异处理能力的只有Google。也就是说，在网站使用302重定向命令将其它域名指向主域时，只有Google会把其它域名的链接成绩计入主域，而其它搜索引擎只会把链接成绩向多个域名分摊，从而削弱主站的链接总量。既然作为网站排名关键因素之一的外链数量受到了影响，网站排名降低也是很自然的事情了。</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/188506#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 30 Apr 2008 17:53:27 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/188506</link>
        <guid>http://biaoming.javaeye.com/blog/188506</guid>
      </item>
          <item>
        <title>今天又发布了融水互动对外测试1.5版本</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/188115" style="color:red;">http://biaoming.javaeye.com/blog/188115</a>&nbsp;
          发表时间: 2008年04月29日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>这次可以发布图片，文章，音乐，和申请圈子以及加入朋友的圈子了。</p>
<p>网址是:<a href="http://www.545300.cn " title="融水互动" target="_blank">www.545300.cn</a>
 融水互动</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/188115#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Tue, 29 Apr 2008 16:54:19 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/188115</link>
        <guid>http://biaoming.javaeye.com/blog/188115</guid>
      </item>
          <item>
        <title>想做个pagination的java版</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/186820" style="color:red;">http://biaoming.javaeye.com/blog/186820</a>&nbsp;
          发表时间: 2008年04月25日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <pre name="code" class="ruby">       def pagination_links_each(paginator, options)  
         options = DEFAULT_OPTIONS.merge(options)  
         link_to_current_page = options[:link_to_current_page]  
         always_show_anchors = options[:always_show_anchors]  
         current_page = paginator.current_page  
         window_pages = current_page.window(options[:window_size]).pages  
         return if window_pages.length &lt;= 1 unless link_to_current_page  
         first, last = paginator.first, paginator.last  
         html = ''  
         if always_show_anchors and not (wp_first = window_pages[0]).first?  
           html &lt;&lt; yield(first.number)  
           html &lt;&lt; ' ... ' if wp_first.number - first.number &gt; 1  
           html &lt;&lt; ' '  
         end  
         window_pages.each do |page|  
           if current_page == page &amp;&amp; !link_to_current_page  
             html &lt;&lt; page.number.to_s  
           else  
             html &lt;&lt; yield(page.number)  
           end  
           html &lt;&lt; ' '  
         end  
         if always_show_anchors and not (wp_last = window_pages[-1]).last?   
           html &lt;&lt; ' ... ' if last.number - wp_last.number &gt; 1  
           html &lt;&lt; yield(last.number)  
         end  
         html  
       end </pre>
&nbsp;
<p>这会产生一个比较好看的视觉，至少我觉得，现在想做个JAVA版的，主要是怎么生成html，请各人搞手给个思路，谢谢！</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/186820#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 25 Apr 2008 15:51:55 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/186820</link>
        <guid>http://biaoming.javaeye.com/blog/186820</guid>
      </item>
          <item>
        <title>今天发现个好东西--Grails</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/179368" style="color:red;">http://biaoming.javaeye.com/blog/179368</a>&nbsp;
          发表时间: 2008年04月03日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          学习Ruby，Ruby on rails是觉得他是动态语言，很方便，很适合做WEB开发。但今天发现了Grails，思想和ROR差不多，用的是java动态脚本语言groovy，所以可以说Groovy on grails，写一个demo，完成CRUD，不用我2两钟，太神了，而且是基于平时常用的spring hibernate hibernate-annotations jetty，所以准备深入学习。<br /><br />这是IBM介绍第一个Grails的例子<br />http://www.ibm.com/developerworks/cn/java/j-grails01158/<br /><br />这是与ROR比较的文章<br /> http://www.infoq.com/cn/news/2007/07/grails-misconceptions
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/179368#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 03 Apr 2008 20:00:57 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/179368</link>
        <guid>http://biaoming.javaeye.com/blog/179368</guid>
      </item>
          <item>
        <title>增强acegi ACL的拦截方法参数问题</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/171572" style="color:red;">http://biaoming.javaeye.com/blog/171572</a>&nbsp;
          发表时间: 2008年03月15日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          如果用acegi acl，你什么发现在定义objectDefinitionSource时被拦截的方法参数必须与投票器定义的processDomainObjectClass一致，如果你想deleteById就会出错，所以重写了AbstractAclVoter下的getDomainObjectInstance。在这增加对deleteById的处理方法。<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; params.length; i++) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (processDomainObjectClass.isAssignableFrom(params[i])) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return args[i];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object o;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; o = processDomainObjectClass.newInstance();<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method setIdMethod = processDomainObjectClass.getMethod(&quot;setId&quot;, new Class[]{Integer.class});<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setIdMethod.invoke(o, new Object[]{Integer.parseInt(args[0].toString())});<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return o;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (InstantiationException e) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AuthorizationServiceException(&quot;不能创建'&quot; + processDomainObjectClass + &quot;'的实例.&quot; + e.getMessage());<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (IllegalAccessException e) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AuthorizationServiceException(&quot;不能创建setId方法,在实体类中必须提供setId(Integer)方法.&quot; + e.getMessage());<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (SecurityException e) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AuthorizationServiceException(e.getMessage());<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (NoSuchMethodException e) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AuthorizationServiceException(&quot;没有找到setId(Integer)方法.&quot; + e.getMessage());<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (IllegalArgumentException e) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AuthorizationServiceException(&quot;setId(Integer)方法参数必须为Integer类型.&quot; + e.getMessage());<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (InvocationTargetException e) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AuthorizationServiceException(&quot;调用setId(Integer)方法出错.&quot; + e.getMessage());<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p>&nbsp;</p>
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/171572#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sat, 15 Mar 2008 10:00:18 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/171572</link>
        <guid>http://biaoming.javaeye.com/blog/171572</guid>
      </item>
          <item>
        <title>acegi TransactionInterceptor遇到spring2.x</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/169978" style="color:red;">http://biaoming.javaeye.com/blog/169978</a>&nbsp;
          发表时间: 2008年03月10日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          一直使用spring2.x都没有问题，所有service都通过AOP注入。<br />现在用acegi的ACL，却发现原来的AOP影响而不能使用。以下是我的AOP<br />&lt;!-- Transactional advice -->&nbsp; <br />	&lt;tx:advice id="txAdvice" transaction-manager="transactionManager">&nbsp; <br />		&lt;tx:attributes>&nbsp; <br />			&lt;!-- methods starting with 'save', 'update' or 'remove' use the default transaction settings -->&nbsp; <br />			&lt;tx:method name="save*"/>&nbsp; <br />			&lt;tx:method name="delete*"/> <br />			&lt;tx:method name="merge*"/> <br />			&lt;tx:method name="remove*"/>&nbsp; <br />			<br />			&lt;!-- other methods are set to read only -->&nbsp; <br />			&lt;tx:method name="*" read-only="true"/> <br />		&lt;/tx:attributes>&nbsp; <br />	&lt;/tx:advice><br />	<br />	&lt;aop:config proxy-target-class="true">	<br />		&lt;aop:advisor pointcut="execution(* cn.biaoming.service..*Service.*(..))" advice-ref="txAdvice"/><br />	&lt;/aop:config><br /><br />而TransactionInterceptor是这么定义的：<br />&lt;bean id="articleService" class="org.springframework.aop.framework.ProxyFactoryBean"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="proxyInterfaces" value="cn.biaoming.service.ArticleService"/><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="target">&lt;ref local="articleServiceTager"/>&lt;/property><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="interceptorNames"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;list><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;idref local="articleServiceSecurity"/><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/list><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/property><br />&nbsp;&nbsp; &lt;/bean><br />&nbsp;&nbsp; <br />&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;bean id="articleServiceSecurity" class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="authenticationManager">&lt;ref bean="authenticationManager"/>&lt;/property><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="accessDecisionManager">&lt;ref local="businessAccessDecisionManager"/>&lt;/property><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="afterInvocationManager">&lt;ref local="afterInvocationManager"/>&lt;/property><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="objectDefinitionSource"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 	&lt;value><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 	&lt;/value><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/property><br />&nbsp;&nbsp; &lt;/bean><br /><br />现在只要把spring2.x 的AOP去掉，TransactionInterceptor就能正常工作，要不就报以下错误<br />WARN Cglib2AopProxy.doValidateClass(250) | Unable to proxy method [public final java.util.List $Proxy29.getLatestArticle(java.lang.String,int)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/169978#comments" style="color:red;">已有 <strong>11</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 10 Mar 2008 21:38:01 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/169978</link>
        <guid>http://biaoming.javaeye.com/blog/169978</guid>
      </item>
          <item>
        <title>JAVA与RUBY方法访问权限的差别</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/168543" style="color:red;">http://biaoming.javaeye.com/blog/168543</a>&nbsp;
          发表时间: 2008年03月06日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          private和protected的在ruby当前和Java的定义有很大的区别：<br /><br />1、在不同对象实例当中的作用域不同<br />Java当中，不管private还是protected的方法，都可以被同一个类别的其他对象实例调用；<br />Ruby当中，private方法不能被同一个类别的其他对象实例调用；<br /><br />2、在类继承关系当中的作用域不同<br />ruby当中，不管private还是protected方法，都可以被子类继承；<br />Java当中，private方法不能被子类继承；<br /><br />这种方法调用的差异，也许来自于不同的面向对象理念：Java的面向对象来自C++，强调类继承关系，所以方法调用限定类继承的层次结构当中的作用域，却不强调对象实例作用域；而ruby的面向对象来自smalltalk，即使是类别也是对象，因此方法调用作用域都是针对对象实例调用来设置的。
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/168543#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 06 Mar 2008 09:33:08 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/168543</link>
        <guid>http://biaoming.javaeye.com/blog/168543</guid>
      </item>
          <item>
        <title>proftpd禁用反向域名解析</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/156944" style="color:red;">http://biaoming.javaeye.com/blog/156944</a>&nbsp;
          发表时间: 2008年01月17日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          # 禁用反向域名解析<br />UseReverseDNS off
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/156944#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 17 Jan 2008 16:35:41 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/156944</link>
        <guid>http://biaoming.javaeye.com/blog/156944</guid>
      </item>
          <item>
        <title>解决libstdc++.so.5问题</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/155194" style="color:red;">http://biaoming.javaeye.com/blog/155194</a>&nbsp;
          发表时间: 2008年01月12日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory<br /><br />apt-get install libstdc++5
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/155194#comments" style="color:red;">已有 <strong>0</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sat, 12 Jan 2008 01:22:29 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/155194</link>
        <guid>http://biaoming.javaeye.com/blog/155194</guid>
      </item>
          <item>
        <title>lucene搜索时如果指定一个域为空呢?</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/147716" style="color:red;">http://biaoming.javaeye.com/blog/147716</a>&nbsp;
          发表时间: 2007年12月12日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          现在有个需求,搜索一个有父子关系的类别,只想搜索到是父的类别,在搜索语句里想加个类似+child:null,但不行,lucene能指定一个域为空的吗?
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/147716#comments" style="color:red;">已有 <strong>1</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 12 Dec 2007 09:54:02 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/147716</link>
        <guid>http://biaoming.javaeye.com/blog/147716</guid>
      </item>
          <item>
        <title>请教compass如何映射java.util.Map类型</title>
        <author>biaoming</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://biaoming.javaeye.com">biaoming</a>&nbsp;
                    链接：<a href="http://biaoming.javaeye.com/blog/139251" style="color:red;">http://biaoming.javaeye.com/blog/139251</a>&nbsp;
          发表时间: 2007年11月08日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          现在实体设计有需要用到java.util.Map,但是在这个属性加@SearchableComponent就报but no class mapping was found for [java.util.Map],具体的信息如下:<br /><br />Caused by: org.compass.core.mapping.MappingException: Tried to resolve ref-alias for property [articles] in alias [test], but no class mapping was found for [java.util.Map]<br /><br />这个错误是因为compass不支持map类型吗?有什么思路可以解决,谢谢!<br /><br />我的配置如下:<br />@SearchableComponent<br />@OneToMany(mappedBy="test")<br />@MapKey(name="title")<br />public Map&lt;String, Article> getArticles() {<br /> return articles;<br />}
          <br/><br/>
          <span style="color:red;">
            <a href="http://biaoming.javaeye.com/blog/139251#comments" style="color:red;">已有 <strong>2</strong> 人发表留言，猛击-&gt;&gt;<strong>这里</strong>&lt;&lt;-参与讨论</a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">Windows7在微软WinHEC 2008上揭开神秘面纱</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 08 Nov 2007 16:11:02 +0800</pubDate>
        <link>http://biaoming.javaeye.com/blog/139251</link>
        <guid>http://biaoming.javaeye.com/blog/139251</guid>
      </item>
      </channel>
</rss>