• BASH reference for those who are "learning by doing"?

    From Richard Owlett@21:1/5 to All on Sat Sep 7 18:00:01 2024
    This started with be exploring "regular expressions".
    I discovered some tutorials that were using Bash in their samples.
    One {lost the reference at the moment} was almost a match for a real
    world problem I have.

    But I've not used Bash in eons and have forgotten how to read a file
    into a single variable or a array variable.

    I've downloaded "Bash Reference Manual"
    [https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
    for when I need fine grained details.
    I've bookmarked the various links on
    [https://mywiki.wooledge.org/BashFAQ]
    for quick reference.

    I find neither to be search friendly.

    Suggestions?

    TIA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Christensen@21:1/5 to Richard Owlett on Sat Sep 7 20:00:01 2024
    On 9/7/24 08:50, Richard Owlett wrote:
    This started with be exploring "regular expressions".
    I discovered some tutorials that were using Bash in their samples.
    One {lost the reference at the moment} was almost a match for a real
    world problem I have.

    But I've not used Bash in eons and have forgotten how to read a file
    into a single variable or a array variable.

    I've downloaded "Bash Reference Manual"
      [https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
    for when I need fine grained details.
    I've bookmarked the various links on
      [https://mywiki.wooledge.org/BashFAQ]
    for quick reference.

    I find neither to be search friendly.

    Suggestions?

    TIA


    I suggest "Mastering Regular Expressions" by Friedl:

    https://www.amazon.com/dp/0596528124


    David

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From debian-user@howorth.org.uk@21:1/5 to Richard Owlett on Sat Sep 7 21:20:02 2024
    Richard Owlett <rowlett@access.net> wrote:
    This started with be exploring "regular expressions".
    I discovered some tutorials that were using Bash in their samples.
    One {lost the reference at the moment} was almost a match for a real
    world problem I have.

    But I've not used Bash in eons and have forgotten how to read a file
    into a single variable or a array variable.

    I've downloaded "Bash Reference Manual"
    [https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
    for when I need fine grained details.
    I've bookmarked the various links on
    [https://mywiki.wooledge.org/BashFAQ]
    for quick reference.

    I find neither to be search friendly.

    Suggestions?

    Typing "regular expression tutorial" or "regular expression bash" into
    a search engine produces lots of potentially useful links.

    Maybe https://en.wikibooks.org/wiki/Regular_Expressions

    TIA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Quaeryth@21:1/5 to Richard Owlett on Sat Sep 7 22:50:02 2024
    On 2024-09-07 11:50, Richard Owlett wrote:
    This started with be exploring "regular expressions".
    I discovered some tutorials that were using Bash in their samples.
    One {lost the reference at the moment} was almost a match for a real
    world problem I have.

    But I've not used Bash in eons and have forgotten how to read a file
    into a single variable or a array variable.

    I've downloaded "Bash Reference Manual"
    [https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
    for when I need fine grained details.
    I've bookmarked the various links on
    [https://mywiki.wooledge.org/BashFAQ]
    for quick reference.

    I find neither to be search friendly.

    Suggestions?

    TIA

    When I've been in the same position, I don't know that I have a single
    go-to resource. Instead I tend to search for what I'm wanting to do at
    the moment and then check out results that seem relevant from https://stackoverflow.com/. I usually have pretty good luck there. https://devhints.io/bash may be helpful, and a couple of the other pages linked at the top looked pretty good, too (e.g. the wiki you referenced).

    Unsolicited thoughts: When it comes to regexes (regular expressions),
    the syntax can depend on where/in what (programming) language or
    application you're using it. When I was trying to sort it all out I
    stumbled upon https://www.regular-expressions.info/, which was a big
    help to me. If you click on "Tools & Languages" at the top of the page,
    you can also get explanations for how regexes are implemented in your particular context. I used this site as a reference while trying to pull
    data out of log files at work in a text editor (Sublime Text, which I
    highly recommend for immediate feedback on your regex attempts). If you
    don't have a big file to practice with, try saving one of the links on https://openbible.com/texts.htm for a copy of the Christian Bible in a
    single text file. I'm sure there's other text files like that out there
    if that's not your cup of tea. Good luck with regex; each time I need it
    is a fun and useful puzzle to solve.

    Quaeryth

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Owlett@21:1/5 to Quaeryth on Sat Sep 7 23:30:01 2024
    On 09/07/2024 03:46 PM, Quaeryth wrote:
    On 2024-09-07 11:50, Richard Owlett wrote:
    This started with be exploring "regular expressions".
    I discovered some tutorials that were using Bash in their samples.
    One {lost the reference at the moment} was almost a match for a real
    world problem I have.

    But I've not used Bash in eons and have forgotten how to read a file
    into a single variable or a array variable.

    I've downloaded "Bash Reference Manual"
    [https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html]
    for when I need fine grained details.
    I've bookmarked the various links on
    [https://mywiki.wooledge.org/BashFAQ]
    for quick reference.

    I find neither to be search friendly.

    Suggestions?

    TIA

    When I've been in the same position, I don't know that I have a single
    go-to resource. Instead I tend to search for what I'm wanting to do at
    the moment and then check out results that seem relevant from https://stackoverflow.com/. I usually have pretty good luck there. https://devhints.io/bash may be helpful, and a couple of the other pages linked at the top looked pretty good, too (e.g. the wiki you referenced).

    Problem is they are pedagogy oriented so to speak. I'm looking for
    easier searchability (real word? ;).


    Unsolicited thoughts: When it comes to regexes (regular expressions),
    the syntax can depend on where/in what (programming) language or
    application you're using it. When I was trying to sort it all out I
    stumbled upon https://www.regular-expressions.info/, which was a big
    help to me. If you click on "Tools & Languages" at the top of the page,
    you can also get explanations for how regexes are implemented in your particular context. I used this site as a reference while trying to pull
    data out of log files at work in a text editor (Sublime Text, which I
    highly recommend for immediate feedback on your regex attempts). If you
    don't have a big file to practice with, try saving one of the links on https://openbible.com/texts.htm for a copy of the Christian Bible in a
    single text file. I'm sure there's other text files like that out there
    if that's not your cup of tea. Good luck with regex; each time I need it
    is a fun and useful puzzle to solve.

    I've got helpful references for regular expressions. Their examples use
    Bash as the vehicle. I want to get my real world examples into Bash so I
    can follow the example techniques given.

    [My examples are from my experiments with re-formatting
    text at https://ebible.org/engkjvcpb/ for comfortable reading by fellow tri-focal wearing senior citizens - that I want to minimize the number
    of HTML tags & eliminating all CSS usage annoys some HTML5 purists ;]


    Quaeryth



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Quaery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BkaXJlY3Rpb24uIEdvb2QgbHVjayB3aXRoDQog ICAgICB5b3VyIGV4cGVyaW1lbnRzITxicj4NCiAgICAgIDxicj4NCiAgICAgIFE8YnI+DQogICAg PC9mb250Pg0KICA8L2JvZHk+DQo8L2h0bWw+DQo=

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Quaeryth on Sun Sep 8 02:00:03 2024
    On Sat, Sep 07, 2024 at 22:00:27 +0000, Quaeryth wrote:
    A query like "site:stackoverflow.com bash how to read file into variable" via Google or DuckDuckGo (and maybe other search engines) usually points me in the right direction. Good luck with your experiments!

    What kind of file?
    What kind of variable?
    What are you planning to do with the variable after you've stored data
    in it?

    The fundamental problem with this question is that bash variables *can't*
    store all kinds of data. Specifically, they are unable to store the NUL
    byte (ASCII 0x00), so storing any kind of binary file is off the table.

    So, that leaves text files. You can, in theory, store a text file in
    a bash variable -- but why? What's the point? Are you going to copy
    that data out to another file? If so, you'd be better off just copying
    the original text file with the cp command, instead of reading the data
    into a shell string variable and then writing it back out. Bash is
    abysmally *slow* at such things. Running cp would most likely be faster,
    for non-tiny files, even if you have to run it several times.

    But maybe this is an X-Y problem, and the real question is something
    like "I want to iterate over the lines of a file. For each line, I
    want to do ____."

    In that case, reading the entire file into a string variable is a poor
    first step. Now, you *might* read the entire file into an *array*
    variable (one line per array element), and then iterate over the array.
    That's not the worst thing you could do.

    But even that may not be necessary. If you don't need to pre-read the
    entire contents, then don't. Just read one line at a time, and process
    each line as you read it.

    That's Bash FAQ #1. <https://mywiki.wooledge.org/BashFAQ/001>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sirius@21:1/5 to Richard Owlett on Sun Sep 8 07:40:01 2024
    On lör, 2024/09/07 at 10:50:36 -0500, Richard Owlett wrote:
    This started with be exploring "regular expressions".
    I discovered some tutorials that were using Bash in their samples.
    One {lost the reference at the moment} was almost a match for a real
    world problem I have.

    Bash has some nifty uses when it comes to variables.

    If you just want to store a file in a variable,
    VAR="$(</path/to/file)
    will do it. If you want to do an array instead, use the 'while read line;
    do' construct. As others have pointed out, this is not an optimal usecase
    for bash.

    Perl on the other hand is well suited for manipulating text (it was the
    main reason for its creation) and has a good regexp engine built in. AWK
    is also a useful tool for manipulating text, a bit depending on the
    structure of it.

    But I've not used Bash in eons and have forgotten how to read a file
    into a single variable or a array variable.

    See above.

    However, you may be picking the wrong hammer for cracking this particular
    nut. As other pointed out, both Python and Perl have modules specifically targeted at handling SGML/XML/HTML which was something you wanted to
    process. Do not re-invent the wheel.

    You can still code the harness in Bash if you want, but use a better tool
    for processing the input files. No need to go to C/C++ or something like
    Go for that. Perl or Python will do just fine.

    I've downloaded "Bash Reference Manual"
    [https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html] for
    when I need fine grained details.
    I've bookmarked the various links on
    [https://mywiki.wooledge.org/BashFAQ]
    for quick reference.

    I find neither to be search friendly.

    The Bash Manual page is actually quite encompassing and very useful. While
    it might not have a lot of examples as such, it does showcase what is
    available within Bash itself. Besides that, the O'Reilly book on Bash has served me well. I have quite a few O'Reilly books and they are all full of examples and detailed explanations. Even the small quick reference books
    they do for things are worthwhile picking up. If you do pick up the Bash
    book, might I suggest you add the Sed & Awk book at the same time.

    It is very common to code something in bash and either call out to sed or
    awk for processing something, depending on the structure of what is
    processed. Those three tools often go hand in hand and if you plan on
    writing larger projects in Bash, you will want to cover Sed and Awk as
    well.

    Suggestions?

    TIA




    --
    Kind regards,

    /S

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Owlett@21:1/5 to Greg Wooledge on Sun Sep 8 13:50:01 2024
    On 09/07/2024 06:51 PM, Greg Wooledge wrote:
    On Sat, Sep 07, 2024 at 22:00:27 +0000, Quaeryth wrote:
    A query like "site:stackoverflow.com bash how to read file into variable" via
    Google or DuckDuckGo (and maybe other search engines) usually points me in >> the right direction. Good luck with your experiments!

    What kind of file?
    What kind of variable?
    What are you planning to do with the variable after you've stored data
    in it?

    [snip]

    I'll quote myself:

    This started with exploring "regular expressions".
    I discovered some tutorials that were using Bash in their samples.
    One {lost the reference at the moment} was almost a match for a real
    world problem I have. >
    But I've not used Bash in eons and have forgotten how to read a file
    into a single variable or a array variable.

    I have 2 relevant test cases:
    1. a file of a single line approximately 200 characters.
    [teststring1.txt]
    2. a file with ~20 lines whose size is 4.5k.
    [teststring1.txt]

    How?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Owlett@21:1/5 to Max Nikulin on Sun Sep 8 13:50:01 2024
    On 09/07/2024 10:36 PM, Max Nikulin wrote:
    On 08/09/2024 04:22, Richard Owlett wrote:

    [My examples are from my experiments with re-formatting
    text at https://ebible.org/engkjvcpb/ for comfortable reading by
    fellow tri-focal wearing senior citizens - that I want to minimize the
    number of HTML tags & eliminating all CSS usage annoys some HTML5
    purists ;]

    Instead of BASH and regular expression use some programming language
    where a reliable HTML parser is available. E.g. in python you may use lxml.html.html5parser, lxml.etree.HTMLParser, BeautifulSoup.

    Calibre aggressively strips CSS and some markup during conversion of
    HTML pages to various ebook formats.



    Quoting myself:
    This started with exploring "regular expressions".
    I discovered some tutorials that were using Bash in their samples.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Sirius on Sun Sep 8 16:00:01 2024
    On Sun, Sep 08, 2024 at 06:48:30 +0200, Sirius wrote:
    Bash has some nifty uses when it comes to variables.

    If you just want to store a file in a variable,
    VAR="$(</path/to/file)
    will do it. If you want to do an array instead, use the 'while read line;
    do' construct. As others have pointed out, this is not an optimal usecase
    for bash.

    Unless you're targeting very old versions of bash, you can read the lines
    of a file/stream into an array with the "readarray" (or "mapfile") command.
    You can specify a single character to act as the line terminator, or
    let the default newline character $'\n' be used. In sufficiently new
    versions of bash, you can specify '' to use NUL as the line terminator.

    For example, in bash 4.4 or higher:

    readarray -t -d '' myfiles < <(
    find . -type f -print0
    )

    You almost always want the -t option, to strip the delimiter from the
    array elements. In the case of NUL, it makes no difference, but it's
    a good habit to have if you ever use this technique on text files.

    Just to reiterate what others have said: do *not* use bash's text
    processing tools or regular-expression-based techniques to parse HTML.
    See <https://stackoverflow.com/q/1732348>.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From debian-user@howorth.org.uk@21:1/5 to Richard Owlett on Sun Sep 8 17:30:01 2024
    Richard Owlett <rowlett@access.net> wrote:
    [My examples are from my experiments with re-formatting
    text at https://ebible.org/engkjvcpb/ for comfortable reading by
    fellow tri-focal wearing senior citizens

    As a mere bifocal (well vari-focal) wearer can I suggest a different
    approach. Stop wearing tri-focals or any other variable focus specs for
    reading a computer screen. Tell them to get a [very cheap] pair of
    single focus reading glasses made to suit the distance their screen is
    away.

    I did this years ago and wouldn't try to do it any other way now. The
    bliss of being able to read the whole screen comfortably without moving
    if I want to.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ael@21:1/5 to Brad Rogers on Sun Sep 8 18:40:01 2024
    On Sun, Sep 08, 2024 at 04:43:20PM +0100, Brad Rogers wrote:
    On Sun, 8 Sep 2024 16:25:04 +0100
    debian-user@howorth.org.uk wrote:

    Hello debian-user@howorth.org.uk,

    Tell them to get a [very cheap] pair of single focus reading glasses
    made to suit the distance their screen is away.

    Works fine if there is not too much astigmation and both eyes need
    roughly the same correction. Then a £1.50 pair from a local discount
    shop will be fine. Otherwise it will cost a bit more....

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve McIntyre@21:1/5 to debian-user@howorth.org.uk on Sun Sep 8 18:20:01 2024
    debian-user@howorth.org.uk wrote:
    Richard Owlett <rowlett@access.net> wrote:
    [My examples are from my experiments with re-formatting
    text at https://ebible.org/engkjvcpb/ for comfortable reading by
    fellow tri-focal wearing senior citizens

    As a mere bifocal (well vari-focal) wearer can I suggest a different >approach. Stop wearing tri-focals or any other variable focus specs for >reading a computer screen. Tell them to get a [very cheap] pair of
    single focus reading glasses made to suit the distance their screen is
    away.

    I did this years ago and wouldn't try to do it any other way now. The
    bliss of being able to read the whole screen comfortably without moving
    if I want to.

    100% agreed. When I started with varifocals 3 years ago, my optician
    strongly recommended also getting a set of fixed-focus glasses for
    monitor work. Despite the inconvenience of carrying multiple pairs of
    glasses, I totally understand why - it makes a huge difference when
    I'm sat in front of the screen for hours at a time.

    --
    Steve McIntyre, Cambridge, UK. steve@einval.com Can't keep my eyes from the circling sky,
    Tongue-tied & twisted, Just an earth-bound misfit, I...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Yassine Chaouche@21:1/5 to All on Sun Sep 8 19:40:01 2024
    Missed (deleted) the start of the discussion.

    Not sure if it helps but:
    I juste made public my toolbox.txt file: https://ychaouche.github.io/toolbox.txt
    it is meant to be open in emacs,
    so that you can use its outliner mode and read only what you're interested in.

    The relevant part is in "** command line tricks" (https://i.imgur.com/eqBjD0n.png)

    You can also take a look at https://ychaouche.github.io/bash.txt,
    but it is less of a "learn by doing" and more of a quick cheat sheet that helps you write or read bash code.

    I use these two files (and more) to organize and quickly access knowledge gems, so that once I learn something I need to remember 6 months from now,
    I just look at one of the files
    (or use my notes.search script,
    but that's another topic).

    Best,


    --
    yassine -- sysadm
    +213-779 06 06 23
    http://about.me/ychaouche
    Looking for side gigs.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From George at Clug@21:1/5 to All on Mon Sep 9 00:30:01 2024
    single focus reading glasses made to suit the distance their screen is
    away.


    For any prolonged activity:

    1) Like others who have responded, I do the above and recommend the same: "single focus reading glasses made to suit the distance the screen is away". Maintaining that distance is important. I have a bad habit of rolling my office chair out of focal
    distance when just reading from the computer screen. It is important to maintain the correct focal distance the glasses are set to.
    2) For close work like reading a book, solder circuit boards, or using a laptop on a desk (book reading distance), I use another pair of glasses set to the focal distance from me to where I hold a book.
    3) To watch TV, I use a different pair of glasses set to the focal distance from me to the TV Screen.

    This means I now use three pair of single focus glasses, all set to a different magnification and most importantly a different focal distance.

    I do not require glasses for any other activity, my distance vision remains quite good. I can peel vegetables for dinner without the need for glasses as it is not a prolonged activity.

    I did try multi focus glasses at one time, but it made walking difficult as glasses set to the focal distance for reading or for computer screens made the the path all blurred.

    If I required glasses for reading the car's speedometer, then I would definitely be using a bifocal pair of glasses. So far I can easily read the instrument panel, and since most of the time we spend focusing on the traffic about us, a quick glance now
    and then to confirm the car's speed is under or at the current speed limit, I am able to drive for many hours.

    While I expect this is far more information than the OP required, my hope it might help the OP or others. It took me too long to find a good optometrist who was able to explain and help me with appropriate glasses set to the required focal distance.

    George

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to debian-user@howorth.org.uk on Mon Sep 9 10:50:01 2024
    debian-user@howorth.org.uk writes:

    As a mere bifocal (well vari-focal) wearer can I suggest a different approach. Stop wearing tri-focals or any other variable focus specs for reading a computer screen. Tell them to get a [very cheap] pair of
    single focus reading glasses made to suit the distance their screen is
    away.

    I don't agree at all. I've used fixed focus glasses before but I find
    close range varifocals a huge upgrade. They're extremely useful for
    monitor work *and also* I can see and read things around me that fall
    outside the extremely narrow focus range of single focus reading
    glasses. I wonder if fixed focus even works for modern large two or
    three monitor setups? I suppose it's fine for a single small screen.

    So, not going back from my close range varifocals. I don't need glasses otherwise.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From George at Clug@21:1/5 to All on Mon Sep 9 12:00:01 2024
    On Monday, 09-09-2024 at 19:20 Karl Vogel wrote:
    On Mon 09 Sep 2024 at 04:47:20 (-0400), Anssi Saari wrote:
    debian-user@howorth.org.uk writes:

    As a mere bifocal (well vari-focal) wearer can I suggest a different approach. Stop wearing tri-focals or any other variable focus specs for reading a computer screen. Tell them to get a [very cheap] pair of
    single focus reading glasses made to suit the distance their screen is away.

    I don't agree at all. I've used fixed focus glasses before but I find
    close range varifocals a huge upgrade. They're extremely useful for
    monitor work *and also* I can see and read things around me that fall outside the extremely narrow focus range of single focus reading
    glasses. I wonder if fixed focus even works for modern large two or
    three monitor setups? I suppose it's fine for a single small screen.

    Have you tried some different fonts? My eyesight is poor, and a good
    font made all the difference.

    https://bezoar.org/posts/2023/0214/font-screenshots/

    Have you tried 100 Hz or greater monitors? All my monitors are 60Hz. I wonder if these help with prolonged computer use?

    George.


    --
    Karl Vogel I don't speak for anyone but myself

    Debugging: when you're the detective, the victim, and the criminal.
    --seen on Reddit, 11 Jul 2024



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Karl Vogel@21:1/5 to Anssi Saari on Mon Sep 9 11:50:01 2024
    On Mon 09 Sep 2024 at 04:47:20 (-0400), Anssi Saari wrote:
    debian-user@howorth.org.uk writes:

    As a mere bifocal (well vari-focal) wearer can I suggest a different approach. Stop wearing tri-focals or any other variable focus specs for reading a computer screen. Tell them to get a [very cheap] pair of
    single focus reading glasses made to suit the distance their screen is away.

    I don't agree at all. I've used fixed focus glasses before but I find
    close range varifocals a huge upgrade. They're extremely useful for
    monitor work *and also* I can see and read things around me that fall
    outside the extremely narrow focus range of single focus reading
    glasses. I wonder if fixed focus even works for modern large two or
    three monitor setups? I suppose it's fine for a single small screen.

    Have you tried some different fonts? My eyesight is poor, and a good
    font made all the difference.

    https://bezoar.org/posts/2023/0214/font-screenshots/

    --
    Karl Vogel I don't speak for anyone but myself

    Debugging: when you're the detective, the victim, and the criminal.
    --seen on Reddit, 11 Jul 2024

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Owlett@21:1/5 to Yassine Chaouche on Mon Sep 9 13:30:02 2024
    On 09/08/2024 12:22 PM, Yassine Chaouche wrote:
    Missed (deleted) the start of the discussion.

    Not sure if it helps but:
    I juste made public my toolbox.txt file: https://ychaouche.github.io/toolbox.txt
    it is meant to be open in emacs,
    so that you can use its outliner mode and read only what you're
    interested in.


    I've never successfully used Emacs [an attempt made several months ago].
    The GUI version is available on my machine.
    HELP menu displays:
    This is GNU Emacs 24.5.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11)
    of 2017-09-12 on x86-grnet-01, modified by Debian
    How do I display/activate "outliner mode"?
    Is appropriate "HELP" documentation of using "outliner mode" available
    as web page?


    The relevant part is in "** command line tricks" (https://i.imgur.com/eqBjD0n.png)

    I tried to display in my browser (SeaMonkey 2.49.4) and got only an
    empty dark gray screen.


    You can also take a look at https://ychaouche.github.io/bash.txt,
    but it is less of a "learn by doing" and more of a quick cheat sheet
    that helps you write or read bash code.

    I assume that is also meant to be read using "outliner mode".

    The notes will give me practice in reading French which I haven't done
    since high school (1961).

    Thanks for trying.




    I use these two files (and more) to organize and quickly access
    knowledge gems,
    so that once I learn something I need to remember 6 months from now,
    I just look at one of the files
    (or use my notes.search script,
    but that's another topic).

    Best,



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Owlett@21:1/5 to Richard Owlett on Mon Sep 9 14:20:01 2024
    On 09/09/2024 06:29 AM, Richard Owlett wrote:
    On 09/08/2024 12:22 PM, Yassine Chaouche wrote:
    Missed (deleted) the start of the discussion.

    Not sure if it helps but:
    I juste made public my toolbox.txt file:
    https://ychaouche.github.io/toolbox.txt
    it is meant to be open in emacs,
    so that you can use its outliner mode and read only what you're
    interested in.


    I've never successfully used Emacs [an attempt made several months ago].
    The GUI version is available on my machine.
    HELP menu displays:
    This is GNU Emacs 24.5.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11)
     of 2017-09-12 on x86-grnet-01, modified by Debian
    How do I display/activate "outliner mode"?
    Is appropriate "HELP" documentation of using "outliner mode" available
    as web page?


    Yes ;} https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html

    I now have today's reading assignment. Retirement can be convenient.


    The relevant part is in "** command line tricks"
    (https://i.imgur.com/eqBjD0n.png)

    I tried to display in my browser (SeaMonkey 2.49.4) and got only an
    empty dark gray screen.


    You can also take a look at https://ychaouche.github.io/bash.txt,
    but it is less of a "learn by doing" and more of a quick cheat sheet
    that helps you write or read bash code.

    I assume that is also meant to be read using "outliner mode".

    The notes will give me practice in reading French which I haven't done
    since high school (1961).

    Thanks for trying.




    I use these two files (and more) to organize and quickly access
    knowledge gems,
    so that once I learn something I need to remember 6 months from now,
    I just look at one of the files
    (or use my notes.search script,
    but that's another topic).

    Best,





    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From eben@gmx.us@21:1/5 to Karl Vogel on Mon Sep 9 16:00:01 2024
    On 9/9/24 05:20, Karl Vogel wrote:
    On Mon 09 Sep 2024 at 04:47:20 (-0400), Anssi Saari wrote:

    I've used fixed focus glasses before but I find
    close range varifocals a huge upgrade. They're extremely useful for
    monitor work *and also* I can see and read things around me that fall
    outside the extremely narrow focus range of single focus reading
    glasses. I wonder if fixed focus even works for modern large two or
    three monitor setups? I suppose it's fine for a single small screen.

    Have you tried some different fonts? My eyesight is poor, and a good
    font made all the difference.

    https://bezoar.org/posts/2023/0214/font-screenshots/

    Indeed. I can't stand Courier or clones, too thin. I use Liberation Mono usually.

    --
    "First, Do No Harm.

    Always do harm second, after the user has proven that they earned it."
    -- ObscureRefence on reddit

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Charlie Gibbs@21:1/5 to Anssi Saari on Mon Sep 9 19:10:01 2024
    On Mon Sep 9 09:07:11 2024
    Anssi Saari <anssi.saari@debian-user.mail.kapsi.fi> wrote:

    debian-user@howorth.org.uk writes:

    As a mere bifocal (well vari-focal) wearer can I suggest a different
    approach. Stop wearing tri-focals or any other variable focus specs
    for reading a computer screen. Tell them to get a [very cheap] pair
    of single focus reading glasses made to suit the distance their
    screen is away.

    I don't agree at all. I've used fixed focus glasses before but I find
    close range varifocals a huge upgrade. They're extremely useful for
    monitor work *and also* I can see and read things around me that fall outside the extremely narrow focus range of single focus reading
    glasses. I wonder if fixed focus even works for modern large two or
    three monitor setups? I suppose it's fine for a single small screen.

    So, not going back from my close range varifocals. I don't need
    glasses otherwise.

    I can't imagine having to manage multiple pairs of glasses. It would
    drive me insane. This would also be the consequence of having cataract
    surgery that gives you perfect distance vision at the cost of your
    close-up vision. I'm nearsighted and have worn glasses since I was
    about 10, so wearing glasses is no big deal for me. I'm now wearing progressive lenses; yes, they take some getting used to at first,
    and you have to be careful on stairs, but on it's well worth the
    convenience. I put them on in the morning and take them off when
    I go to bed - no worrying about where I left those damned reading
    glasses.

    When I got cataract surgery, I told the doctor to leave my nearsighted
    vision the way it is and let the glasses handle it. I can focus on
    computer screens well enough, and when I'm driving the shift from the instrument panel to distance and back has become automatic. If I want
    to look at something really close (like my wife's eyes), I take off my
    glasses, or look over them. Your mileage may vary.

    I did once get a pair of single-focus glasses made that focused at the
    distance of a computer screen (or music stand). Just after I picked
    them up, my eyes changed, and the glasses then focused at 8 feet.
    Two hundred dollars wasted.

    --
    /~\ Charlie Gibbs | We'll go down in history as
    \ / <cgibbs@kltpzyxm.invalid> | the first society that wouldn't
    X I'm really at ac.dekanfrus | save itself because it wasn't
    / \ if you read it the right way. | cost-effective. -- Kurt Vonnegut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From George at Clug@21:1/5 to All on Tue Sep 10 13:50:01 2024
    On Tuesday, 10-09-2024 at 18:59 Anssi Saari wrote:
    George at Clug <Clug@goproject.info> writes:

    Have you tried 100 Hz or greater monitors? All my monitors are 60Hz. I wonder if these help with prolonged computer use?

    In my home setup one monitor does 75 Hz and the other 144 but I can't
    see much, if any, difference in clarity compared to 60 Hz. Also I have
    no idea how to configure that in Debian, I just quickly tested with my
    work Windows laptop.

    Thanks Anssi, I find your comments very useful regard refresh rate.

    I believe in most Linux's GUI settings for the Display, there will be a "Refresh rate" which appears to be user adjustable in XFCE, if the monitor supports multiple refresh rates, but for me, my monitors only support 60 Hz anyway so I cannot confirm. I
    don't know about Gnome or KDE? If anyone has a monitor that can do multiple refresh rates and use either Gnome or KDE, please let me know if they just use the highest refresh rate or if the refresh rate is user adjustable via the GUI's Display settings.

    George.






    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to George at Clug on Tue Sep 10 11:10:01 2024
    George at Clug <Clug@goproject.info> writes:

    Have you tried 100 Hz or greater monitors? All my monitors are 60Hz. I wonder if these help with prolonged computer use?

    In my home setup one monitor does 75 Hz and the other 144 but I can't
    see much, if any, difference in clarity compared to 60 Hz. Also I have
    no idea how to configure that in Debian, I just quickly tested with my
    work Windows laptop.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to Karl Vogel on Tue Sep 10 11:10:01 2024
    Karl Vogel <vogelke@pobox.com> writes:

    Have you tried some different fonts? My eyesight is poor, and a good
    font made all the difference.

    https://bezoar.org/posts/2023/0214/font-screenshots/

    Fonts on what? I mostly can't control fonts on documents I edit or
    create, for work at least. A little hard to do on PDFs too, let alone
    UIs.

    With fixed width fonts, terminals and Emacs is where I have the most
    choice, and there it's one of Input, Consolas or Meslo LG in different environments.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)