??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲一区 二区 三区,亚洲一区二区三区加勒比,欧美一级大片在线视频http://www.aygfsteel.com/aoneany/category/34221.htmlƲ上天堂Q先下地?/description>zh-cnSun, 04 Aug 2013 10:43:06 GMTSun, 04 Aug 2013 10:43:06 GMT60~写bat脚本执行jarhttp://www.aygfsteel.com/aoneany/articles/402292.html沙漠中的?/dc:creator>沙漠中的?/author>Fri, 02 Aug 2013 03:08:00 GMThttp://www.aygfsteel.com/aoneany/articles/402292.htmlhttp://www.aygfsteel.com/aoneany/comments/402292.htmlhttp://www.aygfsteel.com/aoneany/articles/402292.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/402292.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/402292.html@echo off       
set PATH=C:\Program Files (x86)\Java\jdk1.6.0_20\bin;C:\WINDOWS;C:\WINDOWS\COMMAND 
set classpath=.;C:\Program Files (x86)\Java\jdk1.6.0_20\lib\tools.jar;C:\Program Files (x86)\Java\jdk1.6.0_20\lib\dt.jar 
java -jar extract_excel.jar
   
pause 


]]>
Java中Xpath实现当前节点L父节点下的字节点http://www.aygfsteel.com/aoneany/articles/399416.html沙漠中的?/dc:creator>沙漠中的?/author>Fri, 17 May 2013 08:05:00 GMThttp://www.aygfsteel.com/aoneany/articles/399416.htmlhttp://www.aygfsteel.com/aoneany/comments/399416.htmlhttp://www.aygfsteel.com/aoneany/articles/399416.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/399416.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/399416.html<section class="imgArea">
    <title="雨伞指数" target="_blank" href="#"></a>
    <span style="#">
        不带?br />     </span>
</section> 在上面代码中Q我们首先需要查扑ֱ性title=”雨伞指数"的节点,Xpath写法?//a[@title='雨伞指数']",然后需要找到父节点Q父节点标识为parent,Xpath的写法ؓ“//a[@title='雨伞指数']/parent::section”Qsection表示点ؓSection节点?br />然后需要查子点Span下的文本内容Q完整的写法?#8220;//a[@title='雨伞指数']/parent::section/span/text()”

]]>
Carrot2Ҏ章进行聚cM码示?/title><link>http://www.aygfsteel.com/aoneany/articles/393951.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Tue, 08 Jan 2013 07:08:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/393951.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/393951.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/393951.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/393951.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/393951.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> ClusteringFlyStoneDocument {<br /><br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">void</span> main(String[] args) {<br />        <br />        <span style="color: #0000FF; ">final</span> Controller controller = ControllerFactory.createCachingPooling(IDocumentSource.<span style="color: #0000FF; ">class</span>);<br />        <span style="color: #008000; ">//</span><span style="color: #008000; ">创徏需要处理的属性对?/span><span style="color: #008000; "><br /></span>        <span style="color: #0000FF; ">final</span> Map<String, Object> attributes = Maps.newHashMap();<br />        <br />        <span style="color: #008000; ">//</span><span style="color: #008000; ">需要处理的文档集合</span><span style="color: #008000; "><br /></span>        List<Document> documents = SampleDocumentData.DOCUMENTS_DATA_MINING;<br />        <br />        <span style="color: #008000; ">//</span><span style="color: #008000; ">文档添加到聚类属性中</span><span style="color: #008000; "><br /></span>        CommonAttributesDescriptor.attributeBuilder(attributes).documents(documents);<br />        <br />        <span style="color: #008000; ">//</span><span style="color: #008000; ">讄处理的语aQ)</span><span style="color: #008000; "><br /></span>        MultilingualClusteringDescriptor.attributeBuilder(attributes).defaultLanguage(LanguageCode.CHINESE_SIMPLIFIED);<br />        <br />        <span style="color: #008000; ">//</span><span style="color: #008000; ">讄需要处理的对象Q以及聚cȝ法</span><span style="color: #008000; "><br /></span>        <span style="color: #0000FF; ">final</span> ProcessingResult englishResult = controller.process(attributes, LingoClusteringAlgorithm.<span style="color: #0000FF; ">class</span>);<br />        <br />        <span style="color: #008000; ">//</span><span style="color: #008000; ">获取l果Q打印聚cM题及兌信息</span><span style="color: #008000; "><br /></span>        <span style="color: #0000FF; ">final</span> List<Cluster> clustersByTopic = englishResult.getClusters();<br />        System.out.println("=======聚类主题=====");<br />        <span style="color: #0000FF; ">for</span>(Cluster cluster : clustersByTopic){<br />            System.out.println("【主?nbsp;? +cluster.getLabel());<br />            List<Document> cDocLst = cluster.getAllDocuments();<br />            <span style="color: #0000FF; ">for</span>(Document doc : cDocLst){<br />                System.out.println("--------" + doc.getTitle());<br />            }<br />        }<br />         <br />        <span style="color: #008000; ">//</span><span style="color: #008000; ">通过URLq行聚类</span><span style="color: #008000; "><br /></span>        <span style="color: #0000FF; ">final</span> ProcessingResult byDomainClusters = controller.process(documents, <span style="color: #0000FF; ">null</span>,ByUrlClusteringAlgorithm.<span style="color: #0000FF; ">class</span>);<br />        <span style="color: #0000FF; ">final</span> List<Cluster> clustersByDomain = byDomainClusters.getClusters();<br />        System.out.println("=======URL聚类=======");<br />        <span style="color: #0000FF; ">for</span>(Cluster cluster : clustersByDomain){<br />            System.out.println("【URL? +cluster.getLabel());<br />            List<Document> cDocLst = cluster.getAllDocuments();<br />            <span style="color: #0000FF; ">for</span>(Document doc : cDocLst){<br />                System.out.println("----" + doc.getTitle());<br />            }<br />        }<br />    }<br /><br />}</div><img src ="http://www.aygfsteel.com/aoneany/aggbug/393951.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2013-01-08 15:08 <a href="http://www.aygfsteel.com/aoneany/articles/393951.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Eclipse中DebugE序打印日志信息配置http://www.aygfsteel.com/aoneany/articles/388440.html沙漠中的?/dc:creator>沙漠中的?/author>Mon, 24 Sep 2012 07:49:00 GMThttp://www.aygfsteel.com/aoneany/articles/388440.htmlhttp://www.aygfsteel.com/aoneany/comments/388440.htmlhttp://www.aygfsteel.com/aoneany/articles/388440.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/388440.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/388440.html在Eclipse Debug ConfigurationsH口中,切换到Arguments늭Q在VM argumenets文本框中配置Log4j配置文g的参敎ͼ如下Q?/div>
-Dlog4j.configuration=file:/D:/WorkSpace/log4j.properties


]]>
部v到weblogic服务包冲H的解决办法http://www.aygfsteel.com/aoneany/articles/383962.html沙漠中的?/dc:creator>沙漠中的?/author>Wed, 25 Jul 2012 09:02:00 GMThttp://www.aygfsteel.com/aoneany/articles/383962.htmlhttp://www.aygfsteel.com/aoneany/comments/383962.htmlhttp://www.aygfsteel.com/aoneany/articles/383962.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/383962.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/383962.html当前开发了一个系l,在tomcat下运行正常,但是部v到weblogic下时Q却出现?/span>java.lang.NoClassDefFoundError: org/aspectj/weaver/tools/PointcutPrimitive异常Q经q查询,原来是当前系l和weblogiccd中都存在存类Q超成包冲突的情c如遇到此类情况Q可以通过构徏部vear包,在weblogic-application.xml通过配置优先加蝲本项目中的包来处理?br /> 在ear工程下的web-info文g夹下Q添加两个文件application.xml和weblogic-application.xml?br /> application.xml文g内容如下Q?/span><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
        "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
        "http://java.sun.com/dtd/application_1_3.dtd"
>
<application>
    <display-name>kubpwl</display-name>
    <module>
        <web>
            <web-uri>kubpwl.war</web-uri>
            <context-root>kubpwl</context-root>
        </web>
    </module>
</application>
weblogic-application.xml文g内容如下Q?span style="font-size: 13px; color: #0000ff; "><?
xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.3/weblogic-application.xsd">
    <!--weblogic-version:10.3.6-->
    <wls:application-param>
        <wls:param-name>webapp.encoding.default</wls:param-name>
        <wls:param-value>UTF-8</wls:param-value>
    </wls:application-param>

    <wls:prefer-application-packages>
        <wls:package-name>org.aspectj.weaver.tools.*</wls:package-name>
        <wls:package-name>javax.jws.*</wls:package-name>
    </wls:prefer-application-packages>
</wls:weblogic-application>

