Saturday, February 27, 2010

HOWTO : Real 3D desktop on Ubuntu 9.10

Compiz fusion plugin - Anaglyph can make your screen to be a real 3D display.

Step 1 :
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install compiz-fusion-bcop compiz-dev build-essential libtool libglu1-mesa-dev libxss-dev git-core compizconfig-settings-manager


Step 2 :
git clone git://anongit.compiz-fusion.org/users/wodor/anaglyph

cd anaglyph
make
sudo make install


Step 3 :
Go to "System" - "Preference" - "CompizConfig Settings Manager" - "Effect" - "Anaglyph"

Set desire keystokes and/or mouse clicks to enable the effect.

Step 4 :
Make your spectacles yourself. Right is Blue and Left is Red.

That's all! See you.

Saturday, February 20, 2010

HOWTO : Changing Time Zone on Ubuntu 9.10

In case you need to change your current time zone, you can do it this way.

sudo dpkg-reconfigure tzdata

That's all! See you.

HOWTO : Make SCIM as default Input Method on Ubuntu 9.10

The Input Method is default to iBus on Ubuntu 9.10. However, iBus does not provide my Chinese Input Method but SCIM has. Therefore, I need to make SCIM as default instead of iBus.

sudo im-switch -s scim

sudo update-alternatives --config xinput-zh_TW

Then, choose scim by the number and a "*" will changed to SCIM from iBus.

That's all! See you.

HOWTO : Fixing mouse click not recognized on Flash under Ubuntu 9.10

You may encounter the mouse click cannot be recongnized on Flash 10.0 r45 under Ubuntu 9.10 AMD64. This tutorial shows you how to fix it.

sudo nano /usr/lib/nspluginwrapper/i386/linux/npviewer

Add the following line right before the LAST line of the file.

export GDK_NATIVE_WINDOWS=1

The final look would be :

#!/bin/sh
TARGET_OS=linux
TARGET_ARCH=i386
export GDK_NATIVE_WINDOWS=1
. /usr/lib/nspluginwrapper/noarch/npviewer


That's all! See you.

Thursday, February 18, 2010

HOWTO : Untangle 7.1 on Intel Desktop Board D510MO

*** UPDATED ON NOVEMBER 20, 2010 : This tutorial is also work for Untangle 8.0 on Intel Desktop Board D510MO. The Realtek wireless card driver is updated to r8168-8.020.00. ***

Intel Desktop Board D510MO equipped with Intel Atom D510 processor and Realtek 8168B PCI-e onboard LAN. It is launched in the first quarter of 2010. The board will be available on Jan 4, 2010 in Hong Kong.

** This tutorial is prepared by me on Jan 2, 2010. Now, I share it here as there are some users do not know how to install Untangle 7.1 on this good motherboard. **

The kernel of Untangle 7.1 does not work on the captioned LAN card on the motherboard. We need to do something to make it work. However, Ubuntu 9.10 do recognized the onboard LAN card.

Step 1 :

Insert another new PCI LAN card to the motherboard. I recommended not to use Realtek chipset LAN card. I use D-Link Gigabit PCI Ethernet Card (DGE-530T) which is equipped with Marvell chipset and it is a low profile design.

The onboard Realtek LAN will be eth1 while the new inserted LAN card will be eth0.

Plug the CAT5e or CAT6 cable to the eth0 which then connect to the internet and the cable that connected to eth1 will be plugged into the gigabit switch.

Step 2 :

Install Untangle as usual. In the first stage of installation, the Untangle will recognize two network interfaces. However, the system reboot automatically and go to stage 2. Make sure to select "Video Safe Mode" to boot to the next stage of installation. Otherwise, you may encounter the display problem - no screen at all. You can press "CTRL+ALT+Plus" one or two times or may be three times to make the display work. However, the resolution is not correct at all.

Then, the Untanlge only see one network interface which is the eth0 - the PCI LAN card. Go ahead to install.

Step 3 :

After the installation, you will go to the web interface. Exit it and go to the "Terminal" at the dock. Type your desired password (you set it this time) twice. Then, you will ask for password again. Key in and a terminal will be displayed.

nano /etc/apt/sources.list

Copy and paste the following lines to the source.list file.

deb http://ftp.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.debian.org/debian/ lenny main contrib non-free


Save it.

Step 4 :

apt-get update
apt-get install gcc make
apt-get install linux-headers-`uname -r`


ln -s /usr/src/linux-headers-`uname -r` /usr/src/linux

Step 5 :

The current version of Realtek 8168B driver at the time of writing is 8.015.00 which is released on November 27, 2009.

Download the Realtek 8168B driver from the Realtek official site at Realtek Official Site.

Or, download as the following :

