Tuesday, February 21, 2017

Blind Obedience

Murray F. took a position as an HPC at a large firm that had rules for everything. One of the more prescient rules specified that for purposes of budgeting, consultants were only allowed to bill for 8 hours of work per day, no exceptions. The other interesting rule was that only certain employees were allowed to connect to the VPN to work from home; consultants had to physically be in the office.

The project to which Murray was assigned had an international staff of more than 100 developers; about 35 of them were located locally. All of the local development staff were HPCs.

With that much staff, as you would expect, there was a substantial MS Project plan detailing units of work at all levels, and assorted roll-ups into the master time line.

A soccer ref holding up a red card

The managers that had created this plan took all sorts of things into account. For example, if you attended three hours of meetings two days a week, then you only had 34 hours available for work; if you had to leave early one day to pick up your kid, it set those hours aside as non-work, and so on. The level of detail even took into account the time it takes to mentally put down one complex task and pick up another one. It was awful to look at but it was reasonably accurate.

Until...

Weather forecasters are wrong as often as they are right. However, the spiraling pin-wheel of snowstorms was getting bigger and barreling down on the local office, and was so imminent that even the forecasters were issuing absolute warnings. Not "It looks like we might get six inches"; but more along the lines of "Get groceries and plan to be shut in for a while".

The storm hit at night and by first light, anyone who looked out the window immediately realized that the forecasters were right and that they weren't going anywhere. In an attempt to be good team players, the consultants called their managers, pointed out that they were snowed in and unable to travel, and given the special circumstances, could they use the VPN and work from home?

The managers all responded that the rules were very specific and that the consultants could only work from the office. Since the consultants were powerless to do anything about the weather or the mountain of snow that had to be shoveled, they took snow days and no work was done.

That's 35 consultants for 2 days or 70 days of (loaded) work, or about 2 ½ months of work that vaporized. Needless to say, this turned the otherwise green time line quite red.

The managers called a meeting to discuss how to make up the time. Their first suggestion was that the consultants put in more time, to which they responded The rules specify that we cannot bill more than 8 hours each day. The managers then asked the consultants if they would work without pay - to get it done. Wisely, the consultants said that they were required to play by the rules set forth by the company, and could not falsify the billing sheets with the wrong number of hours worked.

The sponsoring agencies of the consultants all agreed on that one (free labor means no commissions on said labor).

This went back and forth for a while until it came time for scheduled demos. Only the work was about ten person-weeks behind schedule and the features to be demo'd had not yet been built.

At this point, the senior people who could not see their expected features in action had no choice but to address the snow delay. After much discussion, they decreed that the budgets had to be adhered to (e.g.: billing was limited to 8 hours per day), but the line development managers could hire additional consultants to make up the missed work. The managers got to work adjusting the master project plan.

The existing consultants pointed out that it would take a substantial amount of time to find new consultants, get computers, set up development environments, do general on-boarding and get new developers up to speed; and that it didn't make sense to hire new developers for something like this.

It was decreed that rules had to be followed, and it didn't matter if it wasn't cost efficient to follow those rules.

So they spent about a month interviewing (new project task for existing senior consultants and managers), bringing new consultants on board (getting them equipment, access, etc. - a new project task for managers) , and giving them architecture and code walk-throughs (new project task for existing senior consultants). This necessitated increasing the expense to the project to cover all the additional overhead.

All to save a few bucks in additional billing by already-trained-and-equipped developers, which would have been completely unnecessary if they had just let them work from home in the first place.

But hey, those were the rules.

[Advertisement] Application Release Automation – build complex release pipelines all managed from one central dashboard, accessibility for the whole team. Download and learn more today!


To read the full article, please visit The Daily WTF

How To Prepare For Parenthood

How To DAD got us the perfect test to get started with all these parenthood feelings and responsibilities. Ouch!

The post How To Prepare For Parenthood appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Monday, February 20, 2017

Red Octopus Face Off With A Swimmer Crab

Sometimes nature can be cruel. And entertaining. ViralHog uploaded this video showing the food chain in action resulting in over 400,000 views already.

“I’m a SCUBA diver and underwater photographer/ cinematographer based in Monterey, California. The conditions here are usually pretty touch and go in terms of clarity, but last week, we had an exceptional few days of 50 feet or more of visibility, paired with the arrival of countless fascinating gelatinous species.”

via: wihel

The post Red Octopus Face Off With A Swimmer Crab appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Dude Makes John Wick Action Scene All By Himself In His Appartment

Nisu Productions uploaded this playful and pretty cool video of a one-man-action-show that already got over 120,000 views on YouTube.

