posted @ 2015-09-18 21:04 Kevin Meng 閱讀(228) | 評(píng)論 (0) | 編輯 收藏
posted @ 2015-08-10 23:15 Kevin Meng 閱讀(196) | 評(píng)論 (0) | 編輯 收藏
posted @ 2012-10-22 11:53 Kevin Meng 閱讀(1490) | 評(píng)論 (0) | 編輯 收藏
posted @ 2012-08-15 12:52 Kevin Meng 閱讀(264) | 評(píng)論 (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);
//強(qiáng)制使用GPS定位
//locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 5, locationListener);
posted @ 2012-08-07 20:59 Kevin Meng 閱讀(337) | 評(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)目不能跑了,訪問(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è)類不存在,可是在老版本明明跑的好好的,而且另一個(gè)現(xiàn)象就是項(xiàng)目根目錄下的jsp訪問(wèn)沒(méi)有問(wèn)題,子目錄下就報(bào)錯(cuò),google了一下,發(fā)現(xiàn)這是新版本tomcat的一個(gè)變化,就是如果不指定context的話,每一個(gè)子文件夾都會(huì)被tomcat當(dāng)作一個(gè)獨(dú)立的虛擬應(yīng)用的,所以每個(gè)子文件夾下的jsp頁(yè)面訪問(wèn)的時(shí)候,都會(huì)在它的同一層找WEB-INF里面的class,這樣當(dāng)然找不到了,只有剛巧放在根目錄下的jsp文件能訪問(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ā)生了類似的問(wèn)題,但是當(dāng)時(shí)沒(méi)充裕時(shí)間去解決,就一直把問(wèn)題遺留到現(xiàn)在。
posted @ 2012-08-01 11:14 Kevin Meng 閱讀(522) | 評(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ì)節(jié)省大量代碼。下面我以mysql數(shù)據(jù)庫(kù)為例分情況一一說(shuō)明:
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) | 評(píng)論 (0) | 編輯 收藏
posted @ 2011-11-28 13:03 Kevin Meng 閱讀(1613) | 評(píng)論 (0) | 編輯 收藏
解決辦法:
posted @ 2011-11-09 20:30 Kevin Meng 閱讀(2478) | 評(píng)論 (0) | 編輯 收藏
SELECT * FROM geo_corporation t WHERE TO_DAYS(t.addtime)>TO_DAYS('2011-11-05')
某一時(shí)間段內(nèi)的記錄
posted @ 2011-11-07 11:56 Kevin Meng 閱讀(261) | 評(píng)論 (0) | 編輯 收藏
posted @ 2010-06-24 10:52 Kevin Meng 閱讀(420) | 評(píng)論 (0) | 編輯 收藏
(7)點(diǎn)下一步開(kāi)始安裝,耐心等待,安裝完后重啟,就可以進(jìn)入美麗的Mac世界了。
posted @ 2009-08-05 12:27 Kevin Meng 閱讀(328) | 評(píng)論 (0) | 編輯 收藏
posted @ 2009-02-16 13:29 Kevin Meng 閱讀(4220) | 評(píng)論 (4) | 編輯 收藏
posted @ 2009-02-12 15:31 Kevin Meng 閱讀(911) | 評(píng)論 (3) | 編輯 收藏
posted @ 2009-02-06 16:08 Kevin Meng 閱讀(2589) | 評(píng)論 (2) | 編輯 收藏
(2)安裝oracle 10g客戶端,如果你用的是oracle 9i同樣需要安裝oracle 10g客戶端,否則無(wú)法連接oracle。如果你的機(jī)器上已經(jīng)安裝有oracle 9i,安裝oracle 10g客戶端對(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 閱讀(751) | 評(píng)論 (0) | 編輯 收藏
posted @ 2009-01-08 15:28 Kevin Meng 閱讀(265) | 評(píng)論 (0) | 編輯 收藏
<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 閱讀(780) | 評(píng)論 (0) | 編輯 收藏
<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 閱讀(1205) | 評(píng)論 (0) | 編輯 收藏