1. Установка
Надо скачать файл плагина и файл конфигурации. Файл плагина надо положить в %home_dir%\.IntelliJIdea10\config\plugins (если папки plugins нету — создать ее), а так же добавить в качестве библиотеки к модулям своего проекта (делается через Project Structure -> Dependencies -> Add Single Entry Module Library...). Затем поправить конфигурацию согласно своим нуждам, положить ее в корень проекта — и все, можно использовать. Для работы с TopCoder необходим плагин moj для арены, инструкции и ссылка — здесь, инструкция на русском — здесь
2. Конфигурация
В конфигурации надо задать несколько директорий. Директория задается путем от корня проекта с заменой \ на /. Пройдемся по пунктам:
inputClass - полное имя класса, используемого для ввода (полное имя — имя пакета + имя класса). Этот класс должен иметь метод next() возвращающей String — следующий токен (как у Scanner) и конструктор, принимающий InputStream. Собственно, Scanner подходит, но он довольно медленный
outputClass - полное имя класса, используемого для ввода (полное имя — имя пакета + имя класса). Соответствующий класс должен иметь 2 конструктора от OuputStream и от Writer и иметь метод close. По умолчанию — java.io.PrintWriter
excludePackages - перечисленные через запятую префиксы пакетов, которые вы не хотите включать в итоговый код, потому что они являются частью окружения на сервере). В большинстве случаев менять значение не надо
outputDirectory - папка, куда складывается итоговый исходный файл (который потом посылается на сервер для проверки). Должна находится в source директории какого-либо модуля в пакете по умолчанию. В проекте, создаваемым idea по умолчанию можно указать папку src
author - содержание тега @author в итоговом файле. В случае пустого значения тег не ставится
archiveDirectory - папка, куда исходники складываются при архивировании. Не рекомендуется, чтобы эта папка была частью source какого-либо модуля. Можно оставить по умолчанию, тогда при первом архивировании эта папка будет создана
defaultDirectory - папка, где будут создаваться автоматически созданные задания. Должна быть в исходном коде какого-либо модуля, но не в пакете по умолчанию. В проекте, созданном по умолчанию, должна быть вида src/package path, например, src/my/package
topcoderDirectory - папка, куда TopCoder плагин moj складывает созданные исходники. Правила те же, что и для outputDirectory. Если не участвуете в TopCoder — можно не беспокоится о значении этой настройки
enableUnitTests - если вы хотите, чтобы на основе ваших заданий создавались юнит тесты, то надо установить в true
testDirectory - если вы не установили значение предыдущей настройки в true, то может иметь любое значение. Иначе должна находится в исходном коде любого модуля, который может видеть те же классы, что и defaultDirectory (собственно, может быть в том же модуле)
Вот и все. Стоит заметить, что после смены конфигурации, чтобы изменения вступили в силу, надо перезагрузить проект
3. Использование
Добавьте себе на главную панель инструментов (Customize Menus and Toolbars... в контекстом меню панели инструментов) из Plug-ins->CHelper следующие кнопки: New Task, Edit Tests, Archive Task, Delete Task, Create Codeforces Tasks.
New Task (Alt+F2) — создает новое задание в defaultDirectory и выбирает его в качестве активного.
Edit Tests (Alt+F5) — открывает редактор тестов (в том числе для TopCoder)
Archive Task (Alt+F6) — удаляет задание, сохраняя код в archiveDirectory и, если включено, создавая unit test в testDirectory
Delete Task - удаляет задание и все его файлы
Parse Contest - создает все задания для определенного соревнование (пока поддерживаются Codeforces, CodeChef, E-Olimp и Timus).
Parse Task - то же самое, что и предыдущий пункт, но создает только одно задание.
Название сайта | ID соревнования | ID задачи из архива | 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) — копирует содержимое Main.java в буфер обмена. Полезно для сайтов, которые не поддерживают отправку файла
4. Меню настройки новой таски
Name - имя класса для задания. Если используются файлы .in/.out, то стоит использовать такое имя, которое при переводе в нижний регистр совпадает с именем входного/выходного файла (без расширения)
Test type - каким образом идут тесты — по одному на файл, сначала количество тестов, а потом сами тесты или тесты прекращаются по какому-то условию (скажем, вход из нулей). В последнем случае основной метод должен кидать UnknownError когда условие выхода выполнилось)
Input type/Output type - тип ввода/вывода. Standard — через стандартный поток, Task_id — см. Name, Custom — имя файла задается в появившемся поле
Heap memory - ограничение на размер памяти
Stack memory - ограничение на размер стека
5. Созданные файлы
В основном файле задания есть один единственный метод - void solve(int testNumber, %input% in, %output% out)
testNumber — номер теста в файле начиная с 1
В файле чекера есть 3 метода:
String check(%input% input, %input% expected, %input% actual)
возвращает null, если ответ правильный, не пустую строку если неправильный, пустую строку для запуска чекера по умолчанию (потокенное сравнение)
double getCertainty()
возвращает точность сравнения даблов для чекера по умолчанию. Если 0, то будут сравниваться как токены
Collection<? extends Test> generateTests()
возвращает набор дополнительных тестов, которые генерируются программно
You can try CLion.
It was created years after I made that comment :)
Anyway thanks
Hi. What's the plugin name for CLion and how to install it?
Jhelper
Thanks. Got it but can't understand the configuration steps.
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
Do you have any project open when you click on "Edit Project Settings"?
Yes i have one project open which i created ...
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
This solved it for me. Thanks
I have some problems with your CHelper - plugin :-?
deleted
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
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 :)
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
I'll look into it
I too faced the same problem in 531 Div2 -250.
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
There is problem on creating ,parsing contest,none function work from toolbar
Nothing is working or only contest parsing?
Now contest parsing work ,how will it generate automatically Main file,it is not working
It should generate the Main file when you run or debug created configuration
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:
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:
При беглом осмотре кода я заметил, что классы исходников очень хардкорно парсятся... Я так понимаю, что если у меня в утилитах будет что-то типа:
то заинлайнится какая-то некомпилируемая хрень, типа:
А если у меня будет:
то, мне кажется, оно вообще забудет его заинлайнить (т.к. после class нет пробела).
А если мой Utils-класс содержит static import-ы?
А если единственная ссылка на мой класс будет внутри generic-типа?
Т.о., если мой стиль оформления кода немного отличается от Вашего, то я могу быть неприятно разочарован во время контеста.
Я правильно понимаю? Тогда об этом стоит предупреждать. ;)
P.S. Но сама идея плагина для генерации одного файла по зависимостям и удаления неиспользуемого кода прикольна. :)
Проблема. Буду думать, как ее решать А так — нет предупреждения потому, что я об этом не задумывался, а никто другой не наткнулся
Ах да, про static импорты (так же как обращение по fqn) вроде было где-то написано, но могло потерятся в процессе
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???
You need to create some class, like IntegerUtils and create static method isPrime. Then you can use it in your solutions
And where do I have to save that class??
Anywhere it will be visible fromyour solution
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??
Are you sure your method was public?
Yes it is public...Do I have to change something in the properties file or put the class in a directory under the src??
Well, it should be somewhere under source — just like for any Java project
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??
In the created source (the one you will submit to the server) all unused methods will be removed
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
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?
I have messaged it to you.
Check emo's comment at the bottom, maybe you have same problem
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.
Strange, not repetable on my computer By the way, you can use Test Type: MULTI_TEST, that's exactly why that type was created
Did you mean MULTI_NUMBER?
BTW, do you suggest me to do anything to make unused code remove working? I'm using chelper2.33.
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?
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.
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??
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!
Thank you for your plugin. It's great.
Egor привет. При установке плагина на Ubuntu 12.04, IntelliJ IDEA CE 11.1 нет возможности добавить кнопки на панель меню.
Порядок действий:
Закинуть плагин в папку /%username%/IntelliJIDEA/plugins/
Перезагрузить IntelliJ
Создать новый проект, добавить в него в dependencies CHelper, в корневой каталог проекта кинуть файл *.properties.
Перезапустить IntelliJ
Собственно потом при выборе "Customize Menus and Toolbars..." пытался найти указанные в блоге опции для добавления, но там подобного нет.
Не подскажешь в чем может быть проблема?
Спасибо.
А в списке установленных плагинов он есть?
Есть.
Нет идей и нет доступа к Ubuntu. У меня на 11.1.1 все работает
А в каком подразделе вообще должен находится CHelper при добавлении меню? У меня там его нет вообще. То, что плагин новый добавлен — отобразилось и в списках есть он.
Plug-ins->CHelper
Вот такое получил:
s2r?
Правака №2
Да, в чем проблема? Ни один метод не используется, потому и вырезается
Если внутри solve написать int x = in.RI(); по идее RI и next() должны остаться
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!
Launch IntelliJ and choose
File -> Settings -> Plugins -> Install plugin from disk -> path_to_chelper2.41.jar
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!
I fixed path that got broken after markdown introduction
Yes, that's home directory
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!
"...also you should include chelper.jar to class path of your project (Project Structure -> Dependencies -> Add Single Entry Module Library…)"
Поставил вот. Юзаю IDEA12 EAP
Есть код:
Тут все хорошо.
Генерируется код:
Собственно, не находится класс Array. По Alt+enter отлично находит.
Написано было:
abstract public class
...он вставлялся в результат как не абстрактный. При замене на
public abstract class
— нормальноДа, пока это, к сожалению, так. Когда у меня наконец появится свободное время я посмотрю что с этим можно сделать
Пост апнули — случайно прочитал это сообщение. Вроде бы я забыдлофиксил это в своем репозитории. Может кому пригодится. Но там нет самых последних обновлений.
Пропало в версии 2.41. Зато теперь вылазит рандомный екзепшн периодически(на работу, кажется не влияет):
<я не умею читать>
how can i use chelper in eclipse IDE ?
Idea plugins are incompatible with Eclipse
Google
Request not allowed from your country That’s all we know.
Why? UPD: Fixed!I downloaded it whit VPN. :)
Why I can't open and Install ? I have installed Java before !
You do not need to download anything from Google actually. Just use IntelliJ Idea Plugin repository (and you do understand that this is plugin for IntelliJ Idea, right?)
"You need to download plug-in and configuration. " plug-in : http://code.google.com/p/idea-chelper/downloads/detail?name=chelper2.4.jar
!
That's old information. Refer to manual on plugin web site
can you share the link?
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)?
Static imports are currently not supported
Thanks.Is there a way to add permanently
at the beginning of generated Main class?
Currently no
Great plugin !
Egor How Can I change the template code that generates automatically in the main? solver class name?
You can change solver class name (Main class name), but unable to change generated code
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 :(
you should throw UnknownError when there's no more test.
thank you man, it works...
Egor, great thanks for your plugin, it makes me efficient! I use it on IDEA 12 on MacOS and I have 2 questions:
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)
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!
Well, if judge uses stdin/stdout you should specify those in your task as well
I need a look at you chelper.properties
Thank you a lot for help!
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
Ok. I will update and double check. P.S. I am using IDEA 13.
Как соединить Topcoder Арену с IntelliJIdea c СHelperom?
Я установил плагин, но не могу конкретно разобраться что еще я не сделал?
Надо запускать арену прямо из идеи — там соотвествующую кнопку на тулбар можно повесить
ОК. Когда я нажимаю ничего не происходит
И в логе ничего нету? А проект — точно с chelper.properties (появляются если нажать кнопку edit project settings и заполнить все правильно)?
Значит вот что я сделал: 1) Установил IntelliJIdea 13.1 с community
2) Сделал эти шаги: - Select menu item "File->Settings...", select "Plugins" in "IDE Settings", push "Browse repositories..." button, right click on CHelper and select "Download and Install". Click "Yes", "OK", "Apply" and "Restart". — Сделано
Right click on main toolbar, select "Customize Menus and Toolbars...", select location where you want actions to be listed (probably end of "Main Toolbar" is good), click "Add After...", select "Plug-ins->CHelper" and add actions you are interested in (probably all but "Task") — Сделано
After that open or create project that you want to use with plugin and click on "Edit Project Settings" to set-up project directories (more on this here) — Здесь я зашел в Project Structure и добавил Chelper в dependencies. Больше я ничего не делал. https://code.google.com/p/idea-chelper/wiki/EditProjectSettings — Эта картинка не высвечивалась
То есть если нажать на кнопку Edit Project Settings с тулбара сеттинги не открываются?
Вы правы. Я нашел Edit Project Settings.
Arena теперь запускается, только видимо проблема с default directory. Куда мне указать default directory в project settings?
Скажем, src/ferrumit (создав соотвествующую папку). А output — src
Создал так.
Arena открылась и задачи открылись.
Правда как нужно тестить и сдавать сами решения.
Я нажал кнопку Run и вышло
Exception in thread "main" java.lang.NoSuchMethodError: net.egork.chelper.task.TopCoderTask.load(Lnet/egork/chelper/util/InputReader;)Lnet/egork/chelper/task/TopCoderTask; at net.egork.chelper.tester.NewTopCoderTester.test(NewTopCoderTester.java:45) at net.egork.chelper.tester.NewTopCoderTester.main(NewTopCoderTester.java:24)
В первый раз такое вижу. Можно попробовать удалить добавленные библиотеки из проекта и нажать edit project setting/ok еще раз
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.
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
It is not able to create Main.java file
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
Seems like there was internal format change. Should have checked beforehand but forgot
Do you have any plans to update source code at https://code.google.com/p/idea-chelper/? It seems to be pretty outdated.
For some reason actual code is in trunk brink, but it still need push from me
And actual code should be in trunk branch now (through I'm planning to fix GCJ support soon)
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?
Your output writer class should have constructor that takes writer as parameter (and relays output there). You can use PrintWriter as output class
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!
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
Are you sure you do not select "Number of test known" when parsing tasks?
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
Try full versions here
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?
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?
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.
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!
You should try marking your archive folder as excluded ;)
Google Code скоро закрывается. Планируется ли переезд на другой хостинг?
UPD: пардон, нашёл.
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.
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
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.
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?
Yes, I have a project opened in Idea with CHelper config. And I ma trying the plugin fro Codechef.
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.
Idea should be running. New task dialog should show up when you click on plus in chrome
new task dialog is not showing up.
Event Log is showing : CHelper: Unable to parse task from codechef
That means that CHelper can't parse this particular task from codechef — they do not have any fixed format
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.
New Update is amazing. We can parse task in Codechef Contest, Hackerearth and CSAcademy too. But still can't parse Codechef Practice Problems.
Egor Can you share the wiki link you mentioned above for instructions?
Are there any plugin like CHelper for C++ in CLion IDE?
http://mirror.codeforces.com/blog/entry/13369
Thank you very much!
I am not understanding how to generate own test cases for tasks like those Petr uses in his livestreams. Can anyone please help me out?
I think the new "Copy" feature has caused some problems in parsing the task's Test Cases.
I highlighted the very same issue here. Got no response till now.
I would recommend to use parsing from within idea until I deploy fix, it still works
One question and one feedback! Egor
Q: How to use precision for double comparisons? I assume in the advanced settings, I need to put something for "checker properties" field, but what to put?? Any manual page explaining that?
Feedback: when checking whether all input class and output class methods are implemented, it doesn't look for the necessary methods in super class. So it complains whereas the method exists in super class.
Is there a list of supported sites for CHelper/CHelper Extension? I can't seem to find it anywhere.
source code is your friend
Did anyone else face the same issue? For multiple nested classes like _1000E.Bridges.edge, the code in output file converts to _1000E.edge.Bridges, which leads to compilation error.
Chelper not working after latest update of Intellij Idea
Exception in thread "main" java.lang.ClassNotFoundException: soln.TaskA at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at net.egork.chelper.tester.NewTester.test(NewTester.java:75) at net.egork.chelper.tester.NewTester.main(NewTester.java:28)
I am working on this, but I am not sure I will finish before the round. You can install previous version temporarily
Ok. Thank you. for temporary purpose when I run the tasks created before this update and then run newly created task , it works fine.
For some reason new version of idea skips on compiling before running corresponding configuration types. I fixed this, you can download new version from repository
Thanks man for such instant response. Love from java user.
Have you updated it in Plugins of IDEA. As this update is not showing there, so the problem still persists.
I had
I'm still using version 4.3.1 because 4.4.2 doesn't work. I was unable to compete in 499 round just because i updated chelper as idea suggested me and after that i returned 4.3.1.
How exactly it does not work? And what version of idea do you use?
I don't know if this is magic but I updated idea version from 2018.1 to 2018.2 and now it works. I'm sorry and thank you =).
It seems new version do not work with old versions of idea
Same occured with me. correctly parsing task after IDEA update. Everything is working again.
CHelper Setup Steps: (as of July 2018)
archiveDirectory actually may not be in source, while it is not mandatory for outputDirectory to be a source one. Otherwise — sound advice
I have followed the advice above. I can generate some files using "Parse Contest" button, but:
Any idea what I may be missing?
I use
OK, I kinda made it work by the following actions:
Now:
However:
I am also facing the same issue, Can anyone help?
Installed Chelper from the repository in idea and then restarted idea.But none of the action is working. Also nothing opens when parse a problem from the browser. (Using Ubuntu operating system)
Had you configured project as described one comment up from yours?
where to find the chelper.properties file
If you press "Edit Project Settings" button it will create one for you
I don't see a edit project settings. Do you mean going to Project Structure?
No, this should be button on your toolbar
Hi Egor, when parsing Codeforces tasks in IDEA, tests are not created.
CHelper Chrome extension stopped working for Codeforces as well.
Hi Egor , All tools [Create Task , Parse Contest ,all] everything is working well except the one small issue. The Parser is not working properly (It parses the problem correctly ,but not able to parse Sample TC , mention in the problem).
( IntelliJ Version 2018 2.5. CHelper Version 4.4.2 Window 10 )
Tried most of possible sol , Still not getting desirable result.
Anybody has the same issue ?
Thx alot :)
Lol. Forget about using the built-in parser for CHelper. Use Competitive Companion (link). This is a much more well-developed and better supported parser and works with CHelper.
Решил таки попробовать заменить плагин Competitive Companion для хрома на CHelper extension, но столкнулся с одной странностью: в каталоге расширений присутствуют две копии этого плагина, у первого есть 30 оценок и 665 пользователей, его версия
4.2.1.1
, в то же время у второго нет оценок, всего 16 пользователей, но его версия повыше —4.3.1.1
.Является ли вторая копия бета-версией или это вышло случайно? Я так вижу, они не одновременно с самим плагином обновляются, потому что версия плагина сейчас
4.4.2
.Hey I am getting this error while running the code!!
java.lang.NullPointerException at net.egork.chelper.codegeneration.CodeGenerationUtilities.getSimpleName(CodeGenerationUtilities.java:410) at net.egork.chelper.codegeneration.SolutionGenerator.createMainClassTemplate(SolutionGenerator.java:498) at net.egork.chelper.codegeneration.SolutionGenerator$3.run(SolutionGenerator.java:574) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1057) at net.egork.chelper.codegeneration.SolutionGenerator.createSourceFile(SolutionGenerator.java:557) at net.egork.chelper.util.TaskUtilities.createSourceFile(TaskUtilities.java:21) at net.egork.chelper.configurations.TaskConfiguration.getState(TaskConfiguration.java:73) at com.intellij.execution.runners.ExecutionEnvironment.getState(ExecutionEnvironment.java:158) at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:55) at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:50) at com.intellij.execution.ProgramRunnerUtil.executeConfigurationAsync(ProgramRunnerUtil.java:92) at com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:41) at com.intellij.execution.impl.ExecutionManagerImpl.restart(ExecutionManagerImpl.java:93) at com.intellij.execution.impl.ExecutionManagerImpl.access$300(ExecutionManagerImpl.java:44) at com.intellij.execution.impl.ExecutionManagerImpl$3.run(ExecutionManagerImpl.java:442) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232) at com.intellij.util.Alarm$Request.runSafely(Alarm.java:356) at com.intellij.util.Alarm$Request.run(Alarm.java:343) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:228) at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:435) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:419) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:403) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:732) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:668) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363) 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)
Egor can anyone help me out??
I am using intellij 2018.3.3 verion and chelper 4.4.2v
Please help.
I am getting this error on IntelliJ IDEA 2018.1.3 with CHelper 4.4.2 and jdk1.8.0_181 Error:
Image of Project structure and chelper.properties file
Problem solved by updating IntelliJ to 2018.3.5, thanks.
I installed idea Intellij and also added the chelper plugin but when i parse a task from codeforces its not adding the testcases automatically.. Rest all are working correctly. can anyone help. I added the plugin from idea intellij store as well as tried downloading the plugin and loading from disk. can anyone please help . I am using Idea Intellij 2018.3.3 version. Test cases are not being parsed. please help.
Egor Not Compatible with Latest Intellij Idea.
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper at net.egork.chelper.tester.NewTester.(NewTester.java:24) Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) Please update
I have tried installing plugin from
File -> Settings... -> Plugins
. I kept receiving an error:Probably, that was due to absence of the
chelper.jar
on the classpath. So I tried downloading the plugin from the Intellij IDEA site, and after unzipping it, I have selected the bunch of jars in theFile -> Project Structure -> Libraries -> + -> Java -> <path_to_the_bunch_of_chelper_jars>
. For a brief period, it helped me, and the tests started to run when I run the problem task. But after some changes, which I cannot reproduce exactly, things went yet another way wrong. Now I keep receiving the following error:Despite the fact, the library
cojac.jar
is on the classpath along withchelper.jar
. What could be done here?UPD: The problem has been solved. If you experience a similar problem, please try to update everything you have. Install plugin of the previous version and then update it when Intellij IDEA advises you to do so.
Hey, I am facing the exact same issue. Can you elaborate a little more how to solve this issue? Waylesange Thanks
OK, just try to keep it simple. I suggest you update Intellij IDEA to the latest version. Secondly, you go to File -> Settings... -> Plugins and search for the chelper plugin. It is required to run the task run configurations, and it supplies you with the buttons on the toolbar, too. After you have done that, you should be getting the error about impossibility to find and load class from net.egork... Now you go to the jetbrains plugin site, search for chelper plugin there, and download the latest zip archive. After unzipping it, go to File -> Project Structure... -> Libraries -> + -> Java, select recursively the folder you just unzipped until you get to a bunch of jars that contain that missing class in the error. After you have added those jars to your classpath, along with JDK, it should be enough to parse a problem from codeforces site using Google Chrome plugin. Thus, you get the tests inherent to the problem as well, whereas if you are importing the problem from within Parse contest menu of chelper, you won't get the tests, which is sad and needs to be fixed by Egor Kulikov. I hope my experience helps you!
You are a lifesaver bro. Thanks!!
I have installed the latest IDE and Chelper 4.4.2.
And I have also manually added all jar files using the Project Settings option. Although everything is working fine, i.e test cases are running and showing results, there are exceptions arising between the test cases on the console.
COJAC-AGENT EXCEPTION FOR CLASS jdk/net/ExtendedSocketOptions java.lang.IllegalArgumentException
Such COJAC-AGENT EXCEPTION is being shown for multiple classes even for InputReader and OutputWriter.
Can someone help on how to get rid of those exceptions?
Although they are not crashing anything, they are frustrating as they are visible in between the test case lines.
You can disable integer overflow checks in Run/Debug configurations.
Thanks, this saved me so much hassle!
It is showing "All test passed" inspite of a wrong solution. How to resolve it?
Which parsing tool had you used? As you can see there were no tests
Yeah me too facing the same problem but i didn't used any parsing tool. I parsed the contest using the contest parser of chelper.
You should use Competitive Companion. CHelper parser is rather outdated.
how to parse using Competitive Companion. Is there any good video's teaching that.
I don't think you need a video to do that. Let me give a brief explanation (assuming CHelper is already set up):
1. Install Competitive Companion
2. Restart Intellij IDEA
3. Open up the page of a problem
4. Click on Competitive Companion (the extension it should be a green plus)
That should do it. Note that you don't have to repeat step 2 every time but it's important to do that upon installing Competitve Companion.
I have installed chelper plugin in Intellij ide.I was able to parse the contest questions but for every task it shows 0 test cases.Its not able to parse the sample test cases,how do i resolve this issue?
What site had you tried to parse from? Codeforces?
Hello Egor,
When I parse a contest from CodeForces, it parses the tasks fine, but without tests.
CHelper version:
4.4.2
Intellij Idea Community Ed:
2020.1.2
I can also see the following exception (stacktrace) in the Idea logs:
This is because Codeforces changed DOM structure of pages a little bit ago. You can use Competitive Companion extension for Chrome for now while I am working on major overhaul of CHelper
Thank you for your response!
Do you have any idea about the timeline of those changes?
You mean the overhaul? Not sure, even alpha is quite some time away. But Competitive Companion is really cool extension, you should try it
Tried, works like a charm, thanks for that!!
Once I have your attention, let me ask another question :) Recently, after a bit of break in competitive programming, I noticed that two of the great Java users — Petr and yourself have switched to GNU C++17 by preserving the coding styles. I'm wondering what the reason was behind switching to C++ after a long period of Java usage in competitive programming.
PS. I have found the solutions by both of you useful and got some ideas to enrich my toolbox for CP. Thanks for that as well.
It sseems most authors stopped to even pretending they care about Java — no reference solutions, and hence — problems with tl
@Egor I am getting this error.My intellij Ide is not opeoning
Internal error. Please refer to https://jb.gg/ide/critical-startup-errors
com.intellij.diagnostic.PluginException: Fatal error initializing 'net.egork.chelper.CHelperMain' [Plugin: CHelper] at com.intellij.serviceContainer.ComponentManagerImpl.handleInitComponentError$intellij_platform_serviceContainer(ComponentManagerImpl.kt:571) at com.intellij.serviceContainer.MyComponentAdapter.doCreateInstance(MyComponentAdapter.kt:59) at com.intellij.serviceContainer.BaseComponentAdapter.doCreateInstance(BaseComponentAdapter.kt:154) at com.intellij.serviceContainer.BaseComponentAdapter.createInstance$lambda$1(BaseComponentAdapter.kt:133) at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:99) at com.intellij.serviceContainer.BaseComponentAdapter.createInstance(BaseComponentAdapter.kt:132) at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:92) at com.intellij.serviceContainer.BaseComponentAdapter.getInstance$default(BaseComponentAdapter.kt:77) at com.intellij.serviceContainer.ComponentManagerImpl$createInitOldComponentsTask$1.invoke(ComponentManagerImpl.kt:394) at com.intellij.serviceContainer.ComponentManagerImpl$createInitOldComponentsTask$1.invoke(ComponentManagerImpl.kt:392) at com.intellij.idea.ApplicationLoader$initApplicationImpl$appInitializedListeners$1$1$2$1.invokeSuspend(ApplicationLoader.kt:139) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:779) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:749) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:389) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) Caused by: java.lang.NoClassDefFoundError: com/sun/net/ssl/HostnameVerifier at net.egork.chelper.CHelperMain.initComponent(CHelperMain.java:17) at com.intellij.serviceContainer.MyComponentAdapter.doCreateInstance(MyComponentAdapter.kt:45) ... 25 more Caused by: java.lang.ClassNotFoundException: com.sun.net.ssl.HostnameVerifier PluginClassLoader(plugin=PluginDescriptor(name=CHelper, id=CHelper, descriptorPath=plugin.xml, path=~\AppData\Roaming\JetBrains\IdeaIC2022.3\plugins\chelper, version=4.4.2, package=null, isBundled=false), packagePrefix=null, instanceId=107, state=active) at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:217) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 27 more
----- Your JRE: 17.0.5+1-b653.25 amd64 (JetBrains s.r.o.) C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.2\jbr
Yeah, sorry, it is not compatible with recent versions of idea
That means We cant use Chelper .
Is there any alternative way to use Chelper?
You can use it with older idea. I hope to sometime do next iteration, but atm I do not have time for it
@Egor Why dont u add Chelper in MarkretPlace in intellij Idea
It was there, I guess it got removed because it is no longer compatible with last version of idea
Egor Getting the following error while try to run the program.
Error: Could not find or load main class net.egork.chelper.tester.NewTester Caused by: java.lang.ClassNotFoundException: net.egork.chelper.tester.NewTester
Somebody please help
https://mirror.codeforces.com/blog/entry/3273?#comment-541119
I was able to resolve the most common errors while setting up chelper with competitive companion chrome extension. Tried to cover all possible errors in my video so that others don't have to read so many comments to solve the common bugs
Youtube Video Link
Hello,
After installing the CHelper plugin, Intellij Idea fails to start up.
Same Problem here. How did you resolve your issue.
The solution for me was to fork the original github repo of the plugin and remove those lines that are causing issues. Then build the project and use it. I find it easier to build it using gradle, so picked a fork of the project that's already migrated to gradle.