searleser97 / cpbooster

Competitive Programming Booster
GNU General Public License v3.0
154 stars 35 forks source link

[Windows] cpbooster is not working as expected in Windows OS #9

Open itsameaditya opened 3 years ago

itsameaditya commented 3 years ago

I am a Windows user and really liked the concept of cpbooster but here is one issue I am facing..... So I parsed a problem from codeforces and all the test cases were downloaded properly .... I then the correct solution to the problem , but the cpbooster plugin says "Wrong Answer"

The answer cannot be wrong because it is an accepted and copy pasted code from codeforces hence there is some issue with the plugin . Here is a screenshot of the verdict:

image

itsameaditya commented 3 years ago

Also just for confirmation I have manually compiled the code above and it gave the correct answer.

searleser97 commented 3 years ago

Thanks for bringing this up!. I am aware of this issue but I haven't had the time to investigate how windows CMD works, apparently it does something weird with spaces and line-endings, it is just weird.

For now, I recommend you to use WSL (Windows Subsystem for Linux) it works perfectly with cpbooster.

itsameaditya commented 3 years ago

Can you tell me a way so that cpbooster does not check trailing or leading blank spaces and also to disable the TLE function .. It seems to have a few bugs..

searleser97 commented 3 years ago

Can you tell me a way so that cpbooster does not check trailing or leading blank spaces and also to disable the TLE function .. It seems to have a few bugs..

This bugs just appear when using windows CMD right ?

itsameaditya commented 3 years ago

I use the CMD to run "cpb clone" and then compile it using inbuilt neovim terminal

searleser97 commented 3 years ago

Currently there is no way to disable the "leading or trailing whitespaces" check. For the TLE you can modify the default value by adding the line time-limit: 99999999 this will tell cpbooster to consider a huge time limit or basically non-existent time-limit

Take a look a this for better undertanding on how time-limit works: https://searleser97.github.io/cpbooster/docs/test#time-limit-exceeded

searleser97 commented 3 years ago

I use the CMD to run "cpb clone" and then compile it using inbuilt neovim terminal

yeah, so, if you run neovim inside CMD then Neovim will use CMD as well for its built-in terminal.

The inmediate solution is to use WSL in Windows instead of regular CMD. I suggest WSL with Ubuntu, since it will make it easier to install the packages.

itsameaditya commented 3 years ago

Can you please tell me how to do that.. I am not really good with OS stuff..

I use the CMD to run "cpb clone" and then compile it using inbuilt neovim terminal

yeah, so, if you run neovim inside CMD then Neovim will use CMD as well for its built-in terminal.

The inmediate solution is to use WSL in Windows instead of regular CMD. I suggest WSL with Ubuntu, since it will make it easier to install the packages.

searleser97 commented 3 years ago

Can you please tell me how to do that.. I am not really good with OS stuff..

There is a pretty nice tutorial from the oficial microsoft website here: https://docs.microsoft.com/en-us/windows/wsl/install-win10

preferably install WSL V2 as well, as suggested in that link

itsameaditya commented 3 years ago

In cmd i just used to type "cpb clone", how do I do the same thing in the WSL thing?

Do I have to reinstall cpbooster from scratch...

searleser97 commented 3 years ago

it works the same way in Linux (WSL) you just run cpb clone or cpb (whatever command)

However, since you are now in WSL (a different operative system inside Windows) you do have to install cpbooster again there.

You must install NodeJs and then do same as before, Just run npm install cpbooster -g and you will be ready to go.

searleser97 commented 3 years ago

I recommend using nvm to install NodeJs https://github.com/nvm-sh/nvm#installing-and-updating

it is as easy as just running some simple commands;

  1. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
  2. nvm install node (probably you will need to restart your WSL terminal before running this command)
  3. npm install cpbooster -g
itsameaditya commented 3 years ago

Does that mean i have to reinstall Neovim too right?

searleser97 commented 3 years ago

Does that mean i have to reinstall Neovim too right?

right, you can run this commands to get it installed:

itsameaditya commented 3 years ago

its too complex dude... i have to rewrite my init.vim .... too much work to do...

itsameaditya commented 3 years ago

Also do you know any other plugin which is similar to cpbooster .. (for windows) i really loved this idea ..... Now I wish... I had Linux

searleser97 commented 3 years ago

I recommend to backup your init.vim in a repository like github, so that you can just git clone it in any machine. In Linux you must locate this file in /home/USERNAME/.config/nvim/init.vim. For example: https://github.com/searleser97/nvim

It will only be an issue if you have some mappings or plugins that just work on Windows, but I doubt that you have something like that, most vim/neovim plugins were made thinking in linux first.

About other tools similar to cpbooster, I know some, but installation steps are more painful even in Linux, also not sure if any of them work for Windows, all of them have instructions for linux. I think it is because Windows requires to write more specific code to the platform, which makes it more complicated. Anyways, some of them are: cf-tool, oj (I don't remember more) (notice this tools do not have a plugin for vim/neovim. you could create it though)

searleser97 commented 3 years ago

Also, if you like to contribute fixing cpbooster for Windows, I'll appreciate it pretty much, otherwise, probably I will return to this in 3 or 4 months.

itsameaditya commented 3 years ago

Also, if you like to contribute fixing cpbooster for Windows, I'll appreciate it pretty much, otherwise, probably I will return to this in 3 or 4 months.

I would love to but I am not as good as you.. but i will surely give it a shot

itsameaditya commented 3 years ago

I recommend to backup your init.vim in a repository like github, so that you can just git clone it in any machine. In Linux you must locate this file in /home/USERNAME/.config/nvim/init.vim. For example: https://github.com/searleser97/nvim

It will only be an issue if you have some mappings or plugins that just work on Windows, but I doubt that you have something like that, most vim/neovim plugins were made thinking in linux first.

About other tools similar to cpbooster, I know some, but installation steps are more painful even in Linux, also not sure if any of them work for Windows, all of them have instructions for linux. I think it is because Windows requires to write more specific code to the platform, which makes it more complicated. Anyways, some of them are: cf-tool, oj (I don't remember more) (notice this tools do not have a plugin for vim/neovim. you could create it though)

What is oj? I cant find it anywhere..

itsameaditya commented 3 years ago

Also I have reached till this step and cofigured neovim and all .. but the cpbooster "template" shows some error in WSL :

### (Error: EACCES: permission denied, open '/home/aditya001/Contests/template.cpp' )

I know there is some mistake in the path for template.cpp file which I have specified. Please help me figure this out

image

searleser97 commented 3 years ago

assumming you don't have any typo in your path, then the only issue I can think of is that probably you created the directory or file with some elevated permissions such as root permissions

searleser97 commented 3 years ago

Glad you got it working in WSL 🙂

FYI, I deleted the latest comments since they describe a different issue and were better summarized on issue: #11