﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-光子CI之旅</title><link>http://www.blogjava.net/kuuyee/</link><description>while (产品+需求+设计+开发+测试+部署+发布 == doing) 
{ 
  CI 
}</description><language>zh-cn</language><lastBuildDate>Wed, 29 Apr 2026 16:48:39 GMT</lastBuildDate><pubDate>Wed, 29 Apr 2026 16:48:39 GMT</pubDate><ttl>60</ttl><item><title>当EffectiveJava遇见Guava - 使类和成员的可访问性最小化(规则13)</title><link>http://www.blogjava.net/kuuyee/archive/2013/06/14/400560.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Fri, 14 Jun 2013 09:09:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/06/14/400560.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/400560.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/06/14/400560.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/400560.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/400560.html</trackback:ping><description><![CDATA[<div style="float: left; min-height: 1px; margin-left: 30px; width: 870px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px; background-color: #f0efe7;"><br /><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">软件设计的基本原则之一，就是系统要模块化，模块之间只通过他们的API进行通信，一个模块不需要知道其他模块的内部工作情况，这个概念称作信息隐藏(information hiding)或封装(encapsulation)。</span></h2><div><h5>需要遵守的原则</h5><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;"><strong>尽可能地使每个类或成员不被外界访问。</strong>换句话说，应该使用与你正在编写的软件的对应功能相一致、尽可能最小的访问级别。</p></li><li><p style="margin: 0px 0px 10px;">对于顶层的(非嵌套的)类和接口，只有两种可能非访问级别，要从是包级私有的也就是<tt>default</tt>，要么是<tt>public</tt>的.包级私有就意味着它是这个包<strong>实现</strong>的一部分，不会作为该包API被导出，这样在以后的发型版本中，对它修改、替换、删除就不用担心会影响先有客户端的程序。</p></li><li><p style="margin: 0px 0px 10px;">如果一个包级私有的顶层类(或者接口)只是在某一个类内部被用到，就应该考虑把它变成唯一使用它的那个类的私有嵌套类。</p></li><li><p style="margin: 0px 0px 10px;">降低不必要公有类的可访问性，比降低包级私有的顶层类更重要的多，因为共有类是API的一部分，而包级私有的顶层类已经是包实现的一部分了。</p></li><li><p style="margin: 0px 0px 10px;">受保护(<strong>protected</strong>)的类或成员是导出API的一部分，必须永远得到支持，应该避免尽量少用。</p></li><li><p style="margin: 0px 0px 10px;">如果子类覆盖了超类的一个方法，子类中的访问级别就不允许低于超类中的访问级别，否则会编译错误。实现了接口的所有方法也必须是共有的，因为接口中的所有方法都是隐含着共有访问级别。</p></li><li><p style="margin: 0px 0px 10px;">为了便于测试，不应该把其访问级别成为共有的，取而代之是把测试类成为包的一部分，从而能够访问它的包级私有元素。</p></li><li><p style="margin: 0px 0px 10px;"><strong>实例域决不能是共有的，包含公有可变域的类即便是final的也不是线程安全的</strong>，</p></li></ul></div><div style="padding-left: 15px; margin: 0px 0px 20px; border-left-width: 5px; border-left-style: solid; border-left-color: #eeeeee;"><table style="max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0px;"><tbody><tr><td><div>Note</div></td><td>长度非零的数组总数可变的，所以，类具有公有的静态final数组域，或者返回这种域的访问方法，这几乎总数错误的。<br /></td></tr></tbody></table></div><div><p style="margin: 0px 0px 10px;"><div style="display: inline-block;"></div></p><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">UnmodifiableArray</span> {<br />       <span style="color: #777777;">// 潜在安全漏洞<br /></span>       <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #00aa55; font-weight: bold;">String</span><span style="color: #333399; font-weight: bold;">[]</span> VALUES = { <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">RED</span><span style="color: #771100;">"</span></span>, <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">GREEN</span><span style="color: #771100;">"</span></span> };<br /><br />       <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> main(<span style="color: #00aa55; font-weight: bold;">String</span><span style="color: #333399; font-weight: bold;">[]</span> args) {<br />         UnmodifiableArray UF = <span style="color: #008800; font-weight: bold;">new</span> UnmodifiableArray();<br />         UF.VALUES[<span style="color: #0000dd;">1</span>] = <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">YELLO</span><span style="color: #771100;">"</span></span>;<span style="color: #777777;">//设置final数组成员<br /></span>         <span style="color: #00aa55; font-weight: bold;">System</span>.out.println(UF);<br />      }<br />      <span style="color: #777777;">//使用Guava<br /></span>     <span style="color: #000077;">@Override<br /></span>     <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #00aa55; font-weight: bold;">String</span> toString() {<br />         <span style="color: #008800; font-weight: bold;">return</span> Objects.toStringHelper(<span style="color: #996633;">this</span>).add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">VALUES0</span><span style="color: #771100;">"</span></span>, UnmodifiableArray.VALUES[<span style="color: #0000dd;">0</span>])<br />                 .add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">VALUES1</span><span style="color: #771100;">"</span></span>, UnmodifiableArray.VALUES[<span style="color: #0000dd;">1</span>]).toString();<br />     }<br /> }</code></pre></div></div><div></div><br /><p style="margin: 0px 0px 10px;">上面的例子里，我们成功更改了一个不可变数组，把成员<tt>GREEN</tt>修改为<tt>YELLO</tt>，执行输出如下：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">UnmodifiableArray{VALUES0=RED, VALUES1=YELLO}</code></pre></div></div><div><p style="margin: 0px 0px 10px;">我们可以通过增加一个不可变集合列表来解决这个安全问题，并把原来<tt>public</tt>访问级别改为<tt>private</tt>的：</p></div><div><div style="display: inline-block;"></div></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">UnmodifiableArrayList</span> {<br />      <span style="color: #777777;">// 消除安全漏洞<br /></span>     <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #00aa55; font-weight: bold;">String</span><span style="color: #333399; font-weight: bold;">[]</span> PRIVATE_VALUES = { <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">RED</span><span style="color: #771100;">"</span></span>, <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">GREEN</span><span style="color: #771100;">"</span></span> };<br />     <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #00aa55; font-weight: bold;">List</span>&lt;<span style="color: #00aa55; font-weight: bold;">String</span>&gt; PVALUES = <span style="color: #00aa55; font-weight: bold;">Collections</span>.unmodifiableList(<span style="color: #00aa55; font-weight: bold;">Arrays</span>.asList(PRIVATE_VALUES));<br />     <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> main(<span style="color: #00aa55; font-weight: bold;">String</span><span style="color: #333399; font-weight: bold;">[]</span> args) {<br />         UnmodifiableArrayList UF = <span style="color: #008800; font-weight: bold;">new</span> UnmodifiableArrayList();<br />         UF.PVALUES.add(<span style="color: #0000dd;">1</span>, <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">YELLO</span><span style="color: #771100;">"</span></span>); <span style="color: #777777;">//会抛出UnsupportedOperationException异常<br /></span>         <span style="color: #00aa55; font-weight: bold;">System</span>.out.println(UF);<br />     }<br />     <span style="color: #777777;">//使用Guava<br /></span>     <span style="color: #000077;">@Override<br /></span>     <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #00aa55; font-weight: bold;">String</span> toString() {<br />         <span style="color: #008800; font-weight: bold;">return</span> Objects.toStringHelper(<span style="color: #996633;">this</span>)<br />                         .add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">PVALUES0</span><span style="color: #771100;">"</span></span>, UnmodifiableArrayList.PVALUES.get(<span style="color: #0000dd;">0</span>))<br />                         .add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">PVALUES1</span><span style="color: #771100;">"</span></span>, UnmodifiableArrayList.PVALUES.get(<span style="color: #0000dd;">1</span>))<br />                         .toString();<br />     }<br /> }</code></pre></div></div><div></div><div><p style="margin: 0px 0px 10px;">构建一个不可变集合，Guava给出了更简洁的办法：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">ImmutableList mmutableList = ImmutableList.of(PRIVATE_VALUES);</code></pre></div></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-06-14</div></div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/400560.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-06-14 17:09 <a href="http://www.blogjava.net/kuuyee/archive/2013/06/14/400560.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ruby下gem-fast设置代理错误</title><link>http://www.blogjava.net/kuuyee/archive/2013/06/13/400495.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Wed, 12 Jun 2013 23:58:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/06/13/400495.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/400495.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/06/13/400495.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/400495.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/400495.html</trackback:ping><description><![CDATA[<hr style="margin: 20px 0px; border-right-width: 0px; border-left-width: 0px; border-top-style: solid; border-top-color: #eeeeee; border-bottom-style: solid; border-bottom-color: #ffffff; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px; background-color: #f0efe7;" /><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><h2><span style="font-size: 14px;">有时候公司内网需要设置HTTP代理才能连接公网，下面列出一些Gem及Git的代理设置方法</span></h2><div><p style="margin: 0px 0px 10px;"><strong>设置Git代理</strong></p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$git config --global http.proxy http://192.128.1.3:80 <br />$  git config -l <br />http.proxy=http://192.128.1.3:80</code></pre></div></div><div><p style="margin: 0px 0px 10px;"><strong>设置Gem代理</strong></p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$ export http_proxy=http://192.128.1.3:80 <br />gem install rails --http-proxy $http_proxy</code></pre></div></div><div><p style="margin: 0px 0px 10px;"><strong>让Bundler使用HTTP代理环境设置</strong></p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sudo -E bundle ...</code></pre></div></div><div><h4>非Root用户设置代理后gem-fast会报错</h4><div><p style="margin: 0px 0px 10px;">如果你是非root用户，比如用Git用户设置http代理后，使用gem-fast会报如下错误：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">curl: (7) couldn't connect to host <br />ERROR:  While executing gem ... (GemFast::Util::ExecutionError)     Failure while executing: curl -f#LA rubygem-gemfast http://ruby.taobao.org/quick/Marshal.4.8/bundler-1.3.5.gemspec.rz --insecure -o /home/git/local/lib/ruby/gems/1.9.1/cache/bundler-1.3.5.gemspec.rz</code></pre></div></div><div><p style="margin: 0px 0px 10px;">目前的还没找到根本的解决办法，原因是授权的问题，因为root用户执行就不报错，所以只能卸载<strong>gem-fast</strong>，这样就不报错了，但是就不能使用gem-fast的快速下载功能了。那位牛人能解决这个问题请告之小弟，谢谢！</p></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-06-12</div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/400495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-06-13 07:58 <a href="http://www.blogjava.net/kuuyee/archive/2013/06/13/400495.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java四大名著下载大全（中文+英文）</title><link>http://www.blogjava.net/kuuyee/archive/2013/06/03/400084.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Mon, 03 Jun 2013 00:30:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/06/03/400084.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/400084.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/06/03/400084.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/400084.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/400084.html</trackback:ping><description><![CDATA[<div style="float: left; min-height: 1px; margin-left: 30px; width: 870px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px; background-color: #f0efe7;"><br /><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">抽时间整理了一下Java四大名著，分享出来方便大家学习！</span></h2><div style="padding-left: 15px; margin: 0px 0px 20px; border-left-width: 5px; border-left-style: solid; border-left-color: #eeeeee;"><table style="max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0px;"><tbody><tr><td><div>Note</div></td><td><strong>郑重声明！本人强烈支持正版，四大名著我已经买了三本，下载电子版只是方便阅读！毕竟这么经典的书是必收藏的！</strong></td></tr></tbody></table></div><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;"><a href="http://book.jd.com/10058164.html" style="color: #0088cc; text-decoration: none;">Java编程思想(第4版)</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=502949&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=502949&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版PDF：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503042&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503042&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503044&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503044&amp;uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a href="http://book.jd.com/10058902.html" style="color: #0088cc; text-decoration: none;">Effective Java（第2版）</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503046&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503046&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版PDF：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503049&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503049&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503051&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503051&amp;uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a href="http://book.jd.com/10058538.html" style="color: #0088cc; text-decoration: none;">Java核心技术 卷I（第8版）</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503052&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503052&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版PDF：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503055&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503055&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503056&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503056&amp;uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a href="http://book.jd.com/10058907.html" style="color: #0088cc; text-decoration: none;">Java核心技术 卷II（第8版）</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503057&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503057&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版CHM：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503058&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503058&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503056&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503056&amp;uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a href="http://book.jd.com/10137873.html" style="color: #0088cc; text-decoration: none;">Java语言程序设计(第4版)</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503059&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503059&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版CHM：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503060&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503060&amp;uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a href="http://product.china-pub.com/24614" style="color: #0088cc; text-decoration: none;">Java编程思想(第3版)</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清非扫描版：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503099&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503099&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版PDF：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503102&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503102&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503103&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503103&amp;uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">习题答案：&nbsp;<a href="http://pan.baidu.com/share/link?shareid=503105&amp;uk=2785758310" style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503105&amp;uk=2785758310</a></p></li></ul></div></li></ul></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-30</div></div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/400084.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-06-03 08:30 <a href="http://www.blogjava.net/kuuyee/archive/2013/06/03/400084.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>当EffectiveJava遇见Guava - 静态工厂方法代替构造器(规则1)</title><link>http://www.blogjava.net/kuuyee/archive/2013/05/30/399987.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Thu, 30 May 2013 09:09:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/05/30/399987.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/399987.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/05/30/399987.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/399987.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/399987.html</trackback:ping><description><![CDATA[<div style="float: left; min-height: 1px; margin-left: 30px; width: 870px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px; background-color: #f0efe7;"><hr style="margin: 20px 0px; border-right-width: 0px; border-left-width: 0px; border-top-style: solid; border-top-color: #eeeeee; border-bottom-style: solid; border-bottom-color: #ffffff;" /><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><a href="http://book.jd.com/10058902.html" style="font-size: 14px; color: #0088cc; text-decoration: none;">Effective Java</a><span style="font-size: 14px;">中指出，使用静态工厂方法代替构造器有几大优势：</span></h2><div><h4>第一大优势 - 他们有名称。</h4><div><p style="margin: 0px 0px 10px;">多个构造器只能通过匹配参数类型的顺序不同来区分使用哪一个，这样常常会导致用户调用错误构造器，而静态工程方法则不同，可以通过方法名清晰的指明用意。</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #777777;">//本例只用来说明第一大优势，请不要纠结其它问题</span> <br /><span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Foo</span> {<br />         <span style="color: #00aa55; font-weight: bold;">Set</span>&lt;Bar&gt; bars;<br />         <span style="color: #00aa55; font-weight: bold;">List</span>&lt;Car&gt; cars;<br />         <span style="color: #777777;">//构造器1<br /></span>         <span style="color: #008888; font-weight: bold;">private</span> Foo(<span style="color: #00aa55; font-weight: bold;">Set</span>&lt;Bar&gt; bars) {<br />                 <span style="color: #996633;">this</span>.bars = bars;<br />         }<br />         <span style="color: #777777;">//构造器2<br /></span>         <span style="color: #008888; font-weight: bold;">private</span> Foo(<span style="color: #00aa55; font-weight: bold;">List</span>&lt;Car&gt; cars) {<br />                 <span style="color: #996633;">this</span>.cars = cars;<br />         }<br />         <span style="color: #777777;">//构造器3<br /></span>         <span style="color: #008888; font-weight: bold;">private</span> Foo(<span style="color: #00aa55; font-weight: bold;">Set</span>&lt;Bar&gt; bars, <span style="color: #00aa55; font-weight: bold;">List</span>&lt;Car&gt; cars) {<br />                 <span style="color: #996633;">this</span>.bars = bars;<br />                 <span style="color: #996633;">this</span>.cars = cars;<br />         }<br />         <span style="color: #777777;">//静态工厂方法1<br /></span>         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> Foo newInstanceByBar(){<br />                 <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">new</span> Foo(<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">HashSet</span>&lt;Bar&gt;());<br />         }<br />         <span style="color: #777777;">//静态工厂方法2<br /></span>         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> Foo newInstanceByCar(){<br />                 <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">new</span> Foo(<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">ArrayList</span>&lt;Car&gt;());<br />         }<br />         <span style="color: #777777;">//静态工厂方法3<br /></span>         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> Foo newInstanceByAll(){<br />                 <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">new</span> Foo(<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">HashSet</span>&lt;Bar&gt;(),<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">ArrayList</span>&lt;Car&gt;());<br />         }<br />         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> main(<span style="color: #00aa55; font-weight: bold;">String</span><span style="color: #333399; font-weight: bold;">[]</span> args) {<br />                 <span style="color: #777777;">// 通过构造器创建实例，不好区分容易使用错误<br /></span>                 Foo fbar = <span style="color: #008800; font-weight: bold;">new</span> Foo(<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">HashSet</span>&lt;Bar&gt;());<br />                 Foo fcar = <span style="color: #008800; font-weight: bold;">new</span> Foo(<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">ArrayList</span>&lt;Car&gt;());<br />                 Foo fall = <span style="color: #008800; font-weight: bold;">new</span> Foo(<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">HashSet</span>&lt;Bar&gt;(),<span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">ArrayList</span>&lt;Car&gt;());<br />                  <span style="color: #777777;">// 通过静态工厂方法可以清晰的用方法名识别<br /></span>                 Foo fbar_static = Foo.newInstanceByBar();<br />                 Foo fcar_static = Foo.newInstanceByCar();<br />                 Foo fall_static = Foo.newInstanceByAll();<br />         }<br />  }<br />  <span style="color: #333399; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Bar</span> {}<br />  <span style="color: #333399; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Car</span> {} <br /></code></pre></div></div><div><p style="margin: 0px 0px 10px;">对于Guava，并没有提供创建静态工厂方法的工具，但整个Guava API到处都是静态方法的实现，我们以Guava Collections Framewrok举例说明。</p></div><div><p style="margin: 0px 0px 10px;">Guava对于第一大优势有很多实现：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #00aa55; font-weight: bold;">List</span>&lt;<span style="color: #00aa55; font-weight: bold;">Type</span>&gt; exactly100 = Lists.newArrayListWithCapacity(<span style="color: #0000dd;">100</span>);<br /><span style="color: #00aa55; font-weight: bold;">List</span>&lt;<span style="color: #00aa55; font-weight: bold;">Type</span>&gt; approx100 = Lists.newArrayListWithExpectedSize(<span style="color: #0000dd;">100</span>); <br /><span style="color: #00aa55; font-weight: bold;">Set</span>&lt;<span style="color: #00aa55; font-weight: bold;">Type</span>&gt; approx100Set = Sets.newHashSetWithExpectedSize(<span style="color: #0000dd;">100</span>);</code></pre></div></div></div><div><h4>第二大优势 - 不必在每次调用他们的时候都创建一个新对象。</h4><div><p style="margin: 0px 0px 10px;">方便对象重用，还可以确保不可变的不会存在两个相等的实例，如果<tt>a==b</tt>那么<tt>a.equals.(b)</tt>才会返回true ,如果能保证这一点，就可以使用<tt>==</tt>操作符来比较对象，会有很大的性能提升。</p></div></div><div><h4>第三大优势 - 他们可以返回原返回类型的任何子类型的对象。</h4><div><p style="margin: 0px 0px 10px;">这是一个非常强大的特性，&nbsp;<a href="http://book.jd.com/10058902.html" style="color: #0088cc; text-decoration: none;">Effective Java</a>中列举了API、SPI、服务提供框架的关系来说明：</p></div><div><p style="margin: 0px 0px 10px;"><strong>API</strong>(Service Interface): 服务公共接口&nbsp;<strong>SPI</strong>(Service Provider Interface)： 服务提供商接口&nbsp;<strong>SPF</strong>(Service Provider Framework): 服务提供框架</p></div><div><p style="margin: 0px 0px 10px;">看例子:</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #777777;">// 服务提供框架示意模型 - 服务API</span> <br /><span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">interface</span> <span style="color: #bb0066; font-weight: bold;">ServiceAPI</span> {<br />         <span style="color: #777777;">// 这里是服务指定的方法<br /></span> }<br /><span style="color: #777777;">// 服务提供框架示意模型 - 服务SPI</span> <br /><span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">interface</span> <span style="color: #bb0066; font-weight: bold;">ServiceSPI</span> {<br />         ServiceAPI newService();<br /> }  <br /><span style="color: #777777;">// 服务提供框架示意模型实现</span> <br /><span style="color: #777777;">// 不可实例化的类，用来注册创建和提供访问</span> <br /><span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">ServiceFramework</span> {<br />         <span style="color: #008888; font-weight: bold;">private</span> ServiceFramework() {<br />         }<span style="color: #777777;">// 强制防止实例化（规则4）<br /><br /></span>         <span style="color: #777777;">// 映射服务名到服务<br /></span>         <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #00aa55; font-weight: bold;">ConcurrentMap</span>&lt;<span style="color: #00aa55; font-weight: bold;">String</span>, ServiceSPI&gt; spis = <span style="color: #008800; font-weight: bold;">new</span> MapMaker().makeMap();<span style="color: #777777;">//使用Guava创建<br /></span>         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #00aa55; font-weight: bold;">String</span> DEFAULT_SPI_NAME = <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">&lt;def&gt;</span><span style="color: #771100;">"</span></span>;<br /><br />         <span style="color: #777777;">// 默认SPI注册API<br /></span>         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> registerDefaultSPI(ServiceSPI spi) {<br />                 registerSPI(DEFAULT_SPI_NAME, spi);<br />         }<br /><br />         <span style="color: #777777;">// 指定SPI注册API<br /></span>         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> registerSPI(<span style="color: #00aa55; font-weight: bold;">String</span> name, ServiceSPI spi) {<br />                 spis.put(name, spi);<br />         }<br /><br />         <span style="color: #777777;">// 服务访问API<br /></span>         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> ServiceAPI newInstance() {<br />                 <span style="color: #008800; font-weight: bold;">return</span> newInstance(DEFAULT_SPI_NAME);<br />         }<br />         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> ServiceAPI newInstance(<span style="color: #00aa55; font-weight: bold;">String</span> name) {<br />                 ServiceSPI spi = spis.get(name);<br />                 <span style="color: #008800; font-weight: bold;">if</span>(spi == <span style="color: #006699;">null</span>)<br />                         <span style="color: #008800; font-weight: bold;">throw</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #cc0000; font-weight: bold;">IllegalArgumentException</span>(<br />                                         <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">No provider registered with name: </span><span style="color: #771100;">"</span></span> + name);<br />                 <span style="color: #008800; font-weight: bold;">return</span> spi.newService();<br />         }<br /> }</code></pre></div></div><div style="padding-left: 15px; margin: 0px 0px 20px; border-left-width: 5px; border-left-style: solid; border-left-color: #eeeeee;"><table style="max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0px;"><tbody><tr><td><div>Note</div></td><td><strong style="color: #333333;">静态工程方法返回的对象所属的类，在编写这个包含静态工厂方法的类时可以不必存在。上面的例子在编写ServiceFramework类时，ServiceAPI的实现类并不存在。这大大增加了框架的灵活性。</strong></td></tr></tbody></table></div><div><p style="margin: 0px 0px 10px;">现在编写客户端测试程序</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #777777;">// 简单的服务提供框架测试程序</span> <br /><span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">Test</span> {<br />         <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> main(<span style="color: #00aa55; font-weight: bold;">String</span><span style="color: #333399; font-weight: bold;">[]</span> args) {<br />                 <span style="color: #777777;">// 服务提供商执行下面的注册<br /></span>                 ServiceFramework.registerDefaultSPI(DEFAULT_PROVIDER);<br />                 ServiceFramework.registerSPI(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">comp</span><span style="color: #771100;">"</span></span>, COMP_PROVIDER);<br />                 ServiceFramework.registerSPI(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">armed</span><span style="color: #771100;">"</span></span>, ARMED_PROVIDER);<br />                  <span style="color: #777777;">// 客户端执行下面的创建<br /></span>                 ServiceAPI s1 = ServiceFramework.newInstance();<br />                 ServiceAPI s2 = ServiceFramework.newInstance(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">comp</span><span style="color: #771100;">"</span></span>);<br />                 ServiceAPI s3 = ServiceFramework.newInstance(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">armed</span><span style="color: #771100;">"</span></span>);<br />                 <span style="color: #00aa55; font-weight: bold;">System</span>.out.printf(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">%s, %s, %s%n</span><span style="color: #771100;">"</span></span>, s1, s2, s3);<br />         }<br />          <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">static</span> ServiceSPI DEFAULT_PROVIDER = <span style="color: #008800; font-weight: bold;">new</span> ServiceSPI() {<br />                 <span style="color: #008888; font-weight: bold;">public</span> ServiceAPI newService() {<br />                         <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">new</span> ServiceAPI() {<br />                                 <span style="color: #000077;">@Override<br /></span>                                 <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #00aa55; font-weight: bold;">String</span> toString() {<br />                                         <span style="color: #008800; font-weight: bold;">return</span> <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">默认服务</span><span style="color: #771100;">"</span></span>;<br />                                 }<br />                         };<br />                 }<br />         };<br />          <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">static</span> ServiceSPI COMP_PROVIDER = <span style="color: #008800; font-weight: bold;">new</span> ServiceSPI() {<br />                 <span style="color: #008888; font-weight: bold;">public</span> ServiceAPI newService() {<br />                         <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">new</span> ServiceAPI() {<br />                                 <span style="color: #000077;">@Override<br /></span>                                 <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #00aa55; font-weight: bold;">String</span> toString() {<br />                                         <span style="color: #008800; font-weight: bold;">return</span> <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">Complementary 服务</span><span style="color: #771100;">"</span></span>;<br />                                 }<br />                         };<br />                 }<br />         };<br />          <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">static</span> ServiceSPI ARMED_PROVIDER = <span style="color: #008800; font-weight: bold;">new</span> ServiceSPI() {<br />                 <span style="color: #008888; font-weight: bold;">public</span> ServiceAPI newService() {<br />                         <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #008800; font-weight: bold;">new</span> ServiceAPI() {<br />                                 <span style="color: #000077;">@Override<br /></span>                                 <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #00aa55; font-weight: bold;">String</span> toString() {<br />                                         <span style="color: #008800; font-weight: bold;">return</span> <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">Armed 服务</span><span style="color: #771100;">"</span></span>;<br />                                 }<br />                         };<br />                 }<br />         };<br /> }<br />  <br /><span style="color: #777777;">//输出如下</span> <span style="color: #ff0000; background-color: #ffaaaa;">默</span><span style="color: #ff0000; background-color: #ffaaaa;">认</span><span style="color: #ff0000; background-color: #ffaaaa;">服</span><span style="color: #ff0000; background-color: #ffaaaa;">务</span>, Complementary <span style="color: #ff0000; background-color: #ffaaaa;">服</span><span style="color: #ff0000; background-color: #ffaaaa;">务</span>, Armed <span style="color: #ff0000; background-color: #ffaaaa;">服</span><span style="color: #ff0000; background-color: #ffaaaa;">务</span></code></pre></div></div></div><div><h4>第四大优势 - 在创建参数化类型实例的时候，他们使代码变得更加简洁。</h4><div><p style="margin: 0px 0px 10px;">在JDK7之前，我们创建一个Collections大致是这么做的：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #00aa55; font-weight: bold;">List</span>&lt;TypeThatsTooLongForItsOwnGood&gt; list = <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">ArrayList</span>&lt;TypeThatsTooLongForItsOwnGood&gt;();</code></pre></div></div><div><p style="margin: 0px 0px 10px;">JDK7发布以后，我们可以简化成这样：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #00aa55; font-weight: bold;">List</span>&lt;TypeThatsTooLongForItsOwnGood&gt; list = <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">ArrayList</span>&lt;&gt;();</code></pre></div></div><div><p style="margin: 0px 0px 10px;">但是Guava还是宁愿使用静态工程方法，因为真的非常方便：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #00aa55; font-weight: bold;">Set</span>&lt;<span style="color: #00aa55; font-weight: bold;">Type</span>&gt; copySet = Sets.newHashSet(elements); <br /><span style="color: #00aa55; font-weight: bold;">List</span>&lt;<span style="color: #00aa55; font-weight: bold;">String</span>&gt; theseElements = Lists.newArrayList(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">alpha</span><span style="color: #771100;">"</span></span>, <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">beta</span><span style="color: #771100;">"</span></span>, <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">gamma</span><span style="color: #771100;">"</span></span>);</code></pre></div></div></div><div><h4>静态工程方法的缺点</h4><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;">类如果不含公有的或者受保护的构造器，就不能被子类化，这也许会因祸得福，因为它鼓励开发人员使用复合，而不是继承。</p></li><li><p style="margin: 0px 0px 10px;">他们与其他的静态方法实际上没有任何区别 如果API文档没有明确的说明这是一个静态工程方法，就会很难识别出来。遵循标准的命名规范习惯，可以弥补这一劣势，下面列出一些惯用命名：</p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;"><strong>valueOf</strong>&nbsp;- 这样的静态工厂方法实际上是类型转换</p></li><li><p style="margin: 0px 0px 10px;"><strong>of</strong>&nbsp;- valueOf的简洁方式</p></li><li><p style="margin: 0px 0px 10px;"><strong>getInstance</strong>&nbsp;- 返回实例通过方法参数描述，对于单例，该方法没有参数，并返回唯一的实例</p></li><li><p style="margin: 0px 0px 10px;"><strong>newInstance</strong>&nbsp;- 与getInstance不同的是，它返回的实例与所有其它实例都是不同的</p></li><li><p style="margin: 0px 0px 10px;"><strong>getType</strong>&nbsp;- 像getInstance一样，但是在工厂方法处于不同的类中的时候使用。Type表示i返回对象类型</p></li><li><p style="margin: 0px 0px 10px;"><strong>newType</strong>&nbsp;- 像newInstance一样，但是在工厂方法处于不同的类中的时候使用。Type表示i返回对象类型</p></li></ul></div></li></ul></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-29</div></div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/399987.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-05-30 17:09 <a href="http://www.blogjava.net/kuuyee/archive/2013/05/30/399987.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>当EffectiveJava遇见Guava - toString(规则10)</title><link>http://www.blogjava.net/kuuyee/archive/2013/05/29/399914.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Wed, 29 May 2013 03:40:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/05/29/399914.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/399914.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/05/29/399914.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/399914.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/399914.html</trackback:ping><description><![CDATA[<div style="float: left; min-height: 1px; margin-left: 30px; width: 870px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px; background-color: #f0efe7;"><br /><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">我们都知道Java书籍有四大名著，其中&nbsp;</span><a href="http://book.jd.com/10058902.html" style="font-size: 14px; color: #0088cc; text-decoration: none;">Effective Java</a><span style="font-size: 14px;">可以说是高手进阶必看的，作者&nbsp;</span><a href="http://en.wikipedia.org/wiki/Joshua_Bloch" style="font-size: 14px; color: #0088cc; text-decoration: none;">Joshua Bloch</a><span style="font-size: 14px;">是Google的首席Java架构师，如果把 James Gosling称为Java之父，那么Joshua Bloch就像是Java之母，是他把Java养育成人。之前曾有人讨论过Google有很多编码规范，为什么唯独没有Java版的问题，最终的结论就是：</span><strong style="font-size: 14px;">Google的Java编码规范就是 Effective Java一书</strong><span style="font-size: 14px;">，可见此书有多么重要。现在Google又推出了强大好用的Java通用类库&nbsp;</span><a href="https://code.google.com/p/guava-libraries/" style="font-size: 14px; color: #0088cc; text-decoration: none;">Guava</a><span style="font-size: 14px;">，公认为比Apache Common好用，因为Apache要兼容老版本，所以妨碍了很多Java的新特性的使用。</span></h2><div><p style="margin: 0px 0px 10px;">既然Effective Java和Guava都诞生于Google，那么当他们相遇会什么样呢，为此我决定重温Effective Java这部著作，并针对每一条规则寻找Guava给出的解决方案，希望能更深入的掌握Java。</p></div><div><p style="margin: 0px 0px 10px;"><a href="http://book.jd.com/10058902.html" style="color: #0088cc; text-decoration: none;">Effective Java</a>第10条规则：&nbsp;<strong>始终要覆盖</strong><tt>toString</tt><strong>方法</strong></p></div><div><p style="margin: 0px 0px 10px;"><a href="http://book.jd.com/10058902.html" style="color: #0088cc; text-decoration: none;">Effective Java</a>里指出，"建议所有的子类都覆盖这个<tt>toString</tt>方法"，这样可以使类用起来更加舒适。最重要的是这样的做法对调试非常有帮助，Guava通过&nbsp;<a href="http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/base/Objects.html#toStringHelper" style="color: #0088cc; text-decoration: none;">Objects.toStringHelper</a>为我们提供了方便创建<tt>toString</tt>的方法。看下面的样例：<br /></p><pre class="highlight CodeRay" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code class="java" style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #777777;">// Returns "ClassName{x=1}"</span>
   Objects.toStringHelper(<span style="color: #996633;">this</span>)
       .add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">x</span><span style="color: #771100;">"</span></span>, <span style="color: #0000dd;">1</span>)
       .toString();

   <span style="color: #777777;">// Returns "MyObject{x=1}"</span>
   Objects.toStringHelper(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">MyObject</span><span style="color: #771100;">"</span></span>)
       .add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">x</span><span style="color: #771100;">"</span></span>, <span style="color: #0000dd;">1</span>)
       .toString();</code></pre><p style="margin: 0px 0px 10px;"><br />Guava关于toString的文档连接：&nbsp;<a href="https://code.google.com/p/guava-libraries/wiki/CommonObjectUtilitiesExplained" style="color: #0088cc; text-decoration: none;">https://code.google.com/p/guava-libraries/wiki/CommonObjectUtilitiesExplained</a></p></div><div><p style="margin: 0px 0px 10px;">下面我把Effective Java的样例代码列出，并用Guava重新了<tt>toString</tt>方法<br /></p><pre class="highlight CodeRay" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code class="java" style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #777777;">// 重写PhoneNumber的toString方法 - Effective Java中文第二版第44页</span>
<span style="color: #008800; font-weight: bold;">package</span> <span style="color: #770077; font-weight: bold;">org.effectivejava.examples.chapter03.item10</span>;

<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #bb4444; font-weight: bold;">java.util.HashMap</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #bb4444; font-weight: bold;">java.util.Map</span>;

<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #bb4444; font-weight: bold;">com.google.common.base.Objects</span>;

<span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #333399; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">PhoneNumber</span> {
        <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #333399; font-weight: bold;">short</span> areaCode;
        <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #333399; font-weight: bold;">short</span> prefix;
        <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">final</span> <span style="color: #333399; font-weight: bold;">short</span> lineNumber;

        <span style="color: #008888; font-weight: bold;">public</span> PhoneNumber(<span style="color: #333399; font-weight: bold;">int</span> areaCode, <span style="color: #333399; font-weight: bold;">int</span> prefix, <span style="color: #333399; font-weight: bold;">int</span> lineNumber) {
                rangeCheck(areaCode, <span style="color: #0000dd;">999</span>, <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">area code</span><span style="color: #771100;">"</span></span>);
                rangeCheck(prefix, <span style="color: #0000dd;">999</span>, <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">prefix</span><span style="color: #771100;">"</span></span>);
                rangeCheck(lineNumber, <span style="color: #0000dd;">9999</span>, <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">line number</span><span style="color: #771100;">"</span></span>);
                <span style="color: #996633;">this</span>.areaCode = (<span style="color: #333399; font-weight: bold;">short</span>) areaCode;
                <span style="color: #996633;">this</span>.prefix = (<span style="color: #333399; font-weight: bold;">short</span>) prefix;
                <span style="color: #996633;">this</span>.lineNumber = (<span style="color: #333399; font-weight: bold;">short</span>) lineNumber;
        }

        <span style="color: #008888; font-weight: bold;">private</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> rangeCheck(<span style="color: #333399; font-weight: bold;">int</span> arg, <span style="color: #333399; font-weight: bold;">int</span> max, <span style="color: #00aa55; font-weight: bold;">String</span> name) {
                <span style="color: #008800; font-weight: bold;">if</span> (arg &lt; <span style="color: #0000dd;">0</span> || arg &gt; max)
                        <span style="color: #008800; font-weight: bold;">throw</span> <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #cc0000; font-weight: bold;">IllegalArgumentException</span>(name + <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">: </span><span style="color: #771100;">"</span></span> + arg);
        }

        <span style="color: #000077;">@Override</span>
        <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">boolean</span> equals(<span style="color: #00aa55; font-weight: bold;">Object</span> o) {
                <span style="color: #008800; font-weight: bold;">if</span> (o == <span style="color: #996633;">this</span>)
                        <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #006699;">true</span>;
                <span style="color: #008800; font-weight: bold;">if</span> (!(o <span style="color: #008800; font-weight: bold;">instanceof</span> PhoneNumber))
                        <span style="color: #008800; font-weight: bold;">return</span> <span style="color: #006699;">false</span>;
                PhoneNumber pn = (PhoneNumber) o;
                <span style="color: #008800; font-weight: bold;">return</span> pn.lineNumber == lineNumber &amp;&amp; pn.prefix == prefix
                                &amp;&amp; pn.areaCode == areaCode;
        }

        <span style="color: #000077;">@Override</span>
        <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">int</span> hashCode() {
                <span style="color: #333399; font-weight: bold;">int</span> result = <span style="color: #0000dd;">17</span>;
                result = <span style="color: #0000dd;">31</span> * result + areaCode;
                result = <span style="color: #0000dd;">31</span> * result + prefix;
                result = <span style="color: #0000dd;">31</span> * result + lineNumber;
                <span style="color: #008800; font-weight: bold;">return</span> result;
        }

    <span style="color: #777777;">//Effective Java原有的toString方法</span>
        <span style="color: #777777;">/*
         * @Override public String toString() { return
         * String.format("(%03d) %03d-%04d", areaCode, prefix, lineNumber); }
         */</span>

        <span style="color: #777777;">/**
         * 采用Guava实现的toString
         *
         */</span>
        <span style="color: #000077;">@Override</span>
        <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #00aa55; font-weight: bold;">String</span> toString() {
                <span style="color: #008800; font-weight: bold;">return</span> Objects.toStringHelper(<span style="color: #996633;">this</span>)
                                .addValue(<span style="color: #00aa55; font-weight: bold;">String</span>.format(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">(%03d) %03d-%04d</span><span style="color: #771100;">"</span></span>, areaCode, prefix,lineNumber))
                                .add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">areaCode</span><span style="color: #771100;">"</span></span>, areaCode)
                                .add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">prefix</span><span style="color: #771100;">"</span></span>, prefix)
                                .add(<span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">lineNumber</span><span style="color: #771100;">"</span></span>, lineNumber)
                                .toString();
        }

        <span style="color: #008888; font-weight: bold;">public</span> <span style="color: #008888; font-weight: bold;">static</span> <span style="color: #333399; font-weight: bold;">void</span> main(<span style="color: #00aa55; font-weight: bold;">String</span><span style="color: #333399; font-weight: bold;">[]</span> args) {
                <span style="color: #00aa55; font-weight: bold;">Map</span>&lt;PhoneNumber, <span style="color: #00aa55; font-weight: bold;">String</span>&gt; m = <span style="color: #008800; font-weight: bold;">new</span> <span style="color: #00aa55; font-weight: bold;">HashMap</span>&lt;PhoneNumber, <span style="color: #00aa55; font-weight: bold;">String</span>&gt;();
                m.put(<span style="color: #008800; font-weight: bold;">new</span> PhoneNumber(<span style="color: #0000dd;">707</span>, <span style="color: #0000dd;">867</span>, <span style="color: #0000dd;">5309</span>), <span style="background-color: rgba(255, 0, 0, 0.0470588);"><span style="color: #771100;">"</span><span style="color: #dd2200;">Jenny</span><span style="color: #771100;">"</span></span>);

                <span style="color: #00aa55; font-weight: bold;">System</span>.out.println(m);
        }
}</code></pre><p style="margin: 0px 0px 10px;">输出对比</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><span style="color: #777777;">//原输出<br /></span>{(<span style="color: #0000dd;">707</span>) <span style="color: #0000dd;">867</span>-<span style="color: #0000dd;">5309</span>=Jenny}  <br /><br /><span style="color: #777777;">//Guava实现输出</span> <br />{PhoneNumber{(<span style="color: #0000dd;">707</span>) <span style="color: #0000dd;">867</span>-<span style="color: #0000dd;">5309</span>, areaCode=<span style="color: #0000dd;">707</span>, prefix=<span style="color: #0000dd;">867</span>, lineNumber=<span style="color: #0000dd;">5309</span>}=Jenny}</code></pre></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-24</div></div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/399914.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-05-29 11:40 <a href="http://www.blogjava.net/kuuyee/archive/2013/05/29/399914.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Linux下的ORACLE安装，成功率99.99999%</title><link>http://www.blogjava.net/kuuyee/archive/2013/05/24/399719.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Fri, 24 May 2013 04:27:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/05/24/399719.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/399719.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/05/24/399719.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/399719.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/399719.html</trackback:ping><description><![CDATA[<div style="float: left; min-height: 1px; margin-left: 30px; width: 870px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px; background-color: #f0efe7;"><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">相信很多童鞋都有过在Linux上安装Oracle数据库的痛苦经历，其中绝大多数都是环境设置的问题。我给大家推荐一个国外大牛写的Oracle的安装脚本&nbsp;</span><a href="http://sourceforge.net/projects/oratoolkit/?source=navbar" style="font-size: 14px; color: #0088cc; text-decoration: none;">OTK</a><span style="font-size: 14px;">，是用Bash写的，这东东大大简化了Oracle安装过程，而且成功率达到99.9999%以上，只要确保你的Linux系统是干净的，那么按照这个教程，保证你会安装成功。</span></h2><div><h4>准备工作</h4><div><p style="margin: 0px 0px 10px;">OTK针对各种Linux提供了&nbsp;<a href="https://www.oratoolkit.ch/knowledge/" style="color: #0088cc; text-decoration: none;">安装文档</a>，本文使用的RHEL5.5_x86_64位，数据库版本为11gR2，主要参考这个&nbsp;<a href="https://www.oratoolkit.ch/knowledge/howto/installation/eeSrv-11g-R2-on-RHEL-5.5-x86_64.php" style="color: #0088cc; text-decoration: none;">文档</a>。</p></div><div><p style="margin: 0px 0px 10px;">首先准备阿好如下的安装文件：</p></div><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;"><a href="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html" style="color: #0088cc; text-decoration: none;">linux.x64_11gR2_database_1of2.zip</a></p></li><li><p style="margin: 0px 0px 10px;"><a href="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html" style="color: #0088cc; text-decoration: none;">linux.x64_11gR2_database_2of2.zip</a></p></li><li><p style="margin: 0px 0px 10px;"><a href="https://www.oratoolkit.ch/redirect.php?url=http://sourceforge.net/projects/oratoolkit/files/" style="color: #0088cc; text-decoration: none;">oratoolkit-1.0.2.1.5-1.noarch.rpm</a></p></li></ul></div><div><p style="margin: 0px 0px 10px;">下载上述文件并放在<tt>/var/tmp/oracle</tt>目录下。最好要把你的YUM源指向你的系统安装光盘或者ISO文件。</p></div></div><div><h4>安装OTK</h4><div><p style="margin: 0px 0px 10px;">用root登陆，执行如下命令：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># su - root <br /># cd /var/tmp/oracle <br /># ls -1 oratool* <br />oratoolkit-1.0.2.1.5-1.noarch.rpm <br /># rpm -ivh oratoolkit-1.0.2.1.5-1.noarch.rpm <br />Preparing...                ########################################### [100%]<br />    1:oratoolkit             ########################################### [100%]</code></pre></div></div><div><p style="margin: 0px 0px 10px;">otk已经帮我们建立了oracle用户，下面需要设置Oracle用户密码</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># passwd oracle <br />Changing password for user oracle. <br />New UNIX password: <br />BAD PASSWORD: it is based on a dictionary word <br />Retype new UNIX password: <br />passwd: all authentication tokens updated successfully.</code></pre></div></div></div><div><h4>解决环境依赖</h4><div><p style="margin: 0px 0px 10px;">这一步最爽，最为头疼的环境依赖问题轻松就解决了！首先要验证下你的系统还差什么没有满足要求，OTK脚本提供了智能的环境是否满足检查:</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># /opt/oracle/otk/current/bin/installManager swReqCheck osSetup11gR2.cfg <br />...//省略大部分输出 <br />20130521_165122: Info: Action swReqCheck of installManager ended with 7 WARNINGS</code></pre></div></div><div><p style="margin: 0px 0px 10px;">最后的结论告诉你的系统共有几个警告（我的系统是7个），你可以在输出日志中查看到底缺了什么。下面的一组命令很酷，让你一下子解决所有的问题:</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">//先拼装命令 <br /># REQ_FILE_DIR="/opt/oracle/otk/current/conf/installManager/requirement" <br /># REQ_FILE_PATH="$REQ_FILE_DIR/ora11gR2-redhat-5-x86_64.pkg.lst" <br /># YUM_COMMAND=$(echo "yum install") <br /># YUM_COMMAND+=$(egrep -v "#" $REQ_FILE_PATH | grep 32-bit | awk '{ print " "$1".i[356]86" }') <br /># YUM_COMMAND+=$(egrep -v "#" $REQ_FILE_PATH | grep 64-bit | awk '{ print " "$1".x86_64" }')  <br /><br />//用echo看看最终拼装的命令是什么样 <br /># echo $YUM_COMMAND  <br /><br />//执行命令 <br /># $YUM_COMMAND  <br /><br />//再次执行环境检查 <br /># /opt/oracle/otk/current/bin/installManager swReqCheck osSetup11gR2.cfg <br />... <br />20130521_170131: Info: Action swReqCheck of installManager ended successfully //这次验证成功了，环境已经满足Oracle安装要求</code></pre></div></div></div><div><h4>增强sqlplus</h4><div><p style="margin: 0px 0px 10px;">OTK提供了一个优化增强的sqlplus环境：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># cd /opt/oracle/otk/current/tools/rlwrap/ <br /># ./configure <br /># make <br /># make install <br /># /usr/local/bin/rlwrap -v <br />rlwrap 0.30</code></pre></div></div></div><div><h4>使用installManager提取安装</h4><div><p style="margin: 0px 0px 10px;">切换到<tt>/opt/oracle/otk/current/conf/installManager</tt>目录，编辑<tt>osSetup11gR2.cfg</tt>来配置安装参数，包括内核参数、目录创建及所有授权等设置，如果你想默认安装就无需更改这个文件。</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># cd /opt/oracle/otk/current/conf/installManager/ <br /># vi osSetup11gR2.cfg <br /># sdiff -s osSetup11gR2.cfg sample/osSetup11gR2.cfg //对比哪些参数修改过 <br /># /opt/oracle/otk/current/bin/installManager osSetup osSetup11gR2.cfg</code></pre></div></div></div><div><h4>把Oracle安装文件移入资源目录</h4><div><p style="margin: 0px 0px 10px;">otk默认读取oracle安装文件的目录是<tt>/var/opt/oracle/repository</tt>，otk的<strong>swInst</strong>实例安装命令会读取这个目录：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># cd /var/tmp/oracle <br /># chown oracle:oinstall * <br /># mv linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip /var/opt/oracle/repository/</code></pre></div></div></div><div><h4>定制oracle用户登录的PS1变量</h4><div><p style="margin: 0px 0px 10px;">这一步没什么实际意义，就是定制Oracle用户登录的提示符。</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># su - oracle<br /> ------------------------------------------------------  <br /> oraToolKit environment variables<br /> ------------------------------------------------------  <br /> Installation directory :   /opt/oracle/otk  <br /> Release                :   1.0.2.1.5  <br /> $RUN directory         :   /opt/oracle/otk/1.0/bin  <br /> $LOG_BASE directory    :   /var/opt/oracle/otk/1.0/log  <br /> ------------------------------------------------------  <br />&lt;SITE|COMPANY&gt;:oracle@stquist1p:sidNotSet$ grep ^SITE .profile.custom.interactive <br />SITE="&lt;SITE|COMPANY&gt;" <br />&lt;SITE|COMPANY&gt;:oracle@stquist1p:sidNotSet$ vi .profile.custom.interactive <br />&lt;SITE|COMPANY&gt;:oracle@stquist1p:sidNotSet$ grep ^SITE .profile.custom.interactive <br />SITE="KuuYee"//修改这一行，可以显示你喜欢的内容 <br />&lt;SITE|COMPANY&gt;:oracle@stquist1p:sidNotSet$ exit <br /># su - oracle <br />KuuYee:oracle@stquist1p:sidNotSet$</code></pre></div></div></div><div><h4>安装Oracle数据库</h4><div><p style="margin: 0px 0px 10px;">OTK没有采用Oracle Universal Installer(<strong>OUI</strong>)，而是用<strong>swInst</strong>来控制整个安装过程的：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$ bash <br />$ cd $INSTALL_CONF <br />$ cp sample/swInstEeSrv11gR2-Step1-linux-x86_64.cfg . <br />$ installManager swInst swInstEeSrv11gR2-Step1-linux-x86_64.cfg <br />$ su - <br /># /opt/oracle/eesrv/11.2.0/db1/root.sh<br /># exit</code></pre></div></div></div><div><h4>创建数据库实例</h4><div><p style="margin: 0px 0px 10px;">OTK采用<strong>dbSetup</strong>来创建实例，首先要进入<tt>$INSTALL_CONF</tt>目录配置实例参数</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$ cd $INSTALL_CONF <br />$ ls -1 dbSetup*.cfg <br />dbSetup-dev.cfg <br />dbSetup-prod.cfg <br />dbSetup-test.cfg <br />$ vi dbSetup-prod.cfg //prod为生产模式 <br />$ sdiff -s dbSetup-prod.cfg sample/dbSetup-prod.cfg <br />DB_NAME="idm_test"                                            | DB_NAME="prod" <br />ORACLE_HOME="$ORACLE_BASE/eesrv/11.2.0/db1"                   | ORACLE_HOME="$ORACLE_BASE/sesrv/11.1.0/db1" <br />NLS_LANG=".AL32UTF8"                                          | NLS_LANG=".UTF8" <br />SYSTEM_SIZE=1G                                                | SYSTEM_SIZE=512M <br />TEMP_SIZE=2G                                                  | TEMP_SIZE=512M <br />UNDO_SIZE=2G                                                  | UNDO_SIZE=512M <br />USERS_SIZE=100M                                               | USERS_SIZE=10M <br />LISTENER_PORT="1541"                                          | LISTENER_PORT="1531" <br />MEMORY_TARGET=7G                                              | MEMORY_TARGET=512M <br />MEMORY_MAX_TARGET=7G                                          | MEMORY_MAX_TARGET=512M <br />SGA_TARGET=3G                                                 | SGA_TARGET=256M <br />PROCESSES=1000                                                | PROCESSES=100 <br />$ installManager dbSetup dbSetup-prod.cfg //执行这部之前最好先配置下/etc/hosts文件，看下面说明</code></pre></div></div><div><p style="margin: 0px 0px 10px;">本文采用<tt>dbSetup-prod.cfg</tt>生产环境模式配置，我们看到还有dev(开发环境)和test(测试环境)，不过我没试过，有兴趣的童鞋可以试试。我在上面列出了我所作出的配置，原文并没有修改内存参数，我之所以修改是因为实际环境因为内存设置太小导致运行一段时间数据库经常挂掉，经过多次的调试而得到的经验值，这里需要说明下我的数据库配置：<br /><strong>OS</strong>：VMware虚拟机(RHEL5.5)<br /><strong>CPU</strong>：8核<br /><strong>内存</strong>：32G<br /><strong>硬盘</strong>：200GB<br />上面用<tt>sdiff -s dbSetup-prod.cfg sample/dbSetup-prod.cfg</tt>命令可以对比下我的参数修改，左面是我的修改参数，右面是原参数,需要特别说明的是第二个参数<tt>ORACLE_HOME</tt>，一定要自修修改，原来的参数是<tt>$ORACLE_BASE/sesrv/11.1.0/db1</tt>，要修改为$ORACLE_BASE/<strong>eesrv/11.2.0</strong>/db1，别改错了！</p></div><div><p style="margin: 0px 0px 10px;"><tt>installManager dbSetup dbSetup-prod.cfg</tt>命令开始安装数据库实例，不过我建议你最好先配置下你的<tt>/etc/hosts</tt>文件，加入下面的内容：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">127.0.0.1    你的hostname</code></pre></div></div><div><p style="margin: 0px 0px 10px;">接下来就是漫长的等待，大概需要几十分钟，具体根据你的机器配置情况。如果你最后看到如下的输出：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">---------------------------------------------------------------------------------------------------- <br />20130522_091856: Info: Executing libmiscellaneous.getFooter function <br />20130522_091856: Info: Terminating installManager execution <br />20130522_091856: Info: Summary log file:  /var/opt/oracle/otk/1.0/log-old/installManager/../installManager.log <br />20130522_091856: Info: Detailed log file: /var/opt/oracle/otk/1.0/log-old/installManager/dbsetup-20130522_090349.log <br />20130522_091856: Info: Action dbSetup of installManager ended successfully <br />----------------------------------------------------------------------------------------------------</code></pre></div></div><div><p style="margin: 0px 0px 10px;"><strong>Congratulations！</strong>你安装成功了。</p></div><div><p style="margin: 0px 0px 10px;">下面登陆试试：</p></div><div style="padding-left: 15px; margin: 0px 0px 20px; border-left-width: 5px; border-left-style: solid; border-left-color: #eeeeee;"><table style="max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0px;"><tbody><tr><td><div>Note</div></td><td>OTK默认创建了一个<strong>otk</strong>用户，密码也是<strong>otk</strong>，&nbsp;<strong>sys</strong>和<strong>system</strong>默认密码是<strong>manager</strong></td></tr></tbody></table></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$ bash <br />$ sourceProdEnv <br />$ sqlplus sys/manager@idm_dev as sysdba; <br />或者 <br />$ sqlplus otk/otk@idm_dev  <br /><br />SQL*Plus: Release 11.2.0.1.0 Production on Wed May 22 11:05:16 2013  <br /><br />Copyright (c) 1982, 2009, Oracle.  All rights reserved.   <br /><br /><br />Connected to: <br />Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production <br />With the Partitioning, OLAP, Data Mining and Real Application Testing options  <br /><br />SQL&gt;</code></pre></div></div></div><div><h3>使用appctl管理oracle</h3><div><p style="margin: 0px 0px 10px;">OTK提供了一个ctl工具来帮我们管理Oracle实例：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$ ctl status all //查看当前状态 <br />$ ctl stop all   //停止数据库 <br />$ ctl start all  //启动数据库</code></pre></div></div></div><div><h3>使用backupuManager备份oracle</h3><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$ cd $BACKUP_CONF <br />$ vi prod.cfg <br />$ sdiff -s prod.cfg sample/prod.cfg DISK_DEVICE_MOUNT_POINT="/" | DISK_DEVICE_MOUNT_POINT="/backup01" <br />$ backupManager full prod.cfg</code></pre></div></div><div><p style="margin: 0px 0px 10px;">定时备份Job</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$ crontab -l|head -2 <br /># Example 1: Daily physical database backup <br /># 0 2 * * * [ -d $HOME/../current ] &amp;&amp; (ksh -c '. ./.profile &gt;/dev/null; backupManager full &lt;sid_1&gt;.cfg &lt;sid_2&gt;.cfg &lt;sid_n&gt;.cfg &gt;/dev/null') <br />$ crontab -e <br />$ crontab -l|head -2 <br /># Example 1: Daily physical database backup <br />0 2 * * * [ -d $HOME/../current ] &amp;&amp; (ksh -c '. ./.profile &gt;/dev/null; backupManager full prod.cfg &gt;/dev/null')</code></pre></div></div><div><h4>创建EM管理控制台</h4><div><p style="margin: 0px 0px 10px;">otk并没有帮我们创建EM控制台，对于习惯用Web管理的用户很不方便，我们需要手工创建：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">$ emca -config dbcontrol db -repos recreate  <br /><br />STARTED EMCA at May 22, 2013 11:18:41 AM <br />EM Configuration Assistant, Version 11.2.0.0.2 Production <br />Copyright (c) 2003, 2005, Oracle.  All rights reserved.  Enter the following information: <br />Database SID: idm_dev //输入sid <br />Listener port number: 1541 //监听输入端口 <br />Listener ORACLE_HOME [ /opt/oracle/eesrv/11.2.0/db1 ]: //默认回车 <br />Password for SYS user:  //输入密码manager <br />Password for DBSNMP user:  //输入密码manager <br />Password for SYSMAN user:  //输入密码manager <br />Email address for notifications (optional): //默认回车 <br />Outgoing Mail (SMTP) server for notifications (optional): //默认回车 <br />-----------------------------------------------------------------  <br /><br />You have specified the following settings  <br /><br />Database ORACLE_HOME ................ /opt/oracle/eesrv/11.2.0/db1  <br /><br />Local hostname ................ localhost.localdomain <br />Listener ORACLE_HOME ................ /opt/oracle/eesrv/11.2.0/db1 <br />Listener port number ................ 1541 <br />Database SID ................ idm_dev <br />Email address for notifications ............... <br />Outgoing Mail (SMTP) server for notifications ...............  <br /><br />----------------------------------------------------------------- <br />Do you wish to continue? [yes(Y)/no(N)]: yes <br />May 22, 2013 11:19:20 AM oracle.sysman.emcp.EMConfig perform <br />INFO: This operation is being logged at /opt/oracle/cfgtoollogs/emca/idm_dev/emca_2013_05_22_11_18_40.log. <br />May 22, 2013 11:19:21 AM oracle.sysman.emcp.EMReposConfig invoke <br />INFO: Dropping the EM repository (this may take a while) ... <br />May 22, 2013 11:19:23 AM oracle.sysman.emcp.EMReposConfig invoke <br />INFO: Repository successfully dropped <br />May 22, 2013 11:19:23 AM oracle.sysman.emcp.EMReposConfig createRepository <br />INFO: Creating the EM repository (this may take a while) ... <br />May 22, 2013 11:24:27 AM oracle.sysman.emcp.EMReposConfig invoke <br />INFO: Repository successfully created <br />May 22, 2013 11:24:30 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository <br />INFO: Uploading configuration data to EM repository (this may take a while) ... //可能会等一会 <br />May 22, 2013 11:25:19 AM oracle.sysman.emcp.EMReposConfig invoke <br />INFO: Uploaded configuration data successfully <br />May 22, 2013 11:25:23 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib <br />INFO: Software library configured successfully. <br />May 22, 2013 11:25:23 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary <br />INFO: Deploying Provisioning archives ... <br />May 22, 2013 11:25:45 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary <br />INFO: Provisioning archives deployed successfully. <br />May 22, 2013 11:25:45 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole <br />INFO: Securing Database Control (this may take a while) ... <br />May 22, 2013 11:25:58 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole <br />INFO: Database Control secured successfully. <br />May 22, 2013 11:25:58 AM oracle.sysman.emcp.util.DBControlUtil startOMS <br />INFO: Starting Database Control (this may take a while) ... <br />May 22, 2013 11:26:28 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration <br />INFO: Database Control started successfully <br />May 22, 2013 11:26:28 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration <br />INFO: &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; The Database Control URL is https://localhost.localdomain:1158/em &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; //这个是EM的访问链接 <br />May 22, 2013 11:26:31 AM oracle.sysman.emcp.EMDBPostConfig invoke <br />WARNING: <br />************************  WARNING  ************************  <br /><br />Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /opt/oracle/eesrv/11.2.0/db1/localhost.localdomain_idm_dev/sysman/config/emkey.ora.   Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.  <br /><br />*********************************************************** <br />Enterprise Manager configuration completed successfully <br />FINISHED EMCA at May 22, 2013 11:26:31 AM</code></pre></div></div><div><p style="margin: 0px 0px 10px;">OK！ 大功告成，相信各位童鞋都安装成功了，OTK的安装还是很稳健的，至少我安装了几十次都成功了！</p></div><div><p style="margin: 0px 0px 10px;">最后祝各位童鞋好运！</p></div></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-21</div></div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/399719.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-05-24 12:27 <a href="http://www.blogjava.net/kuuyee/archive/2013/05/24/399719.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CDI在JavaEE7中占据如此重要的地位！</title><link>http://www.blogjava.net/kuuyee/archive/2013/05/17/399413.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Fri, 17 May 2013 07:40:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/05/17/399413.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/399413.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/05/17/399413.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/399413.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/399413.html</trackback:ping><description><![CDATA[<header style="line-height: 20px;">
<div style="width: 1270px; margin-right: auto; margin-left: auto;">
<h1 style="color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif;"><span style="font-size: 21px; line-height: 30px;">从下面的JavaEE7新特性列表中，你会发现CDI是多么的重要，它无处不在！</span></h1><strong><span style="color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; font-size: 21px;">到处都标示着&#8220;</span><span style="color: #ff0066; font-family: adelle, Georgia, 'Times New Roman', serif; font-size: 21px;">CDI Integration</span><font color="#4e443c" face="adelle, Georgia, Times New Roman, serif"><span style="font-size: 21px;">&#8221;，本文摘自&nbsp;</span></font><a href="http://www.devx.com/Java/Article/47999" style="color: #0088cc; font-family: adelle, Georgia, 'Times New Roman', serif; font-size: 21px; text-decoration: none;">这里</a></strong><p>&nbsp;</p>
</div>
</header>
<div style="width: 1270px; margin-right: auto; margin-left: auto; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">
<div style="text-align: left; color: #5a5a5a;">
<div style="margin-left: -30px;">
<div style="float: left; min-height: 1px; margin-left: 30px; width: 370px;">
<h2><u>EJB 3.2</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Enterprise Java Bean 3.2&nbsp;<a href="http://jcp.org/en/jsr/detail?id=345" style="color: #0088cc; text-decoration: none;">(JSR 345)</a></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Enhancing EJB architecture to enable the PaaS model with features such as multi-tenancy</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Factorization of container-managed transactions to use other component technologies of the Java EE platform</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Enhanced use of annotations to simplify EJB programming model</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Alignment and integration with other specifications related to JSRs within the Java EE 7 platform such as<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;, JMS, Bean Validation, etc</li>
</ul>
<h2><u>EL 3.0</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Expression Language 3.0&nbsp;<a href="http://jcp.org/en/jsr/detail?id=341" style="color: #0088cc; text-decoration: none;">(JSR 341)</a></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Separate expression language context into parsing and evaluation contexts independent of the JSP specification</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Introduction of new customizable expression language coercion rules</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Reference static methods and members directly in EL expressions without having to define them in Tag Library Descriptor, similar to instance method invocation</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Adding equality, string concatenation, and sizeof operators</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;Integration so that +events+ can be generated before/during/after the expressions are evaluated</li>
</ul>
<h2><u>JMS 2.0</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java Messaging Service 2.0&nbsp;<a href="http://jcp.org/en/jsr/detail?id=343" style="color: #0088cc; text-decoration: none;">(JSR 343)&nbsp;</a>The new introduction will be an evolution of the previous version, JSR-914.</p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Enhanced JMS programming model to make application development easier, cleaning up ambiguities in the present specification</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Enhanced integration with&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;for easier and more unified use of API</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Make necessary changes to API in allowing any JMS provider to integrate with any Java EE containerinvocation</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Make JSR more cloud-friendly, leveraging multi-tenancy and other cloud-related features from the platform</li>
</ul>
<h2><u>EL 3.0</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Expression Language 3.0&nbsp;<a href="http://jcp.org/en/jsr/detail?id=341" style="color: #0088cc; text-decoration: none;">(JSR 341)</a></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Separate expression language context into parsing and evaluation contexts independent of the JSP specification</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Introduction of new customizable expression language coercion rules</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Reference static methods and members directly in EL expressions without having to define them in Tag Library Descriptor, similar to instance method invocation</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Adding equality, string concatenation, and sizeof operators</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;Integration so that events can be generated before/during/after the expressions are evaluated</li>
</ul>
</div>
<div style="float: left; min-height: 1px; margin-left: 30px; width: 370px;">
<h2><u>Servlet 3.1</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java Servlet 3.2&nbsp;<a href="http://jcp.org/en/jsr/detail?id=340" style="color: #0088cc; text-decoration: none;">(JSR 340)&nbsp;</a>Servlet早在JavaEE6就已经无缝集成了&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Optimize Java EE PaaS model, leveraging the cloud for Web applications</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Optimizing PaaS model leveraging multi-tenancy. To support this into the Web container, the main areas of optimization will be security, session state, resources and</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;other multi-tenant awareness requirements for Web applications.</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Enhance the asynchronous support of Servlet 3.0 and simplify further in building asynchronous applications</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Utilize Java EE concurrency APIs for asynchronous support</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Enhance the Servlet 3.0 built-in security features</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Optimize the built-in plug-ability support of Servlet 3.0</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Focus on providing necessary functionality for building easier-to-use, high-level protocol support for Web Sockets and other protocols that work with HTTP in the Servlet API</li>
</ul>
<h2><u>JAX-RS 2.0</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java API for RESTful Web Services 2.0&nbsp;<a href="http://jcp.org/en/jsr/detail?id=339" style="color: #0088cc; text-decoration: none;">(JSR 339)</a></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Define two client APIs, both REST-compatible -- a low-level API using builder pattern and a higher-level API leveraging the low-level APIs</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Hypermedia, an important RESTful feature of Web applications, will be easy to create, and it will process links associated with resources in representation either as a header or as a links within the entity peripheral.</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Make it possible to validate parameters of forms or query using bean validation and return a meaningful response on failure to validate</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Closer integration&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;@Inject</li>
</ul>
<h2><u>JSF 2.2</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java Server Faces 2.2&nbsp;<a href="http://jcp.org/en/jsr/detail?id=344" style="color: #0088cc; text-decoration: none;">(JSR 344)</a></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Making configuration options dynamic, eliminate tag handler class even for non-composite JSP components, introduce shorthand URLs for Facelet Tag Libraries, make cc:interface in composite components optional, enhance deployment, integrate with&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code></li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Component identification and Ajax</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Support implementation of Portlet Bridge 2.0</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Support for HTML5 features, such as Forms, Heading, Metadata and Section content model, Flow management, Listener for page navigation events, and new components like FileUpload and BackButton</li>
</ul>
<h2><u>CDI 1.1</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Context and Dependency Injection 1.1&nbsp;<a href="http://jcp.org/en/jsr/detail?id=346" style="color: #0088cc; text-decoration: none;">(JSR 346)</a></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Global ordering of interceptors and decorators,</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;API for managing built-in context,</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Embedded mode to allow startup outside the Java EE container</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Declarative control over which packages/classes are scanned in a bean archive</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Bean declaration at constructor level</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Injection for static members, such as loggers</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Send&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;events for Servlet events</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Better support for&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;in libraries when used in the Java EE platform</li>
</ul>
</div>
<div style="float: left; min-height: 1px; margin-left: 30px; width: 370px;">
<h2><u>JPA 2.1</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java Persistence API 2.1&nbsp;<a href="http://jcp.org/en/jsr/detail?id=338" style="color: #0088cc; text-decoration: none;">(JSR 338)</a></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Addition of the javax.persistence.StoredProcedureQuery interface to control stored procedure query execution. &gt;Javax.persistence.EntityManager has added four variants of methods that return a StoredProcedureQuery for executing a stored procedure, including one allowing named stored procedure query. The newly introduced annotation @NamedStoredProcedureQuery can be specified on an entity or mapped class, similar to the @NamedQuery. The parameters IN, OUT and INOUT can be used to manipulate values from the stored procedure.</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;The javax.persistence.criteria.AbstractQuery interface has been refactored by CriteriaUpdate, CriteriaDelete and CommonAbstractQuery interfaces.</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Added new identifiers for persistence query language (JPQL), such as FUNCTION for supporting JPQL built-in functions, TREAT for down casting within path expressions in the FROM and WHERE clauses, and ON for specifying the relationship between the tables.</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;Integration Listener.The entity listeners can be annotated with @PostConstruct and @PostDestroy for their lifecycle. Also, the usual lifecycle callback methods, such as @PrePersist, @PostPersist, @PreUpdate and @PreRemove can be used for entities.</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Added support for unsynchronized persistence context to create container-managed unsynchronized persistence context. For example, @PersistenceContext (synchronization=SynchronizationType.UNSYNCHRONIZED)</li>
</ul>
<h2><u>Bean Validation 1.1</u></h2>
<p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Bean Validation 1.1&nbsp;<a href="http://jcp.org/en/jsr/detail?id=349" style="color: #0088cc; text-decoration: none;">(JSR 349)</a></p>
<ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;">
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Integration with other Java EE specs，&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code>&nbsp;etc.</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;APIs to validate parameters and return values of method calls.</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Validate parameters and return values on HTTP calls</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Ability to translate a group into another group while cascading the validation</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;APIs to validate parameters and return values of method calls</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Apply constraints on group collection</li>
     <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em>&nbsp;Extend the model to support AND and OR style composition</li>
</ul>
</div>
</div>
</div>
</div>
&nbsp;<img src ="http://www.blogjava.net/kuuyee/aggbug/399413.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-05-17 15:40 <a href="http://www.blogjava.net/kuuyee/archive/2013/05/17/399413.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE数据库ORA-00257解决</title><link>http://www.blogjava.net/kuuyee/archive/2013/05/15/399287.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Wed, 15 May 2013 02:13:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/05/15/399287.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/399287.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/05/15/399287.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/399287.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/399287.html</trackback:ping><description><![CDATA[<div style="width: 1170px; margin-right: auto; margin-left: auto; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="margin-left: -30px;"><div style="float: left; min-height: 1px; margin-left: 30px; width: 870px;"><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">今天数据库突然连不上了，报ORA-00257错误（空间不足错误），通过查找资料，绝大部分说这是由于Archivelog归档日志太多，占用了全部的硬盘剩余空间导致的，通过简单删除日志或加大存储空间就能够解决。</span></h2><div><p style="margin: 0px 0px 10px;">首先进入oracle用户，使用<strong>rman</strong>工具执行命令<strong>rman target/</strong>：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">oracle@test-idm-db01$ rman target/  <br /><br />Recovery Manager: Release 11.2.0.1.0 - Production on Wed May 15 09:29:06 2013  <br /><br />Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.  <br />RMAN-00571: =========================================================== <br />RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== <br />RMAN-00571: =========================================================== <br />RMAN-00554: initialization of internal recovery manager package failed <br />RMAN-04005: error from target database: <br />ORA-01031: insufficient privileges</code></pre></div></div><div><p style="margin: 0px 0px 10px;">竟然报错了，如果你的空间100%一点剩余都没有，那么就会报这个错，只能想办法让你的系统腾出一点空间，哪怕几百兆！然后重启数据库应该就可以登陆dba了。</p></div><div><p style="margin: 0px 0px 10px;">重启数据库，再次<strong>rman</strong></p></div><div><div monospaced"=""><pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);">oracle@test-idm-db01$ rman target/  <br /><br />Recovery Manager: Release 11.2.0.1.0 - Production on Wed May 15 09:29:40 2013  <br /><br />Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.  <br /><br />connected to target database: IDM_TEST (DBID=4064060693)</pre></div></div><div><p style="margin: 0px 0px 10px;">现在删除Archivelog归档文件，执行下面的命令来删除最近7天的归档：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">RMAN&gt; DELETE ARCHIVELOG FROM TIME 'SYSDATE-7';</code></pre></div></div><div><p style="margin: 0px 0px 10px;">也可以只保留最近7天的，其余的都删除：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">RMAN&gt; DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';</code></pre></div></div><div><p style="margin: 0px 0px 10px;">但是过一段时间你的日志还是回满，对于开发环境这样的归档功能其实没什么必要，彻底解决办法是关闭这个功能，用dba登陆oracle：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sqlplus / as sysdba;</code></pre></div></div><div><p style="margin: 0px 0px 10px;">然后执行下面的命令：</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">SQL&gt; <span style="color: #bb0066; font-weight: bold;">alter</span> <span style="color: #333399; font-weight: bold;">database</span> flashback off;</code></pre></div></div><div><p style="margin: 0px 0px 10px;">然后重启数据库就OK了！</p></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-15</div></div></div></div></div><footer style="text-align: center; padding: 20px 0px; margin-top: 20px; border-top-width: 1px; border-top-style: solid; border-top-color: #e5e5e5; background-color: #f5f5f5; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="width: 1170px; margin-right: auto; margin-left: auto;"></div></footer><img src ="http://www.blogjava.net/kuuyee/aggbug/399287.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-05-15 10:13 <a href="http://www.blogjava.net/kuuyee/archive/2013/05/15/399287.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CDI(JSR-346)-JavaEE平台上下文依赖注入规范 1.1 新特性</title><link>http://www.blogjava.net/kuuyee/archive/2013/05/09/399037.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Thu, 09 May 2013 03:47:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/05/09/399037.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/399037.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/05/09/399037.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/399037.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/399037.html</trackback:ping><description><![CDATA[<div style="width: 1170px; margin-right: auto; margin-left: auto; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="margin-left: -30px;"><div style="float: left; min-height: 1px; margin-left: 30px; width: 870px;"><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">主要功能改进</span></h2><div><div><p style="margin: 0px 0px 10px;">这些主要功能改变已经在CDI 1.1中引入：</p></div><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;">加入全局拦截器 (参阅Java Interceptors Specification 1.2)， 全局装饰器 和使用<tt>@Priority</tt>注解实现替代选择</p></li><li><p style="margin: 0px 0px 10px;">给注解为<tt>@AroundConstruct</tt>的构造器加入生命周期回调支持 (参阅 Java Interceptors Specification 1.2)</p></li><li><p style="margin: 0px 0px 10px;">允许绑定拦截构造器</p></li><li><p style="margin: 0px 0px 10px;">拦截器绑定移入拦截器规范，以供其它规范使用</p></li><li><p style="margin: 0px 0px 10px;">Beans内建支持装饰器&nbsp;</p></li><li><p style="margin: 0px 0px 10px;">加入<tt>EventMetadata</tt>允许事件元数据检查</p></li><li><p style="margin: 0px 0px 10px;">加入&nbsp;<tt>@Vetoed</tt>&nbsp;注解让Classes失去原有程序能力</p></li><li><p style="margin: 0px 0px 10px;">很多改进来强化beans功能，包括&nbsp;<tt>@TransientReference</tt>&nbsp;注解允许保留实力给调用它的方法或构造函数&nbsp;</p></li><li><p style="margin: 0px 0px 10px;">加入激活和销毁周期的事件回调&nbsp;</p></li><li><p style="margin: 0px 0px 10px;">加入&nbsp;<tt>AlterableContext</tt>&nbsp;允许bean实例被明确的销毁</p></li><li><p style="margin: 0px 0px 10px;">给bean在周期注解、EJB、在JavaEE中自启动CDI功能&nbsp;</p></li><li><p style="margin: 0px 0px 10px;">在&nbsp;<tt>bean.xml</tt>中加入class过滤排除，以防止扫描classes和package&nbsp;</p></li><li><p style="margin: 0px 0px 10px;">加入&nbsp;<tt>Unmanaged</tt>&nbsp;允许方便的访问无上下文的bean实例</p></li><li><p style="margin: 0px 0px 10px;">加入&nbsp;<tt>CDI</tt>&nbsp;以方便的访问当前的CDI容器</p></li><li><p style="margin: 0px 0px 10px;">加入&nbsp;<tt>AfterTypeDiscovery</tt>事件，允许在类型发现之后扩展附加注册</p></li><li><p style="margin: 0px 0px 10px;">加入&nbsp;<tt>@WithAnnotation</tt>&nbsp;注解作为一种改善负载性能的方式</p></li><li><p style="margin: 0px 0px 10px;">在便携的扩展加入很多次要的改进</p></li></ul></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-09</div></div></div></div></div><footer style="text-align: center; padding: 20px 0px; margin-top: 20px; border-top-width: 1px; border-top-style: solid; border-top-color: #e5e5e5; background-color: #f5f5f5; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="width: 1170px; margin-right: auto; margin-left: auto;"></div></footer><img src ="http://www.blogjava.net/kuuyee/aggbug/399037.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-05-09 11:47 <a href="http://www.blogjava.net/kuuyee/archive/2013/05/09/399037.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Jenkins文档翻译(2)-构建一个Maven2项目</title><link>http://www.blogjava.net/kuuyee/archive/2013/05/06/398854.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Mon, 06 May 2013 05:15:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/05/06/398854.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/398854.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/05/06/398854.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/398854.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/398854.html</trackback:ping><description><![CDATA[<div style="width: 1170px; margin-right: auto; margin-left: auto; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="margin-left: -30px;"><div style="float: left; min-height: 1px; margin-left: 30px; width: 870px;"><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">原文链接:&nbsp;</span><a href="https://wiki.jenkins-ci.org/display/JENKINS/Building+a+maven2+project" style="font-size: 14px; color: #0088cc; text-decoration: none;">https://wiki.jenkins-ci.org/display/JENKINS/Building+a+maven2+project</a></h2><div><p style="margin: 0px 0px 10px;">Jenkins提供一个专注于Maven2项目的Job类型。这种Job类型深度集成Maven2并提供如下优于free-style software project Job类型的特性：</p></div><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;">Jenkins从Maven POM中获取更多信息来辅助构建工作，这样就大大减少了Job的配置工作。</p></li><li><p style="margin: 0px 0px 10px;">Jenkins监听Maven执行过程来决定如何处理Job。例如，Jenkins会在Maven测试阶段自动记录JUnit报告。如果你正在运行javadoc目标，Jenkins会自动记录javadoc。</p></li></ul></div><div><p style="margin: 0px 0px 10px;">因此你只需要为Job配置SCM信息和指定运行Maven项目的哪个目标就可以了，其它的Jenkins会帮你决定如何去做。</p></div><div><div></div></div><div><blockquote style="padding: 0px 0px 0px 15px; margin: 0px 0px 20px; border-left-width: 5px; border-left-color: #eeeeee;">&nbsp;<strong>TODO</strong>&nbsp;谈论Maven modules在子项目中的表现，还有构建编号在子项目中是如何控制的。带有截屏。</blockquote><div></div></div><div><h4>用模块依赖链接自动构建</h4><div><p style="margin: 0px 0px 10px;">Jenkins从你的POM模型中读取项目依赖，如果这个依赖已经是Jenkins内的一个构建，那么Jenkins会自动的触发这个构建。Jenkins能够识别POM内所用类型的依赖：</p></div><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;">父级POM</p></li><li><p style="margin: 0px 0px 10px;">&lt;dependencies&gt;部分</p></li><li><p style="margin: 0px 0px 10px;">&lt;extensions&gt;部分</p></li><li><p style="margin: 0px 0px 10px;">&lt;reporting&gt;部分</p></li></ul></div><div><p style="margin: 0px 0px 10px;">这个处理过程取决于版本和账户，因为在你的项目中有很多版本/分支，Jenkins要正确的决定如何处理依赖。</p></div></div><div><h4>Maven集成插件</h4><div><p style="margin: 0px 0px 10px;">Jenkins的Maevn2项目类型包含一个Maven集成插件，它已经绑定在Jenkins发行版本中。它会列在可用插件列表中，当插件版本低于Jenkins当前版本时，推荐你升级Maven集成插件。虽然它是一个插件，但是它会作为Jenkins核心的一部分进行开发、测试和发布。</p></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-06</div></div></div></div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/398854.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-05-06 13:15 <a href="http://www.blogjava.net/kuuyee/archive/2013/05/06/398854.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Shell环境下删除命令如何排除指定文件</title><link>http://www.blogjava.net/kuuyee/archive/2013/04/21/398171.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Sun, 21 Apr 2013 12:28:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/04/21/398171.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/398171.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/04/21/398171.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/398171.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/398171.html</trackback:ping><description><![CDATA[<div style="width: 1170px; margin-right: auto; margin-left: auto; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="margin-left: -30px;"><div style="float: left; min-height: 1px; margin-left: 30px; width: 870px;"><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2>Shell环境下删除命令如何排除指定文件</h2><div><a href="http://www.kuuyee.org/2013/04/13/bash-del-file-excludes/author.primary_page.url" style="color: #0088cc; text-decoration: none;">kuuyee&nbsp;</a>&nbsp;|&nbsp; 2013-04-13 &nbsp;|&nbsp;&nbsp;<a href="http://www.kuuyee.org/2013/04/13/bash-del-file-excludes/tag.primary_page.url" style="color: #ffffff; text-decoration: none; display: inline-block; padding: 2px 4px; font-size: 11.844px; font-weight: bold; line-height: 14px; text-shadow: rgba(0, 0, 0, 0.247059) 0px -1px 0px; white-space: nowrap; vertical-align: baseline; background-color: #999999; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">Linux</a>&nbsp;&nbsp;&nbsp;<a href="http://www.kuuyee.org/2013/04/13/bash-del-file-excludes/tag.primary_page.url" style="color: #ffffff; text-decoration: none; display: inline-block; padding: 2px 4px; font-size: 11.844px; font-weight: bold; line-height: 14px; text-shadow: rgba(0, 0, 0, 0.247059) 0px -1px 0px; white-space: nowrap; vertical-align: baseline; background-color: #999999; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">Shell</a>&nbsp;&nbsp;&nbsp;<a href="http://www.kuuyee.org/2013/04/13/bash-del-file-excludes/tag.primary_page.url" style="color: #ffffff; text-decoration: none; display: inline-block; padding: 2px 4px; font-size: 11.844px; font-weight: bold; line-height: 14px; text-shadow: rgba(0, 0, 0, 0.247059) 0px -1px 0px; white-space: nowrap; vertical-align: baseline; background-color: #999999; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">Command</a>&nbsp;&nbsp;&nbsp;<a href="http://www.kuuyee.org/2013/04/13/bash-del-file-excludes/tag.primary_page.url" style="color: #ffffff; text-decoration: none; display: inline-block; padding: 2px 4px; font-size: 11.844px; font-weight: bold; line-height: 14px; text-shadow: rgba(0, 0, 0, 0.247059) 0px -1px 0px; white-space: nowrap; vertical-align: baseline; background-color: #999999; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">系统管理</a>&nbsp;&nbsp;</div><p style="margin: 0px 0px 10px;"></p><div><p style="margin: 0px 0px 10px;">下面列出root目录下的文件结构</p></div><div><div><div><div monospaced"=""><pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);">+- root<br />     +- fileA.txt<br />     +- subdir1<br />   +-  a.txt<br />   +-  b.txt<br />   +-  c.txt<br />     +- subdir2<br />   +- d.txt<br />   +- e.txt<br />   +- f.txt<br />     +- subdir3<br />     +- subdir4<br />     +- subdir5<br />     +- subdir6<br />     +- subdir7<br />     +- subdir8<br />     +- subdir9<br />     ...</pre></div></div></div></div><div><p style="margin: 0px 0px 10px;">目的是除了目录subdir2和文件fileA.txt其它的都要删除，如果一个一个删就效率太低了，Shell命令可以轻松的解决</p></div><div><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">ls|grep -v 'subdir2\|fileA.txt'|xargs rm -r</code></pre></div></div><div><p style="margin: 0px 0px 10px;">执行的效果如下</p></div><div><div><div><div monospaced"=""><pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);">+- root<br />     +- fileA.txt<br />     +- subdir2<br />          +- d.txt<br />          +- e.txt<br />          +- f.txt</pre></div></div></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-04-13</div></div></div></div></div><footer style="text-align: center; padding: 20px 0px; margin-top: 20px; border-top-width: 1px; border-top-style: solid; border-top-color: #e5e5e5; background-color: #f5f5f5; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="width: 1170px; margin-right: auto; margin-left: auto;"></div></footer><img src ="http://www.blogjava.net/kuuyee/aggbug/398171.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-04-21 20:28 <a href="http://www.blogjava.net/kuuyee/archive/2013/04/21/398171.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GitLab5.0安装全过程</title><link>http://www.blogjava.net/kuuyee/archive/2013/04/19/398092.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Fri, 19 Apr 2013 07:43:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/04/19/398092.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/398092.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/04/19/398092.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/398092.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/398092.html</trackback:ping><description><![CDATA[<div style="width: 1170px; margin-right: auto; margin-left: auto; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">
<div style="margin-left: -30px;">
<div style="float: left; min-height: 1px; margin-left: 30px; width: 870px;">
<div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;">
<h2><span style="font-size: 14px;">GitLab5发布快一个月了，决定试用下，5.0最大的特性就是用GitLab-Shell取代了Gitolite，这大大降低了安装难度，不多本人在安装过程中还是越到了一些问题，所以记录下来供要安装GitLab5的朋友参考！</span></h2>
<p style="margin: 0px 0px 10px;">主要参考文档:&nbsp;<a href="https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md" style="color: #0088cc; text-decoration: none;">https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md</a></p>
<h4>安装步骤总览</h4>
<ol style="padding: 0px; margin: 0px 0px 10px 25px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">
     <li>安装依赖包</li>
     <li>安装Ruby/RVM</li>
     <li>创建Git用户</li>
     <li>安装GitLab-Shell</li>
     <li>配置数据库</li>
     <li>安装GitLab</li>
     <li>启动</li>
</ol>
<h4>安装依赖库</h4>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install libicu-devel mysql-devel pcre-devel</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">安装python,官方要求版本必须在2.5以上，而且不支持3.0,Fedora一般的版本都在2.7以上，因此直接安装源自带的即可</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install python</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">安装完查看下版本</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">python --version</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">还要确保python2命令有效</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">python2 --version</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">如果提示&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">bash: python2: 未找到命令</code>&nbsp;,那你需要link一下</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sudo ln -s /usr/bin/python /usr/bin/python2</code></pre>
<h4>安装Ruby</h4>
<ul style="padding: 0px; margin: 0px 0px 10px 25px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">
     <li>源码方式安装</li>
</ul>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">mkdir /tmp/ruby &amp;&amp; cd /tmp/ruby <br />curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz <br />cd ruby-1.9.3-p392 <br />./configure <br />make <br />sudo make install</code></pre>
<ul style="padding: 0px; margin: 0px 0px 10px 25px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">
     <li>RVM方式</li>
</ul>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">curl -#L https://get.rvm.io | bash -s stable --ruby</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">默然安装ruby2.0, GitLab推荐用1.9.3</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">rvm install ruby-1.9.3-p392</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">还要安装Bundler</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sudo gem install bundler</code></pre>
<h4>添加系统Git用户</h4>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">创建一个&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">git</code>&nbsp;用户供GitLab使用</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">adduser --comment 'GitLab' git</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">让git用户无密码登陆</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sudo chmod 644 /etc/shadow vim /etc/shadow</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">去掉用户的叹号</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">git:!!:15814:0:99999:7::: 修改为 git::15814:0:99999:7:::</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">加入sudo组</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">chmod u+w /etc/sudoers <br />vim /etc/sudoers <br /><br />## Allow root to run any commands anywhere <br />root ALL=(ALL) ALL <br />git ALL=(ALL) ALL #加入这行</code></pre>
<h4>安装GitLab Shell</h4>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">切换到git用户</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">su - git cd ~/</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">克隆GitLab Shell</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">git clone https://github.com/gitlabhq/gitlab-shell.git <br />cd gitlab-shell</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">切换到最新的分支<br />
</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><div>git checkout v1.2.0 </div></pre>
<h4></h4>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">生产配置文件</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">cp config.yml.example config.yml</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">更改配置信息，一般就改下你部署的域名地址gitlab_url</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">vim config.yml <br />
# Url to gitlab instance. Used for api calls. Should be ends with slash.
gitlab_url: "http://localhost/" #改成你的域名或者IP</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">安装</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">./bin/install</code></pre>
<h4>安装数据库</h4>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">gitlab支持mysql和postgresql，这里以mysql为例，postgresql会比较麻烦！</p>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">切换回root用户</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">su - root</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">安装mysql及开发包</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install -y mysql-server mysql mysql-devel</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">启动数据库</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">service mysqld start</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">初始化GitLab数据库</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor. 
Commands end with ; or \g. 
Your MySQL connection id is 2 
Server version: 5.5.30 MySQL Community Server (GPL)</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">mysql&gt; CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab'; 
Query OK, 0 rows affected (0.01 sec)</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">mysql&gt; CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
Query OK, 1 row affected (0.00 sec)</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">mysql&gt; GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
Query OK, 0 rows affected (0.00 sec)</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">mysql&gt; \q 
Bye</code></pre>
<h4></h4>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">测试gitlab用户连接mysql</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sudo -u git -H mysql -u gitlab -p -D gitlabhq_production</code></pre>
<h4>安装GitLab</h4>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">终于到GitLab的安装了，进入git用户</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">su - git 
cd ~/</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">克隆GitLab</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab <br />cd gitlab</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">切换到5.0稳定分支</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sudo -u git -H git checkout 5-0-stable</code></pre>
<h4>配置</h4>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">cd /home/git/gitlab</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># 用样例配置生成gitlab配置 
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># 更改域名 
sudo -u git -H vim config/gitlab.yml</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># 确保gitlab对 log/ 和 tmp/ 目录有写权限 
sudo chown -R git log/ 
sudo chown -R git tmp/ 
sudo chmod -R u+rwX log/ 
sudo chmod -R u+rwX tmp/</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># 创建附属目录 
sudo -u git -H mkdir /home/git/gitlab-satellites</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># 创建pids目录并确保对gitlab可写 
sudo -u git -H mkdir tmp/pids/ 
sudo chmod -R u+rwX tmp/pids/</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># 生成Unicorn配置 
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb</code></pre>
<h4>配置GitLab DB设置</h4>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># Mysql sudo -u git cp config/database.yml.mysql config/database.yml</code></pre>
<h4>安装Gems</h4>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">cd /home/git/gitlab</code> 
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">sudo gem install charlock_holmes --version '0.6.9'</code> <br />
<code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># For MySQL (note, the option says "without") 
bundle install --deployment --without development test postgres</code></pre>
<h4></h4>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><span style="font-family: verdana, 'courier new'; line-height: 21px;"><br />
</span></p>
<h4 style="margin: 10px 0px; text-rendering: optimizelegibility; font-size: 17.5px;">初始化数据并激活高级特性</h4>
<p>&nbsp;</p>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">首先编辑/home/git/gitlab/config/database.yml</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"># 
# PRODUCTION 
# 
production: 
  adapter: mysql2 
  encoding: utf8 
  reconnect: false 
  database: gitlabhq_production 
  pool: 5 
  username: root 
  password: "secure password" #更改为你mysql的root用户密码 
# host: localhost 
# socket: /tmp/mysql.sock 
#</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">执行rake</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">bundle exec rake gitlab:setup RAILS_ENV=production</code></pre>
<div alert-danger"="" style="padding: 8px 35px 8px 14px; margin-bottom: 20px; text-shadow: rgba(255, 255, 255, 0.498039) 0px 1px 0px; background-color: #f2dede; border: 1px solid #eed3d7; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #b94a48; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">报错了，提示 Error connecting to Redis on localhost:6379 (ECONNREFUSED)<br />
解决办法：<br />
切到root,安装Redis<br />
bc(command). yum install redis*<br />
service redis start #启动redis</div>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">重新执行rake</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">bundle exec rake gitlab:setup RAILS_ENV=production</code></pre>
<div alert-info"="" style="padding: 8px 35px 8px 14px; margin-bottom: 20px; text-shadow: rgba(255, 255, 255, 0.498039) 0px 1px 0px; background-color: #d9edf7; border: 1px solid #bce8f1; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #3a87ad; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">如果你安装最新版可能会报&nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">/home/git/repositories/root</code>&nbsp;目录找不到，手工建上即可！</div>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">如果你看到如下信息:</p>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">... 
Administrator account created:</code> <br /><br /><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">login.........admin@local.host 
password......5iveL!fe</code></pre>
<h4></h4>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><strong>恭喜你！你已经成功安装GitLab了！别忘了记录输出的管理用户名和密码！</strong></p>
<h4>启动GitLab</h4>
<pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">bundle exec rails s -e production 
=&gt; Booting WEBrick 
=&gt; Rails 3.2.13 application starting in production on http://0.0.0.0:3000 
=&gt; Call with -d to detach 
=&gt; Ctrl-C to shutdown server 
[2013-04-19 15:04:41] INFO WEBrick 1.3.1 
[2013-04-19 15:04:41] INFO ruby 1.9.3 (2013-02-22) 
[x86_64-linux] [2013-04-19 15:04:41] INFO WEBrick::HTTPServer#start: pid=11488 port=3000</code></pre>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">Ok,你现在可以访问GitLab了，默认端口是 @3000@， 访问 http://你的域名或IP:3000<br />
第一访问会比较慢，因为要编译很多js和css.</p>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">哈哈！看到登陆页面了吧！</p>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><img src="http://www.kuuyee.org/images/gitlab/gitlab_01.png" title="GitLab登陆" alt="GitLab登陆" style="max-width: 100%; vertical-align: middle; border-width: 0px;" /></p>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">输入管理用户名和密码！开始享受GitLab吧！</p>
<p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><img src="http://www.kuuyee.org/images/gitlab/gitlab_02.png" title="GitLab首页" alt="GitLab首页" style="max-width: 100%; vertical-align: middle; border-width: 0px;" /></p>
<p style="margin: 0px 0px 10px;"></p>
<div>2013-04-19</div>
</div>
</div>
</div>
</div>
<footer style="text-align: center; padding: 20px 0px; margin-top: 20px; border-top-width: 1px; border-top-style: solid; border-top-color: #e5e5e5; background-color: #f5f5f5; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;">
<div style="width: 1170px; margin-right: auto; margin-left: auto;"></div>
</footer><img src ="http://www.blogjava.net/kuuyee/aggbug/398092.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-04-19 15:43 <a href="http://www.blogjava.net/kuuyee/archive/2013/04/19/398092.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在RHEL5.5上安装PostgreSql92</title><link>http://www.blogjava.net/kuuyee/archive/2013/04/09/397587.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 09 Apr 2013 07:55:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/04/09/397587.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/397587.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/04/09/397587.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/397587.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/397587.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">RHEL5.5默认的源里没有postgresql9的包，需要下载源。下载地址 ：<a href="http://yum.postgresql.org/9.2/redhat/rhel-5-x86_64/pgdg-redhat92-9.2-7.noarch.rpm" style="color: #0088cc; text-decoration: none;">http://yum.postgresql.org/9.2/redhat/rhel-5-x86_64/pgdg-redhat92-9.2-7.noarch.rpm</a></p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">然后安装源</p><pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">rpm -ivh pgdg-redhat92-9.2-7.noarch.rpm </code></pre><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">最后安装postgresql92</p><pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install postgresql92 postgresql92-server postgresql92-devel </code></pre><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">初始化数据库</p><pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">service postgresql-9.2 initdb Initializing database:                                     [  OK  ]</code></pre><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">启动数据库</p><pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">/etc/init.d/postgresql-9.2 start Starting postgresql-9.2 service:                           [  OK  ]</code></pre><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">查看数据状态</p><pre style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">netstat -nutlap | grep post tcp        0      0 127.0.0.1:5432              0.0.0.0:*                   LISTEN      21627/postmaster     udp        0      0 127.0.0.1:12823             127.0.0.1:12823             ESTABLISHED 21627/postmaster </code></pre><div><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border: 0px;"><br /></code></div><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;"></p><img src ="http://www.blogjava.net/kuuyee/aggbug/397587.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-04-09 15:55 <a href="http://www.blogjava.net/kuuyee/archive/2013/04/09/397587.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>设置Linux用户无口令登陆方式</title><link>http://www.blogjava.net/kuuyee/archive/2013/03/20/396700.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Wed, 20 Mar 2013 01:08:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/03/20/396700.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/396700.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/03/20/396700.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/396700.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/396700.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 有些时候需要用户能够无密码登陆，解放办法很简单，如下：<br>切换到root用户，修改/etc/shadow文件。<br>chmod 644 /etc/shadow<br>vim /etc/shadow &nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2013/03/20/396700.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/396700.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-03-20 09:08 <a href="http://www.blogjava.net/kuuyee/archive/2013/03/20/396700.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse配色方案插件 真漂亮！</title><link>http://www.blogjava.net/kuuyee/archive/2013/02/26/395728.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 26 Feb 2013 02:43:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/02/26/395728.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/395728.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/02/26/395728.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/395728.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/395728.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">最近发现了一个Eclipse配色方案插件，这回给Eclipse配色太方便了。</p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">插件主页：<a href="http://eclipsecolorthemes.org/" style="color: #0088cc; text-decoration: initial;">http://eclipsecolorthemes.org/</a></p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">插件提供了上万种配色方案，非常漂亮，上图看下：</p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;"><img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53349/o_eclipse_theme_04.jpg" title="找不到方法异常" alt="找不到方法异常" style="max-width: 100%; height: 754px; vertical-align: middle; border-width: 0px; width: 937px;" width="937" height="754" /></p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">安装很简单，打开&nbsp;<strong>Eclipse Marketplace</strong></p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;"><img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53349/o_eclipse_theme_01.jpg" title="找不到方法异常" alt="找不到方法异常" style="max-width: 100%; height: 372px; vertical-align: middle; border-width: 0px; width: 343px;" width="343" height="372" /></p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">查找&nbsp;<strong>Eclipse Color Theme</strong>，会找到这个插件。</p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;"><img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53349/o_eclipse_theme_02.jpg" border="0" alt="" width="608" height="326" /><br /></p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;">安装完成后进入&nbsp;<strong>Preferences &#8212;&gt; Appearance &#8212;&gt; Color Theme</strong>&nbsp;就可选择主题了</p><p style="margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;"><img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53349/o_eclipse_theme_03.jpg" title="找不到方法异常" alt="找不到方法异常" style="max-width: 100%; height: 656px; vertical-align: middle; border-width: 0px; width: 793px;" width="793" height="656" /></p><img src ="http://www.blogjava.net/kuuyee/aggbug/395728.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-02-26 10:43 <a href="http://www.blogjava.net/kuuyee/archive/2013/02/26/395728.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Fedora18 KDE定制版安装记录</title><link>http://www.blogjava.net/kuuyee/archive/2013/01/29/394882.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 29 Jan 2013 06:37:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/01/29/394882.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/394882.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/01/29/394882.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/394882.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/394882.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>为什么是KDE，因为实在忍受不了Gnome3了，<a href="http://lyric.im/why-i-use-kde-instead-of-gnome-1" style="color: #0088cc; text-decoration: initial;">为什么我弃用GNOME转向KDE</a>这篇文章很全面了Gnome的不足，而KDE才是真正给用户使用的桌面，基本上不输给Win7，如果你是Linuxer,投入KDE怀抱吧！</strong></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;">秀下我的桌面！</p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/r_fedora18-kde-instll_00_min.jpg" title="Fedora18 KDE" alt="Fedora18 KDE" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="640" height="360" /></p>
<h4>下载LiveCD</h4>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><a href="http://download.fedoraproject.org/pub/fedora/linux/releases/18/Live/x86_64/Fedora-18-x86_64-Live-KDE.iso" style="color: #0088cc; text-decoration: initial;">http://download.fedoraproject.org/pub/fedora/linux/releases/18/Live/x86_64/Fedora-18-x86_64-Live-KDE.iso</a><br />
<a href="https://fedorahosted.org/releases/l/i/liveusb-creator/liveusb-creator-3.11.7-setup.exe" style="color: #0088cc; text-decoration: initial;">https://fedorahosted.org/releases/l/i/liveusb-creator/liveusb-creator-3.11.7-setup.exe</a>&nbsp;<br />
liveusb-creator用来创建USB安装介质，KDE安装盘不算大，就800多MB。</p>
<h4>开始安装</h4>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;">插入烧录好的USB，重启电脑选择USB启动,看到如下启动页面：<br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_01_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="595" height="408" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>进入LiveCD桌面，点击桌面上的Install to Hard Drive安装图标,如下图：</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_02_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="801" height="601" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>选择中文语言</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_03_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="802" height="603" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>进入安装摘要页面，主要是设置存储</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_04_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="801" height="600" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>点击安装目标位置，进入磁盘选择页</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_05_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="798" height="599" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>选中安装磁盘点继续</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_06_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="801" height="600" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>在安装选项里把自定义磁盘分区勾上，然后点击回收空间</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_07_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="801" height="395" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>进入手动分区页，点击自动创建连接，如下图：</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_08_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="798" height="399" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>直接使用Fedora默认的分区方案，不用做任何更改（除非你想自定义分区方案）点击结束分区</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/r_fedora18-kde-instll_09_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="640" height="479" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>完成存储设置，点击开始安装</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_10_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="801" height="601" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>进入安装进度，同时设置root密码</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_11_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="800" height="599" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>完成安装，重启系统！</strong><br />
<img src="http://www.blogjava.net/images/blogjava_net/kuuyee/53286/o_fedora18-kde-instll_12_min.jpg" title="Fedora18 KDE LiveCD" alt="Fedora18 KDE LiveCD" style="max-width: 100%; vertical-align: middle; border-width: 0px; " width="802" height="601" /></p>
<p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>Congratulations!</strong>&nbsp;安装完成！先写到这，安装成功的童鞋可以先随便玩玩，后续的内容我会逐渐告诉大家如何把KDE打造成实用而且漂亮的桌面。<br /></p><div><p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"><strong>待续&#8230;</strong></p><p style="margin: 0px 0px 1.5em; font-size: 16.363636016845703px; color: #333333; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; line-height: 20px; background-color: #ffffff;"></p></div><p>&nbsp;</p><img src ="http://www.blogjava.net/kuuyee/aggbug/394882.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-01-29 14:37 <a href="http://www.blogjava.net/kuuyee/archive/2013/01/29/394882.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>下一代静态网站生成框架Awestruct在Fedora18安装全过程</title><link>http://www.blogjava.net/kuuyee/archive/2013/01/24/394698.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Thu, 24 Jan 2013 05:39:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/01/24/394698.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/394698.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/01/24/394698.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/394698.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/394698.html</trackback:ping><description><![CDATA[<h2></h2><h2><strong style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px;">Awestruct是非常棒的静态网站生成框架，他基于Jekyll，使用Ruby语言开发。Awestruct可以根据模板生成非常漂亮的网站，例如可以用BootStrap或者BluePrint，这两个大名鼎鼎的东东不用多说了吧，地球人都知道。废话不多说，进入主题。</strong></h2><h3>安装Ruby环境</h3><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">首先安装一些依赖库，否则安装Awestruct会报如下的错误：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">Building native extensions.  This could take a while... <br />......... <br />ERROR:  Error installing <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a>:         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ERROR: Failed to build gem native extension. .         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/bin/ruby extconf.rb <br />checking for stdio.h... *** extconf.rb failed *** <br />Could not create Makefile due to some reason, probably lack of <br />necessary libraries and/or headers.  Check the mkmf.log file for more <br />details.  You may need configuration options. <br />. <br />Provided configuration options:         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-dir         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-dir         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-include         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-include=${opt-dir}/include         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-opt-lib         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-opt-lib=${opt-dir}/lib         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-make-prog         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--without-make-prog         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--srcdir=.         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--curdir         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--ruby=/usr/bin/ruby <br />/usr/share/ruby/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError) <br />You have to install development tools first.         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:506:in `try_cpp'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:931:in `block in have_header'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:790:in `block in checking_for'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:284:in `block (2 levels) in postpone'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:254:in `open'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:284:in `block in postpone'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:254:in `open'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:280:in `postpone'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:789:in `checking_for'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/ruby/mkmf.rb:930:in `have_header'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from extconf.rb:2:in `&lt;main&gt;'</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">开始安装依赖库，用&nbsp;<strong>root</strong>&nbsp;用户或者&nbsp;<strong>su</strong>&nbsp;执行如下命令：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel</code></pre><div alert-success"="" style="padding: 8px 35px 8px 14px; margin-bottom: 18px; text-shadow: rgba(255, 255, 255, 0.498039) 0px 1px 0px; background-color: #dff0d8; border: 1px solid #d6e9c6; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #468847; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px;">我是Fedora的粉丝，对不住用其它发行版的童鞋了，请自行根据我列出的安装包找到对应的系统安装方法。</div><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">安装Ruby和RubyGems,用&nbsp;<strong>root</strong>&nbsp;用户或者&nbsp;<strong>su</strong>&nbsp;执行如下命令：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install ruby ruby-devel ruby-irb rubygems</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">Fedora18 Yum源的Ruby非常新，都是目前(2012-12-14)的最新版本，看看安装的Ruby版本：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">正在安装    : libyaml-0.1.4-3.fc18.x86_64                                           1/10    <br />正在安装    : ruby-libs-1.9.3.327-22.fc18.x86_64                                    2/10    <br />正在安装    : ruby-irb-1.9.3.327-22.fc18.noarch                                     3/10    <br />正在安装    : rubygem-json-1.6.5-2.fc18.x86_64                                      4/10    <br />正在安装    : rubygem-io-console-0.3-22.fc18.x86_64                                 5/10    <br />正在安装    : rubygem-bigdecimal-1.1.0-22.fc18.x86_64                               6/10    <br />正在安装    : rubygem-rdoc-3.12-5.fc18.noarch                                       7/10    <br />正在安装    : rubygems-1.8.24-3.fc18.noarch                                         8/10    <br />正在安装    : ruby-1.9.3.327-22.fc18.x86_64                                         9/10    <br />正在安装    : ruby-devel-1.9.3.327-22.fc18.x86_64 </code></pre><h3>安装Awestruct</h3><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">Awestruct使用RubyGems管理安装，用&nbsp;<strong>root</strong>&nbsp;用户或者&nbsp;<strong>su</strong>&nbsp;执行如下命令：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">gem install <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a> --no-ri --no-rdoc</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">结果报如下错误:</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">Fetching: nokogiri-1.5.5.gem (100%) <br />ERROR:  Error installing <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a>:         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;invalid gem format for /usr/local/share/gems/cache/nokogiri-1.5.5.gem</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">这个问题让我郁闷了N久时间，Google了大半天，还特意搞了FANQIANG，结果死活装不上nokogiri。最后通过Yum来解决,我只能说RubyGems安装很无耻！还是YUM好！，命令如下：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install -y rubygem-nokogiri</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">再次安装Awestruct：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install -y rubygem-nokogiri</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">盼望已久的时刻来临，如果哪位童鞋看到如下的输出，Congratulations！</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">Successfully installed <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a>-0.4.7 17 gems installed</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">不过别高兴太早，先适用下是否OK！用BootStrap模板生产一个新的静态网站，命令如下：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a> -i -f bootstrap //或者用awestruct --init --framework bootstrap</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">傻眼了，还是报错：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">[root@localhost kuuyee]# <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a> -i -f bootstrap <br />/usr/local/share/gems/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/execjs-1.4.0/lib/execjs.rb:5:in `&lt;module:ExecJS&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/execjs-1.4.0/lib/execjs.rb:4:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `&lt;top (required)&gt;'         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'     <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `&lt;top (required)&gt;'          &nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'     <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/handlers/coffeescript_handler.rb:8:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/handler_chains.rb:14:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/pipeline.rb:2:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/engine.rb:6:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/cli/generate.rb:1:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/cli/invoker.rb:4:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/bin/awestruct:6:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/bin/awestruct:23:in `load'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/bin/awestruct:23:in `&lt;main&gt;'</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">顾名思义，提示没有JavaScript Runtime。继续Google，最后一位高人指点说装个JavaScript引擎就OK，我选择NodeJS。只可惜NodeJSF没有YUM源，只能源码编译安装，无所谓，继续:</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">wget -c 'http://nodejs.org/dist/v0.8.16/node-v0.8.16.tar.gz' <br />tar zxvf node-v0.8.16.tar.gz  <br />cd node-v0.8.16 <br />./configure  <br />make &amp;&amp; make install</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">又是一阵漫长的等待，搞不明白一个JS框架怎么要编译这么久，无语！最后编译完成测试一下：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">[root@localhost node-v0.8.16]# node -v v0.8.16</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">OK,继续Awestruct测试：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">[root@localhost kuuyee]# <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a> -i -f bootstrap <br />/usr/local/share/gems/gems/git-1.2.5/lib/git/lib.rb:700:in `command': git version   2&gt;&amp;1:sh: git: 未找到命令 (Git::GitExecuteError)         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/git-1.2.5/lib/git/lib.rb:649:in `current_command_version'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/git-1.2.5/lib/git/lib.rb:659:in `meets_required_version?'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/git-1.2.5/lib/git.rb:30:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/deploy/base_deploy.rb:2:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/deploy/s3_deploy.rb:1:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/cli/deploy.rb:1:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/cli/invoker.rb:7:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/share/gems/gems/awestruct-0.4.7/bin/awestruct:6:in `&lt;top (required)&gt;'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/bin/awestruct:23:in `load'         <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/bin/awestruct:23:in `&lt;main&gt;'</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">竟然还TMD报错，不过这回不用急，只是提示没装Git，好办！那就装呗：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">yum install git</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">再继续Awestruct：</p><pre style="padding: 8.5px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><div style="display: inline-block;"><font color="#333333" face="Menlo, Monaco, Consolas, Courier New, monospace"><span style="font-size: 12px; line-height: 18px; white-space: pre-wrap;">[root@localhost kuuyee.org]# <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a> -i -f bootstrap
Create directory: /root/git_project/kuuyee.org/_config
Create directory: /root/git_project/kuuyee.org/_layouts
Create directory: /root/git_project/kuuyee.org/_ext
Create file: /root/git_project/kuuyee.org/_ext/pipeline.rb
Create directory: /root/git_project/kuuyee.org/stylesheets
directory _site/stylesheets/ 
directory images/ 
directory javascripts/ 
   create stylesheets/styles.scss 
   create images/glyphicons-halflings.png 
   create images/glyphicons-halflings-white.png 
   create javascripts/bootstrap-alert.js 
   create javascripts/bootstrap-button.js 
   create javascripts/bootstrap-carousel.js 
   create javascripts/bootstrap-collapse.js 
   create javascripts/bootstrap-dropdown.js 
   create javascripts/bootstrap-modal.js 
   create javascripts/bootstrap-popover.js 
   create javascripts/bootstrap-scrollspy.js 
   create javascripts/bootstrap-tab.js 
   create javascripts/bootstrap-tooltip.js 
   create javascripts/bootstrap-transition.js 
   create javascripts/bootstrap-typeahead.js 
   create _site/stylesheets/styles.css 

Now you're <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a>!

To generate your site continuous during development, simply run:

  <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a> -d

and visit your site at

  http://localhost:4242/

Create file: /root/git_project/kuuyee.org/_layouts/base.html.haml
Create file: /root/git_project/kuuyee.org/index.html.haml</span></font><font color="rgba(0, 0, 0, 0)" face="Menlo, Monaco, Consolas, Courier New, monospace"><span style="font-size: 12.025px; line-height: 18px; white-space: pre-wrap;">
</span></font></div></code></pre><div><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><div style="display: inline-block;"></div></code></div><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;"><strong>Congratulations!</strong>&nbsp;这回真的恭喜你了！赶紧部署一下：</p><pre style="padding: 8.5px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><div style="display: inline-block; font-size: 12px; line-height: 18px; white-space: pre-wrap;"><font color="#333333" face="Menlo, Monaco, Consolas, Courier New, monospace">[root@localhost kuuyee]#  <a title="下一代静态网站生成工具" href="http://awestruct.org" >下一代静态网站生成工具</a> -d
Unable to locate profile: development
Using profile: NONE
Generating site: http://localhost:4242
Generating: /1003/awestruct-sample/_site/images/glyphicons-halflings-white.png
Generating: /1003/awestruct-sample/_site/images/glyphicons-halflings.png
Generating: /1003/awestruct-sample/_site/index.html
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-alert.js
/usr/local/share/gems/gems/awestruct-0.4.7/lib/awestruct/handlers/interpolation_handler.rb:35: Use RbConfig instead of obsolete and deprecated Config.
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-button.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-carousel.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-collapse.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-dropdown.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-modal.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-popover.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-scrollspy.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-tab.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-tooltip.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-transition.js
Generating: /1003/awestruct-sample/_site/javascripts/bootstrap-typeahead.js
Analyzing:  /1003/awestruct-sample/_site/stylesheets/styles.css
[Listen warning]:
  Missing dependency 'rb-inotify' (version '~&gt; 0.8.8')!
  Please run the following to satisfy the dependency:   
    gem install --version '~&gt; 0.8.8' rb-inotify   
.  
  For a better performance, it's recommended that you satisfy the missing dependency.
  Listen will be polling changes. Learn more at https://github.com/guard/listen#polling-fallback.
.
&gt;&gt; Thin web server (v1.4.1 codename Chromeo)
&gt;&gt; Maximum connections set to 1024
&gt;&gt; Listening on 0.0.0.0:4242, CTRL+C to stop
</font></div><font color="#333333" face="Menlo, Monaco, Consolas, Courier New, monospace"><span style="font-size: 12.025px; line-height: 18px; white-space: pre-wrap;"><br /></span></font></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">打开&nbsp;<a href="http://localhost:4242/" style="color: #0088cc; text-decoration: initial;">http://localhost:4242/</a>&nbsp;看看吧！</p><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;"><img src="http://docs.1003.com/images/bootstrap.png" title="BootStrap网站模板" alt="BootStrap网站模板" style="max-width: 100%; vertical-align: middle; border: 0px;" /></p><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">细心的童鞋一定会注意到部署输出有警告，我是属于不想看到任何警告的人，所以还得继续，清楚警告：</p><pre style="padding: 8.5px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12.025px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 9px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902); font-weight: normal;"><code style="padding: 0px; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;">gem install --version '~&gt; 0.8.8' rb-inotify</code></pre><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;">再次部署访问就不会有警告了！</p><p style="margin: 0px 0px 9px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; background-color: #ffffff;"><strong>大功告成！祝愿各位童鞋安装成功！</strong></p><img src ="http://www.blogjava.net/kuuyee/aggbug/394698.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-01-24 13:39 <a href="http://www.blogjava.net/kuuyee/archive/2013/01/24/394698.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GitHub被墙了</title><link>http://www.blogjava.net/kuuyee/archive/2013/01/22/394522.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 22 Jan 2013 00:17:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2013/01/22/394522.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/394522.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2013/01/22/394522.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/394522.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/394522.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 经过几天的尝试可以确定GitHub被墙了，我只能说中国没救了！&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2013/01/22/394522.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/394522.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2013-01-22 08:17 <a href="http://www.blogjava.net/kuuyee/archive/2013/01/22/394522.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Jboss Seam2.3.0.BETA1发布</title><link>http://www.blogjava.net/kuuyee/archive/2012/04/08/373585.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Sun, 08 Apr 2012 12:00:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2012/04/08/373585.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/373585.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2012/04/08/373585.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/373585.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/373585.html</trackback:ping><description><![CDATA[<div><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #f7f7f7; ">Jboss在3月30号发布了</span><span>Seam2.3.0.BETA1，</span><span>Release Notes如下：<br /><ul><li>修正了大量的Bug</li><li>全面支持JSF2</li><li>加入&nbsp;bean validation 和 EJB 3.1 的支持</li><li>升级Drools版本至5.1</li><li>升级Junit版本至4</li><li>更新大量例子支持JSF2</li></ul></span><div><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #f7f7f7; ">Jboss Seam计划在这个月发布另一个里程碑 2.3.0.Beta2，逐步完善 Arquillian 和 Seam Gen 特性。其后就集中在 2.3.0 的BUG 修复上。&nbsp;</span></div><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #f7f7f7; "><br />下载：</span><a target="_blank" href="http://www.seamframework.org/Seam2/Downloads" style="color: #006699; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #f7f7f7; ">http://www.seamframework.org/Seam2/Downloads</a>&nbsp;<br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #f7f7f7; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #f7f7f7; ">文档：</span><a target="_blank" href="http://docs.jboss.org/seam/2.3.0.Beta1/html/" style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #f7f7f7; color: #006699; ">http://www.seamframework.org/Seam2/Seam2Documentation.</a>&nbsp;</div><img src ="http://www.blogjava.net/kuuyee/aggbug/373585.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2012-04-08 20:00 <a href="http://www.blogjava.net/kuuyee/archive/2012/04/08/373585.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE 11g在Linux下手工配置EM</title><link>http://www.blogjava.net/kuuyee/archive/2012/04/05/373355.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Thu, 05 Apr 2012 03:08:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2012/04/05/373355.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/373355.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2012/04/05/373355.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/373355.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/373355.html</trackback:ping><description><![CDATA[<div id="content" style="font-family: 微软雅黑; line-height: normal; font-size: medium; "><div id="preamble" style="margin-top: 1.5em; margin-bottom: 1.5em; "><div style="font-family: Georgia, 'Times New Roman', Times, serif; margin-left: 0px; "><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; ">使用OTK工具安装的Oracle默认没有配置EM，下面记录下配置和启动过程!</p></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; ">首先创建EM，执行下面的命令</p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">$ emca -config dbcontrol db -repos recreate</tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; ">我第一次运行报如下错误：<br /></p><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->Mar&nbsp;<span style="color: #800000; font-weight: bold; ">31</span>,&nbsp;<span style="color: #800000; font-weight: bold; ">2012</span>&nbsp;<span style="color: #800000; font-weight: bold; ">4</span>:<span style="color: #800000; font-weight: bold; ">16</span>:<span style="color: #800000; font-weight: bold; ">06</span>&nbsp;PM&nbsp;oracle.sysman.emcp.EMReposConfig&nbsp;createRepository<br />CONFIG:&nbsp;ORA<span style="color: #808080; ">-</span><span style="color: #800000; font-weight: bold; ">00604</span>:&nbsp;error&nbsp;occurred&nbsp;at&nbsp;recursive&nbsp;SQL&nbsp;<span style="color: #0000FF; ">level</span>&nbsp;<span style="color: #800000; font-weight: bold; ">1</span><br />ORA<span style="color: #808080; ">-</span><span style="color: #800000; font-weight: bold; ">01653</span>:&nbsp;unable&nbsp;<span style="color: #0000FF; ">to</span>&nbsp;extend&nbsp;<span style="color: #0000FF; ">table</span>&nbsp;SYS.SOURCE$&nbsp;<span style="color: #0000FF; ">by</span>&nbsp;<span style="color: #800000; font-weight: bold; ">128</span>&nbsp;<span style="color: #808080; ">in</span>&nbsp;tablespace&nbsp;SYSTEM<br />oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException:&nbsp;ORA<span style="color: #808080; ">-</span><span style="color: #800000; font-weight: bold; ">00604</span>:&nbsp;error&nbsp;occurred&nbsp;at&nbsp;recursive&nbsp;SQL&nbsp;<span style="color: #0000FF; ">level</span>&nbsp;<span style="color: #800000; font-weight: bold; ">1</span><br />ORA<span style="color: #808080; ">-</span><span style="color: #800000; font-weight: bold; ">01653</span>:&nbsp;unable&nbsp;<span style="color: #0000FF; ">to</span>&nbsp;extend&nbsp;<span style="color: #0000FF; ">table</span>&nbsp;SYS.SOURCE$&nbsp;<span style="color: #0000FF; ">by</span>&nbsp;<span style="color: #800000; font-weight: bold; ">128</span>&nbsp;<span style="color: #808080; ">in</span>&nbsp;tablespace&nbsp;SYSTEM<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:<span style="color: #800000; font-weight: bold; ">1650</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeScript(SQLEngine.java:<span style="color: #800000; font-weight: bold; ">1000</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:<span style="color: #800000; font-weight: bold; ">339</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:<span style="color: #800000; font-weight: bold; ">380</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.emcp.EMReposConfig.createRepository(EMReposConfig.java:<span style="color: #800000; font-weight: bold; ">510</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:<span style="color: #800000; font-weight: bold; ">228</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:<span style="color: #800000; font-weight: bold; ">157</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.emcp.EMConfig.perform(EMConfig.java:<span style="color: #800000; font-weight: bold; ">253</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:<span style="color: #800000; font-weight: bold; ">589</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:<span style="color: #800000; font-weight: bold; ">1448</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:<span style="color: #800000; font-weight: bold; ">573</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at&nbsp;oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:<span style="color: #800000; font-weight: bold; ">521</span>)<br />Mar&nbsp;<span style="color: #800000; font-weight: bold; ">31</span>,&nbsp;<span style="color: #800000; font-weight: bold; ">2012</span>&nbsp;<span style="color: #800000; font-weight: bold; ">4</span>:<span style="color: #800000; font-weight: bold; ">16</span>:<span style="color: #800000; font-weight: bold; ">06</span>&nbsp;PM&nbsp;oracle.sysman.emcp.EMReposConfig&nbsp;invoke<br />SEVERE:&nbsp;Error&nbsp;creating&nbsp;the&nbsp;repository</div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; "><strong style="color: #083194; "><br />解决办法</strong></p></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; ">使用SYS用户登录sqlplus，然后执行下面的语句：</p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; "> SQL<span style="color: #990000; ">&gt;</span> <span style="font-weight: bold; "><span style="color: #0000ff; ">SELECT</span></span> <span style="color: #990000; ">*</span> <span style="font-weight: bold; "><span style="color: #0000ff; ">FROM</span></span> DBA_DATA_FILES <span style="font-weight: bold; "><span style="color: #0000ff; ">where</span></span> TABLESPACE_NAME <span style="color: #990000; ">=</span> <span style="color: #ff0000; ">'SYSTEM'</span><span style="color: #990000; ">;</span> <br />FILE_NAME     FILE_ID TABLESPACE_NAME                    <br /> BYTES     BLOCKS <span style="font-weight: bold; "><span style="color: #0000ff; ">STATUS</span></span>  RELATIVE_FNO AUT   MAXBYTES  MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS  <br />ONLINE_  <span style="color: #990000; ">/</span>data01<span style="color: #990000; ">/</span>rdbms<span style="color: #990000; ">/</span>wcdb<span style="color: #990000; ">/</span>datafile<span style="color: #990000; ">/</span>wcdb_system_01<span style="color: #990000; ">.</span>dbf          <span style="color: #993399; ">1</span> SYSTEM                          <span style="color: #993399; ">536870912</span>      <span style="color: #993399; ">65536</span> AVAILABLE           <br /> <span style="color: #993399; ">1</span> NO           <span style="color: #993399; ">0</span>          <span style="color: #993399; ">0</span>            <span style="color: #993399; ">0</span>  <span style="color: #993399; ">535822336</span>       <span style="color: #993399; ">65408</span> <br />SYSTEM</tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; ">然后新定义个空间文件wcdb_system_02.dbf，注意不要重名</p></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; ">然后新定义个空间文件*wcdb_system_02.dbf*，注意不要重名</p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">SQL<span style="color: #990000; ">&gt;</span> <span style="font-weight: bold; "><span style="color: #0000ff; ">ALTER</span></span> TABLESPACE SYSTEM <span style="font-weight: bold; "><span style="color: #0000ff; ">ADD</span></span> DATAFILE <span style="color: #ff0000; ">'/data01/rdbms/wcdb/datafile/wcdb_system_02.dbf'</span> SIZE 500M<span style="color: #990000; ">;</span> Tablespace altered<span style="color: #990000; ">.</span></tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; ">然后再次执行EM创建成功！</p></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; ">EM的访问地址：<a href="https://host:1158/em" style="color: fuchsia; ">https://localhost:1158/em</a></p></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; "><strong style="color: #083194; ">删除一个EM资料库</strong></p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">$ emca <span style="color: #990000; ">-</span>repos <span style="font-weight: bold; "><span style="color: #0000ff; ">drop</span></span></tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; "><strong style="color: #083194; ">配置数据库的 Database Control</strong></p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">$ emca <span style="color: #990000; ">-</span>config dbcontrol db</tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; "><strong style="color: #083194; ">删除数据库的 Database Control配置</strong></p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">$ emca <span style="color: #990000; ">-</span>deconfig dbcontrol db</tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; "><strong style="color: #083194; ">重新配置db control的端口，默认端口在1158</strong></p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">$ emca <span style="color: #990000; ">-</span>reconfig ports $ emca <span style="color: #990000; ">-</span>reconfig ports <span style="color: #990000; ">-</span>dbcontrol_http_port <span style="color: #993399; ">1160</span> $ emca <span style="color: #990000; ">-</span>reconfig ports <span style="color: #990000; ">-</span>agent_port <span style="color: #993399; ">3940</span></tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; "><strong style="color: #083194; ">先设 置ORACLE_SID环境变量后,启动EM console服务</strong></p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">$ emctl start dbconsole</tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; "><strong style="color: #083194; ">先设置 ORACLE_SID环境变量后,停止EM console服务</strong></p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">$ emctl stop dbconsole</tt></pre></div></div><div><p style="margin-top: 0.5em; margin-bottom: 0.5em; "><strong style="color: #083194; ">先设置ORACLE_SID环 境变量后,查看EM console服务的状态</strong></p></div><div style="margin-top: 1em; margin-bottom: 1.5em; "><div style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-image: initial; border-left-width: 5px; border-left-style: solid; border-left-color: #f0f0f0; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f8f8f8; background-position: initial initial; background-repeat: initial initial; "><pre style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; "><tt style="font-size: inherit; color: navy; ">$ emctl <span style="font-weight: bold; "><span style="color: #0000ff; ">status</span></span> dbconsole</tt></pre></div></div></div></div></div><div id="footer" style="font-family: Arial, Helvetica, sans-serif; font-size: small; border-top-width: 2px; border-top-style: solid; border-top-color: silver; padding-top: 0.5em; margin-top: 4em; line-height: normal; "></div><img src ="http://www.blogjava.net/kuuyee/aggbug/373355.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2012-04-05 11:08 <a href="http://www.blogjava.net/kuuyee/archive/2012/04/05/373355.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个速度比较快的Cygwin镜像</title><link>http://www.blogjava.net/kuuyee/archive/2011/10/17/361490.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Mon, 17 Oct 2011 15:43:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/10/17/361490.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/361490.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/10/17/361490.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/361490.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/361490.html</trackback:ping><description><![CDATA[最近发现163镜像总是中途下载失败！所以测试了一下别的镜像，发现一个速度还可以（是小鬼子的）！<br />就此记录连接<br /><div style="display: inline-block; "><div><div><a href="ftp://ftp.iij.ad.jp/pub/cygwin/">ftp://ftp.iij.ad.jp/pub/cygwin/<br /><br /></a></div></div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/361490.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-10-17 23:43 <a href="http://www.blogjava.net/kuuyee/archive/2011/10/17/361490.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用Weblogic WLST脚本 远程部署Web应用</title><link>http://www.blogjava.net/kuuyee/archive/2011/10/13/361213.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Thu, 13 Oct 2011 15:46:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/10/13/361213.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/361213.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/10/13/361213.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/361213.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/361213.html</trackback:ping><description><![CDATA[废话少说 直接上代码<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080; ">&nbsp;1</span>&nbsp;<span style="color: #0000FF; ">import</span><span style="color: #000000; ">&nbsp;re<br /></span><span style="color: #008080; ">&nbsp;2</span>&nbsp;<span style="color: #000000; ">&nbsp;<br /></span><span style="color: #008080; ">&nbsp;3</span>&nbsp;<span style="color: #000000; ">warPath&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">'</span><span style="color: #800000; ">helloWebApp</span><span style="color: #800000; ">'</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;4</span>&nbsp;<span style="color: #000000; ">serverUrl&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">'</span><span style="color: #800000; ">t3://192.168.1.100:7001</span><span style="color: #800000; ">'</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;5</span>&nbsp;<span style="color: #000000; ">username&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">'</span><span style="color: #800000; ">weblogic</span><span style="color: #800000; ">'</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;6</span>&nbsp;<span style="color: #000000; ">password&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">'</span><span style="color: #800000; ">weblogic</span><span style="color: #800000; ">'</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;7</span>&nbsp;<span style="color: #000000; ">targetServer</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">examplesServer</span><span style="color: #800000; ">"</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;8</span>&nbsp;<span style="color: #000000; ">deployAppName</span><span style="color: #000000; ">=</span><span style="color: #800000; ">'</span><span style="color: #800000; ">DeployExample2</span><span style="color: #800000; ">'</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">&nbsp;9</span>&nbsp;<span style="color: #000000; "><br /></span><span style="color: #008080; ">10</span>&nbsp;<span style="color: #000000; ">&nbsp;<br /></span><span style="color: #008080; ">11</span>&nbsp;<span style="color: #000000; ">connect(username,&nbsp;password,&nbsp;serverUrl)<br /></span><span style="color: #008080; ">12</span>&nbsp;<span style="color: #000000; ">&nbsp;<br /></span><span style="color: #008080; ">13</span>&nbsp;<span style="color: #000000; ">appList&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;re.findall(deployAppName,&nbsp;ls(</span><span style="color: #800000; ">'</span><span style="color: #800000; ">/AppDeployments</span><span style="color: #800000; ">'</span><span style="color: #000000; ">))<br /></span><span style="color: #008080; ">14</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">print</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">=========================</span><span style="color: #800000; ">"</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">15</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">print</span><span style="color: #000000; ">&nbsp;len(appList)<br /></span><span style="color: #008080; ">16</span>&nbsp;<span style="color: #000000; "></span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;len(appList)&nbsp;</span><span style="color: #000000; ">&gt;</span><span style="color: #000000; ">&nbsp;0:<br /></span><span style="color: #008080; ">17</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">#</span><span style="color: #008000; ">oldestArchiveVersion&nbsp;=&nbsp;min(map(int,&nbsp;appList))</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">18</span>&nbsp;<span style="color: #008000; "></span><span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">print</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">'</span><span style="color: #800000; ">come&nbsp;in!!!</span><span style="color: #800000; ">'</span><span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080; ">19</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;undeploy(deployAppName)<br /></span><span style="color: #008080; ">20</span>&nbsp;<span style="color: #000000; ">&nbsp;<br /></span><span style="color: #008080; ">21</span>&nbsp;<span style="color: #000000; "></span><span style="color: #008000; ">#</span><span style="color: #008000; ">deploy(appName='DeployExample',&nbsp;path&nbsp;=&nbsp;'helloWebApp',&nbsp;targets&nbsp;=&nbsp;'examplesServer',timeout=600000,&nbsp;block&nbsp;=&nbsp;'true')</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">22</span>&nbsp;<span style="color: #008000; "></span><span style="color: #000000; "><br /></span><span style="color: #008080; ">23</span>&nbsp;<span style="color: #000000; ">deploy(deployAppName,&nbsp;warPath,&nbsp;targets</span><span style="color: #000000; ">=</span><span style="color: #000000; ">targetServer,&nbsp;securityModel&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">Advanced</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,timeout</span><span style="color: #000000; ">=</span><span style="color: #000000; ">600000</span><span style="color: #000000; ">,&nbsp;block&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #800000; ">"</span><span style="color: #800000; ">true</span><span style="color: #800000; ">"</span><span style="color: #000000; ">)<br /></span><span style="color: #008080; ">24</span>&nbsp;<span style="color: #000000; ">exit()</span></div>Ok<img src ="http://www.blogjava.net/kuuyee/aggbug/361213.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-10-13 23:46 <a href="http://www.blogjava.net/kuuyee/archive/2011/10/13/361213.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CentOS5.4安装Trac记录</title><link>http://www.blogjava.net/kuuyee/archive/2011/10/08/360212.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Sat, 08 Oct 2011 09:52:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/10/08/360212.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/360212.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/10/08/360212.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/360212.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/360212.html</trackback:ping><description><![CDATA[<div><div style="color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div monospaced"=""><pre coderay"="" style="padding: 9.5px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; color: #333333; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; margin-top: 0px; margin-bottom: 10px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.14902);"><code style="padding: 0px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; color: inherit; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: transparent; border: 0px;"><br />rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-4.noarch.rpm <br />yum install libffi -y <br />yum install python26 -y <br />rm -f /usr/bin/python <br />ln -s /usr/bin/python26 /usr/bin/python <br />vim /usr/bin/yum <br />python -V <br />wget http://peak.telecommunity.com/dist/ez_setup.py <br />python ez_setup.py <br />easy_install Babel==0.9.5 <br />easy_install Trac <br />trac-admin easyci_project initenv <br />tracd --port 8000 /easyci/trac/easyci_project <br />trac-admin /easyci/trac/easyci_project permission add admin TRAC_ADMIN</code></pre></div></div><p style="margin: 0px 0px 10px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"></p></div><img src ="http://www.blogjava.net/kuuyee/aggbug/360212.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-10-08 17:52 <a href="http://www.blogjava.net/kuuyee/archive/2011/10/08/360212.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(转载)CentOS中简单用yum升级 Python 至2.6</title><link>http://www.blogjava.net/kuuyee/archive/2011/10/08/360206.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Sat, 08 Oct 2011 09:26:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/10/08/360206.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/360206.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/10/08/360206.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/360206.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/360206.html</trackback:ping><description><![CDATA[<div><a href="http://vpshello.com/upgrade-python-to-26-with-yum/">http://vpshello.com/upgrade-python-to-26-with-yum/<br /><span class="Apple-style-span" style="color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Microsoft YaHei', Arial, Verdana, sans-serif; font-size: 12px; line-height: 18px; -webkit-text-decorations-in-effect: none; background-color: #ffffff; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">写了不少VPS评测，今天发个简单的技术帖。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">CentOS 在当前最新的 5.6 版中，其 python 的版本依然比较落后，还是古老的 2.4。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">但是有些程序需要 2.6 才跑得起来，编译安装的话，又太麻烦，而且不适合菜鸟使用。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">下面就给出使用 yum 升级 python 至 2.6 的简单方案。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "><span id="more-173" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "></span></p><div id="codeSnippetWrapper" style="margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 4px; padding-right: 4px; padding-bottom: 4px; padding-left: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; text-align: left; border-left-color: silver; border-left-style: solid; line-height: 12pt; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; overflow-x: auto; overflow-y: auto; border-top-color: silver; border-top-style: solid; cursor: text; border-right-color: silver; border-right-style: solid; background-position: initial initial; background-repeat: initial initial; "><div id="codeSnippet" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; background-position: initial initial; background-repeat: initial initial; "><span id="lnum1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #606060; background-position: initial initial; background-repeat: initial initial; ">   1:</span> rpm -Uvh http:<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #008000; background-position: initial initial; background-repeat: initial initial; ">//download.fedora.redhat.com/pub/epel/5Server/i386/epel-release-5-4.noarch.rpm</span></pre><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "></p><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; background-position: initial initial; background-repeat: initial initial; "><span id="lnum2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #606060; background-position: initial initial; background-repeat: initial initial; ">   2:</span> yum install libffi -y</pre><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "></p><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; background-position: initial initial; background-repeat: initial initial; "><span id="lnum3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #606060; background-position: initial initial; background-repeat: initial initial; ">   3:</span> yum install python26 -y</pre><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "></p><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; background-position: initial initial; background-repeat: initial initial; "><span id="lnum4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #606060; background-position: initial initial; background-repeat: initial initial; ">   4:</span> rm -f /usr/bin/python</pre><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "></p><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; background-position: initial initial; background-repeat: initial initial; "><span id="lnum5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #606060; background-position: initial initial; background-repeat: initial initial; ">   5:</span> ln -s /usr/bin/python26 /usr/bin/python</pre><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "></p></div></div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">如果是 64 位的 CentOS，则将上述第一句代码中的 i386 改为 x86_64 即可。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">运行完毕后，此时系统默认的 python 已经是 2.6 版了。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">然而，yum 是基于 python2.4 的，因此会出现故障。解决方法也很简单：</p><div id="codeSnippetWrapper" style="margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 4px; padding-right: 4px; padding-bottom: 4px; padding-left: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; text-align: left; border-left-color: silver; border-left-style: solid; line-height: 12pt; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; overflow-x: auto; overflow-y: auto; border-top-color: silver; border-top-style: solid; cursor: text; border-right-color: silver; border-right-style: solid; background-position: initial initial; background-repeat: initial initial; "><div id="codeSnippet" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; background-position: initial initial; background-repeat: initial initial; "><span id="lnum1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #606060; background-position: initial initial; background-repeat: initial initial; ">   1:</span> nano /usr/bin/yum</pre><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "></p></div></div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">将第一行末的 python 后加上 2.4，即将第一行改为：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">#!/usr/bin/python2.4</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">这样，yum 依然使用 python 2.4 环境运行，一切恢复正常。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">此时我们输入 python -V 即可看到当前的 python 版本：</p><div id="codeSnippetWrapper" style="margin-top: 20px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 4px; padding-right: 4px; padding-bottom: 4px; padding-left: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; text-align: left; border-left-color: silver; border-left-style: solid; line-height: 12pt; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; overflow-x: auto; overflow-y: auto; border-top-color: silver; border-top-style: solid; cursor: text; border-right-color: silver; border-right-style: solid; background-position: initial initial; background-repeat: initial initial; "><div id="codeSnippet" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; background-position: initial initial; background-repeat: initial initial; "><span id="lnum1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #606060; background-position: initial initial; background-repeat: initial initial; ">   1:</span> # python -V</pre><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "></p><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 8pt; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f4f4f4; border-bottom-style: none; text-align: left; line-height: 12pt; border-left-style: none; width: 570px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; overflow-x: visible; overflow-y: visible; background-position: initial initial; background-repeat: initial initial; "><span id="lnum2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #606060; background-position: initial initial; background-repeat: initial initial; ">   2:</span> Python 2.6.5</pre></div></div></span><br /></a></div><img src ="http://www.blogjava.net/kuuyee/aggbug/360206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-10-08 17:26 <a href="http://www.blogjava.net/kuuyee/archive/2011/10/08/360206.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cygwin简单配置</title><link>http://www.blogjava.net/kuuyee/archive/2011/10/08/360190.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Sat, 08 Oct 2011 06:26:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/10/08/360190.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/360190.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/10/08/360190.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/360190.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/360190.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 首先安装cygwin,这部很简单在此不描述了,给出下载链接http://cygwin.com/setup.exe 记得装上vim和OpenSSh还有cygrunsrv&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/10/08/360190.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/360190.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-10-08 14:26 <a href="http://www.blogjava.net/kuuyee/archive/2011/10/08/360190.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(转载)Redhat linux下调整系统时钟</title><link>http://www.blogjava.net/kuuyee/archive/2011/08/30/357568.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 30 Aug 2011 06:33:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/08/30/357568.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/357568.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/08/30/357568.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/357568.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/357568.html</trackback:ping><description><![CDATA[<div><div>               <div id="blog_text"> <div>原文链接:<a href="http://yoozhu.com/?p=232">http://yoozhu.com/?p=232</a><br /><br />最近公司的服务器时间慢了，想调整一下。试了好多次，总不成功，经过几天的努力，终于成功了。现在把我的做法写下来，让后来的同仁少走弯路。</div> <div> </div> <div><strong>1.先修改日期</strong><br /> date -s 11/24/1999<br /> 這時時間變成 Wed Nov 24 00:00:00 CST 1999</div> <div><strong>2.再来修改时间</strong><br /> date -s 09:41:00<br /> Wed Nov 24 00:00:00 CST 1999</div> <div><strong>3.检查硬件(CMOS)时间</strong><br /> clock -r</div> <div><strong>4.将系统时间写入CMOS</strong><br /> clock -w</div> <div>最后两步一般人容易忘记，所以总是失败。呵呵。</div> </div> 						          </div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/357568.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-08-30 14:33 <a href="http://www.blogjava.net/kuuyee/archive/2011/08/30/357568.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(转)JVM崩溃的原因及解决！</title><link>http://www.blogjava.net/kuuyee/articles/355030.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 26 Jul 2011 01:49:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/articles/355030.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/355030.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/articles/355030.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/355030.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/355030.html</trackback:ping><description><![CDATA[原文:<a href="http://www.cnblogs.com/shiyangxt/archive/2009/01/06/1370627.html">http://www.cnblogs.com/shiyangxt/archive/2009/01/06/1370627.html</a><br /><br /><div><div id="cnblogs_post_body"><p>前些天，搞JNI的时候，报了个JVM崩溃的错。错误信息如下：</p> <p>#<br /> # An unexpected error has been detected by HotSpot Virtual Machine:<br /> #<br /> #&nbsp; EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x009fcf52, pid=4752, tid=4440<br /> #<br /> # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode)<br /> # Problematic frame:<br /> # V&nbsp; [jvm.dll+0x9cf52]<br /> #<br /> # An error report file with more information is saved as hs_err_pid4752.log<br /> #<br /> # If you would like to submit a bug report, please visit:<br /> #&nbsp;&nbsp; <a href="http://java.sun.com/webapps/bugreport/crash.jsp">http://java.sun.com/webapps/bugreport/crash.jsp</a><br /> #<br /> 我只不过是想通过C++生成一个Java的Date对象，然后输出当前时间。通过这点错误信息我们大概可以知道的是</p> <p>JVM crash了，输出错误到hs_err_pid4752.log日志。</p> <p>----------------------------------------------------------------------------------------------------</p> <p>结果运行死活都报这个错，也产生了一个log错误日志。其实运行一次产生一个，错都一样，我只举其中一个：</p> <p>为了防止本机信息泄露，我把路径屏掉。</p> <p>#<br /> # An unexpected error has been detected by HotSpot Virtual Machine:<br /> #<br /> #&nbsp; EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x009fcf52, pid=4344, tid=5876<br /> #<br /> # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode)<br /> # Problematic frame:<br /> # V&nbsp; [jvm.dll+0x9cf52]<br /> #</p> <p>---------------&nbsp; T H R E A D&nbsp; ---------------</p> <p>Current thread (0x00823d30):&nbsp; JavaThread "main" [_thread_in_vm, id=5876]</p> <p>siginfo: ExceptionCode=0xc0000005, reading address 0x00000000</p> <p>Registers:<br /> EAX=0x00000000, EBX=0x06f8c0f8, ECX=0x0006f954, EDX=0x00823df0<br /> ESP=0x0006f934, EBP=0x0006f980, ESI=0x0006f954, EDI=0x0006f9e8<br /> EIP=0x009fcf52, EFLAGS=0x00010246</p> <p>Top of Stack: (sp=0x0006f934)<br /> 0x0006f934:&nbsp;&nbsp; 009eb893 00000000 00823d30 009ecac3<br /> 0x0006f944:&nbsp;&nbsp; 00823d30 00000000 0006f9fc 0006f998<br /> 0x0006f954:&nbsp;&nbsp; 00823df0 0082b438 009a1e20 00823d30<br /> 0x0006f964:&nbsp;&nbsp; 0006f980 009ebb6a 00823d30 0000000e<br /> 0x0006f974:&nbsp;&nbsp; 00000004 0006f9e8 0006f998 0006f9e8<br /> 0x0006f984:&nbsp;&nbsp; 1000148b 00823df0 0082b434 00000000<br /> 0x0006f994:&nbsp;&nbsp; 0006f9fc 0006fa5c 06f8c0f8 06f8c0f8<br /> 0x0006f9a4:&nbsp;&nbsp; cccccccc cccccccc cccccccc cccccccc </p> <p>Instructions: (pc=0x009fcf52)<br /> 0x009fcf42:&nbsp;&nbsp; 44 24 04 24 fc 8b 00 8b 00 c3 8b 44 24 04 24 fc<br /> 0x009fcf52:&nbsp;&nbsp; 8b 00 ff 74 24 04 8b c8 e8 93 fe ff ff c3 8b 44 </p> <p><br /> Stack: [0x00030000,0x00070000),&nbsp; sp=0x0006f934,&nbsp; free space=254k<br /> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)<br /> V&nbsp; [jvm.dll+0x9cf52]<br /> C&nbsp; [NativeCode.dll+0x148b]<br /> C&nbsp; [NativeCode.dll+0x1253]<br /> j&nbsp; com.sy.test.TestNative.sayHello()V+0<br /> j&nbsp; com.sy.test.TestNative.main([Ljava/lang/String;)V+22<br /> v&nbsp; ~StubRoutines::call_stub<br /> V&nbsp; [jvm.dll+0x875dd]<br /> V&nbsp; [jvm.dll+0xdfd96]<br /> V&nbsp; [jvm.dll+0x874ae]<br /> V&nbsp; [jvm.dll+0x8e6f1]<br /> C&nbsp; [javaw.exe+0x14c5]<br /> C&nbsp; [javaw.exe+0x3151]<br /> C&nbsp; [kernel32.dll+0x16fd7]</p> <p>Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)<br /> j&nbsp; com.sy.test.TestNative.sayHello()V+0<br /> j&nbsp; com.sy.test.TestNative.main([Ljava/lang/String;)V+22<br /> v&nbsp; ~StubRoutines::call_stub</p> <p>---------------&nbsp; P R O C E S S&nbsp; ---------------</p> <p>Java Threads: ( =&gt; current thread )<br /> &nbsp; 0x008306d0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5624]<br /> &nbsp; 0x0082fb30 JavaThread "CompilerThread0" daemon [_thread_blocked, id=5988]<br /> &nbsp; 0x0082e8c0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2400]<br /> &nbsp; 0x0082de70 JavaThread "Finalizer" daemon [_thread_blocked, id=5704]<br /> &nbsp; 0x0082ccf0 JavaThread "Reference Handler" daemon [_thread_blocked, id=4240]<br /> =&gt;0x00823d30 JavaThread "main" [_thread_in_vm, id=5876]</p> <p>Other Threads:<br /> &nbsp; 0x0082a060 VMThread [id=1960]<br /> &nbsp; 0x00831270 WatcherThread [id=5708]</p> <p>VM state:not at safepoint (normal execution)</p> <p>VM Mutex/Monitor currently owned by a thread: None</p> <p>Heap<br /> &nbsp;def new generation&nbsp;&nbsp; total 576K, used 209K [0x02de0000, 0x02e80000, 0x032c0000)<br /> &nbsp; eden space 512K,&nbsp; 40% used [0x02de0000, 0x02e14510, 0x02e60000)<br /> &nbsp; from space 64K,&nbsp;&nbsp; 0% used [0x02e60000, 0x02e60000, 0x02e70000)<br /> &nbsp; to&nbsp;&nbsp; space 64K,&nbsp;&nbsp; 0% used [0x02e70000, 0x02e70000, 0x02e80000)<br /> &nbsp;tenured generation&nbsp;&nbsp; total 1408K, used 0K [0x032c0000, 0x03420000, 0x06de0000)<br /> &nbsp;&nbsp; the space 1408K,&nbsp;&nbsp; 0% used [0x032c0000, 0x032c0000, 0x032c0200, 0x03420000)<br /> &nbsp;compacting perm gen&nbsp; total 8192K, used 1715K [0x06de0000, 0x075e0000, 0x0ade0000)<br /> &nbsp;&nbsp; the space 8192K,&nbsp; 20% used [0x06de0000, 0x06f8cdb0, 0x06f8ce00, 0x075e0000)<br /> No shared spaces configured.</p> <p>Dynamic libraries:<br /> 0x00400000 - 0x0040d000&nbsp;&nbsp;*******************************</p> <p>0x7c920000 - 0x7c9b4000 &nbsp;C:\WINDOWS\system32\ntdll.dll<br /> 0x7c800000 - 0x7c91d000 &nbsp;C:\WINDOWS\system32\kernel32.dll<br /> 0x77da0000 - 0x77e49000 &nbsp;C:\WINDOWS\system32\ADVAPI32.dll<br /> 0x77e50000 - 0x77ee2000 &nbsp;C:\WINDOWS\system32\RPCRT4.dll<br /> 0x77fc0000 - 0x77fd1000 &nbsp;C:\WINDOWS\system32\Secur32.dll<br /> 0x77d10000 - 0x77d9f000 &nbsp;C:\WINDOWS\system32\USER32.dll<br /> 0x77ef0000 - 0x77f38000 &nbsp;C:\WINDOWS\system32\GDI32.dll<br /> 0x77be0000 - 0x77c38000 &nbsp;C:\WINDOWS\system32\MSVCRT.dll<br /> 0x76300000 - 0x7631d000 &nbsp;C:\WINDOWS\system32\IMM32.DLL<br /> 0x62c20000 - 0x62c29000 &nbsp;C:\WINDOWS\system32\LPK.DLL<br /> 0x73fa0000 - 0x7400b000 &nbsp;C:\WINDOWS\system32\USP10.dll<br /> 0x6d710000 - 0x6d723000 &nbsp;C:\PROGRA~1\KASPER~1\KASPER~1\mzvkbd.dll<br /> 0x76bc0000 - 0x76bcb000 &nbsp;C:\WINDOWS\system32\PSAPI.DLL<br /> 0x6d730000 - 0x6d743000 &nbsp;C:\PROGRA~1\KASPER~1\KASPER~1\mzvkbd3.dll<br /> 0x6d020000 - 0x6d035000 &nbsp;C:\PROGRA~1\KASPER~1\KASPER~1\adialhk.dll<br /> 0x77f40000 - 0x77fb6000 &nbsp;C:\WINDOWS\system32\SHLWAPI.dll<br /> 0x6d4c0000 - 0x6d4c6000 &nbsp;C:\PROGRA~1\KASPER~1\KASPER~1\kloehk.dll<br /> 0x00960000 - 0x00afe000&nbsp;&nbsp;*******************************</p> <p>0x76b10000 - 0x76b3a000 &nbsp;C:\WINDOWS\system32\WINMM.dll<br /> 0x6d290000 - 0x6d298000 *******************************</p> <p>0x6d610000 - 0x6d61c000&nbsp;&nbsp;*******************************</p> <p>0x6d310000 - 0x6d32d000 *******************************</p> <p>0x6d630000 - 0x6d63f000&nbsp;&nbsp;*******************************</p> <p>0x10000000 - 0x1004e000&nbsp;&nbsp;*******************************</p> <p>VM Arguments:<br /> java_command: com.sy.test.TestNative<br /> Launcher Type: SUN_STANDARD</p> <p>Environment Variables:<br /> JAVA_HOME=*******************************</p> <p>CLASSPATH=*******************************<br /> PATH=*******************************<br /> USERNAME=user<br /> OS=Windows_NT<br /> PROCESSOR_IDENTIFIER=x86 Family 6 Model 14 Stepping 8, GenuineIntel</p> <p>&nbsp;</p> <p>---------------&nbsp; S Y S T E M&nbsp; ---------------</p> <p>OS: Windows XP Build 2600 Service Pack 2</p> <p>CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 14 stepping 8, cmov, cx8, fxsr, mmx, sse, sse2</p> <p>Memory: 4k page, physical 1300464k(465904k free), swap 3092560k(2157304k free)</p> <p>vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct&nbsp; 5 2007 01:21:52 by "java_re" with MS VC++ 6.0</p> <p>看到就些错误日志就可以断定是由于我用Java的主函数调用本地dll文件时出了错。</p> <p>我初步推断是因为我的C++产生Java对象传给Java类后，没有回收。导致内存泄露。</p> <p>但是因为我是初学者，所以对C++控制Java还不熟，所以经过调试，C++编译通不过。由于最近考试压力</p> <p>实在太大，迫使我先暂且放下这个问题。</p> <p>但是不解决心里不爽，于是开始了搜索》》》》》》》》》》》》》》》漫长的信息检索》》》》》》》</p> <p>发现新大陆》》》》》》》》》</p> <p>以下内容，转载自<a href="http://developers.sun.com.cn/blog/yutoujava/">http://developers.sun.com.cn/blog/yutoujava/</a></p> <p>-----------------------------------------------------------------------------------------------------</p> <p>Java的应用有时候会因为各种原因Crash，这时候会产生一个类似java_errorpid.log的错误日志。可以拿到了</p> <p>这个日志，怎样分析Crash的原因呢？下面我们来详细讨论如何分析java_errorpid.log的错误日志。</p> <p>一. 如何得到这个日志文件<br /> 如果有一个严重的错误引起Java进程非正常退出，我们叫Crash，这时候会产生一个日志文件。缺省情况下，这个</p> <p>文件会产生在工作目录下。但是，可以在Java启动参数通过下面的设置，来改变这个文件的位置和命名规则。例如：<br /> java -XX:ErrorFile=/var/log/java/java_error_%p.log<br /> 就将这个错误文件放在/var/log/java下，并且以java_error_pid.log的形式出现。</p> <p>&nbsp;</p> <p>二.产生错误的原因<br /> 造成严重错误的原因有多种可能性。Java虚拟机自身的Bug是原因之一，但是这种可能不是很大。在绝大多数情况下，</p> <p>是由于系统的库文件、API或第三方的库文件造成的；系统资源的短缺也有可能造成这种严重的错误。在发生了Crash</p> <p>之后，如果无法定位根本原因，也应该迅速找到Work Around的方法。</p> <p>三.对日志文件的分析<br /> 首先要检查日志的文件头：例如，下面是从一个客户发过来的错误日志的文件头</p> <p>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<br /> #<br /> # An unexpected error has been detected by HotSpot Virtual Machine:<br /> #<br /> # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0815e87e, pid=7268, tid=4360<br /> #<br /> # Java VM: Java HotSpot(TM) Server VM (1.4.2_13-b06 mixed mode)<br /> # Problematic frame:<br /> # V [jvm.dll+0x15e87e]<br /> #<br /> －－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－</p> <p>&nbsp;</p> <p>文件头中有很多有用的信息，&#8220;EXCEPTION_ACCESS_VIOLATION &#8221;意味着Java应用Crash的时候，</p> <p>正在运行JVM自己的代码，而不是外部的Java代码或其他类库代码。这种情况很可能是JVM的Bug，但是</p> <p>也不一定。除了&#8220;EXCEPTION_ACCESS_VIOLATION &#8221;，还有可能是别的信息，例如&#8220;SIGSEGV(0xb)&#8221;，</p> <p>意味着JVM正在执行本地或JNI的代码;&#8220;EXCEPTION_STACK_OVERFLOW&#8221;意味着这是个栈溢出的错误。</p> <p>&nbsp;（**********看到这里我们知道我报错时正在运行JVM自己的代码，而不是外部的Java代码或其他类库代码*********）</p> <p>另外一个有用的信息就是：<br /> # Problematic frame:<br /> # V [jvm.dll+0x15e87e]</p> <p><br /> 它说明Crash的时候，JVM正在从哪个库文件执行代码。除了&#8220;V&#8221;以外，还有可能是&#8220;C&#8221;、&#8220;j&#8221;、&#8220;v&#8221;、&#8220;J&#8221;。具体的表示意思如下：</p> <p>FrameType Description：<br /> C: Native C frame<br /> j: Interpreted Java frame<br /> V: VMframe<br /> v: VMgenerated stub frame<br /> J: Other frame types, including compiled Java frames</p> <p>（**********看到这里我们知道我报错时是V: VMframe这种情况*********）</p> <p><br /> 文件头之后，是当前线程的DUMP信息，线程之后是JVM进程的DUMP信息，包括所有线程的状态、地址和ID。最后还有JVM状态，</p> <p>Heap状态，动态连接库等等的信息。这些烦乱的信息中，包含有非常有用的信息。下面我们根据几个具体的实例来分析Java虚拟</p> <p>机Crash的典型例子。</p> <p>四.内存回收引起的Crash<br /> 内存回收引起的Crash有以下的特点：在日志文件头一般有&#8220; EXCEPTION_ACCESS _VIOLATION&#8221;和</p> <p>&#8220;# Problematic frame: # V [jvm.dll+....&#8221;的信息，意味着这是在JVM内部处理，而且多半是JVM的Bug。</p> <p>（**********看到这里我们知道我报错时意味着这是在JVM内部处理，而且多半是JVM的Bug*********）</p> <p>对于这类问题，最快的方法就是绕过它。</p> <p>另外，在Thread的DUMP信息最后，还能看到有关内存回收的行为例如：</p> <p>--------------- T H R E A D ---------------<br /> Current thread (0x00a56668): VMThread [id=4360]<br /> siginfo: ExceptionCode=0xc0000005, reading address 0x00000057<br /> Registers:<br /> ........</p> <p>Stack: [0x03cf0000,0x03d30000), sp=0x03d2fc18, free space=255k<br /> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)<br /> V [jvm.dll+0x15e87e]</p> <p>VM_Operation (0x063efbac): full generation collection, mode: safepoint, requested by thread 0x040f83f8<br /> ------------------------------------------------------------</p> <p>可以清楚的看到JVM正在做 &#8220;full generation collection&#8221;。另外还有可能看到，其他的回收行为：</p> <p>generation collection for allocation</p> <p>full generation collection</p> <p>parallel gc failed allocation</p> <p>parallel gc failed permanent allocation</p> <p>parallel gc system gc</p> <p>（***********这些错，俺都没碰到***********）<br /> 对于内存回收的错误，一般采取改变回收的算法和参数的方法来绕过去。例如，来自客户的日志除了上面的</p> <p>日志信息，在日志中Heap信息中还能发现一些其他信息：</p> <p>--------------------------------------------------------------<br /> Heap<br /> def new generation total 22592K, used 19530K [0x10010000, 0x11890000, 0x138f0000)<br /> eden space 20096K, 97% used [0x10010000, 0x11322bd8, 0x113b0000)<br /> from space 2496K, 0% used [0x113b0000, 0x113b0000, 0x11620000)<br /> to space 2496K, 0% used [0x11620000, 0x11620000, 0x11890000)<br /> tenured generation total 190696K, used 100019K [0x138f0000, 0x1f32a000, 0x30010000)<br /> the space 190696K, 52% used [0x138f0000, 0x19a9cf38, 0x19a9d000, 0x1f32a000)<br /> compacting perm gen total 38656K, used 38588K [0x30010000, 0x325d0000, 0x34010000)<br /> the space 38656K, 99% used [0x30010000, 0x325bf038, 0x325bf200, 0x325d0000)<br /> ----------------------------------------------------------------</p> <p><br /> 上面的信息能看出在Crash的时候，JVM的PermSize空间几乎已经消耗完了，并且回收算法在压缩Perm空间的时候出了错。</p> <p>因此，建议改变内存回收的算法，或扩大PermSize和MaxPermSize的数值。</p> <p>（*******这个倒是可以尝试*******）</p> <p>五.栈溢出引起的Crash</p> <p>Java代码引起的栈溢出，通常不会引起JVM的Crash，而是抛出一个Java异常：java.lang.StackOverflowError。</p> <p>但是在Java虚拟机中，Java的代码和本地C或C++代码公用相同的Stack。这样，在执行本地代码所造成的栈溢出，</p> <p>就有可能引起JVM的Crash了。</p> <p>栈溢出引起的Crash会在日志的文件头中看到&#8220;EXCEPTION_STACK_OVERFLOW&#8221;字样。另外，在当前线程的Stack</p> <p>信息中也能发现一些信息。例如下面的例子：</p> <p>-----------------------------------------------------------------------------------<br /> # An unexpected error has been detected by HotSpot Virtual Machine:<br /> #<br /> # EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x10001011, pid=296, tid=2940<br /> #<br /> # Java VM: Java HotSpot(TM) Client VM (1.6-internal mixed mode, sharing)<br /> # Problematic frame:<br /> # C [App.dll+0x1011]<br /> #<br /> --------------- T H R E A D ---------------<br /> Current thread (0x000367c0): JavaThread "main" [_thread_in_native, id=2940]<br /> :<br /> Stack: [0x00040000,0x00080000), sp=0x00041000, free space=4k<br /> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)<br /> C [App.dll+0x1011]<br /> C [App.dll+0x1020]<br /> C [App.dll+0x1020]<br /> :<br /> C [App.dll+0x1020]<br /> C [App.dll+0x1020]<br /> ...&lt;more frames&gt;...<br /> Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)<br /> j Test.foo()V+0<br /> j Test.main([Ljava/lang/String;)V+0<br /> v ~StubRoutines::call_stub</p> <p>--------------------------------------------------------------------------------</p> <p>在上面的信息中，可以发现这是个栈溢出的错误。并且当前栈剩余的空间已经很小了(free space =4k)。</p> <p>因此建议将JVM的Stack的尺寸调大，主要设计两个参数：&#8220;-Xss&#8221; 和&#8220;-XX:StackShadowPages=n&#8221;。</p> <p>但是，将栈的尺寸调大，也意味着在有限的内存资源中，能打开的最大线程数会减少。</p> <p>&nbsp;（******俺的栈剩余还有free space=254k，显然不符，于是乎我决定假期再解决，o(&#8745;_&#8745;)o...******）</p> <p>结论：</p> <p>我觉得还是C++建立Java对象后，没有回收-----------------鉴定完毕</p> <p>&nbsp;</p> <p>不知园子里可否有人有其他的建议。欢迎提出！</p> <p>这个问题发到两个JavaQQ群都没动静，于是决定自己解决，看来越往后越要靠自己了。</p> </div></div><img src ="http://www.blogjava.net/kuuyee/aggbug/355030.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-07-26 09:49 <a href="http://www.blogjava.net/kuuyee/articles/355030.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JBoss AS7配置MySQL数据源</title><link>http://www.blogjava.net/kuuyee/archive/2011/07/19/354598.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 19 Jul 2011 02:49:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/07/19/354598.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/354598.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/07/19/354598.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/354598.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/354598.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: AS7默​认​的​数​据​源​是​H2，虽​然​H2方​便​，但​是​一​般​的​生​产​环​境​都​是​MySQL、​ORACLE、​SQLServer居​多​，本​文​描​述​如​何​在​AS7配​置​MySQL数​据​源​。&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/07/19/354598.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/354598.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-07-19 10:49 <a href="http://www.blogjava.net/kuuyee/archive/2011/07/19/354598.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JBoss AS7 发布</title><link>http://www.blogjava.net/kuuyee/archive/2011/07/13/354224.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Wed, 13 Jul 2011 01:43:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/07/13/354224.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/354224.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/07/13/354224.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/354224.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/354224.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 今天登陆jboss官网,结果一个巨幅的JBoss AS7的发布宣传广告呈现在眼前!&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/07/13/354224.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/354224.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-07-13 09:43 <a href="http://www.blogjava.net/kuuyee/archive/2011/07/13/354224.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaEE6 FAQs 之@Model</title><link>http://www.blogjava.net/kuuyee/archive/2011/07/12/354161.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 12 Jul 2011 06:14:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/07/12/354161.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/354161.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/07/12/354161.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/354161.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/354161.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: JavaEE6 FAQs @Model注​解​的​用​途​&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/07/12/354161.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/354161.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-07-12 14:14 <a href="http://www.blogjava.net/kuuyee/archive/2011/07/12/354161.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(翻译)JavaEE6规范 CDI教程第五部分</title><link>http://www.blogjava.net/kuuyee/archive/2011/07/12/354145.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 12 Jul 2011 02:38:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/07/12/354145.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/354145.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/07/12/354145.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/354145.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/354145.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本​部​分​讲​述​使​用​多​个​@Qualifiers来​进​一​步​区​分​注​入​类​型&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/07/12/354145.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/354145.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-07-12 10:38 <a href="http://www.blogjava.net/kuuyee/archive/2011/07/12/354145.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(翻译)JavaEE6规范 CDI教程第四部分</title><link>http://www.blogjava.net/kuuyee/archive/2011/06/28/353291.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 28 Jun 2011 10:26:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/06/28/353291.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/353291.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/06/28/353291.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/353291.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/353291.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本​部​分​讲​述​@Producer&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/06/28/353291.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/353291.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-06-28 18:26 <a href="http://www.blogjava.net/kuuyee/archive/2011/06/28/353291.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Maven项目常见问题实战(一) 解决相互依赖</title><link>http://www.blogjava.net/kuuyee/archive/2011/06/28/353158.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 28 Jun 2011 04:40:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/06/28/353158.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/353158.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/06/28/353158.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/353158.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/353158.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 很​多​时​候​随​着​项​目​的​膨​胀​，模​块​会​越​来​越​多​，如​果​设​计​上​ 稍​有​不​慎​就​会​出​现​模​块​之​间​相​互​依​赖​的​情​况​。​这​对​于​使​用​Maven的​用​户​是​比​较​痛​苦​的​，因​为​出​现​模​块​之​间​相​互​依​赖​的​话​在​构​建​的​时​候​就​会​失​败​，Maven通​常​要​先​编​译​被​依​赖​的​模​块​，如​果​出​现​相​互​依​赖​Maven就​不​知​道​该​怎​么​办​了​。​本文讲述如何解决Maven项目间的相互依赖.&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/06/28/353158.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/353158.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-06-28 12:40 <a href="http://www.blogjava.net/kuuyee/archive/2011/06/28/353158.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(翻译)JavaEE6规范 CDI教程第三部分</title><link>http://www.blogjava.net/kuuyee/archive/2011/06/20/352650.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Mon, 20 Jun 2011 03:43:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/06/20/352650.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/352650.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/06/20/352650.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/352650.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/352650.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本​部​分​讲​述​@Alternative和​@Qualfiers&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/06/20/352650.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/352650.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-06-20 11:43 <a href="http://www.blogjava.net/kuuyee/archive/2011/06/20/352650.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(翻译)JavaEE6规范 CDI教程第二部分</title><link>http://www.blogjava.net/kuuyee/archive/2011/06/17/352490.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Fri, 17 Jun 2011 03:10:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/06/17/352490.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/352490.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/06/17/352490.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/352490.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/352490.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本​部​分​讲​述​@Inject和​@Produces<br>&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/06/17/352490.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/352490.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-06-17 11:10 <a href="http://www.blogjava.net/kuuyee/archive/2011/06/17/352490.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(翻译)JavaEE6规范 CDI教程第一部分</title><link>http://www.blogjava.net/kuuyee/archive/2011/06/16/352421.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Thu, 16 Jun 2011 06:03:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/06/16/352421.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/352421.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/06/16/352421.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/352421.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/352421.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 此​教​程​讲​述​DI(依​赖​注​入​)，并​且​涵​盖​了​CDI(上​下​文​依​赖​注​入​)的​一​些​特​性​，比​如​类​型​安​全​注​解​配​置​、​替​换​选​择​等​内​容​。​<br>CDI是​依​赖​注​入​(DI)和​拦​截​(AOP)的​Java标​准​规​范​。​DI和​AOP有​着​很​高​的​知​名​度​，Java需​要​处​理​DI和​AOP以​便​在​此​之​上​构​建​其​它​的​标​准​。​DI和​AOP是​很​多​Java框​架​的​基​础​。​<br>CDI是​JavaEE 6的​基​础​。​它​很​快​就​得​到​了​Caucho's Resin、​IBM's WebSphere、​Oracle's Glassfish、​Red Hat's JBoss和​众​多​应​用​服​务​器​的​支​持​。​CDI与​Spring和​Guice框​架​非​常​相​似​，就​像​JPA很​像​ORM。​CDI简​化​了​对​于​DI和​AOP的​API。​如​果​你​使​用​过​Spring或​者​Guice，你​会​发​现​CDI更​容​易&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/06/16/352421.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/352421.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-06-16 14:03 <a href="http://www.blogjava.net/kuuyee/archive/2011/06/16/352421.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ceylon语言介绍第一部分（翻译）——Hibernate之父的又一力作</title><link>http://www.blogjava.net/kuuyee/archive/2011/05/24/350885.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Mon, 23 May 2011 23:25:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/05/24/350885.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/350885.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/05/24/350885.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/350885.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/350885.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Hibernate之父闭关两年后推出的又一力作——JVM语言 Ceylon<br>Ceylon是一门新的语言，它运行在Java虚拟机上，目前正有我所在的小组开发，它隶属于RedHat。我们都是Java和Java生态系统的粉丝，因为它的实用性、广阔的文化氛围和开发社区、天生适用于商业应用以及可移植性。然而我们必须承认这门语言和其现有的类库，已经过了15年的发展，它不能再提供更好的功能来解决现在的商业问题。&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/05/24/350885.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/350885.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-05-24 07:25 <a href="http://www.blogjava.net/kuuyee/archive/2011/05/24/350885.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一条命令搞定svg批量格式转换</title><link>http://www.blogjava.net/kuuyee/archive/2011/05/17/350370.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 17 May 2011 01:12:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/05/17/350370.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/350370.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/05/17/350370.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/350370.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/350370.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: ,抽时间试用了一下Gnome3，发现默认主题的图标超漂亮，就下载了一套。结果打开一看，竟然全是SVG格式，虽然使用Adobe提供的SVG Viewer可以查看,但是只能一个一个的看，不能批量浏览。费了很多时间查找SVG批量格式转换的软件，结果不是收费就是不能批量处理，很是郁闷，最后没辙了，只好使用Linux提供的ImageMagick(现在ImageMagicK也有Windows版本,懒得装了)。ImageMagick真是难以置信的强大,一条命令就可以搞定SVG到PNG格式的批量转换:&nbsp;&nbsp;<a href='http://www.blogjava.net/kuuyee/archive/2011/05/17/350370.html'>阅读全文</a><img src ="http://www.blogjava.net/kuuyee/aggbug/350370.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-05-17 09:12 <a href="http://www.blogjava.net/kuuyee/archive/2011/05/17/350370.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Linux下列出所有子目录及磁盘占用情况</title><link>http://www.blogjava.net/kuuyee/archive/2011/04/25/348985.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Mon, 25 Apr 2011 09:46:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/04/25/348985.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/348985.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/04/25/348985.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/348985.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/348985.html</trackback:ping><description><![CDATA[今天<a href="http://jenkins-ci.org/">Jenkins</a>(以前叫Hudson)CI服务器突然挂了，排查了半天发现磁盘已经100%，真后悔当初没把磁盘设大点，其实可以用LVM调整一下，但是心里还是没底，怕把数据都丢失了，决定以后再调整磁盘分配。目前先吧Jenkins下没用的项目都干掉，可以腾出很多空间。<br />
<br />
我们都知道使用<strong><span style="color: #0000cd">du</span></strong>命令可以查看目录，例如查看<span style="color: #0000cd"><strong>/home/kuuyee</strong></span>目录占用磁盘空间大小可以使用下面的命令：<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080">1</span><img alt="" align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" /><span style="color: #000000">root@pm</span><span style="color: #000000">-</span><span style="color: #000000">ubuntu:</span><span style="color: #000000">~</span><span style="color: #008000">#</span><span style="color: #008000">&nbsp;du&nbsp;/home/kuuyee&nbsp;-sh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000"><br />
</span><span style="color: #008080">2</span><span style="color: #008000"><img alt="" align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" /></span><span style="color: #000000">333M&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000">/</span><span style="color: #000000">home</span><span style="color: #000000">/</span><span style="color: #000000">kuuyee</span></div>
<br />
但是有个问题，我的Jenkins目录下有上百个构建项目，一个一个的差看目录占用情况太麻烦了，google了一下找到一个办法：<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080">1</span><img alt="" align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" /><span style="color: #000000">root@pm</span><span style="color: #000000">-</span><span style="color: #000000">ubuntu:</span><span style="color: #000000">~</span><span style="color: #008000">#</span><span style="color: #008000">&nbsp;du&nbsp;/home&nbsp;--max-depth=1&nbsp;-h</span><span style="color: #008000"><br />
</span><span style="color: #008080">2</span><span style="color: #008000"><img alt="" align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" /></span><span style="color: #000000">125M&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000">/</span><span style="color: #000000">home</span><span style="color: #000000">/</span><span style="color: #000000">linux<br />
</span><span style="color: #008080">3</span><span style="color: #000000"><img alt="" align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" />333M&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000">/</span><span style="color: #000000">home</span><span style="color: #000000">/</span><span style="color: #000000">kuuyee<br />
</span><span style="color: #008080">4</span><span style="color: #000000"><img alt="" align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" />457M&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000">/</span><span style="color: #000000">home</span></div>
<br />
这样的话就吧所有的子目录的磁盘占用情况都列出来了!这里的<span style="color: #0000cd"><strong>--max-depth</strong></span>参数代表着要列出目录的深度，如果要列出两级目录就设置为<span style="color: #b22222"><strong>2</strong></span>，以此类推。<br />
如果想吧结果输出到文件里可以这样：<br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><span style="color: #008080">1</span><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" alt="" /><span style="color: #000000">root@pm</span><span style="color: #000000">-</span><span style="color: #000000">ubuntu:</span><span style="color: #000000">~</span><span style="color: #008000">#</span><span style="color: #008000">&nbsp;du&nbsp;/home&nbsp;--max-depth=1&nbsp;-h&nbsp;&gt;&nbsp;disk_status.txt</span></div>
<br />
<p>下面给出du命令的用法及参数说明：</p>
<p style="font-size: 12pt"><strong>用法：du [选项]&#8230; [文件]&#8230;<br />
或：du [选项]&#8230; &#8211;files0-from=F<br />
总结每个&lt;文件&gt;的磁盘用量，目录则取总用量。</strong></p>
<p><strong>参数含义如下：</strong><br />
<span style="color: #0000cd"><strong>-s</strong></span> 对每个Names参数只给出占用的数据块总数。<br />
<span style="color: #0000cd"><strong>-a</strong></span> 递归地显示指定目录中各文件及子孙目录中各文件占用的数据块数。若既不指定-s，也不指定-a，则只显示Names中的每一个目录及其中的各子目录所占的磁盘块数。<br />
<span style="color: #0000cd"><strong>-b</strong></span> 以字节为单位列出磁盘空间使用情况（系统缺省以 k 字节为单位）。<br />
<span style="color: #0000cd"><strong>-k</strong></span> 以1024字节为单位列出磁盘空间使用情况。<br />
<span style="color: #0000cd"><strong>-c</strong></span> 最后再加上一个总计（系统缺省设置）。<br />
<span style="color: #0000cd"><strong>-l</strong></span> 计算所有的文件大小。</p><img src ="http://www.blogjava.net/kuuyee/aggbug/348985.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-04-25 17:46 <a href="http://www.blogjava.net/kuuyee/archive/2011/04/25/348985.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>批处理中获取当前路径</title><link>http://www.blogjava.net/kuuyee/archive/2011/04/22/348762.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Fri, 22 Apr 2011 01:37:00 GMT</pubDate><guid>http://www.blogjava.net/kuuyee/archive/2011/04/22/348762.html</guid><wfw:comment>http://www.blogjava.net/kuuyee/comments/348762.html</wfw:comment><comments>http://www.blogjava.net/kuuyee/archive/2011/04/22/348762.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/kuuyee/comments/commentRss/348762.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kuuyee/services/trackbacks/348762.html</trackback:ping><description><![CDATA[<strong>废话不多说,直接看例子：<br />
</strong>
<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #008080;">1</span>&nbsp;<span style="color: #800080;">@echo</span><span style="color: #000000;">&nbsp;off<br />
</span><span style="color: #008080;">2</span>&nbsp;<span style="color: #000000;">echo&nbsp;当前盘符：</span><span style="color: #000000;">%~</span><span style="color: #000000;">d0<br />
</span><span style="color: #008080;">3</span>&nbsp;<span style="color: #000000;">echo&nbsp;当前盘符和路径：</span><span style="color: #000000;">%~</span><span style="color: #000000;">dp0<br />
</span><span style="color: #008080;">4</span>&nbsp;<span style="color: #000000;">echo&nbsp;当前批处理全路径：</span><span style="color: #000000;">%~</span><span style="color: #000000;">f0<br />
</span><span style="color: #008080;">5</span>&nbsp;<span style="color: #000000;">echo&nbsp;当前盘符和路径的短文件名格式：</span><span style="color: #000000;">%~</span><span style="color: #000000;">sdp0<br />
</span><span style="color: #008080;">6</span>&nbsp;<span style="color: #000000;">echo&nbsp;当前CMD默认目录：</span><span style="color: #800080;">%cd</span><span style="color: #000000;">%</span><span style="color: #000000;"><br />
</span><span style="color: #008080;">7</span>&nbsp;<span style="color: #000000;">pause</span></div><img src ="http://www.blogjava.net/kuuyee/aggbug/348762.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kuuyee/" target="_blank">kuuyee</a> 2011-04-22 09:37 <a href="http://www.blogjava.net/kuuyee/archive/2011/04/22/348762.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>