Comment On Denumerating the DayOfWeekEnum

"When I first found this custom 'enum'," writes Garrett Hopp," I had assumed that my predecessor had re-implemented the DayOfWeek Enumeration. I suppose that wouldn't be that big of a WTF as discovering the built-in DayOfWeek does involve using a search engine... which many developers seem to struggle with." [expand full text]
« PrevPage 1 | Page 2Next »

Re: Denumerating the DayOfWeekEnum

2012-07-27 09:06 • by data nerd (unregistered)
He forgot FILENOTFOUND

Re: Denumerating the DayOfWeekEnum

2012-07-27 09:26 • by PedanticCurmudgeon
385806 in reply to 385781
NitPiC#:
Yeah, that is a bit curious.
I assume you've already read the wiki on the subject

7*4 == 28 is one possible link, but as Wiki points out, that is fairly week (yeah, pun intended, sorry).

Since it is referenced right in the first chapter of the Bible, the idea must have been around and firmly entrenched for ages, long before people started committing ancient myths to written documents.

Curious stuff indeed.
From the article:
The association of the days of the week with the Sun, the Moon, and the five planets visible to the naked eye dates to the Roman era (2nd century).

Re: Denumerating the DayOfWeekEnum

2012-07-27 09:27 • by n9ds
7 Days/Week is easy to explain, take the number of days in the year, figure on 50 weeks of useful work (which is a nice round number), then add 2 for vacation, and lo and behold you get 7 ish. Although I'm not sure what they'd do in places where they get more than 2 weeks of vacation. Maybe that's where the exchange rate comes into play.

Re: Denumerating the DayOfWeekEnum

2012-07-27 11:03 • by DWalker59
385813 in reply to 385756
Some Jerk:
I suspect that this individual must have been looking at source code and attempting to discern its' purpose. Apparently, this individual did not understand what they were doing, or perhaps the hash table might have been replaced with an equally rediculous coding structure... you know, like a REAL ENUM!?


Its'? That's a new variation.

Re: Denumerating the DayOfWeekEnum

2012-07-27 11:17 • by Nagesh (unregistered)
Is good to see WTF that not PHP. PHP gets too bad rap here, but these codesd show he can make WTF with C++ too.

Re: Denumerating the DayOfWeekEnum

2012-07-27 11:45 • by radarbob (unregistered)
385820 in reply to 385771
Spewin Coffee:
The real fail is using C#.

Fishing with Bill Dance!

Re: Denumerating the DayOfWeekEnum

2012-07-27 11:48 • by radarbob (unregistered)
385821 in reply to 385785
PHP Vigilante:
The real WTF is Java.

Fishing with Bill Dance!

Re: Denumerating the DayOfWeekEnum

2012-07-27 11:51 • by radarbob (unregistered)
385822 in reply to 385794
A. Nonymous:
PHP Vigilante:
The real WTF is not knowing Java.

TFTFY

Fishing with Bill Dance!

Re: Denumerating the DayOfWeekEnum

2012-07-27 12:14 • by radarbob (unregistered)
It all makes sense... Resume fodder. To wit:


Engineered highly efficient hash table used throughout the code base, significantly reducing processing time. So concise and well written as to be self documenting. Consistent; the hash table uses strings exclusively, giving a simplified API. I also leverage String's inherent trait of immutability thereby reducing not only error potential, but conserving memory in a 1.5M LOC system where every byte counts.

Please send the codz upon request.

Fishing with Crystal Meth

Re: Denumerating the DayOfWeekEnum

2012-07-27 12:18 • by foxyshadis (unregistered)
385825 in reply to 385806
PedanticCurmudgeon:
NitPiC#:
Yeah, that is a bit curious.
I assume you've already read the wiki on the subject

7*4 == 28 is one possible link, but as Wiki points out, that is fairly week (yeah, pun intended, sorry).

Since it is referenced right in the first chapter of the Bible, the idea must have been around and firmly entrenched for ages, long before people started committing ancient myths to written documents.

Curious stuff indeed.
From the article:
The association of the days of the week with the Sun, the Moon, and the five planets visible to the naked eye dates to the Roman era (2nd century).


That's from at least a millennium or two after the 7-day week became common, though, so it obviously has nothing to do with the origins.

Personally, I think it's most likely that an early prophet of some forgotten religion (what we'd call a cult leader now), maybe prior to Judaism entirely, came up with the absolute 7-day cycle and it stuck and spread. Similar arbitrary customs happen all the time, because sometimes it doesn't matter what you use as long as everyone agrees.

Re: Denumerating the DayOfWeekEnum

2012-07-27 12:48 • by PedanticCurmudgeon
385830 in reply to 385825
foxyshadis:
PedanticCurmudgeon:
From the article:
The association of the days of the week with the Sun, the Moon, and the five planets visible to the naked eye dates to the Roman era (2nd century).


