wiki:HackingTutorial

Hacking Tutorial

This page aims to put you quick at work. It shows you how to start hacking @ info-arena.

Please note that your code changes will not be visible online but rather to the other developers that update their local working copy. From time to time we will decide together whether we should update the production code.

Requirements

To get a complete local install of the info-arena website you need the following:

  • MySQL 5 database server. Please do not use a different MySQL unless you're sure of using only compatible features.
  • Apache web server with at least mod_rewrite (it's included in most apache packages).
  • PHP 5 (not 4), for the website.
  • A  Subversion client (read below)

The evaluator only works on linux systems (security related code is not remarkably portable). You can work on the website just fine even without a functional evaluator however.

Here is a list of packages for linux distros: (Try make a list you can just cut&paste)

  • Debian/Ubuntu?:
    [sudo] apt-get install apache2 php5-cli libapache2-mod-php5 php5-mysql php5-gd php5-curl \
                           wdg-html-validator subversion mysql-server mysql-client gnuplot \
                           imagemagick texlive-latex-base
    
  • Windows (I know it's not a distro):  WAMP5 or another apache/php/mysql bundle.

The site will also use the fileinfo and zip php extensions, if you have them. Installing them can be a bit difficult (it often means compiling by hand) so they're not absolutely required. Also php5-curl and wdg-html-validator are not absolutely required, but you need them at least to run tests, which is a very good idea.

Subversion

First of all, you need to get a copy of the source code from the svn repository ( http://hackers.devnet.ro/dav-svn/trunk). We use WebDAV for subversion access. You can find the latest development tree (infoarena2) in source:trunk/. The complete url to the latest tree is  http://hackers.devnet.ro/dav-svn/trunk/. If for some reason you are behind some nazi firewall which blocks webdav you can use the same url with https (just accept the bogus certificate) and it will most likely work.

Linux users can just do

svn co http://hackers.devnet.ro/dav-svn/trunk

.  TortoiseSVN is a wonderful windows-only Subversion client that works as a shell extension. We highly recommend using this if you are not familiar with Subversion. There are other subversion clients out there, please consult their documentation to find out how to do a checkout.

Setting up the site

It used to be that setting up a local working copy required you to dig through a bunch of config files and write an apache2 conf by hand. This is no longer the case; your best bet is to go with

./scripts/setup.php

. It will ask you a bunch of questions and build the config files. It can also configure apache and load the SQL dump. It can't check dependencies, see above for what packages you need to install.

For Windows, make sure you have the <mysql_install_dir>\bin directory in your PATH and libmysql.dll copied in windows\system32 (you can get the dll from mysql install dir). Also, php needs to be installed as an apache module. After all requirements are checked and the repository checked out, you can run the setup-win.php script: from a console, with your current directory in 'scripts', run 'php setup-win.php'. (if php is not in PATH, use the absolute link: most likely c:\php\php.exe)

There is a page about the config files, but it's hideously out of date.

Due to changes in the database structure, you must also run the scripts utf8 and live-eval (from scripts directory).

Making Changes

Before making any changes, make sure you have read and understood the coding standards.

Only certain users have write permissions (commit) over the repository, but a few good contributions should get you an account.

However, if you do not have the right permissions you can create patches instead (with svn diff in linux, or create patch from TortoiseSVN context menu) and create tickets. Somebody will see the ticket, review the patch and accept or reject it. If you make several good contributions then you will be granted commit permission.

If your first patches get rejected, try not to get discouraged, we will explain why we rejected it and what needs to be changed.

If you don't know what to work on, try looking at some tickets. Try to choose something that sounds small and easy. Don't worry someone else might be working on the same thing, it rarely happens.

If you have any questions feel free to ask us.