- 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
the wtf is you don't have to close the connection when using using - that and the funny comment.
Admin
Well, Paul's explanation is incomplete, and this makes it wrong.
Yes, Excel plays with the "$" in the sheet names.
No, there is no direct need to remove those "$", because the used computer language provides something like "if" and some string operations that would allow to test for "$"s and react accordigly.
But if we expect zero or more "$"s at the right place, we can as well remove all currently contained "$"s, how many there might be anyway, and place the correct amount on our own - which allows to adjust the sheet name in one line of code instead a bunch of if-then-else constructs.
Admin
Removing a file while you still are accessing it will work well for UN*X and Linux, but usually caues trouble under MS Windows.
Admin
He's not a programmer anymore. Instead now he rages at our network service providers. It can be rather amusing, though unfortunately they've moved him farther away from people so I don't get to hear it. I think they wanted to reduce collateral damage when he inevitably goes thermonuclear.
Admin
You have no idea what you are talking about, do you?
Admin
Yeah, it is a well established fact that a certain large and aggressively dominant software company is founded on, composed entirely of, and produces nothing but pure unmitigated evil.
If you don't know that already, you may have an excuse if you fall into one of these categories:
Admin
Admin
Thread won. Everyone go home.
Admin
I know what he is talking about. A filename or path is in UNIX is just an alias to the file. If you open the file to use that creates another "reference" to the file.
A file is only deleted physically when there are no links (other than symbolic ones which don't count) or open file handles on it.
You can write a new file there (with the old name) but the old file is still there whilst it is in use.
Admin
Just in case anyone is sceptical about Microsoft products being a never ending stream of broken APIs: remember Internet Explorer 6.
Admin
The browser people kept using for 12 years, then complained it wasn't compliant with current standards.
Admin
Admin
Admin
Ouch! So true it hurts.
Admin
I'm not saying you should never use Microsoft, or that you should never write components that will only run on Microsoft.
But a company should not have the attitude of "Microsoft shop" meaning that they will never consider using a different operating system for anything, even if it happens to be more appropriate for the purpose. Or that it isn't preferable to write your systems in a more open, portable way just in case in the future a better operating system appears for the purpose of running it and you want to port...
Write for Microsoft-only if doing so will mean a far quicker development time / lower development cost than doing otherwise.
Admin
Admin
Admin
Excel has another "feature" where it can't reliably detect the encoding of a .csv file, so if that CSV is utf8 encoded, but the field headers contain only ascii, it barfs and screws it all up, forcing you to perform a bunch of extra steps to import it correctly.
Admin
Where's the WTF? Oh, I'm actually supposed to READ the comments! I guess it's really true that more things make us say WTF than just code...
Admin
Admin
Let's be specific here, if they were any good they'd be working on Google's search engine. Quite frankly most of Google's other products are also full of fail.
Admin
The only WTF I see is that the code and comments were posted on TDWTF at all.
Nothing to see here.
Admin
Jerry, please read Windows Can but Won't. Also, I've had to work with, or more appropriately against, Excel and it's a steaming pile of crap. Methods that don't do what they say, methods that work differently in different versions for no obvious reason, methods that sometimes crash for no reason... I've even been in the situation where everything worked in Office 2003 but after we migrated to Office 2007 a method sometimes didn't do anything without any error message whatsoever. The only solution that sort of worked was to call the method in a loop with DoEvents and check if the requested modifications were made.
Admin
I'm kind of on the fence with this. Comments that explain the theory of something like this are fine; actually needed.
But it's like Paul was running for political office or something and couldn't say with 20 words what 2,000 words would do; and not only that, but while describing the problem, he had to cast aspersions on his opponent.
Definitely a politician.
And knowing how competent all politicians are ...
Admin
Wow, who knew that Blakeyrat would end up on TDWTF main page?
Admin
The comments make sense
someone who sees the comment will understand why the WTF code is there.
Admin
Which entirely sidesteps the question of why "we can totally demolish your system" buffer overflows etc. are being manufactured in the first place, so many that they still need to be patched at the 10-year average rate of several per month.
Admin
I always thought the source code for Excel was one of those myths... that the core was still some hand-tweaked assembly that Microsoft had inherited way back when they bought it.
Yeah, I don't know where I heard it.
Admin
Admin
But why the code does what it does? That, my friend, is never in the code. That is where the comments come in.
Admin
I feel your pain, Paul. I feel your pain.
Admin
Then come up with a legit WTF about his work. Other than ranting about his thorough efforts to reduce the complexity of Microsoft APIs.
If his ego makes him WTF something, that's one thing, but if his ego is just annoying you, maybe you're not that great?
CAPTCHA letatio - French for le'tatio or "the tattler".
Admin
I'd love to see what was left out of the original comments.
I've found comments like "left in because the fat pig/fat bitch insisted on it" and much worse.
Admin
like others I don't see the wtf. The only wtf maybe is that he should be doing a check on the last character to see if it is a $ then add one of it isn't instead of doing a global replace. And who hasn't been frustrated working hours trying to solve a stupid bug? He just vented his frustration in his comment instead of to someone else.. Honestly it is pretty hilarious and I would love to come across comments like that.. descriptive and funny.
Admin
OMG I'm a 3! Please help!!
Admin
What? You aren't one of those people the subscribe to psychobabble without any formal proof of correctness are you? ARRRHH I am so mad :) At least I'm not so stupid to think that way otherwise I'd be wrong like you.
You make a good point skilled techies have their preferences and they often verge on religion. What would you rather have a bunch of people that aren't passionate about the tech they use and the systems they build?
"We are going to use .Net/Java/Cocoa (pick one) to build a SOA/direct access/ORM data model to present a website/App/desktop program for linux/windows/Mac. We don't really care much which one because we all know version 2.0 is going to be as oh hum as v1 was."
Admin
In C# for example (~ don't have compiler handy)
wsheet = wsheet.TrimEnd('$').Append('$');
Would cover both causes assuming there aren't multiple "$" on the end of the line without even needing to use a conditional.
Admin
I've spent years trying to forget it. And just when I'd succeeded, you come along. Bastard.
Admin
When A) the characters can't appear elsewhere in the string anyway and B) .Replace is shorter and easier to understand than doing stuff with .Length and indexes, I don't see the problem.
Admin
Global solution cannon on local problem is WTF. Paul is WTF.
Sorry WTFers...
Admin
"Anyone who has worked with a database in a professional capacity for more than 20 minutes should have a list of at least 10 reasons why Excel is a monster. These probably include:
The way it butchers postal codes that start with a leading zero, like the town I grew up in (Granby, MA 01033 USA)
Dates of any kind
Serial numbers that have leading 0's (see #1)
The JET database driver for Excel. One large WTF.
SQL Server Integration Services Excel datasource. WTF squared.
The f-ing "just put an apostrophe" workaround. WTF.
a. The equally effective "format as text before you paste" workaround. Gives the illusion of working, only to break later.
Save as CSV, then reopen the CSV in Excel. Lots of magical things happen there.
While on the topic, CSV files, which are a whole WTF on their own.
The Jet database driver's "type guess rows" registry entry. WTF factorial.
The root of all this: Excel makes things that look like tables, and tables are useful for data. There is no other program that is as widespread AND makes things that look like tables, so people use Excel to make tables of data. And it's in fact really, really bad at that. It was designed for ad-hoc numerical analysis and got appropriated as a database loading and reporting tool.
I think it's actually damaged the GNP of whole nations, this Excel program. It'd be interesting to know how badly."
Admin
What failure mode do you imagine for this that doesn't involve an exception being thrown?
Admin
Three things. First: I didn't submit this code. Another employee did. Two: I was kidding and he knows it. Third: I actually am pretty great!
Admin
I like Microsoft, but I have to agree with Paul. His coding looks good and he works around the $#*@ that is Excel.
Admin
From here: Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.
Admin
My thoughts exactly.
that and removing all those '$' before adding them, instead of just checking if they are there.
Admin
Seems like a valuable entry because the comment rage is pretty funny, imo.
Admin
Admin
TRWTF is the use of Microsoft Excel spreadsheets as a database.
"That's what Microsoft Access is for!"
Admin