2009-02-21

MySQL "unable to select database" error

A quick Google search will show a lot of somewhat disjoint solutions to or descriptions of this problem - basically, it's pretty simple - I found it when I set up a "Login" example page using PHP and MySQL. All looked right, but the login failed with a "Select Failed" message, which in turn allowed that the user defined for the web opeation was not authorized by the database, causing the select to fail.

Further investigation led me to insert mysql_error() at the point of the select error, which told me that the problem was that the user had not been added [defined] for the database.

So if a PHP script gets a "Cannot select DB" error on the select statement, make sure the user has been added to the database with the appropriate permissions.

2009-02-12

MP3 Decoder Not Installed by Default

The following error is common when K3B (CD/DVD Burning Software) is run for the first time on a stock-install system:

Mp3 Audio Decoder plugin not found.

K3b could not load or find the Mp3 decoder plugin. This means that you will not be able to create Audio CDs from Mp3 files. Many Linux distributions do not include Mp3 support for legal reasons.

Solution: To enable Mp3 support, please install the MAD Mp3 decoding library as well as the K3b MAD Mp3 decoder plugin (the latter may already be installed but not functional due to the missing libmad). Some distributions allow installation of Mp3 support via an online update tool (i.e. SuSE's YOU).

How to Mount a Remote SSH Filesystem using sshfs

Ran across this bit in the Ubuntu Wordpress Blog: How to Mount a Remote SSH Filesystem using sshfs

The sshfs can be used to mount and unmount remote file systems in user space over an SSH tunnel.

The sshfs program was not installed by default.

This program (sshfs) is relate to the FUSE user-space file system architecture.

  1. create /media/<MOUNTPOINTNAME>
  2. chown the newly created directory to belong to the current user
  3. issue 'sshfs user@host:/path /media/<MOUNTPOINTNAME>' to mount the remote filesystem

Adding to the Perl Include Path

[this is from the Perl Module Installer documentation supplied with cPanel and CenOS]

Suppose you need to add a path - say /home/earthsid/perl - to the Perl include path. You will need to modify the Perl code to set the INC path in the BEGIN block of the program.

You can do this by adding the following code to your script:

BEGIN {
    my $homedir = ( getpwuid($>) )[7];
    my @user_include;
    foreach my $path (@INC) {
        if ( -d $homedir . '/perl' . $path ) {
            push @user_include, $homedir . '/perl' . $path;
        }
    }
    unshift @INC, @user_include;
}

Note that - no matter where the BEGIN block resides in a program, it is always excuted first, before ay other part of hte script lib.

Installing OpenSuSE 11.1 over the Internet

You will need to know these to get the NET install started...

Net Install Parameters:
  Protocol: HTTP
  Host: www.gtlib.gatech.edu
  Path: pub/opensuse/distribution/11.1/repo/oss/

Net Install CD:
  http://www.gtlib.gatech.edu/pub/opensuse/distribution/11.1/iso/openSUSE-11.1-NET-i586.iso

ISO Directory:
  http://www.gtlib.gatech.edu/pub/opensuse/distribution/11.1/iso/

Furthermore, you may need to install these lines into your /etc/hosts file:

## added to solve un-explained "Couldn't resolve host..." error
## while installing OpenSuSE 11.1 (NET) - these lines provide the
## hostname->to->ip address mappings for the OpenSuSE mirrors; 
## NOTE:  These addresses should be checked and updated before use!  
## These is just what the 'host' command returned today...
##     -pdwilso(at)gmail.com
128.8.235.18    mirror.umoss.org
134.174.150.123 mirrors.med.harvard.edu
149.20.20.135   .kernel.org
64.50.236.216   suse.mirrors.tds.net
204.152.186.174 opensuse.ca.unixheads.org
64.50.238.52    ftp.osuosl.org
64.50.236.52    ftp.osuosl.org
146.137.96.15   mirror.anl.gov
146.137.96.7    mirror.anl.gov
198.60.22.13    mirrors.xmission.com
146.6.54.21     ftp.utexas.edu
72.3.128.167    mirror.rackspace.com
155.98.64.86    opensuse.cs.utah.edu
129.21.2.111    mirrors.rit.edu
64.90.181.77    mirror.nyi.net
80.237.136.138  ftp.hosteurope.de
156.56.247.193  ftp.ussg.iu.edu

Hosts file: uploads/opensuse-mirror-hosts-20090212.txt

An odd aspect of the DNS name resolution problem: For some reason, Konqueror could not resolve host names, but 'host' could.

Finally, here is a script that I used to create the hosts listing:

#!/bin/sh
host $1 | perl -e 'while(<>){\
  chomp;m/([a-z.]+) has address ([0-9.]+)/ && print"$2\t$1\n";\
}'

This script is used like:

  getip.sh mirror1.kernel.org

and returns

  <IP-Address>\t<Hostname>

If you've got root, the output of getip.sh can be used thus:

  getip.sh mirror1.kernel.org >> /etc/hosts

Of course there are other ways to do this. Of course you should check the output of getip.sh before appending it to /etc/hosts.

Caveat emptor. YMMV. Don't take any wooden nickels.

2009-02-07

Emacs TRAMP

Neat. Remember all those years ago when you were opening and editing files on remote servers using Emacs and its Ange-FTP module? Remember how it all went bad back during the war when packet sniffers became common, and you couldn't trust your password to the wires, anymore? Remember the joy you felt when you realized that ssh, scp, and sftp had it within their power to fix all that for good and all as soon as all those benighted ISPs opened port 22 to their secure shell servers instead of those stupid other ports and their clear-text protocols? Remember the angst you felt waiting for some Lisp guru to take pity on your pathetic ineptitude with with her parenthetical language and code you up an SSH-based file I/O substrate for your favorite horned text processing system? Remember the bleak years of despair and hopelessness you spent trashing random windows boxes, wracked with frustration as your Emacs-nox was denied you by petty bureaucrats and ill-conceived Win32 solutions?

Rejoice now, all ye stricken!

http://www.gnu.org/software/tramp/

ftp://ftp.gnu.org/gnu/tramp/

One (1) prop to the KDE Help System and its authors, that's where we discovered all this... would add another if there was a way to provide a bookmark into the desktop help system, here - as is, I don't even have the hierarchical path info - just the document title [TRAMP version 2.0.57 User Manual], which doesn't seem to be useful in finding the file within the help system, as the "search" function has some grievance that remains un-addressed....

2009-02-06

X Session Problems (KDM, GDM, WDM, XDM, FVWM and more)

It seems clear to me at this point that the desktop is going to have to be KDE, and (in this case, now) KDE4, in particular.

The bottom line is simply this: the KDE widget set has the widgets I want, and it works more consistently than e.g. GNOME.

This blog has been down for days because the gnome-panel has decided to - each time it is launched - go into an infinite loop which hogs something around 100% of the processor cycles, and will not stop until it is killed with a 'pkill -9 gnome-panel'.

Now, I know this problem with GNOME has something to do with the stored configuration, but I have been unable to determine just exactly which aspect of the GNOME configuration is causing the problem.

Furthermore, once I realized that GNOME was not healing itself, and was in fact doing everything in its power to prevent me from using the computer at all, I tried to switch back to KDE. That effort took down the whole X server config, starting with the session login manager - neither kdm nor gdm would work, and gdm wouldn't even start.

After a brief flirtation with wdm, I took the fallback to xdm - which sort of worked, but wouldn't start an X session until I re-installed both GDM and KDM.

Having been through all that, I was so relieved to see the KDE desktop again I haven't changed it since.

Now, in between all this, I have also found that FVWM as installed by OpenSuSE does not come configured - the "out of the box" configuration is simply a black screen (arguably an improvement over the miore-effect tiling that is the X default) with the default, built-in root menu available using the right mouse button on the black desktop. After screwing around with the FVWM config - and since I did not have my archived FVWM configuration immediately available, I tried to switch to a different - I.E. non-FVWM session - which is when I discovered that the session configurations were hosed. Specifically, when I logged in to the FVWM session, something in the session manager config got changed, and there was no non-trivial way to change it back.

The really unfortunate part of all this is that I do not have a "fix" to present here. This is all just a problem description, and fails to even adequately define the problem in reproducible terms.

I will, in the course of getting this desktop environment to a usable state, try to generate some more coherent bug reports and/or workarounds to the problems that keep coming up.

Meanwhile, KDE4 is going to be "it" - I expect it

a) to be simpler to configure for user-friendly day-to-day use

b) to be more robust once configured

c) to provide a widget set tailored for my needs

FVWM is more configurable, and arguably more powerful for detailed, perhaps non-standard, configuration items, but tends to be less intuitive in its default modes, and more tedious to bring into compliance with the Windows-like look and feel which GNOME and KDE have shown to be so popular.

In short, I will provide KDE as a baseline desktop, with customizations purpose-built using FVWM (these will typically be for dedicated accounts).

Finally: I think I like KDE3 better than KDE4. All my transparent widgets from KDE3 have gone opaque in KDE4, and the glassy, glossy radioactive eye-candy from KDE3 is toned way down - at least in the default versions. I have some screenshots of each which I will link here (once I find the URLs) that should highlight some of the differences.