躺在沙灘上的小豬

          快樂的每一天

          #

          [webwork]Default Action

          http://wiki.opensymphony.com/display/WW/Action+configuration

          Since Webwork 2.2.1 you are also able to specify a default action to be executed when no other action is matched in the xwork.xml. This feature is provided mainly to eliminate the need to create an action class and/or element for very simple or similar results.  The default action name can be set inside the package element like below:

          <default-action-ref name="simpleViewResultAction">

          Caution

          This feature should be configured such that there is only one default action per namespace. Therefore if you have multiple packages declaring a default action with the same namespace, it is not guaranteed which action will be the default.

          posted @ 2006-02-10 20:27 martin xus| 編輯 收藏

          終于可用trac了

          因沒有安裝python for svn,一直沒能使用trac。感謝python chinese的幫助,特別感謝張俊的幫忙。

          python for svn目前最新版本沒有2.4的,只有2.3的,感謝張俊提供他自己編譯的python2.4版本。

          謝謝!

          下載:
          http://www.aygfsteel.com/Files/martinx/svn-win32-1.2.0_py2.4.rar

          posted @ 2006-02-10 15:57 martin xus| 編輯 收藏

          [Z]Trac在Windows下的安裝配置

          收藏一篇文章:http://ayiiq180.blogeden.cn/post/16101/3723

          用svn幾個月管理現在的項目了,雖然是個windows的項目并且windows下也有svn的前端工具了,不過看到了Trac的介紹還是忍不住裝上了,Timeline,Roadmap,Milestone,wiki,Ticket都給開發交流提供了很大的便利。

          1. 安裝前準備,Trac是用python寫的,所以所有安裝的前提就是python必須安裝了,由于svn with python bind只有for python2.3的,所以整個安裝也只能用python2.3.5了,我試驗了一下python2.4.2,到使用libsvn的地方就會出錯了,共需要如下軟件包:
            Trac 0.9.3
            Clearsilver0.9.14 binaries
            Python 2.3.5
            Apache 2.0.54 or 2.0.55
            Subversion 1.2.3
            Python 2.3 Bindings for subversion 1.2.3
            docutils 0.4.0
            SQLite 3.2.2 這個可以不裝,只有在pysqlite不能正常用的時候用這個
            PySQLite 1.1.6-py2.3
            Diffutils 2.8.7-1這個也是可選組件,但建議安裝,否則不能diff源代碼
            CJKcodecs如果使用GB*的源代碼編碼,這個必須安裝,否則無法顯示其中的中文
          1. 安裝
          2. 安裝Python 2.3
          • 安裝apache
          • 安裝svn for win32 安裝docutils:首先解壓,命令行運行
            > python setup.py install
          • 建立svn倉庫,這個不多說了,不過看到一個說法,在windows建立倉庫的時候用svnadmin create --fs-type fsfs E:WILDWOLFSVNRepast,說fsfs文件系統是svn在win32上的首選fs。
          • 配置apache和svn的綁定:
            1)拷貝svn/bin下的所有dll和so文件到apache的modules目錄下
            2)建立密碼文件
             htpasswd -cm E:WILDWOLFSVN.htaccess samuel
            3) 修改httpd.conf
            Uncomment:
            LoadModule dav_module modules/mod_dav.so
            LoadModule dav_fs_module modules/mod_dav_fs.so
            AddHandler cgi-script .cgi
            Add:
            # Subversion
            LoadModule dav_svn_module modules/mod_dav_svn.so
            LoadModule authz_svn_module modules/mod_authz_svn.so
            At the end of the httpd.conf
            # Subversion
            <Location /svn>
              DAV svn
              # any /svn/foo URL will map to a repository C:/svn/foo
              # I've only got it working using SVNPath!!
              SVNParentPath E:/WILDWOLF/SVN
              AuthType Basic
              AuthName "Subversion repository"
              AuthUserFile E:/WILDWOLF/SVN/.htaccess
              Require valid-user
            </Location>
            
            4) 重啟apache,測試一下
            http://localhost:8080/svn/Repast
          • 安裝svn python bingings,解壓下載下來的zip包,拷貝libsvn和svn兩個文件夾到python的安裝目錄下的Lib/site_packages/下,拷貝svn安裝目錄bin下的所有dll到libsvn下。
          • 安裝PySQLite
          • 安裝ClearSilver
          • 安裝cjkcodecs
          • 安裝diffutils
          • 安裝Trac
          1. 配置
          2. 修改PythonPath/share/trac/cgi-bin/下的trac.cgi第一行成為自己安裝的PathToPython,然后拷貝這個文件到apache的cgi-bin目錄下。如果不想拷貝這個文件,可以在httpd.conf中增加:
            <Directory "/Path/To/Trac/cgi-bin">
                ScriptInterpreterSource Registry-Strict
            </Directory>
            
            在windows注冊表中增加cgi的運行方式:
            [HKEY_CLASSES_ROOT.cgiShellExecCGICommand]
            @="PathToPythonpython.exe"
            
          • 建立trac DB:到Python23/scripts下運行:
            > python trac-admin E:/WILDWOLF/SVN/trac.d
             Trac [E:/WILDWOLF/SVN/trac.db]> initenv
            
            按照提示輸入項目名稱和svn倉庫地址等。然后給用戶附權限:
             Trac [E:/WILDWOLF/SVN/trac.db]> permission add samuel TRAC_ADMIN
            #此處運行permission list可以看到現有用戶的權限和可以使用的權限定義
            
            如果需要顯示源代碼中的GBK中文,并且安裝了cjkcodecs,修改trac.db/conf/trac.ini中的:
            [trac]
            default_charset = GBK
            
            原來utf-8存儲的東西不會有影響,一樣是utf-8顯示。
          • 將Trac加到apache中,修改httpd.conf,在最后增加:
            # TRAC
            Alias /trac "PATH/TO/Python/share/trac/htdocs"
            <Location "/cgi-bin/trac.cgi">
              SetEnv TRAC_ENV "E:/WILDWOLF/SVN/trac.db"
              SetEnv PYTHONPATH "PATH/TO/python"
            </Location>
            <Location "/cgi-bin/trac.cgi/login">
              AuthType Basic
              AuthName "Project"
              AuthUserFile E:/WILDWOLF/SVN/.htaccess
              Require valid-user
            </Location>
            <Directory "PATH/To/Python/share/trac/htdocs">
              Options Indexes MultiViews
              AllowOverride None
              Order allow,deny
              Allow from all
            </Directory>
            
          • 重啟apache,測試吧:
            http://localhost:8080/cgi-bin/trac.cgi
          1. Trac的升級,備份老版本的文件后,在python/scripts下執行

            > python trac-admin E:svntrac.db upgrade
            > python trac-admin E:svntrac.db wiki upgrade
            

          posted @ 2006-02-10 15:52 martin xus| 編輯 收藏

          用subversion和trac進行項目管理

          感謝python-chinese的幫助,特別感謝張駿的幫忙!

          記下我的安裝過程,給自己留個底,也給和我一樣尋求幫助的同學一個參考:

          一:安裝如下軟件:
          1:python 2.4.2:http://www.python.org/ftp/python/2.4.2/python-2.4.2.msi
          2:subversion1.3.0:http://subversion.tigris.org/files/documents/15/29065/svn-1.3.0-setup.exe
          3:trac0.93:http://ftp.edgewall.com/pub/trac/trac-0.9.3.win32.exe
          4:Clearsilver0.9.14:http://www.clearsilver.net/downloads/win32/clearsilver-0.9.14.win32-py2.4.exe
          5:PySQLite 2.1.3:http://initd.org/pub/software/pysqlite/releases/2.1/2.1.3/pysqlite-2.1.3.win32-py2.4.exe
          上面都是exe文件,直接安裝即可

          二:下面安裝python for subversion官方當前最新版本是python2.3,沒有python2.4的,感謝張駿提供了他自己編譯的python2.4版本,我也是使用的這個版本,

          釋放下來,拷貝到%python_home%\lib\site-packages.

          三:建立svn倉庫
          可參考這里:Subversion快速入門教程:http://www.subversion.org.cn/content/view/18/27/

          四:使用trac

          http://projects.edgewall.com/trac/wiki/TracInstall

          posted @ 2006-02-10 11:50 martin xus| 編輯 收藏

          Lucene Highlighter

          lucene最新版本為1.9,從apache svn中checkout 出來已經包括了Highlighter

          測試一下:

          package org.apache.lucene.search.highlight;

          import junit.framework.TestCase;
          import org.apache.lucene.analysis.Analyzer;
          import org.apache.lucene.analysis.TokenStream;
          import org.apache.lucene.analysis.standard.StandardAnalyzer;
          import org.apache.lucene.document.Document;
          import org.apache.lucene.document.Field;
          import org.apache.lucene.index.IndexReader;
          import org.apache.lucene.index.IndexWriter;
          import org.apache.lucene.queryParser.QueryParser;
          import org.apache.lucene.search.Hits;
          import org.apache.lucene.search.IndexSearcher;
          import org.apache.lucene.search.Query;
          import org.apache.lucene.search.Searcher;
          import org.apache.lucene.store.RAMDirectory;

          import java.io.IOException;
          import java.io.StringReader;

          /**
           * 
          @author martin
           
          */

          public class WordsHighlighterTest extends TestCase {
              
          private IndexReader reader;
              RAMDirectory ramDirectory;
              
          final private static String FIELD_NAME = "contents";
              
          final private static String queryString = "索引";

              String [] words 
          = {
                      
          "1:索引內容結構:Document,以及包含于Document的多個Field索",
                      
          "2:索引內容優先性調整因子,boost(可對整個Document或Field指定).",
                      
          "3:索引的寫入IndexWriter,索引的寫入目標Directory,實現包括FsDirectory跟RamDirectory等",
                      
          "4:索引創建速度的調整"
              }
          ;


              
          protected void setUp() throws Exception {
                  ramDirectory 
          = new RAMDirectory();
                  IndexWriter indexWriter 
          = new IndexWriter(ramDirectory, new StandardAnalyzer(), true);
                  
          for (String s : words) {
                      addDoc(indexWriter, s);
                  }

                  indexWriter.optimize();
                  indexWriter.close();
                  reader 
          = IndexReader.open(ramDirectory);
              }


              
          private void addDoc(IndexWriter indexWriter, String s) throws IOException {
                  Document doc 
          = new Document();
                  doc.add(
          new Field(FIELD_NAME, s, Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.YES));
                  indexWriter.addDocument(doc);
              }


              
          public void testSimpleWords() throws Exception {
                  Query query 
          = new QueryParser(FIELD_NAME, new StandardAnalyzer()).parse(queryString);
                  query 
          = query.rewrite(reader);
                  System.out.println(
          "Searching for: " + query.toString(FIELD_NAME));
                  Searcher searcher 
          = new IndexSearcher(ramDirectory);
                  Hits hits 
          = searcher.search(query);
                  Highlighter highlighter 
          = new Highlighter(new SimpleHTMLFormatter("<font color=\"red\">""</font>"), new QueryScorer(query));
                  highlighter.setTextFragmenter(
          new SimpleFragmenter(20));
                  Analyzer analyzer 
          = new StandardAnalyzer();
                  
          for (int i = 0; i < hits.length(); i++{
                      String text 
          = hits.doc(i).get(FIELD_NAME);
                      TokenStream tokenStream 
          = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
                      String result 
          = highlighter.getBestFragments(tokenStream, text, 2"");
                      System.out.println(
          "\t" + result);
                  }

              }


              
          protected void tearDown() throws Exception {
                  
          super.tearDown();
              }

          }

          輸出:

          Searching for: "索 引"
          4:創建速度的調整
          3:的寫入IndexWriter,的寫入目標Directory,實現包
          1:內容結構:Document,以
          2:內容優先性調整因子,boost(可對整個Document或Field指

          posted @ 2006-02-09 19:11 martin xus| 編輯 收藏

          僅列出標題
          共28頁: First 上一頁 7 8 9 10 11 12 13 14 15 下一頁 Last 
          主站蜘蛛池模板: 陆丰市| 吕梁市| 含山县| 嘉兴市| 神木县| 汪清县| 湄潭县| 朝阳区| 呼和浩特市| 灌云县| 江阴市| 汾阳市| 凯里市| 德州市| 阿城市| 合作市| 耒阳市| 娄烦县| 连平县| 铜山县| 琼海市| 葵青区| 溧阳市| 赫章县| 元江| 兰西县| 巩义市| 通海县| 赤水市| 内丘县| 乐清市| 凤阳县| 扎兰屯市| 枣阳市| 胶南市| 逊克县| 扎鲁特旗| 青河县| 金川县| 陆河县| 耒阳市|