## Activities: Virtual programming lab

mod_vpl
Maintained by Juan Carlos Rodríguez-del-Pino
VPL is an activity module to manage programming assignments
561 sites
43 fans
Moodle 2.3, 2.4, 2.5

VPL- Virtual Programming Lab is a activity module that manage programming assignments and whose salient features are:

• Enable to edit the programs source code in the browser
• Students can run interactively programs in the browser
• You can run tests to review the programs.
• Allows searching for similarity between files.
• Allows setting editing restrictions and avoiding external text pasting.

### Awards

• Thu, 16 Feb 2017, 8:05 PM
Sorry Kushal Patel for the late answer.
If you want to avoid that the user interact when the students RUN their code you must modify the default script of the language you are using and redirect the standar input to /dev/null.
e.g. if you are using java you must get the java default script and copy it to your vpl_run.sh , then replace the line
echo "java -enableassertions $MAINCLASS" >> vpl_execution by echo "{" >> vpl_execution echo "java -enableassertions$MAINCLASS" >> vpl_execution
echo "} < /dev/null" >> vpl_execution

I recomend to use the "based on" feature.

Best regards.

• Thu, 16 Feb 2017, 8:11 PM
Hello Moussa Sarr,
you can use java classes and packages in VPL. To resolve the problem you need to give full detail of your code and how you use it in VPL.

Best regards.
• Wed, 2 Aug 2017, 1:44 PM
Hi all,
I am able to run the following c program.
but I need to evaluate this program. please let us know if anyone can help me.
#include #include #include int main()
{

int pid, id;
if(fork() == 0)
{
/* open for writing */
printf("From child %d\n",getpid());
raise(2);
}

pid=wait(&id);
printf("From parent \n");
printf("Signal no= %d \n",id &355);

//waitpid(-1, NULL, 0);
return 0;

}
• Fri, 4 Aug 2017, 2:42 AM
I don't know a easy way to test this type of program. I can imagine making a something similar to a facade pattern that replaces the API you are using to log and test the student's program behavior. But I also think it may be a hard and fragile way to test student's programs.
Best regards,
Juan Carlos.
• Thu, 24 Aug 2017, 10:28 PM
Hi Juan,
Is there a support in VPL for Visual Basic?
Thank you,
Meir
• Thu, 24 Aug 2017, 10:42 PM
Hi'

I'm not sure it's worth mentioning, I've modified locally the vpl_evaluate.cpp to cope with dot '.' in program output compared to expected output in vpl_evaluate.cases Else, punctuation ("Hi.") is confused with numbers (".5").
Here some explanation with a short example.
Suppose we want to test a program "+1" with the test.case :

Case = Test zero
input = 0
output = 1

Here a program solution (in C) :

int main() {
int n;
scanf("%d",&n);
printf("%d",n+1);
return 0;}

You can even give better solution :

int main() {
int n;
printf("Give a number ");
scanf("%d",&n);
printf("+1 : %d",n+1);
return 0;}

It works! VPL find the 0 and the 1 of the test.case. Great! It was not sure because of extra texts ("Give ..." and "+1 :"), but VPL skip these texts

But it does not work for :

int main() {
int n;
printf("Give a number.");
scanf("%d",&n);
printf("+1 : %d",n+1);
return 0;}

What's the difference? The difference is in the dot "." in the text "Give a number."! VPL think there is a number here...
The problem is in vpl_evaluate.cpp isNumStart

bool NumbersOutput::isNumStart(char c){
if(isdigit(c)) return true;
return c=='+' || c=='-' || c=='.';}

Yes, some numbers .5, .0, ... begin with a dot ".", but "." alone?
So I've changed it to :

bool NumbersOutput::isNumStart(char c){
if(isdigit(c)) return true;
return c=='-' ;}

And now, last program works. (but ".5" are to be written "0.5")

Best for you,
Denis B.

ps: There must be other solutions with better lexical analysis to recognize true numbers.
• Fri, 13 Oct 2017, 11:31 AM
Hi all,
All done for my VPL, but when in my code python, using third party (example: stdio.py), (import stdio), i do not know where can i put the file stdio.py on Server of JAIL.
Thanks!!!
• Sun, 15 Oct 2017, 7:04 PM
Hello Denis B.
your comment is a bug that has been fixed in the 3.3. We use now a regular expression to detect numbers.
see
https://github.com/jcrodriguez-dis/moodle-mod_vpl/commit/b8fc63174337a883f8f973dc3497ef9698512e91#diff-730b93876f4d34ec69e467370ecaefe9
• Sun, 15 Oct 2017, 7:31 PM
Hello Dan Nguyen Duc,
Install the third party package on the jail server and restart the service.
You also can add files to specific activities as "execution files" and remember to mark the files as "Files to keep when running".

• Mon, 16 Oct 2017, 9:35 AM
Thank you Juan Carlos,
- add files to specific activities as "execution files" and remember to mark the files as "Files to keep when running": Ok - Done, but
- Install the third party package on the jail server and restart the service: Not done. In my server, i added third party to default package of Python, and test success on server when call function of third party.
• Fri, 20 Oct 2017, 9:38 PM
Hi!

Is it possible to download all student submission attempts as zip for a particular user? Right now(v3.2.5) supports to download all latest submissions for all users.
• Mon, 23 Oct 2017, 7:17 PM
Hi Tõnis,
the 3.2.5 version has not available this feature. The download of all the student's submissions is already implemented in the 3.3 version.

Best regards.
• Fri, 10 Nov 2017, 10:03 PM
Hi
I have created the Jail Server but when I try to connect to the server via https I get a warning about the certificate, and then a 404 error. Does this mean that the server is being contacted but that the jail server software itself is not installed correct, or is this not an assumption I can make (that the certificate notification is not evidence of a successful connection to the physical server or URL)?

When I log in to the server via PuTTY and go to the root of the directory structure I can see a directory called jail; is this where it should be residing?

Sorry but not yet getting any OK message and trying to identify why not.
• Sat, 11 Nov 2017, 1:40 AM
Hello Gildredge,
the certificate message may be due to the use of a selfsigned certificate.
The 404 message may be because you are not using the path /OK.
https://server[:SECURE_PORT]/OK

best regards.
• Sat, 11 Nov 2017, 1:53 AM
To all the users of VPL
This comments system is apropiate for very simple questions.

Please, for user's questions/sugestions use the forum,
for installer's questions/bugs use github and give details about the version of plugin, jail server and jail server OS of your instalation

https://github.com/jcrodriguez-dis

Best regards,
Juan Carlos