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

由于最近需要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配置成功

posted @ 2008-07-02 10:48 Kevin Meng 阅读(167) | 评论 (0)编辑 收藏

(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>

posted @ 2008-07-01 16:14 Kevin Meng 阅读(884) | 评论 (0)编辑 收藏

网上有很多介绍,但是都太麻烦,特别是当你的表中有lob字段的时候,其实很简单,用以下SQL就可以了。
create table tab2 tablespace space2 as (select t.* from tab1 t);
tab1为原来的表,tab2为临时表 space2为目的表空间。
执行完后,把tab1删除,然后把tab2改名为tab1就可以了。注意该方法不能复制索引,所以必须重建索引!

posted @ 2008-06-18 16:02 Kevin Meng 阅读(479) | 评论 (0)编辑 收藏

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)

posted @ 2008-06-16 09:18 Kevin Meng 阅读(368) | 评论 (0)编辑 收藏

来源: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

我的问题就是这样解决的。
重启电脑,一切正常!!
希望对大家有帮助!

posted @ 2008-05-26 09:52 Kevin Meng 阅读(1095) | 评论 (3)编辑 收藏

我的开发环境: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;

posted @ 2008-05-23 13:47 Kevin Meng 阅读(648) | 评论 (0)编辑 收藏

一、下载三个软件: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,如如何设置目录的访问权限(只读,可写等等)。



 

posted @ 2008-04-11 11:15 Kevin Meng 阅读(217) | 评论 (0)编辑 收藏

新建一个CSS标签,标签名选择TABLE,确定后在弹出的CSS样式编辑器里,选"分类"中的"方框"选项,将里面的宽,高,填充,边界的值全部设为0;再将"定位"中"类型"下面的宽,高的值也都设为0,点保存,然后再把表格的样式设置为table就可以了,即class="TABLE".

posted @ 2008-03-03 17:20 Kevin Meng 阅读(1521) | 评论 (0)编辑 收藏

firefox上网慢是由于解析域名需要太长时间造成的,解决办法如下(有时间再翻译成中文):

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 阅读(1870) | 评论 (0)编辑 收藏

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就可以了

posted @ 2007-12-25 15:20 Kevin Meng 阅读(219) | 评论 (0)编辑 收藏

仅列出标题
共12页: 上一页 1 2 3 4 5 6 7 8 9 下一页 Last