It's been a while since I've done one of these. There should be something in here for everyone ...
We've all seen the "const ONE=1" plenty of times, so here's a fun variation that Matthew Farwell found in cost estimating software. To be fair to the original programmer, no one could have possibly anticipated that someone, somewhere, sometime might want to increase prices ...
public final static int V_125 = 155; public final static int V_165 = 195; public final static int V_195 = 225; public final static int V_225 = 255; public final static int V_255 = 285; public final static int V_285 = 315; public final static int V_345 = 375; public final static int V_405 = 375; public final static int V_435 = 435; public final static int V_495 = 495; public final static int V_555 = 555; public final static int V_615 = 615;
And here's another variation -- in Fortran 90 -- of this from Richard Shaw ...
integer, parameter :: one_thousand = 250
David learned a new thing about C++ when trying to create an instance of COrderSummary ...
/* *** * XMLParse - returns an instance of COrderSummary or NULL on error * *** * Note: This should probably be a static method. Since it isn't, * you will need to reference it will a null object: * COrderSummary *obj = NULL; * obj = obj->XMLParse(someXMLString); * ***/ COrderSummary::XMLParse(const char *xml) { ... }
Jay's predecessor had a hard time understanding why users might want things like SUBTOTALS and TAX AMOUNT on their invoice: can't they just use a calculator?
# add in a "BALANCE DUE" line for the cry-babies who can't figure it out
Scott Stanchfield was tasked with optimizing memory usage in a Java application and found a way to shave a few bytes left in by an intern with a sense of humor ...
public class ValidationMessage { //internal members string messageId; string messageText; string helpLink; /* ... */ double cheeseburger; char broiled; long time; //helper functions /* ... */ }
Buried inside of a large ACH validation routine, Stefanie found this line ...
if (i == 892) syscall_beep();
The following variable names (submitted by A and O, respectively) are best enjoyed with a maturity age of fourteen years or less ...
float CumRate; // Cumulative pass rate ... string ass = Request.Form["associated_skill_"+selId]; if (ass.IndexOf(",") > -1) { ass = ass.Split(',')[0]; } row.ID = int.Parse(ass)
Mark came across the Dummy16() and Dummy17() methods in the Visual Studio Tools for Office SDK and wondered, what ever happened to Dummy1() through Dummy 15() ?
And while we're picking on the VS Tools for Office, following is the code required to call Excel's Dialog Show from C# ...
if(xlApp.Dialogs[Excel.XlBuiltInDialog.xlDialogOpen].Show(sTextName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing) == true) { ... }
Matt Spicer understands that this following function is called like "EnableDisable(true);" but still wondered exactly what would happen ...
//Enable or disable controls in the form private void EnableDisable(bool blnEnable) { ... }
I suppose I'll leave you with this comment that Miki Watts came across ...
Price = 0e-5; /* JKF 1999-07-21 I hope it's not a bug */