AlexDmitriev's blog

By AlexDmitriev, 4 years ago, In English,

Hi, Codeforces.

Changelog:

  • 0.15
    • Fixed running in newer CLion versions
    • Move debug/release changer to the combobox with run configurations.
  • 0.14
    • Update Chelper dependency to support Competitive companion extension.

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.

Source code | known bugs | bugtacker | instructions

 
 
 
 
  • Vote: I like it  
  • +64
  • Vote: I do not like it  

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Code generation is currently broken in public EAP of CLion. issue on GH

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I was testing and I got a problem, can you help me ?

http://snag.gy/AifUx.jpg

Thanks in advance.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Did you create output configuration? See wiki for more details.

»
4 years ago, # |
  Vote: I like it -16 Vote: I do not like it

CHelper for Java and JHelper for C++. Interesting names :D

»
4 years ago, # |
Rev. 15   Vote: I like it 0 Vote: I do not like it

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!

  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it +6 Vote: I do not like it

    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

    • »
      »
      »
      4 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      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!

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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!

      • »
        »
        »
        »
        4 years ago, # ^ |
        Rev. 2   Vote: I like it +1 Vote: I do not like it

        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:)

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          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?

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it +1 Vote: I do not like it

            Well, it took some time:)

            But I believe it will be easier to port my code to python then Java code to C++.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Added parsers from CHelper(currently only parser from IDE, not from Chrome) including CodeForces.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Chrome extension supported.

For those who use other browsers (Firefox?): it should be quite easy to write similar extension. Almost no logic is required.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can this be integrated with sublime too?

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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...

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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:

    Make possible to call JHelper action. Yo should do one or both of the following:

    • Add icons of actions to menu or toolbar. Click to the toolbar-Customize menus and toolbars-Main menu/toolbar-Add after-Plugins-JHelper-select all
    • Add shortcuts for actions. Preferences-Keymap-Plugins-JHelper

    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:) )

»
3 years ago, # |
  Vote: I like it +16 Vote: I do not like it

CLion version 1.0 is released

»
3 years ago, # |
Rev. 6   Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Hi

    1. TopCoder is currently not supported. It is in plans but it doesn't really make sense to do it right now while unused coffee elimination is so unstable due to unused code rule
    2. Usually I just delete all tasks between contests. I'm going to do some sort of archivation, but it haven't been done yet.
    3. Could you post stack trace and say when it happens?
    4. Unfortunately there's currently no convenient way to do that. I'm open to your ideas.
      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
    static bool needcalculate = true;
    if(need calculate) {
    needcalculate = false;
    //calc what you need
    }
    

    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.

»
3 years ago, # |
  Vote: I like it +5 Vote: I do not like it

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 toWinMain' /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 2

Other 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.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      It works perfectly now. Thanks a lot for your great software! :)

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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)

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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 :)

»
22 months ago, # |
  Vote: I like it +14 Vote: I do not like it

Currently it's known not to work correctly with CLion 2016.3, I'll try to fix this ASAP

  • »
    »
    22 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Is this fixed? (I have updated CLion to 2016.3 :( )

    • »
      »
      »
      22 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Sorry, but not yet and I'm not sure I'll be do that tally quickly

  • »
    »
    22 months ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    I've added several fixes, it seems to work now.

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there any way to disable the auto comment system?

  • »
    »
    10 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If you mean "code generated" header, no, there's no way to disable it, as far as I remember

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Note, that CLion 2017.3 is not currently supported

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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?

»
9 months ago, # |
  Vote: I like it -10 Vote: I do not like it

Help Post, Why my solution was getting WA? Problem My Solution. Why WA Plz Help me. To Find Out Plz.

»
4 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

CLion says,

Error running 'testrunner': Cannot run 'testrunner' on ''

while I am running a TaskX.cpp file after parsing A contes problems.... :(

Link

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Unfortunately last versions of CLion is not (yet) supported. The last supported version is 2017.2 Which version do you use?

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      ok...thank you. I'm using the latest version 2018.1.3...About when would we get the latest version support?

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        No specific plans now, sorry. When I fight my laziness of when somebody will do it instead of myself

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      does it support clion 2017.2.3 ?

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Yes

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          is there any crome extensions for parse task?? i found chelper parse task crome extensions but it's not working for jhelper.

          • »
            »
            »
            »
            »
            »
            3 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Cheaper plugin should work. Also there is competitive companion

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          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?

          • »
            »
            »
            »
            »
            »
            3 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I don't think that's doable now. You can move to different folders after you solved probably

            • »
              »
              »
              »
              »
              »
              »
              3 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              is there anyway to use scanf, and printf instead of in, out ?

              • »
                »
                »
                »
                »
                »
                »
                »
                3 months ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                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.

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Now, this problem is (I believe fixed) with JHelper 0.15 and CLion 2018.2

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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 ?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +10 Vote: I do not like it

      yes i see eliminate code and reformat code, what does each one do exactly ?

      • »
        »
        »
        »
        3 months ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        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.

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          the problems with eliminate unused code -> are they because a certain way of coding that i may avoid while i write my code ??

          • »
            »
            »
            »
            »
            »
            3 months ago, # ^ |
            Rev. 2   Vote: I like it 0 Vote: I do not like it

            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.

            • »
              »
              »
              »
              »
              »
              »
              3 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              so the general tip here is no templates, yeah!

              • »
                »
                »
                »
                »
                »
                »
                »
                3 months ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                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.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 months ago, # ^ |
                  Rev. 4   Vote: I like it 0 Vote: I do not like it

                  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 ?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 months ago, # ^ |
                  Rev. 3   Vote: I like it 0 Vote: I do not like it

                  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

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 months ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  this is my small lib file https://imgur.com/JGMzVcy

                  this is my task file https://imgur.com/ym71reV i called only gcd function

                  this output file https://imgur.com/69QqEb9 bpow function appeared with no reason

                  this is find usages in output file for bpow https://imgur.com/rAGJAyf usages only are in library and output and no usages in tasks folder !!

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 months ago, # ^ |
                    Vote: I like it +10 Vote: I do not like it

                  i think i figured the problem.

                  all recursive functions are included even if i didn't use them, and non recursive functions are removed.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 months ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  That's a reasonable explanation

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 months ago, # ^ |
                    Vote: I like it -10 Vote: I do not like it

                  hope u fix it soon, thanks for your help

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 months ago, # ^ |
                    Vote: I like it +31 Vote: I do not like it

                  I'm ready to review your PR.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

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