prefer-application-packages 表示优先加蝲目lib下的包?img src ="http://www.aygfsteel.com/aoneany/aggbug/383962.html" width = "1" height = "1" />

]]>
CXF服务集成Spring的配|(讉K路径Q?/title><link>http://www.aygfsteel.com/aoneany/articles/377621.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Tue, 08 May 2012 07:57:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/377621.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/377621.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/377621.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/377621.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/377621.html</trackback:ping><description><![CDATA[在Web.xmldCXFServlet的配|?br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000FF; "><</span><span style="color: #800000; ">servlet</span><span style="color: #0000FF; ">></span><br />         <span style="color: #0000FF; "><</span><span style="color: #800000; ">servlet-name</span><span style="color: #0000FF; ">></span>CXFServlet<span style="color: #0000FF; "></</span><span style="color: #800000; ">servlet-name</span><span style="color: #0000FF; ">></span><br />         <span style="color: #0000FF; "><</span><span style="color: #800000; ">servlet-class</span><span style="color: #0000FF; ">></span><br />             org.apache.cxf.transport.servlet.CXFServlet<br />         <span style="color: #0000FF; "></</span><span style="color: #800000; ">servlet-class</span><span style="color: #0000FF; ">></span><br />         <span style="color: #0000FF; "><</span><span style="color: #800000; ">load-on-startup</span><span style="color: #0000FF; ">></span>0<span style="color: #0000FF; "></</span><span style="color: #800000; ">load-on-startup</span><span style="color: #0000FF; ">></span><br />     <span style="color: #0000FF; "></</span><span style="color: #800000; ">servlet</span><span style="color: #0000FF; ">></span><br /> <br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">servlet-mapping</span><span style="color: #0000FF; ">></span><br />         <span style="color: #0000FF; "><</span><span style="color: #800000; ">servlet-name</span><span style="color: #0000FF; ">></span>CXFServlet<span style="color: #0000FF; "></</span><span style="color: #800000; ">servlet-name</span><span style="color: #0000FF; ">></span><br />         <span style="color: #0000FF; "><</span><span style="color: #800000; ">url-pattern</span><span style="color: #0000FF; ">></span>/services/*<span style="color: #0000FF; "></</span><span style="color: #800000; ">url-pattern</span><span style="color: #0000FF; ">></span><br />     <span style="color: #0000FF; "></</span><span style="color: #800000; ">servlet-mapping</span><span style="color: #0000FF; ">></span></div> <span style="font-family: 宋体; color: #ac885b; font-size: 12pt; ">其中</span><span style="font-family: 'Courier New'; color: #ac885b; font-size: 12pt; ">/services/*</span><span style="font-family: 宋体; color: #ac885b; font-size: 12pt; ">表示会拦截所?/span><span style="font-family: 'Courier New'; color: #ac885b; font-size: 12pt; ">services</span><span style="font-family: 宋体; color: #ac885b; font-size: 12pt; ">下的讉K路径?/span><span style="font-size:9.0pt;font-family:宋体;Courier New";Courier New";Courier New";color:#AC885B;"><br /> </span> <div style="font-size: 13px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; background-color: #eeeeee; "><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000FF; "><</span><span style="color: #800000; ">beans </span><span style="color: #FF0000; ">xmlns</span><span style="color: #0000FF; ">="http://www.springframework.org/schema/beans"</span><span style="color: #FF0000; "><br />     xmlns:xsi</span><span style="color: #0000FF; ">="http://www.w3.org/2001/XMLSchema-instance"</span><span style="color: #FF0000; "><br />     xmlns:jaxws</span><span style="color: #0000FF; ">="http://cxf.apache.org/jaxws"</span><span style="color: #FF0000; "><br />     xmlns:context</span><span style="color: #0000FF; ">="http://www.springframework.org/schema/context"</span><span style="color: #FF0000; "><br />     xsi:schemaLocation</span><span style="color: #0000FF; ">="<br />     http://www.springframework.org/schema/beans <br />     http://www.springframework.org/schema/beans/spring-beans.xsd<br />     http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd<br />     http://www.springframework.org/schema/context   <br />     http://www.springframework.org/schema/context/spring-context-3.0.xsd"</span><span style="color: #0000FF; ">></span><br /> <br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">import </span><span style="color: #FF0000; ">resource</span><span style="color: #0000FF; ">="classpath:META-INF/cxf/cxf.xml"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">import </span><span style="color: #FF0000; ">resource</span><span style="color: #0000FF; ">="classpath:META-INF/cxf/cxf-extension-soap.xml"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">import </span><span style="color: #FF0000; ">resource</span><span style="color: #0000FF; ">="classpath:META-INF/cxf/cxf-servlet.xml"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/><br /> </span><br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">context:annotation-config</span><span style="color: #0000FF; ">/></span><br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">context:component-scan </span><span style="color: #FF0000; ">base-package</span><span style="color: #0000FF; ">="com.*.server.resource"</span><span style="color: #0000FF; ">></</span><span style="color: #800000; ">context:component-scan</span><span style="color: #0000FF; ">></span><br /> <br />     <span style="color: #008000; "><!--</span><span style="color: #008000; "> 登陆服务 </span><span style="color: #008000; ">--></span><br />     <span style="color: #0000FF; "><</span><span style="color: #800000; ">jaxws:endpoint <br />       </span><span style="color: #FF0000; ">id</span><span style="color: #0000FF; ">="LoginService"</span><span style="color: #FF0000; "> <br />       implementor</span><span style="color: #0000FF; ">="com.*.ws.LoginService"</span><span style="color: #FF0000; "> <br />       address</span><span style="color: #0000FF; ">="/ILoginService"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">></span><br />      <span style="color: #0000FF; "></</span><span style="color: #800000; ">jaxws:endpoint</span><span style="color: #0000ff; ">></span><br /> <span style="color: #0000FF; "></</span><span style="color: #800000; ">beans</span><span style="color: #0000FF; ">></span></div> <span style="font-family: 宋体; color: red; font-size: 12pt; ">则当?/span><span style="font-family: 'Courier New'; color: red; font-size: 12pt; ">CXF</span><span style="font-family: 宋体; color: red; font-size: 12pt; ">的访问\径ؓ</span><span style="font-family: 'Courier New'; color: red; font-size: 12pt; "> http://url/projectname/services/ILoginService?br /></span>而不是:<span style="font-family: 'Courier New'; font-size: 16px; ">http://url/projectname/ILoginServiceQ注意添加services的\径)</span><img src ="http://www.aygfsteel.com/aoneany/aggbug/377621.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2012-05-08 15:57 <a href="http://www.aygfsteel.com/aoneany/articles/377621.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RCP中系l内|菜单?/title><link>http://www.aygfsteel.com/aoneany/articles/371717.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Mon, 12 Mar 2012 05:27:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/371717.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/371717.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/371717.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/371717.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/371717.html</trackback:ping><description><![CDATA[      在eclipse-RCP中许多系l内|菜单,可以直接拿过来用,如ActionFactory.CLOSEQActionFactory.CLOSE_ALLQActionFactory.SAVEQActionFactory.SAVE_ASQActionFactory.DELETE{?br />可以通过saveAction = ActionFactory.SAVE.create(window);创徏Action<br />      需要?div style="display: inline-block; "></div>ActionFactory.SAVE,<div style="display: inline-block; "></div>ActionFactory.SAVE_ALL变ؓ可用状态,只需要设|编辑器EditorPart的isDirty()Ҏq回为true卛_?br />      ActionFactory.SAVE_AS讄<div style="display: inline-block; "></div>~辑器EditorPart的iisSaveAsAllowed()为true卛_?br />     但是<div style="display: inline-block; "></div>ActionFactory.DELETE需要其他视图或~辑器中注册全局的句柄,可以通过如下Ҏ使用editorSite.getActionBars().setGlobalActionHandler(<div><div><span style="white-space:pre"> </span>ActionFactory.DELETE.getId(), new CustomAction(););</div></div><img src ="http://www.aygfsteel.com/aoneany/aggbug/371717.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2012-03-12 13:27 <a href="http://www.aygfsteel.com/aoneany/articles/371717.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RCPE序中设|编辑器兌ActionSet昄菜单栏的位置http://www.aygfsteel.com/aoneany/articles/371412.html沙漠中的?/dc:creator>沙漠中的?/author>Wed, 07 Mar 2012 08:13:00 GMThttp://www.aygfsteel.com/aoneany/articles/371412.htmlhttp://www.aygfsteel.com/aoneany/comments/371412.htmlhttp://www.aygfsteel.com/aoneany/articles/371412.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/371412.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/371412.htmlpath=edit属性,才能EditorPart兌的菜单显C的中间?img src ="http://www.aygfsteel.com/aoneany/aggbug/371412.html" width = "1" height = "1" />

]]>
在CXF中如何传递抽象对?/title><link>http://www.aygfsteel.com/aoneany/articles/371010.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Wed, 29 Feb 2012 08:29:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/371010.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/371010.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/371010.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/371010.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/371010.html</trackback:ping><description><![CDATA[先定一个适配器类Q承XmlAdapter,可以抽象类转换为可以识别的传输对象<br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> UserTOAdapter </span><span style="color: #0000FF; ">extends</span><span style="color: #000000; "> XmlAdapter</span><span style="color: #000000; "><</span><span style="color: #000000; ">TO, User</span><span style="color: #000000; ">></span><span style="color: #000000; "> {<br /> <br />     @Override<br />     </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> User unmarshal(TO to) </span><span style="color: #0000FF; ">throws</span><span style="color: #000000; "> Exception {<br />         </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> (User)to;<br />     }<br /> <br />     @Override<br />     </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> TO marshal(User user) </span><span style="color: #0000FF; ">throws</span><span style="color: #000000; "> Exception {<br />         </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> (TO)user;<br />     }<br /> <br /> }<br /> </span></div> <div>在WebService接口中定义参数{换的ҎQ如?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">@WebService<br /></span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">interface</span><span style="color: #000000; "> TypeConvert {<br />    @WebMethod<br />    @XmlJavaTypeAdapter(UserTOAdapter.</span><span style="color: #0000FF; ">class</span><span style="color: #000000; ">)<br />    User addUser(User user);<br />}</span></div><br /><br /></div><img src ="http://www.aygfsteel.com/aoneany/aggbug/371010.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2012-02-29 16:29 <a href="http://www.aygfsteel.com/aoneany/articles/371010.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring的DispatcherServlet如何注册多个servlet的xml文ghttp://www.aygfsteel.com/aoneany/articles/366846.html沙漠中的?/dc:creator>沙漠中的?/author>Tue, 20 Dec 2011 07:44:00 GMThttp://www.aygfsteel.com/aoneany/articles/366846.htmlhttp://www.aygfsteel.com/aoneany/comments/366846.htmlhttp://www.aygfsteel.com/aoneany/articles/366846.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/366846.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/366846.html在web.xml中,可以通过*号匹配多?servlet.xml的文件。具体格式如下:

 

    <servlet>
        
<servlet-name>test</servlet-name>
        
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        
<init-param>  
            
<description>加蝲/WEB-INF/spring-mvc/目录下的所有XML作ؓSpring MVC的配|文?/span></description>  
            
<param-name>contextConfigLocation</param-name>  
            
