Prev2a.gifWelcome
   Computer programmers being frustrated in their work in their cubicles in the office. Computer programmers being frustrated in their work in their cubicles in the office. Computer programmers being frustrated in their work in their cubicles in the office. Computer programmers being frustrated in their work in their cubicles in the office.[1]

• Convert a Wiki file into plain HTML (WB)
     • Image media links need special handling (WB_Include)
• Add missing images (WBIA)
• Report local files not up to date with APtS (WBafter)
• Update last update timestamp file (WBupdate)
• Create WB-ALL for use in WB script (WBListAll)
• Cross reference internal links (WBtree)
• Search for character strings in WB backup files (WBsearch)
• Check for not current files in Local and Bmccedd (WBXXX)
• Check external links (WBheads)
• List images used (WBcount)
• Compare local and remote image trees (WBcompare)
• List versions of script files (WBversions)
• Print contents of file in raw hexadecimal (Hexprint)
• Print Ascii character set (Ascii)
• Julia programming language String builtin function problem

Warning: To get the real script code you have to go to the APtS source for this page, because HTML symbols show here as their values not their source, e.g.: "[" shows as "[". Furthermore, Wiki/HTML 5 and/or whatever other techieshit is not formatting this warning itself as I (BMcC[18-11-46-503]) think it should. Once again, as often: God Damn Wiki! God damn dolt techies! (+2022.04.02)

Julia script to cross reference internal links (WBtree)

using Dates
dt = string(Dates.now())
dtx = findfirst('T', dt)
global now = dt[1: dtx - 1] * " " * dt[dtx + 1: 19]

global IDS = Dict{String,Array{String}}()
global LWIDS = Dict()
global BCT = 0
global MAPS = 0
global L2C1FirstPadding = true
global noTOCs = []
global allFootnotes = 0
global FootnoteBlocks = 0
global totalRevisions = 0
global NYTComments = 0

APFS = "054" # WBTree:APFS
version = APFS
println("WBTree v", version, ".  ", now, "\n")
HSYMS = []

global fdict = Dict{String, String}()
global ildict = Dict{String, Int64}()
global linkCt = 0
global ilinkCt = 0
global pageCt = 0
global incoming = Dict{String, Array{String}}()
global externalLinks = Dict{String, Array{String}}()

global excludeds = ["Tree.html", "RTree.html", "XTree.html", "IndexOfSubjects.html"]

function makeTable(DICT, ptr)
    global L2C1FirstPadding = true
    if ptr == "=>"
        istr = string(ilinkCt)
        if ilinkCt > 999
            listr = length(istr)
            istr = istr[1: listr - 3] * "," * istr[listr - 2: listr]
        end
        global out = "<table style=\"border-collapse:separate;font-family:sans-serif;font-weight:bold;background-color:lightyellow;padding:10px;\"><tr><td colspan=2 style=\"padding:2px 0px 12px 2px;color:gray;font-weight:normal;\"><p>Pages: " * string(pageCt) * ". Interpage links > <span style=\"font-weight:bold;\">" * lc * "</span>.  Intrapage (\"#\") links > " * istr * ".  WBtree v" * version * ".  Imagemaps: " * string(MAPS) * ".  NYTs: <span style=\"font-weight:bold;\">" * string(NYTComments) * "</span>.</p><p style=\"line-height:140%;font-size:smaller;border:1px solid black;padding:0px 9px 6px 8px;background-color:white;\">{{BRMX|TooComplex|200}}.</p><p style=\"color:blue;padding-top:4px;\">" * now * "   ([[{{BRM|Tree}}|Tree]]/[[Template:BRM_Tree|T]])<p></td></tr>\n"
        global ILINKS = istr
        global RLINKS = lc
    elseif ptr == "<=" 
        global out = "<table style=\"border-collapse:separate;font-family:sans-serif;font-weight:bold;background-color:lightyellow;padding:10px;\"><tr><td colspan=2 style=\"padding:2px 0px 16px 2px;color:gray;font-weight:normal;\">Reverse table of incoming internal interpage links:<br /><span style=\"color:blue;\">" * now * "</span></td></tr>\n"
    else
        global out = "<table style=\"border-collapse:separate;font-family:sans-serif;font-weight:bold;background-color:lightyellow;padding:10px;\"><tr><td colspan=2 style=\"padding:2px 0px 16px 2px;color:gray;font-weight:normal;\">!QWERTY! outgoing external links (several uninteresting items excluded):<br /><span style=\"color:blue;\">" * now * "</span></td></tr>\n"
    end
    global shit = []
    for x in keys(DICT)
        push!(shit, x)
    end
    ghosts = []
    crt = 0
    shitx = sort(shit, by=lowercase)
    for s in shitx
        s2 = s[1:(length(s) - 5)]
        if length(DICT[s]) == 0
            push!(ghosts, (s2 == "IntoTheLight" ? "[https://www.bmccedd.org/IntoTheLight.html IntoTheLight]" : "[[{{BRM|" * s2 * "}}|" * s2 * "]]"))
        end
        ilss = ""
        if s2 == "Tree" || s2 == "RTree" || s2 == "XTree"
            ilss = "(n/a)"
        else 
            ils = get(ildict, s, 0)
            if ils > 0
                ilss = "(" * string(ils) * ")"
            end
        end
        if ptr != "<<="
            if s2 == "welcome"
                s2a = ""
            else
                s2a = "|" * s2
            end
            ohmygod = "[[{{BRM" * s2a * "}}|" * s2 * "]]"
            if s2 == "IntoTheLight"
                ohmygod = "[https://www.bmccedd.org/IntoTheLight.html IntotheLight]"
            end
            global out *= "<tr><td colspan=2 style=\"padding:2px;\"><span class=\"brmty\" id=\"" * s2 * "\">" * ohmygod * "</span><span class=\"brmtg\">" * ilss * " " * ptr * "</span></td></tr>"
        else
            crt += 1
            crtx = string(crt)
            crtx = (" " ^ (4 - length(crtx))) * crtx
            global out *= "<tr" * (s == "https://www.bmccedd.org/IntoTheLight.html" ? " id=\"IntoTheLight\"" : "") * "><td colspan=2 style=\"padding:2px;\"><span style=\"font-weight:normal;\">" * crtx * ".</span> <span style=\"background-color:yellow;padding:2px 5px;overflow-wrap:anywhere;\">[" * s * " " * s * "]</span><span class=\"brmtg\">" * ilss * " " * ptr * "</span></td></tr>"
        end
        if s2 == "OnCitation" && ptr == "<="
            global out *= "<tr><td> </td><td>[ TMTC ]</td></tr>"
        elseif s2 != "welcome" || ptr != "<="
            global out *= "<tr><td style=\"padding:2px" * (L2C1FirstPadding ? " 2px 2px 40px" : "") * ";\"> </td><td style=\"padding:2px;\">" *
               (ptr == "<=" && s2 == "IntoTheLight" ? "[ [[{{BRM|XTree#IntoTheLight}}|''All incoming links remote'']] <span style=\"font-weight:normal;\">==></span> ]" : DICT[s]) *
               "</td></tr>\n"
        else
            losers = ""
            snoTOCs = sort(noTOCs)
            for item in snoTOCs
                loser = item[1:length(item) - 5]
                if loser == "welcome"
                    continue
                end
                losers *= "[[{{BRM|" * loser * "}}|" * loser * "]], "
            end
            global out *= "<tr><td style=\"padding:2px" * (L2C1FirstPadding ? " 2px 2px 40px" : "") * ";\"> </td><td style=\"padding:2px;\">!TOC[" *
               losers[1 : length(losers) - 2] * "]</td></tr>\n"
        end
        global L2C1FirstPadding = false
    end
    out *= (length(ghosts) == 0 ? "" : "<tr><td colspan=2 style=\"padding:8px 0px 2px 2px;color:gray;font-weight:normal;\">Ghosts: " * string(ghosts) * "</td></tr>") * "</table>"
    out = replace(out, "!QWERTY!" => string(crt), count=1)
    return(out)
end
 
try
    global errId = 1
    a = readdir()
    for itm in a
        if findfirst(".html", itm) == nothing
            continue
        end
        if itm == "TSUHD.html"
            continue
        end
        incoming[itm] = []
    end
    global errId = 2
    for itm in keys(incoming)
        global pageCt += 1        
        item = itm

        f = open(item)
        global errId = 4
        res = read(f)
        sres = String(res)
        global errId = 5
        close(f)
        x = findfirst("href=\"welcome.html#TOC\"", sres)
        if x == nothing
            push!(noTOCs,item)
        end

        fns = length(findall("id=\"cite_note", sres))
        if fns > 0
            global allFootnotes += fns
            global FootnoteBlocks += 1
        end
        if itm != "JSource.html"
            global NYTComments += length(findall("Your comment has been approved!", sres))
        end
        rev = findfirst(r"\+2022\.[0-9][0-9]\.[0-9][0-9] v[0-9][0-9][0-9]", sres)
        if rev != nothing
            revv = tryparse(Int64, sres[rev][14:16])
            global totalRevisions += revv
        end        
            
        x = findall(r"href=\"[a-zA-Z0-9-_!]+\.html#[^\"]+", sres)
        y = []
        for z in x
            w = sres[z]
            v = findfirst("#", w)
            push!(y, [w[7 : v.start - 6], w[v.start + 1 : length(w)]])
            global BCT += 1
        end
        x = findall(r"href=\"#[^\"]+", sres)
        for z in x
            w = sres[z]
            push!(y, ["", w[8 : length(w)]])
            global BCT += 1
        end

        ittm = itm[1 : length(itm) - 5]
        LWIDS[ittm] = y
        x = findall(r"id=\"[^\"]+", sres)
        y = []
        for z in x
            push!(y, sres[z.start + 4 : z.stop])
            global BCT += 1
        end
        IDS[ittm] = y

        x = findall(r"&#[^;]+;", sres)
        for y in x
            z = sres[y]
            if z in HSYMS
                continue
            end
            push!(HSYMS, z)
        end 
        
            
        if itm in excludeds
            global fdict[itm] = "[''" * (itm == "XTree.html" ? "N/A" : "Everything") * "'']"
            continue
        end

        if findfirst(r"aplacetostudy"i,  sres) != nothing
            println((item in ["Dashboard.html", "Images.html", "JSource.html"] ? "" : "** ") * "Aplacetostudy: " * item)
        end

        global MAPS += length(findall("<map name=\"", sres))

        refs = findall(r"href=\"[a-zA-Z0-9-_!]+\.", sres)
        srefs = []
        for r in refs
            ss = sres[r]
            ss = ss[7: (length(ss) - 1)]
            if !(ss in srefs)
                push!(srefs, ss)
            end
            if !(ss * ".html" in a)
                println("Bad link: " * itm * " => \"" * ss * "\".")
                exit(16)
            end
            if !(itm in incoming[ss * ".html"])
                push!(incoming[ss * ".html"], itm)
            end
            global linkCt += 1 
        end
        str = ""
        for x in sort(srefs, by=lowercase)
            str *= (str != "" ? ", " : "") * "[[#" * x * "|" * x * "]]"
        end
        global fdict[itm] = str
        global ildict[itm] = iq = length(findall("<a href=\"#", sres))
        global ilinkCt += iq

        xls = findall(r"( href=\"|\|link=)http.*?[\" ]", sres)
        for xl in xls
            t = sres[xl]
            t = replace(t, r"( href=\"|\|link=)" => "", count=1)
            t = t[1:length(t) - 1]
            if get(externalLinks, t, "!") == "!"
                externalLinks[t] = [itm]
            else
                if !(itm in externalLinks[t])
                    push!(externalLinks[t], itm)
                end
            end
        end
    end
catch ex
    s = string(ex)  
    if length(s) > 200
        s = s[1:200] * "..."
    end
    println("\n      Failure[" * string(errId) * "]: ", typeof(ex), ".\n", s);
    exit(16)
end

lc = string(linkCt)
if linkCt > 999
    lenlc = length(lc)
    lc = lc[1:lenlc - 3] * "," * lc[lenlc - 2:lenlc]
end

global incoming2 = Dict{String, String}()
for k in keys(incoming)
    ary = incoming[k]
    str = ""
    for x in sort(ary, by=lowercase)
        stp = x[1:length(x)-5]
        str *= (str != "" ? ", " : "") * "[[#" * stp * "|" * stp * "]]"
    end
    global incoming2[k] = str
end

T = makeTable(fdict, "=>")

RT = makeTable(incoming2, "<=")

global incoming2 = Dict{String, String}()
for k in keys(externalLinks)
    if findfirst("https://faculty.washington.edu/walter/Killing%20Cats3.html#_edn", k) != nothing ||
            k == "https://validator.w3.org/"
        continue
    end
    ary = externalLinks[k]
    str = ""
    for x in sort(ary, by=lowercase)
        stp = x[1:length(x)-5]
        stp2 = ""
        if stp != "welcome"
            stp2 = "|" * stp
        end 
        str *= (str != "" ? ", " : "") * "\"[[{{BRM" * stp2 * "}}|" * stp * "]]\""
    end
    global incoming2[k] = str
end

XT = makeTable(incoming2, "<<=") 

TALL =  "{{#switch: {{{1}}}\n"
TALL *= " | R = " * RT * "\n"
TALL *= " | X = " * XT * "\n"
TALL *= " | #default = " * T * "\n}}"

