Egor's blog

By Egor, 6 years ago, translation, In English,
1. Installation
You need to download plug-in and configuration. Plug-in should go to %home_dir%\.IntelliJIdea10\config\plugins (if directory plugins is absent you need to create it), also you should include chelper.jar to class path of your project (Project Structure -> Dependencies -> Add Single Entry Module Library...). After that you need to edit configuration (see next section) and put it in project root. That's it — you are all set. For TopCoder you would need moj plugin for Arena, manual and download link is here

2. Configuration
As a general note, if some property in configuration represents a folder you must enter relative path from project root (using / instead of )
inputClass - full qualified name of class used for input (like java.util.Scanner). This class should implement method next that returns String — next token from input — and it should have constructor that takes InputStream as only argument
outputClass - full qualified name of class used for output (like java.io.PrintWriter). Ouput class shoud has constructor, that take OuputStream and one that take Writer as parameter and also method close.
excludePackages - comma separated list of package prefixes. Classes from such packages would not be inlined but rather imported. In most cases you should leave it as is
outputDirectory - directory where full source code would be stored. Should be under source and in default package (for example, if you create standart idea project, "src" spould be ok)
author - content of @author tag in. If empty no author tag would be created
archiveDirectory - directory where tasks would be archived. Should not be under source
defaultDirectory - direcory where tasks would be created by default. Should be under source in non-default package (for example src/my/package)
topcoderDirectory - directory where moj puts its TopCoder stubs. Should be under source in default package (e.g. src)
enableUnitTests - should be true if you want unit tests to be created and false otherwise
testDirectory - directory where tests would be stored. Shoud be under source
After configuration change you need to reload project for changes to take effect

3. Actions
I would recommend to add following actions on main toolbar (Customize Menus and Toolbars... from context menu of toolbar, actions are in Plug-ins->CHelper): New Task, Edit Tests, Archive Task, Delete Task, Create Codeforces Tasks.



New Task (Alt+F2) — creates new task in defaultDirectory
Edit Tests (Alt+F5) — opens test editor

Archive Task (Alt+F6) — archives task (deletes all it files and stores them in archive, also creates unit tests if configured to do so)
Delete Task - deletes task and all associated files
Parse Contest - creates all tasks for particular contest (currently Codeforces, CodeChef, E-Olimp and Timus are supported).

Parse Task - creates single task.

Site Contest ID Problemset task ID Contest task ID
Codeforces contest_id (131) contest_id letter (131 A) contest_id letter (131 A)
CodeChef contest_code (NOV11) problem_code (GCD2) contest_code problem_code
(NOV11 DOMNOCUT)
Timus contest_id (101) problem_id (1000) contest_id problem_number (101 1)
Copy Source (Alt+F8) — copies content of Main.java to clipboard. This is useful for judges that do not support submission of file

4. New Task dialog

Name - task class name
Test type - type of tests — either single test per file, number of tests and then tests themselves or just some tests until some condition is met. You need to throw UnknownError in last case to indicate that there would be no more tests
Input type/Output type - input/output type. Standard — stdin/stdout, Task_id — file input/output with file names %Name%.toLowerCase() + ".in"/".out", Custom — just file input/output, names provided in separate text fields
Heap memory - memory limit
Stack memory - stack size limit (defaults are same as codeforces)

5. Task files
For each task 2 files is creates. In main task class there is one method:
void solve(int testNumber, %input% in, %output% out)
testNumber — 1-based index of test in file
In checker class there are 3 methods:
String check(%input% input, %input% expected, %input% actual)
should return null if answer is correct, non empty string if answer is wrong and empty string to run default checker
double getCertainty()
returns certainty for double comparision in default checker
Collection<? extends Test> generateTests()
additional generated tests

For TopCoder tasks the only class would contain method from problem statement. Task would be created automatically when you opens problem in TopCoder client (if moj properly configured)
 
 
 
 
  • Vote: I like it  
  • +29
  • Vote: I do not like it  

