2010-01-07

Proftpd login slow

Proftpd takes 10 seconds to login on my computer. I am using the Apachefriends Xampp. I had to modify the proftpd.conf to have these two lines to maki it fast:

IdentLookups off
UseReverseDNS off

2010-01-02

"libstdc++.so.5: cannot open shared object file: No such file or directory"

I installed the new Ubuntu operating system, the 9.10 Karmic Koala. Actually I installed the Kubuntu version, because I found KDE4 more usable, nicer, and better developing, than the normal Gnome environment. After succesfully moved every program, I found my favorite game is not working with the 64bit version of the new Ubuntu operating system. I got this error:
"libstdc++.so.5: cannot open shared object file: No such file or directory"
Aha, I've seen that the C++ libraries missing, immediately tried to install them:
apt-get install libstdc++5
But it is not working, not libstdc++5 package! Shame!
Tried to reinstall the ia32-libs, but it also doesn't have it...
Finally found the solution here:
http://agentzlerich.blogspot.com/2009/11/getting-32-bit-libstdcso5-in-karmic.html
I try to write a shorter version:
-Download the package here: http://packages.ubuntu.com/jaunty/i386/libstdc++5/download
-Copy the library and the link inside to /usr/lib
-execute the following command: ldconfig

2009-09-30

Samsung Z810 Mobile Modem (Pannon GSM) under Ubuntu

My sister bought this HSDPA modem long ago. This device is not working on Ubuntu out of the box like the previous (soap dish shaped) Huawei E220 or E272 ones. We need the usb_modeswitch package to make it work.

First get and install the USB_MODESWITCH package.
The harder way is to download and compile from the homepage:
http://www.draisberghof.de/usb_modeswitch/
The easier is to download as a debian/ubuntu package from this page:
http://packages.debian.org/sid/usb-modeswitch

Then write an executable, which should be called with root privileges after the modem is inserted:

#!/bin/bash

#Power off the device
echo suspend > /sys/bus/usb/devices/2-6/power/level

#Reset the usbserial module - needed when reinserting
#also opens as storage device
rmmod usbserial
modprobe usbserial vendor=0x05c6 product=0x1000

#Reset the device:
usb_modeswitch -v 0x05c6 -p 0x1000 -R 1
sleep 10
#Starting up the modem:
usb_modeswitch -v 0x05c6 -p 0x1000 -m 0x05 -M 55534243123456780000000000000616000000000000000000000000000000


More USB modem related resources can be found here:
https://forge.betavine.net/frs/?group_id=12&release_id=200

Good luck!

2009-07-28

Removing window titlebar when maximized

To use all the space available on the desktop, would be nice to hide the window titlebar. Previously - I think in KDE 3.5 - there was a window decoration which hid itself in maximized mode, but still gave the unmaximize and close buttons.

With compiz, we can just hide the window decoration when in maximized state. To hide the decoration under Firefox (which is almost all the time maximized) use CCSM (sudo apt-get install compizconfig-settings-manager). Go to the "Window Decorations", and under "Decoration windows" put:
title=Firefox - hides the decoration of firefox or
!state=maxvert - hides the decoration of all maximized windows.

One can use the gnome panel applet "Window Picker" which replaces the taskbar, shows icons instead of the tasks, and a the remaining place is displayed as the window titlebar, with an "X" close button on the end. This solution is used at the Ubuntu Netbook Remix. An example:

Firefox Firebug console dropping strange js errors

I am using the Firebug Firefox extension for web developers. It all the time shows strange messages which not related to the current website under debug. I see something like:
[Exception... "update.locale file doesn't exist in either the XCurProcD or GreD directories" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: file:///usr/lib/xulrunner-1.9.1.2pre/components/nsUpdateService.js :: getLocale :: line 549" data: no]
[Break on this error] " directories", Cr.NS_ERROR_FILE_NOT_FOUND);\n
Read about the internet and found a solution, to create the missing but in the previous versions probably existing file. Use one of the lines, depending on you firefox version:
sudo touch /usr/lib/firefox-3.5.1/update.locale
sudo touch /usr/lib/firefox-3.5.2pre/update.locale

2009-07-26

Wacom Bamboo One

I received a Bamboo One cheap tablet previously. Never used tablets before, but heard that the Wacom tablets quality is very good, and they are usable under Linux.

