小菜毛毛技術(shù)分享

          與大家共同成長

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            164 Posts :: 141 Stories :: 94 Comments :: 0 Trackbacks

          #

          目標(biāo):
          本文主要介紹如何定義實(shí)體的主、次標(biāo)識符。

          一、標(biāo)識符
          標(biāo)識符是實(shí)體中一個或多個屬性的集合,可用來唯一標(biāo)識實(shí)體中的一個實(shí)例。要強(qiáng)調(diào)的是,CDM中的標(biāo)識符等價于PDM中的主鍵或候選鍵。
          每個實(shí)體都必須至少有一個標(biāo)識符。如果實(shí)體只有一個標(biāo)識符,則它為實(shí)體的主標(biāo)識符。如果實(shí)體有多個標(biāo)識符,則其中一個被指定為主標(biāo)識符,其余的標(biāo)識符就是次標(biāo)識符了。

          二、如果定義主、次標(biāo)識符
          1)選擇某個實(shí)體雙擊彈出實(shí)體的屬性對話框。在Identifiers選項(xiàng)卡上可以進(jìn)行實(shí)體標(biāo)識符的定義。如下圖所示



          2)選擇第一行“主標(biāo)識符”,點(diǎn)擊屬性按鈕或雙擊第一行“主標(biāo)識符”,彈出屬性對話框,如圖所示

          3)選擇"Attributes"選項(xiàng)卡,再點(diǎn)擊“Add Attributes”工具,彈出如圖所示窗口,選擇某個屬性作為標(biāo)識符就行了。

          待續(xù)。

          0
          0
          (請您對文章做出評價)
          posted @ 2009-08-13 15:19 小菜毛毛 閱讀(304) | 評論 (0)編輯 收藏

          目標(biāo):
          本文主要介紹屬性的標(biāo)準(zhǔn)檢查約束、如何定義屬性的附加檢查。

          一、定義屬性的標(biāo)準(zhǔn)檢查約束
          標(biāo)準(zhǔn)檢查約束是一組確保屬性有效的表達(dá)式。在實(shí)體屬性的特性窗口,打開如圖所示的檢查選項(xiàng)卡。


          在這個選項(xiàng)卡可以定義屬性的標(biāo)準(zhǔn)檢查約束,窗口中每項(xiàng)的參數(shù)的含義,如下
          參數(shù) 說明
          Minimum 屬性可接受的最小數(shù)
          Maximum  屬性可接受的最大數(shù)
          Default 屬性不賦值時,系統(tǒng)提供的默認(rèn)值
          Unit 單位,如公里、噸、元
          Format 屬性的數(shù)據(jù)顯示格式
          Lowercase 屬性的賦值全部變?yōu)樾懽帜?/td>
          Uppercase 屬性的賦值全部變?yōu)榇髮懽帜?/td>
          Cannot modify 該屬性一旦賦值不能再修改
          List Of Values 屬性賦值列表,除列表中的值,不能有其他的值
          Label 屬性列表值的標(biāo)簽

          二、定義屬性的附加檢查
          當(dāng)Standard checks 或Rules 不能滿足檢查的要求時,可以在Additional Checks選項(xiàng)卡的Server子頁上,通過SQL語句中使用%MINMAX%、%LISTVAL%、%RULES%、%UPPER%、%LOWER%幾個變量來定義Standard和Rule,如圖所示


          %MINMAX%、%LISTVAL%、%UPPER%、%LOWER%
          在Standard Check中定義的Minimum 和Maximum、List values 、uppervalues、lowervalues

          %RULES%
          在Rules特性窗口Expression選項(xiàng)卡中定義的有效性規(guī)則表達(dá)式


          待續(xù)。
          posted @ 2009-08-13 15:17 小菜毛毛 閱讀(449) | 評論 (0)編輯 收藏

          目標(biāo):
          本文主要介紹PowerDesigner概念數(shù)據(jù)模型以及實(shí)體、屬性創(chuàng)建。

          一、新建概念數(shù)據(jù)模型
          1)選擇File-->New,彈出如圖所示對話框,選擇CDM模型(即概念數(shù)據(jù)模型)建立模型。


          2)完成概念數(shù)據(jù)模型的創(chuàng)建。以下圖示,對當(dāng)前的工作空間進(jìn)行簡單介紹。(以后再更詳細(xì)說明)


          3)選擇新增的CDM模型,右擊,在彈出的菜單中選擇“Properties”屬性項(xiàng),彈出如圖所示對話框。在“General”標(biāo)簽里可以輸入所建模型的名稱、代碼、描述、創(chuàng)建者、版本以及默認(rèn)的圖表等等信息。在“Notes”標(biāo)簽里可以輸入相關(guān)描述及說明信息。當(dāng)然再有更多的標(biāo)簽,可以點(diǎn)擊 "More>>"按鈕,這里就不再進(jìn)行詳細(xì)解釋。


          二、創(chuàng)建新實(shí)體
          1)在CDM的圖形窗口中,單擊工具選項(xiàng)版上的Entity工具,再單擊圖形窗口的空白處,在單擊的位置就出現(xiàn)一個實(shí)體符號。點(diǎn)擊Pointer工具或右擊鼠標(biāo),釋放Entitiy工具。如圖所示

          2)雙擊剛創(chuàng)建的實(shí)體符號,打開下列圖標(biāo)窗口,在此窗口“General”標(biāo)簽中可以輸入實(shí)體的名稱、代碼、描述等信息。


          三、添加實(shí)體屬性
          1)在上述窗口的“Attribute”選項(xiàng)標(biāo)簽上可以添加屬性,如下圖所示。


          注意:
          數(shù)據(jù)項(xiàng)中的“添加屬性”和“重用已有數(shù)據(jù)項(xiàng)”這兩項(xiàng)功能與模型中Data Item的Unique code 和Allow reuse選項(xiàng)有關(guān)。
          P列表示該屬性是否為主標(biāo)識符;D列表示該屬性是否在圖形窗口中顯示;M列表示該屬性是否為強(qiáng)制的,即該列是否為空值。

          如果一個實(shí)體屬性為強(qiáng)制的,那么, 這個屬性在每條記錄中都必須被賦值,不能為空。

          2)在上圖所示窗口中,點(diǎn)擊插入屬性按鈕,彈出屬性對話框,如下圖所示。

          注意:這里涉及到域的概念,即一種標(biāo)準(zhǔn)的數(shù)據(jù)結(jié)構(gòu),它可應(yīng)用至數(shù)據(jù)項(xiàng)或?qū)嶓w的屬性上。在以下的教程中將另立章節(jié)詳細(xì)說明。

          待續(xù)。

          posted @ 2009-08-13 15:09 小菜毛毛 閱讀(368) | 評論 (0)編輯 收藏

          目標(biāo):
          本文主要介紹PowerDesigner中概念數(shù)據(jù)模型 CDM的基本概念。

          一、概念數(shù)據(jù)模型概述
          數(shù)據(jù)模型是現(xiàn)實(shí)世界中數(shù)據(jù)特征的抽象。數(shù)據(jù)模型應(yīng)該滿足三個方面的要求:
          1)能夠比較真實(shí)地模擬現(xiàn)實(shí)世界
          2)容易為人所理解
          3)便于計(jì)算機(jī)實(shí)現(xiàn)

          概念數(shù)據(jù)模型也稱信息模型,它以實(shí)體-聯(lián)系(Entity-RelationShip,簡稱E-R)理論為基礎(chǔ),并對這一理論進(jìn)行了擴(kuò)充。它從用戶的觀點(diǎn)出發(fā)對信息進(jìn)行建模,主要用于數(shù)據(jù)庫的概念級設(shè)計(jì)。

          通常人們先將現(xiàn)實(shí)世界抽象為概念世界,然后再將概念世界轉(zhuǎn)為機(jī)器世界。換句話說,就是先將現(xiàn)實(shí)世界中的客觀對象抽象為實(shí)體(Entity)和聯(lián)系(Relationship),它并不依賴于具體的計(jì)算機(jī)系統(tǒng)或某個DBMS系統(tǒng),這種模型就是我們所說的CDM;然后再將CDM轉(zhuǎn)換為計(jì)算機(jī)上某個DBMS所支持的數(shù)據(jù)模型,這樣的模型就是物理數(shù)據(jù)模型,即PDM。

          CDM是一組嚴(yán)格定義的模型元素的集合,這些模型元素精確地描述了系統(tǒng)的靜態(tài)特性、動態(tài)特性以及完整性約束條件等,其中包括了數(shù)據(jù)結(jié)構(gòu)、數(shù)據(jù)操作和完整性約束三部分。
          1)數(shù)據(jù)結(jié)構(gòu)表達(dá)為實(shí)體和屬性;
          2)數(shù)據(jù)操作表達(dá)為實(shí)體中的記錄的插入、刪除、修改、查詢等操作;
          3)完整性約束表達(dá)為數(shù)據(jù)的自身完整性約束(如數(shù)據(jù)類型、檢查、規(guī)則等)和數(shù)據(jù)間的參照完整性約束(如聯(lián)系、繼承聯(lián)系等);


          二、實(shí)體、屬性及標(biāo)識符的定義
          實(shí)體(Entity),也稱為實(shí)例,對應(yīng)現(xiàn)實(shí)世界中可區(qū)別于其他對象的“事件”或“事物”。例如,學(xué)校中的每個學(xué)生,醫(yī)院中的每個手術(shù)。
          每個實(shí)體都有用來描述實(shí)體特征的一組性質(zhì),稱之為屬性,一個實(shí)體由若干個屬性來描述。如學(xué)生實(shí)體可由學(xué)號、姓名、性別、出生年月、所在系別、入學(xué)年份等屬性組成。

          實(shí)體集(Entity Set)是具體相同類型及相同性質(zhì)實(shí)體的集合。例如學(xué)校所有學(xué)生的集合可定義為“學(xué)生”實(shí)體集,“學(xué)生”實(shí)體集中的每個實(shí)體均具有學(xué)號、姓名、性別、出生年月、所在系別、入學(xué)年份等性質(zhì)。

          實(shí)體類型(Entity Type)是實(shí)體集中每個實(shí)體所具有的共同性質(zhì)的集合,例如“患者”實(shí)體類型為:患者{門診號,姓名,性別,年齡,身份證號.............}。實(shí)體是實(shí)體類型的一個實(shí)例,在含義明確的情況下,實(shí)體、實(shí)體類型通常互換使用。

          實(shí)體類型中的每個實(shí)體包含唯一標(biāo)識它的一個或一組屬性,這些屬性稱為實(shí)體類型的標(biāo)識符(Identifier),如“學(xué)號”是學(xué)生實(shí)體類型的標(biāo)識符,“姓名”、“出生日期”、“信址”共同組成“公民”實(shí)體類型的標(biāo)識符。

          有些實(shí)體類型可以有幾組屬性充當(dāng)標(biāo)識符,選定其中一組屬性作為實(shí)體類型的主標(biāo)識符,其他的作為次標(biāo)識符。

          三、實(shí)體、屬性及標(biāo)識符的表達(dá)



          待續(xù)!

          posted @ 2009-08-13 15:05 小菜毛毛 閱讀(362) | 評論 (0)編輯 收藏

          log4j入門與提高-實(shí)例講解

          關(guān)鍵字: log4j,輸出到控制臺,日志文件,日志文件分天,日志郵件

          官方網(wǎng)站:http://logging.apache.org/log4j/index.html:

           

          廢話不多說,切入主題,下面都是基礎(chǔ)的應(yīng)用。后面我會寫有關(guān)擴(kuò)展的應(yīng)用,使它更聽話。

           

          讀取配置文件

          Java代碼 復(fù)制代碼
          1. package org.cjj.log4j.config.xml;   
          2.   
          3. import java.net.URL;   
          4.   
          5. import org.apache.log4j.xml.DOMConfigurator;   
          6.   
          7. /**  
          8.  * 單實(shí)例 讀取log4j配置文件,初始化log4j  
          9.  *   
          10.  * @author cjj  
          11.  *   
          12.  */  
          13. public class Log4jXMLConfig   
          14. {   
          15.     private static Log4jXMLConfig instance;   
          16.   
          17.     public static synchronized Log4jXMLConfig initia()   
          18.     {   
          19.         if (instance == null)   
          20.         {   
          21.             return new Log4jXMLConfig();   
          22.         }   
          23.         return instance;   
          24.     }   
          25.   
          26.     private Log4jXMLConfig()   
          27.     {   
          28.         final URL url = Log4jXMLConfig.class.getResource("log4j.xml");   
          29.         DOMConfigurator.configure(url);   
          30.     }   
          31. }  

           

          配置文件

          Xml代碼 復(fù)制代碼
          1. <?xml version="1.0" encoding="UTF-8" ?>  
          2. <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">  
          3. <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">  
          4.   
          5.     <!-- ========================== 自定義輸出格式說明================================ -->  
          6.     <!-- %p 輸出優(yōu)先級,即DEBUG,INFO,WARN,ERROR,F(xiàn)ATAL -->  
          7.     <!-- #%r 輸出自應(yīng)用啟動到輸出該log信息耗費(fèi)的毫秒數(shù)  -->  
          8.     <!-- #%c 輸出所屬的類目,通常就是所在類的全名 -->  
          9.     <!-- #%t 輸出產(chǎn)生該日志事件的線程名 -->  
          10.     <!-- #%n 輸出一個回車換行符,Windows平臺為“\r\n”,Unix平臺為“\n” -->  
          11.     <!-- #%d 輸出日志時間點(diǎn)的日期或時間,默認(rèn)格式為ISO8601,也可以在其后指定格式,比如:%d{yyy MMM dd HH:mm:ss,SSS},輸出類似:2002年10月18日 22:10:28,921  -->  
          12.     <!-- #%l 輸出日志事件的發(fā)生位置,包括類目名、發(fā)生的線程,以及在代碼中的行數(shù)。舉例:Testlog4.main(TestLog4.java:10)  -->  
          13.     <!-- ========================================================================== -->  
          14.        
          15.     <!-- ========================== 輸出方式說明================================ -->  
          16.     <!-- Log4j提供的appender有以下幾種:  -->  
          17.     <!-- org.apache.log4j.ConsoleAppender(控制臺),  -->  
          18.     <!-- org.apache.log4j.FileAppender(文件),  -->  
          19.     <!-- org.apache.log4j.DailyRollingFileAppender(每天產(chǎn)生一個日志文件), -->  
          20.     <!-- org.apache.log4j.RollingFileAppender(文件大小到達(dá)指定尺寸的時候產(chǎn)生一個新的文件),  -->  
          21.     <!-- org.apache.log4j.WriterAppender(將日志信息以流格式發(fā)送到任意指定的地方)   -->  
          22. <!-- ========================================================================== -->  
          23. <!-- 輸出到日志文件  -->  
          24.     <appender name="filelog_appender"  
          25.         class="org.apache.log4j.RollingFileAppender">  
          26.         <!-- 設(shè)置File參數(shù):日志輸出文件名 -->  
          27.         <param name="File" value="log/testlog4jxml_all.log" />  
          28.         <!-- 設(shè)置是否在重新啟動服務(wù)時,在原有日志的基礎(chǔ)添加新日志 -->  
          29.         <param name="Append" value="true" />  
          30.         <!-- 設(shè)置文件大小 -->  
          31.         <param name="MaxFileSize" value="1MB" />  
          32.         <!-- 設(shè)置文件備份 -->  
          33.         <param name="MaxBackupIndex" value="10000" />  
          34.         <!-- 設(shè)置輸出文件項(xiàng)目和格式 -->  
          35.         <layout class="org.apache.log4j.PatternLayout">  
          36.             <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p (%c:%L)- %m%n" />  
          37.         </layout>  
          38.     </appender>  
          39.   
          40. <!-- 輸出到日志文件 每天一個日志  -->  
          41.     <appender name="filelog_daily" class="org.apache.log4j.DailyRollingFileAppender">      
          42.         <param name="File" value="log/daily.log" />      
          43.         <param name="DatePattern" value="'daily.'yyyy-MM-dd'.log'" />      
          44.         <layout class="org.apache.log4j.PatternLayout">      
          45.             <param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] (%c:%L) - %m%n" />      
          46.         </layout>      
          47.     </appender>    
          48.   
          49. <!-- 輸出到控制臺中 -->  
          50.     <appender name="console" class="org.apache.log4j.ConsoleAppender">  
          51.         <layout class="org.apache.log4j.PatternLayout">  
          52.             <param name="ConversionPattern"  
          53.                 value="%d{yyyy-MM-dd HH:mm:ss} %-5p: %m%n" />  
          54.             <!-- "%-5p: [%t] [%c{3}.%M(%L)] | %m%n" -->  
          55.         </layout>  
          56.     </appender>  
          57.   
          58. <appender name="EMAIL_QQ" class="org.apache.log4j.net.SMTPAppender">  
          59.         <param name="Threshold" value="INFO"/>  
          60.         <param name="BufferSize" value="128" />  
          61.         <param name="SMTPHost" value="smtp.qq.com" />  
          62.         <param name="SMTPUsername" value="cjjvictory" />  
          63.         <param name="SMTPPassword" value="***" />  
          64.         <param name="From" value="cjjvictory@qq.com" />  
          65.         <param name="To" value="cjjvictory@gmail.com" />  
          66.         <param name="Subject" value="測試郵件發(fā)送" />  
          67.         <param name="LocationInfo" value="true" />  
          68.         <param name="SMTPDebug" value="true" />  
          69.         <layout class="org.cjj.log4j.extend.PatternLayout_zh">  
          70.             <param name="ConversionPattern" value="[%d{ISO8601}] %-5p %c %m%n"/>  
          71.         </layout>  
          72.     </appender>  
          73.   
          74. <!--- 異步測試,當(dāng)日志達(dá)到緩存區(qū)大小時候執(zhí)行所包的appender -->  
          75.     <appender name="ASYNC_test" class="org.apache.log4j.AsyncAppender">      
          76.      <param name="BufferSize" value="10"/>      
          77.      <appender-ref ref="EMAIL_QQ"/>  
          78.    </appender>  
          79.   
          80.  <!-- 設(shè)置包限制輸出的通道 -->  
          81.     <category name="org.cjj" additivity="false">  
          82.                <!-- 日志輸出級別,起碼可以有5個級別,可以擴(kuò)展自己的級別,郵件發(fā)送必須是ERROR級別不好用,所以最后自己擴(kuò)展一個郵件發(fā)送級別 -->  
          83.         <level value="ERROR" />  
          84.         <appender-ref ref="filelog_daily" />  
          85.         <appender-ref ref="daily_appender" />  
          86.         <appender-ref ref="console" />  
          87.         <appender-ref ref="ASYNC_test" />  
          88.  </category>  
          89.   
          90. </log4j:configuration>  

           

          郵件亂碼問題:

           

          郵件發(fā)送的布局采用了org.cjj.log4j.extend.PatternLayout_zh,因?yàn)樵瓉淼膐rg.apache.log4j.PatternLayout會有亂碼,所以重寫一個方法既可。可能方法有點(diǎn)野蠻,所以那位有好的方法還請指教。

           

          Java代碼 復(fù)制代碼
          1. package org.cjj.log4j.extend;   
          2.   
          3. import org.apache.log4j.PatternLayout;   
          4.   
          5. public class PatternLayout_zh extends PatternLayout   
          6. {   
          7.     @Override  
          8.     public String getContentType()   
          9.     {   
          10.         return "text/html;charset=GBK";   
          11.     }   
          12. }  
           
          posted @ 2009-08-06 08:41 小菜毛毛 閱讀(532) | 評論 (0)編輯 收藏

          datagrid.mxml-----------------------------------------------------------------------------------
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
               creationComplete="srv.send()"><!-- 發(fā)送HTTPService請求-->
             
              <mx:Script >
                  <![CDATA[
                      import mx.collections.XMLListCollection;
                      import mx.collections.ArrayCollection;
                      import mx.rpc.events.ResultEvent;
                      [Bindable]
                      private var users:XML;

                    private  function resultUsers(event:ResultEvent):void{//處理結(jié)果
                    users = XML(event.result);
                    datagrid.dataProvider=users.children();//XMLList
                   
                    }
                  ]]>
              </mx:Script>
             
              <mx:HTTPService url="user.xml" useProxy="false" id="srv" resultFormat="xml" result="resultUsers(event)"><!--處理結(jié)果函數(shù)-->
                 
              </mx:HTTPService>
                  <mx:Panel x="416" y="75" width="458" height="269" layout="absolute" id="panel" title="用戶信息" fontSize="14" fontWeight="bold" fontFamily="Verdana" color="#BB8BDD" borderStyle="solid" borderThickness="3" borderColor="#0E0505" cornerRadius="20" themeColor="#A3C2D8" alpha="0.85" backgroundColor="#FFFFFF" backgroundAlpha="0.84">
                          <mx:DataGrid x="32" y="10" width="374" height="193" id="datagrid" enabled="true" fontSize="13" fontWeight="bold" textAlign="center" color="#526BBE" borderColor="#C0C8CC" themeColor="#A9B1B3" alpha="0.86" alternatingItemColors="[#E9E9E9, #EFF8F9]" borderStyle="inset">
                              <mx:columns>
                                  <mx:DataGridColumn headerText="ID" dataField="ID"/>
                                  <mx:DataGridColumn headerText="姓名" dataField="name"/>
                                  <mx:DataGridColumn headerText="年齡" dataField="age"/>
                              </mx:columns>
                          </mx:DataGrid>             
                  </mx:Panel>
          </mx:Application>

          --------------------user.xml--------------------------------------------------------------------------------------------------------------------
          <?xml version="1.0" encoding="utf-8"?>
          <users>
              <user>
                 <ID>213001</ID>
                 <name>飛機(jī)</name>
                 <age>22</age>
             </user>
             <user>
                 <ID>213003</ID>
                 <name>痞子</name>
                 <age>23</age>
             </user>
             <user>
                 <ID>213006</ID>
                 <name>嗨嗨</name>
                 <age>22</age>
             </user>
             <user>
                 <ID>213013</ID>
                 <name>小強(qiáng)</name>
                 <age>21</age>
             </user>
             <user>
                 <ID>213015</ID>
                 <name>蕭蕭</name>
                 <age>22</age>
             </user>
             <user>
                 <ID>213016</ID>
                 <name>小敏</name>
                 <age>22</age>
             </user>
          </users>

          文章出處:http://www.diybl.com/course/4_webprogram/xml/xml_js/200855/113849.html

          posted @ 2009-07-30 23:07 小菜毛毛 閱讀(2037) | 評論 (0)編輯 收藏

          用actionscript給服務(wù)器請求添加參數(shù)難免會很麻煩,使用mx:request標(biāo)簽就可以解決這一問題,可以把他
          嵌套到HTTPService標(biāo)簽中實(shí)現(xiàn)參數(shù)的提交。如下例所示:
          Xml代碼 復(fù)制代碼
          1. <mx:request>  
          2.       <txtPara>{txtPara.text}</txtPara>  
          3.  </mx:request>  

          其中txtPara是發(fā)送到服務(wù)器端參數(shù)的名城,標(biāo)簽體是參數(shù)值,而標(biāo)簽體的值就是下方文本框的值。
          以下是完整的mxml文件:
          Xml代碼 復(fù)制代碼
          1. <?xml version="1.0" encoding="utf-8"?>  
          2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >  
          3.     <mx:Script>     
          4.       <![CDATA[    
          5.         import mx.rpc.events.ResultEvent;                
          6.         import mx.controls.Alert;                        
          7.         private function httpHandle(e:ResultEvent):void   
          8.         {  
          9.             Alert.show(e.result.Result);  
          10.         }  
          11.         ]]>     
          12.     </mx:Script>     
          13.     <mx:HTTPService id="myHttp" url="http://localhost:8080/myflex/http" showBusyCursor="true" result="httpHandle(event);" useProxy="false">  
          14.         <mx:request>  
          15.             <txtPara>{txtPara.text}</txtPara>  
          16.         </mx:request>  
          17.     </mx:HTTPService>  
          18.     <mx:Panel title="TEST HTTPService" width="368" height="140" x="78" y="30" layout="absolute">  
          19.         <mx:Label text="PARA" x="110" y="26"/>     
          20.         <mx:TextInput id="txtPara" x="161" y="24" width="95"/>    
          21.         <mx:Label text="The para sent to service is:" x="58" y="53"/>  
          22.         <mx:Label x="126" y="53" id="lblResult"/>     
          23.         <mx:Button label="Submit" click="myHttp.send()" x="277" y="53"/>      
          24.     </mx:Panel>  
          25. </mx:Application>  

          在服務(wù)器端就可以從request中取到txtPara參數(shù)的值,這里沒有做過多處理,只是在后端取到這個值又通過xml形式返還到客戶端。
          這是例子運(yùn)行的截圖:


          mx:request組件一般是結(jié)合mx:form組件一起使用,flex提供了完備的數(shù)據(jù)校驗(yàn)功能,如對字符串的校驗(yàn)mx:StringValidator、
          對電話號碼驗(yàn)證的mx:PhoneNumberValidator、對日期驗(yàn)證的mx:DateValidator、對電子郵件驗(yàn)證的mx:EmailValidator、對郵編驗(yàn)證
          的mx:ZipCodeValidator等等。下面這個示例來自Flex的在線文檔,主要展示flex的form驗(yàn)證功能,沒有數(shù)據(jù)的提交。

          Xml代碼 復(fù)制代碼
          1. <?xml version="1.0" encoding="utf-8"?>  
          2. <!-- Simple example to demonstrate Form layout container. -->  
          3. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">  
          4.     <mx:Panel title="Form Container Example" height="75%" width="75%"    
          5.         paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">  
          6.         <mx:Text width="100%" color="blue"  
          7.             text="Moving from one form field to another triggers the validator."/>  
          8.         <mx:Form width="100%" height="100%">  
          9.             <mx:FormHeading label="Enter values into the form."/>  
          10.             <mx:FormItem label="First name">  
          11.                 <mx:TextInput id="fname" width="200"/>  
          12.             </mx:FormItem>  
          13.             <mx:FormItem label="Date of birth (mm/dd/yyyy)">  
          14.                 <mx:TextInput id="dob" width="200"/>  
          15.             </mx:FormItem>  
          16.             <mx:FormItem label="E-mail address">  
          17.                 <mx:TextInput id="email" width="200"/>  
          18.             </mx:FormItem>  
          19.             <mx:FormItem label="Age">  
          20.                 <mx:TextInput id="age" width="200"/>  
          21.             </mx:FormItem>  
          22.             <mx:FormItem label="SSN">  
          23.                 <mx:TextInput id="ssn" width="200"/>  
          24.             </mx:FormItem>  
          25.             <mx:FormItem label="Zip">  
          26.                 <mx:TextInput id="zip" width="200"/>  
          27.             </mx:FormItem>  
          28.             <mx:FormItem label="Phone">  
          29.                 <mx:TextInput id="phone" width="200"/>  
          30.             </mx:FormItem>  
          31.         </mx:Form>  
          32.     </mx:Panel>  
          33.   
          34.     <mx:StringValidator source="{fname}" property="text" minLength="4" maxLength="12"/>  
          35.     <mx:PhoneNumberValidator source="{phone}" property="text"/>  
          36.     <mx:DateValidator source="{dob}" property="text"/>  
          37.     <mx:EmailValidator source="{email}" property="text"/>  
          38.     <mx:NumberValidator source="{age}" property="text" integerError="Enter Integer value"  
          39.         minValue="18" maxValue="100" domain="int"/>  
          40.     <mx:SocialSecurityValidator source="{ssn}" property="text"/>  
          41.     <mx:ZipCodeValidator source="{zip}" property="text"/>  
          42. </mx:Application>  

          示例運(yùn)行的截圖:
           
          posted @ 2009-07-28 13:55 小菜毛毛 閱讀(361) | 評論 (0)編輯 收藏

          最近學(xué)習(xí)flex,參考了不少網(wǎng)上的資料,特別是 中國flex開發(fā)者(http://www.flexer.cn/)。flex數(shù)據(jù)交互是一個關(guān)鍵,做個學(xué)習(xí)總結(jié),請flex老鳥指正!

          flex和后端的數(shù)據(jù)交互有很多方式,flex可以使用ActionScript讀寫文件(xml、txt)的形式存儲顯示數(shù)據(jù),
          Flex 3.0中新增了對本地?cái)?shù)據(jù)庫(.db格式)操作的類,可用于讀取本地的數(shù)據(jù)庫數(shù)據(jù)。新增了對PDF數(shù)據(jù)
          操作的類,可用于讀取PDF數(shù)據(jù)。

          xml文件方式

          XML優(yōu)點(diǎn)是簡單小巧、存儲方便、檢索快速。所以,XML常用于數(shù)據(jù)存儲和數(shù)據(jù)交換。Flex 3.使用URLLoader類可方便地傳輸XML數(shù)據(jù)。
          使用XML方式傳輸數(shù)據(jù)的步驟如下所示。
          新建名為"tree.xml"文件,用以存儲XML數(shù)據(jù):
          Xml代碼 復(fù)制代碼
          1. <?xml version="1.0" encoding="utf-8"?>  
          2. <menus>  
          3.     <node label="Mail">  
          4.         <node label="Inbox"/>  
          5.         <node label="Personal Folder">  
          6.             <node label="Demo"/>  
          7.             <node label="Personal"/>  
          8.             <node label="Saved Mail"/>  
          9.             <node label="bar"/>  
          10.         </node>  
          11.         <node label="Calendar"/>  
          12.         <node label="Sent"/>  
          13.         <node label="Trash"/>  
          14.     </node>  
          15. </menus>  

          xml文件的讀寫我們可以用FileStream類來實(shí)現(xiàn):
          讀取xml文件:
          Javascript代碼 復(fù)制代碼
          1. var testXML:XML;   
          2. var file:File = File.documentsDirectory.resolvePath("tree.xml");   
          3. var fileStream:FileStream = new FileStream();   
          4. fileStream.open(file, FileMode.READ);   
          5. testXML = XML(fileStream.readUTFBytes(fileStream.bytesAvailable));   
          6. fileStream.close();  

          寫回xml文件
          Javascript代碼 復(fù)制代碼
          1. var testXML:XML=<content>content</content>......;   
          2. var file:File = File.documentsDirectory.resolvePath("tree.xml");   
          3. var fileStream:FileStream = new FileStream();   
          4. fileStream.open(file, FileMode.WRITE);   
          5. var outputString:String = '<?xml version="1.0" encoding="utf-8"?>\n';   
          6. outputString += testXML.toXMLString();   
          7. fileStream.writeUTFBytes(outputString);   
          8. fileStream.close();  

          需要說明一下的是文件打開方式:FileMode
          READ --設(shè)置文件打開方式為只讀
          WRITE--設(shè)置文件打開方式為寫數(shù)據(jù)。文件不存在,則創(chuàng)建;文件存在,則覆蓋原有數(shù)據(jù)。
          APPEND--設(shè)置文件打開方式為追加。文件不存在,則創(chuàng)建;文件存在,則新數(shù)據(jù)從文件末尾開始增加。
          UPDATE--設(shè)置文件打開方式為讀寫。文件不存在,則創(chuàng)建。設(shè)置該模式通常用于隨機(jī)讀寫訪問文件??梢詮奈募娜我馕恢米x取,寫入數(shù)據(jù)時,只有寫入位置的存在字節(jié)被覆蓋,其他所有字節(jié)不受影響。

          這里我們使用URLRequest類來加載xml數(shù)據(jù),編寫應(yīng)用程序初始化處理函數(shù)loadXML。
          變量,用以指明XML文件路徑。
          public function loadXML():void//應(yīng)用程序初始化處理函數(shù)
          {
              //定義URLRequest實(shí)例,指定文件地址。
              var request:URLRequest=new URLRequest("tree.xml");
              loader.load(request);//加載XML文件
              loader.addEventListener(Event.COMPLETE,completeHandle);     //添加加載完成時的監(jiān)聽
          }

          loader.addEventListener(Event.COMPLETE,completeHandle)語句表示添加對XML加載完成事件的監(jiān)聽。一旦加載完成執(zhí)行
          completeHandle函數(shù)。完成剩余MXML代碼。剩余代碼包括completeHandle函數(shù),<mx:Tree>組件設(shè)計(jì)等。
          以下代碼是完整的MXML代碼。
          Java代碼 復(fù)制代碼
          1. <?xml version="1.0" encoding="utf-8"?>   
          2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" fontFamily="simsun"    
          3.     fontSize="12" layout="absolute" width="242" height="442" creationComplete="loadXML()">   
          4.     <mx:Script>   
          5.           <![CDATA[   
          6.             import mx.collections.ArrayCollection;    
          7.             import mx.rpc.events.ResultEvent;          
          8.             public var loader:URLLoader=new URLLoader();   
          9.             public var menus:XML=new XML();            
          10.             public function loadXML():void             
          11.             {   
          12.                 var request:URLRequest=new URLRequest("tree.xml");   
          13.                 loader.load(request);    
          14.                 loader.addEventListener(Event.COMPLETE,completeHandle);   
          15.             }   
          16.             public function completeHandle(e:Event):void  
          17.             {   
          18.                 menus=XML(loader.data);               
          19.                 var results:XMLList=menus.node;       
          20.                 tree.dataProvider=results;    
          21.             }   
          22.           ]]>   
          23.     </mx:Script>   
          24.   
          25.     <mx:Tree id="tree" x="10" y="35" width="218" height="397" labelField="@label" />   
          26.     <mx:Label x="10" y="10" text="Tree Nodes From XML File"/>   
          27.  </mx:Application>  

          這是運(yùn)行結(jié)果截圖:



          <mx:HTTPService>組件方式


          <mx:HTTPService>組件可與所有的后端程序交互。例如,ASP、ASP.Net、JSP、PHP等。
          以下是一個<mx:HTTPService>組件語法示例:
          <mx:HTTPService id="feedRequest" url="http://localhost:8080/myflex/helloworld?para_1=para_1&para_2=para_2" result="showResult(event)" />
          id唯一標(biāo)識該組件,url是數(shù)據(jù)提交的地址,可以在地址后面添加參數(shù),提交到后端進(jìn)行處理,處理后
          再返回Flex可識別的數(shù)據(jù)類型,如數(shù)組型、XML型、Object型等。

          <mx:HTTPService>組件返回的數(shù)據(jù)存儲于ResultEvent類中。使用<mx:HTTPService>組件的result事件可處理HTTP程序返回的數(shù)據(jù)。
          eg. <mx:HTTPService result="處理函數(shù)名">

          返回的數(shù)據(jù)存儲于ResultEvent類的result屬性下。各種數(shù)據(jù)的具體位置與HTTP程序的處理結(jié)果有關(guān)。
          數(shù)據(jù)返回后的處理方法示例:
          Java代碼 復(fù)制代碼
          1. import mx.rpc.events.ResultEvent;                          
          2. import mx.controls.Alert;                                 
          3.   
          4. private function showResult(e:ResultEvent):void  
          5. {   
          6.     Alert.show(e.result as String);                       
          7. }  


          來一個簡單的例子會讓你更加明白的!

          這是客戶端mxml的源代碼:
          Xml代碼 復(fù)制代碼
          1. <?xml version="1.0" encoding="utf-8"?>  
          2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >  
          3.     <mx:Script>     
          4.       <![CDATA[    
          5.         import mx.rpc.events.ResultEvent;                
          6.         import mx.controls.Alert;                     
          7.           
          8.         private var arr:Array=new Array();               
          9.         private function addHandle():void             
          10.         {  
          11.             myHttp.url="http://localhost:8080/myflex/sum";                                                       
          12.             if(arr.length>0)                             
          13.                 myHttp.url+="?";  
          14.             for(var i:int=0;i<arr.length;i++)             
          15.             {  
          16.                 if(i!=arr.length-1)  
          17.                     myHttp.url+="num="+arr[i].para.toString()+"&";  
          18.                 else  
          19.                     myHttp.url+="num="+arr[i].para.toString();  
          20.             }  
          21.             Alert.show(myHttp.url);  
          22.             myHttp.send();                         
          23.         }  
          24.           
          25.         private function addData():void           
          26.         {  
          27.             var obj:Object=new Object();             
          28.             obj.para=txtPara.text;                  
          29.             arr.push(obj);                          
          30.             dg.dataProvider=arr;                     
          31.             txtPara.text="";                       
          32.             dg.validateNow();                        
          33.         }  
          34.           
          35.         private function delData():void           
          36.         {  
          37.             arr=new Array();                               
          38.             dg.dataProvider=arr;                   
          39.             dg.validateNow();                        
          40.         }  
          41.           
          42.         private function httpHandle(e:ResultEvent):void  
          43.         {  
          44.             lblResult.text=e.result.sumTag;  
          45.         }  
          46.         ]]>     
          47.     </mx:Script>     
          48.     <mx:HTTPService id="myHttp" showBusyCursor="true" result="httpHandle(event);" useProxy="false"/>  
          49.     <mx:Panel title="測試HTTPService" width="368" height="334" x="78" y="30" layout="absolute">  
          50.         <mx:Label text="疊加參數(shù):" x="110" y="26"/>  
          51.         <mx:TextInput id="txtPara" x="161" y="24" width="95"/>    
          52.         <mx:DataGrid id="dg" x="76" y="64" height="166" width="179">  
          53.             <mx:columns>  
          54.                 <mx:DataGridColumn dataField="para" headerText="參數(shù)列表"/>  
          55.             </mx:columns>  
          56.         </mx:DataGrid>  
          57.         <mx:Button label="添加" click="addData();" x="277" y="26"/>     
          58.         <mx:Button label="刪除" click="delData();" x="277" y="64"/>     
          59.         <mx:Label text="疊加結(jié)果是:" x="58" y="253"/>  
          60.         <mx:Label x="126" y="253" id="lblResult"/>     
          61.         <mx:Button label="計(jì)算" click="addHandle();" x="277" y="249"/>      
          62.     </mx:Panel>  
          63. </mx:Application>  

          "http://localhost:8080/myflex/sum"是一個servlet的映射地址,actionscript方法addHandle將每一個數(shù)字參數(shù)添加到url映射地
          址后面并且向服務(wù)器發(fā)送請求,addData方法把輸入的數(shù)字顯示到下方列表,delData方法刪除整個列表,httpHandle方法處理服務(wù)器
          的返回值。其中e.result.sumTag表示取得xml返回?cái)?shù)據(jù)中sumTag標(biāo)簽中的內(nèi)容。
          以下是servlet中對接收參數(shù)的處理:
          Java代碼 復(fù)制代碼
          1. public void doPost(HttpServletRequest request, HttpServletResponse response)   
          2.             throws ServletException, IOException   
          3.     {   
          4.         String[] para = request.getParameterValues("num");   
          5.         int sum = 0;   
          6.         if (para != null)   
          7.         {   
          8.             for (int i = 0; i < para.length; i++)   
          9.             {   
          10.                 if (para[i] != null && !"".equals(para[i]))   
          11.                 {   
          12.                     sum = sum + Integer.parseInt(para[i]);   
          13.                 }   
          14.             }   
          15.         }   
          16.         response.getWriter().print(   
          17.                 "<?xml version=\"1.0\" encoding=\"utf-8\"?><sumTag>" + sum   
          18.                         + "</sumTag>");   
          19.     }  


          下面是例子運(yùn)行的截圖:


          下一次學(xué)習(xí)總結(jié)一下<mx:WebService>組件和RemoteObject及其他的交互方式!
          posted @ 2009-07-28 13:53 小菜毛毛 閱讀(1573) | 評論 (0)編輯 收藏

          flex與java--Blazeds學(xué)習(xí)(配置)
          先簡單說一下Blazeds,簡單的講Blazeds就是flex與java平臺進(jìn)行交互的工具,當(dāng)然不僅限于java語言,也包括運(yùn)行在java平臺上的其他語言,關(guān)于這方面可以google下。
             其實(shí)BlazeDS可以看成是LCDS的一個子集,而且是一個開源產(chǎn)品,在一般的項(xiàng)目中完全可以替代LCDS,現(xiàn)在有三個版本,其中Turnkey版內(nèi)置了Tomcat和 Flex 3 SDK,還包含blazeds.war、ds-console.war和samples.war;Binary Distribution版只包括blazeds.war,此為最簡配置;而Source則包含blazeds的Java源代碼,如果想做二次開發(fā)就下載這個。
          下圖是Adobe官方的Blazeds與LCDS的對比,
           
          現(xiàn)在知道什么地方該用哪個了吧
          好了不多說了,看看如何配置:
          目前來說有三種方式:
          第一種:flex工程與java工程相互獨(dú)立;
          第二種:Flex工程整合Java項(xiàng)目;
          第三種:java項(xiàng)目中加入flex;
          其中第一種和第三種在配置上很相似。
          簡單說一下:
           
          第一種:
          1、當(dāng)然是先建一個java工程,把需要的包導(dǎo)入,配置文件寫好,web.xml參考Blazeds的例子,導(dǎo)入Tomcat就ok;
          2、然后建一個flex工程,在Server Technology處選擇J2EE,然后選擇使用LCDS,next;
          3、Web root選擇你發(fā)布到tomcat中的java工程目錄,Root URL寫入你要再瀏覽器中訪問該項(xiàng)目的url,Context root寫你的java工程名;
          4、請確保已經(jīng)開啟tomcat服務(wù),然后點(diǎn)擊Valdate Configuration按鈕,沒有任何錯誤提示點(diǎn)擊Finish即完成項(xiàng)目創(chuàng)建,此flex項(xiàng)目中最后的編譯swf文件都會保存在tomcat下的工程目錄的一個(flex項(xiàng)目名稱)-debug文件夾中,當(dāng)然你也可以更改這個路徑就在output folder那,如下圖:
           
          5、注意:項(xiàng)目建好后右擊工程選擇屬性->flex complier,flex sdk version 一定要更改,一般選default SDK就可以了,不要使用默認(rèn)的serverSDK,這一步很重要,因?yàn)槟憬ǖ氖荓CDS支持的項(xiàng)目,LCDS是支持服務(wù)器端編譯的,Blazeds并不支持,這也是為什么有些人配置Blazeds不能夠正常編譯的原因。
           
          第二種:Flex工程整合Java項(xiàng)目,這里使用MyEclipse+flexBuilder插件版
          1、創(chuàng)建Flex工程,勾選Use remote object access service,next。
          2、 配置J2EE服務(wù)器,我們這里使用Tomcat,Target runtime:選擇一個Tomcat的runtime,沒有就新建一個,只需要指定Tomcat的安裝目錄即可;設(shè)定上下文路徑和blazeds.war的位置,如圖:
           
          3.  設(shè)置輸出文件的路徑,改為webRoot就可以;
          4、以下全部采用默認(rèn)配置就可以,點(diǎn)擊finish;
          5、把flex工程變?yōu)閙yEclipse的web工程,右擊項(xiàng)目選擇MyEclipse->add web project capabilities....,注意不要覆蓋web.xml,右擊工程選擇屬性進(jìn)行其他配置。
           
          第三種:
          1、在已有的java工程上右擊選擇flex project nature->add flex project nature;
          2、以后操作同第一種,不在詳述。
          posted @ 2009-07-23 17:12 小菜毛毛 閱讀(1269) | 評論 (0)編輯 收藏

          1. 不用說?…

            It goes without saying that子句

            = (It is) needless to say (that)子句

            = It is obvious that子句

            = Obviously, S. + V.

            例︰不用說早睡早起是值得的。

            It goes without saying that it pays to keep early hours.

            2. …是不可能的; 無法…

            There is no Ving

            = There is no way of Ving.

            = There is no possibility of Ving.

            = It is impossible to V.

            = It is out of the question to V.

            = No one can V.

            = We cannot V.

            例︰不可否認(rèn)的?成功的事業(yè)關(guān)鍵在于健康的身心。

            There is not denying that successful business lies in a healthy body and mind.

            3. 我深信…

            I am greatly convinced (that)子句

            = I am greatly assured (that)子句

            例︰我深信預(yù)防是于治療。

            I am greatly convinced that prevention is better than cure.

            4. 在各種…之中?…

            Among various kinds of …, …

            = Of all the …, …

            例︰在各種運(yùn)動中?我尤其喜歡慢跑。

            Among various kinds of sports, I like jogging in particular.

            5. …是很容易證明的。

            It can be easily proved (that)子句

            例︰時間最珍貴是很容易證明的。

            It can be easily proved that nothing is more precious than time.

            6. …無論如何強(qiáng)調(diào)都不為過

            … cannot be overemphasized

            例︰交通安全的重要性無論如何強(qiáng)調(diào)都不為過。

            The importance of traffic safety cannot be overemphasized.

            7. 就我的看法?…;我認(rèn)為…

            In my opinion, …

            = To my mind, …。

            = As far as I am concerned, …

            = I am of the opinion that子句

            例︰就我的看法?打電動玩具既花費(fèi)時間也有害健康。

            In my opinion, playing video games not only takes much time but is also harmful to health.

            8. (A) 每個人都知道…

            Everyone knows (that)子句

           ?。˙) 就我所知?…

            As far as my knowledge is concerned, …

            例︰就我所知?下列方法對我?guī)椭艽蟆?/p>

            As far as my knowledge is concerned, the following ways are of great help to me.

            9. 毫無疑問地?…

            There is no doubt (that)子句

            例︰毫無疑問地?近視在我國的年輕人中是一個嚴(yán)重的問題。

            There is no doubt that near-sightedness is a serious problem among the youth of our country.

            10. 根據(jù)我個人經(jīng)驗(yàn)?…

            According to my personal experience, …

            = Based on my personal experience, …

            例︰根據(jù)我個人經(jīng)驗(yàn)?微笑已帶給我許多好處。

            According to my personal experience, smile has done me a lot of good.

          ·                                 11. 在我認(rèn)識的人當(dāng)中?也許沒有一個人比…更值得我尊敬。

            Of all the people I know, perhaps non deserves my respect more than …

            例︰在我認(rèn)識的人當(dāng)中?也許沒有一個人比我的英文老師張老師更值得我尊敬。

            Of all the people I know, perhaps non deserves my respect more than Miss Chang, my English teacher.

            12. 在我的求學(xué)過程中?我忘不了…

            In the course of my schooling. I will never forget …

            例︰在我的求學(xué)過程中?我忘不了學(xué)習(xí)英文所遭到的大困難。

            In the course of my schooling. I will never forget the great difficulty I encountered in learning English.

            13. (A) 隨著人口的增加?… With the increase/growth of the population, …

           ?。˙) 隨著科技的進(jìn)步, … With the advance of science and technology, …

            例︰隨著臺灣經(jīng)濟(jì)的快速發(fā)展?許多社會問題產(chǎn)生了。

            With the rapid development of Taiwan's economy, a lot of social problems have come to pass.

            14. (A) 在這信息的年代?…扮演重要的角色。

            In the age of information and communication, … plays an important role.

           ?。˙) 在今日工業(yè)社會中?…是生命不可或缺的。

            In today's industrial society, … is indispensable to life.

            例︰在這信息的年代?計(jì)算機(jī)扮演非常重要的角色。

            In this age of information and communication, the computer plays an extremely important role.

            15. 在討論…?一個人不得不承認(rèn)…。

            In dealing with …, one cannot but admit (that)子句

            例︰在討論未來的職業(yè)?一個人不得不承認(rèn)盡早決定未來的職業(yè)很重要。

            In dealing with one's future career, one cannot but admit that it is very important to decide one's future career as early as possible.

            16. 世上沒有什么比…更令我高興。

            Nothing in the world can delight me so much as …

            例︰世上沒有什么比到快餐店吃漢堡更令我高興。

            Nothing in the world can delight me so much as having hamburgers in fast-food restaurants.

            17. … 是必要的 It is necessary that S (should) V

            … 是重要的 It is important/essential that S (should) V

            … 是適當(dāng)?shù)?It is proper that S (should) V

            … 是緊急的 It is urgent that S (should) V

            例︰我們當(dāng)保持公共場所清潔是應(yīng)當(dāng)?shù)摹?/p>

            It is proper that we (should) keep the public places clean.

            18. 每當(dāng)我聽到…?我就忍不住感到興奮。Whenever I hear …, I cannot but feel excited.

            每當(dāng)我做…? 我就忍不住感到悲傷。 Whenever I do …, I cannot but feel sad.

            每當(dāng)我想到…?我就忍不住感到緊張。Whenever I think of …, I cannot but feel nervous.

            每當(dāng)我遭遇…?我就忍不住感到害怕。Whenever I meet with …, I cannot but feel frightened.

            每當(dāng)我看到… 我就忍不住感到驚訝。Whenever I see …, I cannot but feel surprised.

            例︰每當(dāng)我想到我家附近那一條清澈的小溪?我就忍不住感到悲傷。

            Whenever I think of the clean brook near my home, I cannot but feel sad.

            = Every time I think of the clean brook near my home, I cannot help feeling sad.

            19. 據(jù)說… It is said (that)子句

            一般認(rèn)為… It is thought (that)子句

            大家都知道… It is known (that)子句

            據(jù)報導(dǎo)… It is reported (that)子句

            一般預(yù)料… It is expected (that)子句

            一般估計(jì)… It is estimated (that)子句

            一般相信… It is believed (that)子句

            例︰一般相信閱讀增加我們的知識、擴(kuò)大我們的心胸。

            It is believed (that) reading increases our knowledge and broadens our mind.

            20. …的主要理由是…

            The main reason why ……… is (that)子句

            例︰青少年犯罪的主要理由是社會環(huán)境日一敗壞。

            The main reason why the juveniles commit crimes is that social environment is becoming worse.

          ·                                 21. 俗語說得好:「…」。

            Well goes an old saying, “…”

            = As an old saying goes(runs, says), “…”

            = An old saying goes, “…”

            = It's an old saying (that)子句

            例︰俗話說得好:「誠實(shí)為上策」。

            As an old saying goes, “Honesty is the best policy.”

            22. (A) …用下列方法… … in the following ways.

            (B) …有三個主要理由。 … for three major reasons.

           ?。–) 要…?至少我們可做三件事。 To …, there are at least three things we can do.

            例︰(A) 我用下列方法增加信心。

            I increase my confidence in the following ways.

            (B) 人們學(xué)外語有三個理由。

            People learn a foreign language for three major reasons.

           ?。–) 為了維護(hù)健康?我們每天至少可做三件事。

            To keep healthy, there are at least three things we can do every day.

            II. 用于文章承轉(zhuǎn)句

            23. 那就是(說)…;亦即…

            That is to say, …

            = That is, …

            = Namely, …

            例︰我們生活需有規(guī)律。也就是說?早睡早起?戒除煙酒。

            We need to live a regular life. That is, we can keep good hours and refrain from smoking and drinking in the daily activities.

            24. (A) 基于這個理由?… For this reason, …

           ?。˙) 為了這個目的?… For this purpose, …

            例︰基于這個理由?我已決定把行醫(yī)作為未來的職業(yè)。

            For this reason, I have decided to take practicing medicine as my future career.

            25. 我們有理由相信…

            We have reasons to believe (that)子句

            例︰我們有理由相信體罰應(yīng)該嚴(yán)格禁止。

            We have reasons to believe that corporal punishment should be strictly prohibited.

            26. 事實(shí)上?…

            As a matter of fact, …

            = In fact, …

            例︰事實(shí)上?健康才是最重要。

            As a matter of fact, it is health that counts.

            27. (A) 例如?… For example, …

            (B) 拿…做例子 Take … for example.

            例︰例如?我們盲目地提高生活水準(zhǔn)?卻降低生活品質(zhì)。

            For example, we elevate the living standards blindly, but lower the quality of life.

            28. 此外?我們不應(yīng)忽視…

            Besides (In addition), we should not neglect …

            例︰此外?我們不應(yīng)忽視每個人都想要一個溫馨祥和的社會。

            In addition, we should not neglect that everyone wants a friendly and peaceful society.

            29. 相反地?…

            on the contrary, …

            = by contrast, …

            例︰相反地?少數(shù)學(xué)生似乎還在鬼混。

            On the contrary, a few students, it seems, are still fooling around.

            30. 另一方面?…

            on the other hand, …

            例︰政府應(yīng)嚴(yán)格執(zhí)法?另一方面?大眾也應(yīng)該培養(yǎng)減少污染的好習(xí)慣。

            The government should enforce laws strictly. On the other hand, the public also should develop the good habit of reducing pollution.

          ·                                 31. 然而?很可惜的是…

            However, it is a pity that子句

            例︰然而?很可惜的是他總是臨時抱佛腳。

            However, it is a pity that he should always cram at the eleventh hour.

            32. 換言之?…

            in other words, …

            = to put it differently

            例︰換言之?我會盡最大的努力達(dá)成我的目標(biāo)。

            In other words, I will try my best to attain (gain, live up to) my goal.

            33. 別人可能認(rèn)為這是事實(shí)?但我不是。我認(rèn)為…

            It may be true as assumed by others, but I don't. I believe that子句

            例︰別人可能認(rèn)為這是事實(shí)?但我不是。我認(rèn)為…

            It may be true as assumed by others, but I don't. I believe that if you have strong determination and perseverance, the success will certainly come to you in the end.

            34. 從此之后?我已發(fā)現(xiàn)…

            Ever since then, I have found that子句

            例︰從此之后?我已發(fā)現(xiàn)…

            Ever since then, I have found smile the best way to avoid any possible conflicts in our daily lives.

            35. 這樣說來?假如……?當(dāng)然毫無疑問地…。

            In this light, if…, there can surely be no doubt (that) 子句

            例︰這樣說來?假如我們能善用時間?當(dāng)然毫無疑問地我們會成功。

            In this light, if we can make good use of time, there can surely be no doubt that we will get somewhere.

            36. 更嚴(yán)重的是?…。

            What is more serious is (that)子句

            例︰更嚴(yán)重的是?我們不珍惜野生動物。

            What is more serious is that we do not cherish the wildlife.

            37. 鑒于社會的實(shí)際需要?…。

            In view of the practical need of society, …。

            例︰鑒于社會的實(shí)際需要?愈來愈多人對學(xué)英語有興趣。

            In view of the practical need of society, there are more and more people interested in learning English.

            III. 用于文章結(jié)論句

            38. 如果能實(shí)踐這三點(diǎn)?…。

            If one can really put the three points into action (practice), …

            例︰如果能實(shí)踐這三點(diǎn)?…。

            If one can really put the three points into action(practice), he will surely be able to live a healthy and happy life.

            39. 做這些簡單之事?我們一定可以…。

            By doing these simple things, we surely can …。

            例︰做這些簡單之事?我們一定可以快樂出門平安回家。

            By doing these simple things, we surely can go out of the door happily and come back home safe every day.

            40. 如此?我相信…。

            In this way, I believe (that)子句

            例︰如此?我相信大家能夠像我一樣?享受乘坐公車的樂趣。

            In this way, I believe that all the people may be able to enjoy the bus ride like me.

          ·                                  41. 實(shí)踐這些?…。

            By putting them (the above) into practice, …。

            例︰實(shí)踐這些?在智育方面我一直能不斷進(jìn)步。

            By putting them(the above) into practice, I have been able to make constant progress in intellectual education.

            42. (A) 唯有符合此三項(xiàng)要求?我們才能…。

            Only by living up to the three requirements, can we …。

           ?。˙) 唯有通力合作?我們才能…。

            Only with combined efforts, can we …。

            例︰唯有通力合作?我們才能期望臺灣不久有新的面貌。

            Only with combined efforts, can we expect Taiwan to take a new face in due course.

            43. 最后?但并非最不重要?…。

            Last but no least, …。

            例︰最后?但并非最不重要?教育上的缺失是助長青少年犯罪的原因。

            Last but no least, the shortcoming in education is the cause contributing to juvenile delinquency.

            44. 這證據(jù)顯示~的重要性在怎么強(qiáng)調(diào)都不為過。

            This evidence shows that the importance of ~ cannot be overemphasized.

            例︰這證據(jù)顯示交通安全的重要性在怎么強(qiáng)調(diào)都不為過。

            This evidence shows that the importance of traffic safety cannot be overemphasized.

            45. 由于這些理由?我…。

            For these reasons, I …。

            例︰由于這些理由?我認(rèn)為在臺灣接受大學(xué)教育是明智的。

            For these reasons, I think that receiving college education in Taiwan is wise.

            46. 總而言之?…。

            In conclusion, …

            = To sum up, …

            例︰總而言之?好國民應(yīng)該遵守交通規(guī)則。

            In conclusion, a good citizen should abide by traffic regulations.

            47. 因此?我們能下個結(jié)論?那就是…。

            We can, therefore, come to the conclusion (that)子句

            例︰因此?我們能下個結(jié)論?那就是世上自由罪珍貴。

            We can, therefore, come to the conclusion that nothing is so precious as freedom in the world.

            48. 如果我們能做到如上所述?毫無疑問地?…。

            If we can do as mentioned above, there can be no doubt (that)子句

            例︰如果我們能做到如上所述?毫無疑問地?我們就能精通英語

            If we can do as mentioned above, there can be no doubt that we can master English

            49. 因此?這就是…的原因。

            Thus, this is the reason why …。

            例︰因此?這就是我重感冒的原因。

            Thus, this is the reason why I caught a bad cold.

            50. 所以?我們應(yīng)該了解…。

            Therefore, we should realize (that)子句

            例︰所以?我們應(yīng)該了解學(xué)英文不能沒有字典。

            Therefore, we should realize that in learning English we cannot do without a dictionary.

          ·                                  51. 因此?由上列的討論我們可以明了…。

            We, therefore, can make clear from the above discussion (that)子句

            例︰因此?由上列的討論我們可以明了毅力可以克服任何困難。

            We, therefore, can make clear from the above discussion that perseverance can overcome any difficulty.

            52. 1. 從~觀點(diǎn)來看?…。 From the ~ point of view, …。

            2. 根據(jù)~的看法?…。 According to ~ point of view, …。

            例︰從政治的觀點(diǎn)來看?這是一個很復(fù)雜的問題。

            From the political point

           

          posted @ 2009-07-22 23:10 小菜毛毛 閱讀(210) | 評論 (0)編輯 收藏

          僅列出標(biāo)題
          共17頁: First 上一頁 9 10 11 12 13 14 15 16 17 下一頁 
          主站蜘蛛池模板: 晋江市| 青海省| 定西市| 桂平市| 文昌市| 隆回县| 常宁市| 灯塔市| 浏阳市| 乌兰县| 宾阳县| 高陵县| 宿州市| 观塘区| 集安市| 浦东新区| 蒲江县| 乌拉特前旗| 西乌| 安泽县| 抚宁县| 清丰县| 霸州市| 徐州市| 沙河市| 桂阳县| 霍山县| 满城县| 信阳市| 吉安市| 沧源| 江孜县| 穆棱市| 瓦房店市| 巴楚县| 厦门市| 古蔺县| 玛多县| 奉新县| 桂东县| 房产|