snoofle

After surviving 35 years, dozens of languages, hundreds of projects, thousands of meetings and millions of LOC, I now teach the basics to the computer-phobic

Mar 2014

Chinese, Korean Japanese - It's All the Same

by in CodeSOD on

Matt H. and company recently added support for Cyrillic script to their PDF invoice generator when they discovered that none of the characters would print. The script used DOMPDF to convert the HTML invoices to PDF, and font handling across scripts can get a bit hairy, so it was not really a surprise. However, as he was digging through the code that generated the invoices, he found this little gem:

<?php
...
$body = mb_convert_encoding($body, 'HTML-ENTITIES', 'UTF-8'); 
 $body = preg_replace_callback('/(&#)([0-9]{4,})(;)/', function($matches) { 
 $code = $matches[2]; 
 if ($code<=19968 && $code>=40895) return $matches[0]; // not CJK 
    return '<span style="font-family:kochi-gothic">'.$matches[0].'</spank>'; 
 },$body); 
 $body = mb_convert_encoding($body, 'UTF-8', 'HTML-ENTITIES');
...
?>

Government, Inc.

by in Feature Articles on

Big corporations are bureaucratic enough to make you say: "wtf?!"

Governments are bureaucratic enough to make you shout: "WTF!!!"


Caching Debugs

by in CodeSOD on

Christian's team was writing a time-management application in Java and utilizing a third party library. The application needed to be up and running 24/7.

A few days after a recent release, a customer called in a problem report complaining that the JVM heap was growing in size over time until it crashed with an out-of-memory error.


It's My Network, I'll Configure it if I Want To

by in Feature Articles on

When Alex was a fresh young admin, he was assigned to provide network support for a team of master developers. These guys had years of experience and knew what they were doing, so when they asked for something to be set up, you could bank on their request being correct.

Alex recieved a request from one of the master developers to set up a VM for him and his team. Since it was a development machine, the developers were given root access.


Screwing Up the Screw Up

by in CodeSOD on

Highly Paid Consultants™ should be knowledgeable in their claimed area of expertise. One would assume that any consultant would have a basic understanding of what passing parameters to a function is for and how to utilize that concept in their chosen programming language.

One would be wrong.