That's from at least a millennium or two after the 7-day week became common, though, so it obviously has nothing to do with the origins.
Unless the association goes back further than Wikipedia cares to admit, which it does.

Re: Denumerating the DayOfWeekEnum

2012-07-27 13:12 • by Nagesh
7 day week borrowed from ancient hindu calendar systems.
Jesus Christ visited India and stay with several folks over here and learn magics tricks.
Between the age of 13 - 28.

None of this visit documented in Bible, but we Hindu know better.

Re: Denumerating the DayOfWeekEnum

2012-07-27 17:10 • by n9ds
385845 in reply to 385833
Nagesh:
7 day week borrowed from ancient hindu calendar systems.
Jesus Christ visited India and stay with several folks over here and learn magics tricks.
Between the age of 13 - 28.

None of this visit documented in Bible, but we Hindu know better.


No, but something like it is documented here: http://www.chrismoore.com/lamb.html where we learn the origins of the Jewish tradition of Chinese food on Christmas Day.

Re: Denumerating the DayOfWeekEnum

2012-07-30 04:49 • by Nagesh
385856 in reply to 385845
n9ds:
Nagesh:
7 day week borrowed from ancient hindu calendar systems.
Jesus Christ visited India and stay with several folks over here and learn magics tricks.
Between the age of 13 - 28.

None of this visit documented in Bible, but we Hindu know better.


No, but something like it is documented here: http://www.chrismoore.com/lamb.html where we learn the origins of the Jewish tradition of Chinese food on Christmas Day.


pla·gia·rism/ˈplājəˌrizəm/
Noun:
The practice of taking someone else's work or ideas and passing them off as one's own.



It is copying, but original Hindu mystic rely on word of mouth to tell story and did not have reach of Internet.

Re: Denumerating the DayOfWeekEnum

2012-07-30 08:27 • by Some Jerk (unregistered)
385861 in reply to 385813
DWalker59:
Some Jerk:
I suspect that this individual must have been looking at source code and attempting to discern its' purpose. Apparently, this individual did not understand what they were doing, or perhaps the hash table might have been replaced with an equally rediculous coding structure... you know, like a REAL ENUM!?


Its'? That's a new variation.

Now THAT is a WTF!

Re: Denumerating the DayOfWeekEnum

2012-07-30 08:38 • by QJo
385863 in reply to 385799
shoofle:
♫ Day enum and me wan' go home. ♪

+1

"Day 0. Da-a-a-ay 0."

Re: Denumerating the DayOfWeekEnum

2012-07-30 09:40 • by Coyne
385864 in reply to 385769
C-Derb:
Coyne:
The best part is that the author actually did DateTime.Now.DayOfWeek; in two parts, but he had the number he wanted.

To even make this kluge work, he had to understand that today.DayOfWeek was a number from 0 to 6...so why didn't he just use the number?

Paid by the line?


Agreed.

But assuming he didn't know that he could just cast from enum to int, as the original submitter pointed out ( (int) DateTime.Now.DayOfWeek ), why would he choose to load up a hash table every time this is called instead of just using a switch statement? Egads, even a nested if statement would have made more sense.

Bonus points for using String.Format instead of ToString() though. I really liked that.


Maybe he's paid by the millisecond of runtime?

Re: Denumerating the DayOfWeekEnum

2012-07-30 17:26 • by JJ (unregistered)
385942 in reply to 385766
AGray:
I'm going to have a go at rewriting this function in one line...wish me luck!!! (I may or may not need it)

C#:
public static string getDayEnum()

{
return DateTime.Now.DayOfWeek.ToString();
}


[...]

...I have great faith in the C# one, since I use C# on a day-to-day basis.

Yikes, I think your faith is about to be shattered. Calling ToString() on an enum member returns the name of the member, not its value, so you'll be returning "Friday," "Tuesday," etc., whereas the WTF code returns "5," "2," etc.

Re: Denumerating the DayOfWeekEnum

2012-07-31 12:48 • by Cbuttius
Yom Rishon, 1st day
Yom Sheni 2nd day
Yom Shlishi 3rd day
Yom R'vii 4th day
Yom Chamishi 5th day
Yom Shishi 6th day

and you shouldn't be using your computer on Shabbat anyway.

Re: Denumerating the DayOfWeekEnum

2012-08-05 07:00 • by Inflexible (unregistered)
I would like to note that your solution doesn't allow us to add FileNotFound when we need to.

Re: Denumerating the DayOfWeekEnum

2012-08-06 06:37 • by Ceiling Cat (unregistered)
I have no understanding for this nonsense.
Sunday is supposed to be day "7". It says so in the Bible.
« PrevPage 1 | Page 2Next »

Add Comment