Friday, February 17, 2006

Soundcard again...

Ages ago I recall finding that the ALSA drivers didn't work on the Tosh, so I was running OSS, but then when I upgraded to 2.6.15-1-686 they stopped... whether that was just because I didn't know to run alsaconf I don't know - but it *did* work fine on the Vaio.

debian-faq-wiki::UseSoundCard
had everything I needed to get ALSA going this time.

ALSA vs OSS

ALSA rocks! - now my Gaim has sound too I can hear when people login or out or send me messages... and my console beeps work :o)

Best of all... I can now use that *gorgeous* AlsaPlayer again... which lets you speed up and slow down and even reverse tracks!!! - crazy :o) great thing to have access to if you're getting bored with listening to your music collection!

Gaim spell check

It seems there are quite a few dependencies to get this working, and the gaim package doesn't actually recommend the bits you need, so I had a look at the Vaio and a few looks with apt-cache search and ended up getting it working...

I *think* this is pretty much what you need:


gaim
(shock, horror!)
aspell
aspell-en
dictionaries-common
libgtkspell0

Friday, February 10, 2006

Installing XML::Simple

http://www.cpanforum.com/threads/1473


cpan> install XML::Simple
Running install for module XML::Simple
Running make for G/GR/GRANTM/XML-Simple-2.14.tar.gz
Is already unwrapped into directory /root/.cpan/build/XML-Simple-2.14
Has already been processed within this session
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib/lib', 'blib/arch')" t/*.t
# Package Version
# perl 5.8.7
# XML::Simple 2.14
# Storable 2.13
# XML::Parser Not Installed
# XML::SAX 0.13
# XML::NamespaceSupport 1.09
# XML::SAX::PurePerl 0.90 (default parser)
t/0_Config........ok
t/1_XMLin.........ok 1/122Unable to recognise encoding of this document at /usr/
local/share/perl/5.8.7/XML/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
t/1_XMLin.........NOK 32
# Failed test 'no warning issued (as expected)'
# in t/1_XMLin.t at line 380.
# got: 'Unable to recognise encoding of this document at /usr/local/sha
re/perl/5.8.7/XML/SAX/PurePerl/EncodingDetect.pm line 96.
# '
# expected: ''
t/1_XMLin.........ok 33/122Unable to recognise encoding of this document at /usr
/local/share/perl/5.8.7/XML/SAX/PurePerl/EncodingDetect.pm line 96.
t/1_XMLin.........NOK 38
# Failed test 'CDATA section parsed correctly'
# in t/1_XMLin.t at line 426.
# Structures begin differing at:
# $got->{cdata} = 'Hello, world!>'
# $expected->{cdata} = 'Hello, world!'
t/1_XMLin.........NOK 39
# Failed test 'CDATA section containing markup characters parsed correctly'
# in t/1_XMLin.t at line 432.
# Structures begin differing at:
# $got->{x} = 'one>two>'
# $expected->{x} = 'onetwo'
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96, line 1.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96, line 1.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96, line 1.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96, line 1.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96, line 1.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96, line 1.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96, line 1.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96, line 1.
t/1_XMLin.........NOK 122
# Failed test 'successfully read an SRT config file'
# in t/1_XMLin.t at line 1443.
# Structures begin differing at:
# $got->{pubpath}{test1}{title} = 'web_source -> web_target1'
# $expected->{pubpath}{test1}{title} = 'web_source -> web_target1'
# Looks like you failed 4 tests of 122.
t/1_XMLin.........dubious
Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 32, 38-39, 122
Failed 4/122 tests, 96.72% okay
t/2_XMLout........NOK 47
# Failed test 'generated document with escaping'
# in t/2_XMLout.t at line 302.
# Structures begin differing at:
# $got->{c} = '&C&'
# $expected->{c} = '&C&'
t/2_XMLout........ok 99/196Unable to recognise encoding of this document at /usr
/local/share/perl/5.8.7/XML/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
t/2_XMLout........ok 196/196# Looks like you failed 1 test of 196.
t/2_XMLout........dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 47
Failed 1/196 tests, 99.49% okay (less 1 skipped test: 194 okay, 98.98%)
t/3_Storable......ok
t/4_MemShare......ok
t/5_MemCopy.......ok
t/6_ObjIntf.......ok
t/7_SaxStuff......ok
t/8_Namespaces....ok
t/9_Strict........ok 2/38Unable to recognise encoding of this document at /usr/l
ocal/share/perl/5.8.7/XML/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
Unable to recognise encoding of this document at /usr/local/share/perl/5.8.7/XML
/SAX/PurePerl/EncodingDetect.pm line 96.
t/9_Strict........ok
t/A_XMLParser.....skipped
all skipped: no XML::Parser
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/1_XMLin.t 4 1024 122 4 3.28% 32 38-39 122
t/2_XMLout.t 1 256 196 1 0.51% 47
1 test and 1 subtest skipped.
Failed 2/11 test scripts, 81.82% okay. 5/454 subtests failed, 98.90% okay.
make: *** [test_dynamic] Error 255
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force

Thursday, February 09, 2006

tcpdump syntax


/usr/sbin/tcpdump -A -s 65535 -i eth0 -l host $ME and host $IT

Wednesday, January 25, 2006

NFS errors...


# umount /var/cache/apt/archives
Cannot MOUNTPROG RPC: RPC: Port mapper failure - RPC: Unable to receive
umount: /var/cache/apt/archives: device is busy


and


# mount /var/cache/apt/archives
mount: RPC: Remote system error - Connection refused


Hmmm... the NFS daemon was not running on server.

I did this on the server:


/etc/init.d/portmap start
/etc/init.d/nfs-kernerl-server start


After I had done this I got:


# umount /var/cache/apt/archives
Cannot MOUNTPROG RPC: RPC: Program not registered


and


# mount /var/cache/apt/archives
mount: RPC: Program not registered


I had to add an entry to /etc/hosts.allow on the server like this:


ssh sshd : ALL@ALL : ALLOW
ALL : 127.0.0.1 LOCAL : ALLOW
portmap : 192.168.254.0/255.255.255.0 : allow


then...


# umount /var/cache/apt/archives
umount: /var/cache/apt/archives: not mounted


YAY! got it!


# mount -v /var/cache/apt/archives
mount: uaine:/var/cache/apt/archives failed, reason given by server: Permission denied


Whoops! I had the wrong directory on the server in the /etc/fstab on the client machine...


# vi /etc/fstab
# mount -v /var/cache/apt/archives
uaine:/mnt/hda1/var/cache/apt/archives on /var/cache/apt/archives type nfs (rw,addr=192.168.254.6)



# mount
...
uaine:/mnt/hda1/var/cache/apt/archives on /var/cache/apt/archives type nfs (rw,addr=192.168.254.6)


All sorted :o)

Tuesday, January 17, 2006

Files with spaces in their names...

If you want to process the output of find and some files have spaces in their names, you don't need to use double quotes...

find has the -print0 switch and xargs has the -0 (or --null) switch.


find . -type f -print0 | xargs -0 ls -l

Monday, January 09, 2006

Debian public key expired...


Reading package lists... Done
W: GPG error: http://ftp.uk.debian.org testing Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 010908312D230C5F
W: You may want to run apt-get update to correct these problems


and something like this:


10 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 0B/14.7MB of archives.
After unpacking 557kB of additional disk space will be used.
Do you want to continue [Y/n]?
WARNING: The following packages cannot be authenticated!
  apt apt-utils libgimp2.0 gimp-svg gimp gimp-data
Install these packages without verification [y/N]?
E: Some packages could not be authenticated


This page explains it:

http://secure-testing-master.debian.net/

And this year (2006) while the link on the secure-testing page is still out of date, you can fix it with this:


