Thursday, February 28, 2019

Octopus Holds on to Diver’s Back After He Jumps Out of Ocean

Octopus Sticks to Diver’s Back Even After He Leaves the Ocean In this crazy video, this diver is heading back onto the boat after diving in the ocean. It appears that the diver picked up a friend on his way up, however! A beautiful, red octopus clung to the diver even when he was above […]

The post Octopus Holds on to Diver’s Back After He Jumps Out of Ocean appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Calculated Security

Carl C spent some time in the late 1980's at a software firm that developed avionics and global positioning systems for military and civilian customers. In their employ, he frequently visited Schlockdeed Corp, a customer with a contract to develop a new generation of jet fighters for the US military. Due to the top secret nature of their work, security was a big deal there.

Whenever Carl entered or left the facility, he had to pass through the security office to get clearance. They would thoroughly inspect his briefcase, jacket, lunchbox, and just about everything short of a full cavity search. Despite the meticulous nature of daily inspections at Schlockdeed, some of their "security measures" bordered on the absurd.

During this era of Sneakernet-type transfers of information, it wasn't uncommon for a programmer to take a box full of floppy disks to and from work every day. Schlockdeed had a rather lax policy regarding disk transportation even though it would be a super easy way to steal their secrets. Subcontractors like Carl would be issued a "media pass" after passing the initial background check to work with Schlockdeed. It was a card that allowed them to carry any number of floppy disks in and out of the building without question.

Carl's tenure was uneventful until he decided to bring his beloved HP-41CX calculator to the office. They were working on some complex algorithms and drawing up equations on a chalkboard was taking too long, so Carl hoped to speed up the process. During his morning inspection, Bill the security guy pulled out the HP-41CX and immediately had a concerned look come over his face.

Bill reached for the radio on his shoulder, "Paulie, we're going to need you. We have a situation." Carl became extremely confused. Had the 41CX been known to be used in bombs? Was it April Fool's Day? "Sir, we need to send you to our CIO for secondary inspection. Right this way," Bill motioned.

Carl's face flushed as he wondered what kind of trouble he was in, especially since "trouble" could quickly escalate to handcuffs and holding cells. He also wondered why a Chief Information Officer would be doing secondary security inspections. Bill led him to Paulie's office, which housed a portly man with a sweet 80's mustache. The nameplate on his desk identified him as the Calculator Inspection Officer.

"I'm gonna need to see yer adding machine there, buddy," Paulie said, holding his hand out. Bill placed the HP-41CX in his palm. He gave it a closer look and grunted, "I'll have to confiscate this from you. It's got internal memory in it, y'see, so you could potentially use it to sneak secrets out. You can have it back at the end of the day, but don't let me ever catch you bringing this here again!" Bill led a calculator-less Carl back to the main security office.

On the way, Bill explained how programmable calculators were strictly forbidden in the facility. Paulie was in charge of enforcing this policy and took his job very seriously. If Carl wanted to bring a calculator, it would have to be a very basic model. Once Paulie approved it, an "AC" (Approved Calculator) sticker would be placed on the back to allow its entry. Feeling discouraged without his HP-41CX, Carl resigned himself to inhaling chalk dust for the rest of his time at Schlockdeed. At least he had a media pass, so he could still freely take floppy disks in and out of the facility.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!


To read the full article, please visit The Daily WTF

Wednesday, February 27, 2019

Angry Dog Throws Hilarious Tantrum

Upset Dog Throws Tantrum In this hilarious video, this dog is clearly quite upset and chooses to pout because of it. This dog mom is clearly amused and records her dog’s tantrum. Awkwardly seated on the couch, this dog refuses to look at her mom and the camera, a great tantrum at its finest. Dogs […]

The post Angry Dog Throws Hilarious Tantrum appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Emotional Elephant Shows Deep Affection Towards Human Friend

Beautiful Elephants Shows Deep Affection Towards Humans Try not to cry at the connection this elephant has with these humans! In the beginning of the video, it appears that this elephant may be trying to eat this woman, but we promise that it wasn’t! This elephant is rather young, believe it or not, and has […]

The post Emotional Elephant Shows Deep Affection Towards Human Friend appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Heartwarming Moment When Dad Gives Autistic Son a Puppy

Check Out This Dad’s Gift to His Autistic Son In this heart wrenching video, this wonderful dad gives his autistic son a puppy to help him take on autism. These wonderful parents thought that getting their son a puppy would help him learn how to care for other creatures and bring him more joy in […]

The post Heartwarming Moment When Dad Gives Autistic Son a Puppy appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

A Switch for Grenk

Let’s say you’ve got a project object in your code. A project might be opened, or it might be closed. In either case, you want to register an event handler to change the status- closed projects can be opened, opened projects can be closed. Now imagine you’re Antonio’s co-worker, Grenk.

No, this time, it’s not a matter of streams. Today, it’s ternary abuse, of the “why is this even here” sort.

switch(project.getStatus())
{
    case CLOSED:
    {
        //snip: re-open the project
        break;
    }
    case OPEN:
    {
        //snip: close the project
        break;
    }
}
registerEvent(projectDB.getStatus().equals(StatusProjectEnum.CLOSED) ? TypeEventProjectEnum.ENABLED : TypeEventProjectEnum.DISABLED, project.getId(), sessionUser,
                           project.getStatus().equals(StatusProjectEnum.CLOSED) ? "Enabled project " + project.getDescription() : "Disabled project " + project.getDescription());

getDao().update(project);

Let’s trace the logic. We start with a switch on the project status. If it’s CLOSED we open it, if it’s OPEN we close it. Then, we call the registerEvent method, and use a ternary on the project status to decide what parameters to pass to the method. The result is an unreadable mess, and it’s extra confusing because we just passed by a perfectly good switch. Why not just put a call to registerEvent in each branch of the switch?

