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

          2012年2月3日

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

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

          每次都在setupconnection...的地方停住了,后來在發(fā)現(xiàn)原來是因為我的手機(jī)沒有插SD卡,憤的!!

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

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

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

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

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

          以下的GPS定位代碼,在MOTO XT800,ME811,HTC S610d等手機(jī)中定位都沒有問題,但是在MOTO XT882里面就是無法定位,后來發(fā)現(xià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 閱讀(338) | 評論 (0)編輯 收藏

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

          解決辦法:其實(shí)這也是自己以前寫tomcat的配置文件時候,寫法不規(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)為你這個站點(diǎn)下沒有應(yīng)用,會自動把每個文件夾當(dāng)作一個虛擬應(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ī)下建立一個應(yīng)用,應(yīng)用的文件路徑通過docBase來指定,這樣就不會再產(chǎn)生找不到class的問題了。

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

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

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

          兩張表:insertTest和insertTest2,前者中有測試數(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 來源表;
          insert into insertTest select * from insertTest2;
          2.如果只希望導(dǎo)入指定字段,可以用這種方法:
           INSERT INTO 目標(biāo)表 (字段1, 字段2, ...) SELECT 字段1, 字段2, ... FROM 來源表;
           注意字段的順序必須一致。
          insert into insertTest2(id) select id from insertTest2;
          3.如果您需要只導(dǎo)入目標(biāo)表中不存在的記錄,可以使用這種方法:
           INSERT INTO 目標(biāo)表  
           (字段1, 字段2, ...)  
           SELECT 字段1, 字段2, ...  
           FROM 來源表  
           WHERE not exists (select * from 目標(biāo)表  
           where 目標(biāo)表.比較字段 = 來源表.比較字段); 
           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 語句后面直接跟上要插入的字段的值。

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

          主站蜘蛛池模板: 永昌县| 莆田市| 兴和县| 苏尼特右旗| 江北区| 金昌市| 什邡市| 巴南区| 项城市| 磴口县| 雷波县| 高唐县| 运城市| 恩平市| 方山县| 北海市| 高平市| 东至县| 中宁县| 平泉县| 辉县市| 普定县| 五台县| 杭锦旗| 淄博市| 汉川市| 个旧市| 和平区| 偏关县| 阿巴嘎旗| 莱州市| 漳州市| 垫江县| 通城县| 永兴县| 诏安县| 故城县| 钟山县| 河曲县| 措美县| 赣州市|