Forums

Search results: 45

Yes, I did and it worked. 

The problem is that I wanted a sync readline input because my course is a introductory to programming for multimedia students that are integrated in anothers couse in the following order: first they will learn html+css, then learn coding with javascript and finally PHP+SQL databases.

In others courses I used C# with coderunner to introduce coding and it was great.  So I'd like to replicate that course to Javascript. But the readline method uses an asynchronously way that is to complex to explain to newbies.

So I tried the readline-sync package but that throw the error I mentioned above.

The problem now is that the jobe server tell that stty is not set:


stty: when specifying an output style, modes may not be set

But when I run a script in the "runs" folder exactly the same, it works!


There is some chance to set the stty mode in jobe server?




Yes, I did and it worked. 

The problem is that I wanted a sync readline input because my course is a introductory to programming for multimedia students that are integrated in anothers couse in the following order: first they will learn html+css, then learn coding with javascript and finally PHP+SQL databases.

In others courses I used C# with coderunner to introduce coding and it was great.  So I'd like to replicate that course to Javascript. But the readline method uses an asynchronously way that is to complex to explain to newbies.

So I tried the readline-sync package but that throw the error I mentioned above.

The problem now is that the jobe server tell that stty is not set:


stty: when specifying an output style, modes may not be set

But when I run a script in the "runs" folder exactly the same, it works!


There is some chance to set the stty mode in jobe server?




Thanks for your reply and help here Richard. It's very much appreciated. 

Here is the output:

root@gamma:/var/www/html/jobe# sudo apt install php-mbstring

Reading package lists... Done

Building dependency tree       

Reading state information... Done

php-mbstring is already the newest version (1:7.0+35ubuntu6.1).

0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.


Here is the output from the simpletest:

root@gamma:/var/www/html/jobe# python3 simpletest.py 

Supported languages:

  •     c: 5.4.0
  •     cpp: 5.4.0
  •     java: 9
  •     nodejs: 4.2.6
  •     php: 7.0.30
  •     python3: 3.5.2

Running python...

Bad result object {}

Running C++

Bad result object {}

Running Java

Bad result object {}


These is newly installed system running only the necessary dependencies and the jobe server.  perhaps I need to do something else. In the install guide you mention "The Python3 and the C development system must also be installed."  


Paul






Question Authors' Forum -> Checking error -> Re: Checking error

by Richard Lobb -

40 seconds for a single run of a question is certainly not acceptable. Have you tried the Java questions on this website in the C and Java quiz? You'll find they take from 2 - 5 seconds.

How many test cases does your question have? If you have a lot of test cases and either:

  • the prototype for the question does not use a combinator template and/or
  • each test case has different standard input
then you'll be sending a separate compile-and-run job to the jobe server for every test case. Java is pretty sluggish so I could imagine 20 or more test cases taking 40 seconds.

If you're writing questions with a large number of test cases, you might want to consider an alternative way of marking the student submission, e.g. by writing your own template grader that contains all the test data within it, so you need only a single job run.

If you not using a large number of test cases and you're experiencing run times like 40 seconds for a single submission then something is seriously broken. Is it possible that some process in Moodle, Jobe or the student browser is timing out on a web request to an inaccessible site, for example?

As an aside it is possible to write question types that package up all the test cases into a single run, even when multiple standard inputs are required. You can get some hints on how to do this by opening the question authoring form, clicking customise, and reading the Template controls help. But it's tricky, and I haven't done it for Java, as I don't currently teach any courses using it.

Richard


Dear Martin,


I'm not clear on what is your specific problem with the question template. I have checked on my server, and I'm using the default nodejs question type, that is, using applications/library/nodejs_task.php  

Can you provide a more specific error message or screenshot?


Regarding the installation of nodejs and related libraries, I'm using nvm to install node:

> nvm ls
->      v6.10.0
         system
default -> v6.10.0

And the executable at /usr/bin/nodejs, as specified in nodejs_task.php is:

> /usr/bin/nodejs --version
v4.8.0

And the installed packages are:

