導入SVN工程到myEclipse中

          1,改名包為可編譯的source包
          2,新建WEB-INF/src 為source包
          3.將工程右鍵點擊,發(fā)布為j2ee web工程

          posted @ 2012-07-04 23:12 youngturk 閱讀(1169) | 評論 (0)編輯 收藏

          DBlink關于from a@dblink

          example:http://www.ixpub.net/thread-1361302-1-1.html



          posted @ 2012-07-02 13:55 youngturk 閱讀(214) | 評論 (0)編輯 收藏

          powerDesigner 導入sql 生成數(shù)據(jù)模型

          將sql文件導入到pdm文件  
              PDM中的逆向工程是指從現(xiàn)有DBMS的用戶數(shù)據(jù)庫或現(xiàn)有數(shù)據(jù)庫SQL腳本中生成PDM的過程。逆向工程有兩種對象:1)通過ODBC數(shù)據(jù)源連接數(shù)據(jù)庫 2) 現(xiàn)有數(shù)據(jù)庫sql腳本。  
              具體的操作如下:  
              1、 數(shù)據(jù)庫已創(chuàng)建完畢,訪問用戶和密碼設置完成。數(shù)據(jù)庫為Oracle9i。  
              2、 ODBC數(shù)據(jù)源已由oracle 的Net Configuration Assistant 創(chuàng)建,本地網(wǎng)絡命名服務“Database”。  
              3、 sql腳本示例create.sql。  
              4、 Powerdesigner已安裝完成。  
                
              一、 通過數(shù)據(jù)源連接數(shù)據(jù)庫逆向工程生成PDM  
              1、 配置用戶數(shù)據(jù)庫連接參數(shù)  
              選擇Database->configure connections,轉到system dsn標簽,點擊Add按鈕,選數(shù)據(jù)庫類型Oracle,點擊完成。  
              顯示如下:輸入DataSource Name“PDMTest”;輸入ServerName“Database”, 配置完成。  
                
              點擊“Test Connect”輸入ServerName“Database”,用戶名和密碼,以后每次連接,選擇Database->connect,選擇odbc數(shù)據(jù)源,輸入ServerName“Database”,用戶名和密碼。  
              若無提示,則說明連接成功。同時,可以通過Database->Connection Information 查看連接信息。  
              2、 設置逆向工程選項,生成pdm  
              創(chuàng)建一個PDM文件,選擇與之匹配的數(shù)據(jù)庫類型“oracle9i”。  
              選擇Database->Reverse Engineer Database,彈出Database Reverse Engineering對話框,選Using an ODBC data source選ODBC數(shù)據(jù)源“PDMTest”  
                
              點擊確定后,顯示此數(shù)據(jù)庫中所有表、視圖、用戶。根據(jù)需要選擇后,轉換成pdm。  
                
              3、 查看數(shù)據(jù)  
              對于生成好的PDM,選擇一個表圖形符號,點擊右鍵,選擇View Data,就可以訪問表中的數(shù)據(jù)了。  
                 
              mysql同理  
              comment只能導入comment段,無法導入name段,要導入name,試試erstudio. 


          方法二
          http://blog.csdn.net/hedongyang/article/details/1609489

          posted @ 2012-06-29 10:26 youngturk 閱讀(1920) | 評論 (0)編輯 收藏

          找回commit前的數(shù)據(jù)集用 as of timestamp

          用法:
          select * from tableName as of timestamp to_timestamp('20120627143000','yyyymmddHH24miss');

          posted @ 2012-06-27 15:20 youngturk 閱讀(1652) | 評論 (0)編輯 收藏

          js中jSON轉換為對象的方法 eval(data)[0] 也可用each配合自己查(配合ajax)

          function test(varWeight){
              
          //var index = parseFloat(document.activeElement.id);
              var index = parseFloat($(varWeight).attr("id"));
              
             var fieldNo 
          =  document.getElementsByName("fieldNo")[index].value;
             var dWeight 
          =  document.getElementsByName("weight")[index+1]
               var weight 
          = dWeight.value;
              
          if(fieldNo != "" && weight != ""){
                 var query 
          = "fieldNo="+fieldNo+"&weight="+weight;
                   $.ajax(
          {  
                     type: 
          "POST",  
                      url: 
          '${webroot}/suggest!maxCount.do',  
                      dataType: 
          'json',  
                      data: query,  
                      success:function(data)
          {
                          var item 
          =  eval(data)[0];//將JSON轉換成對象 
                       
          //var item2 = JSON.parse(data);
                          var max_weight = parseFloat((item.max_weight).replace(",",""));
                          var current_weight 
          = parseFloat((item.current_weight).replace(/,/g,""));
                          var temp 
          = current_weight + parseFloat(weight);
                      
          if(max_weight<temp){
                          alert(
          "當前合計庫存:"+temp+",大于最大庫存量:"+max_weight);
                          dWeight.focus();
                          
          return false
                      }

                      close();
                      
          //return false; 
                      
          // document.getElementById(obj).innerHTML=html; 
                      }
          ,
                      error: function()
          {   
                    
          //  document.getElementById(obj).innerHTML="網(wǎng)絡連接超時,無法顯示數(shù)據(jù)!";   
                   
          //  return;   
                      }
             
                      
                   }
          );

              }

          posted @ 2012-06-21 00:14 youngturk 閱讀(1426) | 評論 (1)編輯 收藏

          誤刪資料恢復

          一、誤刪資料恢復
             一不小心刪錯了,還把回收站清空了,咋辦?。恐灰?,你就能找回你刪掉并清空回收站的東西。 
             步驟: 
             1、單擊“開始——運行,然后輸入regedit (打開注冊表) 

             2、依次展開:HEKEY——LOCAL——MACHIME/SOFTWARE/microsoft/WINDOWS/CURRENTVERSION/EXPLORER/DESKTOP/NAMESPACE 在左邊空白外點擊“新建”,選擇:“主鍵”,把它命名為“645FFO40——5081——101B——9F08——00AA002F954E”再把右邊的“默認”的主鍵的鍵值設為“回收站”,然后退出注冊表。就OK啦。 
             3、要重啟計算機。
             只要機器沒有運行過磁盤整理。系統(tǒng)完好.任何時候的文件都可以找回來。
          也許你已經(jīng)在Excel中完成過上百張財務報表,也許你已利用Excel函數(shù)實現(xiàn)過上千次的復雜運算,也許你認為Excel也不過如此,甚至了無新意。但我們平日里無數(shù)次重復的得心應手的使用方法只不過是Excel全部技巧的百分之一。本專題從Excel中的一些鮮為人知的技巧入手,領略一下關于Excel的別樣風情。

          posted @ 2012-06-20 19:59 youngturk 閱讀(218) | 評論 (0)編輯 收藏

          Dom4j全部實例

          Attribute
          Attribute定義了XML的屬性
          Branch
          Branch為能夠包含子節(jié)點的節(jié)點如XML元素(Element)和文檔(Docuemnts)定義了一個公共的行為,
          CDATA
          CDATA 定義了XML CDATA 區(qū)域
          CharacterData是一個標識接口,標識基于字符的節(jié)點。如CDATA,Comment, Text.
          Comment
          Comment 定義了XML注釋的行為
          Document
          定義了XML文檔
          DocumentType
          DocumentType 定義XML DOCTYPE聲明
          Element
          Element定義XML 元素
          ElementHandler
          ElementHandler定義了 Element 對象的處理器
          ElementPath
          被 ElementHandler 使用,用于取得當前正在處理的路徑層次信息
          Entity
          Entity定義 XML entity
          Node
          Node為所有的dom4j中XML節(jié)點定義了多態(tài)行為
          NodeFilter 定義了在dom4j節(jié)點中產(chǎn)生的一個濾鏡或謂詞的行為(predicate)
          ProcessingInstruction
          ProcessingInstruction 定義 XML 處理指令.
          Text
          Text 定義XML 文本節(jié)點.
          Visitor
          Visitor 用于實現(xiàn)Visitor模式.
          XPath
          XPath
          要想弄懂這套接口,關鍵的是要明白接口的繼承關系:
          • interface java.lang.Cloneable
            • interface org.dom4j.Node
              • interface org.dom4j.Attribute
              • interface org.dom4j.Branch
                • interface org.dom4j.Document
                • interface org.dom4j.Element
              • interface org.dom4j.CharacterData
                • interface org.dom4j.CDATA
                • interface org.dom4j.Comment
                • interface org.dom4j.Text
              • interface org.dom4j.DocumentType
              • interface org.dom4j.Entity
              • interface org.dom4j.ProcessingInstruction
          1. 讀取并解析XML文檔:
          讀寫XML文檔主要依賴于org.dom4j.io包,其中提供DOMReader和SAXReader兩類不同方式,而調(diào)用方式是一樣的。這就是依靠接口的好處。
           
              // 從文件讀取XML,輸入文件名,返回XML文檔
              public Document read(String fileName) throws MalformedURLException, DocumentException {
                 SAXReader reader = new SAXReader();
                 Document document = reader.read(new File(fileName));
                 return document;
              }
           
              
             
          其中,reader的read方法是重載的,可以從InputStream, File, Url等多種不同的源來讀取。得到的Document對象就帶表了整個XML。根據(jù)本人自己的經(jīng)驗,讀取的字符編碼是按照XML文件頭定義的編碼來轉換。如果遇到亂碼問題,注意要把各處的編碼名稱保持一致即可。
          2.    取得Root節(jié)點
          讀取后的第二步,就是得到Root節(jié)點。熟悉XML的人都知道,一切XML分析都是從Root元素開始的。
           
             public Element getRootElement(Document doc){
                 return doc.getRootElement();
              }
           
          3.    遍歷XML樹
          DOM4J提供至少3種遍歷節(jié)點的方法:
          1) 枚舉(Iterator)
           
              // 枚舉所有子節(jié)點
              for ( Iterator i = root.elementIterator(); i.hasNext(); ) {
                 Element element = (Element) i.next();
                 // do something
              }
              // 枚舉名稱為foo的節(jié)點
              for ( Iterator i = root.elementIterator(foo); i.hasNext();) {
                 Element foo = (Element) i.next();
                 // do something
              }
              // 枚舉屬性
              for ( Iterator i = root.attributeIterator(); i.hasNext(); ) {
                 Attribute attribute = (Attribute) i.next();
                 // do something
              }

          2)遞歸
          遞歸也可以采用Iterator作為枚舉手段,但文檔中提供了另外的做法
           
              public void treeWalk() {
                 treeWalk(getRootElement());
              }
              public void treeWalk(Element element) {
                 for (int i = 0, size = element.nodeCount(); i < size; i++)     {
                     Node node = element.node(i);
                     if (node instanceof Element) {
                        treeWalk((Element) node);
                     } else { // do something....
                     }
                 }
          }
           

          3) Visitor模式
          最令人興奮的是DOM4J對Visitor的支持,這樣可以大大縮減代碼量,并且清楚易懂。了解設計模式的人都知道,Visitor是GOF設計模式之一。其主要原理就是兩種類互相保有對方的引用,并且一種作為Visitor去訪問許多Visitable。我們來看DOM4J中的Visitor模式(快速文檔中沒有提供)
          只需要自定一個類實現(xiàn)Visitor接口即可。
           
                  public class MyVisitor extends VisitorSupport {
                     public void visit(Element element){
                         System.out.println(element.getName());
                     }
                     public void visit(Attribute attr){
                         System.out.println(attr.getName());
                     }
                  }
           
                  調(diào)用:  root.accept(new MyVisitor())
              Visitor接口提供多種Visit()的重載,根據(jù)XML不同的對象,將采用不同的方式來訪問。上面是給出的Element和Attribute的簡單實現(xiàn),一般比較常用的就是這兩個。VisitorSupport是DOM4J提供的默認適配器,Visitor接口的Default Adapter模式,這個模式給出了各種visit(*)的空實現(xiàn),以便簡化代碼。
              注意,這個Visitor是自動遍歷所有子節(jié)點的。如果是root.accept(MyVisitor),將遍歷子節(jié)點。我第一次用的時候,認為是需要自己遍歷,便在遞歸中調(diào)用Visitor,結果可想而知。
          4. XPath支持
              DOM4J對XPath有良好的支持,如訪問一個節(jié)點,可直接用XPath選擇。
           
             public void bar(Document document) {
                  List list = document.selectNodes( //foo/bar );
                  Node node = document.selectSingleNode(//foo/bar/author);
                  String name = node.valueOf( @name );
               }
           
              例如,如果你想查找XHTML文檔中所有的超鏈接,下面的代碼可以實現(xiàn):
           
              public void findLinks(Document document) throws DocumentException {
                  List list = document.selectNodes( //a/@href );
                  for (Iterator iter = list.iterator(); iter.hasNext(); ) {
                      Attribute attribute = (Attribute) iter.next();
                      String url = attribute.getValue();
                  }
               }
           

          5. 字符串與XML的轉換
          有時候經(jīng)常要用到字符串轉換為XML或反之,
           
              // XML轉字符串
            Document document = ...;
              String text = document.asXML();
          // 字符串轉XML
              String text = <person> <name>James</name> </person>;
              Document document = DocumentHelper.parseText(text);
           

          6 用XSLT轉換XML
           
             public Document styleDocument(
                 Document document,
                 String stylesheet
              ) throws Exception {
              // load the transformer using JAXP
              TransformerFactory factory = TransformerFactory.newInstance();
              Transformer transformer = factory.newTransformer(
                 new StreamSource( stylesheet )
              );
              // now lets style the given document
              DocumentSource source = new DocumentSource( document );
              DocumentResult result = new DocumentResult();
              transformer.transform( source, result );
              // return the transformed document
              Document transformedDoc = result.getDocument();
              return transformedDoc;
          }
           

          7. 創(chuàng)建XML
            一般創(chuàng)建XML是寫文件前的工作,這就像StringBuffer一樣容易。
           
              public Document createDocument() {
                 Document document = DocumentHelper.createDocument();
                 Element root = document.addElement(root);
                 Element author1 =
                     root
                        .addElement(author)
                        .addAttribute(name, James)
                        .addAttribute(location, UK)
                        .addText(James Strachan);
                 Element author2 =
                     root
                        .addElement(author)
                        .addAttribute(name, Bob)
                        .addAttribute(location, US)
                        .addText(Bob McWhirter);
                 return document;
              }
           

          8. 文件輸出
              一個簡單的輸出方法是將一個Document或任何的Node通過write方法輸出
           
              FileWriter out = new FileWriter( foo.xml );
              document.write(out);
           
            如果你想改變輸出的格式,比如美化輸出或縮減格式,可以用XMLWriter類
           
              public void write(Document document) throws IOException {
                 // 指定文件
                 XMLWriter writer = new XMLWriter(
                     new FileWriter( output.xml )
                 );
                 writer.write( document );
                 writer.close();
                 // 美化格式
                 OutputFormat format = OutputFormat.createPrettyPrint();
                 writer = new XMLWriter( System.out, format );
                 writer.write( document );
                 // 縮減格式
                 format = OutputFormat.createCompactFormat();
                 writer = new XMLWriter( System.out, format );
                 writer.write( document );
              }
           
          5.使用ElementHandler
          XmlHandler.java
          import java.io.File;
           
          import org.dom4j.DocumentException;
          import org.dom4j.Element;
          import org.dom4j.ElementHandler;
          import org.dom4j.ElementPath;
          import org.dom4j.io.SAXReader;
           
          public class XmlHandler {
              public static void main(String[] args) {
                 SAXReader saxReader = new SAXReader();
                 File file = new File("students.xml");
                 try {
                     // 添加一個ElementHandler實例。
                     saxReader.addHandler("/students/student", new StudentHandler());
                     saxReader.read(file);
           
                 } catch (DocumentException e) {
                     System.out.println(e.getMessage());
                 }
              }
           
              /**
               * 定義StudentHandler處理器類,對<student>元素進行處理。
               */
              private static class StudentHandler implements ElementHandler {
                 public void .Start(ElementPath path) {
                     Element elt = path.getCurrent();
                     System.out.println("Found student: " + elt.attribut.ue("sn"));
                     // 添加對子元素<name>的處理器。
                     path.addHandler("name", new NameHandler());
                 }
           
                 public void .End(ElementPath path) {
                     // 移除對子元素<name>的處理器。
                     path.removeHandler("name");
                 }
              }
           
              /**
               * 定義NameHandler處理器類,對<student><name>子元素進行處理。
               */
              private static class NameHandler implements ElementHandler {
                 public void .Start(ElementPath path) {
                     System.out.println("path : " + path.getPath());
                 }
           
                 public void .End(ElementPath path) {
                     Element elt = path.getCurrent();
                     // 輸出<name>元素的名字和它的文本內(nèi)容。
                     System.out.println(elt.getName() + " : " + elt.getText());
                 }
              }
          }

          posted @ 2012-06-15 11:14 youngturk 閱讀(645) | 評論 (0)編輯 收藏

          使用accepter遍歷所有XML子元素

          public class Myvisitor extends VisitorSupport {
              /**
               * 對于屬性節(jié)點,打印屬性的名字和值
               */
              public void visit(Attribute node) {
                  System.out.println("attribute : " + node.getName() + " = "
                         + node.getValue());
              }

              /**
               * 對于處理指令節(jié)點,打印處理指令目標和數(shù)據(jù)
               */
              public void visit(ProcessingInstruction node) {
                  System.out.println("PI : " + node.getTarget() + " "
                         + node.getData());
              }

              /**
               * 對于元素節(jié)點,判斷是否只包含文本內(nèi)容,如是,則打印標記的名字和 元素的內(nèi)容。如果不是,則只打印標記的名字
               */
              public void visit(Element node) {
                  if (node.isTextOnly())
                     System.out.println("element : " + node.getName() + " = "
                            + node.getText());
                  else
                     System.out.println("--------" + node.getName() + "--------");
              }
           
              @Test
              public void test() throws DocumentException {
                  SAXReader saxReader = new SAXReader();
                  Document document = saxReader.read("src/book.xml");
                  // dom4jParser.traversalDocumentByIterator();
                  document.accept(new Myvisitor());
               }
              

          posted @ 2012-06-14 22:45 youngturk 閱讀(246) | 評論 (0)編輯 收藏

          dom4j解析 字符串傳喚成xml

          d
          oc = DocumentHelper.parseText(xml); // 將字符串轉為XML

          map.put(
          "title", title);
                          
                          Iterator
          <?> iters = recordEle.elementIterator("script");

          String title 
          = recordEle.elementTextTrim("title"); // 拿到head節(jié)點下的子節(jié)點title值
          Iterator iters = map.keySet().iterator();
                  
          while (iters.hasNext()) {
                      String key 
          = iters.next().toString(); // 拿到鍵
                      String val = map.get(key).toString(); // 拿到值
                      System.out.println(key + "=" + val);



          List list = (document.selectNodes("/books/book/@show" )); // xpath解析
                      Iterator iter = list.iterator();
                      while(iter.hasNext()){
                          Attribute attribute = (Attribute)iter.next();
                          if(attribute.getValue().equals("yes")){
                          attribute.setValue("no");
                          }
                         
                          Element ownerElement = (Element)iter.next();
                          Element dateElement = ownerElement.addElement("date");
                          dateElement.setText("2004-09-11");

                      }

           

          posted @ 2012-06-14 14:44 youngturk 閱讀(541) | 評論 (0)編輯 收藏

          dom4j實例 的Xpath解析 轉

          books.xml:

          <?xml version="1.0" encoding="UTF-8"?>  
              
          <books>  
                  
          <!--This is a test for dom4j, jakoes, 2007.7.19-->  
                  
          <book show="yes" url="lucene.net">  
                      
          <title id="456">Lucene Studing</title>  
                  
          </book>  
                  
          <book show="yes" url="dom4j.com">  
                      
          <title id="123">Dom4j Tutorials</title>  
                  
          </book>  
                  
          <book show="no" url="spring.org">  
                      
          <title id="789">Spring in Action</title>  
                  
          </book>  
                  
          <owner>O'Reilly</owner>  
              </books> 



          public void parseBooks(){  
                   
                  SAXReader reader 
          = new SAXReader();  
                  
          try {  
                      Document doc 
          = reader.read("books.xml");  
                      Node root 
          = doc.selectSingleNode("/books");  
                      List list 
          = root.selectNodes("book[@url='dom4j.com']");  
                       
                      
          for(Object o:list){  
                           
                          Element e 
          = (Element) o;  
                          String show
          =e.attributeValue("show");  
                          System.out.println(
          "show = " + show);  
                      }  
                      
                  } 
          catch (Exception e) {  
                      e.printStackTrace();  
                  }  
              }  
          Document doc 
          = reader.read("books.xml");的意思是加載XML文檔,此是可以用doc.asXML()來查看,它將打印整個xml文檔。

            Node root 
          = doc.selectSingleNode("/books");是讀取剛才加載的xml文檔內(nèi)的books節(jié)點下的所有內(nèi)容,對于本例也是整個xml文檔。
            當然我們也可以加載
          /books下的某一個節(jié)點,如:book節(jié)點
          Node root 
          = doc.selectSingleNode("/books/book");
          或:Node root 
          = doc.selectSingleNode("/books/*");
          注意:如果有多個book節(jié)點,它只會讀取第一個
          root.asXML()將打?。?br />
          <book show="yes" url="lucene.net">
                  
          <title id="456">Lucene Studing</title>
          </book>

            既然加載了這么多,那我怎么精確的得到我想要的節(jié)點呢,別急,看下面:
          List list 
          = root.selectNodes("book[@url='dom4j.com']");
          它的意思就是讀取books節(jié)點下的book節(jié)點,且book的節(jié)點的url屬性為dom4j.com
          為什么使用list來接收呢,如果有兩個book節(jié)點,且它們的url屬性都為dom4j.com,此時就封閉到list里了。

            如果想讀取books下的所有book節(jié)點,可以這樣:
          List list 
          = root.selectNodes("book");

            如果想讀取books節(jié)點下的book節(jié)點下的title節(jié)點,可以這樣:
          List list2 
          = root.selectNodes("book[@url='dom4j.com']/title[@id='123']");

            注意:selectNodes()參數(shù)的格式:
            節(jié)點名[@屬性名
          ='屬性值'],如:book[@url='dom4j.com']
            如果有多個節(jié)點,用“
          /”分開,如:book[@url='dom4j.com']/title[@id='123']

            最近就是讀取封閉在List里的內(nèi)容了,可以用Node來讀取,也可以用Element來轉換。
          attributeValue(
          "屬性")是讀取該節(jié)點的屬性值
          getText()是讀取節(jié)點的的內(nèi)容。




          posted @ 2012-06-14 08:56 youngturk 閱讀(1092) | 評論 (0)編輯 收藏

          僅列出標題
          共33頁: First 上一頁 10 11 12 13 14 15 16 17 18 下一頁 Last 
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統(tǒng)計

          公告

          this year :
          1 jQuery
          2 freemarker
          3 框架結構
          4 口語英語

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          EJB學習

          Flex學習

          learn English

          oracle

          spring MVC web service

          SQL

          Struts

          生活保健

          解析文件

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 乌兰察布市| 得荣县| 米泉市| 抚顺县| 盖州市| 年辖:市辖区| 武汉市| 耒阳市| 新疆| 石景山区| 河池市| 玛纳斯县| 临江市| 武陟县| 炉霍县| 隆林| 临汾市| 交城县| 冀州市| 读书| 辉南县| 吴忠市| 泸西县| 神农架林区| 梓潼县| 连江县| 唐山市| 萨嘎县| 水富县| 汝城县| 新和县| 拉孜县| 永城市| 新源县| 大埔县| 长阳| 龙口市| 遵义县| 深水埗区| 芜湖县| 翁源县|