snapdragon3101's blog

By snapdragon3101, 5 years ago, In English

Check : https://cpeditor.github.io

Hi Guys !

You guys are truly amazing. I created CP Editor around 3 months ago just for fun and personal use, never wanted to make it public but anyways, I decided to make it public with this blog. I got so much love and support that I could not hold myself back from improving it, in following weeks I released the second version in this blog. Fixing a lot of issues and bringing new features.

Let's get into what is new in this release of CP Editor. But first,

Merry Christmas programmers!!

Thanks to ouuan for his wonderful contributions. Almost all new features were implemented by him.

What's New

More information
  • [NEW] Editor now only prompts to save on exit, if unmodified changes are present.
  • [NEW] Title-bar shows * for unsaved files.
  • [NEW] Verdict now shows colors. WA in Red and AC in Green.
  • You can Expand the size of the Input, Output and Message box.
  • Now you can Read Input from files in Input boxes.
  • Editor now also Optionally accepts Expected Output that you can use to check against your program's stdout.
  • Editor also Shows Verdict If you have provided Expected Output. Verdict can be any of three :
    • AC : Accepted, Verdict given when Output matches with Expected Output
    • WA : Wrong Answer, Verdict given when Output does not matches with Expected Output
    • ** : Unknown, Either Expected or Your Program's stdout is Empty.
  • Diff viewer has been added to check the difference between the Expected and Produced Output. (Click More to view Diff)
  • Set Tab Size.
  • Added Competitive Companion in the Editor. So no need to copy paste Input/Output manually, Competitive Companion fetches testcases for you. Set it up as follow :
Setting Competitive Companion

What's Fixed

  • [New] Fixed Issue when even if expected and produces output were same, the editor still produced WA.
  • [New] Fixed an Issue where upon format, there was a chance of command window to blink.
  • [New] Fixed Application Crash when Companion Server was restarted.
  • [New] Fixed Issue where AppImage would crash on Some Ubuntu 18.04.
  • Fixed the issue where { always automatically added a new line with }
  • Fixed Tab and Spaces mix-up, in the old version editor always used Spaces for indentation.
  • Fixed issue where if user was not opted for beta. Still they get beta update notifications.

Troubleshooting and General Information

  • Make sure Competitive companion extension port and CP Editor Companion port are same and above 10,000.
  • Make sure no other server is listening on the port. If this is the reason you may have to change the port to something else that is not being used.
  • Two instances of CP Editor will not be able to run Companion, because only one of them can listen at one port.
  • Competitive Companion can also parse Contests. Make sure you are on a problem page when you press parse Task not on a contest page.
  • If a problem has more than Sample 3 testcases. The Editor will discard all testcases except first three.
  • I have not much experience with Windows, So if your OS has a firewall that prevents CP Editor from listening or request from arriving, you may need to add an exception for the port in your Anti-virus or firewall settings.

Download

Sources : https://github.com/coder3101/cp-editor2

Download : https://github.com/coder3101/cp-editor2/releases

Support me with Stars**
  • Vote: I like it
  • +123
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How can I use it in my Ubuntu ?

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

    AppImage

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

      So I can just download AppImage and run it ?

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

        Yes it would be better if you google on how to run AppImage. You have to download it and then make it executable then run it on terminal.

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

          I downloaded it but on running it says segmentation fault core dumped .

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

"An invalid payload was delivered on the listening port"

The above error is coming when we click on the browser extension on codeforces.What to do now, i have checked they have same port no configured.

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

    That message pops if the extension is not providing correct json data. Try another browser even try changing ports.

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

      Thanks, one feature that we can't resize the coding area and hence its not helping to work properly on split screen. Any help to enable the feature to reduce coding area(i tried the normal way,it did't work). Thanks again.

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

      I've tried changing ports and still get the same message. Is it possible to fix this issue without trying another browser? I don't have other browsers available (except Tor).

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

        Check with Competitive Companion, GitHub page, (url in post) i guess it doesn't work well with tor. Try opening an issue there and see if there is a fix! Since this issue is not related with Editor, I cannot help much except to guide you to correct place.

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

          Sorry, I use Google Chrome as my main browser. I'm just stating that I don't have any browsers other than Google Chrome left, except Tor.

          Apologize for the unclear information.

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

            So you are getting error? What does it says?

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

              My browser is Google Chrome. This message appeared on the editor as I click the parse button of the extension:

              "An invalid payload was delivered on the listening port"

              I tried changing port to some values larger than 10000 and it still doesn't work.

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

Hey)

Recently I've started to use this editor, and I like it very much so far) Here some of my thoughts)

1) The size of output boxes and compiler messages box size could be flexible, because on small monitors there is just not enough space for code editor window.

2) An option to make a new .cpp file after parsing a task could be very convenient. Like it would be possible to choose a folder, and when I parse a task, a file with the task name automatically is made.

3) I cannot figure out why the expected output thing sometimes does not work. It works for sums of numbers for example. But for this task https://mirror.codeforces.com/contest/1277/problem/B it does not work for some reason. It prints WA when the output is clearly the same.

