- 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
I was expecting that "Rumen" was actually some guy named "Ruperson" and a tragic search-and-replace accident bungled his all over the source code.
Admin
The guy who wrote that became the Lead Engineer?
validus: yes, it is true
Admin
Not saying that you have this attitude, but...
I've found that most developers who would say something like this are elitist snobs who believe the unwashed masses don't deserve to use their development language of choice. Sure, this whole web site is dedicated to the dumb things that some developers do, but it's not because the langauge is somehow too easy. What are you implying with your statement? That we should artficially obfuscate our development languages to keep out the riff raff? Do you think that would lower the total number of WTFs out there?
Admin
When in doubt use 85! I like that idea :)
Admin
You have a point, though. All computer languages should be as user-friendly as possible. (Compilers and interpreters go hang -- they can just give it their best guess. In fact, I believe that this is the guiding principle behind PHP.)
Here's my software manifesto: (1) All programs should be written in pink. People like pink. (1a) Exception: A large proportion of the blogosphere prefer purple crayon. These people should be supported by a fork. A very large fork. (2) Programming languages should be typeless, stateless, and, if possible, meaningless. The reader should be able to construct his or her own narrative (in the case of procedural languages) or happening (in the case of declarative languages). (3) Functional languages should be banned. Even Code Gurus don't understand this tricky, recursive, lazy-evaluation, no-side-effect type stuff. (4) All other languages should be reverted, with immediate effect, to version 1.0. All other versions are clearly intentionally obfuscated for the benefit of elitist snobs. (5) Brackets, angle brackets, parentheses, semi-colons and tabs are hereby deprecated with the extreme displeasure of CodeThulhu. All they do is cause pointless arguments over syntax. C'mon, people, let's concentrate on getting some work done!
This just about leaves Whitespace, although the proscription of tabs is a problem. I'm working on that one. I'm thinking, what if I just renamed "tabs" to be "bats"?
Incidentally, in answer to the question in your final sentence: yes. Yes, I do.
Admin
I don't know much about Windows and .NET, this is what seems to be going on to me. I'm assuming that an ASP.NET service is a web service.
GDI = Graphics Device Interface
The name suggests it's device oriented, and needs some kind of display device to work. The System.Drawing description on MSDN confirms that:
The inability to use it in a service is consistent with that, it wouldn't make sense to display it on the server's display device. But you can use it from an ASP.NET application, where using the server's display device would be a bad idea too. So apparently this device is emulated in software and the resulting image is sent to the client in a HTTP response.
If this interpretation is correct then this design is a big WTF in my view. Image processing is just data processing, and there may be good reasons to do it on a headless machine without any specialized graphics hardware. I do that all the time (using Python and the numpy/scipy libraries). If System.Drawing can be used in an ASP.NET application, which doesn't use the server's display device (I should hope) but sends the image to another machine using HTTP, then why can't it be used in an ASP.NET service, which sends its results from a server to another machine using HTTP too. It seems to be an artificial restriction.
Of course I may be completely misinterpreting what's going on here :-)
Admin
Admin
Yep, you are. You can't claim knowledge in an area you know strictly nothing about. You can associate a canvas with a DIB (device-independent bitmap) and handle that as a virtual structure.
That was a lot of words to demonstrate that some of your code should be published here more often.
Admin
Ha. I like it. But...as we all know, real elitist snob developers don't even need whitespace and tabs, just a keyboard with a 0 key and a 1 key and no display.
Admin
Yes, such as you who repeated comments already made here.
Admin
Admin
I was thinking this at the first post, guess someone beat me too it :)
Admin
I didn't claim knowledge, I claimed lack of knowledge, and acknowledged I might be misinterpreting the situation. I'm not the only one doing that, it would seem. Don't conclude my code is full of WTFs based on your own misinterpretations.
Can you explain why System.Drawing can't be used in a .NET service if a DIB is available?
Admin
You purchased more powerful hardware!
Admin
Have you ever used C#?
Admin
Admin
The snippet quoted from MSDN by @kim is a warning. It essentially states that Some of the classes and methods in this namespace will assume the presence of certain resources. Use at your own risk when these resources are not present.
There's nothing at all to stop you from using System.Drawing to render an image and send it down some pipeline. This is how most CAPTCHA generators work, after all.
Admin
The real WTF is that he didn't just say 42.
Admin
Thanks for the clarification, but what I don't see is why those resources are present in ASP.NET applications but not ASP.NET services, assuming Kim was correct about that. It would expect what's available in both contexts to be the same, in terms of what's relevant for image processing (operations on arrays of numbers in memory, format conversions and I/O, that should be what it comes down to, more or less).
Yes, time to type in the CAPTCHA and go to bed.
Admin
You don't need two keys and a keyboard, just a single Morse key. If you have a capacitor to keep the machine running long enough for an interrupt to detect power failure and do a graceful closedown, you don't even need a Morse key, you can just toggle the power supply.
Admin
You've got everything backwards! You're fired!
(1) All programs should be written in a hex editor, on a serial terminal. Emacs or vi may be used if you're prepared to compile them from punch-cards. It's much more macho this way. (2) Every data and language structure should be an object. Arrays, booleans, functions, loops, conditionals, individual database records (you can only alter them one at a time), allocated memory, 8 different kinds of integer and 24 different kinds of float (all of which should exhibit arithmetic errors, because that's just the way math processors work); all of these should be accessible only by instantiating individual, single use objects, generated from the base laguange factory object in run-time. Conversion between the different classes of object is deprecated, you should instead instantiate another object occupying the same space in memory. (3) Any keywords that correspond to an actual word in a natural language must be eliminated and replaced by an initialism or an anacronism. (4) All software must be the bleeding edge, too-unstable-for-Ubuntu version, especially if the most recent developer is simply changing the architecture for the hell of it. (5) Where at all possible, the code should consist entirely of the symbols appearing above the numbers on the keyboard. Perl didn't go nearly far enough in this respect. (6) Memory allocation must be performed manually, through the base factory object, based on guesswork. (7) The manual should be in the form of a wiki, maintained by a developer who has since the left the project, and argues constantly with the current developers. Support is available on the mailing list/forum from egomaniacs who actually know less than you, but believe that you shouldn't want to do that anyway. (8) All programs must be run on a virtual machine, originally written in Java by a large Kafkaesque corporation and then reverse engineered in Ruby by pedantic idiot savants. This is for security reasons. (9) 9 is not a bug. We intended for it to be broken.
Having achieved these goals, we can say goodbye to n00bs, and anybody who remembers the sensation of the wind on their face. I'm sure you will all agree that it's much more important for the code to be theoretically perfect than useful.
Admin
Wow!
Admin
Admin
next time just ask me
Admin
Why does it seem like everyone is always bashing (or maybe it should be bludgeoning) .NET?
Sure there are a few oddities in the framework, but on the whole, I find it a rather efficient, time saving environment to work in. And yes, I have used other languages (VB6 {shudder} and Pascal hair turns white comes to mind).
Mind you, this example is rather wtffy...
CAPTCHA: conventio - why do I always seem to get the italian captchas?
Admin
I smell Bulgarian FAIL :D
Admin
Admin
You mean APL all over again? Bjech.
Admin
Addendum: note that APL's runic input even requires a special keyboard, with a handful of symbols.
Admin
My thoughts exactly. Of course, I would have done it this way:
That way, I'm sure the variable is properly initialized before setting it to 42 and it didn't accidentally get set to something else in a failing try block.
Admin
Right. There are a few problems with the bitmap-management functions. I once wrote a graphics library support system; it is very easy to just malloc your way through the standards and get a bitmap-management and file-format library. It is something else entirely to do so in a way that allows for misformed files, out-of-bound indexes, and proper memory management while still getting great performance. The Windows team hasn
t made much of an effort in that direction and mostly stayed with their first-pass coding effort there. So you do end up using up a tremendous amount of memory (some of which is difficult or impossible to recover), memory pool fragmentation, and improperly (or maliciously) encoded indices that go unchecked (although after posting a bazillion patches the holes are probably mostly gone), etc. IOW, not ideal for a system service but, in a pinch, workable. A better option still is to use a competent library to assist you in your work; Leadtools isn
t bad at all for example, and there are others.Admin
where is the purple monkey dishwasher error message?
Admin
Admin
Admin
[quote user="Mango Tango"][quote user="Bim Job"]You have a point, though. All computer languages should be as user-friendly as possible. (Compilers and interpreters go hang -- they can just give it their best guess. In fact, I believe that this is the guiding principle behind PHP.)
[quote user="Mango Tango"][quote user="Bim Job"]You have a point, though. All computer languages should be as user-friendly as possible. (Compilers and interpreters go hang -- they can just give it their best guess. In fact, I believe that this is the guiding principle behind PHP.)
Here's my software manifesto: (1) All programs should be written in pink. People like pink.[/quote]
You've got everything backwards! You're fired!
(1) All programs should be written in a hex editor, on a serial terminal. Emacs or vi may be used if you're prepared to compile them from punch-cards. It's much more macho this way.[/quote]My hero![quote user="Mango Tango"] (2) Every data and language structure should be an object. Arrays, booleans, functions, loops, conditionals, individual database records (you can only alter them one at a time), allocated memory, 8 different kinds of integer and 24 different kinds of float (all of which should exhibit arithmetic errors, because that's just the way math processors work); all of these should be accessible only by instantiating individual, single use objects, generated from the base laguange factory object in run-time. Conversion between the different classes of object is deprecated, you should instead instantiate another object occupying the same space in memory.[/quote]You're losing me here. What is this object whereof you speak? Is it big-endian? Or little-endian? Does it require both a CAR and a CDR? How many bits?
I like the idea of a run-time base language factory object, though. We can run with this. Does the garbage collector use the Visitor Pattern? Should we require an architecture-specific Abstract Factory Visitor Pattern?[quote user="Mango Tango"] (4) All software must be the bleeding edge, too-unstable-for-Ubuntu version, especially if the most recent developer is simply changing the architecture for the hell of it. [/quote]This is an unfair target for the developer. I'm told that it's possible to produce software for Ubuntu that is 100% stable. Of course, none of it will work when the next six-month upgrade to Krazy Koala is automatically uploaded.
I mean, what's a poor bleeding-edge guy supposed to do, when the underlying OS does it for you? quote user="Mango Tango" The manual should be in the form of a wiki, maintained by a developer who has since the left the project, and argues constantly with the current developers. Support is available on the mailing list/forum from egomaniacs who actually know less than you, but believe that you shouldn't want to do that anyway.[/quote]I hear you, brother. We have all been there, and we are all sinners.[quote user="Mango Tango"]Having achieved these goals, we can say goodbye to n00bs, and anybody who remembers the sensation of the wind on their face.[/quote]Yes ... we both need a different class of girlfriend.
Admin
Right, I'll try that again without the irritation of being called a robot three times over, and resorting to inaccurate cut and paste:
My hero! You're losing me here. What is this object whereof you speak? Is it big-endian? Or little-endian? Does it require both a CAR and a CDR? How many bits?I like the idea of a run-time base language factory object, though. We can run with this. Does the garbage collector use the Visitor Pattern? Should we require an architecture-specific Abstract Factory Visitor Pattern?
This is an unfair target for the developer. I'm told that it's possible to produce software for Ubuntu that is 100% stable. Of course, none of it will work when the next six-month upgrade to Krazy Koala is automatically uploaded.I mean, what's a poor bleeding-edge guy supposed to do, when the underlying OS does it for you?
I hear you, brother. We have all been there, and we are all sinners. Yes ... we both need a different class of girlfriend.Admin
Maybe he floats on a matress in a pool, while performing some nihilistic act...
Admin
System.Drawing is perfectly acceptable to use in ASP.NET Applications. In fact, as your question alludes - it is required if you want to do ANY image manipulation since it's the wrapper around all of the image classes, and GDI+.
We use it extensively to render images to be served up to customers. (the images representing pseudo-realtime graphs of live log data in a standard well log plot).
Admin
The issue is usually that of the user account the ASP service is running under (think: Network Service) and it's inability to access the "desktop" resources. Network service is severely limited in a number of ways and you can't do GDI, thus you can't use most of System.Drawing.
Admin
Admin
Finally this post found me. I am the person who commented these lines, which doesn't mean code is written by me of course. You are going to find more comments with my name on it, don't be surprised.
You don't know nothing about the background and history of that project code. I admit that the code could be written much better, but there are many reasons for such bad code and that I will not write about them here. I can only take full responsibility about the code written by me and my team under (not specified here) circumstances.
Admin
Thanks for giving more context. When using it in ASP.NET applications IIS will help to limit the damage by killing worker processes after a while. System services don't have that luxury. But the warning is about Windows or ASP.NET services. I assume ASP.NET services are web services, ASP.NET is a web application framework after all.
But now I see there's an option to host a web service in a Windows service instead of IIS. So the protections offered by IIS are not guaranteed to be available for web services, which can easily explain why MS doesn't support System.Drawing in that context. And that answers my question.
Admin
Admin
Error 7309: split bare infinitive. Suggest: "If you can't render the English language adequately then how do you expect us to believe you can write program code?"
Admin
A "rumen" is part of the stomach of a cow, so may this refers to a business process rather than a person.
Admin
Rumen?
We are DEVO
Admin
It happens (although when the obsolete code is still consuming resources, you would think someone would check) - not too long ago I suddenly realised that in some code I had written, I had a method which was included but the only call had been removed as I had fixed it (the method was a bit of a workaround really) but the method remained in place. At least that didn't waste resources like this though.
Admin
Sorry to deconstruct your lynching party, but, AFAICT,
Rumen is the good guy that knows how to do stuff, and the code has been f**ked up by a coworker who unfortunately appears to be both mentally challenged and unnamed.
Rumen can't help it that in want of better code or, indeed, just a better comment, this coworker is dropping his name (to deflect responsability: "Sorry, I don't know why this is, Rumen told me to; If you want to know more, you'll have to ask Rumen yourself" (ed: ... because I can't remember shit or are just too darn lazy to type it up).
I say, we need to stop lynching Rumen, clean our pitchforks and hunt for the TRWTF**ker!
Captcha: quis (who?) !!!
Admin
A nice way to put that is 'have you actually looked at the offending code long enough (to spot the absense of scope blocks, e.g.)'. He's obviously used C#
Admin
+1