<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Llayland's Food, Oracle, and Haskell</title>
	<atom:link href="http://llayland.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://llayland.wordpress.com</link>
	<description>Culinary, Database, and functional Delights</description>
	<lastBuildDate>Tue, 31 May 2011 06:36:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='llayland.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Llayland's Food, Oracle, and Haskell</title>
		<link>http://llayland.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://llayland.wordpress.com/osd.xml" title="Llayland&#039;s Food, Oracle, and Haskell" />
	<atom:link rel='hub' href='http://llayland.wordpress.com/?pushpress=hub'/>
		<item>
		<title>An example of circular programming</title>
		<link>http://llayland.wordpress.com/2011/05/31/an-example-of-circular-programming/</link>
		<comments>http://llayland.wordpress.com/2011/05/31/an-example-of-circular-programming/#comments</comments>
		<pubDate>Tue, 31 May 2011 06:36:12 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=73</guid>
		<description><![CDATA[Something clicked the other day and I was able to get past the mental block I had with circular programming. I was trying to optimize counting the transpositions between a sting and a permutation of that string. Earlier code left me at a nice starting point,where the pair of strings was represented as [[(Int,Int)]] with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=73&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Something clicked the other day and I was able to get past the mental block I had with circular programming.</p>
<p>I was trying to optimize counting the transpositions between a sting and a permutation of that string. Earlier code left me at a nice starting point,where the pair of strings was represented as [[(Int,Int)]] with the first Int being the position of a character in the first string and the second being the position of the same character int the permutation.  For example:</p>
<p><code>
<pre>
abcd_abcd = [ [(1,1)]
            , [(2,2)]
            , [(3,3)]
            , [(4,4)]
            ] :: [[(Int,Int)]]

abcd_acbd = [ [(1,1)]
            , [(2,3)]
            , [(3,2)]
            , [(4,4)]
            ] :: [[(Int,Int)]]

dcbaabcd_dbcaacbd = [ [(4,4),(5,5)]
                    , [(3,2),(6,7)]
                    , [(2,3),(7,6)]
                    , [(1,1),(8,8)]
                    ] :: [[(Int,Int)]]
</pre>
<p></code></p>
<p>One way to solve this is to concatenate the lists, sort by the first elements of the pairs, and then fold with a function that counts the changes in direction of the second elements of the pairs.  </p>
<p></code>
<pre>
foldl' f (GT,0,0) . map snd . sort . concat
   where f (dir, cnt,n) n' = (dir',  if dir = dir' then cnt else cnt +1, n')
         dir' = compare n' n
</pre>
<p><code></p>
<p>This works, but I wanted a one pass solution. I also didn't need a full sort, just the ability to access the next and previous match. I got stuck for quite a while before deciding to start with a two pass solution.  First I have a hashmap defined recursively in terms of itself.  I did not realize it at the time, but this is actually very similar to the fold above. The base case of the first element corresponds loosely to the initializer  and the recursive case corresponds to carrying of "dir" and "n" in the accumulating function</p>
<p><code>
<pre>
h :: [[(Int,Int)]] -&gt; HM.HashMap Int (Ordering, Ordering, Int)
h ms =  foldl (foldr f) HM.empty ms
   where h' = h ms
         f (key, val) = case key of
                          1 -&gt; HM.insert 1 (GT, GT, val)
                          n -&gt; let (old_dir, old_val) = find (n-1) in HM.insert n (old_dir, compare val old_val, val)
         find n = let (Just (dir, _, val)) = HM.lookup n h' in (dir, val)
</pre>
<p></code></p>
<p>Now I just need a second pass for the counting:<br />
<code>
<pre>

trans :: HM.HashMap Int (Ordering, Ordering, Int) -&gt; Int
trans = HM.fold f 0
  where f (old_dir, dir, _) c = if dir == old_dir then c else c+1
</pre>
<p></code><br />
This seems really easy in retrospect, but writing it involved a lot of false starts and felt like going down the rabbit hole.  Once I got done celebrating, moving on to a one pass solution was easy. I already knew I could have a structure that would have the preceding element available by the time I needed it. I just need one that also has the next element available by the time I need it. </p>
<p><code>
<pre>

h2 :: [[(Int,Int)]] -&gt; HM.HashMap Int (Ordering, Ordering, Int, Int)
h2 ms = foldl (foldr f ) HM.empty ms
   where h2' = h2 ms
         f (key, val) = case key of
                          1 -&gt;  HM.insert key (GT, GT, val, 0)
                          n -&gt; let (old_dir, old_val) = prev n
                                   new_c = next n
                                   dir = compare val old_val
                                   in HM.insert n (old_dir, dir, val, if old_dir == dir then new_c else new_c+1)
         prev n = let (Just (dir, _, val, _)) = HM.lookup (n-1) h2' in (dir, val)
         next n = case HM.lookup (n+1) h2' of
                       Nothing -&gt; 0
                       Just (_, _, _, c) -&gt; c 

trans2 ms = let (Just (_, _, _, c)) = HM.lookup 2 (h2 ms) in c
</pre>
<p></code>   </p>
<p>The correspondence to my original fold has broken down.  The base case is still the same, but now it looks like my recursive case is recursing in both directions at once. So why do I need to go both ways? If I accumulated upwards, I would not know where to look for the answer.  Accumulating downwards lets me always look at element 2.  Similarly, I can't calculate the direction changes downwards because I wouldn't know where to start.</p>
<p>My takeaways from this exercise are:</p>
<ol>
<li>Just pretend like you already have the structure you need</li>
<li>don't get caught up in how magical it seems.</li>
<li>don't overthink it. Assume it will work and do it	</li>
<ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=73&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2011/05/31/an-example-of-circular-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
		<item>
		<title>crazy rewrites</title>
		<link>http://llayland.wordpress.com/2010/12/10/crazy-rewrites/</link>
		<comments>http://llayland.wordpress.com/2010/12/10/crazy-rewrites/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 04:48:13 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=67</guid>
		<description><![CDATA[Jonathan Lewis&#8217;s posts on index joins inspired me to run a few test cases of my own. I thought it was pretty neat that the optimizer could split a single table query into a 6 way self join. It really blew my mind when I found it could do the reverse. I also found it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=67&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Jonathan Lewis&#8217;s posts on index joins inspired me to run a few test cases of my own. I thought it was pretty neat that the optimizer could split a single table query into a 6 way self join. It really blew my mind when I found it could do the reverse. I also found it quite cute that it does the opposite of what I tell it too. That&#8217;s just how stuff works for me.</p>
<p>This was run on a fresh install of the developer vm in VirtualBox:</p>
<p><b>Edit</b> &#8211; I really need to learn to preview.  Here is the corrected script and output<br />
<code>set echo on<br />
set linesize 200</p>
<p>drop table t1;</p>
<p>create table t1 (n1,n2,n3,n4,n5,n6,filler)<br />
nocache<br />
as<br />
select trunc(rownum/100),<br />
trunc(rownum/100),<br />
trunc(rownum/100),<br />
trunc(rownum/100),<br />
trunc(rownum/100),<br />
trunc(rownum/100),<br />
lpad(rownum, 1000, '0')<br />
from dual connect by level &lt;= 100000;</p>
<p>create bitmap index t1_n1 on t1(n1);<br />
create bitmap index t1_n2 on t1(n2);<br />
create bitmap index t1_n3 on t1(n3);<br />
create bitmap index t1_n4 on t1(n4);<br />
create bitmap index t1_n5 on t1(n5);<br />
create bitmap index t1_n6 on t1(n6);</p>
<p>call dbms_stats.gather_table_stats('SCOTT','T1');</p>
<p>set timing on;</p>
<p>set autotrace traceonly;</p>
<p>set arraysize 5000;</p>
<p>select n1,n2,n3,n4,n5,n6 from t1;</p>
<p>select a.n1, b.n2, c.n3, d.n4, e.n5, f.n6<br />
from t1 a, t1 b, t1 c, t1 d, t1 e, t1 f<br />
where a.rowid = all(b.rowid, c.rowid, d.rowid, e.rowid, f.rowid);<br />
</code></p>
<hr />
<p><code><br />
SQL&gt; select n1,n2,n3,n4,n5,n6 from t1;</code></p>
<p>100000 rows selected.</p>
<p>Elapsed: 00:00:01.65</p>
<p>Execution Plan<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Plan hash value: 362797529</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| Id  | Operation                         | Name             | Rows  | Bytes | Cost (%CPU)| Time     |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
|   0 | SELECT STATEMENT                  |                  |   100K|  2343K|  2018   (1)| 00:00:25 |<br />
|   1 |  VIEW                             | index$_join$_001 |   100K|  2343K|  2018   (1)| 00:00:25 |<br />
|*  2 |   HASH JOIN                       |                  |       |       |            |          |<br />
|*  3 |    HASH JOIN                      |                  |       |       |            |          |<br />
|*  4 |     HASH JOIN                     |                  |       |       |            |          |<br />
|*  5 |      HASH JOIN                    |                  |       |       |            |          |<br />
|*  6 |       HASH JOIN                   |                  |       |       |            |          |<br />
|   7 |        BITMAP CONVERSION TO ROWIDS|                  |   100K|  2343K|    11   (0)| 00:00:01 |<br />
|   8 |         BITMAP INDEX FULL SCAN    | T1_N1            |       |       |            |          |<br />
|   9 |        BITMAP CONVERSION TO ROWIDS|                  |   100K|  2343K|    11   (0)| 00:00:01 |<br />
|  10 |         BITMAP INDEX FULL SCAN    | T1_N2            |       |       |            |          |<br />
|  11 |       BITMAP CONVERSION TO ROWIDS |                  |   100K|  2343K|    11   (0)| 00:00:01 |<br />
|  12 |        BITMAP INDEX FULL SCAN     | T1_N3            |       |       |            |          |<br />
|  13 |      BITMAP CONVERSION TO ROWIDS  |                  |   100K|  2343K|    11   (0)| 00:00:01 |<br />
|  14 |       BITMAP INDEX FULL SCAN      | T1_N4            |       |       |            |          |<br />
|  15 |     BITMAP CONVERSION TO ROWIDS   |                  |   100K|  2343K|    11   (0)| 00:00:01 |<br />
|  16 |      BITMAP INDEX FULL SCAN       | T1_N5            |       |       |            |          |<br />
|  17 |    BITMAP CONVERSION TO ROWIDS    |                  |   100K|  2343K|    11   (0)| 00:00:01 |<br />
|  18 |     BITMAP INDEX FULL SCAN        | T1_N6            |       |       |            |          |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>Predicate Information (identified by operation id):<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>2 &#8211; access(ROWID=ROWID)<br />
3 &#8211; access(ROWID=ROWID)<br />
4 &#8211; access(ROWID=ROWID)<br />
5 &#8211; access(ROWID=ROWID)<br />
6 &#8211; access(ROWID=ROWID)</p>
<p>Statistics<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
1  recursive calls<br />
0  db block gets<br />
86  consistent gets<br />
0  physical reads<br />
0  redo size<br />
526501  bytes sent via SQL*Net to client<br />
628  bytes received via SQL*Net from client<br />
21  SQL*Net roundtrips to/from client<br />
0  sorts (memory)<br />
0  sorts (disk)<br />
100000  rows processed</p>
<p>SQL&gt;<br />
SQL&gt; select a.n1, b.n2, c.n3, d.n4, e.n5, f.n6<br />
2  from t1 a, t1 b, t1 c, t1 d, t1 e, t1 f<br />
3  where a.rowid = all(b.rowid, c.rowid, d.rowid, e.rowid, f.rowid);</p>
<p>100000 rows selected.</p>
<p>Elapsed: 00:00:07.78</p>
<p>Execution Plan<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Plan hash value: 3617692013</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
|   0 | SELECT STATEMENT  |      |   100K|  3515K|  3919   (1)| 00:00:48 |<br />
|   1 |  TABLE ACCESS FULL| T1   |   100K|  3515K|  3919   (1)| 00:00:48 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Statistics<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
1  recursive calls<br />
0  db block gets<br />
14307  consistent gets<br />
14286  physical reads<br />
0  redo size<br />
103737103  bytes sent via SQL*Net to client<br />
628  bytes received via SQL*Net from client<br />
21  SQL*Net roundtrips to/from client<br />
0  sorts (memory)<br />
0  sorts (disk)<br />
100000  rows processed</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=67&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2010/12/10/crazy-rewrites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
		<item>
		<title>Thanks Computer Junkyard</title>
		<link>http://llayland.wordpress.com/2009/02/12/thanks-computer-junkyard/</link>
		<comments>http://llayland.wordpress.com/2009/02/12/thanks-computer-junkyard/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 05:46:52 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=62</guid>
		<description><![CDATA[Just a quick thank you to Computer Junkyard I had a great experience there today. If you are in or around Tampa, please check them out.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=62&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just a quick thank you to <A>Computer Junkyard</a> I had a great experience there today.</p>
<p>If you are in or around Tampa, please check them out.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=62&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2009/02/12/thanks-computer-junkyard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
		<item>
		<title>Understanding Monads I</title>
		<link>http://llayland.wordpress.com/2009/01/21/understanding-monads-i/</link>
		<comments>http://llayland.wordpress.com/2009/01/21/understanding-monads-i/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 05:39:02 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=57</guid>
		<description><![CDATA[It turns out that understanding monads is even harder than finding the time to write about monads. I don&#8217;t want to waste this opportunity, so I&#8217;m just going to make it up as I go along. For me to really have a motivation to understand something, I need to see a need for it. So [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=57&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It turns out that understanding monads is even harder than finding the time to write about monads.  I don&#8217;t want to waste this opportunity, so I&#8217;m just going to make it up as I go along.</p>
<p>For me to really have a motivation to understand something, I need to see a need for it. So just what good are monads anyways? The first thing I thought of was you can view monads as models to evaluate functions, that are  defined with the monadic operators, under.  Admittedly this is stupidly simple example but I&#8217;m at the stupidly simple stage of learning:</p>
<p>&gt; let failOn0 n = n &gt;&gt;= \x -&gt; if x == 0 then fail &#8220;zero&#8221; else return x</p>
<p>This seems tailor made to evaluate under the Maybe monad which models possible failure:</p>
<p>&gt; failOn0 (Just 1)<br />
Just 1<br />
&gt; failOn0 (Just 0)<br />
Nothing</p>
<p>You could also evaluate under the List monad which models non-deterministic choice. Basically, you get back all possible results:</p>
<p>&gt; failOn0 [1,2,3]<br />
[1,2,3]<br />
&gt; failOn0 [0,2,3]<br />
[2,3]<br />
&gt; failOn0 [0,0,0]<br />
[]</p>
<p>Finally you could evaluate it under the Identity monad which models variable substitution.  This one is a little different because it can really fail:</p>
<p>&gt; failOn0 (Id 1)<br />
Id 1</p>
<p>&gt;failOn0 (Id 0)</p>
<p>*** Exception: zero</p>
<p>So I can write one function and evaluate it several different ways.  That&#8217;s enough of a reason for me to dig in deeper.  Now I&#8217;d suggest reading <a href="http://www.haskell.org/haskellwiki/Monads_as_Containers">Monads as containers</a> for good explanation of writing simple monads. Then I would write Identity Monad and the Tree Monad on paper. I would follow that up by writing the reductions for several examples of fmap, join, and &gt;&gt;= on paper.  And yes, I really do mean on paper.</p>
<p>I just finish the paper exercizes today and I think I have a good handle it. I think I can almost tackle part II where I will get into more of the usefulness of monads, conditioning myself to what &gt;&gt;= really means, and the state monad.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=57&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2009/01/21/understanding-monads-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
		<item>
		<title>Bitter Gourd Curry (Indian/Thai Fusion)</title>
		<link>http://llayland.wordpress.com/2008/09/13/bitter-gourd-curry-indianthai-fusion/</link>
		<comments>http://llayland.wordpress.com/2008/09/13/bitter-gourd-curry-indianthai-fusion/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 21:44:51 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=23</guid>
		<description><![CDATA[Here&#8217;s another recipe I dug up that was very popular at work.  This was my second attempt at making bitter gourd. The stuff is difficult to work with since it is so incredibly bitter.  Honestly, this was still a bit too bitter for me, but it was a big hit for the people that were [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=23&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s another recipe I dug up that was very popular at work.  This was my second attempt at making bitter gourd. The stuff is difficult to work with since it is so incredibly bitter.  Honestly, this was still a bit too bitter for me, but it was a big hit for the people that were used to other bitter gourd dishes.</p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">Here is my best shot at a recipe for the curry. I almost never measure anything, so you have to use your judgment.</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">1) Mix in a large zip loc bag to marinate at least overnight:</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">3 chinese bitter gourd, diced. each about the size of a large cucumber.</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">1 handful raw bird chilies, rough chopped</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">1/2 to 1 bulb of garlic sliced thick</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">canola oil to cover and toasted sesame oil for flavor</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">salt</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">cracked black pepper</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">2) Ingredients</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">strained oil from marinade</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">1 handful raw bird chilies, sliced lengthwise</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">dried red pepper flakes (to taste for extra heat, but do use some as they have a different flavor than the bird chiles)</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">4-5 kaffir lime leaf (fresh, dried is pointless)</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">3-4 bay leaf (dried)</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">1/2 can red curry paste (yes, I cheated a little bit since I was in a hurry)</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">black mustard seed &#8211; No clue how much, probably enough to cover the bottom of the pan about 30-40%</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">powdered cumin &#8211; a lot of this, probably about a heaping palmful.  I kept having to add more to get the flavor right</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">cinamon &#8211; not to much, it is just there to accent the cumin</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">8-12 baby bok choy washed, whites diced and greens left whole &#8211; I had used the whites for another dish, but they would be fine in the curry if diced finely</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">1/2 to 1 bulb garlic sliced thick</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">bitter gourd, chile, and garlic from marinade</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">natural sugar (the brown crystals) &#8211; about 3/8 cup, but I might reduce this to 1/4 cup since it was a bit on the sweet side</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">cream of coconut</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">rice wine vinegar</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">asefoetida &#8211; enought to lightly cover the pan</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">3) Method</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">drain the oil from the marinade into a large skillet.  Avoid getting much of the juice from the bitter melon in the skillet to avoid splattering, but do not discard the juice.</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">add chiles, red pepper flaeks, mustard, cumin, cinamon, bay leaf,  kaffir lime leaf, and curry paste.</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">Turn on the burner to a low to medium low heat. You want to let the oil come up to temperature slowly to allow the flavors to infuse and to minimize splattering from any liquids from in the oil. </span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">When the oil get to temperature add the garlic, bitter gourd with juice, whites from the bok choy and salt to taste -then turn the burner up to medium high.</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">Cook until the gourd is tender (probably 7 to 10 minutes) stirring occasionally</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">taste and reseason if needed &#8211; I had to add more cumin, cinamon, and salt here</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">Pour off excess oil into a jar to save (do leave some in the skillet)</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">stir the greens into the mixture until they are wilted (less than a minute) </span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">add sugar and stir until thoroughly dissolved</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">give it a good sprinkling of the rice wine vinegar</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">sprinkle asefoetida powder over the entire skillet.  I used a good amount because I felt the dish was lacking pungency.</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">stir, taste and reseason or add more vinegar if needed</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">mix in enough cream of coconut to thicken the sauce. the cream of coconut also serves to bring all the flavors together and tone down some of the bitterness.  start with a small amount and add more if needed.</span></span><span style="font-size:x-small;font-family:Tahoma;"></span></p>
<p class="MsoNormal"><span style="font-size:x-small;font-family:Tahoma;"><span style="font-size:10pt;font-family:Tahoma;"> </span></span></p>
<p><span style="font-size:x-small;font-family:Arial;"><span style="font-size:10pt;font-family:Arial;">I think that is pretty much how I made it.  Next time I&#8217;d like to add some fresh curry leaves.  The excess oil is also very good, especially for roasting potatoes.<br />
</span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/llayland.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/llayland.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=23&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2008/09/13/bitter-gourd-curry-indianthai-fusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
		<item>
		<title>Okra Coconut Curry (sort of)</title>
		<link>http://llayland.wordpress.com/2008/09/13/okra-coconut-curry-sort-of/</link>
		<comments>http://llayland.wordpress.com/2008/09/13/okra-coconut-curry-sort-of/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 21:32:26 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=18</guid>
		<description><![CDATA[5 cups Okra sliced into rounds handful of mustard seed hing  (Asafoetida) powder 2 tbsp oil 1/2 grated coconut (not the sweetened kind) handful of green chiles 6 garlic cloves, sliced 1 tsp tamarind paste 1 cup water 1 8oz can of coconut cream a two fingered ping of dried methi leaves What&#8217;s the most [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=18&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<ul>
<li> 5 cups Okra sliced into rounds</li>
<li>handful of mustard seed</li>
<li>hing  (<img src="/WINDOWS/TEMP/moz-screenshot-2.jpg" alt="" />Asafoetida) powder</li>
<li>2 tbsp oil</li>
<li>1/2 grated coconut (not the sweetened kind)</li>
<li>handful of green chiles</li>
<li>6 garlic cloves, sliced</li>
<li>1 tsp tamarind paste</li>
<li>1 cup water</li>
<li>1 8oz can of coconut cream</li>
<li>a two fingered ping of dried methi leaves</li>
</ul>
<p>What&#8217;s the most important question you can ask yourself while cooking? If you are anything like me, it is &#8220;How do I fix this?&#8221; I can&#8217;t seem to get through a dish without making at least one mistake.  Thankfully I&#8217;m good at the fix it game and I usually manage to turn the problem into a plus. Here is one example:</p>
<p>I had a nice bag of okra, so I set out to make the <a href="http://www.aayisrecipes.com/2006/04/19/bhindi-curry-bhende-olli-mirsangi-ambat/">Okra Curry</a> I found on <a href="http://www.aayisrecipes.com/">Aayi&#8217;s Recipes</a>.  My first mistake was forgetting to buy curry leaves. I&#8217;d been to three stores already and didn&#8217;t feel like going out again so I decided to go ahead without them.  The second was thinking that I had a large bag of shredded coconut in the freezer.  It turned out to be about a half a cup.  Thankfully I had a can of coconut cream in the pantry that did the trick. The third was forgetting to add the tamarind paste. I had to dissolve it is a quarter cup of water that I boiled in the microwave to make it easy to blend into the finished dish. Despite all this it turned out really well.</p>
<p>So this is how it should have gone:</p>
<ol>
<li>grind the chilies and coconut into a paste</li>
<li>fry the mustard seed in the oil until it begins to pop</li>
<li>add the okra and garlic, sprinkle liberally with hing, and saute until about halfway done</li>
<li>add the coconut chili mixture, saute for a minute or two</li>
<li>add the water and tamarind paste, stir until the paste is dissolved</li>
<li>add the coconut cream and cook until okra is almost done</li>
<li>add the methi leaves and simmer for a minute or two</li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/llayland.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/llayland.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=18&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2008/09/13/okra-coconut-curry-sort-of/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
		<item>
		<title>A quick gripe</title>
		<link>http://llayland.wordpress.com/2008/08/14/a-quick-gripe/</link>
		<comments>http://llayland.wordpress.com/2008/08/14/a-quick-gripe/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 05:14:34 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=15</guid>
		<description><![CDATA[I really did not want the Oracle section of this blog to be my whining about all the nasty things Oracle does to me. It is just hard to find the time and motivation to write up anything positive when I run into three new (to me at least) bugs in three days. So, I&#8217;m [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=15&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I really did not want the Oracle section of this blog to be my whining about all the nasty things Oracle does to me. It is just hard to find the time and motivation to write up anything positive when I run into three new (to me at least) bugs in three days. So, I&#8217;m going to gripe:</p>
<p>I hit the bug in metalink note 469587.1 where &#8220;Error PLS-00167 : keyword BULK is used in a wrong context&#8221; is raised with an incorrect interval literal.  Of course, I had to come up with a unique twist of my own.  Apparently this:</p>
<p><code>INTERVAL '.1' SECOND</code></p>
<p>is not valid and should be:</p>
<p><code>INTERVAL '0.1' SECOND</code></p>
<p>The other thing I ran into is that binds of objects tend to cause bugs.  This applies to both explicit binds in dynamic sql and the implicit binds of pl/sql variables in sql statements. I&#8217;ll write up a good post sometime soon, but for now just note that the type information seems to get lost and that using the treat function around the bound variable to get the type information back seems to fix things.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/llayland.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/llayland.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=15&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2008/08/14/a-quick-gripe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
		<item>
		<title>Indian style vegetarian &#8220;tamales&#8221;</title>
		<link>http://llayland.wordpress.com/2008/08/08/indian-style-vegetarian-tamales/</link>
		<comments>http://llayland.wordpress.com/2008/08/08/indian-style-vegetarian-tamales/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 04:59:59 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=10</guid>
		<description><![CDATA[I haven&#8217;t made anything terribly exciting lately, so I thought I go back a few months to a dish I made that was a big hit at the office. I had been reading a couple of food blogs and two items stuck in my mind: Cholkya vayli bhakri &#8211; A roti made on banana leaf [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=10&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t made anything terribly exciting lately, so I thought I go back a few months to a dish I made that was a big hit at the office. I had been reading a couple of food blogs and two items stuck in my mind:</p>
<ul>
<li>Cholkya vayli bhakri &#8211; A roti made on banana leaf</li>
<li>vaygana bajji &#8211; Smoked eggplant</li>
</ul>
<p>The eggplants paticularly caught my eye because I had promissed some of my vegetarian coworkers that I would try to find something I could make them on my smoker. The roti appealled to me as it finally gave me a use for my apparently sterile banana trees. Unfortunately, I was extremely busy at the time and didn&#8217;t have any time to spare in the kitchen. Finally, I decided that I needed to give it a rest a do something I enjoy.  In spite of the fact that I was extremely tired, or maybe because of it, I came up with a great idea, &#8220;Why not combine the two recipes?&#8221; This saved my the effort of frying all the rotis while allowing much more flavor from the banana leaves and smoke into the dish.</p>
<p>I&#8217;ve rambled on enough; here is the recipe:</p>
<p>2 cups (less 4 tbps) all purpose flour (Maida)<br />
4 tbsp corn starch<br />
1 13.5oz can of cream of coconut<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
mix into a loose batter</p>
<p>good amount of black mustard seed<br />
good amount of dried red pepper<br />
1 black cardomon pod<br />
1 clove garlic<br />
2 tsp tomato curry<br />
salt<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
mash into a paste</p>
<p>2 large eggplants<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
smoke low and slow (225 degrees) until softened, then blacken over direct flame<br />
remove skin and some seeds<br />
smoke cleaned eggplant to remove excess moisture<br />
mash lightly with above paste, should be very chunky</p>
<p>cut squares of fresh banana leaf 4-5 inches<br />
scoop batter onto each leaf. just scoop it in the middle and spread lightly- should be about 2/3 covered (round). place a dollop of eggplant mixture in the batter round, about 2/3 of the way across. pick up the near edge of the leaf and fold it over so near end of the round covers the eggplant mixture and overshoots the other other end a little<br />
press down lightly and pull towards you to create a tube of filling.<br />
fold that tube forward over the two edges (should be roughly together)<br />
smoke low and slow for a couple of hours until the batter sets<br />
increase temperature to 400 degrees for about 20 minutes to finish them off<br />
A note on smoking:</p>
<p>If you don&#8217;t have a smoker, you can use a  grill  just make sure to keep the coals to one side and the food to the other so you get indirect heat. I&#8217;d recommend using larger chunks of wood, but chips will work as well. I believe I used  hickory, pecan, and cherry which gives a nice blended flavor.  That would have been overkill just for the tamales, so I had the other half of the smoker filled with mojo marinated chicken quarters.  Plain old oak and most other woods would have been fine as well.  I&#8217;d recommend against mesquite as it could be overpowering<br />
2 cups (less 4 tbps) all purpose flour (Maida)<br />
4 tbsp corn starch<br />
1 13.5oz can of cream of coconut<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
mix into a loose batter</p>
<p>good amount of black mustard seed<br />
good amount of dried red pepper<br />
1 black cardomon pod<br />
1 clove garlic<br />
2 tsp tomato curry<br />
salt<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
mash into a paste</p>
<p>2 large eggplants<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
smoke low and slow (225 degrees) until softened, then blacken over direct flame<br />
remove skin and some seeds<br />
smoke cleaned eggplant to remove excess moisture<br />
mash lightly with above paste, should be very chunky</p>
<p>cut squares of fresh banana leaf 4-5 inches<br />
scoop batter onto each leaf. just scoop it in the middle and spread lightly- should be about 2/3 covered (round). place a dollop of eggplant mixture in the batter round, about 2/3 of the way across. pick up the near edge of the leaf and fold it over so near end of the round covers the eggplant mixture and overshoots the other other end a little<br />
press down lightly and pull towards you to create a tube of filling.<br />
fold that tube forward over the two edges (should be roughly together)<br />
smoke low and slow for a couple of hours until the batter sets<br />
increase temperature to 400 degrees for about 20 minutes to finish them off</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/llayland.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/llayland.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=10&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2008/08/08/indian-style-vegetarian-tamales/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
		<item>
		<title>Default precision fractional for timestamp datatype is 6. Huh?</title>
		<link>http://llayland.wordpress.com/2008/08/07/default-precision-fractional-for-timestamp-datatype-is-6-huh/</link>
		<comments>http://llayland.wordpress.com/2008/08/07/default-precision-fractional-for-timestamp-datatype-is-6-huh/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 06:09:03 +0000</pubDate>
		<dc:creator>llayland</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://llayland.wordpress.com/?p=6</guid>
		<description><![CDATA[I&#8217;ve always read that the default precision for timestamps was 6. From &#8220;Oracle® Database SQL Language Reference 11g Release 1 (11.1) Part Number B28286-03 TIMESTAMP Datatype The TIMESTAMP datatype is an extension of the DATE datatype. It stores the year, month, and day of the DATE datatype, plus hour, minute, and second values. This datatype [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=6&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always read that the default precision for timestamps was 6.</p>
<p>From &#8220;Oracle® Database SQL Language Reference 11g Release 1 (11.1) Part Number B28286-03</p>
<blockquote><p>TIMESTAMP Datatype</p>
<p>The TIMESTAMP datatype is an extension of the DATE datatype. It stores the year, month, and day of the DATE datatype, plus hour, minute, and second values. This datatype is useful for storing precise time values. Specify the TIMESTAMP datatype as follows:</p>
<p>TIMESTAMP [(fractional_seconds_precision)]</p>
<p>where fractional_seconds_precision optionally specifies the number of digits Oracle stores in the fractional part of the SECOND datetime field. When you create a column of this datatype, the value can be a number in the range 0 to 9. The default is 6.</p></blockquote>
<p>I found a fun little case where the default precision is 0. It was the end of a long day when I did something similar to this:</p>
<p><code></p>
<p style="padding-left:30px;">SQL&gt; create or replace type timestamp_tab as table of timestamp;<br />
2  /</p>
<p style="padding-left:30px;">Type created.</p>
<p style="padding-left:30px;">SQL&gt;<br />
SQL&gt; create or replace function get_ts return timestamp_tab<br />
2  is<br />
3     retval timestamp_tab;<br />
4  begin<br />
5     select<br />
6               to_timestamp('20080102','YYYYMMDD')<br />
7               + interval '0.1' second * (rownum - 2)<br />
8     bulk collect into retval<br />
9     from dual<br />
10     connect by level &lt;= 3;<br />
11<br />
12     return retval;<br />
13  end get_ts;<br />
14  /</p>
<p style="padding-left:30px;">Function created.</p>
<p style="padding-left:30px;">SQL&gt;<br />
SQL&gt; begin<br />
2     for rec in (select * from table(get_ts)) loop<br />
3        dbms_output.put_line(rec.column_value);<br />
4        dbms_output.put_line(to_char(rec.column_value, 'FF'));<br />
5     end loop;<br />
6  end ;<br />
7  /<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000</p>
<p style="padding-left:30px;">PL/SQL procedure successfully completed.</p>
<p></code></p>
<p>Strange, I&#8217;ve lost my fractional seconds. Maybe I need to explicitly set the precision in my type:</p>
<p style="padding-left:30px;"><code><br />
SQL&gt; create or replace type timestamp_tab as table of timestamp(4);<br />
2  /Type created.</p>
<p style="padding-left:30px;">SQL&gt;<br />
SQL&gt; begin<br />
2     for rec in (select * from table(get_ts)) loop<br />
3        dbms_output.put_line(rec.column_value);<br />
4        dbms_output.put_line(to_char(rec.column_value, 'FF'));<br />
5     end loop;<br />
6  end ;<br />
7  /<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000</p>
<p style="padding-left:30px;">PL/SQL procedure successfully completed.</p>
<p style="padding-left:30px;">
<p></code></p>
<p>No dice. Let&#8217;s go back to basics to make sure I&#8217;m not just braindead at this point:</p>
<p style="padding-left:30px;"><code><br />
SQL&gt; begin<br />
2     dbms_output.put_line(<br />
3        to_timestamp('20080102','YYYYMMDD') + interval '0.1' second * -1<br />
4     );<br />
5  end;<br />
6  /<br />
2008-01-01 23:59:59.900000000PL/SQL procedure successfully completed.</p>
<p style="padding-left:30px;">SQL&gt;<br />
SQL&gt; begin<br />
2     for rec in (<br />
3        select to_timestamp('20080102','YYYYMMDD')<br />
4               + interval '0.1' second * -1 ts<br />
5        from dual<br />
6     ) loop<br />
7        dbms_output.put_line(rec.ts);<br />
8     end loop;<br />
9  end;<br />
10  /<br />
2008-01-01 23:59:59.900000000</p>
<p style="padding-left:30px;">PL/SQL procedure successfully completed.</p>
<p></code></p>
<p style="padding-left:30px;">
<p>So, I do normally get six digits by default.  Maybe it is a bulk collect issue?</p>
<p style="padding-left:30px;"><code><br />
SQL&gt; create or replace function get_ts2 return timestamp_tab<br />
2  is<br />
3     retval timestamp_tab := timestamp_tab();<br />
4  begin<br />
5     retval.extend(3);<br />
6<br />
7     for rec in (<br />
8        select rownum n,<br />
9               to_timestamp('20080102','YYYYMMDD')<br />
10               + interval '0.1' second * (rownum - 2) ts<br />
11        from dual<br />
12        connect by level &lt;= 3<br />
13     ) loop<br />
14        retval(rec.n) := rec.ts;<br />
15     end loop;<br />
16     return retval;<br />
17  end get_ts2;<br />
18  /Function created.</p>
<p style="padding-left:30px;">SQL&gt;<br />
SQL&gt; begin<br />
2     for rec in (select * from table(get_ts2)) loop<br />
3        dbms_output.put_line(rec.column_value);<br />
4        dbms_output.put_line(to_char(rec.column_value, 'FF'));<br />
5     end loop;<br />
6  end ;<br />
7  /<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000</p>
<p style="padding-left:30px;">PL/SQL procedure successfully completed.</p>
<p></code></p>
<p>Nope.  Maybe an explicit cursor?</p>
<p style="padding-left:60px;"><code><br />
SQL&gt;<br />
SQL&gt; declare<br />
2     cursor ts_cur is<br />
3     select * from table(get_ts);<br />
4  begin<br />
5     for rec in ts_cur loop<br />
6        dbms_output.put_line(rec.column_value);<br />
7        dbms_output.put_line(to_char(rec.column_value, 'FF'));<br />
8     end loop;<br />
9  end ;<br />
10  /<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000PL/SQL procedure successfully completed.</p>
<p></code></p>
<p style="padding-left:60px;">
<p>Nope.  Hmm, I vaguely remember that you can declare the return type of a cursor but I&#8217;ve never had to do it before.</p>
<p style="padding-left:60px;"><code><br />
SQL&gt;<br />
SQL&gt; declare<br />
2     type ts_rec is record(ts timestamp);<br />
3     cursor ts_cur return ts_rec is<br />
4     select column_value from table(get_ts);<br />
5  begin<br />
6     for rec in ts_cur loop<br />
7        dbms_output.put_line(rec.ts);<br />
8        dbms_output.put_line(to_char(rec.ts, 'FF'));<br />
9     end loop;<br />
10  end ;<br />
11  /<br />
2008-01-01 23:59:59.900000<br />
900000000<br />
2008-01-02 00:00:00.000000<br />
000000000<br />
2008-01-02 00:00:00.100000<br />
100000000PL/SQL procedure successfully completed.</p>
<p></code></p>
<p>Aha, so the default precision for a timestamp when returned from a table function into a cursor is 0. Just for grins:</p>
<p style="padding-left:60px;"><code><br />
SQL&gt;<br />
SQL&gt; declare<br />
2     type ts_rec is record(ts timestamp(0));<br />
3     cursor ts_cur return ts_rec is<br />
4     select column_value from table(get_ts);<br />
5  begin<br />
6     for rec in ts_cur loop<br />
7        dbms_output.put_line(rec.ts);<br />
8        dbms_output.put_line(to_char(rec.ts, 'FF'));<br />
9     end loop;<br />
10  end ;<br />
11  /<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000<br />
2008-01-02 00:00:00.<br />
000000000PL/SQL procedure successfully completed.</p>
<p></code></p>
<p style="padding-left:60px;">
<p>So, problem solved.  Hopefully this will save someone out there some time and head scratching.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/llayland.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/llayland.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/llayland.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/llayland.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/llayland.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/llayland.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/llayland.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/llayland.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/llayland.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/llayland.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/llayland.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/llayland.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/llayland.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/llayland.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/llayland.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/llayland.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=llayland.wordpress.com&amp;blog=3985948&amp;post=6&amp;subd=llayland&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://llayland.wordpress.com/2008/08/07/default-precision-fractional-for-timestamp-datatype-is-6-huh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3f8ce982ee226b5e8fb0f2892e612039?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">llayland</media:title>
		</media:content>
	</item>
	</channel>
</rss>
