Feed the-daily-wtf The Daily WTF

Favorite IconThe Daily WTF

Link http://thedailywtf.com/
Feed http://syndication.thedailywtf.com/TheDailyWtf
Updated 2024-11-23 08:46
CodeSOD: The Flasher
Michael H sends us some code that probably deserves a NSFW warning for exhibitionism. This code is a confusing bit of metaprogramming that… well, shouldn’t be allowed near schools or playgrounds.
The Carte Blanche Pattern
"Rejoice! Rejoice! Emmanuel shall come to thee, O' Israel!"Something was definitely up. Ricardo, the team lead, hadn't stopped singing carols that day. Sure, it was a few weeks before Christmas, but that was hardly an excuse to serenade the whole office. No, something had happened, and Erika was determined to keep out of it.This wasn't the first time Ricardo had gotten prematurely excited over something. Usually dour and unhappy, when he truly believed in a project, he'd hype himself up about it until there was no talking sense into him. It was best to lie low. If you got sucked in, you'd only be blamed when the inevitable fallout crushed his spirit yet again.Unfortunately, fate seemed to have it in for Erika. Ricardo made a beeline for her cube, still singing carols."I bring ye tidings of great joy!" he announced, knocking on the sidewall of her cube. "They agreed to rewrite the frontend—this time, with a CMS!"That was good news. Nobody liked the aging frontend, but nobody ever seriously broached the subject of redoing it, not with the usual budget austerity. It worked, and it was "only" six years old, they should be able to patch anything that had security implications and keep it running for another ten years. Just like a used car, right?The biggest complaint was that it had no Content Management System. Every tiny image tweak Marketing wanted, every news article, every dynamic piece of content was achieved via a promotion. They'd separated content from structure as best they could in small payments on the tech debt over the years, but the prospect of a proper CMS, where they could hand the keys to Marketing and wash their hands of the content, was like Christmas come early. Still, Erika couldn't help but wonder where the catch was."What's the deadline?" she asked, already preparing to cringe."That's the best part: you won't have to worry about the project or the tech design or anything," Ricardo answered. "They're sending over a couple of guys from the East Branch to run the whole thing. Apparently they've had a CMS for a year now and love it, so they want to build the exact same thing here."Erika bristled. If they had a CMS in the East Branch, why did they give her so much crap about putting one in Corporate HQ? And now a couple of clowns were coming in to tell the team how to do their jobs?Sensing her frustration, Ricardo beamed at her. "Hey, don't worry. I know these guys. They're a couple of certified geniuses. I hear they used to work at Google! They know what they're doing, they just need us to supply a few extra pairs of hands and they'll run the whole show. I got Marketing to agree to give them free run of it, carte blanche, whatever they say goes. This is going to be the best project we've ever done!"A year later, it was almost Christmas yet again—but this time, there were no festivities in the air. Erika's hair had grown out and reverted to its natural colour; she couldn't be bothered to head to the salon, not when every day she felt like drinking herself into a stupor. Marketing seemed bound and determined to take all of IT down and replace them with offshore developers, and with good reason: every test they ran on the shiny new frontend found some new "Critical" bug. Validation was never quite right. The workflow was nothing like the design had promised. The styles were off. The images were wrong. The CMS was serving up content scheduled for the future, but only on Tuesdays. Every bug that got fixed introduced another four.Ricardo spent most of his time in meetings, trying to quell the Marketing demons and lull them back into their unhappy slumber. Erika's task was testing the application as rapidly as she could, despite no real QA training. If Marketing's testers received another bad build, all hell would break loose. The last glimmer of hope within her suggested that if she could just get a look at the code, maybe she could figure out what was wrong. Maybe she could solve it. There had to be a Node module that could fix the systemic problems, right?"Which branch is the code on?" asked Erika, passing Ricardo in the hallway. "I thought I'd take a look—""Don't you dare." Ricardo actually stopped to grip her shoulders tightly, a terrified look in his eyes. "I thought that last month, and I've regretted it ever since. I've seen things I can never unsee in that codebase. Single letter variable names. Views mixed with models mixed with half-hearted validation. Tabs and spaces together, Erika! As if they belonged that way! Don't you dare throw away your sanity on this project, you hear me?"Ricardo's theatrics aside, Erika was now more convinced than ever that she had to see the code for herself. Not because she could fix it, but because she was morbidly curious. When Ricardo wasn't looking, she poked around the repo, checked out a working copy, and sneaked home with her laptop and a bottle of chardonnay to see what she could find.The first file she opened was the account creation workflow. Remembering Ricardo's words about spacing, she ran it through Sublime's re-indention methods before she read any of it. Soon after, she swapped the chardonnay for whiskey, but she began to comprehend the problem: these guys were not developers. They didn't understand how to construct software. Whatever they'd done at the East Branch was, had to be, a fluke. Their best code was all ripped straight from StackOverflow. They were desperately trying to make intelligent decisions, but they kept coming up with bizarre conventions like this one:
CodeSOD: Ch-ch-ch-changes
Archie poked around in his company’s billing system. This was a mistake, because that system is implemented largely in PL/SQL, and only a developer made from the sternest stuff can deal with PL/SQL.Like most PL/SQL applications, the Oracle database is the closest thing they have to version control. Each developer makes changes in the live dev environment and then hopes for the best. They don’t use TOAD or SQLPlus or any “normal” tool for making these changes- they have to use an in-house developed GUI, because that GUI tracks their changes and writes rows into a database called “VersionDB”. When they finish a patch and want to release the changes to their customer sites, they send a copy of the VersionDB and let a simple script apply all of those changes.
Management Reality
Merriam-Webster says that synonyms of stupidity include boneheadedness, brainlessness, denseness, dim-wittednes, dumbness, mindlessness, senselessness, thickness, vacuity and witlessness (among others). Perhaps they should add management to the list.For some reason, managers tend to make leaps-of-faith in the realm of technology. If they think that they know the meanings of two words, then there must be a connection between those two words. Unfortunately, whether the connection is real or imagined, they seem to proceed as though it were always real.A couple of years ago, Harold worked for a modest company. It was your garden variety organization with the usual amenities (a break room, candy and soda machines, etc.). In this place, strict adherence to the Dilbert Principle was the standard for hiring and promotion, and the CIO was a prime example of this rule in action. The powers-that-be believed this individual to have an in-depth understanding of how technology worked, and how different roles (e.g.: developer, QA, etc.) interacted, and so he was promoted to Chief Insipient Oaf.The CIO had a very high opinion of himself and of his supreme knowledge and mastery of all things. After reading an article on the subject on the InterWebs, the CIO decreed that a new high-tech think-tank would be created to foster design, productivity and camaraderie within the organization.This facility would have a certain Feng Shui to drive the layout and ambience. It would have a specific quantity of each of a certain type of computer. There would be erasable surfaces upon which new brillance could be scribbled. It would showcase successful projects, as well as industry awards. It would even have a high-tech table capable of dynamically expanding to match the number of folks in the room (e.g.: a dining table with additional leaves).Teams would be able to brainstorm new solutions in record time in this conducive environment. Inter-team sessions would enable people to optimize work flow and productivity across departments. This new think-tank would elevate their performance to levels worthy of the word enterprise.He even wrote about it in non-peer-reviewed magazines, without discussing it with anyone above - or below him in the organization.One day, the CIO's minions were sitting around their department break room, reading and discussing their leaders' bragging about their new think-tank. In particular, since they'd never been told of its existence, they were trying to figure out where it was located. After all, they had no room that featured such computers, awards or successful projects, and it might be nice to leverage such a room for its intended purpose.Fortunately, the CIO had mentioned enough facts in the article about the think-tank that the staff was finally able to deduce that he was actually talking about their break room.One can only wonder what might have happened if someone had actually requested a brainstorming session in the think-tank...[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!
Error'd: Let's Party like it's 2005
"I can't tell if it's a proofreading or a 'Y2k15' glitch," Ken L. writes.
CodeSOD: Good Idea, Bad Idea
After years of neglecting their command line tools, Microsoft decided to try and build a grown-up set of administrative tools, and released PowerShell. Nearly a decade later, and many of their flagship services still don’t integrate neatly with PowerShell. The syntax is a bit messy, and the promises of an object-oriented shell never quite came to fruition. PowerShell is a great idea, executed poorly. For all that, it still offers certain advantages compared to the Unix family of shells, and is certainly worlds better than ol’ CMD.EXE.Speaking of good ideas executed poorly: backups aren’t a good idea, they’re a great idea. And when Tommy took over as an Active Directory engineer, he was happy to hear that his predecessor had left behind a script that backed up all their user data on a daily basis. Tommy was significantly less happy when he saw the script.
Let Them Eat Cookies
As a Python developer, SEO was far outside of Ian’s toolbox, more in the realm of expensive social media consultants. However, when his friend Alec asked for help, he knew he couldn’t turn him down.Alec worked at LightBarn, a lighting supply company, and was overseeing their SEO optimizations. Alec explained that no one could actually find the company’s website with relevant keywords on popular search engines. “I looked all the way to page 150!” Alec said. “I don’t get it. We have plenty of inbound links.” Alec had worked for months writing a blog on the company’s site, and his posts were routinely linked to by other industry sites.
CodeSOD: A SASsy Import
After ten minutes of Mike staring at the screen unmoving, Jill sighed. As the newly minted tech lead, she knew that she had to help unwedge problems. But she also knew that Mike had been tasked with a task which should have been simple, had the project been developed in their team. Alas, it had been thrown over the wall for them to maintain, as a “reward” for cleaning up so much else.The calculations for generating quotes for customers were, for some complex scenarios, quoting too low; they were missing some items. The originators of the quote system had used Excel, so there was probably a hard-coded range to be updated. She’d asked Mike to fix it, create a playbook for this system and create a ticket sketching out what might be needed to make the system more resilient and maintainable. Excel would still be required, for the actuaries wouldn’t hand over formulae in anything else, but perhaps some jiggling into independent sheets and just running summaries over “the whole sheet” would reduce the pain. Jill had thoroughly cautioned Mike that he did not want, at this point, to discover the paperwork and bureaucracy to change how the calculations were performed, so the only changes to be made in this first approach were to be the minimum necessary, while keeping the style and solution intact.What Jill did not expect as the first question from Mike, when she went over, was an inquiry into just what the bureaucracy would be like, to bite the bullet immediately. Humoring him with an explanation, she was somewhat more taken aback when, after only brief cussing, he started pulling up the forms to do so.Once she saw the code being maintained, and Mike’s proposed replacement, she signed off immediately on the paperwork parts she was authorized to approve, and went off with a printed copy to get the co-signatures needed. By the time they were done, the time taken for this override process set a new institutional record for “fastest approval”. Sometimes, lumbering bureaucracies could move quickly; dodging a bullet during a budgetary crunch with no funding available for empire expansion will do that.The code, and Mike’s replacements, went into training materials for the team. The original code may be found below; it can be summarized as:
Announcements: TDWTF API
Happy New Year! Have we got some great news for you. Subramanian has contributed a RESTful API for accessing our articles, which we’ve deployed. So now you can get started on your New Year’s resolution of writing and sharing more code.You can check the docs here. I know Subramanian is working on using this to build an Android app, which we’ll be happy to announce here when he’s ready. If you use this API for anything, do let us know. And if you have any thoughts for how to improve it, send us a pull request on GitHub. We look forward to seeing the cool stuff you guys get up to with this.[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll 👍 today.Your first 30 days are free on us. Learn more at Scout.
Don't Click That
The year was 2004, and Scott S. has just begun his internship at IniBank: an underdog financial institution that would, over the years, grow up to be one of the biggest players on the market. Despite being fresh out of college with little experience under his belt, he quickly found his way around the corporate culture and acclimated to the Application Development Department.His first task was to assist in rewriting a simple, internal Classic ASP application into ASP.NET and WebForms. Eager to work with the then-new and shiny technology, he spent his days researching the documentation, asking questions, and learning the ropes, slowly producing useful code.One day, as he was tweaking a simple grid, Tim—the project manager and his internship overseer—stepped into his cubicle. "Hi, how's it going?" he asked jovially. "Enjoying the company so far?""Sure!" Scott smiled. "The people are nice, the project is pretty cool, and all in all I'm having a good time here.""Well, I'm glad to hear that, because I've discussed it with the management, and we're thinking of offering you a permanent position.""Really?" Scott's eyes shone with glee. Straight out of college, and already getting a real job, how cool is that? he thought."And how's the rewrite?" Tim asked, taking a seat next to Scott. "Can I see your work?""Okay. Today I've been working on the customers view." Scott brought up the project, ran the application, and brought up a simple table. "It's almost done. You can add a person, you can edit their data, but you can't—""Hmm, let me see." Tim took the mouse and keyboard from Scott and started testing the application. After adding a few customers and playing with all the sorts and filters on the table, he spotted one more button. "Okay, so now, I click here, and it should delete the customer, right?""Um, don't—"Scott tried to say something, but the cursor was already hovering over the red "Delete" button.Click.Now, these days, IniBank has all sorts of test environments and safeguards in place. Back in 2004, however ... to say it wasn't the case was an understatement. In fact, Scott's application was hooked directly to the production environment, running happily with database administrator permissions and ready to wreak havoc.So when he heard the mouse clicking, his stomach instantly grew as heavy as an iron ball. Because he knew which part of the code he couldn't get to compile, and which part he'd commented out just a few minutes ago ..."Uh, Scott?" Tim frowned. "Why is the grid empty?""I, I ... The WHERE clause ... I'm so sorry," Scott mumbled, his face pale as a sheet of paper, as he frantically tried to remove the filters and change the parameters. But the DELETE statement in his code did its work masterfully—and since it was only half-written, instead of removing the single customer marked for deletion, it simply wiped the whole table."You didn't ... oh God!" Tim put two and two together. "Quick, let's call some DBAs and hope there's a current backup!"Luckily, after a few moments of downtime and a bit of angry shouting, the database was restored. Tim and Scott decided to share the blame and simply forget about this little incident. In the end, Scott got his position at IniBank—and a few years later, after Tim and a few other people left for greener pastures, he became the manager of the now-booming Application Development Department. And while Scott personally made sure a situation like this could never happen again by implementing best practices and proper testing regimes, he still enjoys spooking new developers with an occasional click on the "Delete" button.[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll 👍 today.Your first 30 days are free on us. Learn more at Scout.
Best of…: Best of 2015: Byte Me
Happy New Year! Today's "best of" is the "best" code to copy file data that I've ever seen. Originally from September. --RemyThe great thing about Android is the low barrier to entry: thanks to open-source tooling, emulators, and the decision to build on a language often taught in schools, just about anyone can write a simple little app.The worst thing about Android is the low barrier to entry. Just about anyone can write a simple little app, whether they know what they're doing or not. The following code snippet is intended to take bytes from an InputStream (a common paradigm for web in Java) and save them into a file.
Best of…: Best of 2015: The A(nti)-Team
Building a good, healthy team environment is hard. In this story, they just don't bother. --RemyIn the 1980’s, there was a TV show called The A-Team. There was the scrounger, who could scam anyone out of anything. He would make promises that were sort of true to get what he wanted (sound like marketing?) There was the tough guy who could intimidate anyone into doing anything. He knew how to get things done, but underneath it all, was a nice guy. There was the leader, who could always come up with a plan to save the day. And there was the one guy who was a little crazy (the good kind of crazy), but who you could count on in a pinch. There was also the occasional outside helper who would run interference and recon. This was a group of folks who worked as a well-oiled machine to get the job done. Failure was not an option! They were a team!The A-Team never filed a project methodology document. No wonder they were wanted criminals.Alex had taken a job on a new greenfield development effort to replace an aging and unsupportable birds-nest-o-wtf™. Naturally, the position was advertised as “we intend to do things right!” The project is fully funded. We will have the proper equipment and team personnel to get this job done. We have the full support of six layers of management plus all of the users. Alex was optimistic.The first thing they did was spend several months wrapped in those numerous layers of management, end users, support folks, senior people who used to support the project (to explain the problems that plagued the old system), and the three architects of the new system. The new architecture was heavily documented, presented to and signed off on by all of the above. It was even reviewed with a critical eye by an independent third party regulatory auditing agency to ensure that the overseeing authorities were confident that the correct approach was being taken.An 8 page document detailing development coding guidelines (e.g.: code formatting settings, naming conventions, unit tests, code coverage and other such team-wide items) was created, reviewed and decreed to be followed by all who worked on the project.The project was off to a good start.Job one was to hire the development part of the team. For this, they looked (very far) offshore to find the cheapest possible talent. After all, anyone can be trained, right? A team of 11 developers who collectively had 13 years of experience, and a team leader with 5 years of experience were hired and put in place.The next major decision was which database should be used. There were three in widespread use at the company. Since all of the databases were hosted on centralized servers, one was immediately ruled out because the hardware that hosted the data servers was insufficiently powerful to handle the expected load in a reasonable time frame. Of the other two, one was widely used by everyone on the team. They knew its syntax, quirks and limits. The the third was mis-configured to have a reputation as being flaky. However, that one also was the corporate standard. In spite of the objections of the team, they used the third one.Project management decided that QA folks could be brought in later.Finally, it was time to begin doing detailed design. The offshore lead decided that a lot of time could be saved by doing design on-the-fly as required. Of course, the architects objected, but the project manager agreed to it.And so the architects started working on building the controller engine and other such mainstays of the project. The junior team, which was to query numerous remote systems for input data, merge, filter and pre-process it, decided that they knew better than what was specified in the architecture document, and started designing their own way of doing things. Without telling the architects or management.Come time for the first sprint check-in and all sorts of red flags flew up during code reviews. The junior lead decreed that the architecture document was only a suggestion that could be ignored in favor of the developers desires. Naturally, this spawned lots of are-you-f’g-kidding-me’s and emails up the chain. The project manager and above seemed disinterested, saying that the junior developers shouldn’t be doing that, but we trust them to do the right thing.This went on, with the architects pointing out implementation flaws and shortcomings that would not support the requirements. All suggestions were ignored, because the offshore lead said “Google fosters an environment of innovation and creativity; we should too!” He was reminded that Google is (in large part) a think-tank, and that this was a highly regulated project within a highly regulated industry. The architecture, which had been signed off by more than 40 managers, was not optional or a suggestion, but mandatory. This was not kindergarten, where creativity is fostered; you had to stick to the approved plan! Now, we’re not talking about how to write a subroutine, or encapsulate an object; we’re talking about using threading incorrectly and in the wrong places, doing database accesses and interprocess communication in such ways that would not be scalable, or provide enough throughput to finish daily runs by regulatory deadlines. Spawning multiple processes instead of just using threads. Using files to act as semaphores, because that’s how they did it in school. The list goes on.None of that mattered. The junior developers resented that they were not consulted on the architecture, and so were bent on ignoring it - with the blessing of their lead. The project manager continued to acknowledge the problems, but didn’t do anything about them. The problems were reported up the chain, and nothing was done. Everyone on the team should have an equal say in things.In the real world, if a student thinks the teacher is wrong, he doesn’t get to change his grade. The surgical resident cuts where the surgeon says and not the other way around. The general doesn’t discuss strategy with the privates. If you join a union, and as the new guy demand to have equal say on policy with the union bosses, you’ll be bunking with Jimmy Hoffa. Experience speaks with exclamation points. Inexperience speaks with question marks.Except on this “team”.The junior developers continued to do what they thought was best, ignoring the architects at every turn. Much of their code was written and rewritten several times over because the designs by the juniors didn’t take things into account. Things more experienced folks know to plan for. By the time 8 months had passed, so much damage had been done that some of the more complex requirements simply couldn’t be hooked in, and more than a month of back-pedaling had to be done on a greenfield development project.About this time, management acquiesced and asked some of the business users to write business-level tests (e.g.: via a spreadsheet that would be fed into JBehave to JUnit test things). The developers would provide the underlying code and some sample entries in the spreadsheets. The architects said that QA folks should be hired because business folks rarely know how to deal with edge cases, precision issues, etc. But the money was not to be spent. After six months of effort, the business users proudly decreed that all the tests for the entire application (e.g.: the entire requirements document) had been set up. A five minute glance showed that they didn’t handle edge cases, null cases, precision cases, or most of the other things that usually require tests. In fact, they had put all of the records that could possibly be processed (at least in their minds) into one giant pass-fail test. Of course, when something changed and it inevitably failed, there was no way to know what failed.Finally, it got so bad that the architects built a physical wall in the code between the setup code (written by the offshore folks) and main engine (written by the architects) sections of the application. Immediately before the main engine began to grind the data, every single variable in the system would be flushed to a state table in the database, so that when something would inevitably be challenged, they could show the inputs that were provided and send the fix-it work to the offshore team. At least this way, they could insulate the main engine from the debris.The department saved a lot of money by using cheap labor, no QA folks and the politically expedient database. Of course, all of the code of the setup portion done by the offshore team was a disaster, and for the most part, very difficult to learn, support, debug and enhance.The product hadn’t even been deployed yet, and the users were already complaining that it took too long to diagnose and fix problems (one of the main reasons the whole rewrite project was authorized), that perhaps the rewrite wasn’t satisfying the main purpose of the rewrite, and that perhaps something might be wrong…[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll 👍 today.Your first 30 days are free on us. Learn more at Scout.
Best of…: Best of 2015: Tis' the Season
We just finished the holiday season, but it's not too long ago that we were wrapped up in a different kind of season: Hunting Season As commenter RFoxmich pointed out: this might be the first 0pt. "Buck". --RemyDeep in the wooded vales of red state America, December is hallowed not just for hunting presents, but also hunting deer. Lo, the season opened on a Friday. Clayton’s consulting firm declared it Camo Day in celebration.Employees festooned themselves and their office in their brown-and-green finest. Some posted deer horns and small taxidermic animals in prominent locations. While this particular company stopped short of installing a shotgun in the kitchen, just in case a bear happened along, it was still the most redneck of wonderlands.Clayton could even swear he smelled hunting musk as he moved through the floor, trying to get back to his desk after an exhausting code review. And everywhere he looked, camouflage-print duct tape lingered like traces of scat: patching a hole in the carpet, propping up the back of a swivel chair, cradling a leaky ceiling tile …Both tape and musk led to his manager Buck’s office.“How you doin’, Clayton!” His voice boomed out from the office like a blunderbuss’ payload, halting Clayton in his tracks. “How’d that code review go?”Clayton peeked in to find Buck applying a piece of camo duct tape to a patch of ruined drywall behind his desk chair. He ignored the scene to reply, “Fine. John has some changes to make, but nothing major.”“Good, good.” Buck rubbed a fist over the newly applied tape. “Don’t mind me, I’m just taking the initiative to fix a few things around here.”Clayton debated whether to say anything. In the end, he couldn’t help himself. “Uh, all that stuff you’re fixing probably needs more than duct tape.”This prompted Buck’s ringing laugh. “If you can’t fix it with duct tape, you’re not using enough!” Finished with the wall, Buck turned, yanked his laptop out of its docking station, and began wrapping the camo-colored tape around it.Clayton really knew better, but again couldn’t help himself. “What are you doing?”“Decorating my laptop!” Buck replied.“But … you’re covering the vents,” Clayton managed around his shock. “It’s gonna overheat.”“It’s winter and it’s cold out! This thing’ll be fine.”“Win—you’re taking it outside?” Clayton faltered.“Out to my hunting blind! I’m cutting out early to get a jump on the season.” Buck reached into his pocket. Out came an obnoxiously sized lock-back knife that he used to slice a gap into the tape layer, allowing him to open up the laptop.“Why bother working remotely?” Clayton asked. “Just call it a week.”“The usual BS quarterly meeting is this afternoon—of course.” Buck rolled his eyes. “Gotta join the WebEx and at least pretend to pay attention.”The WebEx would handle both video and audio for the meeting. Clayton imagined the deer would take a dim view to budget projections, but Buck’s laptop did have a mute button.“Happy hunting, champ! I’ll have my cell phone in case you need anything.” Buck packed his laptop, then gathered his coat and a cooler that was almost certainly full of beer.“Uh, OK.”In the end, Clayton couldn’t complain about a manager-free afternoon. He returned to his desk, dug into his work, and all was well.A few hours later, his desk phone rang. Buck’s cell.Clayton internalized a curse and picked up the phone. “Hello?”There was nothing on the other end at first aside from scuffling, and a string of very not-internalized curses from Buck.“Boss?” Clayton prompted.“The damn thing’s a brick!” Buck cried.“What is?” Clayton asked.“It just shut down on me!”“Your laptop?”“And the damn meeting’s still on!” More scuffling noises from Buck’s end. “Hopefully everyone’s too busy snoozing to notice I fell off the WebEx. Hang on, I’ll be in the office soon!”Clayton didn’t bother stifling his groan, but managed to hang up before it escaped.Twenty minutes later, Buck stampeded into his cube, cooler and laptop in tow. He dropped the camouflaged computer onto Clayton’s desk, shaking out his hand. “Sumbitch shut down on me out of nowhere!”Clayton felt the waves of hot fury radiating off the laptop when he stuck his hand near it. “It overheated, like I said. You blocked the fans that keep air circulating through there,” he explained. “We gotta get this tape off.”“Nah! If it’s hot, we just gotta cool it down, right?” Buck opened up his cooler and pulled out a half-melted bag of ice. He then turned and dropped said bag directly onto the laptop.Clayton’s jaw fell. Should he bother to say anything? No, it never helped.“While it’s cooling off, I’ll need your computer to log back into the WebEx,” Buck said.Clayton suppressed his instinctive panic. “You have to leave it here. No ice or camo. I’m done for the day, and I’m not touching any more work until Monday! Deal?”“Deal.”With a collecting breath, Clayton logged out, then stood to gather his belongings. “There you go.”Buck clapped him on the shoulder. “Happy hunting, champ!”[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
Best of…: Best of 2015: Once You Eliminate the Impossible…
This article, from April had a problem, so they decided to use XML. Now they have An error occurred while parsing EntityName. Line 7, position 32. -- RemyOnce you eliminate the impossible……Whatever remains, no matter how improbable, must be XML.Developers have many weaknesses, among them this: they don’t like to say that something can’t be done. That’s why when Glenn M’s client, TelCo, asked if their request was really impossible, instead of apologizing and vigorously nodding his head, Glenn said, “Well, technically…”And that’s how he ended up writing this.
Best of…: Best of 2015: To Spite Your Face…
This article, from February had me cringing even as I reread it- and I wrote it! I've had the misfortune of working on a number of projects that failed because of people like Brandon making sure they failed. --Remy“I’ve got a gig for you,” said the recruiter.Clive, like many freelancers, weighed the contents of his bank account versus the daily rate he was promised, and decided that any gig was for him under those conditions. This one sounded mostly okay; an insurance company needed a new software package that would help them leap through some regulatory hoops. As a bonus, they wanted someone who could teach their devs the latest tools and techniques… like source control. Clive aced the interview, and started a week later. There was already an email waiting in his work inbox, from someone named Brandon. It read: “See me.”That nose won't know what hit it…Brandon lurked in his office, adhered to his mid–90s ergonomic chair like it was an appendage. He glared over his monitor and stared at Clive. “You work for me,” he said.In monosyllables and four word sentences, Brandon revealed that no one who participated in the hiring decision would have any day-to-day contact with Clive. Clive reported to him, and him alone.“Okay… well, when I was hired, they said that they wanted me to set up Subversion. Should I get started on that?” Clive asked.“No.”“May I ask why? Do you have another preference? Would you like to discuss the options?”“No.”Clive waited. Brandon didn’t expand. He simply stared at Clive. Stared, and stared.Clive slunk back to his cube and got started on looking at the code base. It currently lived in a file share, using the “file.pl.old”, “file.pl.old.old” versioning convention. The code was Perl, and unreadable by even Perl standards. It had grown in a culture here “parsable means runnable”, included no comments, and had absolutely no tests. Clive’s only ally was Lee, another head-hunted expert who also reported directly to Brandon, and had a two week head start on understanding the code. When Clive got stuck, he poked his head around the cube wall and asked Lee.Like a glacier grinding down a mountain, Clive slowly worked his way through the code. After about a week, he was developing a small degree of confidence. Then an email from Brandon arrived: “See me.”“You’re disrupting the dev team,” he said.“What?”“You and Lee are making too much noise. This is an office, not a social club.”“That’s crazy. I’m just asking him questions about the work we’re doing! What, do you want us to schedule a conference room just to ask questions?”“Yes.”Brandon stopped talking and resumed his staring contest. He stared, and stared… Clive got the point and scurried back to his cube.The requirements were complex and evolving, which wasn’t unusual. Only one user, Carole, actually knew what they were, which also wasn’t unusual. Clive sent her an email with a handful of questions, and tried to get some work done. He waited for a few days for her reply, and as he found new questions, he sent more emails.In a week, he had sent nearly half a dozen, but got no reply. He sent more, asking for status updates. Over this time, he had more questions. He tried calling her, but it dumped to a full voicemail box. He tried scheduling a meeting, but Carole never accepted.And then an email from Brandon arrived: “See me.”“Carole says you’re harassing her,” Brandon said.“What?”“You send her emails, even after she answers your questions. She said you called a meeting but didn’t show up for it. This needs to stop.”“That’s crazy. She never replied, and I can show you my inbox to prove it.”“Carole doesn’t use email,” Brandon explained. “An intern prints out her emails, and she replies via inter-office mail. She’s very busy. You have the requirements document. Implement it, and stop bothering her.”“What, you want us to implement a solution without ever talking to the business user who knows the requirements?”Brandon stared at him. And stared. And…With Lee’s help, Clive made some real progress over the next few months. They learned their way around the absurd date format (measured as the number of days since April 3rd, 1974, except when it was measured in the number of months since the preceding Monday, except when it was measured in the number of weeks since the following Sunday). They worked past the fact that no one was allowed to upgrade past Firefox 3, or the fact that they couldn’t run overnight jobs because all of the servers were turned off at 6PM sharp. Carole didn’t communicate, Brandon just stared at them, and the rest of their co-workers treated them like plague carriers.A few weeks before their six month stint expired, Clive was digging through the company network drive, searching for a spreadsheet containing sample data. He found one named after the recruiting company that placed him, and hoped that it was something useful. It was, after a fashion.The spreadsheet was a report illustrating exactly how much the recruiting company was getting paid to provide Clive and Lee. The fees were so abusive a used car salesman would have blushed. Change tracking and collaboration was enabled on the document, which meant Clive could read comments made by various users.From the senior management level, there were comments like, “It doesn’t matter how expensive it is.” Accounting warned, “We won’t have the money to pay annual bonuses, if we do this!”Brandon had left his own note: “Our business is too special. They will fail. This is a waste of money. They will fail.”The pieces clicked into place. Brandon hadn’t been making a prediction; he was making a promise. And he’d kept it- there was no way that Clive and Lee could deliver what was originally promised in the next few weeks.Then an email from their recruiter arrived. “That company still wants added staff. Do you want to re-up for another six months?”Having learned from Brandon, Clive sent a one-word reply: “No.”[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!
Coded Smorgasbord: Classic WTF: Holiday Smorgasbord
Your Christmas present this year is a pile of WTFs from back in 2005. A veritable holiday smorgasbord. This post wouldn't be here if it didn't exist. --RemyIt's been a while since I've done a smorgasbord post, so here goes ...DM discovered the source of some rather ... unprofessional ... error messages in the log files ...
The PM Who Stole Christmas
It’s Christmas Eve, and that means we’re taking a little break from writing new articles. Starting next week, we’ll re-run all of the best articles of this year.For today, though, while I was working on The Glitch Who Stole Christmas, I got a bit inspired, and maybe a bit carried away.
The Glitch Who Stole Christmas
CodeSOD: The Apple Genius
Apple refers to their in-store technicians as “geniuses”. Everyone on Earth knows that it’s nothing more than cute marketing and is a meaningless title.Well, almost everyone. Derick worked for a company where the CIO worked at Apple’s HQ at some point. Said CIO was quite proud of this achievement, and made sure everyone knew it. He wasn’t happy that his new startup had decided to use C#, but it was okay: he was ready to reinvent core pieces of the .NET framework to avoid having to deal with whatever bombs Microsoft had snuck in.And he was going to optimize it.
The Machine
I shouldn't have taken that call, I thought, looking down the dark, endless staircase.But deep down, I knew there was no other choice. Running a computer repair shop in a town like Derry meant one thing: if you want to put food on the table and pay the bills, you can't afford to lose a client. No, not in this day and age, not in a market filled to the brim with geeky teenagers offering cut-throat prices. You snatch up every opportunity and suck it dry before it worms out of your hands.Besides, it was supposed to be an easy job. Just an animal shelter on the outskirts of the town with a computer—"The Machine", as the monotone voice over the phone had called it—that wouldn't turn on.Plug it back into the wall socket, pocket the cash, and head home, I'd thought, driving a muddy dirt road out of town and into a dark, foggy marsh. Easy money.But now, staring down the abyss leading to the shelter's basement, listening to the distant howl of hundreds of stray dogs, breathing the stale air filled with a faint tinge of decay ... suddenly, it didn't look that simple."Take care." Behind me, the shelter's owner—an old, weary man stuck managing a building in equally bad repair— watched me from a distance. There was something off about him, about the way he looked at the door, how his face twitched slightly every time I mentioned the computer.It's probably nothing, just the quirks of old age, I kept thinking, but the suspicion in the back of my mind refused to die down."I will," I told him, then closed the door behind me.The bare old bulb at the end of the stairwell didn't provide much light to see by. I put my hand on the unpainted wall and slowly set my foot on the concrete step below, trying to keep balance while my eyes adjusted to the dimness. Step by step, I slowly headed down, the air growing thicker and heavier around me, the noxious smell intensifying, making me sick to my stomach ... but I held on, some nagging feeling driving me further and further into the unknown.Finally, I reached solid floor and looked around the room. It was tight, quiet, and almost empty—very much unlike the rest of the shelter, as if it didn't belong to the building.And it was there, atop a light wooden table against the grey, bare wall, plugged into the sole wall socket in the room.The Machine.It was an apt name for that piece of hardware. The solid, unbranded beige tower standing next to a bulky CRT monitor and a Model M keyboard radiated an aura of nostalgic grandeur. I stepped towards the table and ran my finger across it, collecting a thick layer of dust. But the computer itself looked almost brand new, its case shining even under the weak light of the room.It must've been here for at least twenty years, I thought. Why would anyone still use such an antique? I flicked the switch on the front.The computer roared.I've heard a lot of noises coming from a computer, but never anything like that. It was the howl of a hurt, suffering animal, a scream of agony. I stepped back instinctively, but the sound persisted, filling the air with a maddening wail that I was sure could be heard throughout the whole shelter. A moment later, the monitor lit up.OPERATING SYSTEM NOT FOUNDI turned the poor PC off, and the noise stopped. I reached for a screwdriver in my pocket, but then I noticed a floppy drive next to the switch. I pushed the eject button, and a disk slipped out of the slot. I pulled it off and held it to the light: a red, unlabelled 3.5 inch floppy, just like any other. Hoping that would solve the problem, I set it aside and tried booting the PC again.The howl was even louder and angrier than before, and the same words showed on the screen before I put the computer out of its misery.So, you won't find the OS. Let's see your hard drive, then.I unplugged all the cables from the back and put the case on the floor. Slowly, I took out all the screws, and dismounted the side panel.THUMP!The mangled body of a black rat fell out of the chassis, filling the room with the rotten stench of death.I froze. I tried to scream, run, do anything at all, but I couldn't, as if something were holding me in place. I looked at the rodent—its fur marked with deep, bloody wounds, its eyes wide open with a piercing stare—and a million thoughts rushed through my mind. How did it even get there? How did it end up like this? It's as if ...As if The Machine chewed on it, a quiet voice whispered in the back of my head. Chewed on it, then spat it out like a bad dinner.Holding back a retch, I tossed the rat away and examined the computer's insides. There was no hard drive, not even a place for it, but I noticed the floppy connector dangling in front of the motherboard, probably pulled out by the poor creature struggling for its life. I plugged it back in, reassembled the case, and hooked it to the rest of the setup.Finally, I slipped the disk back into the drive, and, heart pounding, I pressed the power switch again. A fan spun up quietly, the floppy drive started buzzing ...... and finally, the DOS prompt showed up.I ran. I ran up the stairs, leaving The Machine behind me, rushing to get as far away from this place as possible. I kicked the door open and burst into the blinding light of the main shelter hall, panicked, breathing heavily and nearly falling to my knees. I looked around, squinting under the painful brightness.No one was there. Even the dogs had fallen silent. A brown paper envelope rested on a nearby desk, labeled FOR FIXING THE MACHINE in bold, black letters.A thought formed in my brain: How did they know I fixed it? And then another one: Would I be here if I hadn't?I opened the envelope with shaking hands and reached inside. A thick wad of cash in tens and twenties, almost five hundred dollars wrapped together.They could've bought a new computer with this kind of money, I thought, but something told me they would never do that.I stuffed the bills back in the envelope and prepared to leave, but as I ran my fingers over the brown paper, I felt something stiff inside. Curious, I pulled it out.A red, unlabelled, 3.5 inch floppy, just like any other.[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!
Error'd: Exactly What I was Looking For
Adrian K. wrote, "Why yes, Apple Developer Forum, that is EXACTLY what I meant!"
Representative Line: The Returned Value
Wilson Silva was looking through some production code, and found this representative line. This particular block of Ruby code was written by someone who claimed to have “lots of programming experience”. One must wonder what that experience was.
The Excel Expert
Ishai bore the unenviable, oft-cursed title of Microsoft Support Engineer. Just about every user who ended up in his call queue was peeved from the start, having navigated half a dozen phone menu options and being stuck on hold for interminable wait times. It didn’t make for a productive support experience.There was nothing Ishai could do about it. After years in the trenches, he was used to it; customer ire was like his own personal cosmic background radiation. But no matter how many times one thinks he’s seen everything, the universe always has something more to reveal to him.His desk phone rang for the umpteenth time that day. “Tier three support, this is Ishai. How may I help you today?”Instead of the mix of frustration and relief most people had upon reaching a human, this caller started off … haughty.“I am Professor Benson. Got that? Professor Benson, not ‘Mr. Benson’ or ‘Sir’ or anything else you decide to call me. I’m a Computer Science professor at BigName University, and I’ve found a bug in the latest version of Excel.”Get in line, Ishai thought. Happily, he was free to roll his eyes without risk. “Can you explain the problem, si—uh, Professor?”“I’m performing a complex calculation.” Professor Benson rattled off the name of an obscure formula that took several variables as input, a formula Ishai had little familiarity with. “The results Excel gives back are wrong. I have no trouble working the calculation by hand, and when I do, I get the expected result.”“I see,” Ishai said. “I’ll need some time to look into this. Can you provide your callback number? I’ll get back to you with a progress update within the next week.”“The next week?” Professor Benson sniffed. “All right. I suppose I have no choice.”Ishai obtained his contact information and gratefully ended the call, but his relief was not to last. The formula turned out to be extremely complex. He needed almost the full week just to figure out what it was supposed to do. Finally, he amassed enough understanding to attempt a few calculations by hand.To his complete lack of surprise, he found his calculations matched Excel’s results every time.“I’m sorry, Professor Benson,” Ishai spoke over the phone a short while later. “It looks like everything’s working as expected.”“Well, yes,” Professor Benson replied. “In the simplistic cases you no doubt tested with, it works fine. But in more complex scenarios, it doesn’t.”Ishai frowned. “Maybe you could send me a representative sample to test with?”“Well, all right,” the professor huffed. “If you think you can handle it.”“I’ll give it my very best shot,” Ishai half-growled back.Ishai received a sample workbook from Professor Benson a short while later. Upon opening it, he had to bite back a sob. The calculations were hard enough with integers. Here, the good professor was using exponents and other values out to 7 decimals. The sort of thing that was next to impossible to calculate by hand.It took another long week of struggling, but Ishai finally completed the calculations. To his shock, Professor Benson was right. Excel was giving the wrong answer—or so it seemed at first. Since part of the formula involved raising variables to the power of other variables, every single digit counted. The professor had configured his workbook to only have 2-decimal digit precision—thus, numbers like 2.0103235 were being truncated down to 2.01 before any mathematical operations were performed. Once Ishai changed the decimal precision to 10, Excel began providing the correct answer.Relieved, and not without some measure of evil glee, he called Professor Benson and explained the issue.Instead of the slightest bit of gratitude, Professor Benson’s tone of voice froze over. “And I assume you believe this is fixed now?”“Well, nothing’s actually broken,” Ishai explained. “Excel’s behaving correctly. You just—”“’I just’ nothing!” the professor cried. “If I didn’t know about changing the precision, how can you expect anyone else to? Your implementation of the formula is flawed! I should be getting a refund from you people, or at least a medal!”“I’m sorry, but there’s no bug here,” Ishai pleaded.After another 30 minutes of unproductive bickering, Ishai finally got Professor Benson off the phone—but not before Benson had threatened to complain to his manager, his manager’s manager, all the way up to Bill Gates if he had to.Ishai slumped over his desk, nursing his temple. “Man, I gotta become a developer,” he muttered. “I bet they don’t deal with crap like this.”[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!
CodeSOD: Leaving an Honest Comment
Apo’s workplace just recently migrated their code into source control. They have eight years of code that’s been written and maintained by developers using a network share as their central repository.
Tales from the Interview: Secure Portfolio
"Heeey, Sean ..." Aisha's tone was cloying as she poked her head around the divider of Sean's cube, still seated on her desk chair."No," he joked, looking up from his work.She laughed, weakly. "Listen, John's sick, probably out the whole week. Can you interview this new dev candidate?"Glancing at his calendar, Sean sighed. "Sure. When will he be here?""An hour from now. Here's his code sample, good luck!" She thrust some papers into his hand and rolled away, leaving Sean dumbfounded.Great, he thought. What am I in for?Figuring he'd at least familiarize himself with the sample, toss the guy the usual softball questions, and get a feel for him, Sean flipped through the stack of printouts. Oddly enough, along with his PHP code, the candidate had submitted a SQL dump."Thoughtful of him," Sean murmured. "Weird, though ... this test data looks very real."Then he flipped over the page and found the CREATE TABLE for the USERS table. What followed were a hundred insert rows, all with passwords like "==AUWZEdZhlTT1UMaVXTWJVU"."Is that ... Base 64, reversed?" Sean wondered, flipping to the PHP code in horror. Sure enough, he found the following in "Security.php":
Error'd: Flipping Burgers at Google
"For some, Google interview questions are getting more obscure," writes Ernie, "but for those of us who worked for years in fast food, all that toiling might pay off."
Awk-ward Error Checking
Emma W. was hired on by BerkTech’s QA department in preparation for a major code rewrite. A Russian company had purchased a thousand copies of BerkTech’s emponymous software package, but as it only supported English, it would require a substantial localization project to support Russian.After Emma started, it didn’t take long for her to notice some common patterns in her unit tests.“Why is the script scrubber.awk telling me a file is missing a semicolon?” she asked Danny, her supervisor. “Shouldn’t this error come from the compiler?”“No, we scrub everything before it gets to the compiler,” Danny explained. “Nothing ever reaches it without passing our best practices. That’s what scrubber.awk is for.”Curious as to what kind of pre-processing that file was performing, Emma cajoled a developer into letting her take a peek at the source code. There wasn’t just one .awk script pre-processing the C++ code.There were 107.If All You Have Is A Hammer…“Danny,” Emma asked over lunch one day, “don’t you think we rely too much on AWK for our build process?”“AWK is our build process,” he replied. “It’s like mortar, joining our bricks of C++ code. At least that’s how Rupert describes it.” Rupert was the chief code architect, and the one who first wrote BerkTech’s code decades ago.“But you don’t need AWK scripts for almost anything. Compilers can give you much more nuanced syntax errors and lexical analysis than ad-hoc scripts can.”“Yeah, but it’s Rupert’s baby. Rupert wrote the app in AWK first, using a branch of one of the old Unix-based interpreters. Later he rewrote parts of it in C++ for better performance. He’s never wanted to let go of AWK. He won’t even run the compiler from the command line. When I say everything has to be done through AWK, I mean everything.”Time CapsuleSoon after, Emma met Rupert for the first time. His office was a perfectly preserved time capsule from 1983. Books older than Emma sat on a shelf, arranged by subject, and surprisingly dust-free. Rupert seemed like he had been preserved in the time capsule, too, with a tight collared polo and polyester slacks.“Danny sent me,” Emma said. “We’ve noticed a lot of multi-byte encoding issues come up lately.”“Multi-byte?” Rupert said. “Our developers should just use regular ASCII.”“But that won’t work for localization. Our Russian translators give us our localization files in Unicode, which uses multi-byte characters for the Cyrillic alphabet. The problem is our version of AWK. It wasn’t designed for multi-byte encodings.”“AWK can handle Unicode,” Rupert said, dismissing Emma with a wave. “It can handle anything.”MutinySoon, development stalled on the localization project because of the multi-byte encoding issue, and deadlines were missed. With the top brass breathing down his neck, Rupert called an all-staff meeting at a fast food joint down the street to discuss the issue.“I know what you’re thinking,” Rupert started, “But we’re not ditching AWK.”Danny spoke first. “There’s no other way,” he said. “There are dozens, hundreds of scripting tools we can use. We can just hand off the localized strings to another tool, and AWK won’t even have to touch it.”“Not going to happen.” Rupert crossed his arms.“The installation process is taking too long!” someone else added. “We have to install our own version of AWK on every computer the application runs on!”“AWK is not a resource hog,” Rupert said, adamant. “It’s no big deal.”The complaints raged for an hour. Finally, Rupert said, “This is a waste of time. We’re not ditching AWK, and we’re not bringing in another toolset. I’ll fix the encoding issue myself.”…Everything Looks Like A NailRupert’s localization code arrived so late, Emma was forced to work nights unit-testing all the new code. By and large, everything worked as Rupert had promised. The project shipped, and soon a thousand PCs in a corporate office in Moscow had Rupert’s obscure version of AWK installed on them.Danny was uneasy, as he told Emma over lunch following the release. “You know those obfusgation coding contests? I tried looking at Rupert’s localization code. It’s more impenetrable than the samples I’ve seen for those contests. If you find anything wrong, he’s the only one who can fix it.”Emma remembered Rupert’s perfectly-preserved office. “If he can keep his code as clean as his office, maybe all of his AWK scripts will keep working for another ten years.”[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!
CodeSOD: Collated Performance
Eliza had a co-worker who had a problem. There were users with names like “René”. Other users, using standard keyboards, wanted to search for “René”, but couldn’t be bothered to figure out how to type that accent, so they just searched for “Rene”.The co-worker came up with this solution:
Announcements: Puppet Labs Sponsors 2016 and Launches a New Tool!
Here at TDWTF, we’re happy to announce that Puppet Labs have renewed their sponsorship of TDWTF.DevOps and infrastructure automation are at that critical cusp, where everyone’s talking about the buzzword, and everyone knows that it’s important, but most people don’t know exactly what it means to “do DevOps”. The tools we use to build infrastructure and deploy applications are changing fast, and the complexity is increasing: and complexity means more opportunities for WTFs.
Safe-ty First
Connor was a Highly-Paid Consultant who dealt with data security and audits, making sure companies’ secrets were irretrievable by enemies, competitors, and unauthorized employees alike.He got an assignment to work with GrocerSoft, a mid-sized company which developed software mostly used by small, independent grocery stores across the nation. They’d just picked up a new client, a chain of medium-sized grocery stores with a paranoid board of directors who imagined all sorts of competitors trying to steal their Top Secret grocery inventory suppliers. As part of the new agreement, GrocerSoft’s sales team had promised annual security audits of GrocerSoft’s data.Connor arrived on-location at the GrocerSoft National Headquarters in Des Moines, Iowa one snowy winter afternoon. The doors were unlocked and no one was there to greet him. Being a security auditor, he decided to wander around for a bit. After a half hour, someone finally asked him if he was lost, and directed him to his contact’s office.His contact was a middle-aged man named Toby who worked as the CTO of GrocerSoft. Toby had worked there for decades, since well before GrocerSoft got big, and had never had another job in his life. He was also, as Connor would discover, quite clueless for someone with the title of Chief Technology Officer.Toby liked to talk. A lot. About everything. Toby took him on a grand tour of the office, showing him every irrelevant nook and cranny. “This, you see”, Toby would say while pointing, “was our first vending machine. We got our first $100K contract in 1982 and got this installed to celebrate. You know you’ve finally made it big when Pepsi brings pop to you.” He laughed loudly as if that was the funniest joke he’d ever made in his life. “It doesn’t work anymore, of course, but we keep it around as a reminder. Sometimes the new guys will try and put quarters in there!” Then Toby leaned in and conspiratorially wrapped an arm around Connor’s shoulder. “We tell ’em that helps keep the bottom line up!”Connor silently rolled his eyes and suffered through the tour as Toby continued on and on, showing him the Sacred Coffee-Stained Office Chair of Conference Room 4 that some Hollywood technical consultant had spilled his coffee on while gathering information for a grocery store shootout in a blockbuster action film. Next was the Donut Box of Miracles which had been left in the founder’s office and discovered fourteen years after his death, then plastic-wrapped and put on display for all to see. Not to mention the Plush Doll of Excellence, a stuffed alien awarded by a client in 1997 after GrocerSoft completed a trainwreck 14-month-long website development for them.Eventually they got to business. “Okay, Connor, like we told you earlier our new client, who we can’t name because of their NDA, needs to know our backups of their data are safe.” Toby lead him to the corner of an unused office and showed him a fireproof safe. “All the datatapes are in that safe. It can only be opened by a web page that only works from my computer. It’s locked down by the IT address and MAP port. And,” he pointed his finger up in a Eureka gesture, “it only works in Inter-Network Explorer, too! They say no one uses that anymore and all the hackers use Google Crohns, so that’s blocked. Real, real secure.” He leaned in and winked. “They built these specifically for the NSA to hold all the battle plans for capturing Saddam Bin Laden. Totally unbreakable! Anyways, I gotta go, going to Hawaii with the wife for the week and the plane leaves in a couple hours. Have fun trying to crack that safe!”And with a wink and a laugh, Toby stormed out, leaving Connor to do his audit.Connor returned the next morning to begin his audit. A visual examination of the safe showed no physical way for him to get in without destroying it, so he noted the make and model and set up for some Internet research. It was a DigiSafe 9000, a LAN-connected fireproof safe with a built-in web server on port 4567 that could be controlled by any PC or smartphone.Connor nmap’d the network and poked the only host with an open port 4567, but was greeted with a security error page. “Your system is not authorized to access this device! A report has been filed and may be used by the owners of this device to press charges!”He chuckled lightly and decided to visit Toby’s office next, to see if he could find a MAC and IP address to spoof on his laptop.He walked into Toby’s office, a spacious corner office on the top floor of the five-story building. It was open and the receptionist didn’t even look up as he waltzed into the CTO’s office.He sat down at the desk. It was piled high with paperwork, folders, and notebooks. The darkened monitor was plastered with dozens of sticky notes.He noticed the small workstation was on and pressed the spacebar. The screen instantly lit up and he was greeted by an unlocked Windows session! Connor grunted in disgust. At least a couple dozen applications were already open, including Internet Explorer, which he guessed was Toby’s previously-mentioned “Inter-Network Explorer.”Probably fifty tabs were open. He started clicking through them, and, not surprisingly, found the DigiSafe 9000 login page was there. It had a simple login prompt with a note that the default password was “00000000” and should be changed after the first login for security reasons.Connor eyed all the sticky notes. He saw private email passwords, shopping lists from 2011, phone numbers for women with names like Candy and Bunny, and a reminder to buy tickets for Attack of the Clones ahead of time.And one labeled “New Client Safe: 00000000”He punched in eight zeros to the login prompt and hit enter. After churning for several seconds, it showed him a simple control page with no styling. He clicked “Unlock” and after several more seconds the site showed an alert box stating “The DigiSafe 9000 has been unlocked and opened. It will re-lock when you close the door.”“Ugh,” he groaned as he sat up from the chair and headed down to the empty office with the safe. Sure enough, the safe door was wide open and inside sat a pile of writeable DVDs and several USB hard drives.Weeks later, Toby called up Connor’s employer to complain about the audit results. He seemed to think Connor’s methods were unfair because real hackers don’t read passwords from people’s notes! Toby didn’t care though. His employer got paid, he got paid, and GrocerSoft’s new client decided to store their Top Secret Supplier List with another vendor.[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
CodeSOD: Elliptical Curveball
Why is it that you hear people saying, “don’t roll your own crypto”? It can’t be that bad, right? I mean, if the code gives the correct outputs when given the correct inputs?Everything in cryptography depends upon “high quality” random numbers, and lots of them. People get into semi-informed flamewars about what “entropy” means, government agencies sneak backdoors into algorithms, performance matters, secrecy matters, and unpredictability matters. The standard which defines four randomness generators is NIST Special Publication 800–90. One of the four raised suspicions because it (Dual_EC_DRBG) was three times slower than any of the others.Joe… well, Joe sends us his own code, which “fixed” this. He made one of the others slower. Using MySQL stored procedures. Just bear in mind, with the below, that it’s still cleaner, more comprehensible, and generally saner than OpenSSL.
Error'd: Online Shopping Magic
"Wow! Every time I tapped 'See more products', the number more than doubled," writes Stephanie F.
CodeSOD: Hang On…
Once upon a time, there was a small logistics company that did most of their software development in house. In the early 2000s, they decided to get ahead of the curve, and started building software to work on mobile devices. At the time, it was risky and uncertain, but over the next few decades, the idea of using commodity mobile phones to run their warehouse management software saved the company piles of money.They grew so big that they cut the company into two parts- Inilogic, the big giant logistics company, and Initech, which made their mobile phone software. In the split, some developers went to Initech, while a few- like Mr. A- stayed with Inilogic.Mr. A happened to be sitting in on a presentation where reps from Initech were showing off their cutting edge new feature: now users would be able to actually place calls from inside the application. Unfortunately, the demo didn’t work. While the developers scrambled to figure out why, he saw this bit of code flash on the projector:
A Cable Outage
New Year's Eve is a wonderful day. Not only a time of rejoicing—meeting and partying with friends and strangers alike to celebrate making it through yet another year—but also a time of change. Between new resolutions and yesteryear's memoirs, it's the best moment to move our lives in a different, exciting, and surprising direction.For Mitch, however, that was not the case. Working for a cable TV company had taught him that when your superior called in the early evening on your day off, it meant one thing and one thing only."Hi, Boss," he sighed. "How bad is it?""Bad." The boss didn't sound too excited himself. "HBO and Showtime are down. People will want our heads on pikes if we don't bring them back up ASAP. So, I know I shouldn't be bothering you, but I've tried everyone and—""No, it's okay," Mitch said. "Just give me twenty minutes to get to the office. I think I know what the problem is, it shouldn't take long.""You're a lifesaver," the boss said with relief. "We'll talk about compensation when you're back. See you, and good luck."Mitch left the house and started his car in surprisingly high spirits. The receivers at the office had their bad moods. All he needed to do was flick a reset switch, and the channels would be broadcasting again. Given holiday overtime was six times his normal hourly salary, he felt like he'd gotten the better end of the deal.Two hours later found Mitch kicking himself for his optimism.He'd tried resetting the receivers. He'd tried replacing them with spares. He'd checked and rechecked all the cables and connections, went through the whole troubleshooting list twice—all for naught. Not only were the two premium channels still not broadcasting, but along the way, another three channels had gone down, one by one.Think, Mitch, think! he urged himself. Huddled in front of a laptop, he tried to connect to one of the failing devices over the local network, but it was just as unmoved by his pings as by his pleas. There was nothing visibly wrong with the network configuration, and other devices plugged into the same ports worked just fine, but the dead receivers stubbornly refused to work no matter what tricks he used.Mitch had no choice but to move to the next step in the troubleshooting protocol. With trembling hands, he dialed the device vendor's helpdesk number."Thank you for calling Initrode Systems, my name is Nathaniel. How can I help you?"A New Year's miracle! The monotone voice on the other side filled Mitch with hope. He'd never expected to connect to a living soul so quickly, on a holiday at that."Hello, my name is Mitch. I'm having a problem with my equipment ..." He explained his troubles in detail, noting every symptom he'd witnessed."I see," Nathaniel said. "Have you tried turning the device off and on again?"The lengthy conversation left Mitch no wiser. He went through the motions, only to hear that "the only suggestion" Initrode Systems had for him was to replace his router. Mitch couldn't fathom how a router would have anything to do with not being able to connect to devices on the same network. Nevertheless, he grumbled a thank-you to Nathaniel and hung up.One thing he'd noticed during the troubleshooting gauntlet was that right after turning on, the devices would work for a few seconds, and only then suddenly drop dead. That gave him a glimmer of an idea. He dug out a dusty Ethernet hub, switched up a few cables, and started capturing packets from the whole network, trying to find a pattern.As burst upon burst of network traffic appeared on Mitch's monitor, he finally started smiling. There was a pattern to this madness. He picked up the phone and called Paul, his colleague from IT."Mitch! Hey there, buddy, what's up? Celebrating the New Year already?""No way, how could I start without you?" Mitch joked. "Listen, Paul, sorry for the interruption, but I have a bit of a situation here at work. Think you could spare a few minutes?""Oh. I thought you were on vacation?""I was.""Well, shoot," Paul said. "I'll do my best."Mitch recapped the outage situation, then segued into his latest findings. "A few seconds after booting, some of our receivers try to send an SNMP trap to some IP, then the ICMP Destination Unreachable message pipes in and they just die. They don't work, they don't respond to pings, they don't generate any traffic.""Huh." Paul muttered something under his breath. "That's an odd response, but it's not wrong. Maybe there's a bug in the firmware? Have you called the vendor?"Mitch suppressed a flare of anger. "They've been as helpful as you'd expect.""Of course. And to think we're paying for that support ... Anyway, what was that IP?" Paul asked.After dictating the address, Mitch heard faint typing for a few seconds. Finally, Paul picked up again."Well, I don't think I can help you. The IP is for a router at our other office. I can't remote in there, and you probably won't be able to get in today either."Mitch sighed, at the end of his rope. There's one more thing I can try, he thought. "But you can remote to the router in here, right?""I can," Paul said."Can you add that IP as its secondary interface? Maybe it will play nicer with the trap?""That ..." Paul paused for a while. "Hey, that might actually work. Let me try."After a few minutes, Paul told Mitch to try resetting the receivers again. He flicked the switch and went back to his laptop, crossing his fingers.There's the trap ... there's the response ..."Bingo!" he exclaimed as the packets started to flow again and the receiver showed up as operational."Woo-hoo, we saved the New Year!" Paul cried, jubilant."It seems so, everything looks OK here. Thanks a lot, man.""Not a problem. Now hurry up and get out of there, you can still catch the ball drop on TV!""If I don't get drunk before then. See you next year!"Mitch hung up and started packing his things. Looking through the window at the first fireworks set off by impatient celebrators, he knew what his first New Year's resolution would be: Never underestimate any problem.[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!
CodeSOD: Databases Done Fresh
Nobody knew how Carl kept his job. Some said he was the boss' boss' nephew, or perhaps knew some dirt on the CEO. Some said he had been threatened with termination before, but his lawyer had advised the company it was cheaper to keep him than to get rid of him. Whatever the case, Carl's eccentricities were legendary.Seeing Carl's footprints on the SVN logs for his project, Paul decided to brave the trip to his cubicle for an explanation of some rationale that eluded his understanding.Carl's cube was in a back corner, almost forgotten, half-hidden behind the coffee station—just as Carl liked it. He'd built a top to his cube out of cardboard, to keep the area dark despite the flourescant lights. Tinfoil was wrapped around the signs, to counter the "EF rays" that set off his "electrosensitivity." The air smelled faintly of roses and cough drops.As Paul knocked, Carl turned, taking off a large pair of noise-cancelling headphones before removing the earbuds nestled underneath. "What brings you to my abode?" he asked, with a wide grin that probably was meant to be casual but instead came off as just a little manic."I had some questions about your commit, ah, revision 512?"Paul tried to keep his tone light, but a shadow passed over Carl's face, and his fingers began to twist against each other, fidgeting."Ah, yes. Five twelve. Five hundred and twelve. Five hundred and ten and two. A bad number, very bad."Paul blinked. "... Right. It's just, I don't understand what you were trying to do here?" Tentatively, he held out the printout for Carl to see:
Classic WTF: Who Needs Connectivity? I Have Service!
Representative Line: Be Thankful for Good Requirements
In the US, today’s the Thanksgiving holiday. As I learned from A Charlie Brown Thanksgiving, it’s supposed to be about friendship, family, and being grateful for what you have. In common practice, it’s more about gorging yourself.While I was perusing our inbox, I saw that Matthew sent me a “flow chart” that represented a set of requirements from his sales team. Immediately upon opening it, I said, “Thank goodness I don’t have to work on this.”So, today, whether you celebrate the orgy of American excess or not, celebrate this fact. You’ve never been handed a requirements document this bad. I hope.[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!
CodeSOD: Mid-Stream Switch
Submitter James writes: "I'm working on a project that has as one of its components a Microsoft App for Excel 2013. My team lead wrote most of the app up to this point, and I'm adding features. While exploring her code, I ran into this little gem (in JavaScript):"
The Guru and The Code
A logistics company isn’t the kind of company that invests heavily in IT, no matter how vital IT is for their business. That’s why Rich spent several years as the only developer. Most of his code was built to pick up data from one siloed turn-key system and dump it into a different one, or to integrate two in-house developed applications. On a bad day, he had to touch up the VBA macros in home-grown Excel spreadsheet someone in accounting had hacked together and had suddenly become “business critical”.
CodeSOD: Confession: The Coin-Flip Hash
There are certain problems in computing that you generally shouldn’t tackle unless you’re planning to make it your life’s work. Don’t write your own date handling logic. Don’t write your own encryption. If you do, you’ll probably screw it up, so use something developed by someone who knows what they are doing. Handling passwords is a subset of encryption, in many ways. Samuel sends this to us as a confession- he hopes to unburden himself of his sins. It’s bad enough that he’s passing passwords in the clear, but he goes a step farther:
Error'd: End User Experience May Vary by Region
"I guess eight of the ports are English-only," Andrew G. wrote.
CodeSOD: The Cleaner
In software development, there are people who get the unenviable task of being the cleaner. Somebody makes a mess, and the cleaner comes in to take care of it. And that brings us to Tina.Tina was brought in as a cleaner. There was an application that was a mess, and the powers-that-be wanted it taken care of. Tina took a look, and she noticed that there were a lot of round trips to the database. In fact, after profiling, it almost looked like every query ran at least twice. She saw code following this pattern everywhere:
The Enterprise Axe
CodeSOD: A Hardware Switch
Michele S. had recently worked on code for an engine-controlled device. Since the device had physically-moving parts operated by servos, the software had to be careful to not move anything out of bounds because it could actually break a physical piece of equipment.Michele had written the low-level function which sets the position of a component.
Quality Overhaul
"Hey, did you see the email? They're remaking our website!""No way, Dave. You're kidding." Cody rushed to his PC and opened the latest company newsletter. After three years of working at IniVenture, he found the news hard to believe. Despite many pleas from the employees, management had never dared to touch that relic of late 90s web design, opting to spend their time and money on more lucrative ventures instead."'Over the next few months,'" he read aloud with Dave peeking over his shoulder, "'we'll be cooperating with Victory Design, an award-winning web design and development agency, to bring IniVenture even closer to the world of Internet and modern technology.'""As if we were anywhere close to that now," Dave groaned, then took to hunting the usual bull. "Let's see: 'latest technologies,' 'brand synergy,' 'your feedback matters,' blah blah blah ... " He smirked. "Well, I don't know about you, but I can't wait to see the revamp. It's going to be a beautiful disaster."Months passed without any news about the new website. Some employees sent their suggestions and offered help, only to be met with a standardized response and no follow-up. The newsletter didn't offer many updates either, other than the occasional reassurance that the project was "right on track" and would be completed "shortly." Reading between the lines, it seemed the revamp had either been shoved aside or canned.Until one day, Cody ended up paying a visit to the IT department."Hi, Jen," he greeted the mousy girl tapping at the keyboard. "Can you hook me up with a clean laptop? We have a new guy starting in a few days.""Uh, yeah, sure, but it'll have to wait a while," she said, not lifting her eyes from the monitor. "I'm just deploying the new website, so ...""Oh, it's done already?" Cody asked, surprised. "Is it any good?""I ... don't know, really," Jen answered. "I didn't even have time to look at it. The moment the PM got the first version from the designers, she forwarded it to me and told me to put it on a public server immediately.""Wait, seriously?" Cody's eyes went wide. "Aren't you guys going to, um, test it or anything?""I tried to explain, and the other company did too, but ... well, let's just say I got my orders." Jen shrugged and went back to hacking at the keyboard."Well, good luck then."Cody sneaked out of the room and went back to his desk. Wow, what a mess, he thought. It's probably going to be down for at least a week, maybe more.But he turned out to be wrong. Just an hour later, his browser opened to the new, sleek, and remodelled IniVenture home page.Except the more he dug into it, the more problems he found. Some links lead to 404 pages, others went into infinite redirect loops. A few images and captions were missing. And to top it off, most projects and clients were just test data left over by the developers, all of them located in "SAMPLE City, SAMPLE State, US".Trying not to laugh, Cody clicked the "Employee Survey" link to let management know about the issues. The page promised that every employee who offered his feedback would be entered into a drawing to win a new iPhone. He answered the questions eagerly but honestly, describing his findings in detail. Then, when the last field of the form asked him to provide his name and email for the sweepstake, something dawned on him ..."Hey, did you see the email? Guess who's the lucky guy with the new iPhone?""What, did I win?" Dave ran to Cody's desk and peeked over his shoulder. Trying not to laugh, Cody pulled up the latest company newsletter."'The new website proved to be an amazing success. We'd like to thank everyone for their efforts, and we'd like to thank over 17,000 of our employees for taking the time to voice their feedback.'""Wait, what?!" Dave cried. "We don't even have a tenth of—""Read on." Cody buried his face in his hands to contain the laughing fit."'The lucky winner of a new iPhone 6S is Mr. Bruce Wayne, who can contact our corporate offices at Gotham City to ...'" Dave shook his head. "Great. Now we have Batman working for us?""Either that, or someone failed to make sure that the employee survey was for employees only!" Giggling like a madman, Cody closed the email client.It wasn't until the following month that management figured out the problems with the website. They ended up taking it down for a month of maintenance, then silently replaced it with the old version.And as far as everybody at IniVenture knows, the Dark Knight never showed up to collect his iPhone.[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!
Error'd: Who Stole the Search Box?!
"Why, thank you, Microsoft, I do need assistance with... wait a minute!" Steve L. writes.
Your Recommended Virus
In the early 2000s, Fernando was the Network Operations Manager for a wireless ISP known for its comprehensive customer support. They had techs who’d install the necessary gear, and consultants who’d arrive onsite to reconfigure computers, routers, firewalls, and everything else, until the customer was completely up and running. A small team of developers could even custom-build any small software apps a customer might ask for.The service was well loved. In fact, it was so thorough and helpful that after the initial install hiccups were soothed, Fernando and his support team almost never heard from customers again.“We’re too good!” a sales manager complained during one of the most surreal meetings of Fernando’s career. “We’re hurting our own business! There’s gotta be a way for us to drive up service calls!”“Ethically,” another sales-beast added quietly.“Right, ethically. What can we do?”Brainstorming commenced. A set number of service calls that the customer had to pay for upfront, whether or not they were ever used? Quarterly “check-ins” built into everyone’s service contracts (at a price, of course)?“Hang on, this is still about helping our customers, right? Or at least it should be,” Fernando said. “What’s one thing that everyone needs help with, all the time? Security. New threats pop up all the time. Why don’t we set up a listserv that we can use to recommend security updates and best practices? That way, we’re staying in touch with the users with good advice—and we can encourage them to call us for help with implementing that stuff.”It was a fantastic suggestion. The sales managers were happy. The top-level execs were happy. And since it had been Fernando’s big idea, he had the privilege of implementing it. He set up a Majordomo list-server, configured to accept postings from his email address only, then carried out his plan to great success. Customers received highlights from Bugtraq and other relevant sources, generated steady business, and were protected from many nasty problems.Everyone was thrilled.It took a full two years before the storm clouds surfaced, but surface they did. Bafflingly, Fernando received an email from the listserv that he hadn’t sent. He opened it, and slowly realized what he was looking at. A Windows virus from some customer's site had replied to one of his emails, and had used his email address as the forged sender. His list-server had then dutifully forwarded it to the entire distribution list.Horror shot through him. Not two seconds later, the phone rang.“Hi Fernando, it’s Brian. Listen, I just got your email. What do you need me to do with this here?”“I’m sorry, it was a mistake,” Fernando gunned out, heart pounding. “Please go ahead and delete that.”He was hardly off the first call when the next one came in. While he was on the line, he watched emails pile up in his inbox.I don't understand what you mean by this.Am I supposed to install this?Can you have one of your guys come out and install this for me?Fernando shook with terror. Sweat beaded at the nape of his neck. Hundreds of customers could potentially infect and torpedo their own operations, all because the Network Operations Manager in charge of security emails had just sent out a virus.The next free moment on the phone, he called his receptionist. “Hold all my calls for the next few minutes, please.”Before he heard any acknowledgement, he dropped the phone back into its cradle and began drafting a clarification email to explain the whole mess. Please disregard—“Hey, what was that weird file you sent out?” A coworker leaned lazily past his office door. “Looks kinda suspicious to me.”“I’m aware of that.” Fernando struggled not to curse or yell. “We’ll talk later.”Once he’d sent out the email, he firewalled the majordomo process to only accept email from localhost. Then he sat back, closed his eyes, and prayed.His quick action made more of a difference than any divine intervention. Fernando never heard any reports of customer systems getting infected from that incident.Disturbingly, he also never figured out whose machine had sent the original.[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
CodeSOD: Confession: rect.Contains(point)
A few years ago, Josip M decided to try his hand at building games using C# and the XNA framework. He started implementing the classic board game, Nine Men’s Morris, but like most side projects, he lost interest and mostly forgot about it… …until a few months ago, when he started cleaning up his hard drive, and found the code again. Then he remembered why he lost interest and abandoned the project:
Single-User Mode
It was a common occurrence for Jarosław F.’s brother, Andrzej, to call him for help. Andrzej worked as a data-entry specialist for the Polish Ministry of Employment, while Jarosław was part of the ministry’s IT department and moonlighted as a Python programmer.One day, Jarosław answered another call from Andrzej. “No sane person can do this job,” Andrzej started. “There just aren’t enough hours in the day.”“‘Hours in the day?’ You enter data and run reports using web software. It’s not that difficult.”“No, you don’t understand. The ministry’s starting a new labor force program, and I’m in charge of the data entry. But there are too many records to enter by hand.”“Andrzej, I’m really tired of this,” Jarosław said. “I’m going to write you a script to help with your work, and in exchange you don’t call me at work for six months. Deal?”Eternity in a CellJarosław had never actually seen the software Andrzej used to enter data. Just getting to Andrzej’s department required signing an authorization form at the front office, then a half-hour wait until his supervisor gave the go-ahead. But Jarosław knew writing the script for his brother wouldn’t take very long.Andrzej showed Jarosław to his desk and opened a browser. The web application looked current circa 1998, as if someone mocked up a Windows GUI in Internet Explorer 4. There were rows and rows of grey tabular data, text set in black Tahoma. Next to each cell was a button marked Edit.“You press the button to edit each cell, which takes a few seconds to load,” Andrzej said, demonstrating. “Each cell, and every row, must be entered one at a time”“Surely there’s a ‘bulk import’ somewhere.” Jarosław scrolled down the page, looking through buttons labelled Income Report and Demographic Report. There was nothing marked that looked remotely like a bulk import feature. “How long does it normally take you to enter a row?”“Five minutes. I usually get about 10 records an hour. There are 400 records, and my boss needs them done by the end of Sunday.” That left five days. “I still have reports to run while I do this. That’s why I need your help.”Parallel Punishments“Okay,” Jarosław said, “can’t you get someone to help you with this? Five people entering data would mean it’d get done in a day.”“Even if we had that many people to spare, there can’t be more than one person entering data at a time. The system would crash.”Jarosław chuckled. “Oh, come on. No web application forces a single user to enter data.”“A year ago, we tried using two people at a time,” Andrzej whispered. “A whole dataset was corrupted. It set back the department’s mandate by six months, and my last supervisor was fired because of it. My new supervisor won’t tolerate any further delays.”A CRUD-like web interface, with no parallel data entry allowed, it seemed deliberately designed to make one person’s life miserable … and that person was Andrzej.“It’s a good thing I work in IT,” Jarosław said. “Because what you need is a tailor-made import script, and I’m the one who can write it for you.”Automated Manual EntryFirst, Jarosław installed Python on Andrzej’s computer. If Jarosław were about to exploit the ministry’s applications, he wanted to use a language he was familiar with. Next, he entered a few sample rows from the dataset Andrzej was burdened with. He logged every HTTP request the web application made, making a list of calls his script would need to make. Finally, he converted the Excel file the data came in to .csv so his script could consume it. It was tedious, but not as tedious as Andrzej’s burden.“Let the script run overnight,” Jarosław said. “If anyone asks, tell them I did this on my own initiative. It should be done by morning.”The next morning, Andrzej himself went to see Jarosław in the IT department. He looked relieved. “You just saved me four days of manual data entry.”“You can use it on other datasets,” Jarosław said. “Just convert the files to .csv and pass in the filename as an argument from the command line. And make sure no one else is entering data while it’s running.”“Thanks,” Andrzej said. “So, call you in six months?”Jarosław shook his head. “This one’s on me. I had no idea what torture they put you through until you showed me.”[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
Announcements: Bonus WTF: Karmic Cascade
Our sponsors at Infragistics have a special treat over on their blog: an extra feature for today. It's a story of teamwork and "teamwork", and of course- disaster.Check it out.A worldwide leader in user experience, Infragistics helps developers build amazing applications. More than a million developers trust Infragistics for enterprise-ready user interface toolsets that deliver high-performance applications for Web, Windows and mobile applications. Their Indigo Studio is a design tool for rapid, interactive prototyping.[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll 👍 today.Your first 30 days are free on us. Learn more at Scout.
...44454647484950515253