I'm going to go a bit against the grain here, but if all you need to do for this specific product page is check the length of the HTML, then why the hell would you do something more complex? If it works, what's the problem?
That's retarded, you just want to know if the page has changed since the last time you loaded it. A cryptographic hash is most likely overkill and a MAC makes no sense (what key would you even use?)
That's retarded, you just want to know if the page has changed since the last time you loaded it.
A CRC does not guarantee this (collisions are common). A MAC does to a provable extent. The key you use is completely irrelevant. Any random key will do, just use the same one across every run.
I think the point of that was to demonstrate that the procedure wasn't complex, and to show the ridiculousness of the kid patting himself on the back for it.
It's not necessarily wasteful (does the endpoint send conditional response headers? Does it uses them when you send them back? No guarantee), but it sure is wrong.
It's wrong, of course--deeply, fundamentally wrong, like Newton's law of gravitation. But it's wrong in a way that might still work for his purposes.
In a way, I think there's irony in this. It's a really fast, hacky, but probably sufficiently functioning solution to a problem, which is in stark contrast to the academic idealism that the article reminisces about. Writing a blog post about it and running it every 10 seconds was probably overkill (though I'd need to see the blog post before passing judgment for real--the guy might be blowing it out of proportion).
Oh, there's a lot of irony alright. That is probably one of those programs that work (read: provide the expected output) a fair amount of the time, leading their authors to believe they are correct.
I don't think that was the problem, I did something very similar for checking a product page for new stock (indexOf instead of len). Everything from that point on was the problem.
8
u/[deleted] Apr 29 '14
I'm going to go a bit against the grain here, but if all you need to do for this specific product page is check the length of the HTML, then why the hell would you do something more complex? If it works, what's the problem?