﻿<?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-学海拾遗</title><link>http://www.blogjava.net/tanzek/</link><description>生活、技术、思想无处不在学习
</description><language>zh-cn</language><lastBuildDate>Mon, 13 Apr 2026 19:52:29 GMT</lastBuildDate><pubDate>Mon, 13 Apr 2026 19:52:29 GMT</pubDate><ttl>60</ttl><item><title>添加一个二路冒泡算法</title><link>http://www.blogjava.net/tanzek/archive/2009/02/21/255944.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sat, 21 Feb 2009 06:16:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2009/02/21/255944.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/255944.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2009/02/21/255944.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/255944.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/255944.html</trackback:ping><description><![CDATA[
		<p>看Robert Sedgewick的《algorithms in c》一书时，在讲到冒泡算法的时候在练习中提到了“摇摆排序”（中文版书中的P206面的第30题），然而细细理解出来就是指的二路冒泡，其实在Donald E.Knuth的《计算机程序设计艺术 第三卷 排序与查找》里面也有讲过，名字记得不是很清楚了。<br />暂时来讲我自己实现了一个，里面的性能分析和调优留在以后再做，先把它放在这里和大家一起共享一下，欢迎指正。<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000">
						<br />* by tanzek. 2009-02-21 .  <br />* implement in dev cpp.<br /></span>
				<span style="COLOR: #008000">*/</span>
				<span style="COLOR: #000000">
						<br />
						<br />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdlib.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> n 10</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> print(</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">a, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> m, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> l, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> r)<br />{<br />    </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">(</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; i</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">m; i</span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">)<br />    {<br />        printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, a[i]);        <br />    }     <br />    printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">---&gt;l=%d, r=%d\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, l, r);<br />}<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> count </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br />{<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> a[</span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000">] </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {</span>
				<span style="COLOR: #000000">104</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">21</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">33</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">8</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">102</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">7</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">89</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">91</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">11</span>
				<span style="COLOR: #000000">};<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> l, r;<br />    l </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; r </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> n;<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> t </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> temp;<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> j;<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">(t </span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">)<br />    {<br />        count </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">;<br />        printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">第%d趟\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, count);<br />         <br />        t </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">(j</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">r</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; j</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">l</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; j</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000">)<br />        {<br />            </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">(a[j] </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> a[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">])<br />            {<br />                temp</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">a[j]; a[j]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">a[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">]; a[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">temp;<br />                t </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> j </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />            }<br />        }<br />        l </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> j;<br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">(j</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">l</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; j</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">r</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; j</span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">)<br />        {<br />            </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">(a[j] </span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> a[j</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">])<br />            {<br />                temp</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">a[j]; a[j]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">a[j</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">]; a[j</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">temp;<br />                t </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> j</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />            }<br />        }<br />        r </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> j;<br />        print(a, n, l, r);<br />    }<br />    <br />    printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">\ncount = %d\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, count);<br />    system(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">PAUSE</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">);<br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />}<br /></span>
		</div>
		<br />同时，通过GOOGLE搜索，也搜到一篇二路冒泡算法实现的文章，也放在这里供大家一起参考。<br />武林外传 <a href="http://qzone.qq.com/blog/53631006-1210520905">http://qzone.qq.com/blog/53631006-1210520905</a><img src ="http://www.blogjava.net/tanzek/aggbug/255944.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2009-02-21 14:16 <a href="http://www.blogjava.net/tanzek/archive/2009/02/21/255944.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>看看骗子的行径！~   [图解]</title><link>http://www.blogjava.net/tanzek/archive/2008/11/28/243191.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Fri, 28 Nov 2008 03:55:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/11/28/243191.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/243191.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/11/28/243191.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/243191.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/243191.html</trackback:ping><description><![CDATA[
		<p>1、首先是加为好友，一般会冒充为官方工作组<br />2、发送信息<br /><img height="420" alt="1.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/ArticleImgs/1.jpg" width="385" border="0" /><br />3、登陆网站<br /><img height="614" alt="2.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/ArticleImgs/2.jpg" width="819" border="0" /><br />4、填入信息<br /><img height="717" alt="3.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/ArticleImgs/3.jpg" width="806" border="0" /><br />5、提示中奖<br /><img height="614" alt="4.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/ArticleImgs/4.jpg" width="819" border="0" /></p>
		<p>
				<img height="614" alt="5.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/ArticleImgs/5.jpg" width="819" border="0" />
		</p>
		<p>6、付钱领奖<br /><img height="614" alt="6.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/ArticleImgs/6.jpg" width="819" border="0" /></p>
		<p>上面就是一个骗子网站的常用过程。识别整个过程的关键是：<a href="http://www.cdreasm.cn/">http://www.cdreasm.cn/</a>，与官方cdream有一字之差。现在这社会就是这样，越是做得像就肯定不是，不要怀疑你的感觉。这里贴出来，供大家娱乐，笑一下！~</p>
<img src ="http://www.blogjava.net/tanzek/aggbug/243191.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-11-28 11:55 <a href="http://www.blogjava.net/tanzek/archive/2008/11/28/243191.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Apache和Tomcat整合</title><link>http://www.blogjava.net/tanzek/archive/2008/11/28/243129.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Thu, 27 Nov 2008 17:56:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/11/28/243129.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/243129.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/11/28/243129.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/243129.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/243129.html</trackback:ping><description><![CDATA[在之前的日子里面，使用SSH架在TOMCAT上面写了一个小项目，但是部门里最经常使用的是Apache+PHP，因此为了能够不开放更多的端口，就想试验下以前听过的将Apache和Tomcat进行整合。<br />在整合过程中，参考了很多内容，我都一一放在此文的末尾，供大家一起参阅。<br />其实本文的目标比较小，经过一些简单的了解后，可以使用Tomcat中的AJP监听端口来进行整合。但是查阅后才得知，使用此种方法还可以进行均衡负载（load-balancing）、失效备援（failover）等，但这里因为我还没有实践成功过，因此仅将本次操作的部分进行总结。<br /><br /><b>试验软件：</b><br />Apache 2.2.10<br />Tomcat 6.0.18<br /><br /><b>1、加入Apache中的mod_proxy支持</b><br />因为在Apache 2.2开始，使用mod_proxy_ajp来支持<code>Apache JServ Protocol version 1.3</code>了。所以，在这里我们只需启用此模块。当然为了更方便地进行代理，也可以把mod_proxy_相关的一些其它模块一起启用，在Apache中的httpd.conf如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">LoadModule proxy_module modules</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mod_proxy.so<br />LoadModule proxy_ajp_module modules</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mod_proxy_ajp.so<br />LoadModule proxy_balancer_module modules</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mod_proxy_balancer.so<br />LoadModule proxy_connect_module modules</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mod_proxy_connect.so<br />LoadModule proxy_ftp_module modules</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mod_proxy_ftp.so<br />LoadModule proxy_http_module modules</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mod_proxy_http.so</span></div>将这些项前面的#号去掉就可以了。<br /><br /><b>2、在Tomcat中配置AJP监听选项</b><br />在Tomcat中，默认就已经开放了AJP的监听选项，同时还开放了一个监听non-SSL HTTP/1.1的Connector，如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Connector port</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">8080</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> protocol</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">HTTP/1.1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> <br />               connectionTimeout</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">20000</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> <br />               redirectPort</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">8443</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Connector port</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">8009</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> protocol</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">AJP/1.3</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> redirectPort</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">8443</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/&gt;</span></div>在上面的配置中，就可以看出AJP的监听端口在8009上，HTTP/1.1浏览器监听在8080端口上。关于Connector的定义、配置及与其它元素之间的关系，大家可参考Apache Tomcat的官方文档，有对结构的完整描述<sup>[1]</sup>。<br />同时，还需要设置jvmRoute来支持通过AJP的负载均衡，如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Engine name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Catalina</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> defaultHost</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">localhost</span><span style="color: rgb(0, 0, 0);">"</span><b><font color="#0000ff"><span style="color: rgb(0, 0, 0);"> jvmRoute</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">tomcat1</span><span style="color: rgb(0, 0, 0);">"</span></font></b><span style="color: rgb(0, 0, 0);">&gt;</span></div>在上述位置加入粗体部分的内容。<br /><br /><b>3、Apache最后配置</b><br />通过上面的步骤，我们就是要确定使用Apache的反向代理，将请求转至Tomcat的AJP监听端口上来正确处理。在Apache的httpd.conf中更改如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">IfModule dir_module</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    DirectoryIndex index.html<font color="#0000ff"> <b><font color="#000000">index.jsp</font></b></font><br /></span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">IfModule</span><span style="color: rgb(0, 0, 0);">&gt;</span></div>在上述元素节点中，加入粗体部分的文字内容，表示增加index.jsp作为默认首页。<br />同时可在最后加入如下内容：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">ProxyRequests Off<br />ProxyPass </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);"> balancer:</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">cluster/</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">proxy balancer:</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">cluster&gt;</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    BalancerMember ajp:</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">127.0.0.1:8009 loadfactor=1 route=tomcat1</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">proxy</span><span style="color: rgb(0, 0, 0);">&gt;</span></div>注意其中的8009是与第1步中的AJP监听端口相对应，后面的route是与第1步中的jvmRoute相对应。<br /><br />4、设置完成后，重新启动Apache和Tomcat。<br />这样子就成功了。<br /><br />本次参考了大量的内容，主要有如下：<br />1、Apache Tomcat Architecture，<a target="_blank" href="http://tomcat.apache.org/tomcat-6.0-doc/architecture/index.html">http://tomcat.apache.org/tomcat-6.0-doc/architecture/index.html</a><br />2、Graham King：High availability Tomcat - Connect Tomcat servers to Apache and to each other to keep your site running，<a target="_blank" href="http://www.roseindia.net/software-tutorials/detail/6135">http://www.roseindia.net/software-tutorials/detail/6135</a>，JavaWorld.com，2004-12-20<br />3、魏杰：Apache负载均衡+Tomcat集群，<a target="_blank" href="http://weijie.blog.51cto.com/340746/68195">http://weijie.blog.51cto.com/340746/68195</a>，2008-03-26<br />4、heavyz：Tomcat启动分析，<a target="_blank" href="http://docs.huihoo.com/apache/tomcat/heavyz/01-startup.html">http://docs.huihoo.com/apache/tomcat/heavyz/01-startup.html</a>，2003-03-22<br />还有很多参考没办法列出来，在此对他们表示非常感谢。<br /><img src ="http://www.blogjava.net/tanzek/aggbug/243129.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-11-28 01:56 <a href="http://www.blogjava.net/tanzek/archive/2008/11/28/243129.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>TAOCP之排序算法（一）</title><link>http://www.blogjava.net/tanzek/archive/2008/11/22/241925.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Fri, 21 Nov 2008 20:37:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/11/22/241925.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/241925.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/11/22/241925.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/241925.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/241925.html</trackback:ping><description><![CDATA[这一段时间都在看TAOCP的排序算法，这些都是我大学生活里面很想看却没看到的部分，同时也为了巩固实践，把它们都写出程序来了。供自己复习之用，也希望能与网友分享。如果有什么问题，还请各位网友能够指正出来。<br /><br />一、计数排序（位于TAOCP第三卷中的内部排序前面的内容中，是高德纳先生讲的第一种类型的排序方法，其适应面比较窄，但却是很有效。同时可以证明此算法是稳定的）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> a数组存储输入数据，count数组用来计数</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">N</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />    </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> j</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">i</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; j</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">N; j</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />         </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(a[i] </span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> a[j]) {<br />             count[i] </span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">;        <br />         } </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> {<br />             count[j] </span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">;       <br />         }<br />    }        <br />}<br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> b数组用于存储排序后的数据</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">N; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />    b[count[i]] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> a[i];<br />}</span></div><br />如果说上面的程序属于“比较计数”[引自TAOCP]的话，那么还有一种方法就是“分布计数”[引自TAOCP]了。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">N; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />    count[a[i]</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">;<br />}<br /></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">u; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">v; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />    count[i] </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> count[i</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">];            </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 其中count[v-1]=N，且count的下标从u-1至v-1 </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">}<br /></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">N</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&gt;=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">) {<br />    b[count[a[i]</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  a[i];     </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> b的下标从0至N-1 </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    count[a[i]</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">;<br />}</span></div>需要注意的是，在“分布计数”中的count与“比较计数”中的count的计数方式有一点点不同，所以在最终转换成排序后的数组时也有不同的处理。而且，在“分布计数”中，要求各个记录的键码值最好满足一定的分布条件[u,v]，全都在一个比较整齐的区间内。也可以证明，此排序算法是稳定的，主要就是在构成排序数组b时采用的循环是倒序，如果是顺序的话，那就不同了。<br /><br />二、比较排序（这也是TAOCP书中讲的第一类排序方法，也是各类数据结构或算法教材必须涉及到的一类算法，过多的解释就无需展开了，让我们来直接用程序对话。）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">N; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />    </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> r </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> a[i];<br />    </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br />    </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(r </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> a[j] </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> j </span><span style="color: rgb(0, 0, 0);">&gt;=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) {<br />        a[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> a[j];<br />        j </span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">;<br />    }<br />    a[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> r;<br />}</span></div>上面这个是顺序表的直接插入方法，针对于2~N的各个记录，用直接寻找最佳位置的方式来进行排序，寻找过程可以和移动过程（顺序表独有）结合起来，以节省时间。在这种方式下，其实最好采用表方式进行存储。在TAOCP一书中还提到，如果结合二叉插入或“两路”插入的方法，可以进一步节省时间，但是其实质上还是会得不到最终的改善。<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> h[</span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">};       </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> shell排序每步步长 </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> ih</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; ih</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">; ih</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />    </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">h[ih]; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">N; i</span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);">h[ih]) {<br />        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> r </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> a[i];<br />        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> h[ih];<br />        </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(r </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> a[j] </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> j</span><span style="color: rgb(0, 0, 0);">&gt;=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) {<br />            a[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">h[ih]] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> a[j];<br />            j </span><span style="color: rgb(0, 0, 0);">-=</span><span style="color: rgb(0, 0, 0);"> h[ih];           <br />        }<br />        a[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">h[ih]] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> r;<br />    }<br />}</span></div>结合多步长跳跃方式和直接插入方法，就构成了Shell排序方法，也叫做“减少增量的排序”[引自TAOCP]。选择一个较好的增量序列来作为步长，在上述程序中就是h数组，优点是对直接插入方法会有实质性的改进。<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> t </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> N</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;  </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">  已经排好序的最低元素下标-1 </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> temp;<br /></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> s;<br /></span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(t </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) {<br />    s </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> t;<br />    t </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br />    </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">s; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {     </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 如果t以上的元素都已经排好序，则无需再排序了 </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(a[i] </span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> a[i</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">]) {<br />            temp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> a[i];<br />            a[i] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> a[i</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">];<br />            a[i</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> temp;<br />            t </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> i;<br />        }<br />    }<br />}</span></div>上面这个程序是冒泡排序方法，在TAOCP书中讲是第二类排序算法，通过“交换”或“换位”方法来实现。在程序中，t变量是相当于选择最后（假设每一次都是把大元素往后移动）还要排序元素的下标，因此对于t以后的元素就无须再去比较和考察了。因此，冒泡排序也可称为“交换选择”或“扩散”等。<br /><br />因为看书的进度比较慢，这些程序就是我先根据算法原理实现了的。后续还有很多排序和查找算法，我还要进一步学习。同时，有关这些算法的优缺点和分析需要做进一步探讨，欢迎各位网友能与多一起学习这等重要基础性知识。我的邮箱地址是：tanzek@gmail.com<br /><img src ="http://www.blogjava.net/tanzek/aggbug/241925.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-11-22 04:37 <a href="http://www.blogjava.net/tanzek/archive/2008/11/22/241925.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]How to Remove Firewall Included in Windows XP</title><link>http://www.blogjava.net/tanzek/archive/2008/11/01/238023.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sat, 01 Nov 2008 05:45:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/11/01/238023.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/238023.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/11/01/238023.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/238023.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/238023.html</trackback:ping><description><![CDATA[
		<p>
				<font color="#ff0000" size="2">因为工作需要，所以需要移除Windows XP Sp2自带的防火墙，找到了这篇文章。</font>
				<br />
		</p>
		<p>Windows Firewall, as the name suggests, creates a protective wall
between your computer and the external traffic coming on to it.
Firewall helps in restricting and monitoring information that is
transferred between your computer and external sources such as a
network or the Internet. Configuring a firewall helps in preventing
unauthorized access to your computer and prevents malicious use of your
computer by hackers. On a Windows XP Service Pack 2 PC, the Windows
Firewall is enabled and turned on by default. In this article, we will
discuss the steps to remove firewall from your computer.</p>
		<p>
				<strong>Need to Remove Firewall?</strong>
		</p>
		<p>You may need to remove firewall, for one of the following reasons:</p>
		<ul>
				<li>You have installed another third-party firewall on your computer and the two firewalls are conflicting with each other.</li>
				<li>The installation of Windows Firewall is corrupt and you want to
remove it completely from your computer to fix the problem and
reinstall the Firewall again.</li>
				<li>Your computer is never connected to a network or the Internet and
you want to get rid of all services that you do not need on your
computer.</li>
		</ul>
		<p>
				<strong>Steps to Remove Firewall</strong>
		</p>
		<p>Windows Firewall removal is primarily a three-step process:</p>
		<ol>
				<li>Disable the firewall.</li>
				<li>Stop the firewall.</li>
				<li>Remove all the files of the firewall.</li>
		</ol>
		<p>To disable and stop the Firewall, perform the following steps:</p>
		<ol>
				<li>Open <strong>Start</strong> menu and select <strong>Control</strong><strong>Panel</strong>.</li>
				<li>Select the <strong>Performance</strong><strong>and</strong><strong>Maintenance</strong> link and then select the <strong>Administrative</strong> Tools link.</li>
				<li>Next, double-click on the <strong>Services</strong> option.</li>
				<li>In the <strong>Services</strong> management console window, right-click on the <strong>Windows Firewall/Internet Connection Sharing (ICS)</strong> service and select <strong>Properties</strong>.</li>
				<li>In the properties dialog box that is displayed, select the <strong>Disabled</strong> option from the Startup type list and click on the <strong>Stop</strong> button.</li>
				<li>Select <strong>Apply</strong> to confirm your changes and click <strong>OK</strong> to exit the properties dialog box.</li>
		</ol>
		<p>To remove all files and registry entries related to the Firewall on your computer, perform the following steps:</p>
		<ol>
				<li>On <strong>Start</strong> &gt; <strong>Run</strong> type <strong>cmd</strong> and press <strong>Enter</strong> to open the Command Prompt window.</li>
				<li> In the Command Prompt window, run the following command and press <strong>Enter</strong>.</li>
		</ol>
		<p>
				<strong>sc delete SharedAccess</strong>
		</p>
		<p>Running this command removes all files and registry entries related
to the firewall service from your computer, and enables you to
completely remove firewall from your computer.</p>
		<p>
				<strong>Reinstall Windows Firewall</strong>
		</p>
		<p>Now, if you wanted to remove firewall only to fix certain errors, or
you want to reinstall the firewall later, then run the following
commands one after another at Command Prompt.</p>
		<p>
				<strong>rundll32 setupapi,InstallHinfSection Ndi-Steelhead 132 %windir%\inf\netrass.inf</strong>
		</p>
		<p>
				<strong>netsh firewall reset</strong>
		</p>
		<p>Next, exit the Command Prompt window and open the Control Panel. Here, double-click on the Windows Firewall option. Click <strong>Yes</strong>
when a message is prompted asking you if you want to start the Windows
Firewall/Internet Connection haring (ICS) service. When you select<strong> Yes</strong>, the service is started and the Windows Firewall dialog is displayed that you can use to configure your firewall.</p>
		<p>If this does not enable you to restore the firewall, you may need to
reinstall Windows XP SP2, which includes the installation for the
Firewall. You may also opt to perform System Restore and revert your
computer back to the time when the Windows Firewall still existed on
your computer.</p>
		<p>Traceback: <a href="http://www.instant-registry-fixes.org/how-to-remove-firewall-included-in-windows-xp/">http://www.instant-registry-fixes.org/how-to-remove-firewall-included-in-windows-xp/</a><br /></p>
