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

          由于最近需要CAS,所以研究了一下tomcat SSL的配置,現(xiàn)記錄下來。
          環(huán)境:
          window xp
          tomcat 5.028
          jdk 1.6
          (1)進入cmd
          我的tomcat安裝在d:\tomcat5.0,所以進入該目錄

          Microsoft Windows XP [版本 5.1.2600]
          (C) 版權(quán)所有 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      //如果是開發(fā)環(huán)境,建議用localhost或機器名,如果是發(fā)布環(huán)境,請用域名,不要用IP

          您的組織單位名稱是什么?
            [Unknown]:  szghj
          您的組織名稱是什么?
            [Unknown]:  szghj
          您所在的城市或區(qū)域名稱是什么?
            [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>
          執(zhí)行到這一步,如果不出意外的話,在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,如果出現(xiàn)安全提示,說明SSL配置成功

          posted @ 2008-07-02 10:48 Kevin Meng 閱讀(196) | 評論 (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 閱讀(903) | 評論 (0)編輯 收藏

          網(wǎng)上有很多介紹,但是都太麻煩,特別是當你的表中有l(wèi)ob字段的時候,其實很簡單,用以下SQL就可以了。
          create table tab2 tablespace space2 as (select t.* from tab1 t);
          tab1為原來的表,tab2為臨時表 space2為目的表空間。
          執(zhí)行完后,把tab1刪除,然后把tab2改名為tab1就可以了。注意該方法不能復(fù)制索引,所以必須重建索引!

          posted @ 2008-06-18 16:02 Kevin Meng 閱讀(491) | 評論 (0)編輯 收藏

          1、盡量不要使用 like '%..%'

          2、對于 like '..%..' (不以 % 開頭),Oracle可以應(yīng)用 colunm上的index

          3、對于 like '%...' 的 (不以 % 結(jié)尾),可以利用 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)

           

          -- 開頭和結(jié)尾都是%,對不起,很難優(yōu)化

           

          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)

           

          -- 以常量結(jié)束,直接寫的時候是不能應(yīng)用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)

           

          --'以常量結(jié)束的,加個reverse 函數(shù),又可以用上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 閱讀(397) | 評論 (0)編輯 收藏

          來源:http://forum.ubuntu.org.cn/viewtopic.php?t=120157&highlight=
          今天開機的時候,ubuntu系統(tǒng)提示說
          Busybox v1.1.3 (debian1:1.1.3-5 ubuntu12)built-in shell (ash)
          enter 'help'for a list of built-in commands
          (initranfs)
          在網(wǎng)上找了很多資料終于找到了解決方法:
          先說說我的情況,我的是雙系統(tǒng),WindowsXP+Ubuntu,所以我進去windowsxp系統(tǒng)

          把boot里面的initrd.img-2.6.24-12-generic.bak重命名替換initrd.img-2.6.24-12-generic

          我的問題就是這樣解決的。
          重啟電腦,一切正常!!
          希望對大家有幫助!

          posted @ 2008-05-26 09:52 Kevin Meng 閱讀(1173) | 評論 (3)編輯 收藏

          我的開發(fā)環(huán)境:Oracle 9i,Window Server 2003
          (1)正確安裝Oracle 9i企業(yè)版,Oracle9i企業(yè)版在安裝的時候就已經(jīng)默認提供了全文索引支持。如果你的Oracle還沒有安裝,請先安裝一下,至于怎樣安裝,這里不做討論,請Google一下。
          (2)Oracle9i默認情況下會把ctxsys用戶鎖定,請以DBA身份登陸Oracle,把用戶ctxsys解鎖,并修改其密碼為ctxsys,以便于我們后面登陸Text Manager
          (3)進入Oracle的text manager,點程序->Oracle-OracleHome92->Enterprise Manager Console。選獨立啟動,然后選工具欄最下面的應(yīng)用程序->text Manager,這時會要求您輸入用戶名和密碼,用戶名ctxsys,密碼ctxsys
          (4)選擇首選項——〉語言指定器——〉CTXSYS,選一個點類似創(chuàng)建,輸入指示器的名字如chinese_lexer,選擇lexer下的chinese_vgrnm_lexer 。
          (5)建立索引,在索引上點右鍵,然后選創(chuàng)建CONTEXT索引,這里要注意方案要選擇您自己的表空間,如我有個表SZPOI在表空間SUZHOU中,現(xiàn)在我要對該表的UNITNAME字段建立全文索引,那么方案選suzhou,表選szpoi,字段選unitname,首選項中選擇chinese_lexer 。

            這樣全文檢索就建好了,并用chinese_vgram_lexer作為分析器。

          (6)如何查詢數(shù)據(jù)。索引建立以后,我們就可以對該表進行全文索引查詢了,查詢語句如下:
          SELECT score(1),t.unitname,t.objectid,t.eminx,t.eminy,t.mpfullname,t.dianhua FROM szpoi t WHERE contains (unitname, '規(guī)劃局,吳中分局', 1) > 0 order by score(1) desc

          這個語句的意思是在表szpoi中查詢unitname包含“規(guī)劃局”和“吳中分局”兩個關(guān)鍵字的記錄,并按匹配度從高到低排序。
          大功告成了嗎?沒有!
          接著我們還要建立兩個job來維護和優(yōu)化索引。
          維護:
          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;
          優(yōu)化:
          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 閱讀(665) | 評論 (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/看看能不能打開,如果能打開,恭喜您,您離成功已經(jīng)不遠了!
          九、設(shè)置權(quán)限
          點開始->運行,打開控制臺
          進入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,大功告成!
          更多設(shè)置,請找google,如如何設(shè)置目錄的訪問權(quán)限(只讀,可寫等等)。



           

          posted @ 2008-04-11 11:15 Kevin Meng 閱讀(226) | 評論 (0)編輯 收藏

          新建一個CSS標簽,標簽名選擇TABLE,確定后在彈出的CSS樣式編輯器里,選"分類"中的"方框"選項,將里面的寬,高,填充,邊界的值全部設(shè)為0;再將"定位"中"類型"下面的寬,高的值也都設(shè)為0,點保存,然后再把表格的樣式設(shè)置為table就可以了,即class="TABLE".

          posted @ 2008-03-03 17:20 Kevin Meng 閱讀(1534) | 評論 (0)編輯 收藏

          firefox上網(wǎng)慢是由于解析域名需要太長時間造成的,解決辦法如下(有時間再翻譯成中文):

          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 閱讀(1884) | 評論 (0)編輯 收藏

          apache 2.2.3
          tomcat 5.028
          下載 mod_jk.so(http://www.aygfsteel.com/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服務(wù)器的地址
          worker.worker1.type=ajp13 #類型
          worker.worker1.lbfactor=1 #負載平衡因數(shù)
          為避免出現(xiàn)亂碼,必須修改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 閱讀(233) | 評論 (0)編輯 收藏

          僅列出標題
          共12頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 Last 
          主站蜘蛛池模板: 蓝山县| 娄烦县| 乐陵市| 敦化市| 桃源县| 湖北省| 垦利县| 泾川县| 菏泽市| 克拉玛依市| 柳林县| 望谟县| 邯郸市| 海林市| 巴林右旗| 乐昌市| 桦川县| 太谷县| 阜平县| 肥乡县| 广南县| 信阳市| 响水县| 天镇县| 屯昌县| 枝江市| 常山县| 兴海县| 衡东县| 长春市| 深水埗区| 本溪市| 于田县| 东安县| 乌鲁木齐县| 井冈山市| 昌都县| 阜康市| 澜沧| 彩票| 忻州市|