Which, by the way, is exactly what Antionio did. During the code review, Grenk objected that Antonio’s version wasn’t as “DRY” as his, but the rest of the team agreed that this was more readable.

[Advertisement] Forget logs. Next time you're struggling to replicate error, crash and performance issues in your apps - Think Raygun! Installs in minutes. Learn more.


To read the full article, please visit The Daily WTF

Tuesday, February 26, 2019

Pod of Orcas Swim Alongside Boat

Pod of Orcas Swim Next to Boat The ocean is filled with strange and beautiful creatures, and this tourist boat had the awesome opportunity to see a pod of orcas in their natural habitat! The graceful creatures were swimming right alongside the boat, peeking their heads up and down as they swam. These tourists definitely […]

The post Pod of Orcas Swim Alongside Boat appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Mother Dances When Daughter Receives College Acceptance Letter

Mother Joyfully Celebrates When Daughter Receives College Acceptance Letter In this heartwarming and hilarious video, Promise tells her mom that she received an acceptance letter to Grambling State University. Her mother was more than overjoyed for her, screaming and dancing when she heard the news. Every parent has big dreams for their children, and we […]

The post Mother Dances When Daughter Receives College Acceptance Letter appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Adorable Baby Can’t Stop Laughing at Her Mom’s Sneeze

Baby Girl Can’t Stop Laughing at Mom’s Sneeze This video is TOO cute! In this video, a baby girl is watching as her mom fake sneezes. Every single time her mom sneezes, this adorable baby girl can’t help but laugh her head off! There honestly isn’t anything we love much more than the sound a […]

The post Adorable Baby Can’t Stop Laughing at Her Mom’s Sneeze appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Beyond Brillant

We've all had cow-orker's who couldn't do their jobs. Some people have even had the privilege of working with Paula.

Jarad should be so lucky.

He worked at Initech in a small development group, building a Windows client tool that customers used to interface with their server. One day, they decided to port the app from .NET to Java. The powers-that-be recommended a highly regarded Lead Java Developer, Kiesha, from Intelligenuity, to lead the project. "Don't worry," they said, "Intelligenuity only employs the most brillant programmers."

At the first group stand up meeting of the project, their manager announced that they would use Eclipse for the Java project. Kiesha posited "I don't have Eclipse. Could someone please send it to me?" So Jarad sent her the link. At the next stand up, he followed up to ask if she had gotten Eclipse installed. She said "I was blocked because she had been unable to download it, so I waited for the next meeting to ask for help." Their manager jumped on her machine and solved her problem by clicking on the download link for her.

Fast forward to the next meeting and she said that she was still unable to proceed because "Eclipse was having some problem with 'JDK' and could someone please send me that?" Jarad sent her that link too. Several days later at the next meeting, she said "Eclipse isn't working because it needs a 'jar' file, so could someone please send one to me?" And after that, "Could someone please send me sample code for doing classes because Eclipse kept saying  NullPointerException".

Finally the manager changed the meeting structure. They would continue their usual standups for the Windows client, but they would add a separate dedicated meeting with just Kiesha. Eventually, they found out that she and her husband were buddies with a highly placed C** executive and his wife. The separate meeting was to "guarantee that she's successful," which meant their manager was writing the code for her.

One day, Kiesha told the manager that a customer was having a critical problem with the web portal, and that it was of the utmost importance that they have a meeting with the customer as soon as possible to help resolve the issue.

Their manager set up a meeting with the customer, himself, Kiesha, Jarad, and the project manager to solve it once and for all. The day of the meeting, the customer was surprised at how many support people and managers showed up. The customer explained. "The, um… 'portal problem' is that we asked Kiesha for the URL of the web portal? This could have been an email."

Sometimes, there is justice in this world, as Kiesha finally lost her job.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!


To read the full article, please visit The Daily WTF

Monday, February 25, 2019

Groom Sings to Bride as She Walks Down the Aisle

Groom Sings to Bride on Wedding Day As this bride is walking down the aisle on her wedding day, her soon-to-be husband sings to her a beautiful love song. We’re certain there wasn’t a dry eye in the house! Every bride dreams of how their wedding day is going to be, and we’re sure this […]

The post Groom Sings to Bride as She Walks Down the Aisle appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Baboon Loves to Groom Puppy

Adorable Baboon Grooms Puppy This super cute pair love to spend time together, and this baboon does what he does best: groom! The puppy patiently lets the baboon groom and clean him, and it looks like he’s enjoying it! Another puppy adorably watches as the baboon affectionately cleans the other puppy. The baboon loves to […]

The post Baboon Loves to Groom Puppy appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

CodeSOD: The Serial Killer

Debugging code on embedded devices introduces additional challenges to tracking down what's going wrong, especially as in many cases, you can't even rely on any sort of println debugging. I've worked with a few devices which my only debugging output is 3 RGB LEDs.

Serial devices, then, can be a godsend. For short runs, you can often just wire pin-to-pin, but for longer connections, you need some sort of serial transciever chip. In most practical situations, the flow between two devices is CPU->UART->transciever->cable->transciever->UART->CPU. Apologies to the OSI model, yes, it's more complicated than this, but for our purposes, it's a useful illustration.

Stephen was debugging a board where the chip supported four UARTs, but the board had two different transcievers on it, each responsible for two different UARTs. What was supposed to happen was that when data arrived via the serial bus, an interrupt would fire and react to the message. None of that was happening.

It wasn't hard to find the method responsible for setting up the interrupts:


    void sysSerialHwInit2 (void)
    {
    int i;

    /* connect serial interrupts */

     for (i=0;i<N_UART_CHANNELS; i++)
         if (chipOneChan[i].int_vec)
             {
             (void) intConnect (INUM_TO_IVEC (chipOneChan[i].int_vec),
                                (VOIDFUNCPTR)chipOneInt, (int)&chipOneChan[i] );
             sysIntEnablePIC (chipOne_devParas[i].intLevel);



        for (i=0;i<N_CHIPTWO_CHANNELS;i++)
                {
        (void) pciIntConnect(INUM_TO_IVEC (INT_NUM_GET (chipTwoChan[i].level)),
                         (VOIDFUNCPTR)chipTwoInt, (int)& chipTwoChan[i]);

                 }

                 sysIntEnablePIC (chipTwoChan[i].level);

         }

    }

