Recent posts on ν42:

Slashing one's feet with tests, or, how to fix 2,950 test failures in one fell swoop

This morning's cpan-outdated | cpanm failed with a torrent of test failures from Pod::Simple.

The log file was so large that I was intimidated at first. Then, I switched to the build directory to see what was failing. Running nmake test filled my screen with a scrolling avalanche of test failures. When the dust settled, I noticed a pattern to the last few tests that were still visible on the screen: (more)

Playing with the TrueRNG 2 hardware random number generator

Recently, I came across TrueRNG 2 on Amazon. I made an impulse decision to take it for a spin. The design on TrueRNG 2 is based on the so-called avalanche effect. The device I received was in a black plastic enclosure with no markings on it except for a cheap sticker with TrueRNG2 / printed over the background of an American flag. (more)

Test failures and directory separators: Take N

A routine update to Perl's Inline::CPP brings about another set of test failures due to the implicit assumption that the same character works as the directory separator on all platforms … (more)

Translating a Rosetta Code entry from Perl to C++

"If the latest C++ could improve on this Rosetta Code task entry for C++ then you might want to compare your improved C++ against the other scripting language solutions such as Perl, Python, Ruby, and Tcl." (more)

No more CPU upgrades for you!

It did not take too long to figure out I had screwed the heatsink on too tightly. It took even less time for me to strip three of the four Phillips screws holding the heatsink in place. The screws have springs around them, and, apparently, if you apply too much force, you're done!

What to do? (more)

Linode makes it hard to maintain uptime (in a good way :-)

Checking my Linode dashboard this morning, I noticed a little notification tucked away in the bottom right corner of the screen announcing the availability of a KVM upgrade … (more)

Can the creators of Quorum write programs in Quorum?

I finally broke down and downloaded Quorum to a Linux VM. I wanted to see what output their Quorum code produced, as I had failed to run it using their online widget.

Using the image of the reference Quorum code which they gave their participants in both studies, I typed in the following code, and put it in a text file. … (more)

Then they came for your Java and Ruby

Recently, brian d foy posted a challenge to rewrite a Perl example in Stefik et al. (2011). In that paper, the authors infamously proclaimed:

Results showed that while Quorum users were afforded significantly greater accuracy compared to those using Perl and Randomo, Perl users were unable to write programs more accurately than those using a language designed by chance.

Quorum seems to be their pet language which they are pushing to replace actual programming languages in widespread use in the industry. (more)

Upgrading my laptop's wireless card to an Intel 7260

Sometimes, I get the itch to tinker with hardware, and I have to scratch it — one hopes without breaking anything.

A few days ago, I discovered the easiest fix when I noticed extremely reasonably priced Intel Network 7260.HMWG.R cards on Amazon.

The itch was killing me. I ordered one, along with the bracket adapter. (more)

Multiple cohabitating versions of Perl on Windows

I just built my shiny new Perl 5.22.0 on my 64-bit Windows 8.1 system using Visual Studio 2013 Community Edition.

First, and foremost, thank you to all who contributes to the development of Perl. Also, thanks to Microsoft for making Visual Studio Community editions available.

While going through the motions of installing the various CPAN modules, the old issue of multiple cohabitating native Windows Perl distributions reared its head again (more)

C++: Walking the filesystem with Boost

Last time, I left after putting together a short but complete program that processed command line arguments, and showed a help message. (more)

C++: Parsing command line arguments with Boost

Still feeling excited about modern C++, I decided to install Boost with MS Visual Studio 2015 RC. Of course, most of Boost is header-only, but there are some libraries with binary components. One of those is Boost.Program_options whose purpose is to provide nice interface to reading program options from either the command line or a config file. (more)

Who is testing the tests?

I have no qualms with the basic premise of test-driven development. However, it doesn't take long before one realizes that any test that is even moderately complicated can itself become a source of bugs. At some point, it feels like the tests themselves are going to need test suites which themselves will need test suites etc ad infinitum. (more)

Golfing a word count program

Most interesting Perl programs are not one-liners. They free the programmer from the drudgery of building up and tearing down commonly used data structures to enhance the programmer's ability to focus on the real problem. It is refreshing to see that C++ now feels that way as well. (more)

Can C++ become your new scripting language?

Containers that free the programmer from the burdens of manual memory management, algorithms, lambdas, and even autovivification! Is C++ becoming straightforward enough to use in daily programming tasks? (more)

Sending faxes using Perl on Windows

A minimal script to send a fax using Perl on Windows. Of course, this assumes your computer actually has a fax modem installed. If not, the RNX-56USB looks like it would do the job. It works on both Linux and Windows.

Can programmers do Statistics?

I have a feeling that most programmer types assume Stats is trivial because the arithmetic involved in most of the basic concepts they have occasion to use is trivial.

In reality, people who assume Stats is trivial share the same lack of understanding pretty much everyone else has about basic Stats concepts. For example, many of them seem to assume that significant test statistic, by itself, means something about the truth of a hypothesis, or that a high correlation coefficient between two variables means one causes the other, or one can reliably predict future values one using the future values of the other.

Windows does have symlinks

Since Vista, one can use the mklink command to create symlinks. mklink is rather cumbersome to use because Windows has no sudo (sudowin aside), but symlinks do exist, and they are pretty convenient once you create them … (more)

Highlight Perl source code using PPI::HTML

A recent Stackoverflow question introduced me to the PPI::HTML module which uses the amazing PPI module to parse Perl source code, and associate CSS classes with the various elements.

What if you wanted to produce a self-contained chunk of syntax-highlighted Perl without depending on external CSS or JavaScript? In that case, you can resort to a somewhat grungy technique I use when I am generating HTML email: Post process the HTML to replace classes on elements with style attributes.

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