﻿<?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/algz/</link><description>Purple Butterfly Flying
QQ群:7101519
Flex,Ext,Spring,Hibernate,EOS,SpringSecurity,Struts
http://algz.googlecode.com/svn/trunk/</description><language>zh-cn</language><lastBuildDate>Sat, 25 Apr 2026 18:59:44 GMT</lastBuildDate><pubDate>Sat, 25 Apr 2026 18:59:44 GMT</pubDate><ttl>60</ttl><item><title>Java发送http请求 (get 与 post方法请求)</title><link>http://www.blogjava.net/algz/articles/412732.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Mon, 21 Apr 2014 05:24:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/412732.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/412732.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/412732.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/412732.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/412732.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Java发送http请求 (get 与post方法请求)，以下代码经本人亲自调试可用！可以直接使用之。注意：通过BufferedReader 读取远程返回的数据时，必须设置读取编码，否则中文会乱码！packagecom.jiucool.www.struts.action;&nbsp;importjava.io.BufferedReader;importjava.io.DataOutputStrea...&nbsp;&nbsp;<a href='http://www.blogjava.net/algz/articles/412732.html'>阅读全文</a><img src ="http://www.blogjava.net/algz/aggbug/412732.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2014-04-21 13:24 <a href="http://www.blogjava.net/algz/articles/412732.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>反射生成笔记</title><link>http://www.blogjava.net/algz/articles/404420.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Wed, 25 Sep 2013 07:40:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/404420.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/404420.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/404420.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/404420.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/404420.html</trackback:ping><description><![CDATA[<div> <div><span style="font-size: 9pt; font-family: 'NSimSun'"> <div><span style="font-size: 9pt; color: #2b91af;"><span style="color: #008000">//*********创建实例***********</span></span></div> <div><span style="font-size: 9pt; color: #2b91af;">Type<span style="color: windowtext">&nbsp;t&nbsp;=&nbsp;<span style="color: #0000ff">typeof</span>(</span>ClassTest<span style="color: windowtext">);<span style="color: #008000">//表示类型声明：类类型、接口类型、数组类型、值类型、枚举类型、类型参数...。</span></span></span></div> <div><span style="font-size: 9pt; color: windowtext;"><span style="color: #0000ff">object</span>&nbsp;obj&nbsp;=&nbsp;<span style="color: #2b91af">Activator</span>.CreateInstance(t);<span style="color: #008000">//通过反射创建对象实例,如果是静态类则不须实例化</span></span></div> <div><span style="font-size: 9pt; color: windowtext;"><span style="color: #008000"> <div><span style="font-size: 9pt;">//obj&nbsp;=&nbsp;ass.CreateInstance("ReflectionTest.ClassTest");&nbsp;//类的全限定名.命名空间.类名</span></div></span></span></div> <div><span style="font-size: 9pt; color: windowtext;"><span style="color: #2b91af"><span style="font-size: 9pt;"><span style="color: #008000">//*********创建和调用方法***********</span></span></span></span></div> <div><span style="font-size: 9pt; color: windowtext;"><span style="color: #2b91af">MethodInfo</span>&nbsp;method&nbsp;=&nbsp;t.GetMethod(<span style="color: #a31515">"WriteString"</span>);&nbsp;<span style="color: #008000">//搜索具有指定名称的公共方法。</span></span></div> <div><span style="font-size: 9pt; color: windowtext;"><span style="color: #2b91af">String</span>&nbsp;s&nbsp;=&nbsp;(<span style="color: #2b91af">String</span>)method.Invoke(obj,&nbsp;<span style="color: #0000ff">new</span>&nbsp;<span style="color: #2b91af">Object</span>[]&nbsp;{&nbsp;<span style="color: #a31515">"123"</span>&nbsp;});<span style="color: #008000">//反射类的对象实例,方法参数&nbsp;</span></span></div> <div><span style="font-size: 9pt; color: windowtext;"><span style="color: #008000">//静态方法</span></span><span style="font-size: 9pt; color: windowtext;"><span style="color: #008000"><span style="font-size: 9pt; color: windowtext;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span></div> <div> <div> <div> <div><span style="font-size: 9pt;">method&nbsp;=&nbsp;type.GetMethod(<span style="color: #a31515">"StaticWriteString"<span style="color: windowtext">);</span></span></span></div> <div><span style="font-size: 9pt; color: windowtext;">method.Invoke(<span style="color: #0000ff">null</span>,&nbsp;<span style="color: #0000ff">new</span>&nbsp;<span style="color: #0000ff">string</span>[]&nbsp;{&nbsp;<span style="color: #a31515">"test"</span>&nbsp;});&nbsp;<span style="color: #008000">//如果是静态方法,第1个参数则忽略,设为null&nbsp;&nbsp;</span></span></div> <div><span style="font-size: 9pt; color: windowtext;"></span>&nbsp;</div> <div><span style="font-size: 9pt; color: windowtext;"><span style="color: #008000">//无参的静态方法</span></span></div> <div><span style="font-size: 9pt; color: windowtext;"><span style="color: #008000"> <div><span style="font-size: 9pt; color: windowtext;"> <div><span style="font-size: 9pt;">method&nbsp;=&nbsp;type.GetMethod(<span style="color: #a31515">"NoneParaWriteString"<span style="color: windowtext">);&nbsp;&nbsp;</span></span></span></div> <div><span style="font-size: 9pt; color: windowtext;">method.Invoke(<span style="color: #0000ff">null</span>,&nbsp;<span style="color: #0000ff">null</span>);<span style="color: #008000">//无参则第2个参数设为null.</span></span></div> <div>&nbsp;</div></span></div></span></span></div></div></div></div> <div><span style="font-size: 9pt; color: windowtext;">System.Diagnostics.<span style="color: #2b91af">Trace</span>.WriteLine(s);//输出到"调试--窗口--即时窗口"</span></div></span></div> <div>&nbsp;</div> <div><span style="font-size: 9pt; font-family: 'NSimSun'">C#反射学习时几点注意内容：</span></div> <div></div> <div><span style="font-size: 9pt; font-family: 'NSimSun'">1．指定类库文件必须使用绝对路径，不能使用相对路径（其实感觉有点不合理，不太方便）</span></div> <div></div> <div><span style="font-size: 9pt; font-family: 'NSimSun'">3．第5行如果反射的类使用的是静态方法,则第1个参数须调为null</span><span style="font-size: 9pt; font-family: 'NSimSun'">。</span></div> <div></div> <div><span style="font-size: 9pt; font-family: 'NSimSun'">4．由于这个方法有两个参数，可以用这种Object的方法指定参数也可以直接写method.Invoke(obj,&nbsp;<span style="color: #0000ff">new<span style="color: windowtext">&nbsp;Object[]&nbsp;{&nbsp;<span style="color: #a31515">"test"</span>,&nbsp;1&nbsp;});</span></span></span></div> <div></div> <div><span style="font-size: 9pt; font-family: 'NSimSun'; color: windowtext">5．调用的方法是一个静态方法，这时候Invoke的时候，对于第一个参数是无视的，也就是我们写什么都不会被调用，即使我们随便new了一个any这样的Object，当然这种写法是不推荐的。但是对应在例子1种我们如果Invoke的时候用了类型不一致的实例来做为参数的话，将会导致一个运行时的错误。</span></div> <div></div> <div><span style="font-size: 9pt; font-family: 'NSimSun'; color: windowtext">6．第三个例子是一个调用无参数静态方法的例子，这时候两个参数我们都不需要指定，用null就可以了。</span></div></div> <div> <div></div> <div><span style="font-size: 9pt; font-family: 'NSimSun'">再说一个问题，如果调用的类是静态类的时候，需要注意一个问题，肯定我们会想到一个问题，静态类是不能实例化的，这时候，31行的类的实例化的方法我们就不需要了，直接使用Invoke就可以实现，否则将会出现运行时的错误，同样的道理，第一个参数将会被无视，只要我们传对了参数就可以了。</span></div></div><img src ="http://www.blogjava.net/algz/aggbug/404420.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2013-09-25 15:40 <a href="http://www.blogjava.net/algz/articles/404420.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA语言___文件下载功能模板.</title><link>http://www.blogjava.net/algz/articles/396077.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Tue, 05 Mar 2013 06:11:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/396077.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/396077.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/396077.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/396077.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/396077.html</trackback:ping><description><![CDATA[<div>JS:</div><div>{</div><div><span style="white-space:pre">		</span>text : '下载导入模板',</div><div><span style="white-space:pre">		</span>iconCls : 'Import',</div><div><span style="white-space:pre">		</span>handler : function() {</div><div><span style="white-space:pre">			</span>window.location.href="../BuinessPlanDownloadServlet";</div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">	</span>}</div><div></div><div>java:</div><div>package com.sysware.customize.hd.investment.productionMaterialsManagement.buinessPlan;</div><div></div><div>import java.io.BufferedInputStream;</div><div>import java.io.BufferedOutputStream;</div><div>import java.io.File;</div><div>import java.io.FileInputStream;</div><div>import java.io.IOException;</div><div>import java.io.PrintWriter;</div><div>import javax.servlet.ServletException;</div><div>import javax.servlet.ServletOutputStream;</div><div>import javax.servlet.http.HttpServlet;</div><div>import javax.servlet.http.HttpServletRequest;</div><div>import javax.servlet.http.HttpServletResponse;</div><div></div><div>public class BuinessPlanDownServlet extends HttpServlet {</div><div></div><div><span style="white-space:pre">	</span>private static final long serialVersionUID = 1L;</div><div></div><div><span style="white-space:pre">	</span>protected void doGet(HttpServletRequest request,</div><div><span style="white-space:pre">			</span>HttpServletResponse response) throws ServletException, IOException {</div><div><span style="white-space:pre">		</span>this.doPost(request, response);</div><div><span style="white-space:pre">	</span>}</div><div></div><div><span style="white-space:pre">	</span>protected void doPost(HttpServletRequest request,</div><div><span style="white-space:pre">			</span>HttpServletResponse response) throws ServletException, IOException {</div><div></div><div><span style="white-space:pre">		</span>String filePath = request.getSession().getServletContext().getRealPath("")+ File.separator+ "template.files"+ File.separator+ "buinessPlanDown" + File.separator + "buinessPlanTempl.xls";</div><div><span style="white-space:pre">		</span>response.reset();</div><div><span style="white-space:pre">		</span>response.setCharacterEncoding("UTF-8");</div><div></div><div><span style="white-space:pre">		</span>File file = new File(filePath);</div><div><span style="white-space:pre">		</span>if (!file.exists()) {</div><div><span style="white-space:pre">			</span>PrintWriter out = response.getWriter();</div><div><span style="white-space:pre">			</span>out.print("{failure:true}");</div><div><span style="white-space:pre">			</span>return;</div><div><span style="white-space:pre">		</span>}</div><div></div><div><span style="white-space:pre">		</span>response.setContentType("application/x-msdownload");</div><div><span style="white-space:pre">		</span>response.setHeader("Content-Disposition", "attachment;filename="+ new String(file.getName().getBytes("gb2312"), "iso8859-1"));</div><div><span style="white-space:pre">		</span>ServletOutputStream out = response.getOutputStream();</div><div><span style="white-space:pre">		</span>BufferedInputStream bis = new BufferedInputStream(new FileInputStream(filePath));</div><div><span style="white-space:pre">		</span>BufferedOutputStream bos = new BufferedOutputStream(out);</div><div></div><div><span style="white-space:pre">		</span>byte[] buff = new byte[2048];</div><div><span style="white-space:pre">		</span>int bytesRead;</div><div><span style="white-space:pre">		</span>while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {</div><div><span style="white-space:pre">			</span>bos.write(buff, 0, bytesRead);</div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">		</span>if (bis != null) {</div><div><span style="white-space:pre">			</span>bis.close();</div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">		</span>if (bos != null) {</div><div><span style="white-space:pre">			</span>bos.flush();</div><div><span style="white-space:pre">			</span>bos.close();</div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">	</span>}</div><div>}</div><img src ="http://www.blogjava.net/algz/aggbug/396077.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2013-03-05 14:11 <a href="http://www.blogjava.net/algz/articles/396077.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]hibernate之生成的和默认的属性值(使用generated刷新实体)</title><link>http://www.blogjava.net/algz/articles/395824.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 28 Feb 2013 01:55:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/395824.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/395824.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/395824.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/395824.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/395824.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 生成的和默认的属性值&nbsp;如果类的一个特定属性有着数据库生成的值，通常在第一次插入实体行的时候。典型的数据库生成的值是创建的时间戳 , 还有其它默认值等. &nbsp; &nbsp; &nbsp;每当hibernate给定义了已生成或默认属性的实体执行SQL INSERT或UPDATE时，它在插入默认值或生成值之后立即执行SELECT。因为设置了generated=always，hibern...&nbsp;&nbsp;<a href='http://www.blogjava.net/algz/articles/395824.html'>阅读全文</a><img src ="http://www.blogjava.net/algz/aggbug/395824.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2013-02-28 09:55 <a href="http://www.blogjava.net/algz/articles/395824.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CENTOS 简介和镜像下载</title><link>http://www.blogjava.net/algz/articles/394336.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 17 Jan 2013 01:41:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/394336.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/394336.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/394336.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/394336.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/394336.html</trackback:ping><description><![CDATA[<h2 style='margin: 10px 0px; padding: 3px 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; line-height: 23px; text-indent: 25px; letter-spacing: normal; font-family: "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; font-size: 19px; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>一、CENTOS下载各国镜像地址</h2><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://www.centos.org/modules/tinycontent/index.php?id=32" target="_blank">http://www.centos.org/modules/tinycontent/index.php?id=32</a></p><h2 style='margin: 10px 0px; padding: 3px 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; line-height: 23px; text-indent: 25px; letter-spacing: normal; font-family: "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; font-size: 19px; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>二、中国大陆镜像部分</h2><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>China	CMCC Taian Branch（泰安移动）</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://mirrors.ta139.com/centos/" target="_blank">http://mirrors.ta139.com/centos/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>China	NetEase（163网易）</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://mirrors.163.com/centos/" target="_blank">http://mirrors.163.com/centos/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>China	Northeastern University, Shenyang Liaoni（东北大学）</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://mirror.neu.edu.cn/centos/" target="_blank">http://mirror.neu.edu.cn/centos/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>China	Sohu Inc, Beijing P.R. China（搜狐CentOS镜像）</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://mirrors.sohu.com/centos/" target="_blank">http://mirrors.sohu.com/centos/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>China	Star Studio of UESTC（电子科技大）</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://mirrors.stuhome.net/centos/" target="_blank">http://mirrors.stuhome.net/centos/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>China	University of Science and Tech of China（中科大）</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://centos.ustc.edu.cn/centos/" target="_blank">http://centos.ustc.edu.cn/centos/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>此外，还有香港、台湾CentOS镜像地址也很快，具体参见上文官方网页，搜索Hong Kong或Taiwan。</p><h2 style='margin: 10px 0px; padding: 3px 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; line-height: 23px; text-indent: 25px; letter-spacing: normal; font-family: "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; font-size: 19px; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>三、CentOS免费还是收费的？</h2><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>参照《<a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://hi.baidu.com/michael7768/blog/item/daefc825998da87234a80f84.html" target="_blank">CentOS 简单介绍，centos完全免费、redhat商业服务是要收钱的</a>》一文说法：</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>&#8220;CentOS 并不向用户提供商业支持，当然也不负上任何商业责任。&#8221;，所以：</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><strong style="margin: 0px; padding: 6px 0px; font-size: 14px;">CentOS各版本系统都是免费下载和使用的，但是要获得支持或者某些定制软件，也可能是需求，则要付费。</strong></p><h2 style='margin: 10px 0px; padding: 3px 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; line-height: 23px; text-indent: 25px; letter-spacing: normal; font-family: "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; font-size: 19px; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>四、CentOS LiveCD、LiveDVD和BinDVD区别在哪里？</h2><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>BinDVD版&#8212;&#8212;就是普通安装版，需安装到计算机硬盘才能用，bin一般都比较大，而且包含大量的常用软件，安装时无需再在线下载（大部分情况）。</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>LiveDVD版&#8212;&#8212;就是一个光盘CentOS系统，可通过光盘启动电脑，启动出CentOS系统，也有图形界面，也有终端。也可以安装到计算机，但是有些内容可能还需要再次到网站下载（自动）。</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>LiveCD版&#8212;&#8212;相比LiveDVD是个精简的光盘CentOS系统。体积更小，便于维护使用。</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>此外，还有个更Mini的CentOS系统版本，上文中的CentOS-6.0-i386-minimal.iso就是，再下面的是网络安装版，你懂的，肯定难用。</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><strong style="margin: 0px; padding: 6px 0px; font-size: 14px;">名词：</strong></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>SRPMS&#8212;&#8212;Source RPM</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>RPM&#8212;&#8212;Red Hat Package Manager</p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'><strong style="margin: 0px; padding: 6px 0px; font-size: 14px;">更多参考：</strong></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>官方主页:<span class="Apple-converted-space">&nbsp;</span><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://www.centos.org/" target="_blank">http://www.centos.org/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>邮件列表:<span class="Apple-converted-space">&nbsp;</span><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://www.centos.org/modules/tinycontent/index.php?id=16" target="_blank">http://www.centos.org/modules/tinycontent/index.php?id=16</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>论坛:<span class="Apple-converted-space">&nbsp;</span><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://www.centos.org/modules/newbb/" target="_blank">http://www.centos.org/modules/newbb/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>文档:<span class="Apple-converted-space">&nbsp;</span><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://www.centos.org/docs/" target="_blank">http://www.centos.org/docs/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>Wiki:<span class="Apple-converted-space">&nbsp;</span><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://wiki.centos.org/" target="_blank">http://wiki.centos.org/</a></p><p style='font: 13px/23px "Microsoft YaHei", Verdana, Tahoma, Arial, SimSun; margin: 0px 0px 6px; padding: 0px; text-align: left; color: rgb(43, 43, 43); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>镜像列表:<span class="Apple-converted-space">&nbsp;</span><a style="color: rgb(16, 92, 182); text-decoration: underline;" href="http://www.centos.org/modules/tinycontent/index.php?id=32" target="_blank">http://www.centos.org/modules/tinycontent/index.php?id=32</a></p><br /><br /><font face="Tahoma"><strong><font color="#c0c0c0" size="2">-------------------------------------------------------------------------------------------------------------<br style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' /><br style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' /></font></strong><span style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>CentOS（Community ENTerprise Operating System）是Linux发行版之一，它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码，因此有些要求高度稳定性的</span></font><a style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(51, 102, 153); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: underline; word-spacing: 0px; border-bottom-color: blue; border-bottom-width: 1px; border-bottom-style: solid; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' class="relatedlink" href="http://www.ideasr.com/forum-97-1.html" target="_blank">服务器</a><span style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同，在于CentOS并不包含封闭源代码软件。</span><br style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' /><br style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' /><font style='color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Tahoma, "Microsoft Yahei", Simsun; font-style: normal; font-variant: normal; font-weight: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' size="4"><strong style="font-weight: 700; word-wrap: break-word;">概述<br style="word-wrap: break-word;" /></strong></font><span style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>　　CentOS，我们有很多人叫它社区企业操作系统，不管你怎么叫它，它都是linux的一个发行版本。CentOS是企业Linux发行版领头羊Red Hat Enterprise Linux（以下称之为RHEL）的再编译版本，RHEL是很多企业采用的linux发行版本，需要向RedHat付费才可以使用，并能得到付过费用的服务和技术支持和版本升级。这个CentOS可以像REHL一样的构筑linux系统环境，但不需要向RedHat付任何的费用，同样也得不到任何有偿技术支持和升级服务。典型的CentOS用户包括这样一些组织和个人，他们并不需要专门的商业支持就能开展成功的业务。CentOS面向那些需要企业级操作系统稳定性，但并不想负担认证和支持方面开销的人。 　　&nbsp;&nbsp;</span><br style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' /><span style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>CentOS计划是在2003年红帽决定不再提供免费的技术支持及产品认证之后的部份"红帽重建者"（Red Hat rebuilders）之一。 　　CentOS和科学Linux （Scientific Linux）、甲骨文Linux（Oracle Linux）、费米Linux（Fermi Linux）等都以红帽所发布的源代码去除商标重建Red Hat Enterprise Linux的翻版，并修正了已经发现了的redhat的bug。 　　CentOS是"Caos Linux"独立计划的一个分枝，在Lawrence Berkeley 国家实验室担任管理员与程序设计师的Kurtzer 表示。但后来Caos基金会最受欢迎的计划变成是RHEL的重建。</span><br style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' /><br style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' /><font style='color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Tahoma, "Microsoft Yahei", Simsun; font-style: normal; font-variant: normal; font-weight: normal; word-spacing: 0px; white-space: normal; word-wrap: break-word; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;' size="4"><strong style="font-weight: 700; word-wrap: break-word;">历史<br style="word-wrap: break-word;" /></strong></font><span style='font: 14px/21px Tahoma, "Microsoft Yahei", Simsun; color: rgb(68, 68, 68); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;'>　　Red Hat公司的产品中，有RedHat Linux（如Redhat8,9）和针对企业发行的版本Red Hat Enterprise Linux，都能够通过网络FTP免费的获得并使用，但是在2003年的时候，redhat com发布redhat 9(简写为rh9)后，不再开发redhat 10，11&#8230;&#8230;，全面转向redhat enterprise linux(简写为rhel)的开发，和以往不同的是，新的rhel 3要求用户先购买lisence，redhat com承诺保证产品的稳定性，安全性。rhel 3二进制代码不再提供下载，而是作为redhat 服务的一部分，但源代码依然是open。它的项目由Fedora Project这个项目所取代，并以Fedora Core这个名字发行并提供普通用户免费使用（自Fedora 7开始去掉"Core"）。Fedora Core这个Linux发行版更新很快，大约半年左右就有新的版本出来，目前的版本是Fedora 15，这个Fedora试验的韵味比较浓厚，每次发行都有新的功能被加入到其中，得到的成功结果将被采用到RHEL的发布中。虽说这样，频繁的被改进更新的不安定产品对于企业来说并不是最好的选择，大多数企业还是会选择有偿的RHEL产品。 　　在构成RHEL的大多数软件包中，都是基于GPL协议发布的，也就是我们常说的开源软件，正因为是这样，Red Hat公司也遵循这个协议，将构成RHEL的软件包公开发布，只要是遵循GPL协议，任何人都可以在原有的软件构成的基础上再开发和发布。CentOS就是这样在RHEL发布的基础上将RHEL的构成克隆再现的一个Linux发行版本。RHEL的克隆版本不只CentOS一个，还有Oracle Linux，Scientific Linux，Fermi Linux等。。但并不保障对应RHEL的软件在CentOS上面能也够100%的正常工作。并且安全漏洞的修正和软件包的升级对应RHEL的有偿服务和技术支持来说，数日数星期数个月的延迟情况也有。</span><img src ="http://www.blogjava.net/algz/aggbug/394336.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2013-01-17 09:41 <a href="http://www.blogjava.net/algz/articles/394336.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JS 创建类---混合的构造函数/原型方式</title><link>http://www.blogjava.net/algz/articles/384711.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Fri, 03 Aug 2012 08:50:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/384711.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/384711.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/384711.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/384711.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/384711.html</trackback:ping><description><![CDATA[<div>JS 创建类---混合的构造函数/原型方式</div><div>prototype:原型.此对象的所有实例共享原型定义的数据和(对象)引用.一般用于防止重复创建函数,浪费内存.</div><div>原型中定义的所有函数和引用的对象都只创建一次;构造函数中的方法则会随着实例的创建重复创建(如果有对象或方法的话).</div><div>不管在原型中还是构造函数中,属性(值)都不共享.</div><div></div><div>创建类的最好方式是用构造函数定义属性，用原型定义方法。</div><div>这种方式同样适用于继承机制，用对象冒充继承构造函数的属性，用原型链继承 prototype 对象的方法。</div><div></div><div></div><div>//构造函数</div><div>function Car(sColor,iDoors,iMpg) {</div><div>&nbsp; this.color = sColor; //定义属性</div><div>&nbsp; this.doors = iDoors; //定义属性</div><div>&nbsp; this.mpg = iMpg; &nbsp; &nbsp; //定义属性</div><div>&nbsp; this.drivers = new Array("Mike","John");//定义数组对象.每个实例创建一个单独的对象</div><div>}</div><div>//公共方法(共享),属性不共享.</div><div>Car.prototype={</div><div>&nbsp; value:1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//属性不共享</div><div>&nbsp; objs:new Array("A","B"), &nbsp; &nbsp; &nbsp; &nbsp;//对象共享引用</div><div>&nbsp; showColor : function() { &nbsp; &nbsp; &nbsp; &nbsp;//方法共享引用.</div><div>&nbsp; &nbsp; alert(this.color);</div><div>&nbsp; }</div><div>};</div><div></div><div>var oCar1 = new Car("red",4,23);</div><div>var oCar2 = new Car("blue",3,25);</div><div>oCar1.drivers.push("Bill"); &nbsp; &nbsp; &nbsp; <span style="color: #99cc00; ">//构造方法中的对象都是各个独立的.</span></div><div>oCar1.value=2; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //属性不共享.</div><div>oCar1.objs.push('C'); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #99cc00; ">//原型中的对象都是共享引用的.</span></div><div>document.write(oCar1.drivers + "&lt;br/&gt;" );</div><div>&nbsp; //Mike1,John,Bill</div><div>oCar1.showColor(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //red</div><div>document.write(oCar2.objs + "&lt;br/&gt;" );</div><div>&nbsp; &nbsp; &nbsp;//A,B &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oCar1:A,B,C</div><div>document.write( "&lt;br/&gt;" +oCar2.value); &nbsp; &nbsp; //1</div><div>document.write( "&lt;br/&gt;" +oCar2.drivers); &nbsp; //Mike1,John</div><div></div><img src ="http://www.blogjava.net/algz/aggbug/384711.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-08-03 16:50 <a href="http://www.blogjava.net/algz/articles/384711.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MyEclipse 布署相同分支的项目时，报错 Exploded location overlaps an existing deployment解决办法.</title><link>http://www.blogjava.net/algz/articles/380860.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Fri, 15 Jun 2012 06:29:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/380860.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/380860.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/380860.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/380860.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/380860.html</trackback:ping><description><![CDATA[<span style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">右键项目-&gt;properties-&gt;MyEclipse-&gt;Web-&gt;Web Context-root的名字为重命名之后的名字即可。</span><img src ="http://www.blogjava.net/algz/aggbug/380860.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-06-15 14:29 <a href="http://www.blogjava.net/algz/articles/380860.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Django1.4 报错：Error: No module named mysite 解决方法</title><link>http://www.blogjava.net/algz/articles/380007.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Tue, 05 Jun 2012 03:30:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/380007.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/380007.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/380007.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/380007.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/380007.html</trackback:ping><description><![CDATA[<p style="color: #333333; margin: 8px 0px 0px; padding: 0px; word-break: break-all; line-height: 26px; font-family: Simsun; text-align: left; background-color: #ffffff; ">开发环境：Python2.7+Django1.4+PyCharm<br />使用 PyCharm 开发&nbsp;Django 时，在settings.py的INSTALLED_APPS中只需要添加app名就可以了，即:'mysite',<br />如果输入"django_example.mysite",则报错：</p><p style="color: #333333; margin: 8px 0px 0px; padding: 0px; word-break: break-all; line-height: 26px; font-family: Simsun; text-align: left; background-color: #ffffff; ">Error: No module named mysite</p><p style="color: #333333; margin: 8px 0px 0px; padding: 0px; word-break: break-all; line-height: 26px; font-family: Simsun; text-align: left; background-color: #ffffff; "><br /></p><img src ="http://www.blogjava.net/algz/aggbug/380007.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-06-05 11:30 <a href="http://www.blogjava.net/algz/articles/380007.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]UML类图符号  各种关系说明以及举例</title><link>http://www.blogjava.net/algz/articles/378313.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Wed, 16 May 2012 07:49:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/378313.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/378313.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/378313.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/378313.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/378313.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">UML中描述对象和类之间相互关系的方式包括：依赖（Dependency），关联（Association），聚合（Aggregation），组合（Composition），泛化（Generalization），实现（Realization）等。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">依赖 （Dependency）：元素A的变化会影响元素B，但反之不成立，那么B和A的关系是依赖关系，B依赖A；类属关系和实现关系在语义上讲也是依赖关 系，但由于其有更特殊的用途，所以被单独描述。uml中用带箭头的虚线表示Dependency关系，箭头指向被依赖元素。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">泛化（Generalization）：通常所说的继承（特殊个体 is kind of 一般个体）关系，不必多解释了。uml中用带空心箭头的实线线表示Generalization关系，箭头指向一般个体。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">实现（Realize）：元素A定义一个约定，元素B实现这个约定，则B和A的关系是Realize，B realize A。这个关系最常用于接口。uml中用空心空心箭头和虚线表示Realize关系，箭头指向定义约定的元素。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">关联（Association）：元素间的结构化关系，是一种弱关系，被关联的元素间通常可以被独立的考虑。uml中用实线表示Association关系，箭头指向被依赖元素。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">聚合（Aggregation）：关联关系的一种特例，表示部分和整体（整体 has a 部分）的关系。uml中用带空心菱形头的实线表示Aggregation关系，菱形头指向整体。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">组 合（Composition）：组合是聚合关系的变种，表示元素间更强的组合关系。如果是组合关系，如果整体被破坏则个体一定会被破坏，而聚合的个体则可 能是被多个整体所共享的，不一定会随着某个整体的破坏而被破坏。uml中用带实心菱形头的实线表示Composition关系，菱形头指向整体。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">其中依赖（Dependency）的关系最弱，而关联（Association），聚合（Aggregation），组合（Composition）表示的关系依次增强。换言之关联，聚合，组合都是依赖关系的一种，聚合是表明对象之间的整体与部分关系的关联，而组合是表明整体与部分之间有相同生命周期关系的聚合。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">而关联与依赖的关系用一句话概括下来就是，依赖描述了对象之间的调用关系，而关联描述了对象之间的结构关系。</p><p align="left" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">后面的例子将针对某个具体目的来独立地展示各种关系。虽然语法无误，但这些例子可进一步精炼，在它们的有效范围内包括更多的语义。<br /><br /></p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">依赖（Dependency）<br /></p><p align="left" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">实体之间一个&#8220;使用&#8221;关系暗示一个实体的规范发生变化后，可能影响依赖于它的其他实例（<strong>图D</strong>）。 更具体地说，它可转换为对不在实例作用域内的一个类或对象的任何类型的引用。其中包括一个局部变量，对通过方法调用而获得的一个对象的引用（如下例所 示），或者对一个类的静态方法的引用（同时不存在那个类的一个实例）。也可利用&#8220;依赖&#8221;来表示包和包之间的关系。由于包中含有类，所以你可根据那些包中的 各个类之间的关系，表示出包和包的关系。</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">图D</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><img height="153" alt="" src="http://www.uml.org.cn/oobject/images/image004.gif" width="543" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; " /></p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br />关联（Association）<br /></p><p align="left" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">实体之间的一个结构化关系表明对象是相互连接的。箭头是可选的，它用于指定导航能力。如果没有箭头，暗示是一种双向的导航能力。在Java中，关联（<strong>图E</strong>） 转换为一个实例作用域的变量，就像图E的&#8220;Java&#8221;区域所展示的代码那样。可为一个关联附加其他修饰符。多重性（Multiplicity）修饰符暗示 着实例之间的关系。在示范代码中，Employee可以有0个或更多的TimeCard对象。但是，每个TimeCard只从属于单独一个 Employee。</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">图E</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><img height="153" alt="" src="http://www.uml.org.cn/oobject/images/image005.gif" width="543" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; " /></p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">聚合（Aggregation）<br /></p><p align="left" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">聚合（<strong>图F</strong>）是关联的一种形式，代表两个类之间的整体/局部关系。聚合暗示着整体在概念上处于比局部更高的一个级别，而关联暗示两个类在概念上位于相同的级别。聚合也转换成Java中的一个实例作用域变量。<br /><br />关联和聚合的区别纯粹是概念上的，而且严格反映在语义上。聚合还暗示着实例图中不存在回路。换言之，只能是一种单向关系。</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">图F</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><img height="153" alt="" src="http://www.uml.org.cn/oobject/images/image006.gif" width="543" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; " /></p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br /><br />合成（Composition）<br /></p><p align="left" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">合成 （<strong>图G</strong>） 是聚合的一种特殊形式，暗示&#8220;局部&#8221;在&#8220;整体&#8221;内部的生存期职责。合成也是非共享的。所以，虽然局部不一定要随整体的销毁而被销毁，但整体要么负责保持局 部的存活状态，要么负责将其销毁。局部不可与其他整体共享。但是，整体可将所有权转交给另一个对象，后者随即将承担生存期职责。</p><p align="left" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">Employee和TimeCard的关系或许更适合表示成&#8220;合成&#8221;，而不是表示成&#8220;关联&#8221;。</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">图G</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><img height="153" alt="" src="http://www.uml.org.cn/oobject/images/image007.gif" width="543" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; " /></p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">泛化（Generalization）<br /></p><p align="left" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">泛化（<strong>图H</strong>）表示一个更泛化的元素和一个更具体的元素之间的关系。泛化是用于对继承进行建模的UML元素。在Java中，用<em>extends</em>关键字来直接表示这种关系。</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">图H</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><img height="153" alt="" src="http://www.uml.org.cn/oobject/images/image008.gif" width="543" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; " /></p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "><br />实现（Realization）<br /></p><p align="left" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">实例（<strong>图I</strong>）关系指定两个实体之间的一个合同。换言之，一个实体定义一个合同，而另一个实体保证履行该合同。对Java应用程序进行建模时，实现关系可直接用<em>implements</em>关键字来表示。</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">图I</p><p align="center" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><img height="153" alt="" src="http://www.uml.org.cn/oobject/images/image009.gif" width="543" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; " /><br /><br /><br />转自:<a href="http://blog.csdn.net/kingofbirdzjy/article/details/1967871">http://blog.csdn.net/kingofbirdzjy/article/details/1967871</a>&nbsp;<br /><br /></p><img src ="http://www.blogjava.net/algz/aggbug/378313.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-05-16 15:49 <a href="http://www.blogjava.net/algz/articles/378313.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>主机为202.130.82.97子网屏蔽码为255.255.192.0，它所处的网络为什么</title><link>http://www.blogjava.net/algz/articles/378170.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Tue, 15 May 2012 03:42:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/378170.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/378170.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/378170.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/378170.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/378170.html</trackback:ping><description><![CDATA[<pre mb10"="" id="content-525389197" style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial; white-space: pre-wrap; word-wrap: break-word; zoom: 1; line-height: 24px; background-color: #ffffff; "> (1)先了解基础运算 <pre mb10"="" id="content-525389197" style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial; white-space: pre-wrap; word-wrap: break-word; zoom: 1; ">异或运算：相同为0，不同为1 与运算：两者为1时为1，有0为0 或运算：有1为1 <br /> <br />(2)IP网段的计算和划分    <br /> IP和子网掩码   我们都知道，IP是由四段数字组成，在此，我们先来了解一下3类常用的IP  <br /> A类IP段  0.0.0.0 到127.255.255.255   <br /> B类IP段  128.0.0.0 到191.255.255.255   <br /> C类IP段  192.0.0.0 到223.255.255.255    <br /><br /> XP默认分配的子网掩码每段只有255或0   <br />A类的默认子网掩码 255.0.0.0     一个子网最多可以容纳1677万多台电脑   <br />B类的默认子网掩码 255.255.0.0    一个子网最多可以容纳6万台电脑  <br />C类的默认子网掩码 255.255.255.0   一个子网最多可以容纳254台电脑   <br />       我以前认为，要想把一些电脑搞在同一网段，只要IP的前三段一样就可以了，今天，我才知道我错了。如果照我这说的话，一个子网就只能容纳254台电脑？真是有点笑话。我们来说详细看看吧。    <br /><br />       要想在同一网段，只要网络标识相同就可以了，那要怎么看网络标识呢？首先要做的是把每段的IP转换为二进制。（有人说，我不会转换耶，没关系，我们用Windows自带计算器就行。打开计算器，点查看&gt;科学型，输入十进制的数字，再点一下&#8220;二进制&#8221;这个单选点，就可以切换至二进制了。）   <br />        把子网掩码切换至二进制，我们会发现，所有的子网掩码是由一串连续的1和一串连续的0组成的（一共4段，每段8位，一共32位数）。  <br /> 255.0.0.0   11111111.00000000.00000000.00000000   <br /> 255.255.0.0  11111111.11111111.00000000.00000000  <br /> 255.255.255.0 11111111.11111111.11111111.00000000   <br />        这是A/B/C三类默认子网掩码的二进制形式，其实，还有好多种子网掩码，只要是一串连续的1和一串连续的0就可以了（每段都是8位）。如11111111.11111111.11111000.00000000，这也是一段合法的子网掩码。子网掩码决定的是一个子网的计算机数目，计算机公式是2的m次方，其中，我们可以把m看到是后面的多少颗0。如255.255.255.0转换成二进制，那就是11111111.11111111.11111111.00000000，后面有8颗0，那m就是8，255.255.255.0这个子网掩码可以容纳2的8次方（台）电脑，也就是256台，但是有两个IP是不能用的，那就是最后一段不能为0和255，减去这两台，就是254台。我们再来做一个。   <br />         255.255.248.0这个子网掩码可以最多容纳多少台电脑？   计算方法：   把将其转换为二进制的四段数字（每段要是8位，如果是0，可以写成8个0，也就是00000000）   11111111.1111111.11111000.00000000   然后，数数后面有几颗0，一共是有11颗，那就是2的11次方，等于2048，这个子网掩码最多可以容纳2048台电脑。  <br /> 一个子网最多可以容纳多少台电脑你会算了吧，下面我们来个逆向算法的题。   一个公司有530台电脑，组成一个对等局域网，子网掩码设多少最合适？   首先，无疑，530台电脑用B类IP最合适（A类不用说了，太多，C类又不够，肯定是B类），但是B类默认的子网掩码是255.255.0.0，可以容纳6万台电脑，显然不太合适，那子网掩码设多少合适呢？我们先来列个公式。   2的m次方＝560   首先，我们确定2一定是大于8次方的，因为我们知道2的8次方是256，也就是C类IP的最大容纳电脑的数目，我们从9次方一个一个试2的9次方是512，不到560，2的10次方是1024，看来2的10次方最合适了。子网掩码一共由32位组成，已确定后面10位是0了，那前面的22位就是1，最合适的子网掩码就是：11111111.11111111.11111100.00000000，转换成10进制，那就是255.255.252.0。    分配和计算子网掩码你会了吧，下面，我们来看看IP地址的网段。   相信好多人都和偶一样，认为IP只要前三段相同，就是在同一网段了，其实，不是这样的，同样，我样把IP的每一段转换为一个二进制数，这里就拿IP：192.168.0.1，子网掩码：255.255.255.0做实验吧。   192.168.0.1   11000000.10101000.00000000.00000001   （这里说明一下，和子网掩码一样，每段8位，不足8位的，前面加0补齐。）   IP    11000000.10101000.00000000.00000001   子网掩码  11111111.11111111.11111111.00000000   在这里，向大家说一下到底怎么样才算同一网段。   要想在同一网段，必需做到网络标识相同，那网络标识怎么算呢？各类IP的网络标识算法都   是不一样的。A类的，只算第一段。B类，只算第一、二段。C类，算第一、二、三段。   算法只要把IP和子网掩码的每位数AND就可以了。  <br /> AND方法：0和1＝0 0和0＝0 1和1＝1   如：And 192.168.0.1，255.255.255.0，先转换为二进制，然后AND每一位   IP      11000000.10101000.00000000.00000001   子网掩码    11111111.11111111.11111111.00000000   得出AND结果  11000000.10101000.00000000.00000000   转换为十进制192.168.0.0，这就是网络标识，   再将子网掩码反取，也就是00000000.00000000.00000000.11111111，与IP AND   得出结果00000000.00000000.00000000.00000001，转换为10进制，即0.0.0.1，   这0.0.0.1就是主机标识。要想在同一网段，必需做到网络标识一样。    我们再来看看这个改为默认子网掩码的B类IP   如IP：188.188.0.111，188.188.5.222，子网掩码都设为255.255.254.0，在同一网段吗？   先将这些转换成二进制   188.188.0.111 10111100.10111100.00000000.01101111   188.188.5.222 10111100.10111100.00000101.11011010   255.255.254.0 11111111.11111111.11111110.00000000   分别AND，得   10111100.10111100.00000000.00000000   10111100.10111100.00000100.00000000   网络标识不一样，即不在同一网段。   判断是不是在同一网段，你会了吧，下面，我们来点实际的。   一个公司有530台电脑，组成一个对等局域网，子网掩码和IP设多少最合适？   子网掩码不说了，前面算出结果来了11111111.11111111.11111100.00000000，也就是255.255.252.0   我们现在要确定的是IP如何分配，首先，选一个B类IP段，这里就选188.188.x.x吧   这样，IP的前两段确定的，关键是要确定第三段，只要网络标识相同就可以了。我们先来确定网络号。（我们把子网掩码中的1和IP中的?对就起来，0和*对应起来，如下：）   <br />255.255.252.0 11111111.11111111.11111100.00000000   <br />188.188.x.x  10111100.10111100.??????**.********   <br />网络标识   10111100.10111100.??????00.00000000   由此可知，?处随便填（只能用0和1填，不一定全是0和1），我们就用全填0吧，*处随便，这样呢，我们的IP就是   10111100.10111100.000000**.********，一共有530台电脑，IP的最后一段1～254可以分给254台计算机，530/254＝2.086，采用进1法，得整数3，这样，我们确定了IP的第三段要分成三个不同的数字，也就是说，把000000**中的**填三次数字，只能填1和0，而且每次的数字都不一样，至于填什么，就随我们便了，如00000001，00000010，00000011，转换成二进制，分别是1，2，3，这样，第三段也确定了，这样，就可以把IP分成188.188.1.y，188.188.2.y，188.188.3.y，y处随便填，只要在1～254范围之内，并且这530台电脑每台和每台的IP不一样，就可以了。 </pre> </pre><img src ="http://www.blogjava.net/algz/aggbug/378170.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-05-15 11:42 <a href="http://www.blogjava.net/algz/articles/378170.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Extjs.tree.treePanel 自动查找node</title><link>http://www.blogjava.net/algz/articles/376965.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Sat, 28 Apr 2012 06:36:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/376965.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/376965.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/376965.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/376965.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/376965.html</trackback:ping><description><![CDATA[<div><span style="white-space:pre">var node_id=</span>
Ext.getCmp('partId').getValue()&nbsp;<br /><span style="white-space:pre">(1)快速定位,根据node.id<br /></span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">注：&nbsp;</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">EXT 树的节点如果不展开,数据是获取不到的(&nbsp;</span>getNodeById() 报异常)<span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">，即使你load了数据不展开节点前，一样获取不到。</span><br />&nbsp; &nbsp; var node=treepanel.getNodeById(node_id);</div><div>&nbsp; &nbsp; //<span style="white-space: pre;">&nbsp;</span>treepanel.expandPath(node.getPath())</div><div>&nbsp; &nbsp; treepanel.getSelectionModel().select(node)</div><div>&nbsp; &nbsp; node.fireEvent('click',node)</div><div><span style="white-space:pre">							</span></div><div><span style="white-space:pre">(2)递归查找,一层一层级联查找<br />注:  虽然能解决(1)中取不到数据的问题,但访问速度慢,而且级联查找时会层层扩展开.<br /></span><span style="white-space: pre;">&nbsp;   treepanel</span>.getRootNode().cascade(function(n) {</div><div><span style="white-space:pre">			</span>if (!n.isLeaf() &amp;&amp; !n.isLoaded()) {</div><div><span style="white-space:pre">				</span>n.reload();</div><div><span style="white-space:pre">				</span>return true;</div><div><span style="white-space:pre">			</span>}</div><div><span style="white-space:pre">			</span>if (n.attributes['id'] == Ext.getCmp('partId').getValue()) {</div><div><span style="white-space:pre">				</span>node = n;</div><div><span style="white-space:pre">				</span>treepanel.getSelectionModel().select(node)</div><div><span style="white-space:pre">				</span>node.fireEvent('click', node)</div><div><span style="white-space:pre">				</span>return false;</div><div><span style="white-space:pre">			</span>}</div><div><span style="white-space:pre">			</span>return true;</div><div><span style="white-space: pre;">&nbsp;   </span>});</div><img src ="http://www.blogjava.net/algz/aggbug/376965.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-04-28 14:36 <a href="http://www.blogjava.net/algz/articles/376965.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Myeclipse7.0和Myeclipse8.5 安装插件(采用link方式)</title><link>http://www.blogjava.net/algz/articles/372071.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Fri, 16 Mar 2012 13:03:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/372071.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/372071.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/372071.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/372071.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/372071.html</trackback:ping><description><![CDATA[一.Myeclipse7.0<br />1.下载所需的插件包<br />2.link方式添加插件<br />例:<br />在D:\Program Files\MyEclipse 6.6\eclipse\links日录下,新建XXX.link文件.<br />内容为: path = D:/Program Files/MyEclipse 6.6/myeclipse_plugins(自定义文件夹)/STP(插件名)<br />注:必须设置路径为:<span style="color: #99cc00; ">\\</span>或<span style="color: #99cc00; ">/</span>.<br /><br /><br />Myeclipse 安装所有插件有两种方式，一种可以直接放到 安装路径下\eclipse\plugins中。但这种安装方式在重装 Myeclipse时插件还得重新装。&nbsp;&nbsp;<br />另外一种是利用link文件链接安装：&nbsp;&nbsp;<br />1.将插件包解压，放到 放到某路径下 \eclipse\plugins 文件夹中（如果解压之后含有plugins文件夹则直接放到eclipse文件夹下，总之要保证含有\eclipse\plugins 形式的路径）。由于这某路径是用来存放所有插件的，所以推荐规范一些，比如我的D:\plugin\axis_plugin\eclipse\plugins（plugin表示这是插件文件夹，axis_plugin表示这是axis插件。axis那两个插件就放在\eclipse\plugins下。），如果有其他插件可在D:\plugin下依照规则建立其他文件夹。&nbsp;&nbsp;<br />2.在MyEclipse 安装路径下的\eclipse\links文件夹文件夹中（如我的在D:\Program Files\MyEclipse 6.5\eclipse\links），建立 XXX.link文件，如Axis2_plugin.link。用记事本打开在里面编辑第一步的 &#8220;某路径&#8221;，在\eclipse之前，路径中要用&#8220;\\&#8221;（原因是\要进行符号转换，和程序中遇到的一样），如我的路径配置 path=D:\\plugin\\axis_plugin （这样程序就会自己找该路径下 \eclipse\plugins 中的插件）。&nbsp;&nbsp;<br />3删除 MyEclipse 路径下\eclipse\configuration中的org.eclipse.update文件夹。&nbsp;&nbsp;<br />4启动MyEclipse 选择&#8220;File-&gt;New-&gt;Other&#8221;可以看到如下界面&nbsp;&nbsp;<br />&nbsp;<br />表示插件添加成功。其他插件也可用类似的方法找到图标，比如svn插件可以在 工具栏window-&gt;show view -&gt;other中找到图标。&nbsp;&nbsp;<br />祝你成功<br /><br />二.Myeclipse8.5<br /><span style="color: #595959; font-family: Arial; font-size: 12px; letter-spacing: 1px; line-height: 20px; background-color: #ffffff; ">在MyEclipse的dropins目录下新建一个svn.link(ps:这里什么文件名和后缀名都没关系),</span><br /><p style="line-height: 20px; color: #595959; font-family: Arial; font-size: 12px; letter-spacing: 1px; background-color: #ffffff; ">里面内容是path=插件的路径，其他类似Myeclipse7.5</p><img src ="http://www.blogjava.net/algz/aggbug/372071.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-03-16 21:03 <a href="http://www.blogjava.net/algz/articles/372071.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript中的空串，false,和0 比较运算关系</title><link>http://www.blogjava.net/algz/articles/371885.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Wed, 14 Mar 2012 13:30:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/371885.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/371885.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/371885.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/371885.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/371885.html</trackback:ping><description><![CDATA[<div>javascript中的 空串，false,和0</div><div>包含了一个运算的规则：相等运算符判断时，</div><div>其中一个是true，先转换成1(false则转换为0)再做比较。&nbsp;</div><div></div><div>"" == false，现将false转化为0，即：判断"" == 0。</div><div>空串转换成数字0，0==0，所以&nbsp;</div><div>alert("" == false)显示的是true。&nbsp;</div><img src ="http://www.blogjava.net/algz/aggbug/371885.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-03-14 21:30 <a href="http://www.blogjava.net/algz/articles/371885.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>软件设计师重点难点---原码,反码,补码,移码计算方式</title><link>http://www.blogjava.net/algz/articles/371231.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Sun, 04 Mar 2012 14:55:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/371231.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/371231.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/371231.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/371231.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/371231.html</trackback:ping><description><![CDATA[<p><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">(1)正数</span></p> <p><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">原码和反码，补码都是一样的，都是正数本身。</span></p> <p><br style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; " /><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">(2)负数</span></p> <p><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">原码是符号位为1,数值部分取X绝对值的二进制。</span><br style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; " /><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">反码是符号位为1,其它位是原码取反。</span><br style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; " /><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">补码是符号位为1,其它位是原码取反，未位加1。</span><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">也就是说，负数的补码是其反码未位加1。</span></p> <p>正负0都为0 000.<br style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; " /> </p> <p><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">(3) 移码</span></p> <p><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">就是将符号位取反的补码.无论正数和负数,0除外,0的补码和移码相同.</span></p> <p><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">也可以理解成:不算符号位外,最高数据位的进位.最高数据位为0,符号位为0;为1,符号位为1.</span></p> <p> </p> <p><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; ">例:</span></p><span style="background-color: #eeeeee; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; "><pre style="padding-bottom: 0px; background-color: #fffcf6; margin-top: 0px; margin-bottom: 10px; padding-left: 0px; padding-right: 0px; zoom: 1; font-family: Arial; font-size: 14px; line-height: 22px; word-wrap: break-word; white-space: pre-wrap; padding-top: 0px; " id="best-answer-content"  mb10"=""><p>      原码       反码       补码       移码</p><p>+0   0 000   0 000    0 000     1 000</p><p>-0    1 000   1 111    0 000      0 000</p><p> </p><p>1011 原码：01011  反码：01011  //正数时，反码＝原码 补码：01011  //正数时，补码＝原码 移码：11011  //原数+10000  －1011 原码：11011 反码：10100  //负数时，反码为原码取反 补码：10101  //负数时，补码为原码取反＋1 移码：00101  //原数+10000  0．1101 原码：0.1101  反码：0.1101  //正数时，反码＝原码 补码：0.1101  //正数时，补码＝原码 移码：1.1101  //原数+1  －0．1101 原码：1.1101 反码：1.0010  //负数时，反码为原码取反 补码：1.0011  //负数时，补码为原码取反＋1 移码：0.0010  //原数+1</p><p> </p></pre></span><img src ="http://www.blogjava.net/algz/aggbug/371231.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-03-04 22:55 <a href="http://www.blogjava.net/algz/articles/371231.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>软件设计师重点难点---磁盘格式化容量,非格式化容量,数据传输率计算</title><link>http://www.blogjava.net/algz/articles/371179.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Sat, 03 Mar 2012 13:22:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/371179.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/371179.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/371179.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/371179.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/371179.html</trackback:ping><description><![CDATA[<p>&nbsp;</p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 1.6; background-color: #ffffff; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">非格式化容量 &nbsp; = &nbsp; 位密度&#215;内圆周长&#215;每面磁道数&#215;记录面数&nbsp;</span><br style="font-family: simsun; line-height: 23px; text-align: left; " /><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&nbsp; &nbsp; &nbsp; 格式化容量 &nbsp; = &nbsp; 扇区大小&#215;每磁道扇区数&#215;每面磁道数&#215;记录面数&nbsp;</span><br style="font-family: simsun; line-height: 23px; text-align: left; " /><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&nbsp; &nbsp; &nbsp; 数据传输率 &nbsp; = &nbsp; 扇区大小&#215;每磁道扇区数&#215;转速 &nbsp;&nbsp;</span>&nbsp;<br /></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 1.6; background-color: #ffffff; ">计算容量时,单位应统一.CM换成MM;MB换成KB;&nbsp;位转换成字节=除以8.<br /></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 1.6; background-color: #ffffff; ">(1)单记录面磁道数=磁道密度<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">(盘面外半径-盘面内半径)</span></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 1.6; background-color: #ffffff; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">(2)非格式化容量=</span>&nbsp;记录<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">位密度</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">内圆周长</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">单记录面磁道数</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">记录面数</span></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 1.6; background-color: #ffffff; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">总磁道数=&nbsp;</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">单记录面磁道数</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">记录面数</span></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 22px; background-color: #ffffff; ">内圆周长=3.14*内圆直径=<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 26px; white-space: pre-wrap; ">2</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><a href="http://wenwen.soso.com/z/Search.e?sp=S%E5%9C%86%E5%91%A8%E7%8E%87&amp;ch=w.search.yjjlink&amp;cid=w.search.yjjlink" target="_blank" style="color: #005599; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; line-height: 26px; white-space: pre-wrap; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #005599; ">圆周率</a><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 26px; white-space: pre-wrap; ">半径 = 圆周率</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 26px; white-space: pre-wrap; ">直径</span></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 22px; background-color: #ffffff; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">(3)格式化容量=记录面数</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">单记录面磁道数</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">每个磁道扇区数</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">扇区字节数</span></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 22px; background-color: #ffffff; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">(4)一个磁道存储的字节数=磁盘扇区数</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">扇区字节</span></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 22px; background-color: #ffffff; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">(5)数据传输率=</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">每磁道扇区数&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">扇区大小&#215;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: simsun; line-height: 23px; text-align: left; ">转速</span>&nbsp;</p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 22px; background-color: #ffffff; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">(6)平均等待时间=磁盘转速时间的一半</span><br /><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.6; ">平均存取时间是反应磁盘数据操作速度的指标，单位是毫秒（ms），他包括3个时间段：平均寻道时间，平均定位时间，转动延迟，其中后面两个统称为等待时间。</span></p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 1.6; background-color: #ffffff; ">&nbsp;</p><p style="margin-top: 0.7em; margin-right: 0.7em; margin-bottom: 0.7em; margin-left: 0.7em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #545454; font-family: Tahoma; line-height: 1.6; background-color: #ffffff; "><font size="4"><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-align: left; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 19px; color: #ff0000; "><font color="#000000" face="Arial">举例：<br />假设一个有3个盘片的硬盘，共有4个记录面，转速为7200/分钟，盘面有效记录区域的外直径为30CM，内直径为10CM，记录位密度为250位/MM，磁道密度为8道/mm，每个磁道分16扇区，每扇区512字节。</font></span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-align: left; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 19px; color: #ff0000; "></span><br /></font>总磁道数：Ct=磁盘面数*(外直径-内直径)/2*磁道密度=4*(30-10)*10/2*8=3200<br />非格式化容量：Cuf=总磁道数*内径磁道周长*位密度=3200*(3.14*10*10)*(250/8)字节=29.95M<br />格式化容量：Cf=总磁道数&#215;每扇区数&#215;每扇区字节数=4*=25M<br />平均数据传输速率：Cg＝每磁道扇区数16&#215;每扇区字节数512KB&#215;转速(7200/60S)=983040=960KB/S</p> <p>&nbsp;</p><img src ="http://www.blogjava.net/algz/aggbug/371179.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-03-03 21:22 <a href="http://www.blogjava.net/algz/articles/371179.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>软件设计师重点难点——系统可靠性计算</title><link>http://www.blogjava.net/algz/articles/371157.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Fri, 02 Mar 2012 15:02:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/371157.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/371157.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/371157.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/371157.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/371157.html</trackback:ping><description><![CDATA[<p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><strong>软件设计师重点难点&#8212;&#8212;系统可靠性计算</strong></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　系统可靠性计算是软件设计师考试的一个重点，近些年几乎每次考试都会考到，但这个知识点的难度不高，了解基本的运算公式，即可轻松应对。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　可靠性计算主要涉及三种系统，即串联系统、并联系统和冗余系统，其中串联系统和并联系统的可靠性计算都非常简单，只要了解其概念，公式很容易记住。冗余系统要复杂一些。在实际的考试当中，考得最多的就是串并混合系统的可靠性计算。所以要求我们对串联系统与并联系统的特点有基本的了解，对其计算公式能理解、运用。下面将对这些计算的原理及公式进行详细的说明。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　<strong>串联系统</strong></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　假设一个系统由n个子系统组成，当且仅当所有的子系统都能正常工作时，系统才能正常工作，这种系统称为串联系统，如图1所示。　</p><p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><img alt="" src="http://www.233.com/NewsFiles/2012-2/6/soft/1.gif" border="0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: top; " /></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　设系统各个子系统的可靠性分别用R<sub>1</sub>，R<sub>2</sub>，&#8230;&#8230;，R<sub>n</sub>表示，则系统的可靠性R=R<sub>1</sub>&#215;R<sub>2</sub>&#215;&#8230;&#215;R<sub>n</sub>&nbsp;。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　如果系统的各个子系统的失效率分别用&#955;<sub>1</sub>，&#955;<sub>2</sub>，&#8230;&#8230;，&#955;<sub>n</sub>来表示，则系统的失效率&#955;=&#955;<sub>1</sub>&#215;&#955;<sub>2</sub>&#215;&#8230;&#215;&#955;<sub>n</sub>&nbsp;。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　<strong>并联系统</strong></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　假如一个系统由n个子系统组成，只要有一个子系统能够正常工作，系统就能正常工作，如图2所示。</p><p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><img alt="" src="http://www.233.com/NewsFiles/2012-2/6/soft/2.gif" border="0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: top; " /></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　设系统各个子系统的可靠性分别用R<sub>1</sub>，R<sub>2</sub>，&#8230;&#8230;，R<sub>n</sub>表示，则系统的可靠性R=1－（1－R<sub>1</sub>）&#215;（1－R<sub>2</sub>）&#215;&#8230;&#215;（1－R<sub>n</sub>） 。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　假如所有子系统的失效率均为&#955;，则系统的失效率为&#956;：</p><p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><img alt="" src="http://www.233.com/NewsFiles/2012-2/6/soft/3.gif" border="0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: top; " /></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　在并联系统中只有一个子系统是真正需要的，其余n-1个子系统都被称为冗余子系统。该系统随着冗余子系统数量的增加，其平均无故障时间也会增加。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　<strong>串并混合系统</strong></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　串并混合系统实际上就是对串联系统与并联系统的综合应用。我们在此以实例说明串并混合系统的可靠性如何计算。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　例1：</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　某大型软件系统按功能可划分为2段P1和P2。为提高系统可靠性，软件应用单位设计了如下图给出的软件冗余容错结构，其中P1和P2均有一个与其完全相同的冗余备份。若P1的可靠度为0.9，P2的可靠度为0.9，则整个系统的可靠度是 。</p><p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><img alt="" src="http://www.233.com/NewsFiles/2012-2/6/soft/04.gif" border="0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: top; " /></p><span style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　供选择的答案</span><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　A. 0.6561</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　B. 0.81</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　C. 0.9801</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　D. 0.9</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　试题分析</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　当系统采用串联方式时，其可靠度R可由公式R=R1R2&#8230;Rn求得。当系统采用并联方式时，其可靠度R可由公式R=1-（1-R1）*(1-R2)&#8230;(1-Rn)求得。这个系统总的来说是串联,但分成两个并联部分。第一部分的可靠度为：R1=1-(1-0.9)*(1-0.9)=0.99；第二部分的可靠度也为：R2=0.99；所以整个系统的可靠度为：R=R1*R2=0.9801 ，C答案。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　试题答案</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　C</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　上面的例题是属于常规形式的可靠性计算题，如果把这种试题再拨高一个层次，可以。</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　例2：</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　1台服务器、3台客户机和2台打印机构成了一个局域网（如图4所示）。在该系统中，服务器根据某台客户机的请求，数据在一台打印机上输出。设服务器、各客户机及各打印机的可靠度分别为a、b、c，则该系统的可靠度为 。</p><p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><img alt="" src="http://www.233.com/NewsFiles/2012-2/6/soft/05.gif" border="0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: top; " /></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　A．ab3c3</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　B．a(1-b3)(1-c2)</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　C．a(1-b)3(l-c)2</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　D．a(1-(1-b)3)(1-(l-c)2)</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　<strong>例题分析</strong></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　在试题给出的系统中，客户机之间是并联的（任何一台客户机出现故障，对其他客户机没有影响），同理，打印机之间是也并联关系。然后，客户机、服务器、打印机之间再组成一个串联关系。因此，我们可以把该系统简化为：</p><p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><img alt="" src="http://www.233.com/NewsFiles/2012-2/6/soft/6.gif" border="0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: top; " /></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　已知服务器、各客户机及各打印机的可用性分别为a、b、c，因此整个系统的可用性为：R=（1-（1-b）<sup>3</sup>）a（1-（1-c）<sup>2</sup>）=a（1-（1-b）<sup>3</sup>）（1-（1-c）<sup>2</sup>）<br />&nbsp;<br />　　例题答案D</p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　<strong>4．模冗余系统</strong></p><p style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　m模冗余系统由m个（m=2n+1为奇数）相同的子系统和一个表决器组成，经过表决器表决后，m个子系统中占多数相同结果的输出可作为系统的输出，如图5所示。</p><p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><img alt="" src="http://www.233.com/NewsFiles/2012-2/6/soft/7.gif" border="0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: top; " /></p><span style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; text-align: left; background-color: #f5fdff; ">　　在m个子系统中，只有n+1个或n+1个以上的子系统能正常工作，系统就能正常工作并输出正确结果。假设表决器是完全可靠的，每个子系统的可靠性为R0，则m模冗余系统的可靠性为：</span><p align="center" style="font-family: Arial, Helvetica, sans-serif; line-height: 22px; background-color: #f5fdff; "><img alt="" src="http://www.233.com/NewsFiles/2012-2/6/soft/8.gif" border="0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: top; " /></p><img src ="http://www.blogjava.net/algz/aggbug/371157.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-03-02 23:02 <a href="http://www.blogjava.net/algz/articles/371157.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>EditorGridPanel 控制单元格的编辑功能</title><link>http://www.blogjava.net/algz/articles/370609.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 23 Feb 2012 10:13:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/370609.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/370609.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/370609.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/370609.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/370609.html</trackback:ping><description><![CDATA[<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; "><br /></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "><strong style="font-weight: bold; "><span style="font-size: medium; ">具体描述：</span></strong></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 表格第一列（其它列也行）为类型选择列，采用ComboBox为编辑器，当选择某一类型（如：类型1）时表格<span style="color: #ff0000; "><strong style="font-weight: bold; ">当前行</strong></span>的某些列（如：第2列~第4列）就变为不可编辑状态，并显示不同的样式（类似于button的disable）。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 当选择其它类型（如：类型2）时表格<span style="color: #ff0000; "><strong style="font-weight: bold; ">当前行</strong></span>的不可编辑单元格又变成可编辑的。</p><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "><br /><br />(1)<br />是否可编辑样式可以在列模型的renderer中操作&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">renderer : function(data, meta){&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp; if(xxx){&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; meta.css += " x-item-disabled";&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp; }&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">}&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " />(2)<br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">是否可编辑逻辑可以在grid的beforeedit事件中拦截判断&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">grid.on("beforeedit", function(e){&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">/*&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e = {&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grid: this,&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; record: r,&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; field: field,&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value: r.data[field],&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; row: row,&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; column: col,&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cancel:false&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">*/&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp; if(xxx){&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false; // 中止，不让编辑&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp; }&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">});</span>&nbsp;<br /><img src ="http://www.blogjava.net/algz/aggbug/370609.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-02-23 18:13 <a href="http://www.blogjava.net/algz/articles/370609.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转] JSON-lib框架，转换JSON、XML不再困难</title><link>http://www.blogjava.net/algz/articles/370571.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 23 Feb 2012 02:56:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/370571.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/370571.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/370571.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/370571.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/370571.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Json-lib可以将Java对象转成json格式的字符串，也可以将Java对象转换成xml格式的文档，同样可以将json字符串转换成Java对象或是将xml字符串转换成Java对象。一、&nbsp;准备工作&nbsp;&nbsp;1、 首先要去官方下载json-lib工具包下载地址：http://sourceforge.net/projects/json-lib/files/json-lib/j...&nbsp;&nbsp;<a href='http://www.blogjava.net/algz/articles/370571.html'>阅读全文</a><img src ="http://www.blogjava.net/algz/aggbug/370571.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2012-02-23 10:56 <a href="http://www.blogjava.net/algz/articles/370571.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JS 数组对象的John方法</title><link>http://www.blogjava.net/algz/articles/367520.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 29 Dec 2011 10:23:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/367520.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/367520.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/367520.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/367520.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/367520.html</trackback:ping><description><![CDATA[<div><div>&lt;script type="text/javascript"&gt;</div><div></div><div>var arr = new Array(3)</div><div>arr[0] = "George"</div><div>arr[1] = "John"</div><div>arr[2] = "Thomas"</div><div></div><div>document.write(arr.join("."))</div><div></div><div>&lt;/script&gt;</div><div>输出：</div><div>George.John.Thomas</div></div><img src ="http://www.blogjava.net/algz/aggbug/367520.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-12-29 18:23 <a href="http://www.blogjava.net/algz/articles/367520.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JS 双竖线运算符</title><link>http://www.blogjava.net/algz/archive/2011/12/29/367518.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 29 Dec 2011 10:20:00 GMT</pubDate><guid>http://www.blogjava.net/algz/archive/2011/12/29/367518.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/367518.html</wfw:comment><comments>http://www.blogjava.net/algz/archive/2011/12/29/367518.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/367518.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/367518.html</trackback:ping><description><![CDATA[<div>JS 双竖线运算符:是或比较.如null||'1',返回'1';'2'||'1',返回'2'.即或运算符中,第一个为真,后面的就不用计算了.所以得'2'.哈哈.</div><img src ="http://www.blogjava.net/algz/aggbug/367518.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-12-29 18:20 <a href="http://www.blogjava.net/algz/archive/2011/12/29/367518.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>连接字符串代码(写的不错)</title><link>http://www.blogjava.net/algz/articles/366904.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Wed, 21 Dec 2011 02:01:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/366904.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/366904.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/366904.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/366904.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/366904.html</trackback:ping><description><![CDATA[<div><span style="font-size: 12px;">&nbsp; &nbsp; public static String join(Object array[], String separator)</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; {</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; if(array == null)</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return null;</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; if(separator == null)</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; separator = "";</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; int arraySize = array.length;</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; int bufSize = arraySize != 0 ? arraySize * ((array[0] != null ? array[0].toString().length() : 16) + (separator == null ? 0 : separator.length())) : 0;</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; StringBuffer buf = new StringBuffer(bufSize);</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i &lt; arraySize; i++)</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; {</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(separator != null &amp;&amp; i &gt; 0)</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buf.append(separator);</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(array[i] != null)</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buf.append(array[i]);</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; return buf.toString();</span></div><div><span style="font-size: 12px;">&nbsp; &nbsp; }</span></div><img src ="http://www.blogjava.net/algz/aggbug/366904.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-12-21 10:01 <a href="http://www.blogjava.net/algz/articles/366904.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]Hibernate Annotation几种关联映射 虽然是转载,但仔细看还是很有帮助的.</title><link>http://www.blogjava.net/algz/articles/366838.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Tue, 20 Dec 2011 06:10:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/366838.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/366838.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/366838.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/366838.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/366838.html</trackback:ping><description><![CDATA[<div><div>Hibernate Annotation几种关联映射</div><div></div><div>一对一(One-To-One)</div><div></div><div>使用@OneToOne注解建立实体Bean之间的一对一关联。一对一关联有三种情况：(1).关联的实体都共享同样的主键，(2).其中一个实体通过外键关联到另一个实体的主键(注意要模拟一对一关联必须在外键列上添加唯一约束)，(3).通过关联表来保存两个实体之间的连接关系(要模拟一对一关联必须在每一个外键上添加唯一约束)。</div><div></div><div>&nbsp;</div><div></div><div>1.共享主键的一对一关联映射：</div><div></div><div>@Entity</div><div></div><div>@Table(name="Test_Body")</div><div></div><div>public class Body {</div><div></div><div>&nbsp; &nbsp;private Integer id;</div><div></div><div>&nbsp; &nbsp;private Heart heart;</div><div></div><div>&nbsp; &nbsp;@Id</div><div></div><div>&nbsp; &nbsp;public Integer getId() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return id;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setId(Integer id) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.id = id;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;@OneToOne</div><div></div><div>&nbsp; &nbsp;@PrimaryKeyJoinColumn</div><div></div><div>&nbsp; &nbsp;public Heart getHeart() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return heart;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setHeart(Heart heart) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.heart = heart;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>}</div><div></div><div>@Entity</div><div></div><div>@Table(name="Test_Heart")</div><div></div><div>public class Heart {</div><div></div><div>&nbsp; &nbsp;private Integer id;</div><div></div><div>&nbsp; &nbsp;@Id</div><div></div><div>&nbsp; &nbsp;public Integer getId() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return id;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setId(Integer id) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.id = id;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>}</div><div></div><div>通过@PrimaryKeyJoinColumn批注定义了一对一关联</div><div></div><div>&nbsp;</div><div></div><div>2.使用外键进行实体一对一关联：</div><div></div><div>@Entity</div><div></div><div>@Table(name="Test_Trousers")</div><div></div><div>public class Trousers {</div><div></div><div>&nbsp; &nbsp;@Id</div><div></div><div>&nbsp; &nbsp;public Integer id;</div><div></div><div>&nbsp; &nbsp;@OneToOne</div><div></div><div>&nbsp; &nbsp;@JoinColumn(name = "zip_id")</div><div></div><div>&nbsp; &nbsp;public TrousersZip zip;</div><div></div><div>}</div><div></div><div>@Entity</div><div></div><div>@Table(name="Test_TrousersZip")</div><div></div><div>public class TrousersZip {</div><div></div><div>&nbsp; &nbsp;@Id</div><div></div><div>&nbsp; &nbsp;public Integer id;</div><div></div><div>&nbsp; &nbsp;@OneToOne(mappedBy = "zip")</div><div></div><div>&nbsp; &nbsp;public Trousers trousers;</div><div></div><div>}</div><div></div><div>上面的例子是指Trousers通过Trousers的外键列zip_id和TrousersZip关联，@JoinColumn批注定义了联接列，该批注和@Column批注有点类似，但是多了一个名为referencedColumnName的参数。该参数定义了所关联目标实体中的联接列，注意，当referencedColumnName关联到非主键列的时候，关联的目标类必须实现Serializable，还要注意的是所映像的属性对应单个列（否则映射无效）</div><div></div><div>一对一关联可能是双向的，在双向关联中，有且仅有一端作为主体（owner）端存在：主体端负责维护联接列（即更新），对于不需要维护这种关系的从表则通过mappedNy属性进行声明。mappedBy的值指向主体的关联属性。例子中，mappedBy的值为zip。最后，不必也不能再在被关联端（ownedside）定义联接列了，因为已经在主体端声明了。</div><div></div><div>如果在主体没有声明@JoinColumn，系统自动进行处理：在主表（owner table）中将创建联接列，列名为：主体的关联属性名+下划线+被关联端的主键列名。上面的例子中是zip_id,因为Trousers中的关联属性名为zip，TrousersZip的主键是id。</div><div></div><div>&nbsp;</div><div></div><div>3.通过关联表定义一对一关联</div><div></div><div>@Entity</div><div></div><div>@Table(name="Test_People")</div><div></div><div>public class People {</div><div></div><div>&nbsp; &nbsp;@Id</div><div></div><div>&nbsp; &nbsp;public Integer id;</div><div></div><div>&nbsp; &nbsp;@OneToOne</div><div></div><div>&nbsp; &nbsp;@JoinTable(name ="TestPeoplePassports",</div><div></div><div>&nbsp; &nbsp; &nbsp; joinColumns =@JoinColumn(name="people_fk"),</div><div></div><div>&nbsp; &nbsp; &nbsp; inverseJoinColumns =@JoinColumn(name="passport_fk")</div><div></div><div>&nbsp; &nbsp;)</div><div></div><div>&nbsp; &nbsp;public Passport passport;</div><div></div><div>}</div><div></div><div>@Entity</div><div></div><div>@Table(name="Test_Passport")</div><div></div><div>public class Passport {</div><div></div><div>&nbsp; &nbsp;@Id</div><div></div><div>&nbsp; &nbsp;public Integer id;</div><div></div><div>&nbsp; &nbsp;@OneToOne(mappedBy = "passport")</div><div></div><div>&nbsp; &nbsp;public People people;</div><div></div><div>}</div><div></div><div>People通过名为TestPeoplePassports的关联表和Passport关联。该关联表拥有名为passport_fk的外键列，该外键指向Passport表，该信息定义为inverseJoinColoumns的属性值，而people_fk外键列指向People表，该信息定义为joinColumns的属性值。</div><div></div><div>这种关联可能是双向的，在双向关联中，有且仅有一端作为主体（owner）端存在：主体端负责维护联接列（即更新），对于不需要维护这种关系的从表则通过mappedNy属性进行声明。mappedBy的值指向主体的关联属性。例子中，mappedBy的值为passport。最后，不必也不能再在被关联端（ownedside）定义联接列了，因为已经在主体端声明了。</div><div></div><div>以上是一对一关联的三种形式，下面介绍多对一关联。</div><div></div><div>&nbsp;</div><div></div><div>&nbsp;</div><div></div><div>&nbsp;</div><div></div><div>多对一(Many-to-One)</div><div></div><div>使用@ManyToOne批注来实现多对一关联。</div><div></div><div>@ManyToOne批注有一个名为targetEntity的参数，该参数定义了目标实体名，通常不需要定义该参数，因为在大部分情况下默认值(表示关联关系的属性类型)就可以很好的满足需求了。不过下面这种情况下这个参数就显得有意义了：使用接口作为返回值而不是常见的实体。</div><div></div><div>@ManyToOne(targetEntity=CompanyImpl.class)</div><div></div><div>@JoinColoumn(name=&#8221;COPM_ID&#8221;)</div><div></div><div>Public Company getCompany(){</div><div></div><div>&nbsp; &nbsp;return company;</div><div></div><div>}</div><div></div><div>多对一的配置方式有两种：(1)通过@JoinColoumn映像(2)通过关联表的方式来映像</div><div></div><div>&nbsp;</div><div></div><div>(1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 通过@JoinColoumn映射</div><div></div><div>SRD Framework中Company,Category例子：</div><div></div><div>Company：</div><div></div><div>@ManyToOne</div><div></div><div>&nbsp; &nbsp;@JoinColumn(name = "CATEGORY_OPTION_ID")</div><div></div><div>&nbsp; &nbsp;private Category category = null;</div><div></div><div>&nbsp; &nbsp;Category：</div><div></div><div>@DiscriminatorValue("Category")</div><div></div><div>public class Category extends Option {</div><div></div><div>}</div><div></div><div>(2) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 通过关联表映射</div><div></div><div>通过@JoinTable批注定义关联表，该关联表包含了指回实体表的外键(通过@JoinTable.joinColoumns)以及指向目标实体表的外键(通过@JoinTable.inverseJoinColoumns)</div><div></div><div>@Entity</div><div></div><div>@Table(name="Test_TreeType")</div><div></div><div>public class TreeType {</div><div></div><div>&nbsp; &nbsp;private Integer id;</div><div></div><div>&nbsp; &nbsp;private String name;</div><div></div><div>&nbsp; &nbsp;private ForestType forestType;</div><div></div><div>&nbsp; &nbsp;@ManyToOne(fetch = FetchType.LAZY)</div><div></div><div>&nbsp; &nbsp;@JoinTable(name="Test_Tree_Forest",</div><div></div><div>&nbsp; &nbsp; &nbsp; joinColumns = @JoinColumn(name="tree_id"),</div><div></div><div>&nbsp; &nbsp; &nbsp; inverseJoinColumns = @JoinColumn(name="forest_id") )</div><div></div><div>public ForestType getForestType() {// forestType的getter，setter方法必须在这里，否则会出错</div><div></div><div>&nbsp; &nbsp; &nbsp; return forestType;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setForestType(ForestType forestType) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.forestType = forestType;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;@Id</div><div></div><div>&nbsp; &nbsp;@GeneratedValue</div><div></div><div>&nbsp; &nbsp;public Integer getId() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return id;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setId(Integer id) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.id = id;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public String getName() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return name;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setName(String name) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.name = name;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>}</div><div></div><div>@Entity</div><div></div><div>@Table(name="Test_ForestType")</div><div></div><div>public class ForestType {</div><div></div><div>&nbsp; &nbsp;private Integer id;</div><div></div><div>&nbsp; &nbsp;private String name;</div><div></div><div>&nbsp; &nbsp;private Set&lt;TreeType&gt; trees;</div><div></div><div>&nbsp; &nbsp;@OneToMany(mappedBy="forestType")</div><div></div><div>public Set&lt;TreeType&gt; getTrees() {// trees的getter，setter方法必须在这里，否则会出错</div><div></div><div>&nbsp; &nbsp; &nbsp; return trees;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setTrees(Set&lt;TreeType&gt; trees) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.trees = trees;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;@Id @GeneratedValue</div><div></div><div>&nbsp; &nbsp;public Integer getId() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return id;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setId(Integer id) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.id = id;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public String getName() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return name;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>&nbsp; &nbsp;public void setName(String name) {</div><div></div><div>&nbsp; &nbsp; &nbsp; this.name = name;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>}</div><div></div><div>&nbsp;</div><div></div><div>一对多(One-to-Many)</div><div></div><div>使用@OneToMany批注可定义一对多关联，一对多关联可以是双向关联。</div><div></div><div>在EJB3规范中多对一这端几乎总是双向关联中的主体(owner)端，而一对多这端关联批注为@OneToMany(mappedBy...)</div><div></div><div>@Entity</div><div></div><div>Public class Troop{</div><div></div><div>&nbsp; &nbsp;@OneToMany(mappedBy=&#8221;troop&#8221;)</div><div></div><div>Public Set&lt;Soldier&gt; getSoldiers(){</div><div></div><div>......</div><div></div><div>}</div><div></div><div>@Entity</div><div></div><div>Public class Soldier{</div><div></div><div>&nbsp; &nbsp;@ManyToOne</div><div></div><div>&nbsp; &nbsp;@JoinColumn(name=&#8221;troop_fk&#8221;)</div><div></div><div>Public Troop getTroop(){</div><div></div><div>......</div><div></div><div>}</div><div></div><div>Troop通过troop属性和Soldier建立一对多的双向关联，在mappedBy端不必也不能再定义任何物理映射。</div><div></div><div>对于一对多的双向映射，如果要一对多这一端维护关联关系，你需要删除mappedBy元素并将多对一这端的@JoinColoumn的insertable和updatabel设置为false。这种方案不会得到什么明显的优化，而且还会增加一些附加的UPDATE语句。</div><div></div><div>&nbsp;</div><div></div><div>单向：</div><div></div><div>通过在被拥有的实体端(owned entity)增加一个外键列来实现一对多单向关联是很少见的，也是不推荐的，建议通过一个联接表来实现这种关联(下面会讲到)。</div><div></div><div>@JoinColoumn批注来描述这种单向关联关系</div><div></div><div>@Entity</div><div></div><div>Public class Customer{</div><div></div><div>&nbsp; &nbsp;@OneToMany</div><div></div><div>@JoinColoumn(name=&#8221;CUST_ID&#8221;)</div><div></div><div>Public Set&lt;ticket&gt; getTickets() {</div><div></div><div>......</div><div></div><div>}</div><div></div><div>@Entity</div><div></div><div>Public class Ticket{</div><div></div><div>&nbsp; &nbsp;...</div><div></div><div>}</div><div></div><div>Customer通过CUST_ID列和Ticket建立了单向关联关系</div><div></div><div>通过关联表处理单向关联：</div><div></div><div>通过联接表处理单向一对多关联是首选方式，这种关联通过@JoinTable批注进行描述</div><div></div><div>@Entity</div><div></div><div>Public class Trainer{</div><div></div><div>@OneToMany</div><div></div><div>@JoinTable(</div><div></div><div>&nbsp; &nbsp;name = "TrainedMonkeys",</div><div></div><div>&nbsp; &nbsp;jonColumns = {@JoinColumn(name = "trainer_id")},</div><div></div><div>&nbsp; &nbsp;inverseJoinColumns = @JoinColumn(name = "monkey_id")</div><div></div><div>&nbsp; &nbsp;)</div><div></div><div>public Set&lt;Monkey&gt; getTrainedMonkeys() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return trainedMonkeys;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>......</div><div></div><div>}</div><div></div><div>@Entity</div><div></div><div>public class Monkey {</div><div></div><div>...//no bidir</div><div></div><div>}</div><div></div><div>上面这个例子中，Trainer通过TrainedMonkeys表和Monkey建立了单向关联，其中外键trainer_id关联到Trainer(joinColoumn),而外键monkey_id关联到Monkey(inversejionColoumns)</div><div></div><div>默认处理机制：</div><div></div><div>通过联接表来建立单向一对多关联不需要描述任何物理映像，表名由以下三个部分组成：主表(ownertable)表名+从表(the other side table)表名，指向主表的外键名：主表表名+下划线+主表主键列名，指向从表的外键名：主表所对应实体的属性名+下划线+从表主键列名，指向从表的外键定义为唯一约束，用来表示一对多的关联关系。</div><div></div><div>@Entity</div><div></div><div>public class Trainer{</div><div></div><div>&nbsp; &nbsp;@OneToMany</div><div></div><div>&nbsp; &nbsp;Public Set&lt;Tiger&gt; getTrainedTigers(){</div><div></div><div>... ...</div><div></div><div>}</div><div></div><div>@Entity</div><div></div><div>public class Tiger{</div><div></div><div>.. ..//no bidir</div><div></div><div>}</div><div></div><div>上面这个例子中，Trainer和Tiger通过联接表Trainer_Tiger建立单向关联关系，其中外键trainer_id关联到Trainer,而外键trainedTigers_id关联到Tiger</div><div></div><div>&nbsp;</div><div></div><div>多对多(Many-to-Many)</div><div></div><div>使用@ManyToMany批注可定义多对多关联，同时，你也许要通过批注@JoinTable描述关联表和关联条件。如果是双向关联，其中一段必须定义为Owner，另一端必须定义为inverse(在对关联表进行更新操作时这一端将被忽略)</div><div></div><div>@Entity()</div><div></div><div>public class Employer implements Serializable {</div><div></div><div>&nbsp; &nbsp;private Integer id;</div><div></div><div>&nbsp; &nbsp;private Collection employees;</div><div></div><div>&nbsp; &nbsp;@ManyToMany(</div><div></div><div>targetEntity = org.hibernate.test.annotations.manytomany.Employee.class,</div><div></div><div>&nbsp; &nbsp; &nbsp; cascade = {CascadeType.PERSIST, CascadeType.MERGE}</div><div></div><div>&nbsp; &nbsp;)</div><div></div><div>&nbsp; &nbsp;@JoinTable(</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;name = "EMPLOYER_EMPLOYEE",</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;joinColumns = {@JoinColumn(name = "EMPER_ID")},</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inverseJoinColumns = {@JoinColumn(name = "EMPEE_ID")}</div><div></div><div>&nbsp; &nbsp;)</div><div></div><div>&nbsp; &nbsp;public Collection getEmployees() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return employees;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>...</div><div></div><div>}</div><div></div><div>@Entity()</div><div></div><div>public class Employee implements Serializable {</div><div></div><div>&nbsp; &nbsp;@ManyToMany(</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cascade = {CascadeType.PERSIST, CascadeType.MERGE},</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mappedBy = "employees"</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;targetEntity = Employer.class</div><div></div><div>&nbsp; &nbsp;)</div><div></div><div>public Collection&lt;Employer&gt; getEmployers() {</div><div></div><div>&nbsp; &nbsp; &nbsp; return employers;</div><div></div><div>&nbsp; &nbsp;}</div><div></div><div>.. ..</div><div></div><div>}</div><div></div><div>@JoinTable批注定义了联接表的表名，联接列数组，以及invers联接列数组，后者是关联表中关联到Employee主键的列(the &#8220;other side&#8221;)。</div><div></div><div>被关联端不必也不能描述物理映射：只需要一个简单的mappedBy参数，该参数包含了主体端的属性名，这样就绑定了双方的关系。</div><div></div><div>默认值：</div><div></div><div>和其它许多批注一样，在多对多关联中很多值是自动生成，党双向多对多关联中没有定义任何物理映射时，Hibernate根据以下规则生成相应的值，关联表名：主表表名+下划线+从表表名，关联到主表的外键名：主表名+下划线+主表中的主键列名，关联到从表的外键名：主表中用于关联的属性名+下划线+从表的主键列名，以上规则对于双向一对多关联同样一样。</div><div></div><div>&nbsp;</div><div></div><div>以上是整理的一点简单的几种映射，可参考EJB3.pdf中P111&#8212;&#8212;P131，hibernate_annotation.pdf 第二章</div><div></div><div>在这里没有具体的例子，有很多内容还需要仔细查看文档。</div></div><img src ="http://www.blogjava.net/algz/aggbug/366838.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-12-20 14:10 <a href="http://www.blogjava.net/algz/articles/366838.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转] 关于oracle with table as 创建临时表的用法示例</title><link>http://www.blogjava.net/algz/articles/365688.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Tue, 06 Dec 2011 08:47:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/365688.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/365688.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/365688.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/365688.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/365688.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #888888; font-family: Arial; line-height: normal; background-color: #ffffff; "><span style="line-height: normal; background-color: #ffff00; color: #000000; font-size: 16px; ">1、with table as 相当于建个临时表（用于一个语句中某些中间结果放在临时表空间的SQL语句），Oracle 9i 新增WITH语法，可以将查询中的子查询命名，放到SELECT语句的最前面。</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">语法就是</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">with tempname as (select ....)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">select ...</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">例子：</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">with t as (select * from emp where depno=10)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">select * from t where empno=xxx</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">with</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">wd as (select did,arg(salary) 平均工资 from work group by did),</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">em as (select emp.*,w.salary from emp left join work w on emp.eid = w.eid)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">select * from wd,em where wd.did =em.did and wd.平均工资&gt;em.salary;</span><br style="line-height: normal; " /><br style="line-height: normal; " /><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; background-color: #ffff00; color: #000000; font-size: 16px; ">2、何时被清除</span><br style="line-height: normal; " /><span style="line-height: normal; background-color: #ffff00; color: #000000; font-size: 16px; ">临时表不都是会话结束就自动被PGA清除嘛! 但with as临时表是查询完成后就被清除了！</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">23:48:58 SCOTT@orcl&gt; with aa as(select * from dept)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">23:57:58&nbsp;&nbsp; 2&nbsp; select * from aa;</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp; DEPTNO DNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOC</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">---------- -------------- -------------</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10 ACCOUNTING&nbsp;&nbsp;&nbsp;&nbsp; NEW YORK</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20 RESEARCH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DALLAS</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 30 SALES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHICAGO</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 40 OPERATIONS&nbsp;&nbsp;&nbsp;&nbsp; BOSTON</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">已用时间:&nbsp; 00: 00: 00.12</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">23:58:06 SCOTT@orcl&gt; select * from aa;</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">select * from aa</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">第 1 行出现错误:</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">ORA-00942: 表或视图不存在</span><br style="line-height: normal; " /><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">已用时间:&nbsp; 00: 00: 00.02</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">23:58:14 SCOTT@orcl&gt;</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; background-color: #ffff00; color: #000000; font-size: 16px; ">3、就这一功能来说，子查询就可以达到啊，为什么要用with呢？ 用with有什么好处？</span><br style="line-height: normal; " /><span style="line-height: normal; background-color: #ffff00; color: #000000; font-size: 16px; ">都能写，但执行计划不同的。当有多个相似子查询的时候，用with写公共部分，因为子查询结果在内存临时表中，执行效率当然就高啦~</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; background-color: #ffff00; color: #000000; font-size: 16px; ">4、问题：</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">有张表数据如下：</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">aaa 高</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">bbb 低</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">aaa 低</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">aaa 高</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">bbb 低</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">bbb 高</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">需要得到下列结果,</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; 高 低</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">aaa 2 1</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">bbb 1 2</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">问 SQL 语句怎么写？？</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">答案：</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">with tt as (</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select 'aaa' id, '高' value from dual union all</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select 'bbb' id, '低' value from dual union all</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select 'aaa' id, '低' value from dual union all</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select 'aaa' id, '高' value from dual union all</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select 'bbb' id, '低' value from dual union all</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select 'bbb' id, '高' value from dual)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">SELECT id,</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNT(decode(VALUE, '高', 1)) 高,</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNT(decode(VALUE, '低', 1)) 低</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; FROM tt</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;GROUP BY id;</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">===================================================================</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">扩展：</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">Oracle9i新增WITH语法，可以将查询中的子查询命名，放到SELECT语句的最前面。</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">　　一个简单的例子:</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">SQL&gt; WITH</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">2 SEG AS (SELECT SEGMENT_NAME, SUM(BYTES)/1024 K FROM USER_SEGMENTS GROUP BY SEGMENT_NAME),</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">3 OBJ AS (SELECT OBJECT_NAME, OBJECT_TYPE FROM USER_OBJECTS)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">4 SELECT O.OBJECT_NAME, OBJECT_TYPE, NVL(S.K, 0) SIZE_K</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">5 FROM OBJ O, SEG S</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">6 WHERE O.OBJECT_NAME = S.SEGMENT_NAME (+)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">7 ;</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">OBJECT_NAME OBJECT_TYPE SIZE_K</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">------------------------------ ------------------- ----------</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">DAIJC_TEST TABLE 128</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">P_TEST PROCEDURE 0</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">IND_DAIJC_TEST_C1 INDEX 128</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">　　通过WITH语句定义了两个子查询SEG和OBJ，在随后的SELECT语句中可以直接对预定义的子查询进行查询。从上面的例子也可以看出，使用WITH语句，将一个包含聚集、外连接等操作SQL清晰的展现出来。</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">　　WITH定义的子查询不仅可以使查询语句更加简单、清晰，而且WITH定义的子查询还具有在SELECT语句的任意层均可见的特点。</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">　　即使是在WITH的定义层中，后定义的子查询都可以使用前面已经定义好的子查询:</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">SQL&gt; WITH</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">2 Q1 AS (SELECT 3 + 5 S FROM DUAL),</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">3 Q2 AS (SELECT 3 * 5 M FROM DUAL),</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">4 Q3 AS (SELECT S, M, S + M, S * M FROM Q1, Q2)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">5 SELECT * FROM Q3;</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">S M S+M S*M</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">---------- ---------- ---------- ----------</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">8 15 23 120</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">　　利用WITH定义查询中出现多次的子查询还能带来性能提示。Oracle会对WITH进行性能优化，当需要多次访问WITH定义的子查询时，Oracle会将子查询的结果放到一个临时表中，避免同样的子查询多次执行，从而有效的减少了查询的IO数量。</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">WITH能用在SELECT语句中，UPDATE和DELETE语句也是支持WITH语法的，只是需要版本支持:</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">http://www.oracle.com.cn/viewthread.php?tid=83530</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">=============================================================================</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">with</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">sql1 as (select to_char(a) s_name from test_tempa),</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">sql2 as (select to_char(b) s_name from test_tempb where not exists (select s_name from sql1 where rownum=1))</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">select * from sql1</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">union all</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">select * from sql2</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">union all</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">select 'no records' from dual</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where not exists (select s_name from sql1 where rownum=1)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and not exists (select s_name from sql2 where rownum=1);</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">再举个简单的例子</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">with a as (select * from test)</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">select * from a;</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">其实就是把一大堆重复用到的SQL语句放在with as 里面，取一个别名，后面的查询就可以用它</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">这样对于大批量的SQL语句起到一个优化的作用，而且清楚明了</span><br style="line-height: normal; " /><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">这是搜索到的英文文档资料(说得比较全,但是本人英文特菜,还没具体了解到,希望各高手具体谈谈这个with</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">as 的好处)</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">About Oracle WITH clause</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">Starting in Oracle9i release 2 we see an incorporation of the SQL-99 &#8220;WITH clause&#8221;, a tool for materializing subqueries to save Oracle from having to re-compute them multiple times.</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">The SQL &#8220;WITH clause&#8221; is very similar to the use of Global temporary tables (GTT), a technique that is often used to improve query speed for complex subqueries. Here are some important notes about the Oracle &#8220;WITH clause&#8221;:</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; ? The SQL &#8220;WITH clause&#8221; only works on Oracle 9i release 2 and beyond.</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; ? Formally, the &#8220;WITH clause&#8221; is called subquery factoring</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; ? The SQL &#8220;WITH clause&#8221; is used when a subquery is executed multiple times</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; ? Also useful for recursive queries (SQL-99, but not Oracle SQL)</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">To keep it simple, the following example only references the aggregations once, where the SQL &#8220;WITH clause&#8221; is normally used when an aggregation is referenced multiple times in a query.</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">We can also use the SQL-99 &#8220;WITH clause&#8221; instead of temporary tables. The Oracle SQL &#8220;WITH clause&#8221; will compute the aggregation once, give it a name, and allow us to reference it (maybe multiple times), later in the query.</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">The SQL-99 &#8220;WITH clause&#8221; is very confusing at first because the SQL statement does not begin with the word SELECT. Instead, we use the &#8220;WITH clause&#8221; to start our SQL query, defining the aggregations, which can then be named in the main query as if they were &#8220;real&#8221; tables:</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">WITH</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">subquery_name</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">AS</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">(the aggregation SQL statement)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">SELECT</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">(query naming subquery_name);</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">Retuning to our oversimplified example, let&#8217;s replace the temporary tables with the SQL &#8220;WITH&nbsp; clause&#8221;:</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">WITH</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">sum_sales AS</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select /*+ materialize */</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp; sum(quantity) all_sales from stores</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">number_stores AS</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select /*+ materialize */</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp;&nbsp; count(*) nbr_stores from stores</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">sales_by_store AS</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; select /*+ materialize */</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; store_name, sum(quantity) store_sales from</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp; store natural join sales</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">SELECT</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; store_name</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">FROM</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; store,</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; sum_sales,</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; number_stores,</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; sales_by_store</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">where</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">&nbsp;&nbsp; store_sales &gt; (all_sales / nbr_stores)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">;</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">Note the use of the Oracle undocumented &#8220;materialize&#8221; hint in the &#8220;WITH clause&#8221;. The Oracle materialize hint is used to ensure that the Oracle cost-based optimizer materializes the temporary tables that are created inside the &#8220;WITH&#8221; clause. This is not necessary in Oracle10g, but it helps ensure that the tables are only created one time.</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">It should be noted that the &#8220;WITH clause&#8221; does not yet fully-functional within Oracle SQL and it does not yet support the use of &#8220;WITH clause&#8221; replacement for &#8220;CONNECT BY&#8221; when performing recursive queries.</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">To see how the &#8220;WITH clause&#8221; is used in ANSI SQL-99 syntax, here is an excerpt from Jonathan Gennick&#8217;s great work &#8220;Understanding the WITH Clause&#8221; showing the use of the SQL-99 &#8220;WITH clause&#8221; to traverse a recursive bill-of-materials hierarchy</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">The SQL-99 &#8220;WITH clause&#8221; is very confusing at first because the SQL statement does not begin with the word SELECT. Instead, we use the &#8220;WITH clause&#8221; to start our SQL query, defining the aggregations, which can then be named in the main query as if they were &#8220;real&#8221; tables:</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">WITH</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">subquery_name</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">AS</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">(the aggregation SQL statement)</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">SELECT</span><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">(query naming subquery_name);</span><br style="line-height: normal; " /><br style="line-height: normal; " /><span style="line-height: normal; color: #000000; font-size: 16px; ">Retuning to our oversimplified example, let&#8217;s replace the temporary tables with the SQL &#8220;WITH&#8221; clause&#8221;:</span></span><img src ="http://www.blogjava.net/algz/aggbug/365688.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-12-06 16:47 <a href="http://www.blogjava.net/algz/articles/365688.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hibernate 注解映射 设置默认值的异常及解决方法</title><link>http://www.blogjava.net/algz/articles/365534.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Mon, 05 Dec 2011 01:21:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/365534.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/365534.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/365534.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/365534.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/365534.html</trackback:ping><description><![CDATA[<div><div>Oracle 数据库:<br />Hibernate&nbsp;annotation :<br /><div><div><span style="white-space:pre">	</span>@Column(name="NUMBERS",columnDefinition="NUMBER(20,3) default 0 ")</div><div><span style="white-space:pre">	</span>public BigDecimal getNumbers() {</div><div><span style="white-space:pre">		</span>return numbers;</div><div><span style="white-space:pre">	</span>}<br /><br />异常:</div></div>Caused by: org.hibernate.HibernateException: Wrong column type: NUMBERS, expected: NUMBER(20,3) default 0&nbsp;</div><div><span style="white-space:pre">	</span>at org.hibernate.mapping.Table.validateColumns(Table.java:261)</div><div><span style="white-space:pre">	</span>at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1083)</div><div><span style="white-space:pre">	</span>at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)</div><div><span style="white-space:pre">	</span>at org.hibernate.impl.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:317)</div><div><span style="white-space:pre">	</span>at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)</div><div><span style="white-space:pre">	</span>at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)</div><div><span style="white-space:pre">	</span>at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)</div><div><span style="white-space:pre">	</span>... 122 more<br />解决方法:<br /><div><div><span style="white-space:pre">	</span>@Column(name="NUMBERS",columnDefinition="number(20,3) default 0 ")</div><div><span style="white-space:pre">	</span>public BigDecimal getNumbers() {</div><div><span style="white-space:pre">		</span>return numbers;</div><div><span style="white-space:pre">	</span>}<br />原因:hibernate 在列定义选项中,数据库中的所有类型应为小写number. hibernate在此直接面对数据库,所以区分大小写.</div></div></div></div><img src ="http://www.blogjava.net/algz/aggbug/365534.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-12-05 09:21 <a href="http://www.blogjava.net/algz/articles/365534.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转] Oracle 语法之 OVER (PARTITION BY ..) 及开窗函数</title><link>http://www.blogjava.net/algz/articles/365263.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 01 Dec 2011 02:00:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/365263.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/365263.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/365263.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/365263.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/365263.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #454545; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 14px; background-color: #ffffff; "><div>oracle的分析函数over 及开窗函数</div><div><font size="2">一：分析函数<strong style="color: black; background-color: #a0ffff; ">over</strong><br /><strong style="color: black; background-color: #ffff66; ">Oracle</strong>从8.1.6开始提供分析函数，分析函数用于计算基于组的某种聚合值，它和聚合函数的不同之处是<br />对于每个组返回多行，而聚合函数对于每个组只返回一行。&nbsp;<br />下面通过几个例子来说明其应用。&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><div><font size="2">1：统计某商店的营业额。&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></div><div><font size="2">&nbsp;&nbsp;&nbsp;&nbsp; date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sale<br />&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20<br />&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15<br />&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 14<br />&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18<br />&nbsp;&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 30<br />&nbsp;&nbsp;&nbsp; 规则：按天统计：每天都统计前面几天的总额<br />&nbsp;&nbsp;&nb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sp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 97&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />2:统计各班成绩第一名的同学信息</font></div><div><font size="2">&nbsp;&nbsp;&nbsp; NAME&nbsp;&nbsp; CLASS S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; ----- ----- ----------------------&nbsp;<br />&nbsp;&nbsp;&nbsp; fda&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; ffd&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 78&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; dss&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 95&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; select name,class,s,rank()<strong style="color: black; background-color: #a0ffff; ">over</strong>(partition by class order by s desc) mm from t2<br />&nbsp;&nbsp;&nbsp; )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; where mm=1&nbsp;<br />&nbsp;&nbsp;&nbsp; --<br />&nbsp;&nbsp;&nbsp; 得到结果：<br />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;&nbsp;&nbsp; 注意：<br />&nbsp;&nbsp;&nbsp; 1.在求第一名成绩的时候，不能用row_number()，因为如果同班有两个并列第一，row_number()只返回一个结果&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; 2.rank()和dense_rank()的区别是：<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --rank()是跳跃排序，有两个第二名时接下来就是第四名<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --dense_rank()l是连续排序，有两个第二名时仍然跟着第三名<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />3.分类统计 (并显示信息)</font></div><div><font size="2">&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp; B&nbsp;&nbsp; C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; -- -- ----------------------&nbsp;<br />&nbsp;&nbsp;&nbsp; m&nbsp;&nbsp; a&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; n&nbsp;&nbsp; a&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; m&nbsp;&nbsp; a&nbsp;&nbsp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bsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp; h&nbsp;&nbsp; b&nbsp;&nbsp; 3</font></div><div><font size="2">&nbsp;&nbsp; select a,c,sum(c)<strong style="color: black; background-color: #a0ffff; ">over</strong>(partition by a) from t2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp; 得到结果：<br />&nbsp;&nbsp; A&nbsp;&nbsp; B&nbsp;&nbsp; C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUM(C)<strong style="color: black; background-color: #a0ffff; ">OVER</strong>(PARTITIONBYA)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp; -- -- ------- ------------------------&nbsp;<br />&nbsp;&nbsp; h&nbsp;&nbsp; b&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp; m&nbsp;&nbsp; a&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp; m&nbsp;&nbsp; a&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp; n&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp; x&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp; 无法得到B列值&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;<br />＝＝＝＝＝</font></div><div><div><p><font face="verdana, arial, helvetica" size="2"><span class="javascript" id="text2200299" style="font-size: 12px; ">select * from test<br /><br />数据:<br />A B C&nbsp;<br />1 1 1&nbsp;<br />1 2 2&nbsp;<br />1 3 3&nbsp;<br />2 2 5&nbsp;<br />3 4 6&nbsp;<br /><br /><br />---将B栏位值相同的对应的C 栏位值加总<br />select a,b,c, SUM(C) OVER (PARTITION BY B) C_Sum<br />from test<br /><br />A B C C_SUM&nbsp;<br />1 1 1 1&nbsp;<br />1 2 2 7&nbsp;<br />2 2 5 7&nbsp;<br />1 3 3 3&nbsp;<br />3 4 6 6&nbsp;<br /><br /><br /><br />---如果不需要已某个栏位的值分割,那就要用 null<br /><br />eg: 就是将C的栏位值summary 放在每行后面<br /><br />select a,b,c, SUM(C) OVER (PARTITION BY null) C_Sum<br />from test<br /><br />A B C C_SUM&nbsp;<br />1 1 1 17&nbsp;<br />1 2 2 17&nbsp;<br />1 3 3 17&nbsp;<br />2 2 5 17&nbsp;<br />3 4 6 17</span></font></p><p><font face="verdana, arial, helvetica" size="2"></font>&nbsp;</p><p><font face="verdana, arial, helvetica" size="2"><span class="javascript" style="font-size: 12px; ">求个人工资占部门工资的百分比</span></font></p><font face="verdana, arial, helvetica" size="2"><p><font face="verdana, arial, helvetica" size="2"><span class="javascript" id="text3005546" style="font-size: 12px; ">SQL&gt; select * from salary;<br /><br />NAME DEPT SAL<br />---------- ---- -----<br />a 10 2000<br />b 10 3000<br />c 10 5000<br />d 20 4000<br /><br />SQL&gt; select name,dept,sal,sal*100/sum(sal) over(partition by dept) percent from salary;<br /><br />NAME DEPT SAL PERCENT<br />---------- ---- ----- ----------<br />a 10 2000 20<br />b 10 3000 30<br />c 10 5000 50<br />d 20 4000 100</span></font></p></font></div></div><div><font size="2">二：开窗函数&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 开窗函数指定了分析函数工作的数据窗口大小，这个数据窗口大小可能会随着行的变化而变化，举例如下：&nbsp;<br />1：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<strong style="color: black; background-color: #a0ffff; ">over</strong>（order by salary） 按照salary排序进行累计，order by是个默认的开窗函数<br />&nbsp;&nbsp;&nbsp;<strong style="color: black; background-color: #a0ffff; ">over</strong>（partition by deptno）按照部门分区<br />2：<br />&nbsp;&nbsp;<strong style="color: black; background-color: #a0ffff; ">over</strong>（order by salary range between 5 preceding and 5 following）<br />&nbsp;&nbsp; 每行对应的数据窗口是之前行幅度值不超过5，之后行幅度值不超过5<br />&nbsp;&nbsp; 例如:对于以下列<br />&nbsp;&nbsp;&nbsp;&nbsp; aa<br />&nbsp;&nbsp;&nbsp;&nbsp; 1<br />&nbsp;&nbsp;&nbsp;&nbsp; 2<br />&nbsp;&nbsp;&nbsp;&nbsp; 2<br />&nbsp;&nbsp;&nbsp;&nbsp; 2<br />&nbsp;&nbsp;&nbsp;&nbsp; 3<br />&nbsp;&nbsp;&nbsp;&nbsp; 4<br />&nbsp;&nbsp;&nbsp;&nbsp; 5<br />&nbsp;&nbsp;&nbsp;&nbsp; 6<br />&nbsp;&nbsp;&nbsp;&nbsp; 7<br />&nbsp;&nbsp;&nbsp;&nbsp; 9<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp; sum(aa)<strong style="color: black; background-color: #a0ffff; ">over</strong>（order by aa range between 2 preceding and 2 following）<br />&nbsp;&nbsp; 得出的结果是<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUM<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ---------------------- -------------------------------------------------------&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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sp; 5-1&lt;=aa&lt;=5+2 的和<br />&nbsp;&nbsp; 对于aa=2来说 ，sum=1+2+2+2+3+4=14&nbsp;&nbsp;&nbsp;&nbsp; ；<br />&nbsp;&nbsp; 又如 对于aa=9 ，9-1&lt;=aa&lt;=9+2 只有9一个数，所以sum=9&nbsp;&nbsp;&nbsp; ；<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />3：其它：<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong style="color: black; background-color: #a0ffff; ">over</strong>（order by salary rows between 2 preceding and 4 following）<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 每行对应的数据窗口是之前2行，之后4行&nbsp;<br />4：下面三条语句等效：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong style="color: black; background-color: #a0ffff; ">over</strong>（order by salary rows between unbounded preceding and unbounded following）<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 每行对应的数据窗口是从第一行到最后一行，等效：<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong style="color: black; background-color: #a0ffff; ">over</strong>（order by salary range between unbounded preceding and unbounded following）<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 等效<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong style="color: black; background-color: #a0ffff; ">over</strong>(partition by null)</font></div></div></span><img src ="http://www.blogjava.net/algz/aggbug/365263.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-12-01 10:00 <a href="http://www.blogjava.net/algz/articles/365263.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转] 页面中调用系统常用的对话框需要用到的classid</title><link>http://www.blogjava.net/algz/articles/365132.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Tue, 29 Nov 2011 09:50:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/365132.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/365132.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/365132.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/365132.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/365132.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">&#9632;打开&#9632;&nbsp;<br />&lt;input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开&gt;&nbsp;<br />&lt;OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0&gt;&lt;/OBJECT&gt;&nbsp;<br />&#9632;另存为&#9632;&nbsp;<br />&lt;input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为&gt;&lt;OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0&gt;&lt;/OBJECT&gt;&nbsp;<br />&#9632;属性&#9632;&nbsp;<br />&lt;input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性&gt;&lt;OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0&gt;&lt;/OBJECT&gt;&nbsp;<br />&#9632;打印&#9632;&nbsp;<br />&lt;input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印&gt;&lt;OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0&gt;&lt;/OBJECT&gt;&nbsp;<br />&#9632;打印预览&#9632;&nbsp;<br />&lt;input name=Button onClick=document.all.WebBrowser.ExecWB(7,1) type=button value=打印&gt;&lt;OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0&gt;&lt;/OBJECT&gt;&nbsp;<br /><br />&#9632;页面设置&#9632;&nbsp;<br />&lt;input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置&gt;&lt;OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0&gt;&lt;/OBJECT&gt;&nbsp;<br />&#9632;刷新&#9632;&nbsp;<br />&lt;input type=button value=刷新 name=refresh onclick="window.location.reload()"&gt;&nbsp;<br />&#9632;导入收藏&#9632;&nbsp;<br />&lt;input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,);&gt;&nbsp;<br />&#9632;导出收藏&#9632;&nbsp;<br />&lt;input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,);&gt;&nbsp;<br />&#9632;加入收藏&#9632;&nbsp;<br />&lt;INPUT name=Button2 onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹&gt;&nbsp;<br />&#9632;整理收藏夹&#9632;&nbsp;<br />&lt;INPUT name=Submit2 onclick="window.external.ShowBrowserUI(OrganizeFavorites, null)" type=button value=整理收藏夹&gt;&nbsp;<br />&#9632;查看原文件&#9632;&nbsp;<br />&lt;INPUT name=Button onclick=window.location = "view-source:" + window.location.href type=button value=查看源文件&gt;&nbsp;<br />&#9632;语言设置&#9632;&nbsp;<br />&lt;INPUT name=Button onclick="window.external.ShowBrowserUI(LanguageDialog, null)" type=button value=语言设置&gt;&nbsp;<br />&#9632;前进&#9632;&nbsp;<br />&lt;INPUT name=Submit onclick=history.go(1) type=submit value=前进&gt;&nbsp;<br />&#9632;后退&#9632;&nbsp;<br />&lt;INPUT name=Submit2 onclick=history.go(-1) type=submit value=后退&gt;</span><img src ="http://www.blogjava.net/algz/aggbug/365132.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-11-29 17:50 <a href="http://www.blogjava.net/algz/articles/365132.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]  WebBrowser.ExecWB的完整说明</title><link>http://www.blogjava.net/algz/articles/365131.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Tue, 29 Nov 2011 09:48:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/365131.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/365131.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/365131.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/365131.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/365131.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "><div class="article" id="article" align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><table id="content" cellspacing="10" cellpadding="0" width="650" border="0" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; font-size: 12px; table-layout: fixed; width: 650px; "><tbody style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><tr style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 12px; "><td style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 12px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 10pt; "><font style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: #ffffff; ">&lt;OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0&gt;&lt;/OBJECT&gt;&nbsp;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(1,1) type=button value=打开&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(2,1) type=button value=关闭所有&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为&gt;&nbsp;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(6,1) type=button value=打印&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(6,6) type=button value=直接打印&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(7,1) type=button value=打印预览&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(10,1) type=button value=属性&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(17,1) type=button value=全选&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(22,1) type=button value=刷新&gt;<br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " />&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(45,1) type=button value=关闭&gt;</font></div></td></tr></tbody></table></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser组件的execWB方法</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">1. &lt;object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"&gt;&lt;/object&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">2. 调用方法:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB nCmdID, nCmdExecOpt, [pvaIn], [pvaOut]</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">3. 参数说明:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(a).nCmdID&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_OPEN = 1,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_NEW = 2,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SAVE = 3,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SAVEAS = 4,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SAVECOPYAS = 5,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_PRINT = 6,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_PRINTPREVIEW = 7,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_PAGESETUP = 8,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SPELL = 9,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_PROPERTIES = 10,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_CUT = 11,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_COPY = 12,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_PASTE = 13,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_PASTESPECIAL = 14,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_UNDO = 15,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_REDO = 16,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_selectALL = 17,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_CLEARselectION = 18,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_ZOOM = 19,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_GETZOOMRANGE = 20&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_updateCOMMANDS = 21&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_REFRESH = 22&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_STOP = 23&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_HIDETOOLBARS = 24&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SETPROGRESSMAX = 25&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SETPROGRESSPOS = 26&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SETPROGRESSTEXT = 27&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SETTITLE = 28&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_SETDOWNLOADSTATE = 29&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDID_STOPDOWNLOAD = 30&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">上面的关键词都可以在浏览器的菜单里面找到对应的选项﹐大家一看就明白的﹗&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(b).nCmdExecOpt&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDEXECOPT_DODEFAULT = 0,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDEXECOPT_PROMPTUSER = 1,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">LECMDEXECOPT_DONTPROMPTUSER = 2,&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OLECMDEXECOPT_SHOWHELP = 3&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">对于这个参数﹐一般来说﹐选1就可以了。</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">4.常用:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(1,1) 打开</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(2,1) 关闭现在所有的IE窗口，并打开一个新窗口</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(4,1) 保存网页</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(6,1) 打印</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(7,1) 打印预览</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(8,1) 打印页面设置</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(10,1) 查看页面属性</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(15,1) 好像是撤销，有待确认</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(17,1) 全选</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(22,1) 刷新</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">WebBrowser.ExecWB(45,1) 关闭窗体无提示</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">5.示例﹕</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(a)调用IE的&#8221;另存为&#8221;功能的示例﹕</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"&gt;&lt;/object&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;A href=".:WebBrowser.ExecWB(4,1);"&gt;Save-存储&lt;/A&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(b)经过改写的登陆模式</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"&gt;&lt;/object&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;body .load="showModalDialog('login_access.asp',0,'Status:NO;dialogWidth:418px;dialogHeight:288px');document.all.WebBrowser.ExecWB(45,1);"&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0&gt;&lt;/OBJECT&gt;&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(1,1) type=button value=打开&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(2,1) type=button value=关闭所有&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为&gt;&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(6,1) type=button value=打印&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(6,6) type=button value=直接打印&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(7,1) type=button value=打印预览&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(10,1) type=button value=属性&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(17,1) type=button value=全选&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(22,1) type=button value=刷新&gt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;input name=Button .Click=document.all.WebBrowser.ExecWB(45,1) type=button value=关闭&gt;</div></span><img src ="http://www.blogjava.net/algz/aggbug/365131.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-11-29 17:48 <a href="http://www.blogjava.net/algz/articles/365131.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hibernate 级联(联表)删除的问题</title><link>http://www.blogjava.net/algz/articles/364066.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 17 Nov 2011 04:47:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/364066.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/364066.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/364066.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/364066.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/364066.html</trackback:ping><description><![CDATA[<div><div>dao.getHibernateSession().createQuery(hql).setParameter("bookid", bookid).setParameter("batch", batch).executeUpdate();&nbsp;<br /><br />(1)String hql="delete&nbsp;from&nbsp;TbProduceplanaccount&nbsp;ppa&nbsp;where&nbsp;ppa.tbBusinessplanaccount.batch=:batch&nbsp;and&nbsp;ppa.tbProduceplanbook.id=:bookid ";<br />异常:<br /><div><div>Hibernate:&nbsp;delete&nbsp;from&nbsp;Tb_ProducePlanAccount,&nbsp;Tb_BusinessplanAccount&nbsp;tbbusiness1_&nbsp;where&nbsp;batch=?&nbsp;and&nbsp;ProducePlanBook_ID=?<br />2011-11-17&nbsp;11:50:16,166&nbsp;WARN&nbsp;&nbsp;[JDBCExceptionReporter]&nbsp;SQL&nbsp;Error:&nbsp;933,&nbsp;SQLState:&nbsp;42000<br />2011-11-17&nbsp;11:50:16,166&nbsp;ERROR&nbsp;[JDBCExceptionReporter]&nbsp;ORA-00933:&nbsp;SQL&nbsp;命令未正确结束&nbsp;<br /><br />(2)hql="delete from TbProduceplanaccount ppa where ppa in (from TbProduceplanaccount ppa where ppa.tbBusinessplanaccount.batch=:batch and ppa.tbProduceplanbook.id=:bookid)";</div><div><div><span class="Apple-style-span" style="white-space: pre;">执行正常.</span></div></div></div><br />总结: hibernate的理解方式与人不同,不能自动生成子查询;<span style="color: #99cc00; ">更新或删除操作是不允许联表的,必须通过子查询找出数据.</span><br />题外语:级联删除是要设置映射的.<br /><div><div></div></div></div></div><img src ="http://www.blogjava.net/algz/aggbug/364066.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-11-17 12:47 <a href="http://www.blogjava.net/algz/articles/364066.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>sql plus操作oracel(windows平台)基础之简易新手篇 </title><link>http://www.blogjava.net/algz/articles/356201.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Wed, 10 Aug 2011 03:29:00 GMT</pubDate><guid>http://www.blogjava.net/algz/articles/356201.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/356201.html</wfw:comment><comments>http://www.blogjava.net/algz/articles/356201.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/356201.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/356201.html</trackback:ping><description><![CDATA[<div><p style="color: #85a246" align="center"></p><div style="text-align: left;"><span style="color: #000000; ">注:登入SQLPLUS时报错,如下:</span><br /><span style="color: #000000; ">请输入用户名: &nbsp;system</span></div><div><div style="text-align: left;"><span style="color: #000000; ">输入口令:</span></div><div style="text-align: left;"><span style="color: #000000; ">ERROR:</span></div><div style="text-align: left;"><span style="color: #000000; ">ORA-12560: TNS: 协议适配器错误<br /></span><span style="color: #000000; ">原因:<div style="display: inline-block; "></div></span><span style="color: #000000; ">是ORCAL实例没启动(net [start/stop] 服务名).与Linux相反,不在SQLPLUS中启动实例.</span></div></div><br />平台: windows server 2003 Enterprise Editon  , oracle 10g(10.02.00.01)<br /><p>&nbsp;</p> <ol> <li>运行"开始-&gt;程序\Oracle - OraDb10g_home1\配置和移植工具"中的"Database Configuration  Assistant"，创建一个数据库。  </li><li>创建成功后，运行"开始-&gt;程序\Oracle - OraDb10g_home1\应用程序开发"中的"SQL Plus".用户名：sys  密码：123456 as sysdba(密码后面要加空格as空格sysdba) 主机字符串：如果是本机可不填。  </li><li> <p style="line-height: 150%; margin-right: 5px; margin-left: 5px; ">从命令提示符下使用sql*plus<br />sqlplus/nolog  <br />conn 用户名/密码 as sysdba  出现&#8221;已连接&#8220;后就是成功了。<br /></p></li></ol>　　　　<br />　　接下来，我们在SQL*Plus中实战一下，为我们下面将要做的打好基础。<br />　　用system登陆到SQL*Plus后，我们做如下操作(这次没有截图，有详细的说明)<br />-----------如登陆成功此1-3步不必做，直接做第4步----------------<br /> <ol> <li>SQL&gt;create user maxuan identified by max; #创建口令为max的用户maxuan  </li><li>SQL&gt;grant connect,resource to maxuan; #为用户maxuan授权  </li><li>SQL&gt;conn maxuan/max; #以用户maxuan进行连接  </li><li>SQL&gt;create table test(a number); #建立一个名为test的表，只有字段名为A的一列，数据类型为数字  </li><li>SQL&gt;insert into test values(1); #插入一条记录  </li><li>SQL&gt;select * from test; #查询记录，此时A列的第一行为1  </li><li>SQL&gt;update test set a=2; #更改记录，此时A列的第一行已改为2  </li><li>SQL&gt;commit; #提交.在完成数据库的插入，删除和修改操作时，只有当事务提交到数据库才算完成。  </li><li>SQL&gt;delete from test; #删除test表中所有的记录，此时test表中没有记录  </li><li>SQL&gt;roll;  #回滚到提交前，此时再查询test表，A列第一行值又回复到2<br /></li></ol>　　<br />　　<strong>oracle的数据类型</strong><br />　　在数据库中创建数据表的时候，我们需要定义表中所有字段的类型，数据类型大致分为：character,numberic,date,lob和raw等，这些是最基本的数据类型。当然在oracle中也允许自定义数据类型！<br />　　<br />　　在oracle中提供的character数据类型:<br />　　char():固定长度字符串，最大长度为2000字节，如果不指定长充，缺省为1个字节长。<br />　　varchar2():可变长度的字符串，最大长度为4000字节，具体定义时指明最大长度，这咱类型可以放数字、字母以及ASCII码字符集(或者EBCDIC等数据库系统接受的字符集标准)中的所有符号。如果数据长度没有达到最大值，oracle会根据数据大小自动调节字段长度。是<br />　　<br />　　最长用的数据类型。<br />　　nchar():根据字符集而定的固定长度字符串，最大长度2000字节。<br />　　nvarchar2():根据字符集而定的可变长度字符串，最大长度4000字节。<br />　　long:可变长字符列，最大长度限制为2GB，用于不需要作字符串搜索的长串数据。此类型是一个遗留下来的而且将来不会被支持的数据类型，逐渐被BLOB，CLOB，NCLOB等大的数据类型所取代。<br />　　<br />　　numberic数据类型用来存储负的和正的整数，分数和浮点型数据，在oracle中提供的numberic数据类型：<br />　　number(,):可变长的数值列，允许0、正值及负值，m是所有的有效数字的位数，n是小数点以后的位数。<br />　　<br />　　在oracle中提供的date数据类型:<br />　　date:缺省格式是dd-mon-yy(日-月-年)<br />　　<br />　　在oracle中提供的lob数据类型:<br />　　blob、clob、nclob：三种大型对象(lob)，用来保存较大的图形文件或带格式的文本文件，如word文档，以及音频、视频等非文本文件，最大长充是4GB。晕些数据存储在数据库内部保存。<br />　　bfile:在数据库外部保存的大型二进制对象文件，最大长度是4GB，这种外部的LOB类型，通过数据库记录变化情况，但是数据的具体保存是在数据库外部进行的。<br />　　<br />　　在oracle中提供的raw数据类型:<br />　　raw():可变长二进制数据，具体定义字段时必须指明最大长度，这种格式用来保存较小的图形文件或带格式的文本文件，它也是一种较老的数据类型，将被lob数据类型所取代。<br />　　long  raw:可变长二进制数据，最大长度是2GB，可以用来保存较大的图形或带格式的文本文件，以及音频、视频等非文本文件，这也是一种较老的数据类型，将被lob数据类型所取代。<br />　　<br />　　其它的数据类型：<br />　　rowid:这是oracle数据表中的一个伪例，它是数据表中每行数据内在的唯一标识<br />　　integer:整数类型<br />　　<br />补充知识：<br />SQL(Structure  Query  Language)语言是结构化查询语言，是数据库的核心语言，是面向集合的描述性非过程化语言。SQL语言共分为四大类：数据查询语言DQL,数据操纵语言DML，数据定义语言DDL,数据库控制语言DCL。<br />　　<br />　　1.数据查询语言DQL的基本结构是由select子句，from子句，where子句组成的查询块：<br />　　select  &lt;字段名表&gt; from &lt;表或视图名&gt; where  &lt;查询条件&gt;<br />　　<br />　　2.数据操纵语言DML完成在数据库中确定、修改、添加、删除某一数据值的任务(以下是部分常用DML语句):<br />　　insert　　增加数据行到表<br />　　delete　　从表中删除数据行<br />　　Update　　更改表中数据<br />　　<br />　　3.数据定义语言DDL完成定义数据库的结构，包括数据库本身、数据表、目录、视图等数据库元素(以下是部分常用DDL语句)<br />　　create  table　　创建表<br />　　create index　　创建索引<br />　　create view　　创建视图<br />　　alter  table　　增加表列，重定义表列，更改存储分配<br />　　drop table　　删除表<br />　　drop  index　　删除索引<br />　　<br />　　4.数据库控制语言DCL用来授予或回收访问数据库的某种特权，并控制数据库操纵事务发生的时间及效果，对数据库实行监视等。如：<br />　　grant　　　　将权限或角色授予用户或其它角色<br />　　revoke　　　　回收用户权限<br />　　roll　　　　回滚，是当某个对话更改了数据库中的数据后，由于某种原因用户不想提交此更改时，oracle所采取的保护操作。这是一个把信息恢复到用户使update、insert、delete前最后提交的状态。<br />　　commit　　　　提交。在完成数据库的插入，删除和修改操作时，只有当事务提交到数据库才算完成，有提交前只有操作数据库的本人才能看到，别人只有在最后提交完成才可以看到。<br /><br />　　一个<strong>购物网站后台数据库</strong>实例：<br />　　现在我们回到用J2EE体系开发购物网站的主题，开始实战建购物网站的后台数据库。<br />　　为了实现购物网站的基本的功能，我们需要建立四个表：商品列表(products)、商品类型表(item)、订单列表(orders)和管理员列表(admin)。表结构如下所示：<br />　　<br />　　item表结构（商品类型表)<br />　　字段名称　　数据类型　　　　允许空　　主键/外键　　备注　　<br />　　type_id　　INTEGER(自动编号)　否　  主键　　 商品类别ID标记<br />　　type　　        varchar2(30)　　      否　　　     商品类别名称<br />　　<br />　　product表结构(商品列表)<br />　　字段名称　　  数据类型　　　允许空　　主键/外键　　备注<br />　　product_id　INTEGER(自动编号)　否　　        主键　　商品ID标记<br />　　title　　             varchar2(30)　　  否　　　　                 商品名称<br />　　type_id　　       INTEGER　　　 否　       　外键　　商品类别标记<br />　　info　　            varchar2(80)　　    是　　　　               商品简介<br />　　price　           　number(16,2)　　  否　　　                　商品价格<br />　　<br />　　orders表结构(订单列表)<br />　　字段名称　　数据类型　　　  允许空　　主键/外键　　备注<br />　　order_id　　INTEGER(自动编号)　否　　       主键　　订单ID标记<br />　　name　　       varchar2(20)　　     否　　　　               顾客姓名<br />　　address　　  varchar2(100)　　    是　　　　              发货地址<br />　　tel　　              number(16)　         是　　　　               联系电话<br />　　email　　        varchar2(30)　        否　　　              　联系email<br />　　btime　　             date　　　       是　　　　               订购日期<br />　　product_id　　INTEGER　　   否　　      外键　   商品标记<br />　　uword　　        varchar2(100)　是　　　　              顾客留言<br />　　<br />　　admin表结构(管理员列表)<br />　　字段名称　　数据类型　　　　允许空　　主键/外键　　备注<br />　　admin_id　　INTEGER(自动编号)　否　　        主键　　  管理员ID标记<br />　　adminname　　varchar2(20)　　        否　　　　                  管理员名称<br />　　password　　varchar2(20)　　          否　　　　                  管理员密码<br />　　<br />　　设计完表结构后，我们就要开始创建了。<br />　　创建表我想已经不是什么难事了，那么我们要注意的是product、item、orders这三个表之间的关联，还有自动编号。<br />　　<br />　　下面是完整的SQL语句，在后面我会给出详细的说明，你可以在SQL*Plus里对照着输入，也可以将它存为SQL脚本文件，在SQL*Plus或SQLPlus  Worksheet里执行。当然也可以把代码直接拷贝到SQL*Plus里执行！<br />　　<br />　　代码：<br />　　rem ///BY MAXUAN  开始///<br />　　create table item(<br />　　type_id integer not null,<br />　　type  varchar2(30),<br />　　constraint item_pk primary  key(type_id)<br />　　);<br />　　<br />　　create table product(<br />　　product_id integer  not null,<br />　　title varchar2(30) not null, <br />　　type_id integer not  null,<br />　　info varchar2(80),<br />　　price number(16,2) not null,<br />　　constraint  product_pk primary key (product_id),<br />　　constraint product_fk foreign  key(type_id) references item(type_id)<br />　　);<br />　　<br />　　create table  orders(<br />　　order_id integer not null,<br />　　name varchar2(20) not  null,<br />　　address varchar2(100),<br />　　tel number(16),<br />　　email varchar2(30)  not null,<br />　　btime date,<br />　　product_id integer not null,<br />　　uword  varchar2(100),<br />　　constraint orders_pk primary key(order_id),<br />　　constraint  orders_fk foreign key(product_id) references  product(product_id)<br />　　);<br />　　<br />　　create table admin(<br />　　admin_id integer  not null,<br />　　adminname varchar2(20) not null,<br />　　password varchar2(20) not  null,<br />　　constraint admin_pk primary key(admin_id)<br />　　);</div><img src ="http://www.blogjava.net/algz/aggbug/356201.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-08-10 11:29 <a href="http://www.blogjava.net/algz/articles/356201.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>EOS让失业的工人找到工作,让专业的技术人员下岗.</title><link>http://www.blogjava.net/algz/archive/2011/06/23/352855.html</link><dc:creator>紫蝶∏飛揚↗</dc:creator><author>紫蝶∏飛揚↗</author><pubDate>Thu, 23 Jun 2011 01:21:00 GMT</pubDate><guid>http://www.blogjava.net/algz/archive/2011/06/23/352855.html</guid><wfw:comment>http://www.blogjava.net/algz/comments/352855.html</wfw:comment><comments>http://www.blogjava.net/algz/archive/2011/06/23/352855.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/algz/comments/commentRss/352855.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/algz/services/trackbacks/352855.html</trackback:ping><description><![CDATA[<div>这段日子，普元到我们公司来推销EOS，看了一下演示，感觉确实做的不错。完全基于Eclipse，不但后台逻辑可视化，现在前台页面也可以可视化开发。这个页面可视化开发不仅仅指的是像DW那样的可视，它集成了很多功能。比如：验证可以设置，综合查询可以自由添加条件（只要修改页面），分页显示。针对单表，多表模式，各有向导，基本下一步，下一步就可以了。页面显示字段什么的，在eclipse里面设置一下就可以了。也就是说不管页面还是后台，你都不用离开eclipse去完成，以前还要开dw，或则文本编辑器来写页面，用xmlbuddy来修改xml配置，比如写了一个action,添加action配置什么的，而且完全可视话，页面之间的流向完全可视话，如果要换流到另外一个页面，把箭头拉一拉就可以了。  <br />&nbsp;&nbsp;&nbsp;&nbsp;  后台逻辑在Eclipse里可以调试。而且有一个后台监控系统，感觉做的不错。出错的话，记录数据，sql，还有执行时间，模块什么的，基本上不用去拉log找异常了，一般都能看出错误来。  <br />&nbsp;&nbsp;&nbsp;&nbsp; 自带了权限系统。集成了工作流。 <br />&nbsp;&nbsp;&nbsp;&nbsp;  后期维护非常方便，随便哪个人都可以维护，以前如果代码写的不好，找bug能累死人，现在基本上来说是比较简单的，玩不出花样来，大家都是一个样。 <br />&nbsp;&nbsp;&nbsp;&nbsp;  可以生成完整的文档。对图形做的注释什么的，可以完全以htm,pdf的格式导出。这样文档和开发可以保持一致。 <br />&nbsp;&nbsp;&nbsp;&nbsp;  以前我们自己基于ibatis,webwork,spring，写插件通过加注释生成了很多文件来完成后台开发，但感觉麻烦的是即使你后台文件全部生成了，但前台哪些链接也蛮麻烦的，而且还要调试。我就想写个插件向导用模板来完成页面。现在看到EOS，比我自己想象中做的还要好。  <br />&nbsp;&nbsp;&nbsp;&nbsp;  感觉对于不是很复杂的系统（我们公司做的大部分系统），天哪，我要懂这么多框架干嘛，struts,webwork,hibernate,ibatis,spring等等，用这些框架还要有很多繁琐的配置，于是就自己来做很多自动生成的工作。现在，只要懂一个EOS就可以了，拖拖拉拉就可以完成，那我要这些框架干吗，不就是完成这个系统嘛。  <br />&nbsp;&nbsp;&nbsp;&nbsp;  虽然我感觉EOS完全是面向过程的，但我们做的一般项目都不复杂，一般的项目完全可以用它来开发。但感觉会砸了很多人的饭碗，因为普通的开发人员，公司随便招个人就可以代替你。</div><img src ="http://www.blogjava.net/algz/aggbug/352855.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/algz/" target="_blank">紫蝶∏飛揚↗</a> 2011-06-23 09:21 <a href="http://www.blogjava.net/algz/archive/2011/06/23/352855.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>