How Not to Parse Command Line Arguments
by in CodeSOD on 2006-12-15Today's Code Snippet is from S.C., who shared this in the Side Bar a littler earlier this week ...
Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.
Today's Code Snippet is from S.C., who shared this in the Side Bar a littler earlier this week ...
Today's Code Snippet comes to us from S.G, who writes, "Over time all development teams inevitably gather their share of WTF code; at the very large project I am currently working on, they hand out "Van Gogh" awards for the best. I hope some of these candidates give you a laugh."
"Some things take time to execute, others seems like they will never end," Henrique Moody wrote. "If you have a huge — really, really freaking huge — e-mail list to parse ... of course, it will take forever."
"So what to do? Set a really, really freaking huge time limit!"
It's been a few days since we've done the Code Snippet Of the Day, so in lieu of Alex's normal article, here's your mid-day CodeSOD edited by Michael Casadevall ...
J.S. Bangs sends us today's snippit located deep within a Java codebase he's maintaining. The function, getRandomBits() returns a 32-byte array of random bites for security purposes. Since Java provides a Random method, this should be easy; in fact a proper implementation can be writting in five lines: