• (cs)

    What? Are you suggesting the number of days in a week should be hardcoded? Sloppy.

  • (cs)

    This is beautiful - it is ready to handle both solar and lunar weeks!

    Also, when we finally get to another planet, the "week" will certainly have more/less than 7 days; we need to plan for this!

  • TopCod3rFan (unregistered)

    wow. just wow.

  • iogy (unregistered)

    Heh, neat. In my coworkers webapp I found the following table:

    id      year
    1       1990
    2       1991
    3       1992
    4       1993
    (and so on)
    36      2025
    

    Oh well, at least this was beyond his planned lifespan.

  • Dave (unregistered)

    Reminds me of the code for the timesheet software at a company I used to work at. That was written in good old VB as well.

  • m (unregistered)

    "By the time he found the below snippet, he felt like he needed a cold shower."

    The code made him horny?

  • Fair warning (unregistered)

    If you haven't been around much:

    When TopCod3r posts (and he will post) about how he used to require his team to code in such and such a manner, ignore it. He's trolling, and if you respond you will be mocked by all the kids here who are way cooler than you will ever be.

  • Luis Guerrero (unregistered)

    Somehow, this is going to get blamed on good ol' trusty VB.

    captcha wisi

    As in wisi-washi code?

  • (cs) in reply to iogy
    iogy:
    Heh, neat. In my coworkers webapp I found the following table:
    id      year
    1       1990
    2       1991
    3       1992
    4       1993
    (and so on)
    36      2025
    
    Oh well, at least this was beyond his planned lifespan.
    I have read some magazine article a while ago about the best and fastest way to do some calculations needed for some yearly report. The answer was a stored procedure, and it had some queries perform joins to a table like the one in the TDWTF article. It wouldn't take too long to become a WTF similar to this one, if the magazine article had not pointed out that the current year records should be deleted when you were to append next year's records
  • (cs) in reply to Fair warning
    Fair warning:
    If you haven't been around much:

    When TopCod3r posts (and he will post) about how he used to require his team to code in such and such a manner, ignore it. He's trolling, and if you respond you will be mocked by all the kids here who are way cooler than you will ever be.

    And if you feel the need to prewarn people about TopCod3r in advance, it means you've fallen prey to him at least once and been embarrassed as a result.

  • (cs) in reply to snoofle
    snoofle:
    Also, when we finally get to another planet, the "week" will certainly have more/less than 7 days; we need to plan for this!
    It might, or it might not. Week is a purely artificial unit of measure, as are the units shorter than a day. Even month is somewhat artificial these days, with the calendar makers wanting to have an integral amount of months in a year. I believe the 24/60/60 subdivision of day is a legacy of ancient Babylonians, and week probably has its origins in the Bible.

    If we designed a new system of measures for time with no legacy support, we'd probably end up with day divided into 100 thousand units (10/100/100) and possibly a week of 5 or 10 days.

  • Don't be fooled (unregistered) in reply to Fair warning
    If you haven't been around much:

    When TopCod3r posts (and he will post) about how he used to require his team to code in such and such a manner, ignore it. He's trolling, and if you respond you will be mocked by all the kids here who are way cooler than you will ever be.

    ...and if someone else post something that defends the practices in the article and you respond; you've been trolled by a n00b! I will mock you even more, since I am cool (way more than you'll ever be.)

  • Fair warning (unregistered) in reply to KenW
    KenW:
    And if you feel the need to prewarn people about TopCod3r in advance, it means you've fallen prey to him at least once and been embarrassed as a result.

    Incorrect! But thanks for playing.

  • notme (unregistered) in reply to tdb
    tdb:
    If we designed a new system of measures for time with no legacy support, we'd probably end up with day divided into 100 thousand units (10/100/100) and possibly a week of 5 or 10 days.

    See: Discordian Calendar

  • Dirk Diggler (unregistered)

    Instead of storing the calendar in a table, they should have used DATA statements. It's a lot faster than database access and you can make change right in the code.

  • (cs) in reply to tdb
    tdb:
    If we designed a new system of measures for time with no legacy support, we'd probably end up with day divided into 100 thousand units (10/100/100) and possibly a week of 5 or 10 days.

    Maybe if you're one of the few who use metric system. Here in the US we like our measurements (whether they be time, length, or mass) to be intuitive. 12 inches = 1 foot, 3 feet = 1 yard, 1760 yards = 1 mile.

  • (cs)

    We had a scheduling system with tables named 1998, 1999, 2000, etc. It stopped working every year right after the holidays.

    I asked why we don't make the year a column. I was told that the table would get too big if we kept reusing the same table every year.

  • Stewie (unregistered) in reply to akatherder
    Here in the US we like our measurements (whether they be time, length, or mass) to be intuitive. 12 inches = 1 foot, 3 feet = 1 yard, 1760 yards = 1 mile.

    My feet are under 11 inches, my yard is bigger than 3 feet and I don't have a mile, you insensitive clod!

  • Addison (unregistered) in reply to akatherder
    akatherder:
    tdb:
    If we designed a new system of measures for time with no legacy support, we'd probably end up with day divided into 100 thousand units (10/100/100) and possibly a week of 5 or 10 days.

    Maybe if you're one of the few who use metric system. Here in the US we like our measurements (whether they be time, length, or mass) to be intuitive. 12 inches = 1 foot, 3 feet = 1 yard, 1760 yards = 1 mile.

    shivers- if you weren't being sarcastic I would be very frightened.

    Last time I checked well over 5.5 billion people used metric. I hope you like being in a club where you're the only member. Well, other then Burma and Liberia. But they don't count.

    Once we colonize other planets there will develop a metric-style time system.

  • TopCod3r Fan Boy (unregistered) in reply to Fair warning
    Fair warning:
    If you haven't been around much:

    When TopCod3r posts (and he will post) about how he used to require his team to code in such and such a manner, ignore it. He's trolling, and if you respond you will be mocked by all the kids here who are way cooler than you will ever be.

    Oh TopCod3r, where art thou?

  • Ebs2002 (unregistered)

    I hear that topcoder's account was banned...

  • Erikj (unregistered) in reply to tdb
    tdb:
    snoofle:
    Also, when we finally get to another planet, the "week" will certainly have more/less than 7 days; we need to plan for this!
    It might, or it might not. Week is a purely artificial unit of measure, as are the units shorter than a day. Even month is somewhat artificial these days, with the calendar makers wanting to have an integral amount of months in a year. I believe the 24/60/60 subdivision of day is a legacy of ancient Babylonians, and week probably has its origins in the Bible.

    If we designed a new system of measures for time with no legacy support, we'd probably end up with day divided into 100 thousand units (10/100/100) and possibly a week of 5 or 10 days.

    Any time unit other then second is a convience unit... the second is the official SI unit for time-measurement.

    Both the day and the year measure cycles, but they are not the official units for time and indeed depend on the planet you happen to be on.

  • nobis (unregistered) in reply to Addison
    Addison:
    akatherder:
    tdb:
    If we designed a new system of measures for time with no legacy support, we'd probably end up with day divided into 100 thousand units (10/100/100) and possibly a week of 5 or 10 days.

    Maybe if you're one of the few who use metric system. Here in the US we like our measurements (whether they be time, length, or mass) to be intuitive. 12 inches = 1 foot, 3 feet = 1 yard, 1760 yards = 1 mile.

    Once we colonize other planets there will develop a metric-style time system.
    What's this obsession with 10s? Hexi is sexy! 256 hours in a day, 16 minutes in an hour, 16 seconds in a minute.

  • (cs) in reply to Addison

    There is an unfortunate inability to change the number of days it takes for a planet to revolve around its star, and this leads to some people's unnecessary hacks in the calendar to make everything fit. What we really need is either:

    a) a planet that revolves around its star in a power of 10 days

    or

    b) to count all future time with systems base-x, based on this one thing we can't change. Of course, this still creates a problem if the number of days in a year is not an integer. And if it's a prime number, that doesn't really leave us much choice as to subdividing the year into months or weeks, etc.

  • Bernard (unregistered)

    I come from the UK - we like to use imperial for milk, beer and speed limits. Everything else is metric. Not sure how we ended up like this...

  • Bob (unregistered)

    Didn't you hear, 12 is the new 10.

  • Keith (unregistered)

    100+ lines of code for something that can be done in nearly 5 lines (as long as you don't mind hard-coding the fact that there are 5 days in a work week). This is a common practice when you are dealing with people who want to keep their jobs secure. Here is one way to correct the code:

    Function fDaysLeftInWeek(ByVal dateToTest As Date) As Integer
        Select Case Weekday(dateToTest)
            Case 1, 7:  Return 0 'Or whatever you want to return if today is Saturday/Sunday
            Case Else:  Return 6 - Weekday(dateToTest) 'The "magic number" 6 is dangerously meaningful!!! - this will return 4 on a Monday.
        End Select
    End Function
    
  • (cs)

    I am a star. My co-workers revolve around me. Redefine the year!

  • (cs) in reply to akatherder

    Don't get this as an anti imperial system rant but why is 12inch=1foot, 3feet=1yard, 1760yards=1mile more intuitive than simple multiplication (or division) by 10 for each prefix? Also there are many people using the metric system, probably more than the ones using the imperial one: most of Europe, most of Asia (if I'm not mistaken China too which really boosts the number), probably most of South America etc. Imperial is used only in the former British Empire countries which don't amount to a large portion of the world population.

    Anyway that is irrelevant to the idea of a non-legacy time measurement system. The current units are very well rooted in the systems and minds of today and it would be very hard and pointless to change them. I see no problem in having 24hour days, 60minute hours and 60 second minutes. Computers can calculate those pretty easily and it's not really hard for humans either. The real problem is the fact that the year has 365.24219 days. Also another issue is that the Earth doesn't have a constant angular speed around the Sun which makes finding the current time even harder. The orbit also shifts each year, the Polar Axis is rotating and oscillating and the Earth's spin is slowly decreasing. All those give huge headaches to people that need to calculate the day and time of day but the units of measurement are really of no importance.

  • Edward Royce (unregistered) in reply to Bernard
    Bernard:
    I come from the UK - we like to use imperial for milk, beer and speed limits. Everything else is metric. Not sure how we ended up like this...

    Because those are the important bits.

  • A. Cube (unregistered) in reply to tdb
    If we designed a new system of measures for time with no legacy support, we'd probably end up with day divided into 100 thousand units (10/100/100) and possibly a week of 5 or 10 days.

    The French tried a decimal time system--it didn't catch on.

  • Stewie (unregistered) in reply to nobis
    nobis:
    What's this obsession with 10s? Hexi is sexy! 256 hours in a day, 16 minutes in an hour, 16 seconds in a minute.

    Errr... if we used hex it would still be 100 hours in a day, 10 minutes in an hour and 10 seconds in a minute (as long as you used both base 16 time and base 16 numbering).

  • guessed (unregistered) in reply to durnurd
    durnurd:
    There is an unfortunate inability to change the number of days it takes for a planet to revolve around its star, and this leads to some people's unnecessary hacks in the calendar to make everything fit. What we really need is either:

    a) a planet that revolves around its star in a power of 10 days

    Just as I suspected -- it's a hardware issue.

  • Ossi (unregistered) in reply to Charles400
    Charles400:
    I am a star. My co-workers revolve around me. Redefine the year!

    Reminds me of the former German chancellor Helmut Kohl, who apparently got so fat he had two smaller chancellors orbiting him. Or so they say...

    Captcha: usitas, the usual...

  • (cs) in reply to Bernard
    Bernard:
    I come from the UK - we like to use imperial for milk, beer and speed limits. Everything else is metric. Not sure how we ended up like this...
    To make drinking and driving easier to compute?

    Although that still doesn't explain the milk. Perhaps the metric system in England is simply lactose intolerant.

  • JR (unregistered)

    Most of this conversation is irrelevant - once they introduce the metric calendar in 2020 it's all going to change. 20 hour days and 10 day weeks, with a totally different definition for the 'metric hour' and 'metric second'. It's going to be a nightmare, I'm truly dreading it.

  • (cs)

    What? No XML ?!!!

  • 50% Opacity (unregistered) in reply to JR
    JR:
    20 hour days and 10 day weeks.

    If they keep the 40 hour work week I'm all for it.

  • Not Wtf (unregistered) in reply to TopCod3r Fan Boy
    TopCod3r Fan Boy:
    Oh TopCod3r, where art thou?

    I also heard TopCod3r got banned. If you go back and look at some previous articles it seems like all of his comments got deleted. It is almost like he never existed now.

    Why? I didn't think there was anything wrong with them, and have seen much, much worse comments on here, including some that have made it difficult for me to be able to read at work (due to language or offensive remarks). It seems the only moderation being done is to make sure someone else isn't TOO funny as to upstage Alex.

  • Mike D. (unregistered) in reply to Addison
    Addison:
    Last time I checked well over 5.5 billion people used metric. I hope you like being in a club where you're the only member. Well, other then Burma and Liberia. But they don't count.
    It wouldn't be the first time. I used Linux back in the mid-90's.
    Addison:
    Once we colonize other planets there will develop a metric-style time system.
    Already have it. It's simply the number of seconds since midnight, January 1, 1970.

    The trick is going to be working out a simpler means of compensating for time dilation. Because, you know, traveling fast underclocks your computer... and you, as well.

  • Another TopCod3r fan (unregistered) in reply to Ebs2002
    Ebs2002:
    I hear that topcoder's account was banned...

    What? Why? I have started reading the comment threads almost exclusively these days to see TopCod3r's response!

  • TopCod3r Fan Boy (unregistered) in reply to Not Wtf
    Not Wtf:
    I also heard TopCod3r got banned. If you go back and look at some previous articles it seems like all of his comments got deleted. It is almost like he never existed now.

    TopCod3r post doubleplusungood refs unperson. unbellyfill dwtf too luaghwise. rewrite fullwise upsub anteposting.

  • (cs) in reply to durnurd
    durnurd:
    What we really need is ... a planet that revolves around its star in a power of 10 days

    Take all the rocket engines on Earth, put them on one side of the planet (the "back" to speed up, the "front" to slow down) and fire them up (compensating for rotation) long enough to speed up [slow down] the planet until a year is a power of ten days long.

    Man prevails over nature and alters his environment.

    Problem solved.

  • Crabs (unregistered) in reply to Bernard
    Bernard:
    I come from the UK - we like to use imperial for milk, beer and speed limits. Everything else is metric. Not sure how we ended up like this...

    Well, because a pint is the perfect amount of beer to be served in one glass.

  • (cs) in reply to Fair warning
    Fair warning:
    If you haven't been around much:

    When TopCod3r posts (and he will post) about how he used to require his team to code in such and such a manner, ignore it. He's trolling, and if you respond you will be mocked by all the kids here who are way cooler than you will ever be.

    TopCod3r? Is that you? ;^)

  • (cs) in reply to Addison
    Addison:
    akatherder:
    tdb:
    If we designed a new system of measures for time with no legacy support, we'd probably end up with day divided into 100 thousand units (10/100/100) and possibly a week of 5 or 10 days.

    Maybe if you're one of the few who use metric system. Here in the US we like our measurements (whether they be time, length, or mass) to be intuitive. 12 inches = 1 foot, 3 feet = 1 yard, 1760 yards = 1 mile.

    shivers- if you weren't being sarcastic I would be very frightened.

    Last time I checked well over 5.5 billion people used metric. I hope you like being in a club where you're the only member. Well, other then Burma and Liberia. But they don't count.

    Once we colonize other planets there will develop a metric-style time system.

    The whole reason there are 60 minutes in an hour, 24 hours in a day, 12 inches in a foot, etc is that the aliens who originally colonized earth had 6 fingers on each hand.

  • Biggles (unregistered) in reply to Bernard
    Bernard:
    I come from the UK - we like to use imperial for milk, beer and speed limits. Everything else is metric. Not sure how we ended up like this...

    O RLY?

    My milk comes in 500 ml cartons, which is lessthan a pint. Sure, they charge me as if it's a pint, but it's not really.

  • (cs) in reply to vt_mruhlin
    vt_mruhlin:
    The whole reason there are 60 minutes in an hour, 24 hours in a day, 12 inches in a foot, etc is that the aliens who originally colonized earth had 6 fingers on each hand.
    Amen. After all, digital just means "Can be counted on ones fingers"... ;^)
  • (cs)

    I'd make a snarky comment about this, but only last Friday I found myself putting the following comments in one of my code files:

    /*

    • old agency listing code starts here ----
    • this is why I need to implement proper source control!!!
    <snip>
    • end of removed agency code. If only I had source control I could've
    • just deleted all that and saved myself this huge inline comment... */

    Yes, metaWTFs in my own code. I am rightly ashamed...

  • (cs)

    Metric division of the day isn't so hard, as long as you keep a day defined as the length of one rotation of the planet on its axis. In fact, you could design a near-perfect calendar under a metric scheme. Dividing a year into days will almost always require minor hacks (see: leap year).

    The only problem with colonizing a planet with a longer (or shorter) day is an evolutionary one; assuming a sleep cycle of 16 Earth hours awake, 8 Earth hours asleep, the first settlers will be dealing with the mother of all jet lag.

    This discussion reminds me of an old Doctor Who (Tom Baker years) which featured a planet with winters that were roughly 16 earth years (I may be off on the actual number). If humanity ever colonizes such a place, I hope they can recruit plenty of astronauts from upstate New York.

Leave a comment on “Code Dendrochronology”

Log In or post as a guest

Replying to comment #:

« Return to Article