is my program too big to edit?
|
07-29-2015, 09:56 AM
(This post was last modified: 07-29-2015 09:59 AM by salvomic.)
Post: #1
|
|||
|
|||
is my program too big to edit?
hi,
the almost complete version of my Astronomy program (here) is now 250 kB into the Prime... I noted often a problem checking for errors with shift-Program: if there is an error (syntax) or the Calc hangs or it resets... Not always, but enough often. I wonder if my program is too big or if there are some other issues... I think to complete the last function, but I' like to could expand it without problems, if it's needed. Another thing, indeed, is that editing more time the program (last firmware) the memory lacks and after many times (I cannot say how many) sometimes the Prime return a "Insufficient memory" message and doesn't save more; only a reset is ok to restart. Thank you for help Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
07-29-2015, 10:43 AM
Post: #2
|
|||
|
|||
RE: is my program too big to edit?
In general you can:
1. Modularize your program, by using 'external' subprograms that do not occupy memory until needed, and release memory when done. Each subprogram is much shorter, thus saving program memory. 2. Use reserved variables instead of locals. 3. Reduce the number of User variables or CAS vars, by re-using vars that are no longer necessary. Would any of these things be helpful for you? -Dale- |
|||
07-29-2015, 10:53 AM
(This post was last modified: 07-29-2015 10:53 AM by salvomic.)
Post: #3
|
|||
|
|||
RE: is my program too big to edit?
(07-29-2015 10:43 AM)DrD Wrote: In general you can: perhaps every of them, Dale... but this program is become complex: 90% of functions call other function... One (big) check also if the app of Marcel, Astro Lab 4, is installed, and decides if to use it or continue with the inside method... I think to modularize, but I've not a precise idea about how i't better. The vars are indeed too many but at the beginning I thought to have all in one inside; when the program grew I lost the control of it :-( The modules, then, should be installed all by the user. I (for now) cannot make an app, as I think to help that of Marcel, already a good app, with my "ancillary" functions... So, I cannot use AVars, and some (big!) list are included inside the program, and they make grow the dimension of it. I appreciate every advice or hint about modularization, I'm searching to make myself an idea, a clear idea. Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
07-29-2015, 03:49 PM
(This post was last modified: 07-29-2015 03:55 PM by Tim Wessman.)
Post: #4
|
|||
|
|||
RE: is my program too big to edit?
Well, two things to keep in mind.
Anything in AVars will be kept in RAM. Thus a 1MB list will always be consuming 1MB. If it is something you think will be large, it really should be kept in a file and only pulled in on use, then discarded when not needed. 256kb should not be problematic for the editor I would anticipate. I'll look at it and see if I can see what you are reporting. TW Although I work for HP, the views and opinions I post here are my own. |
|||
07-29-2015, 03:57 PM
(This post was last modified: 07-29-2015 03:59 PM by salvomic.)
Post: #5
|
|||
|
|||
RE: is my program too big to edit?
(07-29-2015 03:49 PM)Tim Wessman Wrote: Well, two things to keep in mind. thank you, Tim. This morning I wrote for error in one of the last lines (about 3300) 0,4 instead of 0.4 and the editor crashed after I choose Check, then I repeated the check and the Prime reset. I found manually the error, corrected it and all was ok. another time I wrote a variable "nameplanet" as "namplanet" and it hanged again. I noted also that sometimes (not always) the Editor doesn't hang if the calc was not connected to CK. When it hanged no luck to use on-Symb: pin hole reset was necessary. Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
07-30-2015, 05:10 AM
Post: #6
|
|||
|
|||
RE: is my program too big to edit?
Hello,
Do you get the same crashes on the emulator and the calculator or only on the calc? If the later, then it might be a memory issue... Could you share a crashing piece of text so that I can use it to debug the code? Cyrille |
|||
07-30-2015, 05:48 AM
Post: #7
|
|||
|
|||
RE: is my program too big to edit?
(07-30-2015 05:10 AM)cyrille de brébisson Wrote: Hello, hi Cyrille, thank you for help. I haven't tried on emulator. Here below the last function. Now it works, but for example, when I wrote "0,0034*sin(2*Mprime)" instead of "0.0034*sin(2*Mprime)" the Prime editor crashed or hanged, after hitting the soft key for checking errors. Also writing a non existent variable hanged. When the file was about 210-220 kB I could use editor without issues. So I though about file dimension, but who know it? In the code you can comment this two function (they are working in the rest of program) Code:
Salvo Code:
∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
09-08-2015, 04:43 PM
(This post was last modified: 09-08-2015 06:02 PM by salvomic.)
Post: #8
|
|||
|
|||
RE: is my program too big to edit?
Tim, Cyrille,
I tired also in emulator and I get the same issues: program crashes when I modify or add something... I don't know why, I hope it doesn't be to big indeed. Please, help TIA! Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
09-08-2015, 06:34 PM
Post: #9
|
|||
|
|||
RE: is my program too big to edit?
(09-08-2015 04:43 PM)salvomic Wrote: Tim, Cyrille, I was able to run your program with some tweaks but it is clearly unstable, after two edits the emulator crashed and all programs were wiped. Not sure what is the issue, but I noticed that you could improve several sections, like for example the planets section: Maybe you can track down the issue after cleaning the code from all these stuff bulking it. My website: ried.cl |
|||
09-08-2015, 07:56 PM
(This post was last modified: 09-08-2015 08:27 PM by salvomic.)
Post: #10
|
|||
|
|||
RE: is my program too big to edit?
(09-08-2015 06:34 PM)eried Wrote: I was able to run your program with some tweaks but it is clearly unstable, after two edits the emulator crashed and all programs were wiped. Not sure what is the issue, but I noticed that you could improve several sections, like for example the planets section: hi Eried, you're right, I should cleaning the code a lot... I'll try soon, anyway. Generally I don't love much to use globals, but in this case maybe it's the best approach... I hope somebody could help me, thanks! thank you Salvo EDIT: however for no is a bit difficult to amend it, if every time I change something in CK and send it to the calculator, my Prime crashes... I don't remember at what level it was still good, but after one of the last functions I added it began the problem with the crashes... ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
09-09-2015, 10:39 AM
Post: #11
|
|||
|
|||
RE: is my program too big to edit?
(09-08-2015 07:56 PM)salvomic Wrote:(09-08-2015 06:34 PM)eried Wrote: I was able to run your program with some tweaks but it is clearly unstable, after two edits the emulator crashed and all programs were wiped. Not sure what is the issue, but I noticed that you could improve several sections, like for example the planets section: Yeah I understand but since your program is quite big already is not that easy to get help. My recommendation is to do some rudimentary versioning with added documentary. First start with an empty program and add one by one optimized functions of the original code writing what they receive and output (easy to get help like that later). After each test save that as a version and write what happened with that version in the prime. The main issue you will encounter is that you cant trust the environment (the prime)... and that is usually the last thing you may think is bugged when developing something. My website: ried.cl |
|||
09-09-2015, 10:53 AM
Post: #12
|
|||
|
|||
RE: is my program too big to edit?
yes, Eried, thanks again for your important advice, I hope to have time to do that soon.
For now, however, I don't understand why the problems there are first to run the program, already with the "Edit Program" procedure: if there is an error (syntax) the Calc hangs or it resets, only if the Program Edit compile it... I would so understand *when* (at which level) I introduced any error or bug, as it first worked well (or, almost well)... For this reason I thought to the dimension as a probably cause of it... Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
09-10-2015, 05:31 AM
Post: #13
|
|||
|
|||
RE: is my program too big to edit?
Hello,
If you could send me (or post here) the files that are causing the crash (or the file that is not causing it as well as the modifications that cause it), I could use it to find the reason for the crash. That would be very appreciated. Cyrille |
|||
09-10-2015, 07:18 AM
Post: #14
|
|||
|
|||
RE: is my program too big to edit?
(09-10-2015 05:31 AM)cyrille de brébisson Wrote: Hello, very kind of you, Cyrille! I've just sent a PM to you with the file link. If others of us want help also, the file that should work (but by me gives issues editing it) is here in the HP Prime Software Library section of the Forum (the program runs better if the Astro Lab 4 app by Marcel is installed, you can find it also in the Library). thanks! Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)