Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • happen several years ago. I wanted to create [] and found a site that showed colorblind versions of the websafe colors and referenced HCIRN as the source. I asked them for their code, which they were kind enough to provide.

    The code was provided in two forms: Java that didn't work, and a spreadsheet that did work. Neither form was clear to read. Since the spreadsheet worked, I started off with a literal translation of that document. Instead of your Label200 things, I had oodles of variables like $E3 and $F45 referencing the contents of spreadsheet cells. The translation worked.

    Of course it looked decidedly nasty. I trimmed dead paths in the code, removed variables that were calculated but never used, and cut out some repeated calculations that were always run on the same inputs. It was still a mess of course.

    I spent some time educating myself about color spaces and tracked down the credited source of the algorithm the spreadsheet was intended to embody. Eventually I was able to start putting variable names from the broken Java onto the translated spreadsheet code, reworking the spreadsheet code into something that fit the rough form of the Java code.

    I never did bother to figure out what the bug was in the Java code was because once the translation got sufficiently far enough away from the spreadsheet version and looked a bit more like perl code, I kept morphing the code in a more perl-like direction to make it easier for me to read.

    Then I translated the whole mess to javascript.

    The result is in [] at the function color_blind_sims() and in the lookup tables above there. If you scroll up to Color_rgb_from_xyz() you can find a reference to a slight difference in the constants supplied in the spreadsheet versus the java code.

    I was lucky enough to have had two code sources (although only one worked), a reference to the algorithm which was being used, and reference material discussing the problem domain. If I hadn't have had all of that, I suspect that the code would still exist as a nice black box full of $E3 and $F45 variable names :)