• Rhywden (unregistered)

    Isn't it called "Mandelbrot"?

    "Madelbrot" has a slightly different meaning in German :)

    Note from Alex: Ugh... fixed! I really should start writing these before 2AM...

  • squeamish ossifrage (unregistered)

    OK, I admit it, I've been known to stare into the cosmic wonder of the Mandlebrot Set while under the influence of a mind-numbing ... uh, margarita.

    But in this case I think it would be much more interesting to gaze into the depths of the brightly colored source code.

  • (cs)
    Alex Papadimoulis:
    The bar for entry into CodeSOD is pretty straight forward: professionally-developed code that elicits that certain What The— reaction.

    Is there really any point to censoring the phrase "What The Fuck" when everyone knows what "WTF" stands for anyway?

    Come on, this is a submarine! This is not a monastery! Can you say s u b m a r i n e? Ah, forget it. I'll pull something from my personal library.

  • Carl (unregistered)

    And this is why programmers should not be math majors.

  • zikko (unregistered) in reply to Rhywden

    The T-SQL Madlebrot I could use T-SQL to generate... Madelbrot." a text-representation of a Mandelbrot Set.

    Three different version! What the fuck?

  • (cs) in reply to Rhywden
    Rhywden:
    Isn't it called "Mandelbrot"?

    "Madelbrot" has a slightly different meaning in German :)

    Which would be...? "Mädelbrot" macht keinen Sinn, "Madenbrot" scho, aber "Madelbrot"?

  • (cs)

    This reminds me of when (many years ago now) we sent a postscript file to our brand-new 300dpi printer which computed and displayed the Mandelbrot set at maximum resolution, with all computations performed in the PS interpreter. I don't remember if it was an overnight job or an "over a long weekend" job, but it was definitely awesome...

    No, I don't have the code.

  • (cs)

    I like it, let's see more like this. Probably like most folk here, I wish I had more time at work to be bored and produce similar inanity.

  • blindman (unregistered)

    I coined a term for this type of entertaining, yet uselss code a long time ago: "MSSQLbation".

  • google HR manager (unregistered)

    Dammit, Alex, now I'm going to have to rewrite one of the questions on our 15 minute handwritten pre-interview test.

  • Heinz 53 (unregistered) in reply to tdittmar
    tdittmar:
    Rhywden:
    Isn't it called "Mandelbrot"?

    "Madelbrot" has a slightly different meaning in German :)

    Which would be...? "Mädelbrot" macht keinen Sinn, "Madenbrot" scho, aber "Madelbrot"?

    In Austrian dialect, Mädel is maiden (Mädchen), and who knows, maybe there is some kind of bread made by maidens. Or maybe, if you put it into the context of the file "Hostel", bread made out of maidens...

  • Tachyon (unregistered) in reply to zikko
    zikko:
    The T-SQL Madlebrot I could use T-SQL to generate... Madelbrot." a text-representation of a Mandelbrot Set.

    Three different version! What the fuck?

    Seems like the text was generated by a Mandelbot...

  • mauhiz (unregistered)

    that easily owns any of my usual bored activies.

  • Alistair (unregistered)

    I take it this is SQL Server 2005+ only, I bravely tried to crash our server running this but just got syntax errors!

  • (cs)

    How about [i]Impressively Useless[i] Coding Tricks?

    Could be an interesting regular feature!

  • memals (unregistered)

    Just for fun I took the ispell 354984 word list and rot13'd it. then I checked how many encoded strings matched real words from the original list. Zero matches :( I am very disappointed. I expected at least 1% to encode into another valid string. I was amazed how quickly the following commands ran cat ROT13.LST | uniq -u > BIG.LST cat mword10/SINGLE.TXT | uniq -u >> BIG.LST cat BIG.LST | uniq --repeated > ROTRES.LST ROTRES.LST was empty, uniq -u removed any duplicates. echo owl >> test.file echo fox >> test.file echo owl >> test.file echo owl >> test.file cat test.file | uniq --repeated Gave the correct result "owl"

  • Smeagle (unregistered) in reply to tdittmar

    Depends on the region. Here in Bavaria, it's "Madel" for girl. So "Madelbrot" would be girlybread?

    • Oliver
  • Mark (unregistered)

    My WTF on this is why was he at work on a Sunday (10-12-2008) with nothing better to do?

  • g (unregistered) in reply to Alistair

    2005+ (as it uses PIVOT).

    It only took 11 seconds to run on my local VM, so I think you'll be alright ;)

  • adiener (unregistered)

    This reminds me of a friend of mine, who was working on writing a raytracer in SQL last time I talked to him.

  • Sean (unregistered) in reply to dkf
    dkf:
    This reminds me of when (many years ago now) we sent a postscript file to our brand-new 300dpi printer which computed and displayed the Mandelbrot set at maximum resolution, with all computations performed in the PS interpreter. I don't remember if it was an overnight job or an "over a long weekend" job, but it was definitely awesome...

    No, I don't have the code.

    http://warp.povusers.org/MandScripts/ps.html

  • JD (unregistered)
    The Article:
    What's the most useless thing I could do with my time without actually doing anything?
    How about this website?
  • UUoCA (unregistered) in reply to memals

    http://partmaps.org/era/unix/award.html

  • Herman (unregistered)

    I made a 2.5D rolling ball application made out of WinForms buttons once.

    facilisis = the new syfilis, get it NOW!

  • ion (unregistered)

    Here’s an ASCII mandelbrot in dc(1) i made a few years ago:

    [lolssdsl0lqx]sx[1+lddd*lld*-ls+dsdrll2**lo+dsld*rd*+4<kd15>q]sq[q
    ]9ksk[d77/3*2-ss47lxx-P1+d78>0]s00[d23/.5-3*so0l0xr10P1+d24>u]dsux
  • ion (unregistered) in reply to ion

    Oh, since the article mentioned quines, i might as well include a dc quine:

    [91PP[dx]93PP]dx
  • blah (unregistered)

    TRWTF is that you made a screenshot out of plaintext you had on hand. Clearly you should have pasted it into Paint first, shot that, and pasted that into another imaging app, and included a shot of that.

  • Carl (unregistered) in reply to blah
    blah:
    TRWTF is that you made a screenshot out of plaintext you had on hand. Clearly you should have pasted it into Paint first, shot that, and pasted that into another imaging app, and included a shot of that.
    ... on a wooden table.
  • BadFellas.org (unregistered)

    Stupid coding trick? This is awesome! :D This is a clever waste of time, not a WTF!

  • (cs) in reply to BadFellas.org
    BadFellas.org:
    Stupid coding trick? This is awesome! :D This is a clever waste of time, not a WTF!
    Acknowledging that I took the time to read these comments is a true WTF/WoT (Waste of Time)
  • anne (unregistered) in reply to Heinz 53
    Heinz 53:
    tdittmar:
    Rhywden:
    Isn't it called "Mandelbrot"?

    "Madelbrot" has a slightly different meaning in German :)

    Which would be...? "Mädelbrot" macht keinen Sinn, "Madenbrot" scho, aber "Madelbrot"?

    In Austrian dialect, Mädel is maiden (Mädchen), and who knows, maybe there is some kind of bread made by maidens. Or maybe, if you put it into the context of the file "Hostel", bread made out of maidens...

    Doesn't "Mandel" mean tonsil? Back in the day we used to laugh about old tonsil bread and his set. Seriously.

  • blah (unregistered) in reply to Someone You Know
    Someone You Know:
    Is there really any point to censoring the phrase "What The Fuck" when everyone knows what "WTF" stands for anyway?
    This is Alex we're talking about. The same guy who renamed the site because of his grandma.
  • Kyre (unregistered)

    Courtesy of the great JoCo:

    Take a point called Z in the complex plane Let Z1 be Z squared plus C And Z2 is Z1 squared plus C And Z3 is Z2 squared plus C and so on If the series of Z's should always stay Close to Z and never trend away That point is in the Mandelbrot Set

    Mandelbrot Set you're a Rorschach Test on fire You're a day-glo pterodactyl You're a heart-shaped box of springs and wire You're one badass fucking fractal And you're just in time to save the day Sweeping all our fears away You can change the world in a tiny way

  • (cs) in reply to blah
    blah:
    Someone You Know:
    Is there really any point to censoring the phrase "What The Fuck" when everyone knows what "WTF" stands for anyway?
    This is Alex we're talking about. The same guy who renamed the site because of his grandma.

    I guess I thought that mentality had been put aside with the demise of the "Worse Than Failure" idiocy.

    Besides, people don't really think he actually changed the name because of his grandmother, do they?

  • (cs)

    It's an inkblot test. I see my wife's episiotomy.

  • (cs) in reply to Someone You Know
    Someone You Know:
    s there really any point to censoring the phrase

    Is there really any point to spelling out the phrase "What The Fuck" when everyone knows what "WTF" stands for anyway? Or are you just some juvenile script kiddie who still gets his kicks saying bad words.

    While everyone knows what it means, some of us appreciate the censorship so that it's a little less NSFW. You know, those of us who are grown up enough to actually have jobs? You'll get there someday, kid, if you're lucky.

  • (cs) in reply to zikko
    zikko:
    Three different version!

    Great. Another loser heard from who has to get his kicks from criticizing typos. Yay.

    We adults with basic reading skills knew what he meant. Perhaps you should take a class.

  • (cs)

    OH NO!

    And here we thought that a text-only display could prevent us from BLIT. :P

  • Chris (unregistered)

    Upon reading this, I got all excited and decided that my sql client had to show me this work. The screenshot was just not enough.

    As I was watching it think, I realized I just ran some sql found on the interweb without really reading or understanding it. Wow. TRWTF is me.

  • Nick (unregistered)

    This is awesome. I want that guy on my team.

  • sam (unregistered) in reply to memals

    [quote user=memals] Zero matches :( I am very disappointed. I expected at least 1% to encode into another valid string. [/quote]

    You have to sort the input before using uniq; it only looks at adjacent lines.

  • Me (unregistered) in reply to dkf

    Ouch!

  • Yep (unregistered)

    Käsebrot, imo.

  • (cs) in reply to Chris
    Chris:
    Upon reading this, I got all excited and decided that my sql client had to show me this work. The screenshot was just not enough.

    As I was watching it think, I realized I just ran some sql found on the interweb without really reading or understanding it. Wow. TRWTF is me.

    TRWTF would have been if you ran it on a production database server.

  • Paul (unregistered) in reply to Arancaytar
    Arancaytar:
    Chris:
    Upon reading this, I got all excited and decided that my sql client had to show me this work. The screenshot was just not enough.

    As I was watching it think, I realized I just ran some sql found on the interweb without really reading or understanding it. Wow. TRWTF is me.

    TRWTF would have been if you ran it on a production database server.

  • Addison (unregistered) in reply to Chris

    I did the same thing, only I went "huh, the only thing it does is select letters" and hit F5.

  • Impressed (unregistered)

    Jaw droppingly cool...

    But how do you get it to "zoom in" to one of the curls?

  • (cs) in reply to KenW
    KenW:
    Someone You Know:
    s there really any point to censoring the phrase

    Is there really any point to spelling out the phrase "What The Fuck" when everyone knows what "WTF" stands for anyway? Or are you just some juvenile script kiddie who still gets his kicks saying bad words.

    While everyone knows what it means, some of us appreciate the censorship so that it's a little less NSFW. You know, those of us who are grown up enough to actually have jobs? You'll get there someday, kid, if you're lucky.

    Well done! Hadn't had a good laugh yet this morning.

  • (cs) in reply to memals
    memals:
    Just for *fun* I took the ispell 354984 word list and rot13'd it. ... ... ... cat BIG.LST | uniq --repeated > ROTRES.LST ... ... ...

    uniq expects the list to be sorted.

    From the man page:

    NAME
           uniq - report or omit repeated lines
    
    SYNOPSIS
           uniq [OPTION]... [INPUT [OUTPUT]]
    
    DESCRIPTION
           Discard all but one of successive identical lines from INPUT 
          (or standard input), writing to OUTPUT (or standard output).
    ...
    ...
    ...
    

    you should be using sort | uniq there.

  • (cs) in reply to Someone You Know
    Someone You Know:
    Is there really any point to censoring the phrase "What The Fuck" when everyone knows what "WTF" stands for anyway?
    It stands for "Worse Than Failure". If you're filling in the other phrase, it's coming out of your own nasty mind. :D

Leave a comment on “Stupid Coding Tricks: The T-SQL Mandelbrot”

Log In or post as a guest

Replying to comment #229841:

« Return to Article