給HUSTOJ使用者提供的源碼閱讀與修改建議

來源:互聯網
上載者:User

 

0、 準備知識

a)        最新系統源碼可以用svn取得,或在下述地址直接瀏覽

          i.  http://code.google.com/p/hustoj/source/browse/   穩定版

         ii.  https://github.com/zhblue/hustoj                         實驗版

b)       系統分為Web和Core兩個部分

c)        簡化ER圖http://code.google.com/p/hustoj/wiki/DBdesign

d)       Web與core的串連方式有兩種,實際運行可選其中一種

      i.   資料庫連接【預設】

1.        Web插入Solution表

2.        core輪詢solution表,發現新紀錄

3.        core更新solution表result等欄位

4.        Web端輪詢soltuion顯示result等欄位。

        ii.   HTTP方式

1.        Web插入Solution表

2.        core訪問Web端admin/problem_judge.php,發現新紀錄

3.        core向Web端admin/problem_judge.php提交資料,problem_judge.php更新solution表result等欄位

4.        Web端輪詢soltuion顯示result等欄位。

1、 Web部分

a)        閱讀設定檔,弄清各設定含義

         i.      參考http://code.google.com/p/hustoj/wiki/Configuration

         ii.      源碼http://code.google.com/p/hustoj/source/browse/trunk/web/include/db_info.inc.php

b)       制定自己的前台模板

            i.      複製template/bs目錄。

            ii.     在db_info.inc.php中修改$OJ_TEMPLATE變數為新模板名

           iii.   瀏覽前台,修改新目錄中對應的php、css、imgae等檔案

c)        模板制定成功以後應該有足夠的知識開始修改template目錄以外的部分了

d)       論壇

           i.    建議整合GPL的phpbb,參考http://code.google.com/p/hustoj/source/browse/trunk/web/bbs.php

            ii.    整合Discuz

1.   建議購買商業許可。

2.   參考http://code.google.com/p/hustoj/source/browse/trunk/web/include/login-discuz.php

e)        比賽根據資料通過率排名,而不只看AC數量

       i.             資料庫solution表pass_rate欄位

       ii.             把contestrank.php中的solved欄位變成浮點對待。

       iii.             http://code.google.com/p/hustoj/source/browse/trunk/web/contestrank.php#36

f)        對有志於重寫整個前台的勇士

      i.             希望你選擇一種魔法師程式設計語言。

      ii.             如果做不到前面那條,請做好長時間開發的心理準備。

    iii.             理論上任何現存web編程模型都可以,推薦JSP/SSH。

    iv.             建議實現admin/problem_judge.php的模擬,方便直接整合原版core

2、 Core部分

a)        閱讀設定檔,弄清各設定含義

      i.    參考http://code.google.com/p/hustoj/wiki/Configuration

    ii.      源碼http://code.google.com/p/hustoj/source/browse/trunk/core/judge_client/judge_client.cc

b)       查閱Linux文檔中關於下述關鍵詞的內容

     i.  Ptrace

    ii.  Chroot

    iii. Setuid

    iv.  Proc

     v. shm

c)        所有API限定在okcalls.h

d)       代碼查重工具sim

   i. 

http://code.google.com/p/hustoj/source/browse/trunk/core/sim/sim_2_67/READMEs

e)        對於計劃改造Core來適應你自己的Oj前台的朋友

  i. 參考1.c.iv

 ii. 在judge_client.cc中搜尋關鍵詞wget

f)        HUSTOJ的沙箱模型

     i.  相對openjudge.net的sandbox libraries而言並不嚴謹

     ii.  對於OJ而言,基本滿足需求

   iii.  容易理解、容易實現、容易修改

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.