Wednesday, March 19, 2008

apache htpasswd password generator

I had to generate random password for a whole bunch of apache httpd users, so I’ve written a script that generates a 8 digit random password:

#!/bin/sh
if [ $# -ne 2 ]
then
echo “passwdgen.sh passwordfile username”
exit
fi

PASS=`date +%N md5sum - cut -c1-8`
echo $2:$PASS
if [ ! -f $1 ]
then
touch $1
fi
/$APACHE_HTTPD_HOME/bin/htpasswd -bm $1 $2 $PASS

Monday, March 17, 2008

Windows XP bizarre problem - Mup.sys hanging issue

I’ve encountered one Windows XP SP2 desktop with weird hanging issue during boot-up. There was no recent software/hardware installation on the box, it just decided to start hanging during boot-up then reboots itself, these steps goes into an infinite loop.

After trying to get into safe mode, I can see it is hanging while loading Mup.sys. However, still no luck can’t even get into safe mode… After various attempts, the only way that I could boot-up the machine is to unplug all USB devices, interesting thing is that once I boot into Windows I can plug all the USB devices back and everything works just fine.

The solution to fix this issue was that I had to backup the files of the current user account, create a new one and delete the current user completely. The magic worked well, I can now boot up back into Windows normally. The cause of this hurts my brain, just another MS Windows myth…

Sunday, March 16, 2008

extract WAV from DVD with mplayer

I found several post on the web using transcode, unfortunately it didn’t work well for me and kept on coredump.

It turns out mplayer can do the same job with less trouble, below is a script that allows you to extract tracks from a specific range of chapters of a track with selected audio channel.

#!/bin/bash
for i in `seq 1 33`;
do
`echo mplayer -vo null -ao pcm -ao pcm:file=track$i.wav:fast dvd://2 -chapter $i-$i -aid 129;`
done

1 33 - this means to rip from chapter 1 to 33
dvd://2 - this is the track that you want to extract the chapters from
aid 129 - 129 is the audio stream ID that you want to select

You can use lsdvd to get the details of the DVD.
use soundconverter to convert it to MP3.

References:
http://www.larsen-b.com/Article/186.html
http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.txt

Tuesday, March 4, 2008

k3b startup failed in Ubuntu

This is another bad side effect after an update in Ubuntu Gutsy.
For some reason k3b failed to startup and it was working right before the packages update! I kept on getting the following error:

X Error: BadDevice, invalid or uninitialized input device 159
Major opcode: 148
Minor opcode: 3
Resource id: 0×0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 159
Major opcode: 148
Minor opcode: 3
Resource id: 0×0
Failed to open device
kdecore (KLocale): WARNING: Definition of PluralForm is none of NoPlural/TwoForms/French/OneTwoRest/Russian/Polish/ Slovenian/Lithuanian/Czech/Slovak/Arabic/Balcan/Ma cedonian/Gaeilge/Maltese: Definition of PluralForm - to be set by the translator of kdelibs.po

I have tried to reinstall k3b, kdelibs and etc. Nothing helped, luckliy I found the following threads:

http://ubuntuforums.org/showthread.php?p=4409467 http://ubuntuforums.org/showthread.php?t=695073&page=2
The solution was:
sudo apt-get remove language-pack-kde-en

It seems language-pack-kde-en cause some conflict during k3b startup when your ubuntu has other languages installed.

Sunday, March 2, 2008

ubuntu gutsy keyboard delay problem

My keyboard started acting really weird after upgraded to Ubuntu Gutsy 7.10. There is a noticeable delay between key strokes, or sometimes the keys repeated itself like crazy. This strange behaviour was really annoying and drove me nuts. After googling and tried to fix it myself, none of the solution fixed my problem. Eventually I discovered the following message kept on repeating in /var/log/messages

usb 1-2: reset low speed USB device using ohci_hcd and address 5

I tried to unplug my USB mouse and webcam, changed them into another USB ports then the messages stopped. Apparently that was the cause of the keyboard issue and more! I had failed to burn several DVDs with k3b and other burning tools previously, it was also contributed by this crazy USB port behaviour. Still not sure what is this problem, perhaps incompatibility with some USB ports on the motherboard or my USB port has problems…