From: Timothy J. H. <tim...@ma...> - 2004-03-26 03:29:38
|
On Mar 25, 2004, at 4:45 PM, Ken Anderson wrote: > I think this would be great! And Tim, i like the new interactive > Tutorial! Thanks.... its starting to take shape nicely.... I'm having fun teaching CS concepts (abstraction, procedure calling) without doing any numerical calculation at all, and still doing interesting examples.... I just presented this curriculum in the SIGCSE 2004 conference and the talk went pretty well. I'd like to provide a machine that anyone could use to try out the web programming ideas, but I have to work on the security issues a little more first. For now, the tutorial is available here: http://tat.cs.brandeis.edu:8090/spr04/typcs04/tutorial/intro.servlet This uses the latest version of the jscheme teaching webapp which includes a U-method for uploading and editing servlets with a web interface, and the V-method for getting color coded error checked versions of servlets and applets using a web interface. I can give U-method access to interested jscheme-users who want to play with it. Or you can download the webapp at http://tat.cs.brandeis.edu:8090/spr04/jscm.tgz and install it in a servlet container like tomcat, jetty, or resin.... > > I think we should exchange some code as you write the tutorial so we > can come up with an appropriate style. Good idea. I'm including the code I use for databases below. I usually create a connection when the webapp is first loaded and then use that connection to define a procedure dbquery that sends strings to the database and gets a list of lists back. The first row gives the types of the columns (metainfo). The db.scm procedure below defines the following procedures ;(define database 'mysql) (define database 'hsqldb) ;; this specifies which of the databases is going to be used mysql or hsqldb ;; This defines the proper driver (define jdbc-driver .... (define jdbc-driver-class (java.lang.Class.forName jdbc-driver)) (define (connect host/db user pw) ; this creates a connection to the specified DB (define (handlequery con query) ; this sends the query to the DB and returns a list of lists as above (define (runquery host/db user pw query) ;; this combines connect and handlequery (define (toMYSQL x) ;; this generates an SQL quoted string from a JScheme string (define (toHSQL x) ;; this generates an HSQL quoted string, with all (')s doubled (''), (define toSQL ;; this selects the quoting mechanism based on which database is being used.... |