• (cs)

    Let's party like it's 99/99!

  • (cs)

    I guess being a PHP god doesn't make him a design god, or db god, or any other type of god.

    King of such a small domain.

  • dguthurts (unregistered)

    The gods must be crazy

  • Moran (unregistered) in reply to golddog
    golddog:
    I guess being a PHP god doesn't make him a design god, or db god, or any other type of god.

    King of such a small domain.

    This seems like the work of Hephaestus.

  • (cs)
    A project that took other developers three month to finish, he was sure he could do in three weeks.
    This reminds me of Armin Sander, the developer of Oktalyzer on the Commodore Amiga.

    Once, I went to the Amiga fair in Cologne, Germany, around 1990. A friend of mine was demonstrating a product of his, and I showed him a Mandelbrot set generator that didn't include such niceties as boundary crawl, or zooming for that matter, but it drew the standard set in 40 seconds on a stock Amiga 500, in 320x256 resolution, using hand-optimised assembly code. And on an Amiga with a faster processor, it obviously ran much faster.

    Armin boasted that he could make it run twice as fast.

    A little later he came to ask how to actually draw a Mandelbrot set.

  • (cs)
    His computer was named godbox, which matched his login name of god.
    Rule of Programming: If you call yourself a god, your code is sure to be featured on TheDailyWTF.com some day.
  • tom103 (unregistered)

    This year/month representation also doesn't handle dates prior to 2000 (or later than 2099), which is quite unforgivable after the panic caused by Y2K...

  • Moxy (unregistered) in reply to golddog
    golddog:
    King of such a small domain.

    Once, I was the King of Spain.

  • (cs)
    So March, 2010 would be 1003. It is not clear why it would require 5 characters varchar...
    No, I think it's pretty clear he got his start in C.
  • Daniel Fountain (unregistered) in reply to boog

    Or perhaps if someone is conceited enough to call themself a god they should realise there is ALWAYS something you dont know how to do in any area of IT. No one knows everything.

    Or sometimes some people seem to know nothing.....

  • portablejim (unregistered)

    I am an inexperienced programmer, an so I use the CodeSODs to identify the problems with the code and write something better (someone normally posts a better solution somewhere in the comments).

    I would do it with:

    • DATE instead of VARCHAR
    • SELECT * FROM DataTable ORDER BY yearmonth LIMIT 3

    <personal_achievement> nearly first </personal_achievement>

  • Pik (unregistered) in reply to tom103
    tom103:
    This year/month representation also doesn't handle dates prior to 2000 (or later than 2099), which is quite unforgivable after the panic caused by Y2K...

    2099

    It does. What do you think 5 in varchar(5) is for? This guy was thinking over millenium!

  • imgx64 (unregistered)

    TRWTF is the base-12 calendar, obviously. We should move to the decimal system.

  • Anonymous (unregistered)

    The column is a VARCHAR(5) so it can store the 4 characters of the year/month, plus the null terminator. Duhuh!

  • dguthurts (unregistered) in reply to portablejim
    portablejim:
    I am an inexperienced programmer, an so I use the CodeSODs to identify the problems with the code and write something better (someone normally posts a better solution somewhere in the comments).

    I would do it with:

    • DATE instead of VARCHAR
    • SELECT <explicit list of fields> FROM DataTable ORDER BY yearmonth LIMIT 3

    <personal_achievement> nearly first </personal_achievement>

    FTFY

  • Merus (unregistered)

    That's the date format on the Gibson, isn't it.

  • portablejim (unregistered) in reply to dguthurts

    Is there really a difference when you are selecting 2 of 2 fields? Is it so you don't have to look up somewhere else the fields you are returning? Other reasons?

  • QJo (unregistered) in reply to Daniel Fountain
    Daniel Fountain:
    Or perhaps if someone is conceited enough to call themself a god they should realise there is ALWAYS something you dont know how to do in any area of IT. No one knows everything.

    Or sometimes some people seem to know nothing.....

    Somebody remind me of the psychological phenomenon that stupid people are too stupid to know how stupid they are, while wiser people are clever enough to know they're not really all that clever. Therefore people who think they're as clever as "god" must be the stupidest people in the world.

  • eVil (unregistered)

    If you're going to go around calling yourself 'a god', or indeed 'god', you had really better make sure in advance, that you are actually any good at the something.

    At the very least you had best not totally suck at what you're trying to be god of.

    Thats "calling yourself 'god' 101".

  • (cs) in reply to portablejim
    portablejim:
    Is there really a difference when you are selecting 2 of 2 fields? Is it so you don't have to look up somewhere else the fields you are returning? Other reasons?
    You're assuming that the database table structure is immutable and that no DBA or other developer decides to add, say, 100 columns. If you don't need all columns, don't select all columns, because they're all sent over the network and increase the load on the network, the database server and the client application.

    Also, if you do 'select *' and then get rows 1 and 2, and somebody modifies the table structure and inserts a field between what used to be rows 1 and 2, your application ceases functioning. (Pre-empting another common mistake here.)

    'select *' is a sign of laziness. And whilst certain kinds of laziness are good assets for a developer (spending a week to write a program that will save you 10 minutes on each new project that you start), other kinds of laziness are liabilities (doing something the easy way because you couldn't be bothered to do it the proper way, like copy-and-paste code).

  • (cs)

    $last_three_yearmonths[] = (string) $i;

    Wait, what? Array index much?

  • NotAGod (unregistered)

    I thought the WTF was the SQL Injection vector.

  • (cs) in reply to dguthurts
    dguthurts:
    SELECT <explicit list of fields>

    I love these people that just blindly repeat the claim that "SELECT *" is somehow evil, without any kind of understanding of whether is actually is, or why it could be.

  • The Poop... of DOOM (unregistered) in reply to portablejim
    portablejim:
    I am an inexperienced programmer, an so I use the CodeSODs to identify the problems with the code and write something better (someone normally posts a better solution somewhere in the comments).

    I would do it with:

    • DATE instead of VARCHAR
    • SELECT * FROM DataTable ORDER BY yearmonth LIMIT 3

    <personal_achievement> nearly first </personal_achievement>

    I'd go with a timestamp instead of a Date, but that's just my personal preference. I'm just more comfortable with PHP's timestamp handling than with its date handling. Plus, there's also something reassuring about just pulling an int in from the DB, instead of some object.
  • (cs)

    Obviously, his name was "Gregory Oliver Davis" (or something like that) and they named everything with initials.

  • MP79 (unregistered)

    this isn't really much of a wtf. I mean, the code simply won't work. Any reasonable test of this will fail. Side bar has seen much better wtf's recently.

  • QJo (unregistered) in reply to GalacticCowboy
    GalacticCowboy:
    Obviously, his name was "Gregory Oliver Davis" (or something like that) and they named everything with initials.

    Could have been called Godfrey.

    Then there was the place where our username used to be our first name (or diminutive) concatenated with the first letter or our surname. Yes, Chris T had an attitude problem.

  • Dramocles (unregistered)

    Reminds me a bit of a versioning system I designed when working for a now-defunct big box chain. We'd use a character representing the quarter of the year (A-Z starting in a specific quarter of a specific year), and two digits to represent the day in the 99-day quarter of the year (because some programmer's years aren't metric, but at least they have a nice round number of days [400]). The lead developer pointed out it not only wasn't Y2k compatible, it would blow up in 1997. "Yeah,", I replied, "but we both know we won't be working here for anything like that amount of time..."

  • (cs)

    What do you mean, "works only about 10 months of the year"?!!

    Clearly, this is meant to get the last 3 months of the most recent full year, and it works just fine when the most recent full year is from February 1 to February 1.

    If you were "god" then you would understand "god's" plan.

  • Someone who can't be bothered to login from work (unregistered) in reply to portablejim
    portablejim:
    I am an inexperienced programmer, an so I use the CodeSODs to identify the problems with the code and write something better (someone normally posts a better solution somewhere in the comments).

    I would do it with:

    • DATE instead of VARCHAR
    • SELECT * FROM DataTable ORDER BY yearmonth LIMIT 3

    <personal_achievement> nearly first </personal_achievement>

    Tom Kyte would approve. People storing typed data as a string is one of his bug bears.

  • anon (unregistered) in reply to golddog
    golddog:
    I guess being a PHP god doesn't make him a design god, or db god, or any other type of god.

    King of such a small domain.

    The dude manipulated time and space to create new months. Clearly he is god of everything, and was being modest by claiming to only be the god of PHP.

  • Someone who can't be bothered to login from work (unregistered) in reply to bertram
    bertram:
    dguthurts:
    SELECT <explicit list of fields>

    I love these people that just blindly repeat the claim that "SELECT *" is somehow evil, without any kind of understanding of whether is actually is, or why it could be.

    One argument is it brings back more data than you need. Which is frequently true, but not usually relevant. What's more relevant is that it will often result in poor usage of indexes.

  • dbers (unregistered) in reply to BentFranklin
    BentFranklin:
    $last_three_yearmonths[] = (string) $i;

    Wait, what? Array index much?

    Thats fine, thats an easy way to 'pop' an element on the end of a php array.

  • Gato (unregistered) in reply to QJo
    QJo:

    Somebody remind me of the psychological phenomenon that stupid people are too stupid to know how stupid they are, while wiser people are clever enough to know they're not really all that clever. Therefore people who think they're as clever as "god" must be the stupidest people in the world.

    You're thinking of the Dunning-Kruger Effect https://secure.wikimedia.org/wikipedia/en/wiki/Dunning%E2%80%93Kruger_effect

  • (cs) in reply to boog
    boog:
    So March, 2010 would be 1003. It is not clear why it would require 5 characters varchar...
    No, I think it's pretty clear he got his start in C.
    You'd think that would lead to a better, not worse, understanding of varchar. Oh well.
  • (cs) in reply to imgx64
    imgx64:
    TRWTF is the base-12 calendar, obviously. We should move to the decimal system.
    Actually, Napoleon tried something like that once. 10 hour days, 10 minute hours, 10 second minutes. Sadly, the masses rejected this unifyingly brillant concept and it didn't catch on.

    Why don't we actually move to a hexadecimal system?

  • Ryan (unregistered)

    Unrelatedly the punctuation in this WTF was horrible

  • EatenByAGrue (unregistered) in reply to dguthurts
    dguthurts:
    The gods must be crazy

    Just imagine the kind of trouble you're going to get if you drop a printout of this from an airplane into an ITT Tech campus.

  • FlyboyFred (unregistered) in reply to GalacticCowboy
    GalacticCowboy:
    Obviously, his name was "Gregory Oliver Davis" (or something like that) and they named everything with initials.

    I thought maybe it was GOD Over Djinn.

  • (cs) in reply to bertram
    bertram:
    dguthurts:
    SELECT <explicit list of fields>

    I love these people that just blindly repeat the claim that "SELECT *" is somehow evil, without any kind of understanding of whether is actually is, or why it could be.

    Not only is it potentially a performance killer, it's also just bad form from a 'clean code' perspective. Select only what columns you will use (including columns used in group by, where, having, etc) there's really no good reason I can see not to.

  • (cs) in reply to JiP
    JiP:
    imgx64:
    TRWTF is the base-12 calendar, obviously. We should move to the decimal system.
    Actually, Napoleon tried something like that once. 10 hour days, 10 minute hours, 10 second minutes. Sadly, the masses rejected this unifyingly brillant concept and it didn't catch on.

    Why don't we actually move to a hexadecimal system?

    For that matter, why don't we move to a unary date system and count the hash marks since Genesis Chapter 1?

  • Rodnas (unregistered) in reply to Moxy
    Moxy:
    golddog:
    King of such a small domain.

    Once, I was the King of Spain.

    I still am the King of Spain. I am also the Queen

    CAPTCHA acsi --- ver close to ascii

  • (cs) in reply to hoodaticus
    hoodaticus:
    JiP:
    imgx64:
    TRWTF is the base-12 calendar, obviously. We should move to the decimal system.
    Actually, Napoleon tried something like that once. 10 hour days, 10 minute hours, 10 second minutes. Sadly, the masses rejected this unifyingly brillant concept and it didn't catch on.

    Why don't we actually move to a hexadecimal system?

    For that matter, why don't we move to a unary date system and count the hash marks since Genesis Chapter 1?

    Picoseconds since the Big Bang is probably more appropriate. If we need to know how many that is, just ask god. He's in the next cubicle.

  • Jerry (unregistered) in reply to hoodaticus
    hoodaticus:
    JiP:
    imgx64:
    TRWTF is the base-12 calendar, obviously. We should move to the decimal system.
    Actually, Napoleon tried something like that once. 10 hour days, 10 minute hours, 10 second minutes. Sadly, the masses rejected this unifyingly brillant concept and it didn't catch on.

    Why don't we actually move to a hexadecimal system?

    For that matter, why don't we move to a unary date system and count the hash marks since Genesis Chapter 1?
    Even that would support addition and subtraction of time spans, something that flummoxes nearly all beginner attempts to program with our crazy second-minute-hour-day-week-month-year crap.

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    If we need to know how many that is, just ask god. He's in the next cubicle.
    QFT. This statement applies to practically everyone working in sofware development.
  • Rawr (unregistered) in reply to portablejim

    I can't tell if you're trolling or being sincere, so if it's the former- good work. I'm biting on the latter.

    1. Why are we hitting the database for something as simple as a month? There are very few reasons why we need to hit the database for this.

    2. Why are we storing months in a database table in the first place? Months are available in the database, and they are available for a multitude of regions and languages. For example, in SQL you'd say something like this SELECT DATENAME(MONTH, GETDATE()). This would display 'AUGUST' for me, for someone in a different country it would display the month in their respective language.

    3. Definitely should be DATE instead of varchar or DATETIME

  • Hortical (unregistered) in reply to Matt Westwood

    [quote user="Matt Westwood"][quote user="hoodaticus"]Why don't we actually move to a hexadecimal system? [/quote]For that matter, why don't we move to a unary date system and count the hash marks since Genesis Chapter 1?[/quote] Picoseconds since the Big Bang is probably more appropriate. If we need to know how many that is, just ask god. He's in the next cubicle.[/quote] The only cubicle next to me is empty. Does this mean I can eat at Mooby's with no worries?

  • Hortical (unregistered) in reply to Hortical
    Hortical:
    Matt Westwood:
    hoodaticus:
    Why don't we actually move to a hexadecimal system?
    For that matter, why don't we move to a unary date system and count the hash marks since Genesis Chapter 1?
    Picoseconds since the Big Bang is probably more appropriate. If we need to know how many that is, just ask god. He's in the next cubicle.
    The only cubicle next to me is empty. Does this mean I can eat at Mooby's with no worries?
  • Rawr (unregistered) in reply to portablejim
    portablejim:
    I am an inexperienced programmer, an so I use the CodeSODs to identify the problems with the code and write something better (someone normally posts a better solution somewhere in the comments).

    I would do it with:

    • DATE instead of VARCHAR
    • SELECT * FROM DataTable ORDER BY yearmonth LIMIT 3

    <personal_achievement> nearly first </personal_achievement>

    Rawr:
    I can't tell if you're trolling or being sincere, so if it's the former- good work. I'm biting on the latter.
    1. Why are we hitting the database for something as simple as a month? There are very few reasons why we need to hit the database for this.

    2. Why are we storing months in a database table in the first place? Months are available in the database, and they are available for a multitude of regions and languages. For example, in SQL you'd say something like this SELECT DATENAME(MONTH, GETDATE()). This would display 'AUGUST' for me, for someone in a different country it would display the month in their respective language.

    3. Definitely should be DATE instead of varchar or DATETIME

    Not sure what happened to my initial quote here... Doh.

  • fritters (unregistered) in reply to Moxy
    Moxy:
    golddog:
    King of such a small domain.

    Once, I was the King of Spain.

    Now I vacuum the turf at Skydome. Err... Rogers Center.

Leave a comment on “God Date Mangling 101”

Log In or post as a guest

Replying to comment #:

« Return to Article