├── judge_client ├── client │ ├── testdata │ │ ├── wa.out │ │ ├── 3.in │ │ ├── 3.out │ │ ├── 1.out │ │ ├── 2.out │ │ ├── ac.out │ │ ├── ce.cc │ │ ├── 1.in │ │ ├── 2.in │ │ ├── ce.java │ │ ├── fpe.pl │ │ ├── rf_link.pl │ │ ├── rf_link.scm │ │ ├── fpe.py │ │ ├── data_empty.zip │ │ ├── fpe.php │ │ ├── fpe.scm │ │ ├── pe.out │ │ ├── tle.py │ │ ├── rf_invalid_open.pl │ │ ├── rf_link.py │ │ ├── ole.py │ │ ├── rf_sleep.py │ │ ├── ac.pl │ │ ├── rf_invalid_open.php │ │ ├── tle.php │ │ ├── ole.pl │ │ ├── rf_invalid_open.py │ │ ├── rf_link.php │ │ ├── mle.scm │ │ ├── ole_boundary.py │ │ ├── tle.pl │ │ ├── tle.cc │ │ ├── mle.cc │ │ ├── ole_boundary.php │ │ ├── ole_boundary.pl │ │ ├── mle.py │ │ ├── data.zip │ │ ├── wa.java │ │ ├── mle_static_data.cc │ │ ├── ole.php │ │ ├── tle.scm │ │ ├── ac.py │ │ ├── wa.cc │ │ ├── mle.pl │ │ ├── sigsegv.cc │ │ ├── ac.php │ │ ├── rf_link.cc │ │ ├── mle.php │ │ ├── ole_boundary.scm │ │ ├── tle.java │ │ ├── ce_huge_output.c │ │ ├── rf_open.cc │ │ ├── mle_mmap.cc │ │ ├── rf_invalid_open.cc │ │ ├── fpe.cc │ │ ├── math.c │ │ ├── ole.cc │ │ ├── ole_boundary.cc │ │ ├── rte_wait.java │ │ ├── ac.cc │ │ ├── rte.java │ │ ├── rte_sleep.java │ │ ├── ole.scm │ │ ├── pe.cc │ │ ├── ole.java │ │ ├── java_time.java │ │ ├── ce_long_error.cc │ │ ├── ac.scm │ │ ├── thread_forbidden.java │ │ ├── mle.java │ │ ├── tle_static_initializer.java │ │ ├── ac.java │ │ ├── ac_non_public_class.java │ │ ├── rte_catch_error.java │ │ ├── rte_invalid_main.java │ │ ├── ac_gregorian_calendar.java │ │ ├── rte_nonstatic_main.java │ │ ├── ce_invalid_class_name.java │ │ ├── rte_has_package.java │ │ ├── tle_multiple_classes_static_initializer.java │ │ ├── ac_multiple_classes.java │ │ ├── ce_too_many_classes.java │ │ ├── Makefile │ │ └── judge.cc │ ├── PHPLoader.php │ ├── guile_loader.cc │ ├── global.cc │ ├── net_util.h │ ├── checker.h │ ├── PerlLoader.pm │ ├── global.h │ ├── java_runner.h │ ├── special_checker.h │ ├── unittest.h │ ├── protocol.h │ ├── script_initializer.h │ ├── PythonLoader.py │ ├── checker.cc │ ├── text_checker.h │ ├── native_runner.h │ ├── strutil.cc │ ├── Sandbox.cc │ ├── strutil.h │ ├── runner.h │ ├── script_runner.h │ └── environment.h ├── script │ ├── stop.sh │ ├── run.sh │ ├── rotate_log.sh │ └── install.sh ├── .gitignore ├── zunit │ ├── Makefile │ └── zunit.cc └── Makefile └── judge_server ├── web ├── META-INF │ └── MANIFEST.MF ├── image │ ├── bg.jpg │ ├── cpc.gif │ ├── cpc.jpg │ ├── cpc.psd │ ├── new.gif │ ├── pic.jpg │ ├── Thumbs.db │ ├── arrow.gif │ ├── arrow.psd │ ├── arrow1.jpg │ ├── arrow2.jpg │ ├── arrow3.jpg │ ├── arrow4.jpg │ ├── banner.jpg │ ├── banner.psd │ ├── blue.jpg │ ├── cpc2.gif │ ├── down.jpg │ ├── folder.gif │ ├── hanoi.psd │ ├── istop.gif │ ├── line1.jpg │ ├── ztop.gif │ ├── ztop1.gif │ ├── arrow1b.jpg │ ├── arrow2b.jpg │ ├── arrow3b.jpg │ ├── arrow4b.jpg │ ├── cpc_acm.jpg │ ├── link_bg1.gif │ ├── link_bg2.gif │ ├── Copy of cpc.jpg │ ├── DataModel.gif │ ├── arrow_sub1.gif │ ├── arrow_sub2.gif │ ├── backgroud.jpg │ ├── buttonbg1.gif │ ├── buttonbg2.gif │ ├── buttonbg3.gif │ ├── sub_menu_bg.jpg │ └── forum_nonews.gif ├── layouts │ ├── header.jsp │ ├── footer.jsp │ └── loginbar.jsp ├── jsp │ ├── manage_forums_content.jsp │ ├── judge_content.jsp │ ├── system_parameters_content.jsp │ ├── home_content.jsp │ ├── registerSuccess_content.jsp │ ├── create_contest_success_content.jsp │ ├── edit_contest_success_content.jsp │ ├── home_message_content.jsp │ ├── submit_success_content.jsp │ ├── contest_message_content.jsp │ ├── message_content.jsp │ ├── problemset_message_content.jsp │ ├── about_content.jsp │ ├── manage_courses_content.jsp │ ├── language_content.jsp │ ├── judge_reply_content.jsp │ └── forgot_password_content.jsp ├── show_problemsets.jsp ├── index.jsp ├── faq.jsp ├── about.jsp ├── login.jsp ├── register.jsp ├── show_qqs.jsp ├── contact_us.jsp ├── home_message.jsp ├── admin_message.jsp ├── course_submit.jsp ├── editProfile.jsp ├── edit_course.jsp ├── show_problems.jsp ├── contest_submit.jsp ├── show_course_runs.jsp ├── show_runs.jsp ├── course_info.jsp ├── edit_contest.jsp ├── edit_contests.jsp ├── manage_courses.jsp ├── problem_submit.jsp ├── registerSuccess.jsp ├── show_contest_runs.jsp ├── contest_info.jsp ├── edit_preference.jsp ├── forgot_password.jsp ├── reset_password.jsp ├── show_courses.jsp ├── show_problem.jsp ├── show_user_status.jsp ├── edit_problemset.jsp ├── problemset_info.jsp ├── search_result.jsp ├── show_contests.jsp ├── show_course_problems.jsp ├── show_course_problem.jsp ├── show_problem_status.jsp ├── contest_search_result.jsp ├── show_contest_problem.jsp ├── show_contest_problems.jsp ├── course_message.jsp ├── course_submit_success.jsp ├── show_contest_ranklist.jsp ├── contest_message.jsp ├── contest_submit_success.jsp ├── problem_submit_success.jsp ├── show_contest_problem_status.jsp ├── show_contest_statistics.jsp ├── create_contest_success.jsp ├── edit_contest_success.jsp ├── show_problemset_ranklist.jsp ├── import_problem_preview.jsp ├── problemset_message.jsp ├── judge.jsp ├── import_contest_problem_preview.jsp ├── language.jsp ├── edit_role.jsp ├── show_roles.jsp ├── add_problem.jsp ├── edit_problem.jsp ├── judge_reply.jsp ├── manage_users.jsp ├── add_course_problem.jsp ├── manage_contests.jsp ├── manage_forums.jsp ├── show_dashboard.jsp ├── add_contest_problem.jsp ├── default_limits.jsp ├── edit_contest_problem.jsp ├── manage_user_role.jsp ├── WEB-INF │ └── validation.xml ├── manage_role_users.jsp ├── show_action_dashboard.jsp └── system_parameters.jsp ├── lib ├── mail.jar ├── antlr.jar ├── struts.jar ├── junit-4.5.jar ├── poi-2.5.1.jar ├── activation.jar ├── commons-io.jar ├── jakarta-oro.jar ├── log4j-1.2.11.jar ├── servlet-api.jar ├── commons-beanutils.jar ├── commons-dbcp-1.2.jar ├── commons-digester.jar ├── commons-logging.jar ├── commons-pool-1.2.jar ├── commons-validator.jar ├── commons-collections.jar ├── commons-fileupload.jar └── mysql-connector-java-3.1.10-bin.jar ├── docs ├── judgemanager.zuml ├── access_log.sql ├── indices.sql ├── qq.sql ├── deployment.txt └── utf8.sql ├── conf ├── forgot_password_template.txt ├── data_source.properties ├── log4j.properties └── oj.conf ├── test_files └── persistence │ └── mysql_data_source.properties ├── src ├── main │ └── cn │ │ └── edu │ │ └── zju │ │ └── acm │ │ └── onlinejudge │ │ ├── bean │ │ ├── Course.java │ │ ├── request │ │ │ └── ThreadCriteria.java │ │ ├── Contest.java │ │ └── Problemset.java │ │ ├── judgeservice │ │ ├── JudgeClientErrorException.java │ │ ├── submissiontest │ │ │ ├── Test.java │ │ │ ├── TrueTest.java │ │ │ ├── ConjunctionTest.java │ │ │ ├── DisjunctionTest.java │ │ │ ├── CompoundTest.java │ │ │ ├── PriorityTest.java │ │ │ ├── ProblemTest.java │ │ │ └── NegationTest.java │ │ ├── ProblemDataErrorException.java │ │ ├── submissionfilter │ │ │ └── SubmissionFilter.java │ │ ├── SubmissionQueueReader.java │ │ ├── Priority.java │ │ ├── JudgeServerErrorException.java │ │ └── JudgingQueueIterator.java │ │ ├── util │ │ ├── cache │ │ │ └── CacheEntry.java │ │ ├── PasswordManager.java │ │ ├── Features.java │ │ ├── ActionLog.java │ │ ├── RandomStringGenerator.java │ │ ├── ConfigurationException.java │ │ └── ProblemsetRankList.java │ │ ├── filter │ │ └── BaseFilter.java │ │ └── persistence │ │ └── PersistenceException.java └── tests │ └── cn │ └── edu │ └── zju │ └── acm │ └── onlinejudge │ ├── judgeservice │ ├── TestSuite.java │ ├── MockDAO.java │ ├── MockLanguageDAO.java │ ├── MockProblemDAO.java │ └── MockSubmissionDAO.java │ └── persistence │ └── sql │ └── PersistenceTests.java └── tools └── form.txt /judge_client/client/testdata/wa.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /judge_client/client/testdata/3.in: -------------------------------------------------------------------------------- 1 | 5 143 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/3.out: -------------------------------------------------------------------------------- 1 | 148 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/1.out: -------------------------------------------------------------------------------- 1 | 4 2 | 2 3 | 0 4 | -------------------------------------------------------------------------------- /judge_client/client/testdata/2.out: -------------------------------------------------------------------------------- 1 | 7 2 | 2 3 | 0 4 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ac.out: -------------------------------------------------------------------------------- 1 | 4 2 | 2 3 | 0 4 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ce.cc: -------------------------------------------------------------------------------- 1 | COMPILE ERROR 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/1.in: -------------------------------------------------------------------------------- 1 | 1 3 2 | -1 3 3 | 0 0 4 | -------------------------------------------------------------------------------- /judge_client/client/testdata/2.in: -------------------------------------------------------------------------------- 1 | 3 4 2 | 1 1 3 | 0 0 4 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ce.java: -------------------------------------------------------------------------------- 1 | COMPILE ERROR 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/fpe.pl: -------------------------------------------------------------------------------- 1 | print 1.0 / 0.0; 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/rf_link.pl: -------------------------------------------------------------------------------- 1 | link '', '' 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/rf_link.scm: -------------------------------------------------------------------------------- 1 | (link "" "") 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/fpe.py: -------------------------------------------------------------------------------- 1 | print eval('1.0/0.0') 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/data_empty.zip: -------------------------------------------------------------------------------- 1 | PK -------------------------------------------------------------------------------- /judge_client/client/testdata/fpe.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /judge_client/client/testdata/mle.pl: -------------------------------------------------------------------------------- 1 | %a = (); 2 | $i = 1; 3 | while (true) { 4 | $a{$i} = '................'; 5 | $i = $i + 1; 6 | } 7 | -------------------------------------------------------------------------------- /judge_client/client/testdata/sigsegv.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | char* p = 0; 5 | memset(p, 0, 10000); 6 | } 7 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ac.php: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main() { 5 | link("", ""); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /judge_client/client/testdata/mle.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /judge_client/client/testdata/rf_open.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | fopen("/tmp/1", "r"); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /judge_client/script/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | root=`readlink /proc/$$/fd/255` 3 | root=${root%/*} 4 | pkill -TERM -P `cat $root/judge.pid` judged 5 | kill -TERM `cat $root/judge.pid` 6 | -------------------------------------------------------------------------------- /judge_client/client/testdata/mle_mmap.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | new int[3 * 1024 * 1024]; 5 | //malloc(sizeof (int) * 300000 * 1024); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /judge_client/client/testdata/rf_invalid_open.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | fopen(NULL, "r"); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /judge_client/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | *.o 3 | *.class 4 | client/JavaSandbox.jar 5 | client/Sandbox.h 6 | client/guile_loader 7 | client/judged 8 | client/libsandbox.so 9 | zunit/libzunit.so 10 | -------------------------------------------------------------------------------- /judge_client/client/testdata/fpe.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a = 0, b = 1 / a; 7 | cout< 2 | #include 3 | 4 | int main() { 5 | double f; 6 | scanf("%lf", &f); 7 | printf("%lf", log10(f)); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ole.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | string s(1025, 'a'); 8 | cout< 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | string s(1024, 'a'); 8 | cout< 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b; 7 | while (cin>>a>>b) { 8 | cout< 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b; 7 | while (cin>>a>>b) { 8 | cout< 6 | #include 7 | #include FL 8 | #ifndef _MAIN_ 9 | #define _MAIN_ 10 | int main() 11 | { 12 | return 0; 13 | } 14 | #endif 15 | #include FL 16 | 17 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ac.scm: -------------------------------------------------------------------------------- 1 | (define gao 2 | (lambda (a b) 3 | (if (eof-object? a) 4 | 0 5 | (begin 6 | (display (+ a b)) 7 | (newline) 8 | (gao (read) (read)) 9 | ) 10 | ) 11 | ) 12 | ) 13 | 14 | (gao (read) (read)) 15 | 16 | -------------------------------------------------------------------------------- /judge_client/zunit/Makefile: -------------------------------------------------------------------------------- 1 | CC=$(CXX) 2 | CXXFLAGS=-Wall -Werror -Wno-sign-compare -ansi -O3 -MD -fPIC 3 | 4 | .PHONY: clean 5 | 6 | libzunit.so: zunit.o 7 | $(CXX) -shared -Wl,-soname,libzunit.so -o libzunit.so zunit.o 8 | 9 | zunit.o: zunit.h 10 | 11 | clean: 12 | rm -f *.so *.o *.d 13 | 14 | -------------------------------------------------------------------------------- /judge_client/Makefile: -------------------------------------------------------------------------------- 1 | default: all 2 | 3 | all: .judged .zunit 4 | 5 | clean: 6 | @make -C client clean 7 | @make -C zunit clean 8 | 9 | install: all 10 | @chmod +x script/install.sh 11 | @script/install.sh 12 | 13 | .judged: .zunit 14 | @make -C client 15 | 16 | .zunit: 17 | @make -C zunit 18 | -------------------------------------------------------------------------------- /judge_server/web/jsp/manage_forums_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 |
3 | Manage Forums 4 |
5 | Manage Forums 6 |
7 |
-------------------------------------------------------------------------------- /judge_server/conf/data_source.properties: -------------------------------------------------------------------------------- 1 | DefaultAutoCommit=true 2 | DefaultCatalog=zoj 3 | DriverClassName=com.mysql.jdbc.Driver 4 | MaxActive=200 5 | MaxIdle=20 6 | MaxWait=500 7 | Url=jdbc:mysql://localhost/zoj?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull 8 | Username=zoj 9 | Password= 10 | -------------------------------------------------------------------------------- /judge_server/tools/form.txt: -------------------------------------------------------------------------------- 1 | Trade 2 | isLong 3 | StockSymbol 4 | lotId 5 | OpenTransactionDate 6 | OpenTransactionExecutionPrice 7 | OpenTransactionAmount 8 | CloseTransactionDate 9 | CloseTransactionExecution Price 10 | CloseTransactionAmount 11 | ExecutionQuantity 12 | NetProfit 13 | NetProfitPerShareTraded -------------------------------------------------------------------------------- /judge_server/web/layouts/footer.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ page import="java.util.Calendar" %> 3 |
4 |

Copyright @ 2001-<%=Calendar.getInstance().get(Calendar.YEAR)%>, Zhejiang University ACM/ICPC Team, All rights reserved.

5 | -------------------------------------------------------------------------------- /judge_server/web/jsp/judge_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 |
Judge
3 |
4 |
5 | Judge 6 |
7 |
8 | -------------------------------------------------------------------------------- /judge_client/client/testdata/thread_forbidden.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | Thread t = new Thread() { 4 | public void run() { 5 | System.out.println("Hello Mars"); 6 | } 7 | }; 8 | t.start(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /judge_server/web/jsp/system_parameters_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 |
System Parameters
3 |
4 |
5 | System Parameters 6 |
7 |
8 | 9 | -------------------------------------------------------------------------------- /judge_client/client/testdata/mle.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | public class Main { 4 | public static void main(String[] args) { 5 | ArrayList lst = new ArrayList(); 6 | for (int i = 0; i < 100; ++i) { 7 | lst.add(new byte[1024 * 1024]); 8 | } 9 | System.out.println(lst.size()); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /judge_client/script/rotate_log.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euv 3 | root=`readlink /proc/$$/fd/255` 4 | root=${root%/*} 5 | cd "$root"/log 6 | target_dir=backup/`date +%Y-%m` 7 | target_name=`date +%d.log` 8 | mkdir -p $target_dir 9 | mv judge.log $target_name 10 | if kill -USR1 `cat ../judge.pid`; then echo; fi 11 | mv $target_name $target_dir/ 12 | gzip $target_dir/$target_name & 13 | -------------------------------------------------------------------------------- /judge_server/src/tests/cn/edu/zju/acm/onlinejudge/judgeservice/TestSuite.java: -------------------------------------------------------------------------------- 1 | package cn.edu.zju.acm.onlinejudge.judgeservice; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.junit.runners.Suite; 5 | 6 | @RunWith(Suite.class) 7 | @Suite.SuiteClasses( { 8 | JudgeClientInstanceUnitTest.class, 9 | JudgeQueueUnitTest.class, 10 | JudgeClientUnitTest.class }) 11 | public class TestSuite { 12 | } 13 | -------------------------------------------------------------------------------- /judge_client/client/testdata/tle_static_initializer.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | 3 | static { 4 | for (int i = 0; i < 10000000; ++i) { 5 | for (int j = 0; j < 10000000; ++j) { 6 | if (i * j % 10000000 == 1) { 7 | System.out.println("ok"); 8 | } 9 | } 10 | } 11 | } 12 | 13 | public static void main(String[] args) { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /judge_server/src/tests/cn/edu/zju/acm/onlinejudge/judgeservice/MockDAO.java: -------------------------------------------------------------------------------- 1 | package cn.edu.zju.acm.onlinejudge.judgeservice; 2 | 3 | import cn.edu.zju.acm.onlinejudge.dao.GenericDAO; 4 | 5 | public class MockDAO implements GenericDAO { 6 | 7 | public void beginTransaction() { 8 | } 9 | 10 | public void closeSession() { 11 | } 12 | 13 | public void commitTransaction() { 14 | } 15 | 16 | public void rollbackTransaction() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ac.java: -------------------------------------------------------------------------------- 1 | import java.util.NoSuchElementException; 2 | import java.util.Scanner; 3 | 4 | public class Main { 5 | public static void main(String[] args) { 6 | Scanner in = new Scanner(System.in); 7 | try { 8 | for (;;) { 9 | int a = in.nextInt(); 10 | int b = in.nextInt(); 11 | System.out.println(a + b); 12 | } 13 | } catch (NoSuchElementException e) { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /judge_server/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.logger.cn.edu.zju.acm.onlinejudge = INFO, onlinejudgeFile 2 | 3 | log4j.appender.onlinejudgeFile=org.apache.log4j.RollingFileAppender 4 | log4j.appender.onlinejudgeFile.File=/var/log/lighttpd/zoj.log 5 | log4j.appender.onlinejudgeFile.MaxBackupIndex=1 6 | log4j.appender.onlinejudgeFile.MaxFileSize=10MB 7 | log4j.appender.onlinejudgeFile.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.onlinejudgeFile.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n 9 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ac_non_public_class.java: -------------------------------------------------------------------------------- 1 | import java.util.NoSuchElementException; 2 | import java.util.Scanner; 3 | 4 | class Main { 5 | public static void main(String[] args) { 6 | Scanner in = new Scanner(System.in); 7 | try { 8 | for (;;) { 9 | int a = in.nextInt(); 10 | int b = in.nextInt(); 11 | System.out.println(a + b); 12 | } 13 | } catch (NoSuchElementException e) { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /judge_server/web/show_problemsets.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 2 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /judge_client/client/testdata/rte_catch_error.java: -------------------------------------------------------------------------------- 1 | import java.util.NoSuchElementException; 2 | import java.util.Scanner; 3 | 4 | public class Main { 5 | public static void main(String[] args) { 6 | Scanner in = new Scanner(System.in); 7 | try { 8 | for (;;) { 9 | int a = in.nextInt(); 10 | int b = in.nextInt(); 11 | System.out.println(a + b); 12 | } 13 | } catch (NoSuchElementException e) { 14 | } catch (StackOverflowError e) { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /judge_server/web/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/faq.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/about.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_qqs.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/contact_us.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/home_message.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/admin_message.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/course_submit.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/editProfile.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/edit_course.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_problems.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /judge_server/web/contest_submit.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_course_runs.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_runs.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/course_info.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/edit_contest.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/edit_contests.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/manage_courses.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /judge_server/web/problem_submit.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/registerSuccess.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_contest_runs.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_client/client/testdata/rte_invalid_main.java: -------------------------------------------------------------------------------- 1 | import java.io.PrintWriter; 2 | import java.util.NoSuchElementException; 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | public static void main() { 7 | Scanner in = new Scanner(System.in); 8 | PrintWriter out = new PrintWriter(System.out); 9 | try { 10 | for (;;) { 11 | int a = in.nextInt(); 12 | int b = in.nextInt(); 13 | out.println(a + b); 14 | } 15 | } catch (NoSuchElementException e) { 16 | } 17 | out.close(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /judge_server/web/contest_info.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/edit_preference.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/forgot_password.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/reset_password.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_courses.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_problem.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_user_status.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /judge_server/web/edit_problemset.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/problemset_info.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /judge_server/web/search_result.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /judge_server/web/show_contests.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_course_problems.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ac_gregorian_calendar.java: -------------------------------------------------------------------------------- 1 | import java.util.GregorianCalendar; 2 | import java.util.NoSuchElementException; 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | public static void main(String[] args) { 7 | GregorianCalendar gc = new GregorianCalendar(); 8 | Scanner in = new Scanner(System.in); 9 | try { 10 | for (;;) { 11 | int a = in.nextInt(); 12 | int b = in.nextInt(); 13 | System.out.println(a + b); 14 | } 15 | } catch (NoSuchElementException e) { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /judge_client/client/testdata/rte_nonstatic_main.java: -------------------------------------------------------------------------------- 1 | import java.io.PrintWriter; 2 | import java.util.NoSuchElementException; 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | public void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | PrintWriter out = new PrintWriter(System.out); 9 | try { 10 | for (;;) { 11 | int a = in.nextInt(); 12 | int b = in.nextInt(); 13 | out.println(a + b); 14 | } 15 | } catch (NoSuchElementException e) { 16 | } 17 | out.close(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /judge_server/web/show_course_problem.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_problem_status.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /judge_server/web/contest_search_result.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /judge_server/web/show_contest_problem.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_contest_problems.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ce_invalid_class_name.java: -------------------------------------------------------------------------------- 1 | import java.io.PrintWriter; 2 | import java.util.NoSuchElementException; 3 | import java.util.Scanner; 4 | 5 | public class main { 6 | public static void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | PrintWriter out = new PrintWriter(System.out); 9 | try { 10 | for (;;) { 11 | int a = in.nextInt(); 12 | int b = in.nextInt(); 13 | out.println(a + b); 14 | } 15 | } catch (NoSuchElementException e) { 16 | } 17 | out.close(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /judge_server/conf/oj.conf: -------------------------------------------------------------------------------- 1 | image_path=/home/srv/zoj/images 2 | queue_port=8301 3 | client_max_job=5 4 | 5 | default_problem_set_id=1 6 | default_home_content=/home/srv/zoj/home.txt 7 | 8 | forgotPassword_title=Reset your ZOJ password 9 | forgotPassword_templateFile=forgot_password_template.txt 10 | 11 | home_url=http://acm.zju.edu.cn 12 | default_reply_to=zojadmin@gmail.com 13 | smtp_host= 14 | smtp_user= 15 | smtp_password= 16 | 17 | submit_interval=5000 18 | 19 | feature_problemset=true 20 | feature_contest=true 21 | feature_editProfile=true 22 | feature_register=true 23 | feature_forgotPassword=false 24 | 25 | client_ip=127.0.0.1 26 | -------------------------------------------------------------------------------- /judge_server/web/course_message.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/course_submit_success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/jsp/home_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ page import="java.io.*" %> 3 | <%@ page import="java.util.*" %> 4 | <%@ page import="cn.edu.zju.acm.onlinejudge.util.ConfigManager" %> 5 | <% 6 | File inputFile=new File(ConfigManager.getDefaultHomeContent()); 7 | try 8 | { 9 | FileReader in=new FileReader(inputFile); 10 | BufferedReader inputText=new BufferedReader(in); 11 | String line=null; 12 | line=inputText.readLine(); 13 | while(line!=null) 14 | { 15 | out.println(line); 16 | line=inputText.readLine(); 17 | } 18 | } catch (Exception e) { 19 | } 20 | %> -------------------------------------------------------------------------------- /judge_server/web/show_contest_ranklist.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/contest_message.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/contest_submit_success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/problem_submit_success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_contest_problem_status.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /judge_server/web/show_contest_statistics.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/create_contest_success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/edit_contest_success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_server/web/show_problemset_ranklist.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /judge_client/client/testdata/rte_has_package.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import java.io.PrintWriter; 4 | import java.util.NoSuchElementException; 5 | import java.util.Scanner; 6 | 7 | public class Main { 8 | public static void main(String[] args) { 9 | Scanner in = new Scanner(System.in); 10 | PrintWriter out = new PrintWriter(System.out); 11 | try { 12 | for (;;) { 13 | int a = in.nextInt(); 14 | int b = in.nextInt(); 15 | out.println(a + b); 16 | } 17 | } catch (NoSuchElementException e) { 18 | } 19 | out.close(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /judge_server/web/import_problem_preview.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/problemset_message.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/judge.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/import_contest_problem_preview.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/language.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/edit_role.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/jsp/registerSuccess_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 | 7 |
8 | Register Success
9 |
10 |

Register Success!

11 |

Back

12 |
13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /judge_server/web/show_roles.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/add_problem.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/edit_problem.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/judge_reply.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/manage_users.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/add_course_problem.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/manage_contests.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/manage_forums.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/show_dashboard.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/add_contest_problem.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/default_limits.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/edit_contest_problem.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/docs/access_log.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS access_log; 2 | 3 | CREATE TABLE access_log ( 4 | access_log_id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, 5 | user_profile_id BIGINT NULL, 6 | handle VARCHAR(32) NULL, 7 | action VARCHAR(128) NOT NULL, 8 | url VARCHAR(512) NOT NULL, 9 | ip VARCHAR(64) NOT NULL, 10 | timestamp DATETIME NOT NULL, 11 | access_time BIGINT NOT NULL 12 | ) ENGINE = InnoDb; 13 | 14 | CREATE INDEX index_access_log_timestamp 15 | ON access_log (timestamp); 16 | -------------------------------------------------------------------------------- /judge_server/web/manage_user_role.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/WEB-INF/validation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /judge_server/web/manage_role_users.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/show_action_dashboard.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/system_parameters.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /judge_server/web/jsp/create_contest_success_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 | 7 |
8 | Create Contest Success
9 |
10 |

Create Contest Success!

11 |

Back

12 |
13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /judge_server/web/jsp/edit_contest_success_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 | 7 |
8 | Create Contest Success
9 |
10 |

Create Contest Success!

11 |

Back

12 |
13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /judge_client/client/PHPLoader.php: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include "util.h" 6 | 7 | static void init_sandbox(const char* memory_limit_string) { 8 | int memory = ReadMemoryConsumption(getpid()); 9 | int memory_limit = 0; 10 | sscanf(memory_limit_string, "%d", &memory_limit); 11 | memory_limit = (memory_limit + memory) * 1024; 12 | 13 | SetLimit(RLIMIT_DATA, memory_limit); 14 | SetLimit(RLIMIT_AS, memory_limit + 10 * 1024 * 1024); 15 | } 16 | 17 | static void scm_main(void* closure, int argc, char** argv) { 18 | const char file_name[] = "p.scm"; 19 | if (argc < 1) 20 | exit(1); 21 | init_sandbox(argv[0]); 22 | scm_c_primitive_load(file_name); 23 | } 24 | 25 | int main(int argc, char* argv[]) { 26 | scm_boot_guile(argc, argv, scm_main, NULL); 27 | } 28 | -------------------------------------------------------------------------------- /judge_client/client/global.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #include "global.h" 21 | 22 | namespace global { 23 | int terminated; 24 | int socket_closed; 25 | } 26 | -------------------------------------------------------------------------------- /judge_server/src/tests/cn/edu/zju/acm/onlinejudge/judgeservice/MockLanguageDAO.java: -------------------------------------------------------------------------------- 1 | package cn.edu.zju.acm.onlinejudge.judgeservice; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import cn.edu.zju.acm.onlinejudge.bean.enumeration.Language; 8 | import cn.edu.zju.acm.onlinejudge.dao.LanguageDAO; 9 | 10 | public class MockLanguageDAO extends MockDAO implements LanguageDAO { 11 | private List languages = Collections.synchronizedList(new ArrayList()); 12 | 13 | public MockLanguageDAO() { 14 | Language language = new Language(0, "cc", "cc", "cc", "cc"); 15 | save(language); 16 | } 17 | 18 | public List getAllLanguages() { 19 | return new ArrayList(languages); 20 | } 21 | 22 | public void save(Language language) { 23 | languages.add(language); 24 | } 25 | } -------------------------------------------------------------------------------- /judge_client/client/net_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either revision 3 of the License, or 9 | * (at your option) any later revision. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __NET_UTIL_H__ 21 | #define __NET_UTIL_H__ 22 | 23 | int CreateServerSocket(int* port); 24 | 25 | #endif // __NET_UTIL_H__ 26 | -------------------------------------------------------------------------------- /judge_client/client/testdata/ce_too_many_classes.java: -------------------------------------------------------------------------------- 1 | class A0 {} 2 | class A1 {} 3 | class A2 {} 4 | class A3 {} 5 | class A4 {} 6 | class A5 {} 7 | class A6 {} 8 | class A7 {} 9 | class A8 {} 10 | class A9 {} 11 | class B0 {} 12 | class B1 {} 13 | class B2 {} 14 | class B3 {} 15 | class B4 {} 16 | class B5 {} 17 | class B6 {} 18 | class B7 {} 19 | class B8 {} 20 | class B9 {} 21 | class C0 {} 22 | class C1 {} 23 | class C2 {} 24 | class C3 {} 25 | class C4 {} 26 | class C5 {} 27 | class C6 {} 28 | class C7 {} 29 | class C8 {} 30 | class C9 {} 31 | class D0 {} 32 | class D1 {} 33 | class D2 {} 34 | class D3 {} 35 | class D4 {} 36 | class D5 {} 37 | class D6 {} 38 | class D7 {} 39 | class D8 {} 40 | class D9 {} 41 | class E0 {} 42 | class E1 {} 43 | class E2 {} 44 | class E3 {} 45 | class E4 {} 46 | class E5 {} 47 | class E6 {} 48 | class E7 {} 49 | class E8 {} 50 | class E9 {} 51 | public class Main { 52 | public static void main(String[] args) { 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /judge_server/web/jsp/home_message_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 |
<%=request.getAttribute("title") == null ? "Message" : request.getAttribute("title").toString()%>
7 |
8 |
9 | 10 |
11 | 12 |
13 | ">Back 14 |
15 |
16 |
17 | -------------------------------------------------------------------------------- /judge_server/web/jsp/submit_success_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 | <% 7 | boolean isProblemset = "Problems".equals(request.getAttribute("region")); 8 | String actionPath = isProblemset ? "showRuns.do" : "showContestRuns.do"; 9 | 10 | %> 11 |
Submit Successfully
12 |
13 |

Your source has been submitted. The submission id is . Please check the ?contestId=">status page.

14 |
15 | 16 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/bean/request/ThreadCriteria.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.bean.request; 17 | 18 | /** 19 | *

20 | *

21 | * 22 | * @poseidon-object-id [I1a80fb8m1050eed7fbfmm439f] 23 | */ 24 | public class ThreadCriteria {} 25 | -------------------------------------------------------------------------------- /judge_client/client/checker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __CHECKER_H__ 21 | #define __CHECKER_H__ 22 | 23 | class Checker { 24 | public: 25 | virtual ~Checker(); 26 | 27 | int Check(int sock); 28 | 29 | protected: 30 | virtual int InternalCheck(int sock) = 0; 31 | }; 32 | 33 | #endif // __CHECKER_H__ 34 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/JudgeClientErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice; 17 | 18 | public class JudgeClientErrorException extends Exception { 19 | 20 | public JudgeClientErrorException() { 21 | super(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissiontest/Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissiontest; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | public interface Test { 21 | boolean test(Submission submission, int priority); 22 | } 23 | -------------------------------------------------------------------------------- /judge_client/client/PerlLoader.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use BSD::Resource; 3 | 4 | sub get_memory_usage() { 5 | my %mem; 6 | open FILE, ') { 8 | next if $line !~ /^(Vm[^:]*):\s*(\d*) /; 9 | $mem{$1} = int($2); 10 | } 11 | close FILE; 12 | $mem{'VmSize'} = $mem{'VmPeak'} if exists($mem{'VmPeak'}); 13 | return $mem{'VmSize'} - $mem{'VmExe'} - $mem{'VmLib'} - $mem{'VmStk'}; 14 | } 15 | 16 | my $memory_limit = (int($ENV{'MEMORY_LIMIT'}) + get_memory_usage()) * 1024; 17 | 18 | $SIG{FPE} = 'DEFAULT'; 19 | $SIG{__DIE__} = sub { 20 | # send SIGFPE to self 21 | kill 8, $$ if $_[0] =~ '^Illegal division by zero'; 22 | }; 23 | 24 | setrlimit(RLIMIT_DATA, $memory_limit, $memory_limit + 1); 25 | setrlimit(RLIMIT_AS, $memory_limit + 10 * 1024 * 1024, $memory_limit + 10 * 1024 * 1024 + 1); 26 | 27 | # just uses some more memory to keep memory usage away from zero... 28 | my %_foooo = (); 29 | for (my $_barrr = 1; $_barrr < 5000; $_barrr++) { 30 | $_foooo{$_barrr} = '................'; 31 | } 32 | 1; 33 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/ProblemDataErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice; 17 | 18 | public class ProblemDataErrorException extends JudgeServerErrorException { 19 | 20 | public ProblemDataErrorException(String message) { 21 | super(message); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissionfilter/SubmissionFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissionfilter; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | public interface SubmissionFilter { 21 | public int filter(Submission submission, int priority); 22 | } 23 | -------------------------------------------------------------------------------- /judge_server/src/tests/cn/edu/zju/acm/onlinejudge/persistence/sql/PersistenceTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001 - 2005 ZJU Online Judge, All Rights Reserved. 3 | */ 4 | package cn.edu.zju.acm.onlinejudge.persistence.sql; 5 | 6 | import junit.framework.Test; 7 | import junit.framework.TestCase; 8 | import junit.framework.TestSuite; 9 | 10 | 11 | /** 12 | *

This test case aggregates all test cases for persistence layer.

13 | * 14 | * @author oldbig 15 | * @version 1.0 16 | */ 17 | public class PersistenceTests extends TestCase { 18 | /** 19 | *

Gets the functional test suite for persistence layer.

20 | * 21 | * @return a TestSuite providing the tests for persistence layer. 22 | */ 23 | public static Test suite() { 24 | final TestSuite suite = new TestSuite(); 25 | 26 | suite.addTestSuite(UserPersistenceImplTest.class); 27 | suite.addTestSuite(ConfigurationPersistenceImplTest.class); 28 | suite.addTestSuite(ForumPersistenceImplTest.class); 29 | 30 | return suite; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /judge_server/web/layouts/loginbar.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 3 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 4 | <%@ page import="cn.edu.zju.acm.onlinejudge.util.Features" %> 5 |
Welcome to ZOJ
6 | 18 | -------------------------------------------------------------------------------- /judge_server/docs/indices.sql: -------------------------------------------------------------------------------- 1 | CREATE UNIQUE INDEX unique_handle 2 | ON user_profile (handle); 3 | 4 | CREATE UNIQUE INDEX unique_email 5 | ON user_profile (email_address); 6 | 7 | CREATE UNIQUE INDEX unique_confirmation 8 | ON confirmation (code); 9 | 10 | CREATE UNIQUE INDEX unique_language 11 | ON language (name); 12 | 13 | CREATE INDEX index_problem_code 14 | ON problem (contest_id, code); 15 | 16 | CREATE INDEX index_problem_title 17 | ON problem (contest_id, title); 18 | 19 | CREATE UNIQUE INDEX unique_reply 20 | ON judge_reply (name); 21 | 22 | CREATE INDEX index_submission_user 23 | ON submission (user_profile_id, problem_id, judge_reply_id); 24 | 25 | CREATE INDEX index_submission_problem 26 | ON submission (problem_id, language_id, judge_reply_id); 27 | 28 | CREATE INDEX index_contest_reference 29 | ON contest_reference (contest_id); 30 | 31 | CREATE INDEX index_problem_reference 32 | ON problem_reference (problem_id); 33 | 34 | CREATE INDEX index_forum_reference 35 | ON forum_reference (post_id); 36 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissiontest/TrueTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissiontest; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | public class TrueTest implements Test { 21 | 22 | public boolean test(Submission submission, int priority) { 23 | return true; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /judge_client/client/global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __GLOBAL_H__ 21 | #define __GLOBAL_H__ 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | #define MAX_JOBS 100 28 | #define MAX_LOG_FILE_SIZE 262144 // 256KB 29 | #define MAX_DATA_FILE_SIZE 16 * 1024 * 1024 // 16MB 30 | 31 | namespace global { 32 | extern int terminated; 33 | extern int socket_closed; 34 | } 35 | 36 | #endif // __GLOGAL_H__ 37 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/bean/Contest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.bean; 17 | 18 | /** 19 | *

20 | * Contest bean. 21 | *

22 | * 23 | * @author Zhang, Zheng 24 | * 25 | * @version 2.0 26 | */ 27 | public class Contest extends AbstractContest { 28 | 29 | /** 30 | *

31 | * Empty constructor. 32 | *

33 | */ 34 | public Contest() {} 35 | 36 | } 37 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/bean/Problemset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.bean; 17 | 18 | /** 19 | *

20 | * Problemset bean. 21 | *

22 | * 23 | * @author Zhang, Zheng 24 | * 25 | * @version 2.0 26 | */ 27 | public class Problemset extends AbstractContest { 28 | 29 | /** 30 | *

31 | * Empty constructor. 32 | *

33 | */ 34 | public Problemset() {} 35 | 36 | } 37 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/SubmissionQueueReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | /** 17 | * 18 | */ 19 | 20 | package cn.edu.zju.acm.onlinejudge.judgeservice; 21 | 22 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 23 | import cn.edu.zju.acm.onlinejudge.persistence.PersistenceException; 24 | 25 | public interface SubmissionQueueReader { 26 | public Submission poll(JudgeClientJudgeThread judgeThread) throws InterruptedException, PersistenceException; 27 | } -------------------------------------------------------------------------------- /judge_client/client/java_runner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __JAVA_RUNNER_H__ 21 | #define __JAVA_RUNNER_H__ 22 | 23 | #include "runner.h" 24 | 25 | class JavaRunner : public Runner { 26 | public: 27 | JavaRunner(int sock, int time_limit, int memory_limit, int output_limit, int uid, int gid) 28 | : Runner(sock, time_limit, memory_limit, output_limit, uid, gid) { 29 | } 30 | 31 | private: 32 | virtual void InternalRun(); 33 | }; 34 | 35 | #endif // __JAVA_RUNNER_H__ 36 | -------------------------------------------------------------------------------- /judge_server/web/jsp/contest_message_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 |
<%=request.getAttribute("title") == null ? "Message" : request.getAttribute("title").toString()%>
7 |
8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 | 16 |
17 | 18 |
19 | ">Back 20 |
21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /judge_server/web/jsp/message_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 |
<%=request.getAttribute("title") == null ? "Message" : request.getAttribute("title").toString()%>
7 |
8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 | 16 |
17 | 18 |
19 | ">Back 20 |
21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /judge_server/web/jsp/problemset_message_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 |
<%=request.getAttribute("title") == null ? "Message" : request.getAttribute("title").toString()%>
7 |
8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 | 16 |
17 | 18 |
19 | ">Back 20 |
21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /judge_client/client/testdata/Makefile: -------------------------------------------------------------------------------- 1 | CC_SOURCES:=$(filter-out ce.cc ce_long_error.cc,$(wildcard *.cc)) 2 | CC_BINARIES:=$(patsubst %.cc,%,$(CC_SOURCES)) 3 | JAVA_SOURCES:=$(filter-out Main.java $(wildcard ce*.java),$(wildcard *.java)) 4 | JAVA_CLASSES:=$(patsubst %.java,%.class,$(JAVA_SOURCES)) 5 | 6 | .PHONY: all clean 7 | 8 | all: $(CC_BINARIES) $(JAVA_CLASSES) 9 | 10 | clean: 11 | rm -f $(CC_BINARIES) $(JAVA_CLASSES) guile_loader 12 | 13 | $(CC_BINARIES): % : %.cc 14 | g++ -o $@ -ansi -fno-asm -O2 -Wall -lm --static -s -DONLINE_JUDGE $^ 15 | 16 | $(JAVA_CLASSES): %.class : %.java 17 | cp -f $^ Main.java 18 | javac Main.java 19 | rm -f Main.java 20 | mv Main.class $@ 21 | 22 | ac_multiple_classes.class: ac_multiple_classes.java 23 | cp -f ac_multiple_classes.java Main.java 24 | javac Main.java 25 | rm -f Main.java 26 | mv Main.class ac_multiple_classes.class 27 | mv 'Main$$1.class' 'ac_multiple_classes$$1.class' 28 | 29 | tle_multiple_classes_static_initializer.class: tle_multiple_classes_static_initializer.java 30 | cp -f tle_multiple_classes_static_initializer.java Main.java 31 | javac Main.java 32 | rm -f Main.java 33 | mv Main.class tle_multiple_classes_static_initializer.class 34 | mv 'T.class' 'tle_multiple_classes_static_initializer_T.class' 35 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/util/cache/CacheEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.util.cache; 17 | 18 | class CacheEntry { 19 | private final T entry; 20 | private final CacheKey key; 21 | 22 | public CacheEntry(T entry, CacheKey key) { 23 | this.entry = entry; 24 | this.key = key; 25 | } 26 | 27 | public T getEntry() { 28 | return this.entry; 29 | } 30 | 31 | public CacheKey getKey() { 32 | return this.key; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /judge_client/client/testdata/judge.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | int main(int argc, char* argv[]) { 11 | if (argc != 2) { 12 | cerr<<"Invalid number of arguments"<>a>>b) { 20 | string s; 21 | for (;;) { 22 | getline(gin, s); 23 | if (gin.fail()) { 24 | return 1; 25 | } 26 | if (s.find_first_not_of(" \t") != string::npos) { 27 | break; 28 | } 29 | result = 2; 30 | } 31 | if (s.find(' ') != string::npos) { 32 | result = 2; 33 | } 34 | istringstream is(s); 35 | int c; 36 | is>>c; 37 | if (is.fail() || c != a + b) { 38 | return 1; 39 | } 40 | } 41 | for (;;) { 42 | string s; 43 | getline(gin, s); 44 | if (gin.fail()) { 45 | break; 46 | } 47 | if (s.find_first_not_of(" \t") != string::npos) { 48 | return 1; 49 | } 50 | } 51 | return result; 52 | } 53 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/Priority.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice; 17 | 18 | public class Priority { 19 | public static final int MIN = 1; 20 | public static final int LOW = 4; 21 | public static final int NORMAL = 5; 22 | public static final int HIGH = 6; 23 | public static final int MAX = 9; 24 | public static final int DENY = -100000; 25 | 26 | public static boolean isValidPriority(int priority) { 27 | return priority >= Priority.MIN && priority <= Priority.MAX; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissiontest/ConjunctionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissiontest; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | public class ConjunctionTest extends CompoundTest { 21 | 22 | public boolean test(Submission submission, int priority) { 23 | for (Test test : this.tests) { 24 | if (!test.test(submission, priority)) { 25 | return false; 26 | } 27 | } 28 | return true; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissiontest/DisjunctionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissiontest; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | public class DisjunctionTest extends CompoundTest { 21 | 22 | public boolean test(Submission submission, int priority) { 23 | for (Test test : this.tests) { 24 | if (!test.test(submission, priority)) { 25 | return true; 26 | } 27 | } 28 | return false; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /judge_client/client/special_checker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __SPECIAL_CHECKER_H__ 21 | #define __SPECIAL_CHECKER_H__ 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | #include "checker.h" 28 | 29 | class SpecialChecker : public Checker { 30 | public: 31 | SpecialChecker(const string& special_judge_filename) : special_judge_filename_(special_judge_filename) { 32 | } 33 | 34 | protected: 35 | int InternalCheck(int sock); 36 | 37 | private: 38 | string special_judge_filename_; 39 | 40 | friend class SpecialCheckerTest; 41 | }; 42 | 43 | #endif // __SPECIAL_CHECKER_H__ 44 | -------------------------------------------------------------------------------- /judge_server/web/jsp/about_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 |
3 | Hall of Fame 4 | 5 | 6 | 12 | 13 |
7 | 8 | 9 | 10 |
  
11 |
14 |
15 |
16 |
17 |
18 |
19 | ZJU ICPC Team Members 20 | 21 | 22 | 28 | 29 |
23 | 24 | 25 | 26 |
  
27 |
30 |
31 |
32 |
-------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/util/PasswordManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.util; 17 | 18 | /** 19 | *

20 | * PasswordManager class. 21 | *

22 | * 23 | * @version 2.0 24 | * @author Zhang, Zheng 25 | */ 26 | public class PasswordManager { 27 | 28 | /** 29 | * Encode the password. 30 | * 31 | * @param pwd 32 | * @return 33 | */ 34 | public static String encodePassword1(String pwd) { 35 | if (pwd == null || pwd.length() == 0) { 36 | return pwd; 37 | } 38 | return pwd + "lala"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/JudgeServerErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice; 17 | 18 | import cn.edu.zju.acm.onlinejudge.persistence.PersistenceException; 19 | 20 | public class JudgeServerErrorException extends Exception { 21 | 22 | public JudgeServerErrorException(String message) { 23 | super(message); 24 | } 25 | 26 | public JudgeServerErrorException(String message, Exception e) { 27 | super(message, e); 28 | } 29 | 30 | public JudgeServerErrorException(PersistenceException e) { 31 | super(e); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /judge_server/docs/qq.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS submission_status; 2 | CREATE TABLE submission_status ( 3 | user_profile_id BIGINT NOT NULL, 4 | problem_id BIGINT NOT NULL, 5 | status VARCHAR(32) NULL 6 | ) ENGINE = InnoDb; 7 | 8 | ALTER TABLE submission_status 9 | ADD CONSTRAINT fk_submission_status_user_profile_id FOREIGN KEY (user_profile_id) 10 | REFERENCES user_profile (user_profile_id) 11 | ON DELETE RESTRICT; 12 | ALTER TABLE submission_status 13 | ADD CONSTRAINT fk_submission_status_problem_id FOREIGN KEY (problem_id) 14 | REFERENCES problem (problem_id) 15 | ON DELETE RESTRICT; 16 | 17 | update problem set color='white' where contest_id=3 AND code='A'; 18 | update problem set color='red' where contest_id=3 AND code='B'; 19 | update problem set color='purple' where contest_id=3 AND code='C'; 20 | update problem set color='blue' where contest_id=3 AND code='D'; 21 | update problem set color='yellow' where contest_id=3 AND code='E'; 22 | update problem set color='pink' where contest_id=3 AND code='F'; 23 | update problem set color='green' where contest_id=3 AND code='G'; 24 | update problem set color='goldenrod' where contest_id=3 AND code='H'; 25 | 26 | update problem set color='red' where contest_id=14 AND code='A'; 27 | update problem set color='green' where contest_id=14 AND code='B'; 28 | -------------------------------------------------------------------------------- /judge_client/client/unittest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __UNITTEST_H__ 21 | #define __UNITTEST_H__ 22 | 23 | #include "zunit.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | using namespace std; 30 | 31 | #include 32 | 33 | static inline string GetWorkingDir() { 34 | char path[FILENAME_MAX + 1]; 35 | if (getcwd(path, sizeof(path)) == NULL) { 36 | cout<<"Fail to get the current working dir"; 37 | exit(1); 38 | } 39 | return path; 40 | } 41 | 42 | const string CURRENT_WORKING_DIR = GetWorkingDir(); 43 | const string TESTDIR = CURRENT_WORKING_DIR + "/testdata"; 44 | 45 | #endif // __UNITTEST_H__ 46 | -------------------------------------------------------------------------------- /judge_server/web/jsp/manage_courses_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=utf-8"%> 2 | <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 3 | <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> 4 | <%@ page import="java.util.List" %> 5 | <%@ page import="java.util.Set" %> 6 | <%@ page import="java.util.HashSet" %> 7 | <%@ page import="java.util.HashMap" %> 8 | <%@ page import="java.util.Arrays" %> 9 | <%@ page import="java.util.Iterator" %> 10 | <%@ page import="cn.edu.zju.acm.onlinejudge.util.StatisticsManager" %> 11 | <%@ page import="cn.edu.zju.acm.onlinejudge.util.PersistenceManager" %> 12 | <%@ page import="cn.edu.zju.acm.onlinejudge.bean.UserProfile" %> 13 | <%@ page import="cn.edu.zju.acm.onlinejudge.bean.Problem" %> 14 |
15 |

Add Book Reader Information

16 |
17 | 18 | username :
19 | password :
20 | 21 |
22 |
23 |

Add Teacher Information

24 |
25 | 26 | username :
27 | password :
28 | 29 |
30 |
-------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissiontest/CompoundTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissiontest; 17 | 18 | import java.util.HashSet; 19 | import java.util.Set; 20 | 21 | public abstract class CompoundTest implements Test { 22 | protected Set tests = new HashSet(); 23 | 24 | public void add(Test test) { 25 | this.tests.add(test); 26 | } 27 | 28 | @Override 29 | public int hashCode() { 30 | return this.tests.hashCode(); 31 | } 32 | 33 | @Override 34 | public boolean equals(Object obj) { 35 | if (obj instanceof CompoundTest) { 36 | return this.tests.equals(((CompoundTest) obj).tests); 37 | } 38 | return false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /judge_client/client/protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __PROTOCOL_H__ 21 | #define __PROTOCOL_H__ 22 | 23 | #define CMD_PING 100 24 | #define CMD_JUDGE 1 25 | #define CMD_DATA 2 26 | #define CMD_COMPILE 3 27 | #define CMD_TESTCASE 4 28 | #define CMD_REMOVE_PROBLEM 5 29 | #define CMD_INFO 6 30 | 31 | #define COMPILING 1 32 | #define RUNNING 2 33 | #define RUNTIME_ERROR 3 34 | #define WRONG_ANSWER 4 35 | #define ACCEPTED 5 36 | #define TIME_LIMIT_EXCEEDED 6 37 | #define MEMORY_LIMIT_EXCEEDED 7 38 | #define OUTPUT_LIMIT_EXCEEDED 10 39 | #define COMPILATION_ERROR 12 40 | #define PRESENTATION_ERROR 13 41 | #define INTERNAL_ERROR 14 42 | #define FLOATING_POINT_ERROR 15 43 | #define SEGMENTATION_FAULT 16 44 | #define JUDGING 19 45 | #define NON_ZERO_EXIT_CODE 21 46 | #define READY 100 47 | #define NO_SUCH_PROBLEM 101 48 | #define INVALID_INPUT 102 49 | 50 | #endif // __PROTOCL_H__ 51 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissiontest/PriorityTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissiontest; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | public class PriorityTest { 21 | private int priority; 22 | 23 | public PriorityTest(int priority) { 24 | this.priority = priority; 25 | } 26 | 27 | public boolean test(Submission submission, int priority) { 28 | return this.priority == priority; 29 | } 30 | 31 | @Override 32 | public int hashCode() { 33 | return this.priority; 34 | } 35 | 36 | @Override 37 | public boolean equals(Object obj) { 38 | if (obj instanceof PriorityTest) { 39 | return this.priority == ((PriorityTest) obj).priority; 40 | } 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /judge_client/client/script_initializer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 Li, Cheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __SCRIPT_INITIALIZER_H__ 21 | #define __SCRIPT_INITIALIZER_H__ 22 | 23 | class ScriptRunner; 24 | 25 | namespace { 26 | class ScriptInitializerBuilder; 27 | }; 28 | 29 | class ScriptInitializer { 30 | private: 31 | int language_id_; // should be consistent with compiler.cc 32 | 33 | protected: 34 | ScriptInitializer(int language_id) : language_id_(language_id) { } 35 | int GetLanguageId() { return language_id_; } 36 | virtual ScriptInitializer* clone() = 0; 37 | friend class ::ScriptInitializerBuilder; 38 | 39 | public: 40 | // this function will be called each time target script runs 41 | virtual void SetUp(ScriptRunner* runner) {} 42 | virtual ~ScriptInitializer() {} 43 | 44 | static ScriptInitializer* create(int language_id); 45 | }; 46 | 47 | 48 | #endif // __SCRIPT_INITIALIZER_H__ 49 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissiontest/ProblemTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissiontest; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | public class ProblemTest { 21 | private int problemId; 22 | 23 | public ProblemTest(int problemId) { 24 | this.problemId = problemId; 25 | } 26 | 27 | public boolean test(Submission submission, int priority) { 28 | return this.problemId == submission.getProblemId(); 29 | } 30 | 31 | @Override 32 | public int hashCode() { 33 | return this.problemId; 34 | } 35 | 36 | @Override 37 | public boolean equals(Object obj) { 38 | if (obj instanceof ProblemTest) { 39 | return this.problemId == ((ProblemTest) obj).problemId; 40 | } 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /judge_client/client/PythonLoader.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys, os, resource, signal, runpy 4 | 5 | sys.path = ['.'] + sys.path 6 | 7 | def get_memory_status() : 8 | args = { 'VmSize' : 0, 'VmExe' : 0, 'VmLib': 0, 'VmStk' : 0 } 9 | fin = open('/proc/self/status', 'r') 10 | for i in fin : 11 | if not i.startswith('Vm') : continue 12 | arg = [ j.strip() for j in i.split(':') ] 13 | args[arg[0]] = int(arg[1].partition(' ')[0]) 14 | fin.close() 15 | return args 16 | 17 | memory_limit = int(sys.argv[1]) 18 | module_name = sys.argv[2].partition('.')[0] 19 | 20 | memory_status = get_memory_status() 21 | if 'VmPeak' in memory_status : 22 | memory_status['VmSize'] = memory_status['VmPeak'] 23 | 24 | memory_usage = memory_status['VmSize'] - memory_status['VmExe'] - memory_status['VmLib'] - memory_status['VmStk'] 25 | memory_limit = memory_limit + memory_usage 26 | 27 | # do not catch SIGXFSZ, otherwise the judge will not know whether an 28 | # OLE has been generated 29 | signal.signal(signal.SIGXFSZ, signal.SIG_DFL) 30 | 31 | # tight memory usage 32 | resource.setrlimit(resource.RLIMIT_DATA, (memory_limit * 1024, memory_limit * 1024 + 1 * 1024) ) 33 | resource.setrlimit(resource.RLIMIT_AS, (memory_limit * 1024 + 10 * 1024 * 1024, memory_limit * 1024 + 11 * 1024 * 1024) ) 34 | 35 | # after the above two calls, the judge will know preparation has finished and 36 | # all following syscall should be traced 37 | 38 | try : 39 | runpy.run_module(module_name, run_name = '__main__') 40 | except MemoryError : 41 | os.kill(os.getpid(), signal.SIGKILL) 42 | except ZeroDivisionError : 43 | os.kill(os.getpid(), signal.SIGFPE) 44 | 45 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/submissiontest/NegationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice.submissiontest; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | public class NegationTest implements Test { 21 | 22 | private Test test; 23 | 24 | public NegationTest(Test test) { 25 | this.test = test; 26 | } 27 | 28 | public boolean test(Submission submission, int priority) { 29 | return !this.test.test(submission, priority); 30 | } 31 | 32 | @Override 33 | public int hashCode() { 34 | return this.test.hashCode(); 35 | } 36 | 37 | @Override 38 | public boolean equals(Object obj) { 39 | if (obj instanceof NegationTest) { 40 | return this.test.equals(((NegationTest) obj).test); 41 | } 42 | return false; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/util/Features.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.util; 17 | 18 | public class Features { 19 | public static boolean problemset() { 20 | return "true".equalsIgnoreCase(ConfigManager.getValue("feature_problemset")); 21 | } 22 | 23 | public static boolean contest() { 24 | return "true".equalsIgnoreCase(ConfigManager.getValue("feature_contest")); 25 | } 26 | 27 | public static boolean editProfile() { 28 | return "true".equalsIgnoreCase(ConfigManager.getValue("feature_editProfile")); 29 | } 30 | 31 | public static boolean register() { 32 | return "true".equalsIgnoreCase(ConfigManager.getValue("feature_register")); 33 | } 34 | 35 | public static boolean forgotPassword() { 36 | return "true".equalsIgnoreCase(ConfigManager.getValue("feature_forgotPassword")); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/util/ActionLog.java: -------------------------------------------------------------------------------- 1 | package cn.edu.zju.acm.onlinejudge.util; 2 | 3 | import java.util.Date; 4 | 5 | public class ActionLog { 6 | private String action; 7 | private Date timeStart; 8 | private Date timeEnd; 9 | private long count; 10 | private long maxAccessTime; 11 | private long minAccessTime; 12 | private long avgAccessTime; 13 | 14 | public ActionLog() { 15 | } 16 | 17 | public String getAction() { 18 | return action; 19 | } 20 | 21 | public void setAction(String action) { 22 | this.action = action; 23 | } 24 | 25 | public Date getTimeStart() { 26 | return timeStart; 27 | } 28 | 29 | public void setTimeStart(Date timeStart) { 30 | this.timeStart = timeStart; 31 | } 32 | 33 | public Date getTimeEnd() { 34 | return timeEnd; 35 | } 36 | 37 | public void setTimeEnd(Date timeEnd) { 38 | this.timeEnd = timeEnd; 39 | } 40 | 41 | public long getCount() { 42 | return count; 43 | } 44 | 45 | public void setCount(long count) { 46 | this.count = count; 47 | } 48 | 49 | public long getMaxAccessTime() { 50 | return maxAccessTime; 51 | } 52 | 53 | public void setMaxAccessTime(long maxAccessTime) { 54 | this.maxAccessTime = maxAccessTime; 55 | } 56 | 57 | public long getMinAccessTime() { 58 | return minAccessTime; 59 | } 60 | 61 | public void setMinAccessTime(long minAccessTime) { 62 | this.minAccessTime = minAccessTime; 63 | } 64 | 65 | public long getAvgAccessTime() { 66 | return avgAccessTime; 67 | } 68 | 69 | public void setAvgAccessTime(long avgAccessTime) { 70 | this.avgAccessTime = avgAccessTime; 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /judge_client/client/checker.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #include "checker.h" 21 | 22 | #include "common_io.h" 23 | #include "logging.h" 24 | #include "protocol.h" 25 | 26 | Checker::~Checker() { 27 | } 28 | 29 | int Checker::Check(int sock) { 30 | LOG(INFO)<<"Judging"; 31 | WriteUint32(sock, JUDGING); 32 | int result = InternalCheck(sock); 33 | switch(result) { 34 | case ACCEPTED: 35 | LOG(INFO)<<"Accepted"; 36 | break; 37 | case WRONG_ANSWER: 38 | LOG(INFO)<<"Wrong Answer"; 39 | break; 40 | case PRESENTATION_ERROR: 41 | LOG(INFO)<<"Presentation Error"; 42 | break; 43 | default: 44 | if (result != -1) { 45 | LOG(ERROR)<<"Invalid result "< problemMap = new Hashtable(); 15 | 16 | public Problem getProblem(long problemId) { 17 | return cloneProblem(problemMap.get(problemId)); 18 | } 19 | 20 | public void save(Problem problem) { 21 | problem.setId(id.getAndIncrement()); 22 | update(problem); 23 | } 24 | 25 | public void update(Problem problem) { 26 | problemMap.put(problem.getId(), cloneProblem(problem)); 27 | } 28 | 29 | private Problem cloneProblem(Problem problem) { 30 | Problem ret = new Problem(); 31 | ret.setId(problem.getId()); 32 | ret.setRevision(problem.getRevision()); 33 | ret.setLimit(cloneLimit(problem.getLimit())); 34 | ret.setChecker(problem.isChecker()); 35 | return ret; 36 | } 37 | 38 | private Limit cloneLimit(Limit limit) { 39 | Limit ret = new Limit(); 40 | ret.setId(limit.getId()); 41 | ret.setMemoryLimit(limit.getMemoryLimit()); 42 | ret.setOutputLimit(limit.getOutputLimit()); 43 | ret.setTimeLimit(limit.getTimeLimit()); 44 | return ret; 45 | } 46 | } -------------------------------------------------------------------------------- /judge_server/docs/deployment.txt: -------------------------------------------------------------------------------- 1 | Database 2 | 1) install MySQL 5.0 or above. The default charset should be UTF8 3 | 2) since input/output data is stored in database and some input/output may be pretty large, 4 | you need change the 'max_allowed_packet' to fit the input/output size. 5 | e.g. /etc/mysql/my.cnf 6 | max_allowed_packet = 64M 7 | 3) create a database named zoj, or something else 8 | 4) execute docs/all.sql by 9 | source ~/zoj-read-only/judge_server/docs/all.sql 10 | 11 | 12 | Servlet Container 13 | You could use Tomcat, JBoss or something else. 14 | 15 | Judge Server 16 | 1) Check out zoj source 17 | svn checkout http://zoj.googlecode.com/svn/trunk/ zoj-read-only 18 | 19 | 2) modify conf/log4j.properties. 20 | The log file path need be changed. 21 | 22 | 3) modify oj.conf. 23 | image_path, judge_server, home_url need be changed. 24 | image_path is the directory containing all problem images. 25 | judge_server should be in the format of 'host:port:threadNumber' 26 | home_url will be used in email templates. 27 | You need configure the smtp if forgotPassword is enabled. 28 | You could also enable/disable some features if necessary. 29 | e.g. if the server is for a local contest, you could disable 30 | problemset, editProfile, register, forgotPassword features 31 | 32 | 4) modify data_source.properties 33 | 34 | 5) modify build.xml 35 | tomcat_path should be changed to correct application deploy path 36 | 37 | 6) run ant build 38 | 39 | Judge Client (TODO) 40 | 41 | Start judge client 42 | /zoj/judge_client --root=/zoj --lang=cc,c,pas --uid=1000 --gid=1000 --daemonize --logtostderr=false --queue_address=127.0.0.1 --queue_port=8301 43 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/filter/BaseFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.filter; 17 | 18 | import java.io.IOException; 19 | 20 | import javax.servlet.Filter; 21 | import javax.servlet.FilterChain; 22 | import javax.servlet.FilterConfig; 23 | import javax.servlet.ServletException; 24 | import javax.servlet.ServletRequest; 25 | import javax.servlet.ServletResponse; 26 | 27 | public class BaseFilter implements Filter { 28 | 29 | public void destroy() { 30 | 31 | } 32 | 33 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, 34 | ServletException { 35 | if (request.getCharacterEncoding() == null) { 36 | request.setCharacterEncoding("UTF-8"); 37 | } 38 | chain.doFilter(request, response); 39 | } 40 | 41 | public void init(FilterConfig filterConfig) throws ServletException { 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/util/RandomStringGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.util; 17 | 18 | import java.util.Random; 19 | 20 | public class RandomStringGenerator { 21 | 22 | private static Random random = new Random(System.currentTimeMillis()); 23 | 24 | public static String generate(int length) { 25 | StringBuilder sb = new StringBuilder(); 26 | for (int i = 0; i < length; ++i) { 27 | int k = RandomStringGenerator.random.nextInt(62); 28 | if (k < 10) { 29 | sb.append((char) ('0' + k)); 30 | } else if (k < 36) { 31 | sb.append((char) ('A' + k - 10)); 32 | } else { 33 | sb.append((char) ('a' + k - 36)); 34 | } 35 | } 36 | 37 | return sb.toString(); 38 | } 39 | 40 | public static String generate() { 41 | return RandomStringGenerator.generate(32); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /judge_client/client/text_checker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __TEXT_CHECKER_H__ 21 | #define __TEXT_CHECKER_H__ 22 | 23 | #include "checker.h" 24 | 25 | class TextChecker : public Checker { 26 | protected: 27 | // This function compares two text files and returns 28 | // 1. ACCEPTED 29 | // If these two files are exactly the same 30 | // 2. PRESENTATION_ERROR 31 | // If these two files are the same after normalization. 32 | // The file is normalized by 33 | // a) Removing all white spaces at the beginning or ending of lines 34 | // b) Removing all blank lines 35 | // c) Replacing all consecutive white space characters by a single space(0x20). 36 | // See the C library function "isspace" for the definition of white space characters. 37 | // 3. WRONG_ANSWER 38 | // Neither ACCEPTED nor PRESENTATION_ERROR 39 | // 4. -1 40 | // Any error occurs 41 | int InternalCheck(int sock); 42 | }; 43 | 44 | #endif // __TEXT_CHECKER_H__ 45 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/util/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.util; 17 | 18 | public class ConfigurationException extends Exception { 19 | 20 | /** 21 | *

22 | * Creates a ConfigurationException instance with the error message. 23 | *

24 | * 25 | * @param message 26 | * a descriptive message for this exception 27 | */ 28 | public ConfigurationException(String message) { 29 | super(message); 30 | } 31 | 32 | /** 33 | *

34 | * Creates a ConfigurationException instance with the error message and cause. 35 | *

36 | * 37 | * @param message 38 | * a descriptive message for this exception 39 | * @param cause 40 | * the cause of this exception 41 | */ 42 | public ConfigurationException(String message, Exception cause) { 43 | super(message, cause); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /judge_client/client/native_runner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __NATIVE_RUNNER_H__ 21 | #define __NATIVE_RUNNER_H__ 22 | 23 | #include "runner.h" 24 | #include "util.h" 25 | 26 | class TraceCallback; 27 | class Tracer; 28 | 29 | class NativeRunner : public Runner { 30 | public: 31 | NativeRunner(int sock, int time_limit, int memory_limit, int output_limit, int uid, int gid) 32 | : Runner(sock, time_limit, memory_limit, output_limit, uid, gid), base_memory_(0), base_time_(0) { 33 | } 34 | 35 | void SetBaseTime(int time) { this->base_time_ = time; }; 36 | void SetBaseMemory(int memory) { this->base_memory_ = memory; }; 37 | virtual void UpdateStatus(); 38 | 39 | protected: 40 | int base_memory_; 41 | int base_time_; 42 | 43 | virtual void InternalRun(); 44 | virtual StartupInfo GetStartupInfo(); 45 | virtual Tracer* CreateTracer(pid_t pid, Runner* runner); 46 | void RunProgram(const char* commands[]); 47 | 48 | friend class NativeRunnerTest; 49 | }; 50 | 51 | #endif // __NATIVE_RUNNER_H__ 52 | -------------------------------------------------------------------------------- /judge_client/script/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JUDGE_USER=65533 4 | JUDGE_GROUP=65533 5 | 6 | set -eu 7 | 8 | function CreateDir() { 9 | if [ -e "$1" ]; then 10 | if ! [ -d "$1" ]; then 11 | echo "$1" exists but is not a directory 12 | exit 1 13 | fi 14 | else 15 | mkdir "$1" 16 | fi 17 | chmod $2 "$1" 18 | } 19 | 20 | read -p "Input the directory to install ZOJ judge client [/home/chroot/zoj]:" dir 21 | if [ "$dir" == "" ]; then 22 | dir="/home/chroot/zoj" 23 | fi 24 | CreateDir "$dir" 755 25 | cp script/start.sh "$dir" 26 | cp script/stop.sh "$dir" 27 | cp script/rotate_log.sh "$dir" 28 | CreateDir "$dir/script" 755 29 | cp script/compile.sh "$dir"/script 30 | cp -f client/judged "$dir" 31 | cp -f client/JavaSandbox.jar "$dir" 32 | cp -f client/libsandbox.so "$dir" 33 | cp -f client/PythonLoader.py "$dir" 34 | cp -f client/PHPLoader.php "$dir" 35 | cp -f client/PerlLoader.pm "$dir" 36 | cp -f client/guile_loader "$dir" 37 | cp -f client/CustomJavaCompiler*.class "$dir" 38 | chmod +x "$dir"/*.sh 39 | chmod +x "$dir"/script/compile.sh 40 | chown -R $JUDGE_USER:$JUDGE_GROUP "$dir" 41 | chown 0:$JUDGE_USER "$dir/judged" 42 | chmod 4710 "$dir/judged" 43 | 44 | #if [[ "`cat /etc/group | grep '^zoj:'`" == "" ]]; then 45 | # groupadd zoj 46 | #fi 47 | #if [[ "`cat /etc/passwd | grep '^zoj:'`" == "" ]]; then 48 | # useradd -g zoj zoj 49 | #fi 50 | read -p "Create a symlink to rotate_log.sh in /etc/cron.daily? [y/n]" choice 51 | if [ "$choice" == "y" ] || [ "$choice" == "" ]; then 52 | if ! ln -s "$dir"/rotate_log.sh /etc/cron.daily/rotate_zoj_log; then 53 | echo "Fail to create the symlink. Please create it manually." 54 | fi 55 | else 56 | echo "Remember to put rotate_log.sh in your cron jobs otherwise the log file will be too large" 57 | fi 58 | -------------------------------------------------------------------------------- /judge_client/client/strutil.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #include "strutil.h" 21 | 22 | #include 23 | #include 24 | 25 | void SplitString(const string& str, char separator, vector* output) { 26 | int k = 0; 27 | for (int i = 0; i < str.size(); ++i) { 28 | if (str[i] == separator) { 29 | if (i > k) { 30 | output->push_back(str.substr(k, i - k)); 31 | } 32 | k = i + 1; 33 | } 34 | } 35 | if (k < str.size()) { 36 | output->push_back(str.substr(k, str.size() - k)); 37 | } 38 | } 39 | 40 | string StringPrintf(const char* format, ...) { 41 | va_list args; 42 | char buffer[1024]; 43 | va_start(args, format); 44 | vsnprintf(buffer, sizeof(buffer), format, args); 45 | va_end(args); 46 | return buffer; 47 | } 48 | 49 | string GetLocalTimeAsString(const char* format) { 50 | time_t t = time(NULL); 51 | struct tm tm; 52 | localtime_r(&t, &tm); 53 | char buf[1024]; 54 | strftime(buf, sizeof(buf), format, &tm); 55 | return buf; 56 | } 57 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/judgeservice/JudgingQueueIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.judgeservice; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 19 | 20 | /** 21 | * JudgingQueueIterator can be used to traverse all submissions judged and being judged since it construction. Because 22 | * the state of a submission being judged is not reflected in the database, this interface is very useful when querying 23 | * submissions from database. Before querying database, acquires a JudgingQueueIterator instance. After database results 24 | * are returned, iterates by this iterator and updates the results. 25 | * 26 | * This iterator is lock-free and never throws ConcurrentModificationException. 27 | * 28 | * @author Xu, Chuan 29 | * 30 | */ 31 | public interface JudgingQueueIterator { 32 | /** 33 | * Returns the next submission or null if reaches the end of queue. 34 | * 35 | * @return the next submission or null if reaches the end of queue. 36 | */ 37 | public Submission next(); 38 | } 39 | -------------------------------------------------------------------------------- /judge_server/src/tests/cn/edu/zju/acm/onlinejudge/judgeservice/MockSubmissionDAO.java: -------------------------------------------------------------------------------- 1 | package cn.edu.zju.acm.onlinejudge.judgeservice; 2 | 3 | import java.util.Hashtable; 4 | import java.util.Map; 5 | import java.util.concurrent.atomic.AtomicLong; 6 | 7 | import cn.edu.zju.acm.onlinejudge.bean.Submission; 8 | import cn.edu.zju.acm.onlinejudge.dao.SubmissionDAO; 9 | import cn.edu.zju.acm.onlinejudge.persistence.PersistenceException; 10 | 11 | public class MockSubmissionDAO extends MockDAO implements SubmissionDAO { 12 | 13 | private AtomicLong id = new AtomicLong(); 14 | 15 | private static Map submissionMap = new Hashtable(); 16 | 17 | public Submission getSubmission(long id) throws PersistenceException { 18 | return cloneSubmission(submissionMap.get(id)); 19 | } 20 | 21 | public void save(Submission submission, long contestId) throws PersistenceException { 22 | submission.setId(id.getAndIncrement()); 23 | update(submission, contestId); 24 | } 25 | 26 | public void update(Submission submission, long contestId) throws PersistenceException { 27 | submissionMap.put(submission.getId(), cloneSubmission(submission)); 28 | } 29 | 30 | private Submission cloneSubmission(Submission submission) { 31 | Submission ret = new Submission(); 32 | ret.setJudgeComment(submission.getJudgeComment()); 33 | ret.setContent(submission.getContent()); 34 | ret.setId(submission.getId()); 35 | ret.setLanguage(submission.getLanguage()); 36 | ret.setMemoryConsumption(submission.getMemoryConsumption()); 37 | ret.setProblemId(submission.getProblemId()); 38 | ret.setJudgeReply(submission.getJudgeReply()); 39 | ret.setTimeConsumption(submission.getTimeConsumption()); 40 | return ret; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /judge_server/web/jsp/language_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 | <%@ page import="cn.edu.zju.acm.onlinejudge.bean.enumeration.Language" %> 7 | <%@ page import="java.util.List" %> 8 |
Language
9 |
10 |
11 |
12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | <% 21 | List languages = (List) request.getAttribute("Languages"); 22 | for (int i = 0; i < languages.size(); ++i) { 23 | Language language = (Language) languages.get(i); 24 | %> 25 | "> 26 | 27 | 28 | 29 | 30 | 31 | <% 32 | } 33 | %> 34 |
IDNameDescriptionOptions
<%=language.getId()%><%=language.getName()%><%=language.getDescription()%><%=language.getOptions()%>
35 |
36 |
37 | 38 | -------------------------------------------------------------------------------- /judge_client/client/Sandbox.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #include 21 | #include "Sandbox.h" 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | #include 28 | 29 | #include "logging.h" 30 | #include "runner.h" 31 | #include "util.h" 32 | 33 | JNIEXPORT jint JNICALL Java_Sandbox_setLimits( 34 | JNIEnv* env, jclass jcls, jint time_limit, jint output_limit, jint file_limit, jint uid, jint gid) { 35 | if ((time_limit && SetLimit(RLIMIT_CPU, time_limit) < 0) || 36 | (output_limit && SetLimit(RLIMIT_FSIZE, output_limit * 1024) < 0) || 37 | (file_limit && SetLimit(RLIMIT_NOFILE, file_limit)) || 38 | (gid && setgid(gid) == -1) || 39 | (uid && setuid(uid) == -1)) { 40 | return -1; 41 | } 42 | return 0; 43 | } 44 | 45 | JNIEXPORT void JNICALL Java_Sandbox_closeLog(JNIEnv *, jclass) { 46 | Log::Close(); 47 | } 48 | 49 | JNIEXPORT void JNICALL Java_Sandbox_logError(JNIEnv* env, jclass jcls, jstring message) { 50 | const char* buf = env->GetStringUTFChars(message, 0); 51 | LOG(ERROR)<ReleaseStringUTFChars(message, buf); 53 | } 54 | -------------------------------------------------------------------------------- /judge_client/zunit/zunit.cc: -------------------------------------------------------------------------------- 1 | #define __NO_ZUNIT_MAIN__ 2 | #include "zunit.h" 3 | 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | namespace zunit { 10 | 11 | Runner::Runner(const string& name) : name_(name) { 12 | RunnerRegistry::GetInstance()->AddRunner(this); 13 | } 14 | 15 | Runner::~Runner() { 16 | } 17 | 18 | RunnerRegistry* RunnerRegistry::instance_ = 0; 19 | 20 | RunnerRegistry* RunnerRegistry::GetInstance() { 21 | if (instance_ == NULL) { 22 | instance_ = new RunnerRegistry(); 23 | } 24 | return instance_; 25 | } 26 | 27 | RunnerRegistry::~RunnerRegistry() { 28 | for (int i = 0; i < runners_.size(); ++i) { 29 | delete runners_[i]; 30 | } 31 | } 32 | 33 | void RunnerRegistry::AddRunner(Runner* runner) { 34 | runners_.push_back(runner); 35 | } 36 | 37 | int RunnerRegistry::RunAll() { 38 | vector > failures; 39 | for (int i = 0; i < runners_.size(); ++i) { 40 | cout<<"=============== "<name()<<" ==============="<Run(); 43 | cout<<"\x1b[32mPass\x1b[0m"<name(); 60 | failures[i].second->Print(cout); 61 | delete failures[i].second; 62 | } 63 | 64 | return failures.size() != 0; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /judge_server/web/jsp/judge_reply_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 | <%@ page import="cn.edu.zju.acm.onlinejudge.bean.enumeration.JudgeReply" %> 7 | <%@ page import="java.util.List" %> 8 |
Judge Reply
9 |
10 |
11 |
12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | <% 21 | List judgeReplies = (List) request.getAttribute("JudgeReplies"); 22 | for (int i = 0; i < judgeReplies.size(); ++i) { 23 | JudgeReply judgeReply = (JudgeReply) judgeReplies.get(i); 24 | %> 25 | "> 26 | 27 | 28 | 29 | 30 | 31 | <% 32 | } 33 | %> 34 |
IDNameDescriptionStyle
<%=judgeReply.getId()%><%=judgeReply.getName()%><%=judgeReply.getDescription()%>
35 |
36 |
37 | 38 | -------------------------------------------------------------------------------- /judge_server/docs/utf8.sql: -------------------------------------------------------------------------------- 1 | ALTER DATABASE zoj DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 2 | 3 | ALTER TABLE country DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 4 | ALTER TABLE user_profile DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 5 | ALTER TABLE user_preference DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 6 | ALTER TABLE confirmation DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 7 | ALTER TABLE role DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 8 | ALTER TABLE user_role DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 9 | ALTER TABLE contest_permission DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 10 | ALTER TABLE forum_permission DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 11 | ALTER TABLE permission_level DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 12 | ALTER TABLE contest DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 13 | ALTER TABLE language DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 14 | ALTER TABLE contest_language DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 15 | ALTER TABLE limits DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 16 | ALTER TABLE problem DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 17 | ALTER TABLE submission DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 18 | ALTER TABLE judge_reply DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 19 | ALTER TABLE forumDEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 20 | ALTER TABLE thread DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 21 | ALTER TABLE post DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 22 | ALTER TABLE referenceDEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 23 | ALTER TABLE reference_typeDEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 24 | ALTER TABLE contest_referenceDEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 25 | ALTER TABLE problem_referenceDEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 26 | ALTER TABLE forum_reference DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 27 | ALTER TABLE configurationDEFAULT CHARACTER SET utf8 COLLATE utf8_bin; 28 | 29 | -------------------------------------------------------------------------------- /judge_client/client/strutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __STRUTIL_H__ 21 | #define __STRUTIL_H__ 22 | 23 | #include 24 | #include 25 | 26 | using namespace std; 27 | 28 | // Splits str by separator and puts the results in output. 29 | void SplitString(const string& str, char separator, vector* output); 30 | 31 | // Like ssptrinf except that returns a string instead of outputing the result in the provided buffer. 32 | string StringPrintf(const char *format, ...); 33 | 34 | // Returns true if str starts with suffix 35 | static inline bool StringStartsWith(const string& str, const string& prefix) { 36 | return prefix.size() <= str.size() && str.substr(0, prefix.size()) == prefix; 37 | } 38 | 39 | // Returns true if str ends with suffix 40 | static inline bool StringEndsWith(const string& str, const string& suffix) { 41 | return suffix.size() <= str.size() && str.substr(str.size() - suffix.size()) == suffix; 42 | } 43 | 44 | // Returns the string representation of the current local time in the specified format. The format string the same as 45 | // the one used in strftime(). 46 | string GetLocalTimeAsString(const char* format); 47 | 48 | 49 | #endif // __STRUTIL_H__ 50 | -------------------------------------------------------------------------------- /judge_server/web/jsp/forgot_password_content.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=utf-8" language="java" %> 2 | <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> 3 | <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 | <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 5 | <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 6 | 7 | 8 |
9 | 10 |
11 |
12 |
Forgot Password
13 |
14 | 15 |
16 |
17 |
18 | <% 19 | String handle = (String) request.getAttribute("handle"); 20 | String email = (String) request.getAttribute("email"); 21 | Boolean ok = (Boolean) request.getAttribute("ok"); 22 | if (((handle != null && handle.trim().length() > 0) || 23 | (email != null && email.trim().length() > 0)) && ok == Boolean.TRUE) { 24 | %> 25 |

An email had been sent to your email.

26 | <% } else { %> 27 |

Fill your handle or email blow. We will send an email to you.

28 |
29 |

30 | handle or
31 | email  
32 | <% if (ok == Boolean.FALSE) { %> 33 | no such user. 34 | <% } %> 35 | 36 |

37 |
38 | <% } %> 39 |
40 |
41 | -------------------------------------------------------------------------------- /judge_client/client/runner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __RUNNER_H__ 21 | #define __RUNNER_H__ 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | class Runner { 28 | public: 29 | Runner(int sock, int time_limit, int memory_limit, int output_limit, int uid, int gid) 30 | : sock_(sock), 31 | time_limit_(time_limit), 32 | memory_limit_(memory_limit), 33 | output_limit_(output_limit), 34 | uid_(uid), 35 | gid_(gid), 36 | pid_(-1), 37 | result_(-1), 38 | time_consumption_(0), 39 | memory_consumption_(0) { 40 | } 41 | 42 | virtual ~Runner(); 43 | 44 | // Runs the specified program. Returns 0 if execution succeeded, or -1 on error. 45 | int Run(); 46 | 47 | int GetMemoryLimit() { return memory_limit_; }; 48 | 49 | 50 | protected: 51 | virtual void InternalRun() = 0; 52 | 53 | int SendRunningMessage(); 54 | 55 | int sock_; 56 | int time_limit_; 57 | int memory_limit_; 58 | int output_limit_; 59 | int uid_; 60 | int gid_; 61 | pid_t pid_; 62 | int result_; 63 | int time_consumption_; 64 | int memory_consumption_; 65 | }; 66 | 67 | #endif // __RUNNER_H__ 68 | -------------------------------------------------------------------------------- /judge_client/client/script_runner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 Li, Cheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __SCRIPT_RUNNER_H__ 21 | #define __SCRIPT_RUNNER_H__ 22 | 23 | #include "native_runner.h" 24 | #include "script_initializer.h" 25 | 26 | class TraceCallback; 27 | 28 | class ScriptRunner : public NativeRunner { 29 | public: 30 | ScriptRunner(int sock, int time_limit, int memory_limit, int output_limit, int uid, int gid, int language_id) 31 | : NativeRunner(sock, time_limit, memory_limit, output_limit, uid, gid), commands(NULL) { 32 | initializer_ = ScriptInitializer::create(language_id); 33 | } 34 | 35 | ~ScriptRunner() { 36 | delete initializer_; 37 | } 38 | 39 | void SetCommands(const char** commands) { this->commands = commands; }; 40 | void SetLoaderSyscallMagic(unsigned long id, int count); 41 | 42 | protected: 43 | virtual void InternalRun(); 44 | virtual StartupInfo GetStartupInfo(); 45 | virtual Tracer* CreateTracer(pid_t pid, Runner* runner); 46 | 47 | ScriptInitializer* initializer_; 48 | const char** commands; 49 | unsigned long loader_syscall_magic_id_; 50 | int loader_syscall_magic_left_; 51 | 52 | friend class ScriptRunnerTest; 53 | }; 54 | 55 | #endif // __SCRIPT_RUNNER_H__ 56 | -------------------------------------------------------------------------------- /judge_client/client/environment.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Xu, Chuan 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * ZOJ is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with ZOJ. if not, see . 18 | */ 19 | 20 | #ifndef __ENVIRONMENT_H__ 21 | #define __ENVIRONMENT_H__ 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | class Environment { 28 | public: 29 | static const Environment* GetInstance(); 30 | 31 | const string& root() const { 32 | return root_; 33 | } 34 | 35 | string GetWorkingDir() const; 36 | 37 | int ChangeToWorkingDir() const; 38 | 39 | void ClearWorkingDir() const; 40 | 41 | string GetProblemDir(int problem_id, int revision) const; 42 | 43 | string GetCompilationScript() const; 44 | 45 | string GetLogDir() const; 46 | 47 | string GetServerSockName() const; 48 | 49 | string GetClientSockName() const; 50 | 51 | private: 52 | Environment(const string& root) : root_(root) { 53 | } 54 | 55 | static Environment* instance_; 56 | 57 | string root_; 58 | 59 | friend class CompilerTest; 60 | friend class ControlMainTest; 61 | friend class ExecJudgeCommandTest; 62 | friend class ExecCompileCommandTest; 63 | friend class ExecTestCaseCommandTest; 64 | friend class CheckDataTest; 65 | friend class ExecDataCommandTest; 66 | friend class JudgeMainTest; 67 | }; 68 | 69 | #endif // __ENVIRONMENT_H__ 70 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/persistence/PersistenceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.persistence; 17 | 18 | /** 19 | *

20 | * The PersistenceException exception is used to wrap any persistence implementation specific exception. This exception 21 | * is thrown by the those persistence interface implementations. 22 | *

23 | * 24 | * @version 2.0 25 | * @author Zhang, Zheng 26 | */ 27 | public class PersistenceException extends Exception { 28 | 29 | /** 30 | *

31 | * Creates a PersistenceException instance with the error message. 32 | *

33 | * 34 | * @param message 35 | * a descriptive message for this exception 36 | */ 37 | public PersistenceException(String message) { 38 | super(message); 39 | } 40 | 41 | /** 42 | *

43 | * Creates a PersistenceException instance with the error message and cuase. 44 | *

45 | * 46 | * @param message 47 | * a descriptive message for this exception 48 | * @param cause 49 | * the cause of this exception 50 | */ 51 | public PersistenceException(String message, Exception cause) { 52 | super(message, cause); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /judge_server/src/main/cn/edu/zju/acm/onlinejudge/util/ProblemsetRankList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Zhang, Zheng 3 | * 4 | * This file is part of ZOJ. 5 | * 6 | * ZOJ is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision. 8 | * 9 | * ZOJ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with ZOJ. if not, see 13 | * . 14 | */ 15 | 16 | package cn.edu.zju.acm.onlinejudge.util; 17 | 18 | import cn.edu.zju.acm.onlinejudge.bean.UserProfile; 19 | 20 | public class ProblemsetRankList { 21 | 22 | private int offset = -1; 23 | private int count = -1; 24 | private UserProfile[] users; 25 | private int[] solved; 26 | private int[] total; 27 | 28 | public ProblemsetRankList(int offset, int count) { 29 | this.offset = offset; 30 | this.count = count; 31 | } 32 | 33 | public int getOffset() { 34 | return this.offset; 35 | } 36 | 37 | public int getCount() { 38 | return this.count; 39 | } 40 | 41 | public UserProfile[] getUsers() { 42 | return this.users; 43 | } 44 | 45 | public void setUsers(UserProfile[] users) { 46 | this.users = users; 47 | } 48 | 49 | public int[] getSolved() { 50 | return this.solved; 51 | } 52 | 53 | public void setSolved(int[] solved) { 54 | this.solved = solved; 55 | } 56 | 57 | public int[] getTotal() { 58 | return this.total; 59 | } 60 | 61 | public void setTotal(int[] total) { 62 | this.total = total; 63 | } 64 | 65 | } 66 | --------------------------------------------------------------------------------