Saturday, March 31, 2018

Toddler Has Had Enough Of His Toys

As a kid your toys are your everything. Most of the time at least. Sometimes you’ve just had enough, and you want to get rid of them on way or another. This kid gets it.

The post Toddler Has Had Enough Of His Toys appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Dog Tries Waking Up A Sleeping Pig

Dogs and pigs aren’t the most usual friends, but these two prove it possible. Still highly unlikely, but possible. A friendship for life is born!

The post Dog Tries Waking Up A Sleeping Pig appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Friday, March 30, 2018

Error'd: Visual Studio? Whatever!

TZ wrote, "Looks like somebody at Microsoft doesn't like static web pages!"

 

"I wonder the generational arrangement that Frontier Airlines is aiming at here," Carl Z. wrote, "Perhaps in some airport, a person is yelling Lil' Ronald Smith, Extra Seat! You're gonna miss your flight!"

 

Jiri G. writes, "Looks like Dell won't let me add a customer number, so, I guess I'll need to wait until they publish their {0} form."

 

"Wow, my surname has to be at least five characters? Thanks for blocking me out, radiooooo.com!" writes Robin Lee.

 

"Finally! My local grocery store stopped using those crashy, BSODy Windows machines in automatic cash registers and installed stable, professional Linux distributions....um, wait, what?" writes Lutosław.

 

"I agree 100% - Americans are indeed NOT clothes," wrote Mark B.

 

[Advertisement] ProGet can centralize your organization's software applications and components to provide uniform access to developers and servers. Check it out!


To read the full article, please visit The Daily WTF

Thursday, March 29, 2018

CodeSOD: Attack of the WASPs

Werner sent us some code from the telcom industry. Before we even get to the code, we have to look at one of the comments.

// This is a hack to be
// able to compile

I might not need to say this, but if you feel like you need to trick the compiler into accepting your code, you may need to rethink your overall design. Then again, when we look at the code in context, the comment makes less sense:

mainserver = null;
mainserver = new WASPApplicationServer();       // This is a hack to be
                                    // able to compile
try {
        mainserver = null;
        mainserver = new WASPApplicationServer();
        noprob = true;
} catch (Exception eee) {
        msg = "There was a problem initializing the server. Log Trap and try again";
        logger.error(msg, eee);
        msg = msg + "\n" + eee;
        snmpev.sendSNMPcritical(moClass, moObjInst, "SERVER: INITIALIZATION", "Unknown Cause",
        "Failure to initialize new WASP Server", msg, msg);
        noprob = false;
}

The “hack” is 100% unnecessary. Worse, if creating a WASPApplicationServer needs to throw exceptions, then doing it outside of the try is completely self-defeating.

The real treat here, though, isn’t the comment or the “hack”, but the humble little noprob flag. Instead of using exceptions to represent, well, exceptional states and error modes that need to be handled, complete with internal state and a full stack trace about what happened, when and why, this throws all of that away and just sets a noprob flag.

Downstream code checks the flag, and if it’s false, terminates the application.

Werner removed the “hack”, but doesn’t know who to blame, as the problem code predates their migration from CVS to SVN back in 2011, and they didn’t migrate history.

[Advertisement] ProGet supports your applications, Docker containers, and third-party packages, allowing you to enforce quality standards across all components. Download and see how!


To read the full article, please visit The Daily WTF

Wednesday, March 28, 2018

The Snoring Little Duck

If you ever slept next to someone who isn’t afraid of a little snoring, you know it gets on your nerves REALLY quick. It gets the blood boiling so to speak, or maybe that’s just […]

The post The Snoring Little Duck appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Keep On Failing

Fails, fails everywhere. I can’t get enough of them, and neither do you (the number of views for these videos is insane!). Luckily for us, people keep doing dumb stuff and we get to enjoy […]

The post Keep On Failing appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

CodeSOD: A Unique Solution

Ruby is a nice little language, but I think it wouldn’t have exploded in popularity like it did without Rails. Nowadays, Ruby still seems to be the first choice of early-stage startups. A big part of that is how easy ActiveRecord makes database access.

Adrian was doing some code reviews, when he came across this line:

  generate_ident_value(ident, value.to_s + rand(10).to_s)

“Um… what’s this doing?”

