drswad / fastolympiccodinghook Goto Github PK
View Code? Open in Web Editor NEWProblem test-case parser for sublime text from various online judges. Depends on Competitive Companion and FastOlympicCoding.
Problem test-case parser for sublime text from various online judges. Depends on Competitive Companion and FastOlympicCoding.
Hi DrSwad , Is there a feature to automatically check the correct answers for the respective test cases?
And Can we parse a contest using sublime and competitive programming hook and fast olympic coding?
Hello , This is not working on my machine. What can I do?
I cloned from git hub rep. There is a option in my sublime text "listen competitive companion" and I set my port as 12345 as you mentioned.
What can I do ??
I am unable to view the result of the test cases when they are being parsed from codeforces. The system just builds and waits for me to enter an input. I have kept the port as 12345.
Also you mentioned the output will come in __filename.cpp but I can't find that anywhere.
I will be really grateful if you will help me.
companion is not able to parse the test cases after the latest update of sublime text
Package control upgraded to 4.0 in sublime, and meanwhile the latest build of FastOlympicCodingHook no longer parsed the test cases. Had to revert to the older version and immediately worked again. Please help revert to the old build (without the change for the latest one contributed by the other person), so it won't auto upgraded to the "bad version" again.
By the way, here is the working version that I revered to and proved to be working:
import sublime
import sublime_plugin
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import _thread
import threading
import platform
def MakeHandlerClassFromFilename(filename):
class HandleRequests(BaseHTTPRequestHandler):
def do_POST(self):
try:
content_length = int(self.headers['Content-Length'])
body = self.rfile.read(content_length)
tests = json.loads(body.decode('utf8'))
tests = tests["tests"]
ntests = []
for test in tests:
ntest = {
"test": test["input"],
"correct_answers": [test["output"].strip()]
}
ntests.append(ntest)
nfilename = filename + ":tests"
if platform.system() == "Windows":
nfilename = filename + "__tests"
print(nfilename)
with open(nfilename, "w") as f:
f.write(json.dumps(ntests))
except Exception as e:
print("Error handling POST - " + str(e))
threading.Thread(target=self.server.shutdown, daemon=True).start()
return HandleRequests
class CompetitiveCompanionServer:
def startServer(filename):
host = 'localhost'
port = 12345
HandlerClass = MakeHandlerClassFromFilename(filename)
httpd = HTTPServer((host, port), HandlerClass)
httpd.serve_forever()
print("Server has been shutdown")
class FastOlympicCodingHookCommand(sublime_plugin.TextCommand):
def run(self, edit):
try:
_thread.start_new_thread(CompetitiveCompanionServer.startServer,
(self.view.file_name(),))
except Exception as e:
print("Error: unable to start thread - " + str(e))
Hey hi ... I have been using this tool at windows machine for quite a while now and it is the exact thing I was looking for but I have ran of a problem now .
I have switched to ubuntu and using the same things as I did for my previous machine .. This thing is not parsing the data in my cppFastOlympicCoding plugin ..
I would be available to give any further information u would require for the same and would really request u to look into my query becz this is one thing without which I cant really code my way into cp ...
Regards
The problems files are always stored in some other path. It should be stored in a folder that I want.
How to change the destination folder?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.