The Daily WTF
Evan sent us 545 lines of PHP code from a file called spec_email.php. It appears to participate in sending an email, with a nice big pile of HTML in it. We're going to take it in a few chunks, because… choices were made. It opens with this check, and a few variable declarations: if(!empty($_GET['action']) && ($_GET['action'] == 'send') )...
Alexander sends us this snippet, where we change our definition of truth to something which eschews concrete definitions and accepts that existence is ephemeral. Truth and false are just illusions we project onto a reality that is itself just an illusion. In the end, we are all nothing. public enum Bit { None = -1, False...
When interacting with RESTful web services, there's a depressingly common anti-pattern: always return status 200 OK, but embed a more meaningful status code in the body of the response. Frequently, the embedded status code is just the HTTP status code you should have returned in the first place. This "fixes" situations where you have badly behaving...
Not to be outdone by Michael R., another prolific participant styles himself The Beast In Black. A handful of his experiences follow here. [psst. Mr Black. Check out this explanation of a half-closed interval) Buyer Beast bemoans "I knew that the global situation was bad, but when Amazon starts offering disdiscounts (or discountcounts,...
If I'm being completely honest, I'm mildly anti-ORM. I'm not about to go on a rampage and suggest they should absolutely, never, ever, ever be used, but I think they tend to create a lot of problems. Instead of being a true mapping between our object model and our relational model, they're their own tool, with its own idosynchracies, and a lot of "magic"...
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...
Costruisci il tuo feed di notizie
Pronto a fare un tentativo?
Inizia una prova di 14 giorni, nessuna carta di credito richiesta.