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

use Perl Log In

Log In

[ Create a new account ]

n1vux (1492)

  (email not shown publicly) ... x.cgi?BillRicker
AOL IM: n1vux (Add Buddy, Send Message)
Yahoo! ID: n1vux (Add User, Send Message)

Only started with Perl4 and Perl5 in 1995. I was doing AWK etc for 12 years before that, and resisted switching. I've been doing OO since before C++ hit bigtime, with Objective-C and SmallTalk, so I really like the (no longer new) Perl5 OO style; and the Lispish Map style is also an old friend. What do I hack with Perl? All data that passes my way; systems monitoring scripts at $DayJob, weather data at night, and I cheat on NPR word puzzles. Member: [] [] /. LinkedIn []

N1VUX is my FCC-issued ham radio callsign.

Journal of n1vux (1492)

Sunday October 14, 2007
01:54 PM

Ubuntu Massachusetts InstallFest.

I had a nice chat with Andy Oram at the Ubuntu Massachusetts InstallFest which he blogged , and brian d foy answered. Small world!

Thanks to Andy and O'Reilly for sponsoring the doorprizes for the installfest.

Wednesday March 14, 2007
01:01 PM

Happy Pi Day

Today is Einstein's Birthday and Pi Day (3.14 American), so at 1:59 it'll be, to the joy of math geeks everywhere.

Previously I've blogged a couple of Compute Pi in Perl items here --- and

My user #1492 appears at the 19,915th position in Pi's decimal fraction

There are Pi Day observances at Math Departments, schools, and science museums all over

Wednesday January 31, 2007
11:24 PM

More fun with Perl and Pi

A year ago #28505, I answered a question on Perl Monks about calculating Pi with Math::BigFloat. Today the always funny XKCD made me go back and look at that program, as I had two rather less useful approximations of Pi to calculate now.

I'm somewhat surprised that Math::BigFloat doesn't have an AntiLog function for Euler's base 'e' (natural exponent). Hard coding it as a constant isn't terrible, but not nice either. I suppose I could compute it too ...


# Adaptation of my prior program to test XKCD's formulas 2007-01-31
# (9^2 + 19^2/22)^(1/4) = PI
# (e^pi - pi) = 20 - delta

use strict;
use warnings;
use Math::BigFloat;

my $DIGS= ($ARGV[0]||10);

# (9^2 + 19^2/22) = PI
print "(9^2 + 19^2/22) = PI ? \n";
my $pi = new Math::BigFloat '9';

my $term= new Math::BigFloat'19';

# $pi->bsqrt()->bsqrt();

# compare to known-good from bottom of file
my $PI=(new Math::BigFloat <DATA>);
my $good=$PI->copy()->round($DIGS+2);
print $good, "\n";
print $pi->round($DIGS+1), "\n";
print (   ($good - $pi), "\n");

# part 2
# (e^pi - pi) = 20 - delta
print " (e^pi - pi) = 20 ?\n";
# my $e = (new Math::BigFloat '10')->bpow((new Math::BigFloat 1)/(new Math::BigFloat $LOG_10));
my $E = new Math::BigFloat '2.71828_18284_59045_23536';
my $VENTE=new Math::BigFloat '20.0';
print "$VENTE \n";
my $diff = $E->copy()->bpow($PI)->bsub($PI);
print $diff->round($DIGS)," \n";
print " ",(($VENTE - $diff)->round(3)), "\n";

# some accurate pi to compare output to:
3.141592653589793238462643383279502884197169399375105820974944592 30781640628621

Monday January 22, 2007
10:25 PM

Daylight Saving Time and Perl - Issues

General advice has been that if the OS is patched for the DST change, Perl will be OK between March 11 and Apr 4, when US DST starts 3 weeks early this year. e.g.,

However, RedHat Enterprise Linux 3's Perl 5.8.0 doesn't notice that the DST date for the OS changed. I grabbed a "" test script from HP Support's forumsscript and it's working fine everywhere else, but appears to report "unpatched" on the RHEL3 system that is patched according to ZDUMP(8) and release levels.

Is this perhaps GCC 2 => GCC 3 transistion legacy baggage?

That was my guess, and nm(1) seems to support - it reports built with GLIBC232 while RHEL3 is GLIBC323 (subtle, these two numbers). But NM also appears to say it's dyanmically linked and I don't see an older glibc on the box?

Anyone know for sure?



GLIBC2.0 seems to have been a red herring, perl -V says it was built with GCC323, and if I build a new HelloWorld0311.c that expands a time_t value between 2007-03-11 2AMEST and 04-04 2AMEST, it behaves identically. Report from a colleague with a RHEL2.1 system is that perl is correct there, but not on his RHEL3 with home-built Perl 5.8.8 too. This starts to make sense, since Red Hat notes on DST said they were issuing a LIBC patch for RHEL2.1 but only an Olson TZ (zoneinfo) file for RHEL3.

