28

I came upon it by complete accident when looking at some question that asked for validating IP addresses in JavaScript. The following solution was proposed in an answer:

function ValidateIPaddress(ipaddress)
{
  if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(myForm.emailAddr.value))
  {
      return (true)
  }
  alert("You have entered an invalid IP address!")
  return (false)
}

It...does stuff. I tried to just copy/paste it in the browser console and see if it works. Imagine my surprise when it didn't. But not because the regex was wrong; it didn't work because it didn't know what myForm.emailAddr.value was. I scrolled all the way to the right to see that it's indeed checking something called myForm.emailAddr.value against the regex. But the question most definitely didn't have any such HTML.

So, coupled with the peculiar style with which it was written, it became clear it was not written by the answerer. I decided to look for the original...and there are many:

But "WAIT!" I hear you say, "Those are about emails" you exclaim. Yep, they are. They just all use the myForm.emailAddr.value string. The other common thing between them is that it's the same code. Some of the answers (marked with an asterisk) actually give appropriate credit to the site W3Resources for the code. The others copy pasted it from there or from here. It's not very clear.

But let's get back to the IP address thing:

These last two give a link to W3Resources again, but this time an article on IP addresses. It appears the author(s) of W3Resources itself did a copy/paste error when they've taken the function from their email article. And now we find their frankly not very good code all over the place.

Regardless of the quality of the code in the article, answers that use the code are usually very bad:

  • just a code dump
  • sometimes doesn't even solve the problem asked for
  • even if copy/pasted to the correct question, the code doesn't work unless you modify either it or your other code to accommodate where it reads the data from
  • no attribution

The last one is honestly what bothers me the most...although the rest don't help, either. At least some answers have taken the code and explain what it does. That seems fine. The ones that link to the article are also "OK". Not great but at least there is attribution and you can go read the article for explanation.

Should we do anything about these? If so, then what--just downvote and that's it?

Note that I suspect there are a lot more instances of this code. I'll continue searching and update them later.

2
  • 2
    I'll continue searching and update them later. What for? Trying to kill some time? ;) I do not see a benefit in such a list.
    – Ctx
    Commented Jan 24, 2020 at 15:16
  • 2
    @Ctx sort of kill time and also because I think it would be helpful to have a (more) complete list. I suspect some people might have, at the very least, fixed the code so it at least works. This corrected code would not be found by looking at the search string I used. They'd still be copies potentially without attribution.
    – VLAZ
    Commented Jan 24, 2020 at 15:31

1 Answer 1

20

When you run into something that might resemble "no attribution", simply flag for moderator attention, and explain that. Obviously, you should provide a link to the "original" piece of code/art/text ... you consider to be the source.

This is actually a nice way to A) bump your "helpful" flags counter and B) uphold quality ... sometimes being bored, I walk through NAOQ. Not to look for badly written new user answers. But for newbie answers that look really nice. When you find such a gem ... copy some part of the answer into your favorite search engine. Very often, that will lead to another long existing answer from Stack Overflow or Quora or some other place where the newbie just stole their content from.

Next step is to then scrub the profile of that newbie, typically, they do that repeatedly. They either drop the same answer, or steal other answers to "answer" other questions.

So, long story short: flag the answer, and let the moderators make the call.

When it is just a "sloppy" answer with bad code: downvote, and write a comment why you did that.

12
  • 2
    My issue here is the sheer number of copies. Should I flag each? Should I flag one and add links to the rest? The former probably makes a lot of work for mods, they might prefer dealing with this in bulk. The latter might instead have the opposite problem. Hence my question here to see what is better. Not sure how usual this situation is, I imagine it shows up from time to time.
    – VLAZ
    Commented Jan 24, 2020 at 15:36
  • 2
    @VLAZ There are millions of questions and answers on the main site. If we would be serious about addressing quality issues, sure: that would mean that we thousands and thousands of flags would need to be raised. What I did: when I notice a repeating pattern for one user, I simply flag one of those, and include links to similar posts in the flag message. One flag, pointing to multiple posts ...
    – GhostCat
    Commented Jan 24, 2020 at 15:43
  • 1
    Yeah, plagiarism is rampant. On this Quora question several answers were copied straight from blog posts. For instance, Keshav Infotech's answer (yes, a company name - "PHP Web Development India") was wholesale plagiarised from Tom Ewer's blog post Web 2.0 Made Awesome: 9 Best WordPress Comments Plugins. Commented Jan 24, 2020 at 23:08
  • 1
    cont' - They were flagged at the time, but obviously Quora doesn't take it seriously. Commented Jan 24, 2020 at 23:08
  • 1
    Re "for newbie answers that look really nice": Yep, here is an example I stumbled upon today: An answer on Stack Overflow which consists almost entirely of plagiarised content from two places, www.git-tower.com (2013?) and a 2015 Stack Overflow answer. Commented Jan 26, 2020 at 18:43
  • 1
    @PeterMortensen Makes you think. meta.stackexchange.com/questions/171876/… ... but alas, what would SE Inc. gain from automatically detecting such things ...
    – GhostCat
    Commented Jan 26, 2020 at 18:56
  • @CodyGray Totally unrelated ... but wondering: have there ever been discussions within the SO moderator community, like to all mods going on strike, or suspend?
    – GhostCat
    Commented Jan 28, 2020 at 13:21
  • 1
    No, there haven't been any "mass strike" discussions. There was one point when a large number of us felt like resigning on the spot, but cooler heads prevailed, and we're trying to have a dialogue with the employees/management to see if we can't resolve our concerns first before we take a nuclear approach. I don't think going on an outright strike is going to resolve anything. That said, it's definitely true that many of us have reduced our activity, for a variety of reasons.
    – Cody Gray Mod
    Commented Jan 28, 2020 at 18:01
  • Thank you very much. And I assume you wouldnt seek dialogue if you had the feeling that doing so would be fully futile.
    – GhostCat
    Commented Jan 28, 2020 at 18:18
  • Another case of plagiarism (only visible with more than 10,000 reputation points). Commented Apr 16, 2020 at 16:03
  • 1
    @PeterMortensen The question you linked to is visible to anyone as it is not deleted. I'm assuming you meant to link to this answer?
    – TylerH
    Commented Apr 16, 2020 at 16:08
  • @TylerH: Yes, correct. Commented Jul 21, 2021 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .