JCornish

25 Reputation

2 Badges

17 years, 22 days

MaplePrimes Activity


These are replies submitted by JCornish

Hello pedro, You are correct that if the student enters a response that is nonsensical in terms of Maple syntax, and error will be thrown. However, if you wish to avoid your students having to include quotes in their response, then they will have to enter valid Maple syntax. I should point out that your example of '+3' is in fact valid Maple syntax and will be treated simplay as '3'. However, a response of '*+3' will be invalid. Jason Cornish Maplesoft
Hello pedro, You are correct that if the student enters a response that is nonsensical in terms of Maple syntax, and error will be thrown. However, if you wish to avoid your students having to include quotes in their response, then they will have to enter valid Maple syntax. I should point out that your example of '+3' is in fact valid Maple syntax and will be treated simplay as '3'. However, a response of '*+3' will be invalid. Jason Cornish Maplesoft
Hello Pedro, I've tried the question bank you posted with FF1.5 and IE6.0 running JREs 1.4.2_09 and 1.5.0_08. The applet worked in all versions. I did encounter the same messages in the Console. 'false' appeared for each click, and the error about the x-coord only appeard when I clicked for a new node and the x-coord matched exactly the value of an already existing node. Other than that no problems were encountered. WHen you say that the applets didn't work, do you mean that no new nodes ever appeared? Jason Cornish Maplesoft
Hello Pedro, I've tried the question bank you posted with FF1.5 and IE6.0 running JREs 1.4.2_09 and 1.5.0_08. The applet worked in all versions. I did encounter the same messages in the Console. 'false' appeared for each click, and the error about the x-coord only appeard when I clicked for a new node and the x-coord matched exactly the value of an already existing node. Other than that no problems were encountered. WHen you say that the applets didn't work, do you mean that no new nodes ever appeared? Jason Cornish Maplesoft
I recently had another request for a more concrete example of how to do this so i'll give it a shot. First create your java class, let's call it TAjava.java:

import java.util.*;

public class TAjava implements gateway.question.random.AlgorithmicFunction {

public String eval(String[ ] args) {

  String st = "Your String array contains the Strings:\n";
  for( int i=0; i<args.length; i++ ) {
    st += i + ": " + args[i] + "\n";
  }
  return st;
}

}

This class implements the 'gateway.question.random.AlgorithmicFunction' from the edu15.jar file and contains a public method call eval which accepts an array of String and returns a String. In this case it merely returns the contents of the original with their position in the array in front, nonthing fancy. eval("string1","string2"); returns "Your String array contains: 0: string1 1: string2" so now we need to compile this class (I have JDK 1.4.2_09 installed). You can check this by typing (at a command prompt) the command: > java -version So let's compile. Go to the folder that contains your class. > javac -classpath "c:\program files\MapleTA2.51\lib\edu15.jar" TAjava.java This will create the file TAjava.class. Now we need to put this into a jar file. > jar cfv TAjava.jar TAjava.class This will create a jar called TAjava.jar. This jar needs to be added to Maple T.A.'s classpath. I'm using Windows so i'll start by copying the Jar into Maple T.A.'s lib folder (C:\Program files\MapleTA2.51\lib). Then edit the wrapper.conf file in the config folder (C:\Program files\MapleTA2.51\configwrapper.conf) and add the line wrapper.java.classpath.{n}=../lib/TAjava.jar below the other similar lines and where {n} is the next number. Now start (restart) the server. Go into an algorithm in a question and add the line $a=java("TAjava","string1","string2"); and you should get the value a Your String array contains: 0: string1 1: string2 Hopefully this helps. You can of course edit the eval method to do anything you want with the array of strings as long as it returns a single strings. Helper methids could also be added to the class but they cannot be called from within Maple T.A. Jason Cornish Maplesoft
I recently had another request for a more concrete example of how to do this so i'll give it a shot. First create your java class, let's call it TAjava.java:

import java.util.*;

public class TAjava implements gateway.question.random.AlgorithmicFunction {

public String eval(String[ ] args) {

  String st = "Your String array contains the Strings:\n";
  for( int i=0; i<args.length; i++ ) {
    st += i + ": " + args[i] + "\n";
  }
  return st;
}

}

This class implements the 'gateway.question.random.AlgorithmicFunction' from the edu15.jar file and contains a public method call eval which accepts an array of String and returns a String. In this case it merely returns the contents of the original with their position in the array in front, nonthing fancy. eval("string1","string2"); returns "Your String array contains: 0: string1 1: string2" so now we need to compile this class (I have JDK 1.4.2_09 installed). You can check this by typing (at a command prompt) the command: > java -version So let's compile. Go to the folder that contains your class. > javac -classpath "c:\program files\MapleTA2.51\lib\edu15.jar" TAjava.java This will create the file TAjava.class. Now we need to put this into a jar file. > jar cfv TAjava.jar TAjava.class This will create a jar called TAjava.jar. This jar needs to be added to Maple T.A.'s classpath. I'm using Windows so i'll start by copying the Jar into Maple T.A.'s lib folder (C:\Program files\MapleTA2.51\lib). Then edit the wrapper.conf file in the config folder (C:\Program files\MapleTA2.51\configwrapper.conf) and add the line wrapper.java.classpath.{n}=../lib/TAjava.jar below the other similar lines and where {n} is the next number. Now start (restart) the server. Go into an algorithm in a question and add the line $a=java("TAjava","string1","string2"); and you should get the value a Your String array contains: 0: string1 1: string2 Hopefully this helps. You can of course edit the eval method to do anything you want with the array of strings as long as it returns a single strings. Helper methids could also be added to the class but they cannot be called from within Maple T.A. Jason Cornish Maplesoft
According to the help page, the class must implement 'gateway.question.random.AlgorithmicFunction' and must have a public method called 'eval' that takes an Array of Strings and returns a String. for example:
..imports..

public class SomeClass implements gateway.question.random.AlgorithmicFunction {

  public String eval( String[] args ) {
    String st;
    ... do something here ...
    return st;
  }
}
Be sure to add the edu15.jar file from TA's lib folder to your classpath to compile your class. Jason Cornish Maplesoft
According to the help page, the class must implement 'gateway.question.random.AlgorithmicFunction' and must have a public method called 'eval' that takes an Array of Strings and returns a String. for example:
..imports..

public class SomeClass implements gateway.question.random.AlgorithmicFunction {

  public String eval( String[] args ) {
    String st;
    ... do something here ...
    return st;
  }
}
Be sure to add the edu15.jar file from TA's lib folder to your classpath to compile your class. Jason Cornish Maplesoft
Hello Florian, The problem is due to compiling with JDK 1.5. This will create a class that is only useable with JDK 1.5. Maple TA uses Java 1.4. You can get around this by compiling with JDK 1.4 or by compling with the -source option when using 1.5 javac -source 1.4 ... Hope this helps. Jason Cornish Maplesoft
Hello Florian, The problem is due to compiling with JDK 1.5. This will create a class that is only useable with JDK 1.5. Maple TA uses Java 1.4. You can get around this by compiling with JDK 1.4 or by compling with the -source option when using 1.5 javac -source 1.4 ... Hope this helps. Jason Cornish Maplesoft
On a Mac, Maple 10 will use the system's JVM. With Java 1.5, Sun removed the Apache Crimson component that Maple 10 requires. Your options would be to either swtich back to the supported JRE 1.4.2 or to download the Crimson parser. http://xml.apache.org/crimson/downloads.html Jason Cornish Maplesoft
Page 1 of 1