I think we need a RHEL3 LIBC patch to have Perl and C localtime() working.



See discussion - Either redeploying /etc/{.|locales?}/localtime from /usr/share/{.|lib}/zoneinfo after patching or applying all RHEL3/4 patches not just the suggested one seems to be the trick. Perhaps the patch failed to refresh because our RHEL3 install is missing the needed tzconfig utility, but it looks like cp would do the trick.


FYI, DateTime::TimeZone is another issue ... it has it's own Olson TZ/zoneinfo, that's it's whole point, it's independent, so it needs to be updated instead of or in addition to the OS, that's a feature.

Saturday December 09, 2006
02:28 PM


My excuse for lack of contributions to the Perl Advent Calendar this last week was I was apparently one of the few attendees at <XML2006> not live-blogging, including several folks from O'Reilly. In spite of the O'Reilly presense, I didn't see or hear much Perl there. One speaker does much of his work in Perl; another has done a couple modules, but Java and Dot-Net appeared to be dominant platforms in discussion.

I returned not so much knowing more, but more aware of what more there is to learn.

My choice of note-taking being paper booklets and a fountain pen may be retro-tech, but my reasons for limiting online time to a bit of Zaurus email checking has more to do with laptops not having Ergo keyboards. Pleasantly, the hotel supplied note paper was in jacket-pocket shaped booklets. I filled an average of one a day with spider scribble.

Since I am dealing with WebService and Service Oriented Architecture issues at $DayJob, I spent much of my time in the Enterprise XML track, but sampled Hands-on XML and XML on the Web as appropriate, especially if "Lessons Learned" or "Best Practices" appeared in the short description. I missed all the good typography and layout talks in the Documents & Publishing track since it's not related to $DayJob, although I'd have personally enjoyed lots of that and the Web2.0 mashups on the Web track.

Suddenly, I feel in a state of sin for typing this inside layout tags instead of semantic tags!

As I glean nuggets of interest from my notes, and my notes-to-self to google more details on many things heard in passing, I'll try to blog them here.

Thursday October 12, 2006
09:55 PM

The geometry of 3-manifolds / Poincaré conjecture

Earlier this week, I attended a public lecture in the Harvard "Research Lectures for Non-Specialsts" by Curtis McMullen (Harvard University): The geometry of 3-manifolds.

As I expected, this was a (relatively) elementary explication of the recent Poincaré conjecture progress, for which Grigori Pereleman was awarded one of the 2006 Fields Medals, and is in line for a share of the Clay Millennium Prize as well. As it happens, McMullen had previously won the Fields Medal himself, in part for cross-fertilizing techniques of chaotic-dynamics to the understanding of the larger Thurston's geometrization conjecture -- that Perelman solved (and declined the Medal). (Thurston had previously been awarded a Fields also.)

Thurston's conjecture seeks to categorize all finite, orientable, unbounded (hyper)surfaces (“manifolds”) according to their intrinsic geometries. Orientable leaves out the un-orientable Möbius strips and Klein bottles and their higher-dimensional analogues. Unbounded leaves out sheets of paper, paper-towel tubes, and again the Möbius strip. Finite leaves out an infinite plane, line, or space, or even a infinite spiral cylinder or library.

