GithubHelp home page GithubHelp logo

seri / gettc Goto Github PK

View Code? Open in Web Editor NEW
99.0 99.0 19.0 1.48 MB

TopCoder offline arena supporting multiple languages

Home Page: http://seri.github.io/gettc/

Ruby 6.21% HTML 87.17% Go 0.30% Python 0.75% Shell 0.99% Makefile 0.59% C++ 0.71% Haskell 0.60% Java 1.82% JavaScript 0.87%

gettc's People

Contributors

dunpyl avatar seri avatar seri-ea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gettc's Issues

gettc 1650 can't get wanting result.

https://community.topcoder.com/tc?module=ProblemDetail&rd=4490&pm=1650
for Single Round Match 140 Round 1 - Division II, Level One
https://community.topcoder.com/tc?module=ProblemDetail&rd=5069&pm=1650
for Single Round Match 194 Round 1 - Division II, Level One
so at this problem I need to try gettc pm=1650 rd=5069
because gettc pm=1650 rd=4490 can't get we needed result.
as a author,can you tell me how to change rd, so I can use gettc 1650 rc=5069 to get I wanting result.

gettc as web application

Dear Seri,

I know the whole purpose of gettc is to test top coder questions offline and I have no problem using gettc offline. I am looking at an alternate situation where I test a small set Java Code in ruby web application online. I am thinking of using gettc to retrieve the folders (for the problem id) and then uploading the folders to my web application. Would I still be able to run the test cases for those folders online? do you have a work around for my situation?

Error gettc initialize

After instaling gettc in ubuntu 18.01 i got this error

➜  topcoder$ gettc
Traceback (most recent call last):
	8: from /usr/local/bin/gettc:23:in `<main>'
	7: from /usr/local/bin/gettc:23:in `load'
	6: from /var/lib/gems/2.5.0/gems/gettc-2.0/bin/gettc:81:in `<top (required)>'
	5: from /var/lib/gems/2.5.0/gems/gettc-2.0/bin/gettc:36:in `init'
	4: from /var/lib/gems/2.5.0/gems/gettc-2.0/bin/gettc:36:in `new'
	3: from /var/lib/gems/2.5.0/gems/gettc-2.0/lib/gettc/download.rb:89:in `initialize'
	2: from /var/lib/gems/2.5.0/gems/gettc-2.0/lib/gettc/download.rb:206:in `get_cookie'
	1: from /var/lib/gems/2.5.0/gems/gettc-2.0/lib/gettc/download.rb:206:in `new'
/var/lib/gems/2.5.0/gems/gettc-2.0/lib/gettc/download.rb:206:in `initialize': wrong number of arguments (given 2, expected 0..1) (ArgumentError)
➜  topcoder 

gettc does not work - Gives wrong username/password error

It appears that something has changed at Topcoder side. See below for the error that I get.

gettc 13072
You have given ID = 13072
Wrong username or password
Account: gettc|algorithm
Cookie: {"JSESSIONID"=>["daUymWbrVaii10yNQ4KdNw**.tomcat_tc01"], "Path"=>["/", "/"], "knu"=>["true"], "Expires"=>["Sat", "Sat"], "tcsso"=>["23003471|e478f65a47e28317bd283ebe87d2163760a745a9c3637523fa5755c788eec53"], "Domain"=>["topcoder.com"]}

Case 0 ... 1ms Error

[gettc] Compile solver
[gettc] Compile checker
[gettc] Run test cases
Case 0 ... 1ms Error
Case 1 ... 1ms Error
Case 2 ... 1ms Error
[gettc] Summary
3 cases checked, 0 failures, 3 errors
Errors: 0, 1, 2
Total time taken: 3 ms
Average time taken: 1 ms
Slowest running case: 1 ms (case 0)

I am getting the following error when I give the command gettc 14072

C:\Users\Varun>gettc 14072
C:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:in connect': SSL_connect returned=1 e rrno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL ::SSL::SSLError) from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:inblock in connect'
from C:/Ruby200/lib/ruby/2.0.0/timeout.rb:51:in timeout' from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:inconnect'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:861:in do_start' from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:850:instart'
from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:582:in start' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/gettc-2.0/lib/gettc/download.rb :159:inconnect'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/gettc-2.0/lib/gettc/download.rb
:176:in post_json' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/gettc-2.0/lib/gettc/download.rb :198:inget_cookie'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/gettc-2.0/lib/gettc/download.rb
:89:in initialize' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/gettc-2.0/bin/gettc:36:innew'

    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/gettc-2.0/bin/gettc:36:in `init

