Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info

    Can someone help to implement the compilex project on my website?

    I want to run and execute programs in for different languages, how can do this with compilex. Or How can use the compilex on my website, any documentation or guide would be highly appreciated.

    Vishnu Bharathi
    @PrabhakarUndurthi I can help you buddy :smile:
    Jacob Samro
    Nice work :smile: great !
    Vishnu Bharathi
    @JacobSamro Thank you :smile:
    @scriptnull you have done a great work here it was very helpful for me in building a code judging Platform i'm working on it
    @scriptnull i am working now on the timeout option support for other languages
    and i'm planning to work on the jsMoule.js for supporting javascript
    Vishnu Bharathi
    @xnio94 It's good to hear that compilex is helping you and moreover , I am gald to receive your wonderful contributions to the library .
    Vishnu Bharathi
    I am planning to write a stable version of compilex , which will be much more standard with a clear architecture. I am afraid of that it will bring many breaking changes in the current API . This will lead to unnecessary confusion in the current version .
    Vishnu Bharathi
    So , I am thinking on ways to revamp the whole repo .
    that's amazing i will definitely update to the new version and those are my suggestions :
    one api method to compile with optional input argument and language argument.
    because that will simplify life for compilex users especially those who use all available languages and the choice of the language is done on the client side i think it's the most common use of compilex
    and for separating the method with input, i found that it lead to very redundant code

    auto detect the operating system and dropping the envData argument it can be done using process.platform, or using the os module for example

    sandbox the module because it's very vulnerable it's very easy for a client to compile a C code that contain a system("shutdown"); and shutdown the server and it can be worst
    the solution that i found to this problem is to use sandboxie http://www.sandboxie.com/
    to run my server.js but it will be more simple if it was integrated to the compilex module or something like that

    -another solution is to run the server.js in virtual machine but the same problem can happen and shutdown the virtual machine so i I thought about using a virtual machine for each client with virtualbox command line for example but that was more complicated

    -and one more possible solution is to scan the client code and prevent the client from using system calls and from importing system libraries or any suspected library but that need a lot of work and and its depend on each language


    i also note something about detecting infinite loops in the user's program
    it rely on the Error: stdout maxBuffer exceeded which i found very confusing because the maxBuffer attribute (in exec method) is the largest amount of memory available to stdout so we can clearly run a programme without infinite loops but if it's stdout exceed Maxbuffer compilex will console log "You might have initialized an infinite loop" which is not the case. and we can also compile a programme with a simple while(1){do nothing;} and without writing any thing in stdout in this case compilex will wait indefinitely for the programme to terminate without logging anything


    i also thought about new powerful features :
    more properties in the callback argument "data" beside data.error and data.output
    for example data.memory Consumed and data.timeConsumed or data.cpuConsumed
    it can be done using addon like timemem.exe https://raw.githubusercontent.com/jafingerhut/clojure-benchmarks/master/bin/readme-timemem.txt

    or using WMIC on windows


    keep the awesome work it very helpful and i think it will be more amazing in the next version for me i will still customizing the current version because im in the middle of
    working on a programming competition platform for my university
    after finishing it i will be honored to contribute to this project please let me know
    Vishnu Bharathi

    Great insights @xnio94 . I started writing this library , when I barely know what node.js is during my college days . So , I have done a lot of mistakes in writing compilex. However , I managed it to do the basic stuff. You had almost mentioned all the shortcomings of the library , that I wanted to discuss. Next version would strive to overcome the challenges that we are facing right now.

    You too had done a great job man . Your summarizes are really helpful. I will keep you updated with the library and Thanks once again man :+1:

    thanks to you sir ;)
    This message was deleted

    I'am trying to implement the compilex project on my website...can i do it like this?

    // POST
    var code=$('#codeWritten').val();
    var compiler = require('compilex');
    var options = {stats : true}; //prints stats on console

    var envData = { OS : "windows"};
    var envData = { OS : "linux" }; // (Support for Linux in Next version)
    compiler.compileJava( envData , code , function(data){

    // Delete temporary files
    console.log('All temporary files flushed !');

    // GET
    <h1>Dylan Compiler</h1>
    <form id="myform" name="myform" method="post" action="">
    <textarea id = 'codeWritten' rows="13" cols="100" id="code" name="code" ></textarea>

    <input type="submit" value="submit" name="submit" />

    I want to post the result from the textbox and then return the output in another textbox
    Vishnu Bharathi
    @dylan1394 Please refer to this https://github.com/scriptnull/compilex/tree/master/examples/compilex-Demo1 . compilex is a server side module and can be required inside server side javascript only. You are trying to require it inside client side javascript. The sample has the details of how to implement your scenario.

    Hi everyone,
    I tried and hosted the demo that is available in this link https://github.com/scriptnull/compilex/tree/master/examples
    I am getting following error while running a java program with user input.


    TypeError: fn is not a function
    at C:\zzz\zzz\Desktop\RunIT\node_modules\compilex\javaModule.js:143:12

    Has anyone faced this error? or Am I doing something wrong?