• FragFrog (unregistered) in reply to kktkkr
    kktkkr:
    If not (pesky management issues) you can stick with divs. Just make 1 for each pixel, and position them manually with code.
    While I'm almost entirely sure you're joking here, please, for the sake of all Timmy's out there, add warnings next time!

    I have seen scripts that actually do that. Well, eventually.

  • dddd (unregistered) in reply to dgvid

    Simples solution, create Circular Color Generator script, and let it run with all the variants.

  • shane (unregistered)

    <a rel="nofollow" href=""http://www.whattheduck.net/strip/1250" target="_blank" title=""http://www.whattheduck.net/strip/1250">[image]

  • SeySayux (unregistered)

    Monday morning, 2.00

    "Hey Timmy, have you heard of that nice ImageMagick thing? It's really cool! It can be used to generate images by script!"

    And yes, 20 minutes later...

    for color in {0..16777215}; do
        convert -size 64x64 xc:white -fill $(printf '#%u' $color) \
            -draw "arc 0,0 64,64 0,360" $(printf '%u' $color).jpg
    done
    

    It's perfect. It explains everything.

  • (cs) in reply to kktkkr
    kktkkr:
    Remember that if you're using PNG or GIF, you have the option of transparency, and probably can cut the total down. Not sure exactly how well it will work.

    If you're using PNGs, it will work great: you can make exactly ONE image, in the page's background color, with a transparent circle in the middle (and partial transparency even allows for smoothing the circle border somewhat). Insert it into the page, and with CSS, set the image's "background-color: #aabbcc", using the hex code the client picked. Very fast (as there's only one image to load), simple, no horrible hacks needed.

  • airdrik (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    My question is when does the "hmm, there *has* to be a better way of doing this" moment kick in? In this case, never. Would I hire him back next summer? Never...

    Yes, yes, interns learn, blah blah, but all but the most retarded of individuals would stop, think, and maybe even ask someone if they know of a better way when trying to fill the gas tank with a thimble, no?

    The moment you refer to happened after his scripts had generated the first 10,000,000 image files, and so he figured: well, while there ought to be a better way, I'm already this far so I might as well just let things finish.
  • drusi (unregistered)

    So what would be the Right Thing in this situation, anyway?

    My instinct is to make a square GIF consisting of a transparent-color circle on a white background, and then set the background color to the hex code. But I'm the sort of programmer who reads TDWTF to reassure himself that "at least I'm not this guy," so...

  • Jay (unregistered) in reply to Mathy
    Mathy:
    If it was automated then there wouldn't be a need to be up all night, surely? And even some generating software would struggle producing 30 a second, and that'd only be if he started right away.

    I demand proof - upload them all to Flickr so I can verify.

    Okay. But before I'll believe your rebuttal, you have to examine every single one of those images and demonstrate that they could not have been produced as described in the story.

  • Jay (unregistered)

    One easy way to solve this would be to display a period with the font color set to the desired color and the font size set to 3000 points.

    I intended this as a joke, but after typing it, hey, that might actually work.

  • (cs) in reply to Jay
    Jay:
    One easy way to solve this would be to display a period with the font color set to the desired color and the font size set to 3000 points.

    I intended this as a joke, but after typing it, hey, that might actually work.

    And there I was thinking that the easiest way would be to make a 1x1 pixel image for each colour, and simply draw a circle by positioning multiple copies of it in the right position on the page...

  • (cs) in reply to Jay
    Jay:
    One easy way to solve this would be to display a period with the font color set to the desired color and the font size set to 3000 points.

    I intended this as a joke, but after typing it, hey, that might actually work.

    A bullet (•) would probably be a better choice, since periods aren't centered and are often squares, depending on the font.

  • Medinoc (unregistered) in reply to dgvid
    dgvid:
    Bad move, Timmy. You could have simply generated a single JPG (a PNG would have better) with 16,777,216 evenly spaced circles, then used the width, height, and background-position properties to the display the correct one. Get to work calculating those offsets, Timmy!
    Wow, I actually didn't know it was possible to willfully display only PART of an image on a web page. But I guess that makes sense.
  • Medinoc (unregistered) in reply to dddd
    dddd:
    Simples solution, create Circular Color Generator script, and let it run with all the variants.
    According to the HTML comments, that's likely what happened.
  • Aaron (unregistered)

    It's a good thing there was no need to support the alpha channel.

  • (cs) in reply to Medinoc
    Medinoc:
    Wow, I actually didn't know it was possible to willfully display only PART of an image on a web page. But I guess that makes sense.
    Sure! http://www.w3schools.com/css/pr_background-position.asp Use that with a fixed width/height, and you have image cropping.
  • (cs) in reply to TheClassic
    TheClassic:
    DaveK:
    Perhaps you and the other cynics should read the HTML comments in the story. Your objection has been anticipated.
    Are there always comments in the html?
    Often but not always. When they do, they frequently contain interesting addenda to the main story.
  • (cs) in reply to vt_mruhlin
    vt_mruhlin:
    DaveK:
    Mathy:
    604800 seconds in a week. 16,777,216 JPGs.

    0.036 seconds each.

    That's pretty impressive. The made up ones really annoy me.

    Perhaps you and the other cynics should read the HTML comments in the story. Your objection has been anticipated.

    Putting relevant content in a comment tag is what passes for "clever" these days?

    THIS. IS. TDWTF!

    (Tonight we comment in HTML.)

  • (cs) in reply to Mathy
    Mathy:
    If it was automated then there wouldn't be a need to be up all night, surely? And even some generating software would struggle producing 30 a second, and that'd only be if he started right away.
    I'm guessing that he spent most of the week waiting for replies to the "plz send me teh codes"-style questions that he posted to beginners' programming forums all over the web, and only figured out how to get the generator script running over the weekend.
  • A Gould (unregistered) in reply to Uncle Al
    Uncle Al:
    Or, if one is an intern, one might not be expected to know tricks like the masking technique and assume that one was handed this job *because* of the grunt work of creating all those images. -1 to Matthew for not checking in on the intern's approach when the job started to take longer than expected.

    Agreed - I've done "grunt work" jobs where things needed to be done by hand (usually because it was a one-off effort, and it was faster to brute-force it once.)

    Can't pin any of this on the intern. Matthew gets pinged for not sending the intern away for a day to think about it, then having them come back and outline the plan (which would then give the opportunity to say "yes, you could do that, but..." and... y'know... teach the intern?

  • sam (unregistered)

    poor, poor timmy

  • (cs) in reply to sam
    sam:
    poor, poor timmy

    Timmy should have known better than to work for Matthew...

  • (cs) in reply to Mathy
    Mathy:
    604800 seconds in a week. 16,777,216 JPGs.

    0.036 seconds each.

    That's pretty impressive. The made up ones really annoy me.

    He had the access to his college's cluster and he can use 100 nodes during the weekend.
  • Joey Stink Eye Smiles (unregistered)

    TRWTF is that every intern story is an indictment of the management or FT employees, not the interns.

  • Hater of the Right (unregistered)

    Timothy???? Matthew???? WTF is up with all the Biblical names?!?!?!?

  • (cs) in reply to Hater of the Right
    Hater of the Right:
    Timothy???? Matthew???? WTF is up with all the Biblical names?!?!?!?

    Jesus Christ you're right... I'm sure it's just pure Luke. We should Mark this one, or maybe it'll just Peter out.

  • Pete (unregistered) in reply to Anonymouse

    That's quite a nice light green...

  • Web Development Expert (unregistered)

    Brian is TRWTF. You can't solve this solution with CSS. If you do, anyone using IE6 is SOL. I have solved a similar problem with a small, ActiveX control. Works every time.

  • Pete (unregistered) in reply to Pete
    Pete:
    That's quite a nice light green...

    The real TDWTF is I fogot to quote what I was referring to. (the colour #BADBAD).

  • Anon (unregistered) in reply to Hater of the Right
    Hater of the Right:
    Timothy???? Matthew???? WTF is up with all the Biblical names?!?!?!?

    Is this any different from a right-winger complaining about middle-eastern or African names?

  • anonymous_coward (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    anonymous_coward:
    The intern shows great potential!

    As what, a door jam?

    intern != architect. You can't expect the newbie to know all the options. That comes with experience.

    What I see in the story is the intern made the delivery using programmatic image generation at the sacrifice of personal time.

    Assuming this guy keeps learning: potential FTE. I can teach syntax and semantics. I can't teach morals, values or ethics.

  • (cs) in reply to Henning Makholm
    Henning Makholm:
    Obviously he should have written a stored procedure in SQL that constructs an image file with the right color at run time.
    CREATE FUNCTION MakeBitMap ( @size int, @r int, @g int, @b int ) RETURNS varbinary(MAX) AS BEGIN DECLARE @bmp varbinary(MAX) SET @bmp = 0x424D769C00000000000036000000280000006400000064000000010020000000000000000000C40E0000C40E00000000000000000000

    DECLARE @x int DECLARE @y int SET @y = 0

    WHILE @y < @size BEGIN SET @x = 0 WHILE @x < @size BEGIN IF (POWER((POWER(CAST(@x AS float) + 0.5 - (@size/2.0), 2) + POWER(CAST(@y AS float) + 0.5 - (@size/2.0), 2)), 0.5) > (@size/2.0)) SET @bmp = @bmp + 0xFFFFFFFF ELSE SET @bmp = @bmp + CAST(@r AS binary(1)) + CAST(@g AS binary(1)) + CAST(@b AS binary(1)) + 0xFF
    SET @x = @x + 1 END SET @y = @y + 1 END

    RETURN @bmp END GO

    SELECT dbo.MakeBitMap(10, 128, 128, 128)

  • Hater of the Right (unregistered) in reply to Anon
    Anon:
    Hater of the Right:
    Timothy???? Matthew???? WTF is up with all the Biblical names?!?!?!?

    Is this any different from a right-winger complaining about middle-eastern or African names?

    Let me guess...your kids would be named Easter Bunny, Santa Claus, and Tooth Fairy?

  • shepd (unregistered)

    Am I the only one who notices that Matthew believes you can have a round JPG? A PNG, using transparency, yes, I can see that at least looking round. But a JPG? How can that end up round? It can have a picture of a circle, sure, but it still ain't round.

  • Mr.X (unregistered)

    Guess it's "Time for a new Timmy!" (Science dude from the Dinosaurs show)

  • anonymous (unregistered)

    If I were Matthew I would have been like "Sorry, Timmy, there was a change in requirements. We no longer want the swatch to be round, we now want hexagon-shaped swatches."

  • (cs) in reply to anonymous_coward
    anonymous_coward:
    intern != architect. You can't expect the newbie to know all the options. That comes with experience.

    What I see in the story is the intern made the delivery using programmatic image generation at the sacrifice of personal time.

    Assuming this guy keeps learning: potential FTE. I can teach syntax and semantics. I can't teach morals, values or ethics.

    I never said he was or should be an architect. What I did say was that most people are born with at least a few grains of common sense. Things like fight or flight, moving your hand when it's getting burned, going to a toilet when you have to shit, etc. I think he lacked that very basic underpinning.

    This isn't about syntax, style or semantics. It's just fucking outright retarded what he did... I obviously wouldn't can him for something like this, but if I detected a real "you're doing it the wrong/hard way" in all of his solutions despite mentoring/guidance, then he is in the wrong profession and should immediately transfer to marketing or worse, sales.

  • anon (unregistered)

    ...or you could just use border-radius, a CSS3 feature.

  • Accalia.de.Elementia (unregistered) in reply to Web Development Expert
    Web Development Expert:
    Brian is TRWTF. You can't solve this solution with CSS. If you do, anyone using IE6 is SOL. I have solved a similar problem with a small, ActiveX control. Works every time.

    ... Unless someone isn't using Internet Exploder, err i mean Internet Explorer

  • jdw (unregistered)

    Why would you make them all by hand when you could just make a Photoshop macro?

  • Jonathan Hamilton (unregistered) in reply to Web Development Expert

    ahahahahaha jesus christ

  • Matt (unregistered)

    When dealing with off-shore employees, I sometimes will put in a boundary condition. So in my request I'll say "After X hours, report back what you have so far" as a sanity check in case they're WAY off base.

    In addition, I always put a time limit on requests; something like "Do not spend more than X hours on this task". For competent workers, you rarely need it. But for the clueless ones, you'll be very surprised when they bill you for 30 hours of work for a 5 hour task. Even for an average rate of $10 USD/hour for a graduate educated Indian performing semi non-trivial business tasks that can add up fast.

    I can't tell you how much I keep telling them "If you have questions, ASK me. I don't want you wasting my money because of something I wasn't clear about. Always ask me for further clarification if you need it, or ask me for help in sending you in the right direct." etc. etc. etc. And rarely do they listen. The ones that do; they stay employed.

  • Klimax (unregistered)

    TRWTF is not knowing about js libraries which can do vector graphics using VML/SVG depending upon browser.(and efficiently)

    CAPTCHA:capio - cap the i/o...

  • (cs)

    I don't understand: Why do we suddenly need a 40 GB SAN?

  • Kang (unregistered)

    Interns are young and tend to party.

    He saw two options:

    1. Spend 8 hours figuring out the right way to do this.

    2. Spend 1 hour writing a script to generate images, let the script run, party and have fun until it's done, then come into work and explain that the red eyes and gaunt look are the result of a weeks worth of work and some overnighters instead of a weeks worth of partying, banging, etc., with the occasional check in to see if the script is done.

    If I'm an intern, it's Option 2. If you're my boss and expect perfect dedication from me now--for free--then who knows what you'll expect when I start getting paid.

  • (cs)

    For a 16x16 circle with transparency, it's

    47 49 46 38 39 61 10 00 10 00 80 01 00 RR GG BB ff ff ff 21 f9 04 01 0a 00 01 00 2c 00 00 00 00 10 00 10 00 00 02 1d 8c 0d a9 c7 a1 bf 18 9c e0 50 8a 2e 74 ba fb 0f 86 a2 c7 7d 99 79 6a 4d d7 58 1b 53 00 00 3b

    Easy enough to wrap up in a CGI script / php script / jsp / aspx / whatever.

  • ryan (unregistered) in reply to dgvid

    I hope that is a bad joke...that image would be huge.

    How about an all white image with a transparent circle in the middle of it, just change the background color w/ css.

  • ryan (unregistered) in reply to ryan

    Whoops I see everyone beat me to it, dunno why I only saw the one comment.

  • (cs)

    Definately a problem in managing the intern rather than a problem with the intern.

    And, by the way, not all interns are free. The AVERAGE hourly salary for an undergraduate intern is between $16 and $17 per hour; for a post-graduate (e.g. going for their masters degree, the averare is close to $25. These are USA national averages across all fields. For Computer Interns in New York City the average is 40%-50% higher.

  • MS Certified Expert (unregistered) in reply to Accalia.de.Elementia
    Accalia.de.Elementia:
    Web Development Expert:
    Brian is TRWTF. You can't solve this solution with CSS. If you do, anyone using IE6 is SOL. I have solved a similar problem with a small, ActiveX control. Works every time.

    ... Unless someone isn't using Internet Exploder, err i mean Internet Explorer

    Why wouldn't they use IE? The others are all open source, which means they have security holes.

  • JB (unregistered)
    tclsh> puts [time {
        for {set color 100000} {$color < 101000} {incr color} {
            exec "C:\\Program Files\\ImageMagick-6.7.0-Q16\\convert.exe" blank.png -fill "#${color}" -draw "circle 10,10 1,10" ${color}.png
        }
    } 1]
    25121743 microseconds per iteration
    

    Sounds like 5 days work using ImageMagick.

Leave a comment on “Twenty-Four Bits Per Intern”

Log In or post as a guest

Replying to comment #:

« Return to Article