Coded Smorgasbord: Mostly In One Line
by Remy Porter from The Daily WTF on (#6NMJ1)
Today's a day for a smorgasbord. We're going to start with a classic kind of bad code, from astephens:
pbUpdates.Value = int.Parse(Math.Truncate(percentage).ToString());
Here, we want to truncate a floating point down to an integer, but take a trip through a string to do it. Why? Probably because the person responsible knew about int.Parse but not how to actually cast.
Thomas's predecessor had a solid idea of where exceptions come from:
Try ' snipCatch ex As Exception Me.Response.Write("error in my code " & ex.ToString()) Me.Write_error(ex)End Try
I appreciate the honesty: your code is bad.
Sylnsr wonders if this stored procedure has anything to do with generating reports?
this.sqlDataSource1.SelectCommand = "rptGetVoidReportDataForReport";
Nah, couldn't be- it says void in the name, so it obviously doesn't return anything.
Finally, Adam wonders exactly what is left to do on this one:
pdfBytes = pdfConverter.GetPdfBytesFromUrl(urlToConvert); //TODO: This is the code we want to use.
TODO? Or TODONE?
[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.