Thursday, July 28, 2011

Enable remote access to MySQL

In MySQL config file, such as my.cnf
- comment out skip-networking
- add bind-address = YOUR_HOST_IP
- restart mysqld
- log in to mysql from server machine
- do GRANT ALL ON DATABASE.TABLE TO USERNAME@'HOST_IP/NAME' IDENTIFIED BY 'PASSWORD'; (Quote is required.)
- on client machine log in with > mysql -u USERNAME -r PASSWORD -h YOUR_HOST_IP

P.S. If there is no config file you can copy/rename from my-*.cnf in mysql directory

Credit: How Do I Enable Remote Access To MySQL Database Server?

Monday, July 25, 2011

More advance commands for moving cursor and screen in VI

These are VI commands I have just learned today

F = reverse of f
t = f and step back 1 char
T = reverse of t
; = repeat f, F, t and T

H = Move cursor to first line of the screen
M = Move cursor to middle of the screen
L = Move cursor to last line of the screen

z. || zz = Move screen to make cursor to middle of the screen
zt = Move screen to make cursor to top of the screen
zb = Move screen to make cursor to bottom of the screen

Ctrl+f = Scroll down 1 screen (Ctrl+d only half screen)
Ctrl+b = reverse of Ctrl+f

Ctrl+e = Move screen down 1 line with the cursor try to stay at the sameline
Ctrl+y = reverse of Ctrl+y

Thursday, July 14, 2011

How to install PHPUnit to Mac OSX

- Install PEAR
curl -O http://pear.php.net/go-pear.phar
php -d detect_unicode=0 go-pear.phar


- Install PHPUnit
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear install --force --alldeps phpunit/PHPUnit


- Set phpunit bin path to System Environment Variables

Credit
Getting and installing the PEAR package manager
PHPUnit Installed on Mac OSX

Monday, July 11, 2011

[Solved] Ubuntu can not use webcam for video call, while Cheese is working properly

This post is not for people who is facing Linux webcam driver issue, it is for people who can get webcam working (with some application, such as Cheese) but webcam is not working for video calling like Skype or Google video call.

I also don't know the cause but for solution is to set this to environment variable before running video call application
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so


For convenient, you can rename the original application bin file to other name and making below script naming as bin file.

For example, I did rename my /usr/bin/google-chrome to /usr/bin/google-chrome.real and create a script at /usr/bin/google-chrome with below content
#!/bin/sh
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/google-chrome.real


Now Gmail video call on my Google Chrome should work. (Skype also can do the same way)

Tested with Ubuntu 10.04 on 32-bits machine.
Credited to some forums in internet. Sorry for forgotten.

Config number of file descriptors on Linux

Check file descriptor limit for a process. Vary depending on owner of the process $ cat /proc/{process-id}/limits Check current number of...