posts - 119, comments - 62, trackbacks - 0, articles - 0

          2006年7月25日

          http://note.youdao.com/share/web/file.html?id=611b9b6bdf9abafbb1ee45436f50be9e&type=note

          posted @ 2015-09-18 21:04 Kevin Meng 閱讀(231) | 評(píng)論 (0)編輯 收藏

          每次都在setupconnection...的地方停住了,后來(lái)在發(fā)現(xiàn)原來(lái)是因?yàn)槲业氖謾C(jī)沒(méi)有插SD卡,憤的!!

          posted @ 2015-08-10 23:15 Kevin Meng 閱讀(201) | 評(píng)論 (0)編輯 收藏

          geoJOSN為UTF-8編碼,轉(zhuǎn)成shp后部分字段出現(xiàn)亂碼,一直找不到解決的辦法。后來(lái)裝了QGIS 1.7.4,打開(kāi)geoJSON文件,注意選擇編碼為UTF-8,然后save as..,保存成shp文件,此時(shí)編碼必須選擇system就可以解決中文亂碼的問(wèn)題了。

          posted @ 2012-10-22 11:53 Kevin Meng 閱讀(1492) | 評(píng)論 (0)編輯 收藏

          http://huangqiqing123.iteye.com/blog/1246882 

          posted @ 2012-08-15 12:52 Kevin Meng 閱讀(268) | 評(píng)論 (0)編輯 收藏

          以下的GPS定位代碼,在MOTO XT800,ME811,HTC S610d等手機(jī)中定位都沒(méi)有問(wèn)題,但是在MOTO XT882里面就是無(wú)法定位,后來(lái)發(fā)現(xiàn)問(wèn)題出現(xiàn)在紅色的代碼部分,強(qiáng)制改成GPS定位就可以了。
                locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
                Criteria criteria = new Criteria();
                criteria.setAccuracy(Criteria.ACCURACY_FINE);
                criteria.setAltitudeRequired(false);
                criteria.setBearingRequired(false);
                criteria.setCostAllowed(true);
                criteria.setPowerRequirement(Criteria.POWER_LOW);
                String provider = locationManager.getBestProvider(criteria, true);
                /* 每隔1000ms更新一次,并且不考慮位置的變化。 */
                locationManager.requestLocationUpdates(provider, 3000, 5, locationListener);
                //強(qiáng)制使用GPS定位
                //locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 5, locationListener);

          posted @ 2012-08-07 20:59 Kevin Meng 閱讀(340) | 評(píng)論 (0)編輯 收藏

          這次項(xiàng)目開(kāi)發(fā),運(yùn)行環(huán)境的tomcat版本從5.5.12升級(jí)到了6.0.18,發(fā)現(xiàn)以前的項(xiàng)目不能跑了,訪(fǎng)問(wèn)一個(gè)很簡(jiǎn)單的jsp也會(huì)報(bào)錯(cuò),說(shuō)無(wú)法編譯,報(bào)的錯(cuò)誤就是:Only a type can be imported. com.xxx.xxx.XXX resolves to a package,意思就是說(shuō)你jsp頁(yè)面上引用的那個(gè)類(lèi)不存在,可是在老版本明明跑的好好的,而且另一個(gè)現(xiàn)象就是項(xiàng)目根目錄下的jsp訪(fǎng)問(wèn)沒(méi)有問(wèn)題,子目錄下就報(bào)錯(cuò),google了一下,發(fā)現(xiàn)這是新版本tomcat的一個(gè)變化,就是如果不指定context的話(huà),每一個(gè)子文件夾都會(huì)被tomcat當(dāng)作一個(gè)獨(dú)立的虛擬應(yīng)用的,所以每個(gè)子文件夾下的jsp頁(yè)面訪(fǎng)問(wèn)的時(shí)候,都會(huì)在它的同一層找WEB-INF里面的class,這樣當(dāng)然找不到了,只有剛巧放在根目錄下的jsp文件能訪(fǎng)問(wèn)。

          解決辦法:其實(shí)這也是自己以前寫(xiě)tomcat的配置文件時(shí)候,寫(xiě)法不規(guī)范造成的,以前的server.xml里面host信息代碼如下:

          <Host name="www.local.com" appBase="D://projects//myWebSite//WebContent" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
              <Alias>192.168.1.43</Alias> 
              <Context path="" docBase="" reloadable="true">
               <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="www.local.com_log." suffix=".txt" timestamp="true"/>
              </Context></Host>

          這其中Context里面的docBase為空,文件路徑就靠Host里的appBase去指定,這樣tomcat認(rèn)為你這個(gè)站點(diǎn)下沒(méi)有應(yīng)用,會(huì)自動(dòng)把每個(gè)文件夾當(dāng)作一個(gè)虛擬應(yīng)用處理。修改后的代碼片段如下:

          <Host name="www.local.com" appBase="" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
              <Alias>192.168.1.43</Alias> 
              <Context path="" docBase="D://projects//myWebSite//WebContent" reloadable="true">
               <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="www.local.com_log." suffix=".txt" timestamp="true"/>
              </Context></Host>

          可以看到Host里面不再指定appBase了,而是在主機(jī)下建立一個(gè)應(yīng)用,應(yīng)用的文件路徑通過(guò)docBase來(lái)指定,這樣就不會(huì)再產(chǎn)生找不到class的問(wèn)題了。

          ps:tomcat的這個(gè)問(wèn)題好像是從5.5.28就開(kāi)始了,記得以前也曾經(jīng)嘗試過(guò)升級(jí)tomcat,就發(fā)生了類(lèi)似的問(wèn)題,但是當(dāng)時(shí)沒(méi)充裕時(shí)間去解決,就一直把問(wèn)題遺留到現(xiàn)在。

          posted @ 2012-08-01 11:14 Kevin Meng 閱讀(525) | 評(píng)論 (0)編輯 收藏

          web開(kāi)發(fā)中,我們經(jīng)常需要將一個(gè)表的數(shù)據(jù)插入到另外一個(gè)表,有時(shí)還需要指定導(dǎo)入字段,設(shè)置只需要導(dǎo)入目標(biāo)表中不存在的記錄,雖然這些都可以在程序中拆分成簡(jiǎn)單sql來(lái)實(shí)現(xiàn),但是用一個(gè)sql的話(huà),會(huì)節(jié)省大量代碼。下面我以mysql數(shù)據(jù)庫(kù)為例分情況一一說(shuō)明:

          兩張表:insertTest和insertTest2,前者中有測(cè)試數(shù)據(jù)
          create table insertTest(id int(4),name varchar(12));
          insert into insertTest values(100,'liudehua');
          insert into insertTest values(101,'zhourunfa');
          insert into insertTest values(102,'zhouhuajian');
          1.如果2張表的字段一致,并且希望插入全部數(shù)據(jù),可以用這種方法:
            INSERT INTO 目標(biāo)表 SELECT * FROM 來(lái)源表;
          insert into insertTest select * from insertTest2;
          2.如果只希望導(dǎo)入指定字段,可以用這種方法:
           INSERT INTO 目標(biāo)表 (字段1, 字段2, ...) SELECT 字段1, 字段2, ... FROM 來(lái)源表;
           注意字段的順序必須一致。
          insert into insertTest2(id) select id from insertTest2;
          3.如果您需要只導(dǎo)入目標(biāo)表中不存在的記錄,可以使用這種方法:
           INSERT INTO 目標(biāo)表  
           (字段1, 字段2, ...)  
           SELECT 字段1, 字段2, ...  
           FROM 來(lái)源表  
           WHERE not exists (select * from 目標(biāo)表  
           where 目標(biāo)表.比較字段 = 來(lái)源表.比較字段); 
           1>.插入多條記錄:
          insert into insertTest2
          (id,name)
          select id,name
          from insertTest
          where not exists (select * from insertTest2
          where insertTest2.id=insertTest.id);
           2>.插入一條記錄:
          insert into insertTest    
          (id, name)    
          SELECT 100, 'liudehua'    
          FROM dual    
          WHERE not exists (select * from insertTest    
          where insertTest.id = 100);
          使用 dual 作表名,select 語(yǔ)句后面直接跟上要插入的字段的值。

          posted @ 2012-02-03 16:04 Kevin Meng 閱讀(535) | 評(píng)論 (0)編輯 收藏

          1、arcgis server安裝過(guò)程中,主體文件安裝結(jié)束,配置server 賬號(hào)時(shí),遇到invalid password specified,對(duì)于arcgissom和arcgissoc兩個(gè)accounts,任何密碼都適合,后來(lái)想著新建另外兩個(gè)arcgissom1和arcgissoc1,通過(guò)了,再一看,原來(lái)arcgissom和arcgissoc兩個(gè)賬號(hào)在計(jì)算機(jī)管理的賬戶(hù)里已經(jīng)存在。刪去后再裝就沒(méi)問(wèn)題了。
          不會(huì)有問(wèn)題了

          posted @ 2011-11-28 13:03 Kevin Meng 閱讀(1621) | 評(píng)論 (0)編輯 收藏

          以前的項(xiàng)目運(yùn)行好好的,升級(jí)了ADT后,進(jìn)行junit測(cè)試時(shí)出現(xiàn)錯(cuò)誤:

          #
          # A fatal error has been detected by the Java Runtime Environment:
          #
          #  Internal Error (classFileParser.cpp:3494), pid=7480, tid=7376
          #  Error: ShouldNotReachHere()
          #
          # JRE version: 6.0_29-b11
          # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.4-b02 mixed mode windows-amd64 compressed oops)
          # If you would like to submit a bug report, please visit:
          #   http://java.sun.com/webapps/bugreport/crash.jsp
          #

          解決辦法:
          1.選中junit測(cè)試類(lèi),右鍵 -> Run As -> Run Configurations...
          2.切換到Classpath選項(xiàng)欄,刪掉Bootstrap Entries里面的Android Library,然后點(diǎn)擊右側(cè)的Advanced.. -> Add Library -> JRE System Library,一路next即可。

          這時(shí)再運(yùn)行該類(lèi),就能正常運(yùn)行了。

          posted @ 2011-11-09 20:30 Kevin Meng 閱讀(2482) | 評(píng)論 (0)編輯 收藏

          字段為Datetime,獲得2011-11-05以后添加的記錄
          SELECT *  FROM geo_corporation t WHERE TO_DAYS(t.addtime)>TO_DAYS('2011-11-05')
          某一時(shí)間段內(nèi)的記錄
          SELECT *  FROM geo_corporation t WHERE TO_DAYS(t.addtime)>TO_DAYS('2011-11-05') AND TO_DAYS(t.addtime)<TO_DAYS('2011-11-7')

          posted @ 2011-11-07 11:56 Kevin Meng 閱讀(264) | 評(píng)論 (0)編輯 收藏

          可以用AntiRSI,也是免費(fèi)的,非常好用。

          posted @ 2010-06-24 10:52 Kevin Meng 閱讀(424) | 評(píng)論 (0)編輯 收藏

          在IBM Z60M上安裝Mac OS 10.4.8
          (1)下載[weiphone][Mac_OS][Mac OS X 10.4.8][JaS AMD-Intel-SSE2-SSE3 with PPF1 & PPF2].iso,然后通過(guò)nero刻盤(pán)。注意:盤(pán)要好,如果沒(méi)有刻錄好,安裝的時(shí)候就會(huì)出現(xiàn)I/O錯(cuò)誤,這個(gè)折騰了我不少時(shí)間。
          (2)在XP下分出一個(gè)盤(pán)來(lái),大概10G的空間就可以了,格式化成FAT32格式(建議用PM軟件)。
          (3)進(jìn)入BISO,設(shè)為從光盤(pán)啟動(dòng),把安裝盤(pán)放入光驅(qū),重新啟動(dòng)電腦。
          (4)如果不出意外,您將進(jìn)入Mac OS安裝程序。點(diǎn)“實(shí)用程序”-》“磁盤(pán)工具”,在這里您將看到所有的盤(pán)符,選中我們已經(jīng)格式化好的磁盤(pán),點(diǎn)抹掉,宗卷格式選Mac OS 擴(kuò)展(日志式),格式化完后,退出磁盤(pán)工具。
          (5)再次回到安裝Mac的介紹頁(yè)面,點(diǎn)繼續(xù),選中我們格式化好的盤(pán)來(lái)安裝mac,點(diǎn)繼續(xù)
          (6)進(jìn)入安裝類(lèi)型,這里很關(guān)鍵。把要安裝的打印機(jī)驅(qū)動(dòng)選上(我全選),本地化語(yǔ)言我選簡(jiǎn)體中文和繁體中文。JaS Intel 10.4.8 ATA kexts included必須選。然后Support for the most common hardware中的10.4.8.x600.Mobility.Support選上。其他都不要選,點(diǎn)下一步即可。注意,不能把所有的硬件驅(qū)動(dòng)都選上,如果那樣的話(huà)可以正常安裝,但是重啟后進(jìn)入Mac時(shí)會(huì)出現(xiàn)黑屏現(xiàn)象,應(yīng)該是由于硬件驅(qū)動(dòng)沖突造成的。
          (7)點(diǎn)下一步開(kāi)始安裝,耐心等待,安裝完后重啟,就可以進(jìn)入美麗的Mac世界了。
           
          聲明:本文只針對(duì)IBM Z60M,別的型號(hào)的機(jī)器由于硬件驅(qū)動(dòng)等問(wèn)題有可能會(huì)不能正常安裝。

          posted @ 2009-08-05 12:27 Kevin Meng 閱讀(330) | 評(píng)論 (0)編輯 收藏

          把jdk\bin目錄下的msvcr71.dll復(fù)制到tomcat安裝目錄的\bin下即可

          posted @ 2009-02-16 13:29 Kevin Meng 閱讀(4226) | 評(píng)論 (4)編輯 收藏

          在登陸上服務(wù)器之后,打開(kāi)我的電腦,在地址欄中輸入“\\tsclient\C”就可以查看本地的C盤(pán)

          posted @ 2009-02-12 15:31 Kevin Meng 閱讀(916) | 評(píng)論 (3)編輯 收藏

          C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\tempfile.tmp所有.tmp文件刪除然后再上傳。有可能需要多試幾次。
          最好用TSVN上傳而不要用Subeclipse

          posted @ 2009-02-06 16:08 Kevin Meng 閱讀(2591) | 評(píng)論 (2)編輯 收藏

          (1)安裝php_pdo.dll和php_pdo_cio.dll,在php的安裝包里面有,建議用php5.2以上版本;
          (2)安裝oracle 10g客戶(hù)端,如果你用的是oracle 9i同樣需要安裝oracle 10g客戶(hù)端,否則無(wú)法連接oracle。如果你的機(jī)器上已經(jīng)安裝有oracle 9i,安裝oracle 10g客戶(hù)端對(duì)oracle 9i并沒(méi)有影響。
          (3)重新啟動(dòng)機(jī)器。
          (4)用phpinfo()檢驗(yàn)是否已經(jīng)加載了php_pdo和php_pdo_oci擴(kuò)展

          連接代碼

          [development]

          database.config.type = pdo_oci
          database.config.host=localhost
          database.config.username = szapp
          database.config.password = szapp
          database.config.dbname = ora
          database.config.port=1521




          $params = array ('dbname' => $config->database->config->dbname,
           'username' => $config->database->config->username,
           'password' => $config->database->config->password,
           'host'=>$config->database->config->host,
           'port'=>$config->database->config->port );
          $db = Zend_Db::factory ( $config->database->config->type, $params );
          $registry->set ( 'db', $db );

          posted @ 2009-01-16 13:54 Kevin Meng 閱讀(752) | 評(píng)論 (0)編輯 收藏

          步驟如下:
          1.      AP服務(wù)器上建立c:\backup文件夾(文件夾路徑客戶(hù)自己選擇)
          2.      打開(kāi)dbbkup.bat-->修改紅字部分-->保存
          exp citictest/citictest@colm2 file=c:\backup\%date:~4,20%.dmp    log=c:\backup\%date:~4,20%.log
          compress=y direct=n rows=y owner='citictest'
          consistent=n constraints=y grants=y indexes=y triggers=y
          3.      將dbbkup.bat放置于c:\backup文件夾之下
          4.      控制面板-->任務(wù)計(jì)劃-->添加任務(wù)計(jì)劃-->選擇程序以進(jìn)行計(jì)劃-->瀏覽-->選中dbbkup.bat-->每日?qǐng)?zhí)行-->選擇時(shí)間-->輸入用戶(hù)名密碼-->完成
          5.      執(zhí)行時(shí)間過(guò)了之后,c:\backup文件夾下面會(huì)出現(xiàn)yyyy-mm-dd.dmp命名的DUMP檔案

          posted @ 2009-01-08 15:28 Kevin Meng 閱讀(268) | 評(píng)論 (0)編輯 收藏

          以前的項(xiàng)目用的是struts1,運(yùn)行得好好的,現(xiàn)在改用struts2后,發(fā)現(xiàn)運(yùn)行不到一天tomcat就出現(xiàn)內(nèi)存溢出的錯(cuò)誤。使用jProfiler分析一下,發(fā)現(xiàn)tomcat啟動(dòng)后使用的內(nèi)存就一路飆升,而且放在action里面的類(lèi)根本沒(méi)有釋放掉,應(yīng)該是struts出現(xiàn)了問(wèn)題,查一下struts的配置,原來(lái)沒(méi)有配ActionContextCleanUp,在web.xml中加入
          <filter>
            <filter-name>struts-cleanup</filter-name>
            <filter-class>
             org.apache.struts2.dispatcher.ActionContextCleanUp
            </filter-class>
           </filter>
           <filter-mapping>
            <filter-name>struts-cleanup</filter-name>
            <url-pattern>/*</url-pattern>
           </filter-mapping>
          再次用jprofiler進(jìn)行分析,果然好了。

          posted @ 2008-12-11 12:44 Kevin Meng 閱讀(783) | 評(píng)論 (0)編輯 收藏

          (1)定義在web.xml中定義JSPSupportServlet
           <servlet>
            <servlet-name>JSPSupportServlet</servlet-name>
            <servlet-class>
             org.apache.struts2.views.JspSupportServlet
            </servlet-class>
            <load-on-startup>1</load-on-startup>
           </servlet>
          (2)把struts-html.tld復(fù)制到WEB-INF目錄
          (3)在頁(yè)面最前面定義標(biāo)簽庫(kù)
          <#assign html=JspTaglibs["/WEB-INF/struts-html.tld"] />
          (4)在<head>中引用標(biāo)簽
          <@html.base/>
           (5)特別注意,在action的配置里面type="freemarker"去掉。因?yàn)槿绻?font color="#ff0000">type="freemarker",那么base為action的路徑,如http://localhost:8080/szmap/findpoi.go,如果去掉type="freemarker",那么base才為網(wǎng)頁(yè)路徑,如http://localhost:8080/szmap/find_poi.htm

          posted @ 2008-11-12 12:11 Kevin Meng 閱讀(1209) | 評(píng)論 (0)編輯 收藏

          最近需要把www.map512.cn的地圖重新進(jìn)行分割一下,因?yàn)橐郧暗牡貓D是通過(guò)arcIMS進(jìn)行分割的,還要配置arcIMS,那煩死人,所以決定還是把以前VB+ArcEngine版本的割圖程序修改一下,改成C#+ArcEngine,改完后馬上割起來(lái),結(jié)果發(fā)現(xiàn)程序運(yùn)行時(shí)所耗的內(nèi)存不斷提高,最后異常退出了,這說(shuō)明肯定有個(gè)地方有內(nèi)存溢出,剛開(kāi)始以為是我代碼的問(wèn)題,不斷的修改代碼,花了兩天時(shí)間還是不行,調(diào)試后發(fā)現(xiàn)出錯(cuò)的地方在arcEngine的出圖函數(shù)output()上,于是打電話(huà)問(wèn)ESRI的客服,給我的答案是沒(méi)有解決的辦法,噴飯!!!!

          昨天老肖提醒了我一下,打補(bǔ)丁,于是立刻給arcEngine打上了SP5補(bǔ)丁,果然再也沒(méi)有問(wèn)題了!靠
          心得是:有事別找ESRI技術(shù)支持!:)

          posted @ 2008-10-24 10:08 Kevin Meng 閱讀(1981) | 評(píng)論 (8)編輯 收藏

          (1)點(diǎn)項(xiàng)目-》添加應(yīng)用-》瀏覽,導(dǎo)入log4net.dll
          (2)修改app.config

          <?xml version="1.0" encoding="utf-8" ?>
          <configuration>
            <configSections>
              <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
                <section name="clipmapAEC.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
                <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
              </sectionGroup>
            </configSections>
            <userSettings>
              <clipmapAEC.Properties.Settings>
                <setting name="mapModelMinX" serializeAs="String">
                  <value>-80000</value>
                </setting>
                <setting name="mapModelMaxX" serializeAs="String">
                  <value>170000</value>
                </setting>
                <setting name="mapModelMinY" serializeAs="String">
                  <value>-80000</value>
                </setting>
                <setting name="mapModelMaxY" serializeAs="String">
                  <value>170000</value>
                </setting>
                <setting name="scalePara" serializeAs="String">
                  <value>2</value>
                </setting>
                <setting name="tileSize" serializeAs="String">
                  <value>512</value>
                </setting>
              </clipmapAEC.Properties.Settings>
              <log4net>
                <root>
                  <level value="INFO" />
                  <appender-ref ref="consoleApp" />
                </root>

                <appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net" >
                  <param name="File" value="C:\\clipmap_log.txt" />
                  <param name="AppendToFile" value="false" />
                  <param name="RollingStyle" value="Date" />
                  <param name="DatePattern" value="yyyy.MM.dd" />
                  <param name="StaticLogFileName" value="true" />
                  <layout type="log4net.Layout.PatternLayout,log4net">
                    <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
                    <param name="Header" value=" ----------------------header--------------------------" />
                    <param name="Footer" value=" ----------------------footer--------------------------" />
                  </layout>
                </appender>
                <appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
                  <layout type="log4net.Layout.PatternLayout,log4net">
                    <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
                  </layout>
                </appender>
                <logger name="Log4NetTest.LogTest">
                  <level value="ERROR" />
                  <appender-ref ref="rollingFile" />
                  <appender-ref ref="coloredConsoleApp" />
                  <appender-ref ref="SystemEvent" />
                </logger>
              </log4net>
            </userSettings>
          </configuration>
          紅色部分是對(duì)log4net的設(shè)置,其他不用管
          (3)在要只用log4net的類(lèi)namespace前面加using log4net; [assembly: log4net.Config.XmlConfigurator()]
          (4)在代碼中使用logger.info("XXXX");就可以了

          posted @ 2008-10-16 15:49 Kevin Meng 閱讀(759) | 評(píng)論 (0)編輯 收藏

          環(huán)境
          jdk1.6
          tomcat5.028

          首先下載“xalan系列jar包”,下載地址:http://www.apache.org/dyn/closer.cgi/xml/xalan-j,
          然后將tomcat中目錄下:/tomcat/common/endorsed/(xercesImpl.jar和xml-apis.jar)刪掉,然后將下載的xalan系列jar包(包括serializer.jar、xalan.jar、xercesImpl.jar、xml-apis.jar、xsltc.jar)拷貝到/tomcat/common/endorsed目錄,重啟tomcat

          posted @ 2008-10-09 10:25 Kevin Meng 閱讀(1539) | 評(píng)論 (0)編輯 收藏

          例如:http://www.map512.cn/findPOI.do?key=南門(mén)
          如果不轉(zhuǎn)碼,request.getParameter("key")返回的是亂碼,在jsp中,我們一般這樣子傳參數(shù)
          String key2=URLEncoder.encode(key,"gbk");
          http://www.map512.cn/findPOI.do?key=key2

          那么在freemarker中怎么辦呢?

          <#setting url_escaping_charset='gbk'>
          <a href=http://www.map512.cn/findPOI.do?key=${key?url}>查詢(xún)</a>

          posted @ 2008-09-18 16:39 Kevin Meng 閱讀(4593) | 評(píng)論 (2)編輯 收藏

          <1>軟硬件環(huán)境
          Apache Http Server 2.2.4
          Tomcat 5.028
          jdk1.6
          請(qǐng)自行下載jk_module.so,但注意必須與apache http server的版本對(duì)應(yīng)。

          硬件我手頭有一臺(tái)IBM服務(wù)器,有三臺(tái)刀片機(jī)可用,IP分別是
          S1:192.168.70.101
          S2:192.168.70.102
          S3:192.168.70.103
          當(dāng)然這三臺(tái)機(jī)器您完全可以用三個(gè)一般的臺(tái)式機(jī)來(lái)代替.
          我們的計(jì)劃是
          用S1來(lái)做應(yīng)用服務(wù)器,用S2來(lái)做負(fù)載均衡,用S3來(lái)做數(shù)據(jù)庫(kù)服務(wù)器.
          <2>在S1,S2下安裝jdk1.6
          例如我安裝在c:\jdk1.6下
          添加環(huán)境變量:
          JAVA_HOME=C:\jdk1.6
          CLASSPATH=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar
          在PATH前面加:
          PATH=%JAVA_HOME%\bin;
          <3>在S1下安裝apache,沒(méi)有什么值得注意的地方,一路按next就可以了
          我安裝在D:\Apache2.2
          <4>在S1,S2下安裝tomcat 5.028
          也是一路按next就可以了,我安裝在d:\tomcat5.0

          以上對(duì)于一個(gè)java開(kāi)發(fā)人員來(lái)說(shuō)應(yīng)該都不是問(wèn)題,接下來(lái)就是重頭戲了!
          <5>配置
          5.1 把下載的mod_jk-1.2.26-httpd-2.2.4.so拷貝到S1機(jī)器的D:\Apache2.2\modules目錄下,并改名為mod_jk.so
          5.2 打開(kāi)S1機(jī)器的D:\Apache2.2\conf\http.conf文件,在一堆LoadModule的最后加上這么一行
          LoadModule jk_module modules/mod_jk.so
          5.3 在D:\Apache2.2\conf\http.conf的最后加上對(duì)jk_module的配置

          #與tomcat關(guān)聯(lián)

          <IfModule jk_module>

          JkWorkersFile conf/workers.properties 

          JkMountFile conf/uriworkermap.properties

          JkLogFile logs/mod_jk.log

          JkLogLevel warn

          </IfModule>

          <IfModule dir_module>

              DirectoryIndex index.html,index.jsp,index.htm   

          </IfModule>

          #結(jié)束與tomcat關(guān)聯(lián)

           


          #添加虛擬主機(jī),注意S1上apache網(wǎng)頁(yè)文件目錄和tomcat網(wǎng)頁(yè)文件目錄要指向同一個(gè)目錄,否則靜態(tài)頁(yè)面會(huì)無(wú)法訪(fǎng)問(wèn)  

          <VirtualHost *:80>
                ServerName www.map512.cn
                DocumentRoot D:/Tomcat5.0/webapps
                ServerAdmin support.szmap@gmail.com
                JkMountFile conf/uriworkermap.properties
          </VirtualHost>
          #給虛擬主機(jī)目錄付權(quán)限
          <Directory D:/Tomcat5.0/webapps>                   
                  Options Indexes FollowSymLinks
                  AllowOverride None
                  Order allow,deny
                  Allow from all
          </Directory>

          #默認(rèn)訪(fǎng)問(wèn)
          <IfModule dir_module>
              DirectoryIndex index.html,index.jsp  
          </IfModule>


          5.4 在D:\Apache2.2\conf\http.conf目錄下新建一個(gè)文件workers.properties,并添加以下內(nèi)容

          #
          # workers.properties
          #


          # list the workers by name

          worker.list=SZMAP, status

          # localhost server 1
          # ------------------------
          worker.s1.port=8009
          worker.s1.host=192.168.70.101
          worker.s1.type=ajp13

          # localhost server 2
          # ------------------------
          worker.s2.port=8009
          worker.s2.host=192.168.70.102
          worker.s2.type=ajp13
          # worker.s2.stopped=1

          worker.SZMAP.type=lb
          worker.retries=3
          worker.SZMAP.balance_workers=s1, s2
          worker.SZMAP.sticky_session=1

          worker.status.type=status

          說(shuō)明:這個(gè)文件配置了兩個(gè)worker,一個(gè)是SZMAP即我們的應(yīng)用服務(wù),這個(gè)應(yīng)用服務(wù)type是lb即負(fù)載均衡,并由s1和s2兩個(gè)balanced_workers來(lái)執(zhí)行,這里你可以添加無(wú)限多個(gè)服務(wù)器來(lái)實(shí)現(xiàn)負(fù)載(當(dāng)然,前提是您有足夠的RMB),一個(gè)是status是用來(lái)查看負(fù)載均衡狀態(tài)的,我們后面將會(huì)用到.

          5.6 在D:\Apache2.2\conf\http.conf目錄下新建一個(gè)文件uriworkermap.properties,并添加以下內(nèi)容

          /*=SZMAP
          /jkstatus=status    #設(shè)置除以下類(lèi)型的文件外,都由tomcat提供服務(wù)(也就是說(shuō)下面列出的格式都有apache提供服務(wù))

          !/*.gif=SZMAP
          !/*.jpg=SZMAP
          !/*.png=SZMAP
          !/*.css=SZMAP
          !/*.js=SZMAP
          !/*.html=SZMAP


          說(shuō)明:這個(gè)配置的意思是,所有的請(qǐng)求都轉(zhuǎn)到SZMAP這個(gè)worker(即上面配置的s1,s2這兩個(gè)balanced_workers下的tomcat服務(wù))去執(zhí)行,除了*.gif,*.html等靜態(tài)元素和/jkstatus,/jkstatus由status這個(gè)worker執(zhí)行.

          5.7 Tomcat的配置
          打開(kāi)S1機(jī)器D:\Tomcat5.0\conf\server.xml,找到Engine部分,改成

          <Engine defaultHost="localhost" name="Catalina" jvmRoute="s1">

                <Host appBase="webapps" name="localhost">

             

          <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"

                           managerClassName="org.apache.catalina.cluster.session.DeltaManager"

                           expireSessionsOnShutdown="false"

                           useDirtyFlag="true">


                      <Membership 

                          className="org.apache.catalina.cluster.mcast.McastService"

                          mcastAddr="228.0.0.4"

                          mcastPort="45564"

                          mcastFrequency="500"

                          mcastDropTime="3000"/>


                      <Receiver 

                          className="org.apache.catalina.cluster.tcp.ReplicationListener"

                          tcpListenAddress="auto"

                          tcpListenPort="4001"

                          tcpSelectorTimeout="100"

                          tcpThreadCount="6"/>


                      <Sender

                          className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"

                          replicationMode="pooled"/>


                      <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"

                             filter=".*\.gif;.*\.js;.*\.jpg;.*\.html;.*\.txt;"/>

                  </Cluster>

              

                  <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>

                </Host>

                <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>

                <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>

              </Engine>

          打開(kāi)S2機(jī)器D:\Tomcat5.0\conf\server.xml,找到Engine部分,改成

          <Engine defaultHost="localhost" name="Catalina" jvmRoute="s2">

                <Host appBase="webapps" name="localhost">

              

          <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"

                           managerClassName="org.apache.catalina.cluster.session.DeltaManager"

                           expireSessionsOnShutdown="false"

                           useDirtyFlag="true">


                      <Membership 

                          className="org.apache.catalina.cluster.mcast.McastService"

                          mcastAddr="228.0.0.4"

                          mcastPort="45564"

                          mcastFrequency="500"

                          mcastDropTime="3000"/>


                      <Receiver 

                          className="org.apache.catalina.cluster.tcp.ReplicationListener"

                          tcpListenAddress="auto"

                          tcpListenPort="4001"

                          tcpSelectorTimeout="100"

                          tcpThreadCount="6"/>


                      <Sender

                          className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"

                          replicationMode="pooled"/>


                      <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"

                             filter=".*\.gif;.*\.js;.*\.jpg;.*\.html;.*\.txt;"/>

                  </Cluster>

              

                  <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>

                </Host>

                <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>

                <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>

              </Engine>


          到此,我們的配置已經(jīng)完成.


          <6>查看結(jié)果
          啟動(dòng)S1和S2下的tomcat服務(wù),然后啟動(dòng)S1下的apache服務(wù).
          打開(kāi)流覽器,輸入地址http://192.168.70.101/jkstatus,如果能看到以下界面,那么,恭喜您,您該感謝我了!呵呵!

          JK Status Manager for 192.168.70.101:80

          Server Version: Apache/2.2.4 (Win32) mod_jk/1.2.26
          JK Version: mod_jk/1.2.26


          (every seconds) [Change Format: XML | Property | Text]  [Read Only]   [S=Show only this worker, E=Edit worker, R=Reset worker state, T=Try worker recovery]

           


           

          Listing Load Balancing Worker (1 Worker) [Hide]


           

          [S|E|R]  Worker Status for SZMAP

          Type Sticky Sessions Force Sticky Sessions Retries LB Method Locking Recover Wait Time Max Reply Timeouts
          lb True False 2 Request Optimistic 60 0

          Good Degraded Bad/Stopped Busy Max Busy Next Maintenance
          2 0 0 0 6 32/94

          Balancer Members [Hide]

            Name Type Host Addr Act State D F M V Acc Err CE RE Wr Rd Busy Max Route RR Cd Rs
          [E|R s1 ajp13 192.168.70.101:8009 192.168.70.101:8009 ACT OK/IDLE 0 1 1 0 1821 0 0 0 1.3M 2.0M 0 5 s1     0/0
          [E|R s2 ajp13 192.168.70.102:8009 192.168.70.102:8009 ACT OK/IDLE 0 1 1 0 1821 0 0 0 1.3M 2.0M 0 4 s2     0/0

          Edit one attribute for all members: [Activation |LB Factor |Route |Redirect Route |Cluster Domain |Distance ]



          參考:
          proxy方式:http://blog.chinaunix.net/u/22176/showart_1002535.html
          liunx下的配置:http://seven.blog.51cto.com/120537/57930

          posted @ 2008-09-10 10:25 Kevin Meng 閱讀(560) | 評(píng)論 (0)編輯 收藏

          所有的頁(yè)面用UTF-8編碼,然后
          在struts.xml中加
          <constant name="struts.locale" value="zh_CN"></constant>
           <constant name="struts.i18n.encoding" value="UTF-8"></constant>
          即可。

          posted @ 2008-08-22 18:50 Kevin Meng 閱讀(247) | 評(píng)論 (0)編輯 收藏

          (1)在eclipse中配置好struts2

          (2)把struts2-spring-plugin-2.0.11.2.jar包復(fù)制到WEB-INF\lib目錄
          (3)在web.xml中配置spring
          <listener>
              <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
          </listener>
          記住,如果您之前用過(guò)spring,請(qǐng)把spring配置去掉。
           <servlet>
            <servlet-name>context</servlet-name>
            <servlet-class>
             org.springframework.web.context.ContextLoaderServlet
            </servlet-class>
            <load-on-startup>1</load-on-startup>
           </servlet>
          (4)修改applicationContext.xml
          <beans default-autowire="byName" xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
          (5)在struts.xml加入
          <constant name="struts.objectFactory" value="spring" />
          (6)在spring的配置文件applicationContext.xml中定義action
          <bean id="SearchBusLineAction"
            class="com.bus.struts2.action.SearchBusLineAction" abstract="false"
            lazy-init="default" autowire="default" dependency-check="default">
            <property name="busService">
             <ref bean="BusServiceImpl" />
            </property>
           </bean> 
          (7)在struts.xml中定義action
          <!-- 注意這里class="SearchBusLineAction"而不是com.bus.struts2.action.SearchBusLineAction是因?yàn)檫@個(gè)已經(jīng)在spring的applicationContext.xml中定義 -->
            <action name="searchBusLine" class="SearchBusLineAction">
             <result name="success" type="freemarker">/index.jsp</result>
            </action>

          posted @ 2008-08-22 17:41 Kevin Meng 閱讀(2423) | 評(píng)論 (0)編輯 收藏

          選Project->Clean...重新編譯一下項(xiàng)目就可以了。

          posted @ 2008-08-08 16:07 Kevin Meng 閱讀(235) | 評(píng)論 (0)編輯 收藏

          freemarker腳本將你的頁(yè)面搞得一團(tuán)槽吧.

          修改一下dreamweaver的配置,將freemarker 腳本顯示成和js一樣的圖標(biāo)效果吧

          以dreamweaver8為例

          打開(kāi)

          Dreamweaver 8\Configuration\ThirdPartyTags\Tags.xml

          加入

          < !-- FreeMarker Tag By hety-->
          <directive_spec tag_name="ftl_b1" start_string="[#" end_string="]" detect_in_attribute="true" icon="TemplateExpr.gif" icon_width="17" icon_height="15"/>
          <directive_spec tag_name="ftl_e1" start_string="[/#" end_string="]" detect_in_attribute="true" icon="TemplateExpr.gif" icon_width="17" icon_height="15"/>
          <directive_spec tag_name="ftl_i" start_string="[@" end_string="/]" detect_in_attribute="true" icon="TemplateExpr.gif" icon_width="17" icon_height="15"/>
          <directive_spec tag_name="ftl_b2" start_string="<#" end_string=">" detect_in_attribute="true" icon="TemplateExpr.gif" icon_width="17" icon_height="15"/>
          <directive_spec tag_name="ftl_e2" start_string="</#" end_string=">" detect_in_attribute="true" icon="TemplateExpr.gif" icon_width="17" icon_height="15"/>
          <directive_spec tag_name="ftl_v" start_string="${" end_string="}" detect_in_attribute="true" icon="TemplateExpr.gif" icon_width="17" icon_height="15"/>

          重啟下dreamweaver就搞定

          dreamweaver其它版本的腳本配置也差不多



          還可參考:http://weishuwei.javaeye.com/blog/85041

          posted @ 2008-08-08 14:06 Kevin Meng 閱讀(315) | 評(píng)論 (0)編輯 收藏

          http://blog.csdn.net/maxgong2005/archive/2006/05/12/725977.aspx

          posted @ 2008-07-07 10:43 Kevin Meng 閱讀(165) | 評(píng)論 (0)編輯 收藏

          (1)配置tomcat支持SSL,請(qǐng)參考我的文章:http://www.aygfsteel.com/menglikun/archive/2008/07/02/212065.html
          (2)把證書(shū)導(dǎo)到j(luò)re,運(yùn)行cmd
          Microsoft Windows XP [版本 5.1.2600]
          (C) 版權(quán)所有 1985-2001 Microsoft Corp.

          C:\Documents and Settings\Administrator>d:

          D:\>cd d:\tomcat5.0

          D:\Tomcat5.0>keytool -export -file myserver.cert -alias cas -keystore server.key
          store
          輸入keystore密碼:
          保存在文件中的認(rèn)證 <myserver.cert>

          D:\Tomcat5.0>

          執(zhí)行到這里,您應(yīng)該可以在d:\tomcat5.0目錄中找到一個(gè)文件myserver.cert
          接著,我們要把這個(gè)證書(shū)文件導(dǎo)到客戶(hù)端的JVM中,因?yàn)楝F(xiàn)在我們的客戶(hù)端和服務(wù)器端都是同一臺(tái)機(jī)器,所以直接進(jìn)入cmd,執(zhí)行以下命令就可以了
          D:\Tomcat5.0>keytool -import -keystore c:/jdk1.6/jre/lib/security/cacerts -file
          myserver.cert -alias cas
          輸入keystore密碼:                                                                //注意,這里是默認(rèn)密碼changeit
          所有者:CN=localhost, OU=szghj, O=szghj, L=suzhou, ST=jiangsu, C=cn
          簽發(fā)人:CN=localhost, OU=szghj, O=szghj, L=suzhou, ST=jiangsu, C=cn
          序列號(hào):486ae46a
          有效期: Wed Jul 02 10:14:02 CST 2008 至Tue Sep 30 10:14:02 CST 2008
          證書(shū)指紋:
                   MD5:AC:A9:C2:47:36:DF:D0:C1:76:F3:6D:14:70:73:90:5C
                   SHA1:3C:2E:45:92:29:98:ED:7E:93:34:BB:11:2D:EE:ED:E3:E4:4D:E3:85
                   簽名算法名稱(chēng):SHA1withRSA
                   版本: 3
          信任這個(gè)認(rèn)證? [否]:  y
          認(rèn)證已添加至keystore中

          (3)配置CAS服務(wù)器
          我用戶(hù)的是3.2.1版本,直接把cas-server-webapp-3.2.1.war復(fù)制到tomcat的webapp目錄,改名為userservice-cas就可以了
          (4)配置客戶(hù)端,我用的是cas-client-java-2.1.0,把casclient.jar復(fù)制到客戶(hù)端的lib目錄,然后打開(kāi)web.xml,添加如下的過(guò)濾器就可以了。
          <filter>
            <filter-name>CAS Filter</filter-name>
            <filter-class>
             edu.yale.its.tp.cas.client.filter.CASFilter
            </filter-class>
            <init-param>
             <param-name>
              edu.yale.its.tp.cas.client.filter.loginUrl
             </param-name>
             <param-value>
              https://localhost:8443/userservice-cas/login
             </param-value>
            </init-param>
            <init-param>
             <param-name>
              edu.yale.its.tp.cas.client.filter.validateUrl
             </param-name>
             <param-value>
              https://localhost:8443/userservice-cas/serviceValidate
             </param-value>
            </init-param>
            <init-param>
             <param-name>
              edu.yale.its.tp.cas.client.filter.serverName
             </param-name>
             <param-value>
              localhost:4000
             </param-value>
            </init-param>
           </filter>

           <filter-mapping>
            <filter-name>CAS Filter</filter-name>
            <url-pattern>/jsp/user/*</url-pattern>
           </filter-mapping>

          其他:
          (1)成功登錄后,出現(xiàn)錯(cuò)誤 Unable to validate ProxyTicketValidator 是什么原因。
          這是因?yàn)閿?shù)字證書(shū)的簽名不一致造成的,例如生成證書(shū)的時(shí)候用localhost,但是訪(fǎng)問(wèn)的時(shí)候卻用機(jī)器名。統(tǒng)一一下就可以了

          posted @ 2008-07-02 11:19 Kevin Meng 閱讀(319) | 評(píng)論 (0)編輯 收藏

          由于最近需要CAS,所以研究了一下tomcat SSL的配置,現(xiàn)記錄下來(lái)。
          環(huán)境:
          window xp
          tomcat 5.028
          jdk 1.6
          (1)進(jìn)入cmd
          我的tomcat安裝在d:\tomcat5.0,所以進(jìn)入該目錄

          Microsoft Windows XP [版本 5.1.2600]
          (C) 版權(quán)所有 1985-2001 Microsoft Corp.

          C:\Documents and Settings\Administrator>d:

          D:\>cd d:\tomcat5.0

          D:\Tomcat5.0>keytool -genkey -alias cas -keyalg RSA -keystore server.keystore            //別名是cas,您可以自己修改
          輸入keystore密碼:                                                //我輸入了密碼menglikun,您可以自己改,但要記住,后面要用到
          再次輸入新密碼:
          您的名字與姓氏是什么?
            [Unknown]:  localhost      //如果是開(kāi)發(fā)環(huán)境,建議用localhost或機(jī)器名,如果是發(fā)布環(huán)境,請(qǐng)用域名,不要用IP

          您的組織單位名稱(chēng)是什么?
            [Unknown]:  szghj
          您的組織名稱(chēng)是什么?
            [Unknown]:  szghj
          您所在的城市或區(qū)域名稱(chēng)是什么?
            [Unknown]:  suzhou
          您所在的州或省份名稱(chēng)是什么?
            [Unknown]:  jiangsu
          該單位的兩字母國(guó)家代碼是什么
            [Unknown]:  cn
          CN=localhost, OU=szghj, O=szghj, L=suzhou, ST=jiangsu, C=cn 正確嗎?
            [否]:  y

          輸入<cas>的主密碼
                  (如果和 keystore 密碼相同,按回車(chē)):                                    //輸入密碼menglikun
          再次輸入新密碼:

          D:\Tomcat5.0>
          執(zhí)行到這一步,如果不出意外的話(huà),在d:\tomcat5.0目錄下就會(huì)有一個(gè)server.ksystore文件
          (2)打開(kāi)d:\tomcat5.0\conf\server.xml,添加一個(gè)新的connector,修改后的server.xml如下:
          <?xml version='1.0' encoding='utf-8'?>
          <Server>
            <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
            <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
            <GlobalNamingResources>
              <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
              <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
              <ResourceParams name="UserDatabase">
                <parameter>
                  <name>factory</name>
                  <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
                </parameter>
                <parameter>
                  <name>pathname</name>
                  <value>conf/tomcat-users.xml</value>
                </parameter>
              </ResourceParams>
            </GlobalNamingResources>
            <Service name="Catalina">
              <Connector URIEncoding="UTF-8" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="4000" redirectPort="8443" useBodyEncodingForURI="true" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
              </Connector>
              <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
              </Connector>
             <Connector port="8443"
                         maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                         enableLookups="false" disableUploadTimeout="true"
                         acceptCount="100" debug="0" scheme="https" secure="true"
                         clientAuth="false" sslProtocol="TLS" keystorePass="menglikun" keystoreFile="server.keystore" />
              <Engine defaultHost="localhost" name="Catalina">
                <Host appBase="webapps" name="localhost">
                  <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
                </Host>
                <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
                <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
              </Engine>
            </Service>
          </Server>
          (3)重新啟動(dòng)tomcat,在瀏覽器中輸入https://localhost:8443,如果出現(xiàn)安全提示,說(shuō)明SSL配置成功

          posted @ 2008-07-02 10:48 Kevin Meng 閱讀(197) | 評(píng)論 (0)編輯 收藏

          (1)開(kāi)通泛域名支持,即house.map512.cn,plan.map512.cn,map512.cn都指向同一IP,如218.4.157.245
          (2)修改tomcat目錄下的conf/server.xml,在engine里面添加

          <Host name="localhost" debug="0" appBase="E:\\Tomcat5.0\\webapps"
                 unpackWARs="true" autoDeploy="true"
                 xmlValidation="false" xmlNamespaceAware="false">
                 <Logger className="org.apache.catalina.logger.FileLogger"
                           directory="logs"  prefix="localhost_log." suffix=".txt"
                      timestamp="true"/>
                  <Context path="" docBase="E:\\Tomcat5.0\\webapps\\szmap"  reloadable="true" caseSensitive="false" debug="0"></Context>
           </Host>

           <Host name="house.map512.cn" debug="0" appBase="E:\\Tomcat5.0\\suzhou"
                 unpackWARs="true" autoDeploy="true"
                 xmlValidation="false" xmlNamespaceAware="false">
                 <Alias>house.map512.cn</Alias>
                 <Context path="" docBase="E:\\Tomcat5.0\\suzhou\\szhouse"  reloadable="true" caseSensitive="false" debug="0"></Context>
           </Host>

           <Host name="plan.map512.cn" debug="0" appBase="E:\\Tomcat5.0\\suzhou"
                 unpackWARs="true" autoDeploy="true"
                 xmlValidation="false" xmlNamespaceAware="false">
                 <Alias>plan.map512.cn</Alias>
                 <Context path="" docBase="E:\\Tomcat5.0\\suzhou\\szghgs"  reloadable="true" caseSensitive="false" debug="0"></Context>
           </Host>

          posted @ 2008-07-01 16:14 Kevin Meng 閱讀(904) | 評(píng)論 (0)編輯 收藏

          網(wǎng)上有很多介紹,但是都太麻煩,特別是當(dāng)你的表中有l(wèi)ob字段的時(shí)候,其實(shí)很簡(jiǎn)單,用以下SQL就可以了。
          create table tab2 tablespace space2 as (select t.* from tab1 t);
          tab1為原來(lái)的表,tab2為臨時(shí)表 space2為目的表空間。
          執(zhí)行完后,把tab1刪除,然后把tab2改名為tab1就可以了。注意該方法不能復(fù)制索引,所以必須重建索引!

          posted @ 2008-06-18 16:02 Kevin Meng 閱讀(492) | 評(píng)論 (0)編輯 收藏

          1、盡量不要使用 like '%..%'

          2、對(duì)于 like '..%..' (不以 % 開(kāi)頭),Oracle可以應(yīng)用 colunm上的index

          3、對(duì)于 like '%...' 的 (不以 % 結(jié)尾),可以利用 reverse + function index 的形式,變化成 like '..%' 代碼

           

          建測(cè)試表和Index。

          注意:重點(diǎn)在于帶reverse的function index。同時(shí),一定要使用CBO才行......

           

          SQL> select reverse('123') from dual;

          REVERSE('123')

          --------------------------------

          321

          1 row selected.

           

          SQL> create table test_like as select object_id,object_name from dba_objects;

          Table created.

           

          SQL> create index test_like__name on test_like(object_name);

          Index created.

           

          SQL> create index test_like__name_reverse on test_like(reverse(object_name));

          Index created.

           

          SQL> analyze table test_like compute statistics for table for all indexes;

          Table analyzed.

           

          SQL> set autot trace

           

          --常量開(kāi)頭的like , 會(huì)利用index ,沒(méi)問(wèn)題......

          SQL> select * from test_like where object_name like AS%';

          Execution Plan

          ----------------------------------------------------------

          0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=655 Bytes=15720)

          1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TEST_LIKE' (Cost=2 Card=655Bytes=15720)

          2 1 INDEX (RANGE SCAN) OF 'TEST_LIKE__NAME' (NON-UNIQUE) (Cost=2 Card=118)

           

          -- 開(kāi)頭和結(jié)尾都是%,對(duì)不起,很難優(yōu)化

           

          SQL> select * from test_like where object_name like '%%';

           

          Execution Plan

          ----------------------------------------------------------

          0 SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=655 Bytes=15720)

          1 0 TABLE ACCESS (FULL) OF 'TEST_LIKE' (Cost=6 Card=655 ytes=15720)

           

          -- 以常量結(jié)束,直接寫(xiě)的時(shí)候是不能應(yīng)用index的

          SQL> select * from test_like where object_name like '%S';

          Execution Plan

          ----------------------------------------------------------

          0 SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=655 Bytes=15720)

          1 0 TABLE ACCESS (FULL) OF 'TEST_LIKE' (Cost=6 Card=655 Bytes=15720)

           

          --'以常量結(jié)束的,加個(gè)reverse 函數(shù),又可以用上index了'

          SQL> select * from test_like where reverse(object_name)like reverse('%AS');

          Execution Plan

          ----------------------------------------------------------

          0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=655 Bytes=15720)

          1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TEST_LIKE' (Cost=2 Card=655 Bytes=15720)

          2 1 INDEX (RANGE SCAN) OF 'TEST_LIKE__NAME_REVERSE' (NON-UNIQUE) (Cost=2 Card=118)

          posted @ 2008-06-16 09:18 Kevin Meng 閱讀(398) | 評(píng)論 (0)編輯 收藏

          來(lái)源:http://forum.ubuntu.org.cn/viewtopic.php?t=120157&highlight=
          今天開(kāi)機(jī)的時(shí)候,ubuntu系統(tǒng)提示說(shuō)
          Busybox v1.1.3 (debian1:1.1.3-5 ubuntu12)built-in shell (ash)
          enter 'help'for a list of built-in commands
          (initranfs)
          在網(wǎng)上找了很多資料終于找到了解決方法:
          先說(shuō)說(shuō)我的情況,我的是雙系統(tǒng),WindowsXP+Ubuntu,所以我進(jìn)去windowsxp系統(tǒng)

          把boot里面的initrd.img-2.6.24-12-generic.bak重命名替換initrd.img-2.6.24-12-generic

          我的問(wèn)題就是這樣解決的。
          重啟電腦,一切正常!!
          希望對(duì)大家有幫助!

          posted @ 2008-05-26 09:52 Kevin Meng 閱讀(1177) | 評(píng)論 (3)編輯 收藏

          我的開(kāi)發(fā)環(huán)境:Oracle 9i,Window Server 2003
          (1)正確安裝Oracle 9i企業(yè)版,Oracle9i企業(yè)版在安裝的時(shí)候就已經(jīng)默認(rèn)提供了全文索引支持。如果你的Oracle還沒(méi)有安裝,請(qǐng)先安裝一下,至于怎樣安裝,這里不做討論,請(qǐng)Google一下。
          (2)Oracle9i默認(rèn)情況下會(huì)把ctxsys用戶(hù)鎖定,請(qǐng)以DBA身份登陸Oracle,把用戶(hù)ctxsys解鎖,并修改其密碼為ctxsys,以便于我們后面登陸Text Manager
          (3)進(jìn)入Oracle的text manager,點(diǎn)程序->Oracle-OracleHome92->Enterprise Manager Console。選獨(dú)立啟動(dòng),然后選工具欄最下面的應(yīng)用程序->text Manager,這時(shí)會(huì)要求您輸入用戶(hù)名和密碼,用戶(hù)名ctxsys,密碼ctxsys
          (4)選擇首選項(xiàng)——〉語(yǔ)言指定器——〉CTXSYS,選一個(gè)點(diǎn)類(lèi)似創(chuàng)建,輸入指示器的名字如chinese_lexer,選擇lexer下的chinese_vgrnm_lexer 。
          (5)建立索引,在索引上點(diǎn)右鍵,然后選創(chuàng)建CONTEXT索引,這里要注意方案要選擇您自己的表空間,如我有個(gè)表SZPOI在表空間SUZHOU中,現(xiàn)在我要對(duì)該表的UNITNAME字段建立全文索引,那么方案選suzhou,表選szpoi,字段選unitname,首選項(xiàng)中選擇chinese_lexer 。

            這樣全文檢索就建好了,并用chinese_vgram_lexer作為分析器。

          (6)如何查詢(xún)數(shù)據(jù)。索引建立以后,我們就可以對(duì)該表進(jìn)行全文索引查詢(xún)了,查詢(xún)語(yǔ)句如下:
          SELECT score(1),t.unitname,t.objectid,t.eminx,t.eminy,t.mpfullname,t.dianhua FROM szpoi t WHERE contains (unitname, '規(guī)劃局,吳中分局', 1) > 0 order by score(1) desc

          這個(gè)語(yǔ)句的意思是在表szpoi中查詢(xún)unitname包含“規(guī)劃局”和“吳中分局”兩個(gè)關(guān)鍵字的記錄,并按匹配度從高到低排序。
          大功告成了嗎?沒(méi)有!
          接著我們還要建立兩個(gè)job來(lái)維護(hù)和優(yōu)化索引。
          維護(hù):
          begin
            sys.dbms_job.submit(job => :job,
                                what => 'ctx_ddl.sync_index(''SZPOI_UNITNAME_INDEX'');',
                                next_date => to_date('23-05-2008 13:54:57', 'dd-mm-yyyy hh24:mi:ss'),
                                interval => 'SYSDATE + (1/24/4)');
            commit;
          end;
          優(yōu)化:
          begin
            sys.dbms_job.submit(job => :job,
                                what => 'ctx_ddl.optimize_index(''SZPOI_UNITNAME_INDEX'',''FULL'');',
                                next_date => to_date('23-05-2008 14:03:02', 'dd-mm-yyyy hh24:mi:ss'),
                                interval => 'SYSDATE + 1');
            commit;
          end;

          posted @ 2008-05-23 13:47 Kevin Meng 閱讀(665) | 評(píng)論 (0)編輯 收藏

          一、下載三個(gè)軟件:Apache 2,Subversion和TortoiseSVN
          二、安裝apache,最好用80端口
          三、安裝Subversion
          四、安裝TortoiseSVN
          五、進(jìn)入D:\Subversion,新建一個(gè)目錄projects
          六、在projects目錄中點(diǎn)鼠標(biāo)右鍵,選擇TortoiseSVN->create reposities here...新建一個(gè)倉(cāng)庫(kù)
          七、打開(kāi)apache的httpd.conf文件,找到
          #LoadModule dav_module modules/mod_dav.so
          #LoadModule dav_fs_module modules/mod_dav_fs.so
          把前面的#去掉,并添加
          LoadModule dav_svn_module D:/Subversion/bin/mod_dav_svn.so
          LoadModule authz_svn_module D:/Subversion/bin/mod_authz_svn.so
          八、在httpd.conf后面添加

          <Location /svn>
          #
          # SVN
          #
          DAV svn
          SVNParentPath "D:/Subversion"

          </Location>
          保存,然后重啟apache,打開(kāi)ie,輸入http://localhost/svn/projects/看看能不能打開(kāi),如果能打開(kāi),恭喜您,您離成功已經(jīng)不遠(yuǎn)了!
          九、設(shè)置權(quán)限
          點(diǎn)開(kāi)始->運(yùn)行,打開(kāi)控制臺(tái)
          進(jìn)入D:\Apache\Apache2\bin,運(yùn)行
          htpasswd -c D:\Subversion\passwd   menglikun
          新建一個(gè)密碼文件,并添加用戶(hù)menglikun,如果要添加更多用戶(hù),運(yùn)行
          htpasswd -m D:\Subversion\passwd   test 
          添加test用戶(hù)
          十、修改apache的httpd.conf文件

          <Location /svn>
          #
          # SVN
          #
          DAV svn
          SVNParentPath "D:/Subversion"

          AuthType Basic
          AuthName "Subversion repository"
          AuthUserFile D:/Subversion/passwd
          Require valid-user
          </Location>
          保存,重啟apache,再次進(jìn)入http://localhost/svn/projects,這次就要求輸入密碼了!
          OK,大功告成!
          更多設(shè)置,請(qǐng)找google,如如何設(shè)置目錄的訪(fǎng)問(wèn)權(quán)限(只讀,可寫(xiě)等等)。



           

          posted @ 2008-04-11 11:15 Kevin Meng 閱讀(227) | 評(píng)論 (0)編輯 收藏

          新建一個(gè)CSS標(biāo)簽,標(biāo)簽名選擇TABLE,確定后在彈出的CSS樣式編輯器里,選"分類(lèi)"中的"方框"選項(xiàng),將里面的寬,高,填充,邊界的值全部設(shè)為0;再將"定位"中"類(lèi)型"下面的寬,高的值也都設(shè)為0,點(diǎn)保存,然后再把表格的樣式設(shè)置為table就可以了,即class="TABLE".

          posted @ 2008-03-03 17:20 Kevin Meng 閱讀(1534) | 評(píng)論 (0)編輯 收藏

          firefox上網(wǎng)慢是由于解析域名需要太長(zhǎng)時(shí)間造成的,解決辦法如下(有時(shí)間再翻譯成中文):

          Local DNS Cache for Faster Browsing on Ubuntu System

          by @ 8:57 am. Filed under Other Linux

           

          A DNS server resolves domain names into IP addresses. So when you request “yahoo.com” for example, the DNS server finds out the address for the domain, and sends your request the right way.

           

          You can run a DNS cache on your computer. This will speed up the process of looking up domain names when browsing. The difference is about 30-60 ms. Multiply that difference by the number of websites you visit a day for an approximate estimate of the speed improvement.

          The following instructions are for someone with a broadband internet connection, where the computer gets it’s local IP address using DHCP from the router in your home or office.

          Install dnsmasq in Ubuntu

          Dnsmasq is a lightweight, easy to configure, DNS forwarder and DHCP server. It is designed to provide DNS and optionally, DHCP, to a small network. It can serve the names of local machines which are not in the global DNS. The DHCP server integrates with the DNS server and allows machines with DHCP-allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic DHCP leases and BOOTP for network booting of diskless machines.

          First you need to make sure that Universe repository is enabled in your sources.list file

          Install dnsmasq Using the following command

          sudo apt-get install dnsmasq

          uncomment the following line (remove “#” in the beginning) in the file /etc/dnsmasq.conf

          listen-address=127.0.0.1

          Now edit

          /etc/dhcp3/dhclient.conf

          and make sure the section below exactly like this, especially the line that says “prepend domain-name-servers 127.0.0.1;”

          #supersede domain-name “fugue.com home.vix.com”;
          prepend domain-name-servers 127.0.0.1;
          request subnet-mask, broadcast-address, time-offset, routers,
          domain-name, domain-name-servers, host-name,
          netbios-name-servers, netbios-scope;

          In the normal case, when you get a new dhcp lease, the dhcp3 client (tool) on your computer gets a new lease, and updates the

          /etc/resolv.conf

          file on your computer with the right values for the DNS servers to use (usually some machine in the network of your hosting provider). Adding the “prepend” option as we did above ensures that “127.0.0.1″ will appear on the top of the list of DNS servers. That magic number refers to your own computer. So in the future, whenever your computer needs to resolve a domain name, it will forward that request to dnsmasq (which is running at 127.0.0.1 - your computer). If the details for the domain name are already in you cache, well and good, dnsmasq will serve it up and make the process real fast. If it is not in the cache, then dnsmasq will look at the /etc/resolv.conf file and use the nameservers listed below the “127.0.0.1″. I hope that explains things.

          Now open the file

          /etc/resolv.conf

          in your text editor. It probably looks like:

          search yourisp.com
          nameserver 217.54.170.023
          nameserver 217.54.170.024
          nameserver 217.54.170.026

          The 127.0.0.1 is missing right now since you haven’t renewed your lease after you edited the /etc/dhcp3/dhclient.conf file. So, let us add that in manually this one time. After you do, your /etc/resolv.conf file will look like the following:

          search yourisp.com
          nameserver 127.0.0.1
          nameserver 217.54.170.023
          nameserver 217.54.170.024
          nameserver 217.54.170.026

          Now you need to restart the dnsmasq using the following command

          sudo /etc/init.d/dnsmasq restart.

          Now you are running a local DNS cache.

          Testing Your Local DNS Cache

          If you want to measure your speed improvement, type the command

          dig yahoo.com

          You will see something like “;; Query time: 38 msec” there.

          Now type the command again, and you should see something like:”;; Query time: 2 msec”

          posted @ 2008-01-22 12:47 Kevin Meng 閱讀(1886) | 評(píng)論 (0)編輯 收藏

          apache 2.2.3
          tomcat 5.028
          下載 mod_jk.so(http://www.aygfsteel.com/Files/menglikun/mod_jk2.rar )放到D:\Apache2.2\modules
          修改D:\Apache2.2\conf\httpd.conf在后面加以下代碼
          # Using mod_jk2.dll to redirect dynamic calls to Tomcat
          LoadModule jk_module modules\mod_jk2.so
          JkWorkersFile "conf\workers.properties"
          JkLogFile "logs\mod_jk2.log"
          JkLogLevel debug
          JkMount /*.jsp worker1
          JkMount /szmap3/* worker1
          在D:\Apache2.2\conf\httpd.conf中新建workers.properties加入代碼
          workers.tomcat_home=d:\Tomcat5.0 #讓mod_jk模塊知道Tomcat
          workers.java_home=C:\jdk1.5 #讓mod_jk模塊知道j2sdk
          ps=\ #指定文件路徑分割符
          worker.list=worker1
          worker.worker1.port=8009 #工作端口,若沒(méi)占用則不用修改
          worker.worker1.host=localhost #Tomcat服務(wù)器的地址
          worker.worker1.type=ajp13 #類(lèi)型
          worker.worker1.lbfactor=1 #負(fù)載平衡因數(shù)
          為避免出現(xiàn)亂碼,必須修改tomcat安裝目錄下的conf/server.xml,修改以下配置
          <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443" URIEncoding="GBK">
              </Connector>
          重新啟動(dòng)apache就可以了

          posted @ 2007-12-25 15:20 Kevin Meng 閱讀(233) | 評(píng)論 (0)編輯 收藏

          這是因?yàn)閒orm里面有個(gè)按鈕名字叫submit,改成別的別的名稱(chēng)如submit2就可以了。  

          posted @ 2007-11-23 09:08 Kevin Meng 閱讀(711) | 評(píng)論 (0)編輯 收藏

              用encodeURIComponent就可以了。如以下代碼:
              var name =  document.getElementById("textName").value;
              if (name=="樓盤(pán)名稱(chēng)")
                  name = "";
              var url="house/searchHouse.php?district="+encodeURIComponent(district);
             

          posted @ 2007-09-26 15:09 Kevin Meng 閱讀(566) | 評(píng)論 (0)編輯 收藏

          一、軟件準(zhǔn)備
          (1)apache_2.2.3-win32-x86-no_ssl.msi 到官方網(wǎng)站下載
          (2)php-5.2.4-win32-installer.msi 到官方網(wǎng)站下載
          二、安裝apache_2.2.3我們安裝在D:\apache2.2目錄下,如果您的機(jī)器上已經(jīng)安裝有oracle,因?yàn)閛racle的apache占用了80端口,安裝完后打開(kāi)D:\Apache2.2\conf\httpd.conf文件,把Listen 80改成別的端口號(hào),如4001
          三、安裝php5.2.4,安裝時(shí)要求選擇apache安裝目錄,選擇D:\Apache2.2就可以了。
          四、測(cè)試PHP是否已經(jīng)安裝成功,進(jìn)入D:\Apache2.2\htdocs新建一個(gè)文本文件,輸入
          <?php
          phpinfo();
          ?>
          另存為phpinfo.php
          啟動(dòng)apahche服務(wù),然后打開(kāi)瀏覽器,輸入http://localhost:4001/phpinfo.php,如果出現(xiàn)php信息頁(yè)面,說(shuō)明php安裝成功。

          posted @ 2007-09-26 11:15 Kevin Meng 閱讀(338) | 評(píng)論 (0)編輯 收藏

          declare
          cursor t1 is select * from szmenpaipro;
          begin
          for rec in t1 loop
          update wgspoi t set t.detail=rec.jieshao where t.objectid=rec.objid;
          end loop;
          end;

          posted @ 2007-08-02 16:48 Kevin Meng 閱讀(1347) | 評(píng)論 (1)編輯 收藏

          出現(xiàn)這個(gè)錯(cuò)誤是因?yàn)閛racle序列R3產(chǎn)生的值在表gdb_objectclasses中已經(jīng)有記錄造成的。解決辦法是進(jìn)入plus/sql或用PL/SQL Developer鏈接oracle.
          (1)執(zhí)行SQL
          SELECT MAX(id) FROM gdb_objectclasses
          找出id的最大值。例如執(zhí)行結(jié)果是
          MAX(ID)
          ---------------
          55
          (2)執(zhí)行SQL
          SELECT registration_id FROM table_registry WHERE table_name = 'GDB_OBJECTCLASSES'
          找到表'GDB_OBJECTCLASSES'注冊(cè)ID號(hào)
          如執(zhí)行結(jié)果是
          --------------
          3
          (3)執(zhí)行SQL
          SELECT last_number FROM user_sequences WHERE sequence_name = 'R3'
          找出序列R3的下一個(gè)值,如果第二步中的執(zhí)行結(jié)果是4則這里是R4。例如執(zhí)行結(jié)果是:
          LAST_NUMBER
          ---------------
          50
          (4)從上面的查詢(xún)結(jié)果中可以看出,序列R3的下一個(gè)值是50,而表gdb_objectclasses中小于55的值都已經(jīng)被占用了。所以就會(huì)出現(xiàn)異常Unique contraint (SDE.GDB_OC_PKC) violated。解決辦法是不斷增加序列R3的值,使其大于55,執(zhí)行下面的SQL語(yǔ)句6次就可以了。
          SELECT R3.NEXTVAL from dual
          (5)在SDE中,選中sde連接后點(diǎn)鼠標(biāo)右鍵,選擇refresh。然后就可以再導(dǎo)數(shù)據(jù)了。注意這一步一定要進(jìn)行,這也是我一直認(rèn)為sde很爛的地方。

          posted @ 2007-04-11 09:52 Kevin Meng 閱讀(7890) | 評(píng)論 (0)編輯 收藏

          例如有這樣一個(gè)表,其中ID號(hào)為AAAK2aAAMAAAOX+AAX的記錄是重復(fù)的,如何只取其中一條記錄呢?
           

          ID1

          XINGMING

          XINGBIE

          CENGYONGMING

          MINZU

          PAICHUSUOBIANHAO

          JUWEIHUIBIANHAO

          AAAK2aAAMAAAOefAAx

          陳長(zhǎng)芬

          2

           

          01

          32059856

          3205985607

          AAAK2aAAMAAAOfgAAn

          陳尺平

          1

           

          01

          32059856

          3205985615

          AAAK2aAAMAAAOX+AAX

          陳春付

          1

           

          01

          32059856

          3205985602

          AAAK2aAAMAAAOX+AAX

          陳春付

          1

           

          01

          32059856

          3205985602

          AAAK2aAAMAAAOX+AAX

          陳春付

          1

           

          01

          32059856

          3205985602

          通過(guò)這個(gè)SQL就可以了。
          create table szzzrktemp as (select * from zzrktemp t1
          where rowid in (select max(rowid) from zzrktemp t2
           where t1.id1=t2.id1))

          posted @ 2007-04-09 13:13 Kevin Meng 閱讀(236) | 評(píng)論 (0)編輯 收藏

          oracle打了9.2.0.4的補(bǔ)丁之后,必須把版本也改變過(guò)來(lái)。
          運(yùn)行cmd
          sqlplus /nolog

          SQL*Plus: Release 9.2.0.1.0 - Production on 星期四 4月 5 09:35:41 2007

          Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

          SQL> conn sys/system@ora as sysdba
          已連接。
          SQL> shutdow immediate
          數(shù)據(jù)庫(kù)已經(jīng)關(guān)閉。
          已經(jīng)卸載數(shù)據(jù)庫(kù)。
          ORACLE 例程已經(jīng)關(guān)閉。
          SQL> startup migrate
          ORACLE 例程已經(jīng)啟動(dòng)。
          Total System Global Area 1687760036 bytes
          Fixed Size                   457892 bytes
          Variable Size             486539264 bytes
          Database Buffers         1199570944 bytes
          Redo Buffers                1191936 bytes
          數(shù)據(jù)庫(kù)裝載完畢。
          數(shù)據(jù)庫(kù)已經(jīng)打開(kāi)。
          SQL> spool d:\catpatch.log
          SQL> @d:\oracle\ora92\rdbms\admin\catpatch.sql
          SQL> spool off
          注:在catpatch中會(huì)調(diào)用catexp來(lái)修改exp
          至此成功修改exp
          使用exp導(dǎo)出成功DD
           

          posted @ 2007-04-05 09:42 Kevin Meng 閱讀(682) | 評(píng)論 (1)編輯 收藏

          當(dāng)一個(gè)access表中有“備注”類(lèi)型的字段時(shí),通過(guò)access的“導(dǎo)出”命令導(dǎo)到oracle時(shí),將出現(xiàn)錯(cuò)誤而無(wú)法導(dǎo)入。解決辦法是通過(guò)PL/SQL Developer來(lái)導(dǎo)。

          posted @ 2007-04-02 23:08 Kevin Meng 閱讀(544) | 評(píng)論 (0)編輯 收藏

          當(dāng)我們用下面的通用代碼插入一個(gè)點(diǎn)到空間表中時(shí),會(huì)報(bào)SPECIFIED ATTRIBUTE COLUMN DOESN'T EXIST錯(cuò)誤,錯(cuò)誤信息如下:
          ArcSDE Error Number        : -38
           Error Description          : SPECIFIED ATTRIBUTE COLUMN DOESN'T EXIST.
          com.esri.sde.sdk.client.SeException:
           at com.esri.sde.sdk.client.j.a(Unknown Source)
           at com.esri.sde.sdk.client.j.a (Unknown Source)
           at com.esri.sde.sdk.client.SeInsert.intoTable(Unknown Source)
           at com.suzhou.service.sde.SDEOperation.addPointObject(SDEOperation.java:59)
           at com.suzhou.struts.action.AdminCheckNewObjAction.execute (AdminCheckNewObjAction.java:143)
           at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
           at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java :419)
           at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
           at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
           at org.apache.struts.action.ActionServlet.doGet ( ActionServlet.java:414)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:237)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
           at com.suzhou.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java :24)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
           at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:214)
           at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
           at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
           at org.apache.catalina.core.StandardContextValve.invokeInternal (StandardContextValve.java:198)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
           at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
           at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
           at org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:104)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
           at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
           at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:520)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
           at org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:520)
           at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
           at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
           at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:799)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
           at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
           at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
           at java.lang.Thread.run(Thread.java:619)
          插入點(diǎn)的java代碼如下:

          String server = "menglikunm";

           int instance = 5151;

           String database = "ora";

           String user = "suzhou";

           String password = "suzhou";

           public Long addPointObject(long x, long y, String tabname) throws Exception {
            SeLayer insertLayer = null;
            SeConnection conn = null;
            Long intsertRowID = null;
            try {
             conn = new SeConnection(server, instance, database, user, password);
             Vector layerList = conn.getLayers();
             for (int index = 0; index < layerList.size(); index++) {
              SeLayer layer = (SeLayer) layerList.elementAt(index);
              System.out.println(layer.getName());
              if ( layer.getName().equalsIgnoreCase(tabname)) {
               insertLayer = layer;
               break;
              }
             }
            } catch (SeException e) {
             // e.printStackTrace();
             throw e;
            }
            // 開(kāi)始插入數(shù)據(jù)
            if (insertLayer == null) {
             throw new Exception("找不到空間表:" + tabname);
            }
            try {
             conn.startTransaction();
             String[] cols = new String[1];
             //cols[0] = insertLayer.getSpatialColumn();
             cols[0]="SHAPE";
             System.out.println(cols[0]);
             SeInsert insert = new SeInsert(conn);
             System.out.println(insertLayer.getName());
             insert.intoTable(insertLayer.getName(), cols);//運(yùn)行到這里時(shí)出現(xiàn)錯(cuò)誤!
             insert.setWriteMode(true);
             SeCoordinateReference coordref = (SeCoordinateReference) insertLayer
               .getCoordRef();
             SeShape shape = new SeShape(coordref);

             int numPts = 1;
             SDEPoint[] ptArray = new SDEPoint[numPts];
             ptArray[0] = new SDEPoint(x, y);
             shape.generatePoint(numPts, ptArray);
             SeRow row = insert.getRowToSet();
             row.setShape(0, shape);
             insert.execute();
             intsertRowID = new Long(insert.lastInsertedRowId().longValue());
             insert.close();
             conn.commitTransaction();
             conn.close();
            } catch (Exception ex) {
             ex.printStackTrace ();
             try {
              conn.rollbackTransaction();
              conn.close();
             } catch (Exception ex2) {
             }
             throw ex;
            }
            return intsertRowID;
           }

          之所以出現(xiàn)這個(gè)錯(cuò)誤,是因?yàn)楫?dāng)插入一個(gè)點(diǎn)到空間表中時(shí),arcsde自動(dòng)生成一個(gè)OBJECTID值,但如果你的空間表導(dǎo)到SDE的時(shí)候表中已經(jīng)有了OBJECTID字段,SDE自動(dòng)生成的是OBJECTID_1字段作為每條記錄的ID字段,如果你把OBJECTID_1字段人為的刪除,那么這時(shí)候arcSDE就找不到該字段了,就會(huì)報(bào)出SPECIFIED ATTRIBUTE COLUMN DOESN'T EXIST.的錯(cuò)誤,解決辦法是重新導(dǎo)一下該空間表,且導(dǎo)入的時(shí)候不能有命名為OBJECTID的字段。

          很多時(shí)候,這些問(wèn)題都要你自己來(lái)發(fā)現(xiàn)和解決,不能太相信ESRI的技術(shù)支持,他們大部分時(shí)候都不能給你什么幫助:)

          posted @ 2007-04-02 23:05 Kevin Meng 閱讀(1862) | 評(píng)論 (1)編輯 收藏

          例如有的時(shí)候你需要你的筆記本去作演示,web應(yīng)用安裝在你的筆記本上,但沒(méi)有網(wǎng)線(xiàn),無(wú)法連網(wǎng)。這時(shí)候如果啟動(dòng)tomcat,將無(wú)法鏈接數(shù)據(jù)庫(kù),那怎么辦呢。點(diǎn)網(wǎng)絡(luò)連接,選擇屬性,然后把所有驅(qū)動(dòng)都安裝一遍,再重新啟動(dòng)tomcat服務(wù)就可以了。

          posted @ 2007-03-29 17:11 Kevin Meng 閱讀(497) | 評(píng)論 (0)編輯 收藏

          下面是矩形選擇的源代碼。多邊形選擇多加點(diǎn)就可以了。
          public?class?RectSelectAction?extends?Action?{

          ????
          //?---------------------------------------------------------?Instance
          ????
          //?Variables

          ????
          //?---------------------------------------------------------?Methods

          ????
          /**
          ?????*?Method?execute
          ?????*?
          ?????*?
          @param?mapping
          ?????*?
          @param?form
          ?????*?
          @param?request
          ?????*?
          @param?response
          ?????*?
          @return?ActionForward
          ?????
          */

          ????
          public?ActionForward?execute(ActionMapping?mapping,?ActionForm?form,
          ????????????HttpServletRequest?request,?HttpServletResponse?response)?
          {
          ????????DynaActionForm?rectSelectForm?
          =?(DynaActionForm)?form;
          ????????String?startx?
          =?rectSelectForm.getString("startx");
          ????????String?starty?
          =?rectSelectForm.getString("starty");
          ????????String?endx?
          =?rectSelectForm.getString("endx");
          ????????String?endy?
          =?rectSelectForm.getString("endy");
          ????????Map?map?
          =?(Map)?request.getSession().getAttribute("THEMAP");
          ????????Polygon?polygon?
          =?this.creatPolygon(map,?startx,?starty,?endx,?endy);
          ????????
          if?(polygon?==?null)?{
          ????????????ActionMessages?msgs?
          =?new?ActionMessages();
          ????????????msgs.add(ActionMessages.GLOBAL_MESSAGE,?
          new?ActionMessage(
          ????????????????????
          "com.suzhou.message.createPolygonFail"));
          ????????????
          this.saveMessages(request,?msgs);
          ????????????
          return?mapping.findForward("resultPage");
          ????????}

          ????????FeatureLayer?menpaiLayer?
          =?null;
          ????????
          for?(int?i?=?0;?i?<?map.getLayers().getCount();?i++)?{
          ????????????
          if?(map.getLayers().item(i).getName().equals("地物點(diǎn)"))?{
          ????????????????menpaiLayer?
          =?(FeatureLayer)?map.getLayers().item(i);
          ????????????????System.out.println(menpaiLayer.getName());
          ????????????????System.out.println(menpaiLayer.getID());
          ????????????}

          ????????}

          ????????
          if?(menpaiLayer?==?null)?{
          ????????????ActionMessages?msgs?
          =?new?ActionMessages();
          ????????????msgs.add(ActionMessages.GLOBAL_MESSAGE,?
          new?ActionMessage(
          ????????????????????
          "com.suzhou.message.layerNotExsist",?"地物點(diǎn)"));
          ????????????
          this.saveMessages(request,?msgs);
          ????????????
          return?mapping.findForward("resultPage");
          ????????}

          ????????map.getLayers().setGeometry(
          true);//?設(shè)置返回空間信息
          ????????menpaiLayer.getRecordset().clearRecordset();
          ????????menpaiLayer.getRecordset().clearEnvelope();
          ????????menpaiLayer.getRecordset().clearGeometry();
          ????????map.getLayers().setOrder(
          false);
          ????????menpaiLayer.setFilterObject(
          null);
          ????????Filter?filter2?
          =?new?Filter();
          //????????filter2.addSubField("BLOCKNAME");
          //????????filter2.addSubField("MPNUM");
          //????????filter2.addSubField("MPABNAME");
          //????????filter2.addSubField("MPSUBNUM");
          ????????
          //filter2.setWhereExpression("");
          ????????filter2.setGlobalEnvelope(true);
          ????????filter2.setSpatialShape(polygon);
          ????????filter2.setRelation(Filter.AREA_INTERSECTION);
          ????????menpaiLayer.setFilterObject(filter2);
          ????????map.refresh();
          ????????menpaiLayer.setFilterObject(
          null);
          ????????
          if?(menpaiLayer.getRecordset()?==?null
          ????????????????
          ||?menpaiLayer.getRecordset().getCount()?<?1)?{
          ????????????ActionMessages?msgs?
          =?new?ActionMessages();
          ????????????msgs.add(ActionMessages.GLOBAL_MESSAGE,?
          new?ActionMessage(
          ????????????????????
          "com.suzhou.message.objectNotFound"));
          ????????????
          this.saveMessages(request,?msgs);
          ????????????
          return?mapping.findForward("resultPage");
          ????????}
          else{
          ????????????request.setAttribute(
          "result",menpaiLayer.getRecordset());
          ????????????
          return?mapping.findForward("resultPage");
          ????????}

          ????}


          ????
          /**
          ?????*?建立矩形
          ?????*?
          ?????*?
          @param?map
          ?????*?
          @param?startx:起點(diǎn)屏幕X坐標(biāo)
          ?????*?
          @param?starty:起點(diǎn)屏幕Y坐標(biāo)
          ?????*?
          @param?endx:終點(diǎn)屏幕X坐標(biāo)
          ?????*?
          @param?endy:終點(diǎn)屏幕Y坐標(biāo)
          ?????*?
          @return
          ?????
          */

          ????
          public?Polygon?creatPolygon(Map?map,?String?startx,?String?starty,
          ????????????String?endx,?String?endy)?
          {
          ????????
          try?{
          ????????????Point?pnt1?
          =?map.toMapPoint(new?Double(startx).doubleValue(),
          ????????????????????
          new?Double(starty).doubleValue());
          ????????????Point?pnt2?
          =?map.toMapPoint(new?Double(endx).doubleValue(),
          ????????????????????
          new?Double(endy).doubleValue());
          ????????????Point?pnt11?
          =?new?Point();
          ????????????Point?pnt22?
          =?new?Point();
          ????????????pnt11.setX(pnt1.getX());
          ????????????pnt11.setY(pnt2.getY());
          ????????????pnt22.setX(pnt2.getX());
          ????????????pnt22.setY(pnt1.getY());
          ????????????Points?points?
          =?new?Points();
          ????????????points.addPointObject(pnt1);
          ????????????points.addPointObject(pnt11);
          ????????????points.addPointObject(pnt2);
          ????????????points.addPointObject(pnt22);
          ????????????Ring?ring?
          =?new?Ring();
          ????????????ring.setPoints(points);
          ????????????Polygon?polygon?
          =?new?Polygon();
          ????????????polygon.addRing(ring);
          ????????????
          return?polygon;
          ????????}
          ?catch?(Exception?ex)?{
          ????????????
          return?null;
          ????????}

          ????}

          }

          posted @ 2007-03-20 17:16 Kevin Meng 閱讀(385) | 評(píng)論 (1)編輯 收藏

          當(dāng)一個(gè)web站點(diǎn)發(fā)布到互聯(lián)網(wǎng)上以后,系統(tǒng)的穩(wěn)定性很重要。而如果你后臺(tái)用的是oracle 9i,有時(shí)候會(huì)出現(xiàn)oracle服務(wù)意外停止的現(xiàn)象。解決辦法是:
          (1)給oracle打最新的補(bǔ)丁(很重要)
          (2)在控制面板的服務(wù)里面選擇oracleServiceXXX,選擇屬性,點(diǎn)“恢復(fù)”,把下面的三個(gè)操作都設(shè)置為“重新啟動(dòng)”就可以了。

          posted @ 2007-02-28 14:01 Kevin Meng 閱讀(1490) | 評(píng)論 (0)編輯 收藏

          大家都知道,在進(jìn)行arcims開(kāi)發(fā)時(shí),經(jīng)常要重新啟動(dòng)arcIMS服務(wù),如果你還用了arcSDE,那么要啟動(dòng)的服務(wù)更多。如果每次都到控制面板中啟動(dòng),累都累死人了。可以通過(guò)批處理來(lái)啟動(dòng)這些服務(wù)。
          新建一個(gè).bat文件,如“啟動(dòng)所有服務(wù).bat”。打開(kāi),輸入以下代碼:
          net start "OracleOraHome92TNSListener"
          pause
          net start "OracleServiceORA"
          pause
          net start "esri_sde"
          pause
          net start "ArcIMS Application Server 9.1"
          pause
          net start "ArcIMS Monitor 9.1"
          pause
          net start "ArcIMS Tasker 9.1"
          pause

          說(shuō)明:
          net start "OracleOraHome92TNSListener" --啟動(dòng)Oracle服務(wù)
          pause --暫停
          net start "OracleServiceORA" --啟動(dòng)Oracle服務(wù)
          net?start "szmap_sde" --啟動(dòng)arcSDE服務(wù)
          net start "ArcIMS Application Server 9.1" --啟動(dòng)arcIMS服務(wù)
          net?start "ArcIMS Monitor 9.1" --啟動(dòng)arcIMS服務(wù)
          net?start "ArcIMS Monitor 9.1" --啟動(dòng)arcIMS服務(wù)
          注意,啟動(dòng)服務(wù)的順序不能亂。

          net命令的詳細(xì)說(shuō)明看MS的DOS命令幫助。這里只作簡(jiǎn)單說(shuō)明。
          net?start "serviceKeyName",這里的serviceKeyName是服務(wù)的關(guān)鍵字,而不是控制面板中顯示的名字,控制面板中顯示的名字是DispalyName.要通過(guò)服務(wù)的DisplayName獲得KeyName可以通過(guò)以下命令實(shí)現(xiàn):
          sc getkeyname "serviceDisplayName"
          例如要查詢(xún)arcSDE服務(wù)“ArcSde Service(esri_sde)”的KeyName,可以運(yùn)行以下命令:
          C:\Documents and Settings\menglikun>sc getkeyname "ArcSde Service(esri_sde)"
          [SC] GetServiceKeyName SUCCESS? Name = esri_sde
          這里可以看出“ArcSde Service(esri_sde)”的KeyName=seri_sde,所以要啟動(dòng)這個(gè)SDE服務(wù),只要執(zhí)行命令:
          sc start "seri_sde"
          即可。

          再新建一個(gè)批處理文件“停止所有服務(wù).bat”,打開(kāi),輸入以下代碼:
          net stop "ArcIMS Tasker 9.1"
          net?stop "ArcIMS Monitor 9.1"
          net?stop "ArcIMS Application Server 9.1"
          net?stop "szmap_sde"
          net stop "OracleOraHome92TNSListener"
          注意,停止服務(wù)的順序剛好以啟動(dòng)相反。
          這樣,大功告成。以后要啟動(dòng)服務(wù),執(zhí)行“啟動(dòng)所有服務(wù).bat”,停止服務(wù)執(zhí)行“停止所有服務(wù).bat”即可。


          posted @ 2007-01-19 23:08 Kevin Meng 閱讀(496) | 評(píng)論 (0)編輯 收藏

          由于文章比較長(zhǎng)而且?guī)Ш芏鄨D片,不好在這里貼出,需要者請(qǐng)發(fā)郵件到kookmen@163.com索取。

          posted @ 2006-11-28 15:31 Kevin Meng 閱讀(606) | 評(píng)論 (9)編輯 收藏

          如果一個(gè)網(wǎng)頁(yè)中有Flash動(dòng)畫(huà),那么javaScript的OnmouseMove事件就無(wú)法響應(yīng),這時(shí)候只要把Flash的背景設(shè)置為透明就可以了。
          即加入:<param name="wmode" value="transparent">

          posted @ 2006-11-12 13:42 Kevin Meng 閱讀(354) | 評(píng)論 (0)編輯 收藏

          一、新建一個(gè)Filter,代碼如下:
          package com.suzhou.util;

          import java.io.IOException;
          import javax.servlet.*;

          public class SetCharacterEncodingFilter implements Filter {
          ?protected String encoding = null;// ///要制定的編碼,在web.xml中配置

          ?protected FilterConfig filterConfig = null;

          ?public void destroy() {
          ??this.encoding = null;
          ??this.filterConfig = null;
          ?}

          ?public void doFilter(ServletRequest request, ServletResponse response,
          ???FilterChain chain) throws IOException, ServletException {

          ??if (request.getCharacterEncoding() == null) {
          ???String encoding = getEncoding();// //得到指定的編碼名字
          ???if (encoding != null)
          ????request.setCharacterEncoding(encoding);// //設(shè)置request的編碼
          ??}
          ??chain.doFilter(request, response);// /有機(jī)會(huì)執(zhí)行下一個(gè)filter
          ?}

          ?public void init(FilterConfig filterConfig) throws ServletException {

          ??this.filterConfig = filterConfig;
          ??this.encoding = filterConfig.getInitParameter("encoding");// /得到在web.xml中配置的編碼
          ?}

          ?protected String getEncoding() {

          ??return (this.encoding);// /得到指定的編碼

          ?}

          }
          二、修改web.xml,添加:
          <filter>
          ??<filter-name>SetCharacterEncoding</filter-name>
          ??<filter-class>com.suzhou.util.SetCharacterEncodingFilter</filter-class>
          ??<init-param>
          ???<param-name>encoding</param-name>
          ???<param-value>GBK</param-value>
          ??</init-param>
          ?</filter>
          ?<filter-mapping>
          ??<filter-name>SetCharacterEncoding</filter-name>
          ??<url-pattern>/*</url-pattern>
          ?</filter-mapping>
          三、進(jìn)入http://localhost:port/admin,選擇Tomcat server/Service/Connector(port),把URI Encoding改成UTF-8,Use Body Encoding For URI Query Parameters:設(shè)置為true,點(diǎn)保存然后重新啟動(dòng)Tomcat即可。
          記住,每個(gè)jsp頁(yè)面的編碼都為:
          <%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*" errorPage="" %>

          這樣子不但能徹底解決中文參數(shù)問(wèn)題(如http://menglikn:4000/suzhou/getMap.do?ditu=市區(qū)圖),而且還能解決中文URL問(wèn)題(如http://menglikun:4000/suzhou/空白頁(yè).html)

          posted @ 2006-11-10 19:26 Kevin Meng 閱讀(528) | 評(píng)論 (0)編輯 收藏

          開(kāi)發(fā)環(huán)境:
          window xp
          jdk 1.5
          tomcat 5.028
          eclispe 3.2
          myeclipse 4.0
          步驟:
          (1)新建一個(gè)web project,名稱(chēng)為suzhouadmin
          (2)在項(xiàng)目上點(diǎn)鼠標(biāo)右鍵,選擇myeclipse->add spring capablities...
          (3)把Spring 1.2 AOP,Spring 1.2 Core Lib,Spring ORM/DAO/Hibernate 3.0 lib,Spring 1.2 web lib選擇中,Copy Checked lib content to project folder,然后點(diǎn)Next
          (4)folder改為:WebRoot/WEB-INF,F(xiàn)ile為applicationContext.xml不變。點(diǎn)Finish。
          Spring的引用完成。

          (5)在項(xiàng)目上點(diǎn)鼠標(biāo)右鍵,選擇myeclipse->add Struts capablities...
          (6)選擇struts1.1,base package for classes?改成 com.suzhou.admin.struts,然后點(diǎn)finish。

          Struts的引用完成。
          (6)新建立一個(gè)包c(diǎn)om.suzhou.admin.hibernate,然后在項(xiàng)目上點(diǎn)鼠標(biāo)右鍵,選擇myeclipse->add Hibernate capablities...
          (7)把Hibernate 3.0 core lib,Hibernate 3.0 advanced lib中,Copy Checked lib content to project folder,點(diǎn)Next
          (8)選擇Spring Configuration file(applicationContext.xml),點(diǎn)Next
          (9)選擇Exit spring configuration file.輸入sessionFactory id為sessionFactory。點(diǎn)Next
          (10)設(shè)置數(shù)據(jù)源ID為dataSource,選擇一個(gè)已經(jīng)設(shè)置好的DB profile,然后點(diǎn)Next
          (11)點(diǎn)Package...選擇com.suzhou.admin.hibernate,自動(dòng)生成類(lèi)名com.suzhou.admin.hibernate.HibernateSessionFactory。

          開(kāi)始配置Struts和Spring.
          (12)打開(kāi)WEB-INFO/web.xml,在最后面添加:
          ?<servlet>
          ??<servlet-name>context</servlet-name>
          ??<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
          ??<load-on-startup>1</load-on-startup>
          ?</servlet>
          這樣,Spring 的ApplicationContext就配置好了。通過(guò)以上配置,Web容器會(huì)自動(dòng)加載/WEB-INF/applicationContext.xml初始化
          ApplicationContext實(shí)例,如果需要指定配置文件位置,可通過(guò)context-param加以指定:
          <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>/WEB-INF/myApplicationContext.xml</param-value>
          </context-param>
          配置完成之后,即可通過(guò)
          WebApplicationContextUtils.getWebApplicationContext()
          方法在Web應(yīng)用中獲取ApplicationContext引用。

          (13)通過(guò)Struts config新建一個(gè)Action名為L(zhǎng)oginAction,自動(dòng)生成的action定義如下:
          ??? <action
          ????? attribute="loginForm"
          ????? input="/index.jsp"
          ????? name="loginForm"
          ????? path="/login"
          ????? scope="request"
          ????? type="com.suzhou.admin.struts.action.LoginAction">
          ????? <forward name="loginfail" path="/error.jsp" />
          ????? <forward name="loginok" path="/main.jsp" />
          ??? </action>
          把其改成:
          ??? <action
          ????? attribute="loginForm"
          ????? input="/index.jsp"
          ????? name="loginForm"
          ????? path="/login"
          ????? scope="request"
          ????? type="org.springframework.web.struts.DelegatingActionProxy">
          ????? <forward name="loginfail" path="/error.jsp" />
          ????? <forward name="loginok" path="/main.jsp" />
          ??? </action>
          并在struts-config.xml中添加Spring插件。
          ?<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
          ??<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
          ?</plug-in>
          (13)用Myeclipse Spring donfig editor打開(kāi)applicationContext.xml,點(diǎn)右鍵,選擇new Bean,輸入Bean name為/login,calss為com.suzhou.admin.struts.action.LoginAction。點(diǎn)finish,applicationContext.xml多加了一個(gè)Bean定義:
          <bean name="/login" class="com.suzhou.admin.struts.action.LoginAction" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default"></bean>

          posted @ 2006-10-25 13:36 Kevin Meng 閱讀(954) | 評(píng)論 (0)編輯 收藏

          (1)安裝文件必須放在英文目錄下,且文件夾名不能帶空格,否則會(huì)出現(xiàn)找不到文件的錯(cuò)誤。
          (2)如果安裝不成功,必須重新安裝時(shí),最好把所有已經(jīng)安裝的oracle服務(wù)刪除。刪除步驟是。
          a.進(jìn)入DOC
          b.進(jìn)入C:\WINDOWS\system32
          c.運(yùn)行sc delete OracleServiceName
          (3)如果系統(tǒng)安裝有放火墻,最好先把其關(guān)閉。安裝完oracle后再重新開(kāi)啟。

          posted @ 2006-10-19 09:29 Kevin Meng 閱讀(276) | 評(píng)論 (0)編輯 收藏

          開(kāi)發(fā)環(huán)境:
          jdk 1.5
          tomcat 5.0.28
          oracle 9i

          (1)在瀏覽器中輸入http://localhost:8181/admin/,登陸tomcat管理系統(tǒng)
          (2)選擇Tomcat server->service->Host->Context(/yourproject)->Resource->Data Source
          (3)在下拉列表中選擇Create new DataSource
          JNDI Name:jdbc/yourDatasourceName
          Data Source URL:jdbc:oracle:thin:@menglikunm:1521:ora
          JDBC Driver:oracle.jdbc.driver.OracleDriver
          UserName:username
          Password:password
          Max. Active Connections:2000(自己定)
          2
          (自己定)
          (4)把oracle 的class12.jar拷貝到tomcat的common/lib目錄下(不要忘記這一步哦)
          (5)重新啟動(dòng)Tomcat
          (6)測(cè)試,代碼如下:
          Connection con = null;
          ??try{
          ???Context ctx=new InitialContext();
          ???DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/ora_menglikunm");
          ???con=ds.getConnection();
          ??}catch(Exception ex){
          ???ex.printStackTrace();
          ??}

          (7)加班作吧!!!!:)

          posted @ 2006-09-22 10:36 Kevin Meng 閱讀(407) | 評(píng)論 (0)編輯 收藏

          在數(shù)據(jù)庫(kù)開(kāi)發(fā)中,打開(kāi)數(shù)據(jù)庫(kù)連接是很慢的。怎樣oracle當(dāng)前的連接數(shù)呢?只需要用下面的SQL語(yǔ)句查詢(xún)一下就可以了。
          select * from v$session where username is not null

          查看不同用戶(hù)的連接數(shù)
          select username,count(username) from v$session where username is not null group by username

          posted @ 2006-09-21 17:18 Kevin Meng 閱讀(6212) | 評(píng)論 (0)編輯 收藏

          亦可依次選擇菜單"window">>"preferences">>"general">>"content types"
          在右邊的窗口中打開(kāi)列表,選中"JavaScript",在下面的"default encoding"右邊的輸入框中輸入javaScript編碼,要看您的網(wǎng)頁(yè)用的編碼,如果是“GBK”就選"GBK",是"GB2312"就選“GB2312”,UTF-8就是UTF-8,再點(diǎn)"update"按鈕。

          posted @ 2006-09-06 17:46 Kevin Meng 閱讀(2205) | 評(píng)論 (5)編輯 收藏

          (1)運(yùn)行cmd
          exp sde/sde@ora 導(dǎo)出sde下的所有數(shù)據(jù)
          exp yourdata/yourdata@ora導(dǎo)出yourdata下所有的數(shù)據(jù)
          (2)用post install在目標(biāo)機(jī)器配置sde。
          (3)在目標(biāo)機(jī)器中建立用戶(hù)yourdata和yourdata表空間
          (4)把sde下面所有的表刪除掉,并授予sde用戶(hù)和yourdata用戶(hù)dba權(quán)限。
          (5)用PLSQL把導(dǎo)出的mdp文件導(dǎo)到sde和yourdata用戶(hù)下。
          (6)重新運(yùn)行arcsde post installation,選擇custom,去掉Define sde user Envirenment,然后不斷點(diǎn)下一步配置。最后一步選擇手動(dòng)啟動(dòng)sde服務(wù)。然后在控制面搬中手動(dòng)啟動(dòng)服務(wù)。

          posted @ 2006-08-23 09:50 Kevin Meng 閱讀(264) | 評(píng)論 (0)編輯 收藏

          這幾天開(kāi)始學(xué)習(xí)dom4j,在網(wǎng)上找了篇文章就開(kāi)干了,上手非常的快,但是發(fā)現(xiàn)了個(gè)問(wèn)題就是無(wú)法以UTF-8保存xml文件,保存后再次讀出的時(shí)候會(huì)報(bào)“Invalid byte 2 of 2-byte UTF-8 sequence.”這樣一個(gè)錯(cuò)誤,檢查發(fā)現(xiàn)由dom4j生成的這個(gè)文件,在使用可正確處理XML編碼的任何的編輯器中中文成亂碼,從記事本查看并不會(huì)出現(xiàn)亂碼會(huì)正確顯示中文。讓我很是頭痛。試著使用GBK、gb2312編碼來(lái)生成的xml文件卻可以正常的被解析。因此懷疑的dom4j沒(méi)有對(duì)utf-8編碼進(jìn)行處理。便開(kāi)始查看dom4j的原代碼。終于發(fā)現(xiàn)的問(wèn)題所在,是自己程序的問(wèn)題。
          ?? 在dom4j的范例和網(wǎng)上流行的《DOM4J 使用簡(jiǎn)介》這篇教程中新建一個(gè)xml文檔的代碼都類(lèi)似如下

          ????public void createXML(String fileName) {

          ????????Document doc = org.dom4j.DocumentHelper.createDocument();

          ????????Element root = doc.addElement("book");

          ????????root.addAttribute("name", "我的圖書(shū)");



          ????????Element childTmp;

          ????????childTmp = root.addElement("price");

          ????????childTmp.setText("21.22");



          ????????Element writer = root.addElement("author");

          ????????writer.setText("李四");

          ????????writer.addAttribute("ID", "001");



          ????????try {

          ????????????org.dom4j.io.XMLWriter xmlWriter = new org.dom4j.io.XMLWriter(

          ????????????????????new FileWriter(fileName));

          ????????????xmlWriter.write(doc);

          ????????????xmlWriter.close();

          ????????}

          ????????catch (Exception e) {

          ????????????System.out.println(e);

          ????????}

          ????}

          ?? 在上面的代碼中輸出使用的是FileWriter對(duì)象進(jìn)行文件的輸出。這就是不能正確進(jìn)行文件編碼的原因所在,java中由Writer類(lèi)繼承下來(lái)的子類(lèi)沒(méi)有提供編碼格式處理,所以dom4j也就無(wú)法對(duì)輸出的文件進(jìn)行正確的格式處理。這時(shí)候所保存的文件會(huì)以系統(tǒng)的默認(rèn)編碼對(duì)文件進(jìn)行保存,在中文版的window下java的默認(rèn)的編碼為GBK,也就是所雖然我們標(biāo)識(shí)了要將xml保存為utf-8格式但實(shí)際上文件是以GBK格式來(lái)保存的,所以這也就是為什么能夠我們使用GBK、GB2312編碼來(lái)生成xml文件能正確的被解析,而以UTF-8格式生成的文件不能被xml解析器所解析的原因。
          ?? 好了現(xiàn)在我們找到了原因所在了,我們來(lái)找解決辦法吧。首先我們看看dom4j是如何實(shí)現(xiàn)編碼處理的


          ?? public XMLWriter(OutputStream out) throws UnsupportedEncodingException {

          ????????//System.out.println("In OutputStream");

          ????????this.format = DEFAULT_FORMAT;

          ????????this.writer = createWriter(out, format.getEncoding());

          ????????this.autoFlush = true;

          ?????? namespaceStack.push(Namespace.NO_NAMESPACE);

          ????}



          ????public XMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException {

          ????????//System.out.println("In OutputStream,OutputFormat");

          ????????this.format = format;

          ????????this.writer = createWriter(out, format.getEncoding());

          ????????this.autoFlush = true;

          ?????? namespaceStack.push(Namespace.NO_NAMESPACE);

          ????}




          ????/**

          ???? * Get an OutputStreamWriter, use preferred encoding.

          ???? */

          ????protected Writer createWriter(OutputStream outStream, String encoding) throws UnsupportedEncodingException {

          ????????return new BufferedWriter(

          ????????????new OutputStreamWriter( outStream, encoding )

          ????????);

          ????}

          ?? 由上面的代碼我們可以看出dom4j對(duì)編碼并沒(méi)有進(jìn)行什么很復(fù)雜的處理,完全通過(guò)java本身的功能來(lái)完成。所以我們?cè)谑褂胐om4j的來(lái)生成我們的XML文件時(shí)不應(yīng)該直接為在構(gòu)建XMLWriter時(shí),不應(yīng)該直接為其賦一個(gè)Writer對(duì)象,而應(yīng)該通過(guò)一個(gè)OutputStream的子類(lèi)對(duì)象來(lái)構(gòu)建。也就是說(shuō)在我們上面的代碼中,不應(yīng)該用FileWriter對(duì)象來(lái)構(gòu)建xml文檔,而應(yīng)該使用FileOutputStream對(duì)象來(lái)構(gòu)建所以將代碼修改入下:
          ????public void createXML(String fileName) {

          ????????Document doc = org.dom4j.DocumentHelper.createDocument();

          ????????Element root = doc.addElement("book");

          ????????root.addAttribute("name", "我的圖書(shū)");



          ????????Element childTmp;

          ????????childTmp = root.addElement("price");

          ????????childTmp.setText("21.22");



          ????????Element writer = root.addElement("author");

          ????????writer.setText("李四");

          ????????writer.addAttribute("ID", "001");



          ????????try {
          ????????????//注意這里的修改


          ????????????org.dom4j.io.XMLWriter xmlWriter = new org.dom4j.io.XMLWriter(

          ????????????????????new FileOutputStream(fileName));

          ????????????xmlWriter.write(doc);

          ????????????xmlWriter.close();

          ????????}

          ????????catch (Exception e) {

          ????????????System.out.println(e);

          ????????}

          ????}
          ??
          ?? 至此DOM4J的問(wèn)題編碼問(wèn)題算是告一段落,希望對(duì)此文章對(duì)其他朋友有用。

          posted @ 2006-08-16 22:56 Kevin Meng 閱讀(115) | 評(píng)論 (0)編輯 收藏

          要在arcIMS中使用arcMap定義的mxd文件,安裝arcIMS時(shí)必須安裝arcMap server(默認(rèn)情況下是不安裝的),然后進(jìn)入arcIMS administrator,新建一個(gè)service,service的類(lèi)型必須選arcmap ImageServer就可以了。

          posted @ 2006-07-31 13:18 Kevin Meng 閱讀(1285) | 評(píng)論 (2)編輯 收藏

          ArcIMS Author是通過(guò)Java API來(lái)連接SDE數(shù)據(jù)庫(kù)的,有時(shí)候會(huì)出現(xiàn)arcIMS author無(wú)法連接SDE數(shù)據(jù)庫(kù),但arcCatalog卻可以的情況。
          解決辦法是進(jìn)入arcSDE的安裝目錄\lib下面把jpe91_sdk.jar,jsde91_sdk.jar兩個(gè)文件拷貝出來(lái),然后搜索arcIMS的安裝目錄,只要有這兩個(gè)文件的地方都覆蓋掉,然后依此重啟一下arcIMS的三個(gè)服務(wù)就可以了。

          posted @ 2006-07-28 16:55 Kevin Meng 閱讀(581) | 評(píng)論 (0)編輯 收藏

          60.AVG(DISTINCT|ALL)

          all表示對(duì)所有的值求平均值,distinct只對(duì)不同的值求平均值

          SQLWKS> create table table3(xm varchar(8),sal number(7,2));

          語(yǔ)句已處理。

          SQLWKS>? insert into table3 values('gao',1111.11);

          SQLWKS>? insert into table3 values('gao',1111.11);

          SQLWKS>? insert into table3 values('zhu',5555.55);

          SQLWKS> commit;

          SQL> select avg(distinct sal) from gao.table3;

          AVG(DISTINCTSAL)

          ----------------

          3333.33

          SQL> select avg(all sal) from gao.table3;

          AVG(ALLSAL)

          -----------

          2592.59

          61.MAX(DISTINCT|ALL)

          求最大值,ALL表示對(duì)所有的值求最大值,DISTINCT表示對(duì)不同的值求最大值,相同的只取一次

          SQL> select max(distinct sal) from scott.emp;

          MAX(DISTINCTSAL)

          ----------------

          5000

          62.MIN(DISTINCT|ALL)

          求最小值,ALL表示對(duì)所有的值求最小值,DISTINCT表示對(duì)不同的值求最小值,相同的只取一次

          SQL> select min(all sal) from gao.table3;

          MIN(ALLSAL)

          -----------

          1111.11

          63.STDDEV(distinct|all)

          求標(biāo)準(zhǔn)差,ALL表示對(duì)所有的值求標(biāo)準(zhǔn)差,DISTINCT表示只對(duì)不同的值求標(biāo)準(zhǔn)差

          SQL> select stddev(sal) from scott.emp;

          STDDEV(SAL)

          -----------

          1182.5032

          SQL> select stddev(distinct sal) from scott.emp;

          STDDEV(DISTINCTSAL)

          -------------------

          1229.951

          64.VARIANCE(DISTINCT|ALL) 求協(xié)方差

          SQL> select variance(sal) from scott.emp;

          VARIANCE(SAL)

          -------------

          1398313.9

          65.GROUP BY 主要用來(lái)對(duì)一組數(shù)進(jìn)行統(tǒng)計(jì)

          SQL> select deptno,count(*),sum(sal) from scott.emp group by deptno;

          DEPTNO? COUNT(*)? SUM(SAL)

          --------- --------- ---------

          10???????? 3????? 8750

          20???????? 5???? 10875

          30???????? 6????? 9400

          66.HAVING? 對(duì)分組統(tǒng)計(jì)再加限制條件

          SQL> select deptno,count(*),sum(sal) from scott.emp group by deptno having nt(*)>=5;

          DEPTNO? COUNT(*)? SUM(SAL)

          --------- --------- ---------

          20???????? 5???? 10875

          30???????? 6????? 9400

          SQL> select deptno,count(*),sum(sal) from scott.emp having count(*)>=5 group by tno ;

          DEPTNO? COUNT(*)? SUM(SAL)

          --------- --------- ---------

          20???????? 5???? 10875

          30???????? 6????? 9400

          67.ORDER BY? 用于對(duì)查詢(xún)到的結(jié)果進(jìn)行排序輸出

          SQL> select deptno,ename,sal from scott.emp order by deptno,sal desc;

          DEPTNO ENAME??????????? SAL

          --------- ---------- ---------

          10 KING??????????? 5000

          10 CLARK?????????? 2450

          10 MILLER????????? 1300

          20 SCOTT?????????? 3000

          20 FORD??????????? 3000

          20 JONES?????????? 2975

          20 ADAMS?????????? 1100

          20 SMITH??????????? 800

          30 BLAKE?????????? 2850

          30 ALLEN?????????? 1600

          30 TURNER????????? 1500

          30 WARD??????????? 1250

          30 MARTIN????????? 1250

          30 JAMES??????????? 950

          posted @ 2006-07-26 15:15 Kevin Meng 閱讀(182) | 評(píng)論 (0)編輯 收藏

          43.CONVERT(c,dset,sset)

          將源字符串 sset從一個(gè)語(yǔ)言字符集轉(zhuǎn)換到另一個(gè)目的dset字符集

          SQL> select convert('strutz','we8hp','f7dec') "conversion" from dual;

          conver

          ------

          strutz

          44.HEXTORAW 將一個(gè)十六進(jìn)制構(gòu)成的字符串轉(zhuǎn)換為二進(jìn)制

          45.RAWTOHEXT 將一個(gè)二進(jìn)制構(gòu)成的字符串轉(zhuǎn)換為十六進(jìn)制

          46.ROWIDTOCHAR 將ROWID數(shù)據(jù)類(lèi)型轉(zhuǎn)換為字符類(lèi)型

          47.TO_CHAR(date,'format')

          SQL> select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') from dual;

          TO_CHAR(SYSDATE,'YY

          -------------------

          2004/05/09 21:14:41

          48.TO_DATE(string,'format') 將字符串轉(zhuǎn)化為ORACLE中的一個(gè)日期

          49.TO_MULTI_BYTE? 將字符串中的單字節(jié)字符轉(zhuǎn)化為多字節(jié)字符

          SQL>? select to_multi_byte('高') from dual;

          TO

          --

          50.TO_NUMBER

          將給出的字符轉(zhuǎn)換為數(shù)字

          SQL> select to_number('1999') year from dual;

          YEAR

          ---------

          1999

          51.BFILENAME(dir,file)指定一個(gè)外部二進(jìn)制文件

          SQL>insert into file_tb1 values(bfilename('lob_dir1','image1.gif'));

          52.CONVERT('x','desc','source') 將x字段或變量的源source轉(zhuǎn)換為desc

          SQL> select sid,serial#,username,decode(command,

          2? 0,'none',

          3? 2,'insert',

          4? 3,

          5? 'select',

          6? 6,'update',

          7? 7,'delete',

          8? 8,'drop',

          9? 'other') cmd? from v$session where type!='background';

          SID?? SERIAL# USERNAME?????????????????????? CMD

          --------- --------- ------------------------------ ------

          1???????? 1??????????????????????????????? none

          2???????? 1??????????????????????????????? none

          3???????? 1??????????????????????????????? none

          4???????? 1??????????????????????????????? none

          5???????? 1??????????????????????????????? none

          6???????? 1??????????????????????????????? none

          7????? 1275??????????????????????????????? none

          8????? 1275??????????????????????????????? none

          9??????? 20 GAO??????????????????????????? select

          10??????? 40 GAO??????????????????????????? none

          53.DUMP(s,fmt,start,length)

          DUMP函數(shù)以fmt指定的內(nèi)部數(shù)字格式返回一個(gè)VARCHAR2類(lèi)型的值

          SQL> col global_name for a30

          SQL> col dump_string for a50

          SQL> set lin 200

          SQL> select global_name,dump(global_name,1017,8,5) dump_string from global_name;

          GLOBAL_NAME??????????????????? DUMP_STRING

          ------------------------------ --------------------------------------------------

          ORACLE.WORLD?????????????????? Typ=1 Len=12 CharacterSet=ZHS16GBK: W,O,R,L,D

          54.EMPTY_BLOB()和EMPTY_CLOB()

          這兩個(gè)函數(shù)都是用來(lái)對(duì)大數(shù)據(jù)類(lèi)型字段進(jìn)行初始化操作的函數(shù)

          55.GREATEST

          返回一組表達(dá)式中的最大值,即比較字符的編碼大小.

          SQL> select greatest('AA','AB','AC') from dual;

          GR

          --

          AC

          SQL> select greatest('啊','安','天') from dual;

          GR

          --

          56.LEAST

          返回一組表達(dá)式中的最小值

          SQL> select least('啊','安','天') from dual;

          LE

          --

          57.UID

          返回標(biāo)識(shí)當(dāng)前用戶(hù)的唯一整數(shù)

          SQL> show user

          USER 為"GAO"

          SQL> select username,user_id from dba_users where user_id=uid;

          USERNAME???????????????????????? USER_ID

          ------------------------------ ---------

          GAO?????????????????????????????????? 25

          58.USER

          返回當(dāng)前用戶(hù)的名字

          SQL> select user from? dual;

          USER

          ------------------------------

          GAO

          59.USEREVN

          返回當(dāng)前用戶(hù)環(huán)境的信息,opt可以是:

          ENTRYID,SESSIONID,TERMINAL,ISDBA,LABLE,LANGUAGE,CLIENT_INFO,LANG,VSIZE

          ISDBA? 查看當(dāng)前用戶(hù)是否是DBA如果是則返回true

          SQL> select userenv('isdba') from dual;

          USEREN

          ------

          FALSE

          SQL> select userenv('isdba') from dual;

          USEREN

          ------

          TRUE

          SESSION

          返回會(huì)話(huà)標(biāo)志

          SQL> select userenv('sessionid') from dual;

          USERENV('SESSIONID')

          --------------------

          152

          ENTRYID

          返回會(huì)話(huà)人口標(biāo)志

          SQL> select userenv('entryid') from dual;

          USERENV('ENTRYID')

          ------------------

          0

          INSTANCE

          返回當(dāng)前INSTANCE的標(biāo)志

          SQL> select userenv('instance') from dual;

          USERENV('INSTANCE')

          -------------------

          1

          LANGUAGE

          返回當(dāng)前環(huán)境變量

          SQL> select userenv('language') from dual;

          USERENV('LANGUAGE')

          ----------------------------------------------------

          SIMPLIFIED CHINESE_CHINA.ZHS16GBK

          LANG

          返回當(dāng)前環(huán)境的語(yǔ)言的縮寫(xiě)

          SQL> select userenv('lang') from dual;

          USERENV('LANG')

          ----------------------------------------------------

          ZHS

          TERMINAL

          返回用戶(hù)的終端或機(jī)器的標(biāo)志

          SQL> select userenv('terminal') from dual;

          USERENV('TERMINA

          ----------------

          GAO

          VSIZE(X)

          返回X的大小(字節(jié))數(shù)

          SQL> select vsize(user),user from dual;

          VSIZE(USER) USER

          ----------- ------------------------------

          6 SYSTEM

          posted @ 2006-07-26 15:13 Kevin Meng 閱讀(189) | 評(píng)論 (0)編輯 收藏

          26.MOD(n1,n2) 返回一個(gè)n1除以n2的余數(shù)

          SQL> select mod(10,3),mod(3,3),mod(2,3) from dual;

          MOD(10,3)? MOD(3,3)? MOD(2,3)

          --------- --------- ---------

          1???????? 0???????? 2

          27.POWER 返回n1的n2次方根

          SQL> select power(2,10),power(3,3) from dual;

          POWER(2,10) POWER(3,3)

          ----------- ----------

          1024???????? 27

          28.ROUND和TRUNC

          按照指定的精度進(jìn)行舍入

          SQL> select round(55.5),round(-55.4),trunc(55.5),trunc(-55.5) from dual;

          ROUND(55.5) ROUND(-55.4) TRUNC(55.5) TRUNC(-55.5)

          ----------- ------------ ----------- ------------

          56????????? -55????????? 55????????? -55

          29.SIGN 取數(shù)字n的符號(hào),大于0返回1,小于0返回-1,等于0返回0

          SQL> select sign(123),sign(-100),sign(0) from dual;

          SIGN(123) SIGN(-100)?? SIGN(0)

          --------- ---------- ---------

          1???????? -1???????? 0

          30.SIN 返回一個(gè)數(shù)字的正弦值

          SQL> select sin(1.57079) from dual;

          SIN(1.57079)

          ------------

          1

          31.SIGH 返回雙曲正弦的值

          SQL> select sin(20),sinh(20) from dual;

          SIN(20)? SINH(20)

          --------- ---------

          .91294525 242582598

          32.SQRT 返回?cái)?shù)字n的根

          SQL> select sqrt(64),sqrt(10) from dual;

          SQRT(64)? SQRT(10)

          --------- ---------

          8 3.1622777

          33.TAN 返回?cái)?shù)字的正切值

          SQL> select tan(20),tan(10) from dual;

          TAN(20)?? TAN(10)

          --------- ---------

          2.2371609 .64836083

          34.TANH

          返回?cái)?shù)字n的雙曲正切值

          SQL> select tanh(20),tan(20) from dual;

          TANH(20)?? TAN(20)

          --------- ---------

          1 2.2371609

          35.TRUNC

          按照指定的精度截取一個(gè)數(shù)

          SQL> select trunc(124.1666,-2) trunc1,trunc(124.16666,2) from dual;

          TRUNC1 TRUNC(124.16666,2)

          --------- ------------------

          100???????????? 124.16

          36.ADD_MONTHS

          增加或減去月份

          SQL> select to_char(add_months(to_date('199912','yyyymm'),2),'yyyymm') from dual;

          TO_CHA

          ------

          200002

          SQL> select to_char(add_months(to_date('199912','yyyymm'),-2),'yyyymm') from dual;

          TO_CHA

          ------

          199910

          37.LAST_DAY

          返回日期的最后一天

          SQL> select to_char(sysdate,'yyyy.mm.dd'),to_char((sysdate)+1,'yyyy.mm.dd') from dual;

          TO_CHAR(SY TO_CHAR((S

          ---------- ----------

          2004.05.09 2004.05.10

          SQL> select last_day(sysdate) from dual;

          LAST_DAY(S

          ----------

          31-5月 -04

          38.MONTHS_BETWEEN(date2,date1)

          給出date2-date1的月份

          SQL> select months_between('19-12月-1999','19-3月-1999') mon_between from dual;

          MON_BETWEEN

          -----------

          9

          SQL>selectmonths_between(to_date('2000.05.20','yyyy.mm.dd'),to_date('2005.05.20','yyyy.dd')) mon_betw from dual;

          MON_BETW

          ---------

          -60

          39.NEW_TIME(date,'this','that')

          給出在this時(shí)區(qū)=other時(shí)區(qū)的日期和時(shí)間

          SQL> select to_char(sysdate,'yyyy.mm.dd hh24:mi:ss') bj_time,to_char(new_time

          2? (sysdate,'PDT','GMT'),'yyyy.mm.dd hh24:mi:ss') los_angles from dual;

          BJ_TIME???????????? LOS_ANGLES

          ------------------- -------------------

          2004.05.09 11:05:32 2004.05.09 18:05:32

          40.NEXT_DAY(date,'day')

          給出日期date和星期x之后計(jì)算下一個(gè)星期的日期

          SQL> select next_day('18-5月-2001','星期五') next_day from dual;

          NEXT_DAY

          ----------

          25-5月 -01

          41.SYSDATE 用來(lái)得到系統(tǒng)的當(dāng)前日期

          SQL> select to_char(sysdate,'dd-mm-yyyy day') from dual;

          TO_CHAR(SYSDATE,'

          -----------------

          09-05-2004 星期日

          trunc(date,fmt)按照給出的要求將日期截?cái)?如果fmt='mi'表示保留分,截?cái)嗝?br />
          SQL> select to_char(trunc(sysdate,'hh'),'yyyy.mm.dd hh24:mi:ss') hh,

          2? to_char(trunc(sysdate,'mi'),'yyyy.mm.dd hh24:mi:ss') hhmm from dual;

          HH????????????????? HHMM

          ------------------- -------------------

          2004.05.09 11:00:00 2004.05.09 11:17:00

          42.CHARTOROWID 將字符數(shù)據(jù)類(lèi)型轉(zhuǎn)換為ROWID類(lèi)型

          SQL> select rowid,rowidtochar(rowid),ename from scott.emp;

          ROWID????????????? ROWIDTOCHAR(ROWID) ENAME

          ------------------ ------------------ ----------

          AAAAfKAACAAAAEqAAA AAAAfKAACAAAAEqAAA SMITH

          AAAAfKAACAAAAEqAAB AAAAfKAACAAAAEqAAB ALLEN

          AAAAfKAACAAAAEqAAC AAAAfKAACAAAAEqAAC WARD

          AAAAfKAACAAAAEqAAD AAAAfKAACAAAAEqAAD JONES

          posted @ 2006-07-26 15:13 Kevin Meng 閱讀(156) | 評(píng)論 (0)編輯 收藏

          【導(dǎo)讀】本文羅列了各種內(nèi)置函數(shù)的使用方法,同時(shí)還對(duì)其返回結(jié)果進(jìn)行了演示。

          SQL中的單記錄函數(shù)

          1.ASCII 返回與指定的字符對(duì)應(yīng)的十進(jìn)制數(shù);

          SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space from dual;

          A???????? A????? ZERO???? SPACE

          --------- --------- --------- ---------

          65??????? 97??????? 48??????? 32



          2.CHR 給出整數(shù),返回對(duì)應(yīng)的字符;

          SQL> select chr(54740) zhao,chr(65) chr65 from dual;

          ZH C

          -- -

          趙 A

          3.CONCAT 連接兩個(gè)字符串;

          SQL> select concat('010-','88888888')||'轉(zhuǎn)23'? 高乾競(jìng)電話(huà) from dual;

          高乾競(jìng)電話(huà)

          ----------------

          010-88888888轉(zhuǎn)23

          4.INITCAP 返回字符串并將字符串的第一個(gè)字母變?yōu)榇髮?xiě);

          SQL> select initcap('smith') upp from dual;

          UPP

          -----

          Smith

          5.INSTR(C1,C2,I,J) 在一個(gè)字符串中搜索指定的字符,返回發(fā)現(xiàn)指定的字符的位置;

          C1??? 被搜索的字符串

          C2??? 希望搜索的字符串

          I???? 搜索的開(kāi)始位置,默認(rèn)為1

          J???? 出現(xiàn)的位置,默認(rèn)為1

          SQL> select instr('oracle traning','ra',1,2) instring from dual;

          INSTRING

          ---------

          9

          6.LENGTH 返回字符串的長(zhǎng)度;

          SQL> select name,length(name),addr,length(addr),sal,length(to_char(sal)) from .nchar_tst;

          NAME?? LENGTH(NAME) ADDR???????????? LENGTH(ADDR)?????? SAL LENGTH(TO_CHAR(SAL))

          ------ ------------ ---------------- ------------ --------- --------------------

          高乾競(jìng)??????????? 3 北京市海錠區(qū)??????????????? 6?? 9999.99??????????????????? 7

          7.LOWER 返回字符串,并將所有的字符小寫(xiě)

          SQL> select lower('AaBbCcDd')AaBbCcDd from dual;

          AABBCCDD

          --------

          aabbccdd

          8.UPPER 返回字符串,并將所有的字符大寫(xiě)

          SQL> select upper('AaBbCcDd') upper from dual;

          UPPER

          --------

          AABBCCDD

          9.RPAD和LPAD(粘貼字符)

          RPAD? 在列的右邊粘貼字符

          LPAD? 在列的左邊粘貼字符

          SQL> select lpad(rpad('gao',10,'*'),17,'*')from dual;

          LPAD(RPAD('GAO',1

          -----------------

          *******gao*******

          不夠字符則用*來(lái)填滿(mǎn)

          10.LTRIM和RTRIM

          LTRIM? 刪除左邊出現(xiàn)的字符串

          RTRIM? 刪除右邊出現(xiàn)的字符串

          SQL> select ltrim(rtrim('?? gao qian jing?? ',' '),' ') from dual;

          LTRIM(RTRIM('

          -------------

          gao qian jing

          11.SUBSTR(string,start,count)

          取子字符串,從start開(kāi)始,取count個(gè)

          SQL> select substr('13088888888',3,8) from dual;

          SUBSTR('

          --------

          08888888

          12.REPLACE('string','s1','s2')

          string?? 希望被替換的字符或變量

          s1?????? 被替換的字符串

          s2?????? 要替換的字符串

          SQL> select replace('he love you','he','i') from dual;

          REPLACE('HELOVEYOU','HE','I')

          ------------------------------

          i love you

          13.SOUNDEX 返回一個(gè)與給定的字符串讀音相同的字符串

          SQL> create table table1(xm varchar(8));

          SQL> insert into table1 values('weather');

          SQL> insert into table1 values('wether');

          SQL> insert into table1 values('gao');

          SQL> select xm from table1 where soundex(xm)=soundex('weather');

          XM

          --------

          weather

          wether

          14.TRIM('s' from 'string')

          LEADING?? 剪掉前面的字符

          TRAILING? 剪掉后面的字符

          如果不指定,默認(rèn)為空格符

          15.ABS 返回指定值的絕對(duì)值

          SQL> select abs(100),abs(-100) from dual;

          ABS(100) ABS(-100)

          --------- ---------

          100?????? 100

          16.ACOS 給出反余弦的值

          SQL> select acos(-1) from dual;

          ACOS(-1)

          ---------

          3.1415927

          17.ASIN 給出反正弦的值

          SQL> select asin(0.5) from dual;

          ASIN(0.5)

          ---------

          .52359878

          18.ATAN 返回一個(gè)數(shù)字的反正切值

          SQL> select atan(1) from dual;

          ATAN(1)

          ---------

          .78539816

          19.CEIL 返回大于或等于給出數(shù)字的最小整數(shù)

          SQL> select ceil(3.1415927) from dual;

          CEIL(3.1415927)

          ---------------

          4

          20.COS 返回一個(gè)給定數(shù)字的余弦

          SQL> select cos(-3.1415927) from dual;

          COS(-3.1415927)

          ---------------

          -1

          21.COSH 返回一個(gè)數(shù)字反余弦值

          SQL> select cosh(20) from dual;

          COSH(20)

          ---------

          242582598

          22.EXP 返回一個(gè)數(shù)字e的n次方根

          SQL> select exp(2),exp(1) from dual;

          EXP(2)??? EXP(1)

          --------- ---------

          7.3890561 2.7182818

          23.FLOOR 對(duì)給定的數(shù)字取整數(shù)

          SQL> select floor(2345.67) from dual;

          FLOOR(2345.67)

          --------------

          2345

          24.LN 返回一個(gè)數(shù)字的對(duì)數(shù)值

          SQL> select ln(1),ln(2),ln(2.7182818) from dual;

          LN(1)???? LN(2) LN(2.7182818)

          --------- --------- -------------

          0 .69314718???? .99999999

          25.LOG(n1,n2) 返回一個(gè)以n1為底n2的對(duì)數(shù)

          SQL> select log(2,1),log(2,4) from dual;

          LOG(2,1)? LOG(2,4)

          --------- ---------

          0???????? 2

          posted @ 2006-07-26 15:11 Kevin Meng 閱讀(213) | 評(píng)論 (0)編輯 收藏

          在很多程序做多需要有發(fā)送電子郵件的功能,以前使用java mail實(shí)現(xiàn)這個(gè)功能很麻煩。現(xiàn)在apache的下的一個(gè)子項(xiàng)目common-email,把這個(gè)問(wèn)題大大的簡(jiǎn)化了。現(xiàn)在在java程序中實(shí)現(xiàn)發(fā)信功能,只需要短短幾行代碼。

          ????? 可以http://jakarta.apache.org/commons/email/在這個(gè)地址下載開(kāi)發(fā)包和查看詳細(xì)的介紹。
          下面介紹簡(jiǎn)單的使用。
          public static class Mail {
          ? public static void send(
          ??? String to,/* 收信人地址 */ String toName,//收信人姓名
          ??? String subject, /* 主題 */
          ??? String body /* 內(nèi)容 */
          ?? ){

          ?

          ??try {
          ???HtmlEmail email = new HtmlEmail();
          ???email.setHostName("smtp.163.com");//設(shè)置發(fā)信的smtp服務(wù)器
          ???email.addTo(to, toName);//設(shè)置收件人帳號(hào)和收件人
          ???email.setFrom("aaa@163.com", "aaa");//設(shè)置發(fā)信的郵件帳號(hào)和發(fā)信人
          ???email.setSubject(subject);//設(shè)置郵件主題
          ???email.setAuthentication("aaa","111111");//如果smtp服務(wù)器需要認(rèn)證的話(huà),在這里設(shè)置帳號(hào)、密碼
          ???email.setHtmlMsg(body,"text/html; charset=GB2312");//設(shè)置郵件正文和字符編碼
          ???email.send();
          ??} catch (EmailException e) {
          ???e.printStackTrace();
          ??}
          ?}
          ?網(wǎng)站的介紹中沒(méi)有提及如何發(fā)送中文郵件,如果發(fā)送中文郵件像上面在setHtmlMsg(),加上字符編碼即可。

          posted @ 2006-07-25 16:34 Kevin Meng 閱讀(886) | 評(píng)論 (0)編輯 收藏

          主站蜘蛛池模板: 永定县| 德清县| 孝义市| 宾川县| 肃南| 兴文县| 勐海县| 宣化县| 长沙市| 瓮安县| 衡山县| 达州市| 噶尔县| 富川| 墨脱县| 涪陵区| 株洲县| 古蔺县| 白山市| 东光县| 民和| 冕宁县| 泰州市| 曲周县| 芒康县| 长岛县| 依兰县| 甘泉县| 忻州市| 监利县| 类乌齐县| 巴彦淖尔市| 凤山县| 荃湾区| 象山县| 泌阳县| 祁阳县| 泸州市| 龙山县| 济源市| 永福县|