6 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Can I use IntelliJIdea to code in C++ ? Are there some plug-in to do that ?
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it
I have a problem,when go add actions , not show me plugin chelper :(,
  • 6 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it
    You either had not copied it to correct folder or had not restarted Idea since
    • 6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      thanks :=) is cool !
    • 4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I installed CHelper from Browse Repository and Restarted the IDE after that I Added All CHelper Icons after Main Toolbar From Menus and Toolbars and I opened Edit Project Settings And When I parse Contest And Press OK NullPointerException And Message null is generated I am not be able install It Correctly plz help me...sorry for my English

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

        Do you have any project open when you click on "Edit Project Settings"?

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

          Yes i have one project open which i created ...

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

            I have had the same problem till I right clicked main directory (Default Folder) and marked it as source, then everything now works. The project originally had only src folder marked as source as it was generated with the commandline project template in intelliJ

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

        I have the same problem with IntelliJIdea 14.0.3 and CHelper 3.94. Here is the Stack trace :

        null java.lang.NullPointerException at java.lang.String.replace(String.java:2227) at net.egork.chelper.util.CodeGenerationUtilities.createStub(CodeGenerationUtilities.java:277) at net.egork.chelper.util.FileUtilities.createTaskClass(FileUtilities.java:302) at net.egork.chelper.util.FileUtilities.createIfNeeded(FileUtilities.java:346) at net.egork.chelper.ui.ParseDialog$1.onOk(ParseDialog.java:69) at net.egork.chelper.ui.OkCancelPanel$1.actionPerformed(OkCancelPanel.java:16) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6525) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6290) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4881) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2739) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:719) at java.awt.EventQueue$4.run(EventQueue.java:717) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:716) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:748) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:573) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109) at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184) at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229) at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227) at java.security.AccessController.doPrivileged(Native Method) at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227) at java.awt.Dialog.show(Dialog.java:1084) at java.awt.Component.show(Component.java:1654) at java.awt.Component.setVisible(Component.java:1606) at java.awt.Window.setVisible(Window.java:1014) at java.awt.Dialog.setVisible(Dialog.java:1005) at net.egork.chelper.ui.ParseDialog.(ParseDialog.java:221) at net.egork.chelper.ui.ParseDialog.parseContest(ParseDialog.java:266) at net.egork.chelper.actions.ParseContestAction.actionPerformed(ParseContestAction.java:23) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:164) at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:169) at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:133) at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:312) at java.awt.Component.processEvent(Component.java:6290) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4881) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2739) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:719) at java.awt.EventQueue$4.run(EventQueue.java:717) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:716) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:748) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:573) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it
So, Egor, you are using IntelliJ IDEA as your main IDE for contests ?
Thx :D
»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I have some problems with your CHelper - plugin :-?

I've tried it with both IntelliJ IDEA 11 and 10, and I can't get it working
I did it in order :
1. Install IntelliJ IDEA 10
2. Copy chelper2.33.jar to config/plugins directory
3. Add CHelper's actions to the toolbar
4. Create new Java Module project (with src directory)
5. Copy chelper.properties to src directory
6. Add chelper2.33.jar to the new project's classpath
7. Try the Chelper's actions ... and it didn't work ...

Anybody has the same issue ?

Thx alot :)
  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    Had you restarted Idea after copying chelper.properties?
    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      yes, I had :(

      thx for your reply :D
      • »
        »
        »
        »
        6 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        Just noticed - you copied chelper.properties to src directory, but it should be in project root
        • »
          »
          »
          »
          »
          6 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it
          thank you for your support, it's working now :D

          oh, if i change my settings in chelper.properties, i will also restart the IDE too ?
          • »
            »
            »
            »
            »
            »
            6 years ago, # ^ |
              Vote: I like it +3 Vote: I do not like it
            Yep, would change it in next version
            • »
              »
              »
              »
              »
              »
              »
              6 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it
              oh, can i have another question, please ?

              How can I define my own Input Class ? Is there any "template" feature ?
              • »
                »
                »
                »
                »
                »
                »
                »
                6 years ago, # ^ |
                  Vote: I like it +3 Vote: I do not like it
                You just need to make sure that your class takes InputStream as argument and has method next, which returns next token from input as string. Everything else you can write as you like
                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  6 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it
                  I mean that how can I put my class definition automatically :-?

                  Should I copy & paste it manually to the Main.java ?
                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  6 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it
                  You just need to write class and put it somewhere under your source (e.g. in src/nova directory) and then fill nova.MyInputClass under inputClass in chelper.properties
                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  6 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it
                  thx to your helping, i've got it working :D

                  also thx for such an useful, and ... wow plug-in :D :D :D
                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  6 years ago, # ^ |
                  Rev. 2   Vote: I like it 0 Vote: I do not like it

                  deleted

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

                  I did the same thing as you suggested. I created a FastReader class under the src\myPackage folder and pointed the input class to "myPackage.FastReader". No complains from the configuration dialog box as intellisense worked, but the output I get is garbled as you can see in this gist I'm using IntelliJ 13

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

To Egor,

Your plugin have a few "bugs" with Topcoder SRM Task :D. I've used it on SRM 530 and 531 and found some issues :D

  1. CHelper can't "parse" the task. When I open a task, there is only moj created code file and it isn't parsed into CHelper's TopCoder Task. I had this issue with task UnsortedSequence (SRM 531 — Div 2 — 250 Task), another tasks just work fine :)

  2. Wrong example input/output parsed. I'm not sure it's CHelper's problem or just moj's :-?. Had this issue with task GogoXCake (SRM 530 — Div 2 — 500 Task), another tasks just work fine :)

