<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>AlexDresko.com</title>
	
	<link>http://alexdresko.com</link>
	<description>an alExperience</description>
	<lastBuildDate>Tue, 09 Nov 2010 15:47:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AlexDresko" /><feedburner:info uri="alexdresko" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>34.789884</geo:lat><geo:long>-82.564591</geo:long><feedburner:emailServiceId>AlexDresko</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Finding duplicate code in C#, VB.Net, ASPX, Ruby, Python, Java, C, C++, ActionScript, or XAML</title>
		<link>http://feedproxy.google.com/~r/AlexDresko/~3/w1Ur5ih5KBY/</link>
		<comments>http://alexdresko.com/2010/09/09/finding-duplicate-code-in-c-vb-net-aspx-ruby-python-java-c-c-actionscript-or-xaml/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 16:03:08 +0000</pubDate>
		<dc:creator>alexdresko</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[delegates]]></category>
		<category><![CDATA[duplicate code]]></category>

		<guid isPermaLink="false">http://alexdresko.com/2010/09/09/finding-duplicate-code-in-c-vb-net-aspx-ruby-python-java-c-c-actionscript-or-xaml/</guid>
		<description><![CDATA[Whether you realize it or not, you need a tool that finds duplicate source code in your applications. In fact, if you’ve never used one before, you probably don’t realize how much you need an automated solution to this problem. &#8230; <a href="http://alexdresko.com/2010/09/09/finding-duplicate-code-in-c-vb-net-aspx-ruby-python-java-c-c-actionscript-or-xaml/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Falexdresko.com%2F2010%2F09%2F09%2Ffinding-duplicate-code-in-c-vb-net-aspx-ruby-python-java-c-c-actionscript-or-xaml%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Falexdresko.com%2F2010%2F09%2F09%2Ffinding-duplicate-code-in-c-vb-net-aspx-ruby-python-java-c-c-actionscript-or-xaml%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Whether you realize it or not, you <em>need </em>a tool that finds duplicate source code in your applications. In fact, if you’ve never used one before, you probably <em>don’t </em>realize how much you <em>need</em> an automated solution to this problem. It’s nearly impossible to manually locate the types of duplicate code that such a tool can easily bring to the surface. Even if you think you’re intimately aware of an application’s code base, every line of code you write contains the potential to awaken the duplicate code dragon.</p>
<p>To combat the problem, we have Atomiq &#8211; what I consider to be the best solution for finding duplicate/similar code in C#, VB.Net, ASPX, Ruby, Python, Java, C, C++, ActionScript, and XAML.</p>
<p><span id="more-203"></span><span style="color: #993300;"><strong>UPDATE 11/9/2010 10:46:26 AM by AD: The promotional code that used to appear on this post has been removed.</strong></span></p>
<p>How can I make such bold claims? Well, for one, because <em>I</em> know I <em>always </em>write awesome code and yet it’s astonishing how frequently Atomic says, “No, Alex, you do <em>not </em>always write awesome code.” <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://alexdresko.com/wp-content/uploads/wlEmoticonsmile.png" alt="Smile" /></p>
<p>Oh, and it happens to be the <em>only </em>code similarity finder I could find that was easy to use for my purposes. You might say <em>nothing else duplicates the Atomiq experience</em>! *SNORT*</p>
<p>Atomiq doesn’t really need this much of an introduction. If you haven’t done so already, it’s an easy, safe, and incredibly eye opening experience to run Atomiq against any of your projects. Here’s how to get some immediate gratification:</p>
<ol>
<li>Download Atomiq from <a href="http://getatomiq.com">http://getatomiq.com</a> (There’s no real need to spend much time on their website if you just want to get some immediate gratification)</li>
<li>Get some immediate gratification.</li>
</ol>
<p>That’s pretty much it as long as we ignore the part where Atomiq points and laughs at all the duplicate code it found! <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://alexdresko.com/wp-content/uploads/wlEmoticonsmile.png" alt="Smile" /></p>
<p>I was able to quickly gain an extensive understanding of where my duplicate code existed with minimal knowledge of how to use Atomiq. After I finished wiping up the tears, I was able to begin the gratifying process of fixing things.</p>
<h3>A personal example</h3>
<p>If you’ve read my posts about <a title="using delegates to eliminate duplicate code" href="http://alexdresko.com/2010/07/27/using-delegates-to-eliminate-duplicate-code/" target="_blank">using delegates to eliminate duplicate code</a> and <a title="using IDisposable responsibly" href="http://alexdresko.com/2010/07/25/using-idisposable-objects-responsibly-the-easy-way/" target="_blank">using IDisposable responsibly</a>, then this example is going to look familiar to you. <em>To be honest, it was Atomiq that led me to the delegate-based design in those posts!</em></p>
<p>Below you will find two methods that do two different things with an OdbcDataReader. Don’t spend a lot of time trying to figure out what they do.</p>
<p>The first bit of code returns a list of first names from a database.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image44.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb44.png" border="0" alt="image" width="204" height="244" /></a></p>
<p>The second bit of code sends an email notification to a list of email addresses in the same database.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image45.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb45.png" border="0" alt="image" width="203" height="244" /></a></p>
<p>It’s pretty typical code you might find in any application that connects to a database. You can tell the author had good intentions, but it’s not hard to think of a few simple things we could do to make the code a better.</p>
<p><em>But it’s probably not a good idea to just dive in and start refactoring!!!</em></p>
<p>If you looked at the code above, you might have noticed that the two methods followed very similar patterns. Though the methods do two different things, they’re not that different from each other.  In other words, there’s a lot of duplicate code. There might be a hundred instances of that pattern in your application! It would be very difficult to find those instances manually.</p>
<p>Before you attempt to refactor, you might want to use a tool like Atomiq to help you find all of the duplicate code patterns in your code. <em>Finding and eliminating those patterns will help you make better refactoring decisions.</em></p>
<p>For example, if we look at the NotifyPeople method from above in Atomiq, we can see from the red lines that there are two other places that have the same pattern as lines 103-115 and 120-131.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image46.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb46.png" border="0" alt="image" width="485" height="427" /></a></p>
<p>Closer inspection shows that, indeed, one of the places in our code that duplicates that pattern is the GetFirstNames method from above. Again, my two previous blog posts, <a title="using delegates to eliminate duplicate code" href="http://alexdresko.com/2010/07/27/using-delegates-to-eliminate-duplicate-code/" target="_blank">using delegates to eliminate duplicate code</a> and <a title="using IDisposable responsibly" href="http://alexdresko.com/2010/07/25/using-idisposable-objects-responsibly-the-easy-way/" target="_blank">using IDisposable responsibly</a>, go into detail explaining how I chose to solve this particular problem in one of my projects.</p>
<h3>Digging deeper</h3>
<p>I’m not going to go into great detail on how to use Atomiq, as its smart developers have already graciously done this on getatomiq.com. It’s not massively complicated software which makes getting to know its full extents a quick exercise. I do suggest watching the introductory videos on the homepage if you’re sitting on the toilet with nothing else to do.</p>
<p>The entire Atomiq user interface isn’t exactly what I would call “typical”, so spending some time on their website will help you get the most out of the tool.  And because of that unique interface, Atomiq has a few features that you might not discover without the aid of the website.</p>
<h3>Constructive criticism</h3>
<p>This wouldn’t be a proper review if I didn’t throw my opinion in the air and wave it like I just don’t care, now would it?</p>
<p>Here’s my bullet list of “other” notes I took during my review of Atomiq.</p>
<ul>
<li>I’m not sure why they don’t include the option to download and run a standard installer for Atomiq, but I don’t necessarily find this to be a problem. I chose to xcopy the Atomiq exe out to c:\Utilities\Atomiq.</li>
<li>If you don’t configure the analyzer’s settings appropriately, the Atomiq user interface might not show anything useful. When this happens, it’s easy to assume you didn’t do something right.<br />
<a href="http://alexdresko.com/wp-content/uploads/image47.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb47.png" border="0" alt="image" width="244" height="128" /></a></li>
<li>Minor detail, but I like to look at change logs. At the time of this writing, there isn’t one on the website or included with the Atomiq application.</li>
<li>The entire user interface isn’t exactly what I would call “standard”. That doesn’t mean it’s a bad/unusable interface, but I’m typically the kind of guy who likes things to look/work the way they do by default. I mean, I never even changed my myspace theme from the default skin for crying out loud! <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://alexdresko.com/wp-content/uploads/wlEmoticonsmile.png" alt="Smile" /> It just catches me off guard when I can’t ALT+F, N to start a new project for example.</li>
<li>When you create a new project in Atomiq, the first thing you are required to do is pick a directory that contains your source code. The <strong>Pick </strong>button shows a pretty standard directory picker, but I really wish I could locate the directory I want more quickly by pasting the directory from my clipboard. I’m quite ninja-like when it comes to wrangling a computer, so it’s sometimes easier for me to get the directory I want in the clipboard from another application than it is for me to locate the directory with this user interface. But now that I think about it, I don’t think wrangling is something ninjas do.<br />
<a href="http://alexdresko.com/wp-content/uploads/image48.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb48.png" border="0" alt="image" width="221" height="244" /></a></li>
<li>It would be great if Atomiq had an MRU list to help me open the files I use often.</li>
<li>It doesn’t appear that Atomiq is able to find duplicate code patterns that vary only by magic numbers, variable/class names, or syntactic variations. Using a tool like Atomiq most effectively sometimes requires gently massaging your code beforehand. For example, the screenshot below shows that Atomiq doesn’t find any similarities between NotifyPeople above and NotifyPeople2. Yet they are, for all practical purposes, identical. <a href="http://alexdresko.com/wp-content/uploads/image49.png"><br />
<img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb49.png" border="0" alt="image" width="497" height="365" /></a><br />
If everyone on your team uses roughly the same coding and naming guidelines, you might not have to worry about that problem much.Here’s another example that I think Atomiq might be able to shed some light on one day. There’s clearly a very important similarity between lines 166 and 177 below.<br />
<a href="http://alexdresko.com/wp-content/uploads/image50.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb50.png" border="0" alt="image" width="294" height="297" /></a><br />
Maybe the developers of Atomiq could provide some kind of clue that there’s an opportunity to perform the following “extract method” refactoring:<br />
<a href="http://alexdresko.com/wp-content/uploads/image51.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb51.png" border="0" alt="image" width="308" height="365" /></a></li>
</ul>
<h3>Still a winner</h3>
<p>Prior to finding Atomiq, I’d never used a code similarity finder. These days, it’s something I use often and can’t imagine living without! It’s such a simple, useful tool, I don’t know why anyone wouldn’t want to use it on their own projects.</p>
<p>Most of the time, you’ll likely use Atomiq as more of a detective tool. It usually finds little pieces of a pattern that, upon closer inspection, are much bigger, more important patterns.  So even though Atomiq can’t perform miracles, the tremendous satisfaction that comes along with deleting tons of duplicate code from your application is worth many times its $30 price tag.</p>
<p><span style="color: #993300;"><strong>UPDATED </strong></span><strong>11/9/2010 10:46:26 AM by AD: The promotional code that used to appear on this post has been removed.</strong></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlexDresko?a=w1Ur5ih5KBY:RhHDsa3VkOY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=w1Ur5ih5KBY:RhHDsa3VkOY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=w1Ur5ih5KBY:RhHDsa3VkOY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=w1Ur5ih5KBY:RhHDsa3VkOY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=w1Ur5ih5KBY:RhHDsa3VkOY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=w1Ur5ih5KBY:RhHDsa3VkOY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=w1Ur5ih5KBY:RhHDsa3VkOY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=w1Ur5ih5KBY:RhHDsa3VkOY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=w1Ur5ih5KBY:RhHDsa3VkOY:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=w1Ur5ih5KBY:RhHDsa3VkOY:-BTjWOF_DHI" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://alexdresko.com/2010/09/09/finding-duplicate-code-in-c-vb-net-aspx-ruby-python-java-c-c-actionscript-or-xaml/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://alexdresko.com/2010/09/09/finding-duplicate-code-in-c-vb-net-aspx-ruby-python-java-c-c-actionscript-or-xaml/</feedburner:origLink></item>
		<item>
		<title>Using delegates to eliminate duplicate code</title>
		<link>http://feedproxy.google.com/~r/AlexDresko/~3/5au2_79gN74/</link>
		<comments>http://alexdresko.com/2010/07/27/using-delegates-to-eliminate-duplicate-code/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 03:35:18 +0000</pubDate>
		<dc:creator>alexdresko</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[delegates]]></category>
		<category><![CDATA[duplicate code]]></category>
		<category><![CDATA[IDisposable]]></category>
		<category><![CDATA[lambda]]></category>
		<category><![CDATA[OleDbCommand]]></category>
		<category><![CDATA[OleDbConnection]]></category>
		<category><![CDATA[OleDbDataReader]]></category>
		<category><![CDATA[try/catch/finally]]></category>
		<category><![CDATA[using]]></category>

		<guid isPermaLink="false">http://alexdresko.com/?p=117</guid>
		<description><![CDATA[Here’s a simple technique you can use to easily eliminate duplicate code. Try not to let the word “delegates” scare you away from learning the technique and I’ll try to refrain from using the word “delegate” as much as possible.  I’ll start small and then work my way towards a more complex example that really demonstrates its power. <a href="http://alexdresko.com/2010/07/27/using-delegates-to-eliminate-duplicate-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F27%2Fusing-delegates-to-eliminate-duplicate-code%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F27%2Fusing-delegates-to-eliminate-duplicate-code%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Here’s a simple technique you can use to easily eliminate duplicate code. Try not to let the word “delegates” scare you away from learning the technique and I’ll try to refrain from using the word “delegate” as much as possible.  I’ll start small and then work my way towards a more complex example that really demonstrates its power.<span id="more-117"></span></p>
<p>Before I go any further, I’d like to point out that my post about <a title="Using IDisposable objects responsibly" href="http://alexdresko.com/2010/07/25/using-idisposable-objects-responsibly-the-easy-way/" target="_blank">Using IDisposable objects responsibly</a> contains a more extravagant example of how this technique is useful. This post goes further to explain HOW we use the technique.</p>
<h3>A simple example</h3>
<p>Let’s look at two overly simplistic methods that do different things with a <strong>connection </strong>object. Whereas the yellow code is identical across the two method, the blue and green code illustrates the differences between the two methods.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image17.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb17.png" border="0" alt="image" width="343" height="264" /></a></p>
<p>There may not be much duplicate code here, but that’s not important right now. When thinking about how we can make this code better, consider these things:</p>
<ul>
<li>What if we decide one day to use <strong>try/catch </strong>statements instead of <strong>using </strong>statements? Doing so would allow us to catch and process specific exception types.</li>
<li>What if the code required to create the connection changes one day?</li>
<li>What if there were dozens of places throughout our application where this type of code is used?!?!?!?!</li>
</ul>
<p>In order to make any of those changes, you’ve got to touch the code in every single place where the pattern exist. <em>That’s </em>the problem we want to fix. We want to be able to make those change, or any other changes, in one place, and have it affect the entire application.</p>
<p>Looking the blue and green code above, you can see that the only dependency those methods have is in the <strong>connection </strong>object. If you think about it, the blue and green methods don’t care where the connection object comes from or what happens to it afterwards – they just need a connection object. Our code would be much better if we could prevent from showing how the <strong>connection </strong>object is created or disposed.</p>
<p>So let’s change our two methods to see how we can better accommodate change in our application.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image18.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb18.png" border="0" alt="image" width="254" height="148" /></a></p>
<p><a href="http://alexdresko.com/wp-content/uploads/image21.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb21.png" border="0" alt="image" width="271" height="267" /></a></p>
<p>I can just hear my boss complaining about that strange <strong>=&gt; </strong>syntax, but bare with me. <img src='http://alexdresko.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  For the most part, this new code looks the same as our original code. Look back at the first code example to verify the differences between the two. As you’ll soon see, they definitely <em>do </em>the same thing, while, at the same time, providing a great deal more flexibility.</p>
<h3>Creating the UsingConnection method</h3>
<p>Here’s a different example that, whether you realize it now or not, illustrates the concept. Look at it closely, and then look at the <strong>CallIndirectly </strong>method even closer. If you can grasp this, the rest is relatively easy.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image24.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb24.png" border="0" alt="image" width="415" height="410" /></a></p>
<p>Here’s the same thing with a bit of color coding to try and help illustrate what’s happening:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image25.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb25.png" border="0" alt="image" width="415" height="410" /></a></p>
<p>Hopefully, you’ve determined that this should be the output of such a program:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image26.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb26.png" border="0" alt="image" width="239" height="157" /></a></p>
<p>In the example above, <strong>CallIndirectly </strong>takes a method (<strong>Action</strong>) as a parameter and stores that parameter in a variable called <strong>methodToCall</strong>. Just as we write <strong>WriteHelloWorld()</strong> to execute <strong>WriteHelloWorld</strong>, we write <strong>methodToCall()</strong> when we want to call the method that was passed to <strong>CallIndirectly</strong>. You can immediate see from the output of the program that using <strong>CallIndirectly </strong>provides us with an opportunity to do things both “Before” and “After” our desired method gets called. Essentially, <strong>CallIndirectily </strong>is a <em>method that calls another method</em>. The trick is, we have to pass a <em>method as a parameter </em>to <strong>CallIndirectly </strong>so it will know which method to call.</p>
<p>Again, if you can grasp that much, the rest is pretty simple.</p>
<p><strong>UsingConnection </strong>is pretty much the exact same thing as <strong>Callindirectly</strong>. If we wanted to, we could use <strong>UsingConnection</strong> in the exact same way that we used <strong>CallIndirectly</strong> above! Here’s proof:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image27.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb27.png" border="0" alt="image" width="517" height="300" /></a></p>
<p>And again with the color coding (let me know if it helps – I’m curious).</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image28.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb28.png" border="0" alt="image" width="517" height="300" /></a></p>
<h3>What’s that Action stuff?</h3>
<p>Notice how the method signatures for <strong>DoSomething</strong> and <strong>DoMoreStuff</strong> are identical with the exception of their names.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image29.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb29.png" border="0" alt="image" width="340" height="78" /></a></p>
<p>For our <strong>UsingConnection</strong> method to work, the first thing we need to do is figure out a way to generalize those signatures.  In other words, we need a way of defining a method signature that could have any name (or even no name, as we’ll eventually see), and that takes a single OleDbConnection parameter. We can represent that last statement with <strong>Action&lt;OleDbConnection&gt;. </strong>You can pretend “Action” represents the name of the method and <strong>OleDbConnection </strong>represents the first parameter. If our methods took three parameters – An <strong>OleDbConnection</strong>, <strong>OleDbCommand</strong>, and an <strong>OleDbDataReader</strong>, for example, we could represent the method by using <strong>Action&lt;OleDbConnection, OleDbCommand, OleDbDataReader&gt;</strong>.</p>
<p>I find the easiest way to do this is to imagine placing the words <strong>DoSomething </strong>and <strong>DoMoreStuff</strong> with the word <strong>Action</strong>. What&#8217; you’d then have is:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image30.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb30.png" border="0" alt="image" width="313" height="53" /></a></p>
<p>While that’s close to the desired result, there’s still a bit more we have to do. It turns out, the name of our OleDbConnection parameter isn’t important either, so let’s get rid of that:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image31.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb31.png" border="0" alt="image" width="245" height="48" /></a></p>
<p>Also, the <strong>void </strong>return type isn’t important to us…</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image32.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb32.png" border="0" alt="image" width="209" height="56" /></a></p>
<p>Finally, to really use the <strong>Action </strong>keyword , we have to replace the ( and ) with &lt; and &gt;.  The end result looks like this:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image33.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb33.png" border="0" alt="image" width="193" height="44" /></a></p>
<p>Because <strong>UsingConnection </strong>takes a parameter of type <strong>Action&lt;OleDbConnection</strong>&gt;, that tells us we can pass <em>any </em>method to <strong>UsingConnection</strong>, so long as it takes a single parameter of type <strong>OleDbConnection</strong>. In other words, just as <strong>void DoSomething(OleDbConnection connection) </strong>tells us that we can pass an <strong>OleDbConnection </strong>object to <strong>DoSomething, </strong>we can see that <strong>void UsingConnection(Action&lt;OleDbConnection&gt; action) </strong>tells us that we can pass any action (read: <em>method)</em> to <strong>UsingConnection </strong>so long as the method we’re passing accepts an <strong>OleDbConnection </strong>parameter.</p>
<h3>What about that pesky lambda syntax?</h3>
<p>The <strong>Test1 </strong>and <strong>Test2 </strong>methods below do the exact same thing, yet it’s apparent that <strong>Test2 </strong>uses a syntax that isn’t exactly intuitive at first.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image34.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb34.png" border="0" alt="image" width="458" height="301" /></a></p>
<p>To understand that <strong>=&gt; </strong>syntax, let’s expand on our understanding of <strong>Action</strong>. As you should recall, the <strong>Action&lt;OleDbConnection&gt; </strong>parameter tells us that we can pass any method to <strong>UsingConnection</strong> so long as it accepts an <strong>OleDbConnection</strong> parameter. Okay, so let’s copy/paste the entire contents of our <strong>DoSomething </strong>method into our call to <strong>UsingConnection </strong>and see what happens.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image35.png"><img style="display: inline; border: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb35.png" border="0" alt="image" width="406" height="204" /></a></p>
<p>Well, that’s basically what we want to do, but it’s obvious that code isn’t going to compile. To make it compile, we only have to make TWO changes.</p>
<p>Remember, <strong>Action&lt;OleDbConnection&gt; </strong>means that the name of the method and its return type do not matter. So the first thing we can do is remove the <strong>void DoSomething</strong> part.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image36.png"><img style="display: inline; border: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb36.png" border="0" alt="image" width="301" height="202" /></a></p>
<p>The ONLY other thing we have to do now is separate the parameters from the method body with the two characters <strong>=&gt;</strong>.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image37.png"><img style="display: inline; border: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb37.png" border="0" alt="image" width="326" height="207" /></a></p>
<p>That’s technically it. The code above compiles and works fine, but there are a couple of things we can do to clean the code up a bit. The main thing is that we don’t have to explicitly declare the type of our connection object. Let’s get rid of that declaration and tidy things up.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image38.png"><img style="display: inline; border: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb38.png" border="0" alt="image" width="281" height="140" /></a></p>
<p>Look how clean that is!</p>
<p>Just to make sure you understand how to make use of this technique, here’s a more concrete example of using the connection:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image39.png"><img style="display: inline; border: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb39.png" border="0" alt="image" width="513" height="203" /></a></p>
<h3>Conclusion</h3>
<p>Again,  you’ll probably want to look at my last post on <a title="Using IDisposable objects responsibly" href="http://alexdresko.com/2010/07/25/using-idisposable-objects-responsibly-the-easy-way/" target="_blank">Using IDisposable objects responsibly</a> to get a better understanding of why we want to use this technique in the first place.</p>
<p>I’ve been on a mission lately to eliminate duplicate code, so there’s a good chance my next two or three posts will be on the same subject.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlexDresko?a=5au2_79gN74:evteMdcQ44E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=5au2_79gN74:evteMdcQ44E:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=5au2_79gN74:evteMdcQ44E:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=5au2_79gN74:evteMdcQ44E:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=5au2_79gN74:evteMdcQ44E:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=5au2_79gN74:evteMdcQ44E:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=5au2_79gN74:evteMdcQ44E:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=5au2_79gN74:evteMdcQ44E:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=5au2_79gN74:evteMdcQ44E:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=5au2_79gN74:evteMdcQ44E:-BTjWOF_DHI" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://alexdresko.com/2010/07/27/using-delegates-to-eliminate-duplicate-code/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://alexdresko.com/2010/07/27/using-delegates-to-eliminate-duplicate-code/</feedburner:origLink></item>
		<item>
		<title>Using IDisposable objects responsibly – the easy way</title>
		<link>http://feedproxy.google.com/~r/AlexDresko/~3/sj59ayNIzcg/</link>
		<comments>http://alexdresko.com/2010/07/25/using-idisposable-objects-responsibly-the-easy-way/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 03:20:02 +0000</pubDate>
		<dc:creator>alexdresko</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[delegates]]></category>
		<category><![CDATA[duplicate code]]></category>
		<category><![CDATA[IDisposable]]></category>
		<category><![CDATA[OleDbCommand]]></category>
		<category><![CDATA[OleDbConnection]]></category>
		<category><![CDATA[OleDbDataReader]]></category>
		<category><![CDATA[try/catch/finally]]></category>

		<guid isPermaLink="false">http://alexdresko.com/?p=69</guid>
		<description><![CDATA[How many times have you complained about how much repetitive code is required to properly dispose of objects in your code? How many times have you found yourself in a situation where you’re unsure whether or not you’re even supposed to dispose of an object in the first place?

I want to show you a technique which completely (or, at least, temporarily) avoids the need to bother yourself with those very important concerns. This is an extremely powerful technique which can be used for much more than dealing with IDisposable related issues, but that seems to be the scenario I use it on most often. <a href="http://alexdresko.com/2010/07/25/using-idisposable-objects-responsibly-the-easy-way/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F25%2Fusing-idisposable-objects-responsibly-the-easy-way%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F25%2Fusing-idisposable-objects-responsibly-the-easy-way%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>How many times have you complained about how much repetitive code is required to properly dispose of objects in your code? How many times have you found yourself in a situation where you’re unsure whether or not you’re even supposed to dispose of an object in the first place?</p>
<p>I want to show you a technique which completely (or, at least, temporarily) avoids the need to bother yourself with those very important concerns. This is an extremely powerful technique which can be used for much more than dealing with IDisposable related issues, but that seems to be the scenario I use it on most often.<span id="more-69"></span></p>
<h3>What not to do (AKA, what we’re used to doing)</h3>
<p>Let’s take some scenarios we’re probably all very familiar with &#8211; ADO.NET’s vast array of IDisposable bad boys.</p>
<p>The first example below illustrates a typical usage of OleDbConnection, OleDbCommand, and OleDbDataReader objects.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image9.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb9.png" border="0" alt="image" width="477" height="563" /></a></p>
<p>Things to notice:</p>
<ul>
<li>There are ~15 lines of code in this method.</li>
<li>Only ~5 lines of that code is specific to the act of returning a list of first names from the method.</li>
<li>The surrounding ADO.NET related code could definitely be made more robust.</li>
</ul>
<p>In case you haven’t pointed them out on your own yet, I’ve highlighted the important lines of code below:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image10.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb10.png" border="0" alt="image" width="477" height="563" /></a></p>
<p>ere’s a similar example. You can see we’re doing something different, but the same problems exist here that exist in the example above. The thing to notice here is that <em>most </em>of the code in this method, unfortunately, is related to using ADO.NET, and <em>most </em>of the code is exactly the same as the previous example.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image11.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb11.png" border="0" alt="image" width="426" height="502" /></a></p>
<p>Now think about that for a minute. Every single time we go to the database, there are ~10 extra lines of code we’re writing just to ensure that our application works smoothly. How do we know that we’ve written those ~10 lines correctly? And how do we ensure that we’ve written those ~10 lines in the same way throughout our entire application where a connection to the database is involved?</p>
<p>The solution is to completely delegate those responsibilities to something else. In other words, we’re <em>not </em>(yet) going to worry about those things.</p>
<h3>How do we fix this?</h3>
<p>If you look at the two examples above, you’ll probably be able to detect a common theme. We’re basically just going through the process of creating an OleDbDataReader (the <strong>reader</strong> object) so we can get values from each row in the table. All of the other code related to the connection, the command, the try/finally, disposing, null checking, etc…. is practically boilerplate code that we don’t want to have to deal with inside our <strong>GetFirstNames</strong> and <strong>NotifyPeople</strong> methods. Again, in these examples, it’s all about the <strong>OleDbDataReader </strong>and that’s very important to keep in mind.</p>
<p>Here’s the trick: What we want is a new method that allows us to instantiate a new OleDbDataReader with whatever information is required, and which will provide us with the OleDbDataReader only at the point where we need it. In this case, we need to pass a SQL query to instantiate the OleDbDataReader, and we want to use the OleDbDataReader every time we successfully call its Read() method.</p>
<p>Let’s look at some examples of what we’re trying to achieve. The examples below do the exact same things as their respective counterparts, yet the important work is immediately visible and easily readable.</p>
<p>Here’s how we can retrieve the first names….</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image12.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb12.png" border="0" alt="image" width="474" height="216" /></a></p>
<p>And here’s how we can notify our people…</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image13.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb13.png" border="0" alt="image" width="452" height="157" /></a> i</p>
<p>As you can see, pretty much <em>all </em>of the ADO.NET related code has been removed from <strong>GetFirstNames2</strong>, and <strong>NotifyPeople2</strong>. Pretty snazzy, eh?</p>
<p>It’s may be a little confusing to you, but the body of the method (highlighted below) actually gets called every time we successfully call the <strong>reader.Read()</strong> method on the <strong>while </strong>loop.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image16.png"><img style="display: inline; border: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb16.png" border="0" alt="image" width="452" height="157" /></a></p>
<p>But what happened to all the other code, you ask? It’s in that method you see above called <strong>ForEachRowInReader</strong>. <strong>ForEachRowInReader </strong>fully handles the responsibility of creating the connection, wrapping everything in a try/catch, calling <strong>reader.Read()</strong>, disposing of any IDisposable objects, etc….  We’ve moved this complicated, error prone code in <strong>ForEachRowInReader</strong> so that it only exists in one place within our application.</p>
<p>Here’s what that method looks like:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image14.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb14.png" border="0" alt="image" width="435" height="487" /></a></p>
<p>As you can see, <strong>ForEachRowInReader</strong> pretty much only contains ADO.NET related code. There’s nothing in this method even remotely related to retrieving names from the database.</p>
<p>The heart and soul of <strong>ForEachRowInReader</strong> is the <strong>Action&lt;OleDbDataReader&gt; </strong>parameter:</p>
<p><a href="http://alexdresko.com/wp-content/uploads/image15.png"><img style="display: inline; border-width: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/image_thumb15.png" border="0" alt="image" width="435" height="487" /></a></p>
<p>What is <strong>Action&lt;OleDbDataReader&gt;</strong>? Well, it’s called a “delegate”, ironically. I know delegates are confusing if you’re not used to working with them, but hopefully this post will inspire you to take a closer look. What we’ve essentially done is wrap a method in another method, and even if you don’t completely understand what’s happening here, surely you will admit it’s pretty awesome.</p>
<p>While I fully intended on going into greater detail in this post, I think its length has reached a point where adding much more might confuse the reader. And since this is my first real post on my site, I think I’m going to save the rest for part two.</p>
<p><strong>8/2/2010 1:14:39 PM Update by AD: </strong>To learn how to use this technique, be sure to check out my post on <a title="Using delegates to eliminate duplicate code" href="http://alexdresko.com/2010/07/27/using-delegates-to-eliminate-duplicate-code/">Using Delegates To Eliminate Duplicate Code</a>.</p>
<p>So, happy coding, interwebz.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlexDresko?a=sj59ayNIzcg:zA25plGDUcM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=sj59ayNIzcg:zA25plGDUcM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=sj59ayNIzcg:zA25plGDUcM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=sj59ayNIzcg:zA25plGDUcM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=sj59ayNIzcg:zA25plGDUcM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=sj59ayNIzcg:zA25plGDUcM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=sj59ayNIzcg:zA25plGDUcM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=sj59ayNIzcg:zA25plGDUcM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=sj59ayNIzcg:zA25plGDUcM:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=sj59ayNIzcg:zA25plGDUcM:-BTjWOF_DHI" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://alexdresko.com/2010/07/25/using-idisposable-objects-responsibly-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://alexdresko.com/2010/07/25/using-idisposable-objects-responsibly-the-easy-way/</feedburner:origLink></item>
		<item>
		<title>The current state of AlexDresko.com</title>
		<link>http://feedproxy.google.com/~r/AlexDresko/~3/AmUqn9_NEQk/</link>
		<comments>http://alexdresko.com/2010/07/23/the-current-state-of-alexdresko-com/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 16:50:16 +0000</pubDate>
		<dc:creator>alexdresko</dc:creator>
				<category><![CDATA[AlexDresko.com]]></category>

		<guid isPermaLink="false">http://alexdresko.com/2010/07/23/the-current-state-of-alexdresko-com/</guid>
		<description><![CDATA[I’m being forced to hold off a bit on writing anything really meaningful due to all of the other things involved with starting a new website like this. For example: I’m not very happy with the registration process that is &#8230; <a href="http://alexdresko.com/2010/07/23/the-current-state-of-alexdresko-com/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F23%2Fthe-current-state-of-alexdresko-com%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F23%2Fthe-current-state-of-alexdresko-com%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I’m being forced to hold off a bit on writing anything really meaningful due to all of the other things involved with starting a new website like this. For example:</p>
<ul>
<li>I’m not very happy with the registration process that is required for commenting on my posts. I think I want to leave registration as a requirement, but the process of commenting on a post needs to be streamlined.</li>
<li>I haven’t yet found an <a title="OpenId" href="http://openid.net/" target="_blank">OpenId</a> plug-in for <a title="WordPress" href="http://wordpress.org" target="_blank">WordPress</a> that functions the way I want. OpenId <em>is </em>enabled on the site, but only nerds like myself would have any clue how to use it. What I really want is something like this:<br />
<a href="http://alexdresko.com/wp-content/uploads/2010/07/image4.png"><img style="display: inline; border: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/2010/07/image_thumb4.png" border="0" alt="image" width="244" height="66" /></a></li>
<li>The major search engines still don’t see my new site the way they should. If you search for “Alex Dresko”, I want AlexDresko.com to be the first result. At least <a title="Bing" href="http://bing.com" target="_blank">Bing</a> shows my site first when you search for “AlexDresko.com”.  I predict this is going to take a while, but there are still a lot of things I can do to make my site the most attractive result when people search for me.</li>
<li>For crying out loud, I don’t even have an “About Me” page yet! What about my resume and links to my social network profiles?  I bet you don’t even know what my purpose is for this site. And have you seen that default faveicon in the address bar? Gag me with a spoon! Yes, I just wrote that. The list of small stuff like this grows and shrinks daily and I’m going to keep hammering away at it until there’s nothing left to sweat.</li>
</ul>
<p>So that’s a rough break down of what’s happening here right now.</p>
<p>I. Am. Not. Going. To. Give. Up. On. This.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlexDresko?a=AmUqn9_NEQk:-IMZ8yiRAEk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=AmUqn9_NEQk:-IMZ8yiRAEk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=AmUqn9_NEQk:-IMZ8yiRAEk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=AmUqn9_NEQk:-IMZ8yiRAEk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=AmUqn9_NEQk:-IMZ8yiRAEk:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=AmUqn9_NEQk:-IMZ8yiRAEk:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=AmUqn9_NEQk:-IMZ8yiRAEk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=AmUqn9_NEQk:-IMZ8yiRAEk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=AmUqn9_NEQk:-IMZ8yiRAEk:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=AmUqn9_NEQk:-IMZ8yiRAEk:-BTjWOF_DHI" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://alexdresko.com/2010/07/23/the-current-state-of-alexdresko-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://alexdresko.com/2010/07/23/the-current-state-of-alexdresko-com/</feedburner:origLink></item>
		<item>
		<title>The dark side of my job</title>
		<link>http://feedproxy.google.com/~r/AlexDresko/~3/_dwq-m6BwhE/</link>
		<comments>http://alexdresko.com/2010/07/20/the-dark-side-of-my-job/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 01:30:00 +0000</pubDate>
		<dc:creator>alexdresko</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[CSI]]></category>
		<category><![CDATA[ESS]]></category>

		<guid isPermaLink="false">http://alexdresko.com/2010/07/20/the-dark-side-of-my-job/</guid>
		<description><![CDATA[On occasion, I get to perform such profound tasks as shifting columns to the right so the labels don’t wrap in our Employee Self Service application. Oh, and I think  I get to remove the “12” from the right column &#8230; <a href="http://alexdresko.com/2010/07/20/the-dark-side-of-my-job/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F20%2Fthe-dark-side-of-my-job%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F20%2Fthe-dark-side-of-my-job%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>On occasion, I get to perform such profound tasks as shifting columns to the right so the labels don’t wrap in our Employee Self Service application. Oh, and I think  I get to remove the “12” from the right column of the Box 12 data.</p>
<p><a href="http://alexdresko.com/wp-content/uploads/2010/07/image3.png"><img style="display: inline; border: 0px;" title="image" src="http://alexdresko.com/wp-content/uploads/2010/07/image_thumb3.png" border="0" alt="image" width="244" height="241" /></a></p>
<p>I just kinda figured the world would want to know that.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlexDresko?a=_dwq-m6BwhE:rpctBIb6ZIw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=_dwq-m6BwhE:rpctBIb6ZIw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=_dwq-m6BwhE:rpctBIb6ZIw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=_dwq-m6BwhE:rpctBIb6ZIw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=_dwq-m6BwhE:rpctBIb6ZIw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=_dwq-m6BwhE:rpctBIb6ZIw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=_dwq-m6BwhE:rpctBIb6ZIw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=_dwq-m6BwhE:rpctBIb6ZIw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=_dwq-m6BwhE:rpctBIb6ZIw:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=_dwq-m6BwhE:rpctBIb6ZIw:-BTjWOF_DHI" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://alexdresko.com/2010/07/20/the-dark-side-of-my-job/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://alexdresko.com/2010/07/20/the-dark-side-of-my-job/</feedburner:origLink></item>
		<item>
		<title>Something is better than nothing</title>
		<link>http://feedproxy.google.com/~r/AlexDresko/~3/k9IOyRgt8DU/</link>
		<comments>http://alexdresko.com/2010/07/20/something-is-better-than-nothing/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 16:58:40 +0000</pubDate>
		<dc:creator>alexdresko</dc:creator>
				<category><![CDATA[AlexDresko.com]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://alexdresko.com/?p=16</guid>
		<description><![CDATA[In 2002, I purchased AlexDresko.com with the sole purpose of creating the most badass website to ever grace this beautiful planet. However, much like a mechanic who never has time to work on his own car, none of the dozen &#8230; <a href="http://alexdresko.com/2010/07/20/something-is-better-than-nothing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F20%2Fsomething-is-better-than-nothing%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Falexdresko.com%2F2010%2F07%2F20%2Fsomething-is-better-than-nothing%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>In 2002, I purchased AlexDresko.com with the sole purpose of creating the most badass website to ever grace this beautiful planet. However, much like a mechanic who never has time to work on his own car, none of the dozen or so drastically different versions of AlexDresko.com I started on over the years ever got a chance to please the public.</p>
<p>But recently, I got tired of not having a voice on the internet. I have all these ideas for things to write about, but I’d always tell myself, “I don’t want to post anything until I can post it on my website, and I can’t post it on my website because my website isn’t ready, and my website isn’t ready because… SQUIRREL!”  Well enough is enough, man. I want  a place to call home and if some PHP *eeeeeek* blog system called WordPress is the way it’s got to happen, then so be it.</p>
<p>I’m going to stop beating myself up about not having everything exactly as I want it and move on. It’s a bitter pill to swallow, but I honestly feel like this is a <em>hugely</em> important step in the right direction. In my mind, there’s still a lot to do here, but something is better than nothing.</p>
<p>Wow. My first, real, suck-it-if-you-don’t-like-it blog post.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlexDresko?a=k9IOyRgt8DU:lyge1o8xygQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=k9IOyRgt8DU:lyge1o8xygQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlexDresko?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=k9IOyRgt8DU:lyge1o8xygQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=k9IOyRgt8DU:lyge1o8xygQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=k9IOyRgt8DU:lyge1o8xygQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=k9IOyRgt8DU:lyge1o8xygQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=k9IOyRgt8DU:lyge1o8xygQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=k9IOyRgt8DU:lyge1o8xygQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlexDresko?a=k9IOyRgt8DU:lyge1o8xygQ:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/AlexDresko?i=k9IOyRgt8DU:lyge1o8xygQ:-BTjWOF_DHI" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://alexdresko.com/2010/07/20/something-is-better-than-nothing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://alexdresko.com/2010/07/20/something-is-better-than-nothing/</feedburner:origLink></item>
	</channel>
</rss>