'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/gettc-2.0/bin/gettc:81:in <top (required)>' from C:/Ruby200/bin/gettc:23:inload'
from C:/Ruby200/bin/gettc:23:in `

'

No such file or directory - /usr/local/bin/../dist/.

I installed Ubuntu 11.10, and then installed ruby1.9.1 and gettc. However, when I ran "gettc 11138", I got the following error:

$ gettc 11138
You have given ID = 11138
No such file or directory - /usr/local/bin/../dist/.

I found that after manually change a line of /usr/local/bin/gettc to the following
default_d = '/var/lib/gems/1.9.1/gems/gettc-1.1.1/dist/.'
Then gettc works fine.

Is there any way that the script can automatically detect that directory? Thanks!

Some cases failed to download

For a few problem ID's, we get the errors, and no directory is created.
For example,
$ gettc 4589
You have given ID = 4589
Downloading problem to raw HTML ... Done
Parsing problem from raw HTML ... no implicit conversion from nil to integer

$ gettc 6620
You have given ID = 6620
Downloading problem to raw HTML ... Done
Parsing problem from raw HTML ... bad URI(is not URI?): http://www.topcoder.com/contest/problem/BackyardTrees/BackyardTrees1.png] [img:http://www.topcoder.com/contest/problem/BackyardTrees/BackyardTrees2.png

Thanks!

A bug in runner.sh

I found a bug in bin/runner.sh. In many places of runner.sh, "==" is used for testing equality, however, it seemed that "=" should be used instead (maybe a difference between C++ and BASH).

Thanks!

Failed to acquire a JWT token

Got the following error in initialize in download.rb on Windows 10:

$ gettc 14461
F:/Ruby/rb225/ruby/lib/ruby/gems/2.2.0/gems/gettc-2.0/lib/gettc/download.rb:190:in `get_cookie': Failed to acquire a JWT token (Gettc::AuthTokenError)
Account: gettc|algorithm
Server Response:
{
  "error": {
    "name": "Internal Server Error",
    "value": 500,
    "description": "Something is broken. Please contact support.",
    "details": "the connection was disabled"
  },
  "serverInformation": {
    "serverName": "TopCoder API",
    "apiVersion": "0.0.1",
    "requestDuration": 889,
    "currentTime": 1483867621994
  },
  "requesterInformation": {
    "id": "9bbc56f94ec5eec27bcec4172cb29e92c7181ed4-RX2pqfbjnwcPLD3y",
    "remoteIP": "10.250.4.231",
    "receivedParams": {
      "username": "gettc",
      "password": "algorithm",
      "apiVersion": "v2",
      "action": "generateJwt"
    }
  }
}
        from F:/Ruby/rb225/ruby/lib/ruby/gems/2.2.0/gems/gettc-2.0/lib/gettc/download.rb:89:in `initialize'
        from F:/Ruby/rb225/ruby/lib/ruby/gems/2.2.0/gems/gettc-2.0/bin/gettc:36:in `new'
        from F:/Ruby/rb225/ruby/lib/ruby/gems/2.2.0/gems/gettc-2.0/bin/gettc:36:in `init'
        from F:/Ruby/rb225/ruby/lib/ruby/gems/2.2.0/gems/gettc-2.0/bin/gettc:81:in `<top (required)>'
        from F:/Ruby/rb225/ruby/bin/gettc:22:in `load'
        from F:/Ruby/rb225/ruby/bin/gettc:22:in `<main>'

Same problem for other IDs.

undefined local variable

