Code Comments
Programming Forum and web based access to our favorite programming groups.I want to run two programs ( one foreground, and one background) that can read / change the same variable ( a [list] ) . THe background program will keep the list updated, while the forground redisplays it when a change is detected. Can I do that using namespace ?
Post Follow-up to this messageMitch wrote: > I want to run two programs ( one foreground, and one background) that > can > read / change the same variable ( a [list] ) . What do you mean by 'program'? Is it Tcl Script or standalone executable application? -- Pozdrawiam (Greetings)! Googie
Post Follow-up to this messagesorry to be so vague.. I want to run a Tcl script , that will run another tcl script in the background to keep a buffer ( the [list] ) updated. ...M' Googie wrote: > Mitch wrote: > > > > > What do you mean by 'program'? Is it Tcl Script or standalone > executable application? >
Post Follow-up to this messageSince you have 2 seperate process running you will need some type of inter-process communication mechanism. When I do this I have one program write to a file and the other program reads the file. If there is a change then take action. Another method is to open a pipe between the 2 programs, or use the comm package in TCLLIB. Also, I have stopped calling my TCL programs "scripts". I have noticed that many people (managment types and even some engineers) think of scripts as being trivial programs.
Post Follow-up to this messageI need one program to update the variable in another one, can I use namespac e to share that varname ? ( and ditto about the "script" word, never to be used in mixed company! ) ...M bbeacham@desanasystems.com wrote: > Since you have 2 seperate process running you will need some type of > inter-process communication mechanism. When I do this I have one > program write to a file and the other program reads the file. If there > is a change then take action. > > Another method is to open a pipe between the 2 programs, or use the > comm package in TCLLIB. > > Also, I have stopped calling my TCL programs "scripts". I have noticed > that many people (managment types and even some engineers) think of > scripts as being trivial programs. >
Post Follow-up to this message"Mitch" <uqrudev@houston.rr.com> wrote in message news:TEqTd.43017$cW2.40808@fe2.texas.rr.com... > I need one program to update the variable in another one, can I use namespace to share > that varname ? > ( and ditto about the "script" word, never to be used in mixed company! ) > > ...M Nope. Separate Tcl programs cannot share variables. If you truely need separate programs I suggest you make them communicate by 2 way pipes or sockets. Both methods are relatively easy in Tcl. But perhaps you can solve your issue with 1 program. Folks here will help if you explain in more detail. For example, what is the "background" program doing while it's not updating the list? Roy > > bbeacham@desanasystems.com wrote: >
Post Follow-up to this messageI'll gladly elaborate. My program displays and edits the data from a multichannel data set. think of it as a line graph of a sound wave. (Actually between 15 to 50 channels simultaneously) Each channel of data is stored as a textfile of integers, one value per line typical files are 900,000 lines long, but could be much larger. (now multiply that 900,000 scans by 15 channels, that is my basic data set ! ) The User can use provided controls to zoom and "browse" up and down the grap hs, which are displayed as "line" objects on canvas widgets. A typical canvas wo uld be perhaps 900x75 (xy) in size. I currently load up the whole banana, I load all the data in all the channel s into a tcl [list] which consists of a list of sublists, each sublist containing al l the data for one channel. (a list of lists) . Then based on User input, I grab the part of the list that needs to be displ ayed and redraw the linegraph on the canvas. When I first wrote the program , the data sets were much smaller and all wen t well. But now , the program has gotten popular , been distributed on 3 continents (oil field) and now getting used on HUGE data sets that I never expected or tested for. The result is that it A) eats up ALOT of RAM and B) the big [list] is clumsy. Changing its contents (like after an edit) take a considerable time. As does getting an lrange of data to display. I am trying to find an alternative way to move quickly through the data for zoom and browse operations. My primary goal is to speed up the display and minimize RAM. ...Mitch Roy Terry wrote: > "Mitch" <uqrudev@houston.rr.com> wrote in message > news:TEqTd.43017$cW2.40808@fe2.texas.rr.com... > > > namespace to share > > > company! ) > > > Nope. Separate Tcl programs cannot share variables. > > If you truely need separate programs I suggest you make them communicate b y > 2 way pipes or sockets. Both methods are relatively easy in Tcl. > > But perhaps you can solve your issue with 1 program. Folks here > will help if you explain in more detail. For example, what is the > "background" > program doing while it's not updating the list? > > Roy > > >
Post Follow-up to this messageTcl does also have threads, if they are compiled in, which can be made to share variables, or data. -- David N. Welton - http://www.dedasys.com/davidw/ Apache, Linux, Tcl Consulting - http://www.dedasys.com/
Post Follow-up to this messageMitch wrote: > I'll gladly elaborate. > > My program displays and edits the data from a multichannel data set. > > think of it > as a line graph of a sound wave. > (Actually between 15 to 50 channels simultaneously) > > Each channel of data is stored as a textfile of integers, one value > per line > typical files are 900,000 lines long, but could be much larger. > (now multiply that 900,000 scans by 15 channels, that is my basic data set > !) > > The User can use provided controls to zoom and "browse" up and down > the graphs, > which are displayed as "line" objects on canvas widgets. A typical > canvas would be > perhaps 900x75 (xy) in size. > > I currently load up the whole banana, I load all the data in all the > channels > into a tcl [list] which consists of a list of sublists, each sublist > containing all the data for one channel. (a list of lists) . > Then based on User input, I grab the part of the list that needs to > be displayed and > redraw the linegraph on the canvas. > > When I first wrote the program , the data sets were much smaller and all > went well. > But now , the program has gotten popular , been distributed on 3 > continents (oil field) and now getting used on HUGE data sets that I never > expected or tested for. > > The result is that it A) eats up ALOT of RAM and B) the big [list] > is clumsy. > Changing its contents (like after an edit) take a considerable time. As > does getting an lrange of data to display. > > I am trying to find an alternative way to move quickly through the > data for zoom and browse operations. > > > My primary goal is to speed up the display and minimize RAM. > > ...Mitch > If you are interested in speeding up your application, you should really download and use the BLT exentension for TCL/TK. This extension provides several additional widgets for TK, including a very nice graph widget which has all that good zooming stuff built into it. Additionally, you can load your data into BLT's vector object instead of a list. This will allow you to store your data into memory using a binary format. You should also be able to remove a lot of TCL code whose functionality can be replaced by the BLT graph widget.
Post Follow-up to this messagehmmmmm, major code change, but sounds very interesting, I'll take a look. ....M' Dennis LaBelle wrote: > Mitch wrote: > > > > If you are interested in speeding up your application, you should really > download and use the BLT exentension for TCL/TK. > > This extension provides several additional widgets for TK, including a ver y > nice graph widget which has all that good zooming stuff built into it. > Additionally, you can load your data into BLT's vector object instead of a > list. This will allow you to store your data into memory using a binary > format. > > You should also be able to remove a lot of TCL code whose functionality ca n > be replaced by the BLT graph widget. >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.