f = open("TREE", "w")
write(f, TALL)
close(f)

println("\n--------\n")

global ct = 0
global chksL = 0
global chksR = 0
shit = []
for x in keys(LWIDS)
    push!(shit, string(x))
end
shitx = sort(shit)

for k in shitx
    for kk in LWIDS[k]
        if kk[1]== ""                # local links in same file
            global chksL += 1
            if kk[2] in IDS[k]
                continue
            end
            spacer = ""
            if length(k) < 12
                spacer = " " ^ (12 - length(k))
            end
            println(k, spacer, " ? \"#" * kk[2] * "\"")
            global ct += 1
            continue
        end
        global chksR += 1       
        if kk[2] in IDS[kk[1]]
            continue
        end
        spacer = ""
        if length(k) < 12
            spacer = " " ^ (12 - length(k))
        end
        println(k, spacer, " ? \"" * kk[1] * "#" * kk[2] * "\"")
        global ct += 1
    end
end
println("\n  RLINKS: ", RLINKS, ", ILINKS: " , ILINKS, " (R: " , chksR, ". L: ", chksL, ") Errs: ", ct, ".  (BCT: " , BCT, ")")
#println("\n", join(HSYMS, ", "))

println("\n  Footnote count: ", FootnoteBlocks, ":", allFootnotes, ".  Revisions > 1Jun22: ", totalRevisions - 2468, ".  NYTComments: ", NYTComments)

Return to TOC!Return to TOC

Julia script to convert a Wiki file into plain HTML (WB)

#using Pkg; Pkg.add("HTTP")
using Dates
using HTTP

include("WB_Include")

APFS = "249" # WB:APFS
global versionNr = APFS
global formattedLength = ""
global unToc = ""
global totalSize = 0
global wpct = 0
global vpct = 0
global MIAs = Dict()
global BRMs = 0
global nrr = 1
global line1 = ""
global failures = []
global deviations = 0
global allSkipped = 0
global withSkipped = 0
global allExceptions = 0
global allCELIBATES = 0
global NEWIMAGES = ""

global ImageCache = Dict{String, Int32}()
global ImageCache2 = Dict{String, String}()
global countSHIT = 0

function formatNumber(n)
    ltxts = string(n)
    ltxt = length(ltxts)
    if ltxt > 6
        return ltxts[1:ltxt - 6] * "," * ltxts[(ltxt - 5) : (ltxt - 3)] * "," *
                    ltxts[ltxt - 2 : ltxt]
    elseif ltxt > 3
        return ltxts[1:ltxt - 3] * "," * ltxts[ltxt - 2 : ltxt]
    end
    return ltxts
end
  
function addSHIT(nbr)
    global unToc *= "  SHIT:" * string(nbr)
    global countSHIT += 1
end

# Purpose here is to find unused images in image directory
function fillImageDict()
    for (root, dirs, files) in walkdir("./w/")
        for file in files
            #x = joinpath(root, file) # path to files
            z = replace(joinpath(root, file), "\\" => "/")    # Mac has all "/". Go team!
            if !startswith(z, "./w/images/")
                continue
            end
            lenz = length(z)
            global ImageCache[z[3 : lenz]] = 0
            global ImageCache2[z[17 : lenz]] = z[12:15] 
        end
    end
end

function doSubstitutions(s, t, fn)
    for i = 1 : length(s)
        si = s[i]
        si2= si[2]
        if fn in si2[1]
            continue
        elseif length(si2[2]) > 0 && !(fn in si2[2])
            continue
        end
        t = replace(t, si[1])
    end
    return t
end

function do1Substitution(s, t, fn)
    for i = 1 : length(s)
        si = s[i]
        si2 = si[2]
        if fn in si2[1]
            continue
        elseif length(si2[2]) > 0 && !(fn in si2[2])
            continue
        end 
        q = t
        t = replace(t, si[1], count=1)
        if t == q
            addSHIT(si[3])
        end
    end
    return t
end

function addToDict(iname, fnm)
    if haskey(MIAs, iname)
        MIAs[iname] = [MIAs[iname][1]  + 1, (MIAs[iname][2] * ", " * fnm)]
        return
    end
    MIAs[iname] = [1, fnm]
end

function getNow()
    dt = string(Dates.now())
    dtx = findfirst('T', dt)
    return(dt[1: dtx - 1] * " " * dt[dtx + 1: length(dt)])
end

function doAFile(fname, seq)
    global formattedLength = ""
    global unToc = ""
    st = time()

    if length(fname) > 0 
        actionUrlPart = "User:Bradford_Robert_McCormick/" * fname
        displayUrl = fname
    else
        actionUrlPart = "User:Bradford_Robert_McCormick"
        displayUrl = "[base url]" 
    end
    actionUrl = "https://www.aplacetostudy.com/wiki/" * actionUrlPart 
    println("\n\033[30;1m[" * versionNr * ":" * IncludeVersion * "]\033[0m  Trying: " * displayUrl)
    txt = nothing 
    try
        res = HTTP.get(actionUrl);
        txt = String(copy(res.body)) # Never had I seen a function that destroys its input parameter. Cui bono?

        deviation = length(res.body) - length(txt)
        if deviation != 0
            global unToc *= "  L/x(" * string(deviation) * ")"
            global deviations += deviation
        end  

        if DESPARATION_TESTING
            zc = res.body
            x = ""
            for  i = 1 : length(zc)
                x *= Char(zc[i])
            end

            a = open("New_" * fname , "w")
            write(a, txt)
            close(a)

            a = open("Old_" * fname, "w")
            write(a, x)
            close(a)

            println(fname , ".  New: " , length(txt), ".  Old: " , length(x), ".")
        end
    
        strtString = "<!-- " * Char(10) * "NewPP lim"
        frst = findfirst(strtString, txt)
    
        if frst == nothing
            println("\n        \033[31;1m\"" * strtString * "\" not found\033[0m\n")
            exit(16)
        end
    
        txt = txt[1:frst[1]-1]

        # Get the goddamned last modified timestamp of the Wiki file. This was too goddamned hard to do!
        shit = String(res)
        shit0 = findfirst(r"Last-Modified:.*?GMT", shit)
        shit1 = shit[shit0]
        if shit1[length(shit1) - 3:length(shit1)] != " GMT"
            println("Bad time: " * fname * " \"" * shit1 * "\"")
            exit(16)
        end
        mfshit = string(Dates.DateTime(shit1[21:length(shit1) - 4], "dd u yyyy HH:MM:SS"))
        global SHIT = mfshit[1:10] * " " * mfshit[12:19]

        #---- meta tags ----
        kw = ""
        if length(fname) == 0 || fname == "BRADFORD" || fname == "index"
            kw = "\n<meta name=\"author\" content=\"Bradford McCormick\" />"
            if fname == "index"
                kw *= "\n<meta name=\"description\" content=\"Improve social interaction thru self-reflective conversation. Modernity, marxist humanism, The Bauhaus. Build good society cultivating peer-to-peer personal intelligence: dialog + technology, precision and soul.\" />"
            end
        end
        kwk = get(keywords, fname, "")
        if kwk != ""
            kw *= "\n<meta name=\"keywords\" content=\"" * kwk * "\" />"  
        end

        txt = replace(txt, "<head>" =>        # Clever trick: This attacks both ends of hte text
                "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"w/css/WBmiracle.css\" />" * kw, count=1) *
                "</div><div class=\"read600\"><br style=\"clear:both;\">" * 
                    "<img src=\"./w/images/5/52/Spacer.gif\" alt=\"!QWERTY!\" width=\"2\" height=\"2\" /></div></body></html>"
    
        global printhole = ""
    
        rawPrint = length(fname) > 0 ? fname : "welcome"
        for i = 1 : length(rawPrint)
            if rawPrint[i:i] == ":"
                printprtChar = "\033[32;1m" * ".58." * "\033[0m"
            elseif rawPrint[i:i] =="/"
                printprtChar = "\033[32;1m" * ".47." * "\033[0m"
            else 
                printprtChar = rawPrint[i:i]
            end
            global printhole *= printprtChar 
        end
    
        if findfirst("<div id=\"toc\" class=\"toc\" role=\"navigation\" aria-labelledby", txt) != nothing   
            q = length(txt) 
            txt = replace(txt, r"<div id=\"toc\" class=\"toc\" role=\"navigation\" aria-labelledby.+?</li>[\t\n\r]+</ul>[\t\n\r]+</div>[\t\n\r]+"s => "", count=1)
            global unToc = "  " * (q > length(txt) ? "(unToc)" : "SHITTOC")           
        end

        txt = do1Substitution(trans1, txt, fname)

        # xout unlinked images
        q = length(txt)
        txt = doSubstitutions(trans6, txt, fname)
        global unToc *= (length(txt) < q ? "  \302\243:" * string(q - length(txt)) : "")      

        txt = doSubstitutions(trans3, txt, fname)
    
        if fname == ""
            txt = do1Substitution(trans4, txt, fname)
        else
            txt = do1Substitution(trans5, txt, fname)
        end

        txt = doSubstitutions(trans2, txt, fname)

        while fname != "JSource"
            zs = findfirst(r"<area href=\"/wiki/Media:[^\"]+\"", txt)
            if zs == nothing
                break
            end
            str = txt[zs]
            strf = str[25 : length(str) - 1] 
            txt = replace(txt, str => "<area href=\"w/images/" * ImageCache2[strf] * "/" * strf * "\"", count=1)
        end
        
        while true
            zs = findfirst(r"href=\"https://www.aplacetostudy.com/wiki/Media:[^\"]+\"", txt)
            if zs == nothing
                break
            end
            str = txt[zs]
            strf = str[48 : length(str) - 1]
            if fname == "JSource" && strf != "ComputerUser.gif"  # Assuing the 4 frustrated computer programmers
                                                                 # are at the very top of the JSource page.
                break
            end 
            txt = replace(txt, str => "href=\"w/images/" * ImageCache2[strf] * "/" * strf * "\"", count=1)
        end

        q = length(findall("\t", txt))
        if q > 0
            global unToc *= "  Tabs:" * string(q)
            txt = replace(txt, "\t" => "        ")
        end

        # What has screwed up here? Wiki is always screwing something up; that's the kind of app it is.
        if fname == "WU_KillingTheCats"
            txt = replace(txt, r"</font>[ \n]+</p>" => "</font></p>")
        end
        if fname == "Experiment" || fname == "My_canon"
            txt = replace(txt, "<div class=\"read600\"></div>\n" => "", count=1)
        end

        txt = do1Substitution(trans7, txt, fname)
    
        global ltxti = length(txt)
        ltxts = string(ltxti)
        ltxt = length(ltxts)
        global formattedLength = ltxti < 1000 ? ltxts : ltxts[1:ltxt - 3] * "," * ltxts[ltxt - 2 : ltxt]

        ID = SHIT
        if fname != "JSource"
            txt = replace(txt, "!QWERTY!" => ID, count=1)
        else 
            OMG = findall("!QWERTY!", txt)
            OMG2 = OMG[length(OMG)]
            till = length(txt)
            txtq = txt
            txt = txt[1:OMG2.start - 1] * ID * txt[OMG2.stop + 1 : length(txt)]
            txtx = replace(txt, ID => "!QWERTY!", count=1)
            if txt[length(txt):length(txt)] != ">" || till >= length(txt) || txtq != txtx 
                println("OMG2 JSource! ", txt[length(txt):length(txt)] != ">", " ", till >= length(txt), " ", txtq != txtx)
                exit(16)
            end
        end

        z = open(length(fname) > 0 ? fname * ".html" : "welcome.html", "w")
        write(z, txt)
        close(z)

        global chksum = 0
        global chk32s = 0
        global skipped = 0
        txtu = codeunits(txt)
        for i = 1 : length(txtu)
            txti = 0
            try
                txti = UInt32(txtu[i])
            catch ex
                if SHOW_SKIPPED
                    try
                        println("  Skipped: \"" * replace(txt[i - 40 : i - 2] , r"\n" => "?") * "\"")
                    catch
                        println("  Skipped failed: " * string(i))
                    end
                end
                global skipped += 1
                continue
            end
            global chksum += txti
            if txti == 32
                global chk32s += 1
            end    
        end
        if skipped > 0
            global withSkipped += 1
        end

        global brms = length(findall("User:Bradford Robert McCormick", txt))
        global BRMs += brms
        global brms = brms == 0 ? "" : ("  BRMs:" * string(brms))
    
        # Find all missing images
        images = findall(r" (src|href)=\"[^\"]+", txt)
        for i = 1 : length(images)
            str0 = txt[images[i]]
            if !contains(str0, "./w/images/")
                if length(str0) >= 10 && str0[1:10] == " href=\"w/i"
                    str0 = replace(str0, " href=\"" => " href=\"./", count = 1)
                elseif length(str0) >= 9 && str0[1:9] == " src=\"w/i"
                    str0 = replace(str0, " src=\"" => " src=\"./", count = 1)
                else
                    continue
                end
            end
            str1 = replace(str0, "%27" => "'")
            off = findfirst("\"", str0)
            str = str1[(off[1] + 3):length(str1)]

            if haskey(ImageCache, str)
                ImageCache[str] += 1
            elseif !isfile(str)
                strd = "./" * str[1:13]
                if !isdir(strd)
                    mkdir(strd)
                    println("  ", strd)
                end
                addToDict(str0 * "\"", fname);
                println("      ", str)
                stri = str[10 : length(str)]
                if findfirst(stri, NEWIMAGES) == nothing
                    global NEWIMAGES *= "\"" * stri * "\", "
                end               
            end
        end
    
    catch ex
        global allExceptions += 1
        s = string(ex)  
        if length(s) > 200
            s = s[1:200] * "..."
        end
        println("\n      Failure: ", typeof(ex), ".\n", s);
        #exit(16)
        push!(failures, fname)
        return 0
    end

    v = "  *X-V5"
    global wpct += 1
    if findfirst("/c/ca/HTML5V.png", txt) != nothing
        v = ""
        global vpct += 1
    end
    CELIBATES = length(findall(r"<img [^>]+>([^<]|<[^/]|</[^a]|</a[^>])",txt)) # find img tags not followed by "</a>"
    if CELIBATES != 1
        if CELIBATES < 1
            println("Too few CELIBATES: " , CELIBATES, " " , fname)
            exit(16)
        end
        global allCELIBATES += CELIBATES - 1
        unToc *= "  CbI: " * string(CELIBATES - 1)
    end
    
    println(" " * seq * "     Done: " * printhole * ".html", " " ^ (23 - length(printhole)), 
                "e/t: " * string(round(time() - st, sigdigits=7)) * "  " * formattedLength * unToc * v * brms *
                "\n              " * SHIT * " GMT.       " * formatNumber(chksum) * ":" * formatNumber(chk32s) * "." *  (skipped > 0 ? "  Skipped: " * formatNumber(skipped) : ""))
    global allSkipped += skipped 
    return ltxti