../../bin/runner.rb:170:in `block in print_failures': undefined local variable or method `j' for #<GettcRu
nner:0x00000000ac1ac0> (NameError)
        from ../../bin/runner.rb:167:in `times'
        from ../../bin/runner.rb:167:in `print_failures'
        from ../../bin/runner.rb:177:in `run'
        from ../../bin/runner.rb:182:in `<main>'

I changed print_case j to print_case case_id which seemed to fix it

I don't know who that code belongs to, but the bug does appear in this repository when grepping for print_case j

Installing gettc in macbook air

My old laptop was dead, and I got a macbook air, which installs ruby and rubygems by default (version 1.8.7). I installed xcode command line tool which includes gcc-4.2. I downloaded the source of gettc using git and then typed "sudo rake", and got the following errors:

....
WARNING: no rubyforge_project specified
gettc requires hpricot (>= 0, runtime)

I then typed "gettc", the bash complained "command not found". Could you give me a hint about what had happened? Thanks!

AddElectricalWiresRunner.cpp:1:20: fatal error: topcoder: No such file or directory

My AddElectricalWiresRunner.cpp looks like

include

using namespace TopCoder;

include "AddElectricalWires.cpp"

include

using namespace std;

int main(int argc, char const *argv[]) {
try {
ifstream ifs(argv[1]);
vector wires; read(ifs, wires); next(ifs);
vector gridConnections; read(ifs, gridConnections);
ifs.close();

    ofstream ofs(argv[2]);
    show(ofs, maxNewWires(wires, gridConnections));
    ofs.close();
} catch (exception &e) {
    cerr << e.what() << endl;
}
return 0;

}
I have all the required softwares installed including boost.How can this issue be figured out?

Adding support for Rust, OCaml, and Racket

Hi Seri,
I still sometimes use your tool to solve problems in my favorite language (Haskell), but I am wondering if you could add support for Rust, OCaml, and Racket.

Cheers,
Mukesh

Returns of type double was incorrectly evaluated

For some problems that have double's as output, the tests of gettc can incorrectly fail. One example is http://community.topcoder.com/stat?c=problem_statement&pm=3561&rd=6519.