The whitespace is as originally found, and it did an exceptional job of hiding the bug. If you just glance at this code, trying to understand its flow from its formatting, it seems pretty sane: set up the interrupts for our UART channels, and then set up the interrupts for our "chiptwo" channels.

Of course, that's not what's actually happening. "Whitespace matters," writes Stephen, and after he let his editor fix the whitespace, the actual flow of the code became clear:


    void sysSerialHwInit2 (void)
    {
        int i;
    
        /* connect serial interrupts */
    
        for (i = 0; i < N_UART_CHANNELS; i++)
            if (i8250Chan[i].int_vec)
            {
                (void) intConnect (INUM_TO_IVEC (i8250Chan[i].int_vec),
                                    (VOIDFUNCPTR)i8250Int, (int)&i8250Chan[i] );
                sysIntEnablePIC (i8250_devParas[i].intLevel);
                for (i = 0; i < N_XR17D_CHANNELS; i++)
                {
                    (void) pciIntConnect(INUM_TO_IVEC (INT_NUM_GET (xr17dChan[i].level)),
                         (VOIDFUNCPTR)xr17dInt, (int)& xr17dChan[i]);
                    sysIntEnablePIC (xr17dChan[i].level);
                }
            }
    }
    

A few missing curly braces meant that what was supposed to be two separate for loops were mashed into one for loop which didn't work.

It wasn't hard to fix the curly braces and the whitespace. It was harder to talk the other developers on the team into setting up their editors to use a consistent approach to whitespace.

[Advertisement] Forget logs. Next time you're struggling to replicate error, crash and performance issues in your apps - Think Raygun! Installs in minutes. Learn more.


To read the full article, please visit The Daily WTF

Adorable Cat Loves to Play with Hair

Cute Cat Plays with Human’s Hair In this adorable video, this cat loves to play, eat, and tangle this woman’s hair! This woman doesn’t seem to mind as this cat has a heyday playing and eating her hair! What a silly kitty! Love videos of cats? Check out some of our favorites!

The post Adorable Cat Loves to Play with Hair appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Sunday, February 24, 2019

Adorable Toddler Has So Much to Talk About on the Phone

Adorable Toddler Talks Animatedly on the Phone We cannot get enough of this ADORABLE Irish toddler talking on the phone! Loved it so much we watched it a couple times! Although you can hardly make out what she’s trying to say and the conversation she’s having hardy makes any sense, we promise you’ll find her […]

The post Adorable Toddler Has So Much to Talk About on the Phone appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Rare Firefall at Yosemite National Park

Firefall at Yosemite National Park Only Happens Once a Year Thanks to nature’s light effects, waterfalls in Yosemite National Park will look like they’re made of fire instead of water! The light will hit the water just right and make the water look reddish orange. This phenomenon only occurs in certain lighting and with light […]

The post Rare Firefall at Yosemite National Park appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Leopard Cub Learns to Walk After Being Paralyzed from Car Accident

Leopard Cub Learns to Walk Again After Being Paralyzed In this miraculous video, this paralyzed leopard cub learns to walk again! This leopard cub was unfortunately involved in car accident and was paralyzed because of it. Only 7 months old, this leopard cub was taken in by a local wildlife center in Junnar, India. The […]

The post Leopard Cub Learns to Walk After Being Paralyzed from Car Accident appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Saturday, February 23, 2019

Kid Rocks Michael Jackson Dance for Talent Show

High School Kid Rocks Michael Jackson Dance Moves for Talent Show Don’t we all wish we could be as talented as this guy? For his school talent show, this high schooler rocks some major dance moves for this Michael Jackson classic! It’s incredible how swiftly and fluently this kid is able to move his feet […]

The post Kid Rocks Michael Jackson Dance for Talent Show appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Litter of Puppies Help Clean the Floor

Litter of Puppies Chase Mop Look at these sweet babies! They’re having the time of their lives as this woman mops the kitchen floor with a regular mop and a litter of puppies! As this woman mops, these puppies latch onto the mop and just love to get dragged by the mop! The puppies actively […]

The post Litter of Puppies Help Clean the Floor appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Elderly Man Protects His Dog from Rain with Plastic Bag

Sweet Elderly Man Shields His Dog from Rain In this touching and adorable video, this elderly man shields his dog from the rain using a plastic bag and hat! The dog is seated in the front basked of his bike and looks quite comfortable as the elderly man prepares him for the rain! No one […]

The post Elderly Man Protects His Dog from Rain with Plastic Bag appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Friday, February 22, 2019

Woman’s Attempt to Steal Package Goes Awry

Woman Attempts to Steal Packages But Slips and Falls In this funny and karma-filled video, this woman attempts to steal a package from someone’s porch after UPS drops off the packages. Although she manages to pick up all of the packages, she slips horribly and hurts herself! We don’t feel bad for this lady! Karma […]

The post Woman’s Attempt to Steal Package Goes Awry appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Error'd: No Scandinavian Pets Allowed

"I guess this is the price I pay for giving my Golden Retriever a unique (and secure) name," writes Robert N.

 

"C'mon Microsoft, everyone knows that NaN isn't allowed to have an ordinal," wrote Douglas M.

 

Geoff O. wrote, "This list of values is practically PLEADING to be translated."

 

"If Robert Reich said all that 4 decades, 9 years ago, he must have been REALLY ahead of his time!" Arezio B. writes.

 

