symlinks on linux

Posted by robbiebow on 12 November, 2008 under geek | Be the First to Comment

I get confused by the manual page for ln – it just doesn’t make it clear to me what goes where. Anyway, so I always remember setting up symlinks as:

ln -sf real pretend

Generally, that’s all I need to remember.

SOAP, XML, SAX, cpan & perl on Debian

Posted by robbiebow on 5 November, 2008 under geek, perl | Be the First to Comment

Many many times I have suffered undue pain when using perl with XML. Anything using SOAP::Lite, XML::Simple, XML::Feed is more often than not affected by incredibly slow XML parsing. This in turn is more often than not down to the lack of certain C or CPAN libraries; out of date or poorly configured XML::SAX or XML::Parser modules; or any combination of all these factors.

The answer is, almost always, to (re)install a few things to get a great performance boost. Here’s what I remember from fixing up a fairly standard Debian 4.0 (etch) install which came with perl 5.8.8:

Use aptitude to install or upgrade the following packages:

apt-get install libxml-sax-perl
apt-get install libxml-sax-expat-perl
apt-get install libxml-libxml-perl

Now the advantage of using apt to do the install is that it will find the all important missing C libraries and install them too. libxml2 and xml-core are the two C libraries that I recall.

Then, reinstall XML::SAX using CPAN:

cpan XML::SAX

Hopefully, that will go smoothly.

Here’s where things get messy: Now you need to uninstall the XML::SAX that you install with apt because apt – at the time of writing (atow) ships version 0.12 whereas the latest version – 0.96 atow – has many fixes. You need to uninstall it because although you have installed the latest version using CPAN, apt and cpan tend to install packages in different locations on your machine.

So, find all versions of XML::SAX on your machine. I use locate for this:

updatedb
locate /XML/SAX.pm

If you find more than one copy of XML::SAX check each version that your find all but the most recent one.

Make sure XML::SAX knows about the parsers we just installed.
XML::SAX picks a parser based on what’s in ParserDetails.ini so you need to make sure your parsers are in there.

http://perl-xml.sourceforge.net/faq/ is a great guide to many of these things and

perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::LibXML::SAX))->save_parsers()"

Does the job.

Sometimes trying to apt-get install libxml-sax-perl keeps returning a could not configure XML::SAX error.

You probably installed XML::SAX using cpan and the old version was deleted (either automatically, or manually) before you apt installed the XML parsers. Well, this is a pain as apt will keep on moaning about it every time you use it. So my solution is to edit

/var/lib/dpkg/status

To say that it is installed, e.g.

Package: libxml-sax-perl
Status: install ok installed

A golden opportunities about to be missed?

Posted by robbiebow on 1 November, 2008 under politics, stuff | Be the First to Comment

The problem we have with banking is that we cannot live without retail banking: day to day banking for people and small companies. Investment banking – or the gee-gees as I prefer to call it – affects very few people, and those that it does affect should be financially secure enough to take significant losses on the chin. Both types of banking have their place.

We ought to not regulate risk out of the entire system. Without risk their is no room for big rewards for big successes. However, we have currently insulated banks from risk by nationalising them. Big rewards for big success only work when they are accompanied by big penalties for big failures. Now the banks can take big risks and if it screws up the man on the street foots the bill. If it succeeds, the banks get their lolly.

So separate gee-gees from retail: the banks should be forced to split their operations into completely separate entities. The resulting retail banks should then be heavily regulated as to how they can borrow and lend, but also be heavily backed by government to protect depositors & borrowers, and ensure you and I get our pay cheques. The gee-gee banks should be lightly regulated and not at all backed by government. Goldman Sachs is where you go to take risks, make (or lose) your millions. Barclays Retail is where you get your mortgage and current account. Exciting and dangerous need to be conjoined, as do boring and safe. Presently we have exciting and safe for our bankers: a disastrous combination.