slycelote's blog

By slycelote, 3 years ago, In English,

I'm happy to announce 2.0 release of caide. Since the last version it got Topcoder support, CHelper integration and multiple improvements in C++ code inliner.

Like CHelper for Java, caide automates certain common tasks that you do during programming competitions: parsing, running and debugging problem tests, inlining library code. It currently supports C++ and C# programming languages. The list of supported online judges is here.

Download here. You can also install VS extension directly from Visual Studio.

Documentation:

Codelite and command line caide in Linux: (full size)

Codelite in Windows: (full size)

Visual Studio:

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

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

How to install it on Linux?

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

    Simply unpack the executable and put it in your PATH.

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

      I've unpacked to many directories from PATH.

      After packing I checked using terminal;

      When I write caide in terminal as usual user, it returns

      bash: /bin/caide: Permission denied
      

      If I write as root user, it returns

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

        Make sure it's executable (sudo chmod +x /bin/caide)

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

        this can happen when you're trying to run 32-bit application under 64-bit system. Type ldd caide and install all the missing libraries.

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

will it work in visual studio express 2013 ?

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

Added a 64-bit Linux build.

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

It seems that Caide does not work with C++11 feature =delete. Caide removes unused declaration of constructor but remains attributes of this declaration.

For example, in solution file we have

class Test {
public:
	Test(int n) : n(n) {}
private:
	Test() = delete;
	int n;
};

void solve(istream& in, ostream& out) {
	Test a(1000);
}

Caide converts it to submission.cpp:

class Test {
public:
	Test(int n) : n(n) {}
private:
	 = delete;
	int n;
};

void solve(istream& in, ostream& out) {
	Test a(1000);
}

Compiler fails on file submission.cpp with error error C2059: syntax error : '='.

Is it possible to fix it?

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

Another bug is removing method that is called from destructor (in case if destructor is not called explicitly).

Because the code is rather huge, I put it on Pastebin: http://pastebin.com/CRQDgguM. The first two cases are failed, the last one worked fine, but it is not convenient to write in such way during coding.

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

    Thanks, I created issues for both bugs: #1, #2.

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

    By the way, until it's fixed you can use a workaround: mark the method that gets removed with /// caide keep comment.

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

To continue reporting streak just want to mention strange thing (not a bug actually).

I bet lots of participants have some defines like

#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

to make their code work under different environment.

Caide inliner module removes this ifdef and you need to fix you submission.cpp file manually. It is not very convenient to repeat this process every time. Is there any opportunity to tell inliner not to remove this ifdef?

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

    There is a setting keep_macros in caide.ini file which you can use for this.

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

      Hmm, it does not seem to work properly.

      I have platform-specific ifdef:

      #ifdef _WIN32
      #define LLD "%I64d"
      #else
      #define LLD "%lld"
      #endif
      

      In the submission.cpp I get the next:

      #ifdef _WIN32
      #else
      #define LLD "%lld"
      #endif
      

      Probably I am mistaken, but for me it seems that Caide removes that part of ifdef that should be choosen by compiler on my computer (so I have defined _WIN32 and this part is removed). I expected both parts to remain unchanged.

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

        Are you sure that the LLD macro is actually used? Unused macro definitions get removed.

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

          Yeah, it is my fault :(

          Thanks for help!

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

can i get (caide) for VS 2015 ??!

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

    It's planned for the nearest future, stay tuned ;)

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

Caide 2.1 changes:

  • Visual Studio 2015 support
  • CodeChef and Codeforces fix
  • Several improvements in C++ inliner
  • Better cross-distro compatibility for Linux builds
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to use it for windows ?

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

    If you use Visual Studio, simply install VsCaide extension. If you want to use the command line application, see README

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

      I am using code lite at the moment , how to install for that?

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

        First, make sure you use latest Codelite version. Then see "Codelite" section here. There is no plugin for Codelite, so you'll have to parse problems / switch between them from command line. The rest (compiling, running) can be done inside the IDE. Let me know if you have any questions.

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

First of all, thank you very much for this awesome tool.

Second, after the most recent update to VS2015 the following needs to be added to clang_options in caide.ini: -D__EDG__,

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

I published 2.2 release. This release contains improvements in C++ inliner. In particular, unused namespaces and comments attached to unused declarations are now removed. Make sure to have -fparse-all-comments clang option in your caide.ini file.

Note: If you use latest release of VS 2015, you need to add the clang option -D__EDG__ in your caide.ini file. Thanks to Jacob for catching this.

Also, in light of recent cin/scanf fiasco, I'd like to remind that you can configure caide to use printf/scanf, fast I/O or any other kind of I/O. All you have to do is modify the signature of solve function and make corresponding changes in 3 template files: main_template.cpp, solution_template.cpp and test_template.cpp (the last one is quite large but you're interested only in runTest function). A sample implementation for printf/scanf is here: https://github.com/slycelote/caide/tree/release/libcaide/doc/samples/cstyle-io

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

