qqjianyue代碼工

          砌java代碼
          posts - 62, comments - 9, trackbacks - 0, articles - 10
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          第一:簡單的使用axis2包自己實現調用

          package common;

          import javax.xml.namespace.QName;
          import org.apache.axis2.AxisFault;
          import org.apache.axis2.addressing.EndpointReference;
          import org.apache.axis2.client.Options;
          import org.apache.axis2.rpc.client.RPCServiceClient;

          public class WebServiceUtils
          {
           // ----------------------------------------------------- Properties
           public static int TIMEOUT = 100000;

           // ----------------------------------------------------- Constructors

           // ----------------------------------------------------- Methods
           /**
            *
            * 調用axis2的webservice的方法
            *
            * @return
            */
           @SuppressWarnings("unchecked")
           static public Object[] invokeWebService( String url, String nameSpace, String method, Object[] args, Class[] returnTypes )
             throws AxisFault
           {
            RPCServiceClient serviceClient = new RPCServiceClient();
            Options options = serviceClient.getOptions();
            EndpointReference targetEPR = new EndpointReference( url );
            options.setTo( targetEPR );
            options.setTimeOutInMilliSeconds( TIMEOUT );
            QName opName = new QName( nameSpace, method );
            Object[] results = serviceClient.invokeBlocking( opName, args, returnTypes );
            return results;
           }
          }


          第二:

          public static OMElement getEchoOMElement() {
                  OMFactory fac = OMAbstractFactory.getOMFactory();
                  OMNamespace omNs = fac.createOMNamespace(
                          "http://example1.org/example1", "example1");
                  OMElement method = fac.createOMElement("echo", omNs);
                  OMElement value = fac.createOMElement("Text", omNs);
                  value.addChild(fac.createOMText(value, "Axis2 Echo String "));
                  method.addChild(value);

                  return method;
              }

           public static void main(String[] args) {
                  try {
                     OMElement payload = ClientUtil.getEchoOMElement();
                      Options options = new Options();
                    
                      options.setTo(targetEPR);
                      options.setAction("urn:echo");

                      //Blocking invocation
                      ServiceClient sender = new ServiceClient();
                      sender.setOptions(options);
                      OMElement result = sender.sendReceive(payload);

                      System.out.println(result);
                    
                      System.out.println(options.getTo());

                  } catch (AxisFault axisFault) {
                      axisFault.printStackTrace();
                  }
              }

           
          第三:

          利用插件生成客戶端
          private static String URL="http://localhost:8080/axis2/services/WeatherService"; 
              public static void main(String[] args) throws RemoteException {
                  try {
                      WeatherServiceStub stub;
                      if (args != null && args.length != 0) {
                          stub = new WeatherServiceStub(args[0]);
                        
                      } else {
                          stub = new WeatherServiceStub(URL);
                      }
                      WeatherServiceStub.SetWeather setWether = new WeatherServiceStub.SetWeather();
                      WeatherServiceStub.Weather wether = new WeatherServiceStub.Weather();
                    
                      wether.setForecast("east");
                      wether.setRain(true);
                      wether.setTemperature(12.3f);
                      wether.setForecast("big");
                    
                      setWether.setWeather(wether);
                      stub.setWeather(setWether);
                    
                      WeatherServiceStub.GetWeatherResponse gw = new WeatherServiceStub.GetWeatherResponse();
                      System.out.println(gw.get_return());       
                    
                  } catch (AxisFault e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
              }


          本文部分來自CSDN博客,轉載請標明出處:http://blog.csdn.net/yhhah/archive/2009/05/07/4158487.aspx

          posted @ 2010-01-20 23:16 Qzi 閱讀(10507) | 評論 (0)編輯 收藏

          IE的 script 元素支持onreadystatechange事件,不支持onload事件。
          FF的script 元素不支持onreadystatechange事件,只支持onload事件。
          如果要在一個<script src="xx.js"> 加載完成執行一個操作,FF使用onload事件就行了,IE下則要結合onreadystatechange事件和this.readyState
          var loadScript = function(fileName,callback) {
           var scriptTag = document.createElement("script");
            scriptTag.src = fileName;
            document.body.appendChild(scriptTag);
            if (callback) {
             scriptTag.onload = callback;//ff
             scriptTag.onreadystatechange = function()//ie
             {
              if (scriptTag.readyState == "loaded") {
              callback();
             }
            }
           }
          }

          posted @ 2009-12-11 18:57 Qzi 閱讀(478) | 評論 (0)編輯 收藏

          關鍵是查詢v$locked_object

          select sess.sid,
              sess.serial#,
              lo.oracle_username,
              lo.os_user_name,
              ao.object_name,
              lo.locked_mode
              from v$locked_object lo,
              dba_objects ao,
              v$session sess
          where ao.object_id = lo.object_id and lo.session_id = sess.sid;


          或者

          select * from v$session t1, v$locked_object t2 where t1.sid = t2.SESSION_ID;

          殺掉進程:
          alter system kill session 'sid,serial#';

          posted @ 2009-09-21 14:09 Qzi 閱讀(243) | 評論 (0)編輯 收藏

          --創建臨時表空間
          create temporary tablespace dbuser_temp
          tempfile 'D:\oracle\product\10.1.0\oradata\btx\dbuser_temp01.dbf'
          size 32m
          autoextend on
          next 32m maxsize 2048m
          extent management local;

          --創建數據表空間

          create tablespace dbuser_data
          logging
          datafile 'D:\oracle\product\10.1.0\oradata\btx\dbuser_data01.dbf'
          size 32m
          autoextend on
          next 32m maxsize 2048m
          extent management local;
          --或者自己控制增長規則
          --pctincreate表示下一次增長是前一次增長的110%
          create tablespace dbuser_data logging datafile 'D:/oracle/product/10.1.0/oradata/btx/DBUSER_DATA01.DBF' size 32m autoextend on next 5m maxsize unlimited default storage (initial 32m next 5m pctincrease 10);

          --修改表空間
          alter tablespace dbuser_data add datafile 'D:/oracle/product/10.1.0/oradata/btx/DBUSER_DATA02.DBF'  size 32m autoextend on next 5m maxsize unlimited;

          --創建用戶與指定默認數據表空間與默認臨時表空間
          create user dbuser identified by dbuser
          default tablespace dbuser_data
          temporary tablespace dbuser_temp;
          --修改用戶表空間
          alter user dbuser default tablespace dbuser_data temporary tablespace dbuser_temp;

          --為用戶賦權

          grant connect,resource to dbuser;

          修改表空間


          查詢oracle表空間使用狀況
          SELECT b.tablespace_name "表空間名",total 表空間大小,free 表空間剩余大小,
          (total-free) 表空間使用大小,
          ROUND((total-free)/total,4)*100 "使用率 %"
          FROM  (SELECT tablespace_name,SUM(bytes) free FROM DBA_FREE_SPACE
          GROUP BY tablespace_name ) a,
          (SELECT tablespace_name,SUM(bytes) total FROM DBA_DATA_FILES
          GROUP BY tablespace_name) b
          WHERE a.tablespace_name=b.tablespace_name ;

          posted @ 2009-08-16 11:24 Qzi 閱讀(1033) | 評論 (0)編輯 收藏

          恢復表數據:
          alter table 表名 enable row movement;
          flashback table 表名 TO TIMESTAMP to_timestamp('2009-08-07 18:34:00','yyyy-mm-dd hh24:mi:ss');

          恢復存儲過程:
          select text from dba_source as of timestamp to_timestamp('2009-03-06 09:45:00', 'YYYY-MM-DD HH24:MI:SS') where owner='IPRA' and name= 'P_IPACCHECK_NC' order by line;
          需要sys用戶
          否則不夠權限
          或者登錄數據庫所在主機,使用數據庫管理者的系統用戶登錄

          posted @ 2009-08-07 22:07 Qzi 閱讀(208) | 評論 (0)編輯 收藏

          視圖:(受權限過濾了)
          all_tables 所有表
          all_indexs 所有索引
          all_tab_columns  所有列,可以查看列的類型

          (dba權限包括所有)
          dba_tables
          dba_tab_columns
          dba_free_space 各對象的剩余空間
          dba_data_files  各數據空間的文件信息
          dba_tablespaces  表空間信息

          posted @ 2009-07-21 13:35 Qzi 閱讀(256) | 評論 (0)編輯 收藏

           

          常用字符函數

          函數

          描述

          LOWER(char)

          將字符串表達式char中的所有大寫字母轉換為小寫字母

          UPPER(char)

          將字符串表達式char中的所有小寫字母轉換為大寫字母

          INITCAP(char)

          首字母轉換成大寫

          SUBSTR(char,start,length)

          返回字符串表達式char中從第start開始的length個字符

          LENGTH(char)

          返回字符串表達式char的長度

          LTRIM(char)

          去掉字符串表達式char后面的空格

          ASCII(char)

          charASCII

          CHAR(number)

          numberASCII

          REPLACE(char,str1,str2)

          將字符串中所有str1換成str2

          INSTR(char1,char2,start,times)

          char1字符串中搜索char2字符串,start為執行搜索操作的起始位置,times為搜索次數

           

          常用日期函數

          函數

          描述

          SYSDATE

          返回系統當前日期和時間

          NEXT_DAY(day,char)

          返回day指定的日期之后并滿足char指定條件的第一個日期,char所指條件只能為星期幾

          LAST_DAY(day)

          返回day日期所指定月份中最后一天所對應的日期

          ADD_MONTH(day,n)

          返回day日期在n個月后(n為正數)或前(n為負數)的日期

          MONTH_BETWEEN(day1,day2)

          返回day1日期和day2日期之間相差得月份

          ROUND(day[,fmt])

          按照fmt指定格式對日期數據day做舍入處理,默認舍入到日

          TRUNC(day,[,fmt])

          按照fmt指定格式對日期數據day做舍入處理,默認截斷到日

           

          數據類型轉換函數

          函數

          描述

          TO_CHAR

          將一個數字或日期轉換成字符串

          TO_NUMBER

          將字符型數據轉換成數字型數據

          TO_DATE

          將字符型數據轉換為日期型數據

          CONVERT

          將一個字符串從一個字符集轉換為另一種字符集

          CHARTORowid

          將一個字符串轉換為Rowid數據類型

          RowIDTOCHAR

          將一個Rowid數據類型轉換為字符串

          NEXTTORAW

          將一個十六進制字符串轉換為RAW數據類型

          RAWTOHEX

          將一個RAW類型的二進制數據類型轉換為一個十六進制表達的字符串

          TO_MULTI_BYTE

          將一個單字節字符串轉換為多字節字符串

          TO_SINGLE_BYTE

          將一個多字節字符串轉換為單字節字符串

           

           

           

          集合函數

          函數

          描述

          AVG

          計算一列值的平均值

          COUNT

          統計一列中值的個數

          MAX

          求一列值中的最大值

          MIN

          求一列值中的最小值

          SUM

          計算一列值的總和

          STDDEV

          計算一列值的標準差

          VARIANCE

          計算一列值的方差

          posted @ 2009-07-16 21:26 Qzi 閱讀(529) | 評論 (0)編輯 收藏

          1、
            encodeURIComponent(”[string]“)
            decodeURIComponent(”[encodedString]“)

          2、
            encodeURI(”[string]“)
            decodeURI(”[encodedString]“)

          3、
            escape(”[string]“)
            unescape(”[encodedString]“)


          1、對每個字節進行編碼;
          2、空格轉為”+”號;
          3、安全字符不編碼。安全字符:大小寫英文字母(a-z以及A-Z) 阿拉伯數字(0-9) \’ ( ) * - . _ !
          4、其他字節以十六進制顯示并加”%”前綴,例如用%25代表%號。

          posted @ 2009-07-15 21:29 Qzi 閱讀(164) | 評論 (0)編輯 收藏

          設置客戶端字符集:
          # 常用中文字符集
          set NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
          # 常用unicode字符集
          set NLS_LANG=american_america.AL32UTF8

          exp 用戶名/密碼@主機 file=導出文件的文件名 tables=(逗號分割表名)  log=aibsm.log feedback=200

          posted @ 2009-07-06 13:21 Qzi 閱讀(208) | 評論 (0)編輯 收藏

          1.Json的對象形式
          {
          property0 : true,                    //property0是一個布爾型的值
          property1 : 0,                        //property1是一個數值型的值
          property2 : "123",                 //property2是一個字符串型的值
          property3 : function(){...}     //property3是一個函數
          }
          使用key-value對構造json對象,注意屬性的key和value使用“:”分開,屬性之間使用“,”分開,注意最后的屬性沒有“,”,什么符號都不要有。將此結構直接賦值給js的對象,則可以使用這個對象調用這些屬性。
          例如:var obj1 = {
          property0 : true,                    //property0是一個布爾型的值
          property1 : 0,                        //property1是一個數值型的值
          property2 : "123",                 //property2是一個字符串型的值
          property3 : function(){...},     //property3是一個函數
          property4 : { p1 : p1Value, p2 : p2Value }    //property4本身又是一個對象
          }
          那么可以調用
          alert(obj1.property0);
          obj1.property3();
          ……
          在Java Web開發中,服務端負責輸出這串字符到jsp頁面的js,就可以使用了。

          關鍵的是,字符串中可能具有js需要避免的特殊字符,建議查看一下spring的JavascriptUtils的javaScriptEscape方法就知道如何做啦
          如果是Ajax調用的話,就是用prototype庫的方法,將字符串轉換為json對象
          new Ajax.Request("http://url/", { 
            method: "get", 
            onSuccess: function(transport) { 
              var json = transport.responseText.evalJSON(); 
              // TODO: document.write(json.xxx); 
            } 
          prototype庫的官網:    http://prototypejs.org/
           }); 
          2.    Json的數組形式
          其實js中的數組更像是一個Map對象,因為它的key不只是整數,還可以是字符串。
          var array;
          array["key0"] = key0Value;
          array["key1"] = key1Value;

          posted @ 2009-06-01 13:33 Qzi 閱讀(357) | 評論 (0)編輯 收藏

          僅列出標題
          共5頁: 上一頁 1 2 3 4 5 下一頁 
          主站蜘蛛池模板: 宜兴市| 钟祥市| 赞皇县| 牡丹江市| 鹤山市| 贡山| 金坛市| 卢氏县| 松潘县| 年辖:市辖区| 台东县| 苍南县| 邵东县| 吴川市| 县级市| 恩平市| 怀远县| 常德市| 湘潭县| 靖安县| 秀山| 曲松县| 仙桃市| 德化县| 宽城| 长沙市| 东丰县| 周至县| 肇东市| 叙永县| 哈巴河县| 九龙坡区| 彭水| 高要市| 温泉县| 游戏| 苏尼特右旗| 永善县| 青铜峡市| 金秀| 廊坊市|