Usul is taking a college course on Java programming, and it’s doing an excellent job preparing him for the real world. Already, he’s been forced to cope with someone who knows one true fact and has run off to apply it in the dumbest way possible. This would be his professor.Our true fact is this: A Java PreparedStament object, used for running database queries, should be closed after use. This returns its connection to the pool and frees any resources the statement was using. You should do this, and you should do it as soon as you’re done with your connection.Now, putting a call to stmt.close() in every finally block was just too much for Professor McCloseypants to deal with. So he provided this “convenience†object to deal with that problem.It’s a lot of code, so we’re going to do this in pieces. First, let’s look at the declaration:
David was recently hired on to head the company’s development team. This was a brand-new position; previously, William, the company’s IT Manager managed the developers directly in addition to his other duties.While getting his workstation set up, he was unable to install the FileZilla FTP client. It was completely blocked via domain policy. Finding this very strange, David talked to the IT Manager and hoped there was a legitimate reason.“FTP is a big security risk,†William explained. “We got hacked through FTP once so I firewalled it by blocking FileZilla installation with Group Policy.†David began to suspect that things at the company were not quite right.“Um, Group Policy isn’t a firewall,†David tried to explain. “And blocking an FTP client installer is unlikely to have an effect on network security.â€William clearly didn’t understand and doubled down on his incorrect ideas. “Trust me, it works,†he said. David soon gave up and simply installed a different FTP client–which worked just fine despite FTP being “firewalled.â€Later, while familiarizing himself with the business’s core applications, David decided to examine the company’s main database server. “It’s set up with RAID 10 for the best performance,†William explained. RAID 10, sometimes called RAID 1+0, mirrors all data into two arrays for fault tolerance, and then each array is striped onto additional disks to greatly improve read/write performance. It’s one of the fastest RAID configurations and a great fit for database servers.But David ran a disk benchmark and was not convinced. “That disk I/O is way too low for RAID 10,†he explained. “Can you show me the configuration?â€â€œOf course,†William replied. “It has to be RAID 10. We ordered it that way.â€They opened the RAID manager for the system, and sure enough the system was not running RAID 10. “Um, this is RAID 5,†David explained. RAID 5 uses three or more disks for striping, but the capacity of one disk is lost for storing parity data which allows the array’s data to survive a single-disk failure. Due to the required parity calculations, RAID 5 writes are not nearly as fast as RAID 10, which is bad for an I/O bound application such as the company’s main database server.“That can’t be,†William responded. “Oh, I know…Kieran must have changed it!†He called the company’s so-called systems administrator to the room, and David endured the uncomfortable exchange as William hurled wild accusations. “I know we ordered this system with RAID 10! Why did you change it?â€â€œI just unboxed it and racked it,†Kieran responded. “Whatever RAID level it has is what it was shipped with.â€â€œThat can’t be true! You tampered with it!â€Kieran rolled his eyes and turned to leave. “I have real work to do elsewhere,†he rudely explained as he excused himself from the conversation. Later on, he sent an email to both David and William which contained the original Purchase Order for the server. The PO clearly showed that William had specifically requested RAID 5 for the server.David found himself wondering if management was aware of William’s behavior and general incompetence, but tried to avoid making waves during training. But the final straw came when he set about installing several of the company’s internal applications and was unable to find any installers on his own. Once again he went to talk to William.“Oh, we don’t install any of our applications. That’s too slow!†he explained. “Instead, look at the database server. It has a shared folder called ‘APPS’, and just map that as a network drive and run everything from there.â€Once again, David found himself doubting the IT Manager’s wisdom. “Doesn’t it hurt our database performance to have the entire company mapping a network drive to the same RAID array as the databases?†he asked.“Oh no,†he replied. “It actually makes it faster. The apps can talk to the database much faster if they’re running from the same server!â€David was stunned by William’s poor understanding of how network-mapped file systems actually work. “That might be true if it was a terminal server…but the applications still run locally on the end user PCs. The files just happen to be stored elsewhere.â€â€œWhat do you know, you’re still the new guy! We’ve had this procedure in place for years now, and for good reason!â€Despite being a newbie, David decided to approach management about the ineptness he’d discovered, and explained that William was rude, incompetent, and had no business working in IT. To his surprise, management conducted a brief investigation and agreed with him! Shortly afterwards, William was let go.The new IT manager was shocked at the company’s infrastructure and quickly made a range of improvements. This included installing a proper Storage Area Network which greatly improved the database server’s performance; a new storage pool for mapped drives which was on separate disks than databases; and a real hardware firewall which, among other things, actually blocked incoming FTP connections from the Internet.David then forwarded his story on to us at The Daily WTF as a reminder that sometimes things actually do turn out okay in the vast WTF-land that is the IT industry. [Advertisement] Easily create complex server configurations and orchestrations using both the intuitive, drag-and-drop editor and the text/script editor. Find out more and download today!
I have certain mantras that I use to guide my programming. They generally revolve around this theme: "Thinking is hard, and I'm not very good at it; every block of code should be simple and obvious, because if it makes me think, I'll probably screw it up and break something." It's a good rule for me, and a good general guideline, but it's a little vague to implement as a policy.Erika’s company wanted to implement this idea as a policy, so they set a limit on how many lines could be in a single method. The thinking was that if each method was short- say, under 100 lines- it would automatically be simple(r), right?Well, Garret, down the hall, wrote a method that was three hundred lines long. During a code review, he was told to refactor it to simplify the logic and comply with the policy. So he did.
Alan worked for Maria in the Books-and-Records department of a massive conglomerate. Her team was responsible for keeping all the historical customer transaction records on line and accessible for auditors and regulatory inquiries. There was a ginormous quantity of records of varying sizes in countless tables, going back decades.Maria was constantly bombarded with performance issues caused by auditors issuing queries without PK fields, or even where-clauses. Naturally, these would bring the servers to their proverbial knees and essentially prevent anyone else from doing any work.To solve this problem, Maria decided that all auditors and regulators would be locked out of the database for purposes of direct queries. Instead, they would be provided with an API that would allow them to mimic a where-clause. The underlying code would check to see if no PKs were specified, or if a where clause was missing altogether. If so, it would run the query at a much lower priority and the auditor issuing the offending query would wait while the servers did the massive scans in the background, so the other auditors could continue working with a reasonably responsive database.So far, so good.Alan wanted to build a mechanism to query the list of available tables, and the columns available in each. This could be provided via the API, which the auditors' developers could then programmatically use to create the objectified where-clause to submit as part of a query.Maria would have nothing to do with that. Instead, she wanted to sit with each potential auditor and have them define every single query that they could possibly ever need (table(s), column(s), join(s), etc). Alan pointed out that the auditors could not possibly know this in advance until some issue arose and they had to find the data relevant to the issue. Since this would vary by issue, the queries would be different every time. As such, there was no way to hard-wire them into the API.She put her foot down and demanded a specific list of queries since that was the only way to build an API.Alan went to every auditor and asked for a list of all the queries they had issued in the past year. They grudgingly obliged.Maria then went on to design each API function call with specific arguments required to execute the given underlying query. The results would then be returned in a dedicated POJO.Again, Alan groaned that defining a POJO for each and every subset of columns was inappropriate; they should at least design the POJOs to handle the entire column set of the given table, and have getters that represented columns that were not requested as part of a given API query throw a column-not-queried exception. Maria said No and insisted on separate POJOs for each query.Some time later, Alan had finished building the API. Once it was tested and deployed, the other development teams built relevant GUIs to use it and allow the auditors to pick the desired query and appropriate parameters to pass to it.This worked well until an auditor needed to add a column to one of the queries. If Maria had let Alan use table-wide column pick-lists and POJOs that had all the fields of a table, this would have been easy. However, she didn't, and made him create another virtually identical API function, but with a parameter for the additional column.Then it happened with another query. And another. And another.After a while, there were so many versions of the API that the managers of the other teams blasted her choice of implementation (they had to deal with the different versions of the POJOs for each table in their code too) and demanded that it be made sane.Finally, under pressure from above, Maria relented and instructed Alan to change the API to use the pick lists and POJOs he had originally wanted to provide.To implement this required changing the signature of every method in the API. Fearing a riot from his counterparts, he got them all together and offered a two month window during which both old and new versions of the method calls would be supported. This would give their teams a chance to make the code changes without forcing them to drop their current priorities. The other developers and managers quickly agreed to the dual-mode window and thanked Alan.Then a few of the other managers made the mistake of thanking Maria for the window in which to make changes.She royally reamed Alan: "Did I tell you to give them a dual-mode window? Did I? You will immediately pull the old methods from the API and re-deploy. You will NOT email the other teams about this. Get it done; NOW!"Alan had worked very hard to develop a good working relationship with his peers and their respective managers. Now he had been ordered to do something that was downright nasty and would absolutely destroy said relationships.Alan changed the API, ran the tests, and entered the command to deploy it, but did not hit ENTER.Then he quietly went around to each of the other managers, told them what he had been instructed to do and apologized for what was about to happen. He was somewhat taken aback when every single one of them told him not to worry; they had dealt with Maria before, that they appreciated his well-intentioned but ill-fated attempt to be a team player, and that they completely understood.After that, he went back to his desk, hit ENTER, and contemplated asking the other managers if they could use a good developer.[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!
Ah, the grand old Dictionary/Map structure. It’s so useful, languages like Python secretly implement most of their objects using it, and JavaScript objects imitate it. One of its powers is that it allows you to create a sparse array, indexed by any data type you want to index it by.Catherine’s cow-orker certainly thought this was pretty great, so they went ahead on and used the Dictionary to map interest rates to years. Years, for this application, were not tracked as actual years, but relative to an agreed upon “year zeroâ€- the first year of the company’s operation. There was a new annual interest rate tracked for each year since.If you’re saying to yourself, “wait… this sounds like a use case for arrays…â€, you’re onto something. Pity you didn’t work with Catherine. You probably wouldn’t have left this behind:
Dima had just finished her Masters in electrical engineering, and was eagerly seeking out a job. She didn't feel any particular need to stick close to her alma mater, so she'd been applying to jobs all over the country.When the phone rang during lunch hour, she was excited to learn it was a recruiter. After confirming he had the right person on the phone, he got right down to business: "We saw your resume this morning, and we're very impressed. We'd like you to come out for an on-site interview and tour. What's your availability next week?"Dima agreed. It was only after she hung up that she realized he'd never given his name or company. Thankfully, he sent her an email within ten minutes with the information. It seemed he was representing DefCo, a major defense contractor with the US government. This would normally be worth a look; it was particularly interesting, however, because she'd only submitted her resume about an hour and a half prior.They must be really impressed, she thought as she replied to confirm the travel arrangements. It'll be nice working someplace large that doesn't take forever to get things done.A week later, Dima hopped out of the cab and made her way into the building. Wrinkle number one immediately presented itself: there were at least twenty other people standing around looking nervous and holding resumes.I guess they interview in groups? she wondered. Well, they're clearly efficient.As Dima waited to tour her first top-secret manufacturing plant, she made small talk with some of the other candidates, and hit wrinkle number two: they weren't all here for the same job. Several were business majors, others had only a high school diploma, while others were mathematicians and liberal arts majors.Clearly they're consolidating the tour. Then we'll split up for interviews ...?The tour guide, a reedy man with a nervous demeanor and a soft, timid voice, informed them that interviews would be conducted later in the day, after the tour. He walked them down the hallway.Dima kept close to near the front so she could hear what he was saying. She needn't have bothered. As they passed the first closed door, he gestured to it and stammered out, "This might be a lab, I think? It could be one of the engineering labs, or perhaps one of the test facilities. They might even be writing software behind there. It's bound to be something exciting."This went on for the better part of two hours. They passed locked door after locked door, with their guide only speculating on what might be inside as he fidgeted with his glasses and avoided eye contact. Finally, he declared, "And now, we'll tour the test facilities. Right this way to the warehouse, please. You're going to love this."Wait, he didn't hedge his bets? We might actuallyseesomething today?! Dima knew better than to get her hopes up, but she couldn't help it. It wasn't as though they could get any lower.They were let into the warehouse, and their guide took them straight toward one particular corner. As they crowded around what appeared to be an ordinary truck, their guide explained its significance in hushed, breath-taken tones: "This is the system upon which our new top-secret mobile Smart-SAM and cross-pulsed radar will be mounted. Soon, this will be one of the most advanced mobile platforms in the United States!"And soon, it will be exciting, thought Dima in dismay. Right now, it's a truck."This concludes our tour," announced the guide, and it was all Dima could do not to groan. At least the interview is next. That can't be nearly as much of a let-down as the tour.Dima was shown to a waiting area with the mathematician, while the others were spilt into their own separate areas. She was called back for her interview moments later. At least they're still punctual?The interviewer introduced himself, and they shook hands. "Have you ever worked on a power supply, Dima?" he asked, which seemed like a logical question to begin the interview. She was just about to answer when he continued, "Just last week I was working on the supply for our cross-pulsed radar. That thing is huge, you wouldn't even believe it. Of course, it's not the biggest one I've ever built. Let's see now, that would've been back in '84 ..."To her horror, he continued in this vein for fifteen minutes, discussing all the large power supplies he'd worked on. For the last five minutes of the interview he changed topics, discussing sound amplifiers you could run off those power supplies, and then which bands would make best use of them (Aerosmith? Metallica? Dima didn't care. She just kept nodding, no longer bothering to even smile). Finally, he thanked her for her time, and sent her on her way.The next day, Dima was informed that she hadn't obtained the position. She breathed a sigh of relief and went on with her search.[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!
Dan has inherited a pile of Objective-C. That’s not the WTF. The previous developer had some… creative problem solving techniques.For example, he needed to show a splash screen, and after three seconds, make it vanish. You might be thinking to yourself, “So I set a timer for 3000 milliseconds, and then close the splash screen, right?â€
Thanks to a combination of illnesses, travel, timezones, and the other horrors of the modern world, we took a week off. If Angular can skip version 3, we can skip episode 3. Welcome to Episode 4 of Software on the Rocks, brought to you by Atalasoft.In today’s episode, we are joined by TDWTF author Jane Bailey. We talk about the process of writing, the nature of programming, and “programmer anarchyâ€.This episode of Software on the Rocks is brought to you by Atalasoft.MP3Web Player
Sacha received custody of a legacy Python API, and was tasked with implementing a fresh version of it.He focused on authentication first. The existing API used JSON web tokens that, for some reason, never expired. Assignments like expiration=86400 and expiration=3600 were littered throughout the code, but seemed to go ignored.It didn't take long to track down the token generating code and figure out the tokens' source of (near) immortality:
The 80's were a time of great technological marvels. The Walkman allowed a person to listen to music anywhere they went. The Video Cassette Recorder allowed you to watch your favorite movies repeatedly until they wore out. Then there was the magic of Fiber Optics. Advances in the light-blasted-through-glass medium allowed places like Seymour's company to share data between offices at blistering speeds.Bill, the President of Seymour's company, always wanted them to be on the cutting edge of technology. He didn't always know the why or the how surrounding it, but when he heard about something that sounded cool, he wanted to be the first company to have it. That's where Seymour came in. As Vice President of Technological Development (a fancy job title he got for being the organization's only true techie) he made Bill's dreams come true. All he had to do was ask for the company credit card.When Bill caught wind of fiber optics at a trade show, he came back to the office ranting and raving about it. "Seymour, we've got to link the offices up with these fiber optical things!" he shouted with enthusiasm. Since their buildings were a mere three miles apart it seemed like overkill, but Seymour was bored and needed a new project. "I've had it with these slow noisy modem things we use to exchange data! I want you to weave these fibers into our computers. You can start today!"Seymour had to calm Bill down and explain to him what a big ordeal getting set up on fiber would be. Since there weren't any existing lines in town, one would have to be routed underground on the route between offices. Seymour got in contact with local utility and telecommunications companies and the initiative was underway.Fast-forwarding eight months, Seymour's fiber connection was a success. The cranky old modems had been mothballed and were a distant memory. Files and reports were being sent between offices at literal light-speed. Bill made it worth all the trouble with a sizable deposit into Seymour's bank account and his own company credit card. But then one day things went awry.Seymour's phone rang at 6:30 one morning. Bill, always the early arriver, was on the other end in a panic. "Seymour! You need to get here right now! The fibers are cooked and we can't download anything to the other office!" Seymour quickly threw on some clothes and got in his car. His commute took longer than normal because of some irritating utility work slowing down traffic but he was sure he'd have it solved in no time.Upon arrival, he took out his trusty fiber testing kit and hooked it up to one of the pairs. Nothing. He tried the next pair. Nothing. The other 13 pairs yielded the same result. "What in the hell?" he thought to himself, with Bill hovering over his shoulder. Further inspections showed nothing was wrong with their equipment in the building."Seymour, this isn't acceptable!" Bill bellowed to him, growing sweatier by the minute. "First it takes you forever to get here, now you don't have any answers for me!""I'm sorry, Bill. I got here as soon as I could. There was this damned utility work in the way..." Seymour cut himself off as an illuminated fiber light went off in his head. "I'll be right back!" Seymour ran out to his car to drive back the way he came. The route he took to work also happened to share some of the fiber line's route.He stopped at the dig site to find it mostly cleaned up with one construction worker remaining. Inspecting the ground, he found the utility company had done their work spray painting the correct areas not to dig. Green here, for the sewer, yellow for natural gas gas over there, and a communications line there. A new utility pole stood proudly, far away from any of the marked areas.Well, it was a good thought, anyway. Seymour ducked under the pole's anchor cable and started back to his car- then stopped. He looked at the anchor cable, and tracked its end down into the orange spray-paint that marked a communication line. He bent down for a closer look and found shredded bits of fiber optic cable. Bingo. He flagged down the last remaining worker to point it out, "Excuse me, sir. I think there's been an accident. This line here was essential to my company's computer system."The portly man in a hard had sauntered over, unconcerned. "Wut? This here thing? Ain't nothin but a bundle of fishing line some'un went an buried fer some reason. This ain't no computer.""Oh, right... My mistake," Seymour offered a token apology and decided he wasn't going to get through to this particular city worker. He drove back to the office and filled Bill in on the mishap. Bill's anger was quickly channeled into an unfriendly phone call to city hall and within 24 hours Seymour's incredible fiber line was back in service. After all the effort the past several months, a getaway to use actual fishing line for its intended purpose sounded like something Seymour badly needed.[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!
A few months ago, Hannes shared with us some recycled code. In that installment, we learned that one of his team mates has… issues with strings. And naming things. And basic language features.These issues continue.For example, imagine if you well that you have a file. This file contains certain characters which you want to remove. Some need to be converted into other forms, like the letter “G†should become “6â€, and “B†should become “8â€. Think through how you might solve this.
John N supports a C# project that, on first run, needs to initialize a database. It pulls that data from a dbInstallFilePath, controlled by the application .config file. This brings us to our representative line:
John C was a vigilant protector of justice, a dark guardian of a public who didn’t even know he existed, striking fear into the hearts of criminals. Specifically, he did IT support for the local police department. It wasn’t a great job. Their infrastructure was ancient, underfunded, and under-supported. He was expected to provide just as much support for the department’s website as well as their radio system. The customers were a “special†brand of ignorant, and often pretty angry about it. The department provided service 24/7, which meant John was expected to be available at weird hours, and not even for emergencies. Many of his customers only worked night shifts, and he had to support them.At around 3AM, John caught a ticket, entered in by one of the secretarial staff. “Officer Bishop reports her email is brokeâ€. With that cornucopia of information, he called Officer Bishop.“I had a high school student participate in a ride-along,†she said. “He wanted some pictures of what our shooting range looked like for a presentation, so I tried to email them. I emailed them to ‘napoleon dot wilson at hot mail dot com,’ but I got an error message about it was undeliverable.â€â€œWell,†John said, “are you sure the email address is accurate?â€â€œYes!†Bishop said. “It was his first name, dot last name, at hot mail dot com.â€â€œAnd it’s spelled correctly?â€â€œYes!†Bishop said, becoming increasingly indignant. “n-a-p-o-l-e-o-n-dot-w-i-l-s-o-n-at-h-o-t-m-a-l-e.comâ€John chuckled. “I don’t think that’s quite right. I think it’s hotmail, as in postal mail. Like a letter. M-a-i-l.â€â€œI know what email address he gave me,†Bishop said. “He said ‘hotmale’. I know what he said.â€John took a breath and tried a different tack. “The words ‘male’ as in a man and ‘mail’ as in letters sound the same. If he just said his email address aloud, you might have simply heard him wrong.â€â€œI know what he said,†Bishop said. “Do you think I’m stupid? I know what words mean. He told me his address was hot male!â€â€œOfficer, I’m not saying you’re stupid,†John said, summoning every ounce of self-control that he could. “But hotmail, like the letter, is a popular email service. Hotmale, like the restroom, is… um… something very different.â€â€œLook, I know you IT people think you’re soooooo smart, but stop treating me like an idiot. I’ve been a police officer for longer than you’ve been wearing diapers. I know what he said.â€â€œMa’am, can I just get you to try sending an email to napoleon.wilson@hotmail.com, like the letter? Just try it for me?â€â€œHe said hotmale.â€Fine, John thought to himself. It was 3AM, and Officer Bishop was on his last nerve. “Ma’am, let’s try something here. I want you to open hotmale.com in your web browser.†He was the IT person- and thus he knew that there was a lot of porn-browsing on station computers, what was a little more, right?“That’s the little blue E, right?â€â€œYes.â€After a beat, he heard, “ACK!â€John waited a beat, hoping to hear Officer Bishop could finally turn her powerful investigative mind to understand what he had been trying to tell her. Her “ack†segued into a gasp of understanding. John started nodding to himself, happy that Bishop had finally figured it out, now that a gay pornography site was staring her in the face.“Oh, I didn’t know… he’s gay?! He didn’t look gay.â€â€œNo, he’s not- I mean, he might be, but-â€Bishop wasn’t listening to him at all. “Oh, but I guess you can never tell these days…â€â€œNo, try and go to hotmail, like the letter now…â€â€œHey, there’s a link to contact them at the bottom of the site. Maybe we should tell them that their email is broken.â€John looked at the clock- it was 3:15 at this point, but it felt like he’d been working on this ticket for hours. “Okay, actually, so it sounds like the problem must be on their end. Why don’t you do this: start a new email, and send it to admin@hotmale.com. Tell them that you were trying to get in contact with Napoleon Wilson, and include the error message that you were getting, along with the message you were trying to send to Napoleon.â€â€œOkay, I’ll do that, but let me give you a piece of advice- don’t talk to people like they’re stupid.â€â€œI’ll definitely keep that in mind,†John said. “I’m just going to go ahead and close this ticket.†[Advertisement] Universal Package Manager – store all your Maven, NuGet, Chocolatey, npm, Bower, TFS, TeamCity, Jenkins packages in one central location. Learn more today!
Let’s say you needed to initialize a buffer to be 260 bytes long, and they all should be 255. Now, you’re using a high-level language, like C#, to talk to a legacy device, so you might have to jump through some hoops to deal with the device API, but how hard could it be? A better question might be, “how hard can you make it?â€There’s an old saying: “fast, good, or cheap: pick twoâ€. Massimo’s employer doesn’t want to be greedy, so they consistently pick one: cheap, which means they get code like this:
Fresh off an internship, Trace landed his first full-time job performing customer service and administration at a large company.Oddly enough, customer service wasn't the worst part of the job. He barely had time to help customers due to all the tasks required just to tread water in the company's lumbering beast of an ERP system. All day long, he had to click the same buttons, generate the same PDF files, and send the same emails.This drudgery wasn't limited to Trace, either. Everyone in his department, from other young graduates to the most senior reps, performed the same grueling ritual. It'd been devised long before Trace was born, and it was taken for granted—right along with the resultant stress, weariness, and repeated mantra of "I'm too busy right now!"Trace saw no reason why the repetitive process couldn't be automated in some fashion, but Trace wasn't a programmer himself. Undaunted, he scheduled a meeting with his boss to go over his idea."Let's bring in someone who can write a program for this. It'll save lots of time and effort in the long run, which we can then use to help our customers." Trace smiled, excited by the prospect of making a real difference at his new corporate home.There was no crack in his manager's tired expression. "It's not an ideal process, sure, but it works. Besides, we don't have room in our budget to hire programmers."That was the day Trace learned that there wasn't a single sound suggestion in the universe that couldn't be shot down with the words, "There's no budget for that."He returned to his desk, discouraged. Just as he was about to plow back into his paperwork, he had a new thought. Wait, why can'tImake this happen? He wasn't a programmer, but that didn't mean he couldn't learn. Hadn't his college roomate always told him that 90% of his CompSci major came down to how well he phrased his Google searches?During downtime and after work, Trace began to teach himself how to code. At first, he'd learn operations and then copy/paste them like mad—he hadn't learned loops yet—but over time, the program gained sophistication. It could click buttons, create PDF files, send emails, and lookup and consolidate important information.It was time to show it to the team. Trace spent a few coffee breaks approaching people at their cubes, demonstrating his achievement. "Isn't this great?"Some of the newer coworkers saw the benefit at once. The more veteran employees frowned with confusion, scorn, or outright fear."Are you trying to get us all fired, kid? If you show this to management, we're screwed!""I don't have any control over this!""My way works for me!"Trace reluctantly left these folks to keep clicking the same buttons, generating the same PDF files, sending the same emails, and making the same old tired complaints about their workload. He learned another important lesson about how easy it was to become complacent with, and even dependent upon, the status quo.With that lesson firmly in mind, he spent his free time deepening his programming knowledge, refining his existing code, even throwing in a few loops. It paid off as his daily administrative chores became a matter of clicks rather than hours. Customers gave him great feedback because he had time to give their issues the attention they deserved.Over time, Trace climbed the ladder with promotions, and quietly shared his program with each new hire. Whenever they suggested process improvements of their own, he made sure to listen.[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!
We get a lot of bad date code samples. Since we all learned to read a calendar in elementary school, everyone assumes they actually understand how dates work, and then tries to codify that knowledge in code. Bad date code is like entry level awfulness, and it takes a lot to surprise me when I see bad date handling code. Mike R knows how to do it, though. He found this code buried in a 30+ file commit, with the helpful commit message, “asdf;â€:
Snoofle's tale is a little different than our usual Tales From the Interview, but these kinds of negotiating tactics are TRWTF. -- RemyAfter more than 3 decades in our field, I find my self in the position of being able to afford to retire, but not yet actually ready to retire. This is partly due to the fact that my wife still wants to work. While walking off into the sunset together seems enticing, biding my time until she's ready seems somewhat boring (for the unmarried, having too much fun while she's still at work, even by her choice, is not conducive to marital bliss).Once you realize that you've cleared the financial hurdles where the big bills like college tuition and the mortgage are paid and retirement is funded, your priorities at work change. For example, when you need to pay tuition and a mortgage, you are willing to put up with a certain amount of stupidity so that you can take care of your family. Once those bills are paid, your tolerance for idiocy shrinks quite a bit. To that end, I left my last job - for the first time - with no job to go to.While I'm waiting for my wife to decide to join me, I've decided that taking another job could fill the time. Since I no longer need the money, however, my criteria for taking another job are far more stringent than usual. Specifically, no more managers who offer randomly chosen delivery dates without taking the amount of work into account. No more places that deploy directly to production. No more tolerance for managers that say one thing and then do another, leaving you holding the bag. No more teams of one experienced person to fix the onslaught of wrong-ness inflicted by a bevy of inexperienced junior developers.As you might imagine, most of what crosses my in-box doesn't measure up. However, every now and then, something of interest (that seems to measure up) appears. The latest of these was a position as a highly experienced architect/developer at a non-financial company in NJ. The technology stack they were using was in line with my experience. The phone screen with the developers yielded some honesty about the differences between where they were and where they needed to be, but at least they recognized the shortcomings. It was a try-buy deal (usually a turn-off for me) with the numbers in the right range (e.g.: commensurate with my experience). I decided to go on the interview.Don't get me wrong; if I could find a good position at half the money, but near home, I'd grab it (convenience trumps income). Unfortunately, there's very little in the way of tech offerings near where we live. If I have to make the long daily shlep, then I feel it's only reasonable to be paid along the lines of typical salaries in the industry and location where I'll be working. The fact that I don't actually need the money is personal and should be of no consequence to the company who will be getting my services.The interview went well. A few days later the offer came, but at $50K less than what they had listed in the job posting. Upon querying, I was informed that although they said I had all the qualifications and experience they were seeking, they decided they only needed mid-level experience and so they adjusted the offer to reflect that. Although it's not about money, I don't like being taken advantage of, and declined based upon the discrepancy.The hiring manager called me to try and convince me to take the position as we had all hit it off and seemed to be on the same page. I said that it seemed that they wanted 30+ years of experience but were only willing to pay for 15 years of experience, and that since the number they originally discussed and the one they offered were so different, that I was not interested in giving it away (would they be willing to let me dumb down my skills, knowledge and experience to match the compensation, or did they want me to use all of my expertise to do the best job possible?)Of course he said the latter. He then pointed out that $50K wasn't that much money and it shouldn't be a deciding factor. I said that money wasn't the issue, but how they changed the terms on me after the fact was. I further pointed out that if it wasn't that much money, then I would take the job at the offered rate if he would personally make up the $50K difference.Naturally he railed at that suggestion.I pointed out that it was interesting that $50K was no big deal when it was coming out of my pocket, but it was a huge deal when it was coming out of his pocket; then I declined the offer.A few days later, he called me again and informed me that he got the budget to pay the originally agreed-upon rate.I am presently doing volunteer work, instead. If I'm going to take a paid position, it should be a fair wage given the skills/experience/location/industry/etc. I am not going to give it away. The fact that he tried to renege on a financial agreement just to make his budget look better - to me - is a huge warning sign that dealing with him would be an ongoing WTF, so I chose to pass on the position.When you have fiscal obligations, getting paid something - anything - is better than nothing, but we all know that someone who is qualified but underpaid is someone searching for a new position. When you have the luxury of not having monetary obligations, dealing with someone who treats you fairly and honestly trumps - pretty much - all.[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!
An anonymous reader was chatting with their fellow developers on Slack. They work for a telecom, and thus have to support software and hardware from a variety of vendors. In one Apple-provided API, they found this method.
Dominique finished her instant cup of ramen, her third day straight. She and the other developers at Bento had gone a month without pay as they finished the beta version of their only application: a browser for promotional materials of yet-to-be-released merchandise.Her cellphone rang. It was CEO Stephen, who was wooing investors with a demo. “How hard is it to block a user from capturing a screen image?â€â€œIt’s possible,†she began. “We’d need to encrypt all copyrighted images that are stored to disk, disable the print screen button, disable the context menu when a user right-clicks–â€â€œGreat, thanks.†Stephen hung up.Stephen returned to the office an hour later. “We’ll need copy protection for a new demo next Monday,†he said.“I didn’t even get to the hard stuff,†Dominique replied. “Like screen capturing software. You’re talking about a dozen different applications we’d need to write fixes for.â€â€œSure, but you can do it by Monday, right? It’s the one thing they’re insisting on.â€The ListDominique assembled the other developers for a stand-up meeting. She wrote on the whiteboard:
For every line of code that ends up in software the general public sees or interacts with, for every line in your Snapchats and Battlezone: Call of Honor Duty Warfare, there are a thousand lines of code written to handle a supply chain processing rule that only applies to one warehouse on alternating Thursdays, but changes next month thanks to a union negotiation. Or it’s a software package that keeps track of every scale owned by a company and reminds people to calibrate them. Or a data-pump that pulls records out of one off-the-shelf silo and pushes them into another.That’s the “iceberg†of software development. In terms of sheer quantity, most software is written below the waterline, deep in the bowels of companies that don’t sell software, but need it anyway. That’s the world of internal software development.And internal software development, in-house software shops, have a problem. Well, they have lots of problems, but we’re going to focus on one today: Internal Billing and the Billable Hour.At a first pass, internal billing makes sense. If you are a widget manufacturer, then you want the entire company aligned with that goal. If you buy raw materials, those raw materials are going into widgets. If you pay laborers, their labor should be going into making widgets. If you buy capital assets, they should be things like widget-stamping machines.But you can’t just build widgets. Your workers need to organize via email. The new Widget-Stamper 9000 needs network connectivity, so you need network drops and routers and switches, which in turn need regular maintenance. This is, in pointy-haired-boss speak, “overheadâ€. You need it, but it doesn’t directly make widgets. It’s a cost center.So what do large companies do? Well, they take all those “non-productive†activities and shuffle them off into their own departments, usually in a “corporate SBUâ€. Then all the departments doing “real†work get a budget to spend on those “cost centersâ€. And thus, internal billing is born.Each employee needs an email account. Let’s assign that a cost, a rough—sometimes very rough—estimate of the total cost of managing the email account. Our corporate IT department will charge $20/yr per employee to cover the storage, configuration, management, and helpdesk support associated with their email account—and so on through the list of IT-related goods and services. Now the idea is that individual departments know their IT needs better than anyone else. By putting them in control of their IT budgets, they can spend their money wisely.If you’re a widget-making company, you view software and IT support as an overhead cost, and recognize that you only have the capacity to pursue a certain number of IT projects, this makes perfect sense. Budgets and billing create a supply/demand relationship, and they give corporate the ability to cut overhead costs by controlling budgets. (Of course, this is all founded on the faulty assumption that in-house software development is simply overhead, but let’s set that aside for now.)The problems start when internal billing meets software development, usually through the interface of the “billable hourâ€. The combination of these factors creates a situation where people who are ostensibly co-workers are locked into a toxic client/vendor relationship. The IT department is usually in a disadvantageous negotiating position, often competing against external vendors for a business department’s IT budget. Treating corporate IT as the preferred vendor isn’t all sunshine and roses for the business, either. There are definitely cases where external vendors are better suited to solve certain problems.Putting IT resources on a billable hours system introduces a slew of bizarre side effects. For one thing, hours have to be tracked. That overhead might be relatively small, but it’s a cost. “Idling†becomes a serious concern. If developers aren’t assigned to billable projects, the IT department as a whole starts looking like it’s being non-productive. Practices like refactoring have to be carefully concealed, because business units aren’t going to pay for that.Spending more billable hours on a project than estimated throws budgets out of whack. This forces developers into “adaptive strategiesâ€. For example: padding estimates. If you can get an extremely padded estimate, or can get a long-running project into a steady-state where no one’s looking too closely at the charges, you can treat these as “banksâ€. A project starts running over your estimate? Start charging that work against a project that has some spare time.Of course, that makes it impossible to know how much time was actually spent on a project, so forget about using that for process improvement later. It also makes every project more expensive, driving up the costs of internal development. This drives business users to seek external solutions, spending their IT budget outside of the company, or worse: to find workarounds. Workarounds like maybe just building a big complicated Excel spreadsheet with macros in it.This isn’t even always restricted to hourly charges, either. I saw one organization that had a charge-back rate of $10,000/yr for a SQL Server database. That wasn’t licensing or hardware, that was just to create a new database on an existing instance of SQL Server. The result? Pretty much no business unit had a working test environment, and they’d often stack four or five different applications into the same database. Rarely, they’d use schemas to organize their tables, but usually you’d have tables like: Users, Users_1, UsersNew, UsersWidgetsoft, ___Users.Forget about upgrades, even if they’re required. Short of making organization-wide modernization a capital project, no department or business unit is going to blow their IT budget on upgrading software that already works. For example, Microsoft still supports the VB6 runtime, but hasn’t supported the VB6 development environment since 2008. So, when the users say, “We need to add $X to the application,†IT has to respond, “We can’t add $X unless we do a complete rewrite, because we can’t support it in the state it’s in.†Either the business ends up doing without the feature or they make it a demand: “We need $X and we need it without a complete rewrite.†Then your developers end up trying to breathe life into a Windows 2000 VM without connecting it to the network in hopes that they can get something to build.Billable hours turn work into a clock-punching exercise. Billing time is how you’re judged, and whether or not that time is spent effectively becomes less relevant. Often, by the end of the week, employees are looking for ways to fill up their hours. This is a task that should be easy, but I’ve watched developers agonize over how much they’re going to lie to make their timesheet look good, and hit their “85% billable†targets. This gets especially bizarre since you’re not self-assigning tasks, but you have to have 85% of your time billable, and thus you need to take the tasks you’ve been assigned and spend a lot of time on the billable ones to make sure you hit your targets, turning five-minute jobs into ten-hour slogs.We could go on dissecting the problems with billable hours, and these problems exist even when we assume that you can just view your in-house software as a cost center. Some of these problems can get managed around, but the one that can’t is this harsh reality: software isn’t a cost center.I’ve heard a million variations on the phrase, “we make widgets, not software!†Twenty years ago, perhaps even ten years ago, this may have been true. Today, if you are running a business of any scale, it simply is not. It’s trite to say, but these days, every business is an IT business.One project I worked on was little more than a datapump application with a twist: the data source was a flow meter attached to a pipe delivering raw materials to a manufacturing process. The driver for reading the data was an out-of-date mess, and so I basically had to roll my own. The result was that, as raw material flowed through the pipe, the ERP system was updated in real-ish time with that material consumption, allowing up-to-the-minute forecasts of consumption, output, and loss.How valuable was that? It’s not simply an efficiency gain, but having that sort of data introduces new ways of managing the production process. From allowing management to have a better picture of the actual state of the process, to helping supply chain plan out a just-in-time inventory strategy, this sort of thing could have a huge change on the way the business works. That wasn’t a skunkworks idea, that wasn’t IT just going off and doing its own thing. That was a real hook for business process improvement.Smart companies are starting to figure this out. I’ve been doing some work for a financial services company that just hired a new CTO, and he’s turned around the “We make $X, not software,†and started his tenure by saying, “We are a software company that provides financial services.†Instead of viewing IT as a sink, he’s pushing the company to view IT as a tool for opening up new markets and new business models.So, yes, IT is a cost of doing business. You’ll need certain IT services no matter what, often fulfilled with off-the-shelf solutions, but configured and modeled to your needs. IT can also be a cost savings. Automation can free up employees to focus on value-added tasks.But the one that’s underestimated in a lot of companies is IT’s ability to create value-added situations. If you make widgets, sure, it’s unlikely that your software is going to directly change the process of making widgets, so it’s unlikely that your software is itself technically “value addedâ€. But a just-in-time supply chain system is more than just a cost savings or an efficiency booster. It can completely change how you manage your production process.By placing the wall of billable hours between IT and the business, you’re discouraging the business from leveraging IT. So here are a few ways that corporations and management could possibly fix this problem.First, as much as possible, integrate the IT staff into the business-unit staff. This might mean moving some corporate IT functionality out into individual departments or business units (if they’re large enough to support it), or dedicating corporate staff to a relationship with specific business units. Turn IT workers into a steady flat cost, not a per-hour cost. When trying to handle priorities and deciding how to spend this limited resource to get new software developed, business-unit management can set priorities.If an organization absolutely must use internal billing to set priorities and control demand for IT resources, move as much work as possible into fixed-rate, flat-fee type operations. If a business unit requests a new piece of software, build a fixed-bid cost for that project, not an hourly cost.While a “20% time†approach, where employees are allowed to spend 20% of their time on their own projects, doesn’t work in these kinds of environments, an organizational variation where some IT budget is used on speculative projects that simply might not work—a carefully managed skunkworks approach—can yield great benefits. It’s also an opportunity to keep your internal IT staff’s skills up to date. When you’re simply clocking billable hours, it’s hard to do any self-training, and unless your organization really invests in a training program, it’s easy to ossify. This can also involve real training, not “I sent my drones to a class, why don’t they know $X by now?†but actual hands-on experimentation, the only way to actually learn new IT skills.All in all: billable hours are poison. It doesn’t matter that they’re a standard practice, they drag your IT department down and make your entire organization less effective. If you’re in a position to put a stop to it, I’m asking you, stop this. If you can’t stop it, find someone who can. Corporate IT is one of the most important yet under-prioritized sectors of our industry, and we need to keep it effective.[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!
We don’t receive many CSS-based submissions, possibly because CSS is already pretty horrible. There are real-world, practical things that you simply need to take a hacky, awkward approach with.Matthew found this code, however, which isn’t a clever hack to work around a limitation, and instead just leaves me scratching my head.
Murray F. took a position as an Highly Paid Consultant at a large firm that had rules for everything. One of the more prescient rules specified that for purposes of budgeting, consultants were only allowed to bill for 8 hours of work per day, no exceptions. The other interesting rule was that only certain employees were allowed to connect to the VPN to work from home; consultants had to physically be in the office.The project to which Murray was assigned had an international staff of more than 100 developers; about 35 of them were located locally. All of the local development staff were HPCs.With that much staff, as you would expect, there was a substantial MS Project plan detailing units of work at all levels, and assorted roll-ups into the master time line.The managers that had created this plan took all sorts of things into account. For example, if you attended three hours of meetings two days a week, then you only had 34 hours available for work; if you had to leave early one day to pick up your kid, it set those hours aside as non-work, and so on. The level of detail even took into account the time it takes to mentally put down one complex task and pick up another one. It was awful to look at but it was reasonably accurate.Until...Weather forecasters are wrong as often as they are right. However, the spiraling pin-wheel of snowstorms was getting bigger and barreling down on the local office, and was so imminent that even the forecasters were issuing absolute warnings. Not "It looks like we might get six inches"; but more along the lines of "Get groceries and plan to be shut in for a while".The storm hit at night and by first light, anyone who looked out the window immediately realized that the forecasters were right and that they weren't going anywhere. In an attempt to be good team players, the consultants called their managers, pointed out that they were snowed in and unable to travel, and given the special circumstances, could they use the VPN and work from home?The managers all responded that the rules were very specific and that the consultants could only work from the office. Since the consultants were powerless to do anything about the weather or the mountain of snow that had to be shoveled, they took snow days and no work was done.That's 35 consultants for 2 days or 70 days of (loaded) work, or about 2 ½ months of work that vaporized. Needless to say, this turned the otherwise green time line quite red.The managers called a meeting to discuss how to make up the time. Their first suggestion was that the consultants put in more time, to which they responded The rules specify that we cannot bill more than 8 hours each day. The managers then asked the consultants if they would work without pay - to get it done. Wisely, the consultants said that they were required to play by the rules set forth by the company, and could not falsify the billing sheets with the wrong number of hours worked.The sponsoring agencies of the consultants all agreed on that one (free labor means no commissions on said labor).This went back and forth for a while until it came time for scheduled demos. Only the work was about ten person-weeks behind schedule and the features to be demo'd had not yet been built.At this point, the senior people who could not see their expected features in action had no choice but to address the snow delay. After much discussion, they decreed that the budgets had to be adhered to (e.g.: billing was limited to 8 hours per day), but the line development managers could hire additional consultants to make up the missed work. The managers got to work adjusting the master project plan.The existing consultants pointed out that it would take a substantial amount of time to find new consultants, get computers, set up development environments, do general on-boarding and get new developers up to speed; and that it didn't make sense to hire new developers for something like this.It was decreed that rules had to be followed, and it didn't matter if it wasn't cost efficient to follow those rules.So they spent about a month interviewing (new project task for existing senior consultants and managers), bringing new consultants on board (getting them equipment, access, etc. - a new project task for managers) , and giving them architecture and code walk-throughs (new project task for existing senior consultants). This necessitated increasing the expense to the project to cover all the additional overhead.All to save a few bucks in additional billing by already-trained-and-equipped developers, which would have been completely unnecessary if they had just let them work from home in the first place.But hey, those were the rules. [Advertisement] Application Release Automation – build complex release pipelines all managed from one central dashboard, accessibility for the whole team. Download and learn more today!
PastorGL inherited some front-end code. This front-end code only talks to a single, in-house developed back-end. Unfortunately, that single backend wasn’t developed with any sort of consistency in mind. So, for example, depending on the end-point, sometimes you need to pass fields back and forth as productID, sometimes it’s id, productId, or even _id.Annoying, but even worse is dealing with the dreaded date datatype. JSON, of course, doesn’t have a concept of date datatypes, which leaves the web-service developer needing to make a choice about how to pass the date back. As a Unix timestamp? As a string? What kind of string? With no consistency on their web-service design, the date could be passed back and forth in a number of formats.Now, if you’re familiar with the JavaScript Date datatype, you’d know that it can take most date formats as an input and convert them into a Date object, which gives you all the lovely convenience methods you might need. So, if for example, you wanted to convert a date string into a Unix timestamp, you might do something like this:
Today, we present our second installment of Software on the Rocks, complete with new features, like an actually readable transcript done by a professional transcriber. Isn’t that amazing?In today’s episode, Alex and Remy host a special guest, Justin Reese, founder of Code & Supply, one of the largest developer community organizations out there, with a nearly constant stream of events. In this episode, we discuss what building a community is like, when is it fair to really tear into bad code, and that time Alex made 10,000 people late for work.This episode of Software on the Rocks is brought to you by Atalasoft.MP3Web PlayerTune in two weeks, when we’ll have Jane Bailey, one of our writers, to discuss working for the site and the perils of “Programmer Anarchyâ€. Follow future episodes here on the site, or subscribe to our podcast.TranscriptAlex: I guess this is another podcast we’re doing.Remy: We are doing this again, and you know what? Not only are we doing this again, Alex, but we have brought a friend. This is Remy Porter, editor of The Daily WTF. We’ve got Alex.Alex: Hello, everyone. Hello, Remy.Remy: And we have with us Justin Reese. So, uh, Justin, why don’t you tell us a little bit about yourself?Justin: Oh. Oh, no. Remy met me through Code & Supply, which is an organization that I started to kind of foster a strong software community here in Pittsburgh.Alex: What sort of things do you do?Justin: Well, so, Code & Supply started because there were lots of disparate meet-ups around the city and just holding events. And there were some really small ones that had great ideas and great people involved but they were really small and they were susceptible to one person failing to do something. And the whole community around a language would die in the city. So, I wanted to make a stronger organization, bring on sponsorship money, and pay to do really cool things, and it just kind of –Alex: And so, this is all Pittsburgh-based, all Pittsburgh local. It sounds like a pretty interesting idea.Justin: Yeah, along with something like 8 to 12 events every month, we held Abstractions this year. You know, it was a very, very large conference.Alex: Oh, that was your conference?Remy: That was his conference. I was an attendee. I just showed up. This was an amazing conference.Justin: What’s really amazing is, like, we had a lot of people there. We’re really focused on creating connections between people, so we – The whole focus was building a bridge between, like, a design community, the ops community, the development community into one thing. But we ended up doing some really amazing things, like Larry Wall, the inventor of Perl, for the first time ever, meeting Joe Armstrong, the inventor of Erlang.Alex: Now, Justin, is Abstractions a not-for-profit or – This whole Code & Supply thing, like, is this someone’s full-time job? I mean, it sounds almost hobby-like, but then, you know, a conference – that’s, like, gone beyond a hobby. You know, there’s some real risks you have to take on to do that.Justin: That’s kind of the reason behind Code & Supply, though, is so that the risk is minimized a little bit. I signed contracts with venues and things that would have financially ruined me if something went wrong, but, you know, having Code & Supply as an organization at least protects me, personally, a little bit.Alex: And just to be clear, when you say, “huge financial risks and liabilities,†you know, this is the thing with conferences that always amazes me, right, is that, you know, we’re talking, like, hundreds of thousands of dollars. And why take on all that liability for, effectively, a hobby?Justin: Alex, you have a pretty good point. It is –You know, I mean, it is, to a point, fun, and I’d love to get to a point where I can make it my full-time job. It’s not quite there yet, but, you know, all the money we’ve made so far has been re-invested into our community. So, we took that Abstractions money that we made and we signed up for a really long lease for a community center so that we can have a place to hold events in perpetuity. And most of the time, I’m making decisions based on how to make the community more welcoming, ‘cause growth is kind of what makes Code & Supply awesome, is its incredible size to do really fantastic events. To grow, you got to be welcoming and get all the people involved.Alex: Now, Justin, I’m actually in the midst of organizing my own conference here. Well, I shouldn’t say “my own.†It’s DevOpsDays Tokyo. And this is one of the same issues that we’re facing is this whole notion of being open and being welcoming. The things that I see a lot are the elitism.Justin: Alex, I think that combating that feeling of elitism is kind of important. You know, we’re a polyglot community, and that means a lot of language, so people make choices for different reasons, and that “best tool for the job†mentality really goes a long way.Remy: And so, Justin, what would you say to the – there’s this one kind of tribe of elitists I see. They’ll grab code samples from other people’s codebases, usually offered by a disgruntled co-worker, and then they’ll post these code samples on a website. They, like, have this “Code Sample of the Day,†and they do these very critical code reviews. I don’t know. I feel like these people could be part of the problem.Justin: Remy, are you talking about something specific?Remy: I’m talking about The Daily WTF.Justin: Yeah, yeah, yeah, yeah. That’s –Alex: Oh, hey. That’s –
There’s an old saying, that if your code is so unclear it needs comments to explain it, you should probably rewrite it. Dan found this code in a production system, which invents a bizarre inversion of that principle:
You may remember our new sponsor, Hired. To help them match up talent with employers, they’ve created their own proprietary dataset about salary and hiring trends, and have published their annual report about what they’ve found.There are a few key things in this report. First, as we all know, you don’t need to go to Silicon Valley for a good job in the tech sector- and even though the salaries are among the highest at an average of $134K a year, with cost of living factored in, even the notoriously expensive New York and LA can give you an advantage in purchasing power.If you are thinking of a move, the hot cities are Austin, Singapore and London. Non-local candidates are getting more offers at higher salaries than anywhere else. Even if you don’t want to go to one of those cities, in 12 of Hired’s 16 markets are offering better salaries to relocators.Age and race still matter. While African-American candidates are actually more likely to get hired, that may be because they’re being hired at a much lower salary than white candidates. Latino and Asian candidates ask for salaries comparable with white candidates, and are both less likely to get hired.If you’re between 25 and 30, you’re much more likely to get an “average†job offer for your experience level, but past 45, you’ll start to see a decline.There’s a lot more in here, including lots of global data. Read the white paper yourself, and if you think you could take advantage of these trends, get on Hired today and get some offers. [Advertisement] Otter, ProGet, BuildMaster – robust, powerful, scalable, and reliable additions to your existing DevOps toolchain.
An email from Andrea Ci arrived in our inbox, with nothing more than some code and a very simple subject line: “VB Conversion: a year in hellâ€.A lot of people have that experience when encountering Visual Basic code, especially when it’s VB6, not VB.Net. Even so, could it really be that bad? Well, let’s look at the sample Andrea provided.
Famed placeholder company Initech is named for its hometown, Initown. Initech recruits heavily from their hometown school, the University of Initown. UoI, like most universities, is a hidebound and bureaucratic institution, but in Initown, that’s creating a problem. Initown has recently seen a minor boom in the tech sector, and now the School of Sciences is setting IT policy for the entire university.Derek manages the Business School’s IT support team, and thus his days are spent hand-holding MBA students through how to copy files over to a thumb drive, and babysitting professors who want to fax an email to the department chair. He’s allowed to hire student workers, but cannot fire them. He’s allowed to purchase consumables like paper and toner, but has to beg permission for capital assets like mice and keyboards. He can set direction and provide input to software purchase decisions, but he also has to continue to support the DOS version of WordPerfect because one professor writes all their papers using it.One day, to his surprise, he received a notification from the Technology Council, the administrative board that set IT policy across the entire University. “We now support Two-Factor Authenticationâ€. Derek, being both technologically savvy and security conscious, was one of the first people to sign up, and he pulled his entire staff along with him. It made sense: they were all young, technologically competent, and had smartphones that could run the school’s 2FA app. He encouraged their other customers to join them, but given that at least three professors didn’t use email and instead had the department secretary print out emails, there were some battles that simply weren’t worth fighting.Three months went by, which is an eyeblink in University Timeâ„¢. There was no further direction from the Technology Council. Within the Business School, very little happened with 2FA. A few faculty members, especially the ones fresh from the private sector, signed up. Very few tenured professors did.And then Derek received this email:
We've all built table driven software. In your engine, you put a bunch of potential callbacks into some data structure, perhaps a map, and call the relevant one based upon some key value. Then the calling logic that uses the engine has some structure that holds the key(s) of the method(s) to be called for some context. If you change the key(s) for a given context, then the corresponding method(s) that get called change accordingly. It's neat, clean, efficient and fairly simple to implement.At least you'd think so.Unless you run into one of those folks who believes that everything, and I mean everything belongs in the database.About 15 years ago, a mid level developer was tasked with creating a table-driven mechanism to call methods based upon values returned from a query to a remote system in real time. He took the phrase "table driven" literally. After I was hired, I was tasked with diagnosing and fixing the performance problems that were weighing down the application. This developer spent a little time explaining his table driven software to me (minus the fact that it was actual DB tables) and that this was highly efficient and couldn't be the source of the performance issues.There was a single stored procedure call named Engine which took as a hard wired argument the name of the method to call, and an arbitrary list of up to 100 pairs of parameter type and value strings. It would then look up the specified method name to see if it existed, and grab the user id from the environment and look up whether the user had permission to call said method. If so, it would parse the arguments until it hit a null, and based upon the specified types, verify that those types matched the ones configured for the specified method, build up a string representing the method call, exec it, grab the results, and spit them back as a delimited string in a single output parameter.It looked something like this:
Microsoft recently announced that they’re changing how they handle .NET languages. Up to this point, the focus has been on keeping them all feature compatible, but going forward, they’ll be tuning VB.Net towards beginners, C# towards professionals, and F# towards people who have to use .NET but want to “be functionalâ€.VB.Net’s biggest flaw is that it’s inherited all of the Visual Basic programmers. You may be able to write bad code in any language, but I’m not convinced you can write good code in VB6 or earlier. Those bad habits, like Hungarian notation, can mark out “modern†code written with a distinctly “non-modern†mindset.Like this:
"I have two questions: First - Why make the dropdown go all the way down to 1908 if you don't want people selecting it? Second - Why can't I view garfield.com if I'm 101 years old?" wrote Tom.
Welcome to Software on the Rocks, the Daily WTF podcast. This is a new feature we’ll be running on a bi-weekly basis for a first season of a few short episodes. If folks like it, or more important, if we really like doing it, this may continue, but for now, we’re committed to season of 6 episodes.In this episode, Alex and Remy discuss ruining the site, the dangers of booking airline tickets, and why Angular 2 is absolutely the best possible framework for those who love lots of boilerplate.This episode of Software on the Rocks is brought to you by Atalasoft.Tune in two weeks, when we’ll have special guest, Justin Reese of Code & Supply, to discuss software communities and the value of a good bar. Follow future episodes here on the site, or subscribe to our podcast.Direct MP3 DownloadTranscript Welcome to software on the rocks, a daily WTF podcast brought to you by Atalsoft.Remy ® So, I guess we are going to do a podcast thing. This is one of our new things and I guess I probably should take it lame. Hello everyone, welcome to software on the rocks, I’m Remy Porter, chief editor of the daily WTF and responsible for single heading, ruining the site, if I judge by the comment section.Alex (A): Hi everyone, this is Alex and I started daily WTF and still tried to take all the good credits for it. And any times someone complain, just really blame on Remy. I remember starting WTF in 2004 or something like that and literally in the 2 months it had been going downhill. I don’t know…R: The high of the first day. Let’s talk about why we are doing a podcast: we have been doing periodical sponsor posts and this is really not a site that makes a lot of money by driving traffic.A: WTF it could be probably be a full time job, if we were able to turn it into a proper media publication, but it is a hobby site. It’s not free, there are server bills and other expenses and in order to pay for that you could just get google ads, but we wanted to do something different and that is why we have a handful of sponsors. By enlarge they are taking care of the website costs. One things that we wanted to do by giving sponsors, was starting a podcast, so thanks to them we are doing it.R: Atellasoft is a vendor that makes SDK for doing document imaging: scanning documents, storing and processing them. It seems like a relatively good idea to solve the problem and I don’t see other good solutions.A: well, they have been around forever and have a solid community and product and I would recommend to just check them out.R: one of the bullet thing that they do: web scanning for dot net. So they do scanning from a Java script API, which is a funny possibility. It brings back one of the projects I worked on. This was for a company called TPG industry. They almost certainly made the paint on your car. They care about colour, that means a lot. This is something that as a developer I really simpatize with: they make the paint. They take it to GMs factory and than GM applies the paint to the cars. The application process has to be extremely tightly controlled, because if the pressure used is wrong, the colour will come out different and when you will put the bumper on the car, the colour will be different of the one of the fender. And so they will get in fight with their customers: GM will say “the paint you gave us is bad, because we sprayed them to the fender and it doesn’t match the bumper. But then TPG says “no, the paint we gave you was good, we fulfilled your requirements, you are using it wrongâ€.A: I’ve never heard that before in any other industry, that’s amazing.R: They have a device, that behind the scenes launches a windows executable. What we deploy just launching the webserver on the user’s machine and from the browser we can do cross-orange requests to the webserver running locally on their machine.A: So he built a website that downloaded a thick client, then installed the webserver, than used it to do all the hard work stuff.R: YepA: It seems like not the easiest way. Why don’t just have the desktop UI than?R: They didn’t want it, they wanted a web browser based UI. What is your hobby outside this?A: That’s a funny way to drive that requirement I guess. So, what are you doing now?R: The hobby that pays the bills is that I am consultant, I’m good at training and this weekend I’m teaching a group of people to use Angular 2-A: Wow, I’ve heard a lot of wonderful things about it, mostly from you, even if I don’t do a lot of web developing.R: Yes, I really love it. What I appreciate the most about Angular 2 is the big quality of sheer boiler plate. I want to have a series of project files that have nothing to do with my business that simply need to exist, so the application needs to find its own hustles.A: Yes, you right. The advantage of having a giant number of files is that it gives the developer a sense of responsibility, it makes you really feel like you are building a web application. I see angular 2 more like the shitty sequel of regular 1R: Yes. If you write code that works with angular 2, it might not work tomorrow. Angular 2 didn’t care to make angular perfect: which each single release changes completely the program. That is the framework that they are giving you a product, that is goodish.A: Some might say it’s bad product management, but I say it’s brave. If you just needed to upload angular and your code works, where is the fun in that? More applications should be doing that.R: Sure! Furthermore, angular is creating new jobs, because of its complexity. But, putting the sarcasm down, I will definitely admit that there are actual benefits from Angular’s approach. A while back I took a course about leading business improvement and me and the teacher had the same approach: we look at a process and model it. IT people when they see a complex process try to automate it. My solution is to delete the process, so it’s not a problem anymore. I think that is a big cultural problem.A: Yes, they are engineering a poor solution to an irrelevant or misunderstood problem. What have I been working on lately… oh booking airplanes tickets. What is fascinating to me about the airline industry is that it existed before information systems were a thing. All their fair rules are so deeply ingrained in the process that it is incomprehensible. Why not just simplify the way airlines work? If you start from scratch you will easily find a solution for that business problem than implementing the absurd business requirements.R: But then you see something like South West Airline. What they did when they entered the industry, they did throw away lot of the legacy craft: they standardize their process and that is why circa 2002 every management magazine was “what is South West Airline doing now?â€. But it’s the same idea: can we simplify the process?A: They did it rapidly, we are talking about years not decades. They adapted to very fast changes in the market. That is all what this agile thing is all about.R: It seems that might be one of your problems now.A: Yeah, here at DevOps my job is to take ideas into reality quicker and to collaborate with different teams. It’s easy, but sometimes anyone is in a different trench and is thinking about a small problem, without collaborating.R: Sometimes they want to do something different, but as you said, organizationally they can’t.A: They recognize that the 6 months process sucks. The devup’s software will give you the possibility to release in less than 6 months, which is amazing for them.R: developers have fund a new solution, even better than devup that gives you feedback and doesn’t require automation.A: we call that develop misconstruction’s Basically you take a bad software and you run it to the customers, waiting for bug feedbacks and when they come you make the adjustments. They are accepting a low quality process and product. Having a half working product is totally acceptable for this companies, which is very sad to me.R: the idea of risk management is something that IT doesn’t take really into consideration. All this things are rooted in risk management and risk tolerance.A: this is an important topic, but nobody is going to care if we call out this things.R: we believe that risk management is something important to talk about. We need a buzz-word and would love to see some ideas in the commentsA: furthermore, for future episodes we would love to bring up a guest, somebody outside usR: yes, there are already some people aligned up.A: this is going to be fun, I’m exited and hope we can keep it up.Machine Generated Transcript [BREATH] and.
Let’s start with a brief lesson on .NET. .NET, like most OO languages, needs the ability to perform “cleanup†when an object finally dies. One option for this is the Finalize method, which is called when the memory is freed, but since it’s the garbage collector’s job to do that freeing, you have no idea when (or even if) that will happen.To solve that problem, .NET has an interface, IDisposable. The I, of course, is one of the lonely last relics of the tyranny that was “Hungarian Notationâ€. Classes which implement this interface have a Dispose method, which should be called by an instance’s owner to trigger cleanup (or can be auto-invoked through some nice syntactic sugar).As an interesting, and odd quirk, classes may implement interfaces privately, so a disposable object might have a private Dispose method, that can only be invoked if you first cast to IDisposable.There was a different problem .NET had, specifically, “wouldn’t it be nice to have a way to safely extend objects without inheriting?†Thus came “extension methodsâ€. These are essentially static methods that simply take an object as its input and perform some operation on the object, but can be invoked as if they were class members.For example:
Douglas had just joined a large eCommerce company that was constructing its own in-house PHP development team. It was a big step for them, as they only relied on cheap freelance c0derz to get things done before. Because of this, Douglas and his cohorts had to maintain a glut of legacy applications made by people who were long gone.A vast majority of the horrid legacy apps were created by a man simply known as Shayne. The sight of his name in the code comments would send icy chills down Douglas' spine. Shayne was freelance down to the very definition of it. His signature philosophy to coding seemed to be "roll your own" and his framework weapon of choice was a version of CodeIgniter that was two years out of date at the time he utilized it.One of the more egregious examples of Shayne's hand-rolled disasters was the authentication script he reused on every site he built. Because of his custom session-generation code, a user could log in to one of his websites and copy the 'session' cookie (which contained hashed user details, rather than a unique session ID) to another Shaynesite. From there, they could instantly log in to it, regardless of whether they had the authority to do so.The authentication script, however, had nothing on the poison marsh that was Shayne's eCommerce platform. The platform was developed a few years prior and used to build up the rest of what was supposed to be the company's triumphant new version. Douglas was brought in at the 11th hour to give it a once-over before it got deployed. It didn't take long for him to find an entire mast's worth of red flags.Within half an hour, he found five separate ways to get a free order out of the system. Simple methods involved changing the cart value to '0' in a hidden input since the back end didn't validate the cart total, and more complex methods like spoofing a 'success' callback from card processor WorldPay. Since the application only checked the order ID (which was available prior to the payment stage) but neither the server origin of the payment callback nor the shared secret; the system would be fooled into thinking that an order had been successfully paid for.Douglas immediately brought his findings to his supervisor and informed him that under no circumstance should it be released as-is. He was convincing enough that the brakes were pressed on the release, but the resolution option his boss presented was less favorable, "I'll see if we can dig up this Shayne's phone number and try to get him back in here to fix this mess!"The colorful, four-letter language Douglas used in reply to that suggestion probably should have been enough to get him fired. Fortunately, his boss used more colorful vocabulary daily. Douglas again swayed him to under no circumstance let Shayne in the door ever again. Wanting to make a good impression, Douglas committed his nights and weekends for the foreseeable future to cleaning up the disaster. But before he did that, he began drafting a letter of recommendation to Amazon to hire a great talent like Shayne. Because who wouldn't love to be able to get a bunch of free stuff from Amazon? [Advertisement] Infrastructure as Code built from the start with first-class Windows functionality and an intuitive, visual user interface. Download Otter today!
Brian found himself digging through some C++ code, trying to figure out a cross-thread synchronization bug. It had something to do with the NetLockWait function, based on his debugging, so he dug into the code.
A lot of the things we do in IT aren't particularly important. If this or that company doesn't sell enough product and goes under, it sucks for the employees, but life goes on. Sometimes, however, we're faced with building systems that need to be truly resilient: aviation systems, for example, cannot go down for a reboot midflight. Government services also fall toward the "important" end of the scale. The local mayor's homepage might not be important, but services like Fire and Rescue or 911 are mission-critical.The control room Kit was installing needed to be up 24/7/365, presumably only allowing a maintenance window every four years. The building was designed to be fireproof, terrorist-proof, electronic-evesdropping-proof, you name it. This was going to be one of the most secure, resilient rooms in the entire city, and we're not talking about a small city, either.Kit hooked up the servers to power. The power had been designed with two independent feeds from two separate substations, with a huge UPS in the loft (to keep it safe from potential floods) with a twelve-hour capacity. The basement housed two diesel generators, and if all else failed, there was a huge socket on the garage wall to allow a transport container generator to be plugged in.It was an excellent design—but you know what site you're on, so you can guess how it all worked out.Kit was in the middle of commissioning and testing the systems they'd installed. Everything was looking good in the control room, and the customer was running some training exercises.Then, it happened: the servers stopped responding.The terminals remained on, but there was clearly nothing for them to connect to. This was around 1990, so it was still very much a mainframe setup. Kit's team headed to the equipment room, only to find the gut-wrenching sight of dead machines: no lights, no fans, nothing.It has to be the power, Kit thought. The system was working five minutes ago, and they're redundant servers. They wouldn't all just break down.He was sweating, but tried not to let his team see. "All right, let's check the UPS," he declared, trying to sound casual."This way," replied one of the techs, leading him to the stairwell ... and down the stairs."Isn't the UPS in the loft?" Kit asked, frowning."No, sir," the tech replied with a grin. "Turns out the floor up there isn't rated for the weight of the lead acid batteries."The best laid plans of mice and men ... Kit thought, then shook his head.Twenty minutes later, the UPS checked out fine. It wasn't flood-proofed anymore, but there wasn't any water, so it ought to have been working. The diesel generators had kicked in, which was why the overhead lights were still on. There had to be some kind of wiring mistake for the servers.Kit traced the wires, mentally correcting the specification to account for the relocated UPS. That led him back to the equipment room without any obvious sign of fault other than "equipment not working." After pulling open a wall panel, he were able to figure out the mistake pretty quickly: the servers were powered by the UPS, but the switch was hooked to the raw mains, and everything was designed to shut off if the switch went down.Kit rubbed his forehead, sent a tech to check all the outlets, and kept looking for any other bonehead moves.The control room power didn't route through the equipment room. When Kit ran a check, half the gear in that room didn't seem to work, either. It had power, but the communication was down.This was all fine before the power went, he reminded himself. Now where's that intercom switch?Then he remembered: the training room. You see, due to the massive amounts of equipment needed to run the control room, there wasn't any space for the communication switches. The nearby training room, however, had much less equipment in it, so they'd moved the switches there.Sure enough, as Kit poked his head into the training room, he found the whole place dark. Who'd want to train during an emergency? Nobody, that's who. So why bother with redundant power? Save the juice for the important rooms—which now couldn't function because they were missing key components.Only one question remained: why did the power go out in the first place? It wasn't a scheduled disaster drill. There were two redundant power lines coming in, so it would've taken something massive to knock them both out. Was one of them disconnected? No; Kit had been there when the electrician went over the wiring, and had seen him sign off on it. Concerned, he wandered out back ... and immediately facepalmed.Both cables came into the building at the same point, so they could both be fed into the same grid. That point was currently occupied by a small backhoe and some frazzled looking contractors.Mystery solved. [Advertisement] Infrastructure as Code built from the start with first-class Windows functionality and an intuitive, visual user interface. Download Otter today!
Dealing with types in dynamically-typed languages is always a challenge. Given a variable, does it hold a string? A number? An object? Without inspecting it, you have no idea!Thus, most of these languages have methods for inspecting variables, where you can ask questions like, “is this a number?†and then decide where to go from there. This can make validating your inputs a bit more difficult.Of course, this code Joe found might make it more difficult than it needs to be:
Steven was an engineer at a US-based company whose leadership had decided to take some dramatic cost-saving measures. A mandatory company meeting convened at 12:00PM, with nary a crumb of food in sight, to allow management to make their big announcement:"We're opening an office offshore, and one of the first things we'll be transitioning there is product documentation."Ah, transitioning: a nice way to say they were firing every US-based tech writer immediately. From that point forward, the engineers would have to send notes on product features to the offshore team, who would then compile the documentation.Steven was nervous about the prospect. He'd had a good working relationship with the tech writers. They could take his notes, add their personal experiences with the products, and compile it all into something useful (for the rare user who actually bothered to look at the manuals). Hesitantly, he raised his hand. "Will the offshore team be trained on our products?""Don't worry. We're working with a consulting company that's helping us hire the best talent available," the meeting presenter assured him with a saccharine smile. In other words, No way in hell. Steven saw through the ruse, but didn't have the guts to call it out. No one else did, either. After all, no one wanted to give management the idea that perhaps engineers were just as replaceable as tech writers.They had no choice but to wait and see. With any luck, the hiring firm would find some good writers, at least.A few weeks later, Steven sent off his first round of notes and crossed his fingers. Unfortunately, what he got back was his own notes copied and pasted into the standard manual template, surrounded with typos and broken English.No, wait, they hadn't just copied his notes. They'd tried to "improve" upon them. In one case where Steven explained the behavior of a quirky installer, he'd written:
The Best of Email feature is not one that gets a lot of traffic these days, but this particular submission couldn’t fit anywhere else. It started when Justus got a ticket: “customer spam filters are blocking our emailsâ€. How on earth was he going to fix customer spam filters? He almost replied as much to the ticket, when he noticed that the end user had helpfully attached a sample email.This was the “to†line… and I present it here in its entirety, exactly as supplied by Justus. I apologize to mobile users in advance: