<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Guj800</title>
	<atom:link href="http://guj800.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://guj800.wordpress.com</link>
	<description>Musings in technology, philosophy, and all things guj</description>
	<lastBuildDate>Tue, 04 Oct 2011 13:02:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='guj800.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Guj800</title>
		<link>http://guj800.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://guj800.wordpress.com/osd.xml" title="Guj800" />
	<atom:link rel='hub' href='http://guj800.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Using a Named Range to Fill a Data Validation List</title>
		<link>http://guj800.wordpress.com/2011/10/04/using-a-named-range-to-fill-a-data-validation-list/</link>
		<comments>http://guj800.wordpress.com/2011/10/04/using-a-named-range-to-fill-a-data-validation-list/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 12:46:02 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[data validation]]></category>
		<category><![CDATA[formula]]></category>
		<category><![CDATA[named range]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=89</guid>
		<description><![CDATA[I have to admit, this one took a little researching on my part. My boss stormed into my office with a quizzical look on her face (a usual occurrence) and said she was having difficulty doing something in Excel. She&#8217;s normally pretty good with Excel, so I know when that is her problem, it&#8217;s not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=89&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have to admit, this one took a little researching on my part. My boss stormed into my office with a quizzical look on her face (a usual occurrence) and said she was having difficulty doing something in Excel. She&#8217;s normally pretty good with Excel, so I know when that is her problem, it&#8217;s not going to be an easy fix. She proceeded to go to my white board in order to sketch out her problem (another indication that this was going to be a doosie) and then stumbled over her own words and drawings (the final nail in the coffin&#8230;this was going to be a fun one).</p>
<p>In a nutshell, her problem was this: she&#8217;s creating an interactive spreadsheet where the user selects an item from Dropdown A and then picks a different item from Dropdown B. Dropdown B is populated with items based on what was selected in Dropdown A. A simple example would be when you go to one of those websites that sells car parts or quotes car values, they first ask you for the make of the car, and then ask you for the model. The &#8220;model&#8221; dropdown only includes cars of the given make.</p>
<p>Shouldn&#8217;t be a problem, thought I. I&#8217;ll just write a macro that fires when the first dropdown is changed and populates the second dropdown accordingly. &#8220;And I can&#8217;t use a macro,&#8221; she said, &#8220;because it&#8217;s going to executives.&#8221; Ah, executives. The struggle to explain how to run a macro when Excel defaults to disabling them is an eternally frustrating one. And macros always tend to fail at the most embarrassing times.</p>
<p>So, what to do now. I knew that I could name a range, and I knew that I could use a named range for the data validation. What I did not know was this little gem of a function:</p>
<p><code>=INDIRECT()</code></p>
<p>This function looks at the value of a cell and considers the text of it, not the reference to it. I sincerely doubt that I&#8217;m explaining that correctly. Essentially, we are going to use the value of the first drop down to define the named range that is to be used in the second drop down. Simple.</p>
<p>These are the lists we will be using for this example.  The first column is car manufacturers (makes) and the second list is models.  Note that the data does not define which models are made by which manufacturers &#8211; that is going to be defined by named ranges.</p>
<p><img src="http://guj800.files.wordpress.com/2011/10/named_ranges.jpg?w=500" alt="Named Ranges" /></p>
<p>First, split up the models column into the named ranges (makes) the models represent.  For instance, cells I2:I5 are Fords, and cells I6:I8 are Toyotas, so the named ranges should be &#8220;Ford&#8221; and &#8220;Toyota&#8221;.</p>
<p><img src="http://guj800.files.wordpress.com/2011/10/named_range_create.jpg?w=500" alt="Named Ranges Defined" /></p>
<p>Next, use the first list of makes as a List Data Validation for your first dropdown.  Do this in cell A3.</p>
<p><img src="http://guj800.files.wordpress.com/2011/10/data_validation.jpg?w=500" alt="Data Validation" /></p>
<p>Finally, and here comes the magic, use an INDIRECT formula for the List Data Validation of the second dropdown.  This will use the first dropdown&#8217;s value as the name of the Named Range used to populate the second dropdown.</p>
<p><img src="http://guj800.files.wordpress.com/2011/10/equals_indirect.jpg?w=500" alt="Equals Indirect" /></p>
<p>That&#8217;s it!  When a user selects an item from the first dropdown, let&#8217;s say &#8220;Ford&#8221;, the second dropdown is populated with items from the named range called &#8220;Ford&#8221;.  Note that List Data Validation needs to be a <b>one dimensional array</b>.  If you require a second dimension to your data, consider a VLOOKUP to be used in conjunction with the above method.</p>
<p>As always, I hope I was explicit enough with my post, but if you have any questions or problems with this method, please do not hesitate to post comments below.</p>
<br /> Tagged: <a href='http://guj800.wordpress.com/tag/data-validation/'>data validation</a>, <a href='http://guj800.wordpress.com/tag/formula/'>formula</a>, <a href='http://guj800.wordpress.com/tag/named-range/'>named range</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=89&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2011/10/04/using-a-named-range-to-fill-a-data-validation-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>

		<media:content url="http://guj800.files.wordpress.com/2011/10/named_ranges.jpg" medium="image">
			<media:title type="html">Named Ranges</media:title>
		</media:content>

		<media:content url="http://guj800.files.wordpress.com/2011/10/named_range_create.jpg" medium="image">
			<media:title type="html">Named Ranges Defined</media:title>
		</media:content>

		<media:content url="http://guj800.files.wordpress.com/2011/10/data_validation.jpg" medium="image">
			<media:title type="html">Data Validation</media:title>
		</media:content>

		<media:content url="http://guj800.files.wordpress.com/2011/10/equals_indirect.jpg" medium="image">
			<media:title type="html">Equals Indirect</media:title>
		</media:content>
	</item>
		<item>
		<title>Drive Time Calculations in Excel</title>
		<link>http://guj800.wordpress.com/2011/04/27/drive-time-calculations-in-excel/</link>
		<comments>http://guj800.wordpress.com/2011/04/27/drive-time-calculations-in-excel/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 12:29:23 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[drive time]]></category>
		<category><![CDATA[Formulas]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=69</guid>
		<description><![CDATA[Building on my most popular post, Getting Information From the Web Using Excel VBA, I had the need in a recent project to calculate drive times on many rows of data, and decided to build a function in Excel to handle the dirty work for me using Google Maps. Essentially, we had 200 or so latitude/longitude [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=69&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Building on my most popular post, <a href="http://guj800.wordpress.com/2008/06/30/getting-information-from-the-web-using-excel-vba">Getting Information From the Web Using Excel VBA</a>, I had the need in a recent project to calculate drive times on many rows of data, and decided to build a function in Excel to handle the dirty work for me using Google Maps.</p>
<p>Essentially, we had 200 or so latitude/longitude points and needed to see which of six addresses were closer from a drive time perspective. Luckily, Google came to the rescue once again, because one can use latitude/longitude coordinates in lieu of an address in order to get directions (which includes drive time) to a physical address (or, I suppose, a second set of latitude/longitude coordinates). What&#8217;s more, the URL for google maps to give you this information is fairly simple:</p>
<p><code>http://maps.google.com/maps?q=from: [PointA] to: [PointB]</code></p>
<p>So, once I dug through the HTML code behind the google maps directions results to find the <code>div</code> element containing the drive time of the quickest route, it was easy enough to create the following function. The two parameters are the addresses, zip codes, coordinates, or whatever else Google will allow you to use to approximate the starting and ending points.</p>
<p><code>Function DriveTime(PointA As String, PointB As String)</code></p>
<p><code>&nbsp;&nbsp;Dim myURL As String</code><br />
<code>&nbsp;&nbsp;myURL = _</code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;"http://maps.google.com/maps?" &amp; _</code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;"&amp;q=from: " &amp; PointA &amp; " to: " &amp; PointB</code></p>
<p><code>&nbsp;&nbsp;Dim inet1 As Inet</code><br />
<code>&nbsp;&nbsp;Dim mypage As Variant</code></p>
<p><code>&nbsp;&nbsp;Set inet1 = New Inet</code><br />
<code>&nbsp;&nbsp;With inet1</code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;.Protocol = icHTTP</code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;.URL = myURL</code><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;mypage = .OpenURL(.URL, icString)</code><br />
<code>&nbsp;&nbsp;End With</code><br />
<code>&nbsp;&nbsp;Set inet1 = Nothing</code></p>
<p><code>&nbsp;&nbsp;Dim intStart As Double, intEnd As Double</code><br />
<code>&nbsp;&nbsp;intStart = InStr(mypage, "&lt;div class=""altroute-rcol altroute-info""&gt;") + 41</code><br />
<code>&nbsp;&nbsp;intEnd = InStr(intStart, mypage, "&lt;/div&gt;") - intStart</code><br />
<code>&nbsp;&nbsp;DriveTime = Mid(mypage, intStart, intEnd)</code></p>
<p><code>End Function</code></p>
<p>It took about 45 seconds to calculate the drive time for appx. 6 * 200 or 1,200 routes. My only other option was to copy and paste those 1,200 coordinates one-by-one into Google maps and retype the drive time. Which probably would have taken at least half a day. I call that a win.</p>
<p>Feel free to use this function for any number of drive time calculations, but I would assume that at some point Google will pitch a fit that your IP is sending so many requests to its map server. However, it didn&#8217;t bat an eye at my 1,200 queries, so who knows? Enjoy!</p>
<br /> Tagged: <a href='http://guj800.wordpress.com/tag/drive-time/'>drive time</a>, <a href='http://guj800.wordpress.com/tag/excel/'>Excel</a>, <a href='http://guj800.wordpress.com/tag/formulas/'>Formulas</a>, <a href='http://guj800.wordpress.com/tag/google/'>Google</a>, <a href='http://guj800.wordpress.com/tag/html/'>HTML</a>, <a href='http://guj800.wordpress.com/tag/vba/'>VBA</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=69&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2011/04/27/drive-time-calculations-in-excel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
		<item>
		<title>Next Unique and Previous Unique</title>
		<link>http://guj800.wordpress.com/2011/03/28/next-unique-and-previous-unique/</link>
		<comments>http://guj800.wordpress.com/2011/03/28/next-unique-and-previous-unique/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 14:03:32 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Series]]></category>
		<category><![CDATA[Unique]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=65</guid>
		<description><![CDATA[Why this isn&#8217;t already a function of Excel baffles me.  Perhaps my work is somewhat unique.  I generally work with very large datasets (over 100,000 rows, often times nearing the 1.08 million row limit of Excel 2007), and I often find myself needing to scroll through the data in order to find the next value [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=65&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Why this isn&#8217;t already a function of Excel baffles me.  Perhaps my work is somewhat unique.  I generally work with very large datasets (over 100,000 rows, often times nearing the 1.08 million row limit of Excel 2007), and I often find myself needing to scroll through the data in order to find the next value in a series.</p>
<p>Consider a spreadsheet with three columns: Fruit, Name, and Score.  Imagine this is populated with the data of a survey of 100,000 people and their opinions of Apples, Bananas, and Oranges.  You can assume that with three fruit types, there would be 300,000 total rows.  Now imagine opening this file in Excel, and imagine it is already sorted by Fruit.  How would you go about locating the first entry of Bananas?</p>
<p>The obvious method is to simply use the scroll bar and drag down until Bananas appear.  A second method would be to press and hold Page Down until this section appears.  In either case, it is far too easy to surpass the intended row, requiring a similar method in the opposite direction.  This can sometimes force you to go back and forth a few times until homing in on that row.</p>
<p>Now imagine that you just want to access the last row in the data, regardless of the contents of the cells.  Just type Ctrl + Down Arrow, and you&#8217;re there.  Wouldn&#8217;t it be nice if there were a similar function for skipping down to the next unique value?  Well, there can be!</p>
<p>Consider the following VBA functions:</p>
<pre>Sub findFirst()
   Dim targetString as String
   targetString = ActiveCell.Text

   If ActiveCell.row = 1 Then
      Exit Sub    
   ElseIf Cells(ActiveCell.row - 1, ActiveCell.Column).Text &lt;&gt; targetString Then
      Cells(ActiveCell.row - 1, ActiveCell.Column).Select
   Else
      ActiveSheet.Columns(ActiveCell.Column).Find(targetString, 
        LookIn:=xlValues).Select
   End If
End Sub
Sub findLast()
   Dim targetString As String
   targetString = ActiveCell.Text

   If Cells(ActiveCell.row + 1, ActiveCell.Column).Text &lt;&gt; targetString Then
      Cells(ActiveCell.row + 1, ActiveCell.Column).Select
   Else
      ActiveSheet.Columns(ActiveCell.Column).Find(targetString,
        SearchDirection:=xlPrevious, LookIn:=xlValues).Select
   End If
End Sub</pre>
<p>In both instances, we&#8217;re using the built-in function Excel uses to find values, similar to using Find or Find/Replace.  In the first function, we first check to make sure we&#8217;re not already at the first row, and if not, we use the find function to locate the first instance of the current value in the current column.  So, using our original example, if we were midway through the entries of Apples and wanted to return to the first Apple entry, this function would look at the Fruit column and search for the first instance of &#8220;Apple&#8221;.</p>
<p>The second function does a similar act, but uses the xlPrevious search direction.  Therefore, it starts at the first cell in the current column, and searches backwards for the current value.  This requires Excel to start from the bottom of the spreadsheet and search upwards.  So, if we are halfway through the &#8220;Apple&#8221; entries and use this function, Excel will start at cell A1048576 and search upward until reaching cell A200001, which would be the last hypothetical instance of &#8220;Apple&#8221;.</p>
<p>In either function, if the cell directly above or below (respectively) the active cell has a different value than the current value, that cell is simply selected.</p>
<br /> Tagged: <a href='http://guj800.wordpress.com/tag/excel/'>Excel</a>, <a href='http://guj800.wordpress.com/tag/find/'>Find</a>, <a href='http://guj800.wordpress.com/tag/series/'>Series</a>, <a href='http://guj800.wordpress.com/tag/unique/'>Unique</a>, <a href='http://guj800.wordpress.com/tag/vba/'>VBA</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=65&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2011/03/28/next-unique-and-previous-unique/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
		<item>
		<title>HAVING Keyword in SQL (or How to Calculate Loyalty with One Sentence)</title>
		<link>http://guj800.wordpress.com/2009/02/04/having-keyword-in-sql-or-how-to-calculate-loyalty-with-one-sentence/</link>
		<comments>http://guj800.wordpress.com/2009/02/04/having-keyword-in-sql-or-how-to-calculate-loyalty-with-one-sentence/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 18:28:11 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=60</guid>
		<description><![CDATA[This was a lot easier than I thought it would be.  For some back story &#8211; but without revealing too much about my industry - in our company, we have individuals who provide us with a great deal of business.  However, they provide our competitors with a great deal of business as well.  They are not contracted [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=60&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This was a lot easier than I thought it would be.  For some back story &#8211; but without revealing too much about my industry - in our company, we have individuals who provide us with a great deal of business.  However, they provide our competitors with a great deal of business as well.  They are not contracted to give us all of their business, and there&#8217;s really nothing we can do aside from creating solid business relationships in order to assure that they do give us at least most of their business.</p>
<p>So in order to easily determine which individuals are giving us most of their business (and we define that as over 70% of their business), I wrote something very similar to the following simple SQL statement (for MySQL):</p>
<pre style="padding-left:30px;">1. SELECT individual_id, count(1) AS total_volume,
2.  sum(case business when 'Us' then 1 else 0 end) as our_volume
3. FROM main_data_table
4. GROUP BY individual_id
5. HAVING our_volume / total_volume &gt;= 0.7;</pre>
<p>Note: the line items are not part of the SQL code &#8211; they were added to make explaining it easier.</p>
<p>I don&#8217;t normally do a lot with the HAVING keyword, but I suppose I ought to.  It comes in really handy in this example.  Here&#8217;s the breakdown of what&#8217;s going on:</p>
<p>1 : This is a stupid way of doing it (not the actual way I chose) but it essentially gives you a total number of line items for the individual_id.</p>
<p>2 : Two things are going on here.  First, we tell MySQL that when the line item represents our business (i.e. the center where the transaction happened was one of our centers), count it as 1.  Otherwise, count it as 0.  That way, when they are aggregated (using the sum() function), the result is the total number of line items for the individual_id that were completed at one of our centers.</p>
<p>5: This limits the results to those individual_id&#8217;s that produced at least 70% of their business at one of our centers.  You must use the HAVING keyword when you want to limit the results to a calculated aggregate qualifier.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=60&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2009/02/04/having-keyword-in-sql-or-how-to-calculate-loyalty-with-one-sentence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
		<item>
		<title>How I Feel Whenever I Submit a Possible Technological Change at Work</title>
		<link>http://guj800.wordpress.com/2008/11/26/how-i-feel-whenever-i-submit-a-possible-technological-change-at-work/</link>
		<comments>http://guj800.wordpress.com/2008/11/26/how-i-feel-whenever-i-submit-a-possible-technological-change-at-work/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 16:43:44 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=58</guid>
		<description><![CDATA[Here is an excellent article at McSweeney&#8217;s that just about perfectly expresses how I feel whenever I try to get management to agree to a change in processes, especially when technology is involved in the improvement. http://www.mcsweeneys.net/2008/11/13hodgman.html By the way, if you don&#8217;t already know, McSweeney&#8217;s is very guj.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=58&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is an excellent article at McSweeney&#8217;s that just about perfectly expresses how I feel whenever I try to get management to agree to a change in processes, especially when technology is involved in the improvement.</p>
<p><a href="http://www.mcsweeneys.net/2008/11/13hodgman.html">http://www.mcsweeneys.net/2008/11/13hodgman.html</a></p>
<p>By the way, if you don&#8217;t already know, McSweeney&#8217;s is very guj.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=58&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2008/11/26/how-i-feel-whenever-i-submit-a-possible-technological-change-at-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
		<item>
		<title>The Greatest and Best Fish in the World: A Tribute</title>
		<link>http://guj800.wordpress.com/2008/09/02/the-greatest-and-best-fish-in-the-world-a-tribute/</link>
		<comments>http://guj800.wordpress.com/2008/09/02/the-greatest-and-best-fish-in-the-world-a-tribute/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 20:55:10 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Death]]></category>
		<category><![CDATA[Fish]]></category>
		<category><![CDATA[Tribute]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=53</guid>
		<description><![CDATA[Having not written anything guj for what seems like ages, something happened over the Labor Day weekend that was incredibly non-guj, and for which I will write a tribute post.  My beta fish, Brutus, crossed over. Brutus was never a very intellectual fish.  When poised with the problem of how to fit his mouth around [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=53&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Having not written anything guj for what seems like ages, something happened over the Labor Day weekend that was incredibly non-guj, and for which I will write a tribute post.  My beta fish, Brutus, crossed over.</p>
<p>Brutus was never a very intellectual fish.  When poised with the problem of how to fit his mouth around the morsels of food I gave him, he failed at an alarming rate.  As he would lunge towards the surface, fully expecting to direct his mouth around the pellet, he would, more often than not, completely miss his target.  This caused the then tumultuous water to reverse the buoyancy of the pellet and drive it down to the murky rocky depths.  Brutus never even seemed to notice.  He would sit at the surface, waiting for another pellet from me, his dutiful master.</p>
<p>When he stopped eating as much, I never thought too much of it.  “He’s getting old,” thought I, “and has had enough of foolishness.  He must have learned that if he grazes the bottom of the tank, he will be able to suck the nutrients out of yesterday’s forgotten foodstuff, and will continue to live forever based on this new plan.”  Ah, but there was a nagging voice deep in my subconscious reminding me that he is indeed getting old, and perhaps this loss of appetite could mean other, more serious things.</p>
<p>I am not a veterinarian, nor do I think a veterinarian can do anything to cure an aging beta fish.  I do not harbor any regret for not having done more to sustain his little life.  All I could do was sit at my desk and watch him slowly decay, his breathing becoming more and more labored, his attitude more and more lethargic.  But I do curse this world for creating something so fragile, and forcing me to love it.</p>
<p>Brutus was a gift from my wife.  She wanted me to have a companion at my cubicle.  His presence seemed to brighten any day.  He was so eager to swim up and look at me when I arrived in the morning.  Yes, this was really just anticipation of the food pellets soon to rain into his tank, but it was pleasant nonetheless.  As days turned into months and finally years, his presence on my desk became a fixture, and I couldn’t imagine working if it weren’t beside him.</p>
<p>There were a few scares.  He stopped eating for about a week a year ago.  I was sure he was a goner.  Many of the symptoms I witnessed over the past few weeks were witnessed then as well.  But somehow, miraculously, he began to eat again, and I nursed him back to health.</p>
<p>When I changed jobs to a different building down the street, I entrusted Brutus to a coworker at the first job, while I moved and got settled in the second job.  When I finally retrieved Brutus from this woman, his tank smelled like a forgotten pond in a redneck’s back yard, and he seemed absolutely miserable.  I cleaned his tank, gave him some food, sat and talked with him, and he was happy.</p>
<p>Now he lies at the bottom of the tank – resting, peacefully, finally.  He is not struggling to breathe, and he is not forcing himself to rise to the surface in a futile attempt at eating.  I don’t have the heart today to flush him.  Maybe tomorrow.  Hopefully soon, because this is kind of depressing looking at a dead body all day.</p>
<p>I want him to stay peaceful, and I don’t want to think of his little fish body being blasted through miles of plumbing to end up in a water treatment plant.  He’s better than that.</p>
<p>Goodbye Brutus, old man.  It was a pleasure getting to know you.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/guj800.wordpress.com/53/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/guj800.wordpress.com/53/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=53&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2008/09/02/the-greatest-and-best-fish-in-the-world-a-tribute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
		<item>
		<title>Progressive Status Indicators in Excel</title>
		<link>http://guj800.wordpress.com/2008/07/10/progressive-status-indicators-in-excel/</link>
		<comments>http://guj800.wordpress.com/2008/07/10/progressive-status-indicators-in-excel/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 14:23:23 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Color]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=42</guid>
		<description><![CDATA[This is one of those posts that is really only for my own benefit. I recently decided to tackle the idea of rather than just putting red, yellow, and green indicator lights on a spreadsheet to indicate how close we were to meeting budget in certain areas, I would programatically allow Excel to determine how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=42&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is one of those posts that is really only for my own benefit.  I recently decided to tackle the idea of rather than just putting red, yellow, and green indicator lights on a spreadsheet to indicate how close we were to meeting budget in certain areas, I would programatically allow Excel to determine how &#8220;green&#8221; or how &#8220;red&#8221; we were, with yellow in the middle.</p>
<p>So, in other words, if red is RGB(250,0,0), yellow is RGB(250,250,0), and green is RGB(0,250,0), how do we gradually go from red to green depending on how far away from budget we are?  By the way, for those who don&#8217;t know, the RGB number format is simply three numbers from 0 to 250 that represent how much of each color red, green, and blue the computer ought to use to compose a color.  Adding red light to green light makes yellow light, so RGB(250,250,0) means you want to use pure red and pure green, but no blue in order to get yellow.</p>
<p>My first task was deciding how to measure the distance from budget.  After a lot of calculations, I realized it should simply be how far from 100% of the budget we were.  That leaves a scale of 0 to 100.  At 100, we want to just display green, and at 0 we want red.</p>
<p>My second task was fading from red to green by going through yellow.  My best solution was to split the task in half.  If the actual value was less than 50% of the goal, we would worry about fading from red to yellow (we would only need to mess with the green color).  If the actual value was more than 50%, we would fade from yellow to green (only mess with the red color).  In other words: If  50% of budget, green = 250, red = calculated value.  Blue is always 0.</p>
<p>Since there are 250 steps of color in the RGB scale, but only 125 for each half (red to yellow, yellow to green), then for every percent of budget, we want to add or remove 5 steps of color.</p>
<p>That&#8217;s all I need to explain, I think, in order to remember this later.  If you have any questions, I will gladly answer them.  What follows are two real-world examples taken straight from my current project. </p>
<p><code>Sub looper()</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;Dim mydiff As Double<br />
&nbsp;&nbsp;&nbsp;&nbsp;Dim i As Integer</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;For i = 5 To 10<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mydiff = (Cells(i, 23) - Cells(i, 24)) / Cells(i, 24)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call update_indicator("shp" &amp; i - 4, mydiff)<br />
&nbsp;&nbsp;&nbsp;&nbsp;Next i</p>
<p>End Sub</p>
<p>Sub update_indicator(strShape As String, dblVar As Double)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;Dim intR As Integer<br />
&nbsp;&nbsp;&nbsp;&nbsp;Dim intG As Integer<br />
&nbsp;&nbsp;&nbsp;&nbsp;Dim intB As Integer</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;intB = 0</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;If dblVar &lt; -0.5 Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;intR = 250<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;intG = 250 - (((Abs(dblVar) * 100) - 50) * 5)<br />
&nbsp;&nbsp;&nbsp;&nbsp;ElseIf dblVar &lt; 0 Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;intG = 250<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;intR = 0 + ((Abs(dblVar) * 100) * 5)<br />
&nbsp;&nbsp;&nbsp;&nbsp;Else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;intG = 250<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;intR = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;End If</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;ActiveSheet.Shapes(strShape).Select<br />
&nbsp;&nbsp;&nbsp;&nbsp;Selection.ShapeRange.Fill.ForeColor.RGB = RGB(intR, intG, intB)</p>
<p>End Sub</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/guj800.wordpress.com/42/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/guj800.wordpress.com/42/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=42&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2008/07/10/progressive-status-indicators-in-excel/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
		<item>
		<title>Phenomenology: The Urinal</title>
		<link>http://guj800.wordpress.com/2008/07/03/phenomenology-the-urinal/</link>
		<comments>http://guj800.wordpress.com/2008/07/03/phenomenology-the-urinal/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 14:07:05 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Phenomenology]]></category>
		<category><![CDATA[Manliness]]></category>
		<category><![CDATA[Observation]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=38</guid>
		<description><![CDATA[This is part of a series on phenomenology &#8211; loosely defined for this blog&#8217;s purposes as the unbiased study of the world with the intent of best understanding the ontology of existence. My goal is to humorously examine some of the lesser-examined aspects or circumstances of our world in order to keep the mind open [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=38&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>This is part of a series on phenomenology &#8211; loosely defined for this blog&#8217;s purposes as the unbiased study of the world with the intent of best understanding the ontology of existence.  My goal is to humorously examine some of the lesser-examined aspects or circumstances of our world in order to keep the mind open and receptive.</em></p>
<p><em>Note: this is a repost of a journal entry I made several years ago.  It is only meant to kick-start the series, and should not be taken seriously.</em></p>
<p>Upon entering the men&#8217;s room, one is generally faced, depending on the particular layout and size of the restroom, with a row of sinks, a row of urinals, and a row of stalls. It is usually a good idea to abstain from entering these stalls, as there is oft found the fecal matter of a supposed Harley rider, construction worker, or truck driver. When entering the space of the urinal, you will usually find a split horizon of urinal elevations, one for adults and one for children. The former can use both elevations, but the latter is generally confined to the lower-placed urinals unless tactical maneuvering is employed.</p>
<p>A urinal is rectangular shaped &#8211; more tall than it is wide. At the bottom of the urinal is a bowl which collects the urine. Sometimes (though not often enough) there is a two inch tall or so cylinder which is a scented &#8220;cake&#8221; called a &#8220;urinal cake&#8221; that neutralizes the urine odor. At the top there is a pipe springing forth vertically and attached is either a lever or a motion detector both affecting the same flushing system. Occasionally you will come across a urinal that works. By this I mean that when flushed, the urine will successfully leave the bowl. More often than not, there will be urine awaiting you (whether or not the urinal works).</p>
<p>When you approach the urinal you will find that the bowl is carved to fit your legs; thus, when standing directly in front of the urinal, you are able to position yourself such that your business is actually <em>inside</em> the urinal, and as such you are able to determine your own vulnerability of peeping eyes. Some men stand as much as half a foot away from the urinal, confident that their neighbors will keep their eyes forward, while others will stand as close to the urinal as possible (so close, in fact, that their business might actually scrape the wall of the urinal). Sometimes there will be a mini-wall partition, known affectionately as a &#8220;splash guard&#8221; that is high enough to block one&#8217;s neighbor&#8217;s peering eyes, yet low enough to maintain sight of the face of said neighbor.  The most rare form of such partition is a full-wall partition, which juts out from the wall from the floor to the ceiling.  So far, the only sightings of these have been at Hooters restaurants.</p>
<p>When removing your penis, it is best to do so smoothly, with no strange movements that might be misinterpreted. If wearing boxer shorts or boxer briefs, I recommend simply unzipping, fishing, and revealing, but keep the fishing to a minimum. If not, you will need to unbutton your pants and pull down the undergarment, which amounts to a sometimes devastating amount of extra time.</p>
<p>There is some controversy regarding how to stand while relieving yourself. In my opinion, it is best to stand with feet shoulder width apart, your right hand commanding the stream and your left hand in your pocket, on your waist, or resting on the upper urinal area. While going at it, it is best to remain with your eyes and face forward, either maintaining a constant vigil of your crotch or staring at the wall directly in front of you. Some men are comfortable with and actually encourage talking during the deed, and some of these are equally comfortable with eye contact during these conversations. However, in order to make it a pleasing experience for the widest participating group, it is best to remain silent and static.</p>
<p>Following urination, a follow-up jingle is necessary (though you will likely fall prey to the men&#8217;s room mantra: &#8220;No matter how you jump and dance, the last two drops go down your pants.&#8221;). Then a flush and reintroduction of penis to pants. I do this simultaneously, but the less experienced may need to do one at a time. In this case, I recommend flushing first, because while the water is running, you have a window of opportunity to settle yourself before the next guy in line gets antsy. There are many methods of reintroduction, the simplest of which is a manual relocation of the penis. Some of the more creative may choose to hold the zipper open while maneuvering their hips such that the penis falls naturally back into place. But whatever your style, do it quickly and move with confidence, lest you be perceived as an amateur. You then may choose one of the following three options: leave the restroom without washing your hands; run a little water over your hands and dry them by air, paper towel, or by running them through your hair; or thoroughly wash your hands using the supplied soap and dry them via one of the above methods. When leaving the restroom, try not to focus on the fact that regardless of your hand-washing choice, countless other men chose the first option and used the same door handle you are now using.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/guj800.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/guj800.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=38&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2008/07/03/phenomenology-the-urinal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting Information From the Web Using Excel VBA</title>
		<link>http://guj800.wordpress.com/2008/06/30/getting-information-from-the-web-using-excel-vba/</link>
		<comments>http://guj800.wordpress.com/2008/06/30/getting-information-from-the-web-using-excel-vba/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 02:52:43 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=36</guid>
		<description><![CDATA[What we&#8217;re trying to do today is get a value from a webpage and return it to a custom function within Excel. I&#8217;m going to use a very simple example, and it should be inferred that this is only for very simple tasks. The information you seek to return to your function will need to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=36&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What we&#8217;re trying to do today is get a value from a webpage and return it to a custom function within Excel. I&#8217;m going to use a very simple example, and it should be inferred that this is only for very simple tasks. The information you seek to return to your function will need to be presented on the webpage the same way every time you visit it, because all you&#8217;re doing is skipping the web browser, bringing the background contents of the webpage into a string, and parsing the string to pull out the data you want.</p>
<p>What I mean by the &#8220;background contents&#8221; is the code behind all webpages. When your browser calls up a URL, it receives a bunch of code, which it uses to render the page to you. If you&#8217;re unfamiliar with HTML code, you may have a bit more difficulty with this, but all you really need to be able to do is recognize where your information is always kept within this code. This sounds more complicated than it is, really.</p>
<p>For my example, I want to create a function called &#8220;temperature&#8221; to which I can pass a city and state, and from which I can gather the current temperature of that city. I live in Orlando, FL, so that is the temperature I want to know.</p>
<p><strong>Important:</strong> The first stumbling block in this project is the need for a special reference from within Excel VBA &#8212; the Microsoft Internet Transfer Control reference. You may need to download msinet.ocx (you can find it pretty easily through popular search engines) in order to add this reference. To add a reference, click Tools -&gt; References from within the VBA window, locate the reference, and select it. If the reference is not available, download msinet.ocx, put it somewhere easy like \Windows\System, and then locate the file via &#8220;Browse&#8230;&#8221; from the references window.</p>
<p>The code for my example function follows, and I will explain everything in the following paragraphs:</p>
<p><code>Function temperature(strCity as string)</code></p>
<p><code>strCity = Replace(strCity, ", ", "%2C+")</code></p>
<p><code>&nbsp;&nbsp;Dim myURL As String<br />
&nbsp;&nbsp;myURL="http://search.msn.com/results.aspx?q=current+temperature+" _<br />
&nbsp;&nbsp;&nbsp;&nbsp;&amp; strCity</code></p>
<p><code>&nbsp;&nbsp;Dim inet1 as inet<br />
&nbsp;&nbsp;Dim mypage As String</code></p>
<p><code>&nbsp;&nbsp;Set inet1 = New Inet<br />
&nbsp;&nbsp;With inet1<br />
&nbsp;&nbsp;&nbsp;&nbsp;.Protocol = icHTTP<br />
&nbsp;&nbsp;&nbsp;&nbsp;.URL = myURL<br />
&nbsp;&nbsp;&nbsp;&nbsp;mypage = .OpenURL(.URL, icString)<br />
&nbsp;&nbsp;End With<br />
&nbsp;&nbsp;Set inet1 = nothing</code></p>
<p><code>&nbsp;&nbsp;Dim intStart As Integer, intEnd As Integer<br />
&nbsp;&nbsp;intStart = InStr(mypage, "&lt;span class=""wea_temp""&gt;&lt;/span&gt;") + 22<br />
&nbsp;&nbsp;intEnd = InStr(intStart, mypage, "&amp;")</code></p>
<p><code>&nbsp;&nbsp;temperature = mid(mypage, intStart, (intEnd - intStart))</code></p>
<p><code>End Function</code></p>
<p>I&#8217;ll take you line-by-line through this somewhat lengthy example function. To begin, the name &#8220;temperature&#8221; and the parameter strCity means that when you input this function into a cell within Excel, you would type &#8220;=temperature&#8221; followed by the city and state in quotes and parenthesis, i.e. &#8216;=temperature(&#8220;Orlando, FL&#8221;)&#8217;.</p>
<p>The second line takes strCity and replaces the comma with &#8220;%2C+&#8221;. The reasoning for this is to properly construct the URL. In the language of a URL, %2C means &#8220;comma&#8221;, and the + denotes a space. You can&#8217;t have spaces or punctuation marks in URLs.</p>
<p>Then we declare myURL, which is what we would have typed into the web browser. If you were to go to msn.com and search for something (like &#8216;current temperature Orlando, FL&#8217;), then looked at the address bar, you would see something like this. In fact, that&#8217;s how I constructed the string, and that&#8217;s how I urge you to go about this as well. We add our city and state &#8211; gathered from the function parameter &#8211; to the end of the string.</p>
<p>The next part gets a little vague for me, because I haven&#8217;t had much experience with the Internet Transfer Control. Like most controls, you need to first point a variable to it (&#8220;Dim inet1 as inet&#8221;), and then initialize it (&#8220;Set inet1 = New Inet&#8221;). In our example, we need to worry about three aspects of the Inet control &#8211; Protocol, URL, and OpenURL. The first two are parameters, and in our case will be icHTTP for the protocol, and the URL we have already constructed as the URL.</p>
<p>The third (OpenURL) is the method we&#8217;re using to hit the URL. The two parameters you need to pass to it are the URL to hit and what to do with the result. Since we&#8217;re only interested in the webpage itself and not any files that might be downloaded, we just want to return the value to a string, hence, we tell it to use the icString data type. icString is a data type unique to the Internet Transfer Control, and unfortunately, I don&#8217;t know much about it except that it can be transferred to a standard string data type.</p>
<p>We complete the web hit with the statement &#8220;Set inet1 = nothing&#8221; in order to clear out our memory. This is just good practice.</p>
<p>This is the fun and somewhat difficult part. If you search in msn for the temperature in Orlando, FL and then take a look at the source of the website through a standard browser, you&#8217;ll see a lot of stuff that means nothing to you. Buried in all of this stuff is the current temperature. The easiest thing to do in this case was to search msn, get the actual temperature, and then search for that number in the source. I then noticed that the temperature occurs directly after the first instance of the phrase &#8216;&lt;span class=&#8221;wea_temp&#8221;&gt;&#8217;. The InStr function tells me what character within the HTML code begins that phrase, and as the phrase is 23 characters long, we add 22 to that number. Immediately after the temperature was the character &#8220;&amp;&#8221;, so we perform another InStr function (passing our first value as the start point for that function) to get the first instance of &#8220;&amp;&#8221; following the temperature. The temperature is then recorded using the mid function, which asks for the string, the start value, and the length of the string you&#8217;re asking for (which would be the position of the &#8220;&amp;&#8221; minus the position of the first character of the temperature).</p>
<p>Like I said, that&#8217;s the difficult part. You have to be able to read through all that code to find your value, and you have to play around with the InStr and mid functions to get the right numbers. This is also why it&#8217;s vital that you only do this with static pages. I know msn.com will always return the temperature of the city and state I search for at the top of the search results, so I am confident that this function won&#8217;t break. But if msn.com put the temperature arbitrarily in the list of search results, this would be substantially more difficult.</p>
<p><strong>UPDATE:</strong> For a second example of how this might be put to use in order to calculate drive times between two addresses, latitude and longitude pairings, zip codes, etc., see my post <a href="http://guj800.wordpress.com/2011/04/27/drive-time-calculations-in-excel/">http://guj800.wordpress.com/2011/04/27/drive-time-calculations-in-excel/</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/guj800.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/guj800.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=36&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2008/06/30/getting-information-from-the-web-using-excel-vba/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
		<item>
		<title>Religion as a Threat to Scientific Progress</title>
		<link>http://guj800.wordpress.com/2008/06/24/religion-as-a-threat-to-scientific-progress/</link>
		<comments>http://guj800.wordpress.com/2008/06/24/religion-as-a-threat-to-scientific-progress/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 15:25:42 +0000</pubDate>
		<dc:creator>JD</dc:creator>
				<category><![CDATA[Critique]]></category>
		<category><![CDATA[Religion]]></category>
		<category><![CDATA[Society]]></category>

		<guid isPermaLink="false">http://guj800.wordpress.com/?p=33</guid>
		<description><![CDATA[In one of my new favorite websites, Secular Philosophy, a well-known contemporary philosopher by the name of Daniel Dennett wrote recently that religion is potentially the largest threat to rationality and scientific progress that we have in the world today. He claims other debilitating factors – for example, alcohol, television, or addictive video games – [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=33&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In one of my new favorite websites, <a href="http://blog.secularphilosophy.com/" target="_self">Secular Philosophy</a>, a well-known contemporary philosopher by the name of Daniel Dennett wrote <a href="http://blog.secularphilosophy.com/?entry=entry080623-072155" target="_self">recently</a> that religion is potentially the largest threat to rationality and scientific progress that we have in the world today. He claims other debilitating factors – for example, alcohol, television, or addictive video games – though powerful enough to negatively affect our critical faculties, are not as corrupting as religion. Religion, he claims,</p>
<blockquote><p>has a feature of that none of them can boast: it doesn&#8217;t just disable, it honours the disability. People are revered for their capacity to live in a dream world, to shield their minds from factual knowledge and make the major decisions of their lives by consulting voices in their heads that they call forth by rituals designed to intoxicate them.</p></blockquote>
<p>Dennett cries for the abolition of religion from all of humanity, for it is like a parasite holding its hosts back from truly realizing their full potential. He closes his argument with the following paragraph:</p>
<blockquote><p>The better is enemy of the best: religion may make many people better, but it is preventing them from being as good as they could be. If only we could transfer all that respect, loyalty and intense devotion from an imaginary being &#8211; God &#8211; to something real: the wonderful world of goodness we and our ancestors have made, and of which we are now the stewards.</p></blockquote>
<p>He is writing to a world-wide audience. However, it is only a small percentage of the world that is or could be performing actions that better or worsen it – definitely on the large scale, but even on the small. The large majority of people with whom I come in contact on a daily basis are not and will never change the world. Regardless of whether or not they go home at night and pray to a god or whether or not they attend church on their Sabbath.</p>
<p>Dennett makes believe that the average person is expending all of his vast energy banks on being faithful when he could be working towards bettering the planet. However, I submit that the average person is neither intelligent enough nor eager to expend any great deal of energy on something not immediately beneficial to him. The average person hasn’t graduated college &#8211; only 28.7% of Americans over the age of 25 had at least a Bachelor’s degree in 2007 (source: <a href="http://www.census.gov/population/www/socdemo/education/cps2007.html" target="_blank">U. S. Census Bureau</a>). The average person watches reality television and sitcoms. The average person shops at Wal-Mart.</p>
<p>There is nothing wrong with watching reality television and shopping at Wal-Mart, and there certainly is nothing wrong with skipping college altogether, for the education of arts and sciences gained these days can be superseded easily by reading a couple dozen books available freely from the public library. My point is merely this: if the average person was non-religious, then the only difference we would see would be in the lives of average people themselves. Even then, I have not found many religious people who spend any amount of time ensuring that they are even living their lives according to that religion.</p>
<p>I agree with Dennett’s writing, however, when applied to the movers and shakers of the world today. Dennett writes of a man in “Liberated” Afghanistan who is being held on death row having been charged with blasphemy. Even today we see many laws being made or not made in America based on religious foundations. Such topics as gay marriage and stem cell research are being debated using words such as “right” and “wrong” – these notions are defined by religion. If the leaders of the world were able to step back from the bias of their faith and dictate law and order based on pure reason and rationality, perhaps the world would be a very different and more advanced place.</p>
<p>Then again, humans may be unable to do this. It’s not as if one person decided he was going to invent this thing called religion and soon got the rest of the world to buy into it. All societies in every corner of the globe eventually created their own religion autonomously. It’s almost as if it is a fundamental need, either of human beings and mankind as a whole, or at least of a society that hopes to attain any sort of order. Humans needed religion to explain the unexplainable, and societies needed religion to define boundaries of actions.</p>
<p>I’m not prepared to take either stance – neither that religion should be replaced with pure reason, nor that religion is an institution that has produced more benefit than detriment. However, I do hold that the average person is not going to put down a Bible and pick up a book on Ethics if he was abolished of his religion. He would simply have more time to mow the yard and watch TV.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/guj800.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/guj800.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/guj800.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/guj800.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/guj800.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/guj800.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/guj800.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/guj800.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/guj800.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/guj800.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/guj800.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/guj800.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/guj800.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/guj800.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/guj800.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/guj800.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=guj800.wordpress.com&amp;blog=3886407&amp;post=33&amp;subd=guj800&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://guj800.wordpress.com/2008/06/24/religion-as-a-threat-to-scientific-progress/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">JD</media:title>
		</media:content>
	</item>
	</channel>
</rss>
