News for hackers. Stuff that matters.
Re:The Fall of Stack Overflow by newaccount74 on Tuesday July 25, 2023 @03:09AM (#36858976)
The very popular Zalgo answer is a perfect example of this problem [1]

The user asks a question that can be answered quite easily, and dozens of people post answers claiming that this is the wrong way to do it and that they should use some other tech to solve the problem.

Some people on Stack Overflow care more about showing off how smart they are rather than answering questions, and I think the point system attracts these people.

[1]: https://stackoverflow.com/questions/1732348/regex-match-open...

Re:The Fall of Stack Overflow by cowthulhu on Tuesday July 25, 2023 @03:41AM (#36859203)
Hilariously, the accepted (I assume by default, not by the asker) answer is flagrantly breaking, like, half a dozen rules and guidelines… but because it’s cynically and unhelpfully crapping on a newbie, it stays up. Or maybe there’s a good reason for it to stay up, but at a glance it sure is t a good look.
Re:The Fall of Stack Overflow by underdeserver on Tuesday July 25, 2023 @04:29AM (#36859523)
Oh come on, it's not crapping on a newbie. It's a funny comment that serves as a reflection of the days and weeks this guy spent debugging these kinds of systems.

As someone who was a newbie at the time when it was posted, who was looking for a way to parse HTML, I took away that it's just really the wrong way to go about it. I didn't feel crapped on at all.

Re:The Fall of Stack Overflow by stavros on Tuesday July 25, 2023 @04:58AM (#36859749)
The question isn't looking to parse HTML (or XML). Regexes are inappropriate for HTML because they can't adequately match the starting and ending tags, not because of black magic. The OP isn't looking to do that, so regexes look like a perfectly acceptable way to go.
Re:The Fall of Stack Overflow by underdeserver on Tuesday July 25, 2023 @03:36PM (#36868146)
I agree completely.

But the asker is very clearly a newbie. The question does not contain further context. The asker's suggestion is wrong (I think). And we've all worked with junior engineers who try to use the wrong tool.

The answer is a whimsical way of making an appropriate suggestion in this inferred context.

Also, to be fair, I think it's not mathematically impossible to use dark regex magic (with look-behinds and such) to parse HTML, but that's a discussion for another day...

Re:The Fall of Stack Overflow by bazoom42 on Tuesday July 25, 2023 @07:44AM (#36860894)
The question is about tokenizing XHTML, not parsing it into a DOM, which is a critical distinction. Regular expressions are a perfectly valid way to tokenize. This is why the snarky answers does not suggest a better solution - there isnt one!

If you scroll down long enough, you will see answers explaining that. But they arent upvoted as the answers suggesting the questioner is an idiot.

Re:The Fall of Stack Overflow by pasc1878 on Tuesday July 25, 2023 @04:54AM (#36859715)
No accepting an answer can ONLY be done by the person asking the question.
Re:The Fall of Stack Overflow by borland on Tuesday July 25, 2023 @04:56AM (#36859737)
That answer is only there because it's really old, from the early days of S.O. where people were allowed to ask questions that weren't super serious binary yes/no style. It'd get moderated and deleted in a heartbeat today. A forlorn monument to the cool place that S.O. once was
Re:The Fall of Stack Overflow by umanwizard on Tuesday July 25, 2023 @07:46AM (#36860913)
Maybe I’m just a fun-hating asshole but personally I find this kind of thing annoying, not cool. People are just trying to get work done, not see someone’s attempt at cringey “nerd culture” humor.
Re:The Fall of Stack Overflow by the_af on Tuesday July 25, 2023 @08:27AM (#36861250)
You agree with SO: those answers are no longer allowed, and haven't been for years. They are only kept as historical artifacts, and marked as such.
Re:The Fall of Stack Overflow by eitland on Tuesday July 25, 2023 @10:08AM (#36862477)
That is not what most of us complain about I think.

I and I think many other are sad that S.O. removes many serious work related questions (have lost count of how many times I saw the perfect question with the perfect answer, with a note that this isn't what Stack Overflow is made for and these questions only exist for historical reasons).

Re:The Fall of Stack Overflow by Etheryte on Tuesday July 25, 2023 @05:24AM (#36859898)
The answer can only ever be accepted by the asker, not even mods can change that. It's actually not that rare that the accepted answer is not the one with most votes in which case the accepted answer is somewhere further down, not the first one on top.
Re:The Fall of Stack Overflow by cowthulhu on Tuesday July 25, 2023 @03:07PM (#36867739)
Oops, you’re right! I was totally misremembering.
Re:The Fall of Stack Overflow by mihaaly on Tuesday July 25, 2023 @04:07AM (#36859382)
Ironic, as answering an other question ("What alternatives are to do X?") instead the original one is not indicating smartness at all.
Re:The Fall of Stack Overflow by Lutger on Tuesday July 25, 2023 @05:40AM (#36860002)
The question explicitly invites the kind of witty reflection shown in the accepted answer, by adding: "and what do you think?"

As mentioned elsewhere, this is an old question and both the kind of question and answer wouldn't be allowed these days.

However, I also fundamentally disagree that questioning the assumptions in a question is unhelpful. You want to solve a problem, find an approach and want help because you have problems with the approach? What if the approach you took _is_ wrong? Its very helpful especially for advanced beginners or at the intermediate level, to be given a different way of solving the problem even if that is not what you asked.

It depends on context if this is just pedantry or genuinely helpful. The best answers I found start with answering the question that was stated, but then proceed in showing how the problem behind the question can also or better be solved.

Re:The Fall of Stack Overflow by umanwizard on Tuesday July 25, 2023 @07:48AM (#36860926)
“You didn’t actually want to do X, here’s how to do Y instead” may indeed be helpful for the beginner who initially asked the question, but it’s very unhelpful for me who finds the page years later actually wanting to do X.
Re:The Fall of Stack Overflow by waterproof on Tuesday July 25, 2023 @08:52AM (#36861492)
I disagree- on SO you’ll usually get some literal answers as well as the more high-level, question-the-premise ones. Why not both?
Re:The Fall of Stack Overflow by umanwizard on Tuesday July 25, 2023 @09:35AM (#36861987)
Because in many cases people don't bother giving the real answer once a comment already has an answer, especially a highly upvoted one.

I'm fine with indirect, "question-the-premise" comments, but they should be posted as comments, not answers, because they are in fact not answers.

Re:The Fall of Stack Overflow by _gabe_ on Tuesday July 25, 2023 @03:11PM (#36867795)
> “You didn’t actually want to do X, here’s how to do Y instead” may indeed be helpful for the beginner who initially asked the question

Stack Overflow isn't a site for beginners, it's for "professionals". At least, that's what all the Stack Overflow defenders tell me every time I criticize the snarkiness, rudeness and patronizing manner of many answers/comments you receive on Stack Overflow.

Re:The Fall of Stack Overflow by Yajirobe on Tuesday July 25, 2023 @08:12AM (#36861117)
> If you parse HTML with regex you are giving in to Them and their blasphemous ways which doom us all to inhuman toil for the One whose Name cannot be expressed in the Basic Multilingual Plane, he comes.

Jesus this is cringe

Re:The Fall of Stack Overflow by zeroonetwothree on Tuesday July 25, 2023 @10:34AM (#36862862)
I thought it was amusing. Reminds me of a lot of 90s internet humor.
Re:The Fall of Stack Overflow by RHSeeger on Tuesday July 25, 2023 @11:38AM (#36863923)
To be fair, that question was written during a period when "how do I parse this html with regular expressions" was asked multiple times per day. And "regular expressions are not a reasonable tool to do that, use a parser" was the correct response to 99% of them. And, at some point, someone decided to throw out a more amusing version of that response. It _was_ funny at the time.
Re:The Fall of Stack Overflow by waterproof on Tuesday July 25, 2023 @08:48AM (#36861440)
In this case, the question actually says “and more importantly, what do you think?”

So the answer is actually on topic.

It may be a bit… stylistically unusual, but I think I came away with a pretty good idea of what the answerer thinks.

Re:The Fall of Stack Overflow by usrbinbash on Tuesday July 25, 2023 @09:44AM (#36862101)
> and dozens of people post answers claiming that this is the wrong way to do it and that they should use some other tech to solve the problem

Yes, and they are factually correct in doing so. The correct answer to the question: "How do I use a hammer to tighten a screw" isn't a lengthy description of how to perform some magic with a hammer. The correct answer is: "You don't. Use a screwdriver."

HTML isn't parseable with regex. The various answers under the question explain in great detail why [1] that is the case.

SO isn't a help forum, it's a question archive. The purpose of an answer isn't to solve one guys specific question, but to provide an answer that is useful to all people who ever stumble upon this question.

[1]: https://stackoverflow.com/a/1758162/19508364

Re:The Fall of Stack Overflow by anter on Tuesday July 25, 2023 @10:40AM (#36862958)
> The correct answer to the question: "How do I use a hammer to tighten a screw" isn't a lengthy description of how to perform some magic with a hammer. The correct answer is: "You don't. Use a screwdriver."

My car broke down in the middle of the desert because of a screw that came loose and all I have is a hammer. You have just condemned me to death because you assume you know better.

Re:The Fall of Stack Overflow by firesteelrain on Tuesday July 25, 2023 @10:25AM (#36862711)
Your response and the other responses are proving our point. It wasn't about context free grammars, level 2 or level 3, etc. It was a very limited subset of a problem. Answer should have been, "while I don't recommend doing it the way you want to do it, that should work for your limited subset".
Re:The Fall of Stack Overflow by usrbinbash on Wednesday July 26, 2023 @07:50AM (#36876155)
> Answer should have been

Yes, and answers on that very page, with lots of upvotes, do exactly that. People looking for answers online, can reasonably be expected to scroll down a page with results.

Re:The Fall of Stack Overflow by BeetleB on Tuesday July 25, 2023 @11:56AM (#36864250)
> HTML isn't parseable with regex.

Poster is not asking for this. He is asking how to parse a specific subset of HTML. And it is demonstrably parseable.

> The correct answer to the question: "How do I use a hammer to tighten a screw" isn't a lengthy description of how to perform some magic with a hammer. The correct answer is: "You don't. Use a screwdriver."

It is not the appropriate way to tighten a screw, but there likely is a correct way to do it with a hammer.

It is fine to point out that there are better ways to parse that HTML, but it is not wrong to do it with regexes.

Sorry to be blunt, but having coworkers like you make the job really annoying. I'm not a newbie, but a seasoned programmer. If I'm asking a question and am in a domain with a fair amount of experience, don't give me patronizing answers.

Re:The Fall of Stack Overflow by usrbinbash on Wednesday July 26, 2023 @07:55AM (#36876200)
> Poster is not asking for this.

Poster is not the one answers are for. Answers are for everyone who stumbles upon this question in the future, and the general topic of the question is very much about parsing some HTML with regex.

Again: SO != Help FOrum

> but there likely is a correct way to do it with a hammer.

No, there isn't. Because the correct way is to use a screwdriver. There is certainly a way to do it with a hammer, same as there is a way to write a webserver in brainf__k. Doesn't mean that way is good or should be done.

> Sorry to be blunt, but having coworkers like you make the job really annoying.

Bluntness is fine. I will be blunt as well: Having to fix code full of hammers used to tighten screws is a lot more annoying than having colleagues who try to prevent that from happening in the first place.

Re:The Fall of Stack Overflow by marcosdumay on Tuesday July 25, 2023 @12:08PM (#36864486)
Nothing on that questions makes me think the person asking it wants to parse HTML. Most HTML parsers will never give the result the question described. And unless you want to dig into tar structure, solving that question is an essential part of creating a parser.

So, no, the top 3 answers are all bullshit.

Re:The Fall of Stack Overflow by bazoom42 on Tuesday July 25, 2023 @05:56PM (#36870152)
> HTML isn't parseable with regex.

The questions isn’t about parsing, the question is about recognizing a token.

Re:The Fall of Stack Overflow by tlogan on Tuesday July 25, 2023 @09:45AM (#36862110)
The funny thing is that the person who worted top voted answer is not smart all. He might look smart for a newbie but the question is about tokenizaion and not about parsing.

So here is the reason: the top voted answers are wrong.

Re:The Fall of Stack Overflow by diemechanist on Tuesday July 25, 2023 @10:16AM (#36862590)
> "Some people on Stack Overflow care more about showing off how smart they are rather than answering questions, and I think the point system attracts these people"

"Some" is an understatement.