Error'd: TAYLOR VS. TIME |
You know that new Taylor Swift treadmill commercial? Looks like there's a little bit of a sync issue between the time on her phone and the analog clock icon at 0:05.
Hans wrote, "Google News now appears to be adding political commentary to its headline summaries."
"That's a lot of notifications for only one document," writes Philip C.
Mattias wrote, "Go home Steam, you're drunk."
"Initially, I wondered why my package kept bouncing between Asia and North America," writes David D., "When I realized FedEx believed it actually traveled backwards in time 24 hours as it crossed the international date line, it all made sense."
Art writes, "So, if I drive my electric car backwards, does that mean I can save money on my electric bill?"
"The 'Copy text from picture' feature in OneNote is awesome, but sometimes, you'll get unexpected additions," wrote Antonio.
[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
|
Метки: Error'd |
CodeSOD: Parsimony |
When I was but a wee lass, the internet was still a wild, untamed place. Before the advent of walled gardens and minifiers, long before Facebook, you could learn everything you needed to know about web programming using one simple tool: View -> Source.
Wide open fields of HTML, speckled with poignant blossoms of inline CSS! Table after table, each one hand-crafted and oddly indented! Gifs ripe for stealing: dancing flames, dancing babies, and 'under construction' signs! What a wonderful world of secrets lay hidden just two clicks away!
Sometimes, in rare occasions, you can still see whole, unmolested Javascript functions in the source code of pages. Today's function comes from a credit union, ready and waiting to teach a new generation of programmers all about number parsing.
function formatNum(Vnum) {
if (Vnum > 99000000) {
alert("Sorry, this will not generate numbers larger that 99 million.");
focus();
} else {
var V10million = parseInt(Vnum / 10000000);
var V1million = (Vnum % 10000000) / 1000000;
if (V1million / 1000000 == 1) {
V1million = 1;
} else
if (V1million < 1) {
V1million = "0";
} else {
V1million = parseInt(V1million, 10);
}
var V100thousand = (Vnum % 1000000) / 100000;
if (V100thousand / 100000 == 1) {
V100thousand = 1;
} else
if (V100thousand < 1) {
V100thousand = "0";
} else {
V100thousand = parseInt(V100thousand, 10);
}
var V10thousand = (Vnum % 100000) / 10000;
if (V10thousand / 10000 == 1) {
V10thousand = 1;
} else
if (V10thousand < 1) {
V10thousand = "0";
} else {
V10thousand = parseInt(V10thousand, 10);
}
var V1thousand = (Vnum % 10000) / 1000;
if (V1thousand / 1000 == 1) {
V1thousand = 1;
} else
if (V1thousand < 1) {
V1thousand = "0";
} else {
V1thousand = parseInt(V1thousand, 10);
}
var Vhundreds = (Vnum % 1000) / 100;
if (Vhundreds / 100 == 1) {
Vhundreds = 1;
} else
if (Vhundreds < 1) {
Vhundreds = "0";
} else {
Vhundreds = parseInt(Vhundreds, 10);
}
var Vtens = (Vnum % 100) / 10;
if (Vtens / 10 == 1) {
Vtens = 1;
} else
if (Vtens < 1) {
Vtens = "0";
} else {
Vtens = parseInt(Vtens, 10);
}
var Vones = (Vnum % 10) / 1;
if (Vones / 1 == 1) {
Vones = 1;
} else
if (Vones < 1) {
Vones = "0";
} else {
Vones = parseInt(Vones, 10);
}
var Vcents = parseInt(((Vnum % 1) * 100), 10);
if (Vcents < 1) {
Vcents = "00";
}
else
if (Vcents % 10 == 0) {
Vcents = Vcents + "0";
}
else
if (Vcents % 10 == Vcents) {
Vcents = "0" + Vcents;
} else {
Vcents = Vcents;
}
if (Vcents == "900") {
Vcents = "90";
} else
if (Vcents == "800") {
Vcents = "80";
} else
if (Vcents == "700") {
Vcents = "70";
} else
if (Vcents == "600") {
Vcents = "60";
} else
if (Vcents == "500") {
Vcents = "50";
} else
if (Vcents == "400") {
Vcents = "40";
} else
if (Vcents == "300") {
Vcents = "30";
} else
if (Vcents == "200") {
Vcents = "20";
} else
if (Vcents == "100") {
Vcents = "10";
} else {
Vcents = Vcents;
}
var Vformat = "";
if (Vnum >= 10000000) {
Vformat = (V10million + "" + V1million + "," + V100thousand + "" + V10thousand + "" + V1thousand + "," + Vhundreds + "" + Vtens + "" + Vones + "." + Vcents);
}
else
if (Vnum >= 1000000) {
Vformat = (V1million + "," + V100thousand + "" + V10thousand + "" + V1thousand + "," + Vhundreds + "" + Vtens + "" + Vones + "." + Vcents);
}
else
if (Vnum >= 100000) {
Vformat = (V100thousand + "" + V10thousand + "" + V1thousand + "," + Vhundreds + "" + Vtens + "" + Vones + "." + Vcents);
}
else
if (Vnum >= 10000) {
Vformat = (V10thousand + "" + V1thousand + "," + Vhundreds + "" + Vtens + "" + Vones + "." + Vcents);
}
else
if (Vnum >= 1000) {
Vformat = (V1thousand + "," + Vhundreds + "" + Vtens + "" + Vones + "." + Vcents);
}
else
if (Vnum >= 100) {
Vformat = (Vhundreds + "" + Vtens + "" + Vones + "." + Vcents);
}
else
if (Vnum >= 10) {
Vformat = (Vtens + "" + Vones + "." + Vcents);
}
else
if (Vnum >= 1) {
Vformat = (Vones + "." + Vcents);
} else {
Vformat = ("0." + Vcents);
}
return Vformat;
}
}
Inputting "8343.33" to this function results in the output of "8,343.32". Why? It's a feature. Ship it!
[Advertisement]
Incrementally adopt DevOps best practices with BuildMaster, ProGet and Otter, creating a robust, secure, scalable, and reliable DevOps toolchain.
|
Метки: CodeSOD |
A Testy Voice |
This, Gregor said by way of introduction, is Jack. Jacks our new highly paid consultant.
Rita shook Jacks hand. Jack was the kind of person who entered a handshake with a dominant, overhand approach, and then applied too much pressure while he smiled at you. He wanted you to know, he was a take charge kind of guy.
Jacks going to set up some automated tests of the IVR system, Gregor said.
Rita worked for a large health insurance company. Their customer facing phone system was a mission critical application. It was a programmable IVR- interactive voice response- application that needed to be able to service huge numbers of fairly routine requests. Like most things tied to the medical industry, those routine requests could be arcane, could be complicated with large numbers of details, and could end with something getting faxed to an office, because half the doctors offices they worked with didnt exactly trust email.
More tests? Rita asked. She wasnt opposed to the idea, but she had written a huge number of test scripts to walk through the logic of the back-end system. But Jacks tests werent back-end tests- he had a tool that could simulate actual phone calls.
What youve got is great, Jack explained in a tone of voice that implied he didnt think it was particularly great at all, but what Im going to do is better. Its like the difference between unit tests and functional tests. Were gonna do end-to-end functional testing now.
Rita was the expert on the IVR system, which meant she couldnt escape Jack. He needed her help to understand some of the testing protocols they had in place. When testing a live system, it was very important to use some special data; for example certain patient names would cause the system to spit out dummy records, which kept their tests away from live data. There were many gotchas to this process, which Rita had documented thoroughly, and she guided Jack through.
Jack assured her that hed gotten it figured out, and went off to work. He deployed the expensive test package to several servers in their datacenter, doing an end-run around the operations guys and getting himself setup with admin privileges on the boxes. Well never get this done if I have to send in tickets for every little thing, he explained. After a few weeks, he pushed the run button, provided the results of the tests, and then, like most highly paid consultants, dried up and blew away on a stiff breeze that evening.
A few days later, Rita got a ticket, escalated from Lisa down in HR. Rita was confused at first, because Lisa had a printer issue, which wasnt exactly in Ritas domain, but apparently it was printing out a patient record over and over again, which caught Ritas attention.
So, Lisa explained, this is one of those big Epsons, the kind thats printer, copier, fax, and its got lots and lots of paper stored away in there, and its burning through that paper like its trying to destroy the rainforest.
And its printing out a patient record?
Benefits stuff for one of our customers, yeah. Its been doing it for days now.
Have you tried unplugging the phone cable?
Why would a printer/copier/fax machine be printing out a patient record non-stop? Interestingly, when Rita pinned Lisa down on the start of the problem, it turned out to be the same day Jack had left.
Rita had a hunch it was the fax machine part that was the culprit, and after checking the activity on the IVR, she was certain. There was a job that was coming in with no origin phone number- it used a direct VoIP connection from inside their own network- from one of Jacks test machines. Every three minutes, it connected to the IVR
Rita called operations. Hey, theres a job running on JCKRKS03 thats causing some problems. Can I get you to kill any test scripts running on there?
No can do, the ops guy said. Were locked out of those boxes. Zero access.
Fine, she needed Jack to fix the mess. She called Initech Consulting.
Oh, the rep said, Jack isnt with the company any more. He moved over to Initrode.
Well, we still have a contract for IVR testing, right? Whos taking over Jacks role?
Oh… I dont really know…
The next three hours were a deep dive into a convoluted maze of bureaucracy. The rep roped in some Initech management. Rita roped in her companys management. Initech claimed that the contract called for the test job to be set up and run- and it was clearly running. They could see the test results. Therefore the contract was completed. Ritas management complained that they werent feeling like they were getting the support they had paid a large sum of money for. Fingers pointed, blame was shared around, and in the end, nobody knew what they could do short of wiping the test servers and starting from scratch, because Jack hadnt told anyone the password.
Annoyed, Rita decided to try remoting into the box. She connected to the box JCKRCKS01. If she were a highly paid consultant, what would her password be? password? No. P@$$w0rd? No. j4ckR0cks? Bingo.
Rita poked around the test runner, and found that Jack had made two mistakes. The first mistake was that Jack didnt use the correct test data. Specifically, when starting a job that would trigger a fax send, the destination number should always start with 555-, which would never be a real number, and would cause the fax to be redirected to an email address. That mistake was a bit of a nuisance, but for the second. Under the contract, Jack was supposed to set up the tests and run them once, and then Rita or any of her peers could run them in the future on demand. Instead, Jack just put the tests on an infinite loop. The call script took about three minutes to run, so every three minutes it triggered a fax of a patients statement of benefits to print out from Lisas printer.
Rita fixed it, and double checked his other scripts. The only piece of good news was that Jack had only used internal phone numbers in all of his scripts. They hadnt spammed an outsiders fax machine with thousands of pages of someones private health information.
[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!
|
Метки: Feature Articles |
CodeSOD: Tough Cookies |
Back in 2007, Dimitry worked on a website that received millions of unique visitors.
One day, a partnered ad agency provided a large PHP script that they wanted deployed as part of a new implementation. Given the popularity of the website, it was important that any code associated with it was either cached or light. This beast was neither. But Dimitry wasn't to ask questions, only test and deploy.
Minutes after the code went live in production, Dimitry's manager barreled into his cube. "It's all frozen!"
"Wha?" Dimitry choked out around a celebratory sip of high-caffeine soda, which quickly went rancid in his mouth.
"The site is down! Roll back! Roll back!"
Rolling back was the easy part. Now, Dimitry had to figure out what had gone wrong. That meant taking a closer look at the ad agency's code, and facing the nightmare within.
Here was a representative function. Its purpose was to read server-side cookie information and track which ads a user had seen. No user would be presented the same ad twice in a row unless the config file specified otherwise.
function _getcookie($config) {
$ip = preg_replace("/\./", "", $_SERVER['REMOTE_ADDR']);
$agent = preg_replace("/\s/", "", $_SERVER['HTTP_USER_AGENT']);
$cstring = base64_encode($ip . $agent);
$handle = opendir($config["cookies"]);
$filelist = array();
$i = 0;
while ($file = readdir($handle)) {
if ($file!="." && $file!=".." && $file!="Thumbs.db") {
$filelist[$i] = $file;
$i++;
}
}
$cookielist = array();
$i = 0;
foreach ($filelist as $key => $value) {
if (substr($value, 0, strlen($cstring))==$cstring) {
$cookielist[$i] = $value;
$i++;
}
}
$cookies = array();
foreach ($cookielist as $key => $value) {
$cookietemp = explode("%", $value);
$cookieid = preg_replace("/\.dat/", "", $cookietemp[1]);
unset($cookietemp);
$cookies[$cookieid] = file_get_contents($config["cookies"] . $value);
}
return $cookies;
}
Dimitry tried firing up an FTP client and checking the file system where the cookie data was stored—only to have his client crash and die on him. The problem? The sheer number of files contained within that directory.
At that point, Dimitry realized that each cookie was stored as a separate file for each key. Additionally, all files in the directory were read into memory for each request to the above-mentioned function. Over 100,000 files were being scanned, read into memory, looped over twice, then dismissed.
And this was just one function out of many that did similar things. Dimitry and his colleagues had some recoding to do.
[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
|
Метки: CodeSOD |
Mercy the Mercenary in… The Cloud |
The tale of Mercy the Mercenary Developer continues. Last week Mercy became the IT support for a political campaign because she knew how to stream from a cellphone, and thus knew more than anyone working at the campaign.
Mercy ground her teeth. Her wifi connection in Rockwoods campaign headquarters had dropped again.
Around her, Rockwoods righteous volunteers milled about. A few sat at phones, working through Floridas constituency months before the general election would even take place. Since Rockwoods town hall speech in Stoneford last week, the number of volunteers had swelled, with far more people below the age of 30 than any rally she had seen on TV, regardless of party.
She checked her lock screen. The wifi network simply wasnt accepting her connection.
Mercy went to find Sullivan. The campaign manager for Rockwood for Governor sat in a corner, her face in a grimace as she stared at her laptop screen. Barbie, I need to reset the router again.
You see how slow our campaign site is? Barbie said, ignoring Mercys request. Its been like this for days.
Right, but right now the router needs a reboot.
Barbie nodded. Mercy went to find the router, which was hidden behind Rover, their single web server. Mercy thought it was a joke when she first saw it during her interview. Rover, Sullivan had explained, was Elliss beloved chocolate labrador retriever, passed two years ago. Behind Rovers case was the router. Mercy retrieved a bent paperclip and pushed the reset button.
Fifteen volunteers today, can you believe it? Sullivan said, as Mercy watched the routers indicators blink back on. We were lucky to have two or three on a given day not long ago.
Fifteen? Mercy counted the volunteers in headquarters: four on the phones, three folding shirts around a table, eight sealing letters in a corner. 15, plus Mercys phone and Sullivans laptop
Mercy went to one of the volunteers on the phone lines. Hey, could you get off wifi for a few minutes? she whispered. I want to test a theory.
The man, who was speaking very loudly to someone on the other end about how Rockwood would save Tallahassee from itself, groaned. He pulled out his phone and switched off his wifi.
Mercy waited another few seconds, then retried the connection on her phone. It connected to the campaign wifi network. Okay, thanks.
Great, he muttered, I cant get on the network.
Mercy returned to Sullivan. We need a new router. I think that model only allows 16 people on the wifi network at any given time.
Why 16?
She shrugged. Its a power of 2.
Ill get some money from the petty cash, she said. Maybe itll speed up our website.
I dont know about that. Its on an ethernet port, not wifi. Mercy had thoroughly examined Rockwoods campaign site. It was all static pages; the contact form led to his Facebook page, and a Donate button linked to his PayPal account. If anything, the site should be fairly speedy. Ill make sure somethings not bogging it down.
Mercy powered on Rovers monitor. The first sign of trouble: Task Manager took ten seconds to launch. The CPU tab showed Rovers old chip pegged at 96%, and its paltry memory hovered around 91%. Worse, she could hear its hard drive thrashing through the din of the volunteers around her.
Bad news, Mercy said to Sullivan. We need a new server.
Mercy was surprised at how long Rover had held out. Rockwood for Governor’s site ran on IIS 5.1, which was about as old as the OS on Rover, Windows XP. The pages, all static, had been generated with an obsolete version of FrontPage. That last bit Ellis had told her with pride.
“Sure, I built the whole thing,” he said. “I made John’s first business page in 1998, back when no one knew what a web site even was.”
“I’m sure a lot of companies did,” Mercy replied. “Amazon, eBay&”
“Oh-kay,” Sullivan said, stepping between Mercy and Ellis. “We’re not here to criticize Ellis’s lovely site or Mercy’s skills. We just need to get the site on, what is it, a new server?”
“More than one,” Mercy said. “I was able to check the server logs, although it took half an hour to get Rover to open them. It’s serving 500 requests a second, way more than it can handle. That little Pentium II in there is choking on all the threads spawned by IIS. After Rockwood’s speech last week, the site’s been linked to from Breitbart, Drudge Report, and Fox News. Another server won’t do. It needs to be hosted on the cloud.”
“On a cloud?” Ellis asked.
“Oh, you mean like, the servers over there—“ Sullivan waved her hands in a vague direction. “Not in the office, you mean.”
Mercy’s throat tightened. Sullivan had probably heard it mentioned on the news, and Ellis was still stuck in 2001. “Right. Better hardware, better software. You can still use FrontPage, Ellis. The files will just be hosted somewhere else.”
Mercy explained that Seashell Hosting, a Florida-based company, would be appropriate. They’d get access to robust, virtualized hardware, ample support (which she’d need, given that she specialized in web development and SEO, not IT), and she’d get the chance to rewrite it in a server-side language & if she could ever persuade Ellis.
Sullivan frowned. “We need our site up and running as soon as possible, but given the expenses you outlined, I’ll have to take it up with John personally. He’ll be in the office soon.”
As soon as Rockwood reappeared in headquarters, Sullivan pulled him, Mercy, and Ellis into the conference space in the back. Rockwood sat, fingers steepled, as Mercy explained the situation.
“You said it’s a Florida company?” Rockwood asked.
“Absolutely. They host personal sites, small companies, even other campaigns.”
“Other campaigns? Not my opponents, I hope. I don’t want Packard’s people anywhere near this.” Harold Packer was Rockwood’s Republican opponent. He and Rockwood were now neck-and-neck in the polls, while the Democratic challenger, Hewlett, was far behind. “Ellis, what do you think of all this? You built the thing.”
“We definitely need some better hardware,” Ellis responded. “I don’t think the traffic will blow over, boss.” He glanced at Mercy, and she could see a slight curl to his lip. “I do believe Packard’s using Seashell Hosting, now that I think about it.”
“I doubt it, Mercy said. She was pretty sure Packard was hosted on some ad-hoc solution. Even if that’s the case, the data’s all segregated. There’s no way someone from Packard’s campaign or anyone else could get access.”
Rookwood’s eyes got a glassy look. “I don’t like this one bit,” he said, after a minute. “I don’t want our site in the ‘cloud’ or whatever. Some hacker could go in and change our page to show a drawing of me in some obscene position. Figure out something else.”
Rockwood left the room, putting on his cheery game face for the volunteers as he did so.
Ellis smirked.
“I’ll show him that Packard’s not on Seashell,” Mercy said, pulling out her phone.
“Let it go.” Sullivan put her hand over Mercy’s phone. “John doesn’t change his mind.” She turned to Ellis. “And you, bless your heart, what are you going to do about it?”
“Wait for it to blow over,” he said.
“Unacceptable.” Sullivan retrieved a platinum-colored credit card from her purse, the words “Rockwood for Governor” embossed on it. “Mercy, you have full rein on this. Get whatever hardware we need to keep our site up here in headquarters.”
The nearest big-box electronics store was a few miles away. When Mercy arrived, she went straight to a blue-shirted employee and asked him to grab a cart. “I need to see the most powerful desktop you’ve got that isnt a gaming rig.”
She left the store with nine consumer-grade desktop towers, a keyboard, a mouse, an input switch, a small flat-screen monitor, a sixteen-port gigabit ethernet switch, and a wifi router. The towers barely fit in her car: four in the trunk, four in the backseat, and one riding shotgun.
Back at headquarters, a crowd watched as Mercy and two enlistees assembled the hardware near the T1 connection. She named them after the founding fathers, thinking it would humor the staff. washington Mercy designated as a firewall, which would run ipf; franklin was a load balancer, running Squid; jefferson became a mysql server; and the other six — hamilton, jay, hancock, adams, madison, and paine — would host Apache httpd.
Meanwhile, Ellis stood in a corner, mouth agape.
Mercy installed Ubuntu CLI, then the necessary software on each. Finally, Mercy copied the relatively tiny Rockwood for Governor campaign site onto each of the web servers. Everything set, she powered down Rover which had been badly thrashing the whole time and moved the ethernet cable from it to the firewall.
Her consumer-grade hosting solution spun to life.
Mercy checked her phone. Rockwood for Governor displayed in milliseconds, far less than the thirty seconds it was taking on Rover. Rover sat silent for the first time since she started working on the campaign.
“We can scale it up as needed,” she said to Sullivan later that day. The servers soaked the hits from Breitbart and the other sites, none of their CPUs getting more than 30% usage. “That router has sixteen ethernet jacks. And that wifi router can handle up to 256 connections. Plus, with that firewall, Rockwood won’t have to worry about dirty pictures showing up on his website.”
“That was almost $10,000 you spent today,” Sullivan said. "Seashell Hosting would have been cheaper.”
Mercy nodded. “You can tell that to Ellis.”
“Tell me what?” Ellis, who had been slack-jawed the entire afternoon, joined them. He had resumed his usual, smug appearance. “Let me get one thing straight, he said to Mercy. You are not Rockwood’s handler. You don’t get to tell him what to do. And you do not go behind my back.”
Sullivan, who had rebuked Ellis earlier, was silent.
“Hey, I’m just here for the job,” Mercy said. “Let me do it the best way that I know how.”
Mercy turned back to Sullivan. “Another thing. With our new server software, we can build our own payment endpoint now. We could even build a blog into it, so Ellis doesn’t have to export it from FrontPage whenever Rockwood wants to issue a press release.”
“Just don’t go changing the design,” he said. “That’s one thing the boss made clear. It looks fine the way it is.” He left them and went back to Rover, which he began to lovingly disassemble into a box.
“About that.” Mercy showed Sullivan the website from her phone. “We need a mobile-friendly responsive design.”
“But you just heard Ellis—“
“I won’t change the design at full resolution. I’ll just go in, pull out all those inline style declarations into a CSS file, change the markup from tables to divs, and add in some @media styles at mobile resolutions. It’ll be the same design. I’ll look just as ugly on a desktop, but less so on a phone or tablet.”
“Fine,” Sullivan said. “But don’t cross Ellis. He and the boss are & well, bosom buddies, as they put it. That’s all I can say about that.”
Sullivan left behind a blinking, confused Mercy, as her servers hummed behind her. Mercy knew one thing: Ellis was turning into the hardest thing about this job.
[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!
http://thedailywtf.com/articles/mercy-the-mercenary-in-the-cloud
|
Метки: Feature Articles |
Error'd: Please Ignore the Progress Bar |
"Honesty like this should be rewarded - whole dialog box warning that the install progress bar is absolutely crap," wrote John A.
"While looking up places to cash travellers's checques in Ithaca, NY, Amex recommends going to Tunis or Swizerland to do that," John B. writes.
Craig wrote, "All right! My Dropbox limit is now -41GB... Maybe I should back up my negative hard drive?"
"So, let me see if I understand this - A 2 TB hard drive has the potential to store 70 years of ...pictures," writes Bj"orn E.

Alistair K. wrote, "Get in trouble for sleeping too long? Yep, I hear you there."
"I'm familiar with automating things with scripts," writes Michiel S., "But it takes real guts to script the raising and lowering of a bridge."
Phil writes, "Data is corrupted from character 3958 to 3957. Ok. I think I got it."
[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!
http://thedailywtf.com/articles/please-ignore-the-progress-bar
|
Метки: Error'd |
CodeSOD: isAlive |
Why are we here? What is the purpose of life? What does it even mean to be alive?
No, I havent been hanging out in coffee shops wearing a beret and discussing philosophy. Ive instead been puzzling over this code, from Nikolai K.
public boolean isAlive() {
try {
return true;
} catch (Exception var2) {
return false;
}
}
protected void finalize() throws Exception {
try {
if(this.isAlive()) {
;
}
} catch (Exception var2) {
System.err.println("Error occurred in finalize. Exception: " + var2);
throw new Exception(var2);
}
}
There are some deep philsophical questions here, but I dont think we can hope to extract any answers. This code begs for an explanation, but I cant give you one. I dont think the original author could either. The best Nikolai could give us was that this was in a CORBA wrapper object. Perhaps having to use CORBA drove the original developer mad? Or perhaps the original developer has a wisdom that only the mad can access?
When will isAlive return false?
[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
|
Метки: CodeSOD |
Announcements: Tokyo TDWTF Meetup |
Tokyo readers, I'll be in your fine city this month -- and that means it's time for another Tokyo/TDWTF nomihoudai! It's always a fun time, and we've got a good group of regulars now. Here's a pic of a group of us from a past meetup:

If you're unaware, nomihoudai is an easy way for a group of folks to get as much food and drink from the menu as they'd like for a set price over a set duration, without fussing over details like who ordered what and how many. While Japanese people often see this as a convenient offer, as an American I recognize it for the challenge it is -- and conquer it I shall!
So, if you're up for getting together on Friday, April 15 or Friday, April 22 (specific day TBD) in the Shinjuku or Shibuya area, please drop me a note via the contact form or direct, apapadimoulis/inedo.com.
|
Метки: Announcements |
The Pagemaster |
Amanda supported and maintained a website through which clients managed their own data. Occasionally, shed read through access logs in search of unwanted scrapers, rogue bots, and hack attempts.
Her diligence paid off when she caught on to a particular IP that was making a huge amount of requests throughout the day. Page after page of results were being requested less than a second after another, as with a typical scraper bot:
?page=1
?page=2
?page=3
But sometimes, the pages were accessed in reverse order:
?page=34
?page=33
?page=32
This sparked Amandas interest. Why would the scraper go backwards? Analyzing the requests one by one, it seemed to get the first page, then go to the last page (37) and go backwards until page 29, edit a record &
Wait, what? Edit a record? This was a paying customer, then, not just anonymous access. The sequence was
1, 37, 36, 35, 34, 33, 32, 31, 29, edit, 1, 37, 36 …
It made no sense at all. The increases and decreases seemed arbitrary. Also, the time between requests didnt suggest a script. They were short, but ‘human’ pauses. Could this really be a person?
With the same logs, it was easy enough for Amanda to figure out which customer was responsible for the odd traffic. She called the manager and explained the situation.
Are you guys running some sort of script? Theres a weird usage pattern here from your account, and we cant figure out whats going on. You guys are going through pages at a time over and over again, making a single action, then repeating it.
The manager needed almost no time to ponder the issue. Oh, its OK. That’s just Stella.
Stella? Amanda repeated.
Yeah. Shes updating our records.
Amanda frowned. Can I speak to her? Theres gotta be a more efficient way to do what shes doing. Id like to—
It wont help, the manager cut her off.
“What?” Amanda asked.
Youll see. Hang on, Ill transfer you to her extension.
Amanda only had a few seconds to puzzle over the managers remarks before a new voice came over the line. Hi! This is Stella. You wanted to speak to me?
Hi, Stella! This is Amanda from the support team. I noticed that youre going through pages backwards while editing records. Can you tell me what youre doing?
Oh! Well, the records Im updating are usually on some high-number page—lets say page 29, right? Stella asked. "So I have to go to that page, but then I lose the page Im on, so I have to do it again.”
Amandas jaw dropped as she tried to parse what shed just heard. Wait, hang on a minute. Lets step through this together, OK? Im gonna open the website here. Can you tell me exactly what you do to edit records?
Sure! Stella said. First, I open the website. That starts on page 1.
OK, got you so far. Amanda opened the website in a browser on her side.
So lets say I want to edit a record on page 29. I go to page 37—
Wait, what? Amanda interrupted. How are you doing that?
At the bottom of the screen. I use the links there, Stella said.
Amanda glanced down the page, and saw the pagination widget at the bottom:
[1] & [30][31] [32] & [37]
Suddenly, it made sense. Sort of. Oh, OK. Theres no direct link to 29, so you click 37, then 36, and so on until you reach 29?
Right! Stella said. Then I edit the record. When I do that, it jumps me to page 30.
So then you click 37, 36, all the way back to 29 again? Amanda semi-reasoned out.
Not quite, Stella said. I close down the browser, reopen it, then I click on 37 and go back to 29, Stella said.
Amanda frowned at her cubicle wall, perplexed. You know you can just press the back button in the browser after you edit a record, right?
But Id lose my place in the list and wouldnt know where I am, Stella explained. I prefer doing it this way.
The managers earlier assertion came back to bite Amanda hard. Well, OK. As long as youre sure youre OK with this.
Yep! Stella replied. Thank you, though!
Amanda couldnt help feeling unsatisfied. Before putting the whole thing behind herself, she retooled the pagination widget, just for their account:
[0][1] [2][3] [4][5] [6][7] [8][9] [10][11] [12][13] [14][15] [16][17] [18][19] [20][21] [22][23] [24][25] [26][27] [28][29] [30][31] [32][33] [34][35] [36][37]
The resulting logs looked like this:
?page=1
?page=29
?edit=4022
?page=1
?page=29
?edit=4023
|
Метки: Feature Articles |
CodeSOD: The Three Second Rule |
The Five Second Rule is, of course, a myth. If you drop a food item on the ground, the bacteria living on the ground arent going to wait five seconds before moving in. Besides, everything you stuff in your face is already covered with all sorts of bacteria anyway. You have an immune system, you might as well use it.
Adolphus Mannz recently gave his immune system a bit of a workout. In their SalesForce system, they needed a way to determine if a record was being added to the system or updated, and perform some slightly different logic in each case. His fellow developer came up with this rather ugly solution.
This is in SalesForces APEX language:
DateTime CreateDate = DateTime.valueof(proj.get('CreatedDate')) ;
DateTime timeNow = system.now();
Long createTimeSecond = CreateDate.GetTime();
Long currentTimeSecond = timeNow.GetTime();
Decimal Diff = (currentTimeSecond - createTimeSecond) ;
// Under 3000 milliseconds or 3 seconds meaning we are at creation process (Not update).
if( Diff < 3000 )
FirstTimeProjectCreation = true;
On its surface, its terrible. Grab the CreatedDate from a project, and then see if it was in the last three seconds. If it was, then it must be new! When we dig deeper, though, it gets worse. If a project record is being created, guess what the value of CreatedDate is?
Null.
[Advertisement] Release!
is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
|
Метки: CodeSOD |
Mercy the Mercenary in… Trouble at the Town Hall |
Mercy Francis sat inside a drab, storefront office. The walls were covered in posters, captioned the words Rockwood for Governor, for a Righteous Florida! To her right was a map of Florida covered in multi-colored thumbtacks. Below the map sat an aging desktop machine. On its case was slapped a piece of masking tape marked Rover.
Across from her sat Barbie Sullivan. She appeared to be in her fifties, just over five feet high, with a greying bob cut. She had introduced herself as the campaign manager.
“For governor?” Mercy asked. “I thought primary season was over.”
“Oh sure, but John Rockwood’s not affiliated with any party. He’s running as an independent.”
“So the ad said you need someone to manage your online presence.”
“Why yes,” Sullivan replied. “Most people who responded to our classified wanted $200 an hour just for consulting. Consultants don’t actually do work, and we really need someone who can get their hands dirty.”
The consultants Mercy knew certainly did get their hands dirty, as Sullivan had put it, and $200 per hour was not unreasonable for their services. “I can do it for $50,” she said. “You can contact me 24 hours a day, and you’ll be my top priority above any other work I have.” Of course, she didn’t have any other work.
Mercy showed her portfolio to Sullivan on her tablet. She had done SEO for several companies in Orlando, developed and designed web sites many others, but her portfolio site really showed off her design skills.
“Oh wow, this is impressive,” Sullivan said. “I’ll bookmark this for later.” The campaign manager fired up her aging laptop, opened some ancient version of Internet Explorer, and laboriously typed in Mercy’s portfolio URL into the browser. Mercy gritted her teeth; her site downgraded gracefully through several versions of Internet Explorer, but anything below IE 11 made her subtle gradients and background images look like a magazine collage.
“This is very impressive,” Sullivan continued, “but the boss really needs to sign off on this. I’ll talk to him after the event tonight and we’ll call you sometime Monday.”
Mercy handed Sullivan her business card. Printed on one side was her email address and cell phone, and on the other were the words Mercy “The Mercenary Developer” Francis.
As Mercy headed for the door, she heard Sullivan muttered something. “Why isn’t that live stream working?” Sullivan kept refreshing her browser window, staring at a black video player with an error message displayed in its center.
Having freelanced since college, Mercy had developed a knack for knowing an opening when she saw one. “Anything I can help you with?” she asked the frustrated Sullivan.
“Ellis was supposed to have this on an hour ago,” she said. “Harry Ellis, our media manager. He’s been bosom buddies with Rockwood almost as long as I have.” She eyed Mercy. “Do you know anything about ustream?”
“Sure.”
Sullivan offered Mercy her laptop. This version of Internet Explorer lacked a DOM inspector, so Mercy viewed the source instead. The ustream code was formed correctly, as far as Mercy could tell.
“It’s not the code,” she said. “It looks like there’s no video data. I’ll make you a deal. I’ll go to this town hall or whatever and see if I can get that stream working. If I do, you pay me $30, otherwise I walk away with nothing.”
“Oh, I’m sure Ellis will get it working before the boss is on,” Sullivan said. “In half an hour,” she muttered. “But why don’t you go lend a hand? If we offer you the position you’ll be working side-by-side with him. We’ll see about your $30 later.”
Mercy sped in her 10-year-old Honda to Stoneford High School, northwest of Orlando, where Rockwood was holding his town hall meeting. Sullivan had told her she’d find Harry Ellis, the campaign’s media manager, in the gym.
The “town hall” held far short of a whole town, with maybe a few dozen people in attendance. The average age of the audience was around 50 or so. Most wore apparel blazoned with the flag.
In the front row, staring into a laptop screen, was a man with a greying comb-over and a prominent chin. Beside him was some television station’s 80’s era camcorder on a tripod. Mercy made her way to him and introduced herself. “Sullivan sent me over to help with the live feed.”
Ellis didn’t look up from his laptop screen. “You can help if you just shut up and let me do my job,” he said.
Mercy would have left then and there, but she remembered how much beans and rice $30 could buy. Instead, she sat next to Ellis. He pulled his laptop screen close to his chest, squirming away from her.
Around them came a smattering of applause. A tall man in his late 60s strode onto the platform that had been erected in the middle of the gym. Ellis started shaking his head, holding up a hand for the man to stop whatever he was about to do. Ignoring Ellis, the man turned on his microphone, waving down the elderly applause in the gym.
“Ellis here says we’re not live, but I know you’ve been waiting a long time to see me, so let’s get this started.”
Ellis closed his laptop. “So much for that.”
Mercy yanked the laptop away from him before he had a chance to put it away. On the screen was a ustream profile page; in the corner, she could see he was logged in as JohnRockwoodCamp.
“I’m so glad to be here, Stoneford,” Rockwood said. As Rockwood stumped in the gym, Mercy checked the stream settings while Ellis muttered next to her. Everything was set up correctly, as far as she could tell. It was set to record from a video feed coming through USB. Nothing wrong with ustream, then. Barring some issue with the laptop, the problem must be whatever camera he was using. It clearly wasn’t using the laptop’s webcam, so it had to be in the gym somewhere.
She turned to hand the laptop back to Ellis, but he had left. She set the laptop on his empty seat.
Mercy found a usb cable connected to the laptop. Unless Ellis was stupid enough to run usb halfway around the gym, the camera itself shouldn’t be more than a few yards away. She followed the cord.
It led to the ancient camcorder on the tripod next to her.
Out the corner of her eye, she spotted Ellis chatting with what looked like a police officer in the doorway.
Meanwhile, Rockwood continued his speech, extolling the virtues of the native Floridian on stage.
She examined the side of the camcorder, wondering how Ellis managed to connect a USB cable to something from the Reagan administration. Ellis had connected several dongles: USB to DVI, then to S-Video, then to the camcorder. The camcorder was on, the low-resolution video visible in the viewfinder. But the DVI-to-S-Video was paired incorrectly: the dongle down-converted from SVI to S-Video, not up-converted. Regardless, DVI was designed not to work with analog input. It would never have worked, regardless of what series of dongles Ellis had used to hook it up.
The police office approached her, followed by Ellis.
Mercy remembered that her smartphone had a ustream app, and she still had the charger in her purse. She lifted the heavy camcorder off the tripod, setting it gently in the seat nearby. She unplugged all the dongles, then plugged the end of the USB cable into her own, which went into her phone. She set the phone’s camera on record. There was no way to keep the phone on the tripod, though. So she took out her duct tape.
“Time to go, miss,” the officer said.
“I’m fixing your feed,” Mercy said to Ellis, ignoring the cop. She tore off a bit of duct tape, rolled it into a loop, and used it to stick her phone to one of the legs. “Why don’t you go check?” she said to Ellis.
Ellis, fuming, went to his seat and opened his laptop. The ustream page showed Mercy’s phone camera footage in the player.
Rockwood continued his speech. His eyes glanced back at the three of them around the tripod. After he finished his thoughts on the IRS and tax codes, he paused for nearly ten seconds, his eyes glazing over, trance-like. Then, he spoke. “You know, I just want to thank our volunteers for all they’re doing. I think they finally got us live. Could you give them a round of applause?”
The audience did so. Ellis, caught in the act of throwing out the one person who was making Rockwood happy, faking a toothy, shark-like smile, and returned to his seat. The officer returned to the door, leaving Mercy with her duct-taped phone. She waved.
“We have to make our state of Florida a better place for these young people. That’s why I have a proposal, one that none of my fellow candidates for the republican nomination would ever make. When I become the next governor of Florida, going to college at a state institution will be free. Not subsidized, not loaned out at high interest, free. Room, board, and everything else.”
Before Ellis had another chance to toss her out of the gym, Mercy headed back to her apartment.
Mercy drove to Rockwood campaign headquarters on Monday to pick up her check for $30. The storefront office was filled with volunteers, wearing “Righteous Rockwood” t-shirts. They were applauding as she entered.
John Rockwood was making an impromptu speech in the back. “You young people are the reason why this campaign is going to change Florida,” he said. “The Democrats don’t own you, the Republicans don’t own you. You know Harold Packard, the Republican who’s foolish enough to run against me? He says you’re all a bunch of freeloaders. What he really means is that he’s scared of you. Well, I’m not scared!” More applause.
The candidate finished his speech, and his volunteers dispersed. Meanwhile, Sullivan grabbed Mercy’s arm and led her to Rockwood himself. “You’re the one who helped Ellis get that video going,” the candidate said, shaking her hand. “What’s your name?”
“Mercy Francis,” she said, wincing at his handshake.
“Lord have Mercy,” he said, chuckling. “You know, I have never once used email, or used one of those smart-eye-phones, so I’m glad I have people like you and Ellis and Barbie over here to help me out.”
As she spoke to Rockwood, Ellis spotted her and moved to intervene. Before he reached them, Sullivan moved between them with a graceful smile. “Ellis, this is Mercy Francis, our new online presence manager,” she said. “She’ll be working with you to get our online presence up to snuff.”
“I don’t need her help,” Ellis said, pointing at Mercy.
Barbie showed a sugary sweet smile. “Oh, yes we do. In fact, Rockwood asked for her personally, after she showed what an asset she was on Friday.”
Ellis, fists clenched, spun on his heels and went back to his laptop.
“That was quite an impression you left,” she said. “We’ll write a check, as we agreed. But I have a proposal.” She led Mercy to a windowless conference room in the back of the storefront. “Forget $30,” Sullivan said. “How does $3000 a month sound? Our donations have gone through the roof since his speech, and we have you to thank for that getting out there.”
“Done,” Mercy said, shaking hands.
http://thedailywtf.com/articles/mercy-the-mercenary-in-trouble-at-the-town-hall
|
Метки: Feature Articles |
Radio WTF: A Day of Mei |
Soundcloud Links: Radio WTF: A Day of Mei
Direct Download: ADayOfMei.mp3
Starring (in order of appearance) Devin Sweeny... as MeiFeaturing the voice of Paul Rousse of VoiceByPaul.com, and the song "Slow Burn" by Kevin MacLeod of Incompetech.com.
Scenes
NARRATOR
Radio W.T.F. presents...
SOUND: Intro music sting
NARRATOR
The Daily WTF
SOUND: end of intro music sting
NARRATOR
Today's episode, "A Day of Mei", adapted for radio by Lorne Kates, from a submission by Nathan B.
NARRATOR
Mei is a great manager-- the greatest that Initech Corporation has. Like all great managers, she doesn't just lead-- she inspires greatness in those under her. Constant, vigilant management is the only difference between a well-oiled machine... and a herd of oil-soaked cats hopped up on caffine.
NARRATOR
Though she's been blessed with some young, whip-smart upcomers-- her job was also kept "intersting" by certain senior-level old-timers who, despite themselves, may just be past their prime...
SOUND: Nathan running into lobby, people milling about
MEI
Good morning, Nathan
NATHAN
(startled)
Um, good morning, Mei.
MEI
Good morning indeed, since we're well into it. Does not the workday start at 9am, or am I wrong?
NATHAN
Sorry, there was a bit of traffic in the parking lot and-
MEI
(interrupts him)
If I made an exception for you, everyone else would want an exception, and pretty soon everyone would be coming in at 11am.
NATHAN
But it's only 9:03...
MEI
Van Gough never had someone tell him to come to work on time, because he was passionate about his job.
NATHAN
Didn't Van Gough go insane and kill himself at 37?
MEI
And he'd made dozens of great paintings by then. And look at you, you're already well past that age.
NATHAN
I'm only 32!
MEI
And still just a programmer. At this rate you'll never succeed into Management.
NATHAN
I'm senior project lead-- and that doesn't even matter because I don't want to be a manager.
MEI
And you never would be with your attitude. I mean, showing up late for work, come on, Nathan. You need to be punctual-- reliable. I'm sure you still think you can play video games until whenever and wake up on time, but you're getting older now, Nathan. You need to make schedules and stick to them. I want to put more structure in your life-- to help you be successful.
NATHAN
But--
MEI
Now, I think you've wasted enough company time standing here talking instead of working. Get to your desk for now. Will you be on time tomorrow morning, yes or no?
NATHAN
The traffic--
MEI
Yes or no?
NATHAN
(pause)
Yes.
MEI
Excellent. Glad to hear that. Now run along.
NATHAN
(walks away)
SOUND: Nathan walking away
MEI
(stage whisper to self)
A manager inspires.
NARRATOR
Mei, like all great managers, knew that communication was the absolute key to keeping a team focused. Left to their own devices, developers would fly off on tangents, chasing down whatever shiny bauble that caught their eye. Constant communication HAD to be maintined-- dilligent, regular communication. And there was no greater, more effective form of communication than the face-to-face meeting.
MEI
Now that we're all here, and no one certain person is late, we can begin this meeting-- wait, hang on. Nathan, your Lync instant messenger status is still set to Available.
NATHAN
Uhh-- sure, I guess so?
MEI
But you aren't available. You're in a meeting.
NATHAN
But anyone who needs me via Lync is in this meeting.
MEI
I'm not looking for excuses, Nathan. Just action.
NATHAN
... okay.SOUND: click, signoff sound (repeated by every other laptop in room)
MEI
And Phillip, I didn't receive your Away from Desk email.
PHILILP
Sorry-- I just though that, like Nathan said, since everyone would be in this meeting--
MEI
I'm not interested in excuses, Phillip. We have protocol so you don't have to think. It just leads to second guessing best practices and making mistakes. Please send your email before we begin.
PHILILP
Okay--
SOUND: PHILLIP typing
SOUND: multiple outlook bings
MEI
As always, Luke will be taking the minutes. Thank you Luke.
LUKE
Glad to help.
MEI
See, everyone? Luke's positive attitude is the difference between earning his way into management, and being stuck a junior developer forever. You can all learn something from him.
LUKE
I put in the notes, by the way, that Phillip and Nathan were reminded of proper meeting attendance protocol.
MEI
Thank you, Luke. Now we can begin properly. The agenda of this meeting is the rewrite of Acme's web application.
NATHAN
I have the conference call dial-in info. Can you pass me the phone?
MEI
I already have Acme on the line.
NATHAN
Wait-- What?
SAMUEL
(on speakerphone)
Samuel from Acme Corp here
NATHAN
(recovering from that, switching from casual to professional tone)
Hi, Sam! Didn't realize you were already online. Sorry for all the internal chatter there.
MEI
It's important that Samuel understands how disorganized the developers are, to know why the project's timelines are slipping. That's why we're having this meeting, and another one every day, to get this project on the correct track. The last iteration of the project was an utter disaster, which is why I'm in charge of it now-- and the developers who worked on it are not only off the project, but gone from the company. You've got the bright, young mind of Luke working on the project now-- and also the other two. Developers will be developers, so let's all stay focused here.
NATHAN
Uh, sure. Sam, something you had flagged in the existing system was the backorder fulfillment logic. When someone places an order for more stock than you have, you want to tell the person when their order will be ready-- based on the expected arrival date of the earliest Purchase Order with sufficient stock. But I understand the current system doesn't always present the correct targets, is that right?
SAMUEL
Yeah, it'll do dumbass stuff like promising the same upcoming order to multiple people.
PHILLIP
Hi, Sam, this is Phillip. I reviewed the existing code, and I can sorta see where that's happening. I drafted a design document that should cover these use-cases, and...
MEI
Hang on, why is this is the first I'm hearing of this?!?
NATHAN
Uh-- this was discussed in the kickoff meeting--
MEI
No, not the feature! I'm not an idiot, I know about the backorder feature. I mean this "design document". No one authorized you to make design decisions.
PHILILP
This isn't a decision-- it's a design proposal for some architecture we can use to--
MEI
How can you possibly "design" or "document" anything before the code is written? We're an agile environment. We make up our design and architecture as we go!
PHILILP
The document is what we're going to code against...
MEI
And by the time the code is finalized, the design will have changed. Your document will be out of date and wrong. All you've done is waste time and confuse any future developer who has the misfortune of reading your incorrect document. Get rid of it! Luke, put it in the minutes that Phillip is to delete the documents he wasted company time creating.
LUKE
(typing)
Done. I'll start keeping track of features that we actually discuss as a team, rather than making up willy-nilly.
MEI
That's an excellent idea. Luke will track all the features from now on. But for this call,the only thing to discuss is this fulfillment feature.
PHILLIP
The issue is that we have to--
MEI
No, Phillip, you already had your chance to contribute, but wasted it on a design document. You just sit there and listen while we come up with a SOLUTION, rather than a design. Why doesn't this feature work, Luke?
LUKE
It's caching all the Purchase Orders when someone puts an item in their cart, then looping over each one to determine which one has enough quantity. As we all know, loops are inherently slow. We should always be querying live data, because SQL is faster than loops.
MEI
And caching never works properly with real-world data. This is what happens when you let programmers "design" without proper oversight. They just waste time on academic exercises like this, instead of being practical.
SAMUEL
So that's why multiple people will get promised the stock from the same purchase order?
LUKE
Yes, absolutely.
NATHAN
Uh-- yes and no. The system is identifying which purchase order to use, but isn't earmarking that stock for one specific user.
LUKE
Which is why we're just doing a SELECT TOP 1 purchase order that matches. That way we can earmark that one record.
NATHAN
But that still doesn't solve the concurrency issue where two users grab for the same one record. And I don't think it address the new feature, where the order can be fulfilled from MULTIPLE purchase orders. You really have to lock the PO table, and start earmarking stock over and over again until the order is fulfilled.
LUKE
All you've done is put a loop back in! Queries are fast, and loops are slow. You never use loops and SQL at the same time.
MEI
And I don't know what a "table lock" is, but it sounds like you're just trying to come up with something fancy and complicated. We need a clean, simple solution-- not more head-in-the-clouds fantasy. Your over-engineered complex idea will be impossible for other developers to maintain.
NATHAN
You can't work with multiple database records without a loop. And you can't do multiple database operations without locking the table.
MEI
(angry)
I've had enough of this, Nathan! The rest of us are coming up with solutions, and you're still prattling on about this non-starter. Sam, unfortunately, it sounds like it's literally impossible to fulfill a backorder from multiple purchase orders, so the system won't be able to support that feature.
SAMUEL
Um, that's a key feature that my customers want.
MEI
Your customers don't want it. They don't even know what a purchase order is.
SAMUEL
But they know the difference between getting two small fulfilments versus all at once later.
MEI
Sam, your customers have been dealing with OUR system for years, and we are the experts at knowing what they want. No one has ever asked for this feature before, and it's silly to force them into it just because you feel they want it. It's a whole bunch of extra hoops to jump through for NO benefit. Now my way-- the RIGHT way-- is better. This way your customers get their deliveries all at once, instead of sitting around like jackasses waiting for heaven-knows how many different UPS trucks to arrive. Keeping the logic the way it is is the best, cleanest solution. I like it.
SAMUEL
Actually, Mei, Nathan sounds like he has a solution.
MEI
No, Sam, that will crash your entire system and break ordering entierly. You should know better than that. Unless you've suddenly become a programmer overnight? Have you, Samuel?
SAMUEL
You don't have to be a programmer to realize--
MEI
Yes or no, Samuel. Do you suddenly know better than me how a programming project should run?
SAMUEL
No, I just think--
MEI
Exactly. No. Luke, do you think you can explain your SELECT TOP ONE in a way that even Phillip and Nathan can understand?
LUKE
Hmm, yeah, I can dumb it down for them, sure.
MEI
Good, then we have a (sarcastic) "design". Sam, we'll have an update for you during the next status call.
SAMUEL
Okay, I suppose. Until then.
(he hangs up)
MEI
As for you two-- since we can't risk you going off-track and wasting any more time, I'm making Luke interim project lead. He'll tell you the exact feature you should be working on. But don't even dare to touch your keyboard before bringing your solution proposals to me. I will tell you if it will work or not. I think this will keep us from wasting any more time. Now, all of you back to your desk, and I'll see you in a half-hour for the mid-day status meeting.
NARRATOR
Like all great managers, Mei knew that quality lived in the details. And yet, too many managers got lost in the big picture, and couldn't see the trees from the forest. The finer details wouldn't perfect themselves. Details were vetted by the person best suited to vet them: Mei herself.
MEI
(heavy sigh)
Can no one do anything right around here?
SOUND: Stand up, walk out of office, over to Nathan's desk
NATHAN
(muttering as he types)
Select... top... one... from... purchase orders...
MEI
(Over his shoulder)
Nathan!
NATHAN
(jump)
Ah what no what uh yeah?
MEI
Nathan, I sent you an important email. Why do I not have a response yet?
NATHAN
(coming out of code haze)
What-- sorry, I didn't even notice the new mail icon. Let me check-- what? This one? From five minutes ago?
MEI
I've been waiting for your response, and now you've thrown my entire afternoon schedule off. I expect a prompt response to a mission critical email.
NATHAN
I was trying to focus on the Purchase Order feature. Why didn't you just Lync me? It'd pop up right away. That's why we have it!
MEI
If you aren't checking your email at least every five minutes, you are doing the whole team a disservice with your tardiness. Now open the attachment. There is important work being held up by some simple fundamentals that aren't done properly.
NATHAN
What is it?
SOUND: Double click
NATHAN
It's-- a big blob of blue?
MEI
It's the background for the logo for the website, and it's completely wrong.
(her tone of voice switches to partly accusatory, partly pandering-- even though nathan has nothing to do with the color choice)
Tell me, Nathan, what color is that?
NATHAN
Umm... blue?
MEI
No, not just "blue". What is that EXACT color?
NATHAN
Oh-- um--- let me pull up the colorpicker-- that's hex 008081.
MEI
Nathan, do you think real people think of colors as number gobbldy-gook? No. Use your brain. What is the NAME of that color?
NATHAN
There isn't a named HTML color for that. The closet HTML color would be-- here's w3school's hex chart-- uhh-- hex 008080-- that is Teal.
MEI
Yuck. Ugly. No wonder it got screwed up. I explicitly asked for Cobolt. Change this to Cobolt.
NATHAN
Do you have the hex code-- I mean, there isn't an HTML color called "cobolt"
MEI
Unacceptable. Install a different color pack.
NATHAN
That isn't how css works.
MEI
Then css is wrong! That color isn't what I asked for. It isn't anywhere near what I want.
NATHAN
What's wrong with it?
MEI
It's too blue.
NATHAN
The blue is-- too-- blue?
MEI
Yes.
(pause a beat)
Well? Fix it.
NATHAN
(giving in to the madness)
Fix it. Right. Why not? Let's make this blue not so blue! Here, Teal.
MEI
Hmm, still too blue.
NATHAN
Of course it is! Let's make it DarkCyan
MEI
Yucky, too green.
NATHAN
Let's get some red all up in this BAM! Indigo.
MEI
Way too red.
NATHAN
Can't have it not perfect. Hey, let's try something radical. THREE COLORS TO PICK FROM: Navy, DarkBlue and MediumBlue.
MEI
Oh, they all look possible, hmm...
(In a sing-songy call)
Oh Luuuuke. Come here a moment.
SOUND: Footsteps coming over
LUKE
Oooo, is this for the new logo?
MEI
Yes, what do you think.
LUKE
Hmmm
(A moment of contemplative pause)
Navy. Definately Navy.
MEI
Yes, I completely agree. Navy. There, see, Nathan? Done in five seconds without any fussiness. It's nice to have a dev like Luke who can get things done without arguments. Make the background navy.
NATHAN
Sure. I'll do that RIGHT NOW. Changing it-- watch it go from hex 008081 to hex 008080! Look at that, such a change.
MEI
Looks much better. It is extremely important to ensure that the CORRECT colors get used. It's literally the face of the website. It doesn't matter what fancy academic brain-exercises you put in behind the scenes-- if it doesn't look right on the outside, then it creates a bad first impression, and that's all the end user really cares about. Now, add our company logo to that, make it 100 by 100, and deploy it to the Timesheet website.
NATHAN
Sure I-- what. (flat what) Timesheet?
MEI
Yes, Nathan, the timesheet-- where we all enter our time. You should know this.
NATHAN
Our timesheet website. Our INTERNAL timesheet website-- you just made me spend all this time to background of a site-- a site no one but internal employees will see-- by ONE SHADE OF BLUE? Mei, I have to concentrate on Acme's purchase order feature! It has to be my top priority.
MEI
Nathan, you aren't managemet-material-- you can't be expected to comprehend priority decisions, and that's okay-- it would be unfair to expect you to do something you aren't capable of. That's why your top priority is whatever I decide it is. But even then, Nathan-- sure the Acme system needs to be worked on, but come on-- this logo isn't a DIFFICULT task. I've already told you how to fix it, you just need to do grunt work to get it done. You shouldn't be having such problems with multi-tasking, Nathan.
LUKE
Yeah, Nathan, I guess this is hard for your because it just doesn't come naturally. I mean, look at me-- not only did I solve your color problem, but I've already got amazing code coverage throughout the entirety of the Acme system. Not just grinding away at one measly feature-- but the ENTIRE APP!
MEI
Code coverage is extremely important. So complete this simple task, reply to my email so I know it's done, then keep working on Acme.
NATHAN
(grumbling)
Logo-- stupid logo-- add the .png of the new logo-- css-- set background-color: NavyBlue. Save. Publish. There. Done.
MEI
That wasn't so hard. Now send me the email.
SOUND: keyboard as he types email, hard hit when he sends
NATHAN
But you just saw me-- uhg. "To: Mei. Re: Timesheet. See timesheet site. signed Nathan." Send.
MEI
Good. And Nathan, next time you get stuck, just ask Luke for help. You obviously need it.
SOUND: mei and luke walking away while they talk, with nathan's voice fading off
NATHAN
(grumble)
select... top... one... from... purchase orders...
SOUND: mei and luke closing door, sitting down in her office, refresh page
MEI
Timesheet site-- reload. (scoff, tsk, tsk) Such a simple task, and still. Look at it.
LUKE
Really, are you surprised he can't even get this right?
MEI
I guess not. So dissapointing.
SOUND: mei pick up phone, dial, ring
NATHAN
(off in the distance)
OH COME ON! WHAT THE F
SOUND: pick up phone
NATHAN
(fake pleasant)
Yes, Mei?
MEI
Get in my office. Now.
SOUND: Phone hanging up-- her hanging up on him
SOUND: walking over to office
MEI
Nathan, I do NOT appreciate being lied to.
NATHAN
What? Lying-- about what?
MEI
About changing the logo background.
NATHAN
I didn't-- what are you talking about?
MEI
You're either lying, or so incompetant you can't complete a simple task. Look at my monitor, Nathan. Look at my Timesheet. What do you see?
NATHAN
(mumbling)
Too many useless meetings.
MEI
What?
NATHAN
(aloud)
Nothing. What am I looking for?
MEI
USE YOUR EYES! Look at the logo.
NATHAN
Yes-- that's the new logo. I just published it, like I said.
MEI
I have you VERY SPECIFIC instructions about the color and you can't even get that right!
NATHAN
I don't know what to tell you. It's the new logo, it's the new color.
MEI
It isn't the right color.
LUKE
It's completely the wrong shade of blue. Even I can see that!
NATHAN
Oh really, Luke? Well, what color is it?
LUKE
(slight pause stammer)
Well-- it's the wrong color.
NATHAN
Uh-huh. What does the element inspetor say?
LUKE
"Element inspector"? Just because you messed up doesn't mean you get to call me sarcastic little names.NATHAN
For the love of-- here...
SOUND: mouse clicking
NATHAN
There, see? Background color is NavyBlue-- hex 008080, the exact one you picked out.
MEI
Impossible. You broke something when you deployed the logo because the shade is wrong. It looks NOTHING like the one on your screen. You must have deployed the wrong color pack.
NATHAN
Again, this is no how css works.
LUKE
Then obviously you don't know enough about the CASCADING part of css. Just because it says NavyBlue doesn't mean it is. It's probably being overridden somewhere.
MEI
That MUST be it. Fix the css.
NATHAN
Again, that isn't how css works. If it was being overriden, the element inspector would have said so.
LUKE
You keep relying on this "element inspector", and I've never even heard of it before. I don't trust some silly little Open Source tool that no one uses.
NATHAN
You've never used browser dev tools? Well color me a deep, full shade of "not shocked at all". Here, screen capture-- color picker-- there, NavyBlue, hex 008080. The color is right.
MEI
No it isn't! Stop making excuses and just FIX THIS!
NATHAN
There's nothing to fix. I don't know-- maybe it's just your monitor that's off.
MEI
Impossible. My monitor is expensive.
LUKE
It is definately your css programming code.
NATHAN
Css code-- you know what? I'll prove it to you. I'm getting my laptop.
SOUND: stomping off, grabbing laptop, stomping back, putting laptop on table
NATHAN
Look. Side by side, exact same website. Different colors. Every monitor is slightly different.
MEI
Then fix your screen so it looks correct like mine.
NATHAN
Actually, I think you just need to adjust the color temperature of your monitor. Mine is correct: I've already white balanced it.
MEI
I don't know or care what that is.
LUKE
This is what he always does, tries to baffle with bully technical terms. We're trying to fix a problem with the color blue, and he tries to confuse things by changing the topic to "white".
MEI
I'm tired of your excuses, Nathan. Give your laptop to Luke and he'll correct it.
NATHAN
I'd rather not hand my development laptop over to--
MEI
(interrupts him hard)
It isn't YOUR laptop. You work for me. That is MY laptop.
NATHAN
If we're being pedantic, it's the company's laptop--
MEI
I am your boss, Nathan! Everything you say, do or use is mine. Now stop being insubordinate and GIVE LUKE YOUR LAPTOP TO FIX.
NATHAN
You know what? Fine. Take it. I honestly don't care enough about the shades of colors to argue. Literally no one else does. Here. Spend more time from Acme's budget on your project. I'm sure the deadlines will understand.
LUKE
Give me that--
SOUND: working on the computer
LUKE
Monitor settings -- advanced -- ha. hahahaha. Oh my god, you can't do ANYTHING right, can you, Nathan. See, Mei? See. He has the color temperature set to "Tungsten" when we OBVIOUSLY have Flourescent lightbulbs in the office. I told you he doesn't know anything about colors.
MEI
That's why I have to dictate every little detail. Ah, there, much better, that matches my screen.
NATHAN
Wow. Amazing. Now I have to get back to the Acme project...
MEI
No. Stop trying to weasle your way out of work. You still have a logo to fix.
NATHAN
Seriously? Mei, if I don't get back to Acme--
MEI
I don't care. You need to learn to take responsibility for yourself-- take some PRIDE in your work. Now sit down, right now, and fix your mistake. Maybe this will teach you to do things right the first time.
NATHAN
(exhausted sigh)
It's your call. You're responsible for the projects.
MEI
I don't like threats. Now, show me the right shade of blue.
Nathan
Teal
MEI
Um, definately not
Nathan
Cyan
MEI
Not feeling it.
Nathan
DeepSkyBlue
MEI
Uhg, too blue
Nathan
Aqua
MEI
Too green
Nathan
DodgerBlue
MEI
Don't like it
Nathan
LightSeaGreen
MEI
Too close to baby vomit
Nathan
RoyalBlue
MEI
Yuck, gross
Nathan
SteelBlue
MEI
Too close to grey
Nathan
DarkSlateBlue
MEI
Definately not
Nathan
Cadet
MEI
Huh? What is that?
Nathan
Cornflower
MEI
That sounds gross
Nathan
AquaMarine
MEI
No
Nathan
Powder
MEI
Uh-- too much-- uhg-- I can't even
Nathan
Alice
MEI
What? No!
Nathan
Azure
MEI
Yuck
Nathan
SkyBlue
MEI
You already said that!
Nathan
Well, I said DeepSkyBlue-- meh.
Nathan
How about DarkCyan?
MEI
(pause)
There!
NATHAN
Okay! Finally. Background color: DarkCyan-- 008B8B.
MEI
Perfect. NOW publish it.
NATHAN
Done.
MEI
See how much easier it is to just do things right the first time? Now, Luke will be by later to check in to make sure you're on schedule for Acme.
NATHAN
I'd hate to fall behind on that.
SOUND: grabbing laptop, getting up
MEI
And Nathan?
NATHAN
Hmm?
MEI
This whole time you've been in my office, I intentionally didn't mention this, because I was hoping you'd have the good sense to fix it yourself-- but your didn't change you Lync status from "Available" for this entire meeting. Very, very dissapointing, Nathan.
NATHAN
(just exhausted for a beat, then leaves)
SOUND: footsteps going back to desk
NATHAN
(fading out)
Great, now my screen looks like yellow tinted crap. No time to fix it-- where was I-- SQL-- umm--
SOUND: office outlook appointment bing
NATHAN
(horrified)
No.
MEI
(calling out to entire office in singsong)
Afternoon progress meeting everyone, main boardroom! Chop chop!
NARRATOR
Like all great managers, Mei knew that sometimes the major roadblock to a project's success were the stakeholders themselves. Lesser people thought with their egos. Mei had to keep a firm and unforgiving hand on the carrot, and-- if necessary-- use that carrot to whip the team back in line.
MEI
Okay, everyone is here-- time to go over how the day went. Luke, as always, is graciously taking the minutes.
LUKE
I'd love to record the attendance, but Phillip didn't give me the correct information. I don't know what meeting he's attending.
PHILLIP
What? I sent you the stupid email-- the "I'll be in a meeting" email. I even put WHICH meeting!
LUKE
Yes, but it just says "Afternoon status" meeting. It doesn't have the date or time.
PHILLIP
Just look at the time of the email!
MEI
No, Phillip, that isn't good enough. I expect you to write out the date and time, and not rely on lazy shortcuts like that. Computers are NORTORIOUS for losing time. We can't rely on that timestamp at all. Luke will fill it in this one time-- even though that ISN'T his job to fix your mistakes-- just so we can actually get this meeting started.
(sickly sweet)
But yay, look at that, Nathan remembered to set his Lync status properly. Very good job, Nathan. Looks like an old dog can learn new tricks.
LUKE
You just have to rub his nose in it a few times first.
NATHAN
Yeah. Ha. Whatever.
MEI
Now, you are all very lucky today, because I was just moments away from coming into this meeting extremely upset about the lack of overall progress. The inability of some people to adhere to timelines and schedules is mind-boggling. I simply can't understand how anyone can be so sloppy and careless and still be able to look themselves in the mirror and sleep at night. But thankfully, the law of averages works in your favor sometimes. Luke has put in some excellent work, completed a large swatch of the system-- and I'm happy to say the Acme project overall is ahead of my expectations for today's timelines. Luke has, single-handedly, completely 85% of the project.
PHILILP
What? I've been banging my head against just the START of the checkout process and Nathan's been doing the backorder bit. That IS the entire project!
MEI
You all are so focused on your little worlds you can't see the big picture around you. I ran a report, and Luke's code represents 85% of the system.
NATHAN
HOW? The checkout and backorder systems are 95% of the billable hours.
LUKE
I took the initiative, and carved out a roadmap for the rest of you to follow. It's all there in the source code repository. I have 85% code coverage.
NATHAN
Code coverage? Are we talking code coverage or CODE?
MEI
Don't nitpick Luke's work, Nathan. It's unbecoming.
NATHAN
But there's a difference. You said the work's in source control? Let me see.
SOUND: CLICKING
NATHAN
This? THIS? This is just code stubs-- placeholder methods-- TODO functions! This is what you're talking about?
LUKE
Exactly. I've already done all the hard thinking for everyone. Now all the rest of the team just needs to bang on some keyboards to fill the rest in.
NATHAN
Mei, come on-- this is just the equivilant of writing "build house here" without even providing details about what material to use-- let alone actually building the wall.
LUKE
No, this is laying bricks where a master architect has told you to build a brick wall. You don't need to know the "details". You just follow the path I've forged.
MEI
It's the 80/20 rule, Nathan. Luke's done 80% of the work with 20% of the effort. Has he not laid out exactly what needs to be done?
NATHAN
It isn't just a matter of saying some magic words and--
MEI
I asked "yes or no", Nathan.
NATHAN
This isn't a "yes or no" question! There's serious design and logical implications to implementing--
MEI
Yes or no. Luke has 85% code coverage, yes or no?
NATHAN
... according to whatever metric, yes, but--
MEI
Great. Why are you fighting me so hard on a simple compliment? Don't you realize you are benfiting from Luke's victory?
NATHAN
Fine, whatever.
PHILILP
(frustrated)
Oh my god, no! Mei, even if Luke's code stubs are great and forge the right path for the next three weeks of work-- which they're not, by the way, they're just not-- THERE IS STILL THREE WEEKS WORTH OF WORK TO DO! Code coverage doesn't change the timelines!
SAMUEL
(on speakerphone)
Wait, three weeks? This is the first I'm hearing of this.
PHILLIP
(exhasperated)
You have the customer on the phone AGAIN?!?
Samuel
Mei, what's this three weeks? I'm scheduled to see a demo of the system end of day TOMORROW.
NATHAN
What?
MEI
Oh, no worries, that's still on track for tomorrow.
NATHAN
WHAT?
PHILLIP
(simultaniously)
WHAT?
SAMUEL
How can that be when I'm hearing three weeks?
MEI
Samuel, you're just hearing wrong. Three weeks of effort doesn't mean three weeks of calendar days. This is a team effort, and team hours-- and you'll have a working beta demo tomorrow, and final delivery Wednesday afternoon.
SAMUEL
Only a Beta? I booked my people for user acceptance testing on Tuesday morning!
MEI
I don't appreciate you changing your expectations on me, Samuel. A demo CLEARLY insinuates a beta demo, not a deliverable.
SAMUEL
No! Demo tomorrow, deliverable by Tuesday! I've got a schedule too.
MEI
One that you made up all by yourself without consulting your primary stakeholder: me. And I'm sorry, but a lack of planning on YOUR part doesn't constitute an emergency on MINE. I manage my department PROPERLY, Samuel. I don't just make up timelines on the fly, like you seem to do. I invitied you here-- to this call-- so you could hear about the progress of your project, not latch onto numbers some random employee pulled out of his ass and try to threaten me with them. It's extremely rude, and extremely disrespectful to me as a manager. So you can behave and expect your demo tomorrow, or you can hang up and pout like a child.
SAMUEL
I'm not happy about this, Mei.
MEI
I'm not in charge of managing your happiness.
SAMUEL
(pause a beat)
Demo tomorrow, deliverable when?
MEI
Wednesday afternoon, as we already agreed upon.
SAMUEL
Fine.
SOUND: PHONE HANGING UP on other end, dialtone, done
MEI
As for the rest of you-- Luke excepted of course-- if you can bother to stop mismanaging your schedules, you won't keep wasting hours on other projects. There's a hard deadline, and you've all already pissed off the customer enough with delays. Get it done, and on time. Got it?
NATHAN
Yeah, about that. In all the meetings we've had about this project-- and boy oh boy have there been so many-- and all the times we've brought up the number of hours of effort remaining-- why has there never once, not even once-- and I'm sure Luke's oh-so-wonderful meeting minutes will confirm this-- has there never been a mention of a final delivery next Wednesday?
MEI
You're not management. You don't need to know delivery dates. They'd just confuse you.
NATHAN
There's nothing confusing at all. People knowing how much time they have to complete a task let's them know-- surprisingly-- how much time they have to complete a task.
MEI
No, if you give developers a timeframe, they just inflate the work to fill the time. I need tasks completed, not developers fooling around all day to "work on" a five minute task. That isn't how you manage.
NATHAN
Well, Mei, you've managed to manage us into a corner with more hours of work to do than there are working hours in the day. We just can't meet that deadline.
MEI
But that's the deadline. We've agreed to a delivery date.
PHILILP
No-- you agreed to it, without seeing if it was possible.
MEI
(pause, you can almost hear the wheels turning as her tone shifts from desperate back into "manager")
Okay. It's okay. I understand, I get it. I apologise, I thought you were capable enough to complete the project, but I was mistaken. It isn't fair of me to expect you to do what you can't do.
NATHAN
Whoa-- That isn't what Phillip was saying-- I mean-- it isn't a matter of not being ABLE to do it.
MEI
No, that's what you're saying, that's what you're telling me. You two can't complete this project-- it's beyond your skill. It's okay, I can reassign your tasks to Luke, he can finish your work for you.
NATHAN
Nonono-- You don't have to do that, Mei. It isn't a matter of skill.
MEI
So Luke isn't capable of finishing your work?
NATHAN
I'm not saying that
PHillip
I am. I'm saying that. This is really complex code we're working on, and I barely trust Luke to be able to find his own butt with a lit roadflare in it.
LUKE
HEY!
PHILLIP
There's no way he can take over what we're doing.
NATHAN
Again, Mei, it isn't a matter of skill, but just the reality of the number of hours in the workday.
MEI
Of course, I understand that, you guys both want to be out the door at 5pm sharp, no exceptions, no matter what.
NATHAN
If it was just a few extra hours, it wouldn't be a problem. And I'm not saying I'm not willing to put in some overtime, but...
PHILLIP
I'm saying it! What's that saying of yours, Mei? "I'm sorry, but a lack of planning on YOUR part doesn't constitute an emergency on MINE."
MEI
Well, Phillip, honestly-- with both Luke and Nathan's dedication-- you know, actual pride in their craft-- with those hours they'll put in, maybe we won't need your hours. You can leave. Your coworkers will cover your work.
PHILILP
If you're going to fire me, then just fire me.
MEI
I never said that. I'm just hearing what you're saying, and if you're saying you aren't needed here and that other people can do your job, no one is forcing you to stay. I'm sure it's a great job market out there.
PHILLIP
(another stand-off pause)
Okay. Just this once. Just this once, and only because I'm not willing to screw over Samuel.
NATHAN
Yeah, if we push hard over the next few nights-- worse case work from home this weekend-- it's doable.
MEI
Yay, we have a plan. Luke will provide guidance to see this to completion. I know it's only 3:58, but let's wrap this meeting a couple minutes early so you can all get right down to work. You've all got a schedule to keep!
NARRATOR
As Five O'Clock rolled around, and the day came to a close, company-wide Lync statuses blinked from "Available" to "Gone Home"-- except for the few who remained; Mei's team working hard and diligently. But putting in the hours to clean up the mess they'd made of their own beds was just what had to be done-- for the good of the project.
Like all great managers, Mei's day ended promptly and on time. Mei went home-- right at 5pm, as she always did, no exceptions-- because a manager leads a healthy personal life by example-- as an exemplar for her underlings. That day, as with every day, she knew she'd done a great job, and that she would lead on with her management skills-- a legacy of greatness that would last until Initech Corporation's bitter end.
SOUND: music outro
NARRATOR
For The Daily WTF, this was "A Day of Mei", adapted for radio by Lorne Kates, from a submission by Nathan B.
In order of appearance:
Theme song was "Slow Burn" by Kevin MacLeod of Incompetech.com
NARRATOR
I'm your announcer Paul Rousse of "Voice By Paul dot com". This has been a W.T.F. Radio presentation.
[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!
|
Метки: Feature Articles |
Error'd: Saskatche-what's-it? |
"I know we are special here in Saskatchewan but I don't think we need 10 different choices," wrote Mike.
Anthill B. writes, "Thanks, Google! That's a really useful tip!"
"Guess yourself an unused membership number at goget.com.au," wrote Scott.
"I'm in the process of setting up a virtual machine cluster and while setting up the IPMI admin password, I get told this", Stuart L. writes, "Nevermind, SuperMicro, it's only the keys to the kingdom."
"Figures that as soon as I get of the stupid squirrels out of my bird feeder, they show up in my PC!" writes Eion R.p>
Tim W. wrote, "Seagate drives are packed with more features than I expected (or needed)."
"I am feeling lucky, but I am not sure what the benefits of a Test SKU would be," writes Jeremy H.
|
Метки: Error'd |
A Meaty Problem |
The scales are down again, where the heck is Andre?
Roger had heard this cry often enough that he didnt bother to poke his head out of his cubicle to see what the issue was. He worked for a meat-packing company. Sides of beef came in one side of the building, where they were sectioned and cut into smaller, grocery-store-friendly portions, and then shipped out the other side in refrigerated trucks. Along the way, the pieces of meat needed to be weighed multiple times. When the scales went down, production stopped.
Ive got it, Andre called out. Theyll be back up in a second!
The scales werent Rogers job. His job was making sure bills of lading and manifests and shipping instructions could be generated for every truck going out. That system was fragile and provided him more than enough work- he needed to integrate data from three different off-the-shelf ERPs and generate output suitable for each of their shipping partners (who all required different formats). Roger had enough problems without worrying about Andres scales.
But damn, if those scales didnt go down a lot.
After a bad stretch of frequent outages, Pierre, the plant manager, had enough. Furious, he called the entire IT department into a conference room to give them a dressing down. He had a slide deck with charts and graphs documenting each of the IT failures that had impacted meat packing. We pack and ship meat, Pierre said as he paced in front of the projector screen. This companys been doing that since before you had this newfangled computer garbage, and well keep doing it when computers get replaced by robots or whatever. All I want to know is, why are you screwing up my goddamn plant?
No one made it out of the meeting unscathed. Roger got called out because an outdated template file caused a shipping label misprint which left a truck sitting in the dock for two hours. There was one system, though, that represented the lions share of the issues on the graphs: Andres scale management system.
After the meeting, Rogers boss, Elene, pulled him aside. Andre is really struggling, she said. And he says its an issue with communicating. Can you give him a hand?
Roger said yes, and sat down with Andre. So, he said, you always seem to be able to fix the problem pretty quickly. Whats the underlying cause?
Oh, well, Andre said, this cruddy scale system is like three hundred years old, and like anything built in the mainframe era, it only understands flat-file format instructions. To get data from our database and into the weighing system, I have to send it a file. Sometimes, theres a locking issue, and I can fix it by just deleting the file.
That would be annoying, Roger said. So you have to delete the file and resend it?
Well, its not usually the file we send that gets locked. Its usually the INI file.
The… can I see your code?
Roger traced through the code, starting with the function that fetched data from the database. FindProductInfo was a pretty standard CRUD function, so he looked for places where it was called- like UpdateData.
private static void UpdateData(string Data)
{
MyProduct currentProduct;
if (!FindProductInfo(Data.Split('|')[2].Trim(), out currentProduct))
{
// Data reading error ?
Log("Error while reading data or while accessing database");
return;
}
// Saving data
IniHelper.WriteVariable("", "Input.ini", "Input", "Id", currentProduct.Id);
IniHelper.WriteVariable("", "Input.ini", "Input", "Description", currentProduct.Description);
IniHelper.WriteVariable("", "Input.ini", "Input", "GTIN_ProduitFini", currentProduct.GTIN);
IniHelper.WriteVariable("", "Input.ini", "Input", "UnitPrice", currentProduct.UnitPrice.ToString());
IniHelper.WriteVariable("", "Input.ini", "Input", "Components", currentProduct.Components);
IniHelper.WriteVariable("", "Input.ini", "Input", "Complementary information", currentProduct.Complementary information);
IniHelper.WriteVariable("", "Input.ini", "Input", "EANPrefix", currentProduct.EANPrefix);
IniHelper.WriteVariable("", "Input.ini", "Input", "WeightType", currentProduct.WeightType.ToString());
IniHelper.WriteVariable("", "Input.ini", "Input", "Weight", currentProduct.Weight.ToString());
IniHelper.WriteVariable("", "Input.ini", "Input", "Tare", currentProduct.Tare);
IniHelper.WriteVariable("", "Input.ini", "Input", "FlagModif", "1");
}
So… you read the product out of the database and then write all of its details into an INI file? Is that the flat file youre sending over to the weighing system?
No, Andre said. They have their own weird format. I guess its not technically a flat file, but whatever you call it. Theres a template we fill in.
Roger shook his head. I dont think were talking the same language. Why are you writing this to an INI file?
Because that b- Andre caught himself and glanced around the cube-farm. In a whisper, he said, Because Elene said Im not allowed to use global variables, even when they totally make sense. This was the easiest way I could come up with to pass product details to the SendVariablesToScale function.
Terrified, Roger pulled up that function.
public static void SendVariablesToScale()
{
string GTIN ;
string BATCH ;
string UBD ;
string Description ;
string UnitPrice ;
string Components ;
string Birth ;
string Breeding ;
string Felling ;
string Carving ;
string Category ;
string Type ;
string InfoComplementaires ;
string EANPrefix ;
string WeightType ;
string Tare ;
// Reading current data
IniHelper.ReadVariable("", "Input.ini", "Input", "EndProduct_GTIN", out GTIN);
IniHelper.ReadVariable("", "Input.ini", "Input", "BATCH", out BATCH);
IniHelper.ReadVariable("", "Input.ini", "Input", "DLC", out DLC);
IniHelper.ReadVariable("", "Input.ini", "Input", "Description", out Description);
IniHelper.ReadVariable("", "Input.ini", "Input", "UnitPrice", out UnitPrice);
IniHelper.ReadVariable("", "Input.ini", "Input", "Components", out Components);
IniHelper.ReadVariable("", "Input.ini", "Input", "Birth", out Birth);
IniHelper.ReadVariable("", "Input.ini", "Input", "Breeding", out Breeding);
IniHelper.ReadVariable("", "Input.ini", "Input", "Felling", out Felling);
IniHelper.ReadVariable("", "Input.ini", "Input", "Carving", out Carving);
IniHelper.ReadVariable("", "Input.ini", "Input", "Category", out Category);
IniHelper.ReadVariable("", "Input.ini", "Input", "Type", out Type);
IniHelper.ReadVariable("", "Input.ini", "Input", "Complementary information", out InfoComplementaires);
IniHelper.ReadVariable("", "Input.ini", "Input", "EANPrefix", out EANPrefix);
IniHelper.ReadVariable("", "Input.ini", "Input", "WeightType", out WeightType);
IniHelper.ReadVariable("", "Input.ini", "Input", "Tare", out Tare);
// Sending the vars to the weighing system
// We need to send the file in the import folder
try
{
string Buf = File.ReadAllText(Application.StartupPath + "\\myTemplateFile.txt", Encoding.Default);
Buf = Buf.Replace("", GTIN);
Buf = Buf.Replace("", BATCH);
Buf = Buf.Replace("", UBD);
Buf = Buf.Replace("", Description);
Buf = Buf.Replace("", UnitPrice);
Buf = Buf.Replace("", Components);
Buf = Buf.Replace("", Birth);
Buf = Buf.Replace("", Breeding);
Buf = Buf.Replace("", Felling);
Buf = Buf.Replace("", Carving);
Buf = Buf.Replace("", Category);
Buf = Buf.Replace("", Type);
Buf = Buf.Replace("", Complementary information);
Buf = Buf.Replace("", EANPrefix);
Buf = Buf.Replace("", WeightType);
Buf = Buf.Replace("", Tare);
MyMutex.WaitOne();
File.AppendAllText(outputFolder + "BufferOutput.tmp", "\r\n" + Buf, Encoding.Default);
MyMutex.ReleaseMutex();
}
catch (Exception E)
{
Log("EXCEPTION", "Unable to send data !");
Log("(NEXT)", E.Message);
}
}
See? Andre said. Its the BuffeerOutput.tmp file that we actually send to the scale system, but input.ini is the one that usually locks us up.
Well, Roger said, looking straight at Andre. I think I see the problem.
|
Метки: Feature Articles |
CodeSOD: Scrubbed Inputs |
In this age of JavaScript everywhere, developers have to come up with all sorts of ways to work around the uglier segments of JavaScript. For example, Aaron found this block, which promises to scrub false-y fields.
require _ = require("underscore");
// recurses, use with care
var scrubFalseyFields = function (obj) {
return _.chain(obj)
.pairs()
.filter(function (pair) {
var val = pair[1];
if (_.isObject(pair[1])) {
// recurse!
pair[1] = scrubFalseyFields(val);
}
return val;
})
.object()
.value();
};
Now, for those of you that dont know your way around Underscore, a functional utility-belt for JavaScript list manipulation, the first call, chain, just enables chained calls to the library by wrapping obj.
pairs takes an object, in the form {foo: 5, bar: 6} and converts it into an array in the form [["foo", 5], ["bar", 6]]. object is its inverse, and value ends the chain. filter, obviously is for filtering, but what happens here is a little… odd.
filter will get an input like ["foo", 5], and then grab the value segment- 5 in this case. Well use that value to decide whether or not to include this pair in the output object- so at its simplest level, this function just takes an object and removes any fields from it that are false-y, and it does that recursively.
There was only one real problem with this code: it was being used to sanitize input data that might contain false values. Downstream from this, there were huge piles of code to handle all the inevitable undefined issues that this created.
|
Метки: CodeSOD |
Tested Backups |
The Big Boss of Initechs Australian division ran the Sydney office as his own personal kingdom. Work- or workers- he didnt care for was banished to the hinterlands of the Melbourne office. For example, IT services was a useless sack of morons who only know how to spend money, and thus the entire department was banished to Melbourne.
Stewart C. lived in Melbourne, and was a new hire not long after the exile. The Melbourne office, with a 900km buffer zone protecting it from the whims of upper management, was actually a decent place to work. At least, until Brendan arrived.
Brendan was an upwardly mobile middle manager based out of Sydney. One day, he did something to offend Tony. The scuttlebutt had a lot of rumors about what that was, ranging from oh, he was late to a big meeting, to he took the last beer at the company party. Rumors aside, the facts were clear: Brendan was in Melbourne with a long list of projects to manage, and he wasnt going back to Sydney until he completed all of them.
A few days into his exile, Brendan brought that list of tasks to Stewarts cube. Stewart. Stew. Stewie. Im gonna need you to go ahead and test our backups, yeah? Make sure we can actually restore from them, right?
Thats a great idea, Stewart said. So great, that we test them on a regular basis. I can send you a doc that covers our backup strategy-
Right, yeah, but have you tested them in production? Brendan asked.
Stewart paused, making certain that hed heard the question properly. Well, no…
Right then, yeah? They havent really been tested till we run them against production, yeah?
We… really shouldnt test things in production, Stewart said. I mean, what if the test fails?
Brendan shook his head and laughed. Stewie, why would the test fail unless the backups are broken, right? Yeah, Im gonna need a plan to cycle through every production server. Wipe it, restore from backup tape, and confirm its working, yeah? Right, so get on that. Orders from Tony, yeah, we need this by next week.
Stewart immediately got to work- on making sure this hare-brained idea didnt go forward. He roped in his boss, who roped in her boss, and everyone was on the same page: this was a terrible idea that had no real benefit and carried with it too much risk and downtime. Buuuuuuut, his boss said, its what Tony wants. We havent got the political clout to tell him no, so were going to have to do it.
Wind of Stewarts attempts at killing the project got back to Brendan. This resulted in a rather nasty meeting invite demanding a status update. Stewart wasnt the only invitee. When he took a seat next to Brendan, they were both staring at a speakerphone.
The phone resonated with Tonys booming voice and confident authority. Well? Whats all this then? he demanded.
Ill tell you what this is, Brendan said. Its just like you said, sir- everyone out here in Melbourne is lazy and obstructive, right? Yeah.
Youre telling me crap I already know, Tony said, his voice crackling on a bad connection. Of course theyre useless, thats why theyre out in Melbourne. Was there a point to this call?
Well, yeah, right, Brendan said. I wanted you on the line for this because Stewart has been the worst, right? Hes been nothing but a trouble-maker disrupting my efforts and second-guessing me-
Stewart started to mount a defense, but he couldnt get a word in before Tonys laughter drowned him out. Brendan, if you cant handle the Melbourne office, how do you expect to cut it back here in Sydney? You just havent got the guts for this business, Brendan. Now, cmon then, youve got your orders. Chop chop, and no excuses.
Tony ended the call, leaving Brendan and Stewart staring at each other in uncomfortable silence. Brendan was the first to break the silence. Yeah, as you can see, Brendan said, this project has attention right from the top. So youre going to give me a workable plan for testing all of the backups on the production servers by tomorrow- or else, right? Yeah.
Stewart nearly demanded, Or else what?, but decided against it. Instead, he wrote up his plan, noted the steps that involved downtime, and sent it to Brendan the following day. Brendan didnt have any follow up questions, and nobody told Stewart to execute the plan, so he promptly forgot about it and got back to doing real work.
Until all IT operations came screeching to a halt two weeks later. Brendan, as it turns out, decided he didnt trust Stewart to run the tests. Instead, he strong-armed one of the junior technicians into doing it for him- but not until after making his own modifications to Stewarts plan. Specifically, he wasnt happy with the schedule- Stewart had very conservatively scheduled only one server to be tested a week, outside of regular business hours, so that any failures or issues would be minimized. That would have taken months, and Brendan wasnt willing to wait that long, so he made the junior technician do them all at once. Without coordinating downtime.
The result was every bit as catastrophic as one might expect, especially considering the junior technician didnt think to order the backup tapes before starting the test, which meant they needed to be shipped from their offsite location. All in all, they lost two days of operations and a lot of reputation among their customers. Tony was furious, and he knew exactly who to blame: the useless sack of morons who only know how to spend money.
Obviously, the folks in Melbourne couldnt handle the complicated job of running IT services, so the IT department there was closed down at the end of the quarter and Initech hired on contractors to set up a new datacenter in Sydney. Stewart wasnt particularly happy to lose his job, but he took some solace in the fact that he had prospects lined up- while Brendan didnt.
[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!
|
Метки: Feature Articles |
CodeSOD: The Last of His Tribe |
"The best thing about working here," Jaeson was told by his boss Renee on the walkthrough of the dev area on his first day, "is that we work closely with the customers, meaning you never EVER have to cash checks the salespeople wrote: you're only held to what your team promised." This sounded good to Jaeson, who was considerably more concerned about getting away from his previous company's open floor plan than the possibility of customer interaction, but hey, he'd take the icing on the cake. It sounded like he was in for a very productive time.
"Let's see, where to put you," mused Renee, glancing over the pods of cubicles. "Aha, I think Zebra Tribe will work." Zebra Tribe, it turned out, was the name of a scrum team; Jaeson would be working closely with the other members of that tribe, as they were called, in the coming months in order to accomplish tasks during sprints.
Over the next three months of working in Zebra Tribe, Jaeson often thought back to that original introduction and laughed. True, there were no salespeople involved with the customers; however, in order to keep customer happy, engineers themselves were forced to promise things they knew wouldn't get done in the arbitrary time-box of a sprint. They were forbidden from explaining Scrum, as it "confused people", so instead had to speak in terms of releases, and nobody wanted to hear "It won't be in the next release, and we're not sure when it'll get done" as an answer. So they were forced to cram more and more work into sprints, leading to rushed work, mountains of technical debt, and no documentation. Even having a fifth man instead of a usual four-person tribe didn't help Zebra much.
"How are you settling in?" Renee asked, at the first so-called biweekly one-on-one three months in. She listened intently to his criticisms of the process before smiling and changing the subject entirely: "Well I've got good news for you. I'm moving you to Elephant Tribe after the current sprint."
Elephant Tribe? thought Jaeson rapidly. I've never heard of Elephant Tribe. Hyena, Mongoose, and Snake, but Elephant? It wasn't a mystery for long; instead of a pod of cubicles like the other teams, Elephant Tribe had a single cube in the corner, where there was some space left over. In this lonely cube sat Bill, the Last of his Tribe, who was overjoyed to be given more resources to work with.
Jaesan was given a second cube in a different corner; gone were the days of active collaboration and late-night nerf wars to keep morale up. He was also given a starter project to get up to speed on the ancient product that Elephant maintained. "We don't use scrum really," explained Bill. "Not much point with just me. Maybe it'll be different soon, though. I hear they're gearing up for a refresh project, keep the UI up to date. Good thing, too; I mostly do support these days. Hasn't been a real project on this thing in, oh... two years? Three?"
Jaesan plunged into the task, getting familiar with the codebase. It was a brutal chore, but he managed to get the basic feature working with hardcoded parameters. Then he opened the configuration class.
public class SplineReticulationParams {
public final bool DEFAULT_RETICULATE_SPLINES_ASYNCHRONOUSLY = true;
public final int DEFAULT_SPLINE_RETICULATION_MAX_THREADS = 10;
// The following fields are deprecated, but cannot be removed without breaking backwards compatibility with older config files.
public final int DEFAULT_MIN_FOOBAR_SIZE = 1; // Deprecated
public final int DEFAULT MAX_FOOBAR_SIZE = 10; // Deprecated
public final bool DEFAULT_RETICULATE_SPLINES_USING_FOOBAR = false; // Deprecated
public final bool DEFAULT_SEND_SPLINES_TO_REMOTE_SERVER_FOR_RETICULATION = true;
public final int DEFAULT_MAX_SPLINES_PER_REMOTE_REQUEST = 100;
public final String DEFAULT_REMOTE_SERVER_NAME = null; // [Submitter's note] Yes, null was used as the default several times.
public final bool reticulateSplinesAsynchronously;
public final int splineReticulationMaxThreads;
// The following fields are deprecated, but cannot be removed without breaking backwards compatibility with older config files.
public final int minFoobarSize; // Deprecated
public final int maxFoobarSize; // Deprecated
public final bool reticulateSplinesUsingFoobar; // Deprecated
public final bool sendSplinesToRemoteServerForReticulation;
public final int maxSplinesPerRemoteRequest;
public final String remoteServerName;
// ... snip ...
public SplineReticulationParams(
bool reticulateSplinesAsynchronously,
int splineReticulationMaxThreads,
int minFoobarSize,
int maxFoobarSize,
bool reticulateSplinesUsingFoobar,
bool sendSplinesToRemoteServerForReticulation,
int maxSplinesPerRemoteRequest,
String remoteServerName,
// ... snip ...
) {
this.reticulateSplinesUsingFoobar = reticulateSplinesUsingFoobar;
this.reticulateSplinesAsynchronously = reticulateSplinesAsynchronously;
this.splineReticulationMaxThreads = splineReticulationMaxThreads;
this.remoteServerName = remoteServerName;
this.minFoobarSize = minFoobarSize;
this.maxFoobarSize = maxFoobarSize;
this.sendSplinesToRemoteServerForReticulation = sendSplinesToRemoteServerForReticulation;
this.maxSplinesPerRemoteRequest = maxSplinesPerRemoteRequest;
// ... snip ...
}
public SplineReticulationParams(
bool reticulateSplinesAsynchronously,
int splineReticulationMaxThreads) {
SplineReticulationParams(
reticulateSplinesAsynchronously,
splineReticulationMaxThreads,
DEFAULT_MIN_FOOBAR_SIZE,
DEFAULT MAX_FOOBAR_SIZE,
DEFAULT_RETICULATE_SPLINES_USING_FOOBAR,
DEFAULT_SEND_SPLINES_TO_REMOTE_SERVER_FOR_RETICULATION,
DEFAULT_MAX_SPLINES_PER_REMOTE_REQUEST,
DEFAULT_REMOTE_SERVER_NAME
// ... snip ...
);
}
public SplineReticulationParams(
bool reticulateSplinesAsynchronously,
int splineReticulationMaxThreads,
bool sendSplinesToRemoteServerForReticulation,
int maxSplinesPerRemoteRequest,
String remoteServerName) {
SplineReticulationParams(
reticulateSplinesAsynchronously,
splineReticulationMaxThreads,
DEFAULT_MIN_FOOBAR_SIZE,
DEFAULT MAX_FOOBAR_SIZE,
DEFAULT_RETICULATE_SPLINES_USING_FOOBAR,
sendSplinesToRemoteServerForReticulation,
maxSplinesPerRemoteRequest,
remoteServerName,
// ... snip ...
);
}
// ... snip ...
}
Not only did he have to add the fields, he also had to add a new constructor ,and then an old constructor that calls the new one with some sensible defaults in case people didn't care about his new feature. That all seemed to work, so he adjusted the config to use a different value than the default... and everything broke. What? He skimmed further down the config class and found the following:
// [Submitter's note] Found wherever the params had to be copied (e.g. to override a single param):
SplineReticulationParams paramsCopy = SplineReticulationParams(
params.reticulateSplinesAsynchronously,
params.splineReticulationMaxThreads,
params.minFoobarSize,
params.maxFoobarSize,
params.reticulateSplinesUsingFoobar,
params.sendSplinesToRemoteServerForReticulation,
params.maxSplinesPerRemoteRequest,
overrideRemoteServerName,
// ... snip ...
);
Despite there being no copy constructor, when several generations of previous programmer had needed to override some parameters, they had made a fresh copy. After all, there were no setters for them to update. In desperation, he took a walk over to Bill's desk to stretch his legs.
"Hey Bill, why didn't we use a Protocol Buffer for our param class?" he asked, innocently.
"A what?"
"...nevermind, I think I figured out why."
[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
|
Метки: CodeSOD |
Error'd: An Identity Crisis |
Ari S. writes, "Not only was the poor computer running Windows XP, it also had to suffer through having the Apple keyboard and mouse attached to it.
Gino V. wrote, "I remember when MY dad and I bought Vallium online... 'Hellen Keller' they called it... I'm glad that we got to do that once."
"Well, I guess there's nothing left for me to do here," writes Andrew B.
Mike S. wrote, "Gosh, I really must watch this soon when I have the chance, otherwise, it'll be 'history'!"
"They can translate Windows code to run on a Mac, but figuring out a percent discount for an academic license is just a bridge too far," writes Ben S.
"There's a server room in one of the remote offices that's responsible for several critical systems at the site," Felipe R. wrote, "and, when I found it, the room happened to be in a bit of a critical state as well."
"Typical spam message, right?" writes Jamie, "Yeah well I think the spammer is trying to deliver some kind of commentary as well."
[Advertisement]
Incrementally adopt DevOps best practices with BuildMaster, ProGet and Otter, creating a robust, secure, scalable, and reliable DevOps toolchain.
|
Метки: Error'd |
CodeSOD: You Can't Always Count on Regular Expressions |
After spending the most of the afternoon searching, trying to solve a rather vexing issue, Adam found exactly the solution he was looking for and wanted to squirrel it away for later reference.
Sure - he could have added to "Favorites" in his browser like on every other website in the world, but there was something about the "bookmark" button on this particular site that called to him. It was more than a dumb link, it was a counter telling you how many people had bookmarked a resource, and you could bookmark it yourself.
Also, it was the most calming shade of blue.

Blame exhaustion, blame frustration, or even the fact that his remaining brain cells were delighted to see that 26 other souls had found this page bookmark-worthy - Adam threw caution to the wind, risked a stealth malware install and clicked on it.
The thing was, instead of increasing by 1 as anyone would expect, it did so by 10.

"Shenanigans!" Adam shouted as he got to work, digging into the page's source and found the code responsible. (After all, who would be so sneaky that they'd increment a bookmark counter by an artificial amount just to make it seem like the page had been bookmarked more than it actually was?)
As it turned out - the original coder, not knowing that you could extract the contents of an HTML node with the “text()” method, or similar ones, decided to give regular expressions a try.
updateBookmarkCounter = (upOrDown) -> counterSpan = $('.bookmark .counter') spanHtml = counterSpan.html() count = spanHtml.match(/\d/).first().toInteger() newCount = if (upOrDown == 'down') then (count - 1) else (count + 1) newCount = 0 if newCount < 1 counterSpan.html(spanHtml.replace(/\d/, newCount)) updateUserBookmarkCount upOrDown
While it was an interesting execution, little did the site's author know that once you hit more than 9 bookmark clicks, "/\d/" was only going to match the first digit of the total count.
http://thedailywtf.com/articles/you-can-t-always-count-on-regular-expressions
|
Метки: CodeSOD |
A Signed Release |
The development and testing process had been rigorous, but Brody felt confident in his code after receiving UAT signoff the week before. There was even time for extensive load and stress testing this time around. Brody spent most of the weekend running builds and packaging up the code and database scripts so that Lars and Co. could prep the deployment first thing Monday.
Lars strolled in an hour late Monday morning, seemingly unconcerned with the magnitude of the release before him. "Hey Lars," Brody greeted him. "It wasn't fun, but I got everything packaged for you guys to do your thing. So you should probably get started so we can hit the ground running tonight."
Lars scoffed at Brody's urgency. "Chill out, BRO-dy. We got this. Since the last time we had a big nightmare release like this, my team created an automated deployment system. Things will go perfectly smooth, assuming you and your contractors did your jobs right."
Brody brushed off Lars' snippiness as he recalled TexOil's last big release. Everyone involved pulled an all-nighter and worked 18 hours straight just to get the troublesome release stable. In the end, Lars' team had deployed the wrong code via human error. So the fact that they had automated deployments now was music to Brody's ears.
TexOil's standard release window of midnight rolled around. Brody resisted the urging of his buddies to hit the bar earlier so he could be clear-headed for the release. Everyone signed in on time and joined the big conference call. "Ready when you are, Lars. Hit it!" Brody prepared to sit back and listen to the happenings and only get involved if things went sideways.
"Automated deployment - ENGAGE!" Lars shouted. In Brody's mind, Lars had just hit a button and a bunch of console windows were appearing then disappearing as their automated system updated everything. An hour went by without much chatter on the call. Brody assumed since the release was automated now, it would be quick. But he deduced there must be some kinks to work out.
Getting impatient and tired, Brody broke the silence, "Hey Lars. How are things looking?"
"Well, the deployment worked just fine. I think there's something wrong with your code, though. All we are getting is ASP.NET errors when trying to bring up the websites. I thought you guys said this was signed off on?" Lars questioned in an accusatory tone.
"Um, it was. Everything worked fine in our UAT environment," Brody responded with concern. "What's the error you're seeing?"
"It's just some lame generic error. It says to turn custom errors off or something. If you guys are customizing stuff, I can't be expected to troubleshoot for you!" Lars shot back.
"Just send me the configuration file, Lars. I'll take a look," Brody said, expecting something to be amiss.
"Fine, but the way our automated deployments work, there's very little chance of a configuration error." Lars attached the web.config file to an email and shot it off to Brody.
Brody popped open the XML configuration file in Visual Studio to check for the myriad changes that were required. One by one, he saw them. He started to think the configuration wasn't the problem and prepared to start debugging. But that's when he reached the bottom of the file and the distinct block of text that was Lars' e-mail signature sat there, looking horribly out of place. It was plastered with several squiggly underlines that were an obvious indicator that it wasn't valid XML.
"Lars..." Brody paused before asking a question he should never have to ask. "Why exactly is your e-mail signature in this config file?"
"WHAT?!" Lars shot back. "Give me a minute and I'll get this resolved." An awkward silence followed. Finally Lars spoke, "Ok Brody, the ASP error went away. We can have the testers hit this thing hard."
Brody breathed a sigh of relief, but immediately began to wonder how that happened. "So Lars, how did that occur when you guys have the deployment automated now?"
"Well, you see Brody," Lars started, nervous. "What we have isn't FULLY automated yet. What you package up for us, I have an app that grabs that and throws it out on the server. Then I copy it by hand to the IIS directory. I also can't figure out how to make configuration changes with it yet, so I have a cohort do those, email the XML to me and I AUTOMATICALLY know to copy and paste it in to the web.config file. It's nearly a fool-proof system though!"
Fortunately, Brody's phone was on mute so Lars and the rest of the conference call couldn't hear the stream of profanity he spewed at the sheer stupidity of this "automated" deployment.
|
Метки: Feature Articles |