Just a "report" for you :D, hope you will see and fix them soon :D

Again, thanks for such an useful plugin :D

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

    I'll look into it

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

    I too faced the same problem in 531 Div2 -250.

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

    For SRM 531 D2 250 empty arrays were handled incorrectly. I will fix this ASAP As SRM 530 currently unavailable I'll look into that later

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

There is problem on creating ,parsing contest,none function work from toolbar

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

    Please help me

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

    Nothing is working or only contest parsing?

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

      Now contest parsing work ,how will it generate automatically Main file,it is not working

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

        This is my chelper.properties file inputClass = java.util.Scanner outputClass = java.io.PrintWriter excludePackages = java.,javax.,com.sun. outputDirectory = src author = Vikash archiveDirectory = archive/unsorted defaultDirectory = src/My topcoderDirectory = topcoder testDirectory = lib/test enableUnitTests = false

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

        It should generate the Main file when you run or debug created configuration

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

          When I select contest id 131(or any) in codeforces it doesn't generate any thing in default directory

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

          Hi Egor. This is my configuration: default dir: src/main Archive dir: archive/unsorted Output dir: src Input class: net.egork.chelper.util.InputReader Output class: net.egork.chelper.util.OutputWriter

          When I click on Run the selected configuration, it successfully generates a Main.java file under src (so src/Main.java). The generated file includes the classes from your library but the methods are empty. This is what I get:

          class InputReader {
          
              public InputReader(java.io.InputStream stream) { /* compiled code */ }
          
              public int readInt() { /* compiled code */ }
          
              }
          

          So, I'm getting compile errors.

          I installed according to https://code.google.com/p/idea-chelper/wiki/MainPage Intellij IDEA 12.1.4 @ Windows

          any hints?

          UPD: If I leave the output dir empty, it compiles correctly:

          - before compiling, it yields "outputDirectory should be under source and in default package".
          
          - it then generates the file on the project root directory (so, on the same level as the src directory). The file still has empty methods for your library classes with /* compiled code */ bodies.
          - I created a sample case and it correctly showed me the results on the intellij console.
»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi Egor, Can you tell me how the inline functions work...I cannot figure it out..Suppose I have a method isPrime(int) that returns whether the number is prime or not.I want to use it directly and not write the whole thing everytime.I think the inline code does exactly this.But I dont know how to use it.Could you tell me or better demonstrate it with an example???

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

    You need to create some class, like IntegerUtils and create static method isPrime. Then you can use it in your solutions

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

      And where do I have to save that class??

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

        Anywhere it will be visible fromyour solution

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

          I created a class algorithms in src and a static method isPrime(Object a) in that.Then I compiled it. After that when I go to a Task and write boolean check=algorithms.isPrime((Object)a) ,then it is shown in red .i.e. it cannot compile...What should I do...Should I have to restart??

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

            Are you sure your method was public?

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

              Yes it is public...Do I have to change something in the properties file or put the class in a directory under the src??

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

                Well, it should be somewhere under source — just like for any Java project

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

                  Ok. now its working .When I created a new directory under src and put the class in it.Thanks for the replies and your time:-) The thing I dont like in this is that it is showing all the methods in that class even if it is not called but some other method of that class is called ..Can this be changed??

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

                  In the created source (the one you will submit to the server) all unused methods will be removed

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

                  When I submitted a problem in topcoder SRM 535 using IntegerUtils class it gave an error regarding too much unused code.I think that inline code is not working..Its definatley not working on codechef where I can see my submitted solution

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

                  That is bug in TopCoder algorithm, I receive that warning quite regular, but never had my submission judged as UCR violation after I started to use Java. Can you point to your codechef submit where inlining/unused code removal had not worked?

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

                  I have messaged it to you.

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

                  Check emotionalBlind's comment at the bottom, maybe you have same problem

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

I was solving a problem of Light OJ, but seems unused codes are not removed in my Main File.

Here is my code: http://ideone.com/gsgDb

Here readLong is not removed, which is actually unused.

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

    Strange, not repetable on my computer By the way, you can use Test Type: MULTI_TEST, that's exactly why that type was created

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

      Did you mean MULTI_NUMBER?

      BTW, do you suggest me to do anything to make unused code remove working? I'm using chelper2.33.

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

        Yes

        It seems for whatever reason Idea considers readLong method as used. Could you open your created source (i.e. Main.java) in Idea and see if method name is grayed out as unused or not?

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

          Yes, it was grayed out.

          But problem is resolved now.

          I changed outputDirectory = src from outputDirectory = src/output

          And now it's working. Sorry, I think I didn't read the instructions carefully.

          Thanks for this awesome software.

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

I changed the properties file and it does work for codeforces and codechef. And when I see my code at the topcoder practise arena it does indeed have the unused codes+every time I run the code for topcoder problems it gives a warning "OutPut directory should be under source and in defualt package " for only topcoder problems but then it runs...What should be done??

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

    I had the same problem but it seems I had not configured my directories correctly. Now, it's ok. My directories in properties are: outputDirectory = src, archiveDirectory = archive/unsorted, defaultDirectory = src/mypackage, topcoderDirectory = src And make sure moj outputs to your src directory. Thanks for the great plugin, Egor!

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

Thank you for your plugin. It's great.

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

Thank you for your great work! But I can't find the "%home_dir%.IntelliJIdea10configplugins" means, so I can't continue to set up this plugin in my PC corrcetly.. Help! Thank you!

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

    Launch IntelliJ and choose

    File -> Settings -> Plugins -> Install plugin from disk -> path_to_chelper2.41.jar

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

      Thank you for your reply! But I mean I don't know where to mkdir the IntelliJIdea10configplugins, that means I don't what "“%home_dir%" mean. Is it the Home directory "~/"? Thank you!

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

        I fixed path that got broken after markdown introduction

        Yes, that's home directory

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

          Oh, got it! Thanks all~

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

          BTW, in the Checker file, there are some imports I can not find in the project.. They are "import net.egork.chelper.task.Test; import net.egork.chelper.tester.Verdict;" And my config is " inputClass = lozy.InputReader outputClass = java.io.PrintWriter excludePackages = java.,javax.,com.sun. outputDirectory = src author = Lozy archiveDirectory = archive/unsorted defaultDirectory = src/cf topcoderDirectory = topcoder testDirectory = lib/test enableUnitTests = false " Is there any problem in my config file or should I do some other works? Thanks a lot!

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

            "...also you should include chelper.jar to class path of your project (Project Structure -> Dependencies -> Add Single Entry Module Library…)"

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

              Sorry for my carelessness... I didn't see the word "also"... Thank you for your reply and your time!

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

how can i use chelper in eclipse IDE ?

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

    Idea plugins are incompatible with Eclipse

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

Google

  1. That’s an error.

Request not allowed from your country That’s all we know.

Why? UPD: Fixed!I downloaded it whit VPN. :)

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

Why I can't open and Install ? I have installed Java before !

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

When I use static imports in Task class it will not appear in the generated Main class which will produce some compilation errors. Is there a fix (a way to have a predefined Main class)?

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

    Static imports are currently not supported

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

      Thanks.Is there a way to add permanently

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

      at the beginning of generated Main class?

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

Great plugin !

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