wget http://samiux.volospin.com/r8168-8.015.00.tar.bz2

tar -xvjf r8168-8.015.00.tar.bz2
cd r8168-8.015.00


rmmod r8169

sh autorun.sh

lsmod | grep r8168

If it is not exist, do the following :

depmod -a
modprobe r8168


Step 6 :

echo "\nblacklist r8169\n" >> /etc/modprobe.d/blacklist

mv /lib/modules/`uname -r`/kernel/drivers/net/r8169.ko /lib/modules/`uname -r`/kernel/drivers/net/r8169.ko.bak

* The above is two lines of command.

Step 7 :

mv /boot/initrd.img-`uname -r` /boot/initrd.img-`uname -r`.bak

mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`

* The above is two lines of command.

Step 8 :

Uncomment the two entries that added to the file /etc/apt/sources.list previously with "#". Make sure you do this step; otherwise it will affect the Untangle when there is an update.

Reboot Untangle and then configure the box accordingly.

Reference

Intel D510MO motherboard
Untangle Official Site

Known issue

When the kernel of Untangle is updated, you need to recompile and reinstall the Realtek driver.

That's all! See you.

Tuesday, February 16, 2010

HOWTO : MyGica D689 USB HDTV dongle and VideoLan on Ubuntu 9.10

We can watch digital TV including HDTV on Ubuntu 9.10 with MyGica D689 USB HDTV dongle. You may also require to buy a new nVidia series 9000 or up display card. Since series 9000, nVidia display card supports hardware acceleration for playing HD video.

In order to keep my Ubuntu box easy for update and secure, I prefer to install software packages from official and PPA repositories. However, I need to compile the MyGica driver in order to make it works. I selected VideoLan for the playback.

Hardware and software used in this tutorial :

CPU - AMD Athlon 64 x 2 4200+
RAM - 8GB DDR2 800
Hard Drive - 320GB x 2 on Hardware RAID 0
HDTV - MyGica D689 HDTV USB dougle (v3.0)
Display card - XFX nVidia GT240 with 1GB DDR3 RAM and HDMI
Operating system - Ubuntu 9.10 Desktop AMD64 with Kernel 2.6.31-19-generic

The following procedures are for installing PPA nVidia display driver.

Step 1 - Add essential repositories :

(A) Add medibuntu repository (for general multimedia codecs and plugins)

sudo wget http://www.medibuntu.org/sources.list.d/karmic.list --output-document=/etc/apt/sources.list.d/medibuntu.list &&
sudo apt-get -q update &&
sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring &&
sudo apt-get -q update


** Note : If you are using Ubuntu Samiux Remix, you are not required to add this repository as it is already added.

(B) Add nvidia-vdpau repository (for related VDPAU libraries)

echo "deb http://ppa.launchpad.net/nvidia-vdpau/ppa/ubuntu karmic main" | sudo tee -a /etc/apt/sources.list.d/nvidia-vdpau.list
echo "deb-src http://ppa.launchpad.net/nvidia-vdpau/ppa/ubuntu karmic main" | sudo tee -a /etc/apt/sources.list.d/nvidia-vdpau.list


Add key of nvidia-vdpau repository to the keyrings.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CEC06767

sudo apt-get update
sudo apt-get upgrade


** Remarks : Or, you can use this command
sudo sh -c 'echo "Test I want to write" > /path/to/file'

Step 2 - Install all related softwares, codecs and plugins :

sudo apt-get install x264 vlc mencoder qt4-qtconfig

sudo apt-get install ubuntu-restricted-extras quicktime-utils quicktime-x11utils libdvdnav4 libdvdread4 libdvdcss2 non-free-codecs faad

Then, reboot your system.

Step 3 - Install nVidia display driver

Select "System" - "Administration" - "Hardware driver" from the menu on the desktop.
Choose nVidia display driver 195 version as prompted. After the install, you are required to reboot your system.

Reboot your system.

Step 4 - Confirmation of VDPAU drivers are installed

Make sure "vdpau" is installed and activated.

ffmpeg -formats | grep vdpau

If you can see some vdpau displayed, vdpau works.

Step 5 - Install MyGica D689 driver :

sudo apt-get install mercurial

At you desired directory, such as /home/samiux.

mkdir mygica
cd mygica
hg clone http://bitbucket.org/davidtlwong/mygica_x8558pro
cd mygica_x8558pro


make
sudo make install


** Note : If you see an error of compiling FireDTV, you should do the following.

nano v4l/.config

Locate "CONFIG_DVB_FIREDTV=m" and change to "CONFIG_DVB_FIREDTV=n"

Save it and run "make" again.

make
sudo make install


Step 5a - Alternative way to install MyGica driver (Optional) :

** Note : Choose Step 5 or 5a only but not both of them.

Or, you can install this version. I prefer this version.

MyGica driver version used (Tip's version) :
Download Tip's version

wget http://bitbucket.org/davidtlwong/mygica_x8558pro/get/tip.tar.gz

tar -xvzf tip.tar.gz
cd mygica_x8558pro

make
sudo make install


** Note : If you see an error of compiling FireDTV, you should do the following.

nano v4l/.config

Locate "CONFIG_DVB_FIREDTV=m" and change to "CONFIG_DVB_FIREDTV=n"

Save it and run "make" again.

make
sudo make install


Tip's version changelog

When the kernel is updated, you should delete the directory of mygica_x8558pro and redo the following :

tar -xvzf tip.tar.gz
cd mygica_x8558pro

make
sudo make install


Step 6 - VideoLan Configuration :

The following should be done. Otherwise, your playlist cannot be saved.

"System" - "Preference" - "Qt4 setting" - "Appearance" - "GUI Style" - "Cleanlooks"

Start VideoLan and configure as the following :

"Media" - "Open Capture Device Ctrl C" - "Capture Mode" - "DVB" - "DVB type" - "DVB-T"

The channels will be scanned but it need a lot of time. You just wait it to finish.

After that, you can save the playlist by "Media" - "Save playlist to the file".

You may delete some duplicated channels on the playlist.

Or, you can download an example at here for reference.

You should load the playlist when you watch HDTV or TV every time.

You may need to do some tuning at "Tool" - "Preference" - "Input & Codec" :

Do some setting on "Cache" or/and "Skip the loop filter for H.264 decoding" when necessary.

Step 7 - Test your MyGica D689 (Optional) :

Insert your MyGica D689.

lsusb

The output should be :
Bus 001 Device 002: ID 0572:d811 Conexant Systems (Rockwell), Inc.

The following is for testing purpose.

sudo apt-get install dvbsnoop dvbtune

dvbsnoop -s signal

If there is some output but not error, your MyGica D689 works.

Step 8 - Streaming TV on LAN and recording TV programmes (Optional and not tested by me) :

This is work of "ksng".

Download ksng's scripts (dated 2009-NOV-26)
Download ksng's scripts (dated 2009-DEC-05)
Download ksng's scripts (dated 2010-FEB-04)

Known Issue :

When watching Standard HD TV, the workload of Athlon 64x2 4200+ is very low, says 800MHz. However, when watching Full HD TV, the workload of Athlon 64x2 will be running in full. I think modern CPU may solve this problem.

Honor :

Many thanks to David T.L. WONG for the MyGica driver while "ksng" for the streaming scripts. They are active members of HKEPC Linux forum.

That's all. See you!

Thursday, February 04, 2010

HOWTO : Django and MySQL on Ubuntu 9.10

Install MySQL and Django

sudo apt-get update
sudo apt-get install mysql-server mysql-client python-mysqldb python-django


Create a softlink
sudo ln -s /usr/lib/python-django/bin/django-admin.py /usr/local/bin/django-admin.py

Create a database namely djangodb (or any other name)
mysql -u root -p

create database djangodb;
exit


That's all! See you.

Tuesday, February 02, 2010

HOWTO : Yet Another Elastix Without Tears

This dirty guide is for making the Elastix box just work and it is for you to understand how Elastix or IP PBX works. All the dial rules setting are applied to Hong Kong only. Advanced application or configuration of Elastix is not included. If you want to learn more, you can refer to Elastix Without Tears.

Hardware
(1) Personal Computer (Mini-ITX)
- Intel ATOM D510 CPU on Intel desktop board D510MO
- 1 X 320GB Hard drive (or smaller)
- 2 X 2GB DDR2 800 RAM (total 4GB) (normally lesser RAM is okay)
- 1 X Gigabit NIC

(2) Additional Hardware
X100P - FXO card without echo cancellation (Cheap but works great for SOHO or home)
Linksys SPA941 IP Phone or Linksys SPA942 IP Phone (Optional)

*If you do not use telephone landline as dial in and out, the X100P is optional.

Software
Elastix 1.6-12 (Asterisk distribution based on CentOS 5.3 Final)
Ekiga 3.2.6 (Ubuntu 9.10 or Windows) (Softphone)

Installation of Hardware
X100P may not be recognized by Elastix due to IRQ problem on some motherboard which includes D510MO. We can overcome this problem with a very crazy step, that is, plug the X100P to the PCI slot of the motherboard with the power cable already plugged in. Use this step when necessary.

The FXO port at the X100P is connected to PSTN (analog telephone line to wall socket). The Bypass port is for connecting to the telephone set.

Installation of Elastix 1.6-12
Install the Elastix is just following the steps on screen. Make sure you write down the root password that you type in during the installation. Login the box and you will prompt the IP address, e.g. 192.168.0.100.

After the installation, you can access the web page of Elastix by entering the IP address (192.168.0.100) to the browser. The username is "admin" while the password is "palosanto". You can change the admin password later. For username and password of other components or modules, please refer to "Elastix Without Tear".

Configuration of Elastix
Log in to the web page of Elastix. Make sure the X100P card is recognized by checking the "Hardware Detection" tab at "System" tab. If everything working fine, you will see the following inside a green coloured box :

Span #1: WCFXO/0 "Wildcard X100P Board 1" (MASTER)
1 FXO In Use


Otherwise, if you see a red coloured box, you should shutdown the box and re-insert the X100P when the power cable is plugged in. If you see "1 FXO not in use" and the colour is pink, the telephone line is not plugged into the FXO port of X100P.

Step 1 : ZAP Trunk setting
Now, go to "PBX" tab. Select "Trunks" on your left hand side. You will see "Trunk ZAP/g0" on the right hand side. Click it. At the "Outbound Caller ID" fill in your home or office landline telephone number in the following format :

"Home" <23456789>

The "Dial Rules" will be "XX."

Click "Submit Changes" button and click the pink coloured bar on the top that written "Apply Configuration Changes Here" to confirm your changes. Make sure you do this step after making any changes or add any item in the Elastix box.

Step 2 : Extensions setting
Go to the "Extensions" on your left hand side. Create "Generic SIP Device". "Extensions" to be "1001". The "Display Name" is "Samiux" and the "SIP Alias" is "samiux". "secret" is "1001" or any number. "nat" is "yes".

At the "Voicemail & Directory", enabled the "Status". "Voicemail Password" is "1001". Enter your email address. Select yes on "Email Attachment", "Play CID" and "Play Envelope". Then click "Submit".

Click "Edit Follow Me Settings" on the top. "Follow-Me List:" is set to "1001". The "Destination if no answer" is set to "Voicemail: <1001> Samiux (unavail)".

Step 3 : Ring Groups setting
Go to the "Ring Groups" on your left hand side. Create a ring group "600" and give it a name to be "General". "Ring Time (max 60 sec)" fill in "60". "Extension List" is "1001". Make sure the "Ring Strategy" is "ringall". The "Destination if no answer" is set to "Voicemail: <1001> Samiux (unavail)".

Step 4 : Inbound Routes setting
Go to the "Inbound Routes" on your left hand side. Create an empty "Incoming Route". Select "Ring Groups: General <600>" at "Set Destination".

Step 5 : Outbound Routes setting
Go to the "Outbound Routes" on your left hand side. Select "0 9_outside" on your right hand side.

At the "Dial Patterns", type "9|XX." and "Trunk Sequence" should select "ZAP/g0". Then click "Submit Changes".

How it works
When someone dail to your landline 23456789, your softphone and analog phone will ring. If you do not answer after 60 seconds, the Elastx will go to Samiux's voicemail box. Make sure your softphone is running. Otherwise, the call will be diverted to the voicemail at once.

If you want to dial out via the landline to "29876543", you just key in "929876543". "9" is to get the outside tone.

If you use Ekiga (softphone) to dail to "Samiux" no matter you are in Hong Kong or other countries as well as in the same network of the Elastix, just install Ekiga and dail "sip:1001@real_ip or 192.168.0.100" or "sip:samiux@real_ip or 192.168.0.100". Make sure you are online. For example, "sip:1001@samiux.com" or "sip:samiux@samiux.com".

Router & firewall configuration
If your Elastix box is behind a router or firewall, you should do port forwarding and open the essential ports.

Port forwarding : 5060
Ports may use : 5004, 7070, 16382, 1720, 3478-9, 10000-20000

Last word
You may need to buy a DID for your Elastix box. DID is a local telephone number which can dial via internet. You can buy one in Hong kong at Hong Kong broadband 2b. It has 2 outgoing channels. Your friends in overseas can dial your DID from softphone and your softphone or IP Phone will ring.

The setting of DID should refer to Elastix Without Tears as this part does not included in this HOWTO.

Reference
Elastix

How to set up video support in Elastix

Elastix Wiki

ENUM registeration

Elastix Without Tears

X100P

Digium

Asterisk

Ekiga

That's all! See you.

Monday, February 01, 2010

HOWTO : Ubuntu 9.10 for OpenVPN

To make your Ubuntu 9.10 box to connect to OpenVPN server is very easy.

sudo apt-get update
sudo apt-get install network-manager-openvpn
sudo /etc/init.d/network-manager restart


Now, you can configure the Network Manager for any OpenVPN server.


That's all. See you!