- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
s2 = s1.Replace("?", "");// still frist - can be posted
Admin
"An exception handler that does nothing but show the error in a message box is also bad."...
But that is not the case here. The exception "handler" does two things... It also converts a proper exception to a return value which can (and likely will) be ignored...and that is the WTF...
If the [pseudo code] was:
catch exception { MessageBox(....); throw; }
If it only showed the error message and then proceeded exactly as if it was not there, then it might still smell, but at least the sentence used in the article would not have been a WTF in and of itself.
Admin
It leaves the result false, which isn't really an action. So yes, it only displays and then discards the Exception.
Admin
And you still missed one:
This thing eliminates newlines, because ReadLine() doesn't include them.
Admin
You think ignoring a boolean "success" return value is okay? Because it isn't.
Admin
But this function is designed to only read files with all lines beginning with INS so that the newlines remain.
Admin
articleText = articleText.replace('well', 'will');
Admin
articleText1 = articleText2.replace('well', 'will'); articleText2 = articleText1.replace('oone', 'one');
Admin
Still empty... after all these years.
Admin
"But this function is designed to only read files with all lines beginning with INS so that the newlines remain."
Well, except that it will insert a blank line before the first one...
Admin
"imagine if you well"
Shouldn't that be "imagine if you will"?
Admin
The one that stuck out to me was the second line of the replaces:
s1 = s2.replace("", "");
replace an empty string with an empty string???
Admin
Looks like this to me:
s1 = s2.replace("!", "");
... although the instance used of the font for the bang makes it look a little odd.
Admin
"still empty - can be used": Note that the replacements switch from s1 to s2 and back. It seems that there was a time where the last replacement was undefined (s2 = s1.Replace("", "");) in order to have the result in s2, and that later it was used without removing the comment with the invitation.
Admin
This is what I see:
s1 = s2.Replace("", "");
The initial character looks like a box, but I suppose it could be any unprintable character.
Admin
Except that in that case the first line now becomes an empty line. Oh, well, close enough. :D
Admin
Fuck all of you pussy ass niggas. This is the best code in the world.
Admin
TRWTF is loading an entire file into memory and doing so line by line. That works until you end up with a file a couple hundred MB in size and it chokes on the replacements if not the reads.
Admin
Copying and pasting into NP++ I get a unit separator.
Admin
"At a guess, I think this must have something to do with OCR, right? It sounds like it"
Yes, it's used to clean files after an OCR. Since all there is to read are numbers there never can be a 'G' or a 'B', instead the most likely option is that it's '6' and '8' respectivly.
But I wonder where that s1 = s2.Replace("", ""); line comes from? Is it really from my submission? Because it's not present in the source code... I AM CONFUSED! And empty.
Admin
Ah yes, it it really IS from my submission. Someone (yes, most likely it was me...) removed it because in VS 2008 it looks like s2.Replace("",""); when in reality it should be s2.Replace("Unit Seperator", "");
Admin
I'm not well. I'll refrain from imagining.
Admin
I'm well. I'm the only oone. I can be used.
Admin
"Think through how you might solve this."
sed 's/INS/\nINS/g;s/G/6/g;s/B/8/g;s/[_^·:<>.£/()A?-]//g'
No, regexes are so evil, we rather write 50 lines of WTFy code ...
Admin
Or treat regexes as an expressive language instead of deliberately writing a pile of unreadable crap:
Admin
Imagine, if you will, that you have a life.
Admin
So I'll never get an O, I, Z, E, A, S, T or g then? Or other symbols I can't think of.
Admin
"So I'll never get an O, I, Z, E, A, S, T or g then? Or other symbols I can't think of."
tbh, I think the OCR already is configured in a way that it only reads the text as numbers. Never seen G, B, O, I, Z... in any of those files. But I didn't configure the scan job, so I cannot say for sure. Good thing is, this atrocity of a program won't be used much longer as the client we are doing this for switches from paper to a digitalized version (about time...). There's really no need to change the program around too much now. And yes, I know that "oh it won't be used much longer anyway" has been said numerous times before and more often than not those programs would be used for years after that statement had been uttered. But since I will be leaving this company at the end of the month, this really is SEP. ;)
Admin
Oh well, another smug Python user. (I have nothing against the language, but those users piss me off.)
What you achieved is basically to replace s/A/B/g with 'A':'B', i.e. exchange a few special characters for a few different ones. And require 3 more lines of code, including a lambda, to run it. Let's say our definitions of readable differ. (If you're referring to the lack of whitespace in my example, I just omitted it for a quick post here; in real code I'd probably have added line breaks between the substitutions; then again like most people I don't know how to put line breaks in this forum. ;)
Admin
Are submissions changed to try and omit identifying information (e.g. key string literals)? If not couldn't someone deduce the submitters real life persona if they stumbled across this?
Admin
Honestly, the requirements are the real WTF. "Still empty, can be used" points to that; blanking out certain characters. Which characters? That's always changing "can be used".
Admin
a thought: what your saying about python/pythonusers basically makes python the BMW of programming languages
as a python programmer, I'll accept that
Admin
"oone"?