Recent posts on ν42: nu42.com

How you average numbers matters

Every now and then, I end up having to explain to skeptical people why it matters how their programs treat the numbers they ingest. With IEEE 754 and doubles, people seem to think that one can just will nilly add a bunch of numbers and average them, and get reliably accurate results … (more)

It all boils down to stat vs fstat from MSVCRT on Windows

Last time, I had just noticed that my perl's stat $filename and stat $fh did not agree on the modification time of a given file.

This turns out to be due to a difference in the way the underlying system calls on Windows behave. (more)

Time zone insanity on Windows

A bit of time zone insanity on Windows causes a spurious test failure with Mojolicious. (mode)

Fixing an oversight in Math::Int64

stdint.h is included if we are compiling with MinGW, but not if we are compiling with a Microsoft compiler. There is a good reason for that: Visual Studio up to version 2010 did not include stdint.h.

But, I am building this with VS 2013, so things get messed up. (more)

Do you uuencode? pack 'u' does!

Uuencoding, which I first used over 25 years ago, and forgot about soon after I stopped using Eudora on Windows 3, can be used to include encoded binary data in the __DATA__ section of a Perl file. (more)

Include image data in the data section of your Perl script or module

This example shows how to do it without adding new dependencies to your project … (more)

Fixing malformed XML with Perl's XML::Parser

I have more experience than I would like to recount being in the middle of a data processing pipeline. I often have to acquire data sets which have been produced using deity knows what kind of COBOL written several decades ago, then passed through several layers to produce what seems to be the cool data format of recent times. Owing to the fact that I am both an economist and a developer, I am often also the end user of said data sets, so I have a vested interest in getting those data sets to usable shape. I have had to resort to using JScript on locked down Windows Servers to process awful lookup tables put together as if the largest hard drives were still 44 Mb Miniscribes.

Frequenly, you find yourself having jumped through 1600 bureaucratic steps to actually get access to the data, and the upstream is either unresponsive to constructive criticism, or worse. In these circumstances, it falls on you to fix others' mistakes, and keep things moving, because it is not your job, say, to enforce the XML standard. (more)

Hands off that constant

In this Stackoveflow question titled "How do I programatically construct constant name and use value of constant?", we have someone who wants to be able to construct names of constants and look up their values.

A Perl programmer knows that if you want to look up values based on string keys, you should use a hash. (more)

Trend analysis at the shallow end of the pool

I have always wondered why some people feel Perl has to suck for their choice of language to be valid. It looks like there are a bunch of people who just try to satisfy their need for approval by seeking what's most popular, and trying to hitch their wagon to that train. I do not know what they can gain by this, but they exist.

Yesterday, I noticed a post on HN which linked to a Google trends comparison of Perl and Python … more

Building libexpat and XML::Parser on Windows 8.1 64 bit using Visual Studio 2013

One of the two main stumbling blocks I have had to a really fulfilling experience with my self-built perls on Windows has been my failure to build libexpat, and libgd. … more

A Ubee nightmare: Maybe your cable modem is the problem after all

After another one of the Ubee replacements from Time Warner failed to even establish a connection after hours of trying, I decided, maybe I was right to be suspicious of the crappily constructed ugly thing that cannot sit straight.

I stopped by the local Walmart, and got myself the most reasonable looking cable modem among the three that were on the shelves: A ZOOM 5341J. … more

UTF-8 output in cmd.exe: perl 5 vs perl 6

I have mentioned before that there are some problems with UTF-8 output in cmd.exe with perl 5.

When I successfully built a perl 6 binary, I was excited to see it produce perfectly good UTF-8 output. … more

When bits don't stick: More portability bugs in Perl modules

The process of putting together the talk lead me to discover another two more of those pesky bugs due to platform differences in handling files. These are more interesting than the directory separator character style issues that I have been ranting about, mostly because of how hard they were to see just by looking at the code. I will submit patches, obviously, but my hope with these blog posts is to re-emphasize that these platform-specific differences do exist, whether we like it or not, and if more people are aware, fewer bugs will make it into CPAN modules in the first place. … more