<?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/"
	>

<channel>
	<title>Matt Oldham &#187; Development</title>
	<atom:link href="http://www.mattoldham.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattoldham.com</link>
	<description>...on the temporal and eternal</description>
	<lastBuildDate>Wed, 01 Jun 2011 16:37:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Site Updates</title>
		<link>http://www.mattoldham.com/2011/06/site-updates/</link>
		<comments>http://www.mattoldham.com/2011/06/site-updates/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 16:35:59 +0000</pubDate>
		<dc:creator>-Matt-</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.mattoldham.com/?p=191</guid>
		<description><![CDATA[I&#8217;m in the middle of testing a couple of new WordPress themes at the moment, so please bear with me.  I wanted to go with something a litte more readable.  I really like the ElegantGrunge theme by Michael Tyson, which I have been using since the site went live, but I think it&#8217;s time to simplify a little more.  We&#8217;ll see which new theme wins out ultimately.  I&#8217;ll take suggestions&#8230;]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in the middle of testing a couple of new WordPress themes at the moment, so please bear with me.  I wanted to go with something a litte more readable.  I really like the ElegantGrunge theme by <a href="http://technomadics.net/" target="_blank">Michael Tyson</a>, which I have been using since the site went live, but I think it&#8217;s time to simplify a little more.  We&#8217;ll see which new theme wins out ultimately.  I&#8217;ll take suggestions&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattoldham.com/2011/06/site-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating Age Based on Date of Birth in SQLite</title>
		<link>http://www.mattoldham.com/2011/05/calculating-age-based-on-date-of-birth-in-sqlite/</link>
		<comments>http://www.mattoldham.com/2011/05/calculating-age-based-on-date-of-birth-in-sqlite/#comments</comments>
		<pubDate>Tue, 31 May 2011 16:07:20 +0000</pubDate>
		<dc:creator>-Matt-</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.mattoldham.com/?p=170</guid>
		<description><![CDATA[On a recent project I needed to calculate a person&#8217;s age relative to the system date based on an input value of a birth date.  In this particular scenario I needed to do so using the SQLite engine, and the specific requirement was to calculate age using the following logic: If person is younger than 1 month, present the age in days (e.g. 30 days) If person is 1 month or older but younger than [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">On a recent project I needed to calculate a person&#8217;s age relative to the system date based on an input value of a birth date.  In this particular scenario I needed to do so using the SQLite engine, and the specific requirement was to calculate age using the following logic:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If person is younger than 1 month, present the age in days (e.g. 30 days)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If person is 1 month or older but younger than 2 months, present the age in weeks (e.g. 8 wks)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If person is 2 months or older but younger than one year, present the age in months (e.g. 3 mos)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If person is 1 year or older, present the age in years (e.g. 2 yrs)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">My initial thought was obviously &lt;i&gt;not&lt;/i&gt; to reinvent the wheel, so I did what any logical database guy would do &#8211; I consulted the SQLite documentation for what I expected to be a plethora of date-specific SQL functions I could leverage.  After all, other RDBMS implementations offer direct support for the functionality I needed.  PostgreSQL, for example offers the age function (http://www.postgresql.org/docs/9.0/static/functions-datetime.html).</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If you are familiar at all with SQLite you have probably been faced with the interesting implementation of dynamic data types.  One example of this is the fact that there is no native &#8220;date&#8221; data type.  One nuance that stems from this implementation is the seemingly limited set of options when it comes to date functions &#8211; at least upon initial observation.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">I found a number of posts (like this one http://stackoverflow.com/questions/3123951/sqlite-how-to-calculate-age-from-birth-date) that discussed calculating such date values using the built-in SQLite functions, however they fell short in getting to the granularity I needed.  Other posts (such as this one http://www.mail-archive.com/sqlite-users@sqlite.org/msg20531.html) suggested writing my own custom SQLite function in C.  This was not an option since my particular requirement relied on using the SQLite implementation inside the context of the Adobe Flash player.  So, I was ultimately left to fend for myself, and this kind of challenge is what developers sometimes need to stoke their initiative and get their creative wheels turning.  It definitely worked for me, not that I needed the motivation <img src='http://www.mattoldham.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Before I started, I knew that I would need a decent set of data against which to test my SQL.  As I typically tend to do for such needs, I fired up Microsoft Excel and generated a list of dates along with their corresponding years/months/days calculations using basic Excel functions.  I then turned the resulting Excel data into SQL INSERT statements and loaded them into a SQLite table named AGE_TEST for testing.  Here&#8217;s an excerpt of the Excel data, based on my local system date of 5/31/2011:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">
<pre class="brush: plain; title: ;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;DOB      Years  Months  Days&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;9/11/05      5       8    20&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;1/1/10       1       4    30&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;1/2/10       1       4    29&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;...&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;5/29/11      0       0     2&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;5/30/11      0       0     1&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;5/31/11      0       0     0&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;</pre>
</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">And here are the respective Excel formulae I used:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">
<pre class="brush: plain; title: ;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;Years:  =DATEDIF(A2,TODAY(),&quot;Y&quot;)&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;Months: =DATEDIF(A7,TODAY(),&quot;YM&quot;)&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;Days:   =DATEDIF(A7,TODAY(),&quot;MD&quot;)&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;</pre>
</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">After a bit of trial and error, I finally ended up with something that worked across all of my test dates.  Admittedly (as you can probably tell from the code), the months calculation was the most challenging.  Here&#8217;s the SQL solution I ended up with:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">
<pre class="brush: sql; title: ;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;SELECT CASE&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;/* DOB is beyond current date */&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN dob &gt; date('now') THEN NULL&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;/* DOB equal to current date */&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN dob = date('now') THEN '0 days'&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;/* subject is less that 1 month old */&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-1 month') &lt; dob THEN CAST((julianday('now') - julianday(dob)) AS INTEGER) || ' days'&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;/* subject is less that 2 months old */&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-2 month') &lt; dob THEN CAST((julianday('now') - julianday(dob))/7 AS INTEGER) || ' wks'&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;/* subject is less than 1 year old */&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-1 year') &lt; dob THEN&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;CASE&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-11 month') &gt;= dob then 11&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-10 month') &gt;= dob then 10&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-9 month') &gt;= dob then 9&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-8 month') &gt;= dob then 8&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-7 month') &gt;= dob then 7&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-6 month') &gt;= dob then 6&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-5 month') &gt;= dob then 5&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-4 month') &gt;= dob then 4&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-3 month') &gt;= dob then 3&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-2 month') &gt;= dob then 2&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN date('now','-1 month') &gt;= dob then 1&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;END || ' mos'&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;/* subject is 1 year or older */&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;ELSE ((strftime('%Y', 'now') - strftime('%Y', dob)) -&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;(CASE&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;WHEN (strftime('%m', dob) &lt; strftime('%m', 'now')) OR&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;(strftime('%m', dob) = strftime('%m', 'now') AND&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;strftime('%d', dob) &lt;= strftime('%d', 'now')) THEN 0&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;ELSE 1&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;END)) || ' yrs'&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;END AS person_age&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;FROM (SELECT dob&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;FROM age_test)&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot; style=&quot;position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;&quot;&gt;</pre>
</div>
<div>On a recent project I needed to calculate a person&#8217;s age relative to the system date based on an input value of a birth date.  In this particular scenario I needed to do so using the SQLite engine, and the specific requirement was to calculate age using the following logic:</div>
<div>
<ul>
<li>If person is younger than 1 month, present the age in days (e.g. 30 days)</li>
<li>If person is 1 month or older but younger than 2 months, present the age in weeks (e.g. 8 wks)</li>
<li>If person is 2 months or older but younger than one year, present the age in months (e.g. 3 mos)</li>
<li>If person is 1 year or older, present the age in years (e.g. 2 yrs)</li>
</ul>
</div>
<p><span id="more-170"></span>My initial thought was obviously to <em>not</em> reinvent the wheel, so I did what any logical database guy would do &#8211; I consulted the <a href="http://www.sqlite.org/datatype3.html" target="_blank">SQLite documentation</a> for what I expected to be a plethora of date-specific SQL functions I could leverage.  After all, other RDBMS implementations offer direct support for the functionality I needed.  PostgreSQL, for example offers the <a href="http://www.postgresql.org/docs/9.0/static/functions-datetime.html" target="_blank">age</a> function.</p>
<div>If you are familiar at all with SQLite you have probably been faced with the interesting implementation of dynamic data types.  One example of this is the fact that there is no native &#8220;date&#8221; data type.  One nuance that stems from this implementation is the seemingly limited set of options when it comes to date functions &#8211; at least upon initial observation.</div>
<p>I found a number of posts (like <a href="http://stackoverflow.com/questions/3123951/sqlite-how-to-calculate-age-from-birth-date" target="_blank">this</a> one) that discussed calculating such date values using the built-in SQLite functions, however they fell short in getting to the granularity I needed.  Other posts (such as <a href="http://www.mail-archive.com/sqlite-users@sqlite.org/msg20531.html" target="_blank">this</a> one) suggested writing my own custom SQLite function in C.  This was not an option since my particular requirement relied on using the SQLite implementation inside the context of the Adobe Flash player.  So, I was ultimately left to fend for myself, and this kind of challenge is what developers sometimes need to stoke their initiative and get their creative wheels turning.  It definitely worked for me, not that I needed the motivation <img src='http://www.mattoldham.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Before I started, I knew that I would need a decent set of data against which to test my SQL.  As I typically tend to do for such needs, I fired up Microsoft Excel and generated a list of dates along with their corresponding years/months/days calculations using basic Excel functions.  I then turned the resulting Excel data into SQL INSERT statements and loaded them into a SQLite table named AGE_TEST for testing.  Here&#8217;s an excerpt of the Excel data, based on my local system date of 5/31/2011:</p>
<div>
<pre class="brush: plain; title: ;">
DOB      Years  Months  Days
9/11/05      5       8    20
1/1/10       1       4    30
1/2/10       1       4    29
...
5/29/11      0       0     2
5/30/11      0       0     1
5/31/11      0       0     0
</pre>
</div>
<div>And here are the respective Excel formulae I used:</div>
<div>
<pre class="brush: plain; title: ;">
Years:  =DATEDIF(A2,TODAY(),&quot;Y&quot;)
Months: =DATEDIF(A2,TODAY(),&quot;YM&quot;)
Days:   =DATEDIF(A2,TODAY(),&quot;MD&quot;)
</pre>
</div>
<div>After a bit of trial and error, I finally ended up with something that worked across all of my test dates.  Admittedly (as you can probably tell from the code), the months calculation was the most challenging.  Here&#8217;s the SQL solution I ended up with:</div>
<div>
<pre class="brush: sql; title: ;">
SELECT CASE
          /* DOB is beyond current date */
          WHEN dob &gt; date('now') THEN NULL
          /* DOB equal to current date */
          WHEN dob = date('now') THEN '0 days'
          /* subject is less that 1 month old */
          WHEN date('now','-1 month') &lt; dob THEN CAST((julianday('now') - julianday(dob)) AS INTEGER) || ' days'
          /* subject is less that 2 months old */
          WHEN date('now','-2 month') &lt; dob THEN CAST((julianday('now') - julianday(dob))/7 AS INTEGER) || ' wks'
          /* subject is less than 1 year old */
          WHEN date('now','-1 year') &lt; dob THEN
             CASE
                WHEN date('now','-11 month') &gt;= dob then 11
                WHEN date('now','-10 month') &gt;= dob then 10
                WHEN date('now','-9 month') &gt;= dob then 9
                WHEN date('now','-8 month') &gt;= dob then 8
                WHEN date('now','-7 month') &gt;= dob then 7
                WHEN date('now','-6 month') &gt;= dob then 6
                WHEN date('now','-5 month') &gt;= dob then 5
                WHEN date('now','-4 month') &gt;= dob then 4
                WHEN date('now','-3 month') &gt;= dob then 3
                WHEN date('now','-2 month') &gt;= dob then 2
                WHEN date('now','-1 month') &gt;= dob then 1
             END || ' mos'
          /* subject is 1 year or older */
          ELSE ((strftime('%Y', 'now') - strftime('%Y', dob)) -
                (CASE
                    WHEN (strftime('%m', dob) &lt; strftime('%m', 'now')) OR
                         (strftime('%m', dob) = strftime('%m', 'now') AND
                          strftime('%d', dob) &lt;= strftime('%d', 'now')) THEN 0
                    ELSE 1
                 END)) || ' yrs'
          END AS person_age
  FROM (SELECT dob
          FROM age_test)
</pre>
<p>I&#8217;d love to hear your thoughts.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mattoldham.com/2011/05/calculating-age-based-on-date-of-birth-in-sqlite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Make a Long Running Query</title>
		<link>http://www.mattoldham.com/2010/08/how-to-make-a-long-running-query/</link>
		<comments>http://www.mattoldham.com/2010/08/how-to-make-a-long-running-query/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 14:06:30 +0000</pubDate>
		<dc:creator>-Matt-</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.mattoldham.com/?p=142</guid>
		<description><![CDATA[Recently a colleague sent me a quick instant message asking if I knew of any way in Oracle to make a query run long enough to test a &#8220;cancel query&#8221; function he was writing in Java.  He had tried several queries that usually produced the results he was looking for, however there wasn&#8217;t enough data in his test environment to reproduce the wait time he needed.  I thought about it for a minute and then [...]]]></description>
			<content:encoded><![CDATA[<p>Recently a colleague sent me a quick instant message asking if I knew of any way in Oracle to make a query run long enough to test a &#8220;cancel query&#8221; function he was writing in Java.  He had tried several queries that usually produced the results he was looking for, however there wasn&#8217;t enough data in his test environment to reproduce the wait time he needed.  I thought about it for a minute and then proposed the following solution.</p>
<p>Oracle provides the <a href="http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10577/d_lock.htm#sthref5204" target="_blank">DBMS_LOCK</a> package which allows users to manage their own locks.  One handy subprogram in this package in the SLEEP method, which suspends the current session for the specified number of seconds.  I have used DBMS_LOCK.SLEEP a number of times in the past so I knew this would do the trick.<span id="more-142"></span></p>
<p>The first thing needed was the ability to execute this package method, which is not something granted to all users by default.  I had my colleague issue the following grant as the SYS user in his test database:</p>
<pre>
<pre class="brush: plain; title: ;">GRANT EXECUTE ON DBMS_LOCK TO public;</pre>
</pre>
<p>Once that was done, all that was needed was a quick function to make his query run long.  Hence, the following:</p>
<pre>
<pre class="brush: plain; title: ;">CREATE OR REPLACE FUNCTION query_wait
(
   i_wait_secs IN PLS_INTEGER
)
   RETURN NUMBER
IS
BEGIN
   DBMS_LOCK.SLEEP(i_wait_secs);
   RETURN i_wait_secs;
END;
/</pre>
</pre>
<p>Here&#8217;s our new helper function in action:</p>
<pre>
<pre class="brush: plain; title: ;">matt:~&amp;gt;sqlplus scott/tiger@local

SQL*Plus: Release 11.2.0.1.0 Production on Tue Aug 24 05:55:54 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&amp;gt; SET TIMING ON

SQL&amp;gt; SELECT query_wait(10)
  2    FROM dual
  3  /

QUERY_WAIT(10)
--------------
            10

Elapsed: 00:00:10.01</pre>
</pre>
<p>And that&#8217;s all there is to it.  Instant, long running queries.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattoldham.com/2010/08/how-to-make-a-long-running-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exploring Mac World &#8211; Update</title>
		<link>http://www.mattoldham.com/2010/02/exploring-mac-world-update/</link>
		<comments>http://www.mattoldham.com/2010/02/exploring-mac-world-update/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 14:52:28 +0000</pubDate>
		<dc:creator>-Matt-</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.mattoldham.com/?p=131</guid>
		<description><![CDATA[Well, it&#8217;s been well over a month since I discussed embarking on my Mac endeavor (http://www.mattoldham.com/2009/12/getting-ready-to-explore-the-world-of-mac/).  I cannot believe it is almost the middle of February, and today is the first day I have not been onsite at my client since before the holidays began.  That also means today is really the first chance I&#8217;ve had to come back around and give you an upadte on where I&#8217;m at with validating the viability of the [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Well, it&#8217;s been well over a month since I discussed embarking on my Mac endeavor (http://www.mattoldham.com/2009/12/getting-ready-to-explore-the-world-of-mac/).  I cannot believe it is almost the middle of February, and today is the first day I have not been onsite at my client since before the holidays began.  That also means today is really the first chance I&#8217;ve had to come back around and give you an upadte on where I&#8217;m at with validating the viability of the Mac for my daily needs.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">To start, here are the specs for my test bed:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Mac Mini</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Mac OS/X 10.5.8</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Processor: 2GHz Intel Core 2 Duo</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Memory: 4GB 1067 MHz DDR3</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">My initial challenge for the Mac was basically to replicate (again, in a viable manner) the various tools and utilities that are critical to my daily grind.  Well, I am honestly surprised to say that aside from a few minor things here and there the Mac stood up to the challenge.  Read on for the specifics&#8230;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">1. Microsoft Office</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">As I mentioned before, this is a must have given the obvious email factor, as well as the amount of client documentation we prepare.  I was fortunate to already find Microsoft Office 2008 installed on the Mac Mini, including the Entourage email client.  At this point I have not been able to explore Entourage at all, but that is on the list.  I have heard there are &#8220;quirks&#8221;, but I cannot validate these claims yet.  It will be very intereting to see how it compares to Outlook.  At this point I&#8217;m just happy there is a Microsoft offering.  Wow, did I really just say that?</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">2. Oracle RDBMS</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">I was somewhat disappointed to find that OracleXE is not available on MacOSX.  I say somewhat because I have been recently challenged by several of the limitations in XE as it relates to otherwise &#8220;enterprise&#8221; features Oracle has disabled in XE (e.g. table partitioning, parallel exports, etc).  Fortunately, I was able to get Oracle 10gR2 Enterprise installed with little effort.  I found the following guide bvery helpful:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">http://www.pythian.com/news/1937/quick-install-guide-for-oracle-10g-release-2-on-mac-os-x-leopard-intel/</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">NOTE: One thing I had to do in order to get the installation to work correctly was to edit the ORACLE_HOME value in the /Library/StartupItems/Oracle/Oracle file.  If you are familiar with Oracle in a Unix environment, you know the importance of ORACLE_HOME so this should not come as a surprise.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">After installation, I tried creating a local database.  This process was giving me grief until I dioscovered I had to enable the root user on a Mac.  What&#8217;s that all about?  Disabling the root user?  Well, the following support note from Apple walked me through the process:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Emabling the root user in MacOSX: http://support.apple.com/kb/HT1528</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Once that was done, I had to manually create the /etc/oratab file and set file permissions such that the oracle user could write to it via the Database Configuration Assistant (dbca) utility.  Finally, I had a fully functional Oracle installation.  Life is good&#8230;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">3. Oracle SQL Developer / Data Modeler &#8211; I already said I was a database guy, therefore I need 1) a query tool, and 2) a data modeling tool.  I have already made the move to the two Oracle tools I listed, and I&#8217;m not ready to move on.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Both of these items are supported on MacOSX and both installed easily.  Things are looking promising, I must admit.  But the challenge is not over&#8230;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">4. Core Development Platform (Java, Ant, Subversion)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Not a whole lot to report here either (fortunately and unfortunately).  I found all of these tools already installed on the Mac Mini, to my surprise.  Not because Apple shipped it that way, obviously, but because I inherited the device from another internal development team who was using the tool set.  It&#8217;s great to see these packages work, which I am not surprised by, but I am a little disappointed I did not get to install them.  That time will come, though.  It will be interested to symlink all of the respective install directories so I can add other JDK versions and switch out my builds on the fly using environment variables.  That will give me the opportunity I was looking for, I only need the time to dig into it.  Something to look forward to&#8230;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">In my original post I also mentioned the desire to find a TortoiseSVN-like utility that integrated natively into the file manager.  I honestly did not expect to find one, given my earlier woes while trying to find such a tool for Gnome/Nautilus.  At that time I was surprised to find that the folks at Tigris (http://www.tigris.org) did not offer one.  Well, they didn&#8217;t overlook the Mac.  I ran across a native Finder plug-in from Tigris (http://scplugin.tigris.org).  Just what I was looking for.  I did notice that the directories under version control did not automatically appear with correct SVN icons, but I am assuming this is related to a caching issue within the plugin.  We&#8217;ll wait and see it it corrects itself.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">5. VMWare</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">As I mentioned before, this is perhaps one of the most critical components I have to get working in order for me to work in the land of Mac.  Not being able to replicate my virtual environment would pretty much be a deal-breaker for me.  I was already aware of VMWare Fusion (http://www.vmware.com/products/fusion/), but I was not clear on the compatibility between Fusion and Workstation (http://www.vmware.com/products/workstation/) (the product I use).  In short, I installed Fusion, opened an existing VM created under VMWorkstation 6.5 on Linux, and it loaded right up with no changes.  Very, very nice.  I can&#8217;t say enough good things about VMWare.  Life is really good&#8230;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">6. UltraEdit</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">This is still in the works by the guys over at IDM Software, but it&#8217;s definitely on the way for MacOSX.  See http://www.ultraedit.com/company/blog/community/what_will_uex_become.html for an update, and be sure to read the comments.  In the meantime, a very viable alternative is found in TextMate (http://macromates.com/).  Couple that along with the Oracle syntax plugin (http://code.google.com/p/oracle-textmate-bundle/) and I can once again write code in comfort.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">7. Pidgin</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">This was alittle misleading, to be honest.  I thougt I had found Pidgin for MacOSC, but I really found a couple of Pidgin alternatives that are recommended by the Pidgin website (http://www.pidgin.im/download/mac/).  After taking a look at them both, I chose to go with Adium (http://adium.im) since it uses the libpurple core library that Pidgin uses and offers &#8220;&#8230;a more native Mac OS X experience&#8221;&#8230; uses the same libpurple core that Pidgin uses.  Interestingly, not all of my groups appeared in the list of groups, but all my critical IM protocols are working.  All in all a nice utility.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">8. Conky</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">This is still a gap.  While I saw a number of posts recommending ???, it does not appear to be anywhere near as flexible as Conky.  I will have to do some more digging.  If anyone can point me in the right direction, I would appreciate it.  I really enjoy ConKy hand have come to rely on it and keep it in my peripheral on the side of my desktop as I work.  I typically watch my CPUI activity, top processes, and core component temps as I work.  A screenshot of my Conky config can be seen here (http://www.mattoldham.com/wp-content/uploads/2010/02/my_screen.png)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">9. iTunes</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">It was obviously no surprise to find iTunes already installed and working indiginously in MacOSX.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">10. Firefox</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Firefox &#8211; No problems here.  I am a long time Firefox user, but have recently begun using GoogleChrome as a result of a friend&#8217;s convincing blogpost: http://blog.incursiontech.com/matt/2009/12/23/fedora-64-bit-google-chrome-flash-player-64-bit-awesome/  It&#8217;s as good as it sounds.</div>
<p>It&#8217;s been well over a month since I first discussed <a href="http://www.mattoldham.com/2009/12/getting-ready-to-explore-the-world-of-mac/" target="_self">embarking on my Mac endeavor</a>.  I cannot believe it is almost the middle of February, and today is the first day I have not been onsite at my client since before the holidays began.  That also means today is really the first chance I&#8217;ve had to come back around and give you an update on where I&#8217;m at with validating the viability of the Mac for my daily needs.</p>
<p>To start, here are the specs for my test bed:</p>
<ul>
<li>Mac Mini</li>
<li>Mac OS/X 10.5.8</li>
<li>Processor: 2GHz Intel Core 2 Duo</li>
<li>Memory: 4GB 1067 MHz DDR3</li>
</ul>
<p>My initial challenge for the Mac was basically to replicate (again, in a viable manner) the various tools and utilities that are critical to my daily grind.  Well, I am honestly surprised to say that aside from a few minor things here and there the Mac stood up to the challenge.  Read on for the specifics&#8230;</p>
<p><span id="more-131"></span></p>
<p>1. Microsoft Office</p>
<p>As I mentioned before, this is a must have given the obvious email factor, as well as the amount of client documentation we prepare.  I was fortunate to already find Microsoft Office 2008 installed on the Mac Mini, including the Entourage email client.  At this point I have not been able to explore Entourage at all, but that is on the list.  I have heard there are &#8220;quirks&#8221;, but I cannot validate these claims yet.  It will be very intereting to see how it compares to Outlook.  At this point I&#8217;m just happy there is a Microsoft offering.  Wow, did I really just say that?</p>
<p>2. Oracle RDBMS</p>
<p>I was somewhat disappointed to find that OracleXE is not available on MacOSX.  I say somewhat because I have been recently challenged by several of the limitations in XE as it relates to otherwise &#8220;enterprise&#8221; features Oracle has disabled in XE (e.g. table partitioning, parallel exports, etc).  Fortunately, I was able to get Oracle 10gR2 Enterprise installed with little effort.  I found the following guide very helpful:</p>
<p><a href="http://www.pythian.com/news/1937/quick-install-guide-for-oracle-10g-release-2-on-mac-os-x-leopard-intel/" target="_blank">http://www.pythian.com/news/1937/quick-install-guide-for-oracle-10g-release-2-on-mac-os-x-leopard-intel/</a></p>
<p>NOTE: One thing I had to do in order to get the installation to work correctly was to edit the ORACLE_HOME value in the /Library/StartupItems/Oracle/Oracle file.  If you are familiar with Oracle in a Unix environment, you know the importance of ORACLE_HOME so this should not come as a surprise.</p>
<p>After installation, I tried creating a local database.  This process was giving me grief until I discovered I had to enable the root user on a Mac.  What&#8217;s that all about?  Disabling the root user?  Well, the following support note from Apple walked me through the process:</p>
<p>Enabling the root user in MacOSX: <a href="http://support.apple.com/kb/HT1528" target="_blank">http://support.apple.com/kb/HT1528</a></p>
<p>Once that was done, I had to manually create the /etc/oratab file and set file permissions such that the oracle user could write to it via the Database Configuration Assistant (dbca) utility.  Finally, I had a fully functional Oracle installation.  Life is good&#8230;</p>
<p>3. Oracle SQL Developer / Data Modeler</p>
<p>Both of these items are supported on MacOSX and both installed easily.  Things are looking promising, I must admit.  But the challenge is not over&#8230;</p>
<p>4. Core Development Platform (Java, Ant, Subversion)</p>
<p>Not a whole lot to report here either (fortunately and unfortunately).  I found all of these tools already installed on the Mac Mini, to my surprise.  Not because Apple shipped it that way, obviously, but because I inherited the device from another internal development team who was using the tool set.  It&#8217;s great to see these packages work, which I am not surprised by, but I am a little disappointed I did not get to install them.  That time will come, though.  It will be interested to symlink all of the respective install directories so I can add other JDK versions and switch out my builds on the fly using environment variables.  That will give me the opportunity I was looking for, I only need the time to dig into it.  Something to look forward to&#8230;</p>
<p>In my original post I also mentioned the desire to find a TortoiseSVN-like utility that integrated natively into the file manager.  I honestly did not expect to find one, given my earlier woes while trying to find such a tool for Gnome/Nautilus.  At that time I was surprised to find that the folks at <a href="http://www.tigris.org" target="_blank">Tigris</a> did not offer one.  Well, they didn&#8217;t overlook the Mac.  I ran across a <a href="http://scplugin.tigris.org" target="_blank">native Finder plug-in from Tigris</a>.  Just what I was looking for.  I did notice that the directories under version control did not automatically appear with correct SVN icons, but I am assuming this is related to a caching issue within the plugin.  We&#8217;ll wait and see it it corrects itself.</p>
<p>5. VMWare</p>
<p>As I mentioned before, this is perhaps one of the most critical components I have to get working in order for me to survive in the land of Mac.  Not being able to replicate my virtual environment would pretty much be a deal-breaker for me.  I was already aware of <a href="http://www.vmware.com/products/fusion/" target="_blank">VMWare Fusion</a>, but I was not clear on the compatibility between Fusion and <a href="http://www.vmware.com/products/workstation/" target="_blank">Workstation</a> (the product I use).  In short, I installed Fusion, opened an existing VM created under VMWorkstation 6.5 on Linux, and it loaded right up with no changes.  Very, very nice.  I can&#8217;t say enough good things about VMWare.  Life is really good&#8230;</p>
<p>6. UltraEdit</p>
<p>This is still in the works by the guys over at IDM Software, but it&#8217;s definitely on the way for MacOSX.  See <a href="http://www.ultraedit.com/company/blog/community/what_will_uex_become.html" target="_blank">http://www.ultraedit.com/company/blog/community/what_will_uex_become.html</a> for an update, and be sure to read the comments.  In the meantime, a very viable alternative is found in <a href="http://macromates.com/" target="_blank">TextMate</a>.  Couple that along with the <a href="http://code.google.com/p/oracle-textmate-bundle/" target="_blank">Oracle syntax plugin</a> and I can once again write code in comfort.</p>
<p>7. Pidgin</p>
<p>This was alittle misleading, to be honest.  I thought I had found Pidgin for MacOSC, but I really found a couple of Pidgin alternatives that are recommended on the <a href="http://www.pidgin.im/download/mac/" target="_blank">Pidgin website</a>.  After taking a look at them both, I chose to go with <a href="http://adium.im" target="_blank">Adium</a> since it uses the libpurple core library that Pidgin uses and offers &#8220;&#8230;a more native Mac OS X experience&#8221;.  Interestingly, not all of my groups appeared in the list of groups, but all my critical IM protocols are working.  All in all a nice utility.</p>
<p>8. Conky</p>
<p>This is still a gap.  While I saw a number of posts recommending <a href="http://projects.tynsoe.org/en/geektool/index.php" target="_blank">GeekTool</a>, it does not appear to be anywhere near as flexible as Conky.  I will have to do some more digging.  If anyone can point me in the right direction, I would appreciate it.  I really enjoy Conky and have come to rely on it and keep it in my peripheral vision on the side of my desktop as I work.  I typically watch my CPU activity, top processes, and core component temps as I work.  A screenshot of my Conky config can be seen <a href="http://www.mattoldham.com/wp-content/uploads/2010/02/my_screen.png" target="_self">here</a>.</p>
<p>9. iTunes</p>
<p>It was obviously no surprise to find iTunes already installed and working indiginously in MacOSX.</p>
<p>10. Firefox</p>
<p>No problems here.  I am a long time Firefox user, but have recently begun using GoogleChrome as a result of a <a href="http://blog.incursiontech.com/matt/2009/12/23/fedora-64-bit-google-chrome-flash-player-64-bit-awesome/" target="_blank">friend&#8217;s convincing blogpost</a>:   It&#8217;s as good as he describes (at least on Linux).</p>
<p>Conclusion</p>
<p>Not too shabby, eh?  These results give me a huge confidence boost in the viability of converting over to a Mac.  Perhaps 2010 is &#8220;<a href="http://news.yahoo.com/s/infoworld/20100209/tc_infoworld/112608;_ylt=AiAictlueJa0s_G2RCaKO8ojtBAF;_ylu=X3oDMTJpdXNscWQwBGFzc2V0A2luZm93b3JsZC8yMDEwMDIwOS8xMTI2MDgEcG9zAzkEc2VjA3luX2FydGljbGVfc3VtbWFyeV9saXN0BHNsawMyMDEwZmluYWxseXQ-" target="_blank">the year of the Mac</a>&#8220;, at least for me.  Which reminds me, I still haven&#8217;t seen any contributions to my MacBook Pro fund&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattoldham.com/2010/02/exploring-mac-world-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Handy Desktop Background For App Developers</title>
		<link>http://www.mattoldham.com/2010/02/handy-desktop-background-for-app-developers/</link>
		<comments>http://www.mattoldham.com/2010/02/handy-desktop-background-for-app-developers/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 22:39:50 +0000</pubDate>
		<dc:creator>-Matt-</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.mattoldham.com/?p=122</guid>
		<description><![CDATA[Ever been working with an application window and wondered if it would fit into a particular screen resolution?  I have.  I am continually testing our apps in different browser windows and periodically I check to make sure we are still within the maximum screen resolution as indicated in our requirements documents.  I had been using this nifty little Firefox plugin which did the job for me.  But, I don&#8217;t have that capability yet (that I [...]]]></description>
			<content:encoded><![CDATA[<p>Ever been working with an application window and wondered if it would fit into a particular screen resolution?  I have.  I am continually testing our apps in different browser windows and periodically I check to make sure we are still within the maximum screen resolution as indicated in our requirements documents.  I had been using this <a href="http://www.yellowpipe.com/yis/tools/window_resizer/" target="_blank">nifty little Firefox plugin</a> which did the job for me.  But, I don&#8217;t have that capability yet (that I know of) with Google Chrome.  And, what if I happen to be testing a non-browser-based application?  Well, I got tired of wondering and decided to do something about it.<span id="more-122"></span></p>
<p>I remember from a previous life having worked with a developer who had a very neat desktop background that demarcated the different resolutions with a label and border so that regardless of which application or window he was working in he could tell immediately how well it fit into a particular resolution simply by moving the window over the different sections of his desktop.  I did a bit of searching and turned up nothing in the way of desktop backgrounds that fit the bill, so I&#8217;m guessing maybe he did what I did &#8211; create my own.</p>
<p>Since I run a screen resolution of 1680&#215;1150 on <a href="http://www.mattoldham.com/2009/09/a-great-development-configuration/" target="_self">my HP laptop</a> I&#8217;ve started with, well, a 1680&#215;1150 image.  You can see that I like darks colors on my desktop, and the final version has a nice little gradient to spice it up a bit.  Conky overlays it very nicely, and I now have a great solution to my problem.</p>
<p style="text-align: left;">Here&#8217;s a screenshot of the final product running on my laptop:</p>
<p style="text-align: center;"><a href="http://www.mattoldham.com/wp-content/uploads/2010/02/my_screen.png"><img class="size-thumbnail wp-image-120 aligncenter" title="My Desktop" src="http://www.mattoldham.com/wp-content/uploads/2010/02/my_screen-150x150.png" alt="My Desktop" width="150" height="150" /></a></p>
<p style="text-align: left;">Here&#8217;s the Gimp .xcf file with all the layers for the 1680&#215;1150 resolution.  Those of you who run larger screen resolutions can take it and modify to fit your needs.</p>
<p style="text-align: left;"><a href="http://www.mattoldham.com/wp-content/uploads/2010/02/desktop_screen_res_bg_1650x1150.xcf">desktop_screen_res_bg_1650x1150.xcf</a></p>
<p style="text-align: left;">And, here is the .png file for those of you already running 1680&#215;1150.</p>
<p style="text-align: left;"><a href="http://www.mattoldham.com/wp-content/uploads/2010/02/desktop_screen_res_bg_1650x1150.png">desktop_screen_res_bg_1650x1150.png</a></p>
<p style="text-align: left;">Hope you enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattoldham.com/2010/02/handy-desktop-background-for-app-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting ready to explore the world of Mac</title>
		<link>http://www.mattoldham.com/2009/12/getting-ready-to-explore-the-world-of-mac/</link>
		<comments>http://www.mattoldham.com/2009/12/getting-ready-to-explore-the-world-of-mac/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 16:30:06 +0000</pubDate>
		<dc:creator>-Matt-</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Apache Ant]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS/X]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[UEX]]></category>
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.mattoldham.com/?p=113</guid>
		<description><![CDATA[Never thought I would be saying that in my lifetime, but here I am nevertheless.  I have been running Linux on my laptop for almost a year now, and I have thoroughly enjoyed the flexibility it has offered me.  I weaned myself off of my old Windows XP VM a while back and have been living my daily development life exclusively in X Windows (Gnome).  My Gnome environment has exposed me to GnomeEdit, Compiz, CairoDock, [...]]]></description>
			<content:encoded><![CDATA[<p>Never thought I would be saying that in my lifetime, but here I am nevertheless.  I have been running Linux on my laptop for almost a year now, and I have thoroughly enjoyed the flexibility it has offered me.  I weaned myself off of my old Windows XP VM a while back and have been living my daily development life exclusively in X Windows (Gnome).  My Gnome environment has exposed me to GnomeEdit, Compiz, CairoDock, Conky, and other utilities here and there.  Getting everything set up has been a little challenging, but not near as much as *keeping* it all set up and playing nicely together.</p>
<p><span id="more-113"></span>More than a couple of times have I installed package updates to components I use everyday only to have a library incompatibility rear its ugly head and break one of my other tools.  To date I have broken (at least temporarily) Compiz, Nautilus,  GnomeTerminal, NetworkManager, VMWare Workstation, and UEX with innocent package updates.  In many case I have been able to recover by either upgrading a tool to a newer version (not so bad) or by downgrading one or more libraries or packages (not as much fun).  In a couple of cases I have not been able to recover &#8211; Nautilus and GnomeTerminal have not worked in quite a while.  Now, this is not to say that I could not get back to a working version of either by doing the necessary digging, research, and trial/error package updates.  The problem is that I don&#8217;t have time for these activities.  My schedule is already full with work that requires these tools and utilities to be working, with little to no slack for troubleshooting one that has stopped working.</p>
<p>Don&#8217;t get me wrong, I am not ready to go back to Windows &#8211; not even close.  The flexibility, freedom, and power I have enjoyed with Linux are things I am not willing to give up.  The question I have is how can I get a stable desktop environment that affords me the freedom of Linux?  Actually, let&#8217;s be more specific.  How can I get a stable desktop environment *on* Linux?</p>
<p>Thus the topic at hand.  OS/X is Linux at its core, which immediately grabs my attention.  Mac&#8217;s are definitely growing in popularity amongst peers in my industry who are not graphics designers.  Can a database guy survive on a Mac?  Hopefully so, but that remains to be seen.  I have begun taking an inventory of the tools and utilities I use everyday that must be found in some reasonable form in the Mac world.  Here&#8217;s the list, in order of importance:</p>
<ul>
<li>Microsoft Office &#8211; simply a must.  And, I really need Outlook.  I have been using Mozilla Thunderbird and it has no calendar.  CrossOver for Linux allows me to run Outlook, but it is somewhat flaky and does not run natively.</li>
</ul>
<ul>
<li>Oracle &#8211; I need a local Oracle database, at least version 10g, and preferrably an XE install (not the full blown Standard or Enterprise version).</li>
</ul>
<ul>
<li>Oracle SQL Developer / Data Modeler &#8211; I already said I was a database guy, therefore I need 1) a query tool, and 2) a data modeling tool.  I have already made the move to the two Oracle tools I listed, and I&#8217;m not ready to move on.</li>
</ul>
<ul>
<li>Core Development Platform (Java, Ant, Subversion) &#8211; not optional. As a side noe, I would love to be able to find an SVN client that integrated natively into the file manager like TortoiseSVN does in Windows.</li>
</ul>
<ul>
<li>VMWare &#8211; we use VMWare for a number of things so this is also a must.</li>
</ul>
<ul>
<li>UltraEdit &#8211; my favorite text editor.  UEX was a huge leap forward for UltraEdit, but for some reason my current openSuse config has broken UEX and it core dumps.  Regardless, still the best text editor there is.</li>
</ul>
<ul>
<li>Pidgin &#8211; or another generic IM client that supports GMail, Yahoo, and standard XMPP.</li>
</ul>
<ul>
<li>Conky &#8211; a desktop system monitor (and more).</li>
</ul>
<ul>
<li>iTunes &#8211; I really miss iTunes.  Haven&#8217;t used it since I jailbroke my iPhone. Not critical, but definitely a nice-to-have.</li>
</ul>
<p>I expect this list will grow, but these are the big ones.</p>
<p>Now for the hardware&#8230;  Thankfully I have access to a Mac Mini that I will use as my test bed.  I&#8217;ll get OS/X set up and running and then begin the software and configuration journey.  Having never used a Mac before, it should be interesting.  Yes, I did use an Apple IIE in my elementary computer lab, but that doesn&#8217;t count <img src='http://www.mattoldham.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>More to come as I make progress.  In the meantime, if anyone is interested in contributing to my MacBook Pro fund&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattoldham.com/2009/12/getting-ready-to-explore-the-world-of-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OLAP Friendly OLTP Design</title>
		<link>http://www.mattoldham.com/2009/11/olap-friendly-oltp-design/</link>
		<comments>http://www.mattoldham.com/2009/11/olap-friendly-oltp-design/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 13:19:38 +0000</pubDate>
		<dc:creator>-Matt-</dc:creator>
				<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.mattoldham.com/?p=92</guid>
		<description><![CDATA[I thought I would post a whitepaper I wrote earlier this year under the auspices of my employer, M. Miller &#38; Associates.  This whitepaper is basically a summary of things I have observed over the course of my career in IT, particularly in regard to database design.  I can assure you that I eat my own dog food when it comes to the things I discuss.  I&#8217;m in the trenches every day putting into practice [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I would post a whitepaper I wrote earlier this year under the auspices of my employer, <a href="http://www.mmillerassociates.com" target="_blank">M. Miller &amp; Associates</a>.  This whitepaper is basically a summary of things I have observed over the course of my career in IT, particularly in regard to database design.  I can assure you that I eat my own dog food when it comes to the things I discuss.  I&#8217;m in the trenches every day putting into practice these concepts in order to produce solid, forward thinking designs.  We&#8217;ll eventually post this on the company website, but until then I make it available here in hopes it provokes thought and discussion.  Let me know what you think.</p>
<p><a rel="attachment wp-att-96" href="http://www.mattoldham.com/2009/11/olap-friendly-oltp-design/olap-fiendly-oltp-design-planning-ahead-for-the-inevitable-data-warehouse/"></a><a href="http://www.mattoldham.com/wp-content/uploads/2009/11/OLAP-Fiendly-OLTP-Design-Planning-Ahead-for-the-Inevitable-Data-Warehouse.pdf">OLAP Fiendly OLTP Design &#8211; Planning Ahead for the Inevitable Data Warehouse</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattoldham.com/2009/11/olap-friendly-oltp-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Great Development Configuration</title>
		<link>http://www.mattoldham.com/2009/09/a-great-development-configuration/</link>
		<comments>http://www.mattoldham.com/2009/09/a-great-development-configuration/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 18:32:31 +0000</pubDate>
		<dc:creator>-Matt-</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Apache Ant]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[openSuse]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oyen]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[UEX]]></category>
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.mattoldham.com/?p=30</guid>
		<description><![CDATA[My current development environment has to be the best configuration I&#8217;ve had to date in my development career.  Here are some of the specifics: HP EliteBook laptop (8730w) 2.4GHz Core 2 Duo 64-bit 6GB Memory openSuse 11.1 64-bit The move to Linux from Windows has been a huge plus, though not without its own challenges.  But it&#8217;s not just the hardware and OS.  Here are the tools that round out a highly productive development environment: [...]]]></description>
			<content:encoded><![CDATA[<p>My current development environment has to be the best configuration I&#8217;ve had to date in my development career.  Here are some of the specifics:</p>
<ul>
<li>HP EliteBook laptop (8730w)</li>
<li> 2.4GHz Core 2 Duo 64-bit</li>
<li> 6GB Memory</li>
<li>openSuse 11.1 64-bit</li>
</ul>
<p>The move to Linux from Windows has been a huge plus, though not without its own challenges.  But it&#8217;s not just the hardware and OS.  Here are the tools that round out a highly productive development environment:<span id="more-30"></span></p>
<ul>
<li><a href="http://www.oracle.com/technology/products/database/xe/index.html" target="_blank">Oracle 10g Express Edition (XE)</a> Cost: $0.  I have been using Oracle since 1998 and can tell you that XE is a huge step forward in providing developers a full Oracle functionality with a small footprint.  And, it&#8217;s free.  We have each developer install a local copy from which we do our individual development database builds.  The database build process (which is performed using Apache Ant) required a bit of special XE configuration to work properly, but is by far one of the best features of our agile development and implementation process.  I am eagerly awaiting Oracle&#8217;s release of the 11g version of XE.</li>
<li><a href="http://www.oracle.com/technology/products/database/sql_developer/index.html" target="_blank">Oracle SQL Developer</a> Cost: $0.  Currently using version 1.5.5.  It&#8217;s not TOAD, which is what I grew up using, but it is slowly gaining all the features of TOAD and more.  All in all, I am satisfied.</li>
<li><a href="(http://www.oracle.com/technology/products/database/datamodeler/index.html" target="_blank">Oracle SQL Developer Data Modeler</a> Cost: $0.  All I can say is &#8220;Wow&#8221;!  I have been looking at data modeling tools for a long time.  My favorite was Oracle Designer back in the day, but I have primarily used ERwin in most of my work.  My frustration was that there was always something missing in terms of features and functionality.  Not so with this new (and, currently, free) tool from Oracle.  I immediately incorporated it into our development process and have not looked back.  If you are looking for a fully featured data modeling tool that will work for Oracle, SQL Server (2000 and 2005), and DB2 &#8211; this is the tool for you.</li>
<li><a href="http://ant.apache.org/" target="_blank">Apache Ant</a> Cost: $0.  When I was first introduced to Ant I was skeptical to say the least.  For a Java developer, sure&#8230; but for the database?  I mean, what could possibly be done with that basic &lt;sql&gt; task?  Boy was I missing out.  After a bit of reading and experimentation (and a ton of insight from a <a href="http://www.incursiontech.com" target="_blank">very smart friend</a> and colleague) I had a full blown agile database build utility on my hands.  I can&#8217;t say enough good things about Ant.</li>
<li><a href="http://subversion.tigris.org/" target="_blank">Subversion (SVN)</a> Cost: $0.  Nothing more to say here.  The breadth of the user community says it all.</li>
<li><a href="http://www.syntevo.com/smartsvn/index.html" target="_blank">SmartSVN</a> Cost $0.  For a Linux development environment, this is a great graphical client for SVN.  While it&#8217;s not needed since you can do all the work with SVN from the command line, it has a load of features even without enabling the Professional version.</li>
<li><a href="http://tortoisesvn.tigris.org/" target="_blank">TortoiseSVN</a> Cost: $0. For a Windows development environment, this is definitely the best SVN client.  Native Windows Explorer integration makes all the difference.  Developed by the same group who maintains Subversion, <a href="http://www.tigris.org/" target="_blank">Tigris</a>.  Now, if only they would port it to one of the Gnome/KDE file managers with the same level of integration.</li>
<li><a href="http://www.codeweavers.com/products/cxlinux/" target="_blank">Crossover Linux (Standard)</a> Cost: $40.  If you need to run windows applciations natively in Linux, this is probably the solution.  I&#8217;m not the biggest fan of it but it&#8217;s the best (if not only viable) alternative and it does do the job. Office 2007 is supported, BTW.</li>
<li>UltraEdit for Linux, aka <a href="http://www.ultraedit.com/products/uex.html" target="_blank">UEX</a> Ohhhh yeah, finally a VI alternative with all the bells and whistles you could ask for.  I have been using UE since 1997, and I can honestly say I use it every day.  UEX is still in beta, but that hasn&#8217;t stopped me from using it.  My hope is that I can transfer my UE license to UEX &#8211; we&#8217;ll see.</li>
<li><a href="http://www.vmware.com/products/ws/" target="_blank">VMWare Workstation</a> Cost: $189.  Yes there are other options here (like the free VirtualBox tool from Sun), but you cannot go wrong with VMWare.  Tried and true.</li>
</ul>
<p>Do you see the pattern?  Open source and free (or at least low cost).  Not necessarily the path of least resistance, but the best things are seldom the easiest to come by.</p>
<p>Also, if you happen to be looking for a good portable hard drive with high capacity and a low profile, take a look at <a href="http://oyendigital.com/" target="_blank">OyenDigital</a>.  I am currently using the <a href="http://oyendigital.com/esata-hard-drive.html" target="_blank">500GB External 2.5-inch eSATA/USB Portable Hard Drive</a> for which I paid $130.  While it&#8217;s only 5400RPM, I can still run virtual machines over the eSATA connection with no problems.  We have a second one (320GB model) we carry with us that contains our full SCM environment running in a Linux VM.  Plug it in, fire up the VM, and we are set.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattoldham.com/2009/09/a-great-development-configuration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

