Tempo

          BlogJava 首頁 新隨筆 聯系 聚合 管理
            1 Posts :: 6 Stories :: 0 Comments :: 0 Trackbacks

          置頂隨筆 #

          小弟想用JAVA實現操作系統ping的功能,代碼如下:
          InetAddress address = InetAddress.getByName("192.168.1.1");
          while(true){ System.out.println(address.isReachable(1000));
           }
          利用操作系統執行ping 192.168.1.1 -t,輸出的結果表示本機和該IP的連接一直都是正常的,但我實現的代碼返回的結果卻時而為true,時而為false.小弟在網上仔細的搜索過相關方面的知識,但都沒有提到這樣的一個問題,望有處理過類似問題的大蝦指點一二!
          posted @ 2009-10-01 11:48 Tempo 閱讀(824) | 評論 (0)編輯 收藏

          2010年3月9日 #

          1、使用ActionSupport(示例下載 )


          ?????? org.springframework.web.struts.ActionSupport 類提供了一個getWebApplicationContext() 方法,可用于手動創建一個 Spring 環境。

          ?????? 這種方式很簡單并且易于理解。但將 Struts Action與 Spring 框架耦合在一起。如果想替換掉 Spring,那么必須重寫代碼。 并且,由于 Struts Action不在 Spring 的控制之下,所以它不能獲得 Spring AOP 的優勢。當使用多重獨立的 Spring 環境時,這種方式可能有用, 但是在大多數情況下,這種方法不如另外兩種方法合適。

          ?


          2、覆蓋 RequestProcessor (示例下載 )


          ?????? 使用 org.springframework.web.struts.DelegatingRequestProcessor 類來覆蓋 Struts
          的 RequestProcessor 處理程序,可將 Spring 從 Struts Action 中分離出來。在struts-config中的配置如下:

          <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"/> 
          <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
            <set-property property="csntextConfigLocation" value="/WEB-INF/beans.xml"/>
          </plug-in>

          ?????? 優點是由于 Struts Action 注意不到 Spring 的存在,所以不需要重寫 Struts 代碼就可以使用其他控制反轉容器來替換掉 Spring。

          ?

          ?

          3、將Action管理委托給Spring (示例下載 )


          ?????? 通過在struts-config中注冊Action時使用org.springframework.web.struts.DelegatingActionProxy類來實現,該方式的優點如下:
          ???????????? a):沒有 Spring 的話,所有的 Struts 動作都必須是線程安全的。如果設置 <bean> 標記的 singleton 屬性?? 為“false”,那么不管用何種方法,應用程序都將在每一個請求上有一個新生成的動作對象。
          ???????????? b):可以利用 Spring 的生命周期方法。例如,當實例化 Struts 動作時,<bean> 標記的 init-method 屬性 被用于運行一個方法。類似地,在從容器中刪除 bean 之前,destroy-method 屬性執行一個方法。這些方法是管理昂貴對象的好辦法,它們以一種與 Servlet 生命周期相同的方式進行管理。
          ????????????? c):Struts Action不了解 Spring,不對代碼作任何改變就可用于非 Spring 應用程序中。RequestProcessor 的改變不會影響它,并且它可以利用 Spring AOP 特性的優點。



          已有 0 人發表留言,猛擊->>這里<<-參與討論


          JavaEye推薦




          文章來源:http://complex.javaeye.com/blog/611042
          posted @ 2010-03-09 11:05 Tempo 閱讀(163) | 評論 (0)編輯 收藏

          2009年10月5日 #


          最近用flex做了一兩個項目,如題,現在談談我所了解的flex在項目中的優缺點。


            優點:
               1、FLEX最大的優點當然得屬跨平臺跨瀏覽器了,在不同平臺下的不同瀏覽器下效果一樣,這無疑是很具有誘惑力的
               2、平臺自帶大量UI Component,讓你開發時可信手摘來,降低了開發這些UI的成本,如Tree,LinkButton等
               3、良好的拖拽支持
               4、普及高,使用flash的人群也已經很龐大了
               5、良好的用戶體驗
               6、遵循ECMAScript標準,有過JS基礎的開發人員能快速的上手
               7、多媒體的支持
            缺點:
               1、無法脫離插件
               2、內存泄漏
               3、官方提供的開發工具編譯速度太慢,當module過多時,這無疑會成為一種噩夢
               4、數據展示方面功能體驗很強大,但在flex應用上輸入數據體驗較差,主要是輸入速度太慢了!
               5、如果需要拓展某種UI或實現一中flex所不具有的UI,那么需要開發人員具有一定的原as基礎,成本被加大
               6、swf文件太大,即使經過一系列的"減肥"過程,依然大得有些不好接受
               7、
            引用
            RIA富媒體講的就是靈活,比如flex要想實現視頻通話,那是相當麻煩的.首先要開發一個ActiveX插件要用戶安裝,然后再與這個插件互相通信,而且這里的與插件通信也是比較麻煩的

               8、數據通信主要是采用 Httpservice和soa的模式進行,這樣的模式傳輸效率不高,當然也不能說很低

            總結:
               以上就是我所了解的flex在項目中的優缺點,希望有過flex的朋友們不吝賜教,呵呵.
          文章來源:http://probe.javaeye.com/blog/481894
          posted @ 2009-10-05 12:14 Tempo 閱讀(1087) | 評論 (0)編輯 收藏


          廢話不說,看代碼:
          package
          {
          import flash.display.Sprite;

          import mx.controls.DataGrid;

          public class RowColorDataGrid extends DataGrid
          {
          public function RowColorDataGrid()
          {
          super();
          }

          override protected function drawRowBackground(s:Sprite,rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void{
          if(dataIndex<super.dataProvider.length){
          super.drawRowBackground(s, rowIndex, y, height, 0x49FFAD, dataIndex);
          }else{
          super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
          }
          }
          }
          }

          先自定義一個DataGrid類,該類繼承自DataGrid類。然后在自己的代碼中引用該類即可,如下:
          <?xml version="1.0"?>
          <!-- DataGrid control example. -->
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:probe="*">

          <mx:XMLList id="employees">
          <employee>
          <name>Christina Coenraets</name>
          <phone>555-219-2270</phone>
          <email>ccoenraets@fictitious.com</email>
          <active>true</active>
          </employee>
          <employee>
          <name>Joanne Wall</name>
          <phone>555-219-2012</phone>
          <email>jwall@fictitious.com</email>
          <active>true</active>
          </employee>
          <employee>
          <name>Maurice Smith</name>
          <phone>555-219-2012</phone>
          <email>maurice@fictitious.com</email>
          <active>false</active>
          </employee>
          <employee>
          <name>Mary Jones</name>
          <phone>555-219-2000</phone>
          <email>mjones@fictitious.com</email>
          <active>true</active>
          </employee>
          </mx:XMLList>

          <mx:Panel title="行著色DataGrid" height="100%" width="100%"
          paddingTop="10" paddingLeft="10" paddingRight="10">
          <probe:RowColorDataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{employees}">
          <probe:columns>
          <mx:DataGridColumn dataField="name" headerText="Name"/>
          <mx:DataGridColumn dataField="phone" headerText="Phone"/>
          <mx:DataGridColumn dataField="email" headerText="Email"/>
          </probe:columns>
          </probe:RowColorDataGrid>

          <mx:Form width="100%" height="100%">
          <mx:FormItem label="Name">
          <mx:Label text="{dg.selectedItem.name}"/>
          </mx:FormItem>
          <mx:FormItem label="Email">
          <mx:Label text="{dg.selectedItem.email}"/>
          </mx:FormItem>
          <mx:FormItem label="Phone">
          <mx:Label text="{dg.selectedItem.phone}"/>
          </mx:FormItem>
          </mx:Form>

          </mx:Panel>
          </mx:Application>
          文章來源:http://probe.javaeye.com/blog/481709
          posted @ 2009-10-05 12:14 Tempo 閱讀(589) | 評論 (0)編輯 收藏


          最近由于項目的需要,用flex實現了一個雙Y軸的Chart,現在將代碼拿出來曬曬!
          <?xml version="1.0"?>
          <!-- Simple example to demonstrate the LineChart and AreaChart controls. -->
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

          <mx:Script>
          <![CDATA[

          import mx.collections.ArrayCollection;

          [Bindable]
          private var expensesAC:ArrayCollection = new ArrayCollection( [
          { Month: "Jan", Wage: 2000, Fine: 100},
          { Month: "Feb", Wage: 1000, Fine: 50},
          { Month: "Mar", Wage: 1500, Fine: 70},
          { Month: "Apr", Wage: 1800, Fine: 30},
          { Month: "May", Wage: 2400, Fine: 50} ]);
          ]]>
          </mx:Script>
          <mx:SolidColor id="sc1" color="blue" alpha=".3"/>
          <mx:Stroke id = "s1" color="blue" weight="2"/>

          <mx:Panel title="LineChart and AreaChart Controls Example"
          height="100%" width="100%" layout="horizontal">

          <mx:LineChart id="linechart" height="100%" width="100%"
          paddingLeft="5" paddingRight="5"
          showDataTips="true" dataProvider="{expensesAC}">

          <mx:horizontalAxis>
          <mx:CategoryAxis categoryField="Month"/>
          </mx:horizontalAxis>

          <mx:verticalAxis>
          <mx:LinearAxis id="first" minimum="0" maximum="200"/>
          </mx:verticalAxis>

          <mx:secondVerticalAxis>
          <mx:LinearAxis id="second" minimum="500" maximum="3000"/>
          </mx:secondVerticalAxis>

          <mx:series>
          <mx:LineSeries verticalAxis="{first}" yField="Fine" form="curve" displayName="Fine"/>
          <mx:ColumnSeries verticalAxis="{second}" yField="Wage" displayName="Wage" stroke="{s1}" fill="{sc1}"/>
          </mx:series>
          </mx:LineChart>
          </mx:Panel>
          </mx:Application>
          文章來源:http://probe.javaeye.com/blog/481686
          posted @ 2009-10-05 12:14 Tempo 閱讀(428) | 評論 (0)編輯 收藏

               摘要: Oracle 分析函數使用介紹    分析函數是oracle816引入的一個全新的概念,為我們分析數據提供了一種簡單高效的處理方式.在分析函數出現以前,我們必須使用自聯查詢,子查詢或者內聯視圖,甚至復雜的存儲過程實現的語句,現在只要一條簡單的sql語句就可以實現了,而且在執行效率方面也有相當大的提高.下面我將針對分析函數做一些具體的說明. 今天我主要給大家介紹一...  閱讀全文
          posted @ 2009-10-05 12:14 Tempo 閱讀(122) | 評論 (0)編輯 收藏

          2009年10月1日 #

          小弟想用JAVA實現操作系統ping的功能,代碼如下:
          InetAddress address = InetAddress.getByName("192.168.1.1");
          while(true){ System.out.println(address.isReachable(1000));
           }
          利用操作系統執行ping 192.168.1.1 -t,輸出的結果表示本機和該IP的連接一直都是正常的,但我實現的代碼返回的結果卻時而為true,時而為false.小弟在網上仔細的搜索過相關方面的知識,但都沒有提到這樣的一個問題,望有處理過類似問題的大蝦指點一二!
          posted @ 2009-10-01 11:48 Tempo 閱讀(824) | 評論 (0)編輯 收藏

          僅列出標題  
          主站蜘蛛池模板: 会昌县| 左权县| 开化县| 大姚县| 花莲县| 平武县| 桐城市| 班戈县| 巫山县| 时尚| 巴中市| 连云港市| 巩留县| 准格尔旗| 西乡县| 大名县| 娄底市| 阿克陶县| 黄浦区| 温宿县| 吉林市| 隆尧县| 黑水县| 江口县| 德令哈市| 盱眙县| 龙泉市| 宣武区| 黑水县| 平邑县| 辽中县| 靖州| 当阳市| 肥东县| 鹤庆县| 肇源县| 芒康县| 承德市| 兰溪市| 特克斯县| 新郑市|