簡易代碼之家

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            157 Posts :: 2 Stories :: 57 Comments :: 0 Trackbacks

          #

          package com.jakin.util;

          import java.util.ArrayList;
          import java.util.Collection;
          import java.util.Collections;
          import java.util.List;

          import org.apache.commons.collections.CollectionUtils;
          import org.apache.commons.lang.ArrayUtils;

          public class CollectionUtilsTest {

              @SuppressWarnings(
          "unchecked")
              
          public static void main(String[] args) {

                  List
          <String> aList = new ArrayList<String>();
                  aList.add(
          "aaa");
                  aList.add(
          "bbb");
                  aList.add(
          "ccc");
                  List
          <String> bList = new ArrayList<String>();
                  bList.add(
          "aaa");
                  bList.add(
          "ddd");
                  bList.add(
          "eee");
                  
          // 并集
                  Collection<String> unionList = CollectionUtils.union(aList, bList);
                  
          // 交集
                  Collection<String> intersectionList = CollectionUtils.intersection(aList, bList);
                  
          // 是否存在交集
                  boolean isContained = CollectionUtils.containsAny(aList, bList);
                  
          // 交集的補集
                  Collection<String> disjunctionList = CollectionUtils.disjunction(aList, bList);
                  
          // 集合相減
                  Collection<String> subtractList = CollectionUtils.subtract(aList, bList);
                  
                  
          // 排序
                  Collections.sort((List<String>) unionList);
                  Collections.sort((List
          <String>) intersectionList);
                  Collections.sort((List
          <String>) disjunctionList);
                  Collections.sort((List
          <String>) subtractList);

                  
          // 測試
                  System.out.println("A: " + ArrayUtils.toString(aList.toArray()));
                  System.out.println(
          "B: " + ArrayUtils.toString(bList.toArray()));
                  System.out.println(
          "A has one of B? : " + isContained);
                  System.out.println(
          "Union(A, B): "
                          
          + ArrayUtils.toString(unionList.toArray()));
                  System.out.println(
          "Intersection(A, B): "
                          
          + ArrayUtils.toString(intersectionList.toArray()));
                  System.out.println(
          "Disjunction(A, B): "
                          
          + ArrayUtils.toString(disjunctionList.toArray()));
                  System.out.println(
          "Subtract(A, B): "
                          
          + ArrayUtils.toString(subtractList.toArray()));

              }

          }

          posted @ 2009-05-14 16:07 Jakin.zhou 閱讀(5881) | 評論 (0)編輯 收藏


          a.properties放在D:\根目錄下,b.properties為要生成的文件名:

          D:\native2ascii -encoding gb2312 a.properties b.properties;

          posted @ 2009-05-08 16:21 Jakin.zhou 閱讀(274) | 評論 (0)編輯 收藏


          在每個頁面中加入:
          <script type="text/javascript">
                   window.history.go(
          +1);
          </script>
          posted @ 2009-05-08 16:13 Jakin.zhou 閱讀(700) | 評論 (1)編輯 收藏


          轉(zhuǎn)換為ISO-8859-1進行傳遞
          String organizationName = java.net.URLEncoder.encode(organization.getName(),"GB2312");
          把ISO-8859-1轉(zhuǎn)換為GBK進行獲取
          String organizationName = new String(organizationName.getBytes("ISO-8859-1"),"GBK");
          posted @ 2009-05-06 09:51 Jakin.zhou 閱讀(223) | 評論 (1)編輯 收藏

               摘要: 從http://www.destroydrop.com/javascripts/tree/下載dtree.zip壓縮包,解壓后我們會用到dtree.js、dtree.css和img文件夾。 1.TreeInfo.java package com.yxx; public class TreeInfo {    &n...  閱讀全文
          posted @ 2009-04-29 10:05 Jakin.zhou 閱讀(1741) | 評論 (1)編輯 收藏

          jar cvf test.jar com

          test.jar=要生成的jar文件名
          com=總路徑下面可能有路徑test1,test2,test3等

          posted @ 2009-04-27 20:29 Jakin.zhou 閱讀(1024) | 評論 (0)編輯 收藏

          導出:
          exp tom/tom/@ora9i_localhost file=d:\test.dmp owner(tom);
          導入:
          imp jakin/jakin@ora9i_localhost file=d:\test.dmp full=y;
          posted @ 2009-04-27 15:23 Jakin.zhou 閱讀(1136) | 評論 (0)編輯 收藏

          解決方法:
          在本機控制面板中修改區(qū)域和語言選項,把"區(qū)域選項"中的"標準和格式"自定義為"英語(美國)";
          重啟MyEclipse,查看help>About MyEclipse Enterprise Workbench>Configuration Details
          查看其中的兩個值:
          osgi.nl=en_US
          user.language=en
          posted @ 2009-04-24 09:57 Jakin.zhou 閱讀(916) | 評論 (1)編輯 收藏

               摘要: 1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instanc...  閱讀全文
          posted @ 2009-04-23 10:46 Jakin.zhou 閱讀(1171) | 評論 (0)編輯 收藏

          一 SVN服務器端基礎配置

          1.創(chuàng)建文件庫,開啟服務
          假設SVN服務器安裝在D盤根目錄下,文件庫創(chuàng)建為D盤下的repository_svn文件夾。

          sc create svnserve binpath= "D:\svn-win32-1.5.0\bin\svnserve.exe --service --root D:\repository_svn" displayname= "Subversion" depend= tcpip start= auto
          sc description svnserve "Subsersion Service"
          //刪除該服務
          sc delete svnserve

          安裝TortoiseSVN后,選中repository_svn文件夾右鍵“TortoiseSVN”-“Create repository here”,此時這個文件夾下會生成很多文件夾及文件,編輯版本庫目錄的conf/svnserve.conf文件:
          [general]
          anon-access = write

          2.導入

          (1)在你的硬盤上創(chuàng)建一個空的文件夾,如temp;

          (2)在那個文件夾下創(chuàng)建你想要的頂級目錄(千萬不要放任何文件進去),如trunk;

          (3)通過在那個文件夾(temp)右鍵,選擇“TortoiseSVN”-“Import...”將這個結(jié)構(gòu)導入到版本庫中。

          這將導入臨時文件夾到版本庫的根目錄形成一個基本的版本庫布局。

          3.檢出

          建一個文件夾,在該文件上右鍵“SVN Checkout”檢出該版本庫的布局。

          二 SVN與Apache整合

          1.先下載apache服務器。從 http://httpd.apache.org/download.cgi 下載最新版本的 Apache,請確認你下載的版本是 2.2.x - 1.3.xx 的版本不能工作;
          2.安裝apache服務器,完成后將瀏覽器指向 http://localhost/ - 將會看到一個預先配置的網(wǎng)站“It works”;
          3.到Subversion的安裝目錄(通常是c:\program files\Subversion),找到文件/bin/mod_dav_svn.so和mod_authz_svn.so,復制這些文件到Apache的模塊目錄(通常是c:\program files\apache group\apache2\modules );
          4.再將Subversion 安裝目錄下面所有的 .dll 文件復制到Apache\Bin 目錄下;
          5.使用記事本之類的文本編輯器修改Apache的配置文件(通常是 C:\Program Files\Apache Group\Apache2\conf\httpd.conf),做出如下修改:

          去掉以下幾行的注釋(刪除 '#'標記):

          #LoadModule dav_fs_module modules/mod_dav_fs.so
          #LoadModule dav_module modules/mod_dav.so

          將以下兩行到 LoadModule 節(jié)的末尾。

          LoadModule dav_svn_module modules/mod_dav_svn.so
          LoadModule authz_svn_module modules/mod_authz_svn.so

          6.再在httpd.conf 末尾加入如下語句:
          <Location /svn>
          DAV svn
          SVNListParentPath on
          SVNParentPath "d:"
          #SVNPath "d:\repository_svn"
          </Location>

          可以修改apache監(jiān)聽端口號:
          打開D:\soft\apache\conf\httpd.conf 文件, 修改監(jiān)聽的端口號
          Listen 80 ->7777
          http://localhost:7777/

          三 用戶管理
          在命令行輸入:
          > cd d:\soft\apache\bin
          > htpasswd -c f:/svn/conf/pwd.conf admin //生成pwd 文件和admin 用戶名 pwd.conf文件可以放在任意位置
          > htpasswd f:/svn/conf/pwd.conf uid001  //在pwd 文件中加入用戶uid001
          > htpasswd f:/svn/conf/pwd.conf uid002  //在pwd 文件中加入用戶uid002

          如果用.conf文件時總是出現(xiàn)用戶名密碼驗證失敗的錯誤,可以換成.txt文件存放用戶名密碼信息
          >htpasswd -c f:/svn/conf/user.txt admin
          注意:在修改用戶名密碼文件或是apache的httpd.conf文件時,一定要stop所有apache監(jiān)聽的服務項并退出,等修改完后要重啟apache及所有的服務。

          接下來修改 httpd.conf,在 Location 標簽中加入如下內(nèi)容:

          AuthType Basic
          AuthName "svn repos"
          AuthUserFile f:/svn/conf/pwd.conf
          Require valid-user

          四 安裝subclipse

          Name: Subclipse 1.6.x (Eclipse 3.2+)            
          URL:  http://subclipse.tigris.org/update_1.6.x

          最后注意:項目導入時,需要在把項目單獨放在一個文件夾中,然后再導入這個文件夾,比如項目pro_one,
          需要放在project文件夾中,然后在project文件夾上右鍵,導入svn。

          附加:其實有個軟件能實現(xiàn)上述所有功能,該軟件名叫:VisualSVN。下載地址:http://www.visualsvn.com/server/download/

           

          posted @ 2009-04-23 10:38 Jakin.zhou 閱讀(1487) | 評論 (1)編輯 收藏

          僅列出標題
          共16頁: First 上一頁 8 9 10 11 12 13 14 15 16 下一頁 
          主站蜘蛛池模板: 承德市| 香格里拉县| 福贡县| 田东县| 尼木县| 永清县| 潢川县| 灵寿县| 额敏县| 广河县| 浏阳市| 吕梁市| 花莲市| 百色市| 宝坻区| 尼木县| 新民市| 乐都县| 连城县| 黑水县| 文成县| 确山县| 房产| 瓦房店市| 潜江市| 隆昌县| 垫江县| 德令哈市| 体育| 曲阳县| 高尔夫| 玛纳斯县| 临泽县| 疏附县| 岐山县| 当阳市| 南靖县| 商都县| 遵义县| 成武县| 嘉义市|