Before searching it on the internet, I bravely attached the tablet to my computer immediately. Huhh, wondered, it started to work immediately! Without driver! Coool!
It works like a mouse, when the pen is above the tablet or just lightly touches it, it moves the cursor. If pressed to the tablet, it acts like a left mouse button. The lower button of the pen acts probably as the right mouse button, gives a menu. The top button? I did not think of it, probably another mouse button, or programmable.
Started to draw under Gimp, but first it worked just like the mouse, without sensitivity to the pressure. Then I found the Preferences/Input Devices/Configure Extended Input Devices, here one can modify all the tablet parameters in Gimp. Set the device to "Wacom Bamboo1", and the mode to "Screen". Check the screenshot below:
From Screenshots

First it was hard to move the cursor without pressing on, always dropped lassos or moved icons. But after a short time I got used to it. The problem was that I used it as a mouse, but it has to be used just like if you draw with a real pencil, if you don't push, it wont leave trail. It's a pleasure to use this cheap tablet, works exactly just like a pencil.

CTRL+ALT+BACKSPACE to work again

When upgraded to Ubuntu 9.04 Jaunty I found that the CTRL+ALT+BACKSPACE - which restarts the X-server at problems - no longer working. I used a second X server before at instable applications or games, where just pressed these keys and the whole thing closed, and I was able to go back to my normal desktop, and even if there was a problem I restarted just the X. Here is the way, how to enable again this function:

Edit the /etc/X11/xorg.conf, and put the disable dontzap option into the serverflags section:
Section "ServerFlags"
Option "DontZap" "false"
EndSection

Dual Monitors

A month ago I bought a small secondary monitor, because it was unbelievably cheap, and thought it will be good for my work. Tried different setups which the NVIDIA driver offers. I wanted the small monitor below the large one, and that I can bring the windows from one to the other easily.
First I tried the separate X screen option, but later on found the Twinview much more useable. This way the two monitors look like one large monitor, one attached to the other from any direction, or can be just a cloned screen.

Windows users - programmers and graphicians - say two monitors are absolutely needed for the work. But under Linux, due to the much more advanced window handling and multiple desktops in both Gnome and KDE, I did not find it very useful. After a month I can say it is good for keep widgets, to show logs or graphs, and keep the chat window - with setting to show on all desktops (always on visible workspace) - to keep always in touch.

And the problems. I don't know why, sometimes applications start on the second monitor. I did not find any logic in it yet, but maybe it exists. Full screen applications, games open in both monitors, just like it would be one large - so half here, half there. If the application uses another resolution than the main screen, it can be set to show just on one monitor this way:
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "1"
Option "TwinViewXineramaInfoOrder" "CRT-0"
#REMOVED Option "metamodes" "CRT-0: 1680x1050 +0+0, CRT-1: 1360x768_60 +0+1050"
Option "metamodes" "1680x1050,1360x768_60 +0+1050; 1024x768,NULL;"
SubSection "Display"
Depth 24
EndSubSection
EndSection

Look at the metamodes option, we leave the first settings as the normal resolution of the two screeens. Then we add a second resolution (1024x768,NULL;), which means when an application switches to 1024x768 24bit, it will be shown on the first monitor only, the second will be disabled. This can be done with any resolutions, both 16 or 24 depths.

Tc-Elite, Enemy-Territory Auth Error (Linux)

On the weekends - when have time - I usually play a bit of Tc-Elite, the best game ever.
It is a free program, installs into the same directory like the Wolfeinsten Enemy-Territory, so both games can be played.

Today the Tc-Elite gave me an error, something like: Cannot connect to server, Punkbuster error, kicked because of unknown Guid. After searching for it on the internet, found that the punkbuster needs to be updated. Previously the game always installed the newest punkbuster, but now something happend - (to the punkbuster).

So how to update it? Download the right command version from this page:

http://www.evenbalance.com/index.php?page=pbsetup.php

Then from the same directory run as user (adds the game to the pb):
./pbsetup.run --i-accept-the-pb-eula -v -ag et

Then update the punkbuster (in your home at ~/.etwolf):
./pbsetup.run --i-accept-the-pb-eula -v -u

From now the game will run
TC-Elite video

