The Daily WTF
David's application has loads of unit tests. Many of the unit tests even go so far as to exhaustively test every combination of parameters. So seeing something like this is pretty common: [Test] [TestCase(false, false, false, false, false)] [TestCase(false, false, false, false, true)] [TestCase(false, false, false, true, false)] [TestCase(false,...
Today, I'm honestly not sure that the WTF is in the code we're looking at. Jeff needed to support an older PHP application which used client side JavaScript heavily. This block was copy-pasted many times throughout the code base: var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest...
One of our most dedicated readers, Michael R., is also one of our most dedicated contributors, sometimes sending us several submissions in a single day. We haven't featured all of them, but now we're making up for that. Today, it's wall-to-wall Michael, mostly food misadventures. Michael might tell you we've cooked the plot, but he can't prove...
Kyle sends us a puzzler of bad code today. It appears in a "JSP-like" codebase- which Kyle provides no futher details on, but certainly hints at a serious WTF underpinning this code. boolean loop = true; while (loop) { // fake loop to break out of loop = false; doesStuff(); moreStuff(); etc(); } This is a representative block,...
Ever since the DOS days, determining file type based on the three letter extension in its filename has been a common practice. I'd argue that it's not a good practice, but it's become so standard that it's hard to avoid. It's so common that pretty much any language in wide use has some sort of "get extension" method. C# is no exception. Of course,...
When you get into the world of proprietary filesystems, things can get real weird. There are many a filesystem that doesn't support directories, still in use today. Or filesystems which only allocated chunks in multi-megabyte blocks, which means you end up wasting a lot of space if you have small files. Or filesystems where the largest file size is...
Створіть власну стрічку новин
Готові спробувати?
Спробуйте протягом 14 днів. Платіжна картка не потрібна.