<param-value>/WEB-INF/*-servlet.xml</param-value>  
        
</init-param>  
        
<load-on-startup>1</load-on-startup>
    
</servlet>
    
<servlet-mapping>
        
<servlet-name>test</servlet-name>
        
<url-pattern>*.do</url-pattern>
    
</servlet-mapping>

表示加蝲/WEB-INF/下所有以-servlet.xmll尾的xml文g



]]>
spring中通过代码注册beanhttp://www.aygfsteel.com/aoneany/articles/365062.html沙漠中的?/dc:creator>沙漠中的?/author>Mon, 28 Nov 2011 14:24:00 GMThttp://www.aygfsteel.com/aoneany/articles/365062.htmlhttp://www.aygfsteel.com/aoneany/comments/365062.htmlhttp://www.aygfsteel.com/aoneany/articles/365062.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/365062.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/365062.htmlpublic static void main(String[] args)   
{   
 DefaultListableBeanFactory beanregistry
=new DefaultListableBeanFactory();   
 BeanFactory container
=(BeanFactory)bindViaCode(beanRegistry);   
 FXNewsProvider newsProvider
=(FXNewsProvider)container.getBean("djNewsProvider");   
 newsProvider.getAndPersistNews();   
}
   
public static BeanFactory bindViaCode(BeanDefinitionRegistry registry)   
{   
  AbstractBeanDefinition newsProvider
=new RootBeanDefintion(FXNewsProvider.class,true);   
AbstractBeanDefinition newsListener
=new RootBeanDefintion(DowJonesNewListerner.class,true);   
AbstractBeanDefinition newsPersister
=new RootBeanDefintion(DowJonesNewPersister.class,true);   
//bean定义到注册容器中   
registry.registerBeanDefinition("djNewsProvider",newsProvider);   
registry.registerBeanDefinition(
"djListener",newsListener);   
registry.registerBeanDefinition(
"djPersister",newsPersister);   
//指定依赖关系   
//通过构造函数方式注?nbsp;  
ConstructorArgumentValues argValues=new ConstructorArgumentValues();   
argValues.addIndexedArgumentValue(
0,newsListener);   
argValues.addIndexedArgumentValue(
1,newsPresister);   
newsProvier.setConstructorArgumentValues(argValues);   
//通过setter方式注入   
MutablepropertyValues propertyValues=new MutablePropertyValues();   
propertyValues.addPropertyValue(
new ropertyValue("newsListener",newsListener));   
propertyValues.addPropertyValue(
new ropertyValue("newsPresister",newsPresister));   
newsProvider.setPropertyValues(propertyValues);   
//l定完成   
return (BeanFactory)registry;   
}
   
}


]]>
位移q制q算http://www.aygfsteel.com/aoneany/articles/348889.html沙漠中的?/dc:creator>沙漠中的?/author>Sat, 23 Apr 2011 13:58:00 GMThttp://www.aygfsteel.com/aoneany/articles/348889.htmlhttp://www.aygfsteel.com/aoneany/comments/348889.htmlhttp://www.aygfsteel.com/aoneany/articles/348889.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/348889.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/348889.html带符号右U?题:Q?5 >> 2 = -4

15原码:   00000000 00000000 00000000 00001111 //32?二进?br /> 反码Q?   11111111 11111111 11111111 11110000 //0?,1变O
补码Q?   11111111 11111111 11111111 11110001 //最后位?,-15二进?br /> 右移2位:  11111111 11111111 11111111 11111100 //双丢弃2?前面30位保?左边?
取反Q?nbsp;     00000000 00000000 00000000 00000011 //0?,1变O
Q1:                                       3+1
l果:                                     Q-Q?//负号保留,十进?/p>


带符号左U?? 10 << 2 = 40
10 补码:    00000000 00000000 00000000 00001010 //32?二进?br /> 左移2?    00000000 00000000 00000000 00101000 //左边丢弃2?双?
l果:                                        40 //十进?/p>

 

无符号右U?题:Q?321 >>> 30 = 3
4321原码:         00000000 00000000 00010000 11100011 //32?二进?br /> 反码Q?          11111111 11111111 11101111 00011100 //0?,1变O
补码Q?          11111111 11111111 11101111 00011101 //最后位?,-4321二进?br /> 无符号右U?0位:  00000000 00000000 00000000 00000011 //双丢弃30?前面二位保留,左边?
l果:                                                3 //十进?/p>


& 位逻辑?题:44 & 21 = 4
44 补码:    00000000 00000000 00000000 00101100 //32?二进?br /> 21 补码:    00000000 00000000 00000000 00010101 //32?二进?br /> & q算:     00000000 00000000 00000000 00000100 //对应的两个二q制位均??l果位才? 否则?
l果:                                         4 //十进?nbsp;  
                                

| 位逻辑?题:9 | 5 = 13
9 补码:    00000000 00000000 00000000 00001001 //32?二进?br /> 5 补码:    00000000 00000000 00000000 00000101 //32?二进?br /> | q算:    00000000 00000000 00000000 00001101 //对应的二个二q制位有一个ؓ1Ӟl果位就?
l果:                                       13 //十进?


^ 位逻辑异或 ? 9 ^ 5 = 12
9 补码:    00000000 00000000 00000000 00001001 //32?二进?br /> 5 补码:    00000000 00000000 00000000 00000101 //32?二进?br /> | q算:    00000000 00000000 00000000 00001100 //对应的二q制位相异时Q结果ؓ1
l果:                                       12 //十进?/p>


~ 位逻辑?? ~9 = -10
9 补码:    00000000 00000000 00000000 00001001 //32?二进?br /> ~ q算:    11111111 11111111 11111111 11110110 //最高位?表示Z个负?则进行取反加1
取反:      00000000 00000000 00000000 00001001 //32?二进?br /> Q1:                                      9+1 //32?二进?br /> l果:                                      -10 //十进?/p>


在计机pȝ中,数g律用补码来表C(存储Q?br /> 主要原因Q用补码,可以符号位和其它位l一处理Q同Ӟ减法也可按加法来处理。另外,两个用补
码表C的数相加时Q如果最高位Q符号位Q有q位Q则q位被舍弃?br /> 补码与原码的转换q程几乎是相同的?br /> 数值的补码表示也分两种情况Q?br /> Q?Q正数的补码Q与原码相同?br />       例如Q?9的补码是00001001?br /> Q?Q负数的补码Q符号位?Q其余位数绝对值的原码按位取反Q然后整个数??br />       例如Q?7的补码:因ؓ是负敎ͼ则符号位?#8220;1”,整个?0000111Q其?位ؓ-7的绝对?7的原?br />      0000111按位取反?111000Q再?Q所?7的补码是11111001?br /> 已知一个数的补码,求原码的操作分两U情况:
Q?Q如果补码的W号位ؓ“0”Q表C是一个正敎ͼ所以补码就是该数的原码?br /> Q?Q如果补码的W号位ؓ“1”Q表C是一个负敎ͼ求原码的操作可以是:W号位ؓ1Q其余各位取反,然后再整个数??br />      例如Q已知一个补码ؓ11111001Q则原码?0000111Q?7Q:因ؓW号位ؓ“1”Q表C是一个负敎ͼ所以该位不变,仍ؓ“1”Q其??111001取反后ؓ0000110Q再?Q所以是10000111?

 

转蝲Q?a >http://blog.csdn.net/zjp8023/archive/2009/05/29/4224121.aspx



]]>
您的数点到哪里Mhttp://www.aygfsteel.com/aoneany/articles/348753.html沙漠中的?/dc:creator>沙漠中的?/author>Thu, 21 Apr 2011 15:36:00 GMThttp://www.aygfsteel.com/aoneany/articles/348753.htmlhttp://www.aygfsteel.com/aoneany/comments/348753.htmlhttp://www.aygfsteel.com/aoneany/articles/348753.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/348753.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/348753.htmlJava 语言支持两种基本的Q点类型: float ?double Q以及与它们对应的包装类 Float ?Double 。它们都依据 IEEE 754 标准Q该标准?32 位Q点和 64 位双_ֺ点二进制小数定义了二进制标准?

IEEE 754 用科学记数法以底Cؓ 2 的小数来表示点数。IEEE 点数用 1 位表C数字的W号Q用 8 位来表示指数Q用 23 位来表示数Q即数部分。作为有W号整数的指数可以有正负之分。小数部分用二进Ӟ底数 2Q小数来表示Q这意味着最高位对应着??(2 -1)Q第二位对应着 ?(2 -2)Q依此类推。对于双_ֺ点敎ͼ?11 位表C指敎ͼ52 位表C尾数。IEEE 点值的格式如图 1 所C?


?1. IEEE 754 点数的格式
?1. IEEE 754 点数的格式

因ؓ用科学记数法可以有多U方式来表示l定数字Q所以要规范化QҎQ以便用底数?2 q且数点左边ؓ 1 的小数来表示Q按照需要调节指数就可以得到所需的数字。所以,例如Q数 1.25 可以表示为尾Cؓ 1.01Q指Cؓ 0Q?(-1) 0*1.01 2*2 0

?10.0 可以表示为尾Cؓ 1.01Q指Cؓ 3Q?(-1) 0*1.01 2*2 3

 

一个十q制数能否用二进制QҎ_表示Q关键在于小数部分。我们来看一个最单的数Q{QIEEE754能否_表示。按照乘?取整C的方法,有:

Q{QIEEE754

得到一个无限@环的二进制小?img title="Q{QIEEE754" border="0" alt="Q{QIEEE754" src="http://www.cnblogs.com/images/cnblogs_com/bossin/WindowsLiveWriter/IEEE754_B489/clip_image020.gif" width="177" height="24" real_src="http://www.cnblogs.com/images/cnblogs_com/bossin/WindowsLiveWriter/IEEE754_B489/clip_image020.gif" />Q用有限位无法表C无限@环小敎ͼ因此Q?img title="Q{QIEEE754" border="0" alt="Q{QIEEE754" src="http://www.cnblogs.com/images/cnblogs_com/bossin/WindowsLiveWriter/IEEE754_B489/clip_image016%5B1%5D.gif" width="44" height="24" real_src="http://www.cnblogs.com/images/cnblogs_com/bossin/WindowsLiveWriter/IEEE754_B489/clip_image016%5B1%5D.gif" />无法用IEEE 754点数精表C。从中也可以看到Q由?/p>

Q{QIEEE754Q?/p>

q四个数也无法精表C。同理:

Q{QIEEE754

也无法用IEEE 754点数精表C?/p>

在以0.1~0.9l尾?个小CQ只?.5可以_表示Q(如)Q{QIEEE754Q而其他均无法q行_转换?/p>

]]>
遍历查找性能试报告QMap,Array,RBTreeQ?/title><link>http://www.aygfsteel.com/aoneany/articles/348346.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Fri, 15 Apr 2011 05:39:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/348346.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/348346.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/348346.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/348346.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/348346.html</trackback:ping><description><![CDATA[  <p><span style="font-family: 宋体">  </p> <p><span style="font-family: 宋体">上次只测试查询的性能Q而且都是在最优的情况下进行,没有考虑条他情况Q这ơ重C改了试用例Q把整个试的各个过E描q出来(加蝲Q排序,查找的效率)?/span></p> <p><strong><span style="font-family: 宋体">场景Q?/span></strong><span style="font-family: 宋体">随机生成</span>5<span style="font-family: 宋体">百万条不同的记录Q而每条记录不存在相同的情c现在将q?/span>5<span style="font-family: 宋体">百万条记录在不同的情况下q行试。测试结果如?/span></p> <p>1<span style="font-family: 宋体">?/span>5<span style="font-family: 宋体">百万条记录,d查询</span>50<span style="font-family: 宋体">万次Q查询前</span>50<span style="font-family: 宋体">万条记录Q?/span></p> <p><span style="font-family: 宋体">数组性能试加蝲p</span>:<strong><span style="color: red">6.11</strong></span><span style="font-family: 宋体">U?/span></p> <p><span style="font-family: 宋体">数组性能试排序p</span>:<strong><span style="color: red">18.313</strong></span><span style="font-family: 宋体">U?/span></p> <p><span style="font-family: 宋体">数组性能试查找p</span>:<strong><span style="color: red">3.297</strong></span><span style="font-family: 宋体">U?/span></p> <p><span style="font-family: 宋体">数组性能试p?/span>:<strong><span style="color: red">27.72</strong></span><span style="font-family: 宋体">U?/span></p> <p><span style="font-family: 宋体">数组性能试d?/span>:<strong><span style="color: red">100005888</strong> </span><span style="font-family: 宋体">字节</span></p> <p>RBTree<span style="font-family: 宋体">性能试加蝲p</span>:<strong><span style="color: red">53.644</strong></span><span style="font-family: 宋体">U?/span></p> <p>RBTree<span style="font-family: 宋体">性能试查找p?/span>:<strong><span style="color: red">2.86</strong></span><span style="font-family: 宋体">U?/span></p> <p>RBTree<span style="font-family: 宋体">性能试p?/span>:<strong><span style="color: red">56.504</strong></span><span style="font-family: 宋体">U?/span></p> <p>RBTREE<span style="font-family: 宋体">性能试共占?/span>:<strong><span style="color: red">240004864</strong> </span><span style="font-family: 宋体">字节</span></p> <p>MAP<span style="font-family: 宋体">性能试加蝲p</span>:<strong><span style="color: red">7.282</strong></span><span style="font-family: 宋体">U?/span></p> <p>MAP<span style="font-family: 宋体">性能试查找p</span>:<strong><span style="color: red">0.11</strong></span><span style="font-family: 宋体">U?/span></p> <p>MAP<span style="font-family: 宋体">性能试p?/span>:<strong><span style="color: red">7.392</strong></span><span style="font-family: 宋体">U?/span></p> <p>MAP<span style="font-family: 宋体">性能试</span> <span style="font-family: 宋体">共占?/span>:<strong><span style="color: red">173554048</strong> </span><span style="font-family: 宋体">字节</span></p> <p>2<span style="font-family: 宋体">?/span>5<span style="font-family: 宋体">百万条记录,d查询</span>5<span style="font-family: 宋体">百万ơ(每条记录查询一ơ)</span></p> <p><span style="font-family: 宋体">数组性能试加蝲p</span>:<strong><span style="color: red">6.078</strong></span><span style="font-family: 宋体">U?/span></p> <p><span style="font-family: 宋体">数组性能试排序p</span>:<strong><span style="color: red">17.642</strong></span><span style="font-family: 宋体">U?/span></p> <p><span style="font-family: 宋体">数组性能试查找p</span>:<strong><span style="color: red">33.049</strong></span><span style="font-family: 宋体">U?/span></p> <p><span style="font-family: 宋体">数组性能试p?/span>:<strong><span style="color: red">56.769</strong></span><span style="font-family: 宋体">U?/span></p> <p><span style="font-family: 宋体">数组性能试d占用</span> = <strong><span style="color: red">100005552</strong> </span><span style="font-family: 宋体">字节</span></p> <p>RBTree<span style="font-family: 宋体">性能试加蝲p</span>:<strong><span style="color: red">54.8</strong></span><span style="font-family: 宋体">U?/span></p> <p>RBTree<span style="font-family: 宋体">性能试查找p?/span>:<strong><span style="color: red">34.581</strong></span><span style="font-family: 宋体">U?/span></p> <p>RBTree<span style="font-family: 宋体">性能试p?/span>:<strong><span style="color: red">89.381</strong></span><span style="font-family: 宋体">U?/span></p> <p>RBTREE<span style="font-family: 宋体">性能试共占?/span> = <strong><span style="color: red">240005024</strong> </span><span style="font-family: 宋体">字节</span></p> <p>MAP<span style="font-family: 宋体">性能试加蝲p</span>:<strong><span style="color: red">6.501</strong></span><span style="font-family: 宋体">U?/span></p> <p>MAP<span style="font-family: 宋体">性能试查找p</span>:<strong><span style="color: red">0.937</strong></span><span style="font-family: 宋体">U?/span></p> <p>MAP<span style="font-family: 宋体">性能试p?/span>:<strong><span style="color: red">7.438</strong></span><span style="font-family: 宋体">U?/span></p> <p>MAP<span style="font-family: 宋体">性能试</span> <span style="font-family: 宋体">共占?/span>=<strong><span style="color: red">173553888</strong> </span><span style="font-family: 宋体">字节</span></p> <p>3<span style="font-family: 宋体">?/span>5<span style="font-family: 宋体">百万条记录,d查询</span>5<span style="font-family: 宋体">千万ơ(每条数据查询</span>10<span style="font-family: 宋体">ơ)</span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试加蝲p</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">6.11</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试排序p</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">17.861</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试查找p</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">331.224</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试p?/span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">355.195</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试d占用</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">99990456</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">字节</span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 'Courier New'">RBTree</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试加蝲p</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">53.097</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 'Courier New'">RBTree</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试查找p?/span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">345.866</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 'Courier New'">RBTree</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试p?/span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">398.963</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 'Courier New'">RBTREE</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试共占?/span><span style="font-size: 10pt; color: black; font-family: 'Courier New'"> = </span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">240005248 </span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">字节</span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 'Courier New'">MAP</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试加蝲p</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">7.235</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 'Courier New'">MAP</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试查找p</span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">9.375</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 'Courier New'">MAP</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试p?/span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">16.61</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> <p style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 'Courier New'">MAP</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试</span><span style="font-size: 10pt; color: black; font-family: 宋体">共占?/span><span style="font-size: 10pt; color: black; font-family: 'Courier New'">:</span><strong><span style="font-size: 10pt; color: red; font-family: 'Courier New'">173554048</span></strong><span style="font-size: 10pt; color: black; font-family: 宋体">字节<br /> <br /> 试文g地址Q?nbsp; <a href="/Files/aoneany/search2.rar">/Files/aoneany/search2.rar</a><br /> <br /> ================================================================<br />     </p> <p class="MsoNormal"><span style="color: #1f497d; font-family: 宋体">前面的测试算法中Q有一个地方偷懒(直接使用</span><span lang="EN-US" style="color: #1f497d">String.CompareTo</span><span style="color: #1f497d; font-family: 宋体">Ҏq行比较Q导致查询效率很差,现在对其q行优化Q测试后的数据ؓQ?/span><span lang="EN-US" style="color: #1f497d"><o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" style="color: #1f497d"><o:p> </o:p></span></p> <p class="MsoNormal"><span lang="EN-US">5</span><span style="font-family: 宋体">百万条记录,d查询</span><span lang="EN-US">5</span><span style="font-family: 宋体">百万ơ(每条记录查询一ơ)</span><span lang="EN-US" style="color: #1f497d"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试加蝲p</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<span style="color: red"><strong>1.016</strong></span></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试排序p</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<span style="color: red"><strong>14.485</strong></span></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试查找p</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<span style="color: red"><strong>0.703</strong></span></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span style="font-size: 10pt; color: black; font-family: 宋体">数组性能试p?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<strong style="color: red">16.204</strong></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p> </o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">RBTree</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试加蝲p</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<strong style="color: red">20.705</strong></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">RBTree</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试查找p?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<strong style="color: red">3.75</strong></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">RBTree</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试p?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<strong style="color: red">24.455</strong></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p> </o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">MAP</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试加蝲p</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<strong style="color: red">3.875</strong></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">MAP</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试查找p</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<strong style="color: red">1.516</strong></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'"><o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left" align="left"><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">MAP</span><span style="font-size: 10pt; color: black; font-family: 宋体">性能试p?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Courier New'">:<strong style="color: red">5.391</strong></span><span style="font-size: 10pt; color: black; font-family: 宋体">U?/span></p> </span></span> <img src ="http://www.aygfsteel.com/aoneany/aggbug/348346.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2011-04-15 13:39 <a href="http://www.aygfsteel.com/aoneany/articles/348346.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse部vTomcat服务旉要注意的地方http://www.aygfsteel.com/aoneany/articles/343722.html沙漠中的?/dc:creator>沙漠中的?/author>Fri, 28 Jan 2011 10:01:00 GMThttp://www.aygfsteel.com/aoneany/articles/343722.htmlhttp://www.aygfsteel.com/aoneany/comments/343722.htmlhttp://www.aygfsteel.com/aoneany/articles/343722.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/343722.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/343722.html在classpath的user Entities节点下添加tomcat的jar包时Q需要引入bin目录下的tomcat-juli.jar包,或lib目录下所有的jar包?/p>

]]>
字符?Thinking in JavaMW记http://www.aygfsteel.com/aoneany/articles/304020.html沙漠中的?/dc:creator>沙漠中的?/author>Sat, 28 Nov 2009 05:54:00 GMThttp://www.aygfsteel.com/aoneany/articles/304020.htmlhttp://www.aygfsteel.com/aoneany/comments/304020.htmlhttp://www.aygfsteel.com/aoneany/articles/304020.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/304020.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/304020.htmlString对象是不可变?/p>

Scanner扫描字符串对象?/p>

备注Q?/p>

在java~译好的class文g?有个区域UCؓConstant Pool,他是一个由数组l成的表,cd
为cp_info constant_pool[],用来存储E序中用的各种帔R,包括Class/String/Integer{各
U基本Java数据cd,详情参见The Java Virtual Machine Specification
4.4章节.

对于Constant Pool,表的基本通用l构?
cp_info {
        u1 tag;
        u1 info[];
}

tag是一个数?用来表示存储的常量的cd,例如8表示Stringcd,5表示Longcd,info[]Ҏ
cd码tag的不同会发生相应变化.
对于Stringcd,表的l构?
CONSTANT_String_info {
        u1 tag;
        u2 string_index;
}
tag固定?,string_index是字W串内容信息,cd?
CONSTANT_Utf8_info {
        u1 tag;
        u2 length;
        u1 bytes[length];
}
tag固定?,length为字W串的长?bytes[length]为字W串的内?

代码样例
(以下代码在jdk6中编?
Z详细理解Constant Pool的结?我们参看一些代?
    String s1
= "sss111";
    String s2
= "sss222";
    System.out.println(s1
+ " " + s2);
׃
"sss111"?/span>"sss222"都是字符串常?在编译期已l创建好了存储在class文g?
在编译后的class文g中会存在q?个常量的对应表示:
08 00 11 01 00 06 73 73 73 31 31 31 08 00 13 01 ; ......sss111....
00 06 73 73 73 32 32 32                         ; ..sss222

Ҏ上面说的String帔Rl构,我们分析一?br /> 开始的08为CONSTANT_String_infol构中的tag,?1应该是它的相对引?01?br /> CONSTANT_Utf8_info的tag,06为对应字W串的长?
73 73 73 31 31 31为字W串?br /> 应的~码,接着分析,会发现后面的是对?/span>"sss222"的存储结?

l过上面分析,我们知道?1?3是两个字W串的相对引?可以修改class文g
来修Ҏ印的内容,把class文g中的
00 6E 00 04 00 03 00 00 00 24 12 10 4C 12 12 4D
Ҏ
00 6E 00 04 00 03 00 00 00 24 12 10 4C 12 10 4D
E序׃输出sss111 sss111,而不是和原程序一栯出sss111 sss222,因ؓ?br /> 们把?/span>"sss222"的相对引?2Ҏ了对"sss111"的相对引?0.

------------分割U?br /> public class Test {
   
public static void main(String[] args) {
        String s1
= "sss111";
        String s2
= "sss111";
    }
}

在上面程序中存在2个相同的帔R
"sss111",对于n个值相同的String帔R,在Constant Pool?br /> 只会创徏一?所以在~译好的class文g?我们只能扑ֈ一个对"sss111"的表C?
000000abh:
08 00 11 01 00 06 73 73 73 31 31 31             ; ......sss111

在程序执行的时?Constant Pool会储存在Method Area,而不是heap?

另外,对于
""内容为空的字W串帔R,会创Z个长度ؓ0,内容为空的字W串攑ֈConstant Pool?
而且Constant Pool在运行期是可以动态扩展的.

关于Stringcȝ说明

1.String使用private final char value[]来实现字W串的存?也就是说String对象创徏之后,׃?br /> 再修Ҏ对象中存储的字符串内?是因ؓ如此,才说Stringcd是不可变?immutable).

2.StringcL一个特D的创徏Ҏ,是使用""双引h创徏.例如new String("i am")实际创徏??br /> String对象,一个是"i am"通过""双引号创建的,另一个是通过new创徏?只不q他们创建的时期不同,
一个是~译?一个是q行?/span>!

3.java对Stringcd重蝲?/span>+操作W?可以直接使用+对两个字W串q行q接.

4.q行期调用Stringcȝintern()Ҏ可以向String Pool中动态添加对?

String的创建方?/strong>

一般有如下几种
1.直接使用""引号创徏.
2.使用new String()创徏.
3.使用new String("someString")创徏以及其他的一些重载构造函数创?
4.使用重蝲的字W串q接操作W?/span>+创徏.

面试?

String s1 = new String("s1") ;
String s2
= new String("s1") ;
上面创徏了几个String对象
?
{案:3?,~译期Constant Pool中创??q行期heap中创??




]]>
java定位打印Q如Q超市,据打印Q?/title><link>http://www.aygfsteel.com/aoneany/articles/287601.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Tue, 21 Jul 2009 03:25:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/287601.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/287601.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/287601.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/287601.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/287601.html</trackback:ping><description><![CDATA[<p>Java自从问世以来在各斚w发展q速,但是一直以来,打印输出是java最q斚w。事实上Qjava1.0不支持Q何打印功能。Java1.1?java.awt包里包含了一个叫做PrintJob的类Q但是这个类提供的打印功能十分粗p和不可靠。当java1.2问世Q它围绕 PrinterJob设计了一个完整独立的打印机制Q叫做java2D printing APIQ,q且在java.awt.print包里定义了一些新的类和接口。这些得基于PrintJob打印机制Q就是AWT printingQ基本荒废,虽然PrintJob从未被抨击而且臛_在这文章里仍然是一个提供技术的cR?</p> <p>  在J2SE1.3里当PrintJob的功能扩展到可以通过在java.awt包里的JobAttributes 和PageAttributes两个c设定工E和面的属性时发生了一些额外的改变。随着J2SE1.3的发布,打印功能相应的得C完善Q但是在混合使用q两U完全不同的打印机制的时候仍然存在一些问题。比如,q两U机制用java.awt.Graphicsq个cȝ一个接口来展现打印内容Q意味着所有要打印的东襉K必须用一张图片表C。另外,完善的PrintJob提供了很有限的工E相兛_性的讄Q这两种机制都没有办法通过E序来选择目标打印机?</p> <p>  Java打印最大的改变来自于J2SE1.4的发布带来的Java打印服务API。这个第三代Java打印支持接口H破了先前提到的局限性。因为新的API是以前两种旧的打印机制定义的功能函数的一个父集?</p> <p>下面是我通过q些API写的定位打印CZ代码Q希望对用java实现打印的朋友有一定的帮助Q?<br /> 在CentOS4.4Qjdk1.6下测试通过?</p> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /><span style="color: #0000ff">import</span><span style="color: #000000"> java.awt.Color; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.awt.Font; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.awt.Graphics; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.awt.Graphics2D; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.awt.print.PageFormat; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.awt.print.Printable; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.awt.print.PrinterException; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.Doc; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.DocFlavor; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.DocPrintJob; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.PrintException; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.PrintService; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.PrintServiceLookup; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.SimpleDoc; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.attribute.DocAttributeSet; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.attribute.HashDocAttributeSet; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.attribute.HashPrintRequestAttributeSet; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.attribute.PrintRequestAttributeSet; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.print.attribute.standard.MediaSizeName; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.swing.JOptionPane; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /> <img id="Codehighlighter1_746_799_Open_Image" onclick="this.style.display='none'; Codehighlighter1_746_799_Open_Text.style.display='none'; Codehighlighter1_746_799_Closed_Image.style.display='inline'; Codehighlighter1_746_799_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_746_799_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_746_799_Closed_Text.style.display='none'; Codehighlighter1_746_799_Open_Image.style.display='inline'; Codehighlighter1_746_799_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" /></span><span id="Codehighlighter1_746_799_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/** */</span><span id="Codehighlighter1_746_799_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />* java定位打印Q把打印内容打到指定的地斏V?nbsp;<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />* <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />* </span><span style="color: #808080">@author</span><span style="color: #008000"> lyb <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />* <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" /></span><span style="color: #008000">*/</span></span><span style="color: #000000"> <br /> <img id="Codehighlighter1_848_3870_Open_Image" onclick="this.style.display='none'; Codehighlighter1_848_3870_Open_Text.style.display='none'; Codehighlighter1_848_3870_Closed_Image.style.display='inline'; Codehighlighter1_848_3870_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_848_3870_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_848_3870_Closed_Text.style.display='none'; Codehighlighter1_848_3870_Open_Image.style.display='inline'; Codehighlighter1_848_3870_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" /></span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> LocatePrint </span><span style="color: #0000ff">implements</span><span style="color: #000000"> Printable </span><span id="Codehighlighter1_848_3870_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_848_3870_Open_Text"><span style="color: #000000">{ <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    </span><span style="color: #0000ff">private</span><span style="color: #000000"> </span><span style="color: #0000ff">int</span><span style="color: #000000"> PAGES </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    </span><span style="color: #0000ff">private</span><span style="color: #000000"> String printStr; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /> <img id="Codehighlighter1_915_1037_Open_Image" onclick="this.style.display='none'; Codehighlighter1_915_1037_Open_Text.style.display='none'; Codehighlighter1_915_1037_Closed_Image.style.display='inline'; Codehighlighter1_915_1037_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_915_1037_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_915_1037_Closed_Text.style.display='none'; Codehighlighter1_915_1037_Open_Image.style.display='inline'; Codehighlighter1_915_1037_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />    </span><span id="Codehighlighter1_915_1037_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/**/</span><span id="Codehighlighter1_915_1037_Open_Text"><span style="color: #008000">/*</span><span style="color: #008000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />     * Graphic指明打印的图形环境;PageFormat指明打印|式(面大小以点量单位, <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />     * 1点ؓ1英寸?/72Q?英寸?5.4毫米。A4U大致ؓ595×842点)Qpage指明号 <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />     </span><span style="color: #008000">*/</span></span><span style="color: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">int</span><span style="color: #000000"> print(Graphics gp, PageFormat pf, </span><span style="color: #0000ff">int</span><span style="color: #000000"> page) <br /> <img id="Codehighlighter1_1136_2367_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1136_2367_Open_Text.style.display='none'; Codehighlighter1_1136_2367_Closed_Image.style.display='inline'; Codehighlighter1_1136_2367_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_1136_2367_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1136_2367_Closed_Text.style.display='none'; Codehighlighter1_1136_2367_Open_Image.style.display='inline'; Codehighlighter1_1136_2367_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />            </span><span style="color: #0000ff">throws</span><span style="color: #000000"> PrinterException </span><span id="Codehighlighter1_1136_2367_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_1136_2367_Open_Text"><span style="color: #000000">{ <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        Graphics2D g2 </span><span style="color: #000000">=</span><span style="color: #000000"> (Graphics2D) gp; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        g2.setPaint(Color.black); </span><span style="color: #008000">//</span><span style="color: #008000"> 讄打印颜色为黑?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">if</span><span style="color: #000000"> (page </span><span style="color: #000000">>=</span><span style="color: #000000"> PAGES) </span><span style="color: #008000">//</span><span style="color: #008000"> 当打印页号大于需要打印的总页数时Q打印工作结?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">            </span><span style="color: #0000ff">return</span><span style="color: #000000"> Printable.NO_SUCH_PAGE; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        g2.translate(pf.getImageableX(), pf.getImageableY());</span><span style="color: #008000">//</span><span style="color: #008000"> 转换坐标Q确定打印边?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        Font font </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> Font(</span><span style="color: #000000">"</span><span style="color: #000000">宋体</span><span style="color: #000000">"</span><span style="color: #000000">, Font.PLAIN, </span><span style="color: #000000">24</span><span style="color: #000000">);</span><span style="color: #008000">//</span><span style="color: #008000"> 创徏字体 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        g2.setFont(font); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        </span><span style="color: #008000">//</span><span style="color: #008000"> 打印当前|?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">int</span><span style="color: #000000"> printFontCount </span><span style="color: #000000">=</span><span style="color: #000000"> printStr.length();</span><span style="color: #008000">//</span><span style="color: #008000"> 打印字数 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">int</span><span style="color: #000000"> printFontSize </span><span style="color: #000000">=</span><span style="color: #000000"> font.getSize();</span><span style="color: #008000">//</span><span style="color: #008000"> Font 的磅值大?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">float</span><span style="color: #000000"> printX </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">595</span><span style="color: #000000"> </span><span style="color: #000000">/</span><span style="color: #000000"> </span><span style="color: #000000">2</span><span style="color: #000000">; </span><span style="color: #008000">//</span><span style="color: #008000"> l定字符炚wQX面正中 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">float</span><span style="color: #000000"> printY </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">842</span><span style="color: #000000"> </span><span style="color: #000000">/</span><span style="color: #000000"> </span><span style="color: #000000">2</span><span style="color: #000000">; </span><span style="color: #008000">//</span><span style="color: #008000"> l定字符炚wQY面正中 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">float</span><span style="color: #000000"> printMX </span><span style="color: #000000">=</span><span style="color: #000000"> printX </span><span style="color: #000000">-</span><span style="color: #000000"> (printFontCount </span><span style="color: #000000">*</span><span style="color: #000000"> printFontSize </span><span style="color: #000000">/</span><span style="color: #000000"> </span><span style="color: #000000">2</span><span style="color: #000000">);</span><span style="color: #008000">//</span><span style="color: #008000"> 打印到正中间 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">float</span><span style="color: #000000"> printMY </span><span style="color: #000000">=</span><span style="color: #000000"> printY </span><span style="color: #000000">-</span><span style="color: #000000"> printFontSize </span><span style="color: #000000">/</span><span style="color: #000000"> </span><span style="color: #000000">2</span><span style="color: #000000">;</span><span style="color: #008000">//</span><span style="color: #008000"> 打印到正中间 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        g2.drawString(printStr, printMX, printMY); </span><span style="color: #008000">//</span><span style="color: #008000"> 具体打印每一行文本,同时走纸UM </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        g2.drawString(printStr, printMX </span><span style="color: #000000">-</span><span style="color: #000000"> printFontSize </span><span style="color: #000000">*</span><span style="color: #000000"> printFontCount, <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                printMY </span><span style="color: #000000">+</span><span style="color: #000000"> printFontSize); </span><span style="color: #008000">//</span><span style="color: #008000"> 具体打印每一行文本,同时走纸UM </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        g2.drawString(printStr, printMX </span><span style="color: #000000">+</span><span style="color: #000000"> printFontSize </span><span style="color: #000000">*</span><span style="color: #000000"> printFontCount, <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                printMY </span><span style="color: #000000">+</span><span style="color: #000000"> printFontSize); </span><span style="color: #008000">//</span><span style="color: #008000"> 具体打印每一行文本,同时走纸UM </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        g2.drawString(printStr, printMX, printMY </span><span style="color: #000000">+</span><span style="color: #000000"> printFontSize </span><span style="color: #000000">*</span><span style="color: #000000"> </span><span style="color: #000000">2</span><span style="color: #000000">); </span><span style="color: #008000">//</span><span style="color: #008000"> 具体打印每一行文本,同时走纸UM </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">return</span><span style="color: #000000"> Printable.PAGE_EXISTS; </span><span style="color: #008000">//</span><span style="color: #008000"> 存在打印|Ql打印工?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" /></span><span style="color: #000000">    }</span></span><span style="color: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000"> 打印内容到指定位|?nbsp;</span><span style="color: #008000"><br /> <img id="Codehighlighter1_2420_3739_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2420_3739_Open_Text.style.display='none'; Codehighlighter1_2420_3739_Closed_Image.style.display='inline'; Codehighlighter1_2420_3739_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_2420_3739_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2420_3739_Closed_Text.style.display='none'; Codehighlighter1_2420_3739_Open_Image.style.display='inline'; Codehighlighter1_2420_3739_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" /></span><span style="color: #000000">    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> printContent() </span><span id="Codehighlighter1_2420_3739_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_2420_3739_Open_Text"><span style="color: #000000">{ <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        printStr </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000">打印试内容</span><span style="color: #000000">"</span><span style="color: #000000">;</span><span style="color: #008000">//</span><span style="color: #008000"> 获取需要打印的目标文本 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span style="color: #0000ff">if</span><span style="color: #000000"> (printStr </span><span style="color: #000000">!=</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000"> </span><span style="color: #000000">&&</span><span style="color: #000000"> printStr.length() </span><span style="color: #000000">></span><span style="color: #000000"> </span><span style="color: #000000">0</span><span style="color: #000000">) </span><span style="color: #008000">//</span><span style="color: #008000"> 当打印内容不为空?nbsp;</span><span style="color: #008000"><br /> <img id="Codehighlighter1_2544_3449_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2544_3449_Open_Text.style.display='none'; Codehighlighter1_2544_3449_Closed_Image.style.display='inline'; Codehighlighter1_2544_3449_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_2544_3449_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2544_3449_Closed_Text.style.display='none'; Codehighlighter1_2544_3449_Open_Image.style.display='inline'; Codehighlighter1_2544_3449_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" /></span><span style="color: #000000">        </span><span id="Codehighlighter1_2544_3449_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_2544_3449_Open_Text"><span style="color: #000000">{ <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            PAGES </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000">; </span><span style="color: #008000">//</span><span style="color: #008000"> 获取打印总页?nbsp;<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #008000">//</span><span style="color: #008000"> 指定打印输出格式 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">            DocFlavor flavor </span><span style="color: #000000">=</span><span style="color: #000000"> DocFlavor.SERVICE_FORMATTED.PRINTABLE; <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #008000">//</span><span style="color: #008000"> 定位默认的打印服?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">            PrintService printService </span><span style="color: #000000">=</span><span style="color: #000000"> PrintServiceLookup <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                    .lookupDefaultPrintService(); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #008000">//</span><span style="color: #008000"> 创徏打印作业 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">            DocPrintJob job </span><span style="color: #000000">=</span><span style="color: #000000"> printService.createPrintJob(); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #008000">//</span><span style="color: #008000"> 讄打印属?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">            PrintRequestAttributeSet pras </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> HashPrintRequestAttributeSet(); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #008000">//</span><span style="color: #008000"> 讄U张大小,也可以新建MediaSizecL自定义大?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">            pras.add(MediaSizeName.ISO_A4); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            DocAttributeSet das </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> HashDocAttributeSet(); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #008000">//</span><span style="color: #008000"> 指定打印内容 </span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">            Doc doc </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> SimpleDoc(</span><span style="color: #0000ff">this</span><span style="color: #000000">, flavor, das); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #008000">//</span><span style="color: #008000"> 不显C打印对话框Q直接进行打印工?nbsp;</span><span style="color: #008000"><br /> <img id="Codehighlighter1_3286_3356_Open_Image" onclick="this.style.display='none'; Codehighlighter1_3286_3356_Open_Text.style.display='none'; Codehighlighter1_3286_3356_Closed_Image.style.display='inline'; Codehighlighter1_3286_3356_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_3286_3356_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_3286_3356_Closed_Text.style.display='none'; Codehighlighter1_3286_3356_Open_Image.style.display='inline'; Codehighlighter1_3286_3356_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" /></span><span style="color: #000000">            </span><span style="color: #0000ff">try</span><span style="color: #000000"> </span><span id="Codehighlighter1_3286_3356_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_3286_3356_Open_Text"><span style="color: #000000">{ <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                job.print(doc, pras); </span><span style="color: #008000">//</span><span style="color: #008000"> q行每一늚具体打印操作 </span><span style="color: #008000"><br /> <img id="Codehighlighter1_3384_3438_Open_Image" onclick="this.style.display='none'; Codehighlighter1_3384_3438_Open_Text.style.display='none'; Codehighlighter1_3384_3438_Closed_Image.style.display='inline'; Codehighlighter1_3384_3438_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_3384_3438_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_3384_3438_Closed_Text.style.display='none'; Codehighlighter1_3384_3438_Open_Image.style.display='inline'; Codehighlighter1_3384_3438_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" /></span><span style="color: #000000">            }</span></span><span style="color: #000000"> </span><span style="color: #0000ff">catch</span><span style="color: #000000"> (PrintException pe) </span><span id="Codehighlighter1_3384_3438_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_3384_3438_Open_Text"><span style="color: #000000">{ <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                pe.printStackTrace(); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />            }</span></span><span style="color: #000000"> <br /> <img id="Codehighlighter1_3456_3732_Open_Image" onclick="this.style.display='none'; Codehighlighter1_3456_3732_Open_Text.style.display='none'; Codehighlighter1_3456_3732_Closed_Image.style.display='inline'; Codehighlighter1_3456_3732_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_3456_3732_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_3456_3732_Closed_Text.style.display='none'; Codehighlighter1_3456_3732_Open_Image.style.display='inline'; Codehighlighter1_3456_3732_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />        }</span></span><span style="color: #000000"> </span><span style="color: #0000ff">else</span><span style="color: #000000"> </span><span id="Codehighlighter1_3456_3732_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_3456_3732_Open_Text"><span style="color: #000000">{ <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #008000">//</span><span style="color: #008000"> 如果打印内容为空Ӟ提示用户打印取?nbsp;</span><span style="color: #008000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">            JOptionPane.showConfirmDialog(</span><span style="color: #0000ff">null</span><span style="color: #000000">, <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                    </span><span style="color: #000000">"</span><span style="color: #000000">Sorry, Printer Job is Empty, Print Cancelled!</span><span style="color: #000000">"</span><span style="color: #000000">, <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                    </span><span style="color: #000000">"</span><span style="color: #000000">Empty</span><span style="color: #000000">"</span><span style="color: #000000">, JOptionPane.DEFAULT_OPTION, <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                    JOptionPane.WARNING_MESSAGE); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />        }</span></span><span style="color: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />    }</span></span><span style="color: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /> <img id="Codehighlighter1_3786_3866_Open_Image" onclick="this.style.display='none'; Codehighlighter1_3786_3866_Open_Text.style.display='none'; Codehighlighter1_3786_3866_Closed_Image.style.display='inline'; Codehighlighter1_3786_3866_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_3786_3866_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_3786_3866_Closed_Text.style.display='none'; Codehighlighter1_3786_3866_Open_Image.style.display='inline'; Codehighlighter1_3786_3866_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> main(String[] args) </span><span id="Codehighlighter1_3786_3866_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_3786_3866_Open_Text"><span style="color: #000000">{ <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        LocatePrint lp </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> LocatePrint(); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        lp.printContent(); <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />    }</span></span><span style="color: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" />}</span></span><span style="color: #000000"> </span></div> <img src ="http://www.aygfsteel.com/aoneany/aggbug/287601.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2009-07-21 11:25 <a href="http://www.aygfsteel.com/aoneany/articles/287601.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>最单的web服务器代?Java)http://www.aygfsteel.com/aoneany/articles/283248.html沙漠中的?/dc:creator>沙漠中的?/author>Fri, 19 Jun 2009 08:36:00 GMThttp://www.aygfsteel.com/aoneany/articles/283248.htmlhttp://www.aygfsteel.com/aoneany/comments/283248.htmlhttp://www.aygfsteel.com/aoneany/articles/283248.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/283248.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/283248.html阅读全文

]]>
|上看到Jtable中revalidate的说?/title><link>http://www.aygfsteel.com/aoneany/articles/268577.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Fri, 01 May 2009 17:18:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/268577.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/268577.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/268577.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/268577.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/268577.html</trackback:ping><description><![CDATA[<p><span style="font-size: 10pt">问题Q在找资料的时候看见JTabel用了setModelҎ后会加上一个revalidateҎQ?br /> 可我删了q个Ҏq没见有什么不同,h点!</span></p> <p><span style="font-size: 10pt">回答一:如果在application上有哪个component׃事g的触发而发生变化(比如QŞӞ的话Q这个方法就是用来更新当前程序的界面用的Q就相当于重M下界?</span></p> <p><span style="font-size: 10pt">回答?The original author comments, very clear:</span></p> <div class="wmqeeuq" id="quote"><br /> <span style="font-size: 10pt">I added a revalidate to JTable in the case that the table structure<br /> changes (columns/rows added/removed). This is necessary, since such an<br /> operation changes the size parameters of the JTable. It makes JTable<br /> behave more nicely in JScrollPane in an app I have here.</span></div><img src ="http://www.aygfsteel.com/aoneany/aggbug/268577.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2009-05-02 01:18 <a href="http://www.aygfsteel.com/aoneany/articles/268577.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JSpinner控制输入http://www.aygfsteel.com/aoneany/articles/260124.html沙漠中的?/dc:creator>沙漠中的?/author>Mon, 16 Mar 2009 14:40:00 GMThttp://www.aygfsteel.com/aoneany/articles/260124.htmlhttp://www.aygfsteel.com/aoneany/comments/260124.htmlhttp://www.aygfsteel.com/aoneany/articles/260124.html#Feedback2http://www.aygfsteel.com/aoneany/comments/commentRss/260124.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/260124.html最q用到JSpinnerQ但是不能控制用戯入?br /> 比如使用SpinnerNumberModelQ虽然设|了minQmaxQ但是还是可以输入超围的数|q可以输入字母,q些都应该是屏蔽掉的?br /> 采用了下面的Ҏ来解冻I

   JSpinner spinner = new JSpinner(new SpinnerNumberModel(value, min, max, 1));
   spinner.setBounds(x,y,width,height);
   // 控制输入
   JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner, "0");
   spinner.setEditor(editor);
   JFormattedTextField textField = ((JSpinner.NumberEditor) spinner.getEditor())
     .getTextField();
   textField.setEditable(true);
   DefaultFormatterFactory factory = (DefaultFormatterFactory) textField
     .getFormatterFactory();
   NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
   formatter.setAllowsInvalid(false);
   add(spinner);
 
