The Daily WTF
Greg's co-worker really wanted to make sure that a variable was correctly set to true or false. So they did this: if (isValid == true) { isValid = true; } else { isValid = false; } If isValid is true, set it to true, otherwise set it to false. isValid is a boolean in C#, so the only options it could have are true and false. The real WTF...
Meta-programming- programs which generate programs- is a delightful hobby, but usually shouldn't be used in production code. Usually. I mean, if you're working in LISP, 90% of your program is going to be macros. But if you're using PHP and JavaScript, there's good odds that someone you work with has decided to combine these two tastes together to create...
Zeke sends us a C# snippet from an extract-transform-load process his company uses. It's… special. private void ResizeColumn(string table, string column, int minSize) { if(null == _connection) return; string sqlReadSize = "SELECT DATA_LENGTH,DATA_TYPE,DATA_PRECISION,DATA_SCALE FROM USER_TAB_COLS WHERE TABLE_NAME = '" + table.ToUpper()...
When I first saw Nick L's submission, I thought to myself, "This is just decompiled code, so of course the names are bad." Public Function tF7q2() As String Dim SelectedtF7q2 As String = Request.QueryString("tF7q2") tF7q2 = SelectedtF7q2 End Function I mean, a name like tF7q2 can't be human generated, right? But then, the query string...
Faithful Michael R. is good for a chuckle today. "I am using the free tier Infura right now but think I will go enterprisey straight away." Can't turn down a deal like that, eh? Chris M. sent in a captcha that is neither an error nor a wtf, but it's kind of funny so here you go: "Microsoft obviously doesn't use Google's CAPTCHA...
Ulvhamne sends us some bad code that, well, I think at this point we should really coin a name for this particular anti-pattern. @Override public int getNumOfItemsInDataContainer(int parDataId) { int numberOfItems = 0; for (Integer x : myTransactionDataContainerMap.keySet()) { numberOfItems...