Repair and optimize mysql automatically

There is a command to repair and optimize all databases at once. The optimizing is very important, an optimized db could be 100x faster than an uploaded and not optimized one. I had an experience that a program did not run at all until we optimized the database. Daily optimizing keeps the mysql very fast.
Repair & Optimize all tables by hand: mysqlcheck -Aor -P

Another daily repair/optimize script (found on the internet and used previously):

Enter this to the crontab:
00 6 * * * root /path_to_script/optimize.sh

The content of optimize.sh:

#!/bin/bash
MYSQL_LOGIN='-u mysql_user --password=your_password'
LOCATION=/opt/lampp/bin

for db in $(echo "SHOW DATABASES;" | $LOCATION/mysql $MYSQL_LOGIN | grep -v -e "Database" -e "information_schema")
do
TABLES=$(echo "USE $db; SHOW TABLES;" | $LOCATION/mysql $MYSQL_LOGIN | grep -v Tables_in_)
echo "Switching to database $db"
for table in $TABLES
do
echo -n " * Repairing/Optimizing table $table ... "
echo "USE $db; REPAIR TABLE $table" | $LOCATION/mysql $MYSQL_LOGIN >/dev/null
echo "USE $db; OPTIMIZE TABLE $table" | $LOCATION/mysql $MYSQL_LOGIN >/dev/null
echo "done."
done
done

Lampp by Apachefriends or Ubuntu?

I had problems with my Lampp server, the mysql usage went up to 100%, then after a time to 200%. Decided to reinstall the apache and mysql servers.

