Project: Cplua
#521
Posted 27 February 2006 - 09:15 PM
CPLua 0.8 RC2 fixes all the bugs you reported, and some other ones (the interactive mode for example was completely unusable )
Thanks again for your help
#522
Posted 28 February 2006 - 02:47 PM
Seems to be ok now .Okay, let's try again
DLMfit has two examples for curve fitting. It defines and uses rather large matrices, and it requires several library chunks, so it is currently a "memory devourer". Loading library chunks is unavoidable, if you want to write well-structured programs, so I'm afraid that DLMfit's memory demands cannot be reduced. Glad to know that it also helps as a check program.Actually I used DLMFit as benchmark to check the gain in performances concerning the memory usage
Note that the problem with those programs don't really come from the garbage collection; it's just that LuaNumAn is rather large, and each chunk loaded in Lua requires a lot of memory (3 to 5 times its size as source code! ).
I have thought about this several times, but I think that loading all the chunks from the beginning helps the user to easily find the dependencies of the program. Loading each chunk just where it is needed is also a good programming habit; for example require("LuaPlot/PlotFunc") can be placed just before the first call of PlotFunc function. However, the user will need to search the whole program just to find the dependencies (and, currently, there is no a "Find" capability ). Furthermore, I don't know what will happen if require("LuaPlot/PlotFunc") is whithin a loop...Btw, I noticed that you allways load the libraries at the beginning of each chunk. That means that even if you use a function at the very end of the program (LuaPlot for example), you reserve a lot of memory for it at the beginning, hence the memory crashes. Maybe you should consider using doscript() instead of require() for functions like LuaPlot: you may also pass some arguments to the called script, and return some value, but the advantage is that you only load the chunk when you really need it require() could also be used near the end of a program, not only at the beggining.
As I suspected. No problem for me. Better than setting your preferences each time you open CPLua.It's just a file containing your preferences: the keyboard and the font you choosed (there will certainly be more options later). It is saved each time you close CPLua. I'm sorry about this, but I didn't have many choices
Aaargh! Can you believe this? I didn't knew that you can mark, copy and paste text directly from the emulator . To be honest, I don't use the emulator much (just to take screenshots).If you just want to exchange Lua programs with text files on the computer, you can copy/paste the code from the emulator... Note there will never be a "magic tool" to transform a MCS files with Lua programs (even saved as TEXT variables) into a simple txt file on the computer... You will allways have to deal through the emulator. I agree it could be convenient to be able to save the output of a program however.
#523
Posted 28 February 2006 - 02:59 PM
#524
Posted 28 February 2006 - 04:07 PM
Kilburn noticed some other bugs in RC2, and I fixed it. There should be a new RC3 version soon, but I will wait a little to see if someone else encoutered problems with the RC2Seems to be ok now .
Well, I was suspecting itAaargh! Can you believe this? I didn't knew that you can mark, copy and paste text directly from the emulator . To be honest, I don't use the emulator much (just to take screenshots).
I suppose the goal is to save the output of programs running on the classpad, more than on the emulator...If I understand, you want to save the output of a program in a .TXT file. In that case, why don't you use Windows functions from fstream in the add-in
However, if you really want it I could perhaps add an import/export facility in the editor (on the emulator only) to open or save an ordinar Lua program in a computer's txt file... I'll think about that
Note that you could simply use copy/paste between the emulator and the notepad though.
#525
Posted 01 March 2006 - 12:39 PM
#526
Posted 01 March 2006 - 01:44 PM
"Release Candidate". It's a very common abbreviation in version numbering schemes . Another option is "pre", which means "pre-release". Both are handy, although I personally don't like abbreviations.What does "RC" mean?
#527
Posted 01 March 2006 - 07:02 PM
#528
Posted 07 March 2006 - 07:40 AM
There was a last bug in CPLua 0.8 RC3 though: if an error occurs in a chunk called with require or doscript, it doesn't stop the main program; it just continues after the call. This can lead to some strange situations, but it has already been fixed for the next version
#529
Posted 07 March 2006 - 02:11 PM
1. Did you add a function for calling Main, orwell? (e.g ShowMainWindow). It is useful... We can create a math program that at the top section Lua's output says what to do, and we write our calcs in the bottom part that is the Main window.
2. Please enable lua to access the Variable Manager... The open and save dialogs are good, but they don't show the file's size.
3. Step-by-step debugging.
4. (The most important one) Why don't you upload CPLua to classpad.org? It can be a good advertisement for Lua (and for the ClassPad forums).
Thanks, bye.
#530
Posted 07 March 2006 - 02:47 PM
Although I'm not Orwell, I think I have something to say:Some suggestions (if you won't become unhappy):
I'm afraid that I don't understand, or you are confused a little bit... You can "write your calcs" in the input window, which is enabled by the "input" function. Currently, the input window is restricted to one-line, at the bottom of the screen.1. Did you add a function for calling Main, orwell? (e.g ShowMainWindow). It is useful... We can create a math program that at the top section Lua's output says what to do, and we write our calcs in the bottom part that is the Main window.
Sounds useful. Note, that this is for user's information only; CPLua has full access to user (or system) variables, via the "cas" function.2. Please enable lua to access the Variable Manager... The open and save dialogs are good, but they don't show the file's size.
This subject has been discussed several months ago. Orwell said that he will not upload CPLua to classpad.org until it reaches version 1.4. (The most important one) Why don't you upload CPLua to classpad.org? It can be a good advertisement for Lua (and for the ClassPad forums).
#531
Posted 07 March 2006 - 04:59 PM
About MainWindow... PAP You are right... there is input line, but we can all agree that one line calculation is not enough. I know, You can say now that Lua should do the calculations, but in my case I often need to pre-calculate something before I can feed a program with data.
#532
Posted 07 March 2006 - 06:10 PM
I see what you want, but it is very difficult to do... When I started CPLua I decided to use my own system to manage the different windows (main menu, edition, console...) instead of the standard system used by the other applications. It is now quite easier to handle windows with this, and it allows some other interesting features (custom keypads, full screen, ...), so I think that it was a good choice; however I can't display a window that uses the standard system (like the Main Application) anymore1. Did you add a function for calling Main, orwell? (e.g ShowMainWindow). It is useful... We can create a math program that at the top section Lua's output says what to do, and we write our calcs in the bottom part that is the Main window.
However, I don't think that it's completely impossible to do, but this would take time
It's already done since CPLua 0.8 RC1 ... Look in the "Settings" menu, there is an option to open the Variable manager2. Please enable lua to access the Variable Manager... The open and save dialogs are good, but they don't show the file's size.
It is possible to create a debugger, and there 2 ways to do that.3. Step-by-step debugging.
1) convert the standard "debug" package to CPLua; it is currently disabled, but I hope that it won't be too hard due to CPlua's specifications (like chunk isolation etc)... I will take a look.
2) use some hacks to break the execution between each line, or between each instructions etc, and display information about the current existing variables, the environment... This would be a real debugger. I shouldn't be too hard (Lua allows that); however, the screen of the ClassPad isn't very large and I don't know how I should display all these informations
I need your ideas and opinions about this
Like PAP said, I would like to wait the first official version. I don't want too many people to start some big projects, and be forced to modify it between each major release because of some new incompatibilities.4. (The most important one) Why don't you upload CPLua to classpad.org? It can be a good advertisement for Lua (and for the ClassPad forums).
But don't worry, CPlua 1.0 should come soon; I don't think that there will be many structural changes after CPLua 0.8 (but if you think about some large improvements or important modifications, say it NOW! )
Whoops, it seems like there are still some functions in this package waiting to be implemented. I'll see what I can doHi! My problem is concerning IO package... its cannot make a list of directories in Root Directory... what I need is fold:content() which lists folders. Is it possible to do it? (options are: list of folders or access to variables manager)
About the Main Window again: remember that you can use the CAS package to create variables and save their values... You could for example write a Lua program that creates a list in the variable manager, and use this list for some later calculations in the Main Window I know that it's less handy, but it's better than nothing
#533
Posted 07 March 2006 - 06:33 PM
I would like to insist on this a little bit more: If you think that something could be made in another, more comfortable way (for example, you have a better idea for the menu that appears when you open CPLua ), please say it, it's not too lateLike PAP said, I would like to wait the first official version. I don't want too many people to start some big projects, and be forced to modify it between each major release because of some new incompatibilities.
But don't worry, CPlua 1.0 should come soon; I don't think that there will be many structural changes after CPLua 0.8 (but if you think about some large improvements or important modifications, say it NOW! )
#534
Posted 07 March 2006 - 08:06 PM
Was You thinking about this My Lua Programs (for faster programs launching) ?
#535
Posted 07 March 2006 - 08:28 PM
Was You thinking about this My Lua Programs (for faster programs launching) ?
Were you thinking.... no?
This has be already asked, I think this is not impossible to implement.
And there is a strange problem about the draw.line function that was here since CPLua 0.6. In the Scribble example program, il you set the drawing thickness to 3 or higher, the lines doesn't draw correctly....
#536
Posted 07 March 2006 - 09:16 PM
Many people here (like the two of us too) have a native language which is different from English. We are all doing our best to be understood by the others, but some people may have more difficulties than the others. I think that such comments should be avoided, if possible.Were you thinking.... no?
And Kilburn, I'm sorry to say that, but it seems like the mean age of people here is 19~20 year old (or maybe older). Why do you allways make us remember that you're only 14? Sometimes a more mature behavior would be welcome
#537
Posted 07 March 2006 - 11:21 PM
I think that a "pause" command will be sufficient. We can use it to temporarily suspend program execution, and enter the "interactive" mode. Note that this should be a "dedicated" interactive mode, able to access variables of the chunk being run. This way we will be able to inspect the values of variables, by using standard CPLua functions in the interactive mode (such as print or table.foreach), or to assign new values to the variables. Then a "resume" command will return CPLua to normal program execution, until another "pause" command is reached. This functionality is similar to the "breakpoints" used in all developement packages. It will not be a "real" debugger, but it will be very useful, and it seems easier to implement.It is possible to create a debugger, and there 2 ways to do that.
1) convert the standard "debug" package to CPLua; it is currently disabled, but I hope that it won't be too hard due to CPlua's specifications (like chunk isolation etc)... I will take a look.
2) use some hacks to break the execution between each line, or between each instructions etc, and display information about the current existing variables, the environment... This would be a real debugger. I shouldn't be too hard (Lua allows that); however, the screen of the ClassPad isn't very large and I don't know how I should display all these informations
I need your ideas and opinions about this
IMHO, this should be considered as the first thing in the "to do" list. However, I'm afraid that it is not as easy as it looks. Orwell, what do you think?searching/replacing ability should be developed in editor.
I noticed this problem only recently, since I don't use thick lines often. When I implemented LuaPlot (4 months ago), it was possible to use line thicknesses of 3 or more pixels. Now, such thick lines are not drawn correctly. This is probably a bug in the "draw" package.And there is a strange problem about the draw.line function that was here since CPLua 0.6. In the Scribble example program, il you set the drawing thickness to 3 or higher, the lines doesn't draw correctly....
Btw, is it possible to add another optional argument in the "line" function, so that dashed lines will be available?
I totally agree. English is not a very rich language, anyway.Many people here (like the two of us too) have a native language which is different from English. We are all doing our best to be understood by the others, but some people may have more difficulties than the others. I think that such comments should be avoided, if possible.
#538
Posted 08 March 2006 - 08:39 AM
Yes, I saw it, thanks.Accessing Variable Manager is already done since CPLua 0.8 RC1
Maybe:It is possible to create a debugger, and there 2 ways to do that:
...
However, the screen of the ClassPad isn't very large and I don't know how I should display all these informations.
I need your ideas and opinions about this
ShowMsg("Var1:"..FirstVar.."\nVar2:"..SecondVar)
It shows a message box. How do you think about it?
Again thanks.I will take a look.
And a question:
Is there a Wait function in Lua? Or I still must use "for x=0,1000 do end" for wait?
#539
Posted 08 March 2006 - 08:12 PM
Is there a Wait function in Lua? Or I still must use "for x=0,1000 do end" for wait?
No...
And for the debugger, you could make a simple function debug() that displays a big dialog window with all the variables used and their values. Is that possible? And assign a "debug" key that will be never used in the program, so if you define EXE as the debug key, when you press EXE, the executions breaks and the dialog window appears.
#540
Posted 09 March 2006 - 09:28 AM
I think that a "pause" command will be sufficient. We can use it to temporarily suspend program execution, and enter the "interactive" mode. Note that this should be a "dedicated" interactive mode, able to access variables of the chunk being run. This way we will be able to inspect the values of variables, by using standard CPLua functions in the interactive mode (such as print or table.foreach), or to assign new values to the variables. Then a "resume" command will return CPLua to normal program execution, until another "pause" command is reached.
Okay I will first try to convert the standard "debug" package thenAnd for the debugger, you could make a simple function debug() that displays a big dialog window with all the variables used and their values. Is that possible? And assign a "debug" key that will be never used in the program, so if you define EXE as the debug key, when you press EXE, the executions breaks and the dialog window appears.
The idea concerning a "debug key" sounds interesting, but which key would you suggest?
What do I think? I think that it's a real nightmare But if you really need it, I'll try...IMHO, this should be considered as the first thing in the "to do" list. However, I'm afraid that it is not as easy as it looks. Orwell, what do you think?
It is certainly useful, not only for debugging; but this should be a part of a future "UI" packageShowMsg("Var1:"..FirstVar.."\nVar2:"..SecondVar)
It shows a message box. How do you think about it?
I can't implement such a function with the SDK (at least for now)... Or maybe only for an entire number of seconds (e.g. wait(5) = wait 5 seconds). I don't have currently any way to measure time with a better precision.Is there a Wait function in Lua? Or I still must use "for x=0,1000 do end" for wait?
#541
Posted 09 March 2006 - 12:27 PM
The idea concerning a "debug key" sounds interesting, but which key would you suggest?
A function like setdebugkey(key_code) Or a Debug button on the toolbar, near Break.
#542
Posted 09 March 2006 - 12:54 PM
I don't have currently any way to measure time with a better precision.
SH3Timers could be used, but it's an unsupported featureand it doesn't work on PC. Maybe there is a Windows timer...
#543
Posted 19 March 2006 - 05:04 PM
for a = 0, 10, 0.1 do if a == 1 then print("found") end endNever prints "found" although it should. I think it's a problem with float numbers.
#544
Posted 19 March 2006 - 05:09 PM
This is not a bug, actually. It's a common problem with computer arithmetics: 0.9+0.1 is not necessarily equal to 1. It may be 0.9999999999 or 1.000000000001, due to the way float numbers are stored in memory. You should never compare float numbers this way. Just replace a==1 with math.abs(a-1)<tiny, where tiny is a small number, e.g., 1e-7. Note that the same problem is present in every computer system.I've found a bug:
for a = 0, 10, 0.1 do if a == 1 then print("found") end endNever prints "found" although it should. I think it's a problem with float numbers.
#545
Posted 19 March 2006 - 05:32 PM
#546
Posted 19 March 2006 - 06:16 PM
However, you don't have this problem with the other ClassPad applications, because it uses BCD numbers instead of float numbers. But this uses a lot more memory and is considerably slower.
Users who want to work with true precision should consider the CAS package, which uses BCD numbers... Btw I just saw that comparators ( <, >=, etc) between CAS objects would be useful too for that kind of problems, I will take a look on it.
#547
Posted 19 March 2006 - 08:43 PM
require "dane"
function wydruk(wiersz,kol)
for i=wiersz,wiersz+8 do
print(tab1[i][kol])
end
end
a=5.2
b=-3
wydruk(a-0.2,b+6)
And this not:
require "dane"
function wydruk(wiersz,kol)
for i=wiersz,wiersz+8 do
print(tab1[i][kol])
end
end
a=input()
b=-3
wydruk(a-0.2,b+6)
"tab1" is a large 2 dimensional table stored in "dane"
#548
Posted 19 March 2006 - 08:58 PM
require "dane" function wydruk(wiersz,kol) for i=wiersz,wiersz+8 do print(tab1[i][kol]) end end a=input() b=-3 a=tonumber(a) wydruk(a-0.2,b+6)
#549
Posted 19 March 2006 - 09:08 PM
Be careful with CPLua 0.8C: there could be an error in your script "dane", and CPLua won't raise any error; it will just stop its execution and continues after the call to require. This is really annoying and has been corrected for the next version that I must release quickly
#550
Posted 19 March 2006 - 09:22 PM
require "dane"
function wydruk(wiersz,kol)
for i=wiersz,wiersz+8 do
print(tab1[i][kol])
end
end
a=input()
b=-3
a=tonumber(a)
wydruk((a-5)/0.2,b+6)
This rises error.
And I have still another question: what is biggest size of table Lua can handle?
#551
Posted 19 March 2006 - 10:08 PM
Try to run your library "dane", and be sure that the only error you have then is "Scripts are not authorized to export symbols" at the end. There may be a problem in this script, and your table "tab1" won't be exported correctly in that case...This rises error.
As much as the ClassPad's memory can handle You could write a small script that fills a table until you get a message saying "not enough memory"And I have still another question: what is biggest size of table Lua can handle?
#552
Posted 19 March 2006 - 11:31 PM
Try to run your library "dane", and be sure that the only error you have then is "Scripts are not authorized to export symbols" at the end. There may be a problem in this script, and your table "tab1" won't be exported correctly in that case...
Nope... it isnt it... runs correctly...
I prepared a table in file and I wanted to use it as a library ( require "dane"). File size is 10KB and it seems to be too much... I think I will have to divide it in smaller parts, and call only this part which is currently neededAs much as the ClassPad's memory can handle You could write a small script that fills a table until you get a message saying "not enough memory"
#553
Posted 21 March 2006 - 08:24 PM
And another idea: It would be handy that we could "compile" all source codes and resources (packages, images, MEM files...) into one single project file. So, when you open the project, all the source files will be opened. I think about a "Project Manager" option, where you add or remove files and pictures from the project.
#554
Posted 21 March 2006 - 08:31 PM
#555
Posted 25 March 2006 - 12:47 PM
#556
Posted 25 March 2006 - 06:49 PM
#557
Posted 25 March 2006 - 06:54 PM
#558
Posted 26 March 2006 - 08:22 AM
It shouldn't be too hard to implement... I'll think about itAnd functions like draw.cptext and draw.luatext might be useful
The only files that CPLua's editor can edit are the files containing Lua programs... I don't exactly see what you would mean by "open images or MEM files"And another idea: It would be handy that we could "compile" all source codes and resources (packages, images, MEM files...) into one single project file. So, when you open the project, all the source files will be opened. I think about a "Project Manager" option, where you add or remove files and pictures from the project.
Lately I often get error informing that I used all memory... how much memory Lua can accomodate for its variables? Is it possbile to build-in something like swap file? Currently memory allowed to use is not enough, and Im sure that many of us met with such error before...
Yes I also noticed this. When I try to write 40 5*5*4 matrices in a file, I have the error "Not enough memory", although I still have 400 KB free. (40 5*5*4 matrices should create a file of size 40000 bytes)
This is becoming a real problemFrom my experience: more than 10KB crashes execution... ok.. I can do it other way, this time.. but soon maybe not and then it will be problem... build in data swapping would be good way. There could be one file for this in this new Lua folder
When writing in a file, all the things you "write" are actually kept in memory, and it is only written in a real MEM file when the file is closed. Thus, you need a free memory space of twice its size when you write its content.
But Tom, 10 Kb shouldn't cause much problems Could you please send me a (short) exemple of program that causes this error?
To everyone: If you think that a program is not running correctly, or if you encounter too many problems with memory etc, please send me a program that reproduces your problem, and I will see what's exactly happening with it.
#559
Posted 26 March 2006 - 09:02 AM
#560
Posted 26 March 2006 - 11:11 AM
1 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users
-
Bing (1)