#] #] ********************* #] "$d_Qroot""0_QNial summary.txt" www.BillHowell.ca 11Jun2021 initial, from "0_QNial notes.txt" collection of often used, but easily forgotten and important, coding ideas #**************************** # List of operators, generated with : # $ grep "^#] " "$d_Qroot""0_QNial summary.txt" | sed 's/^#\]/ /' # ********************* "$d_Qroot""0_QNial summary.txt" view [symbols, optrs], Conditional loaddef, dependent on whether it has already been done If an optr is only one line - just use IS, not IS OP clear tracking of changes to code [StErrorEst Rsq] = solitary (StErrorEst Rsq) !!! backups to add loaddef comments as each [expression (IS), operator(IS OP)] is loaded : Check [path, dir] exist timestamps somewhat simple test of an optr Find words (symbols) -w = word, -i = case insensitive Interim changes to symbols : Linux : launch leafpad from filemanager, using command : 25Apr2018 SPECIAL NOTE!! : [syms_inParens, symExtract_strin] mutually call each other, which is new for me! loaddef tracking : lines to add at [start,end] on .ndf files : Short form of Howell's QNial types (want 3 letters, accept 4 for some cases, 5+ rarely?) : 08********08 #] +-----+ # This is my NORMAL tool : #] path_backupDatedTo_zArchive IS OP path - SAFE WORKING backup file to a z_Archive dated today (create?) # for website work and huge fileLists : #] pathL_backupTo_dirFlat IS OP pathList d_backup - backup multi-dir paths to a (created) FLAT dir #] dirFlat_restoreTo_pathL IS OP flag_fnamesDated d_backup pathList - restore dated paths from d_FLAT #] +-----+ 08********08 # Debug, IS versus IS OP, checking if a variable is defined for loaddefs If an optr is only one line - just use IS, not IS OP #] IF flag_break THEN BREAK ; ENDIF ; IF (NOT (in '' (symbols 0)) THEN loaddefs (link d_Qnial 'subDir' ) ; ENDIF ; var_defined := IF (isfault var_defined) THEN loaddefs (link d_Qnial 'subDir' ) ; ENDIF ; 08********08 #] +-----+ #] optr change : #] +.....+ #] +.....+ #] To : #] +.....+ #] +.....+ 08********08 #] +-----+ #] opL_QNial -> "$d_Qroot""0_QNial summary.txt" #] opL_setup -> "$d_Qndfs""QNial setup.ndf" #] opL_strings -> "$d_Qndfs""strings.ndf" #] opL_fileOps -> "$d_Qndfs""file_ops.ndf" #] opl_find -> "$d_SysMaint""Linux/find notes.txt" #] opl_grep -> "$d_SysMaint""Linux/grep summary.txt" #] opl_sed -> "$d_SysMaint""Linux/sed summary.txt" #] opl_geany -> "$d_SysMaint""text processors/geany notes.txt" 08********08 #] +-----+ #] timestamp_YYMMDD IS - returns timestamp in obvious format #] timestamp_YYMMDD_HM IS - returns timestamp in obvious format #] timestamp_YYMMDD_HMS IS - returns timestamp in obvious format #] timestamp_to_YYMMDD_HMS IS OP sys_timestamp - format timestamp eg "dayOfWk MMM DD hh:MM:SS MST YYYY" #] timestamp_DDMMMYYYY IS - returns timestamp in obvious format #] timestamp_DDMMMYYYY_HMS IS - returns timestamp in obvious format 08********08 #] +-----+ # ~= (XOR) and = (XNOR), from 'QNial setup.ndf' #] o (~= o o) #] l (~= l o) #] l (~= o l) #] o (~= l l) #] #] l (= o o) #] o (= l o) #] o (= o l) #] l (= l l) 08********08 #] +-----+ #] WHILE statement example #] WHILE (~= ??eof (line := readfile finn)) DO #] chrs_special := str_findChrsInSet flag_chrs_include chrs_set line ; #] IF (= line 'mumbo-jumbo') #] THEN exit 'blah-blah' ; #] ELSE writefile fout line ; #] ENDIF ; #] ENDWHILE ; 08********08 #] Check [path, dir] exist - IF templates see "$d_Qroot""5_QNial IF templates.txt" % verify that paths are allowable ; 08********08 #] +-----+ #] miscellaneous # view [symbols, optrs], #] qnial> post EACH first symbols 0 : show my QNial symbols #] qnial> opL_[strings,fileops,setup] : to view operator lists of key ndf files : #] Conditional loaddef, dependent on whether it has already been done var_defined := flag_webRawe_extract_pathsSubDirsFnames ; IF (isfault var_defined) THEN webRawe_extract_pathsSubDirsFnames ; ENDIF ; #] [StErrorEst Rsq] = solitary (StErrorEst Rsq) !!!??? # see qnial> host link d_txted ' "' d_Qndfs 'economics, markets/Fischer header.ndf" & ' 08********08 #] to add loaddef comments as each [expression (IS), operator(IS OP)] is loaded : see 'link d_Qnial_root 'setup.ndf', replace gName below with target fName : add_ISOP_debug link d_Qndfs 'windows [open, close, ID, title], [get,set,move] cart [posn,size].ndf' add debug lines prior to operator descriptions to track loaddefs of path add_ISOP_debug_marked link d_Qndfs 'windows system for startup.ndf' the operator must already be preceded by a comment line of standard format the comment in turn provides lightning fast Unix cmd extraction of comments (eg lists of operators) # to update all : webSite_doAll # easiest - not worth wasting tyime on individual updates especially if menus change 08********08 #] Find words (symbols) -w = word, -i = case insensitive $ find "$d_webRaw" -maxdepth 3 -name "*.html" | tr \\n \\0 | xargs -0 -IFILE grep -w -i --with-filename --line-number ':&file-insert &:' "FILE" | sed 's#:.*##' | sort -u +--+ $ find "$d_Qndfs" -maxdepth 3 -name "*.ndf" | tr \\n \\0 | xargs -0 -IFILE grep -w -i --with-filename --line-number 'd_webDone' "FILE" | sed 's#:.*##' | sort -u +--+ Picking the right "sed separator", example str_replaceIn_path : chr_sed := first ((`/ `# `! `| `@ EACHLEFT subStr_in_str (link strOld strNew)) sublist (`/ `# `! `| `@) ) ; #+-----+ #] Interim changes to symbols : operators : "mark" the symNew IS OP, for ease of getting back to it [Ctrl->, Ctl-<] in geany sym??Old IS symNew Note the "??" to make sure that symOld isn't overwritten document replace symOld symNew symOld IS symNew remove the "??" variables : sym???Old := symNew ; document replace symOld symNew CAREFUL - that symOld isn't part of another symbol! symOld IS symNew remove the "??" 08********08 #] Linux : launch leafpad from filemanager, using command : leafpad --tab-width=3 %f 08********08 #] 25Apr2018 SPECIAL NOTE!! : [syms_inParens, symExtract_strin] mutually call each other, which is new for me! # It should lock up in a loop or something, but seems to be working. 08********08 #] loaddef tracking : lines to add at [start,end] on .ndf files : f_strings := 'strings.ndf' ; loaddefs_start f_strings ; loaddefs_ended f_strings ; 08********08 #] Short form of Howell's QNial types (want 3 letters, accept 4 for some cases, 5+ rarely?) : arry nested rectangular array dir directory (full directory) fHand file number mostly use shorthand eg 'finn := open path "r' fname file name without directory int integer real real str string path path = fullDirectory baseName extension, used in operator names pinn, pout, ... common shorthand where multiple paths involved pname archaic version used in [IS OP, Tran] arguments word word IMPORTANT! Often, string operations will damage [data, files, directories] because they will result in sub-string substitutions that destroy the original data. Working with words, as defined by either [white, word] character sets, is (hopefully) far more reliable for critical applications. Computer programming is just one great example. #] getconf LINE_MAX maximum length of lines for files (24Jun2021 2048 for my LMDE) https://www.unix.com/programming/211867-maximum-length-line.html #] oldformat := setformat '%5.3f' # enddoc