Thursday, July 31, 2008

Počítačový evergreen

Proti bolesti zad...

http://zdravi.idnes.cz/deset-prekvapivych-triku-proti-bolestem-zad-f33-/zdravi.asp?c=A080317_141512_zdravi_bad

http://slovnik.seznam.cz/?q=pra%C5%BE%C3%A1k&lang=cz_en

100 Prague towers

Interesting project shows Prague from perspective of famous Prague towers. You can turn around in 360 degrees or move to another tower just by clicking on the picture.

English version: http://stovezata.praha.eu/homepage.html
Czech version: http://stovezata.praha.eu/index.html

Tuesday, July 29, 2008

Square dancing weekend

Last weekend was wonderful dancing event for people who enjoy Square dance. My friends David&Lenka precisely prepared dancing event which was the final part of their weding celebration.

It started in the Prague where we took boat trip throught center of the city and we saw some nice places including Charles' bridge and Vysehrad. Then we went by bus to the place where the dancing started.

It was situated in hotel near by Prague. Level of the even was high in all ways - it was very well organised, place was nice, hotel stuff took care of us all the time, dancing quality was very good and also square dance level - we danced C3A all the weekend. Even the weather was great so it was very nice relaxing weekend.

At the end of the weekend I went with my friend to the theatre to visit play. It was part of the summer student theatre fest. The evening contained one chorus sing, one drama and one pantomima. All the plays were wonderful.

Monday, July 28, 2008

Playing Oracle and MySQL game

Sometimes we want to escape characters in Oracle SQL Plus console

Set the escape character
set escape \

Send command (in the same session)
INSERT INTO customer (url) VALUES('http://www.example.com/redir.php?id=1234\&log=true');

Select rows recursevely

SELECT LPAD(' ', 2 * (LEVEL - 1)) || TO_CHAR(child) s
FROM test_table
START WITH parent IS NULL
CONNECT BY PRIOR child = parent;

This has just one restriction: no joins allowed.
source: http://www.adp-gmbh.ch/ora/sql/connect_by.html

Insert-update with MySQL

INSERT INTO table_name (col_names)
VALUES (values)
ON DUPLICATE KEY UPDATE col=val, col2=val2;
source: http://devblog.billism.com/?p=12

Tuesday, July 22, 2008

Riding back horses again

We were riding back horses again. Last weekend was very good weather for relaxing so we took another lesson of horse-driving. We ran for some times but very slowly and carefully, much slower than I wanted. But better to be careful than injured.

We went to the nature and if was time I enjoyed the surrounding view of woods, fields and wild in the sunshine.

Just at the end the horse stepped on my foot. It was not good but, fortunately, I did not need the doctor's help.
Even though, I am decided to take another lesson next time but I will take another horse.

Friday, July 18, 2008

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

Thursday, July 10, 2008

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.


Monday, July 07, 2008

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');