![]() |
by Lyle Seaman on (#6TFFE)
Someone online said we run a Mickey Mouseoutfit. Angered beyond words, we consulted legal@disney.com and they threatened to findthat guy and sue him. So to anyone else who thinks this column is Goofy, you should know that the world's definitive authorities insistthat it absolutely is not.But these guys? This website actually iskind of goofy, according to resolutioner Adam R. who crowed "Someone forgot to localize some text for the new year!"
|
The Daily WTF
Link | http://thedailywtf.com/ |
Feed | http://syndication.thedailywtf.com/TheDailyWtf |
Updated | 2025-06-01 20:01 |
![]() |
by Remy Porter on (#6TEM2)
Antonio's team hired some very expensive contractors and consultants to help them build a Java based application. These contractors were very demure, very mindful, about how using ORMs could kill performance.So they implemented a tool that would let them know any time the Hibernate query generator attempted to perform a cross join.
|
![]() |
by Remy Porter on (#6TDRF)
Bejamin's team needed to generate a unique session ID value that can't easily be guessed. The traditional way of doing this would be to generate cryptographically secure random bytes. Most languages, including PHP, have a solution for doing that.But you could also do this:
|
![]() |
by Remy Porter on (#6TCT4)
Today's anonymous submission is a delightfully simple line of JavaScript which really is an archetype of a representative line.
|
![]() |
by Remy Porter on (#6TBX5)
Ted's company hired a contract team to build an application. The budget eventually ran out without a finished application, so the code the contract team had produced was handed off to Ted's team to finish.This is an example of the Ruby code Ted inherited:
|
![]() |
by Lyle Seaman on (#6TA9W)
Happy 2025 to all our readers. I can already tell thisyear's columns are going to be filled with my (least)favorite form of WTF, the impossible endless gauntlet offlaming password hurdles to jump over or crawl under. Please comment if you know why this week's column has this title and why it doesn't have the title Swordfish.Peter G. starts off our new year of password maladies with a complaint that is almost poetic.
|
![]() |
by Remy Porter on (#6T9FQ)
Ash's company outsourced to an offshore vendor.This is an example of what they got back:
|
![]() |
by Remy Porter on (#6T8ZK)
Twenty five years ago today, the world breathed a collective sight of relief when nothing particularly interesting happened. Many days begin with not much interesting happening, but January 1st, 2000 was notable for not being the end of the world.I'm of course discussing the infamous Y2K bug. We all know the story: many legacy systems were storing dates with two digits- 80 not 1980, and thus were going to fail dramatically when handling 00- is that 1900 or 2000?Over the past few weeks, various news outlets have been releasing their "25 years later" commentary, and the consensus leans towards this was no big deal, and totally fine. Nothing bad happened, and we all overreacted. There may have been some minor issues, but we all overreacted back then.So I want to take a moment to go back to the past, and talk about the end of the 90s. Let's go for it.via GIPHYIt's the End of the World as We Know It25 years on, it's really hard to capture the vibe at the close of the 90s. We'll focus on the US, because that's the only region I can speak to first hand. The decade had a "it was the best of times, it was the worst of times," aspect to it. The economy was up, lifted in part by a tech bubble which had yet to pop. The AIDS epidemic was still raging (thanks, in part, to the disastrous policies of the Reagan administration). Crime was down. The Columbine Shooting was hitting the national consciousness, but was only a vague hint of the future of mass shootings (and the past, as mass shootings in the US have never actually been rare). The Soviet Union was at this point long dead and buried, and an eternal hegemony of the US seemed to be the "end of history". On the flip side, Eastern Europe was falling apart and there was war in Kosovo. Napster launches, and anti-globalization protests disrupt cities across the country.Honestly, I feel like Woodstock '99 sorta sums up the last year of the decade. A music festival with a tradition of love and peace is wildly unmanaged and held in a hostile environment and devolves into chaos, violence, and sexual assaults.With the millennium looming, people were feeling weird. There was a very real sense that the world was coming to an end. Not literally, but the sense of a looming apocalypse of some king was inescapable. It's easy to be the rational one and say, "this is just an arbitrary mark on an arbitrary calendar, it doesn't mean anything", but the mass public and the zeitgeist at the time wasn't feeling rational.When you add the Y2K bug into the mix, people lost their goddamn minds.The Vibe of Y2KWe'll talk about the technical challenges of the Y2K bug, but honestly, I think it's less interesting than the vibe.What people knew was this: computers ran the world, and at midnight on December 31st, 1999, every computer was going to freak out and try and kill us. Don't take my word for it.Honestly, would anyone have cared if the Backstreet Boys climbed into a bunker in 1999? That feels like the end of their reign as the boy band of the moment. Even Dr. Dre, who is clearly trying to be reasonable, doesn't want to be on a plane that night. Christina Aquilera's mom told her not to use elevators.Or check this guy, who's less afraid of the technical problem and more "the social" one:It wasn't all panic, like this long segment from the Cupertino City Council:And certainly, hero of the site Peter, knew it was boring and dry:But NYE 1999, people were unplugging all their appliances so the computers in them wouldn't freak out. In the run up, people were selling books to help you prep. Survival guides abounded. Some of them took this as a dire warning about the dangers of global warming and sexuality in media.The public poorly understood what Y2K meant, but were primed to expect (and prepare for) the worst. From this distance of hindsight, we can see echoes of the panic in the response to the COVID pandemic- a very real problem that people wildly misunderstood and reacted to in all sorts of insane ways.The ProblemLet's get back to this idea of "some programs represented years with two digits". From the perspective of a modern programmer, this seems weird. It sounds like we were storing dates as stringly typed data, which would be a really silly thing to do.So I want to discuss the kinds of systems that were impacted and why. Because in the 90s, people thought their PCs might blow up at the changeover, but your desktop computer was never really at any risk. It was legacy mainframe systems- the big iron that ran half the world- that was at risk.To understand the bug, and why it was hard to fix, we need to spend some time talking about how these systems worked. Well, work, because there are certainly a few still in use.We're going to focus on COBOL, because I've had the misfortune to work with COBOL systems. Take my examples here as illustrative and not "authoritative*, because there are a lot of different kinds of systems and a lot of different ways these bugs cropped up.Now, as a modern programmer, when we think about representing numbers, we think about how many bits we dedicate to it. An 8-bit integer holds 256 distinct values.Mainframe systems used "flat file databases". As the name implied, data was stored in a file- just dumped into that file with minimal organization. A single application may interact with many "flat files"- one holding customers, one holding invoices, and so on. There were no built-in relationships or foreign key constraints here, applications needed to enforce that themselves. On a single mainframe, many programs might interact with the same set of files- the accounts receivable program might interact with invoices, the shipping supervisor would also look at them to plan shipping, an inventory management program would update inventory counts based on that, and so on.These interactions could get complex on any given system. And those interactions could get more complicated because multiple systems needed to talk to each other- so they'd need data interchange formats (like EDI or ASN.1).In COBOL, you'd describe your flat files with a "data division" in your program. That data division might look something like this:
|
![]() |
by Remy Porter on (#6T8DC)
|
![]() |
by Remy Porter on (#6T7PK)
|
![]() |
by Lyle Seaman on (#6T656)
The Hatter was framed! He didn't even do it! Nil Corpus Delecti, et cetera.Yet Yitz O., up to some kind of skullduggery, observed a spacetime oddity."When trying to compare some results from a GetOrders call via the ebayapi, I noticed something weird was happening with the DateTimes in the response.The attached is 3 calls to get the same order, made in quick succession.The millisecond part of all the DateTimes matched the millisecondpart of the *current* time (which you can see in the TimeStamp field.I assume it's because they rolled their own DateTime functionalityand are Getting a UTC time by subtracting the difference betweenthe local time and the UTC time, and one of those values doesn't havethe millisecond value in it, but it's the ebay api so who knows."Undoubtedly a bug that nobody ever noticed because they probablyjust ignore the millis altogether.
|
![]() |
by Remy Porter on (#6T5JC)
|
![]() |
by Remy Porter on (#6T56C)
Last year, we spent our Christmas looking at some Christmas movies and specials, and rated them based on the accuracy of their portrayal of the IT industry. We're going to continue with that this year. Just like last year, we'll rate things based on a number of floppy disks- means it's as accurate as Office Space, whereas puts it someplace down around Superman III.GremlinsTechnology has conquered the world, but none of it actually works. As Mr. Futterman (played by the classic character actor Dick Miller) points out: they've all got gremlins in them. Except, thanks to a goofy dad's last minute Christmas gift and some careless 80s teens, the gremlins aren't just taking over technology, but the entire town with their goofy violence.This was the most mentioned film left out last year. As far as tech industry representation, we've got a lot to discuss here. First, the father who purchases Gizmo- the Mogwai that becomes the source of all the gremlins- is an inventor. This is the 80s, and thus we're all recovering from the fads of Rubik's Cubes and Pet Rocks, so Randy Petlzer is trying to crash whatever the next fad is. He's got a collection of goofy gadgets, including the orange juicer above, which is itself a premonition of the Juicero startup, itself a goofy disaster of venture capital.An independent inventor with no real business model but a bunch of goofy ideas also thinks he's a genius. Where have I heard that before? At least, he did "read the manual" (listened to the instructions given to him by the very 80s orientalist stereotype) and even communicated them, so credit to that. But nobody actually followed those instructions anyway, which leads to all the chaos. Do you think I used the word "goofy" enough to describe this movie? It's very goofy, and I think it's gotten goofier with age, honestly. Without nostalgia, I wouldn't call it good, but it is goofy.The highlight of the film is Phoebe Cates's monologue about why she hates Christmas: a grisly tale about her father's death.Rating:The ApartmentBud Baxter has an apartment conveniently close to work- so convenient that all the executives at his company bring their mistresses there. It's great for Bud's career, but less good for his reputation and his own personal love life.So, this may be a stretch as Christmas movies go. It takes place around Christmas, but doesn't have a lot of Christmas themes. You know what it does have? A load of entitled management types who not only control Bud's life around the office, but his life at home, and definitely don't care about how that affects him. If this were in 2024, they'd be using bossware to track him and smart door locks to keep him out of his own house.Rating:The Knight Before ChristmasA modern gal in Ohio has given up on love. A 14th century knight is magically transported to Ohio. Together, they discover the true meaning of Christmas- and love.This is Netflix's stab at a Hallmark level Christmas movie. The whole thing revolves around the Ohio town having a Christmas tradition of erecting a "Christmas Castle" and doing a pseudo-Ren Faire thing every Christmas which is not, as far as I know, a thing anywhere, except perhaps a few small towns in Europe, where they have naturally occurring castles. Our gallant knight gets to be flummoxed by modern technology, like the Alexa, but basically figures all this stuff out over the course of a few days.For IT accuracy, this is definitely:Rating:However, it's also worth noting that the plot kicks off with our modern gal hitting the befuddled knight with her car at the Christmas Castle. They go to the hospital, where everyone assumes he's an actor from the Castle, and now has amnesia after being hit by a car. Since he has no ID, instead of providing medical care for what they believe to be severe brain damage, they just... let her take him home with her. So, if we were rating this for accurately representing the health care system in the US:Rating:The Bear: Feast of the Seven Fishes"The Bear" focuses on Carmy, who is trying to turn his deceased brother's sandwich shop into a Michelin rated fine-dining restaurant. This episode flashes back to a Christmas before his brother died, and shows us what his family life was like, as his mother prepares the traditional "Feast of the Seven Fishes" for Christmas.So, unlike Christmas Castles, Feasts of Seven Fishes are real. I grew up with the loud Italian family. My grandmother was so Italian she came through Ellis Island and also had one of these to point at her Christmas Tree. We did not do the complete Feast of the Seven Fishes, because nobody wanted to work that hard, but deep fried kippers were always featured. These were whole fish, which you'd eat. Bones, faces and all. That was fine, but I was honestly really there for the ginettes (everyone else calls them anise cookies, but we called them ginettes).Our Christmas wasn't as stressful as Carmy's, and while folks got drunk, it was strictly "the old guys drink too much and fall asleep in their chairs" levels of drunk.Rating:Dominic the DonkeyWhen Santa wants to visit his "paisans" in Italy, his reindeer can't handle the hills- so he relies on his friend, Dominic, the Italian Christmas Donkey.Look, I had to suffer through this song growing up, so now you do to. Hit play. Put it on loop. You're trapped in here with us. Jingety jing! HEE HAW HEE HAW! IT'S DOMINIC THE DONKEY.Rating:The Iron GiantAn alien war-bot crashes on Earth and gets amnesia, forgetting that it's a war-bot. Young Hogarth befriends the bot, and adventures ensue. Meanwhile 1950s Fox Mulder tries to track down the "monster" and put a stop to the Communist threat it represents.I know what you're saying: "there's nothing Christmas here!" But, based on this list so far, amnesia is a Christmas tradition! Setting that aside, I'm not religious, but if we're talking about keeping the "Christ" in "Christmas", you can't do better than a giant robot who dies for our sins and is reborn days later. Honestly, the Bible could have used more giant robots. Maybe a Godzilla or two. While the movie leans hard into Superman as its metaphor for heroism, Superman has frequently been appropriated as a Christ metaphor. Which, there's a whole lot to unpack there, given that Superman's creators were Jewish.This story features incompetent government agents trying to regulate technology they don't understand. While the film colors it in with Red Scare tones, it echoes the same constant shrieking from the FBI and NSA that regular citizens shouldn't have access to strong encryption (and they need a magical backdoor into all encryption algorithms to keep you SAFE). Or the countless "think of the children!" bills that attempt to police the Internet and always fail. Or the classic "Felony Contempt of Business Model"- the sections of the DMCA that make it illegal for you to refill your printer cartridges or jailbreak your phones.Rating: [Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.
|
![]() |
by Remy Porter on (#6T4P9)
Mihail was excited when, many years ago, he was invited to work for a local company. At the time, he was in college, so getting real-world experience (and a real-world paycheck) sounded great. It was a small company, with only a handful of developers.The excitement didn't last long, as Mihail quickly learned what the project was: parsing commit messages in source control and generating a report of how many hours a developer worked on any given task. It was a timesheet tracking application, but built on commit messages."This... seems like a bad idea?" Mihail told his supervisor. "Couldn't we just do this in a timesheet tool? Or heck, a spreadsheet? Accounting would probably prefer a spreadsheet.""If we did that, people could edit their numbers," the supervisor responded.Apparently they hadn't heard about amending commits. Or just... lying in the commit message?Now, Mihail wasn't allowed to start working. A design document needed to be crafted first. So several senior developers went into a room, and hammered out the design. Three weeks later, they had a basic structure of five classes: components, which were made up of milestones, which were made up of tickets, which had contributors, which made commits. It wasn't a complicated design, so it was mystifying as to why it took three weeks to write. More problematic- the project had only budgeted a month, so Mihail was left with a single week for implementation.One frantic week later, Mihail handed in his work. It was insufficiently tested, but more or less worked according to the design. He had to take a week off of work for exams, and when he returned from those exams, the senior devs had some good news and bad news. The good news: they were happy with his work! The bad news: during the week the design had been completely changed and needed to be rewritten.So the rewrite began, with a new design, and once again, too little time left to do the work. Tests went out the window first, but "basic coding practices" quickly followed. The second version was less reliable and usable than the first. Then the Big Boss sent down an edict: this whole system should get its data from their bug tracker, which had SQL integration options.Once again, it was all thrown away, and a new version began. Mihail started writing queries for the database, starting by joining the three key tables to produce the data they wanted. Then he read the new version of the design doc, published while he was working, and joined the five tables together they'd need. After combining the six tables the design doc called for, Mihail was starting to think the code he was writing was bad.The workflow that the design called for offered it's own challenges. After writing the query which joined eight tables together, with a nest of subqueries and summaries, the query itself weighed in at 2,000kb. And that was just for one report- there were a dozen reports that were part of the project, all similarly messy, and all subject to rapidly changing design documents. The queries were all hard-coded directly in a Python script, and the design was explicit: don't slow down developers by using prepared statements, just use string concatenation (aka SQL injection) because we can trust our inputs! This Python script would run its reporting queries, and then dump the results into tables in the application's database. Then a web UI would pick up the data from the tables and show it to the user.The only thing we can say about the results is that the web UI looked nice. The underlying horror that was the code was hidden.With the project finally done, it was time to show it off to upper management. Mihail's supervisor starts demoing their system, and after a minute, the Big Boss pipes up: "Why do we need this?""Oh, well, it's a more flexible-""No. Why do we need this?""Time tracking is fundamental to our billing-""Right, but why do we need this? You know what, never mind. Do whatever you want with this, just make sure that all the data ends up in an Excel spreadsheet at the end of the month. That's what we send to accounting."All in all, Mihail spent six months working on this project. Once complete, it was never used by anyone. [Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!
|
![]() |
by Remy Porter on (#6T3Z7)
Rachel worked on a system which collected data about children, provided by parents and medical professionals. There was one bug that drew a lot of fire: no one could report the age of a child as less than one. That was a problem, as for most of their users, child ages are zero-indexed. One of the devs picked up the bug, made a change, and went on to the next bug.This was the fix:
|
![]() |
by Lyle Seaman on (#6T2BS)
Rational Tim R. observed "When setting up my security camera using the ieGeek app thereseem to be two conflicting definitions of sensitivity. I hopethe second one is wrong, but if it's right, I reallyhope the first one is wrong."
|
![]() |
by Remy Porter on (#6T1JZ)
Michael had a co-worker who was new to the team. As such, there was definitely an expected ramp-up time. But this new developer got that ramp up time, and still wasn't performing. Worse, they ended up dragging down the entire team, as they'd go off, write a bunch of code, end up in a situation that they couldn't understand why nothing was working, and then beg for help.For example, this dev was tasked with adding timestamps to a set of logging messages. The logs had started as simple "print" debugging messages, but had grown in complexity and it was time to treat them like real logging.This stumped them, as the following C# code only ever printed out a zero:
|
![]() |
by Remy Porter on (#6T0PT)
Conditional statements, we would hope, are one of the most basic and well understood constructs in any programming language. Hope, of course, is for fools and suckers, so let's take a look at a few short snippets.Our first installment comes from Jonas.
|
![]() |
by Remy Porter on (#6SZV0)
Joseph sends us a tried and true classic: bad date handling code, in JavaScript. We've all seen so much bad date handling code that it takes something special to make me do the "confused dog" head tilt.
|
![]() |
by Remy Porter on (#6SZ3B)
Today's anonymous submitter supplies us with a classic antipattern: padding via switch:
|
![]() |
by Lyle Seaman on (#6SXE6)
The weather isn't the only thing that's balmy around this parts.For instance Bruce, who likes it hot."Westford, MA is usually bracing for winter in December,but this year we got another day of warm temperatures. The feels like temperature was especially nice."
|
![]() |
by Remy Porter on (#6SWJG)
Phil's company hired a contractor. It was the typical overseas arrangement: bundle up a pile of work, send it off to another timezone, receive back terrible code, push back during code review, then the whole thing blows up when the contracting company pushes back about how while the code review is in the contract if you're going to be such sticklers about it, they'll never deliver, and then management steps in and says, "Just keep the code review to style comments," and then it ends up not mattering anyway because the contractor assigned to the contract leaves for another contracting company, and management opts to use the remaining billable hours for a new feature instead of finishing the inflight work, so you inherit a half-finished pile of trash and somehow have to make it work.Like I said, pretty standard stuff.Phil found this construct scattered all over the codebase:
|
![]() |
by Remy Porter on (#6SVPK)
One of the long-tenured developers, Douglas at Patrick's company left, which meant Patrick was called upon to pick up that share of the work. The code left behind by Douglas the departing developer was, well... code.For example, this block of Java:
|
![]() |
by Remy Porter on (#6STV7)
Rob's co-worker needed to write a loop that iterated across every element in an array. This very common problem, and you'd imagine that a developer would use one of the many common solutions to this problem. The language, in this case, is JavaScript, which has many possible options for iterating across an array.Perhaps that buffet of possible options was too daunting. Perhaps the developer thought to themselves, "a for each loop is easy mode, I'm a 10x programmer, and I want a 10x solution!" Or perhaps they just didn't know what the hell they were doing.Regardless of why, this is the result:
|
![]() |
by Remy Porter on (#6ST0H)
Alice has the dubious pleasure of working with SalesForce. Management wants to make sure that any code is well tested, so they've set a requirement that all deployed code needs 75% code coverage. Unfortunately, properly configuring a code coverage tool is too hard, so someone came up with a delightful solution: just count how many lines are in your tests and how many lines are in your code, and make sure that your tests make up 75% of the total codebase.Given those metrics, someone added this test:
|
![]() |
by Lyle Seaman on (#6SR8A)
This week, a double dose of Daniel D.First he shared a lesson he titled "Offer you can't refuse a.k.a.Falsehood programmers believe about prices" explaining "Some programmers believe that new prices per month (when paid annually) are always better then the old ones (when paid monthly). Only this time they have forgotten their long-time clients on legacy packages."
|
![]() |
by Remy Porter on (#6SQCJ)
Eli sends us something that's not quite a code sample, despite coming from code. It's not a representative line, because it's many lines. But it certainly is representative.Here's the end of one of their code files:
|
![]() |
by Remy Porter on (#6SPF5)
As often happens, Luka started some work but didn't get it across the finish line before a scheduled vacation. No problem: just hand it off to another experienced developer.Luka went off for a nice holiday, the other developer hammered away at code, and when Luka came back, there was this lovely method already merged to production, sitting and waiting:
|
![]() |
by Remy Porter on (#6SNMS)
"We use a three tier architecture," said the tech lead on Cristian's new team. "It helps us keep concerns separated."This statement, as it turned out, was half true. They did divide the application into three tiers- a "database layer", a "business layer", and a "presentation layer". The "database layer" was a bunch of Java classes. The "business layer" was a collection of Servlets. And the "presentation layer" was a pile of JSP files.What they didn't do, however, was keep the concerns separated.Here's some code from their database layer:
|
![]() |
by Remy Porter on (#6SMVH)
Alexandra inherited a codebase that, if we're being kind, could be called "verbose". Individual functions routinely cross into multiple thousands of lines, with the longest single function hitting 4,000 lines of code.Very little of this is because the problems being solved are complicated, and much more of it is because people don't understand how anything works.For example, in this C++ code, they have a vector of strings. The goal is to create a map where the keys are the strings from the vector, and the values are more strings, derived from a function call.Essentially, what they wanted was:
|
![]() |
by Lyle Seaman on (#6SK12)
...or actually, it doesn't. A few fans found figures that just didn't add up. Here they are.Steven J Pemberton deserves full credit for this finding."My bank helpfully reminds me when it's time to pay mybill, and normally has no problem getting itright. But this month, the message sent Today 08:02,telling me I had to pay by tomorrow 21-Nov was senton... 21-Nov. The amount I owed was missing the decimal point. They then apologisedfor freaking me out, but got that wrong too, by notreplacing the placeholder for the amount I really needed to pay."
|
![]() |
by Erik Gern on (#6SJA6)
|
![]() |
by Remy Porter on (#6SHD7)
Today, we're going to start with the comment before the method.
|
![]() |
by Remy Porter on (#6SGHK)
Robert was diagnosing a problem in a reporting module. The application code ran a fairly simple query- SELECT field1, field2, field3 FROM report_table- so he foolishly assumed that it would be easy to understand the problem. Of course, the "table" driving the report wasn't actually a table, it was a view in the database.Most of our readers are familiar with how views work, but for those who have had been corrupted by NoSQL databases: database views are great- take a query you run often, and create it as an object in the database:
|
![]() |
by Remy Porter on (#6SFM5)
"Magic bytes" are a common part of a file header. The first few bytes of a file can often be used to identify what type of file it is. For example, a bitmap file starts with "BM", and a PGM file always starts with "PN" where "N" is a number between 1 and 6, describing the specific variant in use, and WAV files start with "RIFF".Many files have less human-readable magic bytes, like the ones Christer was working with. His team was working on software to manipulate a variety of different CAD file types. One thing this code needed to do is identify when the loaded file was a CAD file, but not the specific UFF file type they were looking for. In this case, they need to check that the file does not start with 0xabb0, 0xabb1, or 0xabb3. It was trivially easy to write up a validation check to ensure that the files had the correct magic bytes. And yet, there is no task so easy that someone can't fall flat on their face while doing it.This is how Christer's co-worker solved this problem:
|
![]() |
by Lyle Seaman on (#6SDQ9)
"Because 9.975 was just a *little* bit too small," explains our firstanonymous helper.
|
![]() |
by Remy Porter on (#6SCVZ)
Charles is supporting a PHP based application. One feature of the application is a standard "Contact Us" form. I'll let Charles take on the introduction:
|
![]() |
by Remy Porter on (#6SBXH)
Once upon a time, web browsers weren't the one-stop-shop for all kinds of possible content that they are today. Aside from the most basic media types, your browser depended on content plugins to display different media types. Yes, there was an era where, if you wanted to watch a video in a web browser, you may need to have QuickTime or... (shudder) Real Player installed.As a web developer, you'd need to write code to check which plugins were installed. If they don't have Adobe Acrobat Reader installed, there's no point in serving them up a PDF file- you'll need instead to give them an install link.Which brings us to Ido's submission. This code is intended to find the Acrobat Reader plugin version.
|
![]() |
by Remy Porter on (#6SAYQ)
Sometimes, there's code so bad you simply know it's unused and never called. Bernard sends us one such method, in Java:
|
![]() |
by Remy Porter on (#6SA0X)
Simon recently found himself working alongside a "very senior" developer- who had a whopping 5 years of experience. This developer was also aggrieved that in recent years, Object Oriented programming had developed a bad reputation. "Functional this, functional that, people really just don't understand how clean and clear objects make your code."For example, here are a few Java objects which they wrote to power a web scraping tool:
|
![]() |
by Lyle Seaman on (#6S869)
...Screens of Death. Photos of failures in kiosk-mode always strike me as akin to the wizard being exposed behind his curtain. Yeah, that shiny thing is after all just some Windows PC on a stick. Here are a few that aren't particularly recent, but they're real.Jared S. augurs ill: "Seen in downtown Mountain View, CA: In Silicon ValleyAI has taken over. There is no past, there is no future,and strangely, even the present is totally buggered. However, you're free to restore the present if you wish."
|
![]() |
by Remy Porter on (#6S79D)
ArSo works at a small company. It's the kind of place that has one software developer, and ArSo isn't it. But ArSo is curious about programming, and has enough of a technical background that small tasks should be achievable. After some conversations with management, an arrangement was made: Kurt, their developer, would identify a few tasks that were suitable for a beginner, and would then take some time to mentor ArSo through completing them.It sounded great, especially because Kurt was going to provide sample code which would give ArSo a head start on getting things done. What better way to learn than by watching a professional at work?
|
![]() |
by Remy Porter on (#6S6AB)
Alicia recently inherited a whole suite of home-grown enterprise applications. Like a lot of these kinds of systems, it needs to do batch processing. She went tracking down a mysterious IllegalStateException only to find this query causing the problem:
|
![]() |
by Remy Porter on (#6S5CG)
Some time ago, poor Keith found himself working on an antique Classic ASP codebase. Classic ASP uses VBScript, which is like VisualBasic 6.0, but worse in most ways. That's not to say that VBScript code is automatically bad, but the language certainly doesn't help you write clean code.In any case, the previous developer needed to make an 8 element array to store some data. Traditionally, in VBScript, you might declare it like so:
|
![]() |
by Remy Porter on (#6S4HN)
Ross needed to write software to integrate with a credit card payment gateway. The one his company chose was relatively small, and only served a handful of countries- but it covered the markets they cared about and the transaction fees were cheap. They used XML for data interchange, and while they had no published schema document, they did have some handy-dandy sample code which let you parse their XML messages.
|
![]() |
by Lyle Seaman on (#6S2NY)
Amateur physicist B.J. is going on vacation, but he likes to plan things right down to the zeptosecond."Assume the flight accelerates at a constant speed for the first half of the flight, and decelerates at the same rate for the second half. 1) What speed does the plane need to reach to have that level of time dilation? 2) What is the distance between the airports?"
|
![]() |
by Remy Porter on (#6S1TS)
Matt needed to add a new field to a form. This simple task was made complicated by the method used to save changes back to the database. Let's see if you can spot what the challenge was:
|
![]() |
by Remy Porter on (#6S0YA)
There's the potential for endless installments of "programmers not understanding how UUIDs work." Frankly, I think the fact that we represent them as human readable strings is part of the problem; sure, it's readable, but conceals the fact that it's just a large integer.Which brings us to this snippet, from Capybara James.
|
![]() |
by Remy Porter on (#6S001)
Since it's election day in the US, many people are thinking about counting today. We frequently discuss counting here, and how to do it wrong, so let's look at some code from RK.This code may not be counting votes, but whatever it's counting, we're not going to enjoy it:
|
![]() |
by Remy Porter on (#6RZ41)
For years, Victoria had a co-worker who "programmed by Google Search"; they didn't understand how anything worked, they simply plugged their problem into Google search and then copy/pasted and edited until they got code that worked. For this developer, I'm sure ChatGPT has been a godsend, but this code predates its wide use. It's pure "Googlesauce".
|