end

global ftp = nothing
global inputIsArray = false

fillImageDict()    

if length(ARGS) == 1
    global argsx = ARGS[1]
    for i = 1 : length(SHORTCUTS)
        si = SHORTCUTS[i]
        si1 = si[1]
        if occursin(si1, argsx)
            global argsx = replace(argsx, si1 => si[2], count=1)
        end
    end
    if findfirst(",", argsx) == nothing
        argsx = strip(argsx)
        if endswith(argsx, ".html")
            argsx = argsx[1 : length(argsx) - 5]
        end
        doAFile(argsx != "welcome" ? argsx : "", "     ")
        exit(0)
    end
    global ftp = split(argsx, ",")
    global inputIsArray = true
elseif length(ARGS) != 2
    println("Bad number parameters (" * string(length(ARGS)) * ")!")
    exit(16)
end

global fl = "[GKW]"
try
    gst = time()
    if ftp == nothing
        f = nothing
        try
            f = open(ARGS[2])
        catch ex
            s = string(ex)  
            if length(s) > 200
                s = s[1:200] * "..."
            end
            println("\n      Failure: ", typeof(ex), ".\n", s);
            exit(16)
        end
        global ftp = readlines(f)
        close(f)
    end
    for fla in ftp
        global fl = strip(fla)
        if endswith(fl, ".html")
            fl = fl[1 : length(fl) - 5]
        end
        if length(fl) < 1
            continue
        end
        if nrr == 1 && fl[1:1] == "#"
            global line1 = fl * "\n"
            continue
        end
        #sleep(2)
        nrq = string(nrr) 
        global totalSize += doAFile(fl != "welcome" ? fl : "", " " ^ (4 - length(nrq)) * nrq * " ")
        global nrr += 1
        
    end

    xformattedLength = formatNumber(totalSize)
    fns = ""
    for f in failures
        if fns != ""   
            fns *= ", "
        end
        fns *= f
    end
    if fns != ""
        fns = "\n\n julia WB \"" * fns * "\""
    end
    b = time() - gst
    c = floor(Int, b / 60)
    d = round(b - (c * 60), sigdigits=7)
    e = string(c) * "m" * (d < 10 ? "0" : "") * string(d) 
    println("\nTotal size: " , xformattedLength, "  (" * string(vpct) * "/" * string(wpct) *
                ": " * string(wpct - vpct) * ")  e/t: " * e * "   [" * getNow() * "]" * fns)
catch ex
    s = string(ex)  
    if length(s) > 200
        s = s[1:200] * "..."
    end
    println("\n      fl: " * fl * ". Failure: ", typeof(ex), ".\n", s);
    exit(16)
end

if inputIsArray
    exit(0)
end

global MIASMA = []

ks = keys(MIAs)
if length(ks) > 0
    println(" ")
    for k in ks
        #println(k, "  ", MIAs[k])
        push!(MIASMA, k * "  " * string(MIAs[k]))
    end
end

global dx = []
if length(MIASMA) == 0
    println("(No missing images)")
else
    MIASMA = sort(MIASMA)
    global prvxxx = MIASMA[1][2:2]
    for mk = 1 : length(MIASMA)
        mmk = MIASMA[mk]
        dxi = replace(mmk, r".*?\"([^\"]+).*" => s"\1", count=1)
        dif = ""
        if !(dxi in dx)
            dif = "*" 
            push!(dx, dxi)
        end 
        nextprv = mmk[2:2]      # This is messed up; there should not be the leading blank
                                       # but I'm not risking fixing it, so kludgiong it
        println((nextprv != prvxxx ? "\n" : "") * dif * mmk)
        global prvxxx = nextprv 
    end
end

global unused = ""
global unusedPfx = ""
global Uct = 0
ks = keys(ImageCache)
global ReverseImages = Dict{Int32,Array{String}}()
for k in ks
    if ImageCache[k] == 0
        global unused *= unusedPfx * "\"" * k * "\""
        global unusedPfx = ", "
        global Uct += 1
    else
        kn = ImageCache[k]
        kk = k[15:length(k)]
        if !(kk in ["Prev2a.gif", "Next2a.gif", "Spacer.gif", "HTML5V.png"]) 
            if haskey(ReverseImages, kn)
                push!(ReverseImages[kn], kk)
            else
                global ReverseImages[kn] = [kk]
            end
        end
    end
end
if length(unused) > 0
    print("\nUnused: " * unused * "  (" * string(Uct) * ")")
end 
println("\nBRMs:" * string(BRMs) * "  SHITs: " * string(countSHIT) * "  deviations: " * string(deviations) * 
    (allSkipped > 0 ? "  skipped: " * string(allSkipped) * " " * string(withSkipped) : "") * 
    "  exceptions: " * string(allExceptions) * "  CELIBATES: " * string(allCELIBATES)) 

println("\n--------")
global shit = []
for x in keys(ReverseImages)
    push!(shit, x)
end
shitx = sort(shit, rev=true)
global nuthin = "[nuthin]"
for i = 1 : length(shitx)
    sq = shitx[i]
    if sq < 5 && sq > 1
        continue
    end
    s = string(sq)
    ss = ""
    ssss = sort(ReverseImages[sq])
    for sss in ssss 
        if ss != ""
            ss *= ", "
        end
        ss *= "\"" * sss * "\""
    end    
    println(" " ^ (6 - length(s)) * s, "   ", ss)
    global nuthin = ""
end
if nuthin != ""
    println("    " * nuthin)
end

if length(ARGS) == 2 && ARGS[2] == "WB-ALL"
    x = open("WBLOG-TS", "w")
    n = getNow()
    t = "\n" * line1 * "\n" * "WB-ALL. Executing: WB: v" * versionNr * ", at: " * n[1:10] * "T" * n[12:16] * ".\n" 
    write(x, t)
    close(x)
    println("\n" * t)
end

if NEWIMAGES != ""
    println("\n  julia WBIA " * NEWIMAGES[1 : length(NEWIMAGES) - 2])
end
 

Return to TOC!Return to TOC

WB_Include

APFSI = "239" # WB_Include:APFS
global IncludeVersion = APFSI

#<span id="Table">Table for links to images in images</span>

global keywords = Dict{String, String}([
    "" => 
            "Husserl, Heraclitus, phenomenology, Eugen Fink, transendental philosophy, individuality, Szczepanski, laicite, secularism, agnosticism, self-accountabliity, Kandinsky, Maine Coon cat, finitude",
    "1983" =>
            "Robert Venturi, Philip Johnson, Louis Kahn, Paul Rudolph, Guild House, Decorated Shed, Less is more",
    "Broch" => 
            "Hermann Broch, The Sleepwalkers, The Death of Virgil",
    "Circ" => 
            "circumcision, genital mutilation, female genital mutilation, foreskin, masturbation, bris, brit milah, mohel, britmilah",
    "Darkness" => 
            "wokeness, woke, Wokies, political correctness, anti-intellectualism, tribalism, groupthink",
    "Huang" =>
            "St. Paul's School, Brooklandville, Brooklandwood, S. Atherton Miiddleton",
    "Hungary" => 
            "witch hunting, blacklist, McCarthyism, political correctness",
    "index" => 
            "Husserl, Heraclitus, phenomenology, Enlightenment, Eugen Fink, transendental philosophy, individuality, Szczepanski, laicite, secularism, agnosticism, self-accountabliity, Kandinsky, Maine Coon cat, finitude, technology and society, lifeworld, lebenswelt, discourse ethics",
    "Mullah" => 
            "Samuel Paty, freedom of expression, religious bigotry, decapitation, laicite, secularism",
    "PhilCris" => 
            "Phenomenology, Vienna Lecture, Edmund Husserl",
    "StP" =>
            "St. Paul's School, Brooklandville",
    "StarAndBars" => 
            "Insignia, Star and bars, Friendly fire",
    "Thanks" => 
            "Robbie McClintock, Robert McClintock, Robert O. McClintock, Robert O McClintock",
    "Venturi" =>
            "Decoration, Ornament, Guild House"  
])

# ERROR: 100
global trans1 = [
    ["<div class=\"mw-parser-output\">" => "",[[],[]],100],
    ["<div id=\"mw-content-text\" lang=\"en\" dir=\"ltr\" class=\"mw-content-ltr\">" =>
            "",[[],[]],101],
    [r"[\r\n\t ]+<div id=\"bodyContent\" class=\"mw-body-content\">[\r\n\t ]+" =>
            "",[[],[]],102],
    [r"[\r\n\t ]+<div id=\"contentSub2\"></div>[\r\n\t ]+<div id=\"jump-to-nav\"></div>[\r\n\t ]+" =>
            "",[[],[]],103],
    [r"[\r\n\t ]+<div id=\"mw-page-base\" class=\"noprint\"></div>[\r\n\t ]+<div id=\"mw-head-base\" class=\"noprint\"></div>[\r\n\t ]+" =>
            "",[[],[]],104],
    [r"<body class=\"mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-2 ns-subject[^>]+>" =>
            "<body>",[[],[]],105],
    [r"<a id=\"top\"></a>[\r\n\t ]+<div id=\"siteNotice\" class=\"mw-body-content\"></div>[\r\n\t ]+<div class=\"mw-indicators mw-body-content\">[\r\n\t ]+</div>" =>
            "",[[],[]],106],
    [r"<h1 id=\"firstHeading\" class=\"firstHeading\" lang=\"en\">[^<]+</h1>" => 
            "",[[],[]],107],
    [r"^[\r\n\t ]+<!DOCTYPE " => 
            "<!DOCTYPE ",[[],[]],108],
    [r"<div id=\"siteSub\" class=\"noprint\"[^D]+Developer</div>" => 
            "",[[],[]],109],
    [r"</title>(.|[\n\t\r])+?</head>" => 
            s"</title></head>",[[],[]],110],
    [r"<a class=\"mw-jump-link\" href=\"#mw-head\"[^I]+Input\">Jump to search</a>" => 
            "",[[],[]],111],
    [r"<body><div id=\"content\" class=\"mw-body\"[^<]+<div id=\"contentSub\">"s =>
            "<body><div id=\"content\" class=\"mw-body\"><div id=\"contentSub\">",[[],[]],112],
    [r"[\t ]+<div class=\"read600\"" => 
            "<div class=\"read600\"",[[],[]],113],
    ["<html class=\"client-nojs\" " => 
            "<html ",[[],[]],114],
    ["src=\"./w/images/2/2a/Carcass_186.png\" decoding=\"async\" width=\"173\" height=\"392\" data-file-width=\"173\" data-file-height=\"392\"" =>
            "src=\"./w/images/0/0b/Carcass_Horizontal.png\" decoding=\"async\" width=\"392\" height=\"173\" data-file-width=\"392\" data-file-height=\"173\"",[[],["Grading"]], 115]
]

global trans2 = [
    ["\" title=\"User:Bradford Robert McCormick\"" => "\" title=\"welcome\"",[[],[]]],
    ["\" title=\"User:Bradford Robert McCormick#" => "\" title=\"welcome#",[[],[]]],
    ["\" title=\"User:Bradford Robert McCormick/" => "\" title=\"",[[],[]]],
    ["\"./w/images" => "\"./w/images",[[],[]]],
    [r" (href|src)=\"./w/images/" => s" \1=\"w/images/",[[],[]]],
    [r"[ \n]+</p><p>" => "</p>\n<p>",[[],[]]],
    [r"[ \n]+</p>\n" => "</p>\n",[[],[]]],
    [r"[ \n]+</li>\n" => "</li>\n",[[],[]]],
    ["'" => "'",[[],[]]],                     # Does this fix the "smart quotes" problem?
    ["'" => "'",[[],[]]],
    [""" => "\"",[[],[]]],
    [""" => "\"",[[],[]]],
    [" " => " ",[[],[]]],           # This changes ampersand poundsign 160 semicolon to HTML nbsp   fuckup

    [r" data-file-(width|height)=\"[0-9]+\"" => "",[[],[]]],
    [r"<a href=\"([^\.]+)\.html\" title=\"([^\"]+)\"><span style=\"vertical-align:-1px;font-size:larger;\">O</span>r else!</a>" =>
            s"<a style=\"text-decoration:none;\" href=\"\1.html\" title=\"\2\"><span style=\"vertical-align:-1px;font-size:larger;\">O</span>r else!</a>",[[],[]]],
    ["<a href=\"IBM.html\" title=\"IBM\"><span title=\"THINK\" style=\"font-weight:bold;color:blue;\">IBM</span></a>" =>
            "<a href=\"IBM.html\" title=\"IBM\" style=\"text-decoration:none;\"><span title=\"THINK\" style=\"font-weight:bold;color:blue;\">IBM</span></a>",[[],[]]],
    ["<a href=\"THINK.html\" title=\"THINK\"><span style=\"background-color:#E0E0E0;padding:1px 4px 0px 3px;font-weight:bold;border:1px solid #585858;border-radius:3px;\" title=\"THINK\">THINK</span></a>" =>
            "<a href=\"THINK.html\" title=\"THINK\" style=\"text-decoration:none;\"><span style=\"background-color:#E0E0E0;padding:1px 4px 0px 3px;font-weight:bold;border:1px solid #585858;border-radius:3px;\" title=\"THINK\">THINK</span></a>",[[],[]]],
    ["<a href=\"THINK.html\" title=\"THINK\"><span style=\"background-color:#E0E0E0;padding:1px 4px 0px 3px;font-weight:bold;border:1px solid #585858;border-radius:3px;\" title=\"THINK\">THINK</span>ing</a>" =>
            "<a href=\"THINK.html\" title=\"THINK\" style=\"text-decoration:none;\"><span style=\"background-color:#E0E0E0;padding:1px 4px 0px 3px;font-weight:bold;border:1px solid #585858;border-radius:3px;\" title=\"THINK\">THINK</span>ing</a>",[[],[]]],
    ["<a rel=\"nofollow\" class=\"external text\" href=\"https://www.mcdonalds.com\">" =>
            "<a rel=\"nofollow\" class=\"external text\" href=\"https://www.mcdonalds.com\" style=\"text-decoration:none;\">",[[],[]]],
    [r"<a href=\"(Prag|Rubbish|Zelensky|Waste|Cannibalism|Petty|MotherBitch|Hungary).html\" title=\"\1\"><span style=\"([^\"]+)\">☠</span></a>" =>
            s"<a href=\"\1.html\" title=\"\1\" style=\"text-decoration:none;\"><span style=\"\2\">☠</span></a>",[[],[]]],
    [r"<a href=\"Wo.html#HMF\" title=\"Wo\"><span style=\"([^\"]+)\">☠</span></a>" =>
            s"<a href=\"Wo.html#HMF\" title=\"Wo\" style=\"text-decoration:none;\"><span style=\"\1\">☠</span></a>",[[],[]]],
    [r"<a href=\"Prayer.html#DoGooders\" title=\"Prayer\"><span style=\"([^\"]+)\">☠</span></a>" =>
            s"<a href=\"Prayer.html#DoGooders\" title=\"Prayer\" style=\"text-decoration:none;\"><span style=\"\1\">☠</span></a>",[[],[]]],
    ["></a><span style=\"font-weight:normal;\"><span style=\"font-style:normal;\">[</span><a href=\"BRADFORD.html\" title=\"BRADFORD\"><span style=\"font-weight:normal;font-size:smaller;\" title=\""I am who am" (Exodus 3:14). Are you, too, my reader?\">18-11-46-503</span></a><span style=\"font-style:normal;\">]</span></span></span>" =>
            "></a><span style=\"font-weight:normal;\"><span style=\"font-style:normal;\">[</span><a href=\"BRADFORD.html\" title=\"BRADFORD\" style=\"text-decoration:none;\"><span style=\"font-weight:normal;font-size:smaller;\" title=\""I am who am" (Exodus 3:14). Are you, too, my reader?\">18-11-46-503</span></a><span style=\"font-style:normal;\">]</span></span></span>",[[],[]]],
    ["><span style=\"font-weight:normal;\">[<a href=\"welcome.html\" title=\"welcome\"><span style=\"font-weight:normal;font-size:smaller;\" title=\""I am who am" (Exodus 3:14). Are you, too, my reader?\">18-11-46-503</span></a>]</span></span>" =>
            ">[<a href=\"welcome.html\" title=\"welcome\" style=\"text-decoration:none;\"><span style=\"font-weight:normal;font-size:smaller;\" title=\""I am who am" (Exodus 3:14). Are you, too, my reader?\">18-11-46-503</span></a>]</span>",[[],[]]],
    [r"\r+" =>
            "",[[],[]]],
    [r"here in A place To Study"i =>
            "here", [["JSource"],[]]],
    [" decoding=\"async\"" =>
            "",[[],[]]],
    [" class=\"internal\"" =>
            "",[[],[]]],
    [r"<span id=\"[^\"]+\"></span>" =>
            "",[[],[]]],
    ["<a href=\"Glossary.html#FITB\" title=\"Glossary\">fill in the blank</a>" =>
            "<a href=\"Glossary.html#FITB\" title=\"Glossary\" style=\"text-decoration:none;\">fill in the blank</a>",
                    [[],[]]],
    ["<a href=\"OnCitation.html\" title=\"OnCitation\">Footnotes</a>" =>
            "<a href=\"OnCitation.html\" title=\"Citations...\" style=\"text-decoration:none;font-family:serif;font-weight:normal;font-style:italic;\">Footnotes</a>",[[],[]]],
    ["<a href=\"w/images/4/4e/Despair2.jpg\" title=\"Despair2.jpg\">Power</a>" =>
            "<a href=\"w/images/4/4e/Despair2.jpg\" title=\"Why bother?\" style=\"text-decoration:none;\">Power</a>",[[],["Monumentality"]]],
    [r"(<li>([)?)<a href=" =>
            s"\1<a style=\"text-decoration:none\" href=", [[], ["NYNYT"]]],
    ["<a href=\"Fortuna.html\" title=\"Fortuna\">Here, let's engage" =>
            "<a href=\"Fortuna.html\" title=\"Fortuna\" style=\"text-decoration:none;\">Here, let's engage", [[],[]]] 
]

global trans3 = [
    [r"href=\"/wiki/User:Bradford_Robert_McCormick/([^\"#]*)#([^\"]*)\"" =>
            s"href=\"\1.html#\2\"",[[],[]]],
    [r"href=\"/wiki/User:Bradford_Robert_McCormick/([^\"]*)\"" =>
            s"href=\"\1.html\"",[[],[]]], 
    [r"href=\"/wiki/User:Bradford_Robert_McCormick([^\"]*)\"" =>
            s"href=\"welcome.html\1\"",[[],[]]],           
    [r"-0\">[^<]+</a></span> <span class=\"reference-text\">" => 
            "-0\">↑</a></span> <span class=\"reference-text\">",[[],[]]],   # ampersand uarr semicolon  fuckup?
    [r"<a href=\"/wiki/([^\"]+)\"" => 
            s"<a href=\"https://www.aplacetostudy.com/wiki/\1\"",[[],[]]],
    ["</font>" =>
            "<!-- /font -->", [[],["KillingTheCats"]]],
    [r"<font([^>]+)>" =>
            s"<!-- font\1 -->", [[],["KillingTheCats"]]],
    ["<li class=\"mw-empty-elt\"></li>" =>
            "", [[],["ChangeLog", "ChangeLog2", "ChangeLog3"]]],
]

# ERROR: 400     # Passum and Good are really screwed up: we do the first match and we ignore subsequent matches
global trans4 = [
    [r"<title>User:Bradford Robert McCormick.*? - A Place to Study Developer</title>" =>
                    "<title>The Life of the Mind|welcome</title>",[[],[]],400],
    ["<a href=\"Education.html\" title=\"User:Bradford Robert McCormick/Education\">" =>
                    "<a href=\"Education.html\" title=\"User:Bradford Robert McCormick/Education\" style=\"text-decoration:none;\">",[[],[]],401],
    ["<a href=\"Passum.html\" title=\"User:Bradford Robert McCormick/Passum\">" =>
                    "<a href=\"Passum.html\" title=\"User:Bradford Robert McCormick/Passum\" style=\"text-decoration:none;\">",[[],[]],402],
    ["<a href=\"Good.html\" title=\"User:Bradford Robert McCormick/Good\">" =>
                    "<a href=\"Good.html\" title=\"User:Bradford Robert McCormick/Good\" style=\"text-decoration:none;\">",[[],[]],403],
    ["<div id=\"contentSub\"></div>" =>  # Why does goddamned asshole code not allow me to delete the trailing newline here?
                    "",[[],[]],404]
]

# ERROR: 500    <a href=\"welcome.html\" title=\"User:Bradford Robert McCormick\">User:Bradford Robert McCormick</a></span></div>
# fname != ""
global trans5 = [
    ["<div id=\"content\" class=\"mw-body\"><div id=\"contentSub\"><span class=\"subpages\">< <a href=\"welcome.html\" title=\"User:Bradford Robert McCormick\">User:Bradford Robert McCormick</a></span></div>" =>
                "<div id=\"content\" class=\"mw-body\">",[[],["index"]],500], 
    ["<div id=\"content\" class=\"mw-body\"><div id=\"contentSub\"><span class=\"subpages\">< <a href=\"welcome.html\" title=\"User:Bradford Robert McCormick\">User:Bradford Robert McCormick</a></span></div>" => 
                "<div id=\"content\" class=\"mw-body\"><div id=\"contentSub\" style=\"padding-top:2px;\"><span style=\"padding:0px 0px 0px 6px;\"><span class=\"subpages\" style=\"border:1px solid black;border-radius:4px;background-color:lightyellow;padding:2px 6px 3px 1px;font-size:smaller;\"><a href=\"welcome.html\"><img alt=\"Prev2a.gif\" src=\"w/images/1/12/Prev2a.gif\" width=\"10\" height=\"12\" style=\"padding-left:3px;\" /></a><a href=\"welcome.html\" title=\"Welcome!\">Welcome</a></span></span></div>",[["Welcome", "index"],[]],501],
    # Once again: "Goddamn Wiki!"
    #[r"<body><div id=\"content\" class=\"mw-body\" role=\"main\">[ \r\n]+" =>
    #        "<body style=\"background-color:white;\"><div id=\"content\" class=\"mw-body\">",[[],["index"]],502],
    [r"<title>User:Bradford Robert McCormick/(.*?) - A Place to Study Developer</title>" => 
                        s"<title>The Life of the Mind|\1</title>",[[],[]],503],
    ["<a href=\"PrepForWhat.html\" title=" =>
                        "<a href=\"PrepForWhat.html\" style=\"text-decoration:none;\" title=", [[],["Huang"]],504]  
]

global trans6 = [       # unlinked images
    [r"<a href=\"/wiki/File:.+?title=\"([^\"]+)[^>]+><img.+?src=\"([^\"]+).*?></a>" =>
            s"<img src=\"\2\" title=\"\1\" />",[[],[]]],
    [r"<a href=\"/wiki/File:[^\"]+\" class=\"image\">(<img[^>]+>)</a>" =>
            s"\1",[[],[]]]
]

# ERROR: 700
global trans7 = [
    ["<body>" =>
            "<body style=\"background-color:white;\">",[[],[]]],
    [">\n<div class=\"read600\">" =>
            "><div class=\"read600\">",[[],["index"]]],
    [" href=\"https://www.bmccedd.org/Dashboard.html\">bmccedd.org <span style=\"font-size:smaller;\">Dashboard</span></a>" =>
            " style=\"text-decoration:none\" title=\"Go to Dashboard on bmccedd.org!\" href=\"https://www.bmccedd.org/Dashboard.html\">bmccedd.org <span style=\"font-size:smaller;\">Dashboard</span></a>",[[],["Dashboard"]]]
]

# Items have to be ordered so that substrings come after longer strings that contain them
global SHORTCUTS = [
    ["TREEI", "Images, Tree, RTree, XTree" ],
    ["TREE",  "Tree, RTree, XTree"         ]
]

global SHOW_SKIPPED = true
global DESPARATION_TESTING = false
 
for x in [trans1, trans2, trans3, trans4, trans5, trans6, trans7]
   for xx in x
        if length(xx[2][1]) > 0 && length(xx[2][2]) > 0
            println("\n Bad trans: ", xx)
            exit(16)
        end
    end
end
                 

Return to TOC!Return to TOC

Julia script to update last update timestamp file (WBupdate)

using Dates

APFS = "005" # WBupdate:APFS
global version = APFS

inf = "\n" * "WBupdate(" * version *"):   \033[" * "31" * ";1m" * string(now())[1:16] * "\033[0m  (local time)\n"
w = open("WBLOG-TS", "a")
write(w, inf)
close(w)
println(inf)

#\033[" * string(clr) * ";1m|" * string(clr) * "|\033[0m  (local time)"

Return to TOC!Return to TOC

JuliaAdd missing images (WBIA)

