Feed the-daily-wtf The Daily WTF

Favorite IconThe Daily WTF

Link http://thedailywtf.com/
Feed http://syndication.thedailywtf.com/TheDailyWtf
Updated 2024-05-18 13:46
Error'd: Shippingship
Unpacking from the pre-Christmas rush, as you might imagine our readers were running intoall kind of fun with packages and delivery and time warps. But first, proof that time warpsalso afflict even web sites that ship only bits, not boxes.Jonathan B.wondered "What day IS it today?" when faced with this article.
Best of…: Best of 2023: Modular Dependencies
Best of…: Best of 2023: Around the World (Around the World)
Best of…: Best of 2023: The Microservice Migration
Christmas in the Server Room
It's the Holiday Season, so we're going to take a break from our usual content, and talk about holiday movies and TV specials. But we can't just completely abandon what The Daily WTF is about, so we're going to rate these holiday classics for the accuracy of their portrayal of the IT industry. We'll rate each on a scale of 5 floppy disks, where 5 has the documentary accuracy of Office Space.A Charlie Brown ChristmasThe story of A Charlie Brown Christmas focuses on the conflict between Christmas spirit and commercialism. The story contains no computers or IT professionals, and instead focuses on the annual Christmas play which the children are producing. In that regard, it's a story of a poorly scoped, poorly resourced project, with the actual responsibility for the project's success being left in the hands of unqualified children, while any sort of managerial oversight by adults is expressed as sad trombone noises.Wha wha whaaaa, indeed.Rating:A Miracle on 34th StreetKris Kringle, a department store Santa claims to be the real thing. He's committed to a mental institution, triggering a court case to determine whether he's dangerously insane- or actually Santa Claus. The "twist", such as it is, is that the Post Office, overwhelmed with all the letters to Santa, decides to deliver the mail to the courthouse. By this, it's determined that the Federal government, in the form of the postal service, believes Kringle to be the real Santa Claus. The case is dismissed, and Christmas is saved.Again, there's very little technology in this story, but the postal workers thinking they have an easy solution to a hard problem and literally dumping it in someone else's lap is very relatable.Rating:Rudolph the Red Nosed ReindeerRudolph, assumed to be "defective" because of his glowing nose, goes on an adventure with other "misfits", until his difference is suddenly useful: his glowing nose will guide Santa's sleigh through the snow. The moral of the story is that it's okay to be different- so long as you're useful.This tale is the tale of the overeager intern, the one who wants to do the "real" work, and is overjoyed to be asked to work late on Christmas Eve, because they finally feel like an important member of the team. Painful watching, but sadly true to life.Rating:Die HardVacationing police officer John McClane's holiday reunion with his estranged wife goes off the rails when terrorists take over the building. But they're not terrorists- they're thieves, and this is all a stunt to get them access to the building's vault.Central to this plot is that, to bypass the final lock, the thieves need the FBI to cut power to the building. From a "basic common sense" perspective, this is absurd- of course you'd expected a powered lock to fail safe, not fail open. That said, we've seen so many wiring and electrical snafus on this site, that I have to grant it some plausibility. Bonus points for the sleazy sales-beast dying. Not realistic, but satisfying.Rating:Santa Claus Conquers the MartiansThe Martian children are sad, so their Martian dad decides to kidnap Santa Claus. This creates a factional schism in Martian culture between the Santa-loving progressive faction, and the conservatives. The conflict is resolved when the dumbest Martian- named Droppo- decides to become Mars's Santa Claus, and Santa is sent home.The movie is stuffed with robots, spaceships, pills instead of food, and of course the requisite 50s era "pushbutton future" where instead of making toys, Santa just pushes buttons on a Martian machine to generate them. It's profoundly dumb, but not as dumb as Droppo. That said, the dumbest person on the planet being handed a powerful position with basically no responsibility and answerable to no one? Painfully realistic.Rating:A Fairytale of New York"It's Christmas Eve dear, in the drunk tank," begins this dark Christmas song. From there, we hear a couple fighting over their broken dreams, and broken hearts, with real genuine spite for each other.Yes, we're drifting out of visual media and into song. While nothing about this may seem terribly IT related, we can see through the subtext of the song. Arrested for public intoxication on Christmas Eve, living a life of wrecked and shattered dreams? Clearly, this is a story of someone who foolishly agreed to push a new release on Christmas Eve. "The tests passed, what could go wrong dear?" might as well be a line in the song.Rating:Jurassic ParkThree wise sages are called to attend a series of virgin births- the births of dinosaurs. While this Christmas movie breaks with tradition by not happening around the Christmas season, and not featuring any Christmas traditions, the characters of Malcolm, Satler, and Grant are clearly following the star to a velociraptor infested Bethlehem.That this entire automated park has one IT professional, and that this IT professional is disgruntled, underpaid, and no one in management seems to care? Said IT professional has all the keys to the kingdom and can do anything he wants with the infrastructure, because management is entirely absent and incompetent? This movie is practically a documentary.Rating: [Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.
Error'd: I Sleigh Me
Counting down to the end of the year, in prep for someholiday or other, here are your penultimate five Error'dsfor 2023. I wonder if Debbie ever was a real person.First, Dr. Drk S. has some odd network behavior to share."Sometimes inexplicable things happen in the cloud. Sometimesyou get alerts that just go away. Sometimes you detect curiousnetwork traffic patterns. Sometimes it all averages out to nothing."
Radical Pricing
Genesis stepped off the bus, splashing through puddles in neon-yellow rain boots, towards the old, rusted bay door of the "Radical Radiators" building. Her actual employer was "Radiation Programmers", which was either related to the heating company or had purchased the building cheap when the radiators went out of business.Key in hand, she unlocked the door, walked past the "No Smoking" sign, and settled in beneath the buzzing fluorescent lights. Laptop on wi-fi, NPR murmuring in her headphones, Genesis settled in for her day: writing software to handle payment processing for fan fiction sites.The garage creaked open. Ten seconds later, a man with a gray, frayed beard ambled in, his blaring music audible even through Genesis's noise-cancelling headphones."Hey Howard, how was your commute?" Howard grunted in reply. Their interactions were minimal, consisting mainly of morning nods and grunts. Genesis was replacing Howard on the team, and it wasn't clear to her if Howard was on his way to a new job or was getting fired and training his replacement.Howard made a bee-line for the ancient coffee machine tucked in the corner. After concocting a brew, he settled at his desk amidst a litter of candy wrappers, soda bottles, and a sandwich from yesterday's lunch, grunting as he sat down.Genesis checked the time, and realized she had an impending 8:45AM meeting with the CEO, Alexis, or as she preferred to be called, "Alexa". There was no agenda, so she opted for coffee and settled into the makeshift conference room, once a car repair garage's back office.Alexa arrived late, Starbucks in hand. "Sorry, let's meet in my office."Once in the office, Alexa set the Starbucks cup down, and grabbed an energy drink from the mini-fridge and some ibuprofen from her desk."So, there's no agenda for this meeting," Genesis said.Alexa downed the pills and chased them with the entire energy drink. "I'll draft one later. How's it going with Howard?""Fine.""Why isn't he here? I invited him to this meeting. Go grab him, will you?"Genesis went over to Howard's desk, and over his blaring music, said, "Hey, I think we have a meeting. Did you get Alexa's Slack message?""Hay is for horses," Howard said, "and I don't check slack. I'll be there in a few minutes. Alexa is always running late anyway."When the entire team was settled in, Alexa laid out the problem. "Our longest client is an author called ForeverNap. They reliably publish every Saturday, but have a whole complex pricing approach they want. It's great revenue for us, but it means that every Saturday, someone has to go and manually change their entire pricing model- and since they're one of our biggest publishers, that someone is me. Every Saturday, I get up at 6AM and manually fix it. Can we automate this at all?""I think," Genesis said, "this would be pretty easy to add a custom code path in the Django models, though long term we might need to do some serious refactoring if we wanted to scale this-""It can't be done," Howard said. "ForeverNap's pricing can't be changed through the code. If we did that, we'd slow it down for everyone else. This could lead to a bigger issue down the road, and as Genesis was hinting at, it isn't good coding standards." He turned to Genesis and added, "I have some concerns that if you find it difficult to come up with a solution that you'll be able to maintain in the future. You know I've got 19 years in this business."Genesis let Howard's statements hang in the air, and said, "Okay, I was hired because I'm a Python and Django expert, but this code is a bit rough and it's my first week. I'm pretty sure I can support this and get up to speed, but I think for now we'll defer to Howard's expertise."The rest of the week followed that pattern. Alexa would raise a concern. Genesis would offer at least a first-draft solution, Howard would explain why that couldn't be done and offer no solutions of his own. At least, that's what happened when Howard was paying attention in the meetings, which wasn't often- Alexa frequently needed to repeat her questions to him.Saturday morning, Genesis realized she'd left her headphones in the office. On her way out to enjoy the weekend, Alexa swung past the office. Walking in, she was hit by a wall of cigarette smoke. Alexa was behind Howard's desk, her laptop out, typing away. Caught misbehaving, Alexa coughed out, "What are you doing here?""I forgot my headphones," Genesis said. "What about you?""Ah, yes. Like I said in the meeting, I manually change the pricing. So I come here and enjoy a cigarette for special occasions."Genesis sighed and walked to her desk. ForeverNap released their new uploads at a 40% discount for the first week. It was trivial to add a simple conditional that automatically updated the prices for that customer only. Genesis ran some quick tests on her local build, pushed it through CI, and then released it.The load on their service was never terribly high, so the chances of hurting response times was low, but Genesis had also set up enough alerting that, if this blew up later, she could just revert the change from home. For now, though, it made sure that all of ForeverNap's uploads would come in at the new pricing."You can go home now," Genesis told Alexa. "We should probably talk more about how we want this feature to work in the long run, but you at least don't have to come here at 6AM anymore.""Oh, great," Alexa said. "No more special occasions." She looked at her cigarette wistfully. [Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!
CodeSOD: Vestigial Organs
Matt inherited some C# code that reads from a JSON config file.
CodeSOD: Misunderstood the Assignment
Benjamin doesn't have a lot of complaints about the project he works on. "There is," he writes, "no tale of daily woe." But even an otherwise healthy project isn't immune to WTFs.
CodeSOD: A Reckless Driver
For a variety of reasons, Robert's company needed to ship a small linux box with a USB ethernet adapter. The driver for said adapter was giving him some issues with their setup, but fortunately the driver was open source, so Robert could at least try and diagnose the problems.In the file inst.c, he found this:
Error'd: 500 Miles
Strictly speaking, closer to 700 miles than 500, butif we really cared about precision we'd just go insaner.Peripatetic Jonathan calls out an inappropriate use of lexical sort, as he wryly suggests he'd be"Just popping over quickly to the nearby store which is 1200km away from me." But he entirely missed also calling out the odd location of the Pargo Greatlinks cafe. We've got you covered, Jonathan.
CodeSOD: No Lifeguard in this Connection Pool
Michael was debugging a system where the J2EE service would just... crash. It was running on a Windows host set to restart the service when this happened, so the outages were brief, but it was a serious problem.He eventually tracked down the problem to a class called JdbcSchema, which is about 1,100 lines of homebrew database management code. It does "fun" things, like create extra tables in the database to track "foreign key metadata".Or, for real fun, it has a getTransIsolation function, which returns the transaction isolation your query should use. If you're thinking to yourself, "doesn't the transaction isolation depend on the specific query and workload?" you'd be right- this function changes what transaction isolation all queries are supposed to use based on the time of day. Presumably, this was to support batch processing at night, but it's a bonkers way of going about it.None of that, however, is why the application crashed.
CodeSOD: Monthly Totals
Daniel spotted an array called $months in a PHP application. The data being stored in the array was some total of the sales of some commodity, for the past 5 months.That much all made sense. What didn't make sense was how the array was indexed.
CodeSOD: Secure Mentorship
Sophia entered the software development industry through an "alternative" path. In Germany, they have a tradition of Ausbildung. Instead of going to university, you focus on on-the-job training with some classes mixed in. There are still exams and all the traditional academic trappings, but with one huge bonus: you're working closely with an Ausbilder- an experienced industry veteran who can show you the ropes.Sophia's Ausbilder was named Tim, and at the company she was working at, he was widely hailed as a genius. He had designed their entire web system from the ground up in Java, which given that every other developer at the company only worked in Delphi, that made him a pretty unique talent. Everyone was pretty convinced he was brillant.Sophia, who at this point was fairly novice in the industry, was excited to work with him. That lasted about five minutes.It didn't take long to discover that the entire system was constructed around god classes that just bundled a pile of unrelated functionality into an undebuggable blob. Sophia has lots of things she wants to share, but today we want to look at one specific class, helpfully called ModuleClient:
CodeSOD: Padding the Amount
Matt's co-worker needed to handle some currency values coming in as strings. As this was in C++, we're already in a fraught territory of having to worry about whether the callers and various APIs we're using handle C-style strings or C++ std::string.Or, you can just mix-and-match in code and hope for the best, while having some interesting approaches to handling your inputs. That's what this developer did.
Error'd: (Almost) Nought but Nulls
For this week, it's mostly nulls. But first, Finn Samiprovides a provocative hint that the LLMs might bedeveloping a theory of other minds. Says Sami: "A coworker noted that when Copilot starts to have doubtsabout Bing, this might be the real start of AGI." I've certainlygot my doubts about some of the Alleged GIs around.
CodeSOD: A Nice Break
Once upon a time, HTML had tags like <marquee>, which scrolled text across your page, and when combined with animated GIF backgrounds basically defined the Geocities aesthetic.Since then, the HTML specification has been refined, and the choice has been made that HTML tags should (mostly) be about semantics- describing the structure of a page, the meaning of elements, and the relationship between those elements. It generally shouldn't describe the presentation of those elements (CSS should do that)- even though the semantics generally imply something about the display (paragraphs and divisions are block elements, for example).And then <br> walks up and throws a wrench in that, because it's much more about the layout of a page than the semantic relationship between elements.The <hr> tag falls into a similar space- it does represent a logical break between parts of the page, but also has a clear visual intent: draw a line on the page.I'm not trying to suggest that either of those tags are wrong or shouldn't be part of the spec, I'm just highlighting that they're not precisely semantic- they don't have a pure semantic meaning like a paragraph or a logical division might.But you know what is wrong? This HTML Ted found, which is a different way of getting a horizontal rule on the page.
CodeSOD: Evaluating Perks
Today's anonymous submitter works for a company that handles customer rewards perks. It's handling thousands of dollars of transactions a day, which isn't a huge amount, but it's certainly non-trivial.Now, there's a conversion formula from points to dollars: points/100*1.7. Now how would someone implement this complex formula in PHP? Well, our submitter's predecessor did it this way:
CodeSOD: TrUe Romance
Mario's predecessor was writing some Java code that parsed textual input. Thus, it needed to be able to turn the string "true" into the boolean value true, but also needed to handle "True" and "TRUE".Now, in Java, the obvious answer would be to use the equalsIgnoresCase String member function. if (value.equalsIgnoresCase("true")).... I mean, obvious to you or me, anyway.But if you're a developer with a hammer, you're going to turn every problem into a nail. And when that hammer is regular expressions, you're going to turn every problem into two problems.
CodeSOD: Capitalizing on Memories
Gavin inherited some "very old" C code, originally developed for old Windows systems. The code is loaded with a number of reinvented wheels.For example, they needed to do a case insensitive string comparison. Now, instead of using stricmp, the case insensitive string comparison, they wrote this:
Error'd: A Brand New Bag!
We've all been watching programming gaffes come and go, and they're almost alwayssome variation on a set of usual themes I've been trying to classify and name. But today, we've got one for you that is amazingly, excitingly, fabulously novel! I'm calling this one ecrash unless somebody's got a better idea.Not to keep you waiting any longer than absolutely necessary, here's Ian M.with this week's winner:"I don't even know how you do search like this, it'ssomehow both way more complicated and way moreunsettling then it needs to be."
CodeSOD: Input Validation is a Sure Thing
Validating inputs matters. It's also a challenge. Validating that an input is numeric might be easy, but validating an email address is orders of magnitude harder (and technically isn't a regular language and thus can't be parsed by regex, though you can get close). Validating a URL is also a pretty challenging task, since URLs can contain all sorts of surprising information.Daniel's co-worker, when tasked with validating URLs, looked at the complexity, and came up with a simple, elegant solution, in JavaScript.
CodeSOD: A Caught Return
When John takes on a new codebase, he always looks for low-risk ways to learn the code by changing it. Things like beefing up the unit tests, tracking down warnings that have been left to languish, minor quality-of-life changes.Well, a few years back, John inherited some C# code, and started tracking down some warnings. That lead to this method.
CodeSOD: Free From Space
Henrik H is contracting with a client, and that client uses a number of other contractors. Some of them have... interesting approaches to problem solving.For example, one of the servers is a Windows server, which stores a lot of temp files on the D: drive. So someone needed to write a C# function that would check the available space, and if it exceeded some threshold, delete the temp files.This is what they came up with.
CodeSOD: Zero Failures
Parsing strings into other data types is always potentially fraught, what with the edge cases and possible errors. This is why most languages provide some kind of helper methods that try and solve those hard problems.C# has a number of them. One, for example, would be Int32.Parse- it attempts to parse a string into an integer, and throws an exception when it fails. Similarly, there's an Int32.TryParse function, which avoids throwing an exception and returns an error code instead.Which brings us to this code, from A Barker.
Error'd: Here We Go Again
This week has been mostly centered on a holiday forthe USians. In the era of online retail and theglobal dominance of Amazon, the notion of "Black Friday"seems to have spread further than the harvest festivalitself. The practice of mass national migrationsthankfully has not.Migrating Maia exclaims"Oh wow, I can change my flight for a fee of only [AMOUNT]! What a deal!"
Best of…: Classic WTF: Worse Than Failure
CodeSOD: Lines of Code
Brittany is a game developer, and frequently ends up working on contracts for other companies. One company wanted her to add some features to their trading-card based game, and they offered her an option: she could either do a fixed-rate contract or a paid-per-line contract.Brittany went with the fixed-rate.When reviewing the code, she found that the previous developers went with the per-line contract:
CodeSOD: Limited Space
While XML is a complicated specification, and incredibly bureaucratic and verbose, it's also powerful enough that many languages, from Java to Python, have XML helper classes in their standard library.C# is one of those languages. But just because there's a built-in library (and a wealth of 3rd party libraries with richer features) doesn't stop people from reinventing the wheel.Ryan sends us this short C# snippet, writing: "This is the start of a method that constructs an XML file using strings."
CodeSOD: Constant Adventure
We know that June 7th, 2006 was a long day for Jonas, Rusty's long-ago predecessor. We know that, because Jonas made a big commit that day. It was the day someone told him to stop using magic numbers and switch to named constants.
Error'd: Unrewarding Math
Our own Michael R., still job-hunting, has turned up a position that should NEVER be filled. "I was hoping at least one of them goes to 11!" Rock on.
CodeSOD: Mapro
Steinin was doing some work for a company that needed some geographic information systems work done. Steinin was just the programmer, and was no expert on the algorithms they needed implemented, and so asked for some references on how to implement them.They handed him this C code.
CodeSOD: Shift Sign Off
An anonymous submitter was working with some vendor-supplied code for talking to a network device. They sent along this sample C code for properly populating the required header.
CodeSOD: All Roads
A conditional statement represents a branch in our code. A place where things could go one way, or they could go the other. That, at least, is traditionally what they are. Adam's co-worker took a different approach.
CodeSOD: Include This
C and C++ are weird, specifically in the way they handle the difference between declarations and definitions. We frequently put our declarations in a header (.h) file, and the definitions associated with them in an implementation file- say, .cpp.But things can only get declared once, which means if multiple implementation files depend on the same header, the compiler will yell at us. We need a way to ensure that, no matter how many times a header is referenced, it's only actually read once.For some compilers, you can use #pragma once to tell the compiler to only include this file once. But that's compiler specific, so more traditionally, the formula is something more like this:
Error'd: Cheap Date
Poor Michael R. is STILL job hunting. "Suddenly it all makes sense why I can't find anything: there are -1 more positions available."Good luck Michael, we're counting (badly) on you.
CodeSOD: On the Border of Badness
The WebForms APIs in ASP .Net tried to make web programming look like native programming- you designed pages in a WYSIWYG editor, and bound event handlers to controls, and pretended like the request/response cycle didn't exist. It was a bit of a mess.One of the ways it was messy was that you now had two different approaches to styling elements in your UI. You could go the route of using CSS, like a normal web page. But every web Control object also exposed a bunch of properties that you could access directly from your server-side code, allowing you to do things like myControl.BorderColor = Color.Red.All that's fine and good, or fine and bad, if we're being honest, but it brings us to Leandro's submission. While trawling through a legacy code base, this little snippet leap out:
CodeSOD: UniQQue Naming
The application Zach B found himself supporting needed to accept file uploads. At one point, someone decided to just drop all the files in the same directory, so they needed to find a way to ensure that there were no name collisions.They wrote this:
The White Appliphant
Circa 2010, Becca's employer, Initech, was growing. "Growing", in this case, meant "acquiring competitors who had niche products that their customers wanted added to Initech's portfolio".One such product was a content-management/workflow tool, already sold to some big-name, multi-billion dollar companies. The tool fell into that niche between "really useful to the people who need it" and "buggy as an ant hill inside of a termite mound under a wasp nest". Sales were good, but the devs were underwater and the backlog of feature requests and bug fixes were growing. So Initech bought the vendor, fired most of the developers, and handed it to an Initech team."It's just some bugfixes," management said, "what could go wrong?"The first thing that went wrong was the senior dev assigned to the project rage quit after two weeks with it. "I ran the install scripts, which are supposed to provision a new database and deploy the web app files to a web server. There are thousands of interlocking scripts to make this happen, and half of them don't work. Along the way, it creates hundreds of SQL tables, all with names like table1, or important_table1, and many of them are never queried by anything in the code, despite having data." What followed was an ultimatum: take me out of this project or I'll take myself out of the company.Given that this senior dev was central to many other projects, the company shuffled things around and put another sacrificial lamb in place, a different senior dev. This dev needed to add a small feature- a new field to a screen. Six weeks later, the dev had something that mostly worked. It was a hacked on retrofit- there was no "right way" to add a new field to a screen; any modifications to any of the front end or back end or database code tended to cause explosions, thunderstorms, and the gnashing of teeth. This dev, also very high up and respected, repeated the ultimatum.When adding a new field to a screen takes six weeks and burns a developer out, you can imagine how hard it is to fix bugs. The junior devs put on bug fixes were burning out just as quickly, but producing far fewer results. The bug backlog kept growing far faster than bugs could get patched.
Cool Power
Power outages are never good, and they're even worse when your facility needs to run 24/7. Now, Jaroslaw's organization didn't do a great job setting up for round-the-clock, always-on operations. It was the kind of thing where the organization grew, annexed the neighboring building, and kept growing. The result was hundreds of workstations, two separate power lines, two server rooms, three different Internet uplinks, and huge piles of switches responsible for making this network work.Which added the problem that after a power outage, nothing came back on exactly right, either. It always took some time to find the one switch that opted not to reboot.Now, many years earlier, someone had the bright idea of installing a generator. The hookup offered no easy way to switch over to generator power, and thus required an electrician with keys to the elecrtical boxes to actually make the change. While the servers had small UPSes, enough of the environment went down during a power outage that, by the time they had the generator on and everything powered back up properly, the outage was usually over.And so it went for years, until someone higher up looked at the problem and freed up the budget to fix things. The generator was replaced, and there was a plan to change the wiring so that it was faster to switch over- but it turned out that would have tripled the budget and shut the facility down for days while electricians redid the whole electrical system. Instead, the budget was used to upgrade from small, consumer-grade UPSes to a big hocking, 10kW unit.It was the size of a large refrigerator, and had enough power to keep all the critical elements of the facility powered on for twenty hours- time enough to switch over to the generator, if needed.And then, miracle of miracles, they tested their switchover plan. They cut main power, saw the UPS come on, ensured work could continue, then had the electricians switch on the generator, and then reversed the whole process. It went off without a hitch.And then a week later, the UPS screamed about an overload. It lasted for about 40 seconds, then cleared up. Considering that the UPS had way more capacity than they needed, that seemed like a serious problem. Two hours later, it happened again. And again. And again. Jaroslaw went through everything in the server room, trying to find the badly behaved device. At one point, he found an unplugged electric kettle sitting not far from the server room, and went on a hunt to see if anyone had been making tea in the server room, thinking that was the culprit. No one had.Over three days, after checking all the equipment, Jaroslaw went to the building wiring diagram and started checking every outlet. He found one, hidden in the back of the server room, ostensibly unused, that had an extension cord plugged in. The cord was neatly tucked into the cable chase, as if it was part of the plan. Jaroslaw tracked the cable, and followed it around the room until he found a hidden refrigerator. Some of the 24/7 staff wanted easy access to snacks and drinks, and didn't want to constantly badge in and out of the server room to get them. While there were plenty of non-UPS protected outlets they could have used, someone had decided this was a better option.And sure enough, while Jaroslaw was looking at the fridge, he heard the compressor kick on, and the UPS scream about an overload at the same time.The immediate fix was easy: remove the fridge and extension cord, and have a serious discussion about proper server room safety. The longer term fix was spending the last bits of the budget to add keyed switches to all of the outlets in the server room, ensuring no one could plug things in without going through the proper channels. [Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.
Error'd: A tall glass of {{product.brand}}
Hungry Adam starts off your RSS feed with what might honestly be making the best of a bad situation."I guess my pizza will be here next time I write a date bug?"
CodeSOD: Not My Domain
Dian found this code snippet.
CodeSOD: UTF-16 Encoding
Let's say you were browsing through some code, and saw a function signature like this:
CodeSOD: Legacy Horrors
Today is Halloween, a day filled with chills, horrors, and Jamie Lee Curtis. An interesting aspect of horror movies is how often the roots of the horror lurk in the past. Michael Meyers had been in an asylum for decades before his infamous Halloween rampage. Midsommar represents a centuries old tradition. Barbarian is rooted in sins committed a generation prior. Freddy Krueger was the manifestation of the sins of our protagonists' parents. Hell, even Dracula is a menace that had been lurking for centuries before our story begins.In honor of that, we're going to look at some code from Davide. Like so much classic horror, the seeds of this sin were planted many, many years before Davide arrived.In 1991, Microsoft released their first version of Visual Basic. The language evolved until 1998, with the release of VB6. Mainstream support ended in 2005, extended support ended in 2008, but like true horror, VB6 has not truly died. The development tools continue to run on all 32-bit versions of Windows.Back in those olden days, Davide's predecessors decided to implement an Enterprise Resource Planning system in VB6. It grew, and evolved, and became something that couldn't be controlled anymore- it was 2.5M lines of code. It entangled itself into the company, taking over every core business function, and rapidly becoming indispensible.We can compare it to so many monsters of horror- the shapeshifting Thing, gradually replacing parts of the company with itself. The fungus from The Last of Us, taking over the brain of the company. We can compare it to The Blob, which may also be the most accurate description of the coding practices used in building it.Here's some code that evaluates a formula entered by the users:
CodeSOD: High Performance Query
Aaron was doing some work with a high-performance-computing platform. The kind of thing that handles complex numerical simulations divided across farms of CPUs, GPUs, FPGAs, and basically anything else that computes.The system comes with a web GUI, and the code for the web GUI is... well... let's just look at the comment on a method.
Error'd: Look, Up In the Sky!
"My FB got HACKED" wrote an anonymous contributor. "Verification codes box sooo not funny " Not just one facepalm, but four.
CodeSOD: End this Date Now
Once upon a time, someone wanted to store date ranges in a database. And so, they started down the obvious path of having two columns, one to hold the starting date of the range, and one to hold the ending date. But even going down that route, they tripped and fell, because they ended up with two database fields name Startdate and StartdateStart. Startdate was the end of the period.You might be thinking, "Well, at least they used the database datetime types," but on that front, you'd be wrong. They used text, and in some cases, instead of Startdate holding a date, it held a string in the format 22-08-2022 to 27-08-2023.Someone had to write code to parse that data, and that someone did the job and then left. Which meant Niels H had to support the resulting C#.
CodeSOD: It's All Right
Mark recently inherited a Java codebase that... well, it's going to need some support. He thought things were bad when he encountered this:
Locally Variable
Henrik H was hired by a customer to fix some bugs in their application. The main one was that their C# web app didn't properly track the user's culture settings. Henrik spoke with their internal developer, who originally wrote the application, and was told: "Sometimes the culture name and LCID is out of sync. I don't understand why?"Well, from that description, Henrik didn't understand either. Why was there a separate name and what the heck was LCID? Why were two variables getting synced? The only answer would be in the code, so Henrik dug in.
CodeSOD: Cast a Different Spell
The rule of spelling in programming is that it doesn't matter if you spell it correctly, only if you spell it consistently. Which is fine if you're working alone, but we rarely work alone. And unless you're entire team shares the same misspelling habits, you're in for trouble when one person insists on "calander" while everyone else uses "calender".Fortunately, Jonathon's co-worker had a solution to this problem.
12345678910...