Useful code snippets

    I'm having problems resetting the hw5.sxml_log file.
    Is there any way that I can delete the log file and
    start all over?
    
    Yes, you can add another password field to your form which would be used for reseting:
    Enter admin password to reset page:<input type=password name="reset"> ...
    Then in your sxml, you reset the logs and counters if the reset password is correct
    (let ( ... (reset (.getParameter request "reset")) ... ) (if (equal? reset "yabbadabbadoo") (begin (write-to-file httpservlet request "log" "") (write-to-file httpservlet request "counter" "0") (write-to-file httpservlet request "othercounter" "0")) <xml> <html><body bgcolor=lightgreen>Logs have been reset</body></html> </xml> (begin ...rest of your code goes here .... ) ) )


  1. How can I have my servlet startup my applet as well?
    
    This is pretty easy, if your applet is in "hw5a.applet" then you just add the following code into your hw5.sxml program:
    <xml> <applet code="silk.SchemeApplet" codebase="." archive="/user/jscheme/applet.jar, /user/jscheme/cs2a.jar" height=20 width=200> <param name=prog value="hw5a.applet"> </applet> </xml>
    Similarly, you can add this tag to html if you want your applet to automatically run when you visit the page.

  2.