|
|
I ended up following the link for the PHP bug and read the report. Then I scratched my head and wondered who decided to complicate date functions like that! So if I'm following the logic correctly...
- If the year is set to '00' in PHP, it apparently doesn't mean '0000', instead it is short hand for '2000'. So '00-00-00' means The year '2000', the month '00', and the day '00'.
- Okay, but the month can't be zero! '00' means you have to subtract one from the year, which makes the year '1999', and the month '12'. That gets us to '1999-12-00'
- Drat, day is also zero! Time to subtract a day from the month, '1999-11-30'
So now '00-00-00' == '1999-12-00' == '1999-11-30'! How much drinking was required before someone thought that was a good idea!?
|
|
|
|
|
Everyone hates on JS math but it actually makes some sense. The only difference between JS and C# in this respect is JS has defined the operator - for the additional string /string , string /int , and int /string combinations. My crude reference chart[^]. You can give C# the same behavior by implementing those missing combinations. Quick example:
class Integer
{
public int Value { get; set; }
public Integer() =>
Value = 0;
public Integer(int number) =>
Value = number;
public static Integer operator +(Integer d1, Integer d2) =>
new Integer(d1.Value + d2.Value);
public static string operator +(string s, Integer d) =>
s + d.Value;
public static string operator +(Integer d, string s) =>
d.Value + s;
public static Integer operator -(Integer d1, Integer d2) =>
new Integer(d1.Value - d2.Value);
public static Integer operator -(Integer d, string s) =>
new Integer(d.Value - int.Parse(s));
public static Integer operator -(string s, Integer d) =>
new Integer(int.Parse(s) - d.Value);
public static implicit operator int(Integer d) =>
d.Value;
public static implicit operator Integer(int d) =>
new Integer(d);
}
static void Main(string[] args)
{
string x = "5";
Integer y = 3;
Integer result1 = x + y - y;
Integer result2 = x - y + y;
Console.WriteLine($"Result1: {result1.Value}\nResult2: {result2.Value}");
Console.ReadKey();
}
EDIT: Simplified code example.
EDIT2: Accidentally left a return when compacting the code.
modified 26-Apr-18 12:38pm.
|
|
|
|
|
Another way of looking at it -
In Javascript:
50 apples * 30 oranges = 1500 of something or other.
In C:
50 apples * 30 oranges = "sorry, I'm not going to do that because it makes no sense and I don't want you to imagine that it does!"
98.4% of statistics are made up on the spot.
|
|
|
|
|
|
Best place to ask this: Bugs and Suggestions[^]
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for the tip.
|
|
|
|
|
Just in case, where's the link to the form he can fill in to get a refund?
|
|
|
|
|
What would you prefer?
Paris Dakar[^]
or
Sydne Rome[^]
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Thanks for the link to the Playboy cover.
|
|
|
|
|
PLayboy covers, while not technically NSFW, are probably not a good thing to be linking to here - some net nazis may well have objections.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
CodeWraith wrote: What would you prefer? For what? A company trip with your coworkers?
I think I prefer .NET
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
When in Rome, do as the Romans do
|
|
|
|
|
So I have an "Update available" message for Java 8.
But ... "To install the update, you must close the running applications". OK, makes sense.
View applications: "Java Update Checker"
Yep, to update Java, I have to close the app that's trying to update Java ...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
And what part of this subtle hint not to update Java do you not understand?
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
CodeWraith wrote: And what part of this subtle hint not to update install Java do you not understand?
FTFY.
|
|
|
|
|
Criticism of Java - Wikipedia[^]
Point 4.2.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Point 4.2: As of 2014, other common 3rd party tools such as Adobe Flash and Adobe Reader that have also been the subject of security vulnerability scrutiny have moved to an automatic self-update model on Windows that does not require any user intervention. This assures that security issues are promptly resolved without requiring additional effort by the system users or administrators. Also means that their update can happen when they want and not when you want, leaving your system open to unplanned reboots, crashes because their update does something wrong, etc.
|
|
|
|
|
|
|
Wow. Reading the issue with generics in Java...WTF were they thinking?
|
|
|
|
|
The mighty Oracle didn't see that one coming.
98.4% of statistics are made up on the spot.
|
|
|
|
|
Genuine LOL!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Ran my update the other day without a problem.
|
|
|
|