Monday, April 18, 2011

Unable to open env file: /etc/default/locale

To fix
"Unable to open env file: /etc/default/locale: No such file or directory"
in /var/log/auth.log, run:

update-locale

Thursday, April 14, 2011

sed: -e expression #1, char 24: unknown option to `s'

When you call sed in ruby, you may get this error message

here is the ruby code

def update_server (conf_file_path, config )
puts "update #{conf_file_path}"
%x[sed "s/drs_db.*\/drs_db/drs_db mmmmmmmm \/drs_db/g" #{conf_file_path}]
end

correct:
def update_server (conf_file_path, config )
puts "update #{conf_file_path}"
%x[sed "s/drs_db.*\\/drs_db/drs_db mmmmmmmm \\/drs_db/g" #{conf_file_path}]
end

Monday, April 11, 2011

add a line in a file

add a line after line: [mysqld]
sed -i '/\[mysqld\]/ a\bind-address = 6.31.83.19' test.cnf

Sunday, April 3, 2011

how to check mysql version

mysql> SELECT version();
+--------------------+
| version() |
+--------------------+
| 5.0.51a-3ubuntu5.7 |
+--------------------+
1 row in set (0.00 sec)

mysql> status
--------------
mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2

Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.0.51a-3ubuntu5.7 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 153 days 19 hours 36 min 16 sec

Friday, April 1, 2011

enable Telnet client in Windows Vista

1. Open the Programs and Features Control Panel
2. Select "Turn Windows features on or off."
3. Select the Telnet Client option and click OK.