<?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>Journeyman Programmer &#187; Uncategorized</title>
	<atom:link href="http://journeyman.ivystreetinc.com/?feed=rss2&#038;cat=1" rel="self" type="application/rss+xml" />
	<link>http://journeyman.ivystreetinc.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 28 Jul 2010 12:53:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Neat Coding Trick: Add a Property Instead of a Parameter</title>
		<link>http://journeyman.ivystreetinc.com/?p=134</link>
		<comments>http://journeyman.ivystreetinc.com/?p=134#comments</comments>
		<pubDate>Wed, 28 Jul 2010 06:35:10 +0000</pubDate>
		<dc:creator>JourneyMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://journeyman.ivystreetinc.com/?p=134</guid>
		<description><![CDATA[If you&#8217;ve ever had to work on a legacy application with a HUGE code base, you might get faced with this situation:
Manager: &#8220;Hey journeyman can you fix this address on this  page so that it knows to take a system configuration?&#8221;
Journeyman:  &#8220;Sure, give me a second for an estimate.&#8221;
You find the code:
public class AddressService [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever had to work on a legacy application with a HUGE code base, you might get faced with this situation:</p>
<p>Manager: &#8220;Hey journeyman can you fix this address on this  page so that it knows to take a system configuration?&#8221;</p>
<p>Journeyman:  &#8220;Sure, give me a second for an estimate.&#8221;</p>
<p>You find the code:</p>
<pre><span style="color: #000080;">public class AddressService {

      public String getFormattedAddress(Datasource ds, int yourFormat) {
           if (yourFormat == 1) { /* do this format */ }
           else { /* do this format */ }
           return addressString;</span></pre>
<pre><span style="color: #000080;">         }
 }</span></pre>
<p>Now go in and track down the code to change .   Hmm interesting function called getFormattedAddress().  Let&#8217;s see, before I touch it do a code search in Eclipse : used in 147 places!!!!!  Ugh . . .</p>
<p>You shan&#8217;t dare change the function call in ALL those places, nightmare, just for one of the calls.</p>
<p>So here&#8217;s one way to do avoid this messy situation:</p>
<ol>
<li>Add a new property, yourConfig, with getters and setters.</li>
<li>Override the function getFormattedAddress so that it takes your new parameter</li>
<li>Set that parameter in the overriding function.</li>
<li>Modify the original function to check the parameter, using a default if the value is empty.</li>
<li>Call the original function form the overriding function</li>
<li>Don&#8217;t forget to reset the default value!</li>
</ol>
<p>Something like this:</p>
<pre><span style="color: #000080;">public class AddressService {
      private String yourConfig = "";

      public String getFormattedAddress(Datasource ds, int yourFormat) {
           String localConfig =
                   (getYourConfig == "") ? "default" : getYourConfig();
           setYourConfig("");
           if (yourFormat == 1) { /* do this format +localConfig */ }
           else { /* do this format + localConfig */ }
           return addressString;</span></pre>
<pre><span style="color: #000080;">         }</span>
<pre style="padding-left: 30px;"><span style="color: #000080;">     public String getFormattedAddress(Datasource ds, int yourFormat, String inYourConfig) {
           setYourConfig(inYourConfig);
           return getFormattedAddress(ds,yourFormat);</span></pre>
<pre style="padding-left: 30px;"><span style="color: #000080;">     }

    public String setYourConfig(String inStr) {this.yourConfig = inStr;}</span><span style="color: #000080;">
    public void getYourConfig() {return this.yourConfig;}</span></pre>
<p><span style="color: #000080;"> }</span></pre>
<p>Now you can call the function from either its original state, or, pass in a config.</p>
]]></content:encoded>
			<wfw:commentRss>http://journeyman.ivystreetinc.com/?feed=rss2&amp;p=134</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tech Republic: Spamaholics</title>
		<link>http://journeyman.ivystreetinc.com/?p=104</link>
		<comments>http://journeyman.ivystreetinc.com/?p=104#comments</comments>
		<pubDate>Thu, 11 Feb 2010 12:52:52 +0000</pubDate>
		<dc:creator>JourneyMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://journeyman.ivystreetinc.com/?p=104</guid>
		<description><![CDATA[I read articles on Tech Republic from time to time.  They&#8217;re . . . . OK.  But I don&#8217;t remember signing up for this kind of email notification.  You&#8217;d think a self proclaimed tech site would show a little more ethical behavior.  Just goes to show you, their opinions are motivated. [...]]]></description>
			<content:encoded><![CDATA[<p>I read articles on Tech Republic from time to time.  They&#8217;re . . . . OK.  But I don&#8217;t remember signing up for this kind of email notification.  You&#8217;d think a self proclaimed tech site would show a little more ethical behavior.  Just goes to show you, their opinions are motivated.  Here&#8217;s my recent inbox. WTF.</p>
<p><img src="http://journeyman.ivystreetinc.com/wp-content/uploads/2010/02/Tech-SpamPublic.gif" alt="Tech SpamPublic" title="Tech SpamPublic" width="400"  class="alignnone size-full wp-image-105" /></p>
]]></content:encoded>
			<wfw:commentRss>http://journeyman.ivystreetinc.com/?feed=rss2&amp;p=104</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORACLE: Batch Commits</title>
		<link>http://journeyman.ivystreetinc.com/?p=81</link>
		<comments>http://journeyman.ivystreetinc.com/?p=81#comments</comments>
		<pubDate>Thu, 31 Dec 2009 23:16:51 +0000</pubDate>
		<dc:creator>JourneyMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://journeyman.ivystreetinc.com/?p=81</guid>
		<description><![CDATA[I had to write an Oracle script template for work to kind of create a guideline for our developers since we are getting inputs from ourselves, DBA standards, and business requirements from our BA&#8217;s and customers.
Anyway, one thing they wanted was batch commits . . . so I wrote this quick little piece:
It creates a [...]]]></description>
			<content:encoded><![CDATA[<p>I had to write an Oracle script template for work to kind of create a guideline for our developers since we are getting inputs from ourselves, DBA standards, and business requirements from our BA&#8217;s and customers.</p>
<p>Anyway, one thing they wanted was batch commits . . . so I wrote this quick little piece:</p>
<p>It creates a temp table, populates it, and puts a DBMS_OUTPUT line for whatever number I set the commit at . . . pretty self explanatory.</p>
<p><span style="color: #333399;">CREATE   GLOBAL  TEMPORARY TABLE temp_Cursor_Count  (<br />
testNumber Number(10)<br />
) ON COMMIT PRESERVE ROWS;<br />
commit;</span></p>
<p><span style="color: #333399;">DECLARE</span></p>
<p><span style="color: #333399;">curVariable Number;</span></p>
<p><span style="color: #333399;">cursorCount Number(10) := 0;<br />
cursorCommit Number(10) := 1000;<br />
cursorMod Number(10) := 1;</span></p>
<p><span style="color: #333399;">CURSOR tt is<br />
select * from temp_Cursor_Count;</span></p>
<p><span style="color: #333399;">begin</span></p>
<p><span style="color: #333399;">&#8211;populate temp table<br />
For i in 1..9999<br />
Loop<br />
insert into temp_Cursor_Count(testNumber) values (i);<br />
end loop;<br />
commit;</span></p>
<p><span style="color: #333399;">FOR record_tt IN tt LOOP<br />
&#8211;INITIALIZE Cursor values<br />
curVariable      :=record_tt.testNumber;</span></p>
<p><span style="color: #333399;">cursorCount := cursorCount + 1;</span></p>
<p><span style="color: #333399;">select MOD(cursorCount,cursorCommit) into cursorMod from dual;</span></p>
<p><span style="color: #333399;">if cursorMod=0 then<br />
&#8211;Normally this is where your COMMIT would occur.<br />
DBMS_OUTPUT.PUT_LINE(cursorCount);<br />
end if;</span></p>
<p><span style="color: #333399;">END LOOP;<br />
end;</span></p>
<p><span style="color: #333399;">truncate table temp_Cursor_Count;<br />
commit;<br />
drop table temp_Cursor_Count;<br />
commit;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://journeyman.ivystreetinc.com/?feed=rss2&amp;p=81</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Folder or Path as a Drive Letter on Windows XP</title>
		<link>http://journeyman.ivystreetinc.com/?p=59</link>
		<comments>http://journeyman.ivystreetinc.com/?p=59#comments</comments>
		<pubDate>Thu, 03 Dec 2009 17:09:05 +0000</pubDate>
		<dc:creator>JourneyMan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://journeyman.ivystreetinc.com/?p=59</guid>
		<description><![CDATA[I was creating a setup of PortableApps on my XP machine with some of the great stuff you can port around in that framework: Open Office, VLC etc. without installing them into the OS.  I didn&#8217;t have a USB drive with me, and thought hey, maybe I can just make a virtual drive from [...]]]></description>
			<content:encoded><![CDATA[<p>I was creating a setup of PortableApps on my XP machine with some of the great stuff you can port around in that framework: Open Office, VLC etc. without installing them into the OS.  I didn&#8217;t have a USB drive with me, and thought hey, maybe I can just make a virtual drive from a folder and load the apps into that (I&#8217;ve done this using Cygwin in my development environment).</p>
<p>So I started digging through the commands and found SUBST.  It associates a path with a drive letter.</p>
<p>Just open up a command line and type in the following syntax:</p>
<p><code><br />subst (virtual drive letter): (actual path)<br /></code></p>
<p>So, for instance, say I want to mount a folder &#8220;\\atlas\shrugged&#8221; from a network drive as drive letter &#8220;q:&#8221; on my local -<br /><code><br />subst q: \\atlas\shrugged<br /></code></p>
<p>And a local folder as &#8220;x:&#8221; -<br /><code><br />subst x: C:\journeyman<br /></code></p>
<p>Disconnecting the virtual drives is simple enough, use the &#8220;/d&#8221; flag for delete:<br /><code><br />subst x: /d<br /></code></p>
<p>I haven&#8217;t found a ton of use cases for this yet, but it&#8217;s a nice little command line tool for any automated tasks you might think of someday.</p>
<p>Funny enough, when I was going through the PortableApps setup it now allows you to install to a folder &#8212; as I remember the older versions needed a drive &#8212; chuckle.  <img src='http://journeyman.ivystreetinc.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://journeyman.ivystreetinc.com/?feed=rss2&amp;p=59</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