Egor How Can I change the template code that generates automatically in the main? solver class name?

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

    You can change solver class name (Main class name), but unable to change generated code

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

      some of the problem's input file is terminated by EOF. How can I handled those problem with CHelper regular test types? I've chose "Number of tests unknown" but it gives me RE :(

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

Egor, great thanks for your plugin, it makes me efficient! I use it on IDEA 12 on MacOS and I have 2 questions:

  1. Every time When I submit a task I have to change i/o streams otherwise, I receive next error during submission: java.lang.RuntimeException: java.io.FileNotFoundException: стандартный ввод (The system cannot find the file specified) at Main.main(Main.java:22)

  2. Sometimes during compilation I receive next error, only main.java removal fixes that: 17:48:32 IllegalStateException: Attempt to modify PSI for non-committed Document!: Attempt to modify PSI for non-committed Document!

Thank you for help!

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    1. Well, if judge uses stdin/stdout you should specify those in your task as well

    2. I need a look at you chelper.properties

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 3   Vote: I like it 0 Vote: I do not like it
      1. Can you give an example where it is better to do? I change only void solve method.
      2. My chelper.properties:
      inputClass = my.InputReader
      outputClass = java.io.PrintWriter
      excludePackages = java.,javax.,com.sun.
      outputDirectory = src
      author = MatFack
      archiveDirectory = archive/unsorted
      defaultDirectory = src/my
      topcoderDirectory = topcoder
      testDirectory = lib/test
      enableUnitTests = false
      

      Thank you a lot for help!

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

        On the first point you need to select "Standard stream" for input/output when you creating task. If you are parsing those should be correct automatically

        On second point — if you use up to date Idea/plugin — I just don't know what could be wrong

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

          Ok. I will update and double check. P.S. I am using IDEA 13.

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

In IDEA 13.1.1 I get the following exception when running a task:

17:20:01 IncorrectOperationException: Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor: Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor

Works OK in 13.0.

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

When i run the codeforces programm using chelper , I get null pointer exception net.egork.chelper.util.CodeGenerationUtilities$InlineVisitor.addClass(CodeGenerationUtilities.java:534)

My configuration file is: inputClass = net.egork.chelper.util.InputReader outputClass = net.egork.chelper.util.OutputWriter excludePackages = java.,javax.,com.sun. outputDirectory = src/output author = Himalay archiveDirectory = archive/unsorted defaultDirectory = src/main/mypackage topcoderDirectory = topcoder testDirectory = lib/test enableUnitTests = false

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

Is the plugin supposed to work for GCJ 2014? I am getting the following error when I try to parse a task:

7:37:09 PM CHelper: Unable to parse task B — Cookie Clicker Alpha. Connection problems or format change

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

    Seems like there was internal format change. Should have checked beforehand but forgot

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

Do you have any plans to update source code at https://code.google.com/p/idea-chelper/? It seems to be pretty outdated.

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

    For some reason actual code is in trunk brink, but it still need push from me

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

    And actual code should be in trunk branch now (through I'm planning to fix GCJ support soon)

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

Hello, thanks for the plugin ;) It makes some good, but, for me, it works only with TopCoder (not with contest with io).

I have described my problem (notSuchMethodException) here: http://stackoverflow.com/questions/23383595/chelper-plugin-nosuchmethodexception-error

Could you please look and help to track the problem?

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

    Your output writer class should have constructor that takes writer as parameter (and relays output there). You can use PrintWriter as output class

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

      It actually had, but after reinstalling plugin from scratch, un-cache-ing idea and doing other random stuff it started working, so sorry for disturbing and thanks again!

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

I have just started using Chelper , it works perfect with topcoder but with code forces it always don't take the first number in input if contains number i.e ( if input like this 5 4 1 1 1 1 it begins reading from 4 not 5 !!) any help please, i am using scanner for input

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

    Are you sure you do not select "Number of test known" when parsing tasks?

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

      oh yes i changed it to single test ... it works now thanks!

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

Hi Egor, I just configure CHelper plugin, everything is working good. But when i tried to Archive the files, its showing error that "Configuration not selected or selected configuration not supported". Can you please give your input about what could be the reason.

chelper.properties content: smartTesting=true archiveDirectory=archieve defaultDirectory=src/codeforces extensionProposed=true outputClass=java.io.PrintWriter excludePackages=java.,javax.,com.sun. outputDirectory=output author= libraryMigrated=true failOnIntegerOverflowForNewTasks=true inputClass=java.util.Scanner enableUnitTests=true testDirectory=lib/test

»
3 years ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it

Exception in thread "main" java.lang.IllegalAccessException: Class net.egork.chelper.tester.NewTester can not access a member of class InputReader with modifiers "public"

This is what I am getting after executing the debug code option. Any suggestions ..? Note : I am using InputReader and OutputWriter class from your code. @Egor

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

Does anybody have any insight into how to speed up running the task in Intellij? Right now I am using Egor's library (which is very helpful btw), and that seems to slow it down as it the compiler links things together I suppose. Overall it take between 15-25 seconds for solution to run for me right now, which is not terribly long but for competitions would be nice if it was a bit faster. I already removed all of my unused plugins and increased stack space but it doesn't seem to make a lot of difference. Has anyone found a way of speeding up Intellij?

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

    Your computer must be very old, since on my 7-years-old Core 2 Duo E6600 the project with Egor's library compiles pretty fast, in about 5 seconds. The same speed is shown by my primitive types collections library (see in my blog). But I once tried to use Trove library and got 15-20 seconds, they have quite large code with lots of abstract classes, which slows down code generation. These numbers are for IDEA 13, maybe your IDE is too old?

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

      Hm I am not sure if that is the case. I am using a 2012 Macbook Pro Retina, with IDEA 14, with all updates I think. Before installing Egor's library I was getting something like that with around 5 seconds. But anyway thanks for the response, maybe there is some setting that I accidentally enabled or something. Also I am using Java 8, I don't know if that makes a difference. I forget exactly but maybe with Java 7 it was faster.

  • »
    »
    3 years ago, # ^ |
    Rev. 7   Vote: I like it -8 Vote: I do not like it

    So just another thing I was wondering about is it fine to have the yaal library under the src folder? I would think that it does not make a difference, but just want to make sure that it does not force some additional recompile or something of the library. Just additional bit of information is that when say I compile topcoder task that does not call from the library (topcoder because codeforces always uses input/output from library) it takes about 1-2 seconds. However as soon as I call a method it can increase to as much as 20 seconds. Just wanted to make sure that this directory setup with the library and everything is the same way that everybody else is doing it. And also another question because I just noticed this but what does the number 4 by the Chelper project folder mean? Thanks!

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

      You should try marking your archive folder as excluded ;)

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

