Logitech Quickcam Chat on Hardy Heron

[Update] – Intrepid RC onwards works better. Plus see tips on fine tuning brightness etc at http://p-s.co.nz/wordpress/?p=315

I needed a web camera for Ekiga/Skype and I chose the Logitech Quickcam Chat web camera because it was cheap and I expected I would be able to get it to work with Ubuntu. My selection process began with https://wiki.ubuntu.com/HardwareSupportComponentsMultimediaWebCameras. I looked at some known brands and tried to identify recent reports of products with “out-of-box” experiences reported. Logitech seemed to have at least one suitable offering (https://wiki.ubuntu.com/HardwareSupportComponentsMultimediaWebCamerasLogitech), namely the Quickcam Chat, and I knew I could source it locally at a good price. Logitech also seemed to be a good bet as a supplier for Ubuntu because it has a Linux support site http://www.quickcamteam.net/hcl/linux/logitech-webcams which is maintained by Logitech’s video engineering team.

In actuality, it was not quite “out-of-the-box” but installing xawtv
sudo apt-get install xawtv
and using V4L instead of V4L2 seemed to do the trick.

One of the comments for the Quickcam Express Plus gave a hint this might be worth a shot – “Camera is detected, but needs package xawtv installed to hook it to /dev/videox.”.

Images are good in Ekiga, a bit yellow in Cheese (except when taking a picture) and sometimes in Skype. This is probably nothing to do with the camera though as DVDs can have the same problem depending on whether gxine is used or not. Underlying cause unknown.

Still, the Logitech Quickcam Chat is a cheap unit and it is working. There are apparently problems running it with Intrepid but that may change soon.

A final touch was to install the Camera Monitor and add it to the tray. It announces when the camera is actually in use by a program e.g. Ekiga. It has a setting so that it launches on startup.

One link which could be of some use is https://help.ubuntu.com/community/Webcam.

MPG to AVI in Ubuntu Using mencoder

A friend had to get a 120 MPG file down to a smaller size so he could email a message to a friend for a celebration. Ubuntu to the rescue! I found the following:

mencoder INPUTFILE -ofps 25 -ovc xvid -oac mp3lame -lameopts abr:br=192 -srate 48000 -xvidencopts fixed_quant=4 -o OUTPUT.avi

http://ubuntuforums.org/showpost.php?p=4142023&postcount=2

The srate (sound) could be dropped to 16000 if necessary but the big savings were with framerate dropping from -ofps 25 to 15 and the size reduced by adding:

scale=160:128

There are likely to be much better ways of doing these things but it worked in this case and the file was 3MB instead of 120MB. The result could be played successfully in VLC (but not necessarily in Windows Media Player or Real Player).

Apache and PHP on Ubuntu – Very Easy Installation

This was very easy – just install php and apache from synaptic and you are good to go. At least for local testing purposes like I am interested in. And if, like myself, you want your test scripts in /home/user/public_html you only need to do the following:

Copy the default website as a starting point.
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
Edit the new configuration file
sudo gedit /etc/apache2/sites-available/mysite
Change the DocumentRoot to point to the new location. For example, /home/user/public_html/
Change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>

Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).
sudo a2dissite default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart

https://help.ubuntu.com/community/ApacheMySQLPHP

NB to install support for mysql (mysqli) use synaptic and search for mysqli.

KeyJnote is Awesome (PDF) Presentation Software

Install it from synaptic
Then run it from the terminal:
e.g. keyjnote “/home/user_name/Desktop/Misc MySQL.pdf”

to read the documentation type the following in the terminal:
man keyjnote
It is very nicely documented.

Key things to remember for me:
Enter toggles spotlight (+/- to change size)
Tab toggles multi-slide view
Left Mouse Button dragging for highlight and right click to remove.

I just recently made a document in OpenOffice Writer with page format as landscape. Export as PDF and we are good to go 🙂

One gotcha – can be a bit flaky visually when compiz is running. Solution: http://p-s.co.nz/wordpress/?p=93

Windows XP Infested, Replace with Ubuntu Hardy Heron

The nasty virus infestation was the final straw and my father-in-law wanted to switch to Ubuntu. He wanted better security and peace of mind.

Step 1 – Use live CD to check that Ubuntu works OK with hardware (monitor, printers, keyboard, mouse, scanner, soundcard)

