- 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
Change the requirements.
Admin
C# is NOT case sensitive:
Admin
Not a patch on TopCoder though, who was skilled enough to effectively troll everyone even if they were watching out for it. That's talent which you conspicuously lack.
Admin
Turing never had to deal with hackers. In a security context, conflating code with data is a huge problem. Every time you hear about some website that got hacked and exposed millions of users' private data due to a SQL injection vulnerability, that's because some developer out there didn't understand how to properly separate code and data.
Admin
All existing processors can be modified to operate in this more secure mode. One simple way to activate this secure mode is to remove the heatsink from your processor, then power up your machine. This sends a signal to the processor to operate in this more secure mode. Unfortunately, I have not yet found a way to turn this feature off.
Admin
This one made me wanna hurl!
Admin
The problem with eval is that most programmers aren't coding:
(though admittedly, I don't know how eval optimizes SQL stored procedures.)Most programmers using eval at best are just causing unnecessary overhead and harder maintenance and at worst causing security problems for their clients.
Admin
you sir, are brilliant!
Admin
Admin
whadd'yall talikn' 'bout with tha single quotes?
tha sigle quotes be in tha Javascript, not tha C# (Java).
Admin
What's a compiled language anyway?
Admin
Compiler Error: Control cannot fall through from one case label ('case 1:') to another
Admin
Bloody hell! WTF!
Admin
The irony, of course, is that source files are already text. I would propose a "streamlining" effort:
Phase 1) To increase maintainability, move whatever's currently in the strings into separate files. Read these into eval at runtime. Phase 2) To increase performance, run eval once on these files and cache the results. Phase 3) To remove redundant code, use the real compiler instead of eval.
Ta da, no more monstrosity!
FYI I've found eval useful on occasion, for example I've had a few times in Javascript where I've needed to run something like "foo(bar[0], bar[1], bar[2], bar[3], bar[4], ...)" for an arbitrary number of bar. I think the following is a pretty clean solution:
var args = map(bar, function(v, k) { return 'bar['+k+']'; }).join(','); eval('foo('+args+')');
Admin
I agree, if the answer involves a javascript interpreter then change the question.
Admin
Please don't. Use Function.apply() to do this sort of thing, no need for eval.
Admin
... Or in an XML configuration file.
Admin
All you people saying that using eval is bad seem to be missing TRWTF here. This code is using an eval-like function in a language that doesn't natively have it to run a bit of JavaScript that splits a large string into an array and loops through it calling the JavaScript eval on each element in turn. Not only using eval, but using it 100+ times when once would be plenty (or arguably too much) and wouldn't significantly reduce the "flexibility"...
If I had to guess I would say that someone had to migrate a classic ASP JScript app to .NET and felt like writing some of it in C# for whatever reason and then didn't get around to (or wasn't allowed to) refactoring this ridiculous bit of legacy crap^H^H^Hode...
Admin
This one made my cry a little. This kind of stuff seems to be coded by Cthulhu himself.
Admin
A post by Remy without the unicorns?!? Clearly fake.
Admin
There are a few details of this that are a little off. For one the original code comes from classic asp/jscript not C#. This does actually come from a classic asp application I was so fortunate to inherit and maintain. The entire application is not stored in the application cache, only "commonFunctions". The mistaken reference to C# and ASP.net is probably due to the fact that I mention that being what I primarily work in. Which is much better written than this hunk of crap.
Admin
TRWTF is Remy. >:( GTFO of my TDWTF with your FAIL.
Admin
But that pales into insignificance when you start to browse through the database behind an inherited codebase and find a whole table containing code fragments <ugh!>.
Admin
Sounds a lot like TCL to me ;)
Admin
Unless we're talking about an infrastructure tool, "an engine that can run dynamic code" is not a REQUIREMENT, it is a proposed SOLUTION to meet the requirement. The requirement is surely something more like, "accepts orders from customers and prepare a shipping manifest and an invoice". Choices of language, database engine, etc, are solutions that should be irrelevant to the user as long as they ultimately work. If your users are putting statements like that in a requirements paper, you need to sit down and explain to them the difference between a problem and a solution. Or simply ignore such statements as suggestions to be taken or ignored as you see fit.
More likely, somebody on the IT side came up with this as a solution.
Admin
Where I come from, we call what you're proposing "going rogue."
In a real business, it's crucial for programmers to trust that stakeholders know what they need. Otherwise, chaos ensues.
Admin
Admin
I guess you can call me that... :)
I'm sitting here with 5 stitches in my hand (not my mouse hand, thankfully) that I managed to give myself with a sword... that's kinda something a guy would be typically more likely to do, huh?
Admin
In C#:
Application["TheRealWTF"] = "VisualBasic";
In VB.Net:
Application("TheRealWTF") = "Javascript";
Whatever this code is; it wouldn't compile as c#...
Admin
C# is a great language for using C# as a scripting language, apparently.