(2) Main OJ files: oj files

Source: Internet
Author: User

(2) Main OJ files: oj files

After OJ is set up, we need to familiarize ourselves with the files and folders under the OJ project.

First, the installed OJ is in the directory var/www/html.

PHP file in html

These PHP files are mainly webpage jumps.

Admin folder

Log on to the administrator account and manage the page

Bootstrap folder

Css styles and images. If you want to modify small pages, go to www \ html \ bootstrap \ css \ bootstrap to find the corresponding css modification. It is recommended to write a css file by yourself if you want to make major changes.

Include folder

The folder where the public configuration file is located (which should be known if php has been learned --);

Here is a web configuration file db_info.inc.php.

The main content is as follows:

Static $ DB_HOST = "localhost"; database server address static $ DB_NAME = "jol"; database name static $ DB_USER = "root"; database username static $ DB_PASS = "root "; database Password // connect db static $ OJ_NAME = "HUSTOJ"; the name of OJ will replace the words HUSTOJ, such as the page title. Static $ OJ_HOME = ". /"; OJ Homepage Address static $ OJ_ADMIN =" root @ localhost "; Administrator emailstatic $ OJ_DATA ="/home/judge/data "; test data directory, actual location. Static $ OJ_BBS = "discuss"; // "bbs" Forum form. discuss is a built-in simple forum, and bbs is a plug-in Forum. Refer to the bbs. php code. Static $ OJ_ONLINE = false; whether to use online monitoring requires a certain amount of memory and Computing. Therefore, if concurrency is high, it is recommended to disable static $ OJ_LANG = "cn"; default language, the Chinese name is cnstatic $ OJ_SIM = true; Whether to display the similarity detection result. Static $ OJ_DICT = false; Whether to enable the online English dictionary static $ OJ_LANGMASK = 1008; // 1mC 2 mCPP 4 mPascal 8 mJava 16 mRuby 32 mBash 1008 for security reason to mask all other language indicates the submission language accepted by the OJ using the mask, which can be overwritten by the game settings. Static $ OJ_EDITE_AREA = true; // whether to enable the submit interface for highlighted syntax display. You can program it online without IDE. Static $ OJ_AUTO_SHARE = false; // true: the code is automatically shared. If the code is enabled, you can view others' answers in the Status of the question. Static $ OJ_CSS = "hoj.css"; you can select "dark.css" and "gcode.css" for customized CSS with limited interface effects. Static $ OJ_SAE = false; // whether to run the web Part static $ OJ_VCODE = true on Sina's cloud platform; Whether to enable graphical logon and registration verification code. Static $ OJ_APPENDCODE = false; Whether to enable automatic addition of code. If it is enabled, the system will check whether append exists in the corresponding directory of $ OJ_DATA during submission. c files, if any, will append the code to the answer in the corresponding language, cleverly use the function that can specify the main function and require students to compile the function called in the main part. Static $ OJ_MEMCACHE = false; whether to use memcache as the page cache. If not, use the/cache directory static $ OJ_MEMSERVER = "127.0.0.1"; memcached server address static $ OJ_MEMPORT = 11211; memcached port static $ OJ_RANK_LOCK_PERCENT = 0; // The ratio of the time in the match time. For example, if it is set to 0.2 in five hours, the last hour is closed. Static $ OJ_SHOW_DIFF = false; // comparison when WrongAnswer is displayed

Lang folder

Language setting folder

Template folder

OJ topic folder, which corresponds to a different style topic. Bs topic is used by default.

Here, we also need to mention that hustoj also has a core configuration file, judge. conf. The default location is/home/judge/etc.

Note that core does not recognize quotation marks and comments, so do not add any quotation marks or comments on your own. Otherwise, judged startup may be affected.

OJ_HOST_NAME = 127.0.0.1 if you use mysql to connect to read the database, the host address of the database OJ_USER_NAME = root database account OJ_PASSWORD = root Database Password OJ_DB_NAME = jol database name OJ_PORT_NUMBER = 3306 database port OJ_RUNNING = 4 judged will start judge_client, it is stipulated that a maximum of several judge_clientOJ_SLEEP_TIME = 5 judged databases can be run at the same time to find new tasks by polling the database, and the rest time at the polling interval is, in seconds OJ_TOTAL = 1 in the old-fashioned concurrent processing, the TOTAL number of judged OJ_MOD = 0 in the old-fashioned concurrent processing, this judged is responsible for processing the tasks where the remainder of solution_id is calculated according to the TOTAL modulus. OJ_JAVA_TIME_BONUS = 2 additional running time obtained by virtual machine languages such as Java. OJ_JAVA_MEMORY_BONUS = 512 additional memory obtained by virtual machine languages such as Java. OJ_SIM_ENABLE = 0 whether to use sim for code similarity detection OJ_HTTP_JUDGE = 0 whether to use HTTP to connect to the database. If enabled, the previous settings such as HOST_NAME are ignored. OJ_HTTP_BASEURL = http: // 127.0.0.1/JudgeOnline the base address for connecting to the database through HTTP, which is the Homepage Address of OJ. OJ_HTTP_USERNAME = user account used by admin to use HTTP (HTTP_JUDGE permission). The VCODE graphic Verification Code cannot be enabled when this account is logged on, but it can be enabled after successful logon. OJ_HTTP_PASSWORD = admin password OJ_OI_MODE = 0 indicates whether the OI mode is enabled. That is, the remaining data is determined no matter whether an error occurs. Once an error occurs in the ACM competition, the OJ_OI_MODE stops running. OJ_SHM_RUN = 0 whether to use the shared memory Virtual Disk of/dev/shm to run the answer. If it is enabled, it can increase the speed of question determination, but it requires more memory. OJ_USE_MAX_TIME = 1 whether to use the maximum running time of all test data as the final running time. If not enabled, the total time of all test data is used as the basis for timeout determination. OJ_LANG_SET = 0, 1, 2, 3, 4 # determine the language of the question

If the question is wrong, let's look at it. While working with me, I changed the database users. I spent 5 more oceans in the group of the author hustoj. One sentence solves O_o.

 

 

If there is no server and there are too many accesses, you can establish a distributed problem determination system.

Database

grant all privileges on jol.* to 'judge'@'%' identified by 'judge_pass' with grant option;

 

Check/etc/mysql/my. cnf to ensure

bind-address        = 0.0.0.0

In the case of high load, it is best to set more connections.

max_connections = 512

 

Second, configure various web programs to connect to the database.
Modify include/db_info.inc.php

Static $ DB_HOST = "Database Server ip"; static $ DB_NAME = "jol"; static $ DB_USER = "judge"; static $ DB_PASS = "judge_pass ";

 

Third, configure the judgment programs to connect to the database and assign tasks.

OJ_HOST_NAME = Database Server ipOJ_USER_NAME = judgeOJ_PASSWORD = judge_passOJ_DB_NAME = jol... OJ_TOTAL = Total number of Judges OJ_MOD = local number, starting from 0...

 

Both machines are installed

sudo apt-get install ssh

 

Fourth, copy the test data directory to the judges.


Copy from host to question maker

Scp-r/home/judge/data root @ question Server ip:/home/judge/

Or use a synchronization command.

Rsync-vzrtopg -- progress -- delete/home/judge/data root @ question Server ip:/home/judge/

Q & A server copy from the host

Scp-r root @ host ip:/home/judge/data/home/judge/

Or use a synchronization command.

Rsync-vzrtopg -- progress -- delete root @ host ip:/home/judge/data/home/judge/

 

Restart mysql

sudo /etc/init.d/mysql restart

Restart Apache

sudo /etc/init.d/apache2 restart

Restart judge

sudo pkill judged&&sudo judged

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.