Post Reply 
HP-50g dangerous L-Shift STO shortcut
11-10-2020, 03:17 PM (This post was last modified: 11-12-2020 11:01 PM by Artur - Brasil.)
Post: #1
HP-50g dangerous L-Shift STO shortcut
Hi,guys

Back to school, I'm back to 50g too. Great machine!

Well, creating some programs for working with LaPlace, I accidentally rewrite an important program in a variable, using the L-shift soft var key.

It is a great short cut for STO key, but it is very dangerous!

After that incident, I searched for some LIB that makes L-shift STO more secure to use.
I could find only one lib, but it worked in a different manner of what I would like.

So, here my results: when you use the shortcut to store values in variables, if these variables contains programs, lists, array, etc, it will be asked a confirmation before replacing the variable.

In next versions, I'll try to make a variable backup before updating the var.

SSTO - the basis program to store data safely

<<
RCLMENU
--> o n m
<< {-1 0 1 10 28}
n VTYPE POS
0 > //zero!
<< o n STO>>
<< m o n CLLCD n
->STR " is:" + 1 DISP
n RCL ->STR 2 DISP //here I need to use smallest font!
3 FREEZE
{{ "Y" << STO MENU>>}
{ "N" << ROT MENU >>} //in next versions, add BKP function.
} TMENU
>>
IFTE
>>
>>

NEW! SSTO version with backup:

<<
RCLMENU
--> o n m
<< {-1 0 1 10 28}
n VTYPE POS
0 > //zero!
<< o n STO>>
<< m o n CLLCD n
->STR " is:" + 1 DISP
n RCL ->STR 2 DISP //here I need to use smallest font!
3 FREEZE
{
{ "BKP"
<< DUP DUP RCL SWAP "SSTOBK/" SWAP +
3 ->TAG
IFERR STO
THEN DUP PURGE STO
END STO MENU>>
}

{ "Y" << STO MENU>>}
{ "N" << ROT MENU >>} //in next versions, add BKP function.
} TMENU
>>
IFTE
>>
>>

The version with backup will show a menu asking: BKP Y N on softkeys.
If you choose BKP, it will save the actual content of variable in SD Card (port 3), under SSTOBK menu, and then save the new data over actual variable. Only one copy will exist, ok?


KSTO - the program that makes assigments to top keys, STO, VAR, CONVERT and UNITS (these last two because they have shortcuts too in the form of l-shift or r-shift soft menu).
Please, see if your 50g menu codes for CONVERT and UNITS confere with the ones listed bellow.


<<
<< SSTO >> 32 ASN //the STO key
<< KDEL 131.01 MENU >> 84.2 ASN //the CONVERT l-shift 6
<< KDEL 42.01 MENU >> 84.3 ASN //the UNITS r-shift 6
<< 1 6
FOR a
"<<a KSTO1>>" "a" a ->STR SREPL DROP
OBJ-> a 10.2 +
NEXT
12 ->LIST STOKEYS
2.01 MENU
>> 31 ASN
>>


KDEL - the subroutine that clears the key assigments
<<
1 6 FOR I
10.2 I +
NEXT
6 ->LIST DELKEYS
>>

KSTO1 - subroutine that adjusts the pages of vars menus
<<
VARS SWAP RCLMENU
FP 100 * 1 -
6 * + GET
SSTO
>>

You need to run the KSTO and put the calculator in USR mode, permanently.
Any better ideas will be appreciated!
Best wishes
Artur - Brazil

ARTUR MARIO JUNIOR
BRAZIL
Find all posts by this user
Quote this message in a reply
11-10-2020, 09:30 PM
Post: #2
RE: HP-50g dangerous L-Shift STO shortcut
Sounds like a very useful program.

Every time I accidently rewrite a variable using [LS] [soft key], I recover it by using [LS] [ANS]. It recalls the prior contents of the variable and the variable name onto the stack. Then I simply press STO to restore that variables to its original state.

Only downfall with this method is once ANS/LASTARG is rewritten, the user cannot restore the variable to its original state.

Maybe writing a program to store contents of LASTARG when rewriting variables holding programs, lists, array, etc could be useful. Sounds good on paper at least.
Find all posts by this user
Quote this message in a reply
11-11-2020, 01:03 AM
Post: #3
RE: HP-50g dangerous L-Shift STO shortcut
From an old post by Joe Horn:

