Page 1 of 1

Found this in some code I wrote 5 years ago

Posted: Wed Apr 06, 2016 1:40 pm
by dandymcgee
//Query last log read
int rows = ds.Tables["tblLastLogRead"].Rows.Count;
if (rows == 0)
{
    return DateTime.Parse("January 1, 1900");
}
else if (rows == 1)
{
    return (DateTime)ds.Tables["tblLastLogRead"].Rows[0]["LastReadDate"];
}
//Something bad happened
return DateTime.Parse("December 7, 1941");
That shit is deeeep.

Re: Found this in some code I wrote 5 years ago

Posted: Thu Apr 07, 2016 3:10 am
by K-Bal

Code: Select all

if (!japanese)
  return error;

Re: Found this in some code I wrote 5 years ago

Posted: Fri Apr 08, 2016 1:14 pm
by dandymcgee
Yo, Marius. I want to try to get a Discord channel going to replace the dead IRC and shitty Skype interface. I'm a member of some other Discord communities so I'm pretty much always online when I'm home.

https://discord.gg/0lYtQl5oK46yLcXD

Re: Found this in some code I wrote 5 years ago

Posted: Sun Dec 04, 2016 1:48 pm
by Arce
:lol:

Re: Found this in some code I wrote 5 years ago

Posted: Mon Dec 05, 2016 1:29 pm
by mattheweston
I could also see

Code: Select all

//Something bad happened
return DateTime.Parse("September 11, 2001");
being applicable

Re: Found this in some code I wrote 5 years ago

Posted: Fri Dec 09, 2016 8:44 am
by dandymcgee
mattheweston wrote:I could also see

Code: Select all

//Something bad happened
return DateTime.Parse("September 11, 2001");
being applicable
Not only is that too close to home, it's too close to now. One of our old applications was written by a guy who thought it would be a good idea to use "9/9/99" as the null date; worst idea ever. Invalid dates should always be far enough in the past that they won't possibly overlap with valid dates, and should *never* be in the future.

Re: Found this in some code I wrote 5 years ago

Posted: Fri Dec 09, 2016 11:42 am
by K-Bal
I mean you also use an exception or a success / error code parameter...

Re: Found this in some code I wrote 5 years ago

Posted: Sat Dec 10, 2016 8:15 am
by dandymcgee
K-Bal wrote:I mean you also use an exception or a success / error code parameter...
Yeah, that's definitely the best way in most circumstances. On certain occasions you want the software to keep doing what it's doing even if an error occurs though, so you need *some* valid date. A more intelligent date would be 1900-01-01 or something else innocuous in case someone sees it.

Re: Found this in some code I wrote 5 years ago

Posted: Mon Dec 12, 2016 10:59 pm
by short
I had no idea at the time what I was doing to myself with this nugget, it's 4 years old at this point:
https://github.com/bjadamson/Smashteroi ... cs#L12-L38

Re: Found this in some code I wrote 5 years ago

Posted: Tue Dec 13, 2016 2:53 pm
by dandymcgee
short wrote:I had no idea at the time what I was doing to myself with this nugget, it's 4 years old at this point:
https://github.com/bjadamson/Smashteroi ... cs#L12-L38
Lol. "FactoryModule" takes in a "ContainerBuilder". Seems perfectly obvious to me. :nono:

Re: Found this in some code I wrote 5 years ago

Posted: Mon Dec 19, 2016 2:45 pm
by Arce
* IContainerBuilder

:lol: