posted @ 2015-09-18 21:04 Kevin Meng 閱讀(227) | 評論 (0) | 編輯 收藏
posted @ 2015-08-10 23:15 Kevin Meng 閱讀(196) | 評論 (0) | 編輯 收藏
posted @ 2012-10-22 11:53 Kevin Meng 閱讀(1490) | 評論 (0) | 編輯 收藏
posted @ 2012-08-15 12:52 Kevin Meng 閱讀(261) | 評論 (0) | 編輯 收藏
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);
//強制使用GPS定位
//locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 5, locationListener);
posted @ 2012-08-07 20:59 Kevin Meng 閱讀(337) | 評論 (0) | 編輯 收藏
這次項目開發,運行環境的tomcat版本從5.5.12升級到了6.0.18,發現以前的項目不能跑了,訪問一個很簡單的jsp也會報錯,說無法編譯,報的錯誤就是:Only a type can be imported. com.xxx.xxx.XXX resolves to a package,意思就是說你jsp頁面上引用的那個類不存在,可是在老版本明明跑的好好的,而且另一個現象就是項目根目錄下的jsp訪問沒有問題,子目錄下就報錯,google了一下,發現這是新版本tomcat的一個變化,就是如果不指定context的話,每一個子文件夾都會被tomcat當作一個獨立的虛擬應用的,所以每個子文件夾下的jsp頁面訪問的時候,都會在它的同一層找WEB-INF里面的class,這樣當然找不到了,只有剛巧放在根目錄下的jsp文件能訪問。
解決辦法:其實這也是自己以前寫tomcat的配置文件時候,寫法不規范造成的,以前的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認為你這個站點下沒有應用,會自動把每個文件夾當作一個虛擬應用處理。修改后的代碼片段如下:
<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了,而是在主機下建立一個應用,應用的文件路徑通過docBase來指定,這樣就不會再產生找不到class的問題了。
ps:tomcat的這個問題好像是從5.5.28就開始了,記得以前也曾經嘗試過升級tomcat,就發生了類似的問題,但是當時沒充裕時間去解決,就一直把問題遺留到現在。
posted @ 2012-08-01 11:14 Kevin Meng 閱讀(520) | 評論 (0) | 編輯 收藏
web開發中,我們經常需要將一個表的數據插入到另外一個表,有時還需要指定導入字段,設置只需要導入目標表中不存在的記錄,雖然這些都可以在程序中拆分成簡單sql來實現,但是用一個sql的話,會節省大量代碼。下面我以mysql數據庫為例分情況一一說明:
insert into insertTest values(100,'liudehua');
insert into insertTest values(101,'zhourunfa');
insert into insertTest values(102,'zhouhuajian');
(id,name)
select id,name
from insertTest
where not exists (select * from insertTest2
where insertTest2.id=insertTest.id);
(id, name)
SELECT 100, 'liudehua'
FROM dual
WHERE not exists (select * from insertTest
where insertTest.id = 100);
posted @ 2012-02-03 16:04 Kevin Meng 閱讀(531) | 評論 (0) | 編輯 收藏
posted @ 2011-11-28 13:03 Kevin Meng 閱讀(1611) | 評論 (0) | 編輯 收藏
解決辦法:
posted @ 2011-11-09 20:30 Kevin Meng 閱讀(2478) | 評論 (0) | 編輯 收藏
SELECT * FROM geo_corporation t WHERE TO_DAYS(t.addtime)>TO_DAYS('2011-11-05')
某一時間段內的記錄
posted @ 2011-11-07 11:56 Kevin Meng 閱讀(259) | 評論 (0) | 編輯 收藏
posted @ 2010-06-24 10:52 Kevin Meng 閱讀(420) | 評論 (0) | 編輯 收藏
(7)點下一步開始安裝,耐心等待,安裝完后重啟,就可以進入美麗的Mac世界了。
posted @ 2009-08-05 12:27 Kevin Meng 閱讀(327) | 評論 (0) | 編輯 收藏
posted @ 2009-02-16 13:29 Kevin Meng 閱讀(4219) | 評論 (4) | 編輯 收藏
posted @ 2009-02-12 15:31 Kevin Meng 閱讀(909) | 評論 (3) | 編輯 收藏
posted @ 2009-02-06 16:08 Kevin Meng 閱讀(2588) | 評論 (2) | 編輯 收藏
(2)安裝oracle 10g客戶端,如果你用的是oracle 9i同樣需要安裝oracle 10g客戶端,否則無法連接oracle。如果你的機器上已經安裝有oracle 9i,安裝oracle 10g客戶端對oracle 9i并沒有影響。
(3)重新啟動機器。
(4)用phpinfo()檢驗是否已經加載了php_pdo和php_pdo_oci擴展
連接代碼
[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 閱讀(750) | 評論 (0) | 編輯 收藏
posted @ 2009-01-08 15:28 Kevin Meng 閱讀(265) | 評論 (0) | 編輯 收藏