Will N. wrote, "I know show runtimes shorten a lot when you cut out commercials, but this new show on iPlayer looks like it's going on FOREVER."

 

Eric B. wrote, "I’m moving to Taiwan. Apparently they have more days in a month than we do, and they’re Sundays!"

 

[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!


To read the full article, please visit The Daily WTF

Thursday, February 21, 2019

Soldier Surprise Visits Little Sister After Returning Home

Soldier Surprises Little Sister at School After this soldier was deployed, she decided to do the sweetest thing and surprise her little sister while she was at school! What results is one of the sweetest moments out there. You can’t help but burst into tears just watching it! I sure did!! I’m a total sucker […]

The post Soldier Surprise Visits Little Sister After Returning Home appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Grandma and Grandson Love to Giggle Together

Grandma and Grandson Giggling Together This adorable and heart-felt video are sure to make your heart melt! We all know how easily amused babies are, and this grandson is no stranger to that! In this video, Grandma taps her fingers against a window, causing her grandson to burst into laughter! It’s hard to love anything […]

The post Grandma and Grandson Love to Giggle Together appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

This Woman Has an Elephant for a Best Friend

This Woman and Elephant are Best Friends In this touching video, this woman and her elephant have an unbreakable bond. Lauryn Murray grew up in the circus world, so she naturally took in a giant Asian elephant as her own! This Asian elephant is named Lady Essex, and Lauren shares a particularly strong bond with […]

The post This Woman Has an Elephant for a Best Friend appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

CodeSOD: Conditionally Exceptional

The beauty of structured exception handling is that it removes explicit conditional logic from your code. The conditions are still there, of course: a catch statement is essentially saying "if the exception type is X, then do this". But the strict syntax gives the compiler some freedom, and if you're using a language like Java, which favors checked exceptions (where methods declare what kinds of exceptions they might throw), there are all sorts of shortcuts the compiler might take to keep that efficient.

But hey, that's all implicit, and if there's one thing we've learned, "explicit is better than implicit". How can we make exception handling explicit? Well, our Anonymous submitter inherited some Java code which does just that.

Object obj = null;
try {
    obj = methodThatCanThrowVariousExceptions();
} catch (Exception e) {
    if (e instanceof ExceptionOne ) {
        //Code removed for anonymity
    }  else if (e instanceof ExceptionTwo ) {
        //Code removed for anonymity
    } else if (e instanceof ExceptionThree ) {
        //Code removed for anonymity
        }
    } else {
        //Code removed for anonymity
    }
}
return obj;

While this is pretty heavily anonymized, the highlights are pretty clear. Our methodThatCanThrowVariousExceptions passes its return to an Object. No specific kind of object, of course, just, y'know, a thing. A whatever. If we get a whatever, we return it, whatever it may be. Otherwise, we check each possible kind of exception… in an if. Because why use the basic syntax of a try/catch when you have an if instead?

While this code favors an explicit approach versus an implicit one, I'll leave the explicit language to describe it as implicit in this case.

