• HStone32@lemmy.world
    link
    fedilink
    arrow-up
    84
    ·
    8 days ago

    SO in a nutshell:

    “I need to do X”

    “Have you tried Y?”

    “No, because I don’t need Y, I need X.”

    “Well you can do Z if you can’t do Y.”

    “OK, sure. But how do I do X?”

    “Why do you need to do X?”

    (Explains why in my hyper-specific situation, I need to do X, and Y and Z won’t work)

    This question has been marked as a duplicate of “How to do Y”

    • purplemonkeymad@programming.dev
      link
      fedilink
      arrow-up
      15
      ·
      8 days ago

      Except in 99% of cases the person is asking an xy problem, and if they ever explained the why, they would get a proper answer.

      Often the reason no one does the hyper-specific thing, is that there are better non code solutions, it’s massively insecure, or is just stupid micromanaging.

      • HStone32@lemmy.world
        link
        fedilink
        arrow-up
        10
        ·
        8 days ago

        You know, when I typically ask a question on SO, its because I want to learn how that thing works, or how to write it myself. I usually say as much, but the SO folks are too focused on the ends, they completely neglect the means. Chances are I’m already aware of that no-code solution, but that’s not what I’m asking for.

        • orcrist@lemm.ee
          link
          fedilink
          arrow-up
          4
          ·
          8 days ago

          I think there’s an element of responsibility that some people feel when they respond. If you’re asking for a very niche solution that is likely to create other problems in the future, should anyone else look at your code or refactor it or rely on it, or should you forget how it works, perhaps people are going to be less inclined in helping you craft it.

          If you still want to craft it, that’s okay, but you have to expect that some real percent of the answers are going to be those folk who know what the tried and true solution is, often because they’ve lived through the reality that you’re attempting to create and they’ve dealt with the aftermath of doing it special and different.

        • purplemonkeymad@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          8 days ago

          Which is fine when people do not reject the answers that are different from what they were expecting. Learning that the problem you have is a reason that noone does this, is a valid thing to learn.

          It’s usually when I see people moving the goal posts on replies, or complaining that they didn’t answer the exact question that i see as frustrating. Or “I don’t want to do that” with no more info.

          But if you are aware of other solutions, you should state that in the question and give your reasons. It’s a waste of time if you know someone might suggest what you have dismissed already.

          The html question is a classic for this, they want to find non self closed tags. Why? Why can’t they use a parser? What are they doing with this info? All questions that would give you a good idea on how the problem can be solved. Playing with regex would be a valid answer to that, but is not stated. Unfortunately I find so’s format discourages extra interrogation.

          The answer is not an attack on the person, but a frustration at the people before that ignored previous answers to use a parser.

      • JackbyDev@programming.dev
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        8 days ago

        and if they ever explained the why, they would get a proper answer.

        That’s funny, every time I’ve explained in detail why my question isn’t a duplicate nobody fucking cares and it still gets closed.

    • winterayars@sh.itjust.works
      link
      fedilink
      arrow-up
      10
      ·
      8 days ago

      I would say it’s more like: “How can I do X?” “Here are some reasons you can’t do Y.”

      The answers should have been “Here are some reasons doing X is hard, but here’s an attempt at it anyway and also some more robust alternatives to doing X.” That would have been an excellent answer. (If you go down far enough you do start to see things like this but they’re hindered by people still responding that you can’t do Y or downvoting because they don’t understand what’s happening.)

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      ·
      edit-2
      8 days ago

      More like:

      • How can I do X?
      • Marked as duplicate of “How can I do Y?”

      Edit: I’ve got insomnia and don’t have my glasses on and misread the end.

  • listless@lemmy.cringecollective.io
    link
    fedilink
    arrow-up
    40
    ·
    9 days ago

    https://www.zalgo.org/

    T̸̛̟͚͋͛̈̊͜͝Ờ̶̤̫̦͙̜̫͇͕͈̘̭̈̑̓̀̈́̌͊͛̆͐̌̈́͝ͅN̸̯̫̺̄̿̎͗͗́͜Y̷̢̱͚̖̤̠̞͉̅́̋̉̿̇̎̋͆͝͝ ̸̧̡̨̧̡̛̖̤̜͔̲̯̞͉͈̻̎̈̄̓̊̄́̕͘͝͠ͅT̷͎̝͌̅̔̓̒H̷̨̧̧̳̱̜͓̮͍̣̬̩̜̙͚̑̌́̑͋̽͗̎͑̊͛̍́͒̕͝͠Ḙ̵̥̥̘̻͔͛̑͒̿͋͝͝ ̶̡͚̬͈̏͌̓̔̈̔̀͌̔̓̾̓͘͝P̷͙̃́̈͐̆̂́͗̏͌̈́Ô̶͎͓̹͖̘̟̬͚̻̦̩͔͛͜͠ͅŅ̶͖̜̱͍̦̔̊͐͆̾̎́́̈́̄̓ͅẎ̸̨̭̜̼͎̜̜͕̥͙̼̤̟̞̄̊̂́ͅ ̴̡̡̛̲̟̳̯͔̝̟͙̌̽͋̏̾̆̅̏̐̅͑̿̀͒̉H̵̪̞̩̥̫̺̅̑̈́̾͌͛́̾̅̈͛͒̾̌̈͐͝Ȅ̶̘̲͙̖̬̞͕̱͍̥͈̦͈͍͔̩̑̒̐̇̑̈́̏͊̽͜͝͝͝ ̸̨̛̛̻̘̙̯̰̦̻͈͓̒̽̉̈̄̌̄͊͂̈͆ͅC̵͙̗̣̮͈̜̪̞̰̣͎̙̏̌̄͗͜Ȯ̸͇̖̼͈̗̝͔̜̘̲̦̦̾̃̆̍͝͝ͅM̷̨̧̮͕̠̘̔ͅÉ̶̡̡̢̡͕̺̗̩̝̩͇͓̄͐͆͛̔̈́̕͜ͅS̵̡͙̬͔̞̞̳͓̜͔͑̌̓̎͆͌̈͌̌̂͛̚͘͝

    • SpaceNoodle@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      9 days ago

      d̶̢̢͖͉̪͖̠̹͇̺̜̼̦̗͍̓̅̊̋́̌̈́̌̐͐̔̅̄̚͜͝ͅͅȍ̷̢̧̦̼͉̝̦͓͖̽͜ǫ̷̫̤͐̀̾̈̇́̈́͛̐̔̀͜͜͝͝͠k̸̩̠̥̦̤̜͈͎̖̜̪̘͚̖̫̝̝͛̈́̇͒͜͝ͅì̷̧͈̥͇̤̝͈̹͕̽̑͌̐́̓̈́̈́ȩ̴̘̠͍͎̜̝̰̼̝̭̹͖͇͚̦͈̼̑̊͗́́̒͐̂̂̾̊̀͜͝

  • communism@lemmy.ml
    link
    fedilink
    arrow-up
    30
    ·
    8 days ago

    OP isn’t trying to parse HTML though… they are trying to detect opening xml tags. Which seems quite achievable with regex.

    • winterayars@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      8 days ago

      It’s still actually pretty sketchy, depending on exactly what you want to do. Strict regex still won’t be able to match correctly if you want to match what an HTML parser considers the opening tag, though fancier regex will. If you’re just looking for the tags in the HTML document as a flat document it’s doable, though. (Mostly.)

  • OpenStars@startrek.website
    link
    fedilink
    English
    arrow-up
    13
    ·
    9 days ago

    Calendar, remind me to ask StackOverflow tomorrow if I can parse HTML with regexs get someone else to do my class homework for me?

    TH̘Ë͖́̉ ͠P̯͍̭O̚​N̐Y̡ H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ

    Sweet, my summoning spell worked!

  • Nariom@lemmy.world
    link
    fedilink
    English
    arrow-up
    8
    ·
    8 days ago

    I once applied to an internship for a company doing job offers aggregation. During the interview they explained to me that the core of what they did was parsing (partial) html with regex. When I asked why they wouldn’t develop a custom parser, they replied to me that they were working on it, but that the internship wouldn’t focus on that. I was not disappointed when it didn’t get the job.

  • fluckx@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    8 days ago

    So all the misery in the world is related to webdevs trying to parse html with regex?

    You bastards.

  • solrize@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    8 days ago

    There is a famous Erik Naggum rant about XML at, no wait, I better not link it but you can find it with a search engine if you want, which means you don’t get to complain to me about it since you are the one who went looking for it. Very NSFW and VERY politically incorrect. Naggum died in 2009 but anyone who published a thing like that today would be raked over the coals.

  • orcrist@lemm.ee
    link
    fedilink
    arrow-up
    5
    ·
    8 days ago

    I’m not a professional code monkey although I’ve done a fair amount of coding, and every time I tried to do parsing myself, I later regretted it.

    But telling people that they’re doing it wrong is rarely met with positivity. :-)

  • kbal@fedia.io
    link
    fedilink
    arrow-up
    4
    ·
    9 days ago

    Using a regex on html is like eating wild mushrooms that you found in the woods. There are times where it’s appropriate and safe, other times where it’s completely insane and possibly deadly, and it takes considerable experience to know how to tell the difference.

  • fubo@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    8 days ago

    Once you learn about parser combinators, all other parsing looks pretty dopey.