• (cs)

    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.

  • J. Random PMP (unregistered) in reply to mystery
    mystery:
    It doesn't take a genius to work out what happened next....

    The guy who wrote that became the Lead Engineer?

    validus: yes, it is true

  • P.E. Dant (unregistered) in reply to highphilosopher
    highphilosopher:
    This just goes to show you that if you try to dummy proof a language, then a lot of dummies will try to use it.

    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?

  • Zack Jones (unregistered) in reply to Carl
    Carl:
    try { ...buncha important stuff... } catch { imgHeight = 85; }
    I encountered an error while trying to decide what to say about this, so I'll just say... 85.

    When in doubt use 85! I like that idea :)

  • Bim Job (unregistered) in reply to P.E. Dant
    P.E. Dant:
    highphilosopher:
    This just goes to show you that if you try to dummy proof a language, then a lot of dummies will try to use it.

    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?

    No, I think he's saying that it "just goes to show you that if you try to dummy proof a language, then a lot of dummies will try to use it."

    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.

  • Gerrit (unregistered) in reply to Kim
    Kim:
    Too bad you didn't read the whole thing...

    "Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions."

    ASP.NET applications isn't ASP.NET services...

    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 Graphics class provides methods for drawing to the display device.

    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 :-)

  • Ken B (unregistered) in reply to highphilosopher
    highphilosopher:
    This just goes to show you that if you try to dummy proof a language, then a lot of dummies will try to use it.
    The problem with trying to make something idiot-proof is that the world keep making better idiots.
  • Procedural (unregistered) in reply to Gerrit
    Gerrit:
    Kim:
    Too bad you didn't read the whole thing...

    "Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions."

    ASP.NET applications isn't ASP.NET services...

    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 Graphics class provides methods for drawing to the display device.

    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 :-)

    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.

  • P.E. Dant (unregistered) in reply to Bim Job
    Bim Job:
    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"?

    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.

  • your name here (unregistered) in reply to Ken B

    Yes, such as you who repeated comments already made here.

  • Carl (unregistered) in reply to P.E. Dant
    P.E. Dant:
    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.
    REAL programmers don't need keyboards (and certainly no stinkin' rodents) -- just toggle the switches to compose the appropriate hex byte, and hit "Load".
  • NoodleOnMind (unregistered) in reply to Not Rumen

    I was thinking this at the first post, guess someone beat me too it :)

  • Gerrit (unregistered) in reply to Procedural
    Procedural:
    Gerrit:
    Of course I may be completely misinterpreting what's going on here :-)

    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.

    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?

  • Goo (unregistered) in reply to mystery
    mystery:
    This is nothing compared to what one of our devs did. Granted we're talking PHP here but the same thing can arguably happen in any language and is basically the same thing seen here but X1000 times worse.

    It all happened when we noticed our main web server was grinding to a halt each day at roughly the same time. At first we dismissed it as a random event. When it didn't go away and in fact for worse an investigation was necessary.

    After checking several things I finally came upon the access log. In here I saw something strange. A single file had been gotten over and over in very quick succession. It had tens of thousands of hits in a matter of seconds. Goodness knows how much overall. What turned out to be stranger is that all of the requests originated from the webserver's own IP.

    So I checked the file and to cut a long story short the dev had somehow managed to get the php file to include it's self in a circular fashion over the web. It doesn't take a genius to work out what happened next....

    You purchased more powerful hardware!

  • Anonymous Coward (unregistered) in reply to hikari
    hikari:
    Dinnerbone:
    Rumen:
    int imgHeight = 0;
    int imgHeight = 0;

    Surely this'll give a compiler error?

    No. Why would it? It's completely valid. Pointless, but valid. It won't even give you a warning, unless you use an add-on like ReSharper, which will go "why are you being stupid?" at you.

    In fact in C# the initialization is pointless anyway, default(int) is 0.

    Have you ever used C#?

  • C (unregistered) in reply to Gerrit
    Gerrit:
    Can you explain why System.Drawing can't be used in a .NET service if a DIB is available?
    It says right there in the page: "Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions." -- IOW, they're full of memory leaks!
  • Anonymous Coward (unregistered) in reply to Gerrit
    Gerrit:
    Procedural:
    Gerrit:
    Of course I may be completely misinterpreting what's going on here :-)

    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.

    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?

    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.

  • Anachronda (unregistered) in reply to Carl
    Carl:
    try { ...buncha important stuff... } catch { imgHeight = 85; }
    I encountered an error while trying to decide what to say about this, so I'll just say... 85.

    The real WTF is that he didn't just say 42.

  • Gerrit (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    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.

    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).

    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.

    Yes, time to type in the CAPTCHA and go to bed.

  • P.M.Lawrence (unregistered) in reply to P.E. Dant
    P.E. Dant:
    Bim Job:
    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"?

    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.

    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.

  • Mango Tango (unregistered) in reply to Bim Job
    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. (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!

    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.

  • Resa (unregistered) in reply to Floyd
    Floyd:
    Additional WTF: Thou shalt not use System.Drawing from ASP.Net applications. See here.

    Wow!

  • Maude (unregistered) in reply to Jeffrey
    Jeffrey:
    mystery:
    It doesn't take a genius to work out what happened next....
    He fixes the cable?
    Don't be fatuous Jeffrey.
  • rumen (unregistered)

    next time just ask me

  • Jaco (unregistered)

    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?

  • Hristo (unregistered)

    I smell Bulgarian FAIL :D

  • SCB (unregistered) in reply to P.M.Lawrence
    P.M.Lawrence:
    P.E. Dant:
    Bim Job:
    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"?

    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.

    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.

    I feel an obligatory XKCD reference coming... Must... Resist...

  • Marvin the Martian (unregistered) in reply to Mango Tango
    Mango Tango:
    (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.

    You mean APL all over again? Bjech.

  • Marvin the Martian (unregistered) in reply to Marvin the Martian
    Mango Tango:
    (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.

    Addendum: note that APL's runic input even requires a special keyboard, with a handful of symbols.

  • Thomas (unregistered) in reply to Anachronda
    Anachronda:
    Carl:
    try { ...buncha important stuff... } catch { imgHeight = 85; }
    I encountered an error while trying to decide what to say about this, so I'll just say... 85.

    The real WTF is that he didn't just say 42.

    My thoughts exactly. Of course, I would have done it this way:

    int imgHeight = 0;
    imgHeight = 42;
    try
    {
        ...stuff...
    }
    catch
    {
        imgHeight = 42;
    }

    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.

  • Procedural (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    Gerrit:
    Procedural:
    Gerrit:
    Of course I may be completely misinterpreting what's going on here :-)

    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.

    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?

    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.

    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 hasnt 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 isnt bad at all for example, and there are others.

  • David (unregistered) in reply to Carl

    where is the purple monkey dishwasher error message?

  • Anonymous (unregistered) in reply to David
    David:
    where is the purple monkey dishwasher error message?
    In the previous article.
  • Bim Job (unregistered) in reply to Marvin the Martian
    Marvin the Martian:
    Mango Tango:
    (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.

    You mean APL all over again? Bjech.

    I'd like to defend APL (really!) ... but I don't have the keyboard for it.

  • Bim Job (unregistered) in reply to Mango Tango

    [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.

  • Bim Job (unregistered) in reply to Mango Tango

    Right, I'll try that again without the irritation of being called a robot three times over, and resorting to inaccurate cut and paste:

    Mango Tango:
    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.

    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.

    My hero!
    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.
    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?

    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.

    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?

    Mango Tango:
    (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.
    I hear you, brother. We have all been there, and we are all sinners.
    Mango Tango:
    Having achieved these goals, we can say goodbye to n00bs, and anybody who remembers the sensation of the wind on their face.
    Yes ... we both need a different class of girlfriend.
  • hdgjhd+ (unregistered) in reply to Jeffrey
    Jeffrey:
    mystery:
    It doesn't take a genius to work out what happened next....
    He fixes the cable?

    Maybe he floats on a matress in a pool, while performing some nihilistic act...

  • NoOneKnows (unregistered) in reply to jpa

    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).

  • NoOneKnows (unregistered) in reply to Gerrit
    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).
    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.

    Yes, time to type in the CAPTCHA and go to bed.

    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.

  • Dirk (unregistered) in reply to Floyd
    Floyd:
    Additional WTF: Thou shalt not use System.Drawing from ASP.Net applications. See here.
    Then how do you get the width and height of an uploaded image?
  • Rumen (unregistered)

    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.

  • Gerrit (unregistered) in reply to Procedural
    Procedural:
    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.

    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.

  • Anonymous (unregistered) in reply to Rumen
    Rumen:
    You don't know nothing...
    That is all I need to read to gauge your intelligence and to be honest, it's not looking good. If you can't adequately render the English language then how do you expect us to believe you can write program code? Sorry Rumen, you're not just bad, you're TDWTF bad.
  • P.M.Lawrence (unregistered) in reply to Anonymous
    Anonymous:
    Rumen:
    You don't know nothing...
    That is all I need to read to gauge your intelligence and to be honest, it's not looking good. If you can't adequately render the English language then how do you expect us to believe you can write program code? Sorry Rumen, you're not just bad, you're TDWTF bad.

    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?"

  • W Sanders (unregistered)

    A "rumen" is part of the stomach of a cow, so may this refers to a business process rather than a person.

  • BamaLama (unregistered)

    Rumen?

    We are DEVO

  • Jacob (unregistered)

    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.

  • Seth (unregistered)

    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?) !!!

  • Seth (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    hikari:
    Dinnerbone:
    Rumen:
    int imgHeight = 0;
    int imgHeight = 0;

    Surely this'll give a compiler error?

    No. Why would it? It's completely valid. Pointless, but valid. It won't even give you a warning, unless you use an add-on like ReSharper, which will go "why are you being stupid?" at you.

    In fact in C# the initialization is pointless anyway, default(int) is 0.

    Have you ever used C#?

    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#

  • Seth (unregistered) in reply to savar
    savar:
    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.

    +1

Leave a comment on “Ask Rumen”

Log In or post as a guest

Replying to comment #:

« Return to Article