For the test case 3, the expected value was "7.637495090348122E7", and the result "76374950.9050914" was deemed incorrect.
However, according to the FAQ (http://apps.topcoder.com/wiki/display/tc/SRM+Algorithm+Competition+FAQ), any answer with absolute or relative error of 1e-9 can still be deemed correct.

Thanks!

HTML processing for ascii "images"

There are quite a few topcoder problem descriptions that contain ascii "images", that is, 2D images made of purely ascii symbols. Some examples are "ChessCover" (ID 202), "Checkers" (ID 204) etc. For these cases, those ascii images are distorted in the HTML files converted by gettc.

I guess using ascii symbols to display 2D images in HTML files is awkward anyway. So never mind if it's not easy to handle such cases. Thanks!

Method signature parsing error resulted in template failure

When method signature is not present, stderr is printed and the erb is failing to convert the template to file.

Example problem method signature:

Definition
--
  | Class:ChessMetricMethod:howManyParameters:int, int[], int[], intReturns:longMethod signature:long howMany(int size, int[] start, int[] end, int numMoves)(be sure your method is public) | Class: | ChessMetric | Method: | howMany | Parameters: | int, int[], int[], int | Returns: | long | Method signature: | long howMany(int size, int[] start, int[] end, int numMoves) | (be sure your method is public)
Class: | ChessMetric
Method: | howMany
Parameters: | int, int[], int[], int
Returns: | long
Method signature: | long howMany(int size, int[] start, int[] end, int numMoves)
(be sure your method is public)

Sample error output:

gettc 1592
ChessMetric was used for TopCoder Collegiate Challenge Round 4 - Division I, Level One.
[Warning] No definition for method signature found
Template error ($HOME/.gettc/template/solve/go/{name}Solver.go)
undefined method `map' for nil:NilClass

Another problem which causes the same issue:

Definition
--
  | Class:JewelryMethod:howManyParameters:int[]Returns:longMethod signature:long howMany(int[] values)(be sure your method is public) | Class: | Jewelry | Method: | howMany | Parameters: | int[] | Returns: | long | Method signature: | long howMany(int[] values) | (be sure your method is public)
Class: | Jewelry
Method: | howMany
Parameters: | int[]
Returns: | long
Method signature: | long howMany(int[] values)
(be sure your method is public)

ID not available <id> error

When I try gettc some_id, it says "download problem to raw html ... id not available .
I did put correct values in .gettc/config.yml file.

Wrong username or password

I have specified correct username/password (I can log in topcoder.com with them) in ~/.gettc/config, but still get Wrong username or password error.
Any hints?

'initialize': wrong number of arguments

Environment
Mac OS X 10.11.4
ruby installed using brew

When I run gettc, I'm getting the following error. I'm getting the same error for all gettc commands that I try to run like gettc reset

[~/tet] % gem -v
2.6.8
[~/tet] % ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15]
[~/tet] % gem install gettc  
Fetching: gettc-2.0.gem (100%)
Successfully installed gettc-2.0
Parsing documentation for gettc-2.0
Installing ri documentation for gettc-2.0
Done installing documentation for gettc after 0 seconds
1 gem installed
[~/tet] % gettc 11127      
/usr/local/lib/ruby/gems/2.4.0/gems/gettc-2.0/lib/gettc/download.rb:206:in `initialize': wrong number of arguments (given 2, expected 0..1) (ArgumentError)
	from /usr/local/lib/ruby/gems/2.4.0/gems/gettc-2.0/lib/gettc/download.rb:206:in `new'
	from /usr/local/lib/ruby/gems/2.4.0/gems/gettc-2.0/lib/gettc/download.rb:206:in `get_cookie'
	from /usr/local/lib/ruby/gems/2.4.0/gems/gettc-2.0/lib/gettc/download.rb:89:in `initialize'
	from /usr/local/lib/ruby/gems/2.4.0/gems/gettc-2.0/bin/gettc:36:in `new'
	from /usr/local/lib/ruby/gems/2.4.0/gems/gettc-2.0/bin/gettc:36:in `init'
	from /usr/local/lib/ruby/gems/2.4.0/gems/gettc-2.0/bin/gettc:81:in `<top (required)>'
	from /usr/local/bin/gettc:22:in `load'
	from /usr/local/bin/gettc:22:in `<main>'
[~/tet] %

Python 3 support

Python 3 support, topcoder supports python now, but the java interface looks horrible and is really buggy. It would be great to do things offline.

I reinstalled gettc, and now it throwing error

➜  SRM 756 git:(master) ✗ gettc 11127
Traceback (most recent call last):
	6: from /usr/local/bin/gettc:23:in `<main>'
	5: from /usr/local/bin/gettc:23:in `load'
	4: from /Library/Ruby/Gems/2.6.0/gems/gettc-2.1/bin/gettc:81:in `<top (required)>'
	3: from /Library/Ruby/Gems/2.6.0/gems/gettc-2.1/bin/gettc:36:in `init'
	2: from /Library/Ruby/Gems/2.6.0/gems/gettc-2.1/bin/gettc:36:in `new'
	1: from /Library/Ruby/Gems/2.6.0/gems/gettc-2.1/lib/gettc/download.rb:85:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/gettc-2.1/lib/gettc/download.rb:156:in `get_cookie': Failed to acquire a JWT token (Gettc::AuthTokenError)
Account: sahiltiwari|
Server Response:
{
  "error": {
    "name": "Internal Server Error",
    "value": 500,
    "description": "Something is broken. Please contact support.",
    "details": "the connection was disabled"
  },
  "serverInformation": {
    "serverName": "TopCoder API",
    "apiVersion": "0.0.1",
    "requestDuration": 487,
    "currentTime": 1581934478618
  },
  "requesterInformation": {
    "id": "some hex code information here",
    "remoteIP" my ip address ",
    "receivedParams": {
      "username": "sahiltiwair",
      "password": "I do not want any one to know password :)",
      "apiVersion": "v2",
      "action": "generateJwt"
    }
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.