Comment On Stupid Coding Tricks: The T-SQL Mandelbrot

The bar for entry into CodeSOD is pretty straight forward: professionally-developed code that elicits that certain What The— reaction. Though there have been a few exceptions over the years, generally speaking, student code, hobbyist code, and amateur code need not apply. That said, I'd like to try something a little different today. Today's example is not technically professionally-developed, it's a Stupid Coding Trick. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:04 • by 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...

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:05 • by 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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:09 • by Someone You Know
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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:10 • by Carl (unregistered)
And this is why programmers should not be math majors.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:10 • by zikko (unregistered)
229811 in reply to 229806
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?

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:15 • by tdittmar
229813 in reply to 229806
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"?

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:16 • by 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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:31 • by Zagyg
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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:33 • by blindman (unregistered)
I coined a term for this type of entertaining, yet uselss code a long time ago: "MSSQLbation".

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:33 • by 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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:37 • by Heinz 53 (unregistered)
229821 in reply to 229813
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...

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:37 • by Tachyon (unregistered)
229822 in reply to 229811
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...

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:40 • by mauhiz (unregistered)
that easily owns any of my usual bored activies.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:50 • by 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!

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:53 • by snoofle
How about [i]Impressively Useless[i] Coding Tricks?

Could be an interesting regular feature!

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:54 • by 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"

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:56 • by Smeagle (unregistered)
229829 in reply to 229813
Depends on the region. Here in Bavaria, it's "Madel" for girl. So "Madelbrot" would be girlybread?

- Oliver

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 08:58 • by Mark (unregistered)
My WTF on this is why was he at work on a Sunday (10-12-2008) with nothing better to do?

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:01 • by g (unregistered)
229831 in reply to 229826
2005+ (as it uses PIVOT).

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

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:01 • by 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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:06 • by Sean (unregistered)
229833 in reply to 229814
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

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:10 • by JD (unregistered)
The Article:
What's the most useless thing I could do with my time without actually doing anything?

How about this website?

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:13 • by UUoCA (unregistered)
229835 in reply to 229828
http://partmaps.org/era/unix/award.html

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:14 • by Herman (unregistered)
I made a 2.5D rolling ball application made out of WinForms buttons once.

facilisis = the new syfilis, get it NOW!

dc mandelbrot

2008-11-19 09:15 • by 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

Re: dc mandelbrot

2008-11-19 09:21 • by ion (unregistered)
229839 in reply to 229837
Oh, since the article mentioned quines, i might as well include a dc quine:

[91PP[dx]93PP]dx

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:22 • by 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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:23 • by Carl (unregistered)
229841 in reply to 229840
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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:29 • by BadFellas.org (unregistered)
Stupid coding trick? This is awesome! :D This is a clever waste of time, not a WTF!

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:34 • by ParkinT
229845 in reply to 229842
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)

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:38 • by anne (unregistered)
229846 in reply to 229821
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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:38 • by blah (unregistered)
229847 in reply to 229809
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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:42 • by 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

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 09:59 • by Someone You Know
229852 in reply to 229847
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?

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 09:59 • by Charles400
It's an inkblot test. I see my wife's episiotomy.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 10:02 • by KenW
229855 in reply to 229809
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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 10:03 • by KenW
229856 in reply to 229811
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.

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 10:10 • by Arancaytar
OH NO!

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

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 10:16 • by 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.

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 10:20 • by Nick (unregistered)
This is awesome. I want that guy on my team.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 10:22 • by sam (unregistered)
229860 in reply to 229828
[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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 10:24 • by Me (unregistered)
229861 in reply to 229814
Ouch!

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 10:24 • by Yep (unregistered)
Käsebrot, imo.

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 10:26 • by Arancaytar
229863 in reply to 229858
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.

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 10:29 • by Paul (unregistered)
229865 in reply to 229863
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.

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 10:30 • by Addison (unregistered)
229866 in reply to 229858
I did the same thing, only I went "huh, the only thing it does is select letters" and hit F5.

Re: Stupid Coding Tricks: The T-SQL Mandelbrot

2008-11-19 10:30 • by Impressed (unregistered)
Jaw droppingly cool...

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

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 10:51 • by Someone You Know
229868 in reply to 229855
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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 10:54 • by seconddevil
229870 in reply to 229828
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.

Re: Stupid Coding Tricks: The T-SQL Madlebrot

2008-11-19 10:56 • by Code Dependent
229871 in reply to 229809
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
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment