Post Reply 
long dropdown list issue
07-23-2015, 05:58 AM
Post: #1
long dropdown list issue
hi,
the code below sometimes works, sometimes gives "Bad argument value", sometimes resets the Prime (grrrr!)...
Why?
I reset the sunCalc() function to test here (also if the problem be there, but it from elsewhere works well)...
Try with:
asteroidMagnitude(2,2,{2015,7,22}) -> {7.68, 3.34, "Ceres"}
asteroidMagnitude(9,9,{2015,7,22}) -> should returns {16.54, 6.5, "Chiron"} but gives also Error: Bad argument value or resets.
Also when "Aten" is chosen...

Is it a 18 item list "too" long?

Salvo

Code:

EXPORT asteroidMagnitude(r, delta, lista)
// r distance from Sun, delta Δ distance from Earth, R distance Earth-Sun
BEGIN
  LOCAL R, H, G, magni, beta, phi1, phi2;
  LOCAL ch, asteroid, name;
  INPUT({{ch, asteroid:={"Ceres","Pallas","Juno", "Vesta", "Astraea", "Hebe", "Iris", "Flora",
  "Metis", "Eunomia", "Melpomene", "Massalia", "Eros", "Icarus", "Geographus", "Apollo", "Chiron", "Aten"}, 
  {20,30,1}}},
  "Choose asteroid or comet", 
  "asteroid: ", "Choose asteroid or comet and press OK", 0,4);
  name:= asteroid(ch);
  // calc distance Sun-Earth
  // sunCalc(lista);
  // R:= sunlist(15);
  R:= 1.016; // the actual program calculates it with the above lines...
  // end Sun

  CASE
  IF ch==  1 THEN H:=3.34; G:=0.12; END;
  IF ch==  2 THEN H:=4.13; G:=0.11; END;
  IF ch==  3 THEN H:=5.33; G:=0.32; END;
  IF ch==  4 THEN H:=3.20; G:=0.32; END;
  IF ch==  5 THEN H:=6.85; G:=0.15; END;
  IF ch==  6 THEN H:=5.71; G:=0.24; END;
  IF ch==  7 THEN H:=5.51; G:=0.15; END;
  IF ch==  8 THEN H:=6.49; G:=0.28; END;
  IF ch==  9 THEN H:=6.28; G:=0.17; END;
  IF ch== 10 THEN H:=5.28; G:=0.23; END;
  IF ch== 11 THEN H:=6.51; G:=0.23; END;
  IF ch== 12 THEN H:=6.50; G:=0.25; END;
  IF ch== 13 THEN H:=11.16; G:=0.46; END;
  IF ch== 14 THEN H:=16.9;  G:=0.09; END;
  IF ch== 15 THEN H:=15.6;  G:=0.15; END;
  IF ch== 16 THEN H:=16.25; G:=0.09; END;
  IF ch== 17 THEN H:=6.5;   G:=0.15; END;
  IF ch== 18 THEN H:=16.8;  G:=0.15; END;
  DEFAULT H:=1; G:=0.1;
  END; // case
  // H absolute visual magnitude, G slope parameter
  beta:= ACOS((r^2+delta^2-R^2)/(2*r*delta));
  phi1:= e^(-3.33*tan(beta/2)^0.63);
  phi2:= e^(-1.87*tan(beta/2)^1.22);
  magni:= H+5*log(r*delta)-2.5*log((1-G)*phi1+G*phi2); // apparent magnitude
  RETURN {ROUND(magni,2), H, name};  // apparent and absolute
END;

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
07-23-2015, 09:59 AM
Post: #2
RE: long dropdown list issue
The INPUT() statement, specifically using the choose variant, seems to have a bug when Choosing a selection from a list with an index greater than 9, (anything requiring scrolling down). The selection is successful just one time. Re-running the program again, with that same selection will cause a crash.

Memory corruption occurs as a result of the Choice scrolling activity.

-Dale-
Find all posts by this user
Quote this message in a reply
07-23-2015, 11:24 AM
Post: #3
RE: long dropdown list issue
(07-23-2015 09:59 AM)DrD Wrote:  The INPUT() statement, specifically using the choose variant, seems to have a bug when Choosing a selection from a list with an index greater than 9, (anything requiring scrolling down). The selection is successful just one time. Re-running the program again, with that same selection will cause a crash.

