<?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>Seth Gholson</title>
	<atom:link href="http://www.sethgholson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sethgholson.com</link>
	<description></description>
	<lastBuildDate>Fri, 13 Jan 2012 21:39:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Using simple_list_item_2 with an ArrayAdapter (Android)</title>
		<link>http://www.sethgholson.com/2012/01/using-simple_list_item_2-with-an-arrayadapter-android/</link>
		<comments>http://www.sethgholson.com/2012/01/using-simple_list_item_2-with-an-arrayadapter-android/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 21:31:48 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.sethgholson.com/2012/01/using-simple_list_item_2-with-an-arrayadapter-android/</guid>
		<description><![CDATA[Today I wanted to display static a ListView of properties and their values. It’s Friday, so I really wanted to do this with as little work as possible. Android’s free layout simple_list_item_2 sounded like what I wanted, but it wasn’t immediately clear how to handle this. There are a lot of lazy ways we can [...]]]></description>
			<content:encoded><![CDATA[<p>Today I wanted to display static a ListView of properties and their values. It’s Friday, so I really wanted to do this with as little work as possible. Android’s free layout simple_list_item_2 sounded like what I wanted, but it wasn’t immediately clear how to handle this. There are a lot of lazy ways we can list single values, but Googling around how to use simple_list_item_2 resulted in lots of questions with no real answer.</p>
<p>I found Mark Assad, who parsed the system layout files into <a href="http://sydney.edu.au/engineering/it/~massad/project-android.html" target="_blank">raw XML</a>. The led to the magic answer of <a href="http://developer.android.com/reference/android/widget/TwoLineListItem.html" target="_blank">TwoLineListItem</a> widget. Finding this widget allowed me to write a simple ArrayAdapter of key/value pairs.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 99.13%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 516px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">adapter = <span style="color: #0000ff">new</span> ArrayAdapter&lt;BasicNameValuePair&gt;(<span style="color: #0000ff">this</span>,android.R.layout.simple_list_item_2,list){</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        @Override</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">public</span> View getView(<span style="color: #0000ff">int</span> position, View convertView, ViewGroup parent){</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            TwoLineListItem row;            </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span>(convertView == null){</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                row = (TwoLineListItem)inflater.inflate(android.R.layout.simple_list_item_2, null);                    </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            }<span style="color: #0000ff">else</span>{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">                row = (TwoLineListItem)convertView;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            BasicNameValuePair data = list.get(position);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            row.getText1().setText(data.getName());</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            row.getText2().setText(data.getValue());</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> row;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    };</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">listView.setAdapter(adapter);</pre>
<p><!--CRLF--></div>
</div>
<p>&#160;</p>
<p>Hope this saves someone else some time, as I spent an embarrassing amount of time determined to use the simple_list_item_2 layout.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2012/01/using-simple_list_item_2-with-an-arrayadapter-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Bit Scatterbrained&#8230;</title>
		<link>http://www.sethgholson.com/2012/01/a-bit-scatterbrained/</link>
		<comments>http://www.sethgholson.com/2012/01/a-bit-scatterbrained/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 20:19:06 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Family]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.sethgholson.com/2012/01/a-bit-scatterbrained/</guid>
		<description><![CDATA[Lately I find myself mixing my PascalCase with my camelCase, calling alloc init instead of new, using [ ] instead of (), and writing awfully verbose method names all over the place. I justify my errors with a glimpse at my average day here lately:]]></description>
			<content:encoded><![CDATA[<p>Lately I find myself mixing my PascalCase with my camelCase, calling alloc init instead of new, using [ ] instead of (), and writing awfully verbose method names all over the place. I justify my errors with a glimpse at my average day here lately:</p>
<p><a href="http://www.sethgholson.com/wp-content/uploads/2012/01/dailyFocus1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Not to scale. Some margin of error. I focus on my family all day. I promise!" border="0" alt="Not to scale. Some margin of error. I focus on my family all day. I promise!" src="http://www.sethgholson.com/wp-content/uploads/2012/01/dailyFocus_thumb1.png" width="623" height="212" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2012/01/a-bit-scatterbrained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Value of Documentation</title>
		<link>http://www.sethgholson.com/2011/10/the-value-of-documentation/</link>
		<comments>http://www.sethgholson.com/2011/10/the-value-of-documentation/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 14:26:50 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Titanium]]></category>
		<category><![CDATA[appcelerator]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://www.sethgholson.com/2011/10/the-value-of-documentation/</guid>
		<description><![CDATA[Having been reared as a developer in Microsoft’s cozy little .NET world, I didn’t really appreciate the value of quality documentation until I ventured out into the wild jungle. I’ve been using Appcelerator’s Titanium Mobile SDK for the past few months. It’s kind of become my Shere Khan here in the jungle. Theoretically, using Titanium [...]]]></description>
			<content:encoded><![CDATA[<p>Having been reared as a developer in Microsoft’s cozy little .NET world, I didn’t really appreciate the value of quality documentation until I ventured out into the wild jungle.</p>
<p>I’ve been using Appcelerator’s Titanium Mobile SDK for the past few months. It’s kind of become my <a title="Chris Benard is my Baloo" href="http://en.wikipedia.org/wiki/Shere_Khan" target="_blank">Shere Khan</a> here in the jungle. Theoretically, using Titanium Mobile is easier and faster than writing native code. This might be true if I didn’t waste so much time deciphering their documentation. </p>
<p>I made a button to toggle my table view’s editable status. The object had a property called editable, so that seemed to be what I wanted. After testing, however, all this did was toggle whether or not swipe-to-delete worked. What I really wanted was the little red minus sign to appear, and have the contents of each row shifted to the right to make room. After 30 minutes of trial and error, looking through <a href="http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.TableViewRow-object" target="_blank">TableViewRow</a> properties, and searching their <a title="Want to see only the results that have been answered? Screw you." href="http://developer.appcelerator.com/questions/newest" target="_blank">Q&amp;A</a> section (because Appcelerator has no official forums) I found that <a title="I&#39;m surprised it doesn&#39;t have two visibility properties: visible and viewing" href="http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.TableView-object" target="_blank">TableView</a> actually has two properties: editable and editing.</p>
<p>&#160;</p>
<p><a href="http://www.sethgholson.com/wp-content/uploads/2011/10/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.sethgholson.com/wp-content/uploads/2011/10/image_thumb1.png" width="603" height="94" /></a> </p>
<p>&#160;</p>
<p>Even after discovering this other property, I still had to actually test each one to see what they did. Apparently, “editable” toggles the swipe-to-delete, whereas “editing” toggles the minus-button-on-the-left thing. The two are independent of each other. </p>
<p>Thanks for saving me time, web based application framework!</p>
<p>Signed,</p>
<p>Bitter in Bossier</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2011/10/the-value-of-documentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enterprise Library Sometimes Chops XML into 2033 Characters</title>
		<link>http://www.sethgholson.com/2011/10/enterprise-library-sometimes-chops-xml-into-2033-characters/</link>
		<comments>http://www.sethgholson.com/2011/10/enterprise-library-sometimes-chops-xml-into-2033-characters/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 20:37:57 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Enterprise Library]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.sethgholson.com/?p=1446</guid>
		<description><![CDATA[This morning I began what I thought would be an uneventful task in .NET: connect to one database, download as XML some rows from a table that have changed since a given time, then pass that XML to a stored procedure in another database so that the changes can be merged. Just two tables: one [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I began what I thought would be an uneventful task in .NET: connect to one database, download as XML some rows from a table that have changed since a given time, then pass that XML to a stored procedure in another database so that the changes can be merged. Just two tables: one relatively small, the other just a 2-column relationship table for the first table. Here’s a contrived snippet to serve the same purpose:</p>
<p>The SQL:</p>
<pre class="brush: sql; title: ; notranslate">
CREATE PROCEDURE dbo.GetXmlValue

AS

SELECT TOP 100
 *
 FROM sys.all_columns
 FOR XML AUTO, ROOT('Root')
</pre>
<p>The Code:</p>
<pre class="brush: csharp; title: ; notranslate">
Database db = GetDatabase();

DataSet set;

using (DbCommand cmd = db.GetStoredProcCommand(&quot;dbo.GetXmlValue&quot;))
 {
     set = db.ExecuteDataSet(cmd);
 }
</pre>
<p>In my application, it was this second table that tripped me a bit. The first only had a few changed rows, so the XML was only 500-1000 characters. The second table generated a much longer XML string – 3864 characters long. My initial plan was to return two tables, each 1 column and 1 row. When using <a href="http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.data.database.executedataset(v=pandp.31).aspx" target="_blank">Database.ExecuteDataSet</a> to fetch the results, however, the second table yielded two rows. I backtracked, second guessed myself, and even grabbed a couple of guys in the hall to double check my code. No one could explain it. It seemed odd that this hasn’t come up before for someone here. I did a bit of Googling and only found a couple of results. This <a href="http://support.microsoft.com/kb/310378" target="_blank">Microsoft Knowledgebase Article</a> just says it’s “by design” and to use <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executexmlreader(v=vs.71).aspx" target="_blank">SQLCommand.ExecuteXmlReader</a>.</p>
<p>The next question that came up was “Well, what does it do if I return a long XML value among other values in the same row?” I tested this out and everything worked as expected. All of the XML was in a single column value as it should be.</p>
<p>I still can’t exactly explain it. <a href="http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.data.database.executescalar(v=pandp.31).aspx" target="_blank">ExecuteScalar</a> has a character limit of 2033 characters. I suspect that because each table in my result set is just a single column value, something somewhere is relying on ExecuteScalar.</p>
<p>My solution? In my stored procedure I just stored each of my table results as an XML typed variable, then returned the two together in the same row.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2011/10/enterprise-library-sometimes-chops-xml-into-2033-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GTIN 12 UPC Check Digit Calculation in SQL Server 2008</title>
		<link>http://www.sethgholson.com/2011/09/gtin-12-upc-check-digit-calculation-in-sql-server-2008/</link>
		<comments>http://www.sethgholson.com/2011/09/gtin-12-upc-check-digit-calculation-in-sql-server-2008/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 20:22:49 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[barcode]]></category>
		<category><![CDATA[check digit]]></category>
		<category><![CDATA[UPC]]></category>

		<guid isPermaLink="false">http://www.sethgholson.com/?p=1406</guid>
		<description><![CDATA[I recently needed to generate the check digit for a GTIN-12 UPC code in SQL. The calculation method for the check digit varies depending on what kind of barcode you’re implementing, so I popped on over to Google to get the necessary algorithm. Naturally, and regardless of simplicity, I checked for any available code snippets. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to generate the check digit for a <a href="http://en.wikipedia.org/wiki/Universal_Product_Code">GTIN-12 UPC code</a> in SQL. The calculation method for the check digit varies depending on what kind of barcode you’re implementing, so I popped on over to Google to get the necessary algorithm. Naturally, and regardless of simplicity, I checked for any available code snippets. The only I found weren’t GTIN-12, and were in C or C++. So for anyone looking to do it (or something similar) in T-SQL, here’s a scalar function to do just that.</p>
<pre class="brush: sql; title: ; notranslate">
CREATE FUNCTION dbo.CalculateBarcodeGTIN12CheckDigit(@input CHAR(11))
RETURNS INT
AS
BEGIN
	DECLARE @evenDigitSum INT = 0
		,@oddDigitSum INT = 0
		,@i TINYINT = 0
		,@result INT;

	-- check if given Barcode is Numeric , if not return error status -1
	IF(ISNUMERIC(@input) = 0
		OR LEN(RTRIM(LTRIM(@input))) != 11)
		RETURN -1

	-- start the compute BarCode checksum algorithm
	SET @i = 1
	WHILE (@i &lt;= 11)
		BEGIN
		 --Add odd and even digits separately;
		 IF((@i % 2) = 0)
			 SET @evenDigitSum += CONVERT(TINYINT, SUBSTRING(@input,@i,1))
		 ELSE
			 SET @oddDigitSum += CONVERT(TINYINT, SUBSTRING(@input,@i,1))
		 SET @i += 1
		END

	--As per: http://en.wikipedia.org/wiki/Universal_Product_Code
	--Multiply odd sum by 3, add to even sum, and mod 10.
	SET @result = ((@oddDigitSum * 3) + @evenDigitSum) % 10;
	IF(@result = 0)
		RETURN 0
	ELSE
		RETURN 10 - @result;

	RETURN -1
END
GO
</pre>
<p>Scalar functions are killer, but I’ll only ever be using it for a single record.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2011/09/gtin-12-upc-check-digit-calculation-in-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hatcher William</title>
		<link>http://www.sethgholson.com/2011/05/1403/</link>
		<comments>http://www.sethgholson.com/2011/05/1403/#comments</comments>
		<pubDate>Fri, 20 May 2011 15:41:44 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[Family]]></category>

		<guid isPermaLink="false">http://www.sethgholson.com/2011/05/1403/</guid>
		<description><![CDATA[So. Awesome.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sethgholson.com/wp-content/uploads/2011/05/20110520-104025.jpg"><img src="http://www.sethgholson.com/wp-content/uploads/2011/05/20110520-104025.jpg" alt="20110520-104025.jpg" class="alignnone size-full" /></a></p>
<p>So. Awesome. <img src='http://www.sethgholson.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2011/05/1403/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why The New Guy Can’t Code</title>
		<link>http://feedproxy.google.com/~r/Techcrunch/~3/3tjpM3YBNAw/</link>
		<comments>http://feedproxy.google.com/~r/Techcrunch/~3/3tjpM3YBNAw/#comments</comments>
		<pubDate>Sat, 07 May 2011 17:30:02 +0000</pubDate>
		<dc:creator>Jon Evans</dc:creator>
				<category><![CDATA[fizzbuzz]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[TC]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[We’ve all lived the nightmare. A new developer shows up at work, and you try to be welcoming, but he1 can’t seem to get up to speed; the questions he asks reveal basic ignorance; and his work, when it finally emerges, is so kludgey that it ultimate...]]></description>
			<content:encoded><![CDATA[<p><img title="ErrorMap" src="http://tctechcrunch.files.wordpress.com/2011/05/errormap.jpg?w=240&amp;h=159" alt="" width="240" height="159">We’ve all lived the nightmare. A new developer shows up at work, and you try to be welcoming, but he<sup>1</sup> can’t seem to get up to speed; the questions he asks reveal basic ignorance; and his work, when it finally emerges, is so kludgey that it ultimately must be rewritten from scratch by more competent people. And yet his interviewers—and/or the HR department, if your company has been infested by that bureaucratic parasite—swear that they only hire above-average/A-level/top-1% people.</p>
<p>It’s a big problem, especially now. There’s a boom on. I get harassing emails from recruiters every day. Everyone’s desperate to hire developers…but developers are not fungible. A great coder can easily be 50 times more productive than a mediocre one, while bad ones ultimately have <em>negative</em> productivity. Hiring one is a terrible mistake for any organization; for a startup, it can be a catastrophic company-killer. So how can it happen so often?</p>
<p>Like many of the hangovers that haunt modern software engineering, this is ultimately mostly Microsoft’s fault.<sup>2</sup> Back when they were the evil empire where everyone secretly wanted to work, they were famous for their “brain-teaser” interview questions – Why are manhole covers round? – and, of course, they asked new university graduates about computer science theory; “Write me a <a href="http://en.wikipedia.org/wiki/Binary_search_algorithm">binary search</a>.”</p>
<p>Everyone wanted to be like Microsoft, even Google, until everyone wanted to be like Google (until recently); and so that interview meme persisted. Check out these two recent posts on the subject of interviewing, courtsey of Hacker News: one <a href="http://ecarmi.org/writing/google-internship/">from a would-be employee</a>, one <a href="http://allenc.com/2011/04/how-to-score-a-google-onsite-interview/">from a Google interviewer</a>. A couple of illuminating quotes from the latter: “I’m not even necessarily saying that this is a good metric” and “If it’s any consolation, at least we don’t ask gotcha riddle questions anymore. Those were especially offensive.”</p>
<p>It’s nice to see that Google have almost sort of realized that their recruiting algorithm is problematic. Too bad they haven’t fixed it. See also Jean Hsu’s “<a href="http://www.jeanhsu.com/2011/02/03/how-effective-are-technical-interviews/">How Effective Are Technical Interviews?</a>” The fundamental problem is that the skills required to pass today’s industry-standard software interview are not the skills required to be a good software developer. Oh, there’s <em>some</em> correlation, but it’s like the Oakland Raiders <a href="http://www.bellinghamherald.com/2011/04/30/1994340/raiders-again-draft-player-with.html">always drafting the fastest runners available</a>, only to discover to their endless dismay that the NFL is not a foot race.</p>
<p>Actually it’s worse than that. At least wide receivers have to run, whereas I can guarantee you, without fear of contradiction, that no software engineer will ever have to write a binary search after they are hired. It’s like choosing a contractor because they know how to forge and cast steel using coal, iron, an oven and a bellows, when they actually need to know a) the address of the nearest Home Depot b) what to do with the steel once they buy it.</p>
<p>Joel Spolsky once correctly explained that you’re generally looking for two things in an employee: <a href="http://www.amazon.com/Smart-Gets-Things-Done-Technical/dp/1590598385">Smart and Gets Things Done</a>. (Academia is teeming with people who are the former but not the latter.) First, though, you have to establish something else: <em>Not Completely Inept</em>. You’d be amazed how many totally incompetent people show up for technical interviews. Google’s binary search is presumably intended as their “<a href="http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html">FizzBuzz</a>” – a low bar you have to hurdle just to get in the door. But a FizzBuzz should take all of five minutes, before the real interview begins.</p>
<p>So what should a real interview consist of? Let me offer a humble proposal: <em>don’t interview anyone who hasn’t accomplished anything. Ever.</em> Certificates and degrees are not accomplishments; I mean real-world projects with real-world users. There is <em>no excuse</em> for software developers who don’t have a site, app, or service they can point to and say, “I did this, all by myself!” in a world where Google App Engine and Amazon Web Services have free service tiers, and it costs <a href="https://market.android.com/support/bin/answer.py?hl=en&amp;answer=113468">all of $25</a> to register as an Android developer and publish an app on the Android Market.</p>
<p>The old system was based on limited information—all you knew about someone was their resume. But if you only interview people with accomplishments, then you have a much broader base to work from. Get the FizzBuzz out of the way, and then have the interviewee show and tell their code, and explain their design decisions and what they would do differently now. Have them implement a feature or two while you watch, so you can see how they actually work, and how they think while working. That’s what you want from a technical interview, not a measure of its subject’s grasp of some antiquated algorithm or data structure. The world has moved on.</p>
<p><sup>1</sup>Yes, I am being deliberately sexist here, because in my experience those women who write code are consistently good at it.</p>
<p><sup>2</sup>I don’t mind that Bill Gates is a megazillionaire; he’s done a lot of really interesting and innovative stuff. I do mind that a lot of unworthy people rode his coattails to minizillionaire status, eg the inventor of <a href="http://en.wikipedia.org/wiki/Hungarian_notation">Hungarian notation</a>, probably the dumbest widely-promulgated idea in the history of the field.</p>
<br>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tctechcrunch.wordpress.com/300193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tctechcrunch.wordpress.com/300193/"></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tctechcrunch.wordpress.com/300193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tctechcrunch.wordpress.com/300193/"></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tctechcrunch.wordpress.com/300193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tctechcrunch.wordpress.com/300193/"></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tctechcrunch.wordpress.com/300193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tctechcrunch.wordpress.com/300193/"></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tctechcrunch.wordpress.com/300193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tctechcrunch.wordpress.com/300193/"></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tctechcrunch.wordpress.com/300193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tctechcrunch.wordpress.com/300193/"></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tctechcrunch.wordpress.com/300193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tctechcrunch.wordpress.com/300193/"></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=techcrunch.com&amp;blog=11718616&amp;post=300193&amp;subd=tctechcrunch&amp;ref=&amp;feed=1" width="1" height="1"><p><iframe src="http://feedads.g.doubleclick.net/~ah/f/v7tfagih50mrtjprksjv4s1ftk/300/250?ca=1&amp;fh=280#http://techcrunch.com/2011/05/07/why-the-new-guy-cant-code/" width="100%" height="280" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe></p><div>
<a href="http://feeds.feedburner.com/~ff/Techcrunch?a=3tjpM3YBNAw:YsfxsH68VIk:2mJPEYqXBVI"><img src="http://feeds.feedburner.com/~ff/Techcrunch?d=2mJPEYqXBVI" border="0"></a> <a href="http://feeds.feedburner.com/~ff/Techcrunch?a=3tjpM3YBNAw:YsfxsH68VIk:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Techcrunch?d=7Q72WNTAKBA" border="0"></a> <a href="http://feeds.feedburner.com/~ff/Techcrunch?a=3tjpM3YBNAw:YsfxsH68VIk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Techcrunch?d=yIl2AUoC8zA" border="0"></a> <a href="http://feeds.feedburner.com/~ff/Techcrunch?a=3tjpM3YBNAw:YsfxsH68VIk:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/Techcrunch?i=3tjpM3YBNAw:YsfxsH68VIk:-BTjWOF_DHI" border="0"></a> <a href="http://feeds.feedburner.com/~ff/Techcrunch?a=3tjpM3YBNAw:YsfxsH68VIk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Techcrunch?i=3tjpM3YBNAw:YsfxsH68VIk:D7DqB2pKExk" border="0"></a> <a href="http://feeds.feedburner.com/~ff/Techcrunch?a=3tjpM3YBNAw:YsfxsH68VIk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Techcrunch?d=qj6IDK7rITs" border="0"></a>
</div><img src="http://feeds.feedburner.com/~r/Techcrunch/~4/3tjpM3YBNAw" height="1" width="1">]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2011/05/why-the-new-guy-can%e2%80%99t-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send a Photo Postcard for $0.99 via Postagram [Photos]</title>
		<link>http://feeds.gawker.com/~r/lifehacker/full/~3/h0FYRJifqJM/send-a-photo-postcard-for-099-via-postagram</link>
		<comments>http://feeds.gawker.com/~r/lifehacker/full/~3/h0FYRJifqJM/send-a-photo-postcard-for-099-via-postagram#comments</comments>
		<pubDate>Wed, 13 Apr 2011 14:30:00 +0000</pubDate>
		<dc:creator>Melanie Pinola</dc:creator>
				<category><![CDATA[Mail]]></category>
		<category><![CDATA[Photos]]></category>
		<category><![CDATA[Social]]></category>
		<category><![CDATA[Social Networks]]></category>
		<category><![CDATA[web application]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[
										
					
						
											
									
				Digital photo sharing is nice and everything, but nothing beats a printed memory delivered to your home. Postagram, from the makers of the popular photo sharing Instagram app, makes it easy to send pho...]]></description>
			<content:encoded><![CDATA[<div style="float:left;padding-right:10px">
										
					<div><a title="Click here to read Send a Photo Postcard for $0.99 via Postagram" href="http://lifehacker.com/5791591/send-a-photo-postcard-for-099-via-postagram">
						<img style="border-color:#B3B3B3;border-width:0 1px 1px;border-style:none solid solid" height="120" width="190" title="Click here to read Send a Photo Postcard for $0.99 via Postagram" alt="Click here to read Send a Photo Postcard for $0.99 via Postagram" src="http://betacache.gawkerassets.com/assets/images/17/2011/04/small_postagram.jpg">
											</a></div>
									</div>
				Digital photo sharing is nice and everything, but nothing beats a printed memory delivered to your home. Postagram, from the makers of the popular photo sharing Instagram app, makes it easy to send photo postcards from your iPhone or the web.				<a href="http://lifehacker.com/5791591/send-a-photo-postcard-for-099-via-postagram" title="Click here to read more about Send a Photo Postcard for $0.99 via Postagram [Photos]">More »</a>
				<br style="clear:both">
			<br style="clear:both">
<br style="clear:both">
<a href="http://ads.pheedo.com/click.phdo?s=3174cad2a53c129329bbf32554257ec6&amp;p=1"><img alt="" style="border:0" border="0" src="http://ads.pheedo.com/img.phdo?s=3174cad2a53c129329bbf32554257ec6&amp;p=1"></a>
<img alt="" height="0" width="0" border="0" src="http://segment-pixel.invitemedia.com/pixel?code=TechBiz&amp;partnerID=167&amp;key=segment"><img alt="" height="0" width="0" border="0" src="http://pixel.quantserve.com/pixel/p-8bUhLiluj0fAw.gif?labels=pub.28252.rss.TechBiz.5734,cat.TechBiz.rss"><div>
<a href="http://feeds.gawker.com/~ff/lifehacker/full?a=h0FYRJifqJM:N_KjxYFHJyA:H0mrP-F8Qgo"><img src="http://feeds.feedburner.com/~ff/lifehacker/full?d=H0mrP-F8Qgo" border="0"></a> <a href="http://feeds.gawker.com/~ff/lifehacker/full?a=h0FYRJifqJM:N_KjxYFHJyA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/lifehacker/full?d=yIl2AUoC8zA" border="0"></a> <a href="http://feeds.gawker.com/~ff/lifehacker/full?a=h0FYRJifqJM:N_KjxYFHJyA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/lifehacker/full?i=h0FYRJifqJM:N_KjxYFHJyA:D7DqB2pKExk" border="0"></a> <a href="http://feeds.gawker.com/~ff/lifehacker/full?a=h0FYRJifqJM:N_KjxYFHJyA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/lifehacker/full?i=h0FYRJifqJM:N_KjxYFHJyA:V_sGLiPBpWU" border="0"></a>
</div><img src="http://feeds.feedburner.com/~r/lifehacker/full/~4/h0FYRJifqJM" height="1" width="1">]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2011/04/send-a-photo-postcard-for-0-99-via-postagram-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chrome 11 beta adds new experimental APIs for proxies, Web navigation</title>
		<link>http://downloadsquad.switched.com/2011/04/05/chrome-11-beta-adds-new-experimental-apis-for-proxies-web-navig/</link>
		<comments>http://downloadsquad.switched.com/2011/04/05/chrome-11-beta-adds-new-experimental-apis-for-proxies-web-navig/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 13:00:00 +0000</pubDate>
		<dc:creator>Lee Mathews</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[safe browsing]]></category>
		<category><![CDATA[SafeBrowsing]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[
	

	Google Chrome 11 -- which just recently made the move to the browser's beta channel -- has received a minor update that gives developers access to two new APIs.

The first is a full-featured proxy API, which will, for example, allow users to set d...]]></description>
			<content:encoded><![CDATA[<div style="text-align:center">
	<img alt="google chrome 11 proxy" src="http://www.blogcdn.com/downloadsquad.switched.com/media/2011/04/chrome-11-proxy.jpg" style="border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;margin-left:4px;margin-right:4px;margin-top:4px;margin-bottom:4px;width:523px;height:420px"></div>
<div style="text-align:left">
	Google Chrome 11 -- which just recently <a href="http://downloadsquad.switched.com/2011/03/23/chrome-11-goes-beta-adds-hardware-accelerated-3d-css-and-html5/">made the move to the browser's beta channel</a> -- has received a minor update that gives developers access to two new APIs.</div>
<br>
The first is a full-featured proxy API, which will, for example, allow users to set different proxy servers for normal browsing and Incognito mode. Proxy auto-config scripts are also supported by the API.<br>
<br>
The second -- Web Navigation Extension -- is a bit more expansive. This API will allow devs to build everything from more powerful safe browsing extensions -- like <a href="http://downloadsquad.switched.com/2011/03/21/bitdefender-traffic-light-protects-your-web-browser-from-malware-phishing/">Traffic Light</a> -- to data analysis and reporting extensions.<br>
<br>
Both APIs are currently experimental, so you'll need to enable them on the about:flags page to try out any relevant extensions. Apart from a <a href="http://code.google.com/chrome/extensions/trunk/samples.html">proxy example built by Google</a> and shipped with the Chromium source, we're not aware of any examples just yet, however. We'll let you know when we spot any slick, new extensions which do surface.<p style="padding:5px;background:#ddd;border:1px solid #ccc;clear:both"><a href="http://downloadsquad.switched.com/2011/04/05/chrome-11-beta-adds-new-experimental-apis-for-proxies-web-navig/">Chrome 11 beta adds new experimental APIs for proxies, Web navigation</a> originally appeared on <a href="http://downloadsquad.switched.com">Download Squad</a> on Tue, 05 Apr 2011 08:00:00 EST.  Please see our <a href="http://www.weblogsinc.com/feed-terms/">terms for use of feeds</a>.</p><p><a href="http://downloadsquad.switched.com/2011/04/05/chrome-11-beta-adds-new-experimental-apis-for-proxies-web-navig/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://downloadsquad.switched.com/forward/19903117/" title="Send this entry to a friend via email">Email this</a> | <a href="http://downloadsquad.switched.com/2011/04/05/chrome-11-beta-adds-new-experimental-apis-for-proxies-web-navig/#comments" title="View reader comments on this entry">Comments</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2011/04/chrome-11-beta-adds-new-experimental-apis-for-proxies-web-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8216;Friday&#8217; Is Just a Beatles&#8217; Rip Off</title>
		<link>http://tosh.comedycentral.com/blog/2011/03/29/friday-is-just-a-beatles-rip-off/</link>
		<comments>http://tosh.comedycentral.com/blog/2011/03/29/friday-is-just-a-beatles-rip-off/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 20:00:21 +0000</pubDate>
		<dc:creator>Mike Pomranz</dc:creator>
				<category><![CDATA[a day in the life]]></category>
		<category><![CDATA[Friday]]></category>
		<category><![CDATA[lyrics]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[Pics]]></category>
		<category><![CDATA[Rebecca Black]]></category>
		<category><![CDATA[songs]]></category>
		<category><![CDATA[the beatles]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[
We&#039;ve learned a very important lesson from this…
John Lennon was super into Fridays.
[via The Daily What]
]]></description>
			<content:encoded><![CDATA[<p style="text-align:center"><a href="http://tosh.comedycentral.com/blog/files/2011/03/rebecca-black-vs-the-beatle.jpg"><img title="rebecca-black-vs-the-beatle" src="http://tosh.comedycentral.com/blog/files/2011/03/rebecca-black-vs-the-beatle.jpg" alt="" width="500" height="430"></a></p>
<p style="text-align:left">We&#39;ve learned a very important lesson from this…</p>
<p style="text-align:left">John Lennon was super into Fridays.</p>
<p style="text-align:left">[via <a href="http://thedailywhat.tumblr.com/post/4184031430/infographic-of-the-day-dont-mind-me-im-just">The Daily What</a>]</p>
<img src="http://tosh.comedycentral.com/blog/?ak_action=api_record_view&amp;id=29310&amp;type=feed" alt="">]]></content:encoded>
			<wfw:commentRss>http://www.sethgholson.com/2011/03/friday-is-just-a-beatles-rip-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://tosh.comedycentral.com/blog/files/2011/03/rebecca-black-vs-the-127.jpg" length="6229" type="image/jpg" />
		</item>
	</channel>
</rss>