q样输入׃可以输入字母了,因ؓ讄了输入格式。超q范围的数g是输入不q去的?br /> 其他的格式都应该是类似的吧,呵呵?br /> 只不q这里用的是NumberFormatter Q还有其他类型的?/p>

 

转蝲Q?a >http://yangke1120.spaces.live.com/blog/cns!77b62010246eabc6!168.entry



]]>
长整型数字格式{?/title><link>http://www.aygfsteel.com/aoneany/articles/251915.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Mon, 19 Jan 2009 08:42:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/251915.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/251915.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/251915.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/251915.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/251915.html</trackback:ping><description><![CDATA[<p><span style="font-size: 12pt"><span style="font-size: 8pt">我从数据库中取出一个数据(数据库中子段cd是numberQ?1449579Q但是我取出来要昄在jsp界面上是4.1449579E7Q用什么方法可以{换成41449579昄出来啊?Q{换成String格式可以,只要能显C出来就可以Q,求大家帮忙! </span></span></p> <p><span style="color: #ff6600"><br /> <span style="font-size: 12pt"><span style="font-size: 8pt">如果是通过JDBC的话Q在d该字D|用getLong()来读取,或者用getObject()然后调用其toString()函数卛_?nbsp;  <br /> 如果是用Hibernate的话Q在映射文g中将该字D|成Long或Integer卛_?/span></span></span></p> <p><span style="font-size: 12pt"><span style="font-size: 8pt; color: #ff00ff">new   java.text.DecimalFormat("########").format(12345678)</span></span></p> <p> </p> <img src ="http://www.aygfsteel.com/aoneany/aggbug/251915.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2009-01-19 16:42 <a href="http://www.aygfsteel.com/aoneany/articles/251915.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>POI错误“Unknown Ptg in Formula”解军_?/title><link>http://www.aygfsteel.com/aoneany/articles/250180.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Tue, 06 Jan 2009 13:36:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/250180.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/250180.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/250180.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/250180.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/250180.html</trackback:ping><description><![CDATA[此错误出现的原因是Excel中有中文定义的名U或者公? <p>Excel中定义的名称改ؓEnglish可以了</p> <img src ="http://www.aygfsteel.com/aoneany/aggbug/250180.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2009-01-06 21:36 <a href="http://www.aygfsteel.com/aoneany/articles/250180.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JSpinner的数据表C方?http://www.aygfsteel.com/aoneany/articles/244913.html沙漠中的?/dc:creator>沙漠中的?/author>Sun, 07 Dec 2008 15:07:00 GMThttp://www.aygfsteel.com/aoneany/articles/244913.htmlhttp://www.aygfsteel.com/aoneany/comments/244913.htmlhttp://www.aygfsteel.com/aoneany/articles/244913.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/244913.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/244913.html        ׃目需要以界面的Ş式表C带有小数点的数据,而且让用户可以输入数据而不q度。开始ƈ没有重视它,以ؓ只要把需要填入JSpinner的数据格式化可以。事实不是这Pl果JSpinner能够正确昄数据Q但是当调整数据时精度就发生了错误,怎么办呢Q到|上找找Q找到的都是数据格式化的ҎQ对我没有用Q也找了一些书c,׃JSpinner只是一个小的lgQ没有很详细的介l,看样子,想简单地依靠别h的帮助文档是不行了,需要看看JSpinner的源代码了。。。。?br />         q入JSpinner的源代码Q仔l分析了他的l成l构Q发现JSpinner昄不同的内容,采用不同的模型,像SpinnerDateModelQSpinnerListModelQSpinnerNumberModel。于是我惛_要对模型修改不就行吗Q最l我解决了下面是单的代码
            JSpinner spiner = new JSpinner();
            int max ,min;//数据的最大最小数点位数
            DecimalFormat format = ((JSpinner.NumberEditor) spiner.getEditor()).getFormat();
            format.setMaximumFractionDigits(max);
            format.setMinimumFractionDigits(min);
从上面代码看来非常简单,但是他确p了我几个时Q希望能l有同样问题的h们有所帮助。最后还要感谢项目组另外一位同事的帮助?/p>

转自:http://www.aygfsteel.com/hclown/articles/24383.html



]]>
Wrong type at constant pool index 异常http://www.aygfsteel.com/aoneany/articles/243990.html沙漠中的?/dc:creator>沙漠中的?/author>Tue, 02 Dec 2008 10:32:00 GMThttp://www.aygfsteel.com/aoneany/articles/243990.htmlhttp://www.aygfsteel.com/aoneany/comments/243990.htmlhttp://www.aygfsteel.com/aoneany/articles/243990.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/243990.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/243990.html重装了机器和myeclipseQ配|上以前的项目,启动myeclipse~译Q但是却出现如下异常

