<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Obfuscation contest</title>
	<atom:link href="http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html</link>
	<description>Oracle Certified Master</description>
	<pubDate>Mon, 01 Dec 2008 19:38:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Log Buffer #92: a Carnival of the Vanities for DBAs</title>
		<link>http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6178</link>
		<dc:creator>Log Buffer #92: a Carnival of the Vanities for DBAs</dc:creator>
		<pubDate>Fri, 11 Apr 2008 16:44:28 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6178</guid>
		<description>[...] Laurent offers greater detail about his obfuscated submission. Also a trippy picture of Chen. [...]</description>
		<content:encoded><![CDATA[<p>[...] Laurent offers greater detail about his obfuscated submission. Also a trippy picture of Chen. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Polarski bernard</title>
		<link>http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6153</link>
		<dc:creator>Polarski bernard</dc:creator>
		<pubDate>Mon, 07 Apr 2008 13:16:55 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6153</guid>
		<description>Hooo.......a pivot feeded by 2 nested loop out of 5 dimensions... we are reaching new hight of pain. The query is not made of cryptic or exotic functions, i can undertand every single word apart though I have hard time to understand the whole picture. The worst query are the ones made of simple words but still you don't understand: the longer you look, the more idiot you feel. 

Back home, I will tell wife that it took me 5 hours to understand 10 lines.</description>
		<content:encoded><![CDATA[<p>Hooo&#8230;&#8230;.a pivot feeded by 2 nested loop out of 5 dimensions&#8230; we are reaching new hight of pain. The query is not made of cryptic or exotic functions, i can undertand every single word apart though I have hard time to understand the whole picture. The worst query are the ones made of simple words but still you don&#8217;t understand: the longer you look, the more idiot you feel. </p>
<p>Back home, I will tell wife that it took me 5 hours to understand 10 lines.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6152</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 07 Apr 2008 12:08:59 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6152</guid>
		<description>I could add 
val[1,1]=1/decode(dim2.x[0],dim1.y[0],null,0),
to get 1/0 error when number of columns of m1 differs from number of rows in m2 :mrgreen:</description>
		<content:encoded><![CDATA[<p>I could add<br />
val[1,1]=1/decode(dim2.x[0],dim1.y[0],null,0),<br />
to get 1/0 error when number of columns of m1 differs from number of rows in m2 <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_mrgreen.gif' alt=':mrgreen:' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6151</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 07 Apr 2008 11:46:58 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6151</guid>
		<description>I have not done this yet. It is surely possible, but I do not know myself how to calculate inverse matrix. 

To multiply matrix I could imagine :
&lt;code&gt;SQL&gt; create table m1 as
  select 1 x, 1 y, 10 val from dual 
  union all select 1,2,20 from dual
  union all select 2,1,30 from dual
  union all select 2,2,40 from dual
  union all select 3,1,50 from dual
  union all select 3,2,60 from dual
  union all select 4,1,70 from dual
  union all select 4,2,80 from dual;
Table created.
SQL&gt; create table m2 as
  select 1 x, 1 y, 100 val from dual 
  union all select 1,2,200 from dual
  union all select 1,3,300 from dual
  union all select 2,1,400 from dual
  union all select 2,2,500 from dual
  union all select 2,3,600 from dual;
Table created.
SQL&gt; select * from m1 pivot (max(val) for y in (1,2))

         X          1          2
---------- ---------- ----------
         1         10         20
         2         30         40
         3         50         60
         4         70         80
SQL&gt; select * from m2 pivot (max(val) for y in (1,2,3))

         X          1          2          3
---------- ---------- ---------- ----------
         1        100        200        300
         2        400        500        600
SQL&gt; select * from (
select * from dual model
reference 
  m1 on (select * from m1) dimension by (x,y) measures (val)
reference 
  m2 on (select * from m2) dimension by (x,y) measures (val)
reference 
  dim1 on (select max(x) x,max(y) y, 0 dummy from m1) dimension by (dummy) measures (x,y)
reference 
  dim2 on (select max(x) x,max(y) y, 0 dummy from m2) dimension by (dummy) measures (x,y)
dimension by (1 x,1 y) measures (0 val)
rules iterate (100) until (dim2.x[0]=iteration_number+1)
(val[for x from 1 to dim1.x[0] increment 1, for y from 1 to dim2.y[0] increment 1]=
nvl(val[cv(),cv()],0)+m2.val[iteration_number+1,cv(y)]*m1.val[cv(x),iteration_number+1] ))
pivot (max(val) for y in (1,2,3))

         X          1          2          3
---------- ---------- ---------- ----------
         1       9000      12000      15000
         2      19000      26000      33000
         3      29000      40000      51000
         4      39000      54000      69000
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I have not done this yet. It is surely possible, but I do not know myself how to calculate inverse matrix. </p>
<p>To multiply matrix I could imagine :<br />
<pre><code>SQL&gt; create table m1 as
&nbsp;&nbsp;select 1 x, 1 y, 10 val from dual 
&nbsp;&nbsp;union all select 1,2,20 from dual
&nbsp;&nbsp;union all select 2,1,30 from dual
&nbsp;&nbsp;union all select 2,2,40 from dual
&nbsp;&nbsp;union all select 3,1,50 from dual
&nbsp;&nbsp;union all select 3,2,60 from dual
&nbsp;&nbsp;union all select 4,1,70 from dual
&nbsp;&nbsp;union all select 4,2,80 from dual;
Table created.
SQL&gt; create table m2 as
&nbsp;&nbsp;select 1 x, 1 y, 100 val from dual 
&nbsp;&nbsp;union all select 1,2,200 from dual
&nbsp;&nbsp;union all select 1,3,300 from dual
&nbsp;&nbsp;union all select 2,1,400 from dual
&nbsp;&nbsp;union all select 2,2,500 from dual
&nbsp;&nbsp;union all select 2,3,600 from dual;
Table created.
SQL&gt; select * from m1 pivot (max(val) for y in (1,2))

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2
---------- ---------- ----------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 40
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 60
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 70&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 80
SQL&gt; select * from m2 pivot (max(val) for y in (1,2,3))

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3
---------- ---------- ---------- ----------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;300
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;600
SQL&gt; select * from (
select * from dual model
reference 
&nbsp;&nbsp;m1 on (select * from m1) dimension by (x,y) measures (val)
reference 
&nbsp;&nbsp;m2 on (select * from m2) dimension by (x,y) measures (val)
reference 
&nbsp;&nbsp;dim1 on (select max(x) x,max(y) y, 0 dummy from m1) dimension by (dummy) measures (x,y)
reference 
&nbsp;&nbsp;dim2 on (select max(x) x,max(y) y, 0 dummy from m2) dimension by (dummy) measures (x,y)
dimension by (1 x,1 y) measures (0 val)
rules iterate (100) until (dim2.x[0]=iteration_number+1)
(val[for x from 1 to dim1.x[0] increment 1, for y from 1 to dim2.y[0] increment 1]=
nvl(val[cv(),cv()],0)+m2.val[iteration_number+1,cv(y)]*m1.val[cv(x),iteration_number+1] ))
pivot (max(val) for y in (1,2,3))

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3
---------- ---------- ---------- ----------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15000
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;26000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;33000
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;29000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;51000
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;39000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;54000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;69000
</code></pre></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Polarski bernard</title>
		<link>http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6150</link>
		<dc:creator>Polarski bernard</dc:creator>
		<pubDate>Mon, 07 Apr 2008 10:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6150</guid>
		<description>hummm... lemme think....really.....hummm...hard....hard.... Yes it is not evident.  The construct within the rule section is not cristal clear and I am lucky to have found the excellent tutorial of Joe on the  caluse model http://www.sqlsnippets.com/en/topic-11663.html.
And even,  this query is the soft version using the 11g pivot. I saw one without it for 10g with a bunch of connect by. Was fun, I gave up when I met the second connect by.

However, I vote for this query over the lsc2, this one has a palatable goal.
is it possible to do an inverse of matrix using the pivot and model clause ? that would be usefull, awfully complicated so that you put it in the interview under the nose of the candidate and ask what the query does.</description>
		<content:encoded><![CDATA[<p>hummm&#8230; lemme think&#8230;.really&#8230;..hummm&#8230;hard&#8230;.hard&#8230;. Yes it is not evident.  The construct within the rule section is not cristal clear and I am lucky to have found the excellent tutorial of Joe on the  caluse model <a href="http://www.sqlsnippets.com/en/topic-11663.html" rel="nofollow">http://www.sqlsnippets.com/en/topic-11663.html</a>.<br />
And even,  this query is the soft version using the 11g pivot. I saw one without it for 10g with a bunch of connect by. Was fun, I gave up when I met the second connect by.</p>
<p>However, I vote for this query over the lsc2, this one has a palatable goal.<br />
is it possible to do an inverse of matrix using the pivot and model clause ? that would be usefull, awfully complicated so that you put it in the interview under the nose of the candidate and ask what the query does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6149</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 07 Apr 2008 08:01:59 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6149</guid>
		<description>:-) I used math function quite economically to translate a list of numbers to a hex string ! One of the objective was to show obscure techniques. But well, I could do cal too :
&lt;code&gt;
select * from (
select * from dual model dimension by (0 day, 1 week) 
measures (0 c)
(
c[for day from 0 to 6 increment 1, for week from 0 to 4 increment 1]=
  1+trunc(trunc(sysdate,'MM'),'IW')-trunc(sysdate,'MM')+cv(day)+7*cv(week),
c[any,any]=case when c[cv(),cv()] between 
  1 and extract(day from last_day(sysdate)) then c[cv(),cv()] end))
pivot (max(c) for day in (
  0 as mon,1 as tue,2 as wed,3 as thu,4 as fri,5 as sat,6 as sun))
order by week;
&lt;/code&gt;

but is this really obscure?</description>
		<content:encoded><![CDATA[<p> <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> I used math function quite economically to translate a list of numbers to a hex string ! One of the objective was to show obscure techniques. But well, I could do cal too :<br />
<pre><code>
select * from (
select * from dual model dimension by (0 day, 1 week) 
measures (0 c)
(
c[for day from 0 to 6 increment 1, for week from 0 to 4 increment 1]=
&nbsp;&nbsp;1+trunc(trunc(sysdate,&#039;MM&#039;),&#039;IW&#039;)-trunc(sysdate,&#039;MM&#039;)+cv(day)+7*cv(week),
c[any,any]=case when c[cv(),cv()] between 
&nbsp;&nbsp;1 and extract(day from last_day(sysdate)) then c[cv(),cv()] end))
pivot (max(c) for day in (
&nbsp;&nbsp;0 as mon,1 as tue,2 as wed,3 as thu,4 as fri,5 as sat,6 as sun))
order by week;
</code></pre></p>
<p>but is this really obscure?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Polarski bernard</title>
		<link>http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6148</link>
		<dc:creator>Polarski bernard</dc:creator>
		<pubDate>Mon, 07 Apr 2008 06:54:01 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2008/04/obfuscation-contest.html#comment-6148</guid>
		<description>Objection, your honor : The query should be formated and have a least some sort of meaning like the one that produce a yearly calandar like unix command 'cal' (this one is really impressive).  Otherwise it is going to turn at who can pile the more regexp and math functions.</description>
		<content:encoded><![CDATA[<p>Objection, your honor : The query should be formated and have a least some sort of meaning like the one that produce a yearly calandar like unix command &#8216;cal&#8217; (this one is really impressive).  Otherwise it is going to turn at who can pile the more regexp and math functions.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
