|
Rick York wrote: Yes, that number arising is pure coincidence Well, actually it's not really coincidence that the ratio of the Egyptian cubit is 0.52 of a meter. However there is nothing mysterious or special about it. I am not sure I conveyed what I am talking about in a clear way.
Here is an absolute fact:
If I gave you only a rope and a rock and asked you to divide the day using only those materials into 24 hours, 1440 minutes and 86400 seconds. When you completed the task your rope would be approximately 1 meter long. The arc of your pendulum would cover ~0.52 of the meter when swinging.
That's all, nothing mysterious.
|
|
|
|
|
private readonly bool _mUseQuoteValue
Original post[^]
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Maybe this should be the proper naming:
const bool _alwaysWrong= true
It does not solve my Problem, but it answers my question
Chemists have exactly one rule: there are only exceptions
modified 19-Jan-21 21:04pm.
|
|
|
|
|
99 Bottles of Beer | Language Malbolge[^]
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
|
I've heard of it. I think the syntax is too verbose.
Real programmers use butterflies
|
|
|
|
|
So, when will we see a malbolge code generator article?
Wrong is evil and must be defeated. - Jeff Ello
Never stop dreaming - Freddie Kruger
|
|
|
|
|
That would be evil
Real programmers use butterflies
|
|
|
|
|
Yes?
Wrong is evil and must be defeated. - Jeff Ello
Never stop dreaming - Freddie Kruger
|
|
|
|
|
Found this gem in our codebase...
public static class DateTimeExtensions
{
public static DateTime EndOfMonth(this DateTime dt)
{
return dt.Date.AddMonths(1).AddDays(-1);
}
}
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Ah.
I can see a problem developing there. I assume he tested it on the first of the month, and it worked fine?
Here is my stab at it:
public static DateTime LastOfMonth(this DateTime dt)
{
int daysInMonth = DateTime.DaysInMonth(dt.Year, dt.Month);
return dt.FirstOfMonth().AddDays(daysInMonth - 1).AtMidnight();
} As seen before: DateTime Extensions to Make Some Simple Tasks a Little More Readable[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Actually, he had unit tests in place, but all the dates tested were on the first day of the month.
My fix was:
return new DateTime(dt.Year, dt.Month, 1).AddMonths(1).AddDays(-1);
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
modified 15-Jun-20 9:14am.
|
|
|
|
|
I guess it's true for tests as well: GIGO ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
And why not simply use DateTime.DaysInMonth ?
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Because the programmer wanted the attention of being presented here?
|
|
|
|
|
Makes sense
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
|
Rob Grainger wrote: return new DateTime(dt.Year, dt.Month, 1).AddMonths(1).AddDays(-1);
This is exactly my EndOfMonth extension function in dotNet.
|
|
|
|
|
This gets you the last *date* of the month, but if you’re actually looking for the “end” of the month and don’t want fencepost errors, you’d want the first of the next month (with no time component) and then use a strict less-than in your comparisons.
|
|
|
|
|
Not to be pernickity but I guess it is going to depend on the intention of the method. If a trial runs for a month then perhaps from a given date that would be the end of the month
However, the intention is not clear from the method name so one may very well assume that it represents the date for the last day in the month of the given date.
|
|
|
|
|
Personally, I feel that an extension method on DateTime should apply to all possible DateTime instances. Otherwise, it can be defined to match circumstances, as long as that is clear from the name.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
30 days have September, all the rest I can't remember.
|
|
|
|
|
I resemble that remark.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
|
That can't be real. Come on. How stupid an entire team has to be to let this run in production. Has to be a joke. And if this is intranet, why are you bothered with form based authentication? Just do AD look up or something.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|