Wednesday, May 28, 2008

Windows Seven - LOL

So Windows Seven will be the next windows OS in few years (plus delays) and the great news are that it won't have the compact 'MinWin' kernel, it will be a 'further evolution of Vista'.

I'm afraid that it will be only the promised Vista. For Vista, they promised loads of stuff, then stripped most of them out like the WinFS, PowerShell just to mention few. Windows Seven will be the almost ready Windows Vista. LOL, they are loosers. Or maybe we are, cause we will give money for it. They should call it Window$$even, notice the double dollars, twice the money for the same Vista shit!

But even if the functionality won't change much and also the performance will be lower then at least the look will be nicer, new icons and skins. Go on guys, we are looking forward to buy it.

Holiday in Croatia

Two days and finally leaving for holidays to Croatia. We'll visit many places (NP - National Park):
  • Zagreb
  • Zadar riviera
  • NP Paklenica
  • Vran lake
  • NP Kornati
  • Modric cave
  • Pasman and Ugljan islands
  • Zrmanja river
  • NP Plitvice.
and with many activities:
  • sightseeing
  • bathing
  • cycling
  • rafting
  • sailing
  • wine & food tasting
After comeback I'll post few pictures (taken with my new Canon 40D camera :) )

Tuesday, May 20, 2008

Oracle - join 2 selects side by side?

Hi, I'm not an SQL guru and this seemingly simple problem made me quite much thinking and searching. That's why I decided to share it.

The problem: I have a table (eg foo) with many columns, for me only two were important:
  • name (varchar2, unique)
  • code (varchar2, unique)
and I had two selects:
  • select name, code from foo order by name
  • select code, name from foo order by code
Got it? The only difference is the sorting! Now I needed to join (NOT union) these two selects in a way to prefer the order of both selects. Easy? Give it a try... :)

The solution was Oracle's 'rownum':

SELECT c1_name, c1_code, c2_code, c2_name
FROM
(SELECT ROWNUM AS s, c1_name, c1_code
FROM (SELECT name AS c1_name, code_id AS c1_code
FROM foo ORDER BY c1_name)) t1
LEFT JOIN
(SELECT ROWNUM AS s, c2_code, c2_name
FROM (SELECT code AS c2_code,name AS c2_name
FROM foo ORDER BY c2_code)) t2
ON t1.s = t2.s

I had to wrap the two selects with another select with rownum, when rownum was directly in the first select, the ordering scrambled it. From here you need to only join the two tables using rownums, do it as you wish, I used left join but probably there could be better ways.