temp files, was: how to re-define the HOME directory?
Subject: temp files, was: how to re-define the HOME directory?
From: Mario Rodriguez
Date: Fri, 05 Jun 2009 21:45:48 +0200
Leo Butler escribi?:
>
> On Fri, 5 Jun 2009, Andrej Vodopivec wrote:
>
> < plot-temp-file is also used in share packages, not just plot.lisp. If
> < you change it, you should make sure you don't break any share
> < packages.
>
> Andrej,
> Thank you for pointing this out. You are correct: share/draw.lisp and
> share/implicit-plot.lisp both use plot-temp-file. Moreover, it does
> appear that these two are broken by this change to plot-temp-file.
>
> There is only one reason why this change would break foo:
> foo is calling plot-temp-file more than once to set the same
> output file.
>
> Perhaps their author(s) could look into this.
>
Time ago I installed Maxima on a server (apache + php) and different
users could open sessions from their web browsers, asking for
calculations via forms and receiving an html document with their
results, graphics included.
The problem was that on the server side, different Maxima sessions used
the same tmp folder to store the files to be processed by gnuplot, as
well as the resulting png graphics, prior to be sent to every user,
along with the corresponding html code. The system should have some
control on the names of these files to avoid sending to one user the
requested graphic made by another user.
My solution was to include two global variables: one for the name of the
file containing gnuplot commands, and the other to store the data. These
two global variables are not documented.
(%i1) load(draw)$
(%i2) gnuplot_file_name : "my_commands_for_gnuplot"$
(%i3) data_file_name : "my_data_for_gnuplot"$
(%i4) draw2d(
file_name = "my_file",
explicit(x^2,x,-1,1),
terminal=png) $
The resulting files are:
my_commands_for_gnuplot
my_data_for_gnuplot
my_file.png
With these variables the user has *complete* control on file names. In
the system I commented above, the names had a randomly generated part,
which helped to identify the user. This random string was stored in a
cookie locally on the client side.
--
Mario