Question of the Day for 21 Dec 2009

  • Jedak (12/22/2009)


    Toreador (12/22/2009)


    "Due to the Holiday Season, and Frosty being a part of the season, an easy question was in order. "

    It might be easy if you're American. Who's Frosty the Snowman?!?

    :unsure:

    Frosty the Snowman

    Frosty the Snowman (TV Special)

    Don't believe the propaganda!

    Frosty is an evil snow golem! You can tell he's evil, because he wears a black hat! (Just check out old cowboy movies for the proof.)

    He tricks innocent children into travelling to the north pole. Well-organized, well-funded adult expeditions with expert navigators and professional explorers still suffer high mortality rates on that kind of trip. Frosty is obviously trying to kill all the children in the whole town!

    Which should be no surprise when you consider he is evil, as evidenced by his black hat.

    Kind of a Pied Piper story, but with a snow monster created by an evil black hat instead of a musician trying to make a living by unconventional rat extermination.

    But the black hat gives it all away. Along with leading children to their certain doom at the north pole.

    😀

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • GSquared (12/22/2009)


    Jedak (12/22/2009)


    Toreador (12/22/2009)


    "Due to the Holiday Season, and Frosty being a part of the season, an easy question was in order. "

    It might be easy if you're American. Who's Frosty the Snowman?!?

    :unsure:

    Frosty the Snowman

    Frosty the Snowman (TV Special)

    Don't believe the propaganda!

    Frosty is an evil snow golem! You can tell he's evil, because he wears a black hat! (Just check out old cowboy movies for the proof.)

    He tricks innocent children into travelling to the north pole. Well-organized, well-funded adult expeditions with expert navigators and professional explorers still suffer high mortality rates on that kind of trip. Frosty is obviously trying to kill all the children in the whole town!

    Which should be no surprise when you consider he is evil, as evidenced by his black hat.

    Kind of a Pied Piper story, but with a snow monster created by an evil black hat instead of a musician trying to make a living by unconventional rat extermination.

    But the black hat gives it all away. Along with leading children to their certain doom at the north pole.

    😀

    Quite the cynical view there. 😉

  • GSquared (12/22/2009)


    Jedak (12/22/2009)


    Toreador (12/22/2009)


    "Due to the Holiday Season, and Frosty being a part of the season, an easy question was in order. "

    It might be easy if you're American. Who's Frosty the Snowman?!?

    :unsure:

    Frosty the Snowman

    Frosty the Snowman (TV Special)

    Don't believe the propaganda!

    Frosty is an evil snow golem! You can tell he's evil, because he wears a black hat! (Just check out old cowboy movies for the proof.)

    He tricks innocent children into travelling to the north pole. Well-organized, well-funded adult expeditions with expert navigators and professional explorers still suffer high mortality rates on that kind of trip. Frosty is obviously trying to kill all the children in the whole town!

    Which should be no surprise when you consider he is evil, as evidenced by his black hat.

    Kind of a Pied Piper story, but with a snow monster created by an evil black hat instead of a musician trying to make a living by unconventional rat extermination.

    But the black hat gives it all away. Along with leading children to their certain doom at the north pole.

    😀

    Is it really black?

    With all that technicolor, my version looks like a grey hat 😉

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • CirquedeSQLeil (12/22/2009)


    GSquared (12/22/2009)


    Jedak (12/22/2009)


    Toreador (12/22/2009)


    "Due to the Holiday Season, and Frosty being a part of the season, an easy question was in order. "

    It might be easy if you're American. Who's Frosty the Snowman?!?

    :unsure:

    Frosty the Snowman

    Frosty the Snowman (TV Special)

    Don't believe the propaganda!

    Frosty is an evil snow golem! You can tell he's evil, because he wears a black hat! (Just check out old cowboy movies for the proof.)

    He tricks innocent children into travelling to the north pole. Well-organized, well-funded adult expeditions with expert navigators and professional explorers still suffer high mortality rates on that kind of trip. Frosty is obviously trying to kill all the children in the whole town!

    Which should be no surprise when you consider he is evil, as evidenced by his black hat.

    Kind of a Pied Piper story, but with a snow monster created by an evil black hat instead of a musician trying to make a living by unconventional rat extermination.

    But the black hat gives it all away. Along with leading children to their certain doom at the north pole.

    😀

    Is it really black?

    With all that technicolor, my version looks like a grey hat 😉

    That would make him partially evil. Similar to Phil the Prince of Insufficient Light/Ruler of Heck.

  • Jedak (12/22/2009)


    CirquedeSQLeil (12/22/2009)


    GSquared (12/22/2009)


    Jedak (12/22/2009)


    Toreador (12/22/2009)


    ...

    That would make him partially evil. Similar to Phil the Prince of Insufficient Light/Ruler of Heck.

    How would that intro go?

    Behold the Powerful semi, sort-of,quazi, wannabe, partially evil, and doer of occasionally bad things - Frosty the Snowman (or Prince Phil).:hehe:

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • CirquedeSQLeil (12/22/2009)


    Jedak (12/22/2009)


    CirquedeSQLeil (12/22/2009)


    GSquared (12/22/2009)


    Jedak (12/22/2009)


    Toreador (12/22/2009)


    ...

    That would make him partially evil. Similar to Phil the Prince of Insufficient Light/Ruler of Heck.

    How would that intro go?

    Behold the Powerful semi, sort-of,quazi, wannabe, partially evil, and doer of occasionally bad things - Frosty the Snowman (or Prince Phil).:hehe:

    That fits. He kills all the children in a whole village, but he does it musically and they have fun while they're being led off to their certain doom. That qualifies as dark gray, I guess. 😛

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Now, it just so happens that yesterday was my birthday, and I know I never disclosed it. I thought for a moment I had encountered some one with uncanny ability.

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

  • Greg Snidow (12/22/2009)


    Now, it just so happens that yesterday was my birthday, and I know I never disclosed it. I thought for a moment I had encountered some one with uncanny ability.

    Well Happy Birthday to you too. It was my birthday - and thus part of the reason for the question done as it was.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Typical Collation Bugs that hurt portability.

    tempid - TempID

    englishalpha - EnglishAlpha

    Master.sys.SysColumns (should be) master.sys.columns

    (I'd prefer) master.sys.columns (SQL2005 view for portability with SQL 2000)

    A lot of posted SQL code falls apart when run on Latin1_General_BIN

  • necs (12/24/2009)


    Typical Collation Bugs that hurt portability.

    tempid - TempID

    englishalpha - EnglishAlpha

    Master.sys.SysColumns (should be) master.sys.columns

    (I'd prefer) master.sys.columns (SQL2005 view for portability with SQL 2000)

    A lot of posted SQL code falls apart when run on Latin1_General_BIN

    The script was designed for 2005 and above. 2000 does not support CTEs, which are used heavily in this question. Since the CTE would not work on SQL 2000, it made no sense to use a backward compatible view made for SQL 2000.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • CirquedeSQLeil (12/22/2009)


    I knew somebody would do this.

    Thanks Jeff

    Heh... you just had to know it was going to be me. 🙂 Thanks for the fun, Jason. Good QoD.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • GSquared (12/21/2009)


    I had to decipher the code based on the usual methodology. I haven't seen the Frosty the Snowman movie since the 70s.

    I did the same - in my case, I'd never seen the movie so the clue meant nothing at all.

    Amusing question though.

    Yes, amusing. If that dba worked for me she would get a lecture on (a) providing comments and (b) avoiding code obscurity!:( My solution for this would work fine in SQL Server 2000 (appended at end).

    Steve: Is there a way to get the code in these to copy-and-paste without losing line-breaks? After I answer, I like to test it, and I have to go through and manually re-add line breaks after copying it into SSMS.

    Just copy it from the email into an empty word document, then select it all and copy from there to a query window. Don't ask me why this works, though - I haven't a clue.

    Here's my code (SQLS 2K, 2K5 and 2K8 compatible) for doing this "decryption":

    use tempdb

    go

    declare @enc varchar(100)Select @enc = '.8.1.16.16.25.27.2.9.18.20.8.4.1.25.'

    -- @enc is the ciphertext with element seperators added front and back

    declare @dec varchar(100) set @dec='' -- to hold the deciphered message.

    create table #temp(id int not null primary key clustered, lett char(1) not null)

    -- number to character translation table

    insert #temp (id,lett) select J, char(J+64) from master.dbo.Tally where J < 27

    -- I have a 11000 row tally table master.dbo.Tally, so that I don't have to keep on creating one.

    insert #temp (id,lett) select 27,' '

    declare @trans table (posn int identity primary key clustered, letter char(1))

    --this table (variable) will hold the deciphered elements of the message

    -- The next insert is standard separation code, see for example Jeff Moden's article

    -- The "Numbers" or "Tally" Table: What it is and how it replaces a loop.

    -- at http://www.sqlservercentral.com/articles/T-SQL/62867/

    insert @trans(letter)

    select T.lett from #temp T, master.dbo.tally tally

    where T.id = substring(@enc,J+1,CHARINDEX('.',@enc,J+1)-J-1)

    and J < LEN(@enc) and substring(@enc,J,1) = '.'

    --put the translated elements back together, and display them

    select @dec = @dec+letter from @trans order by posn option (maxdop 1)

    -- maxdop 1 option ensures the order is correct

    -- order by posn is actually redundant - in effect it's just a comment

    select @dec

    drop table #temp -- tidy up

    Tom

  • I had my 14 year old solve it 😛

    I gave it to her without the SQL code and she did a standard alphabet/number decode... I am going to try it in the query analyzer next just for fun.

    Great question... anyone have a practical application for this one? Besides decoding birthday messages 😀

    Peter Trast
    Microsoft Certified ...(insert many literal strings here)
    Microsoft Design Architect with Alexander Open Systems

  • Tom.Thomson (2/8/2010)


    GSquared (12/21/2009)


    I had to decipher the code based on the usual methodology. I haven't seen the Frosty the Snowman movie since the 70s.

    I did the same - in my case, I'd never seen the movie so the clue meant nothing at all.

    Amusing question though.

    Yes, amusing. If that dba worked for me she would get a lecture on (a) providing comments and (b) avoiding code obscurity!:( My solution for this would work fine in SQL Server 2000 (appended at end).

    Steve: Is there a way to get the code in these to copy-and-paste without losing line-breaks? After I answer, I like to test it, and I have to go through and manually re-add line breaks after copying it into SSMS.

    Just copy it from the email into an empty word document, then select it all and copy from there to a query window. Don't ask me why this works, though - I haven't a clue.

    ...

    Occasionally the copy and paste from SSC adds some non-printing characters to the code. This can be avoided by pasting first to notepad++ (or something of the like), then you can see the non-printables and remove them. Or do just as you have done.

    Sorry for the late reply. I didn't get the notification that somebody posted a new comment on this thread.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • petertrast (3/20/2010)


    I had my 14 year old solve it 😛

    I gave it to her without the SQL code and she did a standard alphabet/number decode... I am going to try it in the query analyzer next just for fun.

    Great question... anyone have a practical application for this one? Besides decoding birthday messages 😀

    Thanks.

    I haven't really thought of a practical use for the deciphering used in this question. However, it does show just another one of those things that can be done using CTEs in SQL.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 15 posts - 16 through 30 (of 32 total)

You must be logged in to reply to this topic. Login to reply