gpg --keyserver subkeys.pgp.net --recv-keys 084750FC01A6D388A643D869010908312D230C5F
gpg --export 084750FC01A6D388A643D869010908312D230C5F | sudo apt-key add -


(thanks to #debian irc channel on freenode.net)

NB1: This will only work this year (2006) - because next year's key signiture will be different.

NB2: This has the side effect of adding the public key to root's keyring which you can see with:


gpg --list-keys


which gives:


pub   1024D/2D230C5F 2006-01-03 [expires: 2007-02-07]
uid                  Debian Archive Automatic Signing Key (2006)


You may want to remove it from there once you've imported it into apt, you can do this with:


gpg --delete-key 2D230C5F

Monday, November 28, 2005

Decimal to Binary

Crazy...

I've always had access to Perl (well since I started using Linux in 1994) and yet I've laboured over writing things in C sometimes... like maths stuff! - fancy spending days writing and months tweaking a command line calculator program in C... now I have this *massive* perl script:


#!/usr/bin/perl -w
die "Usage: $0 MATHS\n" unless(@ARGV);for(@ARGV){s/x/*/g};
print eval(join('',@ARGV)),$/;


To convert a decimal number to binary in perl you could do:


unpack("B32", pack("N", $number));


and then chopping off the leading zeros... as per http://www.unix.org.ua/orelly/perl/cookbook/ch02_05.htm

... but TIMTOWTDI, you're better to use:


sprint("%08b", $number);

Wednesday, November 23, 2005

Multi line comments in Perl...

How-can-I-comment-out-a-large-block-of-Perl-code?

or even just...


=pod
blah
blah
blah
~
~
~
=cut


...from http://mail.pm.org/pipermail/nwarkansas-pm/2000-September/000001.html


serf 2005-11-23 14:02:41-05 is =pod ... =cut still OK? or is that deprecated?
serf 2005-11-23 14:03:28-05 I found it here
ysth 2005-11-23 14:08:50-05 serf that will confuse any pod parser trying to look for documentation interspersed with your code; =for comment...=end comment =cut is better


http://perldoc.perl.org/perlpod.html

Prompt...

ksh and bash together:


PS_LOG_HOST="$LOGNAME@`hostname`:"
PS_TTY="[`tty|cut -c 6-`]"
case "$TERM" in
"xterm" | "screen" )
     BEL=`printf "\a"`
     if [ -n "${BASH_VERSION}" ]
     then
           PS1='\e]0;\u@\h:\w ${PS_TTY}\a\u@\h:\w ${PS_TTY}\n\$ '
     else
           PS0=`printf "\033]0;"`
           PS_KSH=`printf " (\033[01;31mksh\033[00m)"`
           PS1=$PS0$PS_LOG_HOST'$PWD '$PS_TTY$BEL$PS_LOG_HOST'$PWD '$PS_TTY$PS_KSH"
\$ "
     fi
;;
* )
     PS1=$LOG_HOST'$PWD$ '
;;
esac


You could trim the tty with ${MY_TTY:5}
but that substitution fails on ksh88:


ksh: ${MY_TTY:5}: bad substitution


bash:

case $TERM in
xterm )
     MYTTY=$(tty)
     PS1='\e]0;\u@\h:\w [${MYTTY:5}]\a\u@\h:\w [${MYTTY:5}]\n\$ '
;;
* )
     PS1='\u@\h:\w\n\$ '
;;
esac


ksh:


PS_LOG_HOST="$LOGNAME@`hostname`:"
case "$TERM" in
"xterm" | "screen" )
     BEL=`printf "\a"`
     PS0=`printf "\033]0;"`
     PS_TTY="[`tty|cut -c 6-`]"
     PS_KSH=`printf " (\033[01;31mksh\033[00m)"`
     PS1=$PS0$PS_LOG_HOST'$PWD '$PS_TTY$BEL$PS_LOG_HOST'$PWD '$PS_TTY$PS_KSH"
\$ "
;;
* )
     PS1=$PS_LOG_HOST'$PWD$ '
;;
esac