2009年4月12日 星期日

Cannot Copy Text in Vim While Using Putty

vim automatically sets visual mode when you click mouse buttons

solution is to stop vim from interpreting the mouse clicks

set mouse=


or add this to ~/.vimrc

2009年4月10日 星期五

Static ARP Entry and Wake on Lan on Arch Linux

1. install wol package in community repository

pacman -S wol

2. wol works only if the target machine is in the arp table. so if not, manually add an entry to the table

arp -s HOSTNAME MACADDRESS

hostname must be in /etc/hosts

3. to load permanent arp entry at boot time, create /etc/ethers then add the command into /etc/rc.local

vi /etc/ethers
--

MACADDRESS HOSTNAME


vi /etc/rc.local
--

arp -f

-f: if no filename is specified, /etc/ethers is used as default

4. wake up some machine

wol -h HOSTNAME MACADDRESS

2009年4月9日 星期四

Set up MythTV Backend on Arch Linux and Watch TV on Windows Player

1. install the mythtv package

sudo pacman -S mythtv

2. import the database structure of mythtv to mysql

mysql -u root -p < /usr/share/mythtv/mc.sql

3. run setup as root or you'd get the message "Couldn't open /dev/v4l/video0 to probe its inputs."

sudo mythtv-setup

4. first time when you run mythtv-setup, it may ask you if upgrade the database schema, press yes, backup would be /tmp

5. General (the below setting is for taiwan)
TV format: NTSC
Channel frequency table: us-cable

6. Capture card (get these device number from dmesg, lspci, and lsusb)
Card type: Analog V4L capture card
Video device: /dev/videoX
VBI device: /dev/vbi0
Audio device: /dev/dspX
Default input: Television

7. Video sources
Listings grabber: No grabber
Channel frequency table: default

8. Input connections
Scan for channels: Video source must be pick first
Starting channel: remember to type a valid number

9. Storage Directories, at least one recording directory has to be added to the Default Storage Group or it will not be possible to watch/record anything. personally i set /tmp. to remove a storage group from the list, highlight it and press the 'D' key

10. user plans to watch analog tv only doesn't need to run mythfilldatabase?

11. start mythtv backend server

sudo /etc/rc.d/mythbackend start


12. go to mythtv front-end

mythfrontend

Utilities / Setup -> Setup -> TV Settings -> Recording Profiles -> Software Encoders (v4l based) -> LiveTV
change all of codecs from RTjpeg to MPEG-4

13. download MythTV Player which is the only one player for windows that allows you to play recordings and LiveTV directly from a MythTv backend.
http://www.sudu.dk/mythtvplayer/index.php

14. mythtv player accept protocol versions 15-31 originally. if your server speak newer or older than it, edit config.xml just change 0 to 1

<AcceptNewerProtocols>1</AcceptNewerProtocols>
<AcceptOlderProtocols>0</AcceptOlderProtocols>


i got some problems, frequent disconnect at the very first minutes, cannot continue playing after disconnect, suitable setting or bitrate for stream to internet.. to be continued

2009年4月8日 星期三

Install VirtualBox on Arch Linux

1. virtuabox needs fakeroot installed and its gui needs sdl

sudo pacman -S fakeroot sdl

2. install virtualbox personal use binary edition from aur

http://aur.archlinux.org/packages.php?ID=9753

3. add user to the vboxusers group

gpasswd -a USERNAME vboxusers

4. add vboxdrv, vboxnetflt( for host interface networking ), vboxnetadp( for host-only networking ) to the Modules array in /etc/rc.conf

5. add the following line to /etc/fstab if you want the vboxusers to have permission to emulate USB devices

none /proc/bus/usb usbfs auto,busgid=108,busmode=0775,devgid=108,devmode=0664 0 0

6. run "vbox_build_module" as root every time your kernel is upgraded

sudo /usr/bin/vbox_build_module

Autostart Applications in LXDE and Gnome

1. the desktop entry of program which you need run on session startup should be put in ~/.config/autostart

mkdir -p .config/autostart

2. create *.desktop or copy from what application you need from /usr/share/applications

[Desktop Entry]
Type=Application
Exec=command

2009年4月7日 星期二

Set up Xorg on Arch Linux

1. install xorg and your graphic card driver

sudo pacman -S xorg xf86-video-intel

2. auto-generate xorg.conf from detected result

Xorg -configure

3. DO NOT run test before hal or your keyboard and mouse will be freezed

Xorg -config filename

4. move the generated file to /etc/X11

sudo mv xorg.conf.new /etc/X11/xorg.conf

5. add the following setting to xorg.conf

vi /etc/X11/xorg.conf
--

..
Section "Module"
Load "glx"
..
..
Section "Monitor"
DisplaySize 336 210
..
..
Section "Screen"
SubSection "Display"
Modes "1280x800" "1024x768"
..

module glx is for 3d acceleration

in order to get correct sizing for fonts, the display size must be set for your desired dpi.
display size = (x|y)pixels * 25.4 / dpi
i'm running xorg with a resolution of 1280x800 and want a dpi of 96 so i use 1280 x 25.4 / 96 and 800 x 25.4 / 96

if you wish to use a lower resolution than your monitor is capable of, manually specify modes which you need only

6. edit /etc/rc.conf to load hal on boot

vi /etc/rc.conf
--

DAEMONS=(syslog-ng network netfs crond hal)

2009年4月6日 星期一

Unify Encoding of MySQL Clients on Ubuntu

it solves encoding of phpmyadmin and mysql cli aren't same.

sudo vi /etc/mysql/my.cnf
--

[client]
default-character-set = utf8