<img src ="http://www.blogjava.net/tanzek/aggbug/238023.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-11-01 13:45 <a href="http://www.blogjava.net/tanzek/archive/2008/11/01/238023.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[译]Dynarch Navigation Bar</title><link>http://www.blogjava.net/tanzek/archive/2008/10/21/235580.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Tue, 21 Oct 2008 00:45:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/10/21/235580.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/235580.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/10/21/235580.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/235580.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/235580.html</trackback:ping><description><![CDATA[<p><span style="font-size: 10pt; color: red">注：毕业设计和工作中多次接触到这个Dynarch Navigation Bar，其文档是英文的，但因一些原因，在这里翻译了一下它的一小部分，原文地址是：<a href="http://www.dynarch.com/demos/NavBar/">http://www.dynarch.com/demos/NavBar/</a>，如有不当之处还请各位读友指正。<br />
</span><br />
</p>
<p style="word-break: break-all; text-align: left" align="left"><strong><span style="font-size: 24pt; font-family: 宋体">Dynarch</span></strong><strong><span style="font-size: 24pt; font-family: 宋体">导航栏</span></strong></p>
<ul type="disc">
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体"><a href="http://www.blogjava.net/tanzek/admin/EditPosts.aspx?catid=35367#安装说明">安装说明</a> - </span><span style="font-size: 12pt; font-family: 宋体">如何安装在您的网站上。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体"><a href="http://www.blogjava.net/tanzek/admin/EditPosts.aspx?catid=35367#Navbar的定制">定制</a> - </span><span style="font-size: 12pt; font-family: 宋体">改变外观和感觉。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><u><span style="font-size: 12pt; color: blue; font-family: 宋体">支持</span></u><span style="font-size: 12pt; font-family: 宋体"> - 如果发生什么错误，请与我们联系。</span> </li>
</ul>
<p style="word-break: break-all; text-align: left" align="left"><strong><span style="font-size: 18pt; font-family: 宋体">License</span></strong><strong><span style="font-size: 18pt; font-family: 宋体">许可</span></strong></p>
<p style="word-break: break-all; text-align: left" align="left"><u><span style="font-size: 12pt; color: blue; font-family: 宋体"><a title="打开新窗口" href="http://203.208.35.101/translate_c?hl=zh-CN&amp;sl=en&amp;tl=zh-CN&amp;u=http://www.dynarch.com/demos/NavBar/license.html&amp;usg=ALkJrhiOysLWpXuVY0Qp16B-bycJ2VRN2g" target="_blank">请阅读在这里的许可文</a></span></u><u><span style="font-size: 12pt; color: blue; font-family: 宋体">本</span></u><span style="font-size: 12pt; font-family: 宋体">。</span></p>
<p style="word-break: break-all; text-align: left" align="left"><strong><span style="font-size: 18pt; font-family: 宋体">Navbar</span></strong><strong><span style="font-size: 18pt; font-family: 宋体">的概况</span></strong></p>
<p style="word-break: break-all; text-align: left" align="left"><span style="font-size: 12pt; font-family: 宋体">我们的DHTML导航栏是一个多用途的类似Windows XP的资源管理器菜单的DHTML&#8220;组件&#8221;<a href="http://203.208.35.101/translate_c?hl=zh-CN&amp;sl=en&amp;tl=zh-CN&amp;u=http://www.dynarch.com/demos/NavBar/samples/winxp.html&amp;usg=ALkJrhj61FrnG7ojpnWl0lthaVEYF3n7ow"><span style="color: windowtext; text-decoration: none; text-underline: none">（</a></span>见<a href="http://203.208.35.101/translate_c?hl=zh-CN&amp;sl=en&amp;tl=zh-CN&amp;u=http://www.dynarch.com/demos/NavBar/samples/winxp.html&amp;usg=ALkJrhj61FrnG7ojpnWl0lthaVEYF3n7ow">样品</a>）。</span></p>
<p style="word-break: break-all; text-align: left" align="left"><strong><span style="font-size: 18pt; font-family: 宋体">特征</span></strong></p>
<ul type="disc">
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">支持广泛范围的<u><span style="color: blue">浏览器</span></u>。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">此外，外观是可定制的，只需要改动一个CSS文件，而不必须触及JavaScript代码。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">用户可以根据他的需要折叠/展开菜单的部分。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">依赖于网页标准。它不依赖于专有的浏览器的功能，同时如果它们可用时，充分利用一些。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">提供高质量的动画和淡入淡出效果。如果不想要，动画可以禁用，要么完全或限制在某个水平。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">菜单部分可以嵌入普通HTML代码。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">（菜单）项目在单击时可以执行定制JavaScript代码。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">当菜单是隐藏的时，它扩大了可用于其他网页的空间。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">它会在一个cookie中记住它的状态，并在用户的回顾该网页时自动恢复。因此，开发人员并不需要在服务器端这样做了。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">2</span><span style="font-size: 12pt; font-family: 宋体">个工作模式：一次允许多个（菜单）节点被展开，或只有一个（菜单）节点被展开。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">某些特征的配置可不需要重新装载和重建菜单（因此，没有一个网页被重新加载）。他们将被保存在Cookie中。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">允许菜单选项带图标。如果一个图标不存在，将会使用'&#187;'来代替。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">允许使用带有alpha-opacity的png图标，在IE浏览器中也可以。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">可以显示工具提示。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">不使用框架。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">降低了网页的文件大小，因为创建菜单的代码可以被放进一个JavaScript文件，该文件是将会被浏览器缓存。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">菜单可以从服务器端脚本动态生成（在网页显示时）。</span> </li>
</ul>
<p style="word-break: break-all; text-align: left" align="left"><strong><span style="font-size: 18pt; font-family: 宋体">Browser support</span></strong><strong><span style="font-size: 18pt; font-family: 宋体">浏览器支持</span></strong></p>
<ul type="disc">
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">Windows</span><span style="font-size: 12pt; font-family: 宋体">中的Internet Explorer 6.0 - 出色的支持</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">Windows</span><span style="font-size: 12pt; font-family: 宋体">中的Internet Explorer 5.5 - 良好的支持</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">Windows</span><span style="font-size: 12pt; font-family: 宋体">中的Internet Explorer 5.0 &#8211;能工作，但没有png方式</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">Mozilla </span><span style="font-size: 12pt; font-family: 宋体">， Firefox ，其他<em>Gecko-s</em>（任何平台） - 出色的支持</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">Opera7</span><span style="font-size: 12pt; font-family: 宋体">（任何平台） - 很好的支持，没有淡入淡出</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">MacOSX</span><span style="font-size: 12pt; font-family: 宋体">的Apple Safari - 出色的支持</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">Linux</span><span style="font-size: 12pt; font-family: 宋体">的Konqueror -良好的支持</span> </li>
</ul>
<p style="word-break: break-all; text-align: left" align="left"><span style="font-size: 12pt; font-family: 宋体">由于大多数Web浏览器，甚至新的，默认工作在兼容模式（也称为QUIRKS模式），以便能够正确显示旧的网页，Navbar需要您在网页上声明为严格的DOCTYPE。这引导浏览器切换到标准的执行模式，Navbar将在QUIRKS模式不能正常工作。</span></p>
<p style="word-break: break-all; text-align: left" align="left"><a name="安装说明"><strong><span style="font-size: 24pt; font-family: 宋体">安装说明</span></strong></a></p>
<p style="word-break: break-all; text-align: left" align="left"><strong><span style="font-size: 22pt; font-family: 宋体">1</span></strong><strong><span style="font-size: 22pt; font-family: 宋体">、</span></strong><span style="font-size: 12pt; font-family: 宋体">从Navbar的发布包中复制&#8220;navbar&#8221;目录到您的Web服务器，例如使用FTP客户端。 If you copied it directly in your document root then a URL like the one below would be valid and lead to the main JS file:如果您直接复制它到您的文档根目录下，因此像下面一样的一个网址将是有效的，并引导主要的js文件：</span></p>
<p style="word-break: break-all; text-align: left" align="left"><span style="font-size: 12pt; font-family: 宋体">http://www.yourdomain.com<span style="color: red">/navbar</span>/navbar.jss </span></p>
<p style="word-break: break-all; text-align: left" align="left"><span style="font-size: 12pt; font-family: 宋体">在这种情况下， Navbar的路径将是&#8220;/navbar&#8221; （红色段）。因为Navbar使用路径来寻找控制图标，因此要在产生菜单之前指定它。</span></p>
<p style="word-break: break-all; text-align: left" align="left"><span style="font-size: 12pt; font-family: 宋体">请注意，有些Web服务器或浏览器可能不认识.jss扩展名（这的确是一个非标准的扩展名），因此将无法传递正确的&#8220;content type&#8221;。如果您遇到任何问题，请重命名该文件为：&#8220;navbar-all.js&#8221;，并在&lt;script&gt;标记中替换并载入该文件。</span></p>
<p style="word-break: break-all; text-align: left" align="left"><strong><span style="font-size: 22pt; font-family: 宋体">2</span></strong><strong><span style="font-size: 22pt; font-family: 宋体">、</span></strong><span style="font-size: 12pt; font-family: 宋体">创建一个&#8220;setupmenu.js&#8221;文件。你可以把它放在任何你想存放的地方，没有必要把它放在的/navbar的路径下。此文件将包含初始化和生成菜单的代码，以下是一个标注了的范例，对于一个完整的例子，您应该查看发行包中的&#8220;setupmenu.js&#8221;源文件，也可看看这个网页的源文件。</span></p>
<p>
<table style="border-right: medium none; border-top: medium none; border-left: medium none; border-bottom: medium none; border-collapse: collapse" cellspacing="0" cellpadding="0" border="1">
    <tbody>
        <tr>
            <td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 426.1pt; padding-top: 0cm; border-bottom: windowtext 1pt solid" valign="top" width="568">
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">_NavBar_url = "/navbar";</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">// </span><span style="font-size: 10.5pt; color: blue">用于禁用当前页面功能的助手函数</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">function</span><span style="font-size: 10.5pt; color: blue"> L(label) {</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;if (_NavBar_pageID.toLowerCase() == label.toLowerCase())</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; label = "!" + label;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;return label;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">}</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">var</span><span style="font-size: 10.5pt; color: blue"> menu = new NavBar(document.getElementById("content"),</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById("beforemenu"),</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById("aftermenu"));</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">// </span><span style="font-size: 10.5pt; color: blue">开始生成（添加顶部控制按钮）</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">menu.openMenu();</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">// </span><span style="font-size: 10.5pt; color: blue">一个菜单项目</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">new</span><span style="font-size: 10.5pt; color: blue"> NavSection(</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;menu, // </span><span style="font-size: 10.5pt; color: blue">父菜单</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;"a menu", // </span><span style="font-size: 10.5pt; color: blue">项目标签</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;[</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; [ L("Home"), "home.html", "Homepage", "images/home.png" ],</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; [ L("Products"), "products.html", "Our products", "images/products.png" ],</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; [ L("Label"), "url", "A tooltip", "images/icon.png" ]</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;]</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">);</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">// </span><span style="font-size: 10.5pt; color: blue">设置一些选项</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">menu.prefs["animation"] = 3;&nbsp;&nbsp;&nbsp; // "bloatware" ;-)</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">menu.prefs["auto-hide"] = true; // </span><span style="font-size: 10.5pt; color: blue">自动隐藏</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">// </span><span style="font-size: 10.5pt; color: blue">结束生成</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">menu.generate();</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p style="word-break: break-all; text-align: left" align="left"><span style="font-size: 12pt; font-family: 宋体">一些标注：</span></p>
<ul type="disc">
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">如果一个到图片的路径是相对（即&#8220;images/home.png&#8221;），那么它将相对到您的网页，而不是/navbar的路径。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">您可以使用PNG图标。包括在Internet Explorer，变化的opacity将可以工作。</span>
    <li style="word-break: break-all; text-align: left; tab-stops: list 36.0pt"><span style="font-size: 12pt; font-family: 宋体">所有定制选项的列表（如menu.prefs[&#8220;animation&#8221;]）见<u><span style="color: blue">定制信息</span></u>。</span> </li>
</ul>
<p style="word-break: break-all; text-align: left" align="left"><strong><span style="font-size: 22pt; font-family: 宋体">3</span></strong><strong><span style="font-size: 22pt; font-family: 宋体">、</span></strong><span style="font-size: 12pt; font-family: 宋体">正如您从上述代码所注意到的，我们创建了一个标记为&#8220;a menu&#8221;名字的单个项目的菜单，并链接到页面&#8220;home.html&#8221;， &#8220;products.html&#8221;。每个网页应具有以下结构：</span></p>
<p>
<table style="border-right: medium none; border-top: medium none; border-left: medium none; border-bottom: medium none; border-collapse: collapse" cellspacing="0" cellpadding="0" border="1">
    <tbody>
        <tr>
            <td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 426.1pt; padding-top: 0cm; border-bottom: windowtext 1pt solid" valign="top" width="568">
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&lt;!-- DOCTYPE </span><span style="font-size: 10.5pt; color: blue">是很重要的，不要忘记了 --&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&lt;html xmlns="http://www.w3.org/1999/xhtml"</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; style="padding: 0px; margin: 0px"&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&lt;head&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;title&gt;yourwebsite.com homepage&lt;/title&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;!-- </span><span style="font-size: 10.5pt; color: blue">包含主要的脚本 --&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript" src="/navbar/navbar.jss"&gt;&lt;/script&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript"&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _NavBar_pageID = "Home"; /* </span><span style="font-size: 10.5pt; color: blue">当前页的菜单标记*/</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;/script&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;style type="text/css"&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* </span><span style="font-size: 10.5pt; color: blue">提取导航栏的样式 */</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @import url(/navbar/navbar.css);</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;/style&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&lt;/head&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&lt;body&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;div id="beforemenu"&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [...] </span><span style="font-size: 10.5pt; color: blue">显示在导航栏中的内容，位于菜单前面 [...]</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;/div&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;div id="aftermenu"&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [...] </span><span style="font-size: 10.5pt; color: blue">显示在导航栏中的内容，位于菜单后面 [...]</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;/div&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;div id="content"&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [...] </span><span style="font-size: 10.5pt; color: blue">这里放置你包含的页面内容 [...]</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/div&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;/div&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;!-- </span><span style="font-size: 10.5pt; color: blue">为了能够生成菜单，在这里加载setupmenu --&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript" src="setupmenu.js"&gt;&lt;/script&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all">&nbsp;</pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&nbsp;&lt;/body&gt;</span></pre>
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">&lt;/html&gt;</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p style="word-break: break-all; text-align: left" align="left"><span style="font-size: 12pt; font-family: 宋体">菜单将建立在id&#8220;content&#8221;的DIV层里面。其他的两个DIV层将被移到导航栏中，并且放在菜单的前面和后面，同时它们也是可选的。</span></p>
<p style="word-break: break-all; text-align: left" align="left"><a name="Navbar的定制"><strong><span style="font-size: 24pt; font-family: 宋体">Navbar</span></strong></a><strong><span style="font-size: 24pt; font-family: 宋体">的定制</strong></span></p>
<p style="word-break: break-all">外观是完全可通过改变CSS文件而定制的。除此之外，有几个自定义选项，需要一些JavaScript代码。假如您是使用下面的命令创建的菜单： </p>
<p>
<table style="border-right: medium none; border-top: medium none; border-left: medium none; border-bottom: medium none; border-collapse: collapse" cellspacing="0" cellpadding="0" border="1">
    <tbody>
        <tr>
            <td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 426.1pt; padding-top: 0cm; border-bottom: windowtext 1pt solid" valign="top" width="568">
            <pre style="layout-grid-mode: char; word-break: break-all"><span style="font-size: 10.5pt; color: blue">var menu = new NavBar("content");</span></pre>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p style="word-break: break-all">您可以修改下列自定义选项：</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><span style="font-size: 10.5pt; color: blue">1.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><code><span style="font-size: 10.5pt; color: blue">menu.prefs["animation"] = 0 | 1 | 2 | 3</span></code></p>
<p style="margin-left: 36pt; word-break: break-all">意思是&#8220;0&#8221;为没有所有的动画，&#8220;1&#8221;为仅是项目的动画，&#8220;2&#8221;为菜单栏的动画，以及&#8220;3&#8221;为&#8220;膨胀&#8221;动画（当隐藏菜单时，整个网页将产生动画）。我强烈建议使用&#8220;2&#8221;（默认值） 。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">2.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["mono-section"] = true | false </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">当mono-section的值为true时，将是一次只有一个项目可见（被展开）。选择另一部分将隐藏当前可见的部分。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">3.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["generate-anim"] = true | false </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">如果这个值是true的话，那么菜单在启动时会显示动画。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">4.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["auto-hide"] = true | false </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">如果这个值是true的话，菜单将会是一个&#8220;自动隐藏&#8221;的菜单，意思是当鼠标光标鼠标光标离开菜单区域时，菜单将自动隐藏。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">5.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["tooltips"] = true | false </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">如果这个值是true（默认）的话，导航栏将显示工具提示。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">6.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["icon-width"] = 20 <br />
menu.prefs["icon-height"] = 14 </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">允许您设定图标的尺寸。如果您提供了不同尺寸的图片，它们将被缩小，以满足上面两行配置的要求。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">7.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["link-prefix"] = "/foo/bar/" </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">如果将此选项设置，则各个菜单所指向的链接都将加上特定前缀（例如：&#8220;/foot/bar/&#8221; ）。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">8.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["cookie-path"] = "/bar/foo/" </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">设定菜单存储的cookie的路径。Cookie用于在紧接后的请求中记住菜单的状态。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">9.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["cookie-exp"] = 15 </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">配置Cookie过期时间。如果没有设置（默认），则cookie将直到关闭浏览器（在会议结束时）才过期。上面的例子说明cookie将在15天后过期。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">10.&nbsp;</span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["link-target"] = "_blank" </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">设定在菜单中链接的target属性。这应该是一个frame的名称。如果你想在当前窗口/帧中打开所有链接，就请不要设置。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">11.&nbsp;</span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["nb-frames"] = 15 <br />
menu.prefs["ns-frames"] = "auto" </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">导航栏（nb-）或菜单项目动画（ns-）的帧数。这个数字越高，动画的速度就越慢。如果设为&#8220;自动&#8221; （默认），帧的数目将基于菜单项目的高度来计算。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">12.&nbsp;</span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["nb-fps"] = 45 <br />
menu.prefs["ns-fps"] = 100 </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">导航栏（nb-）或菜单项目动画（ns-）每秒将会显示的帧数。这个数字越高，动画将会越平滑，但CPU的负载就会越高。其默认值应该对于大部分系统都是不错的。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">13.&nbsp;</span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["home-href"] = "http://dynarch.com/mishoo/menubar.epl" <br />
menu.prefs["home-title"] = "NavBar project page" <br />
menu.prefs["home-text"] = "NavBar" </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">这个首选项可让您定义将会显示在头部/尾部和它的工具栏提示的链接。上面的例子显示了默认选项。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">14.&nbsp;</span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["no-controls"] = false </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">设置<strong>为</strong>true，为了隐藏&#8220;全局菜单控制&#8221;，即&#8220;+&#8221;，&#8220;-&#8221;按钮操作所有菜单项目，以及左/右箭头可关闭/打开菜单。</p>
<p style="margin-left: 36pt; word-break: break-all; text-indent: -18pt; tab-stops: list 36.0pt"><code><span style="font-size: 10.5pt; color: blue">15.&nbsp;</span></code><code><span style="font-size: 10.5pt; color: blue">menu.prefs["no-disable"] = false </span></code></p>
<p style="margin-left: 36pt; word-break: break-all">如果您设置为<strong>true</strong>的话，Navbar将不会禁用当前的项目。如果你想当前的项目看上去是激活的，并且没有被禁用，可在这里设置&#8220;item-disabled&#8221; （或自定义字符串），同时该项目将获得附加的字符串作为类的名称。使用这个（类名称）您可以在它的样式表中定义一个自定义外观。&#8220;item-disabled&#8221;是在navbar.css中定义的默认的类别名称，用来使得该项目看起来是&#8220;激活&#8221;的。</p>
<img src ="http://www.blogjava.net/tanzek/aggbug/235580.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-10-21 08:45 <a href="http://www.blogjava.net/tanzek/archive/2008/10/21/235580.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]Learn techniques for building better DAOs</title><link>http://www.blogjava.net/tanzek/archive/2008/10/15/234545.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Wed, 15 Oct 2008 15:04:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/10/15/234545.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/234545.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/10/15/234545.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/234545.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/234545.html</trackback:ping><description><![CDATA[
		<font color="#ff0000">高级DAO编程-学习构建更好的DAO的技巧，是关于DAO模式应用比较好的文章，在这里将之转载，希望能多多学习。</font>
		<br />
		<h1>Advanced DAO programming</h1>
		<p id="subtitle">
				<em>Learn techniques for building better DAOs</em>
		</p>
		<p>Level: Advanced</p>
		<a href="http://www.ibm.com/developerworks/library/j-dao/#author">Sean Sullivan</a> (<a href="mailto:dao-article@seansullivan.com?subject=Advanced%20DAO%20programming">dao-article@seansullivan.com</a>), Software Engineer<br /><p> 07 Oct  2003</p><blockquote>J2EE developers use the Data Access
Object (DAO) design pattern to separate low-level data access logic
from high-level business logic. Implementing the DAO pattern involves
more than just writing data access code. In this article, Java
developer Sean C. Sullivan discusses three often overlooked aspects of
DAO programming: transaction demarcation, exception handling, and
logging.</blockquote><br /><p>During the past 18 months I worked with a team of talented software
engineers to build custom Web-based supply chain management
applications. Our applications accessed a broad range of persistent
data, including shipment status, supply chain metrics, warehouse
inventory, carrier invoices, project management data, and user
profiles. We used the JDBC API to connect to our company's various
database platforms and applied the DAO design pattern throughout the
applications.</p><p>Figure 1 shows the relation between the applications and data sources:</p><br /><a name="N1004D"><b>Figure 1. Applications and data sources</b></a><br /><img alt="Web applications" src="http://www.ibm.com/developerworks/library/j-dao/jwebapps.jpg" width="282" height="176" /><br /><p>Applying the Data Access Object (DAO) pattern throughout the
applications enabled us to separate low-level data access logic from
business logic. We built DAO classes that provide CRUD (create, read,
update, delete) operations for each data source.</p><p>In this article, I'll introduce you to DAO implementation strategies
and techniques for building better DAO classes.
Specifically, I'll cover logging, exception handling, and transaction
demarcation. You will learn how to incorporate all three in your DAO
classes. This article assumes that you are familiar with the JDBC API,
SQL, and relational database programming.</p><p>We'll start with a review of the DAO design pattern and data access objects.</p><p><a name="N10065"><span class="atitle">DAO fundamentals</span></a></p><p>The DAO pattern is one of the standard J2EE design patterns.
Developers use this pattern to separate low-level data access
operations from high-level business logic. A typical DAO implementation
has the following components:</p><ul><li>A DAO factory class</li><li>A DAO interface</li><li>A concrete class that implements the DAO interface</li><li>Data transfer objects (sometimes called value objects)</li></ul><p>The concrete DAO class contains logic for accessing data from a
specific data source. In the sections that follow you'll learn
techniques for designing and implementing data access objects. See <a href="http://www.ibm.com/developerworks/library/j-dao/#resources">Resources</a> to learn more about the DAO design pattern.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N10086"><span class="atitle">Transaction demarcation</span></a></p><p>The important thing to remember about DAOs is that they are
transactional objects. Each operation performed by a DAO -- such as
creating, updating, or deleting data -- is associated with a
transaction. As such, the concept of <i>transaction demarcation</i> is extremely important.</p><p>Transaction demarcation is the manner in which transaction
boundaries are defined. The J2EE specification describes two models for
transaction demarcation: programmatic and declarative. Table 1 breaks
down the two models:</p><p><b>Table 1. Two models of transaction demarcation</b></p><table border="1" cellpadding="3" cellspacing="0" width="100%"><tbody><tr><td><b>Declarative transaction demarcation</b></td><td><b>Programmatic transaction demarcation</b></td></tr><tr><td>The programmer declares transaction attributes using an EJB deployment descriptor.</td><td>The programmer is responsible for coding transaction logic.</td></tr><tr><td>The run-time environment (the EJB container) uses the attributes to automatically manage transactions.</td><td>The application controls the transaction via an API.</td></tr></tbody></table><p>We'll focus on programmatic transaction demarcation.</p><p><a name="N100C2"><span class="smalltitle">Design considerations</span></a></p><p>As stated previously, DAOs are transactional objects. A typical DAO
performs transactional operations such as create, update, and delete.
When designing a DAO, start by asking yourself the following questions:</p><ul><li>How will transactions start?</li><li>How will transactions end?</li><li>Which object will be responsible for starting a transaction?</li><li>Which object will be responsible for ending a transaction?</li><li>Should the DAO be responsible for starting and ending transactions?</li><li>Will the application need to access data across multiple DAOs?</li><li>Will a transaction involve one DAO or multiple DAOs?</li><li>Will a DAO invoke methods on another DAO?</li></ul><p>Knowing the answers to these questions will help you choose the
transaction demarcation strategy that is best for your DAOs. There are
two main strategies for transaction demarcation in DAOs. One approach
makes the DAO responsible for demarcating transactions; the other
defers transaction demarcation to the object that is calling the DAO's
methods. If you choose the former approach, you will embed transaction
code inside the DAO class. If you choose the latter approach,
transaction demarcation code will be external to the DAO class. We'll
use simple code examples to better understand how each of these
approaches works.</p><p>Listing 1 shows a DAO with two data operations: create and update:</p><br /><a name="N100F0"><b>Listing 1. DAO methods</b></a><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="code-outline"><pre class="displaycode">  public void createWarehouseProfile(WHProfile profile);<br />  public void updateWarehouseStatus(WHIdentifier id, <br />    StatusInfo status);<br /></pre></td></tr></tbody></table><br /><p>Listing 2 shows a simple transaction. The transaction demarcation
code is external to the DAO class. Notice how the caller in this
example combines multiple DAO operations within the transaction.</p><br /><a name="N100FE"><b>Listing 2. Caller-managed transaction</b></a><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="code-outline"><pre class="displaycode">      tx.begin();    // start the transaction<br />      dao.createWarehouseProfile(profile);<br />      dao.updateWarehouseStatus(id1, status1);<br />      dao.updateWarehouseStatus(id2, status2);<br />      tx.commit();   // end the transaction<br /></pre></td></tr></tbody></table><br /><p>This transaction demarcation strategy is especially valuable for
applications that need to access multiple DAOs in a single transaction.</p><p>You can implement transaction demarcation using either the JDBC API
or the Java Transaction API (JTA). JDBC transaction demarcation is
simpler than JTA transaction demarcation, but JTA provides greater
flexibility. In the sections that follow we'll take a closer look at
the mechanics of transaction demarcation.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N1010D"><span class="atitle">Transaction demarcation with JDBC</span></a></p><p>JDBC transactions are controlled using the <code>Connection</code> object. The JDBC Connection interface (<code>java.sql.Connection</code>) provides two transaction modes: auto-commit and manual commit. The <code>java.sql.Connection</code> offers the following methods for controlling transactions:</p><ul><li><code>public void setAutoCommit(boolean)</code></li><li><code>public boolean getAutoCommit()</code></li><li><code>public void commit()</code></li><li><code>public void rollback()</code></li></ul><p>Listing 3 shows how to demarcate a transaction using the JDBC API:</p><br /><a name="N10140"><b>Listing 3. Transaction demarcation with the JDBC API</b></a><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="code-outline"><pre class="displaycode">import java.sql.*;<br />import javax.sql.*;<br /><br />// ...<br />DataSource ds = obtainDataSource();<br />Connection conn = ds.getConnection();<br />conn.setAutoCommit(false);<br />// ...<br />pstmt = conn.prepareStatement("UPDATE MOVIES ...");<br />pstmt.setString(1, "The Great Escape");<br />pstmt.executeUpdate();<br />// ...<br />conn.commit();<br />// ...<br /></pre></td></tr></tbody></table><br /><p>With JDBC transaction demarcation, you can combine multiple SQL
statements into a single transaction. One of the drawbacks of JDBC
transactions is that the transaction's scope is limited to a single
database connection. A JDBC transaction cannot span multiple databases.
Next, we'll see how transaction demarcation is done using JTA. Because
JTA is not as widely known as JDBC, we'll start with an overview.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N1014C"><span class="atitle">Overview of JTA</span></a></p><p>The Java Transaction API (JTA) and its sibling, the Java Transaction
Service (JTS), provide distributed transaction services for the J2EE
platform. A <i>distributed transaction</i> involves a transaction manager and one or more resource managers. A <i>resource manager</i>
is any kind of persistent datastore. The transaction manager is
responsible for coordinating communication between all transaction
participants. The relationship between the transaction manager and
resource managers is shown in Figure 2:</p><br /><a name="N1015F"><b>Figure 2. A transaction manager and resource managers</b></a><br /><img alt="A transaction manager and resource managers" src="http://www.ibm.com/developerworks/library/j-dao/transactionmanager.jpg" width="358" height="244" /><br /><p>JTA transactions are more powerful than JDBC transactions. While a
JDBC transaction is limited to a single database connection, a JTA
transaction can have multiple participants. Any one of the following
Java platform components can participate in a JTA transaction:</p><ul><li>JDBC connections</li><li>JDO <code>PersistenceManager</code> objects</li><li>JMS queues</li><li>JMS topics</li><li>Enterprise JavaBeans</li><li>A resource adapter that complies with the J2EE Connector Architecture specification</li></ul><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N1018A"><span class="atitle">Transaction demarcation with JTA</span></a></p><p>To demarcate a transaction with JTA, the application invokes methods on the <code>javax.transaction.UserTransaction</code> interface. Listing 4 shows a typical JNDI lookup for the <code>UserTransaction</code> object:</p><br /><a name="N1019F"><b>Listing 4. A JNDI lookup for the UserTransaction object</b></a><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="code-outline"><pre class="displaycode">import javax.transaction.*;<br />import javax.naming.*;<br />// ...<br />InitialContext ctx = new InitialContext();<br />Object txObj = <br />  ctx.lookup("java:comp/UserTransaction");<br />UserTransaction utx = (UserTransaction) txObj;<br /><br /></pre></td></tr></tbody></table><br /><p>After the application has a reference to the <code>UserTransaction</code> object it may start the transaction, as shown in Listing 5:</p><br /><a name="N101B1"><b>Listing 5. Starting a transaction with JTA</b></a><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="code-outline"><pre class="displaycode">utx.begin();<br />// ...<br />DataSource ds = obtainXADataSource();<br />Connection conn = ds.getConnection();<br />pstmt = conn.prepareStatement("UPDATE MOVIES ...");<br />pstmt.setString(1, "Spinal Tap");<br />pstmt.executeUpdate();<br />// ...<br />utx.commit();<br />// ...<br /><br /></pre></td></tr></tbody></table><br /><p>When the application invokes <code>commit()</code>, the transaction manager uses a two-phase commit protocol to end the transaction.</p><p><a name="N101C1"><span class="smalltitle">JTA methods for transaction control</span></a></p><p>The <code>javax.transaction.UserTransaction</code> interface provides the following transaction control methods:</p><ul><li><code>public void begin()</code></li><li><code>public void commit()</code></li><li><code>public void rollback()</code></li><li><code>public int getStatus()</code></li><li><code>public void setRollbackOnly()</code></li><li><code>public void setTransactionTimeout(int)</code></li></ul><p>To start a transaction the application calls <code>begin()</code>. To end a transaction the application
calls either <code>commit()</code> or <code>rollback()</code>. See <a href="http://www.ibm.com/developerworks/library/j-dao/#resources">Resources</a> to learn more about transaction management with JTA.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N10204"><span class="atitle">Using JTA and JDBC</span></a></p><p>Developers often use JDBC for low-level data operations in DAO
classes. If you plan to demarcate transactions with JTA, you will need
a JDBC driver that implements the <code>javax.sql.XADataSource</code>, <code>javax.sql.XAConnection</code>, and <code>javax.sql.XAResource</code> interfaces. A driver that implements these interfaces will be able to participate in JTA transactions. An <code>XADataSource</code> object is a 
factory for <code>XAConnection</code> objects. <code>XAConnection</code>s are JDBC connections that participate in JTA transactions.</p><p>You will be required to set up the <code>XADataSource</code> using
your application server's administrative tools. Consult the application
server documentation and the JDBC driver documentation for specific
instructions.</p><p>J2EE applications look up the data source using JNDI. Once the
application has a reference to the data source object, it will call <code>javax.sql.DataSource.getConnection()</code> to obtain a connection to the database.</p><p>XA connections are different from non-XA connections. Always
remember that XA connections are participating in a JTA transaction.
This means that XA connections do not support JDBC's auto-commit
feature. Also, the application must not invoke <code>java.sql.Connection.commit()</code> or <code>java.sql.Connection.rollback()</code> on an XA connection. Instead, the application should use <code>UserTransaction.begin()</code>, <code>UserTransaction.commit()</code>, and <code>UserTransaction.rollback()</code>.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N1024C"><span class="atitle">Choosing the best approach</span></a></p><p>We've discussed how to demarcate transactions with both JDBC and
JTA. Each approach has its advantages and you will need to decide which
one is most appropriate for your application. </p><p>On many recent projects our team has built DAO classes using the
JDBC API for transaction demarcation. These DAO classes can be
summarized as follows:</p><ul><li>Transaction demarcation code is embedded inside the DAO class.</li><li>The DAO class uses the JDBC API for transaction demarcation.</li><li>The caller has no way to demarcate the transaction.</li><li>Transaction scope is limited to a single JDBC Connection.</li></ul><p>JDBC transactions are not always suitable for complex enterprise
applications. If your transactions will span multiple DAOs or multiple
databases the following implementation strategy may be more appropriate:</p><ul><li>Transactions are demarcated with JTA.</li><li>Transaction demarcation code is separated from the DAO.</li><li>The caller is responsible for demarcating the transaction.</li><li>The DAO participates in a global transaction.</li></ul><p>The JDBC approach is attractive due to its simplicity; the JTA
approach offers greater flexibility. The implementation you choose will
depend on the specific needs of your application.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N1027E"><span class="atitle">Logging and DAOs</span></a></p><p>A well-implemented DAO class will use logging to capture details
about its run-time behavior. You may choose to log exceptions,
configuration information, connection status, JDBC driver metadata, or
query parameters. Logs are useful in all phases of development. I often
examine application logs during development, during testing, and in
production.</p><p>In this section, I'll present a code example that shows how to
incorporate Jakarta Commons Logging into a DAO. Before we get to that,
let's review a couple of basics. </p><p><a name="N1028C"><span class="smalltitle">Choosing a logging library</span></a></p><p>Many developers use a primitive form of logging: <code>System.out.println</code> and <code>System.err.println</code>. <code>Println</code>
statements are quick and convenient but they do not offer the power of
a full-featured logging system. Table 2 lists logging libraries for the
Java platform:</p><p><b>Table 2. Logging libraries for the Java platform</b></p><table border="1" cellpadding="3" cellspacing="0" width="100%"><tbody><tr><td><b>Logging library</b></td><td><b>Open source?</b></td><td><b>URL</b></td></tr><tr><td>java.util.logging</td><td>No</td><td>http://java.sun.com/j2se/</td></tr><tr><td>Jakarta Log4j</td><td>Yes</td><td>http://jakarta.apache.org/log4j/</td></tr><tr><td>Jakarta Commons Logging</td><td>Yes</td><td>http://jakarta.apache.org/commons/logging.html</td></tr></tbody></table><p><code>java.util.logging</code> is the standard API for the J2SE 1.4
platform. Most developers would agree, however, that Jakarta Log4j
delivers greater functionality and more flexibility. One of the
advantages of Log4j over java.util.logging is that it supports both the
J2SE 1.3 and J2SE 1.4 platforms.</p><p>Jakarta Commons Logging can be used in conjunction with <code>java.util.logging</code>
or Jakarta Log4j. Commons Logging is a logging abstraction layer that
isolates your application from the underlying logging implementation.
With Commons Logging, you can swap the underlying logging
implementation by changing a configuration file. Commons Logging is
used in Jakarta Struts 1.1 and Jakarta HttpClient 2.0.</p><p><a name="N102EE"><span class="smalltitle">A  logging example</span></a></p><p>Listing 7 shows how to use Jakarta Commons Logging in a DAO class:</p><br /><a name="N102FB"><b>Listing 7. Jakarta Commons Logging in a DAO class</b></a><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="code-outline"><pre class="displaycode">import org.apache.commons.logging.*;<br /><br />class DocumentDAOImpl implements DocumentDAO<br />{<br />      static private final Log log = <br />        LogFactory.getLog(DocumentDAOImpl.class);<br /><br />      public void deleteDocument(String id)<br />      {<br />          // ...<br />          log.debug("deleting document: " + id);<br />          // ...<br />          try<br />          {<br />              // ... data operations ...<br />          }<br />          catch (SomeException ex)<br />          {<br />              log.error("Unable to <br />                delete document", ex);<br />              // ... handle the exception ...<br />	}<br />      }<br />}<br /></pre></td></tr></tbody></table><br /><p>Logging is an essential part of any mission-critical application. If
you encounter a failure in a DAO, logs often provide the best
information for understanding what went wrong. Incorporating logging
into your DAOs ensures you will be
equipped for debugging and troubleshooting.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N10307"><span class="atitle">Exception handling in DAOs</span></a></p><p>We've looked at transaction demarcation and logging and you now have
a deeper understanding of how each applies to data access objects. Our
third and final discussion point is exception handling. Following a few
simple exception handling guidelines will make your DAOs easier to use,
more robust, and more maintainable.</p><p>When implementing the DAO pattern, consider the following questions:</p><ul><li>Will methods in the DAO's public interface throw checked exceptions?</li><li>If yes, what checked exceptions will be thrown?</li><li>How will exceptions be handled within the DAO implementation class?</li></ul><p>In the process of working with the DAO pattern, our team developed a
set of guidelines for exception handling. Follow these guidelines to
greatly improve your DAOs:</p><ul><li>DAO methods should throw meaningful exceptions.<br /><br /></li><li>DAO methods should not throw <code>java.lang.Exception</code>. A <code>java.lang.Exception</code> is too generic. It does not convey any information about the underlying problem.<br /><br /></li><li>DAO methods should not throw <code>java.sql.SQLException</code>.
SQLException is a low-level JDBC exception. A DAO should strive to
encapsulate JDBC rather than expose JDBC to the rest of the application.<br /><br /></li><li>Methods in the DAO interface should throw checked exceptions only
if the caller can reasonably be expected to handle the exception. If
the caller won't be able to handle the exception in a meaningful way,
consider throwing an unchecked (run-time) exception.<br /><br /></li><li>If your data access code catches an exception, do not ignore it.
DAOs that ignore caught exceptions are difficult to troubleshoot.<br /><br /></li><li>Use chained exceptions to translate low-level exceptions into high-level ones.<br /><br /></li><li>Consider defining standard DAO exception classes. The Spring Framework (see <a href="http://www.ibm.com/developerworks/library/j-dao/#Resources">Resources</a>) provides an excellent set of predefined DAO exception classes.</li></ul><p>See <a href="http://www.ibm.com/developerworks/library/j-dao/#resources">Resources</a> for more detailed information about exceptions and exception handling techniques.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N1035F"><span class="atitle">Implementation example: MovieDAO</span></a></p><p><code>MovieDAO</code> is a DAO that demonstrates all of the
techniques discussed in this article: transaction demarcation, logging,
and exception handling. You will find the <code>MovieDAO</code> source in the <a href="http://www.ibm.com/developerworks/library/j-dao/#Resources">Resources</a> section. The code is divided into three packages:</p><ul><li><code>daoexamples.exception</code></li><li><code>daoexamples.movie</code></li><li><code>daoexamples.moviedemo</code></li></ul><p>This implementation of the DAO pattern consists of the classes and interfaces shown below:</p><ul><li><code>daoexamples.movie.MovieDAOFactory</code></li><li><code>daoexamples.movie.MovieDAO</code></li><li><code>daoexamples.movie.MovieDAOImpl</code></li><li><code>daoexamples.movie.MovieDAOImplJTA</code></li><li><code>daoexamples.movie.Movie</code></li><li><code>daoexamples.movie.MovieImpl</code></li><li><code>daoexamples.movie.MovieNotFoundException</code></li><li><code>daoexamples.movie.MovieUtil</code></li></ul><p>The <code>MovieDAO</code> interface defines the DAO's data operations. The interface has five methods, as shown here:</p><ul><li><code>public Movie findMovieById(String id)</code></li><li><code>public java.util.Collection findMoviesByYear(String year)</code></li><li><code>public void deleteMovie(String id)</code></li><li><code>public Movie createMovie(String rating, String year, String, title)</code></li><li><code>public void updateMovie(String id, String rating, String year, String title)</code></li></ul><p>The <code>daoexamples.movie</code> package contains two implementations of the <code>MovieDAO</code> interface. Each implementation uses a different approach to transaction demarcation, as shown in Table 3:</p><p><b>Table 3. MovieDAO implementations</b></p><table border="1" cellpadding="3" cellspacing="0" width="100%"><tbody><tr><td><br /></td><td><b>MovieDAOImpl</b></td><td><b>MovieDAOImplJTA</b></td></tr><tr><td>Implements the MovieDAO interface?</td><td>Yes</td><td>Yes</td></tr><tr><td>Obtains DataSource via JNDI?</td><td>Yes</td><td>Yes</td></tr><tr><td>Obtains java.sql.Connection objects from a DataSource?</td><td>Yes</td><td>Yes</td></tr><tr><td>DAO demarcates transactions internally?</td><td>Yes</td><td>No</td></tr><tr><td>Uses JDBC transactions?</td><td>Yes</td><td>No</td></tr><tr><td>Uses an XA DataSource?</td><td>No</td><td>Yes</td></tr><tr><td>Participates in JTA transactions?</td><td>No</td><td>Yes</td></tr></tbody></table><p><a name="N1044F"><span class="smalltitle">MovieDAO demo application</span></a></p><p>The demo application is a servlet class called <code>daoexamples.moviedemo.DemoServlet</code>. <code>DemoServlet</code> uses both of the Movie DAOs to query and update movie data in a table.</p><p>The servlet demonstrates how to combine the JTA-aware <code>MovieDAO</code> and the Java Message Service in a single transaction, as shown in Listing 8.</p><br /><a name="N1046B"><b>Listing 8. Combining MovieDAO and JMS code in a single transaction</b></a><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td class="code-outline"><pre class="displaycode">UserTransaction utx = MovieUtil.getUserTransaction();<br />utx.begin();<br />batman = dao.createMovie("R",<br />  "2008",<br />  "Batman Reloaded");<br />publisher = new MessagePublisher();<br />publisher.publishTextMessage("I'll be back");<br />dao.updateMovie(topgun.getId(),<br />  "PG-13",<br />  topgun.getReleaseYear(),<br />  topgun.getTitle());<br />dao.deleteMovie(legallyblonde.getId());<br />utx.commit();<br /></pre></td></tr></tbody></table><br /><p>To run the demo application, configure an XA datasource and a non-XA
datasource in your application server. Then, deploy the daoexamples.ear
file. The application will run in any J2EE 1.3-compliant application
server. See <a href="http://www.ibm.com/developerworks/library/j-dao/#resources">Resources</a> to obtain the EAR file and source code.</p><br /><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" width="100%" height="1" /></td></tr></tbody></table><table class="no-print" align="right" cellpadding="0" cellspacing="0"><tbody><tr align="right"><td><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="middle"><img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" width="16" height="16" /><br /></td><td align="right" valign="top"><a href="http://www.ibm.com/developerworks/library/j-dao/#main" class="fbox"><b>Back to top</b></a></td></tr></tbody></table></td></tr></tbody></table><br /><br /><p><a name="N1047B"><span class="atitle">Conclusion</span></a></p><p>As this article has shown, implementing the DAO pattern entails more
than just writing low-level data access code. You can start building
better DAOs today by choosing a transaction demarcation strategy that
is appropriate for your application, by incorporating logging in your
DAO classes, and by following a few simple guidelines for exception
handling. </p><br /><br /><p><a name="resources"><span class="atitle">Resources</span></a></p><ul><li>Download the MovieDAO source code at <a href="http://daoexamples.sourceforge.net/">daoexamples.sourceforge.net</a><br /><br /></li><li>Want to learn more about the Data Access Object pattern? Start with the <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html">Core J2EE Patterns home page</a>.<br /><br /></li><li>Kyle Brown's "<a href="http://www.ibm.com/developerworks/java/library/j-sdao/">A stepped approach to J2EE testing with SDAO</a>" (<i>developerWorks</i>, March 2003) provides a short introduction to data access objects and the DAO design pattern.<br /><br /></li><li>The Dragonslayer tutorial "<a href="http://www.ibm.com/developerworks/ibm/edu/i-dw-i-2extreme6-i.html">Create persistent application data with Java Data Objects</a>" (<i>developerWorks</i>, July 2003) shows you how to combine Struts and the DAO pattern for low-impact enterprise data persistence.<br /><br /></li><li>Srikanth Shenoy's "<a href="http://www.ibm.com/developerworks/java/library/j-ejbexcept.html">Best
practices in EJB exception handling</a>" (<i>developerWorks</i>, May 2002) introduces both exception handling basics and logging with Log4j.<br /><br /><br /><br /></li><li>The <i>Java theory and practice series</i> offers a three-part introduction to the Java Transaction API, starting with "<a href="http://www.ibm.com/developerworks/java/library/j-jtp0305.html">Understanding JTS -- An introduction to transactions</a>" (<i>developerWorks</i>, March 2002).<br /><br /></li><li>The <a href="http://java.sun.com/products/jta/">Java Transaction API</a> is a key part of the J2EE platform.<br /><br /></li><li><a href="http://logging.apache.org/log4j/docs/index.html">Jakarta Log4j</a> is a world-class logging library for Java applications.<br /><br /><br /><br /></li><li><a href="http://jakarta.apache.org/commons/logging/">Jakarta Commons Logging</a> provides an easy-to-use logging abstraction layer.<br /><br /></li><li>The <a href="http://www.springframework.org/">Spring Framework</a>
provides abstraction layers for JDBC and transaction management.
Additionally, the framework contains standardized DAO exception classes
and JNDI helper classes.<br /><br /></li><li>Rod Johnson's <a href="http://www.amazon.com/gp/product/0764543857/104-0953169-7411102?v=glance&amp;n=283155"><i>J2EE Design and Development</i></a>
(Wrox Press, 2002) belongs on every J2EE developer's bookshelf. The
book is full of application design strategies, practical programming
techniques, and real-world examples.<br /><br /></li><li>Josh Bloch's <a href="http://www.amazon.com/gp/product/0201310058/104-0953169-7411102?v=glance&amp;n=283155"><i>Effective Java Programming Language Guide</i></a> (Addison Wesley, 2001) presents best practices for exception handling and class library design.<br /><br /></li><li>See the Java technology zone tutorials page for a complete listing of free <a href="http://www.ibm.com/developerworks/views/java/tutorials.jsp">Java technology tutorials</a> from <i>developerWorks</i>.<br /><br /></li><li>You'll find hundreds of articles about every aspect of Java programming in the <a href="http://www.ibm.com/developerworks/java/"><i>developerWorks</i> Java technology zone</a>.<br /></li></ul><br /><br /><p><a name="author"><span class="atitle">About the author</span></a></p><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td colspan="3"><img alt="" src="http://www.ibm.com/i/c.gif" width="100%" height="5" /></td></tr><tr align="left" valign="top"><td><br /></td><td><img alt="" src="http://www.ibm.com/i/c.gif" width="4" height="5" /></td><td width="100%"><p>Sean
C. Sullivan is a software engineer working in Portland, Oregon. His
most recent projects include building supply chain management
applications and an Internet e-commerce payment system. He has also
worked on operating system and CAD software projects at IBM and Image
Systems Technology. Sean is an Apache Jakarta developer, having
contributed code to the Jakarta HttpClient project. He has been
developing applications with Java since 1996 and is the author of <i>Programming with the Java Media Framework</i>, published by John Wiley &amp; Sons. Sean holds a BS in Computer Science from
Rensselaer. He can be reached at <a href="mailto:dao-article@seansullivan.com?cc=">dao-article@seansullivan.com</a>.</p></td></tr></tbody></table><p>Traceback: <a href="http://www.ibm.com/developerworks/library/j-dao/">http://www.ibm.com/developerworks/library/j-dao/</a></p><img src ="http://www.blogjava.net/tanzek/aggbug/234545.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-10-15 23:04 <a href="http://www.blogjava.net/tanzek/archive/2008/10/15/234545.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]Lazy Initialization and the DAO pattern with Hibernate and Spring</title><link>http://www.blogjava.net/tanzek/archive/2008/10/15/234543.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Wed, 15 Oct 2008 14:48:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/10/15/234543.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/234543.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/10/15/234543.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/234543.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/234543.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 关于Spring和Hibernate整合后的懒加载和DAO模式应用，尤其介绍了其中的Hibernate懒加载在应用Spring的情况下在各个层次实现的情况。暂时是英文的，有时间试着翻译一下！~Hibernate and Lazy InitializationHibernate object relational mapping offers both lazy and ...&nbsp;&nbsp;<a href='http://www.blogjava.net/tanzek/archive/2008/10/15/234543.html'>阅读全文</a><img src ="http://www.blogjava.net/tanzek/aggbug/234543.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-10-15 22:48 <a href="http://www.blogjava.net/tanzek/archive/2008/10/15/234543.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>笔记本故障处理一则</title><link>http://www.blogjava.net/tanzek/archive/2008/10/10/233475.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Thu, 09 Oct 2008 20:58:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/10/10/233475.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/233475.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/10/10/233475.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/233475.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/233475.html</trackback:ping><description><![CDATA[
		<p>同事一台Benq Joybook S53笔记本，今日说电脑进入不了系统，安全模式正常，但普通模式就在XP滚动条处停止不动了。咋一看，这情况还真与平常所见的有不同，一般进入不了系统的话，是要到系统蓝底的时候了，但是这个却在这里停了，估计是系统及硬件有问题了。捣了半天，弄出了几个方向，最后还是没有完美地解决，但总也算是经验，这里都给记一下。<br /><br />方向一：修复系统<br />在安全模式下看系统很正常，没有明显的木马和病毒现象，基本上排除了是系统问题，原因也由于同事在C盘存了很多东西，图个简例修复一下。但是放入系统盘进行修复时，拷贝文件完成后再继续安装时，就一直停在34分钟处（有兴趣的朋友可以到网上面搜索一下“XP著名的34分钟死机”），没有办法继续下去了。根据查资料，原因听说是硬件问题（可以看一下MS的说法，<a href="http://support.microsoft.com/kb/828267/zh-cn">还剩 34 分钟时安装程序停止响应</a>）。问题依旧<br /><br />方向二：升级SP3后的问题<br />查看了一下安全模式，一眼就能看出升级到了SP3，早就听说在SP3下面有很多怪问题，蓝屏和死机的现象最多，想想是不是因为升级了，然后产生了这样子的问题呢？把SP3和34分钟结合起来一起找了一下，发现网上也有这样子的讨论，主要讲了一个就是因为intelppm服务的原因（<a href="http://www.qqread.com/win98/2008/05/h410627.html">紧急修复：SP3升级硬件冲突重启故障</a>，同时为了解决这问题，还找了<a href="http://forums.techarena.in/mediacenter/966902.htm">XP Service Pack 3 fails in MCE 2002 Service Pack 2</a>，比较细致地使用三种方法处理intelppm的问题）。问题依旧<br /><br />方向三：卸载Windows XP SP3<br />主要参考MS官网的<a href="http://support.microsoft.com/kb/950249">如何从您的计算机中删除 Windows XP Service Pack 3</a>一文，但是发现其中提供的几种方法都不适用于这台电脑，要么没有文件夹，要么就是无法启动系统还原（因为普通模式进入不了，安全模式不允许还原）。无语，问题继续依旧。<br /><br />方向四：重装系统<br />为了能及时交差，不得已重装系统。安装完原来的系统之后，系统会寻找各个硬件的驱动程序，发现每当只要安装Texas Instruments PCIxx12 Integrated FlashMedia Controller这个设备的驱动程序后，系统马上就会死机，直觉告诉这很可能就是问题所在。进入安全模式，把所有驱动安装好，然后把这个驱动停用掉，再重新启动正常模式，居然听到了熟悉的开机声音，看来问题已经找到了，不过驱动还没有完全装好<br /><br />方向五：找驱动<br />此驱动在网上还是比较容易找的，但是下载的所有驱动却都没有，如联想Thinkpad、Benq S73等，无一例外地死机了。所以，在安全模式与普通模式徘徊了N次之后，决定不装了，先把它停用再说。问题结束！~<br /><br />到此，问题算是结束了，虽然不算完美。最后的问题解决方向还是有的，譬如驱动没匹配上，中断或其他资源有冲突，升级主板BIOS进行设置等。但是还得先看同事有没有这个需要哦？<br /><br />附：<br />1、解决intelppm服务问题的三种方法（见<a href="http://forums.techarena.in/mediacenter/966902.htm">http://forums.techarena.in/mediacenter/966902.htm</a>）<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">Suggestion </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">: Boot in Safe Mode and disable intelppm<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">=========================</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">. Restart the computer.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">. Keep pressing the F8 key until the Windows Startup menu appears.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">. Choose Safe Mode, and press Enter.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">. Log onto Windows by using the Administrator account or any user account<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />with Administrator privileges.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Note: In Safe Mode, your system display and Desktop will look and perform<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />differently than in Normal Mode. This is only temporary. To </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> to Normal<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Mode, we can simply restart the computer.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">. Click Start, choose Run, type CMD, press Enter.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">6</span>
				<span style="COLOR: #000000">. Copy </span>
				<span style="COLOR: #0000ff">this</span>
				<span style="COLOR: #000000"> line, right</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">click the command prompt, choose Paste, press<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Enter<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />sc config intelppm start</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> disabled<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">7</span>
				<span style="COLOR: #000000">. Restart and check the result.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />If the issue persist, please </span>
				<span style="COLOR: #0000ff">goto</span>
				<span style="COLOR: #000000"> next step:<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Suggestion </span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">: Modify registry keys in Safe Mode<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">==============================</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">. Click Start, choose Run, type regedit, press Enter<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">. Locate HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\intelppm<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">. Right</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">click </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">intelppm</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, choose Export. Save it as </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">intelppm.reg</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">. If any<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />unexpected issue occur, we can open it to restore the registry keys.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">. In the right pane, open </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">Start</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, please change the value to </span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">. Click OK to save the change.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">6</span>
				<span style="COLOR: #000000">. Quit Registry Editor and restart the computer to check the result.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />If the issue persist, please </span>
				<span style="COLOR: #0000ff">goto</span>
				<span style="COLOR: #000000"> next step:<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Suggestion </span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">: Disable the IntelPPM service in Recovery Console:<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">==============================</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">. Insert the Windows XP CD</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">ROM into the CD</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">ROM drive, and then restart the<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />computer.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">. Click to select any options that are required to start the computer from<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />the CD</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">ROM drive </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> you are prompted to </span>
				<span style="COLOR: #0000ff">do</span>
				<span style="COLOR: #000000"> so.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">. When the </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">Welcome to Setup</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> screen appears, press </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">R</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> to start the<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Recovery Console.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">. If you have a dual</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">boot or multiple</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">boot computer, choose the<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />installation that you need to access from the Recovery Console.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">. When you are prompted to </span>
				<span style="COLOR: #0000ff">do</span>
				<span style="COLOR: #000000"> so, type the Administrator password. If the<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />administrator password is blank, just press Enter.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Note: This password </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000"> the </span>
				<span style="COLOR: #0000ff">default</span>
				<span style="COLOR: #000000"> Administrator account is set when<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />installing Windows XP. If you have not set a password </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000"> it, press Enter.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">. Please enter the following command and press the Enter key:<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />disable intelppm<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #000000">6</span>
				<span style="COLOR: #000000">. Restart the computer to check the result.</span>
		</div>
		<br />2、系统常见服务（见<a href="http://kongjian.baidu.com/sevenez/blog/item/acb37b0045a51c14728b651e.html">http://kongjian.baidu.com/sevenez/blog/item/acb37b0045a51c14728b651e.html</a>）<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">系统基本<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />atapi 标准IDE</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">ESDI硬盘控制器。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">1394</span><span style="COLOR: #000000"> ARP 客户端协议 拥有1394接口的电脑都有此驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />AFD 网络支持环境，包括TCP</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">IP NetBIOS Helper Service在内的许多网络服务依赖于它。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />beep 控制主板的蜂鸣器，停用的话它就不出声了。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Crcdisk CRC磁盘筛选驱动程序。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />diskperf 硬盘检测驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />dmboot 启动时用于加载NT磁盘的驱动(平时停用状态)。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />dmload 启动时必须加载的磁盘驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Fips 用于加载和管理磁盘分区的驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />fs_rec 文件系统识别器。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Generic Packet Classifier 普通信息包分类器。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />HTTP Windows XP SP2</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">2003的核心组件，提供应用程序通过HTTP协议通讯的能力。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />IntelIde Intel主板PCI接口驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />IP Network Address Translator 负责IP地址的NAT转换。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />IPSEC driver IPSEC Services依赖于此服务。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />ksecdd 在核心模式(kernel</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">mode)下用户跟LSASS通讯的核心安全设备驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />mnmdd 图形缓冲处理器。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />mountmgr 设备安装管理器。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />NDIS System Driver 无线网络装置的驱动 NDIS全称为Network Device Interface Specification(网络驱动接口标准)。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />NDIS 用户模式 I</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">O 协议 Wireless Zero Configuration 服务依赖它。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />NDProxy NDIS的代理程序<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />NetBios over Tcpip DHCP Client 和 TCP</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">IP NetBIOS Helper 网络服务依赖它<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Null 空，没有意义，不过有些软件需要它。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />PartMgr(Partition Manager) 分区管理。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />ParVdm 视频显示模块虚拟驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />PCIIDE PCI插槽驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />RDPCDD 数据传输端口驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Remote Access Auto Connection Driver 为系统服务Remote Access Auto Connection Manager提供支持。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Serial 串口驱动程序。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Remote Access IP ARP Driver ARP协议驱动，负责IP地址和MAC地址之间的转换。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Remote Access NDIS TAPI Driver 无线网络连接适配器驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />TCP</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">IP Protocol Driver TCP</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">IP协议，DHCP等网络服务都依赖它。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />VgaSave 基本显卡驱动，停止它将使系统无法启动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />VolSnap 为卷影复制功能提供支持。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />第三方<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">.第三方驱动<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />agp440 Intel AGP驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />NVIDIA nForce AGP Bus Filter Nvidia AGP驱动。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />gdrv 技嘉产品的驱动程序。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />ViaIde VIA芯片的IDE驱动<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">.杀毒软件<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)卡巴斯基:kl1、klif。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)诺顿:NAVAP、NAVAPEL、NAVENG、NAVEX15、SymEvent、SAVRT、SAVRTPEL。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">)瑞星:basetdi、hookcont、hookreg、hooksys、MemScan、ExpScan。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">)金山:KWatch3、KNetWch、KWatchSvc、KPfwSvc、KRegEx、KvMemon、PProtect。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">.常用软件<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)QQ:npkcrypt、npkcusb、kmsinput。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)StyleXPService StyleXP的主题服务。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">.流氓软件<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)雅虎助手:CnsMinKP。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)百度搜霸:Bdguard、adsrsvc。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">)划词搜索:abhcop。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">)CNNIC中文上网:AHook、Anfad、CDNTRAN、Cdnprot、FAD、hProcess。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">)MyIEHelper:nwupspx。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">)MMSAssist彩信通:albus、JMediaService。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">7</span><span style="COLOR: #000000">)IE</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">BAR恶意插件:fsprot、moprot。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">)局域网病毒:NetGroup Packet Filter Driver。<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />(</span><span style="COLOR: #000000">9</span><span style="COLOR: #000000">)恶意程序:autorun。</span></div><img src ="http://www.blogjava.net/tanzek/aggbug/233475.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-10-10 04:58 <a href="http://www.blogjava.net/tanzek/archive/2008/10/10/233475.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个比较绚的文本链接滚动效果</title><link>http://www.blogjava.net/tanzek/archive/2008/07/30/218560.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Tue, 29 Jul 2008 16:31:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/07/30/218560.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/218560.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/07/30/218560.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/218560.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/218560.html</trackback:ping><description><![CDATA[
		<p>一个比较绚的文本链接滚动效果，使用CSS+JS实现，有现成的js文件调用。<br /><a href="http://www.webspot.net.cn/?p=140"><br />http://www.webspot.net.cn/?p=140</a></p>
<img src ="http://www.blogjava.net/tanzek/aggbug/218560.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-07-30 00:31 <a href="http://www.blogjava.net/tanzek/archive/2008/07/30/218560.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]Understanding The FTP PORT Command</title><link>http://www.blogjava.net/tanzek/archive/2008/07/16/215168.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Wed, 16 Jul 2008 03:41:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/07/16/215168.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/215168.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/07/16/215168.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/215168.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/215168.html</trackback:ping><description><![CDATA[
		<strong>You may already know that when FTP (File Transfer Protocol)
commands cross the wire, they use port 21 by default. You may also know
that port 20 is assigned to FTP data. Unfortunately, most FTP data
sessions do not actually use port 20.<br /><br /></strong> So you have just taken a trace of an FTP session and noticed
that a PORT command crossed the wire. When you looked at the decode,
you saw the strangest command sequence:
<br /><br />     PORT 10,2,0,2,4,31
<br /><br />[We have several FTP trace files online at 
<br /><a href="http://www.packet-level.com/traceFiles.htm">http://www.packet-level.com/traceFiles.htm</a>.] 
<br /><br />What does this mean? First let us take a look at the purpose of
the PORT command. Then we will decipher the numbers following the
command. <br /><br /><b>THE PORT COMMAND</b><br />FTP communications use two port number values - one for commands
(port 21 by default) and one for data transfer (this is where the PORT
command comes into play). <br /><br />The PORT command is sent by an FTP client to establish a
secondary connection (address and port) for data to travel over. In
some FTP implementations port 20 is used for data, but that is the
exception rather than the rules. Typically in a trace you will see data
crossing over a dynamic port number (IANA states that this range should
be between 49152 through 65535, but most likely you'll see your
application using something just above 1024 - the area that used to be
the dynamic port number area). <br /><br />Figure 1 shows the summary of an FTP communication.  Packet 16 contains the PORT command.  [This trace file is online at <a href="http://www.packet-level.com/traceFiles.htm">http://www.packet-level.com/traceFiles.htm</a>.] 
<br /><br /><center><img src="http://images.ientrymail.com/networknewz/port-pkt16.gif" /><br /><i>Figure 1: The PORT command and parameters are visible in Sniffer's summary column.</i></center><br /><br />An FTP client issues a PORT to the FTP server and defines what
port the client will be listening on for the data channel connection.
Upon receipt of the PORT command, the server establishes a new TCP
connection to the client using that TCP port value. <br /><br />You may see numerous PORT commands issued during a single FTP
session - a new data channel must be established to transfer directory
listings and perform file GET and PUT operations.
<br /><br /><b>The Freaky Numbers</b><br /><br />After the PORT command, you will see a series of six numbers -
these numbers indicate the IP address and port number to use in
establishing a data transfer connection. The first four numbers
(10,2,0,2 in our example above) indicate the client IP address. The
second numbers, 4,15 indicate the client port number. <br /><br />4,15? Strange. When you look at your trace, you would notice
that the server establishes a connection on the client port 1039
(D=1039 in packet 19 in Figure 1). How did we get from 4,15 to 1039?
Here we go. To interpret and translate the value 4,15 into a port
number the receiver must do some decimal to hex translations - here is
an example:
<br /><br />	first number (4) translate to hex (0x04)
<br />	second number (15) translate to hex (0x0F)
<br /><br />Now take the entire set of hex bytes (0x040F) and translate the
bytes from hex to decimal (1055). Figure 2 displays the conversion
value in Hex Workshop's Base Converter applet. (Hex Workshop and Base
Converter are available online at <a href="http://www.bpsoft.com/">www.bpsoft.com</a>.) Voila!  
<br /><br /><center><img src="http://images.ientrymail.com/networknewz/port-translate.jpg" /><br /><i>Figure 2: Hex value 040F is equivalent to decimal value 1039. </i></center><br /><br />Most folks get snagged when they try to translate both decimal
values as a single set (415 = 0x019F) - that just will not work. You
must split the values and convert individually to hex before combining
and converting to decimal. <br /><br />Now you know - when you see another PORT command on the wire,
you should be able to guess what port the data transfer process will
use.<br /><br /><em><a href="http://www.securitypronews.com/authors/laurachappell.html">View All Articles by Laura Chappell </a></em><br /><br /><hr /><p><strong>About the Author: </strong><br />
Laura Chappell is the Sr. Protocol Analyst for the Protocol Analysis
Institute.  Laura focuses on researching, writing and lecturing on
network analysis and security.  In 2003, over 60 of Laura's courses
become available via internet/CD and a series of "White Hat Toolbox:
Security Tools, Tricks and Traces" are releasing at
<a href="http://www.packet-level.com/">http://www.packet-level.com</a>.  Laura can be reached at
<a href="mailto:lchappell@packet-level.com">lchappell@packet-level.com</a>.  </p><a href="http://www.securitypronews.com/it/networksystems/it_network_systems-archive.html" class="topLink">More it_network_systems Articles</a><p><br /></p><p>Traceback: <a target="_blank" title="http://www.securitypronews.com/it/networksystems/spn-21-20030917UnderstandingtheFTPPORTCommand.html" href="http://www.securitypronews.com/it/networksystems/spn-21-20030917UnderstandingtheFTPPORTCommand.html">http://www.securitypronews.com/it/networksystems/spn-21-20030917UnderstandingtheFTPPORTCommand.html</a><br /></p><img src ="http://www.blogjava.net/tanzek/aggbug/215168.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-07-16 11:41 <a href="http://www.blogjava.net/tanzek/archive/2008/07/16/215168.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>A Timeless Way of Building Software</title><link>http://www.blogjava.net/tanzek/archive/2008/05/26/203057.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Mon, 26 May 2008 15:08:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/05/26/203057.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/203057.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/05/26/203057.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/203057.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/203057.html</trackback:ping><description><![CDATA[
		<font face="Georgia" size="2">Most of my readers know that I'm a software architect by trade.  I've been creating software large and small for over twenty years.  And I've experienced movement after movement in software design from <em>object-orientation</em> in the 1980s and early 90s to <em>component-based design</em>, <em>distributed objects</em>, <em>Web-based software</em>, <em>service-oriented architecture</em> and too many others to even mention.  I'm pretty jaded at this point because I've learned, in general, the problems that you couldn't solve in the previous generation of technique are often only marginally more solveable in the next generation (which is invariably invented to "fix" the previous problems.) <br /><br />Alas, a genuinely better mousetrap is really hard to find.<br /><br />So in the end, if you couldn't do whatever it is you wanted to do with the previous generation of technique, it's actually not that likely you'll succeed in the next.  Certain software problems remain hard, and in general, it mysteriously happens to involve the juncture between technology and people in some way.  To paraphrase this, I could say that the software and techniques get better fairly constantly, but people remain the same.<br /><br />And please, bear with me because I'm going to try out a real zinger on you in a minute.  <br /><br />Because every once in a long while, something <em>new and big</em> actually does come along.  Or at least something that <em>looks </em>new and big.  One of the new and big things that came along about ten years ago was the concept of </font>
		<a href="http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29">
				<em>
						<font face="Georgia" size="2">design patterns</font>
				</em>
		</a>
		<font face="Georgia" size="2">.  It was pretty neat stuff.  It said that despite the current technology we have, the processes that continue to evolve, there are certain timeless solutions to certain software design problems.  It was a revelation at the time.  And the writers of the </font>
		<a href="http://www.amazon.com/exec/obidos/tg/detail/-/0201633612?v=glance">
				<font face="Georgia" size="2">book that explained this</font>
		</a>
		<font face="Georgia" size="2"> got both famous and very successful.  Why? Because these design patterns really worked is why.  And anyone who has read the books and has ever really built software recognizes these patterns.  And what was strange was that no one really expected it. One day, we just had them.  And the kicker was, they were always there, but now they were in our conscious thought and we had real names for them.  <em>My point</em>: They were in our face all the time but most of us couldn't see them.<br /><br />We are in a similar place with the Web right now.  We've done this Web stuff enough now that we are just beginning to see the design patterns.  What works, and why, in a specific situations, bounded by forces.  Some folks have had the hubris to give this next generation a name and to tease out these patterns.  Some people are just now going <em>aha</em>, and some people haven't got it yet, and most of the rest of us either aren't ready for it or just haven't heard of it.  But, I will tell you this.  It's quite real.  The best practices and design patterns of Web software are just starting to become understood.  The strange part is, we're discovering the same things over again.  What's old is new again.<br /><br />Now, before you get all worked up or worse, I bore you and you stop reading, I will give you a nice list of the the forces behind these patterns.  If you recall, design patterns are a solution to a problem in context.  We are starting to get the context and even the outlines of the patterns of this "new" generation of software.  But we have a long way to go still.  The Web is a monstrously big space with big problems, and it's not getting better.  There are </font>
		<a href="http://www.useit.com/alertbox/internet_growth.html">
				<font face="Georgia" size="2">one billion of us</font>
		</a>
		<font face="Georgia" size="2"> out here now.  Clearly understanding what it takes to create great software on the Web that is successful, useful, and vibrant will be an ongoing challenge for a <em>long time</em>.  But it will get easier because we are codifying our knowledge of this exciting and huge place where we now find ourselves.<br /><br /><br /></font>
		<div align="center">
				<font face="Georgia" size="2">
						<img alt="The Timeless Way of Software" src="http://hinchcliffe.org/img/timelesswayofsoftware.jpg" />
						<br />
				</font>
		</div>
		<br />
		<div align="center">
				<font size="2">
						<font face="Georgia">
								<strong>Figure 1:  </strong>The driving forces in modern software.<br />With a rough comparison between SOA<br />and The Timeless Way (Web 2.0 by any other name).</font>
				</font>
		</div>
		<br />
		<font face="Georgia" size="2">
				<br />Now is where I'm going to hit you with a flight of fancy.  I'm going to use <a href="http://en.wikipedia.org/wiki/Christopher_Alexander">Christopher Alexander's</a> opening chapter of a <a href="http://www.davidsheen.com/words/timeless.htm">Timeless Way of Building</a> and tailor it to describe this old-but-new way of building the Web and software for it.  We are lacking for a little inspiration and this book in particular continues to sell upwards of 10,000 copies a year, 25 years after it was frst published.  And Christopher Alexander, for those of you who may not know, was the person that originally discovered the design pattern.  But it wasn't for software.  It was for creating great, timeless buildings.  He was one of the first that realized that his field of endeavor has certain elemental, timeless cores, no matter the technique, building material, or the people.  It was an amazing discovery that poured over into the software world with considerable success.  <br /><br />My assertion is that nothing has really changed in software, we might understand the forces better but they are almost always the same.  People want software that does what they want, is available when they need it.  They want software that grows with them, helps them, teaches them, and lets them do the same with others.  They want software that gets out of their way, disappears, and is more convenient by far than inconvenient.  A</font>
		<font face="Georgia" size="2">nd they want to pay as little as possible for it, but enough so that it's worth it.  </font>
		<font face="Georgia" size="2">They are willing to have software get right into the middle of their lives.  If it's the right software.  And as long as we've had software, they've always wanted this. But now they might actually start getting it.<br /><br />In any case, I don't literally believe every phrase in this take-off, but I do believe the overall concept deeply and profoundly as a software professional.  And I will continue to update the diagram above (clearly marked <em>beta 1</em>) until we have more of the forces in it. And some are definitely missing.  <em>Please, as always, leave any comments and suggestions for improvement below</em>.<br /><br />And now, without further ado, here is the <em>The Timeless Way of Building Software</em>, with <em>sincere </em>apologies to Christopher Alexander:<br /></font>
		<font face="Georgia" size="2">
				<br />
		</font>
		<br />
		<div align="center">
				<font color="#0000ff" size="5">
						<strong>
								<font face="Georgia">The Timeless Way of Building Software</font>
						</strong>
				</font>
				<br />
		</div>
		<br />
		<div align="center">
				<font color="#0000ff">
						<em>
								<font face="Georgia" size="2">Inspiration For The Next Generation of Web Software</font>
						</em>
				</font>
				<br />
		</div>
		<br />
		<font face="Georgia" size="2">
				<br />There is <em>one timeless way</em> of building software.  It is decades old and is the same today as it's always been.  And because it is timeless, it will always remain this way.<br /><br />The great software of our time has always been created by people who were close to this way.  It isn't possible to create great software - software that is satisfying, and useful, and makes itself a natural extension of life - except by following this way.  And as you will see, this way will lead anyone who looks for it to elegant, vibrant software which is itself timeless in its form.<br /><br />It is the process by which the function of a piece of software grows directly from the inner nature of people and naturally out of the raw bits, the otherwise meaningless digital medium, of which it is made.<br /><br />It is a process which allows the life inside a person, or a group of people, or a community to flourish, openly, in freedom, so vividly that it gives rise, of its own accord, to the natural order which is needed to be contained within it.<br /><em><br />It is so powerful and fundamental that with its help you can create software that is as beautiful and enriching as anything else you have ever seen.</em><br /><br />Once you understand this way, you yourself will be able to create software that is alive, that is intertwined comfortably with your life and the lives of others. You will design worlds where you and others will want to work, play, and co-exist together; beautiful places where you can sit and dream comfortably.<br /><br />This way is so powerful, that with its help hundreds or thousands, or even hundreds of thousands of people, can come together together to create software and community which is as alive and vibrant, peaceful and relaxed, as any living experience has ever been.<br /><br />Without the central control of authorities and experts, if you are working in this timeless way, a genuine place will grow right from underneath your fingertips, as steady as the grass in the fields or the trees in your backyard.<br /><br /><em>And there is no other way in which a software which is fundamentally good can possibly be made.</em><br /><br />That doesn't mean that all ways of making software are identical.  Quite the contrary. It means that at the core of all successful software and at the core of all successful processes of creation and evolution, there is one fundamental invariant feature which is responsible for their success.  Although this way has taken on a thousand different forms at different times, in different places, still, there is an unavoidable, invariant core to all of them.<br /><br />Take a look at the some of the great Web software like Google's search page, Flickr or del.icio.us.  They all have that unique, yet unhurried, grace which comes from perfect ease and natural balance.  But what is it they have in common exactly?  They are beautiful, ordered, harmonious - yes, all of these things.  But especially, and what strikes to the heart, they <em>live</em>.<br /><br /><em>Each one of us yearns to be able to bring something to life like this. Or just be a part of it somehow.</em><br /><br />It is a fundamental human instinct, as much a part of our desire as the desire to be part of something greater than ourselves.  It is, quite simply, the desire to make a part of nature, to complete a world which is already made of mountains, streams, stones, buildings, ourselves, our living systems, and our increasing connectedness together.<br /><br />Each one of us has, somewhere in our heart, the dream to make a living world, a universe, and place of our own for us to share with others.<br /><br />Those of us who have trained as software designers have this desire perhaps at the very center of our lives; that one day, somewhere, somehow, we shall build a software experience which is wonderful, beautiful, and breathtaking; a place where people can go and live their dreams.<br /><br />In some form, every person has some version of this dream; whoever you are, you may have the dream of one day creating a most beautiful place, virtual or otherwise, where you can come together with others and freely share your knowledge, learn, participate in your community or government, and otherwise conduct your daily interaction with the rest of the world.<br /><br />In some less clear fashion, anyone who is concerned with communities and other large group efforts has this same dream, perhaps for the entire world.<br /><br /><em>And there is a way that software can actually be brought to life like this.</em><br /><br />There is a definable sequence of activities which are the heart of all acts of software design, and it is possible to specify, precisely, under way conditions these activities will generate software which is alive.  All this can be made so explicit that anyone can do it.<br /><br />And just so, the process by which a group of independent people can make software become alive and create a place as real as any other can equally be made precise.  Again, there is a definable sequence of activities, more complex in this case, which are the heart of all collective processes of software creation.  And it is also possible to specify exactly when these processes will bring things to life.  And once again, these processes can be made so explicit, and so clear, that any <em>group </em>of people can make use of them.<br /><br />This process is behind the design of community built software like Linux, Apache, Wikipedia, and many others.  It was behind the design of the great virtual places for people to live and work: the Internet, Usenet, and the World Wide Web.  It was behind the creation of simple, satisfying software of the kind that powers the iPod, the Blackberry, and Firefox; of SourceForge, Wikipedia, and BitTorrent.  In an unconscious form, this way has been behind almost all ways of creating software since the beginning.<br /><br />But it has become possible to identify it, only now, by going to a level of analysis which is deep enough to show what is invariant in all of the different versions of this way.<br /><br /><em>This hinges on a form of representation which reveals all possible design processes, as versions of one most fundamental set of patterns.</em><br /><br />First, we have a way of looking at the ultimate constituents of the environment: the ultimate "things" which a piece of software is made of.  As we shall see, every piece of software is made of certain fundamental entities known as design patterns; and once we understand software in terms of its patterns, we have a way of looking at them, which makes all software, all of their parts and function, all members of the same class of thing.<br /><br />Second, we have a way of understanding the generative processes which give rise to these patterns: in short, the source from which the ultimate constituents of software come.  These patterns tend to come from certain combinatory processes, which are different in the specific patterns that they generate, but always similar in their overall structure, and in the way they work.  They are essentially like languages.  And again, in terms of these pattern languages, all the different way of building software, although different in detail, become similar in general outline.<br /><br />At this level of analysis, we can compare many different software creation processes.<br /><br />Then, once we see their differences clearly, it becomes possible to define the difference between those processes which make software vibrant, alive, and useful, and those which make them the opposite.<br /><br />And it turns out that, invariant, behind all processes which allow us to make great software, there is a single common process.<br /><br />This single idea is operational and precise.  It is not merely a vague idea, or a class of processes which we can understand: it is conrete enough and specific enough, so that it functions practically.  It gives us the power to make software and virtual communities live, as concrete as a match gives us the power to make flame.  It is a method of a discipline, which teaches us precisely what we have to do make our software what we want it to be.<br /><br />But though this method is precise, it cannot be used mechanically.<br /><br />The fact is, that even when we have seen deep into the processes by which it is possible to make software alive, in the end, it turns out this knowledge only brings us back to that part of ourselves which is forgotten.  Although the process is precise, and can be defined in exact scientific terms, finally it becomes valuable, not so much because it shows us things which we don't know (though it may do that as well), but instead, because it shows us what we know already.<br /><br />Of course, this way of building software has never be named.  It's not service-oriented architecture, or the personal software process, or agile methodology, or the unified process, or CMM, or any of the others.  It's the actual things that are conceived and done and worried about when software is created and used.  For now, because all software is quickly becoming connected to all other software, and because the Web is becoming the place where more and more of the relevant software is, and finally because it is a more complete reconception of what we thought we knew, we'll give it a name temporarily.  An unsatisfying name, but one that we can remember for now. <br /><br />We will call it Web 2.0.<br /><br /></font>
		<font face="Georgia" size="2">
				<em>What do you think?  Are we at a place where we can really identify the design patterns in Web 2.0?<br /><br /></em>Traceback:  <a href="http://web2.wsj2.com/a_timeless_way_of_building_software.htm">http://web2.wsj2.com/a_timeless_way_of_building_software.htm</a></font>
<img src ="http://www.blogjava.net/tanzek/aggbug/203057.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-05-26 23:08 <a href="http://www.blogjava.net/tanzek/archive/2008/05/26/203057.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转] 软件企业以人为本的16项措施</title><link>http://www.blogjava.net/tanzek/archive/2008/05/25/202682.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 25 May 2008 01:19:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/05/25/202682.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/202682.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/05/25/202682.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/202682.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/202682.html</trackback:ping><description><![CDATA[
		<h3>

		软件企业以人为本的16项措施

		</h3>
		<font face="宋体">
				<font size="3">  以人为本不能停留在口头上，要落实到具体的实施上，以下是我的实践或是我在软件企业看到的实践：</font>
		</font>
		<br />
		<font size="3">
				<font face="\&quot;宋体\&quot;">(1) 重视现有的员工胜过去搜索外面的新人</font>
		</font>
		<br />(<font face="宋体"><font size="3">2) 鼓励员工在职深造，学成归来的要重用</font></font><br /><font face="宋体"><font size="3">(3) 招高水平的员工进来</font></font><br /><font size="3"><font face="\&quot;宋体\&quot;">(4) 稳定的高于本地域行业平均水平的收入，使其没有后顾之忧，专心事业</font></font><br />(<font face="宋体"><font size="3">5) 为每一个员工进行职业路线的规划</font></font><br /><font size="3"><font face="\&quot;宋体\&quot;">(6) 通过股权等激励措施鼓励员工长期在企业内工作</font></font><br />(<font face="宋体"><font size="3">7) 用人所长,不勉强员工做不乐意做的工作</font></font><br />(<font face="宋体"><font size="3">8) 设置部门内部沟通经费</font></font><br />(<font face="宋体"><font size="3">9) 轮岗制，加强岗位之间的互相理解，培养员工的综合能力</font></font><br />(<font face="宋体"><font size="3">10) 增加培训的经费，做好定向培训</font></font><br />(<font face="宋体"><font size="3">11) 通过明确定义其工作产品来反映他的业绩，并使其有成就感</font></font><br /><font size="3"><font face="\&quot;times\&quot;">(12) </font><font face="\&quot;宋体\&quot;">及时认可员工的业绩，为其喝彩</font></font><br />(<font face="宋体"><font size="3">13) 不限定明确的上下班时间，只要保证每天8小时即可</font></font><br />(<font face="宋体"><font size="3">14) 提供宽松舒适的工作环境，如中间的休息，点心、饮料等</font></font><br />(<font face="宋体"><font size="3">15) 有专职的后勤人员负责处理各种杂事,如报销、火车票预定等，减少对开发人员的干扰</font></font><br /><font size="3"><font face="\&quot;times\&quot;">(16) </font><font face="\&quot;宋体\&quot;">管理部门实际是服务部门，要明确服务意识，不要培养公司的官僚作风</font></font><br /><br />来源：http://dylan1971.blog.ccidnet.com/blog-htm-itemid-270462-uid-37742-do-showone-type-blog.html<br /><img src ="http://www.blogjava.net/tanzek/aggbug/202682.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-05-25 09:19 <a href="http://www.blogjava.net/tanzek/archive/2008/05/25/202682.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>你的SimpleDateFormat起作用了吗？</title><link>http://www.blogjava.net/tanzek/archive/2008/04/29/197381.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Tue, 29 Apr 2008 12:52:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/04/29/197381.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/197381.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/04/29/197381.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/197381.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/197381.html</trackback:ping><description><![CDATA[通过SimpleDateFormat格式化日期输出是一种常见的用法，如下：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">SimpleDateFormat sdf </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SimpleDateFormat(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">yyyy-MM-dd HH:mm:ss</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />System.out.println(sdf.format(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Date()));</span></div>如果上述代码正常工作，它将显示当前的日期年月日时分秒格式。<br /><br />但是有时候它并没有如我们预期的那样，而显示的时间比当前的时间少了八个小时，或是多了八个小时，而这一切就需要我们再关注另外一个问题，那就是时区（TimeZone）。<br />如果我们将时区进行设置为“东八区”，那么就一切回复正常了。如下有两种方式：<br /><br />1、通过改变默认的时区<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">TimeZone.setDefault(TimeZone.getTimeZone(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">GMT+8:00</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />SimpleDateFormat sdf </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SimpleDateFormat(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">yyyy-MM-dd HH:mm:ss</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />System.out.println(sdf.format(Calendar.getInstance()));</span></div><br />2、通过设定SimpleDateFormat的构造参数<br />    通过查阅API手册，可知SimpleDateFormat还有一个构造函数：<a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html#SimpleDateFormat(java.lang.String, java.util.Locale)"><strong><font face="Courier New">SimpleDateFormat</font></strong></a><font face="Courier New">(</font><a title="class in java.lang" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html"><font face="Courier New">String</font></a><font face="Courier New"> pattern, </font><a title="class in java.util" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Locale.html"><font face="Courier New">Locale</font></a><font face="Courier New"> locale)</font> ，因此我们就可通过设定Locale来取得特定时区的日期格式。<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">SimpleDateFormat sdf </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> SimpleDateFormat(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">yyyy-MM-dd HH:mm:ss</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, Locale.CHINA);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />System.out.println(sdf.format(new Date());</span></div><br />到这时候，关于时区的简单设定就结束了，更多的参考请在网上搜索关于Java Locale的设定文章。<img src ="http://www.blogjava.net/tanzek/aggbug/197381.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-04-29 20:52 <a href="http://www.blogjava.net/tanzek/archive/2008/04/29/197381.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java Web的中文问题</title><link>http://www.blogjava.net/tanzek/archive/2008/03/20/187407.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Thu, 20 Mar 2008 01:43:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/03/20/187407.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/187407.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/03/20/187407.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/187407.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/187407.html</trackback:ping><description><![CDATA[
		<p>摘自王俊标编著的《精通Java Web开发-基于Struts EJB Hibernate JBuilder》一书：<br /><br />1、页面请求<br />   采用Filter过滤器方式：<br />                  web.xml片段</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008080"> 1</span>
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">……<br /></span>
				<span style="COLOR: #008080"> 2</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000"> filter 配置 </span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 3</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">filter</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 4</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000"> filter 别名 </span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 5</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">filter-name</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">encodingfilter</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">filter-name</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 6</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000"> 类文件位置 </span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 7</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">filter-class</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">login3.EncodingFilter</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">filter-class</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 8</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        <br /></span>
				<span style="COLOR: #008080"> 9</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000"> 定义属性encoding="gb2312" 即指定编码类型 </span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">10</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">init-param</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">11</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">desription</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">encode to gb2312</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">desription</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">12</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">param-name</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">encoding</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">param-name</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">13</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">param-value</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">gb2312</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">param-value</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">14</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">init-param</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">15</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">filter</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">16</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
						<br />
				</span>
				<span style="COLOR: #008080">17</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000"> filter 映射配置 </span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">18</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">filter-mapping</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">19</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000"> 定义该filter 处理所有格式的请求 </span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">20</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">filter-name</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">encodingfilter</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">filter-name</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">21</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">url-pattern</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">/*</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">url-pattern</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">22</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">filter-mapping</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">23</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />……</span>
		</div>
		<p>         EncodingFilter.java<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008080"> 1</span>
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> java.io.IOException;<br /></span>
				<span style="COLOR: #008080"> 2</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
						<br />
				</span>
				<span style="COLOR: #008080"> 3</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> javax.servlet.</span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">;<br /></span>
				<span style="COLOR: #008080"> 4</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> javax.servlet.http.HttpServlet;<br /></span>
				<span style="COLOR: #008080"> 5</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
						<br />
				</span>
				<span style="COLOR: #008080"> 6</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> EncodingFilter </span>
				<span style="COLOR: #0000ff">extends</span>
				<span style="COLOR: #000000"> HttpServlet <br /></span>
				<span style="COLOR: #008080"> 7</span>
				<span style="COLOR: #000000">
						<img id="Codehighlighter1_161_1000_Open_Image" onclick="this.style.display='none'; Codehighlighter1_161_1000_Open_Text.style.display='none'; Codehighlighter1_161_1000_Closed_Image.style.display='inline'; Codehighlighter1_161_1000_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_161_1000_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_161_1000_Closed_Text.style.display='none'; Codehighlighter1_161_1000_Open_Image.style.display='inline'; Codehighlighter1_161_1000_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">implements</span>
				<span style="COLOR: #000000"> Filter </span>
				<span id="Codehighlighter1_161_1000_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_161_1000_Open_Text">
						<span style="COLOR: #000000">{<br /></span>
						<span style="COLOR: #008080"> 8</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span>
						<span style="COLOR: #008080"> 9</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">private</span>
						<span style="COLOR: #000000"> FilterConfig filterConfig;<br /></span>
						<span style="COLOR: #008080">10</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span>
						<span style="COLOR: #008080">11</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">private</span>
						<span style="COLOR: #000000"> String targetEncoding </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">;<br /></span>
						<span style="COLOR: #008080">12</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span>
						<span style="COLOR: #008080">13</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_313_424_Open_Image" onclick="this.style.display='none'; Codehighlighter1_313_424_Open_Text.style.display='none'; Codehighlighter1_313_424_Closed_Image.style.display='inline'; Codehighlighter1_313_424_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_313_424_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_313_424_Closed_Text.style.display='none'; Codehighlighter1_313_424_Open_Image.style.display='inline'; Codehighlighter1_313_424_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> init(FilterConfig filterConfig) </span>
						<span style="COLOR: #0000ff">throws</span>
						<span style="COLOR: #000000"> ServletException </span>
						<span id="Codehighlighter1_313_424_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_313_424_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">14</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">.filterConfig </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> filterConfig;<br /></span>
								<span style="COLOR: #008080">15</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">.targetEncoding </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">.filterConfig.getInitParameter(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">encoding</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /></span>
								<span style="COLOR: #008080">16</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">17</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">18</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> doFilter(ServletRequest request, ServletResponse response,<br /></span>
						<span style="COLOR: #008080">19</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_558_909_Open_Image" onclick="this.style.display='none'; Codehighlighter1_558_909_Open_Text.style.display='none'; Codehighlighter1_558_909_Closed_Image.style.display='inline'; Codehighlighter1_558_909_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_558_909_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_558_909_Closed_Text.style.display='none'; Codehighlighter1_558_909_Open_Image.style.display='inline'; Codehighlighter1_558_909_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            FilterChain chain) </span>
						<span style="COLOR: #0000ff">throws</span>
						<span style="COLOR: #000000"> IOException, ServletException </span>
						<span id="Codehighlighter1_558_909_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_558_909_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">20</span>
								<span style="COLOR: #000000">
										<img id="Codehighlighter1_566_725_Open_Image" onclick="this.style.display='none'; Codehighlighter1_566_725_Open_Text.style.display='none'; Codehighlighter1_566_725_Closed_Image.style.display='inline'; Codehighlighter1_566_725_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_566_725_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_566_725_Closed_Text.style.display='none'; Codehighlighter1_566_725_Open_Image.style.display='inline'; Codehighlighter1_566_725_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">try</span>
								<span style="COLOR: #000000"> </span>
								<span id="Codehighlighter1_566_725_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_566_725_Open_Text">
										<span style="COLOR: #000000">{<br /></span>
										<span style="COLOR: #008080">21</span>
										<span style="COLOR: #000000">
												<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            System.out.println(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">targetEncoding :</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> targetEncoding </span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">\n</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">);<br /></span>
										<span style="COLOR: #008080">22</span>
										<span style="COLOR: #000000">
												<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            request.setCharacterEncoding(targetEncoding);<br /></span>
										<span style="COLOR: #008080">23</span>
										<span style="COLOR: #000000">
												<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            chain.doFilter(request, response);<br /></span>
										<span style="COLOR: #008080">24</span>
										<span style="COLOR: #000000">
												<img id="Codehighlighter1_755_817_Open_Image" onclick="this.style.display='none'; Codehighlighter1_755_817_Open_Text.style.display='none'; Codehighlighter1_755_817_Closed_Image.style.display='inline'; Codehighlighter1_755_817_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_755_817_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_755_817_Closed_Text.style.display='none'; Codehighlighter1_755_817_Open_Image.style.display='inline'; Codehighlighter1_755_817_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">catch</span>
								<span style="COLOR: #000000"> (ServletException sx) </span>
								<span id="Codehighlighter1_755_817_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_755_817_Open_Text">
										<span style="COLOR: #000000">{<br /></span>
										<span style="COLOR: #008080">25</span>
										<span style="COLOR: #000000">
												<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            filterConfig.getServletContext().log(sx.getMessage());<br /></span>
										<span style="COLOR: #008080">26</span>
										<span style="COLOR: #000000">
												<img id="Codehighlighter1_843_906_Open_Image" onclick="this.style.display='none'; Codehighlighter1_843_906_Open_Text.style.display='none'; Codehighlighter1_843_906_Closed_Image.style.display='inline'; Codehighlighter1_843_906_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_843_906_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_843_906_Closed_Text.style.display='none'; Codehighlighter1_843_906_Open_Image.style.display='inline'; Codehighlighter1_843_906_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">catch</span>
								<span style="COLOR: #000000"> (IOException iox) </span>
								<span id="Codehighlighter1_843_906_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_843_906_Open_Text">
										<span style="COLOR: #000000">{<br /></span>
										<span style="COLOR: #008080">27</span>
										<span style="COLOR: #000000">
												<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            filterConfig.getServletContext().log(iox.getMessage());<br /></span>
										<span style="COLOR: #008080">28</span>
										<span style="COLOR: #000000">
												<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
								</span>
								<span style="COLOR: #008080">29</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">30</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span>
						<span style="COLOR: #008080">31</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_936_997_Open_Image" onclick="this.style.display='none'; Codehighlighter1_936_997_Open_Text.style.display='none'; Codehighlighter1_936_997_Closed_Image.style.display='inline'; Codehighlighter1_936_997_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_936_997_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_936_997_Closed_Text.style.display='none'; Codehighlighter1_936_997_Open_Image.style.display='inline'; Codehighlighter1_936_997_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> destroy() </span>
						<span id="Codehighlighter1_936_997_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_936_997_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">32</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">.filterConfig </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">null</span>
								<span style="COLOR: #000000">;<br /></span>
								<span style="COLOR: #008080">33</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">.targetEncoding </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">null</span>
								<span style="COLOR: #000000">;<br /></span>
								<span style="COLOR: #008080">34</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">    <br /></span>
						<span style="COLOR: #008080">35</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">36</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
		<p>
				<br />2、Web容器编码<br />      在Tomcat的的源代码中的getParameter()方法，用户调用request.getParameter()方法时，首先调用parsetParameters()方法，在这里面将编码进行转换。如：<br />      String s_target = new String (s_source.getBytes("iso-8859-1"), "gb2312);<br /><br />3、数据库<br />      MySQL中文问题的主要原因是：它对数据进行编码时，采用了和底层的操作系统所不同的编码。通常MySQL在中文Windows平台上正确的编码方式是GBK。因此只要将MySQL安装目录下的my.ini文件中的default-character-set选项设为GBK即可。<br /><br />4、响应结果<br />      对于Servlet的代码处理，可以使用：<br />         ……<br />         respsonse.setContentType("text/html;charset=GB2312");<br />         ……<br />      对于JSP文件，可以在开头部分添加如下声明：<br />         ……<br />         &lt;%@ page contentType="text/html;charset=GB2312" %&gt;<br />         ……<br />      对于HTML页面文件，则在开头部分添加声明如下：<br />         ……<br />         &lt;head&gt;<br />            &lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=GB2312"&gt;<br />         &lt;/head&gt;<br />         ……<br />5、XML文件<br />      在采用"UTF-8"方式编码的情况下，使用XML文件存储中文数据常常会出现乱码的问题，建议使用"GB2312"：<br />      &lt;?xml version='1.0' encoding="GB2312"</p>
<img src ="http://www.blogjava.net/tanzek/aggbug/187407.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-03-20 09:43 <a href="http://www.blogjava.net/tanzek/archive/2008/03/20/187407.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC++中的ON_COMMAND_RANGE宏</title><link>http://www.blogjava.net/tanzek/archive/2008/01/26/177905.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sat, 26 Jan 2008 05:51:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/01/26/177905.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/177905.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/01/26/177905.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/177905.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/177905.html</trackback:ping><description><![CDATA[
		<font color="#000000">VC++中的ON_COMMAND_RANGE宏和ON_COMMAND等宏一样，是用来声明消息处理函数的，与<br />ON_COMMAND不同的是，此宏可用来定义一组消息的处理函数。<br /><br />两个宏的用法是：<br /><strong>ON_COMMAND(</strong><i>id</i><b>,</b><i>memberFxn</i><strong>)<br />ON_COMMAND_RANGE(</strong><i>id1</i><strong>,</strong><i>id2</i><strong>,</strong><i>memberFxn</i><strong>)<br /><br /></strong>看起来其中<em>memberFxn</em>似乎没有什么差别，但是在学习使用中，发现ON_COMMAND_RANGE宏中的<em>memberFxn</em>常常会被定义成带参数的处理函数，而ON_COMMAND则是不带参数的处理函数。这就让我奇怪了，于是查阅MSDN的解释，循着提供的线索一直查到了《<em>Visual C++ Programmer’s Guide</em>》中的《Handlers for Message-Map Ranges》一章，于是在《Declaring the Handler Function》一节中找到了答案，引用原文如下：<br /><p><font style="BACKGROUND-COLOR: #d3d3d3">Handler functions for single commands normally take no parameters. With the exception of update handler functions, handler functions for message-map ranges require an extra parameter, <i>nID</i>, of type <b>UINT</b>. This parameter is the first parameter. The extra parameter accommodates the extra command ID needed to specify which command the user actually chose.</font>  <br /><br />为了帮助和我一样不太懂英文的朋友，顶着头皮翻译了下：<br /><font style="BACKGROUND-COLOR: #f5f5dc">单个命令（消息）的处理函数通常不带参数。但是更新处理函数、针对消息映射范围的处理函数需要一个额外的参数，一个UINT类型的<em>nID</em>。此参数是第一个参数，这个额外的参数收集了用来指定用户真正选择命令的命令ID。</font></p>因此完全可以一个带参数的消息处理函数来接收指定的命令ID，不过这里要提醒朋友一点的是，并不是非得只有一个参数，可以使用多个参数的消息处理函数，如<em>function(WPARAM wParam, LPARAM lParam)</em>，但是真正能够使用的参数是第一个参数<em>wParam</em>，它是用户选择的命令ID。</font>
		<br />
		<br />对于更新处理函数，也存在相对应于ON_COMMAND_RANGE的<strong>ON_UPDATE_COMMAND_UI_RANGE</strong>宏，它的作用也是处理连续的范围(contiguous range)，但是它与ON_COMMAND_RANGE有一点点区别。通过上面可知，一般范围处理函数(ON_COMMAND_RANGE)是通过在处理函数后面加一个参数，当消息进行处理时，将会把该命令ID传至该参数。而ON_UPDATE_COMMAND_UI_RANGE则使用的是<em>pCmdUI</em>，一个<strong>CCmdUI</strong>的指针类型，它内部就包含了一个数据成员(m_nID)，用来指向命令ID，具体请参考MSDN中的内容。上述内容在MSDN中的《<em>Visual C++ Programmer’s Guide</em>》中的《Handlers for Message-Map Ranges》一章《Example for a Range of Command IDs》一节中可以找到原文：<br /><p><font style="BACKGROUND-COLOR: #d3d3d3">Update handler functions for single commands normally take a single parameter, <i>pCmdUI</i>, of type <b>CCmdUI*</b>. Unlike handler functions, update handler functions for message-map ranges do not require an extra parameter, <i>nID</i>, of type <b>UINT</b>. The command ID, which is needed to specify which command the user actually chose, is found in the <b>CCmdUI</b> object.<br /></font></p>意思大概也是：<br /><font style="BACKGROUND-COLOR: #f5f5dc">单个命令的更新处理函数通常只带一个参数，即一个CCmdUI指针类型的pCm<em>dUI</em>。不像普通的处理函数一样，针对消息映射范围的更新处理函数不需要一个额外的UINT参数nID，这个用来指定用户真正选择的命令ID，能够在CCmdUI对象中找到。</font><img src ="http://www.blogjava.net/tanzek/aggbug/177905.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-01-26 13:51 <a href="http://www.blogjava.net/tanzek/archive/2008/01/26/177905.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>OpenGL in VC++</title><link>http://www.blogjava.net/tanzek/archive/2008/01/19/176379.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Fri, 18 Jan 2008 16:30:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/01/19/176379.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/176379.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/01/19/176379.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/176379.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/176379.html</trackback:ping><description><![CDATA[首先看一个简单的例子：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">windows.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">math.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">gl</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">gl.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">gl</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">glu.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">gl</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">glaux.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> screenWidth </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">640</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> screenHeight </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">480</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">GLdouble A, B, C, D;<br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> myInit(</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">    glClearColor(</span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">    glColor3f(</span><span style="COLOR: #000000">0.0f</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">0.0f</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">0.0f</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">    glPointSize(</span><span style="COLOR: #000000">2.0</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">    glMatrixMode(GL_PROJECTION);<br /></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">    glLoadIdentity();<br /></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">    gluOrtho2D(</span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">, (GLdouble)screenWidth, </span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">, (GLdouble)screenHeight);<br /></span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">    A </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> screenWidth </span><span style="COLOR: #000000">/</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">4.0</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">20</span> <span style="COLOR: #000000">    B </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0.0</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">21</span> <span style="COLOR: #000000">    C </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> D </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> screenHeight </span><span style="COLOR: #000000">/</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">2.0</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">22</span> <span style="COLOR: #000000">}<br /></span><span style="COLOR: #008080">23</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">24</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> myDisplay(</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">25</span> <span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">26</span> <span style="COLOR: #000000">    glClear(GL_COLOR_BUFFER_BIT);<br /></span><span style="COLOR: #008080">27</span> <span style="COLOR: #000000">    glBegin(GL_POINTS);<br /></span><span style="COLOR: #008080">28</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(GLdouble x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; x</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">4.0</span><span style="COLOR: #000000">; x</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">0.005</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">29</span> <span style="COLOR: #000000">    {<br /></span><span style="COLOR: #008080">30</span> <span style="COLOR: #000000">        GLdouble func </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> exp(</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">x) </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> cos(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">3.14159265</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> x);<br /></span><span style="COLOR: #008080">31</span> <span style="COLOR: #000000">        glVertex2d(A </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> x </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> B, C </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> func </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> D);<br /></span><span style="COLOR: #008080">32</span> <span style="COLOR: #000000">    }<br /></span><span style="COLOR: #008080">33</span> <span style="COLOR: #000000">    glEnd();<br /></span><span style="COLOR: #008080">34</span> <span style="COLOR: #000000">    glFlush();<br /></span><span style="COLOR: #008080">35</span> <span style="COLOR: #000000">}<br /></span><span style="COLOR: #008080">36</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">37</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">**</span><span style="COLOR: #000000"> argv)<br /></span><span style="COLOR: #008080">38</span> <span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">39</span> <span style="COLOR: #000000">    auxInitDisplayMode(AUX_SINGLE</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">AUX_RGBA); <br /></span><span style="COLOR: #008080">40</span> <span style="COLOR: #000000">    auxInitPosition(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">500</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">500</span><span style="COLOR: #000000">); <br /></span><span style="COLOR: #008080">41</span> <span style="COLOR: #000000">    auxInitWindow(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">simple</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">); <br /></span><span style="COLOR: #008080">42</span> <span style="COLOR: #000000">    myInit();<br /></span><span style="COLOR: #008080">43</span> <span style="COLOR: #000000">    auxMainLoop((AUXMAINPROC)myDisplay);<br /></span><span style="COLOR: #008080">44</span> <span style="COLOR: #000000">}</span></div>运行结果如下图所示：<br /><img height="527" alt="FirstDemo.JPG" src="http://www.blogjava.net/images/blogjava_net/tanzek/TechArticle/FirstDemo.JPG" width="508" border="0" /><br /><br />在上面的例子，透露着一个简单的OpenGL操作框架：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main()<br />{<br />   InitWindows();  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">OpenGL中初始化窗口</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">   RegisterFunc(MyFunc);  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">注册回调函数</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">   MyInit();    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">自定义初始化过程</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">   DoDraw();    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">画数部分</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">}</span></div><br />其实以上的例子来自于《计算机图形学——用OpenGL实现（第2版）》的内容，但是在原来的程序中，使用的是glut函数，即来自于OpenGL的实用工具库。但是在VC++中，并不自带此辅助库，但在它的辅助库中，有相应的aux函数，因此，上例使用的都是辅助库中的aux函数。<img src ="http://www.blogjava.net/tanzek/aggbug/176379.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-01-19 00:30 <a href="http://www.blogjava.net/tanzek/archive/2008/01/19/176379.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RFC关于非连续子网掩码的小说明</title><link>http://www.blogjava.net/tanzek/archive/2008/01/06/173182.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 06 Jan 2008 14:09:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/01/06/173182.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/173182.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/01/06/173182.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/173182.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/173182.html</trackback:ping><description><![CDATA[ 在RFC 950 - Internet Standard Subnetting Procedure中有一小句这样子的声明：<br /><hr /><font color="#0000ff">Since the bits that identify the subnet are specified by a bitmask, they need not be adjacent in the address. However, we recommend that the subnet bits be contiguous and located as the most significant bits of the local address.</font><br /><hr /><br />然后在RFC 1219 - On the assignment of subnet numbers对RFC 950其中的子网号设定作了一些补充，在这里就可以看到对RFC 950的一些总结：<br /><hr /><font color="#0000ff">RFC-950 [2] specifies a procedure for subnetting Internet addresses using a bit-mask.  While RFC-950 allows the "ones" in the subnet mask to be non-contiguous, RFC-950 recommends that 1) they be contiguous, and 2) that they occupy the most significant bits of the "host" part of the internet address.</font><br /><hr /><br />在其中就可以看到RFC并不要求子网掩码必须是连续为1的，即允许为非连续子网掩码，不过并不推荐这样做。但是在大多数系统中，尤其是Windows系统中，以Windows XP为例，如果设定非连续子网掩码的话，将会出现如下提示：<br /><img height="497" alt="DiscontinousSubnetMasks.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/TechArticle/DiscontinousSubnetMasks.jpg" width="526" border="0" /><br />不知这个能不能在Windows XP的系统说明里面能不能找到，期待ing...<img src ="http://www.blogjava.net/tanzek/aggbug/173182.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-01-06 22:09 <a href="http://www.blogjava.net/tanzek/archive/2008/01/06/173182.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>TCP/IP Illustrated中文版</title><link>http://www.blogjava.net/tanzek/archive/2008/01/06/173165.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 06 Jan 2008 12:31:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2008/01/06/173165.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/173165.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2008/01/06/173165.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/173165.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/173165.html</trackback:ping><description><![CDATA[ <img height="209" alt="TranslationsOfTCP-IPIllustrated1.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/TechArticle/TranslationsOfTCP-IPIllustrated1.jpg" width="808" border="0" /><img src="/WebResource.axd?d=pLXXeGbWF7eXU8SMs2-GFZvUWY2JNH05dFx5YzJhGUYAYJAFEaTEq36NAhTPy7_KekvzDFwt8wvQWdByvJIGWdEq6x2KpKD80&amp;t=633043282327207582" /> <br />明天TCP/IP协议考试，使用TCP/IP Illustrated Volume 1:The Protocol中文版，对其中的语句有点不理解处，于是想查一下原版出处内容。不想查到了作者W. Richard Stevens' Home Page，到家了，顺便点击了一下本书的<a href="http://www.kohala.com/start/translations.tcpipiv1.html">Foreign language translations</a>，进入了<a href="http://www.kohala.com/start/translations.tcpipiv1.html">http://www.kohala.com/start/translations.tcpipiv1.html</a>（如上图），一看居然没有Simplied Chinese在上面，这本书的中文译版是1998年出版的，按理说作者的网站上更新应该是可以出现的喽。<br />    呵呵，觉得一点出入，便随记下了！~<br /><br />原书英文版地址：<a href="http://safari.oreilly.com/0201633469">http://safari.oreilly.com/0201633469</a><img src ="http://www.blogjava.net/tanzek/aggbug/173165.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2008-01-06 20:31 <a href="http://www.blogjava.net/tanzek/archive/2008/01/06/173165.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[MIT]Science and Engineering Writing for Phase II, Fall 2002</title><link>http://www.blogjava.net/tanzek/archive/2007/12/20/169161.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Thu, 20 Dec 2007 14:09:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/12/20/169161.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/169161.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/12/20/169161.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/169161.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/169161.html</trackback:ping><description><![CDATA[
		<span id="Bodycopy1">
				<span>
						<p>Graphics (tables, figures, and graphs) are not just salad dressing; they are not just illuminations scribed in the margins by hightech monks to increase the glory of science. Rather graphics are integral to a document's logic, structure, and purpose. Technical papers are often structured around the graphics.</p>
						<p>Literally, a graphic makes the reader ``see'' the author's idea. By their nature, Graphic and textual representations differ. text is one dimensional and, well, composed of words. Text is two dimensional and presents its ideas visually.</p>
						<p>I have 6 things to say about graphics:</p>
						<ol>
								<li>A picture is worth a thousand words; the higher the information density, the better. As a corralary, a picture that is worth fewer than a thousand words should be removed from a document.</li>
								<li>As with text, structure will be vital if large amounts of information are to be conveyed. Expository issues of purpose, context, beginning/middle/end, and design apply to graphics. Often the graphic's structure is predetermined and well known by both the reader and the author. When the structure is new, extra care must be taken to convey order the reader.</li>
								<li>Graphics must convey information visually; the reader must be able to ``see'' something when looking at the figure. While the expository issues are similar, the principles of graphic design can be very different, and the tools and methods used to achieve visual impact are often quite different from those used to produce textual impact. For an in depth coverage of graphic design principles relevant to technical writing, I can recommend Edward Tufte's ``The Visual Display of Quantitative Information'' and ``Envisioning Information.''</li>
								<li>The graphic must be referenced in the text. ``See Figure 1'' is not sufficient. Additionally, the reader must be told what to ``see'' when looking at the graphic, and how the figure relates to the text.</li>
								<li>The use of graphics provides a second representation of the ideas found in the text. Such multiple representation has two benefits. First, because readers preferentially absorb information from some media, a variety of representations -- pictures, graphs, tables, and text -- gives the reader a better chance of immediatly grasping the author's idea. Secondly, these multiple representations provide a more complete picture of a complicated idea. If the reader can approach the same idea from different vantages, the big picture is more easily grasped. The understanding of a complicated idea is complete when the reader can comfortably switch between different the idea's representations. (See the work of Judah Scwartz for more information on the relationship between multiple representations and learning complex ideas.)</li>
								<li>Like text, graphics are edited; they go through drafts, through write-read-think-edit-write cycles.</li>
						</ol>
						<p>For more on graphics, I recommend Edward Tufte's <em>The Visual Display of Quantitative Information</em> and <em>Envisioning Information</em>.</p>
				</span>
		</span>
		<p>Traceback: <a href="http://www.core.org.cn/OcwWeb/Writing-and-Humanistic-Studies/21W-783Science-and-Engineering-Writing-for-Phase-IIFall2002/StudyMaterials/detail/graphics.htm">http://www.core.org.cn/OcwWeb/Writing-and-Humanistic-Studies/21W-783Science-and-Engineering-Writing-for-Phase-IIFall2002/StudyMaterials/detail/graphics.htm</a></p>
<img src ="http://www.blogjava.net/tanzek/aggbug/169161.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-12-20 22:09 <a href="http://www.blogjava.net/tanzek/archive/2007/12/20/169161.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JOONE(Java Object-Oriented Network Engine)使用初探</title><link>http://www.blogjava.net/tanzek/archive/2007/09/30/149925.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 30 Sep 2007 08:03:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/09/30/149925.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/149925.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/09/30/149925.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/149925.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/149925.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 1												/**/										/*																										  2														 * JOONE - Java Object Oriented Neural Engine						  3														 * 						http://joone.sourcefo...&nbsp;&nbsp;<a href='http://www.blogjava.net/tanzek/archive/2007/09/30/149925.html'>阅读全文</a><img src ="http://www.blogjava.net/tanzek/aggbug/149925.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-09-30 16:03 <a href="http://www.blogjava.net/tanzek/archive/2007/09/30/149925.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JDBC驱动下载</title><link>http://www.blogjava.net/tanzek/archive/2007/09/11/144343.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Tue, 11 Sep 2007 11:01:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/09/11/144343.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/144343.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/09/11/144343.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/144343.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/144343.html</trackback:ping><description><![CDATA[
		<strong>
				<font size="4">SQL Server 2000 Driver for JDBC Service Pack 3</font>
				<br />
		</strong>Download-Site: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=07287B11-0502-461A-B138-2AA54BFDC03A&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=07287B11-0502-461A-B138-2AA54BFDC03A&amp;displaylang=en</a><br /><h4>System Requirements</h4><div><span><ul><li>Supported Operating Systems: HP-UX; IBM AIX; Linux; Solaris; Windows 2000 Service Pack 2; Windows 2000 Service Pack 3; Windows 2000 Service Pack 4; Windows Server 2003; Windows XP</li></ul>The following versions of SQL Server will be supported for use with the SQL Server 2000 Driver for JDBC SP2: <br />• SQL Server 2000 Standard and Enterprise Editions* <br />• SQL Server 2000 Standard and Enterprise Editions with Service Pack 1 or higher* <br />• SQL Server 2000 Enterprise Edition (64-bit)*<br /><br />* Service Pack 3a is strongly recommended <br /><br />The following versions of the JDK will be supported for use with the SQL Server 2000 Driver for JDBC: <br />• JDK 1.1.8 <br />• JDK 1.2<br />• JDK 1.3<br />• JDK 1.4<br /></span></div><br /><hr /><strong><font size="4">MySQL Connector/J 5.0</font></strong><br />Download-Site: <a href="http://dev.mysql.com/downloads/connector/j/5.0.html">http://dev.mysql.com/downloads/connector/j/5.0.html</a><div><span><br />MySQL Connector/J is the official JDBC driver for MySQL. <br /></span></div><div><br /><hr /><strong><font size="4">Microsoft SQL Server 2005 JDBC Driver 1.1</font><br /></strong><h4>System Requirements</h4><div><span><ul><li>Supported Operating Systems: Linux; Solaris; Windows 2000 Service Pack 4; Windows Server 2003 R2 (32-Bit x86); Windows Server 2003 x64 editions; Windows XP Service Pack 2<br /></li><li>Java Runtime Environment (JRE) 1.4 or later<br /></li><li>SQL Server 2005 or SQL Server 2000<br /></li></ul></span></div></div><img src ="http://www.blogjava.net/tanzek/aggbug/144343.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-09-11 19:01 <a href="http://www.blogjava.net/tanzek/archive/2007/09/11/144343.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于人工神经网络中的M-P模型的一点疑问</title><link>http://www.blogjava.net/tanzek/archive/2007/08/08/135364.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Wed, 08 Aug 2007 14:31:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/08/08/135364.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/135364.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/08/08/135364.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/135364.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/135364.html</trackback:ping><description><![CDATA[人工神经网络M-P模型构成一个逻辑非模型，从书中抄下来的，如下图：<br /><img height="136" alt="PerpretronNor.bmp" src="http://www.blogjava.net/images/blogjava_net/tanzek/PerpretronNor.bmp" width="433" border="0" /><br />其中的T不知道该怎么作解释，烦请帮个忙了。<img src ="http://www.blogjava.net/tanzek/aggbug/135364.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-08-08 22:31 <a href="http://www.blogjava.net/tanzek/archive/2007/08/08/135364.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]Effective file hiding : Bypassing Raw File System I/O Rootkit Detector</title><link>http://www.blogjava.net/tanzek/archive/2007/07/11/129520.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Wed, 11 Jul 2007 01:43:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/11/129520.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/129520.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/11/129520.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/129520.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/129520.html</trackback:ping><description><![CDATA[
		<table cellspacing="0" cellpadding="4" width="100%" border="0">
				<tbody>
						<tr>
								<td bgcolor="white">
										<table cellspacing="1" cellpadding="4" width="100%" border="0">
												<tbody>
														<tr>
																<td bgcolor="white">
																		<b>Effective file hiding : Bypassing Raw File System I/O Rootkit Detector</b>
																		<br />
																		<i>@ :: worthy ::</i>     Apr 06 2007, 08:51 (UTC+0) </td>
														</tr>
														<tr>
																<td bgcolor="white">
																		<table cellspacing="2" cellpadding="5" width="94" align="right">
																				<tbody>
																						<tr>
																								<td valign="top" bgcolor="white">
																										<img src="http://rootkit.com/usericons/cardmagic.jpg" border="0" />
																								</td>
																						</tr>
																				</tbody>
																		</table>
																		<b>cardmagic</b> writes: 0. Something else :<br /><br />After reading Hoglund's post, I finally decide to write this article.<br />Actually in China, many smart rootkit/antirootkit writers have their own interesting materials,but unfortunately they are unable to publiish them becuase of various reasons(business contract,language barrier or even related to some secret organization).<br />The main idea of this post comes to me when I designed DarkSpy, but after I finishing coding of the bus level file hider, it was discarded.<br />Hopefully it will still be useful for some guys here:)<br />Okay, now lets discuss the main topic :<br /><br />1. Raw I/O based hidden file detection: <br /><br />This kind of file detection is used very commonly in modern detetors. such as DarkSpy/Icesword.<br />The main idea for this detection method is to directly send I/O request packet to file system ,<br />so that detector will get the real view of system files.<br />this is effective for hiding by native routine call hooking and file system filter driver.<br /><br />In addition, DarkSpy has added two great points into this(The second one makes DarkSpy's file detecion better than Icesword ^_^ )<br />a) Implement IofCallDriver itself,and directly call the original file system dispach routines,<br />this will bypass hiding by the file system dispath routing hooking.<br />b) Recover the whole file system file image in the memory before each I/O, this is against the<br />hiding by inline code patching of file system dispatch routines.<br /><br /><br />2. The Bypassing theory:<br /><br />Here we will only discuss the real hider ( not file stream stuff),and we will describe the the bypassing theory with DarkSpy, because DarkSpy is very typical in raw I/O based file detectors.Let's look at basic flow of DarkSpy file detection first.<br /><br /><code><br />   -----------------                   --------------------- <br />   |   DarkSpy     |  &lt;1&gt; ----&gt;recover | FILE SYSTEM IMAGE |<br />   -----------------  &lt;2&gt;-----&gt;call---&gt;|  dispatch code    |<br />                      &lt;2&gt;&lt;-----return--|-------------------|<br /></code><br /><br />From the figure above, we can see it's almost impossible to do something in file system, because DarkSpy has recoverred the whole image, even directly call the dispatch code without system routine's help.<br />Now start changing our point of view and brainstorm, can we intercept the I/O processing besides file system?<br />The answer is true, because file system will call many system routines.<br />But we must pick an appropriate call that has the chance to reach the I/O content,which one will be the best? IofCallDriver maybe first come to your mind...but unfortunately DarkSpy has implemented it inside,because IofCallDriver is very easy to implement :)<br />So we have to pick another choice which is<br />a) hard to implement<br />b) will be called by file system<br />c) able to touch the I/O content<br />which one will be the best ?<br />Oh,yes, you got it, it's IofCompleteRequest. Okay... this is our idea...<br />Through IofCompleteRequest code patching , check if we are called by file system,if yes, we will filter the I/O content. Thus,we will be sure to bypass all modern raw I/O based file detector.<br /><br />3. The Main Code: <br /><br />Please check --<br /><br /><a href="http://www.rootkit.com/vault/cardmagic/hidefile.c" target="_blank">http://www.rootkit.com/vault/cardmagic/hidefile.c</a></td>
														</tr>
												</tbody>
										</table>
								</td>
						</tr>
				</tbody>
		</table>
		<p>
		</p>
		<hr color="black" noshade="" size="1" />
		<p>(c) www.rootkit.com / http://www.rootkit.com/<br /><br />TraceBack: <a href="http://rootkit.com/newsread_print.php?newsid=689">http://rootkit.com/newsread_print.php?newsid=689</a><br /><br /><font color="#0000ff">注：好牛的一篇文章哦！~  呵呵，真的需要调整自己的视角了：在计算机里面，不是所看到的东西就一定是真实的。</font></p>
<img src ="http://www.blogjava.net/tanzek/aggbug/129520.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-11 09:43 <a href="http://www.blogjava.net/tanzek/archive/2007/07/11/129520.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]RAW FileSystem Recovery</title><link>http://www.blogjava.net/tanzek/archive/2007/07/11/129514.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Wed, 11 Jul 2007 01:09:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/11/129514.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/129514.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/11/129514.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/129514.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/129514.html</trackback:ping><description><![CDATA[
		<table id="table3" cellspacing="0" cellpadding="0" width="100%" border="0">
				<tbody>
						<tr>
								<td style="PADDING-RIGHT: 9px; PADDING-LEFT: 9px; PADDING-BOTTOM: 6px; PADDING-TOP: 10px" bgcolor="#ffffff">To know how to deal with it, we need to discuss the basics first. The filesystem type is recorded at least in two separate places 
<ul><li>In the <i>partition table</i> (<i>MBR</i>, sometimes referred to as a <i>legacy-style partition</i>) or in the <i>LDM database</i> (when dynamic disks are used). 
</li><li>In the <i>volume boot sector</i>. </li></ul><p>Three significantly different combinations are thus possible.</p><ul><li>Both partition table and volume boot sector provide consistent information about the filesystem type. This is how the things are supposed to be when the volume is online and operational. 
</li><li>Only one of these places contains proper information, or the information is contradictory (e.g. partition table lists the volume as NTFS, while the boot sector indicates it is the FAT32). 
</li><li>Neither partition table nor volume boot sector contain filesystem type information (the partition table will in this case indicate the special filesystem type of zero, i.e. unused volume). This can happen during normal operation and is pretty legal configuration state. It appears when you create a volume (e.g. using Disk Management applet) but do not format it at the same time. You can even assign a drive letter to this unformatted volume, as illustrated below (notice the underlined "H:" drive which has no filesystem type defined). </li></ul><p align="center"><img alt="RAW filesystem - undefined filesystem type in Disk Manager" src="http://www.blogjava.net/images/blogjava_net/tanzek/TechArticle/raw-filesystem.gif" border="0" /></p><p>If the volume filesystem type information is unavailable, attempting CHKDSK against the volume will result in the following message:</p><p><font face="Courier">The type of the filesystem is RAW.<br />CHKDSK is not available for RAW drives.</font></p><p>Sometimes, the volume fails in such a way that it becomes RAW. In most cases the failure will be associated with a sudden reboot (per power failure or the STOP error). Several causes are possible: partition table, LDM database, or the volume boot sector corruption, or (on the NTFS volume) when certain records in both MFT and MFT mirror are damaged beyond easy recognition.</p></td>
						</tr>
						<tr>
								<td height="4">
										<img height="4" src="http://www.z-a-recovery.com/images/box-btm-l.gif" width="4" />
								</td>
								<td width="100%" background="/images/box-btm.gif" height="4">
								</td>
						</tr>
				</tbody>
		</table>
		<p> </p>
		<table id="table4" cellspacing="0" cellpadding="0" width="100%" border="0">
				<tbody>
						<tr>
								<td width="4" bgcolor="#eff3fb">
										<img height="25" src="http://www.z-a-recovery.com/images/plashkablue_left.gif" width="3" />
								</td>
								<td bgcolor="#eff3fb">
										<p class="header">
												<b>"RAW filesystem" recovery expectations</b>
										</p>
								</td>
						</tr>
						<tr>
								<td height="4">
										<img height="4" src="http://www.z-a-recovery.com/images/box-top-l.gif" width="4" />
								</td>
								<td width="100%" background="/images/box-top.gif" height="4">
								</td>
						</tr>
						<tr>
								<td width="4" background="/images/box-l.gif" height="100%">
								</td>
								<td style="PADDING-RIGHT: 9px; PADDING-LEFT: 9px; PADDING-BOTTOM: 6px; PADDING-TOP: 10px" bgcolor="#ffffff">
										<b>The data recovery</b> should not be complicated because the volume location info is still available. Be advised that some arbitrary filesystem type may be associated with the volume when you attempt to identify it amongst the list of the available volumes. 
<p align="center"><img height="171" alt="RAW filesystem volume errorneously interpreted as FAT16" src="http://www.blogjava.net/images/blogjava_net/tanzek/TechArticle/raw-filesystem-readout.gif" width="522" border="0" /></p><p align="left">Notice the highlighted volume - it is the same H: volume featured in the earlier screenshot. It has the correct size (128MB) and the correct on-disk location (starting at 200+40+40 = 280MB from the start of disk), but the filesystem type of <i>"Large FAT16"</i> is not a good bet because the volume is in fact NTFS - the filesystem type information in the LDM database got corrupt (yeah, I know because I did it in purpose). This fact will be later discovered by ZAR and the appropriate decision will be made to treat the volume as NTFS, and in this test case an exact recovery is ultimately achieved. </p><p>In a real world case, the recovery expectations vary depending on the damage profile and locality. Overall, I'd expect a good yield. Exact recovery is possible if the damage is confined to the boot sector(s) and/or partition table (however there is no easy way to tell if it is). Suggested course of action is thus as usual: to download our data recovery tool (<a href="http://www.z-a-recovery.com/download.htm">click here for a download page</a>) and try it. Be sure to check <a href="http://www.z-a-recovery.com/man-workflow.htm">this page</a> as well.<br /><br />TraceBack: <a href="http://www.z-a-recovery.com/art-raw-filesystem.htm">http://www.z-a-recovery.com/art-raw-filesystem.htm</a></p></td>
						</tr>
				</tbody>
		</table>
		<p>
				<font color="#0000ff">注：今天本来想查点RAW FileSystem的资料，无意中找到这篇关于RAW FileSystem恢复的，还算得上是一篇资料文章哦，所以就转贴过来了！~</font>
		</p>
<img src ="http://www.blogjava.net/tanzek/aggbug/129514.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-11 09:09 <a href="http://www.blogjava.net/tanzek/archive/2007/07/11/129514.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL的中文问题</title><link>http://www.blogjava.net/tanzek/archive/2007/07/08/128924.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 08 Jul 2007 13:12:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/08/128924.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/128924.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/08/128924.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/128924.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/128924.html</trackback:ping><description><![CDATA[
		<p>唉，看到网上这么多的关于MySQL中文编码的问题。今天自己碰到了，网上没有找到我的完整答案，发现真的是好晕啊！~<br />    不过幸好弄出来了，没有让整个下午的时候白费哦。<br />就今天所看到的，和自己所操作的一起总结下哦。<br />我用的工具有：<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">MyEclipse 5.1.0<br />JDK 1.6.0<br />mysql</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">connection</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">java</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">3.0</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">2<br /></span>
				<span style="COLOR: #000000">MySQL </span>
				<span style="COLOR: #000000">5.0</span>
				<span style="COLOR: #000000">.</span>
				<span style="COLOR: #000000">27</span>
		</div>
		<p>这里工具的版本是很重要的，呆会一点一点把它讲来，所以把全部环境都列出来了！~<br /><br />1、data too long for column问题<br />问题描述：在MySQL下面输入select, insert等SQL语句，对于汉字均出现此种情况<br />    字段为char或varchar型，长度为255，绝对不会是真的字段长度不够的问题。请大家查看这篇贴子：<a href="http://blog.sina.com.cn/u/53b0d5dc0100097v">http://blog.sina.com.cn/u/53b0d5dc0100097v</a>，有此问题的详解。我后来的问题也基本上是在此篇基本上解决的。重要的是：--default-character-set=utf8参数<br /><br />2、语句在MySQL CMD下面输入正确，但是在Java中执行同样的SQL语句，却无法工作。<br />问题描述：如果SQL语句中带中文的话，就会出现下面的异常，<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">java.sql.SQLException: Syntax error or access violation,  message from server: </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''中? at line 1</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br /> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:</span>
				<span style="COLOR: #000000">1962</span>
				<span style="COLOR: #000000">)<br /> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:</span>
				<span style="COLOR: #000000">1163</span>
				<span style="COLOR: #000000">)<br /> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:</span>
				<span style="COLOR: #000000">1257</span>
				<span style="COLOR: #000000">)<br /> at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:</span>
				<span style="COLOR: #000000">1218</span>
				<span style="COLOR: #000000">) </span>
		</div>
		<br />进行好上面第一点的配置以后还是无济于事。<br />    通过细心观察，总觉得不应该是MySQL的配置问题了，因为在MySQL CMD下面能够很正常地输入，所以怀疑是mysql connector的问题。<br />    查阅了mysql connector的docs后，找到了一些内容：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">All strings sent from the JDBC driver to the server are converted automatically from </span><span style="COLOR: #0000ff">native</span><span style="COLOR: #000000"> Java Unicode form to the client character encoding, including all queries sent via Statement.execute(), Statement.executeUpdate(), Statement.executeQuery() as well as all PreparedStatement and CallableStatement parameters with the exclusion of parameters set using setBytes(), setBinaryStream(), setAsiiStream(), setUnicodeStream() and setBlob().</span></div>意思就是说：所有从JDBC驱动器到服务器的字符串都将会自动地从本地JAVA Unicode编码形式转换为客户端的字符编码。<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">Prior to MySQL Server </span><span style="COLOR: #000000">4.1</span><span style="COLOR: #000000">, Connector</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">J supported a single character encoding per connection, which could either be automatically detected from the server configuration, or could be configured by the user through the useUnicode and characterEncoding properties.<br /><br />Starting with MySQL Server </span><span style="COLOR: #000000">4.1</span><span style="COLOR: #000000">, Connector</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">J supports a single character encoding between client and server, and any number of character encodings </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> data returned by the server to the client in ResultSets.<br /></span></div>在这里就涉及到了版本的问题：在MySQL 4.1以前的版本中，连接器对每一个connection支持单个的字符编码；而在MySQL 4.1开始以后的版本中，连接器在客户端和服务器端之间支持单个的字符编码。<br /><br />重要的就是在这里了，不知道因为是什么原因，我的连接器客户端的编码总是与服务器的对接不上，因此在这里将采用手动指定客户端编码。如下所述：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">To override the automatically</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">detected encoding on the client side, use the characterEncoding property in the URL used to connect to the server.</span></div><br />对于useUnicode和characterEncoding两个连接属性，下面介绍一点点：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000"><table summary="Connection Properties" border="1"><tbody><tr><td width="10%">useUnicode</td><td>Should the driver use Unicode character encodings when handling strings? Should only be used when the driver can't determine the character set mapping, or you are trying to 'force' the driver to use a character set that MySQL either doesn't natively support (such as UTF-8), true/false, defaults to 'true'</td></tr><tr><td>characterEncoding</td><td>If 'useUnicode' is set to true, what character encoding should the driver use when dealing with strings? (defaults is to 'autodetect')</td></tr></tbody></table></span></div>因此，在连接中，我把连接的URL 从原来的：<br />jdbc:mysql://localhost:3306/[DBName]","[username]","[password]" 改成为：jdbc:mysql://localhost:3306/[DBname]?useUnicode=true&amp;characterEncoding=UTF-8","[username]","[password]"。<br /><br />经过这样子的改动以后，程序能够正常地输入中文值或作为条件参数。<br /><br />下面还有关于连接器的一点点内容：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">To allow multiple character sets to be sent from the client, the </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">UTF-8</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> encoding should be used, either by configuring </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">utf8</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> as the </span><span style="COLOR: #0000ff">default</span><span style="COLOR: #000000"> server character set, or by configuring the JDBC driver to use </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">UTF-8</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> through the characterEncoding property.</span></div><br /><br />总结：<br />此问题可能还在其它地方有问题，但是到现在为止，中文不能出现在SQL语句中的问题已经解决。如果有网友能够有进一步地突破，还希望不吝指教。谢谢了！~  当然，如果本篇有一些不足之处，也请指出哦！<img src ="http://www.blogjava.net/tanzek/aggbug/128924.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-08 21:12 <a href="http://www.blogjava.net/tanzek/archive/2007/07/08/128924.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Big-Endian And Little-Endian</title><link>http://www.blogjava.net/tanzek/archive/2007/07/07/128753.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sat, 07 Jul 2007 03:32:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/07/128753.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/128753.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/07/128753.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/128753.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/128753.html</trackback:ping><description><![CDATA[今天老师给我们复习单片机，出了一个题目，就这个字节存储顺序搞得人晕死了。就在网上找了下文章，如下：<br /><div><h3>Byte Order in Multibyte Values</h3>HP, IBM and Motorola 68000 systems store multibyte values in <strong>Big Endian </strong>order, while Intel 80x86 and DEC VAX systems store them in <strong>Little Endian </strong>order. Big Endian stores the high-order byte at the starting address while Little Endian stores the low-order byte at the starting address. The low-order byte contains the bits for the lowest possible values, that is, 0-255, while the high-order byte contains the bits that specify the large values (that is, 256-65535 in a short integer). (The term <i>endian</i> is derived from a passage in Jonathan Swift's <i>Gulliver's Travels</i>). Swapping <strong>integer data</strong> between computers of different types is a difficult problem unless you convert the information into <strong>ASCII</strong> characters. 
<p><a href="http://www.robelle.com/library/smugbook/network.html#sockets">Sockets</a> has functions to convert <a href="http://www.robelle.com/library/smugbook/numbers.html">Long and Short Integers</a> to and from Internet standard byte ordering, which is Big Endian. </p><p></p><ul><li><strong>htonl</strong>, convert host-to-network, long integer 
</li><li><strong>htons</strong>, convert host-to-network, short integer 
</li><li><strong>ntohl</strong>, convert network-to-host, long integer 
</li><li><strong>ntohs</strong>, convert network-to-host, short integer </li></ul><p>Big Endian systems such as HP-UX and MPE are already compatible with the network ordering, so they can define these functions as null macros. </p><p>The Power PC is a <a href="http://www.byte.com/art/9509/sec12/art1.htm">big-endian</a> processor; that is, it supports both big- and little-endian addressing modes. This bi-endian architecture enables software developers to choose either mode when migrating OSes and applications from other machines. </p></div>TraceBack: http://www.robelle.com/library/smugbook/byteordr.html<br /><img src ="http://www.blogjava.net/tanzek/aggbug/128753.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-07 11:32 <a href="http://www.blogjava.net/tanzek/archive/2007/07/07/128753.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Joel On Software---轻松写就功能规格说明书 </title><link>http://www.blogjava.net/tanzek/archive/2007/07/06/128529.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Fri, 06 Jul 2007 03:39:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/06/128529.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/128529.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/06/128529.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/128529.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/128529.html</trackback:ping><description><![CDATA[
		<p>此节为第一部分的第六节：<br />轻松写就功能规格说明书 第2节：什么是规格说明书？ </p>
		<p>下面是JOEL在规格说明书中都要给出的一些内容： </p>
		<p>1、事先声明。这纯粹是出于自我保护目的。通常可以说：“该规格说明书还没有完成”。</p>
		<p>2、作者。人们应该拥有他们说明的事物的责任权与所有权。如果规格说明书出了错，那么就应该有一个专门指派的规格说明书所有人，他的名字就印在规格说明书上，由他负责对规格说明书进行修订。</p>
		<p>3、情节。反映你心目中设想的人们将如何使用产品的真实生活情节。这就是要放内容的地方。情节越生动越真实，那么你在为实际的或者虚构的用户设计产品时会做得越好。</p>
		<p>4、非构建目标。其实就是不打算去做的事情，很可能就是产品将来没有的特性，确认“我们不打算去做”。</p>
		<p>5、概观。规格说明书目录，使阅读者形成大体印象，让细节变得有意义。</p>
		<p>6、细节，细节，细节。每一条细节都应该有处理细节的决定，规格明书需要以文档的形式描述出决定。</p>
		<p>7、未尽事宜。对于规格说明书的第一个版本留下一些未尽事宜是允许的，这些需要描述出来以让程序员知道并在实现代码时进行考虑。</p>
		<p>8、旁注。对于规格说明书，可能会有各种不同类型的读者，考虑那些仅仅对团体中的某一类人带来帮助的有用仿真陈述。</p>
		<p>9、规格说明书需要保持时时更新的状态。随着产品的开发与新决定的做出，规格说明书的更新应该是不断地持续下去的。规格说明书总是反映我们大家针对产品将如何工作而纪念品出的最佳理解。</p>
		<p>JOEL通常在服备器的某个位置保存一份当前版本，一般而言是用带有修订标记的规格说明书副本，而非是重新的规格说明书版本来让各位成员进行参考。</p>
<img src ="http://www.blogjava.net/tanzek/aggbug/128529.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-06 11:39 <a href="http://www.blogjava.net/tanzek/archive/2007/07/06/128529.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Joel On Software---JOEL 测试:改进代码的12个步骤</title><link>http://www.blogjava.net/tanzek/archive/2007/07/05/128399.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Thu, 05 Jul 2007 08:40:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/05/128399.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/128399.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/05/128399.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/128399.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/128399.html</trackback:ping><description><![CDATA[
		<p>此节为第一部分的第三节：<br />JOEL测试：改进代码的12个步骤<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">JOEL测试<br /></span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">、使用源控制代码吗？<br /></span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">、能一步完成连编吗？<br /></span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">、每天都做连编吗？<br /></span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">、有故障信息数据库吗？<br /></span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">、在编写新代码之前修复故障吗？<br /></span>
				<span style="COLOR: #000000">6</span>
				<span style="COLOR: #000000">、有最新的进度表吗？<br /></span>
				<span style="COLOR: #000000">7</span>
				<span style="COLOR: #000000">、有规格说明书吗？<br /></span>
				<span style="COLOR: #000000">8</span>
				<span style="COLOR: #000000">、程序员拥有安静的工作环境吗？<br /></span>
				<span style="COLOR: #000000">9</span>
				<span style="COLOR: #000000">、你用到了你资金能力内可买到的最好工具吗？<br /></span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000">、有测试人员吗？<br /></span>
				<span style="COLOR: #000000">11</span>
				<span style="COLOR: #000000">、新聘人员在试用期写代码吗？<br /></span>
				<span style="COLOR: #000000">12</span>
				<span style="COLOR: #000000">、进行走廊可用性测试吗？</span>
		</div>
		<p>
				<br />在这一节中例出了JOEL测试的12个步骤，个人觉得确实把一些标准软件测试的精华吸取进去了，却又抛弃了各类标准测试中的过于严格、限制灵活性的部分。当然这也如书中所说的，“Joel测试的不足之处，处是，确实不应该用它来保证核动力工厂软件是安全的”。作为个人来讲，应该把这些测试作为一种软件开发的习惯（当然，只是有些部分哦！~）。<br /><br />在这里把比较精要的地方记录一下：<br />1、不使用源控制，程序员没有办法知道其他人员做了什么，所以不容易进行错误回滚。源控制系统的另外一个巧妙之处在于，可保证源代码在每个程序员的硬盘上都是经过自动确认了的。</p>
		<p>2、从最新的源快照进行一次可分发的连编，需要多少个步骤？在一个优秀的团队通常会维护一个脚本，通过运行它，可以从头至尾地进行一次检查；重新编译每一个代码行；并按其不同的版本、语言以及条件编译语句#ifdef来生成EXE文件；创建安装包；并且生成最终的表现介质——CD-ROM、下载页面等。<font color="#0000ff"><font color="#000000">如果这样的过程需要多步才能完成，那么就很可能出错，并且越接近产品分发时刻，就越希望修复“最后故障”、形成最终EXE文件等操作所经历的周期会更短一些。</font>JOEL指出不应该有20步。</font></p>
		<p>3、无论谁中断了连编，都要负责修复连编操作，直到有别人中断连编过程为止。<font color="#0000ff">这是JOEL在Excel开发团队采用一种激励不要中断连编过程的机制，同时也让大家弄清楚连编是如何进行的。<br /></font></p>
		<p>
				<font color="#000000">4、故障信息数据库。一个可用的故障信息数据库必须至少为每个故障包含如下数据：重现故障的完整步骤、预期功能、观察到的（故障）行为、要分配谁、是否已修复。<br /></font>
		</p>
		<p>5、<font color="#0000ff">发现故障到准备修复故障之间等待的时间越长，付出的代价（时间与金钱上）就越大。</font><font color="#000000">微软普遍采取了一种称之为零缺陷法（zero defects methodology）的措施。零缺陷意味着在任意给定时间点，最需要优先去做的事情是在写任何新的代码之前消除故障。<font color="#0000ff">这也可以是一个衡量进度表的标准：</font>如果你已经修复了所有已经知道的故障，并且剩下的就是编写新代码，那么进度表就是极其准确的。</font></p>
		<p>6、<font color="#0000ff">拥有一个好的进度表的优点：</font>保证它始终反映最新的项目情况；迫使你做出将要实现什么功能的决定，然后强迫你拣出最不重要的功能，并加以剪除而不是陷入功能沼泽地带（也就是功能范围蔓延开来）。</p>
		<p>7、“没有规格说明书就没有代码”。不是根据规格说明书开发出来的软件通常会因设计欠佳而停滞不前，从而使进度失去控制。</p>
		<p>8、JOEL举了一个比较好的例子：Mutt记不住Unicode版本的strcpy函数的名字。他可以查询该函数，这要花费30秒钟的时间；他也可以询问Jeff，这得用去15秒钟的时间。既然紧靠Jeff坐着，他选择询问Jeff。不过，Jeff因此显得心烦意乱而丢掉了15分钟的产出（仅仅为了节省Mutt 15秒钟）。然而如果当Mutt去询问Jeff需要45秒钟的时间时，Mutt就会去选择自己去查询了。</p>
		<p>9、<font color="#0000ff">可以显著地提高开发效率</font>，同时程序员是容易通过给他们提供最棒最新的东西而得到满足的，这是一种远比通过支付极富竞争力的薪力来促使他们为你工作好得多的途径。</p>
		<p>10、没有专门的测试人员，意味着要么分发充满故障的产品，要么通过让价值$100/小时的程序员去做那些能够让价值$30/小时的测试人员完成的工作。</p>
		<p>11、一定要让应聘者编写一些代码。</p>
		<p>12、走廊可用性测试指的是，在走廊里随便抓一个从身边走过的人，要他试着使用你所编写的代码。如果对5个人进行了这类测试，那么就可以了解隐藏在代码中的95%的可用性问题。<br /></p>
<img src ="http://www.blogjava.net/tanzek/aggbug/128399.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-05 16:40 <a href="http://www.blogjava.net/tanzek/archive/2007/07/05/128399.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JOEL on Software(JOEL说软件)</title><link>http://www.blogjava.net/tanzek/archive/2007/07/05/128394.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Thu, 05 Jul 2007 08:32:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/05/128394.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/128394.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/05/128394.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/128394.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/128394.html</trackback:ping><description><![CDATA[&lt;&lt;JOEL On Software&gt;&gt;<br />中文译名：JOEL说软件<br /><p align="center"><a title="JOEL On Sotware" href="http://www.china-pub.com/computers/common/info.asp?id=26115" target="_blank"><img height="180" alt="Joel_On_Software.gif" src="http://www.blogjava.net/images/blogjava_net/tanzek/BookCovers/Joel_On_Software.gif" width="121" border="0" /></a></p><h3 class="brown13"><b>【内容简介】</b></h3>这是一本介绍软件管理的小品文集。全书分为45章，每章就是一个独立的专题或者知识点。本书内容十分丰富全面，小到项目负责人制订进度表，大到软件执行总裁提出富有竞争性的战略，都在本书的介绍之列。尽管内容很多，但事例驱动的写作方式，奠定了本书在可学性与可用性方面明显的优势。<br />本书从不同侧面满足了软件开发人员、设计人员、管理人员及从事软件相关工作的人员的学习与工作需要。 
<div class="clear5px"></div><h3 class="brown13"><b>【目录信息】</b></h3>第一部分 位与字节：编程实践点滴<br />一 语言的选择 2<br />二 深入底层 4<br />三 JOEL测试：改进代码的12个步骤 14<br />四 每一位软件开发人员必须、绝对要至少具备UNICODE<br />四 与字符集知识（没有任何例外！） 27<br />五 轻松写就功能规格说明书 第1节：为什么烦心？ 38<br />六 轻松写就功能规格说明书 第2节：什么是规格说明书？ 44<br />七 轻松写就功能规格说明书 第3节：但是……如何？ 54<br />八 轻松写就功能规格说明书 第4节：技巧 58<br />九 轻松制订软件进度表 65<br />十 每日连编是朋友 75<br />十一 难伺候的故障修复 81<br />十二 软件开发中的5个世界 87<br />十三 稿纸原型开发 94<br />十四 不要被太空架构师所吓倒 96<br />十五 开火与运动 100<br />十六 人员技能 104<br />十七 源于计算机学科的三个错误思想 109<br />十八 二元文化 114<br /><br /><font color="#0000ff">注：前不久看完了这本书，里面还是有很多东西可以学，只是感觉译文确实有点不怎么好（看了一下在China-Pub的书评，作者得到的鸡蛋比较多）。不过还好，因为自己还是有一点基础，所以能够看懂一些，如果有耐心和时间的话，真还是想看一下原版或是影印版的。</font><img src ="http://www.blogjava.net/tanzek/aggbug/128394.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-05 16:32 <a href="http://www.blogjava.net/tanzek/archive/2007/07/05/128394.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>不要用浏览器来测试</title><link>http://www.blogjava.net/tanzek/archive/2007/07/03/127774.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Tue, 03 Jul 2007 03:02:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/03/127774.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/127774.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/03/127774.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/127774.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/127774.html</trackback:ping><description><![CDATA[
		<p>进行B/S系统编程，大概浏览器就是最直接的测试程序是否正确的方法了。因为在这里所看到的什么，就很直接地可能是用户看到的什么，这可能就是叫做用户视角测试吧。<br /><br />但发现这有很大的缺点。总结一下：<br />1、WEB Server有时候在运行比较慢的时候，会导致浏览器执行结果和刚刚修改后的结果不一致；<br />2、浏览器一般都会有Cookies和临时文件，这样子也会导致浏览器的执行结果是上一次的结果。<br /><br />刚刚就接触到了这个怪问题，就好像昨天晚上的class文件没有生成，这个问题这真是让好晕的。<br />    所以，建议编程测试最好用专用的测试工具，像JAVA就可以用JUnit等工具，在服务器端进行测试可以用Cactus，这个还没有用过，期待哦。<br /><br />这点还说一点昨天的问题，对于class文件没有生成的情况，在Eclipse下面可以通过"Project"-&gt;"Clean"菜单命令清除项目生成文件以后，再来编译。注意哦，如果取消了自动编译(Build Automatically)的话，就要自己去手动编译啦。</p>
<img src ="http://www.blogjava.net/tanzek/aggbug/127774.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-03 11:02 <a href="http://www.blogjava.net/tanzek/archive/2007/07/03/127774.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JSP taglib中的一个小问题</title><link>http://www.blogjava.net/tanzek/archive/2007/07/02/127683.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Mon, 02 Jul 2007 13:47:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/07/02/127683.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/127683.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/07/02/127683.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/127683.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/127683.html</trackback:ping><description><![CDATA[今天写了个JSP的自定义标签的小练习，照着书上的程序写完所有的源码以后，一进行调试，发现出现很多稀奇古怪的事。<br />如：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">    类型无法解析(</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> type can</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">t be resolved.)</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #000000">    找不到tag类处理器(can</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">t load tag class handler)</span></div><br />等。<br />好晕的。后来通过检查，发现在classes目录下面没有产生标记处理器类的class文件，一直以为Eclipse IDE会自动编译然后放到合适的文件夹下面，所以导致此类原因。<br /><br />以后要记着点：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">对于与类有关的程序(如JavaBean, Taglib等)在执行，要看是否被编译成了二进制文件，否则哭都没人理的。</span></div><img src ="http://www.blogjava.net/tanzek/aggbug/127683.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-07-02 21:47 <a href="http://www.blogjava.net/tanzek/archive/2007/07/02/127683.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>数据挖掘相关</title><link>http://www.blogjava.net/tanzek/archive/2007/06/27/126454.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Wed, 27 Jun 2007 00:43:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/06/27/126454.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/126454.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/06/27/126454.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/126454.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/126454.html</trackback:ping><description><![CDATA[
		<p>
				<font color="#0000ff">什么是规则</font>？就是一个条件和一个结果的和：<em>If condition then result</em>。实际中有用的往往是结果中只有一个元素的情况。</p>
		<p>
				<font color="#0000ff">关联规则（association rule）</font>挖掘技术用于发现数据库中属性之间的有趣联系。和传统的产生式规则不同，关联规则可以有一个或多个输出，同时一个规则的输出属性可以是另一个规则的输入属性。关联规则分析有时也叫购物篮分析，是因为它可以找寻出潜在的令人感兴趣的所有的产品组合。由此，有限数目的属性可能生成上百条规则。</p>
		<p>关联规则的<font color="#0000ff">置信度</font>、<font color="#0000ff">支持度</font>和<font color="#0000ff">兴趣度</font>：<br /></p>
		<p>
		</p>
		<table style="WIDTH: 294px; HEIGHT: 203px" align="center" border="1">
				<tbody>
						<tr>
								<td>
										<p align="center">元组</p>
								</td>
								<td>
										<p align="center">出现频率</p>
								</td>
						</tr>
						<tr>
								<td>
										<p align="center">A</p>
								</td>
								<td>
										<p align="center">45%</p>
								</td>
						</tr>
						<tr>
								<td>
										<p align="center">B</p>
								</td>
								<td>
										<p align="center">42.5%</p>
								</td>
						</tr>
						<tr>
								<td>
										<p align="center">C</p>
								</td>
								<td>
										<p align="center">40%</p>
								</td>
						</tr>
						<tr>
								<td>
										<p align="center">A和B</p>
								</td>
								<td>
										<p align="center">25%</p>
								</td>
						</tr>
						<tr>
								<td>
										<p align="center">A和C</p>
								</td>
								<td>
										<p align="center">20%</p>
								</td>
						</tr>
						<tr>
								<td>
										<p align="center">B和C</p>
								</td>
								<td>
										<p align="center">15%</p>
								</td>
						</tr>
						<tr>
								<td>
										<p align="center">A和B和C</p>
								</td>
								<td>
										<p align="center">5%</p>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<font color="#0000ff">支持度</font>：就是一个元组在整个数据库中出现的概率。如上面的例子中<em>S(A)=0.45</em>。<br /><br /><font color="#0000ff">置信度</font>：它是针对规则而言的。对于一般的规则，它的<em>可信度=p(condition and result)/p(condition)</em>。例如有如下规则：<em>If B and C then A</em>。则它的置信度是：<em>p(B and C and A)/p(B and C)=5%/15%=0.33</em>。<br /><br /><font color="#0000ff">提高率（或者叫兴趣度）</font>：对于上面的一个规则，我们可以发现，当我们从从数据库中直接取A的时候，概率是45%；可在我们的规则中，取到A的概率却只有33.3%。显然，这种情况是我们不愿意见到的，我们应该略去这样的一些规则。所以我们引入了兴趣度的概念，具体的公式如下：<em>兴趣度=p(condition and result)/p(condition)*p(result)</em>。当兴趣度大于1的时候，这条规则就是比较好的；当兴趣度小于1的时候，这条规则就是没有很大意义的。兴趣度越大，规则的实际意义就越好。 <br /><br />克服实际应用中数据量暴大的问题。当数据量增大时，要考虑的元素组就增长的很快了。<br /><br /><font color="#0000ff">关联规则的优缺点：<br /></font><font color="#0000ff">优点：</font><br />·它可以产生清晰有用的结果。 <br />·它支持间接数据挖掘。 <br />·可以处理变长的数据。 <br />·它的计算的消耗量是可以预见的。 <p><font color="#0000ff">缺点：</font><br />·当问题变大时，计算量增长得厉害。 <br />·难以决定正确的数据。 <br />·容易忽略稀有的数据。</p><img src ="http://www.blogjava.net/tanzek/aggbug/126454.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-06-27 08:43 <a href="http://www.blogjava.net/tanzek/archive/2007/06/27/126454.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>想看的书---&lt;&lt;开发自己的搜索引擎---Lucene 2.0 + Heritrix&gt;&gt;</title><link>http://www.blogjava.net/tanzek/archive/2007/06/26/126425.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Tue, 26 Jun 2007 13:47:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/06/26/126425.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/126425.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/06/26/126425.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/126425.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/126425.html</trackback:ping><description><![CDATA[
		<p align="left">开发自己的搜索引擎---Lucene 2.0 + Heritrix<br /></p>
		<p align="center">
				<a title="开发自己的搜索引擎---Lucene2.0+Heritrix" href="http://www.china-pub.com/computers/common/info.asp?id=34370" target="_blank">
						<img height="200" alt="Lucene2007-06-26.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/BookCovers/Lucene2007-06-26.jpg" width="158" border="0" />
				</a>
		</p>
		<p align="left">
				<br />
		</p>
		<h3 class="brown13">
				<b>【内容简介】</b>
		</h3>
		<p align="left">本书详细介绍了如何应用Lucene进行搜索引擎开发，通过学习本书，读者可以完成构建一个企业级的搜索引擎网站。.<br />全书共分为14章，内容包括搜索引擎与信息检索基础，Lucene入门实例，Lucene索引的建立，使用Lucene构建搜索，Lucene的排序，Lucene的分析器，对Word、Excel和PDF格式文档的解析，Compass搜索引擎框架，Lucene分布式和Google Search API，爬虫Heritrix，综合实例之准备篇，综合实例之HTMLParser篇，综合实例之DWR篇，综合实例之Web编。..<br />本书是国内第一本使用Lucene和Heritrix来讲解搜索引擎构建的书，通过详细的对API和源代码的分析，力求使读者在应用的基础上，能够深入其核心，自行扩展和开发相应组件，发挥想象力，开发出更具有创意的搜索引擎产品。本书适合Java程序员和从事计算机软件开发的其他编程人员阅读，同时也可以作为搜索引擎爱好者的入门书籍。<br />由于目前市面上从技术层面介绍搜索引擎的书并不多，即使有，也大多停留在理论阶段，而非搜索引擎的开发过程。因此，可以说本书是国内第一本详细介绍搜索引擎开发过程的图书。<br />（1）采用最新的Lucene 2.0。以前大家用的1.4.3版本，而最新的Lucene 2.0重写了很多API，内部的实现方法也有了很大优化。本书的代码都是在2.0版本下调试通过的，这样可以帮助读者了解Lucene的更多新功能。<br />（2）配有一个完整的搜索引擎案例。这个案例有很强的实用价值，只需稍加修改，就能应用于实际项目，市场价值在30000元以上！<br />（3）着重解决开发人员头痛的问题。本书的目的是指导项目实践，因此没有罗列各个API的用法，而是对常见的开发问题进行深入探讨，比如本书的第7章，是专门为解决“Word，Excel和PDF文件如何解析”这个问题而设置的。<br />（4）内容新颖，前卫实用。本书介绍了Compass、Heritrix、DWR和HTMLParser等内容。在搜索引擎开发的过程中，这些均为相当重要且实用的技术，笔者经过自身实践将它们展现给读者，希望能让读者在学习Lucene的同时开拓视野。<br />光盘特色：<br />配有一个完整的搜索引擎案例。这个案例有很强的实用价值，只需稍加修改，就能应用于实际项目，市场价值在30000元以上！... <br /><br /><font color="#0000ff">[后注]：<br />   一直以来都对搜索引擎很有兴趣的，最近在学习JAVA，看到了Lucene，所以就找了一下，觉得这本书应该还可以的。只是苦于一直没有可靠的经济来源，所以再等一会，看能不能等到电子版哦。唉，这样子偷偷摸摸地好苦啊！</font></p>
<img src ="http://www.blogjava.net/tanzek/aggbug/126425.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-06-26 21:47 <a href="http://www.blogjava.net/tanzek/archive/2007/06/26/126425.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>最近在看的书</title><link>http://www.blogjava.net/tanzek/archive/2007/06/25/126009.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 24 Jun 2007 19:17:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/06/25/126009.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/126009.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/06/25/126009.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/126009.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/126009.html</trackback:ping><description><![CDATA[
		<p align="left">1、JSP网络开发技术与整合应用<br /></p>
		<a title="JSP网络开发技术与整合应用" href="http://www.china-pub.com/computers/common/info.asp?id=353947" target="_blank">
				<p align="center">
						<img height="160" alt="jsp2007-06-24-1.gif" src="http://www.blogjava.net/images/blogjava_net/tanzek/BookCovers/jsp2007-06-24-1.gif" width="111" border="0" />
				</p>
		</a>
		<p align="left">
				<br />
				<b>【内容简介】</b>
		</p>
		<p align="left">本书由浅入深、循序渐进地介绍了JSP技术的知识体系、开发技巧以及相关的技术整合。全书共分31章，内容涵盖了JSP技术基础、JSP技术的相关开发技术（包括JavaBeans、文件操作、数据库操作、自定义标签库等技术）、JSP技术与其他技术的整合开发（如Web测试、Log4j、J2EE、Hibernate 等）。本书一个最大的特点就是它一切以JSP技术为中心，涉及面广，对使用JSP进行Web开发过程中涉及的技术都有介绍，对每项技术都做了比较详细的介绍并配有实例程序供读者理解，每个例子都具有很强的针对性，力求让读者通过自己动手做而掌握每项技术的要点，从而学习更多的知识。.<br />本书适合JSP/Java编程的初中级读者、JSP编程爱好者、Java开发人员以及高校相关专业师生学习使用。... <br /><br />China-Pub网上书店：<a href="http://www.china-pub.com/computers/common/info.asp?id=353947">http://www.china-pub.com/computers/common/info.asp?id=353947</a><br /><br />2、JSP应用开发详解<a title="JSP应用开发详解" href="http://www.china-pub.com/computers/common/info.asp?id=16176" target="_blank"><br /></a></p>
		<p align="center">
				<a title="JSPiet应用开发详解" href="http://www.china-pub.com/computers/common/info.asp?id=16176" target="_blank">
						<img height="160" alt="jsp2007-06-24-2.gif" src="http://www.blogjava.net/images/blogjava_net/tanzek/BookCovers/jsp2007-06-24-2.gif" width="112" border="0" />
				</a>
		</p>
		<h3 class="brown13">
				<b>【内容简介】</b>
		</h3>
		<p align="left">本书结合JSP和Servlet的最新规范，从基本的语法和规范入手，以经验为后盾、以实用为目标，以实例为导向，以实践为指导，深入浅出地讲解了JSP开发中的种种问题。以精简的内容介绍了JSP的语法、Servlet技术、JDBC技术、标签库技术、表达式语言、Struts、JavaServer Face等技术；对于JSP开发中常遇到的典型的难点，专门设置了专题进行集中讨论。本书的最后一篇围绕一个电子商务网站，使用最新的表达式语言，创造性地以零Java代码介绍了各个模块的开发实现，并且提供完整的、可运行的实例。在讨论标签语言、表达式语言和Struts技术方面，本书具有独到之处。本书介绍的零Java代码电子商务网站的实现，可以作为非Java语言的JSP开发者最佳参考。随书附赠光盘内容为书中范例源代码。<br /><br />China-Pub网上书店：<a href="http://www.china-pub.com/computers/common/info.asp?id=16176">http://www.china-pub.com/computers/common/info.asp?id=16176</a><br /><br /><br /><font color="#0000ff">[注]：<br />   虽然刚考完英语四级，而且可能也考得不怎么样，但是对于专业还是那么有兴趣哦。想早一点把这两本书看完，熟悉Servlet+JSP编程。</font></p>
<img src ="http://www.blogjava.net/tanzek/aggbug/126009.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-06-25 03:17 <a href="http://www.blogjava.net/tanzek/archive/2007/06/25/126009.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]JAVA盛宴</title><link>http://www.blogjava.net/tanzek/articles/126007.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 24 Jun 2007 17:47:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/articles/126007.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/126007.html</wfw:comment><comments>http://www.blogjava.net/tanzek/articles/126007.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/126007.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/126007.html</trackback:ping><description><![CDATA[
		<p align="left">   笼统意义上的Java实际上已经成为一个大迷宫，发展方向也非常不确定，即使是许多专业Java开发人员也无法了解全豹了。在这样的大背景下评价Java图书，其实是并不讨好的差事。因此，我们将内容分为三部分，本期仅讨论Java语言层次的综合类和入门图书。 </p>
		<p align="left">入门书似乎是技术含量低的代名词，实则不然，要写一本好的入门书其实是非常难的。比如说吧，笔者惊奇地发现，国内的作者居然近乎完全口口相传、人云亦云似地还在大讲特讲AWT图形组件，而对Swing要么根本不提，要么介绍非常简略，最后完全弄成喧宾夺主，对于这样的书，我们挑选时坚决枪毙之。毕竟，Swing在图形界面方面替代AWT，已经是1998年1.2发布时的陈年旧事了，7年过去了，我们的作者、老师还在教授读者使用实际项目中根本不可能使用的AWT图形组件，简直是可怕而又可悲的事情。要知道，国外讲AWT的书早已绝版多日了。 </p>
		<p align="center">
				<img height="200" alt="clip_image001.jpg" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image001.jpg" width="139" border="0" /> <img height="200" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image002.jpg" width="162" border="0" v:shapes="_x0000_i1026" /> <img height="128" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image004.jpg" width="92" border="0" v:shapes="_x0000_i1027" /> <img height="128" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image006.jpg" width="91" border="0" v:shapes="_x0000_i1028" /></p>
		<p align="center">
				<img height="128" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image008.jpg" width="90" border="0" v:shapes="_x0000_i1029" /> <img height="128" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image010.jpg" width="93" border="0" v:shapes="_x0000_i1030" /> <img height="128" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image012.jpg" width="92" border="0" v:shapes="_x0000_i1031" /> <img height="128" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image014.jpg" width="102" border="0" v:shapes="_x0000_i1032" /></p>
		<p align="left">缘起 搞技术的人中，像笔者这样喜欢买书看书的，很有不少：同行朋友里家中技术书成山的大有人在。听说，国内互动出版网的五星级会员超过了一万，也可为此佐证。其中原因大部分应该拜我们从事的行业变化太快所赐——不读书，就有朽掉的危险。想来《中华读书报》中《电脑书城》这样的专刊，读者中除了出版界、图书发行界、图书馆界的朋友外，应该还有众多此道同人吧。 </p>
		<p align="left">算起来，接触电脑，买电脑书，也有20来年历史了。从当年一书难求，到现在屡屡被书店中琳琅满目之势所眩晕，真是恍如隔世。从某种意义上来说，如今买书想要买对，也可以算是一种学问。这种情况下，别人的阅读经验和评论，就非常有意义了。不然，何以Amazon的书评模式会如此引人注目呢。 </p>
		<p align="left">中国的评论传统，古已有之。月旦评、人物志在前，《文心》、《诗品》于后。而历代诗话、画论云云，可谓浩如烟海。书话之滥觞则始自近代阿英，此后成了非常流行的一种文体，近年来国内书业勃兴（有数字说每年新书就十数万种），更是为此推波助澜。 </p>
		<p align="left">计算机图书方面的评论介绍性文字，在我们印象中，国外已有多年，比如赫赫有名的《Dr.Dobb sJournal》网上书评ERCB，1990年开始的ACCU书评，当然还有起自1995年的Amazon自由书评，如今已经成为图书方面最具影响力的一种媒体形式。国内早期得到广泛注意的书评性文字，应该是侯捷的《Windows程序设计好书》、《MFC4大天王》、《C /OOP大系》等“无责任书评”系列，陆续使不少原来国内知之甚少的好书开始为众人所瞩目，有许多人都由此开始重视技术图书的品牌与质量。此后，国内相关的网站、杂志都开始出现，书多，有价值的信息也越来越多，荣耀、孟岩等总结的《C程序设计之四书五经》、《C 程序设计之四书五经》等等是其中的代表。但大多数门类上还是徒叹阙如，许多普通读者面对书海，仍然无所适从。 </p>
		<p align="left">说起这个专栏的缘起，完全是一种机会巧合。近年来移居海外后，能够比较没有障碍地接触到最新的图书资讯，视界迅速扩大，业余时间却增加了不少。偶然开始受人之邀帮忙选书、评书，又进而审书、译书，渐渐结识若干国内出版社的朋友，因此得以获悉不少出版界的行内故事，自己也慢慢生出些半个行内人的感觉。此后在网上再遇到初学者因为选书而手足无措时，开始忍不住好为人师，代为指点迷津一番。网上书店或者相关的技术论坛更逐渐成为笔得痛快臧否的良所。久而久之，小圈子里都知道我好发议论，朋友们开始送我一个外号——“嗜评狂”。 </p>
		<p align="left">今年伊始，收到一位出版界朋友的建议，说《中华读书报》想开一个专栏，从中立的角度，按类别总结方式为读者和发行渠道推荐国内出版的好书，以促进技术书界优胜劣汰，形成良性循环。这无疑是一件有功的事业。作为行外人兼海外人，蹙而为此，心里本来颇为踌躇，但是得多位业界朋友鼓励，并惠允全面专业知识的协助，于是也就斗胆得令，小兵先行了。 </p>
		<p align="left">名闻国内外读书界的“董氏二兄弟”中董鼎山先生有一本文集叫做《书·人·事》，本专栏名称即效此而来。笔者的意思，是不完全限于书本身，而是涉及书人、书事。但愿能够不辱使命。知我者，罪我者，欢迎发邮件到<a href="mailto:jch_liu@sohu.com" target="_blank">jch_liu@sohu.com</a>交流沟通。 </p>
		<p align="left">专栏开山第一篇，我挑当今最热门的语言Java作为主题，大概是最四平八稳，最无可争议的选择了吧。虽然Java的实际使用率应该还在C/C 之下，但是舆论似乎已经达成共识，Java才是明天的主宰。这不，Readex调查公司最近所做的一份开发人员调查显示，C/C 和Java在开发语言使用比例上的优势已经牢不可破，而且未来期望一项，Java占据了极大比例，C/C 以及VB都在明显下降。C 专家ThomasPlum也做过一个有趣的实验，使用正则表达式筛选网上招聘中的编程语言要求，结果Java以43%左右的比例仅略低于老资格的C ，排名第二，远超过了C、VB、.NET类语言。《SoftwareDevelopment》杂志最新的读者调查结果来看，Java和J2EE等相关技术人员的薪水已经稳稳高出同侪。 </p>
		<p align="left">在学界，海外的大专院校几乎都已经清一色地以Java为默认教学语言，数据结构、<a href="http://tech.163.com/special/O/000915A0/OS.html">操作系统</a>乃至编译、图形学等等科目通通采用Java实现。连美国院校委员会（CollegeBoard）针对高中生的AP考试也用Java替换了原来的C 。也难怪高德纳（Knuth）的徒孙同时也是该委员开发主席的MarkWeiss（就是多本数据结构教材的那位作者）居然要写一本《C forJavaProgrammer》了。 </p>
		<p align="left">Java的热门，也集中体现在出书上。与Java相关的图书所占比例，可能早已大过了技术本身的市场份额。近年来尤其如此。而且，从业内朋友提供的国内图书销售数据来看，Java图书的销售也早已经与VB、C/C 相较而有过之无不及了。 </p>
		<p align="left">需要指出的是，Java本身与其他语言最大的不同，在于它既是一门语言，更是一个平台，相当于C ，C /CLI，VB.NET…… .NET平台。而且Java平台又分为J2SE（即所谓Core/DestopJava）、J2EE（Enterprise/ServerJava）和J2ME（Mobile/Wireless）三层，其实此外还有Jini，JXTA，JavaWebServices等无法因此归入以上类别的平台技术。加上Apache、JBoss等大旗下的开源Java技术和轻量企业级Java技术已成燎原之势，许多互相竞争的框架、<a href="http://tech.163.com/production/">产品</a>、技术甚至开始与Sun公司官方方案争胜，笼统意义上的Java实际上已经成为一个大迷宫，发展方向也非常不确定，即使是许多专业Java开发人员也无法了解全豹了。 </p>
		<p align="left">在这样的大背景下评价Java图书，其实是并不讨好的差事。因此，我们将内容分为三部分，本期仅讨论Java语言层次的综合类和入门图书。 </p>
		<p align="left">综合/巨著 </p>
		<p align="left">在国内，Stroustrup的《C 程序设计语言（特别版）》和《C Primer中文版》经常被人并称为C 两大巨著，记得当时出版社宣传中有“倚天屠龙”语，确为妙喻。其实，《C 编程思想》也处在同一等级别，尤其是加上后来出版的第二卷之后。 </p>
		<p align="left">无独有偶，在Java世界里，同样也有并驾齐驱的巨著双璧：《Java编程思想》（第二版）BruceEckel著侯捷译机械工业出版社定价：99元 </p>
		<p align="left">本书似乎毋需多言了，它在国内名气之大我早有耳闻：以99元的高价销售已经超过了50000册（侯捷网站数据），远远甩开了竞争对手，其盛势甚至超过了海外———其实在国外，本书与《Java核心技术》、Horton、Deitel的《Java程序设计<a href="http://tech.163.com/school">教程</a>》、vanLinden的《Java2教程》（英文名JustJava）都在伯仲之间，仅仅是略占优势而已。除Deitel的面向教材市场，售价超过90美元之外，其余的连定价都咬得很紧，无论篇幅多大，均在35美元上下，可见竞争之激烈。 </p>
		<p align="left">本书的优点是对象优先，强调概念的理解，开放的模式带来了类似开源软件的群聚效果，有更多人帮助提高图书质量。第三版中对当代软件工程实践和工具（Ant、XP、Designbycontract）的融入，便于读者进入职业角色，也是大大高出一般编程书的地方，体现了Eckel仍身处开发社区中央的优势。当然，这些特点同时也带来了一些负面影响，那就是有些初学者尤其是缺乏基本编程知识的人由此入门可能会有困难。我的建议是，可以先选择一本纯粹的入门书，比如《Java语言导学》，再回头来通过本书打通任督二脉，增进功力。《Java2核心技术卷I：基础知识》（第6版）CayS.Horstmann,GaryCornell著程峰等译机械工业出版社定价：75元 </p>
		<p align="left">听出版社的朋友说，这本书渐渐在国内有了追赶前书的势头。其实这一点并不奇怪。本书的作者均是从业界转入教职、有着丰富经验的大学教授，而且除本书外，均另有多部技术名著面世，写作经验也非常老辣：Horstmann写有直接与Deitel竞争的Java教材以及其他多部畅销的计算机<a href="http://tech.163.com/discover/">科学</a>教材，在Wiley出版；而Cornell是著名的VB、C 技术作家，同时还是近年来发展飞速并且收购了大量Wrox版权的技术图书出版社Apress的创始人。图书的技术审校有包括Java传奇人物JoshuaBloch等数十人，这样的阵容，威力可想而知。 </p>
		<p align="left">由于叙述详细，编排方式近似于国内教材，本书已经逐渐成为许多读者受挫于《Java编程思想》之后的替代方案，而且颇有成效。但是作者的原意却是面向“有坚实编程语言基础的程序员”的，所以我建议完全不具备编程知识的读者还是需要另找一块敲门砖比较理想。本书更准确的定位Eckel自己在《Java编程思想》后面的资源清单中已经为我们说明了：“篇幅巨大，内容全面，我在寻找答案的时候第一个就会想到它。”当然，Eckel指的是本书的上下两卷。说到原书的卷II，作者和出版社显然有所失误，因为卷II的第6版从来就没有出版过。如今，两卷已经统一更新到了第七版。《Java程序设计教程》（第5版）H.M.Deitel著，施平安等译清华大学出版社定价：98元《Java编程语言》（第三版）KenArnold,JamesGosling著虞万融等译中国电力出版社定价：45元 </p>
		<p align="left">国内图书中能够与前两巨著相提并论的，恐怕应该还是这两本了。Deitel的程序设计语言教材影响极大，类似于国内的谭浩强，综合而言至今仍然无人能敌。当然Deitel技术上绝无问题，业界实践也并不缺，只不过他完全用一个模板方便地不断重用于各个语言，多年不变，显得有些不思进取，而且套路性文字在正文中越来越多，有一厢情愿之嫌。这些与前两本书相比，都是有差距的。不过，如果忽略篇幅和定价因素外，Deitel倒是很好的入门书。我当年就是用他的C真正入门的，相比一些同事采用国内教材的痛苦回忆和后患无穷，高下立见。Gosling的这本书篇幅是四本中最小的，它容易让我们联想到Kernighan&amp;Ritchie的《C程序设计语言》和Stroustrup的《C 程序设计语言（特别版）》。平心而论，此书的地位不如前二者，但是语言之父的凝练文字、严谨定义和书中不经意流露出来的思想，仍然弥足珍贵。本书不适合初学者入门，对于理清概念绝对是最佳读物。 </p>
		<p align="left">入 门 </p>
		<p align="left">入门书似乎是技术含量低的代名词，实则不然。要写一本好的入门书其实是非常难的，否则，当年Dryden出版社何以给哈佛的Mankiw（就是当今美国总统的经济顾问）彻头彻尾的一本入门书《经济学原理》拍出100万美元预付金？写入门书，你不仅需要具有高出所写内容层次许多的技术深度（这样才能在选择、把握材料时游刃有余），还要研究对象的学习心理，通常这意味着一定的教学经验。此外，对语言和叙述方式的要求也是最高的———高端技术书的读者大多能够宽容你文笔的干涩，而对于初学者，只要他读得费劲，你的其他优点将荡然无存。最后，你还将面临激烈的竞争，市场上可能有几十个形形色色的对手已经严阵以待。 </p>
		<p align="left">同样，推荐入门书其实也是最难的。原因之一还是同类书太多，几乎每个参与竞争的相关出版社都不会轻易放过这一角逐，市场上此类书占总品种比例大概接近了40%。原因之二则是涉及面太广：初学者是金字塔之根基，而且今日之高手同样有初学记忆，你要是推荐得不中意，他们也会发表意见的，众口既然难调，难免不会众口铄金。 </p>
		<p align="left">以上原因，促使得我们不得不谨慎从事。我们的解决办法，是设立如下评判标准： </p>
		<p align="left">1．内容选取须反映当前实际。这里并没有严格限定必须遵守最新标准。实际上也没有必要，至今尚没有见到国内有哪本书反映J2SE5.0（请读者注意，Ja鄄va平台的新版本已经从原来的1.5统一到5.0）的———本人正在翻译中的《Java核心技术》（第7版）可能会是比较早遵循5.0标准的作品。 </p>
		<p align="left">2．内容选取应该基本符合J2SE范畴。记得TimO Reilly（出技术书非常出名的O Reilly公司的老板）曾经讥讽当时流行的Java傻瓜书和“21天/24小时/10分钟自学Java”一类的图书说，Java本身并不是那么简单的编程语言，纯粹为了炒作而做出多快好省的美妙承诺，这样的书、作者和出版商都是极不负责任的。的确，Java技术本身的复杂（虽然简单是Sun公司为其下的第一个修饰词），想用一本书讲清楚基本的入门内容：语言要素、面向对象概念、图形界面开发、事件处理、I/O、applet、异常与调试等等，控制篇幅都已经非常困难，哪里还能再奢谈其他？ </p>
		<p align="left">3．翻译书的译校质量应该达到起码的要求。 </p>
		<p align="left">4．市场上容易买到。这条标准其实很难完全量化，一个指标是调查公司所统计的实际销售数据（由出版界朋友提供），一个指标是国内主要技术图书网上书店的销售排名以及点击次数。综合起来，只要缺货并不严重即可。 </p>
		<p align="left">有趣的是，这几条简单而明显的标准，衡量起当下的图书时，却成了巍巍其阿的分水岭：几乎所有国内的入门图书都被毫无借口好讲地直接淘汰出局了。第1条标准最具杀伤力，我惊奇地发现，国内的作者居然近乎完全口口相传、人云亦云似地还在大讲特讲AWT图形组件，而对Swing要么根本不提，要么介绍非常简略，最后完全弄成喧宾夺主，对于这样的书，则是坚决枪毙之。毕竟，Swing在图形界面方面替代AWT，已经是1998年1.2发布时的陈年旧事了，7年过去了，我们的作者、老师还在教授读者使用实际项目中根本不可能使用的AWT图形组件，简直是可怕而又可悲的事情。要知道，国外讲AWT的书早已绝版多日了。 </p>
		<p align="left">第2条上出现的问题有的非常可笑，有几本书（销售成绩好像还很不错）居然在煞有其事地讨论JavaScript！而不少书本来篇幅就少得可怜，许多该讲到的远未讲透，却乐滋滋地干起了副业，在最后用几页篇幅讲JSP、Servlet或者EJB，让人哭笑不得。 </p>
		<p align="left">而第3条上折损的也颇有不少，IvorHorton极富盛名的《BeginningJava2》先后几个版本《Java2入门经典》（1.2）（中国电力出版社）、《Java2编程指南》（1.3,1.4）（电子工业出版社）就都毁在翻译上。奇怪的是，最早的版本前几章还流畅可读，此外就完全有些乱来了。后面的版本居然将nativeAPI翻译成“自然API”，真不知道译者学的是什么专业。 </p>
		<p align="left">那么，最后的幸存者有哪些呢？《Java语言导学》MaryCampione等著，马朝晖译机械工业出版社定价：39元 </p>
		<p align="left">Sun公司官方推荐的Java语言初学<a href="http://tech.163.com/school">教程</a>，作者都是Sun公司内部的文档写作人员，所以文字和技术是绝对有保障的，中文翻译通顺可读。编排上，将ap鄄plet和集合等内容放入附录，也是避重就轻的合理之举，其实applet在实际项目中很少有使用的机会。常见问题也是一个很有特色的环节。不足的地方是图形组件部分太省，当然，这正好可以用《Java核心技术》等书进行弥补。《Java就业培训教程》张孝祥著清华大学出版社定价：39元 </p>
		<p align="left">张孝祥此书颇有国人特色（比如字符乱码问题）、局部也很见功力（比如一些穿插在正文中的小经验、小难点解疑），能够看出作者下了不少功夫，有所积累。国内读者由此应该比较容易入门。问题出在图形组件部分，先讲述AWT事件处理模型本来很好，但是继而用两节篇幅讲述AWT，Swing却只有一节，就有些令人遗憾了。《21天学通Java2》 第三版 RogersCadenhead等著，袁国忠译人民邮电出版社定价：54元 </p>
		<p align="left">本书属于许多人痛批的“21天学通系列”，其实内容不错，翻译也算中规中矩。所不足的地方，是作为敲门砖篇幅稍大，定价较高。如果删去RMI、联网、Servlet和JSP内容，也许更加合理。《Java2实用教程》HerbertSchildt著，马海军等译清华大学出版社定价：48元 </p>
		<p align="left">实不相瞒，此书原版在国外是一本入门畅销书，作者名气很大，写书多年了，是Osborne的王牌作者。原文讲Swing很少，而且例子比较小儿科。中文译本还没有读过，不知如何，需要读者自己判断。 </p>
		<p align="left">下次专栏，我们将继续谈谈国内出版的Java好书。 </p>
		<p align="left">本文的上半部分发表以后，引起了一些读者的兴趣。有读者对我所说的“许多普通读者面对书海，仍然无所适从”大有同感，并且询问到具体如何选书买书的问题。其实，同样的问题在各种场合包括论坛、技术讲座上，我曾经无数次被问到，所以在继续介绍Java好书之前，我先花一点篇 幅说明一下。 </p>
		<p align="left">关于选书的经验之谈 </p>
		<p align="left">以我个人的经验来看，选中适用图书的关键，在于“知己知彼”。知己，当然就是对自己有正确的定位。拿Java来说，你在购买第一本Java图书之前，需要确定自己处于什么层次。如果编程经验较少，对基本的程序设计语言概念都知之甚少的话，《Java核心技术》或者《Java编程思想》就不太合适了，这一层次的巨著都在书的最前面明确说明读者需要“一定的编程经验”，而《Java语言导学》、《21天学通Java2》可能是你的正确选择。如果你学习过其他程序设计语言，了解“关键字”、“函数”、“数据类型”等等基本概念，但是对面向对象完全是门外汉，那么《Java编程思想》是一个很好的起点，它是典型的对象优先（ObjectFirst）教学法的代表。如果你已经是有一定经验的C/C 程序员，《Ja鄄va核心技术》显然最适合你，因为书中有许多专门针对C/C 程序员的提示，而且循着“环境·语言结构·面向对象”顺序讲解。其余类别的图书也可以按照这种思路选择。 </p>
		<p align="left">此外，我有一个特别的建议：如果你的英文不错，建议入门的时候以英文版为主，辅以一本中文基础教材，尤其是面向对象的概念方面，英文直接阅读理解，往往比中文更加容易。因为面向对象概念其实涉及语言和知识表示中较深层次，恰恰是不同语言区别较大，不容易移译的地方。加之国内早期翻译不够审慎，而且统一性不足，使用中文术语体系理解，有时候反而事倍功半。就以“面向对象”一词来说，新手对此是很难望文而生义的，这是典型的不良翻译范例。曾经有一个比较夸张的笑话，说有人将《面向对象方法》当成谈恋爱技巧书买了回去，其实正说中了此译的弊病。相对而言，海外译为“物件导向”，要更接近原意。这里的对象＝object，就是中文的物体、事物乃至事情，所以《Ja鄄va编程思想》有“万事万物皆对象”（ev鄄erthingisanobject）的说法。而这里的面向＝oriented，其实是“以……为重点/中心”、“（此方法/领域中）……很重要”的意思。所以面向对象＝object oriented的英文原意，其实是“以事物表示为中心”之义。时至今日，专业人士当然不再可能有出上述笑话的可能，大家反而已经习惯这一术语体系，并且母语化了。但是学习面向对象技术的新手呢，他们仍然免不了在“类”、“类型”、“接口”、“实例”、“成员”、“方法”、“实现”、“协定”、“字段”、“属性”、“服务”、“消息”……构成的语词森林中筚路蓝缕。从这一点来说，国内高等院校开始双语教学，是有其益处的。 </p>
		<p align="left">正确选书的第二个重要环节就是知彼了，也即尽量多地了解相关图书信息。遗憾的是，目前国内客观而且有内容的书评类资料非常缺乏，出版社提供的信息又往往公信力不够。本专栏的目的之一，就是尝试对此情况有所补益。当然，普通读者的获知手段并非没有。第一手的信息，包括出版社、作译者的情况，出版前言、作译序、图书外装帧的介绍文字和设计水平都能透露制作者在此书上花费的功夫几何。前言和序纯属八股文字的图书，作译者用心程度就非常值得怀疑。此外，国内各主要专业网上书店（china pub.com，第二书店，华储等等）都有类似Amazon的自由书评以及各种销售排行榜（不少实体书店也会提供销售排行榜），虽然成色远较Amazon为逊色，但还是很值得参考的，毕竟这些都反映着客观因素。尤其是china pub上外版书有直接到Amazon该书原文版的链接，可以很方便地了解原版的评价，然后考虑翻译质量，即可八九不离十了。本报定期刊登的各出版社“销售热点”、“书店经理荐书榜”等等栏目也是图书情况的重要参考。至少，你可以了解到某种、某类书市场上哪些销售良好，哪些是出版社的重点<a href="http://tech.163.com/production/">产品</a>。 </p>
		<p align="left">老实说，目前选书买书的确不是易事。撰写本文过程中，我所查询到的Java图书不下六七百种，但是真正值得评论的却在30种以内。看来，国内出版界离正确的方向还有不小的差距。 </p>
		<p align="left">继续我们的Java图书盛宴。在综合和入门层次图书之后，我们已经更上一层楼，可以看到更广阔的Java世界图景。首先进入我们视野的是语言编程经验和深入层次图书，面向中级读者。正如著名程序设计专家Sun公司杰出工程师GuySteele所说：“对于一门程序设计语言，你需要了解三样东西：一是语言核心，即语法结构；二是语言的词汇，包括所提供的数据结构和功能设施；三是语言的习惯用法。”一般的程序设计图书只会涉及到前面两点，而要讨论第三点，往往需要作者有大量的代码开发和阅读经验，难度极大，所以，这一层次目前国内市场上所见图书，基本上都是国外翻译作品。 </p>
		<p align="left">曾几何时，国外的Java图书出现过三大系列鼎足而立的态势。这就是Pearson集团旗下的Prentice Hall和Addison Wesley与Sun公司合作推出的Sun Press Java系列，Wrox公司的Java系列和O'Reilly公司的Java系列。比较而言，前者虽然来自技术本原，又汇集原来两个系列的实力，权威性毋庸置疑，但是总体 </p>
		<table cellpadding="0" align="left" border="0">
				<tbody>
						<tr>
								<td>
										<p align="left"> </p>
								</td>
						</tr>
				</tbody>
		</table>
		<p align="left">上技术文档气息比较重，各书之间就写作水平和易读性来看很不均衡，既有《Java核心技术》、《Effective Java》、《Java编程语言》这样的超级经典，又有大量平平之作。后者的规划最为严密，丛书的平均水平也最整齐，经过多年积累，已经出版了70多种，几乎囊括了Java技术的方方面面：语言学习（以《Head First Java》和《Java in a Nutshell》为代表）、技术专题（以《Java网络编程》、《Java与XML》、《Java Swing》、《Java Server Pages》为代表）、工具（《Eclipse》、《Ant权威指南》为代表）、企业级开发（以《Enterprise JavaBeans》为代表）和实例（《Java经典实例》为代表）。而Wrox则是盛极后衰的典型，2001年前后，印着作者头像大多名为“Beginning”和“Professional”的红皮书与O Reilly一一针锋相对，不但出手奇快，而且内容涵盖全面扎实，博得好评一片，声势一度压过了后者，这其中以Ivar Horton的《Java入门经典》、《J2EE高级编程》、《Expert One-on-One J2EE Design and Development》为代表。可遗憾的是，此后不久Wrox就由于整个集团在.NET和Java乃至图形图像、网站设计等等多面作战，战线过长，管理又失控，终于以被收购而告终。其品牌和大部分图书归入John Wiley所有，也就是说，现在新的红皮书都是这家有近200年历史的公司旗下出品。另外有部分图书则被开发类图书的新锐Apress购买，改用该出版社的封面。两家目前同时出版“Beginning”冠名的图书，但是原“Professional”系列Apress改用“Pro”以示区分。 </p>
		<p align="left">　　这三大主流系列之外，还有小型的Manning出版社不可不提。Manning本来也覆盖各种开发语言和工具，甚至包括其他出版社很少涉及的PowerBuilder，但是2003年后，几乎完全转向了Java平台，与Java开发社区的结合度大概是最紧的———theServerSide网站上就频繁出现该出版社的图书预览评论。为了避免与大中型竞争对手正面冲突，Manning选择了更加专业和前沿的小众领域，并精益求精，取得了极佳的口碑。在Struts、Hibernate、JUnit、Ant等方面都有最具竞争力的图书。 </p>
		<p align="left">　　虽然本文已经进入最后部分，但是从所涉及的Java领域来看，只能说是刚刚开了一个头———仅仅评完了语言层面的图书而已。不难发现，目前国内市场上值得关注的引进图书，几乎都不出以上四家，当然，近来国产图书也开始有了一些佳作。接下来，让我们一起尽览Java图书大观园秀色。 </p>
		<p align="center">工具书 </p>
		<p align="left">　　Java是一种简单但是又复杂的语言。说它简单，是指相对C 等前辈而言，许多功能语言能够直接提供支持，大大减少了开发工作量；说它复杂，是指Java语言和平台提供的功能极为丰富，短时间很难掌握。时至今日，发展到5.0的Java，光是API的数量就已经是一个惊人的数字，就更不用说其中细节了。Sun公司的API文档当然帮得上忙，但是对于经验不够以及英文不好的人，无法完全解决问题。这种情况下，可供查阅的工具书就非常必要了。 </p>
		<p align="center">
				<img height="400" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image016.jpg" width="267" border="0" v:shapes="_x0000_i1033" />
		</p>
		<p align="left">　　JAVA技术手册（第4版）（影印版）<br />　　David Flanagan／著<br />　　清华大学出版社　定价：99元 </p>
		<p align="left">　　说起Java工具书，首屈一指的当然是Flanagan的传奇大作了。此书与《Unix技术手册》、《Linux技术手册》并称O'Reilly Nutshell（坚果）系列的三大手册，是该公司早期得以称雄技术出版领域的大功臣，与Java的版本保持同步。言简意赅的叙述和丰富的索引是其招牌特征。此书中没有涉及AWT、Swing以及J2EE的内容，系列中另有两本书专门讲述。需要警告大家的是，第4版是此书最不好的一个版本，最明显的缺点就是书中切口处没有印上类似于字典的曾经是Nutshell手册特色的分隔标签。每章开始处的包关系图也没了。国内中国电力出版社还出版过此书第三版的中文版，但是翻译颇受诟病。国外此书的第五版已经出版，又迅速攀升到畅销榜前列。 </p>
		<p align="center">
				<img height="400" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image018.jpg" width="308" border="0" v:shapes="_x0000_i1034" />
		</p>
		<p align="left">　　JAVA Developers ALMANAC 中文版：实例与快速参考（第1.4版　第1卷） <br />　　Patrick Chan／著　王卫星等／译<br />　　机械工业出版社　定价：99元 </p>
		<p align="left">　　作者作为Java创始小组的主力成员，曾是负责可移植性和Windows平台的架构师，也是AWT的设计者之一。显然，在版式设计方面，他也颇有天赋。本书在形式和体例设计上花费的心思比《Java技术手册》可以说是有过之而无不及，因此多年来极受Java程序员青睐。其结果，是一本非常实用参考书，除按字母逐一讲解API之外，还有极为丰富的实例，实例有网络版，查询更加方便。本书有些网上书店有特价销售，30元左右，可谓大大的物超所值。此书本还有第2卷，讨论applet和Swing，但是没有中文版。清华大学出版社影印了两卷，可以参考。 </p>
		<p align="left">以下我们真正超越基本语言的层面，进入更广阔的天地。迎面而来的是开发客户端程序必不可少的GUI技术，也就是Swing。由于Java在桌面方面的开发还没有成为主流，我们在这里只是浅尝辄止。 </p>
		<p align="left">　　Java Swing（第二版） <br />　　Marc Loy,Robert　Eckstein等／著　R&amp;W组／译 <br />　　清华大学出版社　定价：128.00元 </p>
		<p align="left">　　Swing方面的书目前只能推荐这一本了。很抱歉，书很厚，价钱也是个问题。但是权威性还是有口碑的，翻译也不错。而如此篇幅却仍然会漏掉一些重要内容，Swing的琐细可以想见了。比较多被人提到的明显遗漏包括AWT事件模型和一些布局管理器。 </p>
		<p align="left">　　国外共有三本比较重要的Swing图书，除本书外，还有Manning所出的一本，也是近900页的巨著，在我印象中似乎没有中文版本。SunPressJava系列中也有一本《JFCSWING标准教材（第二版）》，略薄一些，有中文译本（电子工业出版社），但是翻译不能令人满意，就不予推荐了。 </p>
		<p align="left">　　接下来我们进入企业级Java的技术迷宫。这是目前炙手可热的领域。然而奇怪得很，如此复杂、内涵丰富、大有文章可做的宝库，国内值得推荐图书的数量和质量却难以与之相符。 </p>
		<p align="left">J2EE综述： __________________________________________________________________________ </p>
		<p align="center">
				<img height="400" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image020.jpg" width="317" align="center" border="0" v:shapes="_x0000_i1035" />
		</p>
		<p align="left">　　The J2EE Tutorial中文版<br />　　Stephanie Bodoff等／著　颜承等／译<br />　　中国铁道出版社　定价：47元</p>
		<p align="left">　　网站上常常有读者询问J2EE该如何入门，从哪一本书入门的问题，令人遗憾的是，目前这个问题并没有直截了当的答案。因为在J2EE 1.5（估计Sun会统一为5.0）尤其是EJB3.0定案之前，J2EE的整个发展方向都并不明确。至少目前，放弃EJB的重量级方案而选用Hibernate、Spring之类的轻型框架正在成为热点。 </p>
		<p align="left">　　本书的好处在于，它直接来自Sun公司，是对J2EE最四平八稳的介绍。书中的主干还是对EJB的介绍，对其他方面包括Web层技术的介绍都比较简略。由于篇幅所限，通过本书，你只能对J2EE有一个大概的初步印象，真正能够达到实战水平，道路还很漫长。顺带提及，本书的新版本（针对1.4）《J2EE1.4标准教材》已经由电子工业出版社出版，其中增加的部分大多与XML、Web服务和JSP方面的更新以及JSF相关，这正是J2EE1.3到1.4的主要更新。不过新版本已经厚达1000页以上，定价100元，就性价比而言似乎不是那么尽如人愿。 </p>
		<p align="left">Web层： __________________________________________________________________________ </p>
		<p align="left">　　Servlet与JSP核心编程，卷1（第2版） <br />　　Marty Hall，Larry Brown／著　赵学良／译 <br />　　清华大学出版社　定价：59元 </p>
		<p align="left">　　按照一般的学习地图，从语言到企业级Java最好的路径就是JSP和Servlet。事实上，如果你没有机会参与大型软件系统的开发，J2EE中最常用也最实用的也就是Web层技术，开发动态网站等等应用，即使中小企业也都用得上。历史上，Servlet和JSP大多是分别讲述的，O'Reilly和Wrox等等出版社都是如此。然而，这两项技术不仅本质相同（最终都要转换为Servlet，再进行编译），而且在应用中关系极为密切。因此，MartyHall将两者结合讲解看似独辟蹊径，实则更加贴近开发实践。从我个人的经验来看，这样做是绝对正确的，也正是这样的处理，使本书得以鹤立鸡群。 </p>
		<p align="left">　　本书原著和译笔都非常流畅，讲述技术细节体贴周到。作者在阐释概念方面有独到之处，常常三言两语就能说清其他书中长篇大论也说不清的东西。书中对Servlet和JSP两项技术区别和如何集成的叙述就极精彩。Amazon上本书的读者评论就达到200多条，受欢迎程度可见一斑。 </p>
		<p align="left">　　本书的第2卷尚未出版，从内容上看应该是在机械工业出版社已经出版的《Servlet与JSP权威指南》（即《More Servlet sand JSP》中文版）一书基础上的更新和扩充，将涵盖Struts、JSTL、JSF等内容。 </p>
		<p align="center">
				<img height="400" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image022.jpg" width="320" border="0" v:shapes="_x0000_i1036" />
		</p>
		<p align="left">　　JSP设计（第三版）<br />　　Hans Bergsten／著　林琪　朱涛江／译<br />　　中国电力出版社　定价：79元 </p>
		<p align="left">　　由于不断保持更新，在单独讲JSP的引进图书中本书已经稳坐头把交椅。值得称道的是，这一版的翻译工作有较大提高。作者的专家身份（JSP和Servlet规范专家组成员）自然保证了内容的权威性。为了覆盖更广的读者群，尤其是网页设计人员，书中不少内容起点很低，比如在讲解中可能很详细地解释一些编程基础知识。这种处理显然是一把双刃剑，有经验的程序员对此很容易不耐烦，事实上网上对此书不利的评价大多也是由此而引起的。在我看来，想让一本JSP技术书籍既满足网页设计人员，又满足软件开发人员几乎是不可能完成的任务，还是“分而治之”符合计算机<a href="http://tech.163.com/discover/">科学</a>原理。 </p>
		<p align="left">　　精通Struts：基于MVC的Java Web设计与开发 <br />　　孙卫琴／著<br />　　电子工业出版社　定价：49元</p>
		<p align="left">　　Tomcat与Java Web开发技术详解<br />　　孙卫琴　李洪成／著<br />　　电子工业出版社　定价：45元</p>
		<p align="left">　　这两本书是2004年国内原创图书中的惊喜。以如此专业的图书而获得一致好评和空前的市场成功（《精通Struts》一书2004年8月出版，到2005年2月已经是第5次印刷，而且仍然印刷了5000册，出版界的朋友告诉我，由此判断此书销售应该已经超过25000册，在今日的市场中如此销量，确属惊人），其含义是非常丰富的：一方面说明技术图书市场其实并没有大多数人眼中的那么悲观，一方面说明Java技术目前在国内的热度确实非常。 </p>
		<p align="left">　　关于这两本书，一位读者的评价非常中肯：“优点并不在于它提出了多少有突破性、发明性的思想，但它作为技术传播工具，能够把技术分析得非常清晰细致，举的各种Web应用实例循序渐进，恰到好处。”也许恰到好处，贴切符合国人需要，才是原创图书成功的必由之路。 </p>
		<p align="left">EJB层：__________________________________________________________________________ </p>
		<p align="left">　　精通EJB（第二版）<br />　　Ed Roman／著　刘晓华／译<br />　　电子工业出版社　定价：59元 </p>
		<p align="left">　　精通EJB（第二版）<br />　　Ed Roman／著　刘晓华／译<br />　　电子工业出版社　定价：59元 </p>
		<p align="left">　　毫无疑问，按Sun公司的本意，EJB应该是J2EE架构中真正的核心。然而，令人尴尬的是，国内已经出版的讲述E鄄JB的图书中，居然挑不出一本完全合格的<a href="http://tech.163.com/school">教程</a>类图书可以推荐。本书原版非常有名，问题又出在翻译上：后半部分许多地方质量差得惊人。好在原作者公开了原版电子文件，读者能够一边看，一边改，一边骂了。 </p>
		<p align="left">　　此书手稿中的一部分最后演变成了另一本书《EJB设计模式》，已由机械工业出版社出版，属于经验总结性的读物，应该配合阅读。 </p>
		<p align="left">经验T深入T模式： </p>
		<p align="left">__________________________________________________________________________ </p>
		<p align="center">
				<img height="400" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image023.jpg" width="276" border="0" v:shapes="_x0000_i1037" />
		</p>
		<p align="left">　　J2EE设计开发编程指南<br />　　Rod Johnson／著　魏海萍／译<br />　　电子工业出版社　定价：64元 </p>
		<p align="left">__________________________________________________________________________ </p>
		<p align="center">
				<img height="300" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image023.jpg" width="207" border="0" v:shapes="_x0000_i1038" />
		</p>
		<p align="left">　　J2EE设计开发编程指南<br />　　Rod Johnson／著　魏海萍／译<br />　　电子工业出版社　定价：64元 </p>
		<p align="left">　　如果J2EE方面只允许推荐一本书的话，此书的英文版会是很多人的选择。Johnson所提出的EJB并不是万灵丹药，以及对何时使用EJB，不使用EJB时的替代方案等等，在当时可以说是振聋发聩，惊醒了许多人。从书中发展出来的Spring框架如今已经成为J2EE轻量级运动的重要一员。让人痛心的是，这本书中文版翻译得惨不忍睹。就凭将Johnson著作无情糟蹋掉这一点，这位译者已经得罪了整个J2EE社区。电子工业出版社在Java技术方面，尤其是J2EE方面出书很多，但是在某些方面（比如说翻译）常常很难令人满意，也许应该好好总结一下了。至少，本书的价值到今天仍然不减，Amazon上的排名保持在3000左右，仍然是最畅销的Java类图书之一，为什么不考虑一下重新翻译，利人利己呢？ </p>
		<p align="center">
				<img height="300" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image025.jpg" width="240" border="0" v:shapes="_x0000_i1039" />
		</p>
		<p align="left">　　J2EE核心模式<br />　　Deepak Alur等／著　牛志奇等／译<br />　　机械工业出版社　定价：35元 </p>
		<p align="left">　　J2EE领域本书与上一本齐名，汇集了Sun公司和客户大量经验，是J2EE架构师必读书。糟糕的是，本书的翻译也是问题多多，只能说比上一本稍好一些。<a href="http://tech.163.com/discover/">科学</a>出版社出版了影印版，可以参考。 </p>
		<p align="left">　　不过也有好消息，此书已经有了第二版，而且中文版由长期担任本报特约记者的青年才俊担纲翻译，不日就将由机械工业出版社出版。想来这次该有满意的结果。 </p>
		<p align="center">其　他 </p>
		<p align="left">　　最后是几本没有归入前面的类别，然而我本人认为比较重要的好书。 </p>
		<p align="center">
				<img height="300" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image026.jpg" width="212" border="0" v:shapes="_x0000_i1040" />
		</p>
		<p align="left">　　JAVA与模式<br />　　阎宏<br />　　电子工业出版社　定价：88元 　　 </p>
		<p align="left">　　本书显然也创造了一个奇迹，高定价仍然畅销并且常销，为原创图书树立了很好的榜样。讲述模式的好书已经很多，但是专门结合Java讲述的，目前应该还是以此本最佳。 </p>
		<p align="left">　　JAVA实用系统开发指南<br />　　彭晨阳<br />　　机械工业出版社　定价：42元 </p>
		<p align="left">　　本书是一本实例驱动的<a href="http://tech.163.com/school">教程</a>，虽然有些设计和代码不够成熟，但以原创标准衡量，已经难能可贵。书中比较详细地介绍了设计思路，并兼顾地介绍相关模式和技术，是一种很好的写作模式。 </p>
		<p align="center">
				<img height="300" src="http://www.blogjava.net/images/blogjava_net/tanzek/JavaFeast/clip_image027.jpg" width="231" border="0" v:shapes="_x0000_i1041" />
		</p>
		<p align="left">　　Java与XML（第二版）<br />　　Brett McLaugblin／著　刘基诚／译<br />　　中国电力出版社　定价：59元 </p>
		<p align="left">　　举贤不避亲。此书正是本人所译。由于J2EE1.4中增加了大量处理XML以及Web服务的内容，此书的重要性大大提升。翻译中在语言的平顺上下了不少功夫，总体还算满意。不过编辑校对上的小失误较多，有一些遗憾。 </p>
		<p align="left">　　我们的Java图书之旅已经到站。虽然已经尽力，但是限于篇幅、眼力和阅历，肯定无法反映全貌，批评与意见，请给我们发邮件：<a href="mailto:jch-liu@sohu.com" target="_blank">jch-liu@sohu.com</a>。</p>
		<p>
				<br />
				<strong style="COLOR: #00ff00">[后注]：<br />本文中推荐的书籍：<br /></strong>
				<span style="COLOR: #0000ff">赫赫有名的《Dr.Dobb sJournal》网上书评ERCB<br />1990年开始的ACCU书评<br /><font color="#0000ff">起自1995年的Amazon自由书评</font></span>
				<font color="#0000ff">
				</font>
		</p>
		<p>
				<font color="#0000ff">侯捷的《Windows程序设计好书》、《MFC4大天王》、《C /OOP大系》等“无责任书评”系列</font>
		</p>
		<p>
				<font color="#0000ff">Stroustrup的《C 程序设计语言（特别版）》和《C Primer中文版》</font>
		</p>
		<p>
				<font color="#0000ff">《Java编程思想》（第二版）BruceEckel著侯捷译机械工业出版社定价：99元<br />《Java核心技术》 35美元上下<br />Horton、Deitel的《Java程序设计教程》 90美元<br />vanLinden的《Java2教程》（英文名JustJava） 35美元上下<br />《Java2核心技术卷I：基础知识》（第6版）CayS.Horstmann,GaryCornell著 程峰等译 机械工业出版社定价：75元 <br />《Java编程语言》（第三版）KenArnold,JamesGosling著 虞万融等译 中国电力出版社定价：45元 </font>
		</p>
		<p>
				<font color="#0000ff">入门：<br />《Java语言导学》MaryCampione等著 马朝晖译 机械工业出版社定价：39元 <br />《Java就业培训教程》张孝祥著 清华大学出版社定价：39元</font>
		</p>
		<p>
				<font color="#0000ff">《Java核心技术》、《Effective Java》、《Java编程语言》 超级经典</font>
		</p>
		<p>
				<font color="#0000ff">工具书：<br />　　JAVA Developers ALMANAC 中文版：实例与快速参考（第1.4版　第1卷） <br />　　Patrick Chan／著　王卫星等／译<br />　　机械工业出版社　定价：99元 </font>
		</p>
		<p>
				<font color="#0000ff">J2EE：<br />　　Servlet与JSP核心编程，卷1（第2版） <br />　　Marty Hall，Larry Brown／著　赵学良／译 <br />　　清华大学出版社　定价：59元 </font>
		</p>
		<p>
				<br />
				<font color="#0000ff">　　Servlet与JSP核心编程，卷1（第2版） <br />　　Marty Hall，Larry Brown／著　赵学良／译 <br />　　清华大学出版社　定价：59元 </font>
		</p>
		<p>
				<font color="#0000ff">　　精通Struts：基于MVC的Java Web设计与开发 <br />　　孙卫琴／著<br />　　电子工业出版社　定价：49元</font>
		</p>
		<p>
				<font color="#0000ff">　　Tomcat与Java Web开发技术详解<br />　　孙卫琴　李洪成／著<br />　　电子工业出版社　定价：45元</font>
		</p>
		<p>
				<font color="#0000ff">　　精通EJB（第二版）<br />　　Ed Roman／著　刘晓华／译<br />　　电子工业出版社　定价：59元 </font>
		</p>
		<p>
				<font color="#0000ff">　　J2EE设计开发编程指南<br />　　Rod Johnson／著　魏海萍／译<br />　　电子工业出版社　定价：64元 </font>
		</p>
		<p>
				<font color="#0000ff">　　J2EE核心模式<br />　　Deepak Alur等／著　牛志奇等／译<br />　　机械工业出版社　定价：35元 <br />　　J2EE架构师必读书</font>
		</p>
		<p>
				<font color="#0000ff">　　JAVA与模式<br />　　阎宏<br />　　电子工业出版社　定价：88元 　　</font>
		</p>
		<p>
				<font color="#0000ff">　　JAVA实用系统开发指南<br />　　彭晨阳<br />　　机械工业出版社　定价：42元</font>
		</p>
<img src ="http://www.blogjava.net/tanzek/aggbug/126007.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-06-25 01:47 <a href="http://www.blogjava.net/tanzek/articles/126007.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]关于垃圾收集的一些话</title><link>http://www.blogjava.net/tanzek/articles/126005.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 24 Jun 2007 16:54:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/articles/126005.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/126005.html</wfw:comment><comments>http://www.blogjava.net/tanzek/articles/126005.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/126005.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/126005.html</trackback:ping><description><![CDATA[<p>附录E 关于垃圾收集的一些话<br><br>&#8220;很难相信Java居然能和C++一样快，甚至还能更快一些。&#8221;</p>
<p>据我自己的实践，这种说法确实成立。然而，我也发现许多关于速度的怀疑都来自一些早期的实现方式。由于这些方式并非特别有效，所以没有一个模型可供参考，不能解释Java速度快的原因。</p>
<p>我之所以想到速度，部分原因是由于C++模型。C++将自己的主要精力放在编译期间&#8220;静态&#8221;发生的所有事情上，所以程序的运行期版本非常短小和快速。C++也直接建立在C模型的基础上（主要为了向后兼容），但有时仅仅由于它在C中能按特定的方式工作，所以也是C++中最方便的一种方法。最重要的一种情况是C和C++对内存的管理方式，它是某些人觉得Java速度肯定慢的重要依据：在Java中，所有对象都必须在内存&#8220;堆&#8221;里创建。</p>
<p>而在C++中，对象是在堆栈中创建的。这样可达到更快的速度，因为当我们进入一个特定的作用域时，堆栈指针会向下移动一个单位，为那个作用域内创建的、以堆栈为基础的所有对象分配存储空间。而当我们离开作用域的时候（调用完毕所有局部构建器后），堆栈指针会向上移动一个单位。然而，在C++里创建&#8220;内存堆&#8221;（Heap）对象通常会慢得多，因为它建立在C的内存堆基础上。这种内存堆实际是一个大的内存池，要求必须进行再循环（再生）。在C++里调用delete以后，释放的内存会在堆里留下一个洞，所以再调用new的时候，存储分配机制必须进行某种形式的搜索，使对象的存储与堆内任何现成的洞相配，否则就会很快用光堆的存储空间。之所以内存堆的分配会在C++里对性能造成如此重大的性能影响，对可用内存的搜索正是一个重要的原因。所以创建基于堆栈的对象要快得多。</p>
<p>同样地，由于C++如此多的工作都在编译期间进行，所以必须考虑这方面的因素。但在Java的某些地方，事情的发生却要显得&#8220;动态&#8221;得多，它会改变模型。创建对象的时候，垃圾收集器的使用对于提高对象创建的速度产生了显著的影响。从表面上看，这种说法似乎有些奇怪——存储空间的释放会对存储空间的分配造成影响，但它正是JVM采取的重要手段之一，这意味着在Java中为堆对象分配存储空间几乎能达到与C++中在堆栈里创建存储空间一样快的速度。</p>
<p>可将C++的堆（以及更慢的Java堆）想象成一个庭院，每个对象都拥有自己的一块地皮。在以后的某个时间，这种&#8220;不动产&#8221;会被抛弃，而且必须再生。但在某些JVM里，Java堆的工作方式却是颇有不同的。它更象一条传送带：每次分配了一个新对象后，都会朝前移动。这意味着对象存储空间的分配可以达到非常快的速度。&#8220;堆指针&#8221;简单地向前移至处女地，所以它与C++的堆栈分配方式几乎是完全相同的（当然，在数据记录上会多花一些开销，但要比搜索存储空间快多了）。</p>
<p>现在，大家可能注意到了堆事实并非一条传送带。如按那种方式对待它，最终就要求进行大量的页交换（这对性能的发挥会产生巨大干扰），这样终究会用光内存，出现内存分页错误。所以这儿必须采取一个技巧，那就是著名的&#8220;垃圾收集器&#8221;。它在收集&#8220;垃圾&#8221;的同时，也负责压缩堆里的所有对象，将&#8220;堆指针&#8221;移至尽可能靠近传送带开头的地方，远离发生（内存）分页错误的地点。垃圾收集器会重新安排所有东西，使其成为一个高速、无限自由的堆模型，同时游刃有余地分配存储空间。</p>
<p>为真正掌握它的工作原理，我们首先需要理解不同垃圾收集器（GC）采取的工作方案。一种简单、但速度较慢的GC技术是引用计数。这意味着每个对象都包含了一个引用计数器。每当一个句柄同一个对象连接起来时，引用计数器就会增值。每当一个句柄超出自己的作用域，或者设为null时，引用计数就会减值。这样一来，只要程序处于运行状态，就需要连续进行引用计数管理——尽管这种管理本身的开销比较少。垃圾收集器会在整个对象列表中移动巡视，一旦它发现其中一个引用计数成为0，就释放它占据的存储空间。但这样做也有一个缺点：若对象相互之间进行循环引用，那么即使引用计数不是0，仍有可能属于应收掉的&#8220;垃圾&#8221;。为了找出这种自引用的组，要求垃圾收集器进行大量额外的工作。引用计数属于垃圾收集的一种类型，但它看起来并不适合在所有JVM方案中采用。</p>
<p>在速度更快的方案里，垃圾收集并不建立在引用计数的基础上。相反，它们基于这样一个原理：所有非死锁的对象最终都肯定能回溯至一个句柄，该句柄要么存在于堆栈中，要么存在于静态存储空间。这个回溯链可能经历了几层对象。所以，如果从堆栈和静态存储区域开始，并经历所有句柄，就能找出所有活动的对象。对于自己找到的每个句柄，都必须跟踪到它指向的那个对象，然后跟随那个对象中的所有句柄，&#8220;跟踪追击&#8221;到它们指向的对象&#8230;&#8230;等等，直到遍历了从堆栈或静态存储区域中的句柄发起的整个链接网路为止。中途移经的每个对象都必须仍处于活动状态。注意对于那些特殊的自引用组，并不会出现前述的问题。由于它们根本找不到，所以会自动当作垃圾处理。</p>
<p>在这里阐述的方法中，JVM采用一种&#8220;自适应&#8221;的垃圾收集方案。对于它找到的那些活动对象，具体采取的操作取决于当前正在使用的是什么变体。其中一个变体是&#8220;停止和复制&#8221;。这意味着由于一些不久之后就会非常明显的原因，程序首先会停止运行（并非一种后台收集方案）。随后，已找到的每个活动对象都会从一个内存堆复制到另一个，留下所有的垃圾。除此以外，随着对象复制到新堆，它们会一个接一个地聚焦在一起。这样可使新堆显得更加紧凑（并使新的存储区域可以简单地抽离末尾，就象前面讲述的那样）。</p>
<p>当然，将一个对象从一处挪到另一处时，指向那个对象的所有句柄（引用）都必须改变。对于那些通过跟踪内存堆的对象而获得的句柄，以及那些静态存储区域，都可以立即改变。但在&#8220;遍历&#8221;过程中，还有可能遇到指向这个对象的其他句柄。一旦发现这个问题，就当即进行修正（可想象一个散列表将老地址映射成新地址）。</p>
<p>有两方面的问题使复制收集器显得效率低下。第一个问题是我们拥有两个堆，所有内存都在这两个独立的堆内来回移动，要求付出的管理量是实际需要的两倍。为解决这个问题，有些JVM根据需要分配内存堆，并将一个堆简单地复制到另一个。</p>
<p>第二个问题是复制。随着程序变得越来越&#8220;健壮&#8221;，它几乎不产生或产生很少的垃圾。尽管如此，一个副本收集器仍会将所有内存从一处复制到另一处，这显得非常浪费。为避免这个问题，有些JVM能侦测是否没有产生新的垃圾，并随即改换另一种方案（这便是&#8220;自适应&#8221;的缘由）。另一种方案叫作&#8220;标记和清除&#8221;，Sun公司的JVM一直采用的都是这种方案。对于常规性的应用，标记和清除显得非常慢，但一旦知道自己不产生垃圾，或者只产生很少的垃圾，它的速度就会非常快。</p>
<p>标记和清除采用相同的逻辑：从堆栈和静态存储区域开始，并跟踪所有句柄，寻找活动对象。然而，每次发现一个活动对象的时候，就会设置一个标记，为那个对象作上&#8220;记号&#8221;。但此时尚不收集那个对象。只有在标记过程结束，清除过程才正式开始。在清除过程中，死锁的对象会被释放然而，不会进行任何形式的复制，所以假若收集器决定压缩一个断续的内存堆，它通过移动周围的对象来实现。</p>
<p>&#8220;停止和复制&#8221;向我们表明这种类型的垃圾收集并不是在后台进行的；相反，一旦发生垃圾收集，程序就会停止运行。在Sun公司的文档库中，可发现许多地方都将垃圾收集定义成一种低优先级的后台进程，但它只是一种理论上的实验，实际根本不能工作。在实际应用中，Sun的垃圾收集器会在内存减少时运行。除此以外，&#8220;标记和清除&#8221;也要求程序停止运行。</p>
<p>正如早先指出的那样，在这里介绍的JVM中，内存是按大块分配的。若分配一个大块头对象，它会获得自己的内存块。严格的&#8220;停止和复制&#8221;要求在释放旧堆之前，将每个活动的对象从源堆复制到一个新堆，此时会涉及大量的内存转换工作。通过内存块，垃圾收集器通常可利用死块复制对象，就象它进行收集时那样。每个块都有一个生成计数，用于跟踪它是否依然&#8220;存活&#8221;。通常，只有自上次垃圾收集以来创建的块才会得到压缩；对于其他所有块，如果已从其他某些地方进行了引用，那么生成计数都会溢出。这是许多短期的、临时的对象经常遇到的情况。会周期性地进行一次完整清除工作——大块头的对象仍未复制（只是让它们的生成计数溢出），而那些包含了小对象的块会进行复制和压缩。JVM会监视垃圾收集器的效率，如果由于所有对象都属于长期对象，造成垃圾收集成为浪费时间的一个过程，就会切换到&#8220;标记和清除&#8221;方案。类似地，JVM会跟踪监视成功的&#8220;标记与清除&#8221;工作，若内存堆变得越来越&#8220;散乱&#8221;，就会换回&#8220;停止和复制&#8221;方案。&#8220;自定义&#8221;的说法就是从这种行为来的，我们将其最后总结为：&#8220;根据情况，自动转换停止和复制／标记和清除这两种模式&#8221;。</p>
<p>JVM还采用了其他许多加速方案。其中一个特别重要的涉及装载器以及JIT编译器。若必须装载一个类（通常是我们首次想创建那个类的一个对象时），会找到.class文件，并将那个类的字节码送入内存。此时，一个方法是用JIT编译所有代码，但这样做有两方面的缺点：它会花更多的时间，若与程序的运行时间综合考虑，编译时间还有可能更长；而且它增大了执行文件的长度（字节码比扩展过的JIT代码精简得多），这有可能造成内存页交换，从而显著放慢一个程序的执行速度。另一种替代办法是：除非确有必要，否则不经JIT编译。这样一来，那些根本不会执行的代码就可能永远得不到JIT的编译。</p>
<p>由于JVM对浏览器来说是外置的，大家可能希望在使用浏览器的时候从一些JVM的速度提高中获得好处。但非常不幸，JVM目前不能与不同的浏览器进行沟通。为发挥一种特定JVM的潜力，要么使用内建了那种JVM的浏览器，要么只有运行独立的Java应用程序。</p>
<!--msthemeseparator-->
<p align=center><img height=10 src="http://www.sdau.edu.cn/support/thinkinjava/_themes/inmotion/inmhorsa.gif" width=300></p>
<p align=center><a href="http://www.sdau.edu.cn/tppmsgs/msgs0.htm#1"><u><font color=#0000ff>英文版主页</font></u></a> | <a href="http://www.sdau.edu.cn/support/thinkinjava/index.htm"><u><font color=#0000ff>中文版主页</font></u></a> | <a href="http://www.sdau.edu.cn/support/thinkinjava/contents/index.htm"><u><font color=#0000ff>详细目录</font></u></a> | </p>
<img src ="http://www.blogjava.net/tanzek/aggbug/126005.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-06-25 00:54 <a href="http://www.blogjava.net/tanzek/articles/126005.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>阻碍晋升和事业发展的十大因素</title><link>http://www.blogjava.net/tanzek/archive/2007/05/12/116953.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sat, 12 May 2007 03:48:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/05/12/116953.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/116953.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/05/12/116953.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/116953.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/116953.html</trackback:ping><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp; 在职业生涯中，仅仅因为你工作出色并不能够保证你在公司稳步提升。不管是否公正，你必须要考虑其他一些因素。 </p>
<p>&nbsp;&nbsp;&nbsp; 下面是影响晋升和阻碍事业发展的十大因素： </p>
<p>&nbsp;&nbsp;&nbsp; 1. 不了解公司为什么雇佣你 <br>&nbsp;&nbsp;&nbsp; 各级管理人员之所以能够存在，只有一个原因：维持老板的形象。你要是不相信，可以问问你的上司。如果你是老板，那么，去问问你的股东们。 </p>
<p>&nbsp;&nbsp;&nbsp; 2. 不能迅速贯彻老板的意图 <br>&nbsp;&nbsp;&nbsp; 如果事情与你的上司有关时，犹豫不决会对你的事业产生影响。你若对上司的命令不能及时反应，他总会记住你，而且会影响你的声誉。 </p>
<p>&nbsp;&nbsp;&nbsp; 比如老板说：&#8220;史密斯干活不行，把他辞了。&#8221;你可能会见义勇为地为他辩解。但专横的老板并不认为这是一种美德，相反他会看作是反抗。假设你迟迟不执行上司的命令，也许不久以后被扫地出门的不仅仅是史密斯了。 </p>
<p>&nbsp;&nbsp;&nbsp; 3. 忽视彼得原则 <br>&nbsp;&nbsp;&nbsp; 彼得原则是说：在等级制度中，每个人都有可能被提升到他所不能胜任的位置。几乎人人都知道这条定律，但很少有人认为此定律对自己也适用。水平低下的经理则会很快达到这个极限。员工们经常习惯对一个晋升的机会进行争夺。但并不是每个晋升都符合你的利益。不符合你专长的晋升，只会加速你职业生涯中的彼得原则。我多次看到不少超级销售人员经历过类似情况。他们非常能干，于是公司觉得应该提拔他们担任销售经理。令我吃惊的是很多销售人员不管自己对管理别人多么没兴趣，都欣然接受了新的职务。到头来这种安排使每个人都受到了伤害。 </p>
<p>&nbsp;&nbsp;&nbsp; 4. 对企业文化的忽视 <br>&nbsp;&nbsp;&nbsp; &#8220;企业文化&#8221;一词已经被用滥了，不过这是公司内的实际生活。当大家都穿白衬衫时，很明显，你不会去穿高领毛衣。 </p>
<p>&nbsp;&nbsp;&nbsp; 如果大家习惯合作，你自然不会去出风头；如果大家每天都工作12小时，你也不会早9晚5的工作；如果你一定要与大家不一样，那么，就应该处处超过别人。 </p>
<p>&nbsp;&nbsp;&nbsp; 5. 希望得到所有人的好感 <br>&nbsp;&nbsp;&nbsp; 最好的主管当然受到别人的尊敬，也可能受到别人的爱戴。但如果你打算继续做出坚定而有正确的决策，就不能太关注人们对你的看法。决策应该根据实际情况来确定，而不是你的同情心和个人感情。千万不要为了得到大家的好感而使决策产生偏差。一个人不可能会使所有人满意。 </p>
<p>&nbsp;&nbsp;&nbsp; 6. 实施有效的自我保护 <br>&nbsp;&nbsp;&nbsp; 组织机构的最高领导人变化的目的是打算进一步改善这个组织结构，而不是与个人有什么恩怨。 </p>
<p>&nbsp;&nbsp;&nbsp; 许多经理人不相信这一点。他们总从个人的角度来看待这一变化。于是，他们对于到来的新领导抱有抵触情绪；这样以来新领导也会产生抵触情绪。结果谁失败呢？ </p>
<p>&nbsp;&nbsp;&nbsp; 7. 在公共场合随便说话 <br>&nbsp;&nbsp;&nbsp; 许多人之所以不成功，是因为过于轻信别人。如果你必须倾吐对某个同事或某个上级的看法，最好是留着回家去说。尖刻的话会很快传到你老板的耳朵里，结果倒霉的只能是你。 </p>
<p>&nbsp;&nbsp;&nbsp; 8. 行动自相矛盾反复无常 <br>&nbsp;&nbsp;&nbsp; 在绝大部分日常问题解决中，最需要的是扎实的、稳妥的判断，而不是创造性。 </p>
<p>&nbsp;&nbsp;&nbsp; 对你的上司和下属来讲，你的反复无常是最令人恼火的。今天对受到的挫折大发脾气，明天对同样的问题又从容对待，会让人觉得你这人不可靠。 </p>
<p>&nbsp;&nbsp;&nbsp; 9. 将错误推到别人身上 <br>&nbsp;&nbsp;&nbsp; 犯了错误要勇于承认，这没有什么不妥。出了错既不要埋怨别人，也不要迁怒于别人。当然，也不要养成不断犯错误，不断承认的坏习惯。 </p>
<p>&nbsp;&nbsp;&nbsp; 10. 让部下干你自己不愿干的事情 <br>&nbsp;&nbsp;&nbsp; 如果你不能身体力行，只让别人加班就不合适。同样，你不是时时注意指导你的部下，你就别指望他们按照你所要求的方式工作。（完）<br>&nbsp;<br>[Traceback]: <a href="http://psyche.netbig.com/p1/p12/1913/20010622/105200.htm">http://psyche.netbig.com/p1/p12/1913/20010622/105200.htm</a></p>
<img src ="http://www.blogjava.net/tanzek/aggbug/116953.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-05-12 11:48 <a href="http://www.blogjava.net/tanzek/archive/2007/05/12/116953.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>论防守与进攻</title><link>http://www.blogjava.net/tanzek/archive/2007/05/11/116628.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Thu, 10 May 2007 16:57:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/05/11/116628.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/116628.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/05/11/116628.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/116628.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/116628.html</trackback:ping><description><![CDATA[<p><span style="COLOR: #0000ff">防守</span>与<span style="COLOR: #0000ff">进攻</span>是一组完全相对的概念，突然间想把它们放在一起，缘因古早就有之&#8220;攻守兼备&#8221;。</p>
<p>&nbsp;&nbsp;&nbsp; 今天主要是想谈一下我对这个组合的看法。</p>
<p>&nbsp;&nbsp;&nbsp; 在我的观念里，我会崇尚于&#8220;<span style="COLOR: #0000ff">守中有攻</span>&#8221;。<br>&nbsp;&nbsp;&nbsp; 守势乃大势，为保全自己而做的一些措施；而攻乃出势，意为与别人进行交涉的措施。<br>&nbsp;&nbsp;&nbsp; 我所认为&#8220;守中有攻&#8221;是在防护好自己的前提下，然后再发出攻势，这样子发出的攻势才能思考周全，发而有力，因此才能即达到目的，也可以让自己不受伤害。而&#8220;<span style="COLOR: #0000ff">攻中有守</span>&#8221;则是在攻击中夹带防守，在这种方式中，我觉得进攻不能发全力，则总要思考着还要保护自己，以使自己免受伤害，然而往往是动一毛而牵全身，致使造成自己不想的结果，反而会让自己受到伤害。<br>&nbsp;&nbsp;&nbsp; 当然可能也会有人说&#8220;<span style="COLOR: #0000ff">全身攻击</span>&#8221;的，然而往往来讲，这是一种武夫的表现，能够有成功的机会，但绝不应该是一个思考者所为的。</p>
<p>&nbsp;&nbsp;&nbsp; 战术上还有两个东西是讲在时间上来战胜的：&#8220;<span style="COLOR: #0000ff">先发制人</span>&#8221;和&#8220;<span style="COLOR: #0000ff">后发制人</span>&#8221;。先发的优势在于时间上的先前，在敌人还没有准备好时，突然进行攻击，力挫敌人；后发的优势则也是在于时间上的落后，往往是在当敌人进行攻击时，稳住自己和思考敌人的进攻方式，攻击后，则不给敌人以喘息的机会，攻击必能取胜。这就是后发的优势，所以我还是喜欢后者，这更具有战术性。</p>
<p><br>&nbsp;&nbsp;&nbsp; 对于如今信息发达的IT时代来讲，我个人觉得这些战术对于企业都有很多用处的。在IT信息领域中，一个企业先发的优势已经失去了，在这个行业中有着大多的事业单位介入，都在啃这块喷香的大面包。然而由于一点点啃，也就会一点点少，而且还会带着更多的人来分。所以，对于一个企业，在考虑先发优势，思考产品的独特创新设计方面外，后发优势则是要多考的，对于也就是要更多地思考敌人以及周围的情况，能够在瞬息万变的信息时代中抓住机遇，迎接挑战。</p>
<p>&nbsp;&nbsp;&nbsp; 以上为个人的一点拙见，欢迎讨论哦！&nbsp; </p>
<br><span style="BACKGROUND-COLOR: #00ffff">[后补]:<br>&nbsp;&nbsp;&nbsp;&nbsp; 前几天刚看完&lt;&lt;期巴达勇士&gt;&gt;,发现期巴达人的战术可谓是一流啊,以小小的三百人众面对强大百万大军,嘿嘿.这里面就有与他们的战术有关的.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "...全力用盾牌去保护左边的同伴..."<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="COLOR: red">Hold之后的截杀....</span><br>&nbsp;&nbsp;&nbsp; 哈哈,佩服...<br></span>&nbsp;&nbsp;&nbsp;&nbsp; 
<img src ="http://www.blogjava.net/tanzek/aggbug/116628.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-05-11 00:57 <a href="http://www.blogjava.net/tanzek/archive/2007/05/11/116628.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>马上就要离开了!~</title><link>http://www.blogjava.net/tanzek/archive/2007/05/06/115638.html</link><dc:creator>tanzek</dc:creator><author>tanzek</author><pubDate>Sun, 06 May 2007 15:53:00 GMT</pubDate><guid>http://www.blogjava.net/tanzek/archive/2007/05/06/115638.html</guid><wfw:comment>http://www.blogjava.net/tanzek/comments/115638.html</wfw:comment><comments>http://www.blogjava.net/tanzek/archive/2007/05/06/115638.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tanzek/comments/commentRss/115638.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tanzek/services/trackbacks/115638.html</trackback:ping><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;历时三年勤工助学工作终于快有了结尾了，回想着这三年的经历，再仔细对比一下三年前后的自己，发现还真让自己吃了一惊。<br>&nbsp;&nbsp;&nbsp;三年前，一个仅带着太多幸运，带着许多热情的学生进入了大学之门，性格上胆小不敢做决定，带着太多美好的校园梦想。一次偶然的原因，参加了一次勤工助学的工作招聘会，再一次的幸运，让我进入了如今的这个我还在工作的部门。<br>&nbsp;&nbsp;&nbsp;这三年来，也不能算得清自己做了多少事情，付出了多少精力。唯一能够算得清的就是自己收获了多少东西，改变了多少。<br>&nbsp;&nbsp;&nbsp;很庆幸，能够有一个这样子的锻炼机会，让我不仅从技术员、技术组长，到现在的主任，一个完全的基层上升平台，虽然不能说获得了多少工作经验，成就了多大的自我，但是可以肯定的是：我真的已经和以前完全不同了，思考的角度和方式也都有了很大的改善。<br>&nbsp;&nbsp;&nbsp;如今，马上就要离开这里了，也说不上什么舍得不舍得，因为从一开始进来就知道自己必须哪一天离开的，而且也看了那么多次的学长、学姐、同事们的离开，也没有太多的在意了。<br>&nbsp;&nbsp;&nbsp;想想哦，应该还是有机会经常回来看看的，希望这里一切都好哦，更希望这一切能够在以后的工作人员手中有更大的发挥空间。嘿嘿。。。<br>&nbsp;&nbsp;&nbsp;好了，就留这么多吧！（唉，这说话还是不行哪！~嘿嘿！~）</p>
<img src ="http://www.blogjava.net/tanzek/aggbug/115638.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tanzek/" target="_blank">tanzek</a> 2007-05-06 23:53 <a href="http://www.blogjava.net/tanzek/archive/2007/05/06/115638.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>