|
Post by votan on Sept 11, 2008 17:51:59 GMT -5
Maybe someone here knows how to do it??? I have a .txt file containing:html "<h1 align = 'center'>Login</h1>" html "<p align = 'center'>" html "</p>" html "<table align = 'center' border = '1'>" html "<tr>" html "<td align = 'center' valign = 'top'>" print "username : "; textbox #username, username$ html "<br>" print "password : "; passwordbox #userpassword, userpassword$ html "<br>" button #submit, "Submit", [checklogin] html "<br> "
Now I want to read it the normal way via "open blahblah for input" as one hunk and then actually display the content of the file as if it would be normal code.... including variables, links etc... Does anyone know how parsing would have to be to actually make it work? ...Already checked out kokenges globlog and it's String-Replace function.... but that allone will not help...
|
|
|
Post by StefanPendl on Sept 12, 2008 2:15:34 GMT -5
To include modules from other source code you need to use the RUN command, the Wiki should have some examples.
|
|
|
Post by votan on Sept 12, 2008 6:45:22 GMT -5
Well, yeah, this would work.... but..... unfortunatily the run command only works with project files.... but as I don't want to create a mass of little projectfiles to call via the run command, I would like to store all files together in a given extra-folder.... so the run command would need to be extended to load files from a given location... like:
loadcode$ = "\public\codebase\" + codename$ + ".bas" run DefaultDir$ + loadcode$, #runcode render #runcode Guess that wouldn't require to much work??
|
|
|
Post by kokenge on Sept 12, 2008 18:18:11 GMT -5
I've had the same problem, and have been playing around with some ideas. This works. Right now it's a subroutine but needs to be made into a function.
I have a project called 'inc' where you could keep all your includes..
For testing I have a program in 'inc' called 'hello.bas' that simply prints "hello world from include"
incdir$ = DefaultDir$ + "\projects\inc_project\"
include$ = "hello.bas" gosub [include] run "inc",#inc render #inc wait
[include] OPEN incdir$ + include$ FOR input AS #f OPEN incdir$ + "inc.bas" for output as #fo while not(eof(#f)) line input #f, a$ print #fo,a$ wend close #f close #fo return
Well - it's something you may want to expand on. Let me know if you get something better, or get this in a function..
Have a great day..
|
|
|
Post by kokenge on Sept 13, 2008 3:16:32 GMT -5
Your idea of loading extra code is working great.
I turned the gosub into a function and it works and is fast.
As a test I have 3 programs in the inc_project directory. hello.bas - simply says hello world. login.bas - a copy of your login code userList.bas - this opens a database and list the users.
They all seem to work ok. This may solve a lot of my problems. I have a few hundred modules in the system that I'm writing and there is just no way I want to have a project for each Run.
Here is the code and test I ran:
incdir$ = DefaultDir$ + "\projects\inc_project\" global incdir$
a$ = include$("hello.bas") ' print hello world run "inc",#inc render #inc
a$ = include$("login.bas") ' your login module run "inc",#inc render #inc
a$ = include$("userList.bas") ' open DB and print user list run "inc",#inc render #inc wait
function include$(include$) OPEN incdir$ + include$ FOR input AS #f OPEN incdir$ + "inc.bas" FOR output as #fo fileLen = LOF(#f) a$ = input$(#f, fileLen) print #fo,a$ close #f close #fo end function
|
|
|
Post by votan on Sept 13, 2008 9:47:18 GMT -5
Nice workaround! But the problem I see here is, that the more simultanous users come, the more writing to disk will occour, what at some point for sure will cause trouble/filelocks/filecorruption/slowdowns.... I guess a simple extension for the run command to allow opening freely definable files is the only real solution. Just let's hope that Carl and his team think so, too....
|
|
|
Post by kokenge on Sept 13, 2008 14:36:38 GMT -5
I ran a quick simulation to see if it could support a load. I'm running on my server. It's the slowest machine I have, since servers don't do much. It only runs at about .8Mhz
Using the 3 programs above. Hello - simply prints hello world. Login - a copy of your login program above List - this opens a user database with 30 users. It list the 30 users in a table with name and address etc. Then closes the database.
I ran 7 test. The test lasted 1 minute. I gathered the times it ran in a minute, and the count per second. Each had a different combination of the programs.
1. hello only - Ran 2200 times for 37 times / second 2. login only - Ran 850 times for 14 times / second 3. list only - Ran 132 times for 2.2 times / second 4. helo + login Ran 666 times for 10.3 times / second 5. login + list Ran 108 times for 1.8 times/ second 6 hello + list Ran 118 times for 2 times / second 7 hello + login + list Ran 98 times for 1.6 times / second
Running on my 2.5mhz machine would easily run 3 times faster.
For the application I'm working on I will probably only get about 20 hits a minute. Worse case I could possibly get 40 to 50 hits a minute.
So for me, this routine looks like it will work.
The only problem is having some other user walking on the inc.bas file before it is RUN. To get around this, I do not close the inc.bas file until after the RUN command. Lockups are not a problem in flat file processing.
HTH..
|
|
|
Post by StefanPendl on Sept 14, 2008 4:18:59 GMT -5
For a multiuser scenario, I would create an inc folder for each session, so each user has its own set of files and there are no file-system-access denied error coming up.
|
|
|
Post by kokenge on Sept 14, 2008 5:55:25 GMT -5
I guess that's possible. My first system install will only have about 1200 to 1500 users. However when I really think about it, there will only be about 300 to 400 users on at any one time. They tend to use it as a group. Especially in manufacturing areas, they tend to sign on by work center. Everyone in that area use the same screens since they are all working on the same thing. So they only need about 3 or 4 screens in each work center.
So I would probably only need about 500+ inc_directories. Managing the inc_project directories and assigning them to a session would be a system in itself.
Probably better to have about 3 or 4 inc_directories. If one has a conflict, use another inc_directory.
However, based on the benchmarks, it appears that I won't have any problem with the single inc_directory. I simply loop until the file conflict ends. If the loop count gets too big it reports an warning. They simply try again, and if they get a few warnings, it reports an error and I'm sure to hear about it. Believe me, I never ever want to hear about it. So I guarantee, somehow this will never happen.
|
|
|
Post by Carl Gundel - admin on Sept 14, 2008 15:54:10 GMT -5
Okay, I've just extended the RUN statement so that it will run not only projects but also BAS files that don't have their own projects. Sorry it's taking me so long to get this next beta out. As they say, the software is never done. -Carl
|
|
|
Post by StefanPendl on Sept 16, 2008 1:42:04 GMT -5
Okay, I've just extended the RUN statement so that it will run not only projects but also BAS files that don't have their own projects. Thats really incredible ;D It is better to have the fixes work, so a good product version is released. Seems that these feature requests are delaying the release
|
|
|
Post by kokenge on Oct 1, 2008 5:34:39 GMT -5
I've just extended the RUN statement so that it will run not only projects but also BAS files that don't have their own projects.
Trying the new Run command on windows xp.
I know it runs synchronously. I'm RUNning a maintenance system that lets you list, add, change, delete and report data in a support file to a larger system. The program is about 1200 lines long. It works great, and it does all the functions I want..
First how do you exit out of a program launched with the RUN command. Is there any way to run it synchronously and wait for the exit out of the RUNed program.
|
|
|
Post by kokenge on Oct 1, 2008 9:00:37 GMT -5
Never mind! I figured out how to do it. Thanks..
|
|
|
Post by votan on Oct 1, 2008 10:54:07 GMT -5
Please share with us how you solved these two issues??
|
|
|
Post by kokenge on Oct 1, 2008 15:22:54 GMT -5
This is not a routine you want to use for something that is used a lot. It's not fast. I happen to have a large system with a lot of support files that need to be maintained. For example I need to maintain users of the system. Probably only done several times a day. Equipment masters are probably only maintained a few times a week. With all the files, I suspect they only run some type of maintenance several times an hour.
Problem is, I have about 50 files. I don't want to put out a project for each file. So I keep all 50+ programs in the same project directory.
Basically I created one project called inc_project. Then use javascript to open the inc.bas program in another window. The inc.bas program RUN's the program I pass to it in that window and the main project continues in it's own window.
Here is a quick sample I wrote. You enter the program name you want to run.
incdir$ = DefaultDir$ + "\projects\inc_project\" [loop] input prog$ html "<SCRIPT> window.open('http://www.yourdomain.com:8008/seaside/go/runbasicpersonal?app=inc&";prog$;"','rbWin');</script>" goto [loop] end
Here is the inc.bas program in the inc_project
incdir$ = DefaultDir$ + "\projects\inc_project\" prog$ = word$(UrlKeys$,2,"&") run incdir$;prog$,#include render #include wait end
I'm still testing it. but it seems to work. I do have one problem I haven't figured out yet. When you end the main program it somehow wants to run the last program again in the opened window. Not a big deal form me since they never close the main program anyway.
|
|