Found this in some code I wrote 5 years ago

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Found this in some code I wrote 5 years ago

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

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

Post by K-Bal »

Code: Select all

if (!japanese)
  return error;
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post 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
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

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

Post by Arce »

:lol:
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
mattheweston
Chaos Rift Junior
Chaos Rift Junior
Posts: 200
Joined: Mon Feb 22, 2010 12:32 am
Current Project: Breakout clone, Unnamed 2D RPG
Favorite Gaming Platforms: PC, XBOX360
Programming Language of Choice: C#
Location: San Antonio,Texas
Contact:

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

Post by mattheweston »

I could also see

Code: Select all

//Something bad happened
return DateTime.Parse("September 11, 2001");
being applicable
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

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

Post by K-Bal »

I mean you also use an exception or a success / error code parameter...
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
short
ES Beta Backer
ES Beta Backer
Posts: 548
Joined: Thu Apr 30, 2009 2:22 am
Current Project: c++, c
Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
Programming Language of Choice: c, c++
Location: Oregon, US

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

Post 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
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post 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:
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

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

Post by Arce »

* IContainerBuilder

:lol:
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
Post Reply