2008-07-18

Starting with MySQL

All the beginning are terrible and slow... again and again looking into the manual for the same commands.

Install
apt-get install mysql-client mysql-server mysql-common php5-mysql

Set root password
mysqladmin password 'new_root_password'

Login to DB
mysql -u root -p

Create database
CREATE DATABASE db_name;

Create regular user and grant appropriate rights
SELECT PASSWORD('secret_password');
CREATE USER user_name IDENTIFIED BY 'secret_password';
GRANT ALL ON db_name.* TO 'user_name'@'host_name' IDENTIFIED BY 'secret_password';
^D

Login under the regular user
mysql -u user_name -p db_name

Create table
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
created_date DATETIME,
name VARCHAR(200),
phone VARCHAR(200)
);

Create index
CREATE INDEX index_users_name ON users (name);
details

Riding back horses

Me and my brother tried riding back horses last week. I was brave enough to settle the horse and ride back immediately to the nature, while my brother decided to take theoretical lesson first. This week we both go to ride horses freely in the nature so we will see...

Visit to the State Opera Prague

At the beginning of July I took the chance and visited the ballet performance in the State Opera Prague. I also invited my close friends. Swan Lake is the famous opera from Tchaikovsky and we all enjoyed it very much. After that we took a cup of hot chocolate and went for sight seeing in the evening city.

Firefox: Open new window in new tab

How to force open new window to new tab in Firefox 2.0?

Open location
about:config

Set Filter
browser.link.open

Variables:
browser.link.open_external
Rule for opening links from external programs (e.g. Thunderbird, Psi, ...)
browser.link.open_newwindow
Rule for opening links targeted to new window by the 'target' attribute
browser.link.open_newwindow.restriction
Rule for opening restrictions by Javascript

Values:
The value sets opening links in:
1 current tab
2 new window
3 new tab in current window

2008-07-10

Xlib: connection refused by server

Trying run under root:
su
swscanner
I received following error message:
Xlib: connection to ":0.0" refused by server

Easy solution, run under regular user:
xhost +localhost
OR:
xhost local:root

Then run under root:
export XAUTHORITY=/home/regular_user_name/.Xauthority

Where
regular_user_name is name of the user doing command su.


2008-07-07

Acer TravelMate 5720 - video drivers

How To install video drivers to Acer TravelMate 5720 (thanks to Miro):
Proprietary binary drivers for Debian:
apt-get install fglrx-driver fglrx-driver-dev fglrx-control fglrx-kernel-src
cd /usr/src/
tar -xjvf fglrx.tar.bz2
cd modules/
./make.sh
mkdir -p /lib/modules/`uname -r`/misc
cp fglrx.ko /lib/modules/`uname -r`/misc/
depmod -ae

Oracle DB server notes

Oracle Error:
Warning: ocifetch(): OCIFetch: ORA-24374: define not done before fetch or execute and fetch in /home/martin/dev/www/inc/ora_funct.php on line 15

Reason and solution:

sometimes wrong syntax but mostly missing access rights to accessed table. You can solve this problem by granting sufficient rights to the user which is accessing the table.

Oracle sql date comparison:
SELECT column
FROM table
WHERE start_date <= TO_DATE('20080401', 'yyyy-mm-dd');