Well, they needed to generate unique identifiers based on a user’s name, so joebob becomes joebob1, and the next joebob becomes joebob2 and so on. “We were having a problem with duplicates- if a user was deleted, we were accidentally re-using their ID, so I added the call to rand to fix that.”

Adrian took a look at the surrounding method’s previous version.

 def generate_ident_value(ident, value = 1)
    if query.find_by(ident: ident + value.to_s)
      generate_ident_value(ident, value + 1) # this is the line which changed
    else
      ident + value.to_s
    end
  end

Yes- this method attempts to see if joebob1 already exists in the database, and if it does, tries again with joebob2, with a nice recursive call. Changing value + 1 to value.to_s + rand(10).to_s meant, instead of trying joebob2, theyd instead tryjoebob15, thenjoebob159, thenjoebob1597`, for example.

Adrian pointed out this was an insane solution. “You’re right, we should just keep every generated ident in a database table.”

“That’s not…”

“And when we combine it with the random ident I added, it’ll be super unique, and we won’t have to worry about deletions!”

“No, that’s…”

That’s exactly what ended up happening, despite Adrian’s protests. Because of the random approach of tacking characters on the end, the field size had to increase to 20 characters, then 30. Adrian expects it to go up to 40 before year’s end. He’s not planning to be around to see that though- he’s already made plans to move onto another position.

[Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!


To read the full article, please visit The Daily WTF

Tuesday, March 27, 2018

CodeSOD: The Truth About Internationalization

Booleans. One would think that simple true and false would be sufficient to represent all the possible values. However, even more than dates, they are one of the most difficult things to master in all of computer science. There are all manner of possible values and many different ways of comparing different entities.

Compounding everything is another dimension to boolean-ness: internationalization. After all, not every language uses English spellings of true and false. In high school, they made me take French, so it'd be vrai and faux. For most of us, we'd put the language-specific spelling in an application-phrases file, cache it and pick the appropriate spelling based upon the meaning of the required phrase. However, the underlying core values of truth/falsehood would still be programming-language-specific.

For most of us...

  class Internationalization {
     // These will index into the list of language-specific phrases
     public enum Phrases { TRUE,
                           FALSE,
                           ...
     };
 
     private List<String> languageSpecificPhrases = new ArrayList<>();
         
     public  Internationalization() {
       // Load strings from configured language file into: languageSpecificPhrases...
     }

     public String getPhrase(Phrases phrase) {
       return languageSpecificPhrases.get(phrase.ordinal()).
     }        

     public boolean getLanguageSpecificBooleanValueForTrue() {
       return true;
     }

     public boolean getLanguageSpecificBooleanValueForFalse() {
       return !getLanguageSpecificBooleanValueForTrue();
     }

  }
[Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!


To read the full article, please visit The Daily WTF

Monday, March 26, 2018

CodeSOD: Authentication Failure

There are certain programming problems that I generally say you shouldn’t try and solve yourself. Dates, of course, are a big one. They’re more complicated than you think, and unless you want to make managing a date handling library your life’s work, just use someone else’s.

Encryption is another. There are so many subtle ways to do it wrong that unless it’s your specialty, you’re going to screw it up. Another similar problem is authentication.

Artyom was having a bit of an authentication problem. He had inherited a Web Portal, written by a “security minded” developer. Since this developer was “security minded”, they took “common sense” security measures, like using JavaScript to prevent copy/pasting into the password field, and to prevent password managers from running. That was annoying enough, especially considering Artyom favored a 34 character password, but strangely… it never worked on the first attempt. Artyom always had to enter the password twice.

Fortunately, the authentication method was well documented, and explained exactly what was going on:

if (Authenticate())
{
    // If user knows password, he or she will be able
    // to type it in again.
    // If he or she has just guessed, he or she will
    // fail at the second attempt
    ShowAuthFailureBox();
    if (Authenticate())
    {
        authorized = true;
        Execute();
    }
    else
    {
        ShowAuthFailureBox();
    }
}
else
{
    ShowAuthFailureBox();
}
[Advertisement] Ensure your software is built only once and then deployed consistently across environments, by packaging your applications and components. Learn how today!


To read the full article, please visit The Daily WTF

Friday, March 23, 2018

Error'd: Mistakes From Out of the Blue

"I got this email out of the blue from TI. By the way, my name isn't ALFONSO," writes Jamie.

 

"Not sure how much I'd get out of LinkedIn Premium, but I am absolutely sure of exactly how much I'd be saving," writes Vivek T.

 

Jonathan wrote, "Meanwhile, in a different story, I heard that Times New Roman was being held for questioning."

Betsy R. wrote.

 

"The new trains on the Great Western line are so amazing that my journey home will be instantaneous," writes Stephen.

 

Anton G. writes, "As the saying goes, 'Technically correct is the best kind of correct.'"

 

[Advertisement] ProGet supports your applications, Docker containers, and third-party packages, allowing you to enforce quality standards across all components. Download and see how!


To read the full article, please visit The Daily WTF

Thursday, March 22, 2018

CodeSOD: Randomly Functional

True random number generator

Jonathan T. had recently been afforded the opportunity to go back and tweak the very first Python-based CMS he'd ever built. Years earlier, he and another junior developer had been forced to cobble this site together with no code reviews, oversight, or help of any kind. Terrible choices had been made in the name of getting their work done.

Jonathan rebuilt every page in the CMS and made sure the forms and plugins cooperated with the new structural elements he introduced. In the process, he got stuck trying to figure out how a "col-sm-6" was showing up on a particular form. He found nothing in the CSS, LESS files, or page-specific JS controlling the form. In desperation, he ran a project-wide search for the randomClass.

This was the result Jonathan found in project/scripts.js, authored by the other junior dev. It explained why, for the past several years, new images on the site had randomly not worked for any discernible reason.


$(document).ready(function() {
    $(".randomClass").addClass("col-sm-6");
    $(".otherRandomClass").addClass("col-sm-12");
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/45/2f/452f62e5a609d293e27f40f31cf9575c.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/82/1d/821db6dc5d1388758247726233553218.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/9e/7c/9e7c27f45180e53ed2fd8d2efa0c6d66.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/a8/71/a871c57d0030082738913b671971a842.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/54/db/54dbbfbe645c87d8106d148031bf5df1.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/24/8f/248f6f9ca57a61cbeafa22bd7fbb7569.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/d8/d1/d8d184223c8d61f19bee78ca7d9e0eaa.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/8c/82/8c828ee6feaa0a072a8f0a963ee684ca.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/1f/41/1f41c5b6e8f65bc10d3f7ee729e9974e.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/a0/ea/a0ea02ddc52be55ef6b7c8c8f9afd6f4.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/17/6c/176c72476538e5e4d6c993e67f758ac8.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/dc/e7/dce73d9ac7e94958146768f6f4b8d18d.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/1f/ab/1fab6033a0b96c6fdfcbe68b66e595bf.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/f5/66/f5664772196cd29611bdb34697d0572d.jpg']").addClass('make-short');

    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
    $("img[src='https://generic.s3.amazonaws.com/cache/5c/bf/5cbf90e3e6afaa503e3f4b8eaf5a4397.jpg']").addClass('make-short');
});
[Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!


To read the full article, please visit The Daily WTF

Wednesday, March 21, 2018

Squirrel Enjoying Some Fancy Lunch

The cold times can be hard on a squirrel, so when you get your little claws on something as delicious as a donut… Jackpot! Eat it as fast as you can, because who knows who’s […]

The post Squirrel Enjoying Some Fancy Lunch appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Dog Making A Snowman

To be honest, it’s not the most beautiful snowman you’ll ever see, but it’s the effort that count. It’s still a very cool one after all! Keep practising, buddy!

The post Dog Making A Snowman appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Representative Line: An HTTP Code

Peter B’s company didn’t have the resource availability to develop their new PHP application entirely in-house, and thus brought in a Highly Paid Contractor™ to oversee that project. This story could end here, and you could fill in the rest, but Peter found an… interesting block of code during the autopsy on this disaster.

Now, I want you to imagine that someone has handed you an integer. You need to know if that integer constitutes a valid HTTP status code. Now, this could get difficult, as just because a number falls between 100 and 599 doesn’t mean that it’s actually a defined status code. Then again, services may define their own status codes, and clients should understand the class of a status code, even if they don’t understand the number, so getting a 147 code isn’t wrong, so we can just probably assume any n where 100 <= n < 600 is valid enough.

Sorry, I’ve gotten off track, because I really just can’t believe this code is the solution someone came up with.

function isValidHttpCode($code)
{
    return in_array(substr($code, 0, 1), [1,2,3,4,5]) && strlen($code) == 3;
}

At least it’s not a regular expression, but keep in mind, the $code variable was an integer in the calling code. For this code we have to coerce it to string not once, but twice. This was a Highly Paid Contractor™, so I wouldn’t be surprised if it was pointlessly cryptic, or overly complicated and 300 lines long, but that’s not the case. I don’t even think this was a case of blind copy/paste from a library of bad code used by the contracting firm, because those usually have pointless, uninformative, and confusing comments.

This is just… dumb.

[Advertisement] Ensure your software is built only once and then deployed consistently across environments, by packaging your applications and components. Learn how today!


To read the full article, please visit The Daily WTF

Tuesday, March 20, 2018

Parrot Would Love Some Ice Cream

As a pet, there are a couple ways to let your boss know you’re sweating your ass off. You could go and sit in front of the fan, for example. Or, as this bad ass […]

The post Parrot Would Love Some Ice Cream appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

The News Isn’t What It Used To Be

Sure, news is more sensational and flashy than ever. But that doesn’t mean it’s a full on professional entertainment show. Far from it, if I have to believe these people on air during amateur hour.

The post The News Isn’t What It Used To Be appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Bank $Security

Banks. They take your money and lend it to others. They lend money deposited by other people to you, either as a car loan, mortgage, or for credit card purchases. For this privilege, you give them all of your personal information, including your social security number. Implicit in that exchange is the fact that the bank should keep your personal information confidential. Security is important. One might think that such a concept would be important to banks. One would be wrong.

To be fair, the high ranking people at the banks probably believe that all of their customer information should be - and is - secure and protected. Unfortunately, there are multiple layers of middle and lower management (that we all know all too well) that might not comprehend that point.

The other thing that banks do is nightly batch processing to keep assorted records updated, generate TPS reports, issue bills, update financial inventory, credit usage and so forth. Since customers tend to hit ATMs at all hours of the day and night, you want your systems-update processing to be able to occur while the system is live. To that end, date and timestamp ranges of transactions to be processed for a given business period usually come into play in some form. The point is that you shield your ongoing transactions from reconciliation activity by excluding it from the reconciliations. The beat business goes on.

Randy worked at a major bank in the Pittsburgh, PA area. Considering that it's a major bank, it seemed odd that their customer facing website was often down for more than an hour at a time during business hours. When he started in 2016, it took about a month to get permissions to get the development tools he needed installed. Hmmm, perhaps they are vigilant about controlling access to their environments, even development; possibly a good, if bureaucratic sign. Once set up, he was assigned to work on their Web Banking app which was written not in MVC but in ASP.NET WebForms. OK, maybe they're slow to adopt newer technologies because they want someone else to beta test them. Caution can be a good sign.

As part of doing his work, Randy sent SOAP messages to the mainframe to retrieve test data for developmental testing. One day, he deduced that the test social security number was that of his boss. He verified this by asking his boss what he had for lunch that day. Sure enough, there were debit card charges for it in the test environment. Uh oh.

That's right; live data in the test environment. Anyone with even novice skills could have gotten social security, routing and account numbers for every customer of the bank! Rather than fight with the, ahem, highly knowledgeable individuals that thought that this was a good setup - and potentially be blamed for any breaches, Randy chose to jump ship and head for saner pastures.

Interestingly, I went to their website, which states that their business hours are M-F 8AM-8PM and Sat 9AM-3PM. At 1:15 on a clear, dry Saturday when the bank should have been open for business, I called the bank posing as a potential customer to ask why their website is often down for more than an hour at a time almost every single night. The auto attendant said to try back during business hours.

Hmmm...

[Advertisement] ProGet can centralize your organization's software applications and components to provide uniform access to developers and servers. Check it out!


To read the full article, please visit The Daily WTF

Monday, March 19, 2018

People Are So Friggin’ Cool

We are capable of more than we think. YOU are capable of anything you set your mind to. Believe in yourself and achieve greatness (and don’t forget to send us your cool videos once you […]

The post People Are So Friggin’ Cool appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Pet Rat Needs A Little Extra Allowance This Week

And he doesn’t have time to explain why or what he needs it for. Just give it to him already okay!? There is probably a very valid reason he needs it we humans wouldn’t understand […]

The post Pet Rat Needs A Little Extra Allowance This Week appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

CodeSOD: A Passion for Details

Passion projects are so common in our industry that there are some people who won’t hire you as a programmer if you’re not also programming in your free time. That’s TRWTF, honestly. There’s nothing wrong with being the kind of programmer who shows up for your 9–5 and then goes home and doesn’t touch a computer until the next day.

There’s also nothing wrong with passion projects. I have a bunch of them, usually carefully chosen to have absolutely no utility whatsoever, so they never start feeling like a job.

A Fish of Greater Size (FoGS) has a passion project, which they work on with a number of friends. It’s a web application written in C… or C++… or maybe a little of both? FoGS isn’t entirely certain what they’re using precisely. It’s an existing code base.

In that code base, there’s a CSS file. It sits in the site’s root directory, but there’s no entry in source control explaining how it got there. There’s no developer on the team who knows how it got there. None of them admits to putting it there. And yet, there it sits.

ls > details > summary {
    margin-left: calc(1em - 2px);
}
details > details > details > summary {
    margin-left: calc(2em - 4px);
}
details > details > details > details > summary {
    margin-left: calc(3em - 6px);
}
details > details > details > details > details > summary {
    margin-left: calc(4em - 8px);
}
details > details > details > details > details > details > summary {
    margin-left: calc(5em - 10px);
}
details > details > details > details > details > details > details > summary {
    margin-left: calc(6em - 12px);
}
details > details > details > details > details > details > details > details > summary {
    margin-left: calc(7em - 14px);
}
details > details > details > details > details > details > details > details > details > summary {
    margin-left: calc(8em - 16px);
}
details > details > details > details > details > details > details > details > details > details > summary {
    margin-left: calc(9em - 18px);
}
details > details > details > details > details > details > details > details > details > details > details > summary {
    margin-left: calc(10em - 20px);
}
details > details > details > details > details > details > details > details > details > details > details > details > summary {
    margin-left: calc(11em - 22px);
}
details > details > details > details > details > details > details > details > details > details > details > details > details > summary {
    margin-left: calc(12em - 24px);
}


details {
    border-left: 1px solid black;
}
details {
    margin-left: 1px;
}

As you can see, this project is all about the details.

[Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!


To read the full article, please visit The Daily WTF

Sunday, March 18, 2018

Save Money With Your Cat

Cats expensive? You might be in for a surprise here. Of course, it still going to cost you something, but you’ll be rewarded for it handsomely in love and unlimited purrs. And with these cool […]

The post Save Money With Your Cat appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Saturday, March 17, 2018

Little Foster Puppy Throws A Tantrum

If this little puppy doesn’t get his way, you better hide. He will unleash fury on you and on everyone you love. Thread lightly if you know what’s good for you.

The post Little Foster Puppy Throws A Tantrum appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Genius Dad Builds Backyard Luge Course

It’s freezing cold outside, so all the kids are in the house. Gone is the quiet and the peace. So what do you do? Well, leave it to a handy dad to build an amazing […]

The post Genius Dad Builds Backyard Luge Course appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Friday, March 16, 2018

Stray Cat Saves Baby’s Life

A lot of people aren’t very fond of stray animals, and that can be for good reason. They can be dangerous or unhygienic. But the people in this little Russian village won’t ever stop thanking […]

The post Stray Cat Saves Baby’s Life appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Truck Vs. Tree Part 3109

You’ve seen it before, truck is strong, tree is also strong, they fight, tree wins. Except this time it goes a little bit different…

The post Truck Vs. Tree Part 3109 appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Error'd: Drunken Parsing

"Hi, $(lookup(BOOZE_SHOP_OF_LEAST_MISTRUST))$ Have you been drinking while parsing your variables?" Tom G. writes.

 

"Alright, so, I can access this website at more than an hour...Yeah. Okay," wrote Robin.

 

Mark W. writes, "Of course, Apple, I downloaded @@itemName@@. I mean, how could I not? It got @@starCount@@ stars in the app store!"

 

"One would hope that IEEE knows how to do this engineering thing," Chris S. wrote.

 

Mike H. writes, "I don't know what language this is in, but if I had to guess, it appears to be in Yak."

 

"Sexy ladies AND inline variables? YES! I WANT TO LEARN MORE!" wrote Chris.

 

[Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!


To read the full article, please visit The Daily WTF