Spent a lot of time with the Apachefriends Xampp package, and also the regular Ubuntu one.
Ubuntu install - installs a lot of packages:
1st method: Tasksel install lamp-server
2nd method (better): apt-get install lamp-server^
Remove:
Good: apt-get remove lamp-server^
Bad: tasksel remove lamp-server (This removed the half Gnome on my local system when tried, so can't recommend...)
The advantage of the regular Ubuntu server is that it is highly extendable. Can install the Munin, Phpmyadmin, etc with plain apt-get, and it's upgraded by the operating system. The disadvantage is that, it used different config files than the Apachefriend Lampp, for example at virtualhosts. Also the config files come with very bad settings, and the versions are older.

The Apachefriends' xampp is very good, but I had lot of problems upgrading my old files. Finally found the only way is to remove completely the old, then install with the command line:
sudo tar xvfz xampp-linux-1.7.1.tar.gz -C /opt
After it copy back the databases (except the existing ones - cdcol, mysql, etc). Then copy back the htdocs directory. Then check the config files, do not overwrite them, just change the settings. When I overwrote the configs, it did not work. The new version of my.cnf needed this line at [mysqld], because dropped people soon:
max_connections = 512

The advantage of the Apachfriends package, that it has all things in a single directory, easy to back up or move to any other Linux system. The upgrade is not so easy if you have a larger system.

2009-06-28

Save video from webcam images

It was 7 years ago, when I played with saving my web camera images and creating time-lapse videos from them on Windows. Later on, after more years I made a Youtube video with sound from those small clips (of course under Linux, with the Kdenlive program). It can be viewed here: My old timelapse


Now I thought it would be nice to collect the images from a few webcams at beautiful places, and create time-lapses. So I wrote a webcam script to save each images into a directory named by the current date, and with jpg files named from the current time:
#!/bin/bash
DIR=/path_to_webcams/webcam_name
DIR2=`date '+%Y-%m-%d'`
FILE=`date '+%H%M'`
mkdir $DIR/$DIR2
wget -o /dev/null -O $DIR/$DIR2/$FILE.jpg http://url-to-the-webcam-image

Then placed a cron job into the /etc/crontab (called in every 2 minutes):
*/2 * * * * root /root/webcam_script.sh

While the computer on (this is on all time) it collects the images. Then the next step is to create a time-lapse video from the images. This script creates an avi video - without sound - from them, execute from the directory of the images (needs mencoder to be installed):
#!/bin/bash
ls -1tr > files.txt
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vbitrate=6000 -o video.avi -mf type=jpeg:fps=25 mf://@files.txt
rm files.txt


Now you can edit your time-lapses using Avidemux, Kdenlive or any other application. Enjoy your time-lapse videos!

2009-06-06

Cube Atlantis

In Ubuntu 8.10 I had the Cube Atlantis plugin - an aquarium with dolphins and sharks was visible inside the cube when turned by mouse. Now, in the 9.04 I also installed the same plugin. I was surprised, now I had freshwater fishes instead of the oddly moving sharks and whales. It is much nicer than before, and we can chose from more kind of fishes in any color and translucency. I added few hundred fishes and it was still fast. In the compizconfig settings we can set the desktop to be not cube, but round shaped, just like a table aquarium.

From Screenshots


It is 10 times better than was before, very nice, although there are places for improvements. The fishes sometimes turning rugged, specially in vertical direction. The default fish colors could be like the real fishes, could be more and nicer corals. The buttom of the aquarium and the water on the top is ugly (switched off in the screenshot).

How to install the control panel and all compiz plugins?
sudo apt-get install compizconfig-settings-manager compiz-fusion-plugins-*

Root privileges

Just if someone interested there are some ways to get root privileges other than setting up a root password in Ubuntu command line. To gain supervisor rights use one if these:

sudo bash
sudo su

To make it real root, with the also the environment variables set:
sudo su -

I usually make a command named "s" to the bin/ directory in my home, that is accessible from anywhere. Also can make that no password ever required, just insert the following line to the end of the /etc/sudoers file:

your_username ALL=NOPASSWD: ALL

PC speaker... hate it

When working or switching on-off the computer, the pc speaker beeps, which is very annoying.

To remove the beeping forever use this command (blacklisting it's driver):

sudo sh -c "echo blacklist pcspkr >> /etc/modprobe.d/blacklist"

The speaker will not work from the next reboot. To remove the driver module from the current session you can use the following:

sudo rmmod pcspkr

To make the flashing instead of beeping:
touch ~/.inputrc && echo set bell-style visible > ~/.inputrc

or use none instead of visible.

2009-05-23

Better midi under Linux: Timidity with Fluidsynth soundfonts

I was always disappointed with the sound quality of the midi playing under Linux.
Since I don't have external equipment (at least which fits around here), I had to install a software MIDI sound renderer. I know there is fluidsynth and timidity, and the last one I used before. It had all the time boring plain sound quality.
Yesterday I was playing with Tuxguitar, but it had a terrible quality under Timidity.
I heard before that there are more kind of soundfonts, but while searching it on the Google, there were too few info. Istalled the fluidsynth soundfonts, but nothing happend. Then checked the timidity.cfg again. I've seen more different files in the same directory now, other than the freepats.cfg. Changed config file, and ... it was working, Tuxguitar had a much better sound!

So the process:

apt-get install timidity fluid-soundfont-gm

change to below line in /etc/timidity/timidity.cfg:
comment out:
#source /etc/timidity/freepats.cfg
enter:
source /etc/timidity/fluidr3_gs.cfg

Install Smile on Ubuntu 9.04

Smile is a Slideshow creator for Linux. Previously I used Manslide and made some very nice slideshows with it, like these:
http://www.youtube.com/watch?v=Q4NywzDWGqY
http://www.youtube.com/watch?v=6mLAedvd_qo

Manslide was a great program, first was hard to use, but gradually improved in stability and effects.
After a time the author decided to drop it and recreated a better program, called SMILE - Slideshow Maker In Linux Environment. Can be downloaded at the kde-apps.org, or at the author's website at http://smile.tuxfamily.org/

I had no chance yet to use it, but here is how to install it under Ubuntu:
1, Download, extract to a directory
2, sudo apt-get install qt4-dev-tools build-essential sox libsox-fmt-all libqt4-dev
3, go to the directory and type: qmake-qt4 && make
4, now create menu links to the smile named executable


If you find it usable, you could support the author, his message is here:

HELP NEEDED
I NEED FINANCIAL HELP TO CONTINUE ALL MY DEVELOPPEMENT LIKE SMILE AND FUTUR MANDVD .... IF YOU WANT HELP YOU CAN SEND DONATION AT :
Gibault Stéphane
Appt 14 / 8 allée des lucioles
36000 Châteauroux
FRANCE
OR VIA PAYPAL
go here :
http://smile.tuxfamily.org/?q=node/5
And click on "FAIRE UN DON"
THANKS