If you accidentally overwrite a variable using [LS] [var] immediately execute LASTARG STO LASTARG.
Find all posts by this user
Quote this message in a reply
11-11-2020, 01:14 AM
Post: #4
RE: HP-50g dangerous L-Shift STO shortcut
(11-11-2020 01:03 AM)John Keith Wrote:  From an old post by Joe Horn:

If you accidentally overwrite a variable using [LS] [var] immediately execute LASTARG STO LASTARG.

Wow! This I didn't know.
Anyway, as happened to me, I only discovered i had lost my programa after many operations.
But I'll tale note your advice!
Many thanks!
Artur

ARTUR MARIO JUNIOR
BRAZIL
Find all posts by this user
Quote this message in a reply
11-11-2020, 01:18 AM
Post: #5
RE: HP-50g dangerous L-Shift STO shortcut
(11-11-2020 01:03 AM)John Keith Wrote:  From an old post by Joe Horn:

If you accidentally overwrite a variable using [LS] [var] immediately execute LASTARG STO LASTARG.

The same is true if you use the STO key itself to accidentally overwrite a variable's former contents. Just do LASTARG STO LASTARG and the overwritten variable reverts to its former contents.

A similar recovery feature is built into the RPL models' PURGE key. If you PURGE a name, then realize you shouldn't have, just do LASTARG STO and the PURGE is undone.

This is all explained on page G-3 of the 50g AUR manual.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
11-11-2020, 01:22 AM (This post was last modified: 11-11-2020 01:25 AM by Artur - Brasil.)
Post: #6
RE: HP-50g dangerous L-Shift STO shortcut
(11-10-2020 09:30 PM)Carsen Wrote:  Sounds like a very useful program.

Every time I accidently rewrite a variable using [LS] [soft key], I recover it by using [LS] [ANS]. It recalls the prior contents of the variable and the variable name onto the stack. Then I simply press STO to restore that variables to its original state.

Only downfall with this method is once ANS/LASTARG is rewritten, the user cannot restore the variable to its original state.

Maybe writing a program to store contents of LASTARG when rewriting variables holding programs, lists, array, etc could be useful. Sounds good on paper at least.

I didn't know this method to recover variables up to now. I plan to save the previuos value with the backup option, beyond Yes or no, at user's command.

If possível, try what I have proposed up to now and ser if there would be any inconvenience. I believe, today, reading The user manual, there will be issues with SOLVE, as I had with Units and Convert.
Best regards and thanks your kind words
Artur.

ARTUR MARIO JUNIOR
BRAZIL
Find all posts by this user
Quote this message in a reply
11-11-2020, 01:41 AM
Post: #7
RE: HP-50g dangerous L-Shift STO shortcut
Hello!

In HP48, a similar problem was the command PURG closest to the comand EDIT.
[Image: edit.jpg]
It is no longer on HP50 keyboard

Stay tunned!

Carlos - Curitiba

(11-11-2020 01:22 AM)Artur - Brasil Wrote:  
(11-10-2020 09:30 PM)Carsen Wrote:  Sounds like a very useful program.

Every time I accidently rewrite a variable using [LS] [soft key], I recover it by using [LS] [ANS]. It recalls the prior contents of the variable and the variable name onto the stack. Then I simply press STO to restore that variables to its original state.

Only downfall with this method is once ANS/LASTARG is rewritten, the user cannot restore the variable to its original state.

Maybe writing a program to store contents of LASTARG when rewriting variables holding programs, lists, array, etc could be useful. Sounds good on paper at least.

I didn't know this method to recover variables up to now. I plan to save the previuos value with the backup option, beyond Yes or no, at user's command.

If possível, try what I have proposed up to now and ser if there would be any inconvenience. I believe, today, reading The user manual, there will be issues with SOLVE, as I had with Units and Convert.
Best regards and thanks your kind words
Artur.

Carlos - Brazil
Time Zone: GMT -3
http://area48.com
Visit this user's website Find all posts by this user
Quote this message in a reply
11-11-2020, 01:44 AM (This post was last modified: 11-11-2020 01:50 AM by Artur - Brasil.)
Post: #8
RE: HP-50g dangerous L-Shift STO shortcut
Just a comment about the assigment keys in 50g (and perhaps to HP prime).
Assigning new functioons to keys are not context sensitive. See my programa above, I had to kill assigments to soft keys when using Units and Convert, and probably will have more situations where I'll have to do the same.
If it would be possible to redefine keys not only by direct access, or shift access, but also by context (or menu). So, te assignmemt of safety store functions to those keys only work when Var menu is active. When other menus are active, the assignment were in "sleeping mode".
Just a dream...
Artur

ARTUR MARIO JUNIOR
BRAZIL
Find all posts by this user
Quote this message in a reply
11-11-2020, 05:49 AM
Post: #9
RE: HP-50g dangerous L-Shift STO shortcut
(11-11-2020 01:44 AM)Artur - Brasil Wrote:  If it would be possible to redefine keys not only by direct access, or shift access, but also by context (or menu). So, te assignmemt of safety store functions to those keys only work when Var menu is active. When other menus are active, the assignment were in "sleeping mode".
Just a dream...
Artur

This is not a dream, but a reality quite easily done in System RPL. For example, System RPL already has entry points that allow your key assignments to do one thing when you're editing a program and something else when you're not editing a program. An assignment which is sensitive to which menu you're in would also be easy. A 50g library which almost automates the creation of such assignments (but knowledge of System RPL helps a lot!) is Keyman+ (listed as "Recommended: Get it!" by HPCALC.ORG), available here: https://www.hpcalc.org/details/3392

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
11-11-2020, 09:53 PM (This post was last modified: 11-11-2020 09:54 PM by Artur - Brasil.)
Post: #10
RE: HP-50g dangerous L-Shift STO shortcut
(11-11-2020 05:49 AM)Joe Horn Wrote:  
(11-11-2020 01:44 AM)Artur - Brasil Wrote:  If it would be possible to redefine keys not only by direct access, or shift access, but also by context (or menu). So, te assignmemt of safety store functions to those keys only work when Var menu is active. When other menus are active, the assignment were in "sleeping mode".
Just a dream...
Artur

This is not a dream, but a reality quite easily done in System RPL. For example, System RPL already has entry points that allow your key assignments to do one thing when you're editing a program and something else when you're not editing a program. An assignment which is sensitive to which menu you're in would also be easy. A 50g library which almost automates the creation of such assignments (but knowledge of System RPL helps a lot!) is Keyman+ (listed as "Recommended: Get it!" by HPCALC.ORG), available here: https://www.hpcalc.org/details/3392
Hi, Joe!
I checked the lib Keyman. Impressive work, but it doesn't make the assignment by context, as I described and you understand very well.
As I told, I did not find any program or lib tha could make this "simple" task.
For the genious people behind HP-50g I believe it would be a feasable work to add a new funtion to this already great machine: ASNCTX - assign by context:
3: function to execute
2: key
1: menu to attach assignment to (0 to all)

Simple, isn't it?
Also PRIME, as a much more advanced system, should have such capacity.
In the mean while, I keep with my simple RPL programs...
Best wishes and thanks for your posts!
Artur

ARTUR MARIO JUNIOR
BRAZIL
Find all posts by this user
Quote this message in a reply
11-13-2020, 01:34 PM
Post: #11
RE: HP-50g dangerous L-Shift STO shortcut
Well, here the new version of SSTO program with backup:

<<
RCLMENU
--> o n m
<< {-1 0 1 10 28}
n VTYPE POS
0 > //zero!
<< o n STO>>
<< m o n CLLCD n
->STR " is:" + 1 DISP
n RCL ->STR 2 DISP //here I need to use smallest font!
3 FREEZE
{
{ "BKP"
<< DUP DUP RCL SWAP "SSTOBK/" SWAP +
3 ->TAG
IFERR STO
THEN DUP PURGE STO
END STO MENU>>
}
{ "Y" << STO MENU>>}
{ "N" << ROT MENU >>} //in next versions, add BKP function.
} TMENU
>>
IFTE
>>
>>

The version with backup will show a menu asking: BKP Y N on softkeys.
If you choose BKP, it will save the actual content of variable in SD Card (port 3), under SSTOBK menu, and then save the new data over actual variable. Only one copy will exist, ok?
The other subroutines were not modified.

Cheers
Artur

ARTUR MARIO JUNIOR
BRAZIL
Find all posts by this user
Quote this message in a reply
Post Reply 




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