> npm ls
/var/www
└─┬ jsdom@9.2.1
  ├── abab@1.0.3
  ├── acorn@2.7.0
  ├── acorn-globals@1.0.9
  ├── array-equal@1.0.0
  ├── cssom@0.3.1
  ├── cssstyle@0.2.36
  ├─┬ escodegen@1.8.0
  │ ├── esprima@2.7.2
  │ ├── estraverse@1.9.3
  │ ├── esutils@2.0.2
  │ ├─┬ optionator@0.8.1
  │ │ ├── deep-is@0.1.3
  │ │ ├── fast-levenshtein@1.1.3
  │ │ ├── levn@0.3.0
  │ │ ├── prelude-ls@1.1.2
  │ │ ├── type-check@0.3.2
  │ │ └── wordwrap@1.0.0
  │ └─┬ source-map@0.2.0
  │   └── amdefine@1.0.0
  ├── iconv-lite@0.4.13
  ├── nwmatcher@1.3.8
  ├── parse5@1.5.1
  ├─┬ request@2.72.0
  │ ├── aws-sign2@0.6.0
  │ ├── aws4@1.4.1
  │ ├─┬ bl@1.1.2
  │ │ └─┬ readable-stream@2.0.6
  │ │   ├── core-util-is@1.0.2
  │ │   ├── inherits@2.0.1
  │ │   ├── isarray@1.0.0
  │ │   ├── process-nextick-args@1.0.7
  │ │   ├── string_decoder@0.10.31
  │ │   └── util-deprecate@1.0.2
  │ ├── caseless@0.11.0
  │ ├─┬ combined-stream@1.0.5
  │ │ └── delayed-stream@1.0.0
  │ ├── extend@3.0.0
  │ ├── forever-agent@0.6.1
  │ ├─┬ form-data@1.0.0-rc4
  │ │ └── async@1.5.2
  │ ├─┬ har-validator@2.0.6
  │ │ ├─┬ chalk@1.1.3
  │ │ │ ├── ansi-styles@2.2.1
  │ │ │ ├── escape-string-regexp@1.0.5
  │ │ │ ├─┬ has-ansi@2.0.0
  │ │ │ │ └── ansi-regex@2.0.0
  │ │ │ ├─┬ strip-ansi@3.0.1
  │ │ │ │ └── ansi-regex@2.0.0
  │ │ │ └── supports-color@2.0.0
  │ │ ├─┬ commander@2.9.0
  │ │ │ └── graceful-readlink@1.0.1
  │ │ ├─┬ is-my-json-valid@2.13.1
  │ │ │ ├── generate-function@2.0.0
  │ │ │ ├─┬ generate-object-property@1.2.0
  │ │ │ │ └── is-property@1.0.2
  │ │ │ ├── jsonpointer@2.0.0
  │ │ │ └── xtend@4.0.1
  │ │ └─┬ pinkie-promise@2.0.1
  │ │   └── pinkie@2.0.4
  │ ├─┬ hawk@3.1.3
  │ │ ├── boom@2.10.1
  │ │ ├── cryptiles@2.0.5
  │ │ ├── hoek@2.16.3
  │ │ └── sntp@1.0.9
  │ ├─┬ http-signature@1.1.1
  │ │ ├── assert-plus@0.2.0
  │ │ ├─┬ jsprim@1.2.2
  │ │ │ ├── extsprintf@1.0.2
  │ │ │ ├── json-schema@0.2.2
  │ │ │ └── verror@1.3.6
  │ │ └─┬ sshpk@1.8.3
  │ │   ├── asn1@0.2.3
  │ │   ├── assert-plus@1.0.0
  │ │   ├── dashdash@1.14.0
  │ │   ├── ecc-jsbn@0.1.1
  │ │   ├── getpass@0.1.6
  │ │   ├── jodid25519@1.0.2
  │ │   ├── jsbn@0.1.0
  │ │   └── tweetnacl@0.13.3
  │ ├── is-typedarray@1.0.0
  │ ├── isstream@0.1.2
  │ ├── json-stringify-safe@5.0.1
  │ ├─┬ mime-types@2.1.11
  │ │ └── mime-db@1.23.0
  │ ├── node-uuid@1.4.7
  │ ├── oauth-sign@0.8.2
  │ ├── qs@6.1.0
  │ ├── stringstream@0.0.5
  │ └── tunnel-agent@0.4.3
  ├── sax@1.2.1
  ├── symbol-tree@3.1.4
  ├── tough-cookie@2.2.2
  ├── webidl-conversions@3.0.1
  ├─┬ whatwg-url@3.0.0
  │ └── tr46@0.0.3
  └── xml-name-validator@2.0.1

I'm not quite sure why there are different version numbers between the "node" and "nodejs" executables...


Please let me know if this is helpful to you,

Best regards


Hi Ismael,

Your TEMPLATE looks really nice and I'm eager to try it out myself. 
Though I'm running into problems with the Jobe server that does not recognize the required node packages (e.g. jsdom). 

Could you maybe share some information on how you setup the jobe server such that a certain set of nodejs packages are available for the scripts?

Question Authors' Forum -> File upload/submission question type

by Trent Lewis -

Hi All,

I'd like to float the idea of a "file upload/submission" question type for CodeRunner.  CodeRunner is excellent for testing solutions to questions that small (a single/flle/page of code) and targeted and I commended the creators for their excellent work. 