“I did this John Wick style action clip at my apartment. I put the camera on the tripod and played the protagonist and the bad guys myself and masked the shots in after effects. Made just for practice.”

Thanks, PenttiHirvi!

The post Dude Makes John Wick Action Scene All By Himself In His Appartment appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

CodeSOD: A Date With a Parser

PastorGL inherited some front-end code. This front-end code only talks to a single, in-house developed back-end. Unfortunately, that single backend wasn’t developed with any sort of consistency in mind. So, for example, depending on the end-point, sometimes you need to pass fields back and forth as productID, sometimes it’s id, productId, or even _id.

Annoying, but even worse is dealing with the dreaded date datatype. JSON, of course, doesn’t have a concept of date datatypes, which leaves the web-service developer needing to make a choice about how to pass the date back. As a Unix timestamp? As a string? What kind of string? With no consistency on their web-service design, the date could be passed back and forth in a number of formats.

Now, if you’re familiar with the JavaScript Date datatype, you’d know that it can take most date formats as an input and convert them into a Date object, which gives you all the lovely convenience methods you might need. So, if for example, you wanted to convert a date string into a Unix timestamp, you might do something like this:

    var d = new Date(someDataThatProbablyIsADateStringButCouldAlsoBeANumber); //Could also use Date.parse
    return d.getTime();

That would cover 99% of cases, but PastorGL’s co-worker didn’t want to cover just those cases, and they certainly didn’t want to try and build any sort of consistency into the web service. Not only that, since they knew that the web service was inconsistent, they even protected against date formats that it doesn’t currently send back, just in case it starts doing so in the future. This is their solution:

/**
 * Converts a string into seconds since epoch, e.g. tp.str2timestamp('December 12, 2015 04:00:00');
 * @param str The string to convert to seconds since epoch
 * @returns {*}
 */
function str2timestamp(str) {
    if (typeof(str) == "undefined" || str.length == 0) {
        return;
    }

    if (typeof(str) != "string") {
        str = "" + str;
    }

    str = str.trim();

    // already a unix timestamp
    if (str.match(/^[0-9]{0,10}$/)) {
        // TODO: fix this before january 19th, 2038 at 03:14:08 UTC
        return parseInt(str);
    }

    // most likely a javascript Date timestamp that is in milliseconds
    if (str.match(/^[0-9]{13,}$/)) {
        return parseInt(str) / 1000;
    }

    var ts = Date.parse(str);
    if (ts) {
        return ts / 1000;
    }

    // fix 00:XX AM|PM & 00:XX:XX AM|PM
    str = str.replace(/00:([0-9]{2}(:[0-9]{2})?\s*[AP]M)/i, "12:$1").replace(/([0-9]{2})([AP|M])/i, "$1 $2");

    // remove any "on, at, @, or -" from the date
    str = str.replace(/\s*(at|@|\-|on|\|)\s*/gi, " ");

    str = str.replace(/\s*(mon(day)?|tue(s?day)?|wed(nesday)?|thu((rs)?day)?|fri(day)?|sat(urday)?|sun(day)?)\s*/gi, "");

    str = str.replace(/([0-9]{1,2})(st|nd|rd|th)/, "$1");

    // replace bad time zone
    if (str.match(/\s+ET$/)) {
        if (d.getTimezoneOffset() == 240) {
            str = str.replace(/\s+ET$/, " EDT");
        } else {
            str = str.replace(/\s+ET$/, " EST");
        }
    }

    str = str.trim();

    var ts;

    ts = Date.parse(str);
    if (ts) {
        return ts / 1000;
    }

    // jan/3/2001
    if (m = str.match(/!^([a-z]+)[-/ ]([0-9]+)[-/ ]([0-9]+)(.*)$!i/)) {
        str = m[2] + " " + m[1] + " " + m[3] + m[4];
    } else if (m = str.match(/!^([0-9]+)[-/ ]([a-z]+)[-/ ]([0-9]+)(.*)$!i/)) {
        // 3/jan/2008
        str = m[1] + " " + m[2] + " " + m[3] + m[4];
    }

    ts = Date.parse(str);
    if (ts) {
        return ts / 1000;
    }
};

I particularly like that, if it’s not a string already, they turn it into one, because regexes are the best way to count the digits in a string, apparently.

In the end, is TRWTF this code, or the inconsistent representations of the web service endpoints?

The Mexican girl from the taco commercial who says, 'Why not both?'

[Advertisement] Otter enables DevOps best practices by providing a visual, dynamic, and intuitive UI that shows, at-a-glance, the configuration state of all your servers. Find out more and download today!


To read the full article, please visit The Daily WTF