|
2007年2月28日
http://note.youdao.com/share/web/file.html?id=611b9b6bdf9abafbb1ee45436f50be9e&type=note
每次都在setupconnection...的地方停住了,后来在发现原来是因为我的手机没有插SD卡,愤的!!
geoJOSN为UTF-8编码,转成shp后部分字段出现乱码,一直找不到解决的办法。后来装了QGIS 1.7.4,打开geoJSON文件,注意选择编码为UTF-8,然后save as..,保存成shp文件,此时编码必须选择system就可以解决中文乱码的问题了。
以下的GPS定位代码,在MOTO XT800,ME811,HTC S610d等手机中定位都没有问题,但是在MOTO XT882里面就是无法定位,后来发现问题出现在红色的代码部分,强制改成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); //强制使用GPS定位 //locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 5, locationListener);
这次项目开发,运行环境的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,就发生了类似的问题,但是当时没充裕时间去解决,就一直把问题遗留到现在。
web开发中,我们经常需要将一个表的数据插入到另外一个表,有时还需要指定导入字段,设置只需要导入目标表中不存在的记录,虽然这些都可以在程序中拆分成简单sql来实现,但是用一个sql的话,会节省大量代码。下面我以mysql数据库为例分情况一一说明: 两张表:insertTest和insertTest2,前者中有测试数据 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张表的字段一致,并且希望插入全部数据,可以用这种方法: INSERT INTO 目标表 SELECT * FROM 来源表; insert into insertTest select * from insertTest2; 2.如果只希望导入指定字段,可以用这种方法: INSERT INTO 目标表 (字段1, 字段2, ...) SELECT 字段1, 字段2, ... FROM 来源表; 注意字段的顺序必须一致。 insert into insertTest2(id) select id from insertTest2; 3.如果您需要只导入目标表中不存在的记录,可以使用这种方法: INSERT INTO 目标表 (字段1, 字段2, ...) SELECT 字段1, 字段2, ... FROM 来源表 WHERE not exists (select * from 目标表 where 目标表.比较字段 = 来源表.比较字段); 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 语句后面直接跟上要插入的字段的值。
1、arcgis server安装过程中,主体文件安装结束,配置server 账号时,遇到invalid password specified,对于arcgissom和arcgissoc两个accounts,任何密码都适合,后来想着新建另外两个arcgissom1和arcgissoc1,通过了,再一看,原来arcgissom和arcgissoc两个账号在计算机管理的账户里已经存在。删去后再装就没问题了。不會有問題了
以前的项目运行好好的,升级了ADT后,进行junit测试时出现错误: # # 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测试类,右键 -> Run As -> Run Configurations... 2.切换到Classpath选项栏,删掉Bootstrap Entries里面的Android Library,然后点击右侧的Advanced.. -> Add Library -> JRE System Library,一路next即可。
这时再运行该类,就能正常运行了。
字段为Datetime,获得2011-11-05以后添加的记录 SELECT * FROM geo_corporation t WHERE TO_DAYS(t.addtime)>TO_DAYS('2011-11-05') 某一时间段内的记录 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')
在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,然后通过nero刻盘。注意:盘要好,如果没有刻录好,安装的时候就会出现I/O错误,这个折腾了我不少时间。
(2)在XP下分出一个盘来,大概10G的空间就可以了,格式化成FAT32格式(建议用PM软件)。
(3)进入BISO,设为从光盘启动,把安装盘放入光驱,重新启动电脑。
(4)如果不出意外,您将进入Mac OS安装程序。点“实用程序”-》“磁盘工具”,在这里您将看到所有的盘符,选中我们已经格式化好的磁盘,点抹掉,宗卷格式选Mac OS 扩展(日志式),格式化完后,退出磁盘工具。
(5)再次回到安装Mac的介绍页面,点继续,选中我们格式化好的盘来安装mac,点继续
(6)进入安装类型,这里很关键。把要安装的打印机驱动选上(我全选),本地化语言我选简体中文和繁体中文。JaS Intel 10.4.8 ATA kexts included必须选。然后Support for the most common hardware中的10.4.8.x600.Mobility.Support选上。其他都不要选,点下一步即可。注意,不能把所有的硬件驱动都选上,如果那样的话可以正常安装,但是重启后进入Mac时会出现黑屏现象,应该是由于硬件驱动冲突造成的。
(7)点下一步开始安装,耐心等待,安装完后重启,就可以进入美丽的Mac世界了。
声明:本文只针对IBM Z60M,别的型号的机器由于硬件驱动等问题有可能会不能正常安装。
把jdk\bin目录下的msvcr71.dll复制到tomcat安装目录的\bin下即可
在登陆上服务器之后,打开我的电脑,在地址栏中输入“\\tsclient\C”就可以查看本地的C盘
把 C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\tempfile.tmp所有.tmp文件删除然后再上传。有可能需要多试几次。
最好用TSVN上传而不要用Subeclipse
(1)安装php_pdo.dll和php_pdo_cio.dll,在php的安装包里面有,建议用php5.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 );
步骤如下:
1. AP服务器上建立c:\backup文件夹(文件夹路径客户自己选择)
2. 打开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. 控制面板-->任务计划-->添加任务计划-->选择程序以进行计划-->浏览-->选中dbbkup.bat-->每日执行-->选择时间-->输入用户名密码-->完成
5. 执行时间过了之后,c:\backup文件夹下面会出现yyyy-mm-dd.dmp命名的DUMP档案
以前的项目用的是struts1,运行得好好的,现在改用struts2后,发现运行不到一天tomcat就出现内存溢出的错误。使用jProfiler分析一下,发现tomcat启动后使用的内存就一路飙升,而且放在action里面的类根本没有释放掉,应该是struts出现了问题,查一下struts的配置,原来没有配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进行分析,果然好了。
(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复制到WEB-INF目录
(3)在页面最前面定义标签库
<#assign html=JspTaglibs["/WEB-INF/struts-html.tld"] />
(4)在<head>中引用标签
<@html.base/>
(5) 特别注意,在action的配置里面type="freemarker"去掉。因为如果加type="freemarker",那么base为action的路径,如http://localhost:8080/szmap/findpoi.go,如果去掉type="freemarker",那么base才为网页路径,如http://localhost:8080/szmap/find_poi.htm
最近需要把 www.map512.cn的地图重新进行分割一下,因为以前的地图是通过arcIMS进行分割的,还要配置arcIMS,那烦死人,所以决定还是把以前VB+ArcEngine版本的割图程序修改一下,改成C#+ArcEngine,改完后马上割起来,结果发现程序运行时所耗的内存不断提高,最后异常退出了,这说明肯定有个地方有内存溢出,刚开始以为是我代码的问题,不断的修改代码,花了两天时间还是不行,调试后发现出错的地方在arcEngine的出图函数output()上,于是打电话问ESRI的客服,给我的答案是没有解决的办法,喷饭!!!!
昨天老肖提醒了我一下,打补丁,于是立刻给arcEngine打上了SP5补丁,果然再也没有问题了!靠
心得是:有事别找ESRI技术支持!:)
(1)点项目-》添加应用-》浏览,导入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>
红色部分是对log4net的设置,其他不用管
(3)在要只用log4net的类namespace前面加using log4net; [assembly: log4net.Config.XmlConfigurator()]
(4)在代码中使用logger.info("XXXX");就可以了
环境
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
例如:http://www.map512.cn/findPOI.do?key=南门
如果不转码,request.getParameter("key")返回的是乱码,在jsp中,我们一般这样子传参数
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}>查询</a>
<1>软硬件环境
Apache Http Server 2.2.4
Tomcat 5.028
jdk1.6
请自行下载jk_module.so,但注意必须与apache http server的版本对应。
硬件我手头有一台IBM服务器,有三台刀片机可用,IP分别是
S1:192.168.70.101
S2:192.168.70.102
S3:192.168.70.103
当然这三台机器您完全可以用三个一般的台式机来代替.
我们的计划是
用S1来做应用服务器,用S2来做负载均衡,用S3来做数据库服务器.
<2>在S1,S2下安装jdk1.6
例如我安装在c:\jdk1.6下
添加环境变量:
JAVA_HOME=C:\jdk1.6
CLASSPATH=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar
在PATH前面加:
PATH=%JAVA_HOME%\bin;
<3>在S1下安装apache,没有什么值得注意的地方,一路按next就可以了
我安装在D:\Apache2.2
<4>在S1,S2下安装tomcat 5.028
也是一路按next就可以了,我安装在d:\tomcat5.0
以上对于一个java开发人员来说应该都不是问题,接下来就是重头戏了!
<5>配置
5.1 把下载的mod_jk-1.2.26-httpd-2.2.4.so拷贝到S1机器的D:\Apache2.2\modules目录下,并改名为mod_jk.so
5.2 打开S1机器的D:\Apache2.2\conf\http.conf文件,在一堆LoadModule的最后加上这么一行
LoadModule jk_module modules/mod_jk.so
5.3 在D:\Apache2.2\conf\http.conf的最后加上对jk_module的配置
#与tomcat关联
<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>
#结束与tomcat关联
#添加虚拟主机,注意S1上apache网页文件目录和tomcat网页文件目录要指向同一个目录,否则静态页面会无法访问
<VirtualHost *:80>
ServerName www.map512.cn
DocumentRoot D:/Tomcat5.0/webapps
ServerAdmin support.szmap@gmail.com
JkMountFile conf/uriworkermap.properties
</VirtualHost>
#给虚拟主机目录付权限
<Directory D:/Tomcat5.0/webapps>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#默认访问
<IfModule dir_module>
DirectoryIndex index.html,index.jsp
</IfModule>
5.4 在D:\Apache2.2\conf\http.conf目录下新建一个文件workers.properties,并添加以下内容
#
# 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
说明:这个文件配置了两个worker,一个是SZMAP即我们的应用服务,这个应用服务type是lb即负载均衡,并由s1和s2两个balanced_workers来执行,这里你可以添加无限多个服务器来实现负载(当然,前提是您有足够的RMB),一个是status是用来查看负载均衡状态的,我们后面将会用到.
5.6 在D:\Apache2.2\conf\http.conf目录下新建一个文件uriworkermap.properties,并添加以下内容
/*=SZMAP
/jkstatus=status #设置除以下类型的文件外,都由tomcat提供服务(也就是说下面列出的格式都有apache提供服务)
!/*.gif=SZMAP
!/*.jpg=SZMAP
!/*.png=SZMAP
!/*.css=SZMAP
!/*.js=SZMAP
!/*.html=SZMAP
说明:这个配置的意思是,所有的请求都转到SZMAP这个worker(即上面配置的s1,s2这两个balanced_workers下的tomcat服务)去执行,除了*.gif,*.html等静态元素和/jkstatus,/jkstatus由status这个worker执行.
5.7 Tomcat的配置
打开S1机器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>
打开S2机器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>
到此,我们的配置已经完成.
<6>查看结果
启动S1和S2下的tomcat服务,然后启动S1下的apache服务.
打开流览器,输入地址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 |
[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
所有的页面用UTF-8编码,然后
在struts.xml中加
<constant name="struts.locale" value="zh_CN"></constant>
<constant name="struts.i18n.encoding" value="UTF-8"></constant>
即可。
(1)在eclipse中配置好struts2
(2)把struts2-spring-plugin-2.0.11.2.jar包复制到WEB-INF\lib目录
(3)在web.xml中配置spring
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
记住,如果您之前用过spring,请把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是因为这个已经在spring的applicationContext.xml中定义 -->
<action name="searchBusLine" class="SearchBusLineAction">
<result name="success" type="freemarker">/index.jsp</result>
</action>
选Project->Clean...重新编译一下项目就可以了。
freemarker脚本将你的页面搞得一团槽吧.
修改一下dreamweaver的配置,将freemarker 脚本显示成和js一样的图标效果吧
以dreamweaver8为例
打开
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
http://blog.csdn.net/maxgong2005/archive/2006/05/12/725977.aspx
(1)配置tomcat支持SSL,请参考我的文章:http://www.blogjava.net/menglikun/archive/2008/07/02/212065.html
(2)把证书导到jre,运行cmd
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 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密码:
保存在文件中的认证 <myserver.cert>
D:\Tomcat5.0>
执行到这里,您应该可以在d:\tomcat5.0目录中找到一个文件myserver.cert
接着,我们要把这个证书文件导到客户端的JVM中,因为现在我们的客户端和服务器端都是同一台机器,所以直接进入cmd,执行以下命令就可以了
D:\Tomcat5.0>keytool -import -keystore c:/jdk1.6/jre/lib/security/cacerts -file
myserver.cert -alias cas
输入keystore密码: //注意,这里是默认密码changeit
所有者:CN=localhost, OU=szghj, O=szghj, L=suzhou, ST=jiangsu, C=cn
签发人:CN=localhost, OU=szghj, O=szghj, L=suzhou, ST=jiangsu, C=cn
序列号:486ae46a
有效期: Wed Jul 02 10:14:02 CST 2008 至Tue Sep 30 10:14:02 CST 2008
证书指纹:
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
签名算法名称:SHA1withRSA
版本: 3
信任这个认证? [否]: y
认证已添加至keystore中
(3)配置CAS服务器
我用户的是3.2.1版本,直接把cas-server-webapp-3.2.1.war复制到tomcat的webapp目录,改名为userservice-cas就可以了
(4)配置客户端,我用的是cas-client-java-2.1.0,把casclient.jar复制到客户端的lib目录,然后打开web.xml,添加如下的过滤器就可以了。
<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)成功登录后,出现错误 Unable to validate ProxyTicketValidator 是什么原因。
这是因为数字证书的签名不一致造成的,例如生成证书的时候用localhost,但是访问的时候却用机器名。统一一下就可以了
由于最近需要CAS,所以研究了一下tomcat SSL的配置,现记录下来。
环境:
window xp
tomcat 5.028
jdk 1.6
(1)进入cmd
我的tomcat安装在d:\tomcat5.0,所以进入该目录
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 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 //如果是开发环境,建议用localhost或机器名,如果是发布环境,请用域名,不要用IP
您的组织单位名称是什么?
[Unknown]: szghj
您的组织名称是什么?
[Unknown]: szghj
您所在的城市或区域名称是什么?
[Unknown]: suzhou
您所在的州或省份名称是什么?
[Unknown]: jiangsu
该单位的两字母国家代码是什么
[Unknown]: cn
CN=localhost, OU=szghj, O=szghj, L=suzhou, ST=jiangsu, C=cn 正确吗?
[否]: y
输入<cas>的主密码
(如果和 keystore 密码相同,按回车): //输入密码menglikun
再次输入新密码:
D:\Tomcat5.0>
执行到这一步,如果不出意外的话,在d:\tomcat5.0目录下就会有一个server.ksystore文件
(2)打开d:\tomcat5.0\conf\server.xml,添加一个新的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)重新启动tomcat,在浏览器中输入https://localhost:8443,如果出现安全提示,说明SSL配置成功
(1)开通泛域名支持,即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>
网上有很多介绍,但是都太麻烦,特别是当你的表中有lob字段的时候,其实很简单,用以下SQL就可以了。
create table tab2 tablespace space2 as (select t.* from tab1 t);
tab1为原来的表,tab2为临时表 space2为目的表空间。
执行完后,把tab1删除,然后把tab2改名为tab1就可以了。注意该方法不能复制索引,所以必须重建索引!
1、尽量不要使用 like '%..%'
2、对于 like '..%..' (不以 % 开头),Oracle可以应用 colunm上的index
3、对于 like '%...' 的 (不以 % 结尾),可以利用 reverse + function index 的形式,变化成 like '..%' 代码
建测试表和Index。
注意:重点在于带reverse的function index。同时,一定要使用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
--常量开头的like , 会利用index ,没问题......
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)
-- 开头和结尾都是%,对不起,很难优化
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)
-- 以常量结束,直接写的时候是不能应用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)
--'以常量结束的,加个reverse 函数,又可以用上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)
来源:http://forum.ubuntu.org.cn/viewtopic.php?t=120157&highlight=
今天开机的时候,ubuntu系统提示说
Busybox v1.1.3 (debian1:1.1.3-5 ubuntu12)built-in shell (ash)
enter 'help'for a list of built-in commands
(initranfs)
在网上找了很多资料终于找到了解决方法:
先说说我的情况,我的是双系统,WindowsXP+Ubuntu,所以我进去windowsxp系统
把boot里面的initrd.img-2.6.24-12-generic.bak重命名替换initrd.img-2.6.24-12-generic
我的问题就是这样解决的。
重启电脑,一切正常!!
希望对大家有帮助!
我的开发环境:Oracle 9i,Window Server 2003
(1)正确安装Oracle 9i企业版,Oracle9i企业版在安装的时候就已经默认提供了全文索引支持。如果你的Oracle还没有安装,请先安装一下,至于怎样安装,这里不做讨论,请Google一下。
(2)Oracle9i默认情况下会把ctxsys用户锁定,请以DBA身份登陆Oracle,把用户ctxsys解锁,并修改其密码为ctxsys,以便于我们后面登陆Text Manager
(3)进入Oracle的text manager,点程序->Oracle-OracleHome92->Enterprise Manager Console。选独立启动,然后选工具栏最下面的应用程序->text Manager,这时会要求您输入用户名和密码,用户名ctxsys,密码ctxsys
(4)选择首选项——〉语言指定器——〉CTXSYS,选一个点类似创建,输入指示器的名字如chinese_lexer,选择lexer下的chinese_vgrnm_lexer 。
(5)建立索引,在索引上点右键,然后选创建CONTEXT索引,这里要注意方案要选择您自己的表空间,如我有个表SZPOI在表空间SUZHOU中,现在我要对该表的UNITNAME字段建立全文索引,那么方案选suzhou,表选szpoi,字段选unitname,首选项中选择chinese_lexer 。
这样全文检索就建好了,并用chinese_vgram_lexer作为分析器。
(6)如何查询数据。索引建立以后,我们就可以对该表进行全文索引查询了,查询语句如下:
SELECT score(1),t.unitname,t.objectid,t.eminx,t.eminy,t.mpfullname,t.dianhua FROM szpoi t WHERE contains (unitname, '规划局,吴中分局', 1) > 0 order by score(1) desc
这个语句的意思是在表szpoi中查询unitname包含“规划局”和“吴中分局”两个关键字的记录,并按匹配度从高到低排序。
大功告成了吗?没有!
接着我们还要建立两个job来维护和优化索引。
维护:
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;
优化:
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;
一、下载三个软件:Apache 2,Subversion和TortoiseSVN
二、安装apache,最好用80端口
三、安装Subversion
四、安装TortoiseSVN
五、进入D:\Subversion,新建一个目录projects
六、在projects目录中点鼠标右键,选择TortoiseSVN->create reposities here...新建一个仓库
七、打开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,打开ie,输入http://localhost/svn/projects/看看能不能打开,如果能打开,恭喜您,您离成功已经不远了!
九、设置权限
点开始->运行,打开控制台
进入D:\Apache\Apache2\bin,运行
htpasswd -c D:\Subversion\passwd menglikun
新建一个密码文件,并添加用户menglikun,如果要添加更多用户,运行
htpasswd -m D:\Subversion\passwd test
添加test用户
十、修改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,再次进入http://localhost/svn/projects,这次就要求输入密码了!
OK,大功告成!
更多设置,请找google,如如何设置目录的访问权限(只读,可写等等)。
新建一个CSS标签,标签名选择TABLE,确定后在弹出的CSS样式编辑器里,选"分类"中的"方框"选项,将里面的宽,高,填充,边界的值全部设为0;再将"定位"中"类型"下面的宽,高的值也都设为0,点保存,然后再把表格的样式设置为table就可以了,即class="TABLE".
firefox上网慢是由于解析域名需要太长时间造成的,解决办法如下(有时间再翻译成中文):
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”
apache 2.2.3
tomcat 5.028
下载 mod_jk.so( http://www.blogjava.net/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 #工作端口,若没占用则不用修改
worker.worker1.host=localhost #Tomcat服务器的地址
worker.worker1.type=ajp13 #类型
worker.worker1.lbfactor=1 #负载平衡因数
为避免出现乱码,必须修改tomcat安装目录下的conf/server.xml,修改以下配置
<Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443" URIEncoding="GBK">
</Connector>
重新启动apache就可以了
这是因为form里面有个按钮名字叫submit,改成别的别的名称如submit2就可以了。
用encodeURIComponent就可以了。如以下代码:
var name = document.getElementById("textName").value;
if (name=="楼盘名称")
name = "";
var url="house/searchHouse.php?district="+encodeURIComponent(district);
一、软件准备
(1)apache_2.2.3-win32-x86-no_ssl.msi 到官方网站下载
(2)php-5.2.4-win32-installer.msi 到官方网站下载
二、安装apache_2.2.3我们安装在D:\apache2.2目录下,如果您的机器上已经安装有oracle,因为oracle的apache占用了80端口,安装完后打开D:\Apache2.2\conf\httpd.conf文件,把Listen 80改成别的端口号,如4001
三、安装php5.2.4,安装时要求选择apache安装目录,选择D:\Apache2.2就可以了。
四、测试PHP是否已经安装成功,进入D:\Apache2.2\htdocs新建一个文本文件,输入
<?php
phpinfo();
?>
另存为phpinfo.php
启动apahche服务,然后打开浏览器,输入 http://localhost:4001/phpinfo.php,如果出现php信息页面,说明php安装成功。
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;
出现这个错误是因为oracle序列R3产生的值在表gdb_objectclasses中已经有记录造成的。解决办法是进入plus/sql或用PL/SQL Developer链接oracle. (1)执行SQL SELECT MAX(id) FROM gdb_objectclasses 找出id的最大值。例如执行结果是 MAX(ID) --------------- 55 (2)执行SQL
SELECT registration_id FROM table_registry WHERE table_name = 'GDB_OBJECTCLASSES'
找到表'GDB_OBJECTCLASSES'注册ID号 如执行结果是 -------------- 3 (3)执行SQL SELECT last_number FROM user_sequences WHERE sequence_name = 'R3' 找出序列R3的下一个值,如果第二步中的执行结果是4则这里是R4。例如执行结果是: LAST_NUMBER --------------- 50 (4)从上面的查询结果中可以看出,序列R3的下一个值是50,而表gdb_objectclasses中小于55的值都已经被占用了。所以就会出现异常Unique contraint (SDE.GDB_OC_PKC) violated。解决办法是不断增加序列R3的值,使其大于55,执行下面的SQL语句6次就可以了。 SELECT R3.NEXTVAL from dual (5)在SDE中,选中sde连接后点鼠标右键,选择refresh。然后就可以再导数据了。注意这一步一定要进行,这也是我一直认为sde很烂的地方。
例如有这样一个表,其中ID号为AAAK2aAAMAAAOX+AAX的记录是重复的,如何只取其中一条记录呢?
ID1
|
XINGMING
|
XINGBIE
|
CENGYONGMING
|
MINZU
|
PAICHUSUOBIANHAO
|
JUWEIHUIBIANHAO
|
AAAK2aAAMAAAOefAAx
|
陈长芬
|
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
|
通过这个SQL就可以了。 create table szzzrktemp as (select * from zzrktemp t1 where rowid in (select max(rowid) from zzrktemp t2 where t1.id1=t2.id1))
oracle打了9.2.0.4的补丁之后,必须把版本也改变过来。 运行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 数据库已经关闭。 已经卸载数据库。 ORACLE 例程已经关闭。
SQL> startup migrate ORACLE 例程已经启动。
Total System Global Area 1687760036 bytes Fixed Size 457892 bytes Variable Size 486539264 bytes Database Buffers 1199570944 bytes Redo Buffers 1191936 bytes 数据库装载完毕。 数据库已经打开。 SQL> spool d:\catpatch.log SQL> @d:\oracle\ora92\rdbms\admin\catpatch.sql SQL> spool off 注:在catpatch中会调用catexp来修改exp
至此成功修改exp 使用exp导出成功DD
当一个access表中有“备注”类型的字段时,通过access的“导出”命令导到oracle时,将出现错误而无法导入。解决办法是通过PL/SQL Developer来导。
当我们用下面的通用代码插入一个点到空间表中时,会报SPECIFIED ATTRIBUTE COLUMN DOESN'T EXIST错误,错误信息如下:
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) 插入点的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; } // 开始插入数据 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);//运行到这里时出现错误! 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; }
之所以出现这个错误,是因为当插入一个点到空间表中时,arcsde自动生成一个OBJECTID值,但如果你的空间表导到SDE的时候表中已经有了OBJECTID字段,SDE自动生成的是OBJECTID_1字段作为每条记录的ID字段,如果你把OBJECTID_1字段人为的删除,那么这时候arcSDE就找不到该字段了,就会报出SPECIFIED ATTRIBUTE COLUMN DOESN'T EXIST.的错误,解决办法是重新导一下该空间表,且导入的时候不能有命名为OBJECTID的字段。
很多时候,这些问题都要你自己来发现和解决,不能太相信ESRI的技术支持,他们大部分时候都不能给你什么帮助:)
例如有的时候你需要你的笔记本去作演示,web应用安装在你的笔记本上,但没有网线,无法连网。这时候如果启动tomcat,将无法链接数据库,那怎么办呢。点网络连接,选择属性,然后把所有驱动都安装一遍,再重新启动tomcat服务就可以了。
下面是矩形选择的源代码。多边形选择多加点就可以了。 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("地物点")) { 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", "地物点")); this.saveMessages(request, msgs); return mapping.findForward("resultPage"); } map.getLayers().setGeometry(true);// 设置返回空间信息 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:起点屏幕X坐标 * @param starty:起点屏幕Y坐标 * @param endx:终点屏幕X坐标 * @param endy:终点屏幕Y坐标 * @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; } } }
当一个web站点发布到互联网上以后,系统的稳定性很重要。而如果你后台用的是oracle 9i,有时候会出现oracle服务意外停止的现象。解决办法是: (1)给oracle打最新的补丁(很重要) (2)在控制面板的服务里面选择oracleServiceXXX,选择属性,点“恢复”,把下面的三个操作都设置为“重新启动”就可以了。
|