Step 2 – Transfer ALL files (including malware) from windows PC to my Ubuntu notebook using ssh

Type into terminal sshd
Follow the (extremely simple) instructions to install ssh server on notebook so we can send it files
Connect PC and notebook with ethernet cable (NB modern network cards probably make it unnecessary to use a special crossover cable)
Set wired connection on PC to static IP
Reboot (not sure if always or even usually necessary but it can remove some problems
Set wired connection on notebook to a different static IP
Reboot (probably not necessary but doesn’t take long)
On PC ping self in terminal e.g. ping own_IP (Ctrl-C to interrupt)
On notebook ping self in terminal e.g. ping own_IP (Ctrl-C to interrupt)
Ping each machine from the other e.g. on notebook ping PC_IP
If all pinging works, run the following (NB assumes drive mounted as drive 1):
scp -pr /media/disk1 username_on_dest@notebook_IP:~/savedpc
(scp http://linux.about.com/od/commands/l/blcmdl1_scp.htm)
At the end check that the same number of files etc made it across.
Then set the permissions for the oldpc folder (and all its contents) to read only etc

NB wipe ssh server off notebook to reduce attack surface. sudo apt-get remove name_of_ssh_server_package

Step 3 – Perform guided installation of Ubuntu wiping entire hard drive

Step 4 – Set up Ubuntu (see http://p-s.co.nz/wordpress/?p=28
NB we need internet access so we can temporarily switch from static IP for the wired connection to DHCP.

Step 5 – Transfer all files back into a folder called oldpc

Type into terminal sshd
Follow the (extremely simple) instructions to install ssh server on PC being rebuilt so we can send it files
Run the following:
scp -pr name_of_folder_to_shift_back username_on_dest@PC_IP:~/oldpc
At the end check that the same number of files etc made it across.
Then set the permissions for the oldpc folder (and all its contents) to read only etc

Step 6 – Enable remote access into PC from notebook
NB initially we are setting this up with the PC in the same room sitting on the same network as the local notebook. Once everything is set up and we install the PC where it actually belongs we will need to use a different IP address. Vinagre’s Find method will no longer work because it works on the local network.

6.1 Set up ADSL modem to allow packets from obscure port through to ssh port (22). Some modems have it as a NAT rule, some as port forwarding (basic) etc.
6.2 On PC go System>Preferences>Remote Desktop and Allow other users to view your desktop and Allow other users to control your desktop (NB ignore command suggestion – we’ll just use Vinagre).
6.3 Create new user via Administration>Users and Groups. This user will be the only one we allow to ssh in. Give that user administrator rights
6.4 Change ssh settings to ONLY allow that new user access to the PC via ssh

sudo gedit /etc/ssh/sshd_config
add new line on end and a blank line after it. May need to reboot (may not). NB sshd not ssh.
The new line is AllowUsers new_user_name_here
6.5 Open ssh tunnel (port forwarding) on notebook. NB format is port:host:hostport. When you connect to that port on the notebook it is directly connecting you to the hostport specified.

ssh -L 5900:localhost:5900 new_username_on_dest@PC_IP

NB I will need to do this each time I wish to use Vinagre to connect to the PC. I open an ssh tunnel, and then use Vinagre to reach across it. I will also need the following on the end of the command:
-p obscure_port

6.6 Open Vinagre on notebook
Applications>Internet>Remote Desktop Viewer>Connect
Host: localhost
Port: 5900
This works because I am directed to port 5900 on the remote computer (via the port forwarding I just set up in the terminal) and localhost is localhost on the PC of the host port.

6.7 Do whatever is needed on the remote PC

6.8 Close Vinagre (NB F11 to toggle in and out of fullscreen)

6.9 Close ssh tunnel with
exit

Step 7 – Setup PC in actual location with ADSL modem etc
Having trouble connecting to the internet. Able to connect to the ADSL modem from the PC using http://gateway_IP_address_here/ so the ethernet connection, the power, and the modem are all working fine. But pinging out doesn’t work. Fixed that. Odd setting required. Printer and scanner installed extremely easily. Much better than competing OS’s ;-).

Step 8

8.1 Thunderbird files
Copied old thunderbird folders across from windows (it worked!). Use sudo cp … and copy and paste the location. To copy all contents of a folder use -r or -R and “path name/with gaps/”* Will find everything in Ubuntu in /home/user_name/.mozilla-thunderbird/gobbledegook.default/Mail. Ctrl H to see hidden folders etc.

Even if a folder does not have subfolders, you must use the -r. Otherwise you get something like cp: omitting directory yadda yadda. http://www.tuxfiles.org/linuxhelp/dirman.html

NB copy and paste the gobbledegook because it can be hard to get it exactly right just by reading it – example reason – Lowercase L (l) not = numeral one (1) even though in some fonts they are very similar!!!!!!! The windows location is Documents and Settings/user_name/Application Data/Thunderbird/Profiles/gobbledegook.default/Mail. It may be necessary to unlock the folders copied across so use sudo chmod 777 -R path_to_unlock_recursively

8.2 Thunderbird address book
Copy the file abook.mab from … oldpc … /Documents and Settings/user_name/Application Data/Thunderbird/Profiles/gobbledegook.default/” to /home/user_name/.mozilla-thunderbird/gobbledegook.default/

8.3 Firefox 2 bookmarks into Firefox 3
This only required opening Firefox 3, Bookmarks>Organise Bookmarks>Import HTML and importing the stored bookmarks.html file from … oldpc … /Documents and Settings/user_name/Application Data/Mozilla/Firefox/Profiles/gobbledegook.default/”. Restart Firefox.

ROUTINE USE:
open secure shell in:
ssh -L 5900:localhost:5900 new_user_name_on_dest@PC_IP -p obscure_port
The PC_IP address will frequently change so try the last one and then ask user to visit www.showmyip.com and tell you the new one. The obscure port was set in step 6.1.
First time with any new IP address will need to say yes (not y, Y etc) to RSA key creation.
Otherwise just need password for new_user_name_on_dest.
(NB to exit when finished)

NB can work from the CLI for file management tasks etc. Only open remote desktop viewer if seeing the screen (or user interaction) useful.

The open remote desktop viewer (Vinagre) Internet>Remote Desktop Viewer
Connect:
localhost
5900

NB performance not so good so use desktop when you have to and actual shell itself when you can.
To get cursor I think it is is Ctrl-Alt. NB fastest often to set desktop background to a colour while working on it and restore wallpaper at end.

F-spot problem with Canon Powershot G2

Will post more details of both problem and solution later. Solution – add Photo folder under /home/grant and away you go.

Update Oct 9th 2008 – Hmmm – software updates seem to have fixed the problem. Possibly had something to do with dbus.

Dual Monitor in Intrepid (At Last!)

The rest is redundant Intrepid Alpha 6 onwards :-). The standard interface works fine.

I have a VGA 19″ monitor and an LCD 19″. But how to get reliable dual monitor? The GNOME screen resolution interface has never been able to get dual monitor working properly. The closest I ever got on previous attempts was the screens the wrong way around!

A friend put me onto the following: HOWTO: Get Dual Monitors (“Dual Head”) to work on a Dell Optiplex 755 running Ubuntu 8.04 with Intel Q35 Chipset and Xorg RandR 1.2. And that did the trick in Ubuntu Intrepid Ibex Alpha 4 onwards.

Step 0 – No compiz sadly. It apparently doesn’t work above 2048 x 2048 and I want 2560 x 1024. So switch the effects to Off.

Step 1 – clean out /etc/X11/xorg.conf
sudo dpkg-reconfigure -phigh xserver-xorg

Step 2 – expand virtual desktop to size required for multiple desktops
Add the following subsection to the “Screen” section of xorg.conf:

Subsection "Display"
Depth 24
Modes "1280x1024" "1024x768"
Virtual 2560 1024
EndSubsection

I set Virtual to be twice the width of 1280 and the height of 1024. Now we are completely finished with xorg.conf. The rest is through xrandr.

The next steps were only required in alpha 4. In alpha 5 it worked with the two previous changes only.

Step 3 – Find out names of monitors
xrandr -q
I found my two monitors were designated VGA-0 and DVI-0. Use your own names as appropriate in the following steps.

Step 4 – Set up as cloned first:
xrandr --output VGA-0 --auto --output DVI-0 --auto --same-as VGA-0

Step 5 – Now setup one large virtual desktop:
sudo xrandr --output DVI-0 --right-of VGA-0

Step 6 – run script automatically on startup:
See AddingProgramToSessionStartup for very helpful instructions.
xrandr --output DVI-0 --right-of VGA-0