Another VS update broke the extension again... A hack to fix this is to add -D__is_assignable=__is_nothrow_assignable to clang_options config entry.

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

caide version 2.3 is out with support for Visual Studio 2017 and fixes in HackerRank and CodeChef parsers.

»
17 months ago, # |
  Vote: I like it +5 Vote: I do not like it

Hi. I was looking for a C++ code inliner, and found this one. I built it for Mac and looks like it's working, but I have some questions.

First, I parsed some problem and manually entered the correct sample output. But after I compile and run it, it outputs

Running test case1
...correct output goes here...

Results summary
_______________
Outcome	Count
Error	1

case1: Testwasnotrun

Why error and Testwasnotrun?

The more general question is how to use it in conjunction with some IDE? It would be convenient to use CMake to create a project with one target for every problem. Is there a way to configure problemID to be just one letter, not including any contest details? And what's the expected workflow for problems that cannot be parsed?

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

    I built it for Mac and looks like it's working

    It's surprising that it compiles out of the box, I didn't expect that :) If you could upload the Mac build somewhere, it would help other users.

    Why error and Testwasnotrun?

    That's puzzling, especially the lack of spaces. Can you send me a zip archive of your caide directory right after you do that?

    how to use it in conjunction with some IDE?

    Right now there is Codelite support, as described in the README. You still have to use terminal to switch between problems and create new ones, but the rest should be possible to do within Codelite.

    It would be convenient to use CMake

    Yes, it is in my plans, but no ETA yet. I've added a Github issue for it here

    Is there a way to configure problemID to be just one letter

    Not at the moment, I've added a Github issue here

    what's the expected workflow for problems that cannot be parsed?

    You can create a code skeleton for the problem with caide problem A, and then create in/out files manually. Checkout caide problem -h.

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

Thanks for the amazing tool!
I am not able to parse tasks through CHelper in Chrome. I read many forums but all in vain. It would be great if u could explain how I can do parsing.
Thanks :)

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

    Which page are you parsing? Do you use VsCaide or command line tool? What are the error messages?

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

      I tried parsing Codeforces questions but did not succeed.
      I use VsCaide and there are no error messages. It just does not parse task!!

      Also, I get the following error when I parse the problem with its URL:
      Unable to start program 'C:\Users\Dishant\Desktop\VisualSolution\cf859A\Debug\cf859A.exe'.

      I am a beginner and am pretty sure might be missing something silly!! Sorry for the trouble!

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

        Please send screenshots and a zipped copy of your solution's folder in a private message.

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

In the Visual Studio 2017 Community Edition i have installed VsCaide extension..... But When I build a solution it is showing build errors...... 499 errors its showing...... cmath, cerno etc....... Can you fix it ?

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

    Please make sure you installed Windows Universal CRT SDK via VS 2017 installer. If it still doesn't work, send me a zip archive of the whole directory.

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

      I already have installed Windows 10 SDK (10.0.15063.0) for Desktop C++ x86 and x64

      Windows 10 SDK (10.0.15063.0) for UWP: C#, VB, JS

      Windows 10 SDK (10.0.15063.0) for UWP: C++

      Windows 8.1 SDK

      but can't find the Windows Universal CRT SDK that you mentioned above....

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

        It's under Individual Components tab, section "Compilers, build tools and runtimes" in the installer.

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

how to solve this problem https://imgur.com/a/ur5ej ?

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

    cpplib project is for your library code; create/parse a problem and put your solution there, in solve() function.

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

      how to modify the templates ?

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

        Sorry, didn't see your message :( Just use any text editor to modify files in templates/ directory.

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

is any one here using this tool with visual studio 2017 and work with it properly, i need his help in guiding me !!

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

    Did you follow these instructions? Where are you stuck?

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

      the instructions are not thorough enough, after create new solution and add task, what configurations should i do because a lot of errors were shown up !!

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

        Please send me screenshots and error messages in PM.