APFS = "005" # WBIA:APFS
global versionNr = APFS

#using Pkg; Pkg.add("HTTP")
using HTTP

function getImage(id)
    try
        res = HTTP.get("https://www.aplacetostudy.com/w/images/" * id)
        f = open("w/images/" * id, "w")
        write(f, res.body)
        close(f)
        println("    Done: " * id)
    catch ex
        s = string(ex)  
        if length(s) > 200
            s = s[1:200] * "..."
        end
        println("\n      Failure: ", typeof(ex), ".\n", s);
        return 0
    end
end

ids = [   # Fill in images to load "x/xx/x.xxx"
 
]

if length(ARGS) > 0
    for arg in ARGS
        item = replace(arg, r"[,\" ]+" => "")
        getImage(item)
    end
    return(0)
end

for id in ids
    getImage(id)
end


Return to TOC!Return to TOC

Julia script to check for not current files in Local and Bmccedd (WBXXX)

#using Pkg; Pkg.add("HTTP")
using Dates
using HTTP

APFS = "014" # WBXXX:APFS           # VERSION STAMP
version = APFS

function getNow()
    dt = string(Dates.now())
    dtx = findfirst('T', dt)
    return(dt[1: dtx - 1] * " " * dt[dtx + 1: length(dt)])
end

function toDecimal(d)
    q = [parse(Int32, d[1:4]), parse(Int32, d[6:7]), parse(Int32, d[9:10]), 
                parse(Int32, d[12:13]), parse(Int32,d[15:16])]
    return q
end

function getDiff(xc,yc)
    x = toDecimal(xc)
    y = toDecimal(yc)
    a = Int64(Dates.value(Dates.DateTime(x[1],x[2],x[3],x[4],x[5]) - 
                Dates.DateTime(y[1],y[2],y[3],y[4],y[5]))/1000)
    b = Int64(trunc(a / (24 * 60 * 60)))
    bb = a - b * (24 * 60 * 60)
    c = Int64(trunc(bb / (60 * 60)))
    cc = bb - (c * 60 * 60)
    d = Int64(trunc(cc / 60))
    return (b > 0 ? string(b) *"d " : "") * string(c) * "h " * string(d) * "m"
end
    
if length(ARGS) != 1 || !(uppercase(ARGS[1]) == "APTS" || uppercase(ARGS[1]) == "LOCAL")
    println("Need one argument: \"APtS\" or \"Local\"")
    exit(16)
end
global APtS = uppercase(ARGS[1]) == "APTS"
println("\nWBXXX v" * version * " at: " * getNow()[1:16] * " doing: " * 
                (APtS ? "APtS => Local" : "Local => Dreamhost") * "\n") 

mos = Dict{String, String}([
    "Jan" => "01", "Feb" => "02", "Mar" => "03", "Apr" => "04", "May" => "05", "Jun" => "06",
    "Jul" => "07", "Aug" => "08", "Sep" => "09", "Oct" => "10", "Nov" => "11", "Dec" => "12"
])
global rejects = []
global nuthin = true
global todoString = ""
gst = time()

global a = readdir()
global aa = length(a) 
for q = 1 : aa
    if q % 50 == 0
        println("Processed: " , q)
    end
    f = a[q]
    lf = length(f)
    if lf < 6 || f[lf- 4 : lf] != ".html"
        push!(rejects, f)
        continue
    end
    res = "" 
    you = f[1 : lf - 5]
    you2 = ""
    if APtS
        you2 = you == "welcome" ? "" : ("/" * you)
    else
        you2 = "/" * f
    end 
    try
        fn = APtS ? "https://www.aplacetostudy.com/wiki/User:Bradford_Robert_McCormick" : 
                    "https://www.bmccedd.org"
        res = HTTP.head(fn * you2)
    catch ex
        if you == "IntoTheLight" && APtS
            println("    [IntoTheLight does not exist in APtS]")
            continue
        end
        s = string(ex)  
        if length(s) > 200
            s = s[1:200] * "..."
        end
        println("\n      Failure1: ", typeof(ex), ".\n", s);
        global nuthin = false
        continue
    end
    try
        locl = string(Dates.unix2datetime(mtime(f)))[1:16]
        res = string(res)
        # Last-Modified: Wed, 08 Dec 2021 09:05:59 GMT
        dt = findfirst(r"Last-Modified: .*?GMT", res)
        dt = res[dt][21:44]
        dtx = dt[8:11] * "-" * mos[dt[4:6]] * "-" * dt[1:2] * "T" * dt[13:17]
        if APtS
            if dtx >= locl 
                println("    APtS => Local:  " * dtx, " >= ", locl, ".   " , you, 
                            "  (" , getDiff(dtx, locl), ")")
                global nuthin = false
                global todoString *= ", " * you 
            end
        else
            if locl >= dtx
                sz = string(stat(f).size)
                lensz = length(sz)
                if lensz > 3
                    sz = sz[1:lensz - 3] * "," * sz[lensz - 2:lensz]
                end 
                println("    Local => Dreamhost:  " * locl, " >= ", dtx, ".   " , you, 
                            "  (" , getDiff(locl, dtx), ") " , sz)
                global nuthin = false                
            end
        end
    catch ex
        s = string(ex)  
        if length(s) > 200
            s = s[1:200] * "..."
        end
        println("\n      Failure2: ", typeof(ex), ".\n", s);
        continue
    end    
end

if nuthin
    println("\n[No work to do]")
end
if todoString != ""
    println("\ntodoString: \"" * todoString[3 : length(todoString)] * "\"")
end

b = time() - gst
c = floor(Int, b / 60)
d = round(b - (c * 60), sigdigits=7)
e = string(c) * "m" * (d < 10 ? "0" : "") * string(d)

println("\n", getNow(), ". [" * e * "].  " * string(rejects))

Return to TOC!Return to TOC

Julia script to verify external links (WBheads)

using HTTP

APFS = "005" # WBheads:APFS
global versionNr = APFS

global failures = []
global attns = []

x = open("XTree.html", "r")
xx = read(x)
close(x)
txt = String(xx)
urls = findall(r"href=\"[^\"]+", txt)
global ctr = 0;
for urlx in urls
    global item = txt[urlx]
    if !contains(item, "http")
        continue
    end
    global ctr += 1
    global item = item[7 : length(item)]
    try
        print("    ", ctr, ". ", item)
        heads = HTTP.head(item, readtimeout=15)
        sx = string(heads.status)
        sxx = ""
        if sx != "200"
            sxx = "ATTN: "
            push!(attns, item)
        end
        println(" ", sxx, sx)
    catch ex
        s = string(ex)
        println(" **Failed**")  
        if length(s) > 200
            s = s[1:200] * "..."
        end
        push!(failures, (item * " =>\n" * s))
    end
end
println("\nWBheads v", versionNr, ". Count: " , ctr , ".")
println("\n", attns)
println("--------")
global ctr = 0
for f in failures
    global ctr += 1
    println("\n", ctr, ". ", f)
end
    

Return to TOC!Return to TOC

Julia Create WB-ALL for use in WB script (WBListAll)

using Dates

APFS = "006" # WBListAll:APFS
version = APFS
global ctr = 0
global out = ""
global problems = ""
dict = Dict{String, Bool}()
global maxItem = 0

z = open("IndexOfSubjects.html", "r")
txt = String(read(z))
close(z)

re = r"<li><a href=\"([^\.]+)\.html\" title=\"[^\"]+\">\1</a>"
z = findall(re, txt)
for zzz in z
    str = txt[zzz]
    str = replace(str, re => s"\1",count=1)
    dict[str] = false
end
txt = replace(txt, re => "")
z = findall(r"<li><a href=\"([^\"]+)\"", txt)
for zzz in z
    global problems *= "GKW: '" * txt[zzz] * "'\n"
end
 
dict["IntoTheLight"] = false

global hits = 0
a = readdir()
for itm in a
    x = findfirst(".html", itm)
    if x == nothing
        continue
    end
    itm = itm[1: (x.start - 1)]
    if itm == "TSUHD"
        continue
    end
    if haskey(dict, itm)
        if dict[itm]
            global problems *= "Duplicate: \"" * itm * "\"\n"
        else
            dict[itm] = true
            global hits += 1
        end
    else
        global problems *= "Missing: \"" * itm * "\"\n"
    end 
    global out *= itm * "\n"
    if length(itm) > maxItem
        global maxItem = length(itm)
    end
    global ctr += 1
end

for x in keys(dict)
    if !dict[x]
        global problems *= "Only in IndexOfSubjects: \"" * x * "\"\n"
    end
end

OUTPUTFILE = "WB-ALL"
z = open(OUTPUTFILE, "w")

zz = "# WBListAll v" * version * ". ctr: " * string(ctr) * ". hits: " * string(hits) *
        ". maxLen: " * string(maxItem) * ". " * string(now())[1:16] * "  (QWERT)"
zza = zz
zz *= "\n" * out
lenzz = "     " * string(length(zz))
lenzzz = length(lenzz)
lenzz = lenzz[lenzzz - 4 : lenzzz]
zz = replace(zz, "QWERT" => lenzz, count=1)
zza = replace(zza, "QWERT" => lenzz, count=1)
write(z, zz)
close(z)
print("\n" * zza * "\n\n" * problems)

println("\n    WB-ALL length: ", lenzz)


Return to TOC!Return to TOC

Julia script to search for character strings in WB backup files (WBsearch)

using Dates

APFS = "047" # WBsearch:APFS
version = APFS
global t = time();
global gotsomething = false
global SZ = Dict{String, String}()
global HSYMS = []
global HSYMCT = 0
global WorkString = ""
global CCT = 1

global PRE = 20
global POST = 38

if length(ARGS) == 0
    println("\n    WB WBsearch string | \\\" string | \\[string\\], string | \\[string\\].... \\\" [before after]")
    exit(0)
end 
if length(ARGS) == 3
    global PRE = parse(Int32, strip(ARGS[2]))
    global POST = parse(Int32, strip(ARGS[3]))
end

OUTPUTFILE = pwd() * "\\..\\JUNK.html"
OUTPUTFILE2 = pwd() * "\\..\\JUNK2.txt"

aa = strip(ARGS[1]);

if findfirst(",", aa) != nothing
    global searchStrings = split(aa, ",")
else 
    global searchStrings = [aa]
end
global ACCUMS = zeros(Int32, length(searchStrings))

global shit = []
for w in searchStrings
    ww = strip(w)
    lent = length(ww)
    if ww[1] == '[' && ww[lent] == ']'
        ww = ww[2 : lent - 1]
    end    
    ww = Regex(ww, "i")
    push!(shit, ww)
end
global searchStrings = shit

global errId = 0
global ctr = 0
global cctr = 0