[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, February 20, 2019

Passerby Rescues Injured Calf from Deep Trench in India

Passerby Rescues Baby Calf from Trench in India In this heartfelt video, a few random passersby are seen at the bottom of a deep trench, attempting to lift an injured baby calf that had fallen in. The calf is hurting and quite heavy, so the woman at the bottom of the trench is experiencing slight […]

The post Passerby Rescues Injured Calf from Deep Trench in India appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Autistic Classmate Named Homecoming King, Students Go Wild at His Dance Moves

Students Go Wild While Autistic Homecoming King Dances in Celebration In this heart-warming and tear-jerking moment, this autistic classmate was named his school’s Homecoming King! Blake Rice celebrated this momentous occasion by busting out some of his favorite dance moves! The gym filled with high school students went wild as he danced for joy! We […]

The post Autistic Classmate Named Homecoming King, Students Go Wild at His Dance Moves appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Hilarious Cockatoo Barks While Standing on Cat

Silly Cockatoo Imitates Bark While Standing on Cat Animals are such silly creatures! This crazy cockatoo perfectly imitates the sound of a dog barking while standing on a cat! Poor kitty! He does a pretty good job tolerating this ridiculous cockatoo despite how annoying he was being. The cat hardly moves as the cockatoo does […]

The post Hilarious Cockatoo Barks While Standing on Cat appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

What's The Floating Point?

Photograph of the San Francisco Mint Coin Adjusting Room. Tables have assay scales at each station. Coin counting... - NARA - 296577

There are a number of gotchas that trip up new programmers: the difference between declaring a variable and initializing it, the need for semicolons to terminate lines at times, and off-by-one errors, to name a few. All of us in the industry have met genius self-taught programmers who can put together extensive, well-architected applications in their sleep—but all of us have also met self-taught juniors who barely grasp the basics and think that's all they'll ever need. There's a reason degrees and formal training exist, after all.

Today's story happened when Olaf was fresh out of university, working his first non-intern job as a "trainee programmer." The company aimed to improve government health care management: a noble goal, for those who have never had the dubious pleasure of interfacing with healthcare systems. However, it was founded by a doctor with just a smattering of PHP knowledge, all self-taught in his minimal spare time.

Olaf came in with an eye to improving what was there using his knowledge of design patterns. PHP is a simple language to learn, but a hard one to master; much of the PHP software out there uses god objects and mingles code with layout, two big no-nos that are nevertheless taught in most online tutorials. Olaf began separating function from form, creating objects that could be reused to minimize the copy-pasting, and the like, happily bringing order to the chaos he'd been given.

Which is how he found himself in the boss's office, on the wrong end of a dressing-down.

"The other programmers won't understand this!" the boss cried. "It's too complicated. Why are you changing it? It works, just leave it alone!"

Disheartened, Olaf went back to work, checking out a clean copy of the master branch without his changes. Trying to ignore the bad practices, he began working on a bug in the accounting system, a bug marked "high priority" and "urgent" since it dealt with billing. Users would upload CSV files with information about what was spent, and the system would sum the values by category and create billing reports. However, there was a rounding error somewhere in the internals, leading to incorrect sums in a few important edge cases.

Olaf had more training than his coworkers, but no training is exhaustive. He was able to quickly determine that this was a floating point mathematical error. Because decimals aren't represented exactly in binary, the math will be wrong in a few edge cases. He went looking for the right way to handle decimal values in PHP. However, unlike Node or C#, it's actually fairly difficult to include external libraries in PHP, as the language has no built-in support for package management. He was unable to figure out how to add a library that would do the math correctly. Since the software was only doing sums, he advocated for integer mathematics: read in the value, remove the decimal point (so that $10.50 would be represented as 1050), do the math, then add the decimal point back when displaying.

One of the other junior devs loved the idea. The senior developer considered it—but the boss flat-out refused the suggestion. His take? "This isn't a floating-point error. This is because PHP is weakly typed, and it's trying to do summation as strings rather than numbers."

(For those who are curious: PHP does not use the "+" operator to concatinate strings. It uses "." instead. "hello " . "world" results in "hello world".)

The final solution the senior ended up implementing: separate the whole part from the fraction, so that our $10.50 charge becomes $10.00 and $0.50, then sum each portion separately.

Olaf didn't wait around to see what would happen when they discovered that the bug still existed, since they were still treating the cents portion as a floating point number. He found a better job in a better language and never looked back.

[Advertisement] Forget logs. Next time you're struggling to replicate error, crash and performance issues in your apps - Think Raygun! Installs in minutes. Learn more.


To read the full article, please visit The Daily WTF

Tuesday, February 19, 2019

Puppy Doesn’t Understand Why Dog Statue Won’t Play with Him

Confused Puppy Tries to Get Dog Statue to Play with Him In this adorably innocent video, this puppy attempts to get this dog statue to just play with him already! Adorned in a cute red bandana, this dog statue looks pretty realistic to this puppy! The puppy attempts to encourage the statue to play by […]

The post Puppy Doesn’t Understand Why Dog Statue Won’t Play with Him appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Baby Girl Tears Up Whenever Mom Sings to Her

Baby Girl Cries Whenever Mom Sings Lullaby to Her In this touching and heart-warming video, this little girl cries whenever her mom sings a particular song. The mother in this video created this song when the little girl was a baby and would sing it to her often. Whenever the little girl’s mom sings this […]

The post Baby Girl Tears Up Whenever Mom Sings to Her appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

CodeSOD: Posting the Check

Coming from the US, I have a pretty simplistic model of how postcodes work. They’re either 5 or 9 digits, depending on how precise you’re being. I can validate that with a simple regular expression. There’s a lot of detail encoded in that number, including the central sorting facility and city or town I’m in, but I don’t usually care about those details. In any country with some sort of postcode system, while the pattern of the postcode may change, the complexity of it generally caps out pretty quickly. That’s sort of the point.

Maybe Sam’s co-worker didn’t know what regexes were. Maybe they’d read an article talking about how regexes were expensive, and were worried about performance. Maybe they wrote this method as part of a college assignment and added it to their personal snippet library and never thought about it again. Maybe they just hated their co-workers and were planting landmines for them to stumble across. Regardless, this is how they verified a postcode within their locale.

public bool checkPostCode(string Postcode)
{
    if (Postcode.Length < 9 && Postcode.Length > 5)
    {
        char[] array = Postcode.ToCharArray();
        int l = array.Length;
        bool end = false, start = false;
 
        if ((int)Convert.ToChar(array[l - 1]) <= 90 && (int)Convert.ToChar(array[l - 1]) >= 65)
            if ((int)Convert.ToChar(array[l - 2]) <= 90 && (int)Convert.ToChar(array[l - 2]) >= 65)
                if ((int)Convert.ToChar(array[l - 3]) <= 57 && (int)Convert.ToChar(array[l - 3]) >= 48)
                    if ((int)Convert.ToChar(array[l - 4]) == 32)
                        end = true;//return true;
 
        if (l == 6)
            if ((int)Convert.ToChar(array[0]) <= 90 && (int)Convert.ToChar(array[0]) >= 65)
                if (array[1] <= 57 && array[1] >= 48)
                    start = true;
 
        if (l == 7)
        {
            if ((int)Convert.ToChar(array[0]) <= 90 && (int)Convert.ToChar(array[0]) >= 65)
            {
                if ((int)Convert.ToChar(array[1]) <= 57 && (int)Convert.ToChar(array[1]) >= 48)
                    if (((int)Convert.ToChar(array[2]) <= 90 && (int)Convert.ToChar(array[2]) >= 65) || ((int)Convert.ToChar(array[2]) <= 57 && (int)Convert.ToChar(array[2]) >= 48))
                        start = true;
 
                if ((int)Convert.ToChar(array[1]) <= 90 && (int)Convert.ToChar(array[1]) >= 65)
                    if ((int)Convert.ToChar(array[2]) <= 57 && (int)Convert.ToChar(array[2]) >= 48)
                        start = true;
            }
        }
 
        if (l == 8)
        {
            if ((int)Convert.ToChar(array[0]) <= 90 && (int)Convert.ToChar(array[0]) >= 65)
                if ((int)Convert.ToChar(array[1]) <= 90 && (int)Convert.ToChar(array[1]) >= 65)
                    if ((int)Convert.ToChar(array[2]) <= 57 && (int)Convert.ToChar(array[2]) >= 48)
                        if (((int)Convert.ToChar(array[3]) <= 90 && (int)Convert.ToChar(array[3]) >= 65) || ((int)Convert.ToChar(array[3]) <= 57 && (int)Convert.ToChar(array[3]) >= 48))
                            start = true;
        }
 
        return start && end;
    }
    else
    {
        return false;
    }
}

Well, that’s a thing. I really like how the first check cycles backwards through the string. I have no idea what locale is being targeted by this code, and I’m not about to trace through it to find out. Instead, I’ll just draw your attention to the //return true commented out, which gives us a sense of the mindset of the developer responsible for this. The whole thing says, “hope you have the ASCII table memorized, sucker”.

[Advertisement] Forget logs. Next time you're struggling to replicate error, crash and performance issues in your apps - Think Raygun! Installs in minutes. Learn more.


To read the full article, please visit The Daily WTF

Mother of the Bride Makeover

Mother of the Bride Gets the Best Makeover Ever This mother of the bride wanted to change up her look for her daughter’s upcoming wedding. She stated in the video that she felt invisible at the ripe age of 60 and didn’t want to embarrass her daughter on the big day. This mother gets the […]

The post Mother of the Bride Makeover appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Monday, February 18, 2019

Great Dane and Puppy Love to Nap Together

Two Great Danes Love Nap Time Awwww!!! I can’t stop watching these two! They’re so precious!! In this super adorable video, two Great Dane brothers are seen napping together in their dog beds (one of those Great Danes can hardly fit in his)! The spotted Great Dane is just a puppy but already is hardly […]

The post Great Dane and Puppy Love to Nap Together appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

German Shepherds Watch Over Baby Geese Chicks

German Shepherd Parents to Baby Geese In this adorable video, two black German Shepherd dogs are sitting around a small circle of three baby geese chicks! They still have their fluffy chick fur that is soft! The two dogs are watching the babies in fascination and are seen nudging, sniffing, and kissing the geese throughout […]

The post German Shepherds Watch Over Baby Geese Chicks appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

The Three-Month Itch

Compass in coil

It was March 2016, and Ian was in need of a job. Fairly early into his search, he was lucky to find a tiny startup in need of someone with Python architecture and design skills. By "tiny," we mean that there were only three other developers working for Jack, the founder.

Ian interviewed with Jack directly. After a technical test, he learned more about the company's pet project: a nearly-finished prototype of an iOS app. Once a user synced their phone with a wrist-worn heart rate monitor, the phone would play appropriate music for whatever the user was doing. It was primarily intended to help users reach a target heart rate while exercising. The app also used the phone's accelerometers to track the user's pace as they moved around, data that Jack claimed would be valuable for research into Parkinson's disease. He even had scientific papers from top universities to back up the claim. The prototype application, in its current state, wouldn't scale. Thus, Jack needed Ian to design a new backend system to store data and handle requests.

Jack was friendly and personable, and his enthusiasm was contagious. Ian accepted on the spot, and started the next day. His office was cramped, but it was his. He got to work designing the requested backend.

Two weeks passed. Then, early on a groggy Monday morning, Jack breathlessly pulled his dev team into a meeting room. The bright light beaming from his Powerpoint presentation drilled into everyone's retinas.

"I've been doing a lot of thinking," Jack prefaced. "We're a brand new startup. Nobody knows about us, right? We gotta do something to build up name recognition. So, here: we're gonna scrap the music part of the app, and focus solely on data collection."

Ian stifled his instinctual What?! Not only were two weeks of work down the drain, but the data collection part of the app was an entirely optional feature at present.

Jack flipped to a slide that showed the metrics he was now interested in tracking for each user. There were so many that the tiniest of fonts had been used to fit them all in. Ian squinted to read them.

"If you build a big enough haystack, a needle will appear!" Jack said. "We'll make the app free so it's a totally opt-in experience. The data we collect is the real prize."

Investment capital was spent on posh downtown office space; for free app developers, only the very best would do. Jack also hired a second iOS developer, a data scientist, and an intern.

"But don't give the intern anything important to do," Jack told the full-timers.

Once Ian settled into his new digs, he began architecting a new system that would somehow capture all the required data.

Three months later, Jack threw it out. "No apps! We need a new direction!"

Jack's new vision was a website where people would sit down and input what songs they listened to when sleeping, exercising, and performing other activities.

"People love to talk about themselves," Jack said. "They don't need to be paid to give us their data!"

A frontend dev was hired to build the website. Soon after it went live, Jack bragged to investors that the website had hit 1 million unique visitors. In reality, the site had handled around 300 submissions, half of which had come from a single person.

Three months later, guess what happened? Jack scrapped the faltering website in favor of a Slack bot that would respond to "Play ${song} by ${artist}" by looking it up on Spotify and providing a link. The Spotify widget would play a 30-second preview, or—if the user were logged in with a Spotify Premium account—play the whole song.

"That's it? How's that going to make any money?" By this point, the developers were no longer holding back their objections.

"We'll charge a subscription fee," Jack answered, undaunted.

"For a chat bot?" Ian challenged. "You already need Spotify Premium for this thing to fully work. If we want people to pay more money on top of that, we have to provide more features!"

"That's something we can figure out later," Jack said.

Jack had the intern develop the company's new flagship product, going against the wishes of Jack from six months earlier. The intern gave it his best shot, but soon had to return to school; the unfinished code was unceremoniously tossed into the frontend developer's lap. With help from one of the iOS developers, he finished it off. And what was Ian up to? Setting up monitoring dashboards and logging at Jack's insistence that they'd attract enough users to justify it.

Three more months passed. A number of "features" were added, such as the bot nagging users in the Slack channel to use it. As this behavior violated the Slack TOS, they were prevented from putting their app in the app store; Jack had to hand out links to a manual install to interested parties. The product was first given to 50 "super-friendly" companies Jack knew personally, of which only a handful installed it and even fewer kept using it after the first day. Jack then extended his offering to 300 "friendly" companies, with similar results.

Ian's breaking point came when Jack insisted he pull overtime, even though there was no way he could help the other developers with their tasks. Nevertheless, Jack insisted Ian stay late with them to "show solidarity." Finally at his wit's end, Ian put in his two weeks. His final day coincided with the general release of the Slack bot, during which he watched a lot of very flat lines on dashboards. When he left the posh office for the last time, the startup still had yet to earn its first cent.

Fortunately, Jack had a plan. After Ian left, he scrapped everything to start on fresh on a new product. No, it wouldn't make any money, but they needed name recognition first.

[Advertisement] Forget logs. Next time you're struggling to replicate error, crash and performance issues in your apps - Think Raygun! Installs in minutes. Learn more.


To read the full article, please visit The Daily WTF

Great White Shark Tries to Break into Diver’s Cage

Great White Shark Bashes into Diver’s Cage The ocean interests some and scares others. In this rare encounter with a great white shark, this diver captures this fascinating creature as it attempts to get into the diver’s cage. Both frightening and spectacular, this video truly displays the power of the great white. In this video, […]

The post Great White Shark Tries to Break into Diver’s Cage appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Sunday, February 17, 2019

Baby Kitten Hides in Owner’s Pocket

Adorable Baby Kitten Sits in Owner’s Pocket This video will melt your heart (and make you want to get a kitty). This baby kitty loves to snuggle up close to it’s owner in his pocket! The little baby pops his head out of the pocket a few times throughout the video, but prefers to stay […]

The post Baby Kitten Hides in Owner’s Pocket appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Baby Mini Pig Covers Little Girl in Kisses

Mini Pig Gives Little Girl Kisses This video is sure to make your heart BURST! I this adorable video, a baby mini pig gives a little girl tons of little pig kisses with its little snout!! We simply cannot get enough of this adorable video! It’s pretty evident in this video that the little girl […]

The post Baby Mini Pig Covers Little Girl in Kisses appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Prince William Turns Red as a Lobster in Reaction to Little Girl’s Question

Prince William Turns Bright Red in Reaction to Question from Little Girl We all love the Royals. I honestly don’t know very many who dislike them. And this is all because of how down-to-earth, kind, and full of integrity they are. Oh, and don’t forget their love for families! Out of all the reasons the […]

The post Prince William Turns Red as a Lobster in Reaction to Little Girl’s Question appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Saturday, February 16, 2019

Crazy Plane Crash Lands in Los Angeles Neighborhood

Insane Plane Crash in Los Angeles Neighborhood On February 3rd, 2019, a small twin prop plane crashed into an Orange County neighborhood. This deadly and dramatic incident killed 5 people. Antonio Pasting was flying his plane after visiting with his daughter and granddaughter when his plane began to fall apart, leading to the crash. The […]

The post Crazy Plane Crash Lands in Los Angeles Neighborhood appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Doberman And Horse Share Very Special Friendship

Doberman and Horse are Best Friends Doesn’t this video just make your heart burst or is that just me?? In this adorable video, we can clearly see the beautiful friendship between this Doberman and his horse best friend! Just because they are two different species, it doesn’t mean that they can’t be best friends and […]

The post Doberman And Horse Share Very Special Friendship appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Enormous 15-car Pile-up in Oak Grove, Minnesota

Dramatic 15-car Pile-up in Minnesota The Polar Vortex shook the Midwest over the past week or so, and Minnesota was definitely one of the hardest hit. In this dramatic and viral video, you can see the horrors of the driving conditions in Minnesota! Icy roads and blinding snow led to this 15-car pile-up on a […]

The post Enormous 15-car Pile-up in Oak Grove, Minnesota appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Friday, February 15, 2019

Little Boy Accidentally Makes Fun of His Mom

Adorable Little Boy Unknowingly Makes Fun of His Mom Kids say the darnedest things, don’t they? We’ve all heard hilarious stories of the things kids say, but this mom was lucky enough to catch it on camera! In this video, her adorable son is sitting with his baby sister on his lap and discussing what […]

The post Little Boy Accidentally Makes Fun of His Mom appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Man Confined to a Wheelchair Dances with His Bride

Man Confined to a Wheelchair Stands to Dance with His Bride I’m not crying, you’re crying (or maybe we both are)!! This wheelchair-bound man is going viral for how inspirational he truly is. Despite his physical disability, he was able to stand and dance his first dance with his bride. In an inspiring feat, the […]

The post Man Confined to a Wheelchair Dances with His Bride appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Error'd: Nobody is Perfect

"Google notified me that it needs help from a human and then displayed me this image," Jeff K. wrote, "I think I may need some help too."

 

"I'm really glad that Pizza Hut's batch job finished up...does this mean I get one of those 16,867,183 coupons?" Lincoln K. wrote.

 

Stefan Z. writes, "Testing is important for any business' site. Even if, sometimes, it's in production."

 

"I give you The Sam's Club business model:

  1. Drop password length limit from 25 to 12
  2. Apply new validation to existing passwords
  3. ???
  4. Profit!" George writes.

 

"My feedback for World of Tanks is as follows - 'I had a VERY negative experience'," writes Piotr.

 

James P. writes, "So...which one do I install first?"

 

[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

Smashing Winter Windows During the Polar Vortex

Breaking Winter Windows Caused by Extreme Temperatures Live in the Midwest or have heard about the terrible Polar Vortex that has torn through the Midwest? Watch this incredible (and hilarious!) video of a young girl smashing a “winter window” that formed on her car! “Winter windows” occur when extreme lows combine with freezing rain. Rolling […]

The post Smashing Winter Windows During the Polar Vortex appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Thursday, February 14, 2019

Athletic Cat Jumps Over Valentine’s Day Roses

Cat Jumps Over Roses to Celebrate Valentine’s Day Cats are incredible animals, and that is plainly evident in this video! There is a beautiful Valentine’s Day display of roses, a heart-shaped pillow, and more. One black cat is seen sitting near the display until a cat adorned in a red cape for Valentine’s Day enters […]

The post Athletic Cat Jumps Over Valentine’s Day Roses appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Baby Girl Refuses to Let Dad Eat Her Vegetables

Baby Refuses to Let Her Dad Eat Vegetables Who remembers not eating vegetables as a kid? We sure do! But how about not letting someone else eat their vegetables? This absolutely adorable baby girl in this video wouldn’t let her dad eat her vegetables! This cute little stinker watches as her dad attempts to eat […]

The post Baby Girl Refuses to Let Dad Eat Her Vegetables appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

CodeSOD: Getting to YES

“We’re a dynamic, multi-paradigm organization, and we do most of our new development in a blend of Ruby and Go. We’re not the kind of company that is dogmatic about tools though, we just want to deliver the best product for our customers.”

That’s what Delphia was told in the interview. She didn’t quite grasp why they were mixing those two in the first place, but the interview went well, and she took the job. It was then that she discovered that everything she’d been told was technically true.

The company had just finished a sprint where they tried to pivot and reimplement their 15 year old codebase in Rails and Go. At the same time. It was difficult to tell from the code if this were a case where they did both together, or they were parallel projects, or frankly, if there was any coordination between either of them. That was their new development.

The company didn’t do much new development, though. The core of the company’s business was a 7,500 line PHP file which contained a single form. It depends on includes from dozens of other files, some of which depend on functions defined in the main PHP file, and thus can’t be used in any other context but that include. It’s less spaghetti code or even a big ball of mud, and more a career killing meteorite.

But it makes more money for the company in a day than Delphia can rightly count.

One function that Delphia kept seeing invoked a bunch was yesorno. It was used almost everywhere, but she had never seen the definition. So, curious, she went digging. And digging. And digging. Someplace around the fifteenth or thirtieth include file she read through, she found it.

function yesorno($in) {
  if($in == 'YES') return 'YES';
  else             return 'NO';
}

That indentation, by the way, is typical of about 30% of the codebase, maybe less. You wouldn’t expect any sort of consistency in this kind of code, would you?

[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

Incredible Book Shop Opens in Chinese Mountain City

Unbelievable Book Shop Opens in China Are you into architecture or books or both? Then this video is for you! Check out this absolutely stunning book shop that recently opened in a Chinese mountain city. Talk about stunning! We are in complete awe of the numerous levels found in this book shop and the literal […]

The post Incredible Book Shop Opens in Chinese Mountain City appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Wednesday, February 13, 2019

Monkey Farts at Dog

Hilarious Monkey Farts at Angry Dog Ever seen one kind of animal make fun of the other? Well, you’re about to! In this comical video, a brave and rather crude monkey shows his bottom and farts at the dog stuck behind a window. The dog is both helpless and upset at this monkey, making this […]

The post Monkey Farts at Dog appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

Baby Girl Admires Her Healthy Belly

Baby Girl Loves to Admire Her Chubby Belly Chubby babies are the cutest babies. We all love a good, chunky baby with adorable fat rolls on her legs! Once babies hit a certain age, they just love to spend time looking at themselves! Watch this wide-eyed and absolutely adorable curiosity in action as this chunky […]

The post Baby Girl Admires Her Healthy Belly appeared first on Viral Viral Videos.



To read the full article, please visit Viral Viral Videos

A Backup Pipeline

“Um… can you come take a look at something for me?”

Pat looked up from happily hacking away at some new features to see Milton hovering at the edge of the cubicle.

“I think I messed up,” Milton added.

One of their company’s main internal systems was a data processing pipeline. “Pipeline” might be a bit generous, as in practice, it was actually a webwork of shell scripts and Python that pulled data in from files, did “stuff” to that data, and dropped the results into other files, which could then be read in by different scripts. In actual use, this usually meant people grabbed the latest version of the scripts from source control, modified and tweaked how they executed to answer one specific data-related question, and if that particular process seemed like it might have value, they’d clean the code up a bit and then try and merge it back up into source control. Otherwise, if they didn’t think they’d need it again, they’d just reset back to HEAD.

Some folks, though, like Milton, mostly kept their own copy of all the scripts. Or in Milton’s case, multiple copies. Milton knew the data processing pipeline better than anyone, but the vast majority of that knowledge was locked up in his personal scripting library.

“I was thinking I should probably try and contribute changes back upstream,” Milton said. “So, like, I’ve got a script that’s called by a script, which is called by a script, and it depends on having a bunch of shell variables created, like $SETUP_DIR.”

Pat nodded along.

“So I wanted to refactor that into an argument, so other people could use it. And I did… but I forgot to change the calling scripts to pass the argument before I tried to test it.”

Specifically, Milton’s script had a line like this:

#!/bin/sh

rm -rf $SETUP_DIR/*/

Which he refactored into a line like this:

#!/bin/sh

rm -rf $1/*/

Shell scripts don’t care if these variables exist or not. Milton had an environment which always guaranteed $SETUP_DIR existed. But $1 is the first argument, and if you don’t pass an argument, it’s nothing. So Milton’s new script, when executed with no arguments, expanded to rm -rf /*/- deleting everything his account had access to.

Mostly that meant lots of failed attempts to delete files he didn’t have the rights to. It also meant his home directory went away, along with his entire packrat pile of spaghettified scripts that were absolutely impossible to reconstruct, as they’d never been placed in source control.

“There’s a way to fix this, right?” Milton asked.

“I mean, sure. You can restore from the last backup you took,” Pat said.

While all the Windows boxes were running an automated backup tool, installed automatically, none of the Linux boxes were so configured. The support team took the stance that if you were technical enough to be running Linux and writing shell scripts, you were technical enough to set up your own backup solution. There was a SAN available to everyone for exactly that purpose.

“Oh, I… never set up a backup,” Milton whispered. “Well… at least I didn’t push?”

Pat wondered if Milton was learning the right lesson from this mistake.

[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