When using a computer, laziness is a virtue. This is why we have
command lines, to help automate the boring and repetitive tasks.
This article <https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part-two-variables-and-loops-in-bash/>
continues the author?s intro to basic command-line concepts. But it
repeats a failing I see all too often in shell scripting: doing
complex parsing of the output of some command, when the command itself
offers an option to produce something closer to the exact output you
need.
In this case, he is extracting the names of datasets from the ?zfs
list? command. And while I have zero experience with ZFS, I can look
at documentation <https://docs.oracle.com/cd/E18752_01/html/819-5461/gazsu.html>, and
discover that the command offers the ?-o? option where you can select
exactly that information you want it to output. It even has ?-H? to
simplify the output format right down, specifically to make it easier
to parse.
Sure, it?s fun to write code. But it can be even more fun to _avoid_
writing code. RTFM helps.
When using a computer, laziness is a virtue. This is why we have
command lines, to help automate the boring and repetitive tasks.
This article
continues the author?s intro to basic command-line concepts. But it
repeats a failing I see all too often in shell scripting: doing
complex parsing of the output of some command, when the command itself offers an option to produce something closer to the exact output you
need.
In this case, he is extracting the names of datasets from the ?zfs
list? command. And while I have zero experience with ZFS, I can look
at documentation <https://docs.oracle.com/cd/E18752_01/html/819-5461/gazsu.html>, and discover that the command offers the ?-o? option where you can select exactly that information you want it to output. It even has ?-H? to
simplify the output format right down, specifically to make it easier
to parse.
Sure, it?s fun to write code. But it can be even more fun to _avoid_
writing code. RTFM helps.
On 3/12/26 08:21, Lawrence D?Oliveiro wrote:
This article <https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part-two-variables-and-loops-in-bash/>
continues the author?s intro to basic command-line concepts. But it repeats a failing I see all too often in shell scripting: [...]
Right. I can only agree with you.
The more general problem is that there's so much stuff about shell programming on the web but most of it is sadly of very bad quality.
Shell scripts HAVE THEIR PLACE, I've writ fairly
long ones ... but any modern suggestion that they
are the one and only great solution to complex
problems - no, No, NO !
Despite my own complaints here, Python is the better
way to go - if possible - for complex little issues.
Far clearer.
On 3/12/26 09:00, Janis Papanagnou wrote:
On 3/12/26 08:21, Lawrence DOliveiro wrote:
two-variables-and-loops-in-bash/>
This article
<https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part-
I took the time to look more closely into that link above.
continues the authors intro to basic command-line concepts. But it
repeats a failing I see all too often in shell scripting: [...]
Not only "a [one] failing"; it's full of bad coding practices!
(I suggest to abstain from it.)
In article <10ou2q9$1qp29$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
On 3/12/26 09:00, Janis Papanagnou wrote:
On 3/12/26 08:21, Lawrence DOliveiro wrote:
>
> This article
> <https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part- >>> two-variables-and-loops-in-bash/>
I took the time to look more closely into that link above.
> continues the authors intro to basic command-line concepts. But it
> repeats a failing I see all too often in shell scripting: [...]
Not only "a [one] failing"; it's full of bad coding practices!
(I suggest to abstain from it.)
Shell scripting seems to bring out the critic in everybody. Nobody likes
the way other people shell script.
Or, as I discovered long ago, nobody wants to run someone else's shell script. What I mean is that if I hand you a piece of C code, you are quite likely to just compile it and run it, as is. Similar for most other languages. But shell, no. Before you will consider running it, you will first analyze it and then probably pretty much totally re-write it. And
this as it should be.
Something called "Python" (mentioned by another poster) probably falls somewhere in between.
In article <EMScnQS_gIv98y_0nZ2dnZfqn_idnZ2d@giganews.com>,
c186282 <c186282@nnada.net> mysteriously wrote:
...
Shell scripts HAVE THEIR PLACE, I've writ fairly
long ones ... but any modern suggestion that they
are the one and only great solution to complex
problems - no, No, NO !
Despite my own complaints here, Python is the better
way to go - if possible - for complex little issues.
Far clearer.
This response has nothing to do with the OP.
Sadly, that's standard for c186282.
In article <10oukth$240u3$1@dont-email.me>, Rich <rich@example.invalid> wrote:
...
Sadly, that's standard for c186282.
Just out of curiosity, what is that (c186282) ?
In article <10oukth$240u3$1@dont-email.me>, Rich <rich@example.invalid> wrote:
...
Sadly, that's standard for c186282.
Just out of curiosity, what is that (c186282) ?
Perhaps that is why I never ever shell script if at all avoidable.
Like Regexp, and PERL it seems to be the province of wannabe gurus
who cant code C.
In article <10ou2q9$1qp29$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
On 3/12/26 09:00, Janis Papanagnou wrote:
On 3/12/26 08:21, Lawrence DOliveiro wrote:
>
> This article
> <https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part- >>> two-variables-and-loops-in-bash/>
I took the time to look more closely into that link above.
> continues the authors intro to basic command-line concepts. But it
> repeats a failing I see all too often in shell scripting: [...]
Not only "a [one] failing"; it's full of bad coding practices!
(I suggest to abstain from it.)
Shell scripting seems to bring out the critic in everybody. Nobody likes
the way other people shell script.
Or, as I discovered long ago, nobody wants to run someone else's shell script. What I mean is that if I hand you a piece of C code, you are quite likely to just compile it and run it, as is. Similar for most other languages. But shell, no. Before you will consider running it, you will first analyze it and then probably pretty much totally re-write it. And
this as it should be.
Something called "Python" (mentioned by another poster) probably falls somewhere in between.
On 12/03/2026 12:44, Kenny McCormack wrote:
Perhaps that is why I never ever shell script if at all avoidable.
Shell scripting seems to bring out the critic in everybody.ÿ Nobody likes
the way other people shell script.
Like Regexp, and PERL it seems to be the province of wannabe gurus who
cant code C.
On 12.03.26 15:12, The Natural Philosopher wrote:
On 12/03/2026 12:44, Kenny McCormack wrote:
Perhaps that is why I never ever shell script if at all avoidable.
Shell scripting seems to bring out the critic in everybody.ÿ Nobody
likes
the way other people shell script.
The application domain of shells and (for example) "C" are quite
different. There's task that are easy done in shell where there's a
huge and unnecessary overhead with languages like "C".
Like Regexp, and PERL it seems to be the province of wannabe gurus who
cant code C.
You think that folks can only program [sophisticatedly] in shell *or* languages like "C"? - I'm positive that you're wrong.
The shell language has a lot of peculiarities, though. And you need
to learn the languages you use (shell or otherwise) in any case. Some
don't seem to do that, though; for languages like "C" it's mandatory
to read a textbook, it seems, while for shell I've seen that many use existing paragons (good or bad ones) to "learn" it or web pages like
the one mentioned in this thread.
Since when I started with Unix I saw most experts know "C" and shell;
on the Unix platforms you have (and often want to use) both languages.
With the separation from Unix, the independent development of the "C" languages, things have probably changed later.
Regexps are a basic key feature of the Unix platforms, something that
was long missing on other platforms. You need to learn the Regexps,
though, with simple expressions you can do powerful things, and with
simple inconsistencies in Regexps you can produce subtle flaws.
Janis
In article <10oukth$240u3$1@dont-email.me>, Rich <rich@example.invalid> wrote:
...
Sadly, that's standard for c186282.
Just out of curiosity, what is that (c186282) ?
On Thu, 12 Mar 2026 14:12:21 +0000
The Natural Philosopher <tnp@invalid.invalid> wrote:
Perhaps that is why I never ever shell script if at all avoidable.
Like Regexp, and PERL it seems to be the province of wannabe gurus
who cant code C.
Horses for courses. C is much more capable for general-purpose work,
but it requires a lot more wrangling (or an external library) to do
batch file operations effectively.
F'rexample, I'm in the process of putting together a home-grown "static
site generator" for use with a free host that doesn't allow server-side
stuff like PHP; the job is to assemble complete HTML files for each
page from header/sidebar templates and page-specific content files.
It's totally possible to do that in C, but I'd have to either roll my
own code or pull in non-stdlib dependencies for stuff like enumerating/ looping over the files in a directory; shell script makes that a first-
class language feature. And the core of the work (tacking files to each other) is likewise something that's easily doable in C, but provided out
of the box in the shell (it's just what cat is designed and named for.)
As with SQL I have always found it quicker to do anything complex, in C,
as it is in fact quicker than trying to do it in SQL, or regexp, both in terms of design time and indeed execution time.
There are people who like to master arcane syntaxes and there are people
who just want an efficient route to a solution.
Probably because it lies somewhere between scripting and programming language?
I've found perl to be a lot more useful for that sort of thing. I
suppose if were starting now I'd be using python. But in the 90's
eprl was the goto scripting language for C programmers.
In article <10ou2q9$1qp29$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
Not only "a [one] failing"; it's full of bad coding practices!
(I suggest to abstain from it.)
Shell scripting seems to bring out the critic in everybody. Nobody likes
the way other people shell script.
Or, as I discovered long ago, nobody wants to run someone else's shell script. What I mean is that if I hand you a piece of C code, you are quite likely to just compile it and run it, as is. Similar for most other languages. But shell, no. Before you will consider running it, you will first analyze it and then probably pretty much totally re-write it. And
this as it should be.
Something called "Python" (mentioned by another poster) probably falls somewhere in between.
In article <EMScnQS_gIv98y_0nZ2dnZfqn_idnZ2d@giganews.com>,
c186282 <c186282@nnada.net> mysteriously wrote:
...
Shell scripts HAVE THEIR PLACE, I've writ fairly
long ones ... but any modern suggestion that they
are the one and only great solution to complex
problems - no, No, NO !
Despite my own complaints here, Python is the better
way to go - if possible - for complex little issues.
Far clearer.
This response has nothing to do with the OP.
On Thu, 12 Mar 2026 14:12:21 +0000
The Natural Philosopher <tnp@invalid.invalid> wrote:
Perhaps that is why I never ever shell script if at all avoidable.
Like Regexp, and PERL it seems to be the province of wannabe gurus
who cant code C.
Horses for courses. C is much more capable for general-purpose work,
but it requires a lot more wrangling (or an external library) to do
batch file operations effectively.
F'rexample, I'm in the process of putting together a home-grown "static
site generator" for use with a free host that doesn't allow server-side
stuff like PHP; the job is to assemble complete HTML files for each
page from header/sidebar templates and page-specific content files.
It's totally possible to do that in C, but I'd have to either roll my
own code or pull in non-stdlib dependencies for stuff like enumerating/ looping over the files in a directory; shell script makes that a first-
class language feature. And the core of the work (tacking files to each other) is likewise something that's easily doable in C, but provided out
of the box in the shell (it's just what cat is designed and named for.)
On Thu, 12 Mar 2026 19:23:17 +0100, Janis Papanagnou wrote:
Probably because it lies somewhere between scripting and programming
language?
No idea what ?scripting? means in this context. Does it mean the
language is interpreted, not compiled?
Yet nobody ever called BASIC a
?scripting? language back in the day -- it was always known as a ?programming? language.
Perl and Python are the same.
One of the first BASIC dialects I programmed in was tokenized on the
fly, including syntax checks when committing a line, and it was then compiled. So there was no reason (in that respect) to call it
anything other than a programming languages.
But one aspect - and that should have been clear from the context of
my previous post - is that in shell you type in the code, and then
you execute it by interpreting it; you don't compile it, you have no
static type checking, not even a complete syntax check (unless you
explicitly invoke a separate explicit syntax check step).
On Fri, 13 Mar 2026 03:05:48 +0100, Janis Papanagnou wrote:
One of the first BASIC dialects I programmed in was tokenized on the
fly, including syntax checks when committing a line, and it was then
compiled. So there was no reason (in that respect) to call it
anything other than a programming languages.
Other than the fact that it didn?t actually compile to machine
language.
Perl and Python do the same sort of thing.
But one aspect - and that should have been clear from the context of
my previous post - is that in shell you type in the code, and then
you execute it by interpreting it; you don't compile it, you have no
static type checking, not even a complete syntax check (unless you
explicitly invoke a separate explicit syntax check step).
See my previous post on the distinction between ?command? languages
and ?programming? languages. Shell script being a ?command? language
is a more meaningful distinction from ?programming? languages than
trying to separate ?programming? languages from ?scripting? ones.
On Fri, 13 Mar 2026 03:05:48 +0100, Janis Papanagnou wrote:
One of the first BASIC dialects I programmed in was tokenized on the
fly, including syntax checks when committing a line, and it was then
compiled. So there was no reason (in that respect) to call it
anything other than a programming languages.
Other than the fact that it didn?t actually compile to machine
language.
Perl and Python do the same sort of thing.
But one aspect - and that should have been clear from the context of
my previous post - is that in shell you type in the code, and then
you execute it by interpreting it; you don't compile it, you have no
static type checking, not even a complete syntax check (unless you
explicitly invoke a separate explicit syntax check step).
See my previous post on the distinction between ?command? languages
and ?programming? languages. Shell script being a ?command? language
is a more meaningful distinction from ?programming? languages than
trying to separate ?programming? languages from ?scripting? ones.
On 13.03.26 04:00, Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 03:05:48 +0100, Janis Papanagnou wrote:
One of the first BASIC dialects I programmed in was tokenized on the
fly, including syntax checks when committing a line, and it was then
compiled. So there was no reason (in that respect) to call it
anything other than a programming languages.
Other than the fact that it didn?t actually compile to machine
language.
I'm not sure I understand your statement correctly. The BASIC system
I was talking about *did* have a compile to the machine instructions
step involved that you triggered explicitly by a 'compile' command.\\
Last time I used Perl I just ran the perl command on a program file[...]
(if I recall correctly). That was certainly different from the BASIC
case I described, where syntax checking was interactively done, and
where an explicit compile step was necessary.
On 12.03.26 20:03, The Natural Philosopher wrote:
As with SQL I have always found it quicker to do anything complex, in
C, as it is in fact quicker than trying to do it in SQL, or regexp,
both in terms of design time and indeed execution time.
Are you saying here that if, for example, you have a pattern to match
then you would implement that natively in "C" than in regexp?
Presumed I understood you correctly, then, frankly, you are obviously
just lacking the necessary expertise and blame Regular Languages (and
their uses and users) just due to ignorance.
There's nothing wrong not
knowing every aspect of CS and IT, but your generalizing imputations
based on that are misguided.
On Thu, 12 Mar 2026 19:38:13 -0000 (UTC), Jim Jackson wrote:
I've found perl to be a lot more useful for that sort of thing. I
suppose if were starting now I'd be using python. But in the 90's eprl
was the goto scripting language for C programmers.
That was the '90s... It took me a while to warm up to Python but it
became the scripting language for GIS applications. It certainly was
better than VBA.
Pike is good too but never caught on.
Python in my experience enforces the re-writing step by inevitably
requiring a version that's either newer or older than what you have available. Although since rewriting in Python only sets you up for
the same thing later on, I rewrite as a Bash script, assuming
there are no alternatives available in a sane language.
I have seen a static site generator written in C, but I don't think
it was anyone's idea of elegance. A C program that only needs to
run once (for its author, at least) can cut a_lot_ of corners!
I am sometimes tempted to use C for dynamic sites, though manyPhp is nowhere near as fast as C, but it is for sure *fast enough*. Mostly
claim PHP is just as fast these days anyway.
Frankly, I don't recall when I heard the term "scripting" for the first
time and in what (language-)context.
IMHO, anything that makes the box "do something"
ÿ useful is a 'programming language' - compiled,
ÿ interpreted or guided by magic fairies.
ÿ Bash is a 'programming language' (though nasty), so
ÿ is Python, so are 'C' and FORTRAN.
On 3/12/26 23:59, Janis Papanagnou wrote:
On 13.03.26 04:00, Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 03:05:48 +0100, Janis Papanagnou wrote:
One of the first BASIC dialects I programmed in was tokenized on the
fly, including syntax checks when committing a line, and it was then
compiled. So there was no reason (in that respect) to call it
anything other than a programming languages.
Other than the fact that it didn?t actually compile to machine
language.
I'm not sure I understand your statement correctly. The BASIC system
I was talking about *did* have a compile to the machine instructions
step involved that you triggered explicitly by a 'compile' command.\\
ÿ I did a few large-ish projects using BASIC/BASCOM
ÿ back in the early PC days. So, apparently, BASIC
ÿ was not a computer language - but WAS when I compiled
ÿ it all five minutes later ???ÿ :-)
ÿ Sorry, some want to see a big diff here, I just see
ÿ "organized way to get a box to DO stuff" - which
ÿ includes scripts, compiled or what-the-fuck.
I do not claim that this distinction defines the difference between
scripting languages and programming languages. That difference
is not well defined.
On 13/03/2026 05:32, c186282 wrote:
On 3/12/26 23:59, Janis Papanagnou wrote:Back in the day I came across and used enormous accounting systems
On 13.03.26 04:00, Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 03:05:48 +0100, Janis Papanagnou wrote:
One of the first BASIC dialects I programmed in was tokenized on the >>>>> fly, including syntax checks when committing a line, and it was then >>>>> compiled. So there was no reason (in that respect) to call it
anything other than a programming languages.
Other than the fact that it didn?t actually compile to machine
language.
I'm not sure I understand your statement correctly. The BASIC system
I was talking about *did* have a compile to the machine instructions
step involved that you triggered explicitly by a 'compile' command.\\
ÿÿ I did a few large-ish projects using BASIC/BASCOM
ÿÿ back in the early PC days. So, apparently, BASIC
ÿÿ was not a computer language - but WAS when I compiled
ÿÿ it all five minutes later ???ÿ :-)
ÿÿ Sorry, some want to see a big diff here, I just see
ÿÿ "organized way to get a box to DO stuff" - which
ÿÿ includes scripts, compiled or what-the-fuck.
written in BASIC.
On 12/03/2026 19:44, Janis Papanagnou wrote:
On 12.03.26 20:03, The Natural Philosopher wrote:Beyond a very limited complexity, yes.
As with SQL I have always found it quicker to do anything complex, in
C, as it is in fact quicker than trying to do it in SQL, or regexp,
both in terms of design time and indeed execution time.
Are you saying here that if, for example, you have a pattern to match
then you would implement that natively in "C" than in regexp?
It's very hard to documents a regexp . Or in fact a complex SQL statement. And in the latter case I replaced a complex SQL statement by a series of simple statements and some C and the program ran at least 10 times
faster. (I never found out how long the SQL version ran because I
aborted it after 6 hours. The C example ran and gave me debugging
output, and once I had fined tuned it, it took about 40 minutes )
On 3/13/26 11:32, The Natural Philosopher wrote:
On 12/03/2026 19:44, Janis Papanagnou wrote:
On 12.03.26 20:03, The Natural Philosopher wrote:Beyond a very limited complexity, yes.
As with SQL I have always found it quicker to do anything complex,
in C, as it is in fact quicker than trying to do it in SQL, or
regexp, both in terms of design time and indeed execution time.
Are you saying here that if, for example, you have a pattern to match
then you would implement that natively in "C" than in regexp?
It's very hard to documents a regexp . Or in fact a complex SQL
statement.
And in the latter case I replaced a complex SQL statement by a series
of simple statements and some C and the program ran at least 10 times
faster. (I never found out how long the SQL version ran because I
aborted it after 6 hours. The C example ran and gave me debugging
output, and once I had fined tuned it, it took about 40 minutes )
People teach or learn SQL from an ivory tower perspective.
Real life SQL, try to limit a big table query to a max of four tables (ideally :-)), + use temporary tables and or cursors.
I've done the same thing using PHP, running the script from the
command-line to generate the static site. I've done it in Bash
earlier too, but I ran into things that are just much easier in
PHP since it's built for generating HTML.
On 13 Mar 2026 07:59:02 +1000
not@telling.you.invalid (Computer Nerd Kev) wrote:
I've done the same thing using PHP, running the script from the
command-line to generate the static site. I've done it in Bash
earlier too, but I ran into things that are just much easier in
PHP since it's built for generating HTML.
Oh, that's a clever notion! Hadn't thought of doing it that way.
Oh, that's a clever notion! Hadn't thought of doing it that way.
There is no point in using PHP to generate a *static* site. It is
after all for *active* sites.
On Fri, 13 Mar 2026 16:03:21 +0000
The Natural Philosopher <tnp@invalid.invalid> wrote:
Oh, that's a clever notion! Hadn't thought of doing it that way.
There is no point in using PHP to generate a *static* site. It is
after all for *active* sites.
Allows you to use the same language across the board. A bit unorthodox,
but I can see the use of it.
Allows you to use the same language across the board. A bit
unorthodox, but I can see the use of it.
But 90% of my php is in fact straight HTML.
On Fri, 13 Mar 2026 19:02:02 +0000
The Natural Philosopher <tnp@invalid.invalid> wrote:
Allows you to use the same language across the board. A bit
unorthodox, but I can see the use of it.
But 90% of my php is in fact straight HTML.
Ditto - but adding PHP (or another preprocessor utility) to the mix
allows me to write the common sections (header, footer, nav. sidebar)
once, in a separate file, rather than having to update them manually
across every single page every time I need to change something. It's
not *as* useful when it's not happening automagically server-side, but
it still saves a lot of tedium.
On 13/03/2026 10:20, Keith Thompson wrote:
I do not claim that this distinction defines the difference between
scripting languages and programming languages.ÿ That difference
is not well defined.
In the end its mere convention.
To my mind scripting tends to be less complete and more specialised. And probably interpreted. And designed to use standalone *programs* to do
the heavy lifting.
Whereas 'language' implies more general application and uses *libraries*
to do the grunt work.
[...]
I am not claiming that is an exact definition, but its how my mind
separates the terms...
On Fri, 13 Mar 2026 11:32:12 +0000, The Natural Philosopher wrote:
It's very hard to documents a regexp . Or in fact a complex SQL
statement.
And in the latter case I replaced a complex SQL statement by a series of
simple statements and some C and the program ran at least 10 times
faster.
(I never found out how long the SQL version ran because I aborted it
after 6 hours. The C example ran and gave me debugging output, and once
I had fined tuned it, it took about 40 minutes )
We had one support person who spent his spare time crafting SQL
statements. They would fail on older DB2 systems that had a 4K limit on a statement size. The best part is with a chain of
CONCAT(CONCAT(CONCAT(.... when a SUBSTR or something fails the whole mess returns NULL.
Ditto - but adding PHP (or another preprocessor utility) to the mix
allows me to write the common sections (header, footer, nav.
sidebar) once, in a separate file, rather than having to update
them manually across every single page every time I need to change something. It's not *as* useful when it's not happening
automagically server-side, but it still saves a lot of tedium.
You can do the same with javaScript
On 12/03/2026 19:44, Janis Papanagnou wrote:
On 12.03.26 20:03, The Natural Philosopher wrote:Beyond a very limited complexity, yes.
As with SQL I have always found it quicker to do anything complex, in
C, as it is in fact quicker than trying to do it in SQL, or regexp,
both in terms of design time and indeed execution time.
Are you saying here that if, for example, you have a pattern to match
then you would implement that natively in "C" than in regexp?
It's very hard to documents a regexp .
[snip SQL topic]
Presumed I understood you correctly, then, frankly, you are obviously
just lacking the necessary expertise and blame Regular Languages (and
their uses and users) just due to ignorance.
Its not a matter of ignorance. That's what wannabe code gurus like to
say, because to them 'guru knowledge' is more important than getting the
job done on time, on budget and leaving code that can actually be maintained.
My point being exactly that to gain the expertise does not lead to a practicable solution *anyway*.
There's nothing wrong notUnfortunately you have just made my point for me.
knowing every aspect of CS and IT, but your generalizing imputations
based on that are misguided.
I have always been under pressure to produce efficientÿ working comprehensible and maintainable code in a short time.
Regexps simply don't fit the bill. Nor do overly complex SQL statements.
I tried both and gave up after I had already taken longer to produce
code that ran way slower than a custom solution in C did
There's even a video about it
"How on Earth does ^.?$|^(..+?)\1+$ produce primes?"
https://www.youtube.com/watch?v=5vbk0TwkokM
18 minutes of documentation to explain one regular expression
The same algorithm would be just a few lines of python or C and could include comments
On 13 Mar 2026 07:59:02 +1000
not@telling.you.invalid (Computer Nerd Kev) wrote:
I've done the same thing using PHP, running the script from the
command-line to generate the static site. I've done it in Bash
earlier too, but I ran into things that are just much easier in
PHP since it's built for generating HTML.
Oh, that's a clever notion! Hadn't thought of doing it that way.
On Fri, 13 Mar 2026 20:56:47 +0000
The Natural Philosopher <tnp@invalid.invalid> wrote:
Ditto - but adding PHP (or another preprocessor utility) to the mix
allows me to write the common sections (header, footer, nav.
sidebar) once, in a separate file, rather than having to update
them manually across every single page every time I need to change
something. It's not *as* useful when it's not happening
automagically server-side, but it still saves a lot of tedium.
You can do the same with javaScript
IMNSHO the use of client-side scripting to load and display static page content should be considered Objectively Wrong, so...nope.
On 2026-03-13 12:32, The Natural Philosopher wrote:
On 12/03/2026 19:44, Janis Papanagnou wrote:
On 12.03.26 20:03, The Natural Philosopher wrote:Beyond a very limited complexity, yes.
As with SQL I have always found it quicker to do anything complex,
in C, as it is in fact quicker than trying to do it in SQL, or
regexp, both in terms of design time and indeed execution time.
Are you saying here that if, for example, you have a pattern to match
then you would implement that natively in "C" than in regexp?
One point with repexps is that with them you are able to control
complexity for a very specific class of tasks; tasks that can be
described within a Chomsky-3 grammar or expressed by finite state
machines. A comparable explicitly programmed programming language
code (say, with a context free grammar) for a respective regexp is
usually clumsier.
It's very hard to documents a regexp .
A regexp is an expression from a language. It is a clear definition
with rules simpler than of a programming language.
But you can of course document the regexps you write if it gets too complicated (for you or generally). You can also compose regexps to
manage complexity. Or name them. - You have all options, similar to
the possibilities that you have in typical programming languages.
And, as with programming languages, you should learn the language!
But Regular Expressions are much simpler. While you may find slight differences in the meta-syntax the basic principle is the same.
[snip SQL topic]
Presumed I understood you correctly, then, frankly, you are obviously
just lacking the necessary expertise and blame Regular Languages (and
their uses and users) just due to ignorance.
Its not a matter of ignorance. That's what wannabe code gurus like to
say, because to them 'guru knowledge' is more important than getting
the job done on time, on budget and leaving code that can actually be
maintained.
(I already noticed that you have a very peculiar image in mind.)
I spoke about the necessity to learn languages, whether regular or
context free. And that lacking knowledge is just ignorance.
I'm aware that typical regular expression syntaxes appear cryptic.
(And I understand the reluctance to learn them.)
(To move that/your problem to "gurus" you met in your life appears
to be nothing but a red herring and is obviously only demonstrating
your unwillingness to learn or understand regexps.)
My point being exactly that to gain the expertise does not lead to a
practicable solution *anyway*.
Within the naturally given domain of Regular Languages you can use
them to quickly create usable (practicable) solutions in appropriate requirement contexts. (I do that all the time. They're really very
useful.)
There's nothing wrong notUnfortunately you have just made my point for me.
knowing every aspect of CS and IT, but your generalizing imputations
based on that are misguided.
I have always been under pressure to produce efficientÿ working
comprehensible and maintainable code in a short time.
And regular expressions are one part of it. - Of course, if you don't
know them, how to use them, what they are for, it may be a hindrance
to use them efficiently. - As said; you have to learn them. It's not different to other things in IT you have to learn. (You don't get it
for free, by divine inspiration, or else.)
Regexps simply don't fit the bill. Nor do overly complex SQL
statements. I tried both and gave up after I had already taken longer
to produce code that ran way slower than a custom solution in C did
There's even a video about it
"How on Earth does ^.?$|^(..+?)\1+$ produce primes?"
(This is not a Regular Expression; it uses back references. Just BTW.)
https://www.youtube.com/watch?v=5vbk0TwkokM
18 minutes of documentation to explain one regular expression
The same algorithm would be just a few lines of python or C and could
include comments
It wouldn't occur to me to use regexps to create (or match) primes.
I suggest to not use fancy Youtube videos but a book or basic tutorial
if you want to get knowledge on that topic.
Janis
Real life SQL, try to limit a big table query to a max of four
tables (ideally :-)), + use temporary tables and or cursors.
VAX Basic was widely used on major banking systems. Excel/VBA was
everywhere.
Chruch-Turing Thesis - different languages are just syntactic sugar.
IMNSHO the use of client-side scripting to load and display static
page content should be considered Objectively Wrong, so...nope.
Christ! There is so much religion here the odour of sanctity is
making me vomit...
On 13/03/2026 15:00, John Ames wrote:
On 13 Mar 2026 07:59:02 +1000There is no point in using PHP to generate a *static* site. It is after
not@telling.you.invalid (Computer Nerd Kev) wrote:
I've done the same thing using PHP, running the script from the
command-line to generate the static site. I've done it in Bash
earlier too, but I ran into things that are just much easier in
PHP since it's built for generating HTML.
Oh, that's a clever notion! Hadn't thought of doing it that way.
all for *active* sites.
IMNSHO the use of client-side scripting to load and display static
page content should be considered Objectively Wrong ...
On Fri, 13 Mar 2026 12:57:39 +0000, Pancho wrote:
Real life SQL, try to limit a big table query to a max of four
tables (ideally :-)), + use temporary tables and or cursors.
Real life SQL, use the EXPLAIN statement to find out where the
bottlenecks are in your query, and fix them.
On Fri, 13 Mar 2026 12:48:56 +0000, Pancho wrote:
VAX Basic was widely used on major banking systems. Excel/VBA was
everywhere.
Not any more, thank goodness.
Chruch-Turing Thesis - different languages are just syntactic sugar.
Ever wonder why we don?t write real-world computer programs using
Turing?s universal tape machine?
There?s a reason why ?computer science? and ?mathematics? are quite
different subjects ...
On 3/13/26 21:58, Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 12:57:39 +0000, Pancho wrote:
Real life SQL, try to limit a big table query to a max of four
tables (ideally :-)), + use temporary tables and or cursors.
Real life SQL, use the EXPLAIN statement to find out where the
bottlenecks are in your query, and fix them.
Yeah, in the late 1980s, my goal for career advancement was to learn how
to interpret query plans. I never really did. I mean I sometimes used
them to spot simple stuff like a missing index, but normally they
weren't that useful.
I was just watching a political YouTube thing with Yanis Varoufakis.
He reckoned the West was losing in the Ukraine war because they deindustrialised, couldn't actually manufacture weapons.
On 3/13/26 21:59, Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 12:48:56 +0000, Pancho wrote:
VAX Basic was widely used on major banking systems. Excel/VBA was
everywhere.
Not any more, thank goodness.
Chruch-Turing Thesis - different languages are just syntactic sugar.
Ever wonder why we don?t write real-world computer programs using
Turing?s universal tape machine?
No, I like syntactic sugar.
There?s a reason why ?computer science? and ?mathematics? are quite
different subjects ...
Ok, I don't understand that comment. Are Turing Machines mathematics
or are they Computer Science?
On 13/03/2026 12:57, Pancho wrote:
On 3/13/26 11:32, The Natural Philosopher wrote:+ use a bit of C code instead. The temporary table then becomes an array
On 12/03/2026 19:44, Janis Papanagnou wrote:
On 12.03.26 20:03, The Natural Philosopher wrote:Beyond a very limited complexity, yes.
As with SQL I have always found it quicker to do anything complex,
in C, as it is in fact quicker than trying to do it in SQL, or
regexp, both in terms of design time and indeed execution time.
Are you saying here that if, for example, you have a pattern to match
then you would implement that natively in "C" than in regexp?
It's very hard to documents a regexp . Or in fact a complex SQL
statement.
And in the latter case I replaced a complex SQL statement by a series
of simple statements and some C and the program ran at least 10 times
faster. (I never found out how long the SQL version ran because I
aborted it after 6 hours. The C example ran and gave me debugging
output, and once I had fined tuned it, it took about 40 minutes )
People teach or learn SQL from an ivory tower perspective.
Real life SQL, try to limit a big table query to a max of four tables
(ideally :-)), + use temporary tables and or cursors.
in C.
Obviously in the limit this breaks if you run out of memory, but 4
gigabytes of data is a hell of a lot.
It was enough to specify the name, address,ÿ postcode, borough, county
and country for every single person in Great Britain....
Which I had asÿ flat files, and wanted as a normalised data base.
Yep by cursors, I meant using a for each loop in a language like C.
Another fucking guru.
Bye
On Fri, 13 Mar 2026 12:21:29 -0700, John Ames wrote:
On Fri, 13 Mar 2026 19:02:02 +0000 The Natural Philosopher
<tnp@invalid.invalid> wrote:
Allows you to use the same language across the board. A bit
unorthodox, but I can see the use of it.
But 90% of my php is in fact straight HTML.
Ditto - but adding PHP (or another preprocessor utility) to the mix
allows me to write the common sections (header, footer, nav. sidebar)
once, in a separate file, rather than having to update them manually
across every single page every time I need to change something. It's not
*as* useful when it's not happening automagically server-side, but it
still saves a lot of tedium.
There is a learning curve but in Python the Flask framework pulls in Jinja
as the templating engine.
https://jinja.palletsprojects.com/en/stable/templates/#template-
inheritance
We had a programmer who loved PHP (Personal Home Page). I dipped into the code a couple of times trying to do minor fixes and it wasn't pretty.
On Fri, 13 Mar 2026 23:07:00 -0000 (UTC), Lawrence D?Oliveiro wrote:
The US has the weapons, it just has its own internal preoccupations
(particularly religious ones) to deal with, which don?t necessarily
align with the rest of the so-called ?West?. Like this stupid
distraction with Iran right now.
That goes back to the Reagan era. There were several highly placed people whose game plan was to get all the Jews in Israel to fulfill prophecy and bring on Armageddon and the Second Coming. I think assholes like Huckabee are still on that page.
Gibbon came to the conclusion that one of the main causes for the fall of
the Roman Empire was Christianity. That may be pertinent to the American Empire too. Why Europeans imported an Asian messiah escapes me.
Like it or not, the Europeans have to learn to be more independent of
the US. It means leaving that oh-so-pleasant post-World-War-II comfort
zone, that they have become addicted to over the last half-century or
so.
If the Europeans want to rattle their sabers it would help if they had
some sabers that weren't rusty and dull. Props to Meloni for saying 'Screw this.' She has bigger balls than Starmer but that's a low bar.
Muggeseggele describes his equipment.
https://en.wikipedia.org/wiki/Muggeseggele
On Fri, 13 Mar 2026 23:26:41 -0400, c186282 wrote:is a
If you need a web page to DO SHIT other than just sit there and look
pretty then you need PHP. I often used those 'make yer own page'
apps/CMS - cheap - to set up the HTML/pages ... the annoying stuff
... and then used PHP to add IQ. Worked well, fairly quick. Found
Joomla to be maybe the best compromise of features, though there
prior tobit of a learning curve compared to, say, WordPress.
Never used it. Our SPA used Angular. The browser based apps I did
the map being incorporated into the Angular project used Node.js/
Express.js on the backend and the Esri Javascript 3.x API on the fontend
for the map pieces.
I did a web app on the Pi yesterday. The Pi reads a I2C DHT11 sensor totemperature
get the inside temperature and humidity and publishes it so I can get the data in the browser on my main machine rather than switching to the Pi. Tomorrow I'll probably expand it to query NOAA for the outside
and humidity and add it to the page. Python/Flask.
fwiw, since the Flask package is included in the Pi's system sitepackages
I'm not in a venv. Also I spun off a process using subprocess.Popen("python", "dht_simple.py") with no problem. The
subprocess does the actual hardware read and updates the html.
I suppose PHP was better than FrontPage that used millions ofnon-breaking
spaces to format a page. Like Cobol there is still a lot of it around. However if I had a kid in college I would not advise them to use PHP.
https://kinsta.com/blog/php-vs-angular/
probably tl;dr. Synopsis:
"The Angular framework works excellent for building large-scale apps with complexity and need of scalability.
PHP is an old player, and it?s still very much in the game. It?s a good, low-cost option for you to develop a small business website, a portfolio site, or even an ecommerce store."
On Fri, 13 Mar 2026 21:59:47 -0000 (UTC), Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 12:48:56 +0000, Pancho wrote:
VAX Basic was widely used on major banking systems. Excel/VBA was
everywhere.
Not any more, thank goodness.
Chruch-Turing Thesis - different languages are just syntactic sugar.
Ever wonder why we don?t write real-world computer programs using
Turing?s universal tape machine?
There?s a reason why ?computer science? and ?mathematics? are quite
different subjects ...
'Computer science' is ambiguous and in some cases refers to rarefied abstractions that are fairly useless. There should be 'practical
programming' or some other discipline that I don't think falls under mathematics.
I think that goes back to the '60s. RPI and many other colleges did not
have a CS program. I forget what the course designation was for FORTRAN IV programming but they didn't know what to do with it and put it in the math department.
Apropos, Tony Hoare died last week but Quicksort lives on.
On 2026-03-13, Pancho wrote:
On 3/13/26 21:59, Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 12:48:56 +0000, Pancho wrote:
VAX Basic was widely used on major banking systems. Excel/VBA was
everywhere.
Not any more, thank goodness.
Chruch-Turing Thesis - different languages are just syntactic sugar.
Ever wonder why we don?t write real-world computer programs using
Turing?s universal tape machine?
No, I like syntactic sugar.
There?s a reason why ?computer science? and ?mathematics? are quite
different subjects ...
Ok, I don't understand that comment. Are Turing Machines mathematics
or are they Computer Science?
They're computer science which is mathematics.
The complexity or simplicity or convenience or lack thereof of using
Turing's machine definition is probably irrelevant here. I suppose the
point Pancho wanted to allude at was precisely that the
platform/language doesn't matter to determine what's doable or not, at
least provided that the languages involved are Turing-complete.
If the Europeans want to rattle their sabers it would help if they had
some sabers that weren't rusty and dull.
On 3/13/26 21:59, Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 12:48:56 +0000, Pancho wrote:
VAX Basic was widely used on major banking systems. Excel/VBA was
everywhere.
Not any more, thank goodness.
Chruch-Turing Thesis - different languages are just syntactic sugar.
Ever wonder why we don?t write real-world computer programs using
Turing?s universal tape machine?
No, I like syntactic sugar.
There?s a reason why ?computer science? and ?mathematics? are quite
different subjects ...
Ok, I don't understand that comment. Are Turing Machines mathematics or
are they Computer Science?
We had a programmer who loved PHP (Personal Home Page). I dipped into the code a couple of times trying to do minor fixes and it wasn't pretty.
On Fri, 13 Mar 2026 21:59:47 -0000 (UTC), Lawrence D?Oliveiro wrote:
On Fri, 13 Mar 2026 12:48:56 +0000, Pancho wrote:
VAX Basic was widely used on major banking systems. Excel/VBA was
everywhere.
Not any more, thank goodness.
Chruch-Turing Thesis - different languages are just syntactic sugar.
Ever wonder why we don?t write real-world computer programs using
Turing?s universal tape machine?
There?s a reason why ?computer science? and ?mathematics? are quite
different subjects ...
'Computer science' is ambiguous and in some cases refers to rarefied abstractions that are fairly useless. There should be 'practical
programming' or some other discipline that I don't think falls under mathematics.
I think that goes back to the '60s. RPI and many other colleges did not
have a CS program. I forget what the course designation was for FORTRAN IV programming but they didn't know what to do with it and put it in the math department.
On 3/13/26 23:19, rbowman wrote:
Apropos, Tony Hoare died last week but Quicksort lives on.
ÿ "Computer Science" has very little do do with
ÿ practical apps. It's closer to, but not quite,
ÿ Pure Math and Stats. It CAN inform practical apps,
ÿ but, really, not so much these days.
ÿ Employers need not hire CS people, waste of money.
ÿ CS *may* have some utility in the developing quantum
ÿ realm however. We'll see.
ÿ [...]
ÿ Yes, I've bitched about Python here, recently, but
ÿ it's still mostly much better than Bash or CSH.
ÿ Those shells were built-up over time ... adding
ÿ ever more weird symbols and syntatic oddities to
ÿ expand the 'language' until they make NO sense
ÿ except for the simplest things.
We had a programmer who loved PHP (Personal Home Page). I dipped into
the code a couple of times trying to do minor fixes and it wasn't
pretty.
On 14 Mar 2026 02:35:23 GMT
rbowman <bowman@montana.com> wrote:
We had a programmer who loved PHP (Personal Home Page). I dipped into
the code a couple of times trying to do minor fixes and it wasn't
pretty.
Definitely would not class it as one of my favorite languages (and I've
heard tell that it was even jankier in the Bad Old Days,) but for
simple HTML preprocessor duties it does the job well enough. If I were
trying to build any kind of large-scale Web application I'd probably be
more inclined to think about my options and choice of tooling.
On 14 Mar 2026 02:35:23 GMT
rbowman <bowman@montana.com> wrote:
We had a programmer who loved PHP (Personal Home Page). I dipped into
the code a couple of times trying to do minor fixes and it wasn't
pretty.
Definitely would not class it as one of my favorite languages (and I've
heard tell that it was even jankier in the Bad Old Days,) but for
simple HTML preprocessor duties it does the job well enough. If I were
trying to build any kind of large-scale Web application I'd probably be
more inclined to think about my options and choice of tooling.
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 5 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 117:51:30 |
| Calls: | 125 |
| Calls today: | 125 |
| Files: | 489 |
| D/L today: |
859 files (365M bytes) |
| Messages: | 76,472 |
| Posted today: | 26 |