global out = "<table style=\"border-collapse:separate;white-space:nowrap;font-family:monospace;font-weight:bold;font-size:large;padding:0px 12px 10px 6px;\">"
try
    global errId = 1
    a = readdir()
    aP0 = readdir("\\Robbie\\WikiBkup\\w\\pdfs")

    aP = []
    for pdf in aP0
        push!(aP, "\\Robbie\\WikiBkup\\w\\pdfs\\" * pdf)
    end   
    a = append!(a, aP) 
    global errId = 2
    for itm in a
        if findfirst(".html", itm) == nothing && itm != "TREE" && findfirst(".pdf", itm) == nothing
            continue
        end
        global item = itm
        f = open(item)
        global errId = 4
        res = read(f)
        global errId = 5
        close(f)
        lenRes = length(res)
        if lenRes > 49999
            lenRes = "            " * string(lenRes)
            lenLenRes = length(lenRes)
            chk = lenRes[lenLenRes - 10 : lenLenRes]
            if get(SZ, chk, "GKW") != "GKW"
                println("Error: " * chk * "  " * item) # Program broke if 2 files same len
                exit(16)
            end          
            SZ[chk] = replace(item, "\\Robbie\\WikiBkup\\w\\" => "", count=1)
        end
        if itm == "TREE" || findfirst(".pdf", itm) != nothing
            continue
        end
        global ctr += 1
        if ctr % 50 == 0
            println(ctr, "  " , round(time() - t, digits=4))
        end        
        txt = String(res)

        x = findall(r"&#[^;]+;", txt)
        global HSYMCT += length(x)
        for y in x
            z = txt[y]
            if z in HSYMS
                continue
            end
            push!(HSYMS, z)
        end

        global cctr += length(txt)
        fuck = []
        quotes = ""
        ct = 1
        for s in searchStrings
            qqk = findall(s, txt)
            qq = length(qqk)
            for itm in qqk
                alpha = itm.start - PRE
                omega = itm.stop + POST
                if alpha < 1
                     omega -= alpha - 1
                     alpha = 1
                end
                if omega > length(txt)
                    omega = length(txt)
                end
                bailout = false
                global tq = txt[alpha:omega]
                for i = 1 : length(tq)
                    global ii = Int32(Char(tq[i]))
                    if ii > 127
                        println("Fuckup: " , item , " \"", tq, "\" " , ii, " \"" , tq[i] , "\"")
                        bailout = true
                        tq = "?" * replace(tq, r"[;&<>']" => "?") * "?"  
                        break
                    end
                end
                if !bailout
                    aaw = findfirst(s, tq)
                    tq = tq[1 : aaw.start - 1] * "WQWQWQ" * tq[aaw.start : aaw.stop] * "XQXQXQ" *
                            tq[aaw.stop + 1: length(tq)]

                    tq = replace(tq, ";" => "!!!!!!!!#59;")  # Some characters here not display correct on JSource page. Use page source!
                    tq = replace(tq, "&" => "&")
                    tq = replace(tq, "!!!!!!!!" => "&")
                    tq = replace(tq, "<" => "<")   
                    tq = replace(tq, ">" => ">") 
                    tq = replace(tq, "\"" => """)
                    tq = replace(tq, "'" => "'")
                    tq = replace(tq, "/" => "/")
                    tq = replace(tq, "{" => "{")
                    tq = replace(tq, "}" => "}")
                    tq = replace(tq, " " => " ")

                    tq = replace(tq, "WQWQWQ" => "<span style=\"border-bottom:1px solid black;font-weight:normal;color:black;\">", count=1)    # Underscore the search text!
                    tq = replace(tq, "XQXQXQ" => "</span>", count=1)                    
                end 
                inf = "<br>" * string(ct) * ". " * string(itm)
                quotes *= inf * (" " ^ (22 - length(inf))) * "<span style=\"" * (bailout ? "" : "background-color:lightyellow;") * "padding:1px 6px 1px 5px;" * (bailout ? "" : "color:darkred;") * "\">" * tq * "</span>"
                ct += 1
            end
            push!(fuck,  qq)
        end

        global ACCUMS += fuck

        if quotes != ""
            global WorkString *= (WorkString == "" ? "" : ", ") * item[1:length(item) - 5]
            global out *= "\n<tr><td style=\"vertical-align:top;line-height:135%;top;text-align:right;font-weight:normal;\"><span style=\"font-size:smaller;\">" * string(CCT) * ".</span> </td><!-- td style=\"vertical-align:top;line-height:135%;\"><a href=\"WikiBkup\\" * item * "\">==</a></td><td> </td --><td style=\"vertical-align:top;line-height:135%;\"><a href=\"WikiBkup\\" * item * "\" style=\"text-decoration:none;\">" * item * "</a></td><td> </td><td style=\"line-height:135%;vertical-align:top;\"><span style=\"font-weight:normal;\">" * string(fuck) * "</span> " * quotes * "</td></tr>"
            global gotsomething = true
            global CCT += 1
        end
    end
catch ex
    s = string(ex)  
    if length(s) > 200
        s = s[1:200] * "..."
    end
    println("\nDoing: " * item * " \"" * tq * "\"")
    println("      Failure[" * string(errId) * "]: ", typeof(ex), ".\n", s);
    exit(16)
end

hsyms = []
hsyms2 = []
global k = 1
global gotSomething = false
for i = 1 : length(HSYMS)
    if k % 10 == 1
        if gotSomething
            kn1 = k - 1
            sp = "<span style=\"font-weight:normal;font-size:smaller;color:darkgreen;\">[" * string(kn1) * "]</span>"
            push!(hsyms, sp)
            sp = "<span style=\"font-weight:normal;color:darkgreen;\">[" * string(kn1) * "]</span>"
            push!(hsyms2, sp)
            gotSomething = false
        end
    end
    h = HSYMS[i]
    if (h >= "Α" && h <= "Ω") || (h >= "α" && h <= "ω")  # Don't trust Greeks! 
        continue
    end
    push!(hsyms, h)
    push!(hsyms2,h[3 : length(h) - 1])
    global k += 1
    global gotSomething = true
end

sct = string(HSYMCT)
sct = sct[1:1] * "," * sct[2:4]
global out *= "\n" * (gotsomething ? "" : "<tr><td colspan=5>[No matches]</td><tr>") * 
            "<tr><td colspan=4><p style=\"font-size:130px;\"> </p></td></tr>" *

            "<tr><td colspan=4><div style=\"width:600px;border-radius:6px;background-color:lightyellow;margin-left:24px;border:2px solid black;padding:0px 8px 0px 10px;width:600px;font-family:sans-serif;font-weight:bold;\"><p style=\"white-space:normal;\"><span style=\"font-weight:normal;font-size: smaller;color:darkgreen;\">" * 
            string(k) * ":</span>  " * replace(join(hsyms, ", "), ", <span style=\"font-weight:normal;font-size:smaller;color:darkgreen;\">[" => " <span style=\"font-weight:normal;font-size:smaller;color:darkgreen;\">[")  * "</p><hr />" *
            "<p style=\"white-space:normal;font-size:smaller;\"><span style=\"font-weight:normal;color:darkgreen;\">" * 
            string(k) * ":</span>  " * replace(replace(join(hsyms2, ", "), ", <span style=\"font-weight:normal;color:darkgreen;\">[" => " <span style=\"font-weight:normal;color:darkgreen;\">["), "x" => "<span style=\"color:darkred;\">x</span>") * "  <span style=\"font-weight:normal;\">[Σ " * sct * "]</span></p></div></td></tr>" *

                "<tr><td colspan=4 style=\"text-align:right;padding-right:280px; padding-top:14px;\"><a style=\"text-decoration:none;font-weight:normal;\" href=\"junk2.txt\">junk2.txt</a></td></tr>" *
                "</table><!--p>[․ 8228</p --><br><p style=\"padding:0px 24px 0px 16px;\">\"" * WorkString * "\"</p><br><br></div></body></html>"

stotlen = string(cctr)
if cctr> 999
    stotlen = stotlen[1:length(stotlen) - 3] * "," *
            stotlen[length(stotlen) - 2 : length(stotlen)]
end
if cctr > 999999
    stotlen = stotlen[1:length(stotlen) - 7] * "," * 
            stotlen[length(stotlen) - 6 : length(stotlen)]
end 
pre = "<html><head></head><body><div style=\"margin:40px 0px 20px 32px;\"><p style=\"line-height:150%;font-family:sans-serif;font-weight:bold\">" 
pre *= string(searchStrings) * ".  " * OUTPUTFILE
pre *= "<br>Files: " * string(ctr) * ".  Chars: " * stotlen * ".  Σ" * string(ACCUMS) * "  Time: " *
                string(round(time() - t, digits=4)) * ".  v" *  version * "</p>"

z = open(OUTPUTFILE, "w")
write(z, pre * out)
close(z)

kk = keys(SZ)
fuck = []
for k in kk
    push!(fuck, string(k))
end
fuck = sort(fuck, rev = true)
global fu = ""
global brk = true
for f in fuck
    if findfirst(".html", SZ[f]) != nothing && brk
        global fu *= "\n" * f * "   " * SZ[f] * "\n"
        global brk = false
    else
        global fu *= f * "   " * SZ[f] * "\n"
    end
end 

z = open(OUTPUTFILE2, "w")
zn = string(now())
zn = zn[1:10] * " " * zn[12 : length(zn)] 
write(z, "    WBsearch v" * version * "\n")   
write(z, "    " * zn * "\n\n" * fu)
close(z)

println("Output saved to: " * OUTPUTFILE* ".  Time: " * string(round(time() - t, digits=4)) * "    Σ" * string(ACCUMS) *
            ".\nv" *  version)

if length(ARGS) > 1
    run(`"C:\Program Files\Google\Chrome\Application\chrome.exe" $OUTPUTFILE`)
end

Return to TOC!Return to TOC

Julia Report local files not up to date with APtS (WBafter)

using HTTP
using Dates
include("WB_Aftermath")

APFS = "051" # WBafter:APFS
global IMAGES = 0

if length(ARGS) == 1 || length(ARGS) > 3
    println("\n    days_in_month  gmt_offset  [ entries to process ]")
    exit(16)
elseif length(ARGS) > 0
    global TZoffset = parse(Int,ARGS[2])
end

global startTime = time()

global ImageCache = Dict{String, String}()
for (root, dirs, files) in walkdir("./w/")
    for file in files
        x = joinpath(root, file) # path to files
        if !startswith(x, "./w/images\\")
            continue
        end
        z = replace(x, "\\" => "/")        
        global ImageCache[z[17 : length(z)]] = z[12 : 15]
        global IMAGES += 1 
    end
end

xq = open("WBLOG-TS", "r")
yq = readlines(xq)

if length(yq) >= 4
    zq = yq[4]
    bdy = findfirst(r"[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}", zq)
    dlm = zq[bdy]
    dlm0 = dlm[1:10] * " " * dlm[12:16]
    println("[" * dlm0 * "]    v" * APFS * " (" * string(length(findall(r"WBupdate|at:", string(yq)))))
else
    println("[What the?]")
end

zq = yq[length(yq)]
bdy = findfirst(r"[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}", zq)
dlm = zq[bdy]
dlm = " " * dlm[1:10] * " " * dlm[12:16] * "     ----------"
global t1time = time() - startTime

ct = length(ARGS) == 3 ? ARGS[3] : DefaultNumberEntries

months = ["January", "February", "March", "April", "May", "June",
         "July", "August", "September", "October", "November", "December"]

res = HTTP.get("https://www.aplacetostudy.com/w/index.php?title=Special:Contributions/Bradford_Robert_McCormick&offset=&limit=" * ct * "&target=Bradford+Robert+McCormick")
txt = String(copy(res.body))

# -------- Cope with Wiki's obnoxious welcome page that has no page name --------

txt = replace(txt, r" class=\"mw-changeslist-date\" title=\"User:Bradford Robert McCormick\">([0-9][0-9]:[^<]+)</a>" =>
        s" class=\"mw-changeslist-date\" title=\"User:Bradford Robert McCormick/welcome\">\1</a>")

if false
    f = open("yyy.txt", "w")
    write(f,txt)
    close(f)
end
arry = []
arry2 = []

hits = findall(r"title=\"User:Bradford Robert McCormick/[^\"]+\">[0-9][0-9]:[^<]+</a>", txt)
hitss = findall(r"title=\"File:[^\"]+\">[0-9][0-9]:[^<]+</a>", txt)
hitsst = findall(r"title=\"Template:[^\"]+\">[0-9][0-9]:[^<]+</a>", txt)

temps = []
for x in hitsst
    y = replace(txt[x],r"\">.+" => "")
    y = replace(y[17 : length(y)], " " => "_")
    if !(y in temps) 
        push!(temps, y)
    end    
end
 
append!(hits, hitss, hitsst)

for j in hits
    x = txt[j]
    y = findlast("k/", x)
    if y == nothing
        y = findlast("e:", x)
    end
    w = findlast("\"", x)
    z = x[y.start + 2 : w.start - 1]
    if z in arry
        continue
    end
    push!(arry,z)
    y = findfirst(">", x)
    w = findfirst("<", x)
    z = x[y.start + 1 : w.start - 1]
    push!(arry2,z) 
end

println(" ")
global WorkToDo = ""
arry3 = []
for i = 1 : length(arry)

# 05:44, 16 March 2022

    x = split(arry2[i])
    y = parse(Int,x[4])
    qqq = 1000
    for i = 1 : length(months)
        if months[i] == x[3]
            qqq = i
            break
        end
    end
    m = qqq
    d = parse(Int,x[2])
    h = parse(Int,x[1][1:2]) + 3    # Time mess in Wiki California base
    if h > 23 
        h = h - 24
        d += 1;
    end
    if d > (length(ARGS) == 0 ? DaysInMonth : parse(Int, ARGS[1]))
        d = 1
        m += 1
    end
    if m > 12
        m = 1
        y += 1
    end
    y = string(y)
    m = string(m)
    if length(m) == 1
        m = "0" * m
    end
    d = string(d)
    if length(d) == 1
        d = "0" * d
    end
    h = string(h)
    if length(h) == 1
        h = "0" * h
    end

    tim =  y * "-" * m * "-" * d * " " * h * arry2[i][3:5]
    goo = ""
    gup = ""
    d = ""
    v = ""
    astray = replace(arry[i], " " => "_")
    IMAGEX = findfirst(r"\.(jpg|png|gif)", astray)
    if IMAGEX == nothing
        v = string(Dates.unix2datetime(stat(astray * ".html").mtime - TZoffset * 60 * 60))
    else
        d = get(ImageCache, astray, "NOPE")
        u = "w/images/" * d * "/" * astray
        v = string(Dates.unix2datetime(stat(u).mtime - TZoffset * 60 * 60))
        goo = "  "
    end 
    v = v[1:10] * " " * v[12:16]
    if arry[i] != "Experiment3"   # My guinea pig web page
        if v < tim
            if astray in temps
                goo = "     "
            else  
                gup = " **** " * d
                if IMAGEX == nothing
                    if WorkToDo != ""
                        global WorkToDo *= ", "
                    end
                    global WorkToDo *= replace(arry[i], " " => "_")
                end
            end
        elseif v == tim
            gup = " == " * d
        elseif IMAGEX != nothing
            gup = "   " * d         
        end    
        push!(arry3, " " * tim * "     " * goo * replace(arry[i], " " => "_") * gup)
    end
end

global dlm0a = " " * dlm0 * "     ----------"
if dlm0a != dlm
    push!(arry3, dlm0a)
end
push!(arry3, dlm)
arry3 = sort(arry3, rev=true)

global pi3 = ""
for i = 1 : length(arry3)
    if i == length(arry3) && arry3[i] == dlm0a
        continue
    end
    if arry3[i][1:11] == pi3
        println("           " * arry3[i][12:length(arry3[i])])
        continue
    end
    println(arry3[i])
    global pi3 = arry3[i][1:11]
end

c = floor(Int, t1time / 60)
d = round(t1time - (c * 60), sigdigits=6)
e1 = string(c) * "m" * (d < 10 ? "0" : "") * string(d)

b = time() - startTime
c = floor(Int, b / 60)
d = round(b - (c * 60), sigdigits=6)
e = e1 * ", " * string(c) * "m" * (d < 10 ? "0" : "") * string(d)

println("\n  " * (WorkToDo == "" ? "[ No work to do ]  " : "julia WB \"" * WorkToDo * "\"  ") * e *
            "  ImageCt: " * string(IMAGES))

Return to TOC!Return to TOC

Julia script to show images used (WBcount)

using Dates

APFS = "091" # WBCount:APFS
version = APFS

global unhex = Dict(
    "0" => 0, "1" => 1, "2" => 2, "3" => 3, "4" => 4, "5" => 5, "6" => 6, "7" => 7,
    "8" => 8, "9" => 9, "a" => 10, "b" => 11, "c" => 12, "d" => 13, "e" => 14, "f" => 15
)
global tohex = Dict(
    0 => ".", 1 => "1", 2 => "2", 3 => "3", 4 => "4", 5 => "5", 6 => "6", 7 => "7", 8 => "8", 
    9 => "9", 10 => "a", 11 => "b", 12 => "c", 13 => "d", 14 => "e", 15 => "f"
)
global distr = []
for i = 1:256
    push!(distr,0)
end

global tbl = Dict()
global maxLen = -1
global ct = 0
global rejects = []
global dshit = []
global FirstImage = true
global REPO = length(ARGS) > 0 && lowercase(ARGS[1]) == "repo"

for (root, dirs, files) in walkdir(".")
    #println("Directories in $root")
    #for dir in dirs
    #    println(joinpath(root, dir)) # path to directories
    #end
    #println("Files in $root")
    for file in files
        x = joinpath(root, file) # path to files
        #if !contains(x, "images")
        if findfirst(r"^\.\\images\\([0-9a-f])\\\1[0-9a-f][\\]", x) == nothing
            push!(rejects, x)
            continue
        end
        # Create a directory with copies of all the image files
        if REPO
            tgt = "\\Robbie\\REPO\\" * x[15 : length(x)]
            try                
                r = open(x,"r")
                rs = open(tgt, "w")
                write(rs, read(r))
                close(r)
                close(rs)
            catch ex
                s = string(ex)  
                if length(s) > 200
                    s = s[1:200] * "..."
                end
                println("\n      REPO: ", tgt , ": ", typeof(ex), ".\n", s);
            end
        end
        y = length(x)
        z = x[15:y]
        zLen = length(z)
        if zLen > maxLen
            global maxLen = zLen
        end
        global tbl[z] = replace(x[1:14], r"[\\]" => "/")
        global ct += 1
        if !(tbl[z] in dshit)
            push!(dshit, tbl[z])
        end
    end
end
dt = string(Dates.now())
dtx = findfirst('T', dt)
dtx = replace(dt[1: dtx - 1] * " " * dt[dtx + 1: length(dt)], r"\.[0-9]+" => "", count=1)
global stuff = "[v" * version * "] " * pwd() * "   (--IMAGES--)<br>maxLen: " * string(maxLen) * ",  count: " *
           string(ct) * ",  dirs: " * string(length(dshit)) * 
           ".  ([[{{BRM|Images}}|Images]]/[[Template:BRM_Images|T]])"
println(stuff) 
global stuff *= "  [<span style=\"color:blue;\">" * dtx * "</span>]<br>\n"

kk = keys(tbl)
fuck = []

for k in kk # keys(tbl)
    push!(fuck, k)
end
fuck = sort(fuck, by=lowercase)
global stuff *= "<div style=\"height:560px;width:544px; overflow:auto; border: 1px solid black;border-radius:6px;margin:16px -56px 14px 0px;padding:0px 0px 2px 48px;background-color:lightyellow;\"><table style=\"font-family:sans-serif;border-collapse:separate;margin:8px 0px 4px 12px;\">" *
            "<tr><td colspan=3 style=\"text-align:right;\">" *
        "<span style=\"border:1px solid black;padding:1px 6px 1px 4px;background-color:white;\">" * 
        "QQsbsQQ" * "</span></td></tr>"
for ks in fuck

    ww = tbl[ks]
    w = unhex[ww[12:12]] * 16 + unhex[ww[13:13]] + 1
    distr[w] += 1

    # <!-- td><span style=\"padding-left:16px;\">[[File:Next2a.gif|link=Media:" * ks * "|Go to Wiki record for image!]]</span></td -->

    global stuff *= "<tr><td" * (FirstImage ? " style=\"padding-right:38px;\"" : "") * ">[[Media:" * ks * "|" * tbl[ks][10:13] * "]]</td><td><span class=\"brmib\">" * ks * 
            "</span></td><td style=\"text-align:right;\">--" * ks * "--</td></tr>\n"
    global FirstImage = false
end

for r in rejects
    println(r)
end

println("\n-------")

global ImageCache = Dict{String, Int32}()
global IMAGES = 0
global ict = 0
global failures = []
cd("../")                # This shit makes no sense to me, so I cheated. GODDAMNED RIGHT!

try
    for (root, dirs, files) in walkdir("./w/")
        for file in files
            x = joinpath(root, file) # path to files
            if !contains(x, "images")
                continue
            end
            z = replace(x, "\\" => "/")
            global ImageCache[z[3 : length(z)]] = 0 
            global ict += 1
        end
    end
    global errId = 1
    a = readdir()
    global errId = 2
    for itm in a
        if findfirst(".html", itm) == nothing
            continue
        end
        global item = itm
        f = open(item)
        global errId = 4
        src = read(f)
        global errId = 5
        close(f)
        txt = String(src)

        images = findall(r" (src|href)=\"[^\"]+", txt)
        for i = 1 : length(images)
            str0 = txt[images[i]]
            if !contains(str0, "./w/images/")
                if length(str0) >= 10 && str0[1:10] == " href=\"w/i"
                    str0 = replace(str0, " href=\"" => " href=\"./", count = 1)
                elseif length(str0) >= 9 && str0[1:9] == " src=\"w/i"
                    str0 = replace(str0, " src=\"" => " src=\"./", count = 1)
                else
                    continue
                end                
            end
            str1 = replace(str0, "%27" => "'")
            off = findfirst("\"", str0)
            str = str1[(off[1] + 3):length(str1)]

            if haskey(ImageCache, str)
                if item != "Images.html"
                    global ImageCache[str] += 1
                else
                    global IMAGES += 1 
                end
            elseif !isfile(str)
                strd = "./" * str[1:13]
                if !isdir(strd)
                    mkdir(strd)
                    println("  ", strd)
                end
                println("?MISSING: ", str)
            else
                println("?GODKNOWSWHAT: ", str)               
            end
        end
    end
    
catch ex
    s = string(ex)  
    if length(s) > 200
        s = s[1:200] * "..."
    end
    println("\n      Failure: ", typeof(ex), ".\n", s);
    #exit(16)
    push!(failures, item)
    return 0
end

global unused = ""
global unusedPfx = ""
global Uct = 0
ks = keys(ImageCache)
global ReverseImages = Dict{Int32, Array{String}}()
global bigsum = 0
global ones = 0
for k in ks
    if ImageCache[k] == 0
        global unused *= unusedPfx * "\"" * k * "\""
        global unusedPfx = ", "
        global Uct += 1
    else
        kn = ImageCache[k]
        kkX = k[15:length(k)]
        global stuff = replace(stuff, "--" * kkX * "--" => string(kn), count=1)
        global bigsum += kn
        if kn == 1
            global ones += 1
        end
        if !(kkX in ["Prev2a.gif", "Next2a.gif", "Spacer.gif", "HTML5V.png", 
                    "GarbageCan.gif", "K2.gif", "Buttocks.jpg", "United_states.gif"]) 
            if haskey(ReverseImages, kn)
                push!(ReverseImages[kn], kkX)  #    ReverseImages[kn] *= ", " * "\"" * kkX * "\""
            else
                global ReverseImages[kn] = [kkX]    #   "\"" * kkX * "\""
            end
        end
    end
end

print("Going to save ./WBKountOut : (" * pwd() * ") ")
q = open("w/WBKountOut", "w")
sbs = string(bigsum)
sbsLen = length(sbs)
if sbsLen > 3
    sbs = sbs[1: sbsLen - 3] * "," * sbs[sbsLen - 2: sbsLen]
end
stuff = replace(stuff, "--IMAGES--" => string(IMAGES) * "; " * string(ones), count=1)
stuff = replace(stuff, r"<td style=\"text-align:right;\">--[^>]+</td>" => "<td style=\"text-align:right;\"><span style=\"font-weight:bold;color:crimson;font-size:x-large;font-family:sans-serif;\">**</span></td>")
qt = stuff * "<tr><td colspan=3 style=\"text-align:right;\">" *
        "<span style=\"border:1px solid black;padding:1px 6px 1px 4px;background-color:white;\">" * string(length(ImageCache)) * "  <span style=\"font-weight:bold;\">Σ</span> " * 
        sbs * "</span></td></tr></table></div>"
fuckedup = replace(qt, "QQsbsQQ" => string(length(ImageCache)) * "  <span style=\"font-weight:bold;\">Σ</span> " * sbs, count = 1)
fuckedupComment = "class=\"brmib\">TrafficJam.gif<small><ref name=\"PieceOfShit\"><span style=\"font-size:14px;\">This picture has an obvious flaw: the 'v' polluting its center. I tried to fix the misspelling of 'Sevareid' and MS Paint is so goddamned shitty that it is not worth trying to fix this. I am enrageed and I should not be enraged because my tools should be better and I should not need to spend more money to get it. It is disgusting. Computers should behave. Blah, blah, blah, etcetera and so forth.</span></ref></small>"
write(q, replace(fuckedup, "class=\"brmib\">TrafficJam.gif" => fuckedupComment, count=1))

global shit = []
for x in keys(ReverseImages)
    push!(shit, x)
end
shitx = sort(shit, rev=true)
global nuthin = "[nuthin]"
println(" ")
for i = 1 : length(shitx)
    sq = shitx[i]
    if sq < 8
        continue
    end
    z = ""
    zzz = sort(ReverseImages[sq])
    for zz in zzz    #   ReverseImages[sq]
        if length(z) > 0
            z *= ", "
        end
        z *= "\"" * zz * "\""      
    end

    s = string(sq)
    u = "(" * string(length(ReverseImages[sq])) * ")      "    
    println(" " ^ (6 - length(s)) * s, " ", u[1:6], z)
    global nuthin = ""
end

if length(unused) > 0
    print("\n    Unused: " * unused * "  (" * string(Uct) * ")\n")
    write(q, "<p style=\"margin-top:24px;\">" * replace(replace(unused, "w/images/" => ""), " " => "  ") * "</p>")
end

close(q)
println("./WBKountOut saved.")

if nuthin != ""
    println("    " * nuthin)
end

global shi = []
for s = 1:20
    append!(shi,0)
end

global crap = ""
for i = 1 : length(distr)
    if i % 64 == 1
        global crap *= "\n    "
    end
    global shi[distr[i] + 1] += 1 
    global crap *= tohex[distr[i]]
end

global mulch = 0
for i = 1: length(shi)
    global mulch += (i - 1) * shi[i]
    if shi[i] != 0
        global shi[i] = [i - 1, shi[i], mulch]
    end
end
for i = 1 : length(shi)
    if shi[length(shi)] != 0
        break
    end
    global shi = copy(shi)[1:length(shi) - 1]
end 

global shidt = 0
global shid = []

for i = 2 : length(shi)
    if shi[i] == 0
        append!(shid, 0)
        continue
    end
    sh = shi[i][2]    #  * (i - 1)
    append!(shid, sh) #  - shi[i - 1][3])
    global shidt += sh
end 

println(crap, "\n\n", shi, " ", shidt, "\n\n", shid)

Return to TOC!Return to TOC

Julia script to list versions of script files (WBversions)

using HTTP
using Dates

APFS = "021" # WBversions:APFS
version = APFS
global errId
global ng = []
global ngd = []
global ngq = []
global itm
global TLC = 0
global maxlen = 16
global JSource = "?" 
global digits = ["0","1","2","3","4","5","6","7","8","9"] 
println(" ")

function processADirectory(adir, sd)
    try
        global errId = 1
        for itmm in adir
            global itm = itmm
            if findfirst(".html", itm) != nothing    
                continue
            end 
            if findfirst(".", itm) != nothing || itm in ["c9", "w", "css", "pdfs", "images", "txts"]
                push!(ngq, itm)
                continue
            end
            if itm[length(itm) : length(itm)] in digits
                push!(ngd, itm)
                continue;
            end
            global errId = 2
            f = open(sd * itm)
            global errId = 3
            res = read(f)
            global errId = 4
            str = String(res) 
            global errId = 5
            JALL = itm == "TzMulti" ? TSUHD : JSource
            ne = false

            magic = Regex("APFSI? = \"([^\"]+)\" # " * itm * ":APFS")       
            f = findfirst(magic, str)
            if f != nothing
                ff = str[f]
                f = replace(ff, magic => s"\1", count = 1)
                sditm = sd * itm
                g = findfirst(magic, JALL)
                if g == nothing
                    println(sd * itm, " " ^ (maxlen - length(sditm)), "Not found: \"", ff, "\"")
                else
                    gg = JALL[g]
                    g = replace(gg, magic => s"\1", count = 1)
                    part1 = sd * itm * (" " ^ (maxlen - length(sditm))) * " \"" * f * "\""
                    part1 = part1 * (" " ^ (24 - length(part1)))
                    lns = length(findall("\n", str))
                    if itm == "WB"
                        global WBlen = lns
                    end
                    global TLC += lns
                    x =  string(length(str))
                    x = (" " ^ (8 - length(x))) * x * "   " 
                    if f == g 
                        x *= part1 * "  "
                    else
                        x *= part1 * "!= \"" * g * "\""
                        ne = true
                    end

                    wbi = ""
                    if itm == "WB_Include"
                        wbi = " + " * string(WBlen) * " = " * string(lns + WBlen)
                    end
                    lns = string(lns)
                    x *= "   " * replace(string(Dates.unix2datetime(stat(replace(sditm, "\\" => "/")).mtime))[1:19], 
                                            "T" => " ", count = 1)     
                    x = x * (" " ^ (65 + (ne ? 4 : 0) - length(x) - length(lns))) * "  " * lns * wbi 
                    println((itm == "WB" ? "\n" : "") * x)
                end
            else
                push!(ng, sd * itm)
            end
        end 
    catch ex
        s = string(ex)  
        if length(s) > 200
            s = s[1:200] * "..."
        end
        println("\n      Failure processADirectory[" * itm * " " * 
                string(errId) * "]: ", typeof(ex), ".\n", s);
        exit(16)
    end
end

try
    errId = 8
    res = HTTP.get("https://www.aplacetostudy.com/wiki/User:Bradford_Robert_McCormick/JSource");
    errId = 9
    global JSource = String(copy(res.body))
    res = HTTP.get("https://www.aplacetostudy.com/wiki/User:Bradford_Robert_McCormick/TheSocietyOfTheUnheard");
    errId = 9
    global TSUHD = String(copy(res.body))

    sd = ""
    global errId = 10
    a = readdir(pwd() * sd)
    processADirectory(a, sd)
    global errId = 11
    sd = ".\\w\\"
    a = readdir(pwd() * sd)
    global errId = 12
    processADirectory(a, sd)
    global errId = 11
catch ex
    s = string(ex)  
    if length(s) > 200
        s = s[1:200] * "..."
    end
    println("\n      Failure mainline[" * string(errId) * "]: ", typeof(ex), ".\n", s);
    exit(16)
end
println("\nTime zone GMT.  Tot lines: ", TLC)
println("\n", sort(ngq))
println("\n", sort(ngd))
println("\n", sort(ng))

Return to TOC!Return to TOC

Julia script to compare local and remote images (WBcompare)

using HTTP

APFS = "009" # WBcompare:APFS
version = APFS

global big = 180000
global BIGS = []
global t = time();

if length(ARGS) < 1
    println("Argument must be \"BmccEdd\" or \"APtS\"")
    exit(16)
end
if uppercase(ARGS[1]) == "BMCCEDD" 
    global URLroot = "https://www.bmccedd.org/w/images/"
elseif uppercase(ARGS[1]) == "APTS"
    global URLroot = "https://www.aplacetostudy.com/w/images/"
else
    println("ARGS[1] unrecognized value: \"" * ARGS[1] * "\"")
    exit(16)
end
println("Remote: " * URLroot * "\n      (Bad: remote -> local len)")

global tbl = Array{String}(undef, 1000)
global sz = 0
global totlen = 0

function getImage(img)
    global errId = 0
    try
        global errId = 1
        a = HTTP.get(URLroot * img)
        global errId = 2
        ab = a.body
        global errId = 3
        f = open("./images/" * img)
        global errId = 4
        fb = read(f)
        global errId = 5
        close(f)
        global errId = 6
        return([ab, fb])
    catch ex
        s = string(ex)  
        if length(s) > 200
            s = s[1:200] * "..."
        end
        println("\n      Failure[" * string(errId) * "]: ", typeof(ex), ".\n", s);
        #exit(16)
        return nothing
    end
end

global others = []

for (root, dirs, files) in walkdir(".")
    for file in files
        x = joinpath(root, file) # path to files
        if !contains(x, "images")
            push!(others,x)
            continue
        end
        global sz += 1
        tbl[sz] = replace(x[10:length(x)], "\\" => "/")

    end
end
println(" ")
for i = 1 : sz
    tbli = tbl[i]
    sleep(1)
    if i % 50 == 0
        ii = "  " * string(i)
        lenii = length(ii)
        ii = ii[lenii - 3 : lenii]
        println("---- Processed " * ii * " files ---- ",
                        round(time() - t, digits=4))
    end
    x = getImage(tbli)
    if x == nothing
        continue
    end
    lenx1 = length(x[1])
    lenx2 = length(x[2])
    global totlen += lenx1
    if lenx1 != lenx2 || x[1] != x[2]
        println("    Bad: " * 
            string(i) * ". " * tbli[1:5] * " " * 
            tbli[6:length(tbli)] * " " * string(lenx1) * 
            " " * string(lenx2) )
    end
    bigger = max(lenx1, lenx2)
    if bigger >= big
        push!(BIGS, string(bigger) * ":" * tbli)
    end
end

stotlen = string(totlen)
if totlen > 999
    stotlen = stotlen[1:length(stotlen) - 3] * "," *
            stotlen[length(stotlen) - 2 : length(stotlen)]
end
if totlen > 999999
    stotlen = stotlen[1:length(stotlen) - 7] * "," * 
            stotlen[length(stotlen) - 6 : length(stotlen)]
end 

println("\n" * string(sz) * " files in directories. " * 
            stotlen * " total length. v" * version * "  ",
            round(time() - t, digits=4))

println("--------\n", sort(BIGS, rev=true), "\n--------\n", others)

Return to TOC!Return to TOC

Julia script to print a file's contents in hexadecimal

APFS = "006" # Hexprint:APFS
version = "v" * APFS * " +2022.05.09"
# Adding the kludge speeded up a search of 600K file from 175 sec to > 1 sec

using Dates
t = time() 

function myPrint(fn, offshit::Int64=0, maxShit::Int64=9999999)  
    offset = Int(floor(offshit / 16)) * 16
    maxLen = Int(floor((maxShit + 15) / 16)) * 16
    if (length(fn)) < 1
        return("\n         NO ARGUMENT\n\n")
    end
    notGood = false
    hexChars = "0123456789ABCDEF"
    everything = ""
    everyin = ""
    p4 = 0
    
    try
        global s = open(fn)
        t = read(s)
        if length(ARGS) > 3
            p4 = tryparse(Int64, ARGS[4])   
            p4 = Int(floor(p4 / 16)) * 16 + 1
            t = t[p4:length(t)]
            p4 -= 1
        end 
        rlim = lent = length(t)
        if offset < 0
            offset = Int(floor((rlim + offset) / 16)) * 16
        end
        taboo = offset + maxLen
        if rlim > taboo
            rlim = taboo
        end
        for i = 1:rlim                                     # length(t)
            r = hexChars[1 + (Int(floor(t[i] % 16)))]    
            q = hexChars[1 + (Int(floor(t[i] / 16)))]    
            everything *= string(q,r, " ")
            if t[i] < 32 || t[i] > 127 
                everyin *= "." 
            else
                everyin *= string(Char(t[i])) 
            end
        end
        hx = string(offset, base = 16)
        println("\n         HexPrint " * version * "\n         " * fn *
                " (" * string(lent) * ": " * string(offset) * " ~ " * string(rlim) * ", 0x" * hx * 
                (p4 == 0 ? "" : "  \033[31;1mKLUDGE!\033[0m") * ")\n")
        rl = 0
        shit = Int(floor(length(everyin) % 16))
        if shit > 0
            shit = 16 - shit 
            everyin *= "                                               "[1:shit]
            everything *= "                                               "[1:( 3 * shit)]
        end
        rl = offset    #    tryparse(Int64,offset) 
        while rl < rlim 
            stain = "        " * string(string(rl + p4, base = 16))
            #staiX = "        " * string(rl)
            stain = stain[(length(stain) - 5):length(stain)]
            #staiX = staiX[(length(staiX) - 5):length(staiX)]
            println(stain * "   " * everything[(3 * rl + 1):(3 * rl + 23)] *
                     " " * everything[(3 * rl + 24):(3 * rl + 48)] *
                     "    " * everyin[(rl + 1):(rl + 16)]  * "   " * string(rl + p4))
            rl += 16
        end
    catch ex
        println("Exception: ", ex)
        notGood = true
    finally
        if notGood == false
            close(s)
            print("\n         CLOSED: ")
        else
            print("\n         NOTGOOD: ")
        end
        println(fn) #  * "\n")
    end
end

p1 = ""
p2 = 0
p3 = 99999999
if length(ARGS) > 2  #  3
    p1 = ARGS[1]                    # filename
    p2 = length(ARGS) > 3 ? 0 : tryparse(Int64, ARGS[2])   # offset
    p3 = tryparse(Int64, ARGS[3])   # length
elseif length(ARGS) == 2
    p1 = ARGS[1]
    p2 = tryparse(Int64, ARGS[2])
elseif length(ARGS) == 1
    p1 = ARGS[1]
else
    println("\n    Hexprint  Filename  [start  [ length  [ kludge ] ] ]")
    exit(16)
end
myPrint(p1,p2,p3)
println("         E/t: " , round(time() - t, digits=4))

Return to TOC!Return to TOC

Julia script to print Ascii character set (Ascii)

APFS = "010" # Ascii:APFS
global versionNr = APFS[2:3]

# I (BMcC) was thoroughly enraged in trying to fix up this script.

global nr = 1
global clr = 30
global defaultClr = Sys.iswindows() ? "33" : "31"
if length(ARGS) == 2
    colr = tryparse(Int64, ARGS[2])
    if colr == nothing
        println("\n   Color not numeric: ", ARGS)
        exit(16)   
    end
    defaultClr = string(colr)
end
global lenArgs = length(ARGS)
global FUCKEDUP = lenArgs > 0 ? lowercase(ARGS[1]) : ""
if FUCKEDUP == "ext"
    global FUCKEDUP = "extended"
end

if !(lenArgs == 0 || FUCKEDUP in ["extended", "plain"])
    println("\n   Parameters fucked up: ", ARGS)
    exit(16)
end
rng = FUCKEDUP == "extended" ? [160 : 175] : [32 : 47]
println(lenArgs > 1 ? "\n     \033[28;1m28 \033[29;1m29 \033[30;1m30 \033[31;1m31 \033[32;1m32 \033[32;1m32 " *
            "\033[33;1m33 \033[34;1m34 \033[35;1m35 \033[36;1m36 \033[37;1m37 \033[38;1m38\033[0m\n" : "\n") 

for i =  rng[1] 
    for j = 0 : 5
        k = i + j * 16
        print("     ", 
                k == 127 ? "[" : "\033[" * defaultClr * ";1m" * Char(k) * "\033[0m", 
                k < 100 ? "  " : k == 127 ? "v" : " " , 
                k == 127 ? versionNr * "]" : string(k))                 # for 127 show version number!
    end

    print("\n")
    if clr == 37
         global clr = 90
    else
         global clr += 1
    end
    global nr += 1
end

Return to TOC!Return to TOC

Julia programming language String builtin function problem

I do not understand why the String function modifies: no, even worse: destroys, its input parameter.



Another julia problem?

julia> a
"ssssst\\ddd"

julia> findfirst(r"[t]\\d",a)
6:8

julia> findfirst(r"[t][\\]",a)
6:7

julia> findfirst(r"[t]\\",a)
ERROR: LoadError: PCRE compilation error: \ at end of pattern at offset 4
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:33
 [2] compile(pattern::String, options::UInt32)
   @ Base.PCRE .\pcre.jl:128
 [3] compile(regex::Regex)
   @ Base .\regex.jl:79
 [4] Regex(pattern::String, compile_options::UInt32, match_options::UInt32)
   @ Base .\regex.jl:44
 [5] Regex(pattern::String)
   @ Base .\regex.jl:67
 [6] var"@r_str"(__source__::LineNumberNode, __module__::Module, pattern::Any, flags::Vararg{Any, N} where N)
   @ Base .\regex.jl:116
in expression starting at REPL[18]:1

julia>





+2022.05.06 v042
Prev2a.gifReturn to Table of contents


 

Footnotes

  1. Curse words due to the PTSD rage trying to do just about anything with a computer causes me (BMcC[18-11-46-503]). After my last years of computer programming work, I just want demand computers to obey me and not give me any problems, but that's not the way computer stuff generally works. Wiki is obtuse.


BMcC signature seal stamp. Modelled on 18th century messenger's letter box in collection of Suntory Museum, Tokyo. Japanese write poems and prayers on slips of paper which they tie into knots like this shape although with longer legs. Prayers are often tied to branches of trees which can look like they are covered with snow. "Symbol of a symbol, image of an image, emerging from the destiny that is sinking into darkness...." (H. Broch, "The Sleepwalkers", p.648) Always remember. Add value. (This image created not later than 21 May 2003)Invenit et fecit


This page has been validated as HTML 5. It is valid when removed from the Wiki environment and massaged to stand alone.

2022-07-02 18:11:43