@Egor The last update did work for me. But I would like to know how to reach EOF without compilation error with this plugin or what would be the proper way to reach EOF.

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

I get this when trying to create tasks by parsing contests on Codeforces

"NotificationException: Task file not found: Seems your task is in inconsistent state"

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

Hi Egor , All tools [Create Task , Parse Contest ,all] not working. please help to solve following error :
NoSuchMethodError: com.intellij.psi.JavaPsiFacade.findClass(Ljava/lang/String;)Lcom/intellij/psi/PsiClass;
Screenshot https://drive.google.com/file/d/0B13U1Ij8LVrFUzY1MmhUalBadDQ/view?usp=sharing

Thanks for nice plugin.

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

Would be cool if it worked. When creating a "new task" without parsing, i'm only getting the class file. No .task file is created so I can't run the files or the tests. Remember this working a year or so back with an older version.

I just had a new setup. With src\default as my default directory on IntelliJ Idea 15.0.2

However, when I do "parse task", it's getting created.

»
6 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
  1. I am not able to parse Contest of Hackerrank, Codechef, Atcoder and Hackerearth. Will these be added later?
  2. I don't like to use Scanner class but CHelper have default as Scanner. How to change it? P.S. I am using CHelper 4.1.7(available on Repositories of JetBrains)
  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Those sites are parsed using chrome extension, you can find it in chrome store

    As for changing input class you can read wiki on github for instructions

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

      How to parse the task using Chrome Extension. I have clicked in + button many times but nothing is happening. Neither the IntelliJ is affected nor the other things.

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

        Do you have a project with CHelper configuration opened in Idea? Also it may be that Hackerrank changed their DOM structure once again. Is there anything in Idea log?

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

          Yes, I have a project opened in Idea with CHelper config. And I ma trying the plugin fro Codechef.

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

            Can you tell me instructions I have to follow after clicking on parse Task in Google Chrome for any practice question on Codechef or ZCO contest of Codechef. I am assuming my Idea is closed.

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

              Idea should be running. New task dialog should show up when you click on plus in chrome

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

                new task dialog is not showing up.

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

                  Event Log is showing : CHelper: Unable to parse task from codechef

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

                  That means that CHelper can't parse this particular task from codechef — they do not have any fixed format

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

                  Ok. Got it. Thanks for the replies, sir. Parse task is working on Hackerrank and AtCoder. Not on Hackerearth,CSAcademy and Codechef. Please look into the issue.

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

                New Update is amazing. We can parse task in Codechef Contest, Hackerearth and CSAcademy too. But still can't parse Codechef Practice Problems.

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

Here is a video tutorial for the installation of CHelper

Link

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

Where to add the configuration file? Also, is the plugin only for topcoder or codeforces too?