严重: Exception starting filter struts2
java.lang.IllegalArgumentException: Wrong type at constant pool index
 at sun.reflect.ConstantPool.getClassAt0(Native Method)
 at sun.reflect.ConstantPool.getClassAt(Unknown Source)
 at sun.reflect.annotation.AnnotationParser.parseAnnotation(Unknown Source)
 at sun.reflect.annotation.AnnotationParser.parseAnnotations(Unknown Source)
 at java.lang.reflect.Method.declaredAnnotations(Unknown Source)
 at java.lang.reflect.Method.getAnnotation(Unknown Source)
 at java.lang.reflect.AccessibleObject.isAnnotationPresent(Unknown Source)
 at org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:161)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

我把Myeclipse中tomcat下JDK配置改ؓjre6的版本,~译q行没有出异常了,但是记得以前也是使用?.5版本的,但是没有出现这U异常,现在怎么又出CQ同LJDK?
要JDK1.5.0.0升?.5.0.11以上的版可以了

]]>
URL中文参数gؕ码问题解?/title><link>http://www.aygfsteel.com/aoneany/articles/242211.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Mon, 24 Nov 2008 02:35:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/242211.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/242211.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/242211.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/242211.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/242211.html</trackback:ping><description><![CDATA[       <span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">最q在?/span><span lang="EN-US">Infoportal</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">集成</span><span lang="EN-US">URL</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">地址遇到一个小的问题Q在</span><span lang="EN-US">URL</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">地址上如果包含有中文参数Ӟ在浏览器地址上就会出Cؕ码,惛_了可能需要把</span><span lang="EN-US">URL</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">参数D{码,写了一D代码测试一下。但是发现有一个问题,是?/span><span lang="EN-US">java</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">字符串中?/span><span lang="EN-US">split</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当分?#8220;Q?#8221;Ӟ直接?/span><u><span lang="EN-US" style="font-size: 10pt; color: navy; font-family: 'Courier New'; mso-font-kerning: 0pt">java.util.regex.PatternSyntaxException</span></u><span lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-font-kerning: 0pt">: Dangling meta character '?' near index 0</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">异常Q原来这个是转义字符Q稍微修改了一下就好了</span> <p class="MsoNormal"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">E序</span></p> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" /><span style="color: #000000">String url</span><span style="color: #000000">=</span><span style="color: #000000">"</span><span style="color: #000000">http://servername?country=中国</span><span style="color: #000000">"</span><span style="color: #000000">;<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" />        String[] segment</span><span style="color: #000000">=</span><span style="color: #000000">url.split(</span><span style="color: #000000">"</span><span style="color: #000000">\\?</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" />        StringBuilder newUrl</span><span style="color: #000000">=</span><span style="color: #0000ff">new</span><span style="color: #000000"> StringBuilder();<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" />        newUrl.append(segment[</span><span style="color: #000000">0</span><span style="color: #000000">]</span><span style="color: #000000">+</span><span style="color: #000000">"</span><span style="color: #000000">?</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" />        String[] argStr</span><span style="color: #000000">=</span><span style="color: #000000">segment[</span><span style="color: #000000">1</span><span style="color: #000000">].split(</span><span style="color: #000000">"</span><span style="color: #000000">&</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img id="Codehighlighter1_234_584_Open_Image" onclick="this.style.display='none'; Codehighlighter1_234_584_Open_Text.style.display='none'; Codehighlighter1_234_584_Closed_Image.style.display='inline'; Codehighlighter1_234_584_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_234_584_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_234_584_Closed_Text.style.display='none'; Codehighlighter1_234_584_Open_Image.style.display='inline'; Codehighlighter1_234_584_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" alt="" />        </span><span style="color: #0000ff">for</span><span style="color: #000000">(</span><span style="color: #0000ff">int</span><span style="color: #000000"> i</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;i</span><span style="color: #000000"><</span><span style="color: #000000">argStr.length;i</span><span style="color: #000000">++</span><span style="color: #000000">)</span><span id="Codehighlighter1_234_584_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_234_584_Open_Text"><span style="color: #000000">{<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            String[] args</span><span style="color: #000000">=</span><span style="color: #000000"> argStr[i].split(</span><span style="color: #000000">"</span><span style="color: #000000">=</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            </span><span style="color: #0000ff">if</span><span style="color: #000000">(args</span><span style="color: #000000">==</span><span style="color: #0000ff">null</span><span style="color: #000000"> </span><span style="color: #000000">||</span><span style="color: #000000">args.length</span><span style="color: #000000">==</span><span style="color: #000000">0</span><span style="color: #000000">)<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                </span><span style="color: #0000ff">continue</span><span style="color: #000000">;<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            newUrl.append(args[</span><span style="color: #000000">0</span><span style="color: #000000">]);<br /> <img id="Codehighlighter1_372_557_Open_Image" onclick="this.style.display='none'; Codehighlighter1_372_557_Open_Text.style.display='none'; Codehighlighter1_372_557_Closed_Image.style.display='inline'; Codehighlighter1_372_557_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_372_557_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_372_557_Closed_Text.style.display='none'; Codehighlighter1_372_557_Open_Image.style.display='inline'; Codehighlighter1_372_557_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />            </span><span style="color: #0000ff">if</span><span style="color: #000000">(args[</span><span style="color: #000000">1</span><span style="color: #000000">]</span><span style="color: #000000">!=</span><span style="color: #0000ff">null</span><span style="color: #000000">)</span><span id="Codehighlighter1_372_557_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_372_557_Open_Text"><span style="color: #000000">{<br /> <img id="Codehighlighter1_382_479_Open_Image" onclick="this.style.display='none'; Codehighlighter1_382_479_Open_Text.style.display='none'; Codehighlighter1_382_479_Closed_Image.style.display='inline'; Codehighlighter1_382_479_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_382_479_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_382_479_Closed_Text.style.display='none'; Codehighlighter1_382_479_Open_Image.style.display='inline'; Codehighlighter1_382_479_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />                </span><span style="color: #0000ff">try</span><span style="color: #000000"> </span><span id="Codehighlighter1_382_479_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_382_479_Open_Text"><span style="color: #000000">{<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                    String argValue</span><span style="color: #000000">=</span><span style="color: #000000">URLEncoder.encode(args[</span><span style="color: #000000">1</span><span style="color: #000000">],</span><span style="color: #000000">"</span><span style="color: #000000">UTF-8</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                    newUrl.append(</span><span style="color: #000000">"</span><span style="color: #000000">=</span><span style="color: #000000">"</span><span style="color: #000000">+</span><span style="color: #000000">argValue);<br /> <img id="Codehighlighter1_520_552_Open_Image" onclick="this.style.display='none'; Codehighlighter1_520_552_Open_Text.style.display='none'; Codehighlighter1_520_552_Closed_Image.style.display='inline'; Codehighlighter1_520_552_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt="" /><img id="Codehighlighter1_520_552_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_520_552_Closed_Text.style.display='none'; Codehighlighter1_520_552_Open_Image.style.display='inline'; Codehighlighter1_520_552_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" alt="" />                }</span></span><span style="color: #000000"> </span><span style="color: #0000ff">catch</span><span style="color: #000000"> (UnsupportedEncodingException e) </span><span id="Codehighlighter1_520_552_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_520_552_Open_Text"><span style="color: #000000">{<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                    e.printStackTrace();<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />                }</span></span><span style="color: #000000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />            }</span></span><span style="color: #000000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />            newUrl.append(</span><span style="color: #000000">"</span><span style="color: #000000">&</span><span style="color: #000000">"</span><span style="color: #000000">);<br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" />        }</span></span><span style="color: #000000"><br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" alt="" />        System.out.println(newUrl.toString());</span></div> <p>原URLQ?a href="http://servername?country">http://servername?country</a>=中国</p> <p>转码后的URLQhttp://servername?country=%E4%B8%AD%E5%9B%BD&</p> <img src ="http://www.aygfsteel.com/aoneany/aggbug/242211.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2008-11-24 10:35 <a href="http://www.aygfsteel.com/aoneany/articles/242211.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA判断是否为鼠标右?/title><link>http://www.aygfsteel.com/aoneany/articles/241967.html</link><dc:creator>沙漠中的?/dc:creator><author>沙漠中的?/author><pubDate>Sat, 22 Nov 2008 07:35:00 GMT</pubDate><guid>http://www.aygfsteel.com/aoneany/articles/241967.html</guid><wfw:comment>http://www.aygfsteel.com/aoneany/comments/241967.html</wfw:comment><comments>http://www.aygfsteel.com/aoneany/articles/241967.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/aoneany/comments/commentRss/241967.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/aoneany/services/trackbacks/241967.html</trackback:ping><description><![CDATA[e.getClickCount()==1&&SwingUtilities.isRightMouseButton(e) <img src ="http://www.aygfsteel.com/aoneany/aggbug/241967.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/aoneany/" target="_blank">沙漠中的?/a> 2008-11-22 15:35 <a href="http://www.aygfsteel.com/aoneany/articles/241967.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>实现和jdk\bin\native2ascii.exe 同样的功?http://www.aygfsteel.com/aoneany/articles/241855.html沙漠中的?/dc:creator>沙漠中的?/author>Fri, 21 Nov 2008 07:24:00 GMThttp://www.aygfsteel.com/aoneany/articles/241855.htmlhttp://www.aygfsteel.com/aoneany/comments/241855.htmlhttp://www.aygfsteel.com/aoneany/articles/241855.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/241855.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/241855.htmlprivate String convertAscii(String str){
        String tmp;
        StringBuffer sb 
