Friday, December 16, 2011

Force java to use IPV4

Having problems with a java server application listening on IPV6. Adding the following to the java command line causes Java to use IPV4.
 It's come in handy a few times. Sadly.

Sunday, December 11, 2011

Lenovo laptop low audio volume

I love lenovo/ibm laptops. Specifically their business line. I've used T series laptops for quite a while. I don't know if this is a lenovo-specific issue or not, but web searches over the years seems to indicate at least that a lot of lenovo laptop users share the problem: low audio volume, and an inability to turn it up to reasonable levels.

I've suffered this in Linux for years and years. There seem to be a lot of fixes proposed by people: kernel parameters, manual ASLA configuration tweaks. They never work for me. So I tend to use headphones for myself, or external (amplified) speakers if for others.

Lately I've been booting Windows on my laptop (T521)... mainly for Skyrim. And suddenly today I noticed the audio volume, which had seemed fine up until then was annoyingly quiet in all software. I have no idea what could have caused this. All the mixer controls were maxed, and still it was a struggle to follow speech if there was any amount of background noise in my environment.

Searching around I find that Windows people seems as baffled as Linux people by this behaviour. Lots of wacky suggestions. A lot of people saying the suggestions didn't work for them.

Finally I found a really simple solution (this is Windows 7, but other versions have similar controls):
Control Panel -> Hardware and Sound -> Manage Audio Devices -> [Playback tab] Speakers -> Properties -> Enhancements [tab] -> check Loudness Equalization -> OK. 
And suddenly I have all the loudness I could want. Why? How!

The description of this option is: "Loudness Equalization uses understanding of human hearing to reduce percieved volume differences." It reports itself as being provided by Microsoft. What does it really do? How does it magically make the volume in all apps suddenly decent? I can't believe it's just software amplification, but perhaps it is. It's hard to believe the description given has the global effect of "fixing" the volume issues.

Furthermore, what happened to make the previously "okay" volume suddenly so weak?

I really have no idea. Is there some equivalent for Linux? I don't know. Whatever it is, it works on this Lenovo box under Windows... like magic. I don't like magic, when it comes to computers. I want to know what's going on.

Monday, October 17, 2011

broken cyrus seen file

Someday I'm going to give up on running my own mail server. I say this especially when my hard drive fills up an my cyrus "seen" database files inevitably corrupt. This db file keeps track of your mailbox message status (whether you've read a message or not).

If you have this problem, you'll see a line like this in  your mail log:
DBERROR: skiplist recovery /home/cyrus/user/u/username.seen: ADD at 4C48 exists
The recommended way to fix this is to truncate the file at the location the problem is detected. In the case above, at the hex byte 4C48.

I've had to do this often enough that I've written a shell script to do it, which just needs the username and hex location supplied via command line.

  • it's a shell script, but python is used to do hex conversion.
  • you'll probably need to change the path (/home/cyrus/user/) to your cyrus user directory (mine is non-standard).
  • you must supply the hex location where the corruption is detected. You can find this in your mail log file (usually /var/log/mail.log). 
  • if your cyrus files are owned by other than user cyrus and group mail, you'll need to change the chown cyrus:mail.
  • the existing *.seen file is backed up with a unique filename (current timestamp), so it can be restored if something goes wrong.

if [ $# != 2 ]; then
    echo "USAGE: $0 login hex"

TRUNC=`python -c "print int('$2', 16)"`
DATE=`date +%Y%m%dT%H%M`

if [ -d $DBPATH ]; then
    dd if=$DBPATH/$1.seen of=$DBPATH/$1.seen.fixed bs=1 count=$TRUNC
    chown cyrus:mail $DBPATH/$1.seen.fixed
    chmod 600 $DBPATH/$1.seen.fixed
    mv $DBPATH/$1.seen $DBPATH/$1.seen.$$TRUNC
    mv $DBPATH/$1.seen.fixed $DBPATH/$1.seen
    echo "No such directory: $DBPATH"

Friday, October 14, 2011

fsck.vfat -a "Unable to create unique name"

On linux (kubuntu), trying to do an fsck on a vfat USB drive, I keep getting "Unable to create unique name".

The solution apparently is to use fsck.vfat -r [device]

I have no idea why interactive mode (-r) works, and automatic mode does not... but it gets rid of the problem.

(dosfsck is an alias for fsck.vfat and fsck.mdos)

Thursday, October 13, 2011

Alert: Error Unable to initialize OpenGL. (Error: Failed loading

It seems my ubuntu/kubuntu opengl/mesa installation is messed up again. Getting the above error on an amd64 system trying to run an ai32 binary the solution is:
LD_PRELOAD=/usr/lib32/mesa/ [path/to/program/to/run]