Skip to content

A Java-based command-line utility for managing code submissions to UVA Online Judge.

License

Notifications You must be signed in to change notification settings

andrey-yemelyanov/uva-utility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JUva

A Java-based command-line utility for managing code submissions to UVA Online Judge. Written in Java, it can run on all platforms.

Credit for the idea belongs entirely to lucastan who was the first to implement a similar tool - UVA NODE.

Installation

Make sure you have JDK/JRE and Ant installed your computer.

  1. Clone uva-utility repo.
  2. Navigate to the project folder and run ant. This will build JUva.
  3. Navigate to the folder where the code for your UVA problems resides.
  4. Launch the application by entering java -jar {pathToProject}/build/jar/JUva.jar.

You might want to create a bash script that will launch JUva without needing to specify the java command. Here is juva.bat script on my Windows machine that starts up JUva.

@echo off
java -jar C:\uva-utility\build\jar\JUva.jar

Just add the folder where the script is located to your PATH environment variable and type juva in your command prompt to launch JUva.

After launching the application you will be prompted to enter your UVA username and password. Note that the password is stored encrypted, only locally, on your computer. You will need to set up paths to your browser and editor. You might also have to specify proxy server.

Once you initialized JUva with your UVA username/password, JUva will remember those and use them next time you launch the application.

Features

JUva supports the following commands:


browser (set {browserPath} | get)

Configures a browser to be used when e.g. viewing problems or launching discussion board for a specific problem.


discuss {problemId}

Launches a browser and loads a discussion board for supplied problem id.


edit ({problemId} | {filePath})

Launches editor and loads a code file corresponding to problem id or file path. If the file does not exist, it will be created using a template (if any). Currently JUva allows working with the files that have extension: cpp, cpp11, java, c, py, pas.

Note that JUva expects that all code files will contain a problem id in their name. E.g. _123_SearchingQuickly.java or 123.cpp. This is how JUva will be able to infer for which problem id you are submitting code to UVA.


editor (set {editorPath} | get)

Configures editor to be used when opening problems for editing.


exit

Exits JUva.


help

Prints a list of available commands and their descriptions.


path

Echoes current working directory.


proxy (set {hostname port} | get | rm)

Configures proxy server to be used when connecting to UVA.


stats

Displays 3 latest UVA submissions for the current user.


submit ({problemId} | {filePath})

Submits a code file for specific problem id to UVA. If you supply only problem id, JUva will attempt to derive file name. If more than one file match problem id, you will be prompted to supply file name instead.


tpl (add {tplPath} | show | rm {lang})

Configures templates for new code files. E.g. 'template.cpp' identifies a template that will be applied when a new C++ file is created.

Template engine currently supports the following dynamic variables:

  • ##problem_id## - replaced with file name without extension.
  • ##problem_url## - replaced with the URL to the problem pdf file on UVA judge.
  • ##problem_name## - replaced with problem name.
  • ##username## - replaced with name of the user who created the file.

Here is an example Java template I have on my computer under the name JavaTemplate.java

import java.util.*;
import static java.lang.Math.*;
import java.util.stream.*;

/*
Problem name: ##problem_name##
Problem url: ##problem_url##
Author: ##username##
*/
public class ##problem_id## {
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);

  }
}

Suppose you I want to create a new Java file with code for problem 11957 - Checkers. I will start by typing edit _11957.java. JUva will then create a new file with that name and apply the above-mentioned template. Note how file name begins with the underscore character. This is because Java does not allow creating classes whose name begins with a numeric character. The following file content will be created:

import java.util.*;
import static java.lang.Math.*;
import java.util.stream.*;

/*
Problem name: 11957 Checkers
Problem url: https://uva.onlinejudge.org/external/119/11957.pdf
Author: Andrey Yemelyanov
*/
public class _11957 {
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);

  }
}

udebug {problemId}

Launches a browser and loads UDebug for supplied problem id.


use {username}

Changes current user context (username and password) that will be used when communicating with UVA and UHunt.


users (add {username} | show | rm {username})

Manages UVA users. Users are saved as a pair (username->password). Password is stored only on your local machine using AES encryption.


view {problemId}

Launches a browser and loads a description for supplied problem id.


About

A Java-based command-line utility for managing code submissions to UVA Online Judge.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages