Saturday, 24 November 2007

pierwsze proby przemieszczania sie :)

Monday, 17 September 2007

Oracle to_date function dates from 20th century

there is a very useful function in Oracle DB to_date. But when you run:
select to_date('78/06/01','YY/MM/DD') from dual;

you might be expecting a date '1-Jun-1978' (might differ depending on your local nls settings), but you get surprisingly: '1-Jun-2078'.
Helpful is parameter RR instead of YY.
RR returns years from 21st century when given value is in range 0-49
and returns years from 20th century when given value is in range 50-99

For most cases you probably want:
select to_date('78/06/01','RR/MM/DD') from dual;


Saturday, 1 September 2007

Mencoder converting files

Ever wanted to play a file that your favourite mplayer does not want to play?
Or it shows other difficulties?

Recently I got some tech movies in .flv (flash) format.
Mplayer1.0.1rc1 plays them, but you cannot seek in those files.
Problematic could be as well .mov files.
For the .flv files you can checkout the latest version of mplayer from the subversion.
You can though convert to a format that mplayer accepts without problems (like .avi)

mencoder input.flv -oac pcm -ovc lavc -o output.avi
mencoder -oac pcm -ovc lavc -o output.avi

Happy watching....

Wednesday, 29 August 2007

Pidgin more instances

Why would you have a need to use more instances of IM pidgin, when you can use in one instance more protocols, etc?

For me the reason was:
- to log only Buddies messages and not IRC chats (they grow fast)
- to flash the Pidgin window only when I receive the messages from Buddies and not from IRC chats

To achieve it create a small bat file that will run second, third, ... instance of the Pidgin
c:\programms\pidgin2.1\pidgin -c c:\.pidgin-alt

where you need to apply paths where you installed your pidgin (in my case in programms\pidgin2.1\) after -c parameter is the path to the directory that will hold all settings for the second, third, etc... instance if this directory does not exist, it will be created)

running that bat file will run in a seperate instance and there you can make independent settings.

happy instant messaging.

Tuesday, 28 August 2007

for my honey

    To make it clear
    there is only one
    and it is not beer,
    She smiles and cries
    but never lies
    as I hold that line
    I'm glad that she's mine.

    I code some stuff,
    I drink, have fun
    but she's the one working so hard.
    She waits for me,
    wiping her neck,
    Wait honey I'll be right back!!!

RMagick install from source in Debian Etch

Installing RMagick from sources (6.3.5)

1. Download the latest imagemagick from

- compile with follwoing options (assuming you don't need it for perl nor C++)

./configure --prefix=/opt/imagemagick --enable-shared --disable-static --without-perl --without-magick-plus-plus

of course you can change prefix or remove it when you want it to be isntalled by default

sudo make install

Make sure /opt/imagemagick/includes/lib is in your LD_LIBRARY_PATH
and /opt/imagemagick/bin in your PATH

2. Download the latest RMagick from


If at this stage you get errors like "unable to read font '(null)'":
- check first if your ImageMagick installation was successful running display command
- if running display you get "unable to find font .... helvetica ..." then you need to install fonts on your system
- if display runs fine but you still get the above error from one of ruby test scripts setting fonts options in ./configure of imagemagick might help
- try to configure again ImageMagick with following options:

./configure --prefix=/opt/imagemagick --enable-shared --disable-static --without-perl --without-magick-plus-plus  --with-gs_font-dir=/usr/share/fonts/type1/gsfonts --with-windows-font-dir=/home/chris/win_fonts

(applying appropriate paths)

sudo make install

- compile again RMagick
- still not running? ...

I hope that helps

Oracle - table changes how to notice

Couple of days ago I had a real problem how to provide always the most recent report with the products hierarchy. The first thought was to write a kind of a hash function to get just a hash stamp of the whole table and compare against the new one. The problem arose when it came to implementing the idea.
There is no built way to get a hash value of a whole table.

Suddenly I thought: "OK, let's check if the number of rows is different, then it would mean the content of the table changed".

I walked that way.
Replacing the table I always create first the new one with some different name and if everything goes fine, I replace the name to the right one at the end.

I have a production table called prods_hier and the new one in the background called prods_hier_bak

the following lines of code do the comparing:

select count(*) into no_of_rows_new from prods_hier;
select count(*) into no_of_rows_bak from prods_hier_bak;
if no_of_rows_new <> no_of_rows_bak then
changed := true;
else -- the same no_of_rows
select count(*) into no_of_changed_rows from
( select * from prods_hier
select * from prods_hier_bak
if no_of_changed_rows <> 0 then
changed := true;
end if;
end if;