= new StringBuffer(1000);
        
char c;
        
int i, j;
        sb.setLength(
0);
        
for(i = 0;i<str.length();i++){
            c 
= str.charAt(i);
            
if (c > 255{
                sb.append(
"\\u");
                j 
= (c >>> 8);
                tmp 
= Integer.toHexString(j);
                
if (tmp.length() == 1) sb.append("0");
                sb.append(tmp);
                j 
= (c & 0xFF);
                tmp 
= Integer.toHexString(j);
                
if (tmp.length() == 1) sb.append("0");
                sb.append(tmp);
            }

            
else {
                sb.append(c);
            }


        }

        
return(new String(sb));
    }
 


]]>
以编E方式调?Apache Anthttp://www.aygfsteel.com/aoneany/articles/236923.html沙漠中的?/dc:creator>沙漠中的?/author>Mon, 27 Oct 2008 09:52:00 GMThttp://www.aygfsteel.com/aoneany/articles/236923.htmlhttp://www.aygfsteel.com/aoneany/comments/236923.htmlhttp://www.aygfsteel.com/aoneany/articles/236923.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/236923.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/236923.htmlhttp://www.ibm.com/developerworks/cn/websphere/library/techarticles/0502_gawor/0502_gawor.html

File buildFile = new File("build.xml");
Project p = new Project();
DefaultLogger consoleLogger = new DefaultLogger();
consoleLogger.setErrorPrintStream(System.err);
consoleLogger.setOutputPrintStream(System.out);
consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
p.addBuildListener(consoleLogger);
try {
p.fireBuildStarted();
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
p.fireBuildFinished(null);
} catch (BuildException e) {
p.fireBuildFinished(e);
}


]]>
制作javaE序启动文ghttp://www.aygfsteel.com/aoneany/articles/227983.html沙漠中的?/dc:creator>沙漠中的?/author>Tue, 09 Sep 2008 08:32:00 GMThttp://www.aygfsteel.com/aoneany/articles/227983.htmlhttp://www.aygfsteel.com/aoneany/comments/227983.htmlhttp://www.aygfsteel.com/aoneany/articles/227983.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/227983.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/227983.html start .\jre\bin\javaw --把jre包放在当前目录下
 -classpath .\bin; .\lib\commons-logging.jar  --执行的类和包?br /> -Djava.library.path=.\lib\ --cd路径
