Hi, Codeforces.
- 0.18
- CopyAction now regenerates output file
- 0.17
- Support for inline inlining for topcoder
- 0.16.4
- Support for WSL
- 0.16.3
- Support CLion 2020.1
- 0.16.2
- Support CLion 2019.1
- 0.16
- Auto switching to a file when changing task
- Auto selecting task when changing a file
JHelper is plugin for writing contests in C++. You may inline code from your own prewritten library so that you can submit only used code. Besides, it allows to test on tests you've added. it's planned that you'll be able to parse a problem/contest and have all samples tests automatically added.
It's available for CLion
Plugin is completely free. IDE price is 89$/year, but it's free for students, have 30-days free trial and often you can use EAP(smth like beta)-versions for free.
You may download the plugin using JetBrains plugin repository or manually from their site
Some explanations how to use that on wiki. Fell free to ask what is unclear.
Please post bugs and feature requests here or in bug tracker.
Your contributions are also welcome. Possible ways to contribute:
- Post bugs or feature requests
- Make wiki more understandable
- Implement something and create pull request.
It's still possible to make it multilingual (I mean add another programming languages). I am open to discuss that.
Thanks Egor for idea with his Chelper and Abra for some code review.
Code generation is currently broken in public EAP of CLion. issue on GH
is there any documentation to know how to use it, please.
Yes, there's a wiki.
Seems to be working now without any fix from me.
I was testing and I got a problem, can you help me ?
http://snag.gy/AifUx.jpg
Thanks in advance.
Did you create output configuration? See wiki for more details.
CHelper for Java and JHelper for C++. Interesting names :D
Hello Alex, Thanks for making such a tool, and I am trying to set it up to use with CLion. I am having trouble setting up the plugin to generate the code. I have tried following the instructions on the wiki but unfortunately I do not fully understand them I think. I get the following error: Task file not found: Seems your task is in inconsistent state If you could provide any help it would be very much appreciated. Thanks again for the time you spent making this tool!
Well, you need to create files that are in those boxes and add them in CMakeLists to appropriate configurations.
I've created example project where it's seems to work: Link to Github
Awesome thank you so much for quick response and help! I downloaded the repository and imported it as a new project and everything works now! Have been using java for all my contests so far with Chelper, but can't wait to now to get better at c++ and use it in contest too with your plugin. Again many thanks for your work!
Also, just one more quick question if you don't mind. In Chelper there is archive button for tasks that one is done with. What is the best way of replicating that workflow in JHelper? Does one just create a folder and then drag the Task.cpp file and Task.task file there when you are done with problem? Thanks!
Probably, right now is the easiest way to do that. I'm going to implement this in more convenient way but I'm afraid it'll happen not very soon. I usually just delete them:)
Right, makes sense. Just out of curiosity how much work was it to get the plugin to the current state in terms of hours? At some point I would be interested in trying myself to port JHelper/CHelper to PyCharm for use with Python. I imagine it is a decent amount of work to get everything functional, yes?
Well, it took some time:)
But I believe it will be easier to port my code to python then Java code to C++.
Added parsers from CHelper(currently only parser from IDE, not from Chrome) including CodeForces.
Chrome extension supported.
For those who use other browsers (Firefox?): it should be quite easy to write similar extension. Almost no logic is required.
Can this be integrated with sublime too?
I don't think so. It uses API provided by JetBrains IDEs
Could you please give me some hints about how can I add a problem / contest, how to solve the problem (coding, testing and submitting) with JHelpr in Clion?
I've study your wiki, but I need more obvious details!
Thanks...
First of all you should configure project (or you may download example project from github)
To add new task you need either use "Add Task" (manually add name and tests) action or Parse contest action (parse tests from Online judge). To make them available you should either add them on toolbar/menu or enable shortcuts for them.
Fro wiki:
Then cpp file with class will be created, you should code here. To run you just choose run configuration and run:)
Feel free to ask for clarification if it's not clear (but it's better to try first all because some actions are harder to explain than to do:) )
CLion version 1.0 is released
Awesome work! Couple of questions:
1. Does Topcoder work with this?
2. What is the usual workflow? For every problem(or contest I parse), it tries to make it TaskA, so should I delete my TaskA every-time.
3. I keep getting many "IllegalArgumentException: childPath should be inside a parentPath", though nothing breaks.
4. Where to write stress-test code(like brute-force program and tester/generator)?
5. In GCJ contest, if I select multi-tests with number of tests known, how to get test case number?
6. Where to write pre-processing code, common to all test cases.
Hi
6. You may either put the code in the ctor of solver (and save in member vars) or do that during first function call with static boolean var like
The first way is preferable because it will be called for each test (I mean for each test consisting of several test cases).
5. See 6, you should have testNumber var status either filled by ctor or static var.
This is the screenshot: http://postimg.org/image/8gw88dl4b/
This error is on the left side.
C:\Users\Bat-Orgil.clion10\system\cygwin_cmake\bin\cmake.exe --build C:\Users\Bat-Orgil.clion10\system\cmake\generated\cc361857\cc361857\Debug --target all -- -j 4 Scanning dependencies of target output Scanning dependencies of target test Scanning dependencies of target testrunner [ 33%] [ 66%] [100%] Building CXX object CMakeFiles/output.dir/output/main.cpp.o Building CXX object CMakeFiles/test.dir/tasks/TaskA.cpp.o Building CXX object CMakeFiles/testrunner.dir/testrunner/main.cpp.o Linking CXX executable output.exe Linking CXX executable test.exe /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libcygwin.a(libcmain.o): In function
main': /usr/src/debug/cygwin-2.2.0-1/winsup/cygwin/lib/libcmain.c:39: undefined reference to
WinMain' /usr/src/debug/cygwin-2.2.0-1/winsup/cygwin/lib/libcmain.c:39:(.text.startup+0x7f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `WinMain' collect2: error: ld returned 1 exit status [100%] Linking CXX executable testrunner.exe CMakeFiles/test.dir/build.make:85: recipe for target 'test.exe' failed make[2]: *** [test.exe] Error 1 CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/test.dir/all' failed make[1]: *** [CMakeFiles/test.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... Built target output [100%] Built target testrunner Makefile:75: recipe for target 'all' failed make: *** [all] Error 2Other side has this error for every 5 seconds.
2:00:54 PM NullPointerException: update failed for AnAction with ID=name.admitriev.jhelper.actions.SwitchCMakeConfigurationAction
I think I have sth wrong with run/debug configuration. Can you check it? Thanks. Let me know if you need any other details.
First of all, change target (on the setting page opened on the screenshot) from build all to testrunner. If that doesn't help please post content of testrunner/main.cpp
It works perfectly now. Thanks a lot for your great software! :)
As for right side: it should not affect anything, but please post stack trace so that I am able to identify the error (click on error message for that)
Released support for local regex input type. Tested only on MacOS, should probably work on Linux.
Please let me know if somebody was able to run it under Windows :)
Currently it's known not to work correctly with CLion 2016.3, I'll try to fix this ASAP
Is this fixed? (I have updated CLion to 2016.3 :( )
Sorry, but not yet and I'm not sure I'll be do that tally quickly
I've added several fixes, it seems to work now.
Is there any way to disable the auto comment system?
If you mean "code generated" header, no, there's no way to disable it, as far as I remember
Note, that CLion 2017.3 is not currently supported
Recently when my programs print a lot or the testcase input is large, the program often terminates prematurely (but with exit code 0), only in the CLion (2017.2) run field, not in the Debug terminal... Did anyone else encounter this problem?
CLion says,
Error running 'testrunner': Cannot run 'testrunner' on ''
while I am running a TaskX.cpp file after parsing A contes problems.... :(
Link
Unfortunately last versions of CLion is not (yet) supported. The last supported version is 2017.2 Which version do you use?
ok...thank you. I'm using the latest version 2018.1.3...About when would we get the latest version support?
No specific plans now, sorry. When I fight my laziness of when somebody will do it instead of myself
does it support clion 2017.2.3 ?
Yes
is there any crome extensions for parse task?? i found chelper parse task crome extensions but it's not working for jhelper.
Cheaper plugin should work. Also there is competitive companion
installation don'e successfully, thanks for your great plugin. is there anyway to save tasks by folders ? each oj has its own folder. or task names become -> "ojName+taskName". can i do any of that?
I don't think that's doable now. You can move to different folders after you solved probably
is there anyway to use scanf, and printf instead of in, out ?
No ( at least no easy way ). Note that when you are testing, it's actually a stringstream. Just add sync_with_stdio(false) and cin.tie (nullptr) and forget about scanf as scary tail.
Now, this problem is (I believe fixed) with JHelper 0.15 and CLion 2018.2
i wrote a small math library in mymath.h and when i used some function i found all the functions written in output file(main.cpp). is there any way to just include the function i called ?
There's setting that allow to remove unused code, but it doesn't work well, so I don't recommend it.
You may place them in different headers and then only files you included will be added.
yes i see eliminate code and reformat code, what does each one do exactly ?
The first one is trying to eliminate unused code, but it has problems (code can become incorrect). The other is reformatting your code according to coding style configured in IDE (basically the same as clicking ctrl+alt+L.
the problems with eliminate unused code -> are they because a certain way of coding that i may avoid while i write my code ??
Well, the main issue is in using templates, e.g like in this issue
Anyway if you want, you may try it, but be ready to turn it off when you get CE. Probability of having other problems (like getting wrong answer) is rather low.
so the general tip here is no templates, yeah!
Well, I don't think "not using templates like
std::vector
with custom types" is better tip than "not using option to eliminate code" but you may choose what fits you best.i have a lib that has func1, func2, func3, and i called only func3, but for some reasons that i don't know, i found that func1 and func3 are included in main.cpp but func2 aren't included although there is no call of func1 in func3.
do you know why ?
No, not really.
My code is pretty straightforward. It just finds all the functions that are unused in generated file according to what CLion reports. So, the most probable problem is that CLion shows some pace where it's used. You may try "find usages" IDE function in generated file to check place where it thinks it's used (because it should use the same mechanism).
PS: Honestly, I don't think it's reasonable to spend time investigating why it doesn't work, but you can read the code here
i think i figured the problem.
all recursive functions are included even if i didn't use them, and non recursive functions are removed.
That's a reasonable explanation
hope u fix it soon, thanks for your help
I'm ready to review your PR.
For everybody interested: (I think) I fixed the problem with new version of CLion. After the plugin moderation version 0.15 should work fine with CLion 2018.2
Added some tips&tricks on configuring templates according to your needs.
riadwaw Can you please explain me the 4th step in Configuration section? Where is the configuration window? Please explain whole step :)
If you did step 2, one of the action is called configuration (and its icon is gearwheel)
It would be great if you could add a video tutorial for basic setup. Most of the steps are too tough to execute manually.
I'm afraid I won't be able to do something more understandable then written instructions I already made
Can you describe some of the advantages of Jhelper. I wanted to know somethings like — can we directly submit from jhelper to codeforces, are testcases automatically fetched from codeforces to clion etc. And also if I face some issues while configuring then where can i get some solutions.
please sir make a video ,how to configure it and run it.i cant figure out
This is a great Tool!!! Can you tell me how can I remove the comments on the output file?
_/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ _
How can I remove these lines? I am using the jhelper-example-project.
You can't, you can change only name in author field
riadwaw, please, please, please, publish on Youtube a screencast of a creation of sample project for a contest. Instructions would be much more understandable
It is saying template 'task' is not found. what could be the problem?
Is jhelper plugin supported in clion 2.5 ?
what is Clion 2.5 ? you mean 2019.2.5? Yes, it should work
2020.1 is not supported yet, make sure not to update if you are going to use jhelper
fixed
Started getting error "Couldn't parse any task: Maybe format changed?" on codeforces only, it is working for codechef though. (Using competitive companion, 2.15.0, Checking on github repo of competitive companion reveals that there have been some changes to codeforces problem parser recently)
Would you please make a video tutorial or described elaborately how to configure and use it with an example?
No, thanks.
Egor added partial support for topcoder in v0.17 (currently under jetbrains premoderation): you still have to test code using other plugin (such as moj), but you can use your library and inline code using new action "Process file"
cc people who asked about topcodet support before: amitsaharana, iensen
PS: a good example how you can add a feature you want.
riadwaw What new action "Process file" does? Can you show one example please ?
It inlines all the code in current file (so that if you use library code, the file is ready for submission). it is created to use in cases where you can't (or don't want to) use Tasks directly for example with TopCoder
riadwaw, is there any wiki how to configure it? I would like to know where those cpps needs to be saved.
I was looking around and tried to figure out how to debug using JHelper. I found a closed GitHub issue (https://github.com/AlexeyDmitriev/JHelper/issues/39), and I couldn't figure out how to. If anyone knows how to use the CLion debugger, while using JHelper, I'd appreciate it if you could point me in the right direction. Whenever I added breakpoints, they got skipped over, I tried on my Task.cpp file, testrunner/main.cpp, and output/main.cpp, with their respective configurations, and I couldn't get it working.
It works for me when I add breakpoints directly in Task.cpp and I click "Debug" button (not "Run" button). You may need to switch to Debug mode so that most of your code is not optimized.
I think I just configured something wrong, as I’m on Debug, and not Release, and it just skips over breakpoints completely, I think I’m going to try a fresh install of CLion.
does it work for you for projects and targets unrelated to jhelper?
Yeah, on my normal non-JHelper projects, it works.
You can also try to add normaltarget in Jhelper project, e.g add test_debug.cpp and
add_executable(test_debug test_debug.cpp)
to CMakeLists.txt.It it doesn't work for this target, then you probably need to find differences in configuration of toolchain and/or debugger between the projects
If it does, I have no idea what could be wrong.
Okay, thank you very much, I’m also going to testing with the sample project, to see if I setup something wrong with CLion overall.
I replaced my cmake-build-debug with the jhelper-example-projects cmake-build-debug, and modified the required files, and it works nows. Thank you so much!
I am glad it works now.
I want to use clion for free, How to do that, not a varsity student.
you can use EAPs https://www.jetbrains.com/clion/nextversion/ (see 203.5981.40 here) when they are available (I think it's available like 1/2-3/4 part of the year).
There are other, more legally questionable ways which I'd rather not discuss
Using competitive companion, I can make the test case be the sample input. How do I add my own test cases?
There's "Edit tests" action, where you can do that in UI.
How to use actions, check wiki
Thank you!!
Did anyone use JHelper for Topcoder? Do I have to create task manually?
Also please let me know if I should ask in different discussion. Thanks.
There's no direct topcoder support, but if somebody used it with topcoderz fill free to share your approach
I used with KawigiEdit, saved source code and opened with Clion (example)
The problem I'm trying to solve is — how do I create a JHelper task out of this source code (saved by topcoder plugin — KawigiEdit in your case)?
Could you please share exact steps you follow? Thanks.
how to used my debugging template in CLion like how to get its output and where, what changed do I need to do in run.template or anywhere else ?