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

Found this in some code I wrote 5 years ago

Postby dandymcgee on Wed Apr 06, 2016 2:40 pm

//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:
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4911
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

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

Postby K-Bal on Thu Apr 07, 2016 4:10 am

Code: Select all
if (!japanese)
  return error;
User avatar
K-Bal
ES Beta Backer
ES Beta Backer
 
Posts: 719
Joined: Sun Mar 15, 2009 4:21 pm
Location: Germany, Aachen

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

Postby dandymcgee on Fri Apr 08, 2016 2:14 pm

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
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4911
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

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

Postby Arce on Sun Dec 04, 2016 3:48 pm

:lol:
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
Arce
Chaos Rift God
Chaos Rift God
 
Posts: 2182
Joined: Mon Jul 10, 2006 10:29 pm

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

Postby mattheweston on Mon Dec 05, 2016 3:29 pm

I could also see

Code: Select all
//Something bad happened
return DateTime.Parse("September 11, 2001");


being applicable
Image
mattheweston
Chaos Rift Junior
Chaos Rift Junior
 
Posts: 203
Joined: Mon Feb 22, 2010 2:32 am
Location: San Antonio,Texas

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

Postby dandymcgee on Fri Dec 09, 2016 10:44 am

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:
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4911
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

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

Postby K-Bal on Fri Dec 09, 2016 1:42 pm

I mean you also use an exception or a success / error code parameter...
User avatar
K-Bal
ES Beta Backer
ES Beta Backer
 
Posts: 719
Joined: Sun Mar 15, 2009 4:21 pm
Location: Germany, Aachen

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

Postby dandymcgee on Sat Dec 10, 2016 10:15 am

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
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4911
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

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

Postby short on Tue Dec 13, 2016 12:59 am

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/Smashteroids/blob/master/EntityLibrary/IOC/FactoryModule.cs#L12-L38
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
User avatar
short
ES Beta Backer
ES Beta Backer
 
Posts: 571
Joined: Thu Apr 30, 2009 3:22 am
Location: Oregon, US

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

Postby dandymcgee on Tue Dec 13, 2016 4:53 pm

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/Smashteroids/blob/master/EntityLibrary/IOC/FactoryModule.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
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4911
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

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

Postby Arce on Mon Dec 19, 2016 4:45 pm

* IContainerBuilder

:lol:
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
Arce
Chaos Rift God
Chaos Rift God
 
Posts: 2182
Joined: Mon Jul 10, 2006 10:29 pm


Return to Programming Discussion

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

cron