Post Reply 
Little explorations with HP calculators (no Prime)
10-17-2017, 08:18 AM (This post was last modified: 10-17-2017 01:19 PM by pier4r.)
Post: #233
RE: Little explorations with HP calculators (pre Prime)
Interesting bit (maybe only interesting for me).

As I (maybe) wrote I am using one of my 50g for a long term project named "life gamification". It is nothing else that collecting data from my point of view to evaluate how I perceived my days. I hope to write a little summary about it but the idea is more or less similar to the one mentioned in the following article: https://hackernoon.com/how-data-forced-m...df76064903

So far I collected 132 days of data, mostly in a directory made out of lists of reals (the total size of the directory is 11 KB on the calculator).

What I do after every collected day is a backup, with a rough script that sometimes requires two executions (see below) and is likely not safe after hundreds of executions due to name conflicts.

After several backups done with the method mentioned above, I browse the SD with the SD filer and I rename the backups done, plus I move them in a precise subfolder on the SD card.

Well today, after having some 30+ objects in the root folder of the SD card, the SD filer stopped working. (sd filer: http://www.hpcalc.org/details/6524 + )

I tried a soft reset (on + F3) but nothing. I may have to reinstall the library, I am not sure, but I was not expecting it.

Another bit: already some weeks ago, browsing with the SDfiler the content of the SD, I noticed that sometimes the SD filer was unable to report all the files in a folder 50+ of them (in particular the 'final' folder where I save the backups). Of , say 60 files, only 40 or 50 were listed.


Code:

  bckSafe
  @input: a string (with a date)
  \<<
    @11:18 10.08.2017
    @safe backup as long as the backup using the SDLIB is not foolproof
    @in input one puts a string with the time like "201708201116"
    @then the STO command is going to save the LIFEG directory
    @ (one executes the program within the directory)
    @with the name LGB201708201116
    @but while STO puts the entire name, only the first 8(?) letters
    @are important for it. So often there is a conflict with
    @existing files
    @and we need a workaround.
    
    "" "filenameStr" DROP
    
    \->
    @input
    inputStr
    @local var
    filenameStr
    
    \<<
      @check input
      IF
        inputStr TYPE 2 \=/
      THEN
        "argument as string please"
        DOERR
      END
      
      @save all the variables for later comparisons with the backup
      {HOME LIFEG} EVAL
        @move in the directory
        
      @clean up 'allvars' from the existing list
      @it is needed a "delete" command actually from a list, so it can be safer
      IFERR
        'allListVars' PURGE
      THEN
        "var likely does not exist" DROP
          
        @drop the commands if last argument is enabled.
        IF
          -55 FC?
        THEN
          DROP
        END
      END
        
      5 TVARS  @collect all the lists
      'allListVars' STO
        @global var
        
      
      
      
      inputStr
      @generate a random number with 4 digits
      10000 RAND * IP
      DUP 
      9000 <
        @returns 0 or 1
      1000 * +
        @add 1000 to the number only if that is lower than 9000
      R\->I
        @no trailing points
      \->STR  
      "LGB" + 
        @we have nnnnLGB
        @that can be cleaned later.
      SWAP + 
      @3. \->TAG 
      'filenameStr' STO
        @lesson learned, it seems that tags are not saved in variables
      
      UPDIR 'LIFEG' RCL 
      filenameStr 
      3. \->TAG 
      STO
      
      filenameStr 
      3. \->TAG 
      RCL 
        @check the result after storing.
    \>>
  \>>


edit: after some hours, SDfiler works again (I recalled the sdlib first to see if it had the same problem). Dunno why.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Little explorations with HP calculators (pre Prime) - pier4r - 10-17-2017 08:18 AM



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