Click here to Skip to main content
15,884,099 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: When ASP.NET programmers don't know JavaScript PinPopular
Electron Shepherd13-Oct-09 0:20
Electron Shepherd13-Oct-09 0:20 
GeneralRe: When ASP.NET programmers don't know JavaScript Pin
Luc Pattyn13-Oct-09 3:40
sitebuilderLuc Pattyn13-Oct-09 3:40 
GeneralRe: When ASP.NET programmers don't know JavaScript Pin
robocodeboy15-Oct-09 0:19
robocodeboy15-Oct-09 0:19 
GeneralRe: When ASP.NET programmers don't know JavaScript Pin
PIEBALDconsult13-Oct-09 11:38
mvePIEBALDconsult13-Oct-09 11:38 
GeneralRe: When ASP.NET programmers don't know JavaScript Pin
Gordon Kushner13-Oct-09 12:39
Gordon Kushner13-Oct-09 12:39 
GeneralRe: When ASP.NET programmers don't know JavaScript Pin
dojohansen15-Oct-09 0:12
dojohansen15-Oct-09 0:12 
GeneralRe: When ASP.NET programmers don't know JavaScript Pin
Lutosław15-Oct-09 22:38
Lutosław15-Oct-09 22:38 
GeneralCode In Need Of Cleanup [modified] Pin
Kevin Marois8-Oct-09 12:29
professionalKevin Marois8-Oct-09 12:29 
Not the worst code I've seen, but it's bad. This is typical code worked on by multiple developers over time. The
class this is in has over 5000 lines of code. All of it looks like this.

/* Get Shop Order Details.*/
DataTable dtShopOrder;

if(sSNInPK.ToLower()=="yes;")
	dtShopOrder = new ERP().GetShopOrderDetails(txtSerialNum.Text);
else
	dtShopOrder = new Operation().GetShopOrderDetails(txtSerialNum.Text);

if(dtShopOrder == null || dtShopOrder.Rows.Count <=0)
{
	this.showMessage("Cannot find the serial number.  Please contact your System Administrator.", MessageType.Warning);
	return;
}

txtShopOrder.Text = dtShopOrder.Rows[0]["ShopOrder"].ToString();
txtAssembly.Text = dtShopOrder.Rows[0]["Assembly"].ToString();
txtRev.Text = dtShopOrder.Rows[0]["Revision"].ToString();
txtCUCode.Text = dtShopOrder.Rows[0]["CUCODE"].ToString();
txtCustomer.Text = dtShopOrder.Rows[0]["CUNAME"].ToString();
txtQty.Text = dtShopOrder.Rows[0]["Qty"].ToString();

/*START >> For enhancement - Sub assembly serial number management(9th June 2009)*/

strSubAsmWC = "";
try
{

	if(dtShopOrder.Rows[0]["SubAsmWC"] != null)
	{
		strSubAsmWC = dtShopOrder.Rows[0]["SubAsmWC"].ToString();
	}
}
catch
{
	strSubAsmWC = "";
}

/*End >> For enhancement - Sub assembly serial number management (9th June 2009)*/

/*START >> For enhancement - assigning Customer Label/MAC Addresses (1st Feb 2007)*/

iCustOpNum = -1;
iMACOpNum = -1;
iMACCount = -1;
strCustLabel = "";
strMACAddress = "";


if(dtShopOrder.Rows[0]["iCustLabelOpNum"] != null)
{
	try
	{
		iCustOpNum = int.Parse(dtShopOrder.Rows[0]["iCustLabelOpNum"].ToString());
	}
	catch
	{

	}
}

if(dtShopOrder.Rows[0]["iMacAddressOpNum"] != null)
{
	try
	{
		iMACOpNum = int.Parse(dtShopOrder.Rows[0]["iMacAddressOpNum"].ToString());
	}
	catch
	{

	}
}

if(dtShopOrder.Rows[0]["iMacAddressCount"] != null)
{
	try
	{
		iMACCount = int.Parse(dtShopOrder.Rows[0]["iMacAddressCount"].ToString());
	}
	catch
	{

	}
}

if(dtShopOrder.Rows[0]["CustLabel"] != null)
	strCustLabel = dtShopOrder.Rows[0]["CustLabel"].ToString();

if(dtShopOrder.Rows[0]["MacAddress"] != null)
	strMACAddress = dtShopOrder.Rows[0]["MacAddress"].ToString();

/*END >> For enhancement - assigning Customer Label/MAC Addresses (1st Feb 2007)*/


Found this in there also

if(slAppConfig[AppConfig.Keys.address_defect_wc.ToString()].ToString().IndexOf(lblWCKey.Text + ";",0)>=0
								|| lblWCKey.Text == this.GetCutOffWC() || lblWCKey.Text == "MRBW")
{ 
	this.EnableDefectEdits(true);
}
else
{
	this.EnableDefectEdits(false);
}


Everything makes sense in someone's mind

modified on Thursday, October 8, 2009 6:40 PM

GeneralRe: Code In Need Of Cleanup Pin
GibbleCH9-Oct-09 4:50
GibbleCH9-Oct-09 4:50 
GeneralRe: Code In Need Of Cleanup Pin
AspDotNetDev26-Oct-09 1:16
protectorAspDotNetDev26-Oct-09 1:16 
GeneralWasted space Pin
Jim (SS)8-Oct-09 6:22
Jim (SS)8-Oct-09 6:22 
GeneralRe: Wasted space Pin
Jaime Olivares8-Oct-09 9:05
Jaime Olivares8-Oct-09 9:05 
GeneralRe: Wasted space Pin
Jim (SS)8-Oct-09 9:12
Jim (SS)8-Oct-09 9:12 
GeneralRe: Wasted space Pin
dojohansen15-Oct-09 0:23
dojohansen15-Oct-09 0:23 
GeneralRe: Wasted space Pin
josda10008-Oct-09 9:39
josda10008-Oct-09 9:39 
JokeRe: Wasted space Pin
PIEBALDconsult8-Oct-09 17:05
mvePIEBALDconsult8-Oct-09 17:05 
GeneralRe: Wasted space Pin
V.8-Oct-09 21:37
professionalV.8-Oct-09 21:37 
GeneralRe: Wasted space Pin
dojohansen15-Oct-09 0:32
dojohansen15-Oct-09 0:32 
GeneralRe: Wasted space Pin
V.15-Oct-09 0:34
professionalV.15-Oct-09 0:34 
GeneralRe: Wasted space Pin
dojohansen15-Oct-09 1:03
dojohansen15-Oct-09 1:03 
GeneralRe: Wasted space Pin
V.15-Oct-09 1:27
professionalV.15-Oct-09 1:27 
GeneralRe: Wasted space Pin
Jim (SS)15-Oct-09 5:14
Jim (SS)15-Oct-09 5:14 
GeneralRe: Wasted space Pin
dmjm-h2-Nov-09 13:18
dmjm-h2-Nov-09 13:18 
GeneralRe: Wasted space Pin
Jim (SS)3-Nov-09 4:04
Jim (SS)3-Nov-09 4:04 
GeneralRe: Wasted space Pin
Member 218499724-Nov-09 18:54
Member 218499724-Nov-09 18:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.