Feed the-daily-wtf The Daily WTF

Favorite IconThe Daily WTF

Link http://thedailywtf.com/
Feed http://syndication.thedailywtf.com/TheDailyWtf
Updated 2024-10-05 00:31
Error'd: Please Ignore the Progress Bar
"Honesty like this should be rewarded - whole dialog box warning that the install progress bar is absolutely crap," wrote John A.
CodeSOD: isAlive
Why are we here? What is the purpose of life? What does it even mean to be alive?No, I haven’t been hanging out in coffee shops wearing a beret and discussing philosophy. I’ve instead been puzzling over this code, from Nikolai K.
Announcements: Tokyo TDWTF Meetup
UPDATE: April 22 will be the day!Tokyo readers, I'll be in your fine city this month -- and that means it's time for another Tokyo/TDWTF nomihoudai! It's always a fun time, and we've got a good group of regulars now. Here's a pic of a group of us from a past meetup:If you're unaware, nomihoudai is an easy way for a group of folks to get as much food and drink from the menu as they'd like for a set price over a set duration, without fussing over details like who ordered what and how many. While Japanese people often see this as a convenient offer, as an American I recognize it for the challenge it is -- and conquer it I shall!So, if you're up for getting together on Friday, April 22 in the Shinjuku or Shibuya area, please drop me a note via the contact form or direct, apapadimoulis/inedo.com. [Advertisement] Scale your release pipelines, creating secure, reliable, reusable deployments with one click. Download and learn more today!
The Pagemaster
Amanda supported and maintained a website through which clients managed their own data. Occasionally, she’d read through access logs in search of unwanted scrapers, rogue bots, and hack attempts.Her diligence paid off when she caught on to a particular IP that was making a huge amount of requests throughout the day. Page after page of results were being requested less than a second after another, as with a typical scraper bot:
CodeSOD: The Three Second Rule
The “Five Second Rule” is, of course, a myth. If you drop a food item on the ground, the bacteria living on the ground aren’t going to wait five seconds before moving in. Besides, everything you stuff in your face is already covered with all sorts of bacteria anyway. You have an immune system, you might as well use it.Adolphus Mannz recently gave his immune system a bit of a workout. In their SalesForce system, they needed a way to determine if a record was being added to the system or updated, and perform some slightly different logic in each case. His fellow developer came up with this rather ugly solution.This is in SalesForce’s APEX language:
Mercy the Mercenary in… Trouble at the Town Hall
Mercy Francis sat inside a drab, storefront office. The walls were covered in posters, captioned the words Rockwood for Governor, for a Righteous Florida! To her right was a map of Florida covered in multi-colored thumbtacks. Below the map sat an aging desktop machine. On its case was slapped a piece of masking tape marked Rover.Across from her sat Barbie Sullivan. She appeared to be in her fifties, just over five feet high, with a greying bob cut. She had introduced herself as the campaign manager.“For governor?” Mercy asked. “I thought primary season was over.”“Oh sure, but John Rockwood’s not affiliated with any party. He’s running as an independent.”“So the ad said you need someone to manage your online presence.”“Why yes,” Sullivan replied. “Most people who responded to our classified wanted $200 an hour just for consulting. Consultants don’t actually do work, and we really need someone who can get their hands dirty.”The consultants Mercy knew certainly did get their hands dirty, as Sullivan had put it, and $200 per hour was not unreasonable for their services. “I can do it for $50,” she said. “You can contact me 24 hours a day, and you’ll be my top priority above any other work I have.” Of course, she didn’t have any other work.Mercy showed her portfolio to Sullivan on her tablet. She had done SEO for several companies in Orlando, developed and designed web sites many others, but her portfolio site really showed off her design skills.“Oh wow, this is impressive,” Sullivan said. “I’ll bookmark this for later.” The campaign manager fired up her aging laptop, opened some ancient version of Internet Explorer, and laboriously typed in Mercy’s portfolio URL into the browser. Mercy gritted her teeth; her site downgraded gracefully through several versions of Internet Explorer, but anything below IE 11 made her subtle gradients and background images look like a magazine collage.“This is very impressive,” Sullivan continued, “but the boss really needs to sign off on this. I’ll talk to him after the event tonight and we’ll call you sometime Monday.”Mercy handed Sullivan her business card. Printed on one side was her email address and cell phone, and on the other were the words Mercy “The Mercenary Developer” Francis.As Mercy headed for the door, she heard Sullivan muttered something. “Why isn’t that live stream working?” Sullivan kept refreshing her browser window, staring at a black video player with an error message displayed in its center.Having freelanced since college, Mercy had developed a knack for knowing an opening when she saw one. “Anything I can help you with?” she asked the frustrated Sullivan.“Ellis was supposed to have this on an hour ago,” she said. “Harry Ellis, our media manager. He’s been bosom buddies with Rockwood almost as long as I have.” She eyed Mercy. “Do you know anything about ustream?”“Sure.”Sullivan offered Mercy her laptop. This version of Internet Explorer lacked a DOM inspector, so Mercy viewed the source instead. The ustream code was formed correctly, as far as Mercy could tell.“It’s not the code,” she said. “It looks like there’s no video data. I’ll make you a deal. I’ll go to this town hall or whatever and see if I can get that stream working. If I do, you pay me $30, otherwise I walk away with nothing.”“Oh, I’m sure Ellis will get it working before the boss is on,” Sullivan said. “In half an hour,” she muttered. “But why don’t you go lend a hand? If we offer you the position you’ll be working side-by-side with him. We’ll see about your $30 later.”Ellis InsistsMercy sped in her 10-year-old Honda to Stoneford High School, northwest of Orlando, where Rockwood was holding his town hall meeting. Sullivan had told her she’d find Harry Ellis, the campaign’s media manager, in the gym.The “town hall” held far short of a whole town, with maybe a few dozen people in attendance. The average age of the audience was around 50 or so. Most wore apparel blazoned with the flag.In the front row, staring into a laptop screen, was a man with a greying comb-over and a prominent chin. Beside him was some television station’s 80’s era camcorder on a tripod. Mercy made her way to him and introduced herself. “Sullivan sent me over to help with the live feed.”Ellis didn’t look up from his laptop screen. “You can help if you just shut up and let me do my job,” he said.Mercy would have left then and there, but she remembered how much beans and rice $30 could buy. Instead, she sat next to Ellis. He pulled his laptop screen close to his chest, squirming away from her.Around them came a smattering of applause. A tall man in his late 60s strode onto the platform that had been erected in the middle of the gym. Ellis started shaking his head, holding up a hand for the man to stop whatever he was about to do. Ignoring Ellis, the man turned on his microphone, waving down the elderly applause in the gym.“Ellis here says we’re not live, but I know you’ve been waiting a long time to see me, so let’s get this started.”Ellis closed his laptop. “So much for that.”Mercy yanked the laptop away from him before he had a chance to put it away. On the screen was a ustream profile page; in the corner, she could see he was logged in as JohnRockwoodCamp.“I’m so glad to be here, Stoneford,” Rockwood said. As Rockwood stumped in the gym, Mercy checked the stream settings while Ellis muttered next to her. Everything was set up correctly, as far as she could tell. It was set to record from a video feed coming through USB. Nothing wrong with ustream, then. Barring some issue with the laptop, the problem must be whatever camera he was using. It clearly wasn’t using the laptop’s webcam, so it had to be in the gym somewhere.She turned to hand the laptop back to Ellis, but he had left. She set the laptop on his empty seat.Mercy found a usb cable connected to the laptop. Unless Ellis was stupid enough to run usb halfway around the gym, the camera itself shouldn’t be more than a few yards away. She followed the cord.It led to the ancient camcorder on the tripod next to her.Out the corner of her eye, she spotted Ellis chatting with what looked like a police officer in the doorway.Meanwhile, Rockwood continued his speech, extolling the virtues of the native Floridian on stage.She examined the side of the camcorder, wondering how Ellis managed to connect a USB cable to something from the Reagan administration. Ellis had connected several dongles: USB to DVI, then to S-Video, then to the camcorder. The camcorder was on, the low-resolution video visible in the viewfinder. But the DVI-to-S-Video was paired incorrectly: the dongle down-converted from SVI to S-Video, not up-converted. Regardless, DVI was designed not to work with analog input. It would never have worked, regardless of what series of dongles Ellis had used to hook it up.The police office approached her, followed by Ellis.Mercy remembered that her smartphone had a ustream app, and she still had the charger in her purse. She lifted the heavy camcorder off the tripod, setting it gently in the seat nearby. She unplugged all the dongles, then plugged the end of the USB cable into her own, which went into her phone. She set the phone’s camera on record. There was no way to keep the phone on the tripod, though. So she took out her duct tape.“Time to go, miss,” the officer said.“I’m fixing your feed,” Mercy said to Ellis, ignoring the cop. She tore off a bit of duct tape, rolled it into a loop, and used it to stick her phone to one of the legs. “Why don’t you go check?” she said to Ellis.Ellis, fuming, went to his seat and opened his laptop. The ustream page showed Mercy’s phone camera footage in the player.Rockwood continued his speech. His eyes glanced back at the three of them around the tripod. After he finished his thoughts on the IRS and tax codes, he paused for nearly ten seconds, his eyes glazing over, trance-like. Then, he spoke. “You know, I just want to thank our volunteers for all they’re doing. I think they finally got us live. Could you give them a round of applause?”The audience did so. Ellis, caught in the act of throwing out the one person who was making Rockwood happy, faking a toothy, shark-like smile, and returned to his seat. The officer returned to the door, leaving Mercy with her duct-taped phone. She waved.“We have to make our state of Florida a better place for these young people. That’s why I have a proposal, one that none of my fellow candidates for the republican nomination would ever make. When I become the next governor of Florida, going to college at a state institution will be free. Not subsidized, not loaned out at high interest, free. Room, board, and everything else.”Before Ellis had another chance to toss her out of the gym, Mercy headed back to her apartment.Quite an ImpressionMercy drove to Rockwood campaign headquarters on Monday to pick up her check for $30. The storefront office was filled with volunteers, wearing “Righteous Rockwood” t-shirts. They were applauding as she entered.John Rockwood was making an impromptu speech in the back. “You young people are the reason why this campaign is going to change Florida,” he said. “The Democrats don’t own you, the Republicans don’t own you. You know Harold Packard, the Republican who’s foolish enough to run against me? He says you’re all a bunch of freeloaders. What he really means is that he’s scared of you. Well, I’m not scared!” More applause.The candidate finished his speech, and his volunteers dispersed. Meanwhile, Sullivan grabbed Mercy’s arm and led her to Rockwood himself. “You’re the one who helped Ellis get that video going,” the candidate said, shaking her hand. “What’s your name?”“Mercy Francis,” she said, wincing at his handshake.“Lord have Mercy,” he said, chuckling. “You know, I have never once used email, or used one of those smart-eye-phones, so I’m glad I have people like you and Ellis and Barbie over here to help me out.”As she spoke to Rockwood, Ellis spotted her and moved to intervene. Before he reached them, Sullivan moved between them with a graceful smile. “Ellis, this is Mercy Francis, our new online presence manager,” she said. “She’ll be working with you to get our online presence up to snuff.”“I don’t need her help,” Ellis said, pointing at Mercy.Barbie showed a sugary sweet smile. “Oh, yes we do. In fact, Rockwood asked for her personally, after she showed what an asset she was on Friday.”Ellis, fists clenched, spun on his heels and went back to his laptop.“That was quite an impression you left,” she said. “We’ll write a check, as we agreed. But I have a proposal.” She led Mercy to a windowless conference room in the back of the storefront. “Forget $30,” Sullivan said. “How does $3000 a month sound? Our donations have gone through the roof since his speech, and we have you to thank for that getting out there.”“Done,” Mercy said, shaking hands. [Advertisement] Onsite, remote, bare-metal or cloud – create, configure and orchestrate 1,000s of servers, all from the same dashboard while continually monitoring for drift and allowing for instantaneous remediation. Download Otter today!
Radio WTF: A Day of Mei
Radio WTF Presents!Jump to transcriptSoundcloud Links:Radio WTF: A Day of MeiDirect Download:ADayOfMei.mp3Starring (in order of appearance)Devin Sweeny... as Mei
Error'd: Saskatche-what's-it?
"I know we are special here in Saskatchewan but I don't think we need 10 different choices," wrote Mike.
A Meaty Problem
“The scales are down again, where the heck is Andre?”Roger had heard this cry often enough that he didn’t bother to poke his head out of his cubicle to see what the issue was. He worked for a meat-packing company. Sides of beef came in one side of the building, where they were sectioned and cut into smaller, grocery-store-friendly portions, and then shipped out the other side in refrigerated trucks. Along the way, the pieces of meat needed to be weighed multiple times. When the scales went down, production stopped.“I’ve got it,” Andre called out. “They’ll be back up in a second!”The scales weren’t Roger’s job. His job was making sure bills of lading and manifests and shipping instructions could be generated for every truck going out. That system was fragile and provided him more than enough work- he needed to integrate data from three different off-the-shelf ERPs and generate output suitable for each of their shipping partners (who all required different formats). Roger had enough problems without worrying about Andre’s scales.But damn, if those scales didn’t go down a lot.After a bad stretch of frequent outages, Pierre, the plant manager, had enough. Furious, he called the entire IT department into a conference room to give them a dressing down. He had a slide deck with charts and graphs documenting each of the IT failures that had impacted meat packing. “We pack and ship meat,” Pierre said as he paced in front of the projector screen. “This company’s been doing that since before you had this newfangled computer garbage, and we’ll keep doing it when computers get replaced by robots or whatever. All I want to know is, why are you screwing up my goddamn plant?”No one made it out of the meeting unscathed. Roger got called out because an outdated template file caused a shipping label misprint which left a truck sitting in the dock for two hours. There was one system, though, that represented the lion’s share of the issues on the graphs: Andre’s scale management system.After the meeting, Roger’s boss, Elene, pulled him aside. “Andre is really struggling,” she said. “And he says it’s an issue with communicating. Can you give him a hand?”Roger said “yes”, and sat down with Andre. “So,” he said, “you always seem to be able to fix the problem pretty quickly. What’s the underlying cause?”“Oh, well,” Andre said, “this cruddy scale system is like three hundred years old, and like anything built in the mainframe era, it only understands flat-file format instructions. To get data from our database and into the weighing system, I have to send it a file. Sometimes, there’s a locking issue, and I can fix it by just deleting the file.”“That would be annoying,” Roger said. “So you have to delete the file and resend it?”“Well, it’s not usually the file we send that gets locked. It’s usually the INI file.”“The… can I see your code?”Roger traced through the code, starting with the function that fetched data from the database. FindProductInfo was a pretty standard CRUD function, so he looked for places where it was called- like UpdateData.
CodeSOD: Scrubbed Inputs
In this age of JavaScript everywhere, developers have to come up with all sorts of ways to work around the uglier segments of JavaScript. For example, Aaron found this block, which promises to scrub “false-y” fields.
Tested Backups
The “Big Boss” of Initech’s Australian division ran the Sydney office as his own personal kingdom. Work- or workers- he didn’t care for was banished to the hinterlands of the Melbourne office. For example, IT services was a “useless sack of morons who only know how to spend money,” and thus the entire department was banished to Melbourne.Stewart C. lived in Melbourne, and was a new hire not long after the exile. The Melbourne office, with a 900km buffer zone protecting it from the whims of upper management, was actually a decent place to work. At least, until Brendan arrived.Brendan was an upwardly mobile middle manager based out of Sydney. One day, he did something to offend Tony. The scuttlebutt had a lot of rumors about what that was, ranging from “oh, he was late to a big meeting,” to “he took the last beer at the company party”. Rumors aside, the facts were clear: Brendan was in Melbourne with a long list of projects to manage, and he wasn’t going back to Sydney until he completed all of them.A few days into his exile, Brendan brought that list of tasks to Stewart’s cube. “Stewart. Stew. Stewie. I’m gonna need you to go ahead and test our backups, yeah? Make sure we can actually restore from them, right?”“That’s a great idea,” Stewart said. “So great, that we test them on a regular basis. I can send you a doc that covers our backup strategy-”“Right, yeah, but have you tested them in production?” Brendan asked.Stewart paused, making certain that he’d heard the question properly. “Well, no…”“Right then, yeah? They haven’t really been tested ’till we run them against production, yeah?”“We… really shouldn’t test things in production,” Stewart said. “I mean, what if the test fails?”Brendan shook his head and laughed. “Stewie, why would the test fail unless the backups are broken, right? Yeah, I’m gonna need a plan to cycle through every production server. Wipe it, restore from backup tape, and confirm it’s working, yeah? Right, so get on that. Orders from Tony, yeah, we need this by next week.”Stewart immediately got to work- on making sure this hare-brained idea didn’t go forward. He roped in his boss, who roped in her boss, and everyone was on the same page: this was a terrible idea that had no real benefit and carried with it too much risk and downtime. “Buuuuuuut,” his boss said, “it’s what Tony wants. We haven’t got the political clout to tell him ‘no’, so we’re going to have to do it.”Wind of Stewart’s attempts at killing the project got back to Brendan. This resulted in a rather nasty meeting invite demanding a “status update”. Stewart wasn’t the only invitee. When he took a seat next to Brendan, they were both staring at a speakerphone.The phone resonated with Tony’s booming voice and confident authority. “Well? What’s all this then?” he demanded.“I’ll tell you what this is,” Brendan said. “It’s just like you said, sir- everyone out here in Melbourne is lazy and obstructive, right? Yeah.”“You’re telling me crap I already know,” Tony said, his voice crackling on a bad connection. “Of course they’re useless, that’s why they’re out in Melbourne. Was there a point to this call?”“Well, yeah, right,” Brendan said. “I wanted you on the line for this because Stewart has been the worst, right? He’s been nothing but a trouble-maker disrupting my efforts and second-guessing me-”Stewart started to mount a defense, but he couldn’t get a word in before Tony’s laughter drowned him out. “Brendan, if you can’t handle the Melbourne office, how do you expect to cut it back here in Sydney? You just haven’t got the guts for this business, Brendan. Now, c’mon then, you’ve got your orders. Chop chop, and no excuses.”Tony ended the call, leaving Brendan and Stewart staring at each other in uncomfortable silence. Brendan was the first to break the silence. “Yeah, as you can see,” Brendan said, “this project has attention right from the top. So you’re going to give me a workable plan for testing all of the backups on the production servers by tomorrow- or else, right? Yeah.”Stewart nearly demanded, “Or else what?”, but decided against it. Instead, he wrote up his plan, noted the steps that involved downtime, and sent it to Brendan the following day. Brendan didn’t have any follow up questions, and nobody told Stewart to execute the plan, so he promptly forgot about it and got back to doing real work.Until all IT operations came screeching to a halt two weeks later. Brendan, as it turns out, decided he didn’t trust Stewart to run the tests. Instead, he strong-armed one of the junior technicians into doing it for him- but not until after making his own modifications to Stewart’s plan. Specifically, he wasn’t happy with the schedule- Stewart had very conservatively scheduled only one server to be tested a week, outside of regular business hours, so that any failures or issues would be minimized. That would have taken months, and Brendan wasn’t willing to wait that long, so he made the junior technician do them all at once. Without coordinating downtime.The result was every bit as catastrophic as one might expect, especially considering the junior technician didn’t think to order the backup tapes before starting the test, which meant they needed to be shipped from their offsite location. All in all, they lost two days of operations and a lot of reputation among their customers. Tony was furious, and he knew exactly who to blame: the “useless sack of morons who only know how to spend money.”Obviously, the folks in Melbourne couldn’t handle the complicated job of running IT services, so the IT department there was closed down at the end of the quarter and Initech hired on contractors to set up a new datacenter in Sydney. Stewart wasn’t particularly happy to lose his job, but he took some solace in the fact that he had prospects lined up- while Brendan didn’t.[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: The Last of His Tribe
"The best thing about working here," Jaeson was told by his boss Renee on the walkthrough of the dev area on his first day, "is that we work closely with the customers, meaning you never EVER have to cash checks the salespeople wrote: you're only held to what your team promised." This sounded good to Jaeson, who was considerably more concerned about getting away from his previous company's open floor plan than the possibility of customer interaction, but hey, he'd take the icing on the cake. It sounded like he was in for a very productive time."Let's see, where to put you," mused Renee, glancing over the pods of cubicles. "Aha, I think Zebra Tribe will work." Zebra Tribe, it turned out, was the name of a scrum team; Jaeson would be working closely with the other members of that tribe, as they were called, in the coming months in order to accomplish tasks during sprints.Over the next three months of working in Zebra Tribe, Jaeson often thought back to that original introduction and laughed. True, there were no salespeople involved with the customers; however, in order to keep customer happy, engineers themselves were forced to promise things they knew wouldn't get done in the arbitrary time-box of a sprint. They were forbidden from explaining Scrum, as it "confused people", so instead had to speak in terms of releases, and nobody wanted to hear "It won't be in the next release, and we're not sure when it'll get done" as an answer. So they were forced to cram more and more work into sprints, leading to rushed work, mountains of technical debt, and no documentation. Even having a fifth man instead of a usual four-person tribe didn't help Zebra much."How are you settling in?" Renee asked, at the first so-called biweekly one-on-one three months in. She listened intently to his criticisms of the process before smiling and changing the subject entirely: "Well I've got good news for you. I'm moving you to Elephant Tribe after the current sprint."Elephant Tribe? thought Jaeson rapidly. I've never heard of Elephant Tribe. Hyena, Mongoose, and Snake, but Elephant? It wasn't a mystery for long; instead of a pod of cubicles like the other teams, Elephant Tribe had a single cube in the corner, where there was some space left over. In this lonely cube sat Bill, the Last of his Tribe, who was overjoyed to be given more resources to work with.Jaesan was given a second cube in a different corner; gone were the days of active collaboration and late-night nerf wars to keep morale up. He was also given a starter project to get up to speed on the ancient product that Elephant maintained. "We don't use scrum really," explained Bill. "Not much point with just me. Maybe it'll be different soon, though. I hear they're gearing up for a refresh project, keep the UI up to date. Good thing, too; I mostly do support these days. Hasn't been a real project on this thing in, oh... two years? Three?"Jaesan plunged into the task, getting familiar with the codebase. It was a brutal chore, but he managed to get the basic feature working with hardcoded parameters. Then he opened the configuration class.
Error'd: An Identity Crisis
Ari S. writes, "Not only was the poor computer running Windows XP, it also had to suffer through having the Apple keyboard and mouse attached to it.
CodeSOD: You Can't Always Count on Regular Expressions
After spending the most of the afternoon searching, trying to solve a rather vexing issue, Adam found exactly the solution he was looking for and wanted to squirrel it away for later reference.Sure - he could have added to "Favorites" in his browser like on every other website in the world, but there was something about the "bookmark" button on this particular site that called to him. It was more than a dumb link, it was a counter telling you how many people had bookmarked a resource, and you could bookmark it yourself.Also, it was the most calming shade of blue.Blame exhaustion, blame frustration, or even the fact that his remaining brain cells were delighted to see that 26 other souls had found this page bookmark-worthy - Adam threw caution to the wind, risked a stealth malware install and clicked on it.The thing was, instead of increasing by 1 as anyone would expect, it did so by 10."Shenanigans!" Adam shouted as he got to work, digging into the page's source and found the code responsible. (After all, who would be so sneaky that they'd increment a bookmark counter by an artificial amount just to make it seem like the page had been bookmarked more than it actually was?)As it turned out - the original coder, not knowing that you could extract the contents of an HTML node with the “text()” method, or similar ones, decided to give regular expressions a try.
A Signed Release
Brody and his team of contract developers were nervously awaiting a major update to TexOil's member website to go live. Between a complete overhaul of the site and massive database changes, it would be difficult to roll back if anything went awry. They were only responsible for developing the software, however. The task of the actual deployments fell to Lars' release team.The development and testing process had been rigorous, but Brody felt confident in his code after receiving UAT signoff the week before. There was even time for extensive load and stress testing this time around. Brody spent most of the weekend running builds and packaging up the code and database scripts so that Lars and Co. could prep the deployment first thing Monday. Lars strolled in an hour late Monday morning, seemingly unconcerned with the magnitude of the release before him. "Hey Lars," Brody greeted him. "It wasn't fun, but I got everything packaged for you guys to do your thing. So you should probably get started so we can hit the ground running tonight."Lars scoffed at Brody's urgency. "Chill out, BRO-dy. We got this. Since the last time we had a big nightmare release like this, my team created an automated deployment system. Things will go perfectly smooth, assuming you and your contractors did your jobs right."Brody brushed off Lars' snippiness as he recalled TexOil's last big release. Everyone involved pulled an all-nighter and worked 18 hours straight just to get the troublesome release stable. In the end, Lars' team had deployed the wrong code via human error. So the fact that they had automated deployments now was music to Brody's ears.TexOil's standard release window of midnight rolled around. Brody resisted the urging of his buddies to hit the bar earlier so he could be clear-headed for the release. Everyone signed in on time and joined the big conference call. "Ready when you are, Lars. Hit it!" Brody prepared to sit back and listen to the happenings and only get involved if things went sideways."Automated deployment - ENGAGE!" Lars shouted. In Brody's mind, Lars had just hit a button and a bunch of console windows were appearing then disappearing as their automated system updated everything. An hour went by without much chatter on the call. Brody assumed since the release was automated now, it would be quick. But he deduced there must be some kinks to work out.Getting impatient and tired, Brody broke the silence, "Hey Lars. How are things looking?""Well, the deployment worked just fine. I think there's something wrong with your code, though. All we are getting is ASP.NET errors when trying to bring up the websites. I thought you guys said this was signed off on?" Lars questioned in an accusatory tone."Um, it was. Everything worked fine in our UAT environment," Brody responded with concern. "What's the error you're seeing?""It's just some lame generic error. It says to turn custom errors off or something. If you guys are customizing stuff, I can't be expected to troubleshoot for you!" Lars shot back."Just send me the configuration file, Lars. I'll take a look," Brody said, expecting something to be amiss."Fine, but the way our automated deployments work, there's very little chance of a configuration error." Lars attached the web.config file to an email and shot it off to Brody.Brody popped open the XML configuration file in Visual Studio to check for the myriad changes that were required. One by one, he saw them. He started to think the configuration wasn't the problem and prepared to start debugging. But that's when he reached the bottom of the file and the distinct block of text that was Lars' e-mail signature sat there, looking horribly out of place. It was plastered with several squiggly underlines that were an obvious indicator that it wasn't valid XML."Lars..." Brody paused before asking a question he should never have to ask. "Why exactly is your e-mail signature in this config file?""WHAT?!" Lars shot back. "Give me a minute and I'll get this resolved." An awkward silence followed. Finally Lars spoke, "Ok Brody, the ASP error went away. We can have the testers hit this thing hard."Brody breathed a sigh of relief, but immediately began to wonder how that happened. "So Lars, how did that occur when you guys have the deployment automated now?""Well, you see Brody," Lars started, nervous. "What we have isn't FULLY automated yet. What you package up for us, I have an app that grabs that and throws it out on the server. Then I copy it by hand to the IIS directory. I also can't figure out how to make configuration changes with it yet, so I have a cohort do those, email the XML to me and I AUTOMATICALLY know to copy and paste it in to the web.config file. It's nearly a fool-proof system though!"Fortunately, Brody's phone was on mute so Lars and the rest of the conference call couldn't hear the stream of profanity he spewed at the sheer stupidity of this "automated" deployment. [Advertisement] BuildMaster integrates with an ever-growing list of tools to automate and facilitate everything from continuous integration to database change scripts to production deployments. Interested? Learn more about BuildMaster!
CodeSOD: Finding the File
There’s one challenge we rarely think about when writing file-handling code: how do we know where the file actually is? Josh H. inherited some C# code that puts a lot of thought into that. A lot.
Announcements: The New(ish) TDWTF
You might have noticed some updates to the site, although if we did our job right you won’t notice half of them.What’s New? We are saying goodbye to Discourse, our old forum and comments system. In its place reintroducing an in-house built system, thanks to the hard work of our newest team member Ben Lubar.Now you don’t have to be a member of the forums to leave a comment on the main site. Plus you can login and comment through several third parties, like Facebook, Google and GitHub.What’s New(ish)A few years ago we redesigned our site. We loved the look, but it wasn’t built as efficiently as we would have liked. So we rebuilt a more lightweight version that should work and look almost exactly the same.It’s not exactly the same, and I’m sure there will be some issues here and there, but now it will be much simpler to correct them. Everything is up on GitHub, so if have any problems or ideas for improvements, post an issue, submit a pull request, post something in this article's discussion, or contact us.[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!
Back Away Slowly
It'd been two hours since Mike had gone to bed. Two slow, miserable hours of counting sheep, staring at the barely visible ceiling, and trying to shake off the stress of the last few weeks at work.His company had (finally) moved from bare metal to a modern, virtualized environment. Mike and a few coworkers were in charge of revamping the whole backup system to match the efficiency of the servers. They'd been handed a generous budget and a single task: make daily backups of all the key servers feasible.Hundreds of emails, days of overtime work, and plenty of bickering had resulted in an impressive setup. Massive JBOD arrays, managed by virtual servers in a cabinet full of blades and hooked up to top-of-the-line 10G switches, all hummed along nicely in the server room.The backup solution was ready for its first test. Mike had personally started the backup job late in the afternoon. The whole team had gathered over his monitor to watch the speed slowly crawl up.One, two... six gigabits per second. With 30TB worth of snapshots, the whole process would take under half a day, meeting the original goal with a huge margin. Mike had gone home a few minutes later, hoping to see the backup completed by morning. But during the evening, his initial optimism had slowly faded.What if we misconfigured something? he kept thinking. Or worse, the hardware fails?Every time he felt close to sleep, his mind conjured yet another disastrous scenario, jolting him wide awake again.Finally, Mike's eyes darted towards the laptop resting in a bag by his bedside. He knew he shouldn't be doing work this late at night ... but surely a little peek at the administration panel wouldn't hurt?Mike crawled out of bed and booted up the laptop while rationalizing his surrender to temptation. It'll just take a few minutes. See that everything's fine, then get some sleep.He logged in to the corporate VPN, opened up the dashboard ... and realized he wouldn't be returning to bed that night. The backup was stuck at less than four percent, and the speed had dropped from six gigabits to barely over a megabit per second.Mike clicked around frantically, trying to pinpoint the problem. The only thing he could find was a warning in VMWare's logs saying that one of the logical units had ended up with over a second of latency. He browsed the network configurations, SMART error logs, but everything else seemed to be in perfect order. All he knew was that a few minutes after he'd left work, the latency had spiked and never returned to a reasonable level.Over the next 20 minutes, Mike tried changing almost every single option even vaguely related to the problem. He was ready to give up—until finally, after closing what seemed to be a thousandth dialog window, the backup speed suddenly ramped back up to several gigabytes per second.It took a while for Mike to remember what exactly he'd just changed. All he'd done was switch the load balancing algorithm used to communicate between the servers and the storage.That shouldn't have changed a thing, he thought, puzzled. He decided to watch the process for a while.The problems came back no more than a few minutes later, but by that time, Mike had an idea of what could be causing them. He remotely disabled the currently used port on the network switch.Sure enough, the traffic flew freely through a different port for a few minutes before clogging up again.The next few days, spent mostly on support calls and filing tickets with the switch manufacturer, confirmed Mike's suspicions. The large amount of data being pushed through the port slowly filled more and more space in the port's buffer. When that space ran out, the port crashed, decimating the network speed and slowing the backups down to a crawl.Luckily, just a few firmware updates later the issue was fully resolved, and Mike was able to enjoy not only the blazing-fast backups and the convenience of virtual servers, but also a good night's sleep.[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!
Error'd: Adequate Enough
"Dell TechDirect's password policy is a lot like their computers," writes John, "Not the greatest, not the worse...just 'ok'."
CodeSOD: String Cheese
Imagine you’re a Java programmer. You need to iterate across a list of strings. Your natural instinct might be to just use a for loop, and that’s proof that you’re not a true enterprise Java programmer.Diether’s company is home to true enterprise developers, and they know how to get things done.
Admin From Hell
"Hello, everyone!"Daniel's eyes slowly rose from his desk as his manager entered the room."As you know, we've been looking for a systems administrator for a while. It's a pleasure to announce we've finally found a great candidate. Please welcome Mark, who's joining Initrode starting today."A tall young man emerged from the shadows and glanced over the people in the room. His black suit and tie rested over a perfectly pressed white shirt. Mark's formality stood in stark contrast not only with the team of geeks, but also the rather casually dressed manager."Mark is an MIT graduate with plenty of experience in both Linux and Windows administration," the manager continued, putting emphasis on the MIT part. "I'm sure he'll be a great addition to our team.""Thank you, and hello," Mark spoke up in a silky smooth voice. "I'd just like to add that I'm very happy to be here, and I hope to introduce all the necessary infrastructure changes that will ensure our success."Faint alarm bells rang in Daniel's head. Changes? he thought. I wonder what kind of changes he has in mind?"And finally, the analytics team." Mark and the manager slowly approached Daniel's desk for the traditional round of hand-shaking. "Daniel, Alice, and Robert are our resident SAS experts. Their work is a huge part of what makes Initrode successful.""Welcome to the company," Daniel said, grabbing Mark's hand in a firm grip."So, what do you think of the new guy?" Robert asked once the door closed behind Mark and the manager. "A bit pretentious, isn't he?""At least he can give you some style lessons." Alice shot a dirty look at Robert's worn-out t-shirt. "What do you think, Daniel?""Yeah, they sure do dress 'em nice at MIT," Daniel replied."I mean about Mark," Alice said.Daniel went for the diplomatic answer. "He's a sysadmin. He's there to fix things when they break. Fine with me. The less we see of him, the better."But something told Daniel the MIT graduate wouldn't restrain himself to rebooting a server once in a while.It didn't take long to confirm Daniel's suspicions. Just two weeks later, he entered the office only to find his team staring at their monitors with a hopeless gaze."What's up? Monday blues getting to you?" he asked, trying to lighten the mood."Just read the mail," Alice muttered, more to herself than Daniel.He opened the mail client, curious as to what happened, and found an e-mail that'd been waiting for him since Friday evening.
Editor's Soapbox: Encryption By Analogy
Last week, US President Obama said something that is usually the sort of line we give the “idiot boss” character in one of our stories. From Ars Technica:
CodeSOD: Code Changes Over Time
Code changes over time. Most of what developers do is manage changes to code. Dana inherited some pretty awful PHP, and decided to take some time to improve performance and make sure any errors thrown by the PHP were actually displayed nicely for the user.While looking at the file-upload module, Dana found this:
Error'd: In Soviet Russia, Birthday Translates You!
"Chrome translator apparently has issue with the numbers 11 and 30 when translating mail.ru to English," wrote Marc B., "Interestingly, the Russian version of the site displays the numbers properly, so WTF Chrome?"
CodeSOD: The Self Test
I consider code cleanup to be important, almost as important as actually writing code, especially since I spend a lot of time doing maintenance and support. During idle time, I enjoy digging through existing code to find overcomplicated algorithms and dead code and see what I can simplify or even delete. While there may not be an immediate benefit, it makes future debugging far easier if you trim out dead code and shorten 3,000 line C files to 500 line ones. And quite often, subtle and difficult-to-diagnose bugs simply go away.While doing this on one of our products, I found a very old public API that appears to have never been completed. At least I hope so, because there’s no way any of it does anything remotely useful.Here are a couple representative functions. No, I don’t know what they’re supposed to do.
It Can't Be Done
Decades ago I had several clients who insisted upon having two PCs on their desk. One would boot up into the word processor and the other would boot up into a spreadsheet program. No amount of instruction could teach these people that a computer can not only run multiple programs, but it can run them at the same time. To this day, these folks are still my clients, and happily paying me to support this arrangement.Some people simply can not be trained.Due to space constraints, John happened to sit near his in-house software development team. The primary business of their company was not software development, and the software folks catered only to the in-house needs of the company.The application in question is a small web query which allows the user to look up a person by some fraction of their first or last name and/or their phone number. Simple enough, really: do a case-insensitive wild card search of whatever they enter on both database fields, and display the results.One day, an Admin guy walked in to discuss the prospects of updating the application. Since people have moved a lot around here, our phone directory database has become outdated. How can we update it?.John suggested that they could provide a link in the same application so that each user could edit their phone number. However this was immediately rejected because everyone there thought it would be futile to ask employees to update their phone numbers.Instead, the manager of the software folks decided to run an internal company-wide survey and mandate that everyone provide their phone number.In the next 10 days, everyone at the company was forced to submit their internal extension number via the survey. It took all of 2 days to discover that this caused another problem. The company had 4 different facilities and all they collected via the survey was the extension numbers and not the facility to which they corresponded.By dumb luck, a week prior to this survey, there had been another survey requesting the facility in which each user was stationed. The software folks assured everyone that it was just a matter of using the other table to get the facility names too.Two days later, John just happened to bump into the same admin guy and asked him about his weekend plans. He said he was going to be in the office as the updates to the phone lookup application needed to happen. John started getting curious as to why the update should warrant weekend work, especially given that they had all the data they needed. He said Yes, the data is available, but it needs to be entered into the system.It later turned out that the software team exported an Excel dump of the two surveys from their SQL-Server database and had asked this poor guy to manually key in one entry after another in the entry form provided by them so that it could be stored in another database table.John told the admin to ask the software manager once again to check if there was a possibility to move the data directly from one table to another, rather than doing manual re-entry. John witnessed the resulting conversation:
CodeSOD: JavaScript Obfuscation
We have to be careful about the articles we publish on TDWTF. We have a responsibility to our submitters, to protect their identity and anonymize the details of their stories. We have a responsibility to our readers- mostly to be entertaining.Last week’s JSF–k story failed one of our readers. Poor Blazej didn’t find it entertaining- it gave him upsetting flashbacks to his own experience with a similar event.You see, Blazej was pitching in on a file uploading site, specifically meant to share videos. While he did some backend work, the front-end developers wanted to make sure that it was impossible to ever learn the actual URL of a video, to prevent people from downloading it. They wrote some JavaScript to obfuscate that URL, but that introduced a new problem: somebody could just read their JavaScript!Using the same principles as JSF–k, but coupled with JavaScript’s unicode support, they produced this:
The Swing of Things
While studying Java in college, Eugene had the great misfortune of being hired by a company that specialized in Java Swing applications. (For those of you who don’t know, Swing is a cross-platform framework for desktop GUI applications.) He was quickly swept aboard a new project: taking a new client’s poorly-implemented, buggy, and unstable PHP website and upgrading it to a new, clean, Java-based version.The team quickly stumbled into a major roadblock. “This has to be a web application?” questioned Rob, the team lead. “You can’t do web with Swing. Why don’t we just write them a Swing application?”“They want a website, not a desktop application,” was the response from the salesman.And so the team set out on a quest to learn web development…AjaxSwingRob soon found a workaround for their dilemma. “I found something that will make web development easy for us!” he announced to the team. “It’s called AjaxSwing, and it converts Swing programs into web applications! We don’t have to learn web development after all!”Eugene was a fairly green developer but even he knew this was a terrible idea. But as the newbie student programmer, he had no say in the matter, and soon found himself thrust into the horrid bowels of a wretched new beast. One that abused a tool designed to quickly shove legacy applications onto the web, instead using it as a core framework on a brand-new application. One that launched a separate, headless JVM process for each user. One that did terrible, unspeakable things with Reflection to replace Java’s internal Swing classes with ones that convert them to remote HTML/JavaScript entities in a web browser somewhere else.The new application was a monster. It had complex features and requirements and the team was continuously bumping into limitations of AjaxSwing. Eugene, being a mere student with the lowest pay, often got selected to work long hours dealing with these issues. He spent a fair amount of time handling customer reports, debugging, and forwarding bug reports on to the AjaxSwing team. To their credit, they worked with him to solve these.Finally, the application was completed and delivered to the client.Random CrashesShortly after deployment, the customer began complaining about random crashes in the application. Something occasionally happened that disconnected everyone from the application. They soon figured out that having the hosting company reboot the server would bring the application back, but eventually it would die again, sometimes after a few hours, sometimes after a few days. Meanwhile, Eugene’s team started adding performance logging and tracing to try to narrow down the cause.After a couple weeks of monitoring, Eugene came into one of their emergency customer support meetings slightly late but armed with a new bit of knowledge. “I found something in the server logs. Someone is actually terminating all the JVM processes used by the site.”Rob frowned. “Why would someone do that? Call the customer and tell them not to do that anymore!”And he did. The customer claimed they never did anything directly with the server, so maybe it was the hosting provider’s fault? But the hosting company claimed that no, they don’t randomly log into customer servers and kill processes.This continued for months. Everyone got used to the status quo and simply learned to live with it. Eugene continued monitoring and logging, but got no additional details. Someone somewhere was killing the JVM process and refusing to admit to it.The CauseMonths later, he received an enlightening email from the hosting provider.
Error'd: An Error is Worth 10 Words
"This was a screenshot I took of an error message I got many years ago (when Win95 was fairly new) after opening one too many instances of Word," Andrew H. wrote."I don't mind that Google likes to beta test everything, but I think I'll pass on this," Mike S. wrote, "I'd hate to be there if it crashes.""Facebook finally admits watching videos on it has no value," writes Kevin M."It's good to know that Windows will only wait six and a half years before making another attempt to synchronize its clock," wrote Matthew."Maybe I've stumbled on the Rosetta Stone for Business Process Architects? Nah, just another deployment WTF," writes Quentin G."I wanted to find the latest drivers for my MSI laptop, but I just couldn't find what I needed," writes Joe R."I have this feeling that you're trying to upsell me, ycharts.com," Jeff C. wrote.Ado B. writes, "Cards Against Humanity goes a step further by turning against charity as well." [Advertisement] Otter, ProGet, BuildMaster – robust, powerful, scalable, and reliable additions to your existing DevOps toolchain.
CodeSOD: Widgety Gadgety Boo
Ancient Coder submits for our review the following migraine-inducer:
The Swamp Cooler
Joe took a job as a programmer at a small shop. It was a huge pay cut, but his current employer was locked in a death-spiral of declining revenue, declining collections, and declining sales. It was time to get out, and his local market didn’t have a lot of options.“We’re a small shop, so we’ll need you to help out with general IT stuff,” Joe’s boss, Jimmy, said. By “help out”, what Jimmy actually meant was “be the helpdesk tech, server tech, and if you have time, write some code”. On an average day, Joe’d be running from user desktop to user desktop, installing Excel or removing malware, before hustling to the server room to manually reboot a locked up box, then on his way out the door, he’d push some changes to the company’s website and pray nothing was wrong.That server room was a bit of a problem, and you already know the details. It was a repurposed janitor’s closet, complete with the large sink, which constantly dripped just a little bit, water pipes running along the ceiling, and a smelly French drain in the floor. There were no windows. There was no ventilation. There was no air-conditioning.In April, Joe knocked on Jimmy’s door. “Hey, I’m a little worried about the server room. There’s no ventilation in there- it’s already up over 80ºF (27ºC) today. Come summer, it’s going to be brutal in there.”“Whaaat?” Jimmy said. “We just bought a half dozen more efficient computers for in there. It’s gonna be fine.”“I really don’t think it will. Even this is too warm for safety. I had to prop the door open to get it cool enough.”Jimmy sighed. “Lordy, I’ll put it on the list, and maybe we’ll get something before summer comes ‘round. But I don’t want you proppin’ that door open! That’s expensive equipment, and I don’t want anything taking a walk!”Summer came around. Jimmy didn’t buy an AC unit. It was a warm summer- one day in August it crested 100ºF (37ªC) outside. Inside the server room, it was literally an oven. Joe kept the door open, despite Jimmy’s concerns, but it wasn’t enough. Their primary application server died. It hosted pretty much everything important at the company, from accounting data to their mail server. It crashed and crashed hard, and whatever was wrong, it was definitely a hardware problem.Joe wasn’t surprised that there was no budget to replace the dead server. He had to spread its functions around to a few other boxes in the closet. “Jimmy,” he said, “I’m pretty sure this was caused by heat. We need to get an AC unit.”“Darnit,” Jimmy said, “for that little tiny closet? A whole AC unit seems like a waste, and we’d have to cut a big hole in the wall, and I just think you’re making something out of nothing. But, here’s what I can do. I’ve got a portable cooler I use when I’m workin’ in my garage. I’ll bring that in from home, and we’ll cut a small hole for the exhaust fan.”The portable cooler was a tiny thing, and it couldn’t keep up with the furnace of the server room. A week later, another server succumbed to heat-related trauma and died.At this point, Joe was downright angry. “Jimmy! We need to get an air conditioner for the server closet.”“Durnit, the whole building doesn’t even have an AC. We use a swamp cooler. I’m not buying an AC for just one room! We’ll just turn the swamp cooler colder.”And colder it was. Jimmy cranked it as high as it would go, which meant regardless of the temperature outside, the building was 55ºF (13ºC). Several of the employees brought winter coats from home and left them at their desks to try and keep warm during the day. With the entire building that cold, with the portable cooler, and with a fan, Joe was able to get the server room down to a reasonable temperature.Joe was pretty surprised when another server died. He rushed to the server room, and found that it wasn’t beastly hot- it was actually a reasonable temperature. He was ready to write it off as lingering damage from the heat, until he pulled the server from the rack.Jimmy, as promised, turned the building’s cooling system- its “swamp cooler” up. A swamp cooler is a very efficient cooling system suitable for drier climates. Unlike an air-conditioner, which uses refrigerant and a compressor to create cold temperatures, a swamp cooler simply pulls dry air across water. The water evaporates, removing some of the heat from the air, while simultaneously adding humidity to the air.That cold, moist air was blowing into the server room, which was a disused closet with exposed water pipes cutting across its ceiling. The pipes were much cooler than the server room’s air, so that moisture condensed on the pipes, then dripped.Joe was not pleased to find the server was wet. Fortunately, it was only the power supply that was actually damaged, and through some miracle, the short didn’t damage anything else. He replaced it with one of the overheating victims’ power supplies and got the server back in service- but not before moving the rack away from where the pipes were dripping.Joe didn’t stick around much longer. He left a few weeks later, and despite his warnings, Jimmy never did buy an AC. As far as Joe knows, every employee still wears coats in the summer.[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!
CodeSOD: The Monthly Report
“Karen, you need to run the monthly report while Ivan is on vacation,” Bruno asked.“Wait, isn’t that just a scheduled job?”“No. It’s old code, and we don’t trust the scheduling systems, and if anything goes wrong how do we know and…”“Well, I guess I can run it, then,” Karen said.“Great, you’ll need to restore the financials database from backup onto your local instance, then run the reporting tool in local configuration-”“Wait… why?”“Why? It’s too heavy a job for our production server!”Karen followed the instructions. She spent a few hours waiting for the database to restore to her local developer instance. She fired off the job and waited another few hours while it ground away doing whatever it was doing. Finally, it quit, leaving behind a 40MB CSV file as its monthly report.At this point, Karen wondered- why did that take so long?. Curious, she extracted all the SQL queries and profiled them. They ran in seconds, and unless there was a poorly designed loop she hadn’t noticed, it wasn’t the queries that were making it slow. Her next guess was that it was the file IO that was slow- but how could that be? How hard was it to write a string of text to a file?
Bidding on Security
Let's talk about Javascript.Like just about every modern language, Javascript is based on C-syntax. That means when you look at a piece of Javascript, it should look pretty familiar: braces to denote block scope, semicolons to terminate lines, square brackets for arrays and dot notation for objects. The usual stuff.Javascript, however, is a scripting language. Like most scripting languages, it's weakly typed. Extremely weakly typed. Thanks to late-night Comedy Central, the Javascript community has come up with two words to replace the usual concept of true and false: truthy and falsy. A non-empty string is truthy, while an empty one is falsey. A defined variable is truthy, while an undefined variable is falsey. Pretty straightforward stuff. You can check for yourself; pressing F12 should provide you with a Console (or, as Rubyists would call it, a REPL) where you can follow along.But that's not all. Not only can you evaluate anything as a boolean, you can evaluate any expression as any type at all with a few handy tricks. Pop quiz: What is the value of [] as an integer?...wat?
Error'd: Getting More than you Bargained for
Ygor L. wrote "Awesome! Git found three more files than I thought that I needed."
Tales from the Interview: The Triple Threat
Interviews are bidirectional in that you are supposed to be culling as much information about the prospective team, co-workers and management as possible, in the same way that they are trying to size you up.There are all sorts of interviewing styles; the reasonable back-and-forth conversation that actually allows you to learn about each other, the written test to see if you can do a ten line program that you had as a homework assignment back in CS102, the keep-guessing-until-you-come-up-with-the-solution-I'm-thinking-of torture test, and so on. However, this tale centers on an interviewer trying so hard to come up with the perfect question, that not only was unanswerable, but there was no way for the interviewer to judge if any answer given was correct.Adam had an interview for a developer position with a cable and networking company a while back. It was a fairly standard interview; three guys asking various questions ranging from past experience and schooling to technical questions. They did however seem to have a problem with his degree. You see, Adam had a Bachelors of Science with three majors. Yes, three majors; Math, CS, and English. Normally people are either surprised or impressed, but never before nor since has he actually been questioned about it so thoroughly.It seems that none of the three people that interviewed him believed that he had three majors. They seemed to think that he had a major and two minors, or a major with two focuses. They grilled him a little about how many and which classes he had to take to get these "majors". So he was really a math guy that took a few programming and English classes right? Every few questions, the topic circled back to his majors.Although he was able to answer their technical questions, it should have been clear that having a CS major qualified him for the job, but they seemed obsessed to make sure that he had really had three majors.Finally, one of the guys dropped what has come to be known as "the bomb" on him. It was by far the single most ridiculous and impossible question anyone has ever been asked at an interview. They had received his resume a few days before, and apparently liked it. The interviewer told Adam that it took him a few days to come up with a question to really find out if he really did have three majors, and then let fly with his ultimate creation:
CodeSOD: Hero on the Half Shell
Melissa’s co-worker needed to write some Python code to kill an external process. There are some third-party modules, like psutil that can solve that problem, but companies like Initech tend to put lots of obstacles along the path of bringing third-party code into your applications.Without third-party tools, you’re stuck “shelling out”. Using built-in Python functions like os.system or the subprocess module. This lets you run commands like ps and kill from inside of your Python program. It’s inelegant, but it works just fine. There’s certainly nothing wrong with it.Melissa’s co-worker saw the inelegant solution, and said to themselves, “Can I make that more ineleganter?”This code searches for every process that’s a “server” for their application, and then kills them.
Thrilling Tales of Software Development: The Eighth Man
Today, we bring you another hastily-drawn, stick-figure video that recounts a true tale of requirements gathering and software development. Remember: gathering requirements is hard.
CodeSOD: Random Ruby
Peri, the new intern, was proving her worth as a programmer rapidly. She was great with finding clever solutions to problems, and she didn't bother the more senior devs too often while doing it: a boon, as they were trying to get their own work done.So when Steven assigned her a simple task—generate some unique IDs for repeated dynamic elements so the automated test team could keep track of which ones were which—he figured she didn't need any hand-holding."Good news!" she reported a few days later. "I completed that task you assigned me easily, ahead of schedule, and in only a single line of code." She preened, clearly proud of her work.Steven, who had long since moved on to other things, smiled at her. "That's great, Peri! I'll get you another ticket in a few minutes, after I approve your pull request."Peri skipped away happily.Steven finished the line he was on, pulled up Stash to skim over the PR—and stopped short.You see, the thing about Ruby is that you can do a lot in a single line of code. It's very compact and expressive that way. So when Peri said she'd written only a single line, well ...
Error'd: Questionable Judgement
"Definitely memorable, but I'm not so sure about the question," writes Shish.
CodeSOD: Authorized Users
“Hey, since Jack quit, you could add Jane to the investigation users?”William M supported one piece of a large, complicated intranet application used by auditors as part of investigations into “events” within the organization. The overall audience is small, and the purpose of the application is mostly to document the process of the investigation. Since it’s so niche, it doesn’t even have a screen for managing user accounts- the users raise a ticket and rope in developers to manage it.The developer in charge of the secure portion of the application- Rick- was busy, so William caught the ticket. He wasn’t sure what to do, so he shot an IM over to Rick.“Oh, it’s easy,” Rick replied. “Just update Jack’s record with Jane’s user info. That’s the easiest way, since Jack quit.”That didn’t seem like a smart process, but William was in a rush and this was Rick’s baby, so he just followed instructions and closed the ticket. Jane re-opened the ticket- she couldn’t access the audit compliance tracker. Jack had never used that page, but Jane planned to.Rick was still busy, so William decided to take a look at the authorization process. He found this code in the main-menu screen of the application.
Website Hacker
An investment bank had just completed development on a new digital retailing platform. Daniel was assigned to a cross-functional automated test team, gearing up to test the platform's web application—or at least trying to. Charlie, a veteran manual tester from QA, had been vocal in his opposition."Automated tests need to be tested themselves, which means the testers need to test the tests, so automation doesn't save anything. If anything, it creates more work! Besides, we should always be striving to recreate the user experience as closely as possible!"Daniel and the other developers insisted that manual testing was valuable, but automation needed to happen too. The conflict marched up the org chart, culminating in a meeting with Charlie's boss, Daniel's boss, their bosses, their bosses' bosses, all the way up the org-chart to where these branches of the organization finally joined.The verdict was handed down. Charlie was appointed the leader on testing the web application, running through the same test cases in a manual fashion to catch any problems that fell through the cracks.The team—developers, QA, and a tech lead—all abandoned their cubes to huddle together in a large conference room. Everything went smoothly until one afternoon, when Charlie piped up with the nervousness of one staring down a cobra poised to lash out."Fellas? I don't know how I did it, but I hacked into the website somehow. I see all of the code."The people seated closest to him glanced up from their work to trade frowns."What do you mean?" Daniel asked, glancing across the table at Charlie."I'm in the browser, and I can see all of the code!" Charlie explained. "I've hacked into the website. I see stuff like, 'div class equal sign—'"In other words, the HTML source. Those who were listening in burst into relieved laughter, prompting everyone else in the room to quit their work and pay attention to the faux emergency.The far more patient tech lead bit her bottom lip to hide her grin. "Charlie, it sounds like you opened the developer tools in Chrome by accident. Press F12, it'll go away."Charlie hunted down the key and pecked it with a single loud stroke. "OK, it's gone," he said as though he’d just diverted a nuclear strike. His gaze swept over the room with a mix of urgency and confusion. "I'm still really concerned. That shouldn't happen!""It's supposed to do that," Daniel explained. "Go to any website you want, you can do that on any of them.""What?!" Charlie flipped to a different browser tab, then pressed F12 again. "What?! No!"Another burst of laughter drowned out his concern."Check out the leet haxxor here," one of the developers cracked."Step away from the computer, Charlie, before you hack the whole Internet!" another developer commanded, pointing a finger-gun at the hapless tester."Charlie, it's just—" Daniel tried to say."We can't keep using this browser!" Charlie declared. "I'm raising a defect for this!""All browsers have something like that for debugging purposes," Daniel explained. "It's not just Chrome."But as the giggles continued around him, Daniel's plea seemed to fall on deaf ears. Charlie tabbed over to their bug tracker and took to some furious hunting and pecking.Daniel shook his head. Let Charlie log his defect if it made him feel better. Surely no one would take it seriously.Unfortunately, QA heads and project leads took "security threats" very seriously. The conflict escalated up through bosses, bosses' bosses, and eventually, the verdict was handed down. To avoid exposing code to users, further web development and testing involving Chrome was suspended company-wide.[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: Safely Configured
Configuration files are, well… files. File operations are “risky”- there’s a lot of reasons why they might fail, and we have to be prepared to handle those execptions.For example, maybe you’ve written an application that reads a configuration file at launch. If, for some reason, it failed to load that config, you’d need to deal with that. If the configuration were just some minor settings, you might choose to fallback to some reasonable defaults. If, on the other hand, the configuration contained important security settings, you would probably want to quit the application, or maybe fallback into some “safety” mode.Patrick U. assumed that was how the NodeJS application he was working on behaved. Then, one of his fellow developers pushed their latest release into production. He went to log into his admin account, and found his password didn’t work- because it had been mysteriously changed to the incredibly insecure “admin”. After a little poking, he found someone had left off a closing-quote in their JavaScript configuration file, and that solved the problem. But why did his password get changed when the config file was broken? Well, this code was responsible for loading the file:
A Laser Storm of Family Fun
Ben was half of the two-man IT department at Bob’s Family Fun Center. It was a popular local place for kids and adults alike to come get wild in go-carts, blast each other in laser tag, and spend copious amounts of tokens to win cheap plastic crap with tickets from arcade games. Bob the owner employed his nephew Ted as the “head of IT”. All it took to qualify Ted for the job was helping Bob out with a home computer problem once.Ted didn’t actually do a whole lot around the Fun Center, but he complained to his uncle enough to hire some help. Ben was fresh out of college with a networking degree, Ben figured he’d get some real-world IT experience at the Fun Center while maybe getting some free go-karting out of it.Upon starting, Ben was intrigued by the network setup Ted had. While strange, it worked. The network had to support the handful of office computers, point-of-sale terminals, a printer, the free customer wi-fi, and a system known as “Impale” that handled all the debit card transactions on the games.At the heart of everything was an excessive-overkill Dell enterprise server in a wooden rack Ted proudly built himself. “Pretty cool, huh?” Ted asked as he showed off his handiwork to Ben. “I spent so much of the budget on this beast of a server, I didn’t have enough left over for a proper rack. So I took matters in to my own hands!” The rack was clearly constructed out of leftovers and scraps from the plywood obstacles installed in the Laser Tag arena, and it wobbled worryingly when anyone walked past.“Sure, Ted, that’s great…” Ben lied as he deduced that even a 1000 person laser tag match with 50 categories of stat tracking couldn’t tax this server. As for the rest of the network topology, that was apparently a budget afterthought as well. The ISP line came in to a small, aging 10/100 router that in turn ran to an equally old switch. A cable in the switch ran to one of the server’s NICs. Everything but Impale depended on this router and switch for network connectivity. The other NIC on the server ran to the dedicated Impale server, which had all the games and registers talking to it. It was certainly not an ideal setup, but it sufficed.One Monday, Ted came in to tell Ben that his uncle was complaining about the Fun Center’s phone service at a family gathering over the weekend. Looking to be helpful, Ted came up with a solution, “You see, Ben, I devised a way to cut the phone company out of the equation completely! I heard about this thing called Voicing on IP, or VOIP. We can cut our phone lines, and do all the calls over the internet!”“Uhh, yeah. It’s actually Voice over IP,” Ben corrected him. “I’m familiar with that. If you want to utilize that I can help get it set up.” Ben gave their ISP a call that afternoon and scheduled a tech visit for the next week.The tech predictably arrived towards the latter part of his estimated 4 hour window. Ben and Ted escorted him to their “network closet”, which was really just a small closet that housed their IT equipment as well as a helium tank for blowing up balloons. The tech started running a line for the phone service when he came across the router it was to be hooked in to. “Well now, that won’t do,” he observed. “That router’s older’n dirt. So’s that switch. Won’t support them blazin’ speeds we got. You gon’ have to git a new’un.”Ted began to get upset at the thought of old Uncle Bob taking the “fun” out of Fun Center if they didn’t get the phones upgraded that day, like he’d promised. “There HAS to be something we can do! What if we run out and get a new router right now??”“Now son, I gots more appointments to get to,” the tech said, eager to leave. “Tell ya what. Since y’all seem like smart guys, I’ll leave this here cable for ya,” he handed the loose end to Ted.“ Go’n get yer new equipment and plug this sucker in along with the rest of them devices and you’ll be good to go!”“I got this!” Ted shouted, before he ran away to the front counter. The tech saw himself out before Ted came back with a wad of cash he took out of one of the front registers. “Ben! Run to Best Buy quick and get the finest router you can afford with this. Bring it back and I’ll get us hooked up and my uncle will be pleased when we have our phones on the internet!”“Um, Ted. You do realize we need new phones that support VoIP too? We can’t just use these old analog ones,” Ben informed him.“Crap! I’ll be right back!” Ted exited again, and returned with another wad of cash. “Get some phones too! Now go!”Two hours later, Ben returned with the gear. “Good, you’re back!” Ted greeted him in the parking lot. “You go get the phones set up, I’ll take care of the router!”Ben did as ordered. He went around and disconnected the old phones 1 by 1 and got the new ones ready to connect to the WiFi. As he was installing the last one at the front counter, he noticed the touchscreen register was frozen. He tried using it to no avail, so he did a hard reboot. It came back up but froze again. The other registers exhibited the same behavior. A mother suddenly came from the game room with her crying kid in tow. “This place is terrible! None of these games work right! They don’t do anything when I swipe my card! You’ve ruined my son’s birthday!”The lady stormed off just as Ben realized that all these problems had to be related to what Ted was doing. He ran to the back room to find Ted sitting there admiring the new gadgets he hooked up. “All set, Benny! Are the phones ready?”Ben ignored Ted as he saw the network/helium closet lit up like Christmas with constantly blinking lights on every port. The Impale server, normally almost silent, kicked its fans into full gear. The PC they used to administer Impale was frozen solid like the registers. “Ted! What did you do???” Ben questioned, starting to panic.“What? I did like the guy said. Plug the cable in to the new router, then plug in all the other cables.” Ben quickly inspected his work. He started tracing each cable to where it ran, when he made a gruesome discovery. Somewhere in the shuffle, Ted ran not one, but two cables from the router to the switch. This caused a massive broadcast storm that crippled anything connected to the network. Ben quickly removed one of the cables and everything started getting back to normal.Ben tried explaining to Ted what happened but it went in one ear and out the other. “Whatever, Ben. It’s working now. Let’s go play some laser tag!” Ted didn’t seem to care that he temporarily turned Bob’s Family Fun Center in to Ted’s House of Horrors.[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!
Error'd: The Errors Mean that it's Working
"After all, it's the courage to install that counts," writes Aaron
CodeSOD: Unselected
In the movie Man of the Year, Robin Williams plays a Jon Stewart-esque comedian who runs for President of the United States. He wins the general election due to a programming glitch in some e-ballot machines deployed nationwide.In Belgium, as Adrien F. can attest, this very nearly happened.The city of Brussels has used electronic voting since 1994. Delacroy Europe implemented the first electronic ballots for the city; the firm developed their e-ballot program in C, which ran on floppy disks and stored votes on plastic cards using magnetic strips. Every year the firm would introduce little tweaks to make their system easier to use, but it was showing its age.On May 25th, 2014, Belgium held elections for many EU and national parliament seats, as well as some local contests. The next day, election officials noticed some irregularities with votes cast in Brussels using Delacroy Europe’s program.About 2000 votes had to be voided, as they contained multiple votes for the same office from different parties (called ‘lists’ in Belgium). It wasn’t enough to sway any one election, but the media had already caught wind of the potential voter fraud. Adrien’s company was hired for an independent code review of Delacroy Europe’s voting program to determine if anything criminal had transpired.First, Adrien ruled out users manually rewriting data to the magnetic strip on the ballot card. It would require a credit card reader, which would have been difficult to smuggle into a polling place, and unlikely to happen on the scale of 2000 ballots or so. He suspected the problem was in the code.He noticed something strange in the UI selection functions, triggered when the user selects a candidate on the viewscreen. Parliamentary ballots were organized by lists that a user picked from. Cand_Check_Selection() determines if a candidate was checked, and if so, whether to select or unselect them (either Cand_Select() or Cand_Unselect()).
Overpowered
Mike had a different perspective on wiring and cable management- because he worked at a factory which made wires and cables. It was the early–90s, and he was in charge of babysitting a couple of VAXes and their massive, 85lb hard drives. It was an easy job: the users knew the system and needed very little support, the VAXes were practically unstoppable, and the backup battery system could keep the entire thing running for over an hour.The computers supported HR and accounting, which meant as the year ticked towards its end, Mike had to prep the system for its heaviest period of use- the year end closing processes. Through the last weeks of December, his users would be rushing to get their reports done and filed so they could take off early and enjoy the holidays.Mike had been through this rodeo before, but Reginald, the plant manager, called him up to his office. There was going to be a wrench in the works this year. Mike sat down in Reginald’s cramped and stuffy office next to Barry, the chief electrician for the plant.“Our factory draws enough power from the main grid that the power company has a substation that’s essentially dedicated to us,” Reginald explained. “But they’ve got a problem with some transformers loaded with PCBs that they want to replace, so they need to shut down that substation for a week while they do the work.”The factory portion was easy to deal with- mid-December was a period when the assembly line was usually quiet anyway, so the company could just shift production to another facility that had some capacity. But there was no way their front-office could delay their year-end closing processes.“So, to keep the office running, we’ll be bringing in a generator truck,” Reginald said. “And that means we’re going to need to set up a cut-over from the main grid to the generator.”From the computer-room side, the process was easy, but that didn’t stop Mike from writing up a checklist, taping it to the wall beside his desk and sharing a copy with Barry. Before the generator truck arrived, he’d already tested the process several times, ensuring that he could go from mains power to battery and back to mains power without any problem.The generator truck arrived a week before the changeover. The electricians ignored it for a few days. Just as Mike was starting to get worried about deadlines, he looked out a window and saw a trio of electricians, lead by Barry, starting to connect cables to it. Later that day, when Mike left to go to lunch, he walked past the generator truck, and noticed something odd about the cables- they were clearly single phase power cables.Typical residential power systems are single-phase alternating current- one peak, one trough. This creates “dead” moments in the cycle, where no work is being done. That’s fine for residential use- but industrial systems need three-phase power- three offset AC cycles that, when added together, guarantee current is always flowing.“Hey,” Mike said to one of the electricians loitering near the truck, “you’re planning to run some three-phase cabling, right?”“Nope. The factory’s shut down- this thing is just gonna run lights and heating.”“And computers,” Mike said. “The hard drives need three-phase power.”“We’ll have to order some parts,” the electrician said.A few more days ticked by with no three-phase connections, and Mike checked in with the electricians again.“The parts are coming.”At this point, Reginald came down from his office to the computer room. “Mike, Barry’s telling me you’re being a disruption.”“What?”“Look, there’s a chain of command,” Reginald said. “And you can’t tell the electricians how to do their job.”“I’m no-”“From now on, if you have any concerns, bring them to me.”The day of the cut-over, the three-phase cabling finally arrived. Barry and his electricians quickly strung those cables from the generator. Mike wasn’t exactly watching them like a hawk, but he was worried- there was no way they could test the configuration while they were working so hastily. Unlike single-phase power, three-phase power could be out-of-sync, which would wreak havoc on the hard drives. He thought about bringing this up to the electricians, but recalled Reginald’s comments on the chain of command. He went to Reginald instead.“Mike,” Reginald said, shaking his head. “I know you computer guys think you know everything, but you’re not an electrician. This is a factory, Mike, and you’ve got to learn a little about what it’s like to work for a living.”Now, the electricians and Mike needed to coordinate their efforts, but Reginald strictly enforced the idea of the chain of command. One electrician would power on the generator and announce it, “Generator’s running.” Another electrician would relay this to Barry: “Generator’s running.” Barry would relay that to Reginald. “Generator’s on.” Reginald, finally, would tell Mike.
CodeSOD: Keeping Regular
Regular expressions can create new problems. Like an industrial drill, they’re extremely powerful- and potentially destructive. They’re expensive, they’re cryptic, but can be extremely concise.For example, Jessica is reimplementing some C# code written by another developer. This developer was never interested in being concise, and instead favored being “clever”. For example, this developer had an array of strings, and needed to remove any non-word-characters from each string.A regex-based solution might include something like “[^\w]” which is obviously incomprehensible nonsense that no one could be expected to understand without piles and piles of documentation.Jessica’s co-worker wrote something far more… elegant.
Just Check The Notepad
As the last deployment script ran to completion, Michael sat back in his chair and let out a small sigh of relief.He knew nothing could go wrong. After all, he'd rehearsed every step of the process hundreds of times during the last six months. But deploying his projects to production always made him as nervous as a highschooler before a drama club premiere.However, the rollout was nearly complete, and Initech's Hyderabad branch was all set up and ready to enjoy their new, polished and improved inventory management system. All that was left was to log into the application for the last sanity check and celebrate the success with his team.Michael opened the browser, typed in the server address and hit Enter, expecting to see the familiar portal.Instead, a standard, white-and-red ASP.NET error page stared back at him.A few minutes of digging around the Hyderabad servers exposed the problem. While all the local applications were configured to use Windows logins to connect to the database, the overseas branch used simple SQL Server authentication with a constant login and password. After a bit of back and forth, Michael was armed with contact information to Hyderabad's database administrator, and set off to resolve the issue.Hi, it's Michael from Initech Seattle, he typed into his Lync window. Can I get a database username and password for the inventory management application?A few minutes later, the reply arrived. Expecting just the username and password, Michael was ready to say thanks and get back to fixing his problem ... but the DBA had a different idea.Sure, just check the Notepad on the server.You mean a text file? Michael responded, somewhat confused.Yes, it's open now, just check your screen.Michael went through all his open Remote Desktop sessions, but none of them had a single text file open. The only programs running were the ones he'd started himself.I don't see it, can you tell me the filename and the directory? He decided to play along. After all, maybe there was some security-related reason why the DBA couldn't send the credentials over IM.It's in the Notepad, the DBA responded. Just check it.No, it's not! Michael was growing a bit irritated. He took the screenshots of both the database and application servers' desktops and attached them to the message, hoping that would finally convince the DBA he wasn't going crazy.After a long while, the DBA finally wrote back. You're on Remote Desktop. That's different. Can you just use TeamViewer?"Are you serious?" Michael asked out loud, but the will to resolve the issue as soon as possible overcame the urge to chew out the clueless administrator. He downloaded the software, sat through the installation process, then typed in the TeamViewer ID.A connection could not be established."Of course," Michael muttered.A quick call to system administrators confirmed Michael's fears: the company firewall blocked all TeamViewer connections. Gaining access meant submitting an exemption request and letting the bureaucracy take its time to process it. The process usually required several days, and the rollout couldn't wait that long.Facing a dead end, he tried to explain the situation to the DBA.I can't get on TeamViewer. Can you please just tell me the username and password for the SQL Server? It would really save us a lot of time!!He sat back in his chair and waited, eyes glued to the IM window. His hopes weren't high, but maybe he'd at least get an excuse to present to his boss.Instead, the reply came:Username: dba, password: rosebud. Let me know if I can be of any further help.It was all Michael could do not to slam his head against his desk. After careful consideration, he decided to pass on the DBA's kind offer.[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: An Unusually Childish Debate
"Hilarity ensued when, during a recent political debate, the subtitles used by the Swedish state television came, not from authorized subtitlers of the debate, but rather the neighboring children's channel," Jonas writes.
CodeSOD: Log of String
The English language contains words with multiple and often contradictory meanings. A dress, for example, is only one of many items you could put on while dressing yourself. Meanwhile, if you want to wear pants instead, you should avoid pantsing yourself, as that would be counter-productive.These shades of meaning come into play frequently in programming. Writing a .NET application to manage school schedules requires some contortions to avoid using the reserved word class, and writing one to hold Dungeons and Dragons character sheets requires you to spell out the attribute Intelligence instead of using the far more common abbreviation int.Dimitris, however, wasn't thinking about the many interesting tidbits to be found in the English language as he went about tracing an error message through the stack his formula engine application had unraveled. Instead, he was thinking about logging. Not the act of felling trees and preparing their corpses for use by humans, but the act of writing messages to a central location so that debugging an application would be easier.Logging has a fascinating etymology, by the way. It originally had to do with a bit of wood that was designed to float upward when a ship sank, making it easier for someone to discover what had befallen the ship by reading its log. In the same manner, Dimitris wanted to discover what had happened to the application—but he got distracted along the way.
...42434445464748495051...