<?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>tomauger.com</title>
	<atom:link href="http://www.tomauger.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.tomauger.com</link>
	<description>Development news, browser quirks, design factoids. Good stuff.</description>
	<lastBuildDate>Tue, 07 Feb 2012 20:35:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Named Ranges in Excel that Automatically Expand (Dynamic Ranges Part 1)</title>
		<link>http://www.tomauger.com/2012/tips-and-tricks/dynamic-named-ranges-in-excel-that-automatically-expand?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dynamic-named-ranges-in-excel-that-automatically-expand</link>
		<comments>http://www.tomauger.com/2012/tips-and-tricks/dynamic-named-ranges-in-excel-that-automatically-expand#comments</comments>
		<pubDate>Tue, 07 Feb 2012 20:35:53 +0000</pubDate>
		<dc:creator>tomauger</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.tomauger.com/?p=336</guid>
		<description><![CDATA[Named Ranges in Excel are pretty cool. They enable things like drop-down lists in your Data Validation. You can define a series of values in a column, give that column a name, and then you can refer to that range by name instead of its coordinates (ie: A1:B5). One of the frustration with maintaining these [...]]]></description>
			<content:encoded><![CDATA[<p>Named Ranges in Excel are pretty cool. They enable things like drop-down lists in your Data Validation. You can define a series of values in a column, give that column a name, and then you can refer to that range by name instead of its coordinates (ie: A1:B5).</p>
<p>One of the frustration with maintaining these lists is that as soon as you add a new value, you have to go back to Formulas &gt; Name Manager and redefine the range to include the new value. To avoid this, you can create what&#8217;s called a Dynamic Range, by using a formula instead of a hard-coded set of coordinates. This is most often handled using the OFFSET( ) function as you&#8217;ll see below. Googling &#8220;Excel dynamic range&#8221; will return tons of results that all have variants of:</p>
<pre>=OFFSET(Sheet1!$A$1, 0, 0, COUNTA($A:$A), 1)</pre>
<h2>The Basic Formula, Explained</h2>
<p>&#8216;OFFSET&#8217; will return a range based on a STARTING POSITION, the ROW OFFSET (that gets added to the starting position), the COLUMN OFFSET (added to the starting position, the HEIGHT (number of rows down) and the WIDTH (number of columns across).</p>
<p>STARTING POSITION is usually the top left cell of your named range</p>
<p>ROW OFFSET is usually 0, since we have defined the starting position of our range</p>
<p>COLUMN OFFSET is also usually 0, for the same reason</p>
<p>HEIGHT is the number of rows to include in the range (here we&#8217;re using another formula &#8211; more on that below)</p>
<p>WIDTH is the number of columns to include in the range (must be at least 1)</p>
<h3>Expanding the Range Dynamically</h3>
<p>So clearly, OFFSET by itself doesn&#8217;t do that much for us &#8211; in fact, if you&#8217;re just going to plug static number into OFFSET, there&#8217;s actually no use for it &#8211; just plug in your range directly and leave it at that. The reason you use OFFSET is because it allows you to substitute any of its parameters (arguments) with some other formula. This is where the &#8216;dynamic&#8217; part comes in.</p>
<p>The typical dynamic range formula you&#8217;ll find on the Interwebs uses COUNT( ) (for numerical columns) or COUNTA( ) for text columns. COUNT and its text cousin COUNTA count the number of non-blank cells. If we count the number of non-blank cells in a row and use that as the HEIGHT parameter of OFFSET, we get a range that starts at the starting coordinate and continues on up to the last cell that contains a text entry. In theory.</p>
<p>In actuality if you read the fine print, what you&#8217;ll get is a range of cells that starts at the first cell and continues down for as many cells as were counted by the COUNTA function. If there are blank cells in the middle of your range for some reason, this number will be wrong. That&#8217;s because the non-blank cells are not counted, so your range will be shorter than it should, and the last cells in the range will be left off. So be aware of this subtlety.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomauger.com/2012/tips-and-tricks/dynamic-named-ranges-in-excel-that-automatically-expand/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix 1-liner: delete all directories EXCEPT a particular one</title>
		<link>http://www.tomauger.com/2012/tips-and-tricks/unix-1-liner-delete-all-directories-except-a-particular-one?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=unix-1-liner-delete-all-directories-except-a-particular-one</link>
		<comments>http://www.tomauger.com/2012/tips-and-tricks/unix-1-liner-delete-all-directories-except-a-particular-one#comments</comments>
		<pubDate>Wed, 25 Jan 2012 15:10:30 +0000</pubDate>
		<dc:creator>tomauger</dc:creator>
				<category><![CDATA[Quickie]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Unix / Linux]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[negative search]]></category>
		<category><![CDATA[one-liner]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://www.tomauger.com/?p=329</guid>
		<description><![CDATA[For those of you that just want the straight goods, here&#8217;s how we delete everything EXCEPT the &#8216;backup&#8217; directory: find . -maxdepth 1 ! -name 'backup' ! -name '.*' &#124; xargs rm -rf Here&#8217;s a bit of a (simplistic) explanation: &#8216;find&#8217; is the magic sauce here. We&#8217;re using it to recursively search through all the [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you that just want the straight goods, here&#8217;s how we delete everything EXCEPT the &#8216;backup&#8217; directory:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'backup'</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'.*'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span></pre></div></div>

<p>Here&#8217;s a bit of a (simplistic) explanation:</p>
<ol>
<li>&#8216;find&#8217; is the magic sauce here. We&#8217;re using it to recursively search through all the files (and directories) starting at &#8216;.&#8217; (the current directory)</li>
<li>the &#8216;!&#8217; is the negation operator, which tells find that the operator that follow (-name) should actually perform a negative match (match everything that does NOT match this criteria)</li>
<li>we also need to set up a negative match for &#8216;.&#8217;, &#8216;..&#8217; etc, since find returns those files as well. Do note that one side effect here is that it won&#8217;t delete, for example, &#8216;.htacess&#8217;. You may need to modify this if you want to kill those &#8216;hidden&#8217; files as well</li>
<li>find is recursive, so even if it doesn&#8217;t attempt to delete the &#8216;backup&#8217; directory, it will still traverse the &#8216;backup&#8217; directory and delete all the files inside it, leaving an empty directory! To avoid this, we use -maxdepth 1 which effectively turns recursion off. We then make sure we recursively delete the files in the OTHER directories by using the -r flag on &#8216;rm&#8217;</li>
<li>xargs is one way to &#8216;do&#8217; something useful with the list of files and directories returned by find (find also has an -exec operator which will be able to do almost exactly the same thing, but I like xargs&#8217; syntax better, personally). We pipe the output to xargs and then follow it with the command that we would want to run once per file/directory, in this case &#8216;rm -rf&#8217;</li>
</ol>
<p>Have fun! And please backup your shit before trying this, cause one mis-step and you can trash a whole lotta stuff!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomauger.com/2012/tips-and-tricks/unix-1-liner-delete-all-directories-except-a-particular-one/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix one-liner to add file to Subversion</title>
		<link>http://www.tomauger.com/2011/tips-and-tricks/quickie/unix-one-liner-to-add-file-to-subversion?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=unix-one-liner-to-add-file-to-subversion</link>
		<comments>http://www.tomauger.com/2011/tips-and-tricks/quickie/unix-one-liner-to-add-file-to-subversion#comments</comments>
		<pubDate>Thu, 15 Dec 2011 23:11:09 +0000</pubDate>
		<dc:creator>tomauger</dc:creator>
				<category><![CDATA[Quickie]]></category>
		<category><![CDATA[Unix / Linux]]></category>
		<category><![CDATA[1-liner]]></category>
		<category><![CDATA[quickie]]></category>
		<category><![CDATA[shell scripting]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[unix find]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://www.tomauger.com/?p=325</guid>
		<description><![CDATA[There&#8217;s probably a better way, but I do most of my svn commands from the root of the project (eg: svn update). I really hate fully qualifying a path when I want to add a new file to version control, when that file clearly has a unique name. Is it a sign of hacker laziness [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s probably a better way, but I do most of my <code>svn</code> commands from the root of the project (eg: <code>svn update</code>). I really hate fully qualifying a path when I want to add a new file to version control, when that file clearly has a unique name. Is it a sign of hacker laziness that I would rather type 30 extra characters of shell code rather than type 25 characters of path name?</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'my_unique_file_name_to_add.php'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">svn</span> add</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tomauger.com/2011/tips-and-tricks/quickie/unix-one-liner-to-add-file-to-subversion/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