However, students are appear to more comfortable working in an IDE when developing code solutions and this is how one would develop code in the workplace.  CodeRunner is an excellent tool for small quiz items, however, students feel a disconnect between the code in the IDE and the snippets in the CodeRunner quiz item.  This disconnect appears to lead to an added anxiety during a test.   This might be overcome with more practice with CodeRunner quiz items out of test conditions and more adept students do not raise concerns for their own work, but novice students tend to end up submitting code that compiles/runs in the IDE, but does not “work” in the quiz item.  

A potential solution might be to allow the student to develop in the IDE and submit to the quiz a single file or a package file (for Java this might be a .jar file) that is produced from the IDE.  If the quiz item had an upload file option this could allow the student to upload the package file that could be tested in the CodeRunner Quiz framework on the jobeserver still using the output text matching.”

It could also be interesting to entertain the idea of allowing code to be retrieved from a version control repository.

Thanks in advance,

Trent

Question Authors' Forum -> Java packages -> Re: Java packages

by Peter Sander -

Here's a slightly more finished version of what I've been cobbling up for Java code questions. The java_code_checkr.py is downloadble from here: https://github.com/sanderator/CodeRunner-prototypes.git.


Prototype template for static and / or dynamic checking of student answer java code specifications.

The file java_code_checkr.py should be included as a CodeRunner Support file in a prototype, eg, LOCAL_PROTOTYPE_java_checkr. Java code questions then use this prototype as their Question type.

The support file java_code_checkr.py has the functions documented below:



compile_and_run
compile_and_run(student_answer, testcode, import_static=None, xception=None, ncoding='utf-8')

Assembles code (student answer, support files, tester class.
Then compiles and (hopefully) runs the tester code.

Example of use in template:

from java_code_checkr import compile_and_run
compile_and_run("""{{STUDENT_ANSWER | e('py')}}""", '''{{TEST.testcode}}''')

 When the student answer is expected to throw a given exception there is an additional argument:

from java_code_checkr import compile_and_run
compile_and_run("""{{STUDENT_ANSWER | e('py')}}""", '''{{TEST.testcode}}''',
    xception='''{{QUESTION.parameters.exception}}''')

where the CodeRunner question type / Template params look like:

{"exception": "IllegalArgumentException"}


compile_and_findbugs
compile_and_findbugs(student_answer, testcode, import_static=None, xception=None, ncoding='utf-8')

Compiles the tester code and runs FindBugs on the bytecode.

Example of use in template:

from java_code import compile_and_findbugs
compile_and_findbugs("""{{ STUDENT_ANSWER | e('py') }}""", '''{{TEST.testcode}}''')



check_for_author
check_for_author(student_answer, existing_author=None)

Checks for an author tag in the javadoc comments. With an existing
author argument, checks that another author has been added.
This is in case the student was to modify existing code with an existing author.
If there's no additional author, then raises an error and stops further testing.

Example of use in template:

from java_code_checkr import check_for_author
check_for_author("""{{ STUDENT_ANSWER | e('py') }}""", '''{{QUESTION.parameters.existing_author}}''')

where the CodeRunner question type / Template params look like:

{"existing_author": "J. Random Author"}



check_for_enum
check_for_enum(student_answer, enum)

Verifies that the appropriate enum is declared.
If that's not the case, then raises an error and stops further testing.

Example of use in template:

from java_code_checkr import check_for_enum
check_for_enum("""{{ STUDENT_ANSWER | e('py') }}""", '''{{QUESTION.parameters.enum}}''')

where the CodeRunner question type / Template params look like:

{"enum": "DayOfWE"}



check_for_enum_in_switch
check_for_enum_in_switch(student_answer, enum_const)

Verifies that the appropriate enum constant is used in a switch case statement.
If that's not the case, then raises an error and stops further testing.

Example of use in template:

from java_code_checkr import check_for_enum_in_switch
check_for_author("""{{ STUDENT_ANSWER | e('py') }}""", '''{{QUESTION.parameters.enum_const}}''')

where the CodeRunner question type / Template params look like:

{{"enum": "DayOfWE", "enum_const": "SATURDAY"}}



check_for_extends
check_for_extends(student_answer, subclass, superclass)

Checks for 'class subclass extends superclass'.
If that's not the case, then raises an error and,stops further testing.

Example of use in template:

from java_code_checkr import check_for_extends
check_for_extends("""{{ STUDENT_ANSWER | e('py') }}""", '''{{QUESTION.parameters.subclass}}''', '''{{QUESTION.parameters.superclass}}''')

where the CodeRunner question type / Template params look like:

{"subclass": "Sub", "superclass":"Souper"}