McMullen had both an inflated beach-ball and an inflated beach “inner tube”, both with marked equators, to demonstrate the topological difference of a sphere and a torus considered as 2-D manifolds. The Sphere passes the loop-test – any loop drawn on it's surface, including but not limited to all diameters, can be shrunk to a point and thus removed topologically from the sphere, but neither kind of diameter on a torus (slicing of bundt cake and of bagel) can be shrunk to a point and removed, only non-diameter loops can. This is an important distinction – of all the possible 2-dimensional surfaces (2-manifolds), the topologists' 2-sphere is the only one to pass the Loop test.

  • [Note on terminology - The topologists' 1-sphere (circle), 2-sphere (beachball surface), 3-sphere (hypersphere) are called by geometers the 2-sphere (closed line), 3-sphere (surface of a 3-ball), 4-sphere (hypersurface of a 4-ball). The Geometer's terminology was of course used in your high school geometry class. Why a difference? Geometers measure the embedding metric space. Topologists usually ignore embedding and look at the internal invariant metrics of the surface, such as it's own intrinsic dimension. Geometers would say hyper-surface explicitly if they meant a 3D hypersurface of a 4D-hyper-volume. *]

One of the key results of 2-D topology is there are only 3 potential geometries for a 2-D manifold. His illustration is of the three is [here]. – Spherical Geometry of course works on a sphere, amusingly the Euclidean geometry works on the torus, and the Hyperbolic geometry works for all higher genus 2-D manifolds (surfaces with more than one “handle”, places where a loop can be caught). Why does Hyperbolic work for all higher genus surfaces? All the extra room at the edges – see the huge number of angels and devils in the outer rings of the infinite regress in Escher's version, visible on his homepage (The text their on his homepage includes a quick overview of his topics.) Right-angle pentagons are a key to the hyperbolic plane.

Jumping up to 3-D hyper-surfaces – again finite but boundless – he used Dante's Paradisio/Inferno as his model of the 3-sphere, a nest of spheres proceeding from a point to a large sphere, and down to a small sphere again. (This 3-manifold is embeddable only in 4-space, not 3-space, obviously. Another common model is two 3-balls, meeting at all points on their exterior such that orientability is maintained. This is the hyper-surface of a 4-ball hyper-volume in 4-space.)

He then used the stage doors of the lecture hall to model a 3-D hyper-torus "hyper-surface" as near cube with sides identified and demonstrate that it too would be loop-linked as was the torus. If we went out the back exits, we'd reappear behind the projection screen; if we exited stage left, we'd reenter stage right. Digging through the floor, we'd drop in the ceiling. He pulled a cord from the door stage right across the stage to the stage left door, saying, if this were a 3-torus, I could reach out this door, back in the other door, to tie this end of the cord to the other end (which he seemingly does), then pull the loop through the space like this ... and the cord did pull through the door, and slack behind him disappeared out the stage-left door. He half convinced us we were indeed in a hyper-torus mini-universe and stuck there :-) , but he did demonstrate that there is no getting shrinking a loop on a 3-torus.

Original form of the Poincaré Conjecture is basically that the 3-sphere is the only closed finite 3-manifold that passes the loop test. The special case of the geometrization conjecture for 3-D requires 8 geometries, and requires allowing segmenting a manifold piece-wise into those 8 architectures. This conjecture includes Poincaré's implicitly, since the spherical geometry will pass the loop test, and the others won't – so if there are no other manifolds, only the unique spherical manifold would pass the loop. The other 7 geometries do not admit a pseudo-sphere, and the spherical geometry has only one possible manifold. Again, the hyperbolic geometry's extra “space” provides the flexibility to rigidly geometricize the stranger manifolds. The lovely "Hyperbolic Space tiled with Dodecahedra" is locally Euclidean – all those 90-90-90 rectilinear girder-and-beam intersections – but globally it has negative curvature. This is the 3-D analog to the hyperbolic tiling with right-angle pentagons, of course.

One of the many great mathematicians to have thought they had proved the Poincaré Conjecture said using Topological arguments was the way not to prove this topological conjecture; in retrospect, his self-criticism appears correct.

[I'm omitting the connection between Knot Theory and geometrization of their complement spaces, which is important in the history of the conjectures.]

Hamilton made great progress on the Poincaré-Thurston problems using “Ricci Flows”, to morph a manifold into it's smooth equivalent, but was stymied by singularities in dimensions higher than 2. McMullen showed a movie of Ricci Flow in action [probably this one. Ricci Flow deforms a curve or surface locally to reduce local curvature – and this has an emergent global property to create symmetry, and in 1-D curves embedded in 2-D space, as in the movie, this will never cause self-intersection.

But with 3-manifolds embedded in 4-space, it can cause the singularities that stymied Hamilton and others, and if repeated, that could fragment the manifold into droplets, which didn't seem useful. Perelman's key insight, according to McMullen , is that these singularities are features not bugs – they're the “cut here” points of the necessary partitioning of a peculiar manifold into it's different constituent metric geometries. Perelman added an analogue of physic's “entropy” to demonstrate that patching the singularities and continuing the Ricci Flow on the resulting pieces was not an infinite shattering but eventually converged to obvious geometries.

[Omitting discussion of singularlary democratic on-line referreing of posted pre-prints without actual paper publication.]

References --

In Mathematics, Wolfram's Mathworld is more authoritative than WikiPedia, which may be more readable by non-mathematicians.

Links for the Grigori Perelman Preprints at

Image galleries used for his slides

AMS summary of state of the proof -

"Notes on Perelman's Papers", Bruce Kleiner, John Lott,

"Ricci Flow and the Poincare Conjecture" John W. Morgan, Gang Tian, 473 pages with over 30 figures

Yau's slides

Humor - Perelman T-shirt

Saturday September 23, 2006
10:15 PM

Knoppix rescue of Linux Laptop

My Linux laptop (thinkpad) was NFG for 24 hours, with GRUB Error 17.
  [Duration was unrelated to severity, just I had other things to do
after I noticed the issue. ]

Problem was caused by shutting down hard (power switch) during boot
(due to real life intervening). Apparently I powered down at exactly
the wrong moment during boot ...

Error 17 means the MBR was read ok, but the /boot filesystem is NG,
format not recognized. Loosely translated, this means /boot
superblock was corrupted.

Why would shutdown write a superblock? Mis-calculated dirty-buffer
flush, maybe? Who knows what hardware does when power is removed? sigh

Wasn't really all that hard to fix, once I dug around ... finding the
RIGHT args for the FSCK to not fsck-up, of course ... but getting to
the point where I could FSCK at all was awkward.

Google for Error 17. (Of course I have alternate computers. This does help.)

Boot Knoppix 5 DVD from UK Linux (Pro) Magazine.

See that /dev/hda2 and /dev/hda4 are auto-detected, have icons on
Knoppix desktop.

HDA2 is clean. HDA3 is swap (/mnt/hda2/etc/fstab agrees it should be),
but where's /dev/hda1 => /boot ? FSTAB says it should be ext3 on

Gpart can't guess, it's says everything is 0 size. That's helpful.
Just helpful. Can't gpart find and use default alt-superblocks in its
heuristics ???

Knoppix didn't even create a block device for hda1 since it wasn't
automountable. So I had to
  # cd dev
  # ls hda* # see hda hda2 hda4 all looking similar
  # man mknod # haven't used this command in YEARS !!
  # mknod b 3 1 hda1 # follow pattern
  # chown root:disk hda1
  # chmod g+w,o-r hda1
to match the others.

Once I did that, it still won't mount -r; it informs me it's got a bad
superblock (as I'd figured).

And FSCK refuses to do anything with bad superblock either.

I had to read the Man page to find out the default backup-superblock
position for a 1K block size, and then ask it "are you 1k blocksize"
by doing
  # fsck.ext3 -b 8193 -B 1024 -n /dev/hda1
to see if it was a 1k blocksize /boot, in which case it would have
simple errors, or if (since /vmlinux is a big file) someone made it
2k or 4k block, that would die gloriously and I'd try the other
default -b's for -B 2024 and -B 4096. Since it was ok but for block 3
on 6+ pass, I ran it for real.
  # fsck.ext3 -b 8193 -B 1024 -n /dev/hda1
It prompted to ignore a read error and prompted to re-write superblock.

So then I
  # mount -t /dev/hda1 /mnt/hda2/boot
and poke around to see that it looks good. Ok, time to try booting again.

Then I remembered to
  # umount /mnt/hda2/boot
  # umount /mnt/hda2
so we're clean, and before shutdown Knoppix for reboot and remove DVDrom ... and see Grub choice menu come up.

Yeah! Knoppix wins again!

I'm glad that worked, since I'm still not sure how to mount the
several volumes in /dev/hda4 via LVM from Knoppix, if I'd had to
rescue my data. Knoppix 5 has an LVM command, but ...

Wednesday April 19, 2006
04:28 PM

LWP::Simple, HEAD method, Firewalls and http_proxy

I decided I needed to try setting up CPAN::Mini at work. Not a problem, only missing File::HomeDir and Compress::Zlib on my development system which I should have anyway.

But the minicpan script failed with message

unable to contact the remote mirror

After verifying that it was attempting to use the $ENV{http_proxy} standard (by adding debug lines to the CPAN::Mini module), I guessed that I needed to comment out the lines in CPAN::Mini::new():

  # croak "unable to contact the remote mirror"
  #  unless LWP::Simple::head($self->{remote});

since HEAD isn't always as well supported or tested ... and voila, it works. Apparently LWP::Simple doesn't use UserAgent's env_proxy options for HEAD method.

I already have a bug report submitted at rt.cpan ... I'm recording the workaround here so folks googling for a solution have a chance to find the work-around.

Wednesday March 15, 2006
11:22 AM

Dan Bricklin's wikiCalc is Perl !

Dan Bricklin, co-founder of VisiCalc and thus the spreadsheet revolution, is building his GPL2 dual-license collaborative "wikiCalc" tool in Perl with AJAX -- usuable locally, as CGI, or mod_perl. Imagine something with the collaborative advantages of a wiki but with WYSIWYG tables and embedded calculations. I'm going to be looking for some nails to pound with this hammer ...
Tuesday March 14, 2006
11:53 AM

Boston PM Tech+Social tonight 3/14 (Pi Day)

Boston.PM will have a combined Tech/Social Meeting, Tuesday, March 14, 2006.
Duane Bronson will present some small scripts he has written [Details and more detail]
MIT E51-376, 7pm [directions and map links]
Then we'll adjourn to Cambridge Brewing Company around 8pm