4) Make run and compile possible using a hotkey

5) Make an option to make WA and AC red and green colors, so I'll will be able to immediately see the verdict

Keep up the good work, I'll definitely follow this project)

EDIT: here an img of bug that I mentioned in (3) https://imgur.com/a/7Q6miXw

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

    Thanks to ouuan, points 5, and points 3 are fixed and will rollout as update in following days.

    EDIT: You should open this as issues in GitHub, so that you can track it's status and it also reminds us what to do.

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

    Yes, i know it is issue with carriage return and line feeds. It has been fixed, in coming days you will get an update!

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

Is there any way to update instead of download new version and install it?

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

    Windows??

    It's 15 MB .exe file, download it and run it will update if you already had it installed otherwise it will install.

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

    The method of update you are asking is called delta updates. Not even VSCode or Atom have it. To update your editor you need to download full size new binaries.

    Those features usually come in handy with professional IDE like Jetbrains, they have modular structure and hence such updates are possible.

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

      Can you add option that I can change size of any part on workspace because space to code is small for me?

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

I have been using this text editor and its really cool.I just wanted to share a few things i have experienced multiple times-

1) There's some issue when we use mouse to select a range of code,and try to copy or do something,i mean, there's no problem in copying but i was not able to select the lines of code as normally as we could have done.There's some issue there.

2)There were problems that i was solving, that got executed in other online compilers and also got AC in codeforces but I was getting error in the text editor( and i was just finding whats wrong in my code when there was none). The error message i was getting is "Error occured during execution...Non-zero exit code -1073741571" Here is one of the submissions if you want to refer it: 67448850. You may try it for any test case.

3) When we press '(' followed by ')' key, we get only one pair of bracket but this doesn't happen in case of the following keys- ',"(single inverted and double inverted) where we get two pairs if we press twice.Please make it behave the same as bracket.

But altogether a great experience, and thanks for this editor.

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

    67448850 works well for me (on Windows 10). Could you please provide your environment?

    BTW, it's better to open an issue here for 2). But for 1) and 3), they are editor issues, so you should open issues here.

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

      I am also using windows 10.Any idea why its happening like that?

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

        Which version of CP Editor are you using? What's your compile command?

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

          The version is 3.0.0 The command is g++ -Wall

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

            Try adding -Wl,--stack=536870912 to the compile command. You declared arrays in the main function, which cost the stack memory. You should declare them outside the main function, or add -Wl,--stack=536870912 to get more stack memory.

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

            And you should update the editor. There are many cool features in the newest version.

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

    Error occured during execution...Non-zero exit code -1073741571

    Such behavior is a cause of memory error! If your programs runs out of stack or heap memory on your machine. It abruptly halts with non-zero exit code. Codeforces judges are powerful and have enough memory, so it runs fine there.

    Also, --stack will only work on windows. Also, better safe than sorry, if your can give some more time to compilation, you could use sanitizers, by appending -fsanitizer=memory,undefined. It prints to stderr, the complete state of memory if anything bad happens. It does slows compilation but not much, there are more sanitizer like address, but only in clang. So I recommend using and installing llvm clang for windows. You will get formatter and complete compiler!

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

Does this work on Macintosh??snapdragon3101

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

So i have been using this editor for the whole day today, and i'm totally in love with this.

I was really in need of something like this :P

I would like to request/recommend some more features which will surely enhance this awesome editor.

  1. Support for more themes ( I really like my Monokai Theme :P ).
  2. Feature that lets you comment a block of code using [ Ctrl ]+[ / ]
  3. Auto Completion
  4. Some more blocks for test cases, maybe scrollable (Not a Must tho)

Thanks to snapdragon3101 and all devs for creating this. <3

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

    Support for more themes! Okay, It can be added easily.

    Comment with CTRL+/ is already in progress.

    Auto completion requires at least some kind of LSP which slows down stuff! However auto completion like that of Geany could be added. It's already in progress, actually I am stuck at one of dependency to add this feature. So as soon as it's done, it will rollout!

    I thought 3 would be enough as mostly CF problem or other problems don't have more than 3 testcases. It also requires doing some UI tweaks which i don't want to do now. Maybe Later.

    Here is what you should do:

    Open issue on the above GitHub, that way you can track the progress of your feature requests! Open 2 issues one for CTRL+/ comment and other for Monkai theme. Issues also help us (devs) to remember what our users want.

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

Is there a way to make snippets?

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

[Format feature will not work as your format command is not valid]. I am getting this error. Please help.

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

    Just ignore it. If you don't want code formatting to eork!. To solve it you need to download and add to path clang-format

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

      How do I add it? I am new to this. Can you please help.

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

        I am not very familiar with Windows system but it's called Environment Variable. You need to add the path of LLVM to ENVIRONMENT Variable named PATH. But as I said earlier you can ignore this error and everything should work fine. Except of course Code Formatting

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

          Okay, thanks a lot for your help. Thank you for this app, will save a lot of time by directly fetching test cases.

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

            Spread the word! Let others know it and let them save time too! It keeps the competition fair and square.