??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲69av,久久91在线,亚洲天堂2014http://www.aygfsteel.com/sunjunblack/q逐梦想的?/description>zh-cnSat, 05 Jul 2025 05:31:04 GMTSat, 05 Jul 2025 05:31:04 GMT60部vspring2.56中的例子jpetstorehttp://www.aygfsteel.com/sunjunblack/archive/2010/03/24/316422.html霜の哀?/dc:creator>霜の哀?/author>Wed, 24 Mar 2010 05:43:00 GMThttp://www.aygfsteel.com/sunjunblack/archive/2010/03/24/316422.htmlhttp://www.aygfsteel.com/sunjunblack/comments/316422.htmlhttp://www.aygfsteel.com/sunjunblack/archive/2010/03/24/316422.html#Feedback2http://www.aygfsteel.com/sunjunblack/comments/commentRss/316422.htmlhttp://www.aygfsteel.com/sunjunblack/services/trackbacks/316422.html
1.   下蝲  到www.springsource.org/download ?下蝲spring-framework-2.5.6.SEC01-with-dependencies
2.   jpetstores说明(自己译jpetstore中的readme.txt,本hp不好 Q翻译不Ch下留?
     配备spring理的中间层和ibatis作ؓ数据讉K{略数据层,与spring的事?和抽象DAO相结合。能使用本地的JDBC或者JTA ?个数据库中的后者一起工?br />      使用了相同的数据模型和演C内Ҏ作ؓjpetstore的原型,可以分别的查?"WEB-INF/dataAccessContext-local.xml"Q?WEB-INF/dataAccessContext-jta.xml"
     上下文定义的l节?br />      提供了相同的用户界面两种不同的Web层实玎ͼ一个基于spring mvc,一个基于struts1.1,后者与jpetstore关系密切Q但是用JSTL重写作ؓjsp的实玎ͼ
     可能的h可比性。查?WEB-INF/web.xml", "WEB-INF/petstore-servlet.xml",and "WEB-INF/struts-config.xml" 的细节?br />      与原来的jpetstore原型相比Q?span id="result_box" class="long_text">q个实现?/span>内部l构和松耦合斚w有了显著的改善。支持的应用上下文的概念Q现在核心就是构?应用对象(application objects)
     最显著的改善就?PetStoreLogic,现在叫做PetStoreFacade,它不再与配置Q资源,事务的细节相?br />      注意以spring为基的web层实现是故意与以struts为基的相似ƈ不是打算改进错误信息{方面的现状。jpetstore包含2个不同实现的web层来概括除了不同
     之外在各自程序设计模型的相同点,也阐明不同风格的配置?br />      q个版本的jpetstore也展CZspringq程处理的可选项 如:Hessian, Burlap, RMI, and Web Services via Apache Axis.他们都提供了x即用通过
     默认的web应用Q注意RMI是添加注释避免与EJB容器冲突Q?#8220;客户?#8221;目录包含了一个通过所有协议调用OoderService输出的简单控制行客户端?br /> 3.   部v
  • 创徏数据?nbsp; 先创建数据库 执行\jpetstore\db\mysql里面 jpetstore-mysql-schema.sqlQjpetstore-mysql-dataload.sql 用来和导入数据(不同数据库自己对应查找)
  • ?/span>Ҏ据库配置文g  在\jpetstore\war\WEB-INF  修改jdbc.properties(自己对应自己的设|?
    1 jdbc.driverClassName=com.mysql.jdbc.Driver
    2 jdbc.url=jdbc:mysql://localhost/jpetstore?
    3 jdbc.username=root
    4 jdbc.password=root
    5 
  • web层实现的选择  在\jpetstore\war\WEB_INF   web.xml代码
    <servlet-mapping>
             
    <!--使用spring mvc默认 -->
        
    <servlet-name>petstore</servlet-name>
            
    <!--使用struts -->
    <!--<servlet-name>action</servlet-name>-->
        
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
  • 部v /jpetstore q行warfile.bat 生成一个文件夹dist 把里面的jpetstore.war复制?tomcat目录下的webapps  ,把对应的数据库驱动放到tomcat\lib?br />
  • q行tomcat 打开览器http://localhost:8080/jpetstore 可以看到jpetstore面  have fun!





]]>
java学习W记Qxml解析Q?/title><link>http://www.aygfsteel.com/sunjunblack/archive/2007/04/13/110513.html</link><dc:creator>霜の哀?/dc:creator><author>霜の哀?/author><pubDate>Fri, 13 Apr 2007 10:08:00 GMT</pubDate><guid>http://www.aygfsteel.com/sunjunblack/archive/2007/04/13/110513.html</guid><wfw:comment>http://www.aygfsteel.com/sunjunblack/comments/110513.html</wfw:comment><comments>http://www.aygfsteel.com/sunjunblack/archive/2007/04/13/110513.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/sunjunblack/comments/commentRss/110513.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/sunjunblack/services/trackbacks/110513.html</trackback:ping><description><![CDATA[最q学习xmlQ把学习的代码发上来   希望Ҏ手有?br>q是note.xml<br> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;"><?</span><span style="color: #000000;">xml version</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">1.0</span><span style="color: #000000;">"</span><span style="color: #000000;"> encoding</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">gb2312</span><span style="color: #000000;">"</span><span style="color: #000000;"> </span><span style="color: #000000;">?></span><span style="color: #000000;"> <br></span><span style="color: #000000;"><</span><span style="color: #000000;">notes</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #000000;"><</span><span style="color: #000000;">note date</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">2007-4-12</span><span style="color: #000000;">"</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #000000;"><</span><span style="color: #000000;">from</span><span style="color: #000000;">></span><span style="color: #000000;">红</span><span style="color: #000000;"></</span><span style="color: #000000;">from</span><span style="color: #000000;">></span><span style="color: #000000;"> <br></span><span style="color: #000000;"><</span><span style="color: #000000;">to</span><span style="color: #000000;">></span><span style="color: #000000;">林</span><span style="color: #000000;"></</span><span style="color: #000000;">to</span><span style="color: #000000;">></span><span style="color: #000000;"> <br></span><span style="color: #000000;"><</span><span style="color: #000000;">message</span><span style="color: #000000;">></span><span style="color: #000000;">周末一起去吃火锅呀</span><span style="color: #000000;"></</span><span style="color: #000000;">message</span><span style="color: #000000;">></span><span style="color: #000000;"> <br></span><span style="color: #000000;"></</span><span style="color: #000000;">note</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #000000;"></</span><span style="color: #000000;">notes</span><span style="color: #000000;">></span></div> <br>q是dom解析xml代码<br> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.File;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.FileInputStream;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.FileNotFoundException;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.IOException;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.InputStream;<br><br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> javax.xml.parsers.DocumentBuilder;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> javax.xml.parsers.DocumentBuilderFactory;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> javax.xml.parsers.ParserConfigurationException;<br><br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> org.w3c.dom.Document;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> org.w3c.dom.Element;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> org.w3c.dom.Node;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> org.w3c.dom.NodeList;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> org.xml.sax.SAXException;<br><br><br></span><span style="color: #0000ff;">class</span><span style="color: #000000;">  DomXMLTest<br>{<br>    </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)<br>    {   <br>        </span><span style="color: #0000ff;">try</span><span style="color: #000000;">{<br>         </span><span style="color: #008000;">//</span><span style="color: #008000;">Q?Q得到DOM解析器的工厂实例</span><span style="color: #008000;"><br></span><span style="color: #000000;">        DocumentBuilderFactory factory </span><span style="color: #000000;">=</span><span style="color: #000000;">DocumentBuilderFactory.newInstance();     <br>          </span><span style="color: #008000;">//</span><span style="color: #008000;">Q?Q从DOM工厂获得DOM解析?/span><span style="color: #008000;"><br></span><span style="color: #000000;">        DocumentBuilder  builder</span><span style="color: #000000;">=</span><span style="color: #000000;">factory.newDocumentBuilder(); <br>        File f</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> File(</span><span style="color: #000000;">"</span><span style="color: #000000;">note.xml</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>         </span><span style="color: #008000;">//</span><span style="color: #008000;">Q?Q把要解析的XML文档转化入流Q以便DOM解析器解析它</span><span style="color: #008000;"><br></span><span style="color: #000000;">        InputStream  is</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> FileInputStream(f);  <br>        </span><span style="color: #008000;">//</span><span style="color: #008000;">Q?Q解析XML文的输入流Q得C个Document</span><span style="color: #008000;"><br></span><span style="color: #000000;">        Document doc</span><span style="color: #000000;">=</span><span style="color: #000000;">builder.parse(is);    <br>        </span><span style="color: #008000;">//</span><span style="color: #008000;">Q?Q得到XML文的根节点</span><span style="color: #008000;"><br></span><span style="color: #000000;">        Element  root</span><span style="color: #000000;">=</span><span style="color: #000000;">doc.getDocumentElement(); <br>         </span><span style="color: #008000;">//</span><span style="color: #008000;">Q?Q得到节点的子节?/span><span style="color: #008000;"><br></span><span style="color: #000000;">        NodeList  notes</span><span style="color: #000000;">=</span><span style="color: #000000;">root.getChildNodes();   <br><br>          </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;i</span><span style="color: #000000;"><</span><span style="color: #000000;">notes.getLength();i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br>          {<br>               Node note</span><span style="color: #000000;">=</span><span style="color: #000000;">notes.item(i);<br>            </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(note.getNodeType()</span><span style="color: #000000;">==</span><span style="color: #000000;">Node.ELEMENT_NODE)<br>                {  <br>                    </span><span style="color: #008000;">//</span><span style="color: #008000;">Q?Q取得节点的属性?/span><span style="color: #008000;"><br></span><span style="color: #000000;">                    String date </span><span style="color: #000000;">=</span><span style="color: #000000;">note.getAttributes().getNamedItem(</span><span style="color: #000000;">"</span><span style="color: #000000;">date</span><span style="color: #000000;">"</span><span style="color: #000000;">).getNodeValue(); <br>                    System.out.println(date);<br>                    </span><span style="color: #008000;">//</span><span style="color: #008000;"> Q?Q轮循子节点</span><span style="color: #008000;"><br></span><span style="color: #000000;">                    </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(Node node</span><span style="color: #000000;">=</span><span style="color: #000000;">note.getFirstChild();node</span><span style="color: #000000;">!=</span><span style="color: #0000ff;">null</span><span style="color: #000000;">;node</span><span style="color: #000000;">=</span><span style="color: #000000;">node.getNextSibling()) <br>                         {<br>                                </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(node.getNodeType()</span><span style="color: #000000;">==</span><span style="color: #000000;">Node.ELEMENT_NODE)<br>                                     {<br>                                            </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(node.getNodeName().equals(</span><span style="color: #000000;">"</span><span style="color: #000000;">from</span><span style="color: #000000;">"</span><span style="color: #000000;">))<br>                                            {<br>                                                 String from</span><span style="color: #000000;">=</span><span style="color: #000000;">node.getFirstChild().getNodeValue();<br>                                                 System.out.println(from);<br>                                             }<br>                                            </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(node.getNodeName().equals(</span><span style="color: #000000;">"</span><span style="color: #000000;">to</span><span style="color: #000000;">"</span><span style="color: #000000;">))<br>                                             {<br>                                                  String to</span><span style="color: #000000;">=</span><span style="color: #000000;">node.getFirstChild().getNodeValue();<br>                                                   System.out.println(to);<br>                                             }<br>                                             </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(node.getNodeName().equals(</span><span style="color: #000000;">"</span><span style="color: #000000;">message</span><span style="color: #000000;">"</span><span style="color: #000000;">))<br>                                             {<br>                                                   String message</span><span style="color: #000000;">=</span><span style="color: #000000;">node.getFirstChild().getNodeValue();<br>                                                   System.out.println(message);<br>                                              }<br>                                      }<br>                           }<br>                  }<br><br>        }<br>        }<br>        </span><span style="color: #0000ff;">catch</span><span style="color: #000000;">(ParserConfigurationException e)<br>        {<br>            e.printStackTrace();<br>        }<br>        </span><span style="color: #0000ff;">catch</span><span style="color: #000000;">(SAXException e)<br>        {<br>            e.printStackTrace();<br>        }<br>        </span><span style="color: #0000ff;">catch</span><span style="color: #000000;">(IOException e)<br>        {<br>            e.printStackTrace();<br>        }<br>     }                                  <br>}</span></div> <br>q有 出现 下面的错?nbsp; 是xml的格式不?Q我应为在 <?xml 前面多个I格 找了好几天的错?br>特别感谢那些帮我N题的高手Q用范伟的话?nbsp; 谢谢?br> <div style="margin: 5px; background: yellow none repeat scroll 0% 50%; position: absolute; left: 0pt; top: 0pt; z-index: 1000; font-family: arial; font-size: 13px; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; -moz-border-radius-bottomright: 5px; -moz-border-radius-bottomleft: 5px; opacity: 0.9; display: none;" id="dictdiv"></div> <div class="wmqeeuq" id="dictaudio"></div> The processing instruction target matching "[xX][mM][lL]" is not allowed. <div style="margin: 5px; background: yellow none repeat scroll 0% 50%; position: absolute; left: 0pt; top: 0pt; z-index: 1000; font-family: arial; font-size: 13px; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; -moz-border-radius-bottomright: 5px; -moz-border-radius-bottomleft: 5px; opacity: 0.9; display: none;" id="dictdiv"></div> <div class="wmqeeuq" id="dictaudio"></div> <br><br><br><br><img src ="http://www.aygfsteel.com/sunjunblack/aggbug/110513.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/sunjunblack/" target="_blank">霜の哀?/a> 2007-04-13 18:08 <a href="http://www.aygfsteel.com/sunjunblack/archive/2007/04/13/110513.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学习W记Qjava中的io操作Q?/title><link>http://www.aygfsteel.com/sunjunblack/archive/2007/04/10/109777.html</link><dc:creator>霜の哀?/dc:creator><author>霜の哀?/author><pubDate>Tue, 10 Apr 2007 15:53:00 GMT</pubDate><guid>http://www.aygfsteel.com/sunjunblack/archive/2007/04/10/109777.html</guid><wfw:comment>http://www.aygfsteel.com/sunjunblack/comments/109777.html</wfw:comment><comments>http://www.aygfsteel.com/sunjunblack/archive/2007/04/10/109777.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/sunjunblack/comments/commentRss/109777.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/sunjunblack/services/trackbacks/109777.html</trackback:ping><description><![CDATA[(1)File的操?br> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.File;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.IOException;<br></span><span style="color: #0000ff;">class</span><span style="color: #000000;"> FileDemo{<br> </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[]){<br>  </span><span style="color: #0000ff;">try</span><span style="color: #000000;">{<br>   File f</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> File(</span><span style="color: #000000;">"</span><span style="color: #000000;">file1.txt</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>   <br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">文g是否存在: </span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">f.exists());<br>     </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">f.exists())<br>      {    <br>           System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">文g不否存在Q开始创建!</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>           f.createNewFile();<br>      }<br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">文g是否存在: </span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">f.exists());<br>   System.out.println(</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;">f.isFile());<br>   System.out.println(</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;">f.isDirectory());   <br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">可否d文g: </span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">f.canRead);<br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">可否修改文g: </span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">f.canWrite());<br>   System.out.println(</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;">f.isHidden());<br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">文g名称: </span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">f.getName());<br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">标准文g? </span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">f.getCanonicalFile()); <br>   System.out.println(</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;">f.getPath());  <br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">l对路径: </span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">f.getAbsolutePath());<br>   System.out.println(</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;">f.getCanonicalPath());<br>   System.out.println(</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;">f.lastModified());<br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">文g大小: </span><span style="color: #000000;">"</span><span style="color: #000000;">+</span><span style="color: #000000;">f.length()</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>  } <br>  </span><span style="color: #0000ff;">catch</span><span style="color: #000000;">(IOException ex){<br>   ex.printStackTrace();<br>  }   <br> }<br>}</span></div> <br>(2)单文件读?br> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.BufferedReader;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.BufferedWriter;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.FileWriter;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.FileReader;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.IOException;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.File;<br></span><span style="color: #0000ff;">class</span><span style="color: #000000;"> test{<br> </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[]){<br>  </span><span style="color: #0000ff;">try</span><span style="color: #000000;">{<br>   File f</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> File(</span><span style="color: #000000;">"</span><span style="color: #000000;">file1.txt</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>   </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">f.exists())<br>      {<br>           f.createNewFile();<br>      }<br>   FileWriter fw</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> FileWriter(f</span><span style="color: #000000;">);<br>   BufferedWriter bw</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> BufferedWriter(fw);<br>   bw.write(</span><span style="color: #000000;">"</span><span style="color: #000000;">大家?我正在学习Java</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>   bw.newLine();<br>   bw.write(</span><span style="color: #000000;">"</span><span style="color: #000000;">请多多指?/span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">file1.txt写入成功!***************开始读..\n</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>   bw.flush();<br>   bw.close();<br>   <br>   FileReader fr</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> FileReader(</span><span style="color: #000000;">"</span><span style="color: #000000;">file1.txt</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>   BufferedReader br</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> BufferedReader(fr);<br>   String temp</span><span style="color: #000000;">=</span><span style="color: #0000ff;">null</span><span style="color: #000000;">;<br>   </span><span style="color: #0000ff;">do</span><span style="color: #000000;">{<br>    temp</span><span style="color: #000000;">=</span><span style="color: #000000;">br.readLine();<br>    System.out.println(temp</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;">:temp);<br>   }<br>   </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(temp</span><span style="color: #000000;">!=</span><span style="color: #0000ff;">null</span><span style="color: #000000;">);<br>   fr.close();<br>   br.close();<br>   <br>   System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">file1.txt已经d!*************</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>  }<br>  <br>  </span><span style="color: #0000ff;">catch</span><span style="color: #000000;">(IOException ex){<br>   ex.printStackTrace();<br>  }   <br> }<br>}<br><br><br>(3)分隔W读? <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.File;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.FileWriter;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.FileReader;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.BufferedWriter;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.BufferedReader;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.io.IOException;<br></span><span style="color: #0000ff;">import</span><span style="color: #000000;"> java.util.StringTokenizer;<br></span><span style="color: #0000ff;">class</span><span style="color: #000000;"> StringTokenizerTest<br>{<br>    </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) <br>    {   <br>        </span><span style="color: #0000ff;">try</span><span style="color: #000000;">{<br>                 File f</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> File(</span><span style="color: #000000;">"</span><span style="color: #000000;">file1.txt</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>                 </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">f.exists())<br>                {<br>                   f.createNewFile();<br>                }<br>                FileWriter fw</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> FileWriter(f);<br>                BufferedWriter bw</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> BufferedWriter(fw);<br>                bw.write(</span><span style="color: #000000;">"</span><span style="color: #000000;">明,?1980-1-1,13624577654</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>                bw.newLine();<br>                bw.write(</span><span style="color: #000000;">"</span><span style="color: #000000;">强,?1984-2-1,13634375634</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>                bw.newLine();<br>                bw.write(</span><span style="color: #000000;">"</span><span style="color: #000000;">红,?1986-1-5,13724777774</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>                System.out.println(</span><span style="color: #000000;">"</span><span style="color: #000000;">数据写入成功Q?/span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>                bw.flush();<br>                bw.close();<br><br>                FileReader fr</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> FileReader(f);<br>                BufferedReader br</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> BufferedReader(fr);<br>                String s</span><span style="color: #000000;">=</span><span style="color: #0000ff;">null</span><span style="color: #000000;">;<br>                <br>                </span><span style="color: #0000ff;">while</span><span style="color: #000000;">  ((s  </span><span style="color: #000000;">=</span><span style="color: #000000;">br.readLine())</span><span style="color: #000000;">!=</span><span style="color: #000000;">  </span><span style="color: #0000ff;">null</span><span style="color: #000000;">)  <br>                {  <br>                     StringTokenizer  st  </span><span style="color: #000000;">=</span><span style="color: #000000;">  </span><span style="color: #0000ff;">new</span><span style="color: #000000;">  StringTokenizer(s,</span><span style="color: #000000;">"</span><span style="color: #000000;">,</span><span style="color: #000000;">"</span><span style="color: #000000;">);  <br>                     System.out.println(s  </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;"> </span><span style="color: #000000;">"</span><span style="color: #000000;"> : s);  <br>                     </span><span style="color: #0000ff;">while</span><span style="color: #000000;">  (st.hasMoreTokens())  {  <br>                       String  name  </span><span style="color: #000000;">=</span><span style="color: #000000;">  st.nextToken();  <br>                       String  sex  </span><span style="color: #000000;">=</span><span style="color: #000000;">  st.nextToken();  <br>                       String  birthday  </span><span style="color: #000000;">=</span><span style="color: #000000;">  st.nextToken();  <br>                       String  tel  </span><span style="color: #000000;">=</span><span style="color: #000000;">  st.nextToken();  <br>                       System.out.println(  </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;">  name);  <br>                       System.out.println(  </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;">  sex);  <br>                       System.out.println(  </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;">  birthday);  <br>                       System.out.println(  </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;">  tel);  <br>                       System.out.println(  </span><span style="color: #000000;">"</span><span style="color: #000000;">_______________________________  </span><span style="color: #000000;">"</span><span style="color: #000000;">);  <br>                          }  <br>                }   <br>                </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(s</span><span style="color: #000000;">!=</span><span style="color: #0000ff;">null</span><span style="color: #000000;">);<br>                fr.close();<br>                br.close();          <br>           }<br>           </span><span style="color: #0000ff;">catch</span><span style="color: #000000;">(IOException e){<br>               e.printStackTrace();<br>         }<br>    }<br>}</span></div> <br><br></span></div> <br> <img src ="http://www.aygfsteel.com/sunjunblack/aggbug/109777.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/sunjunblack/" target="_blank">霜の哀?/a> 2007-04-10 23:53 <a href="http://www.aygfsteel.com/sunjunblack/archive/2007/04/10/109777.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript 技?/title><link>http://www.aygfsteel.com/sunjunblack/archive/2007/04/08/109283.html</link><dc:creator>霜の哀?/dc:creator><author>霜の哀?/author><pubDate>Sun, 08 Apr 2007 15:38:00 GMT</pubDate><guid>http://www.aygfsteel.com/sunjunblack/archive/2007/04/08/109283.html</guid><wfw:comment>http://www.aygfsteel.com/sunjunblack/comments/109283.html</wfw:comment><comments>http://www.aygfsteel.com/sunjunblack/archive/2007/04/08/109283.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/sunjunblack/comments/commentRss/109283.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/sunjunblack/services/trackbacks/109283.html</trackback:ping><description><![CDATA[<br>1. oncontextmenu="window.event.returnValue=false" 彻底屏蔽鼠标右?br><table oncontextmenu=return(false)></table> 可用于Table<br><br>2. <body onselectstart="return false"> 取消选取、防止复?br><br>3. onpaste="return false" 不准_脓<br><br>4. oncopy="return false;" oncut="return false;" 防止复制<br><br>5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图?br><br>6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显C出你的图标<br><br>7. <input style="ime-mode:disabled"> 关闭输入?br><br>8. 永远都会带着框架<br><script language="JavaScript"><!--<br>if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网?br>// --></script><br><br>9. 防止被hframe<br><SCRIPT LANGUAGE=JAVASCRIPT><!-- <br>if (top.location != self.location)top.location=self.location;<br>// --></SCRIPT><br><br>10. |页不能被另存?br><noscript><iframe src="/blog/*.html>";</iframe></noscript> <br><br>11. <input type=button value=查看|页源代?<br>onclick="window.location = "view-source:"+ "http://www.williamlong.info""><br><br>12.删除时确?br><a href="javascript:if(confirm("实要删除吗?"))location="boos.asp?&areyou=删除&page=1"">删除</a> <br><br>13. 取得控g的绝对位|?br>//Javascript<br><script language="Javascript"><br>function getIE(e){<br>var t=e.offsetTop;<br>var l=e.offsetLeft;<br>while(e=e.offsetParent)<br>alert("top="+t+"/nleft="+l);<br>}<br></script><br><br>//VBScript<br><script language="VBScript"><!--<br>function getIE()<br>dim t,l,a,b<br>set a=document.all.img1<br>t=document.all.img1.offsetTop<br>l=document.all.img1.offsetLeft<br>while a.tagName<>"BODY"<br>set a = a.offsetParent<br>t=t+a.offsetTop<br>l=l+a.offsetLeft<br>wend<br>msgbox "top="&t&chr(13)&"left="&l,64,"得到控g的位|?<br>end function<br>--></script><br><br>14. 光标是停在文本框文字的最?br><script language="javascript"><br>function cc()<br>{<br>var e = event.srcElement;<br>var r =e.createTextRange();<br>r.moveStart("character",e.value.length);<br>r.collapse(true);<br>r.select();<br>}<br></script><br><input type=text name=text1 value="123" onfocus="cc()"><br><br>15. 判断上一늚来源<br>javascript:<br>document.referrer<br><br><br>16. 最化、最大化、关闭窗?br><object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> <br><param name="Command" value="Minimize"></object><br><object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> <br><param name="Command" value="Maximize"></object><br><OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><br><PARAM NAME="Command" VALUE="Close"></OBJECT><br><input type=button value=最化 onclick=hh1.Click()><br><input type=button value=最大化 onclick=hh2.Click()><br><input type=button value=关闭 onclick=hh3.Click()><br>本例适用于IE<br><br>17.屏蔽功能键Shift,Alt,Ctrl<br><script><br>function look(){ <br>if(event.shiftKey) <br>alert("止按Shift?"); //可以换成ALT CTRL<br>} <br>document.onkeydown=look; <br></script><br><br>18. |页不会被缓?br><META HTTP-EQUIV="pragma" CONTENT="no-cache"><br><META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"><br><META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"><br>或?lt;META HTTP-EQUIV="expires" CONTENT="0"><br><br>19.怎样让表单没有凹凸感Q?br><input type=text style="border:1 solid #000000"> <br>?br><input type=text style="border-left:none; border-right:none; border-top:none; border-bottom: <br><br>1 solid #000000"></textarea><br><br>20.<div><span>&<layer>的区别? <br><div>(division)用来定义大段的页面元素,会生{?<br><span>用来定义同一行内的元素,?lt;div>的唯一区别是不产生转行 <br><layer>是ns的标讎ͼie不支持,相当?lt;div><br><br>21.让弹出窗口L在最上面:<br><body onblur="this.focus();"><br><br>22.不要滚动? <br>让竖条没? <br><body style="overflow:scroll;overflow-y:hidden"> <br></body> <br>让横条没? <br><body style="overflow:scroll;overflow-x:hidden"> <br></body> <br>两个都去掉?更简单了 <br><body scroll="no"> <br></body> <br><br>23.怎样L囄链接点击后,囄周围的虚U?<br><a href="#" onFocus="this.blur()"><img src="/blog/logo.jpg" border=0></a><br><br>24.电子邮g处理提交表单<br><form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain"> <br><input type=submit><br></form><br><br>25.在打开的子H口h父窗口的代码里如何写Q?br>window.opener.location.reload()<br><br>26.如何讑֮打开面的大?br><body onload="top.resizeTo(300,200);"><br>打开面的位|?lt;body onload="top.moveBy(300,200);"><br><br>27.在页面中如何加入不是满铺的背景图?拉动面时背景图不动 <br><STYLE> <br>body <br>{background-image:url(/blog/logo.gif); background-repeat:no-repeat; <br>background-position:center;background-attachment: fixed} <br></STYLE> <br><br>28. 查一D字W串是否全由数字l成<br><script language="Javascript"><!--<br>function checkNum(str){return str.match(//D/)==null}<br>alert(checkNum("1232142141"))<br>alert(checkNum("123214214a1"))<br>// --></script><br><br>29. 获得一个窗口的大小<br>document.body.clientWidth; document.body.clientHeight<br><br>30. 怎么判断是否是字W?br>if (/[^/x00-/xff]/g.test(s)) alert("含有汉字");<br>else alert("全是字符");<br><br>31.TEXTAREA自适应文字行数的多?br><textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight"><br></textarea><br><br>32. 日期减去天数{于W二个日?br><script language=Javascript><br>function cc(dd,dadd)<br>{<br>//可以加上错误处理<br>var a = new Date(dd)<br>a = a.valueOf()<br>a = a - dadd * 24 * 60 * 60 * 1000<br>a = new Date(a)<br>alert(a.getFullYear() + "q? + (a.getMonth() + 1) + "? + a.getDate() + "?)<br>}<br>cc("12/23/2002",2)<br></script><br><br>33. 选择了哪一个Radio<br><HTML><script language="vbscript"><br>function checkme()<br>for each ob in radio1<br>if ob.checked then window.alert ob.value<br>next<br>end function<br></script><BODY><br><INPUT name="radio1" type="radio" value="style" checked>Style<br><INPUT name="radio1" type="radio" value="barcode">Barcode<br><INPUT type="button" value="check" onclick="checkme()"><br></BODY></HTML><br><br>34.脚本怸出错<br><SCRIPT LANGUAGE="JavaScript"> <br><!-- Hide <br>function killErrors() { <br>return true; <br>} <br>window.onerror = killErrors; <br>// --> <br></SCRIPT><br><br>35.ENTER键可以让光标Ud下一个输入框<br><input onkeydown="if(event.keyCode==13)event.keyCode=9"><br><br><br>36. 某个网站的链接速度Q?br>把如下代码加?lt;body>区域?<br><script language=Javascript><br>tim=1<br>setInterval("tim++",100)<br>b=1<br>var autourl=new Array()<br>autourl[1]="www.njcatv.net"<br>autourl[2]="javacool.3322.net"<br>autourl[3]="www.sina.com.cn"<br>autourl[4]="www.nuaa.edu.cn"<br>autourl[5]="www.cctv.com"<br>function butt(){<br>document.write("<form name=autof>")<br>for(var i=1;i<autourl.length;i++)<br>document.write("<input type=text name=txt"+i+" size=10 value="/blog/试?.....>" =?lt;input type=text <br>name=url"+i+" size=40> =?lt;input type=button value=GO <br><br>onclick=window.open(this.form.url"+i+".value)><br/>")<br>document.write("<input type=submit value=h></form>")<br>}<br>butt()<br>function auto(url)<br>else<br><br>b++<br>}<br>function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+"/"+Math.random()+" width=1 height=1 <br><br>onerror=auto("http://"+autourl+"")>")}<br>run()</script><br><br>37. 各种样式的光?br>auto Q标准光?br>default Q标准箭?br>hand Q手形光?br>wait Q等待光?br>text QI形光?br>vertical-text Q水qI形光?br>no-drop Q不可拖动光?br>not-allowed Q无效光?br>help Q?帮助光标<br>all-scroll Q三角方向标<br>move Q移动标<br>crosshair Q十字标<br>e-resize<br>n-resize<br>nw-resize<br>w-resize<br>s-resize<br>se-resize<br>sw-resize<br><br>38.面q入和退出的Ҏ<br>q入面<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)"><br>推出面<meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)"> <br>q个是页面被载入和调出时的一些特效。duration表示Ҏ的持l时_以秒为单位。transition表示使用哪种ҎQ取gؓ1-23:<br>  0 矩Ş~小 <br>  1 矩Ş扩大 <br>  2 圆Ş~小<br>  3 圆Ş扩大 <br>  4 下到上刷?<br>  5 上到下刷?br>  6 左到叛_?<br>  7 叛_左刷?<br>  8 竖百叶窗<br>  9 横百叶窗 <br>  10 错位横百叶窗 <br>  11 错位竖百叶窗<br>  12 Ҏ?<br>  13 左右C间刷?<br>  14 中间到左叛_?br>  15 中间C?br>  16 上下C?<br>  17 右下到左?br>  18 右上到左?<br>  19 左上到右?<br>  20 左下到右?br>  21 横条 <br>  22 竖条 <br>  23 以上22U随机选择一U?br><br>39.在规定时间内跌{<br><META http-equiv=V="REFRESH" content="5;URL=http://www.williamlong.info"> <br><br>40.|页是否被检?br><meta name="ROBOTS" content="属性?><br>  其中属性值有以下一?<br>  属性gؓ"all": 文g被索,且页上链接可被查询;<br>  属性gؓ"none": 文g不被索,而且不查询页上的链接Q?br>  属性gؓ"index": 文g被索;<br>  属性gؓ"follow": 查询上的链接;<br>  属性gؓ"noindex": 文g不检索,但可被查询链接;<br>  属性gؓ"nofollow": 文g不被索,但可查询上的链接?br><br>最大化H口Q?br><script language="JavaScript"><br><!--<br>self.moveTo(0,0)<br>self.resizeTo(screen.availWidth,screen.availHeight)<br>//--><br></script><br><br><br><br><br>?决问题:׃层与下拉框之间的优先U是Q下拉框 > 层,因此在显C的时候,会因Z先的次序而会出现如上问题。(如果几个元素都是层的话,我们可以通过层的 z-index 属性来讄Q解军_法就是:l层中放一个优先比下拉框更高的元素(iframeQ,从而解x问题Q具体解决代码如下:<br><br><div id="menu" style="position:absolute; visibility:hidden; top:20px; left:20px; width:100px; height:200px; background-color:#6699cc;"><br><table><br><tr><td>item 1</td></tr><br><tr><td>item 2</td></tr><br><tr><td>item 3</td></tr><br><tr><td>item 4</td></tr><br><tr><td>item 5</td></tr><br></table><br><iframe src="/blog/javascript:false" style="position:absolute; visibility:inherit; top:0px; left:0px; width:100px; height:200px; z-index:-1; filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';"></iframe><br></div><br><br><a href="#" onclick="document.getElementById('menu').style.visibility='visible'">menu</a><br><br><form><br><select><option>A form selection list</option></select><br></form><br><br>输入框也可以做的很漂亮了<br><div align="center"><input type="hidden" name="hao" value="yes"><br>外向敎ͼ<input <br>name=answer <br>style="color: #ff0000; border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid #c0c0c0"><br> 没回{的题数Q?lt;input <br>name=unanswer id="unanswer" <br>style="color: #ff0000; border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid #c0c0c0"><br><br/><br>d?<br><input <br>name=score id="score" <br>style="color: #ff0000; border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid #c0c0c0"><br> l    ?<br><input <br>name=xgjg id="xgjg" <br>style="color: #ff0000; border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid #c0c0c0"><br><br/><br><br/> <br><br><input onClick=processForm(this.form) style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt" type=button value=查看l果 name="button"> <br><input type="reset" name="Submit" value="重做"><br></div><br>注意Q修?lt;body>?lt;body onload="max.Click()">即ؓ打开最?br><br>化窗口,而如果改?lt;body onload="min.Click()">变为窗口一打开最化<br><br><object id="min" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><br><param name="Command" value="Minimize"><br></object> <object id="max" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"><br><param name="Command" value="Maximize"><br></object><br></body><br><br>面自动hQ说明)<br><br>当你做网|Q是不是有的时候想让你的网自动不停刷斎ͼ或者过一D|间自动蟩转到另外一个你自己讑֮的页面?其实实现q个效果非常地简单,而且q个效果甚至不能UC为特效。你只要把如下代码加入你的网中可以了?br><br>1Q页面自动刷斎ͼ把如下代码加?lt;head>区域?lt;meta http-equiv="refresh" content="20">,其中20指每?0U刷Cơ页?<br><br>2Q?面自动跌{Q把如下代码加入<head>区域?lt;meta http-equiv="refresh" content="20;url=http://www.williamlong.info">,其中20指隔20U后跌{到http: //www.williamlong.info面?<br><br>面自动关闭<br><br>5000是指旉<body onLoad="setTimeout(window.close, 5000)"> <br><br>弹出H口自动关闭 <br><br>10U后弹出H口自动关闭<br><br>注意Q在新的tan.htm的body中要?<onLoad="closeit()"><br>head<br><br><script language="JavaScript"><br><br><!--<br><br>var gt = unescape('%3e');<br><br>var popup = null;<br><br>var over = "Launch Pop-up Navigator";<br><br>popup = window.open('', 'popupnav', 'width=225,height=235,resizable=1,scrollbars=auto');<br><br>if (popup != null) {<br><br>if (popup.opener == null) {<br><br>popup.opener = self; <br><br>}<br><br>popup.location.href = 'tan.htm';<br><br>}<br><br>// --><br><br></script><br><body>注意Q这D代码是在新建文件中?br><script language="JavaScript"><br><br>function closeit() <br><br></script><br><br>q个可不?lt;iframe>(引用Q呀。是直接调用的。以下代码加?lt;body>区域<br><br><object type="text/x-scriptlet" width="800" height="1000" data="../index.htm"><br></object><br><br><br><img src ="http://www.aygfsteel.com/sunjunblack/aggbug/109283.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/sunjunblack/" target="_blank">霜の哀?/a> 2007-04-08 23:38 <a href="http://www.aygfsteel.com/sunjunblack/archive/2007/04/08/109283.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>EditPlus 用户工具配置http://www.aygfsteel.com/sunjunblack/archive/2007/04/03/108275.html霜の哀?/dc:creator>霜の哀?/author>Tue, 03 Apr 2007 14:12:00 GMThttp://www.aygfsteel.com/sunjunblack/archive/2007/04/03/108275.htmlhttp://www.aygfsteel.com/sunjunblack/comments/108275.htmlhttp://www.aygfsteel.com/sunjunblack/archive/2007/04/03/108275.html#Feedback0http://www.aygfsteel.com/sunjunblack/comments/commentRss/108275.htmlhttp://www.aygfsteel.com/sunjunblack/services/trackbacks/108275.html

工具集成——编译器集成例子QJava、Borland C++、Visual C++、Inno Setup、nsisQ?br>?#8220;工具→参数选择→用户工具”选项设|,讄步骤
?讄l名Uͼq里也可以不讄
?单击“d工具→应用E序”按钮q进行如下设|?br>?各种cM"$(FilePath)"的参数可以在文本框右侧的头下拉菜单中获取,具体含义如下
参数 描述
$(FilePath) 文g路径Q文件全名,含目录和文g名)
$(FileDir) 文g目录Q不带文件名Q?br>$(FileName) 文g名(不带目录Q?br>$(FileNameNoExt) 不带扩展名的文g名(不带目录Q?br>$(FileExt) 扩展名(当前文gQ?br>$(ProjectName) 工程名称Q当前工E名Q?br>$(CurLine) 当前行号Q光标位|处的行P
$(CurCol) 当前列号Q光标位|处的列P
$(CurSel) 当前文本Q插入当前选定文本Q?br>$(CurWord) 当前单词Q插入当前单词)
$(WindowList) 昄当前H口列表q择特定文g


例子 1. Java ~译?/p>

菜单文本QJava ~译?br>命oQc:\java\bin\javac.exe
参数Q?$(FilePath)"
初始目录Q?(FileDir)
捕获输出Q开?/p>

要运行已~译?Java cLӞ你可以进行如下设|:
菜单文本QJava
命oQc:\java\bin\java.exe
参数Q?(FileNameNoExt)
初始目录Q?(FileDir)
“命o”部分应当替换为实际的 Java 解释器的路径?/p>

例子 2. Borland C++

菜单文本QBorland C
命oQc:\bc\bin\bcc32.exe
参数Q?Ic:\bc\include -Lc:\bc\lib -n$(FileDir) $(FilePath)
初始目录Qc:\bc\bin
捕获输出Q开?/p>

例子 3. Visual C++

菜单文本QVisual C++
命oQc:\msdev\vc98\bin\cl.exe
参数Q?$(FilePath)"
初始目录Q?(FileDir)
捕获输出Q开?/p>

例子 4. Inno Setup
菜单文本Q编?Inno
命oQC:\Program Files\Inno Setup 4\Compil32.exe”
参数Q?cc $(FileName)
初始目录Q?(FileDir)
捕获输出Q开?/p>

例子 5. nsis
菜单文本Q编?nsis
命oQC:\NSIS\makensis.exe
参数Q?(FileName)
初始目录Q?(FileDir)
捕获输出Q开?/p>

例子 6. C#
菜单文本Q编?C#
命oQC:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\csc.exe
参数Q?(FileName)
初始目录Q?(FileDir)
捕获输出Q开?/p>

在上面设|中Q在命o部分Q必M用系l中各自~译器的l对路径?/p>

讄完毕后,你可以在“工具”菜单q行对应工具了,q行l果会显C在底部的输出窗口,你也可以通过快捷?Ctrl + 0-9) q行Q或者是通过“用户工具?#8221;的快h钮运行?/p>

要运行已~译?*.exe 文gQ你可以q行如下讄Q此时可执行文g需要和~译文g同名Q:
菜单文本QRun
命oQ?(FileNameNoExt)
参数Q?br>初始目录Q?(FileDir)

原文章地址:http://www.cppblog.com/shyli/archive/2006/12/17/16531.aspx



]]>
java排序常见法http://www.aygfsteel.com/sunjunblack/archive/2007/04/03/108143.html霜の哀?/dc:creator>霜の哀?/author>Tue, 03 Apr 2007 02:40:00 GMThttp://www.aygfsteel.com/sunjunblack/archive/2007/04/03/108143.htmlhttp://www.aygfsteel.com/sunjunblack/comments/108143.htmlhttp://www.aygfsteel.com/sunjunblack/archive/2007/04/03/108143.html#Feedback2http://www.aygfsteel.com/sunjunblack/comments/commentRss/108143.htmlhttp://www.aygfsteel.com/sunjunblack/services/trackbacks/108143.html
  • 選擇排序
  • 要排序的對象分作兩部䆾Q一個是已排序的Q一個是未排序的Q從後端未排序部份選擇一個最|並放入前端已排序部䆾的最後一個,例如Q?br>

    排序前:70 80 31 37 10 1 48 60 33 80

    1. [1] 80 31 37 10 70 48 60 33 80 選出最?
    2. [1 10] 31 37 80 70 48 60 33 80 選出最?0
    3. [1 10 31] 37 80 70 48 60 33 80 選出最?1
    4. [1 10 31 33] 80 70 48 60 37 80 ......
    5. [1 10 31 33 37] 70 48 60 80 80 ......
    6. [1 10 31 33 37 48] 70 60 80 80 ......
    7. [1 10 31 33 37 48 60] 70 80 80 ......
    8. [1 10 31 33 37 48 60 70] 80 80 ......
    9. [1 10 31 33 37 48 60 70 80] 80 ......

    • 插入排序
    像是玩樸克一樣,我們將牌分作兩堆,每次從後面一堆的牌抽出最前端的牌Q然後插入前面一堆牌的適當位|,例如Q?br>

    排序前:92 77 67 8 6 84 55 85 43 67

    1. [77 92] 67 8 6 84 55 85 43 67 ?7插入92?/li>
    2. [67 77 92] 8 6 84 55 85 43 67 ?7插入77?/li>
    3. [8 67 77 92] 6 84 55 85 43 67 ?插入67?/li>
    4. [6 8 67 77 92] 84 55 85 43 67 ?插入8?/li>
    5. [6 8 67 77 84 92] 55 85 43 67 ?4插入92?/li>
    6. [6 8 55 67 77 84 92] 85 43 67 ?5插入67?/li>
    7. [6 8 55 67 77 84 85 92] 43 67 ......
    8. [6 8 43 55 67 77 84 85 92] 67 ......
    9. [6 8 43 55 67 67 77 84 85 92] ......

    • 氣排序?/li>
    名思義Q就是排序時Q最大的元素會如同氣泡一樣移臛_端,其利用比較相鄰元素的ҎQ將大的元素交換臛_端,所以大的元素會不斷的往右移動,直到適當的位|為止?br>

    基本的氣泡排序法可以利用旗標的方式稍微減一些比較的時間Q當訪完陣列後都沒有發生Q何的交換動作Q表C排序已E完成,而無需再進行之後的迴圈比較與交換動作Q例如:

    排序前:95 27 90 49 80 58 6 9 18 50

    1. 27 90 49 80 58 6 9 18 50 [95] 95出
    2. 27 49 80 58 6 9 18 50 [90 95] 90出
    3. 27 49 58 6 9 18 50 [80 90 95] 80出
    4. 27 49 6 9 18 50 [58 80 90 95] ......
    5. 27 6 9 18 49 [50 58 80 90 95] ......
    6. 6 9 18 27 [49 50 58 80 90 95] ......
    7. 6 9 18 [27 49 50 58 80 90 95] 由於接下來不會再發生交換動作Q排序提早結?/li>

    public class BasicSort {
    //选择排序
    public static void selectionSort(int[] number) {
    for(int i = 0; i < number.length - 1; i++) {
    int m = i;
    for(int j = i + 1; j < number.length; j++)
    if(number[j] < number[m])
    m = j;

    if(i != m)
    swap(number, i, m);
    }
    }
    //插入排序
    public static void injectionSort(int[] number) {
    for(int j = 1; j < number.length; j++) {
    int tmp = number[j];
    int i = j - 1;
    while(tmp < number[i]) {
    number[i+1] = number[i];
    i--;
    if(i == -1)
    break;
    }

    number[i+1] = tmp;
    }
    }
    //冒排序
    public static void bubbleSort(int[] number) {
    boolean flag = true;

    for(int i = 0; i < number.length-1 && flag; i++) {
    flag = false;
    for(int j = 0; j < number.length-i-1; j++) {
    if(number[j+1] < number[j]) {
    swap(number, j+1, j);
    flag = true;
    }
    }
    }
    }

    private static void swap(int[] number, int i, int j) {
    int t;
    t = number[i];
    number[i] = number[j];
    number[j] = t;
    }
    }


    ]]>
    վ֩ģ壺 ¡| | | ˮ| Դ| Ͽ| | | | ͭɽ| ɽ| ɽ| | Ӻ| ɽ| | Ͻ| | | Զ| ٰ| ͼľ| | | | | ȫ| ƽ| ؿ˹| ˫| | | ɽ| | ͩ| ұ| | | | ۶| ݸ|