main --Mainc?br /> 完整的bat文gQ中间用I格来格开
@echo off
start .\jre\bin\javaw -classpath .\bin;.\lib\commons-logging.jar;.\lib\dom4j-1.6.1.jar -Djava.library.path=.\lib\ fecat.applicationcenter.FEcatApplication



]]>
在JavaMDIH口中加入滚动条http://www.aygfsteel.com/aoneany/articles/227467.html沙漠中的?/dc:creator>沙漠中的?/author>Sat, 06 Sep 2008 17:14:00 GMThttp://www.aygfsteel.com/aoneany/articles/227467.htmlhttp://www.aygfsteel.com/aoneany/comments/227467.htmlhttp://www.aygfsteel.com/aoneany/articles/227467.html#Feedback0http://www.aygfsteel.com/aoneany/comments/commentRss/227467.htmlhttp://www.aygfsteel.com/aoneany/services/trackbacks/227467.htmlJava设计MDIH口Q要用到JDesktopPanecdJInternalFramec,其应用可以看jdk自带的metaworks的例子。但用它实现的MDIH口在子H口Ud父窗口时Q没有滚动条Qؓ此必借助于JScrollPane才行Q如下:

        JDesktopPane desktop = new JDesktopPane ();
.
        JScrollPane scrollpane = new JScrollPane(desktop,
                JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        getContentPane().add(scrollpane);

但是一q行Q但内部H口Ud到边界外ҎQ我们预想中的滚动条q没有出玎ͼ怎么办?原来QJDesktopPane 加到JScrollPane后其大小只是JScrollPane的viewport的大,所以滚动条q没有出现。所以我们要惛_法让JDesktopPane 的Viewport的大跟随内部窗口的位置而改变大,l承一个JDesktopPane 吧:

/**
 * @author Turbo Chen
 * @version 1.01
 */
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class JDesktop extends JDesktopPane{
    public void paint(Graphics g){
        super.paint(g);
        Dimension d = preferredSizeOfAllFrames();
        this.setPreferredSize(d);
        this.revalidate();
    }

  /**
   * @return q回最佳desktop寸..
   */
    public Dimension preferredSizeOfAllFrames(){
        JInternalFrame [] array = getAllFrames();
        int maxX = 0;
        int maxY = 0;
        for (int i = 0; i < array.length; i++){
            if ( array[ i ].isVisible() ){
                int cx;
                cx = array[i].getX();
                int x = cx + array[i].getWidth();
                if (x > maxX) maxX = x;
                int cy;
                cy = array[i].getY();
                int y = cy + array[i].getHeight();
                if (y > maxY) maxY = y;
            }
        }
        return new Dimension(maxX, maxY);
    }
}
关键是preferredSizeOfAllFramesQ)ҎQ子H口Ud旉成JDesktop的刷斎ͼ它调用preferredSizeOfAllFramesQ)Ҏ重新计算最佳JDesktop的大,q过revalidate()Ҏ来通知它的上层容器即JScrollPaneQJScrollPane会根据JDesktop的大来调整自nViewport的大,当Viewport的大超出可视范_JScrollPane出现滚动条?

在你的程序中Q只要用q个新的JDesktopc,可以在MDIH口中实现滚动条?/p>

 



]]>
վ֩ģ壺 ˮ| Ͷ| Զ| ̶| ˮ| | | ɽ| ˶| | ¡| | | ˮ| | ɽ| | | ˰| | | ³ƶ| | Ϫ| | ï| | | ǿ| | ʯ| ̫| | | Ӫ| ԭ| Ԫı| | | | ʯʨ|