Memory corruption occurs as a result of the Choice scrolling activity.

-Dale-

yes Dale, I think the same thing.
In another program I noted also that using two different lists (like months and days), the longer will be truncated at the size of the shorter.

I think to divide the list into parts and handle them with another choose list: a bit tricky and maybe ugly, but more secure, I hope...

Salvo

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
07-23-2015, 11:38 AM
Post: #4
RE: long dropdown list issue
The "team" is aware of the the problem, and perhaps a solution will find its way in a future release. I also encountered this, in a different program, and there was a bug fix for the issue, but trouble remains. The choice format of the INPUT command is a great feature, and the problem should be fixable.

-Dale-
Find all posts by this user
Quote this message in a reply
07-23-2015, 12:30 PM
Post: #5
RE: long dropdown list issue
(07-23-2015 11:38 AM)DrD Wrote:  The "team" is aware of the the problem, and perhaps a solution will find its way in a future release. I also encountered this, in a different program, and there was a bug fix for the issue, but trouble remains. The choice format of the INPUT command is a great feature, and the problem should be fixable.

-Dale-

I agree!
I hope the "team" could solve soon the issue...
In the meantime, do you think it could be a good solution to divide the list into two alphabetically series and choose one with a previous "choosing list", or could it seem to be too "bogus"?

Salvo

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
07-23-2015, 03:53 PM (This post was last modified: 07-23-2015 03:54 PM by DrD.)
Post: #6
RE: long dropdown list issue
Divide and conquer is a good idea (for now). You might display a PRINT chart for INPUT choices based on a number range or an alphabetical range. The chart might have a set of lists containing nine choices, from which an INPUT could then display the selected sublist to get to the actual data point of interest, as just one idea.
Find all posts by this user
Quote this message in a reply
07-23-2015, 04:01 PM
Post: #7
RE: long dropdown list issue
(07-23-2015 03:53 PM)DrD Wrote:  Divide and conquer is a good idea (for now). You might display a PRINT chart for INPUT choices based on a number range or an alphabetical range. The chart might have a set of lists containing nine choices, from which an INPUT could then display the selected sublist to get to the actual data point of interest, as just one idea.

Divide et impera!
Romans were masters in that "strategy", and computer science's engineers, also Smile

Thanks, Dale, good idea.
I'm adding to that I'm trying now (see the partial code): a first input to ask for series (1-10, 10-20, others) based on Asteroid's number (i.e. Ceres 1, Pallas 2...), than three IF for the series. Doing so I could put only about 26-27 bodies, but the most brighten of the sky are not more than 10-20, isn't it, Marcel?

Salvo

Code:

  INPUT({{chserie, {"1-9", "10-20", "others"}, {20,30,1}}},
  "Choose series of asteroids",
  "Series: ", "Choose series of asteroid and press OK", 0,1);
  IF chserie==1 THEN
    INPUT({{ch, asteroid:={"1 Ceres","2 Pallas","3 Juno", "4 Vesta", "5 Astraea", "6 Hebe", "7 Iris", "8 Flora",
    "9 Metis"}, 
    {20,30,1}}},
    "Choose asteroid or comet", 
    "asteroid: ", "Choose asteroid or comet and press OK", 0,4);
    CASE
        IF ch==  1 THEN H:=3.34; G:=0.12; albedo:=0.100; END;
        IF ch==  2 THEN H:=4.13; G:=0.11; albedo:=0.140; END;
        IF ch==  3 THEN H:=5.33; G:=0.32; albedo:=0.220; END;
        IF ch==  4 THEN H:=3.20; G:=0.32; albedo:=0.380; END;
        IF ch==  5 THEN H:=6.85; G:=0.15; albedo:=0.227; END;
        IF ch==  6 THEN H:=5.71; G:=0.24; albedo:=0.268; END;
        IF ch==  7 THEN H:=5.51; G:=0.15; albedo:=0.277; END;
        IF ch==  8 THEN H:=6.49; G:=0.28; albedo:=0.243; END;
        IF ch==  9 THEN H:=6.28; G:=0.17; albedo:=0.243; END;
        DEFAULT H:=1; G:=0.1;
    END; // case
  name:= asteroid(ch);
  END; // if

  IF chserie==2 THEN

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
07-23-2015, 09:28 PM
Post: #8
RE: long dropdown list issue
Hi Salvomic!

Yes, you are right..

Marcel.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)