Updated 2014-01-13 20:05:52 by dkf

Arjen Markus (2 may 2007) Now that the Wiki is (almost) back in its former glory, I had a wildish idea about using the server it runs on for more Tcl applications.

Not hindered by much knowledge of the technical difficulties, I propose:

  • "We" implement a mechanism to run other Tcl applications
  • "We" use the Wiki as a repository for Tcl plugin demonstrations and more serious applications

Just to make it more concrete:

One possible application could be to make some of the Wiki entries interactive. Take for instance a page like Fun with functions. Rather than a static picture and a lot of code, the page could show a graph and a few entry widgets. You enter a few data, press the refresh button and there you are: a new graph for the new function or range.

More elaborate applications are possible too of course.

(Enough for now, this is the basic idea)

RS Um.. somehow this goes in the direction of remote Tclets - without Tcl/Tk Tclet Plugin. As I wrote Fun with functions, let's consider what would be needed in that case:

  • an interface where new user input (a string) would come in
  • the function graph is rendered on a canvas, so we'd need a screenshot (using Img)
  • This requires that the app is on-screen, and not covered by other windows :(
  • If that can be assured, making a screenshot and saving it to a designated image file (GIF or JPEG) is a matter of a few lines of code
 set im [image create photo -data .c] ;# or whatever the canvas is called
 $im write $filename -format JPEG
 # notify Wub that it can refresh the served page

AM You can do that with:
   raise .
   tkwait visibility .
   set im [image create photo -data .c -format window]
   $im write $filename -format JPEG

   # notifiy Wub ...

Some problems: the server may not have an X Display to work with and you could get race conditions (two users who both want their windows to show up on top at the same time). Then it would be best to use a frame buffer instead of a visible X Window window.

LV Security issues would need to be addressed, to prevent people from performing destructive operations. I suspect that something making use of safetcl/safe interps would help.

DKF: I know (from private communication) that Gerald Lester is working on an application server idea where the basic plan is to run the whole application inside a safe interpreter with resources (databases, web services, log files, etc.) aliased in from the outside world according to a descriptor that can be vetted by the administrator. It seems like an awesome idea (speaking as someone who writes that sort of thing for a living) and it uses the power of Tcl to great effect. But he should write it up publicly, not me.