<?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>Hotchkiss Consulting</title>
	<atom:link href="http://hotchkissconsulting.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://hotchkissconsulting.net</link>
	<description>We make the web work for you</description>
	<lastBuildDate>Sun, 11 Jul 2010 23:07:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Twilio with CodeIgniter&#8211; a model for rapid development</title>
		<link>http://hotchkissconsulting.net/2010/07/using-twilio-with-codeigniter-a-model-for-rapid-development/</link>
		<comments>http://hotchkissconsulting.net/2010/07/using-twilio-with-codeigniter-a-model-for-rapid-development/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 18:41:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Twilio]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=290</guid>
		<description><![CDATA[I&#8217;ve developed a CodeIgniter model (attached below) for rapid development of a Twilio-powered app.  If you&#8217;re not familiar, Twilio lets you develop web apps that interface with telephony via an XML-based API.
This model only deals with incoming calls at the moment, but if I get some feedback (or need it for my own purposes), [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve developed a CodeIgniter model (attached below) for rapid development of a Twilio-powered app.  If you&#8217;re not familiar, Twilio lets you develop web apps that interface with telephony via an XML-based API.</p>
<p>This model only deals with incoming calls at the moment, but if I get some feedback (or need it for my own purposes), I&#8217;ll update it to initiate outgoing calls, voice-&gt;text,  as well.</p>
<p>Here&#8217;s an example of usage:<br />
<code><br />
$body = $this-&gt;twilio-&gt;say('Thanks for calling!', 'woman');<br />
$gath = $this-&gt;twilio-&gt;say('Please enter your ID number then press pound');<br />
$body .= $this-&gt;twilio-&gt;gather($gath, '/voice/process/idcheck/', 6);<br />
$body .= $this-&gt;twilio-&gt;redirect('/voice/answer/noid/');<br />
echo $this-&gt;twilio-&gt;build($body);<br />
</code></p>
<p>These 4 lines, generate the appropriate XML code to have a computerized woman&#8217;s voice say &#8220;Thanks for calling!&#8221;, then the script starts listening for touch-tone entry of a 6 digit number and says, in a male voice, &#8220;Please enter your ID number then press pound&#8221;.  If a 6 digit number is entered, it POSTs it to /voice/process/idcheck/, if not, it redirects to /voice/answer/noid/</p>
<h2>The model is available for download <a href="http://bit.ly/bxvJxx">here</a>.</h2>
<p>Questions?  Problems?  I&#8217;m happy to help.</p>
<p>Want Hotchkiss Consulting to help develop your phone-based app?  <a href="mailto:contact@hotchkissconsulting.net">We&#8217;d love to</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2010/07/using-twilio-with-codeigniter-a-model-for-rapid-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manually adding Social Media links to a WordPress Theme</title>
		<link>http://hotchkissconsulting.net/2010/02/manually-adding-social-media-links-to-a-wordpress-theme/</link>
		<comments>http://hotchkissconsulting.net/2010/02/manually-adding-social-media-links-to-a-wordpress-theme/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 05:59:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-To]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=284</guid>
		<description><![CDATA[Here&#8217;s a set of links to add your posts to Digg, Twitter, StumbleUpon, Del.icio.us, Facebook, MySpace, Google Bookmarks, Technorati, AddThis, and Reddit&#8211; I always end up needing these for themes I&#8217;m building, so I thought I&#8217;d pass them along!

&#60;!-- Digg --&#62;
&#60;a href=&#34;http://digg.com/submit?url=&#60;?php the_permalink(); ?&#62;&#38;title=&#60;?php the_title(); ?&#62;&#34; rel=&#34;nofollow&#34; title=&#34;Submit to Digg&#34; target=&#34;_blank&#34;&#62;&#60;img src=&#34;&#60;?php bloginfo(&#x27;template_directory&#x27;); ?&#62;/images/social/digg.gif&#34; alt=&#34;Digg&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a set of links to add your posts to Digg, Twitter, StumbleUpon, Del.icio.us, Facebook, MySpace, Google Bookmarks, Technorati, AddThis, and Reddit&#8211; I always end up needing these for themes I&#8217;m building, so I thought I&#8217;d pass them along!</p>
<p><code><br />
&lt;!-- Digg --&gt;<br />
&lt;a href=&quot;http://digg.com/submit?url=&lt;?php the_permalink(); ?&gt;&amp;title=&lt;?php the_title(); ?&gt;&quot; rel=&quot;nofollow&quot; title=&quot;Submit to Digg&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/digg.gif&quot; alt=&quot;Digg&quot; title=&quot;Digg&quot; /&gt;&lt;/a&gt;<br />
&lt;!-- Twitter --&gt;<br />
&lt;a title=&quot;Tweet About It!&quot; href=&quot;http://twitter.com/home?status=&lt;?php the_title(); ?&gt; &lt;?php the_permalink(); ?&gt;&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/twitter.gif&quot; alt=&quot;Twitter&quot; title=&quot;Twitter&quot; /&gt;&lt;/a&gt;<br />
&lt;!-- StumbleUpon --&gt;<br />
&lt;a href=&quot;http://www.stumbleupon.com/submit?url=&lt;?php the_permalink(); ?&gt;&amp;title=&lt;?php the_title(); ?&gt;&quot; rel=&quot;nofollow&quot; title=&quot;Stumble It!&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/stumbleupon.gif&quot; alt=&quot;StumbleUpon&quot; title=&quot;StumbleUpon&quot; /&gt;&lt;/a&gt;<br />
&lt;!-- Delicious --&gt;<br />
&lt;a href=&quot;http://delicious.com/save?url=&lt;?php urlencode(the_permalink()); ?&gt;&amp;amp;title=&lt;?php urlencode(the_title()); ?&gt;&quot; onclick=&quot;window.open(&#x27;http://delicious.com/save?v=5&amp;amp;noui&amp;amp;jump=close&amp;amp;url=&lt;?php urlencode(the_permalink()); ?&gt;&amp;amp;title=&lt;?php urlencode(the_title()); ?&gt;&#x27;, &#x27;delicious&#x27;, &#x27;toolbar=no,width=550,height=550&#x27;); return false;&quot; title=&quot;Bookmark this post on del.icio.us&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/delicious.gif&quot; alt=&quot;Delicious&quot; title=&quot;Delicious&quot; /&gt;&lt;/a&gt;<br />
&lt;!-- Facebook --&gt;<br />
&lt;a href=&quot;http://www.facebook.com/share.php?u=&lt;?php the_permalink(); ?&gt;&quot; rel=&quot;nofollow&quot; title=&quot;Share on Facebook&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/facebook.gif&quot; alt=&quot;Facebook&quot; title=&quot;Facebook&quot; /&gt;&lt;/a&gt;<br />
&lt;!-- MySpace --&gt;<br />
&lt;a href=&quot;javascript:GetThis(&#x27;&lt;?php the_title(); ?&gt;&#x27;,&#x27;&lt;?php the_excerpt(); ?&gt;&#x27;, &#x27;&lt;?php the_permalink(); ?&gt;&#x27;)&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/myspace.gif&quot; alt=&quot;MySpace&quot; title=&quot;MySpace&quot; /&gt;&lt;/a&gt;<br />
&lt;!-- Google Bookmarks --&gt;<br />
&lt;a href=&quot;http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=&lt;?php the_permalink(); ?&gt;&quot; rel=&quot;nofollow&quot; title=&quot;Bookmark on Google&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/google.gif&quot; alt=&quot;Google Bookmarks&quot; title=&quot;Google Bookmarks&quot; /&gt;&lt;/a&gt;<br />
&lt;!-- Technorati --&gt;<br />
&lt;a href=&quot;http://technorati.com/faves?add=&lt;?php the_permalink(); ?&gt;&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/technorati.gif&quot; alt=&quot;Technorati&quot; title=&quot;Technorati&quot; /&gt;&lt;/a&gt;<br />
&lt;!-- AddThis --&gt;<br />
		&lt;a class=&quot;addthis_button&quot; href=&quot;http://www.addthis.com/bookmark.php?v=250&amp;amp;username=xa-4b6908a945df8eb0&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/addthis.gif&quot;  alt=&quot;Bookmark and Share&quot; style=&quot;border:0&quot;/&gt;&lt;/a&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4b6908a945df8eb0&quot;&gt;&lt;/script&gt;<br />
&lt;!-- Reddit --&gt;<br />
&lt;a href=&quot;http://reddit.com/submit?url=&lt;?php the_permalink(); ?&gt;&quot; rel=&quot;nofollow&quot; title=&quot;Submit to Reddit&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo(&#x27;template_directory&#x27;); ?&gt;/images/social/reddit.gif&quot; alt=&quot;Reddit&quot; title=&quot;Reddit&quot; /&gt;&lt;/a&gt;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2010/02/manually-adding-social-media-links-to-a-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In a WordPress theme, only show an element on the first page</title>
		<link>http://hotchkissconsulting.net/2010/02/in-a-wordpress-theme-only-show-an-element-on-the-first-page/</link>
		<comments>http://hotchkissconsulting.net/2010/02/in-a-wordpress-theme-only-show-an-element-on-the-first-page/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 05:54:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-To]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=283</guid>
		<description><![CDATA[I just had a colleague shoot me a quick question&#8211; he had a flash animated header that he wanted to only show up on the home page, so he wanted to know how he could keep it in the header, but only have it show up on that home page.  Without further ado, here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I just had a colleague shoot me a quick question&#8211; he had a flash animated header that he wanted to only show up on the home page, so he wanted to know how he could keep it in the header, but only have it show up on that home page.  Without further ado, here&#8217;s the code:<br />
<code><br />
&lt;?php if (is_home()) : ?&gt;<br />
	&lt;!-- Content to only show on the home page --&gt;<br />
&lt;?php endif; ?&gt;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2010/02/in-a-wordpress-theme-only-show-an-element-on-the-first-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Easily Add Twitter Status to any page with PHP</title>
		<link>http://hotchkissconsulting.net/2010/02/easily-add-twitter-status-to-any-page-with-php/</link>
		<comments>http://hotchkissconsulting.net/2010/02/easily-add-twitter-status-to-any-page-with-php/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 01:50:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=282</guid>
		<description><![CDATA[Quick post&#8211; I found a lot of answers to this problem but none that really worked for me&#8230;
This will output your latest twitter status, converting any URLs or email addresses to clickable links:
function get_status($twitterid) {
	$xml = @simplexml_load_file(&#x27;http://twitter.com/statuses/user_timeline/&#x27;.$twitterid.&#x27;.xml?count=1&#x27;);
		if($xml-&#62;status) {
	       foreach($xml-&#62;status as $status){
			$text = $status-&#62;text;
			$text = html_entity_decode($text);
			$text = &#34; &#34;.$text;
			$text = [...]]]></description>
			<content:encoded><![CDATA[<p>Quick post&#8211; I found a lot of answers to this problem but none that really worked for me&#8230;</p>
<p>This will output your latest twitter status, converting any URLs or email addresses to clickable links:</p>
<p><code>function get_status($twitterid) {<br />
	$xml = @simplexml_load_file(&#x27;http://twitter.com/statuses/user_timeline/&#x27;.$twitterid.&#x27;.xml?count=1&#x27;);<br />
		if($xml-&gt;status) {<br />
	       foreach($xml-&gt;status as $status){<br />
			$text = $status-&gt;text;<br />
			$text = html_entity_decode($text);<br />
			$text = &quot; &quot;.$text;<br />
			$text = eregi_replace(&#x27;(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&amp;//=]+)&#x27;,<br />
			   &#x27;&lt;a href=&quot;\\1&quot; target=_blank&gt;\\1&lt;/a&gt;&#x27;, $text);<br />
			$text = eregi_replace(&#x27;(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&amp;//=]+)&#x27;,<br />
			   &#x27;&lt;a href=&quot;\\1&quot; target=_blank&gt;\\1&lt;/a&gt;&#x27;, $text);<br />
			$text = eregi_replace(&#x27;([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&amp;//=]+)&#x27;,<br />
			&#x27;\\1&lt;a href=&quot;http://\\2&quot; target=_blank&gt;\\2&lt;/a&gt;&#x27;, $text);<br />
			$text = eregi_replace(&#x27;([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})&#x27;,<br />
			&#x27;&lt;a href=&quot;mailto:\\1&quot; target=_blank&gt;\\1&lt;/a&gt;&#x27;, $text);<br />
			$text .= &quot;&lt;h4&gt;Posted from $status-&gt;source&lt;/h4&gt;&quot;;<br />
	       }} else {<br />
		return &#x27;Trouble in Twittersville, API not loading, sorry!&#x27;;<br />
		}<br />
	       return $text;<br />
}<br />
</code></p>
<p>Then, to call it, just use this function:</p>
<p><code><br />
get_status('YOUR_TWITTER_ID');<br />
</code></p>
<p>with your numerical Twitter ID in the obvious spot.  You can find your Twitter ID by looking at the URL for your Twitter RSS feed, which will be:</p>
<p>http://twitter.com/statuses/user_timeline/YOUR_TWITTER_ID.rss</p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2010/02/easily-add-twitter-status-to-any-page-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing content for non-active languages with qTranslate</title>
		<link>http://hotchkissconsulting.net/2010/01/accessing-content-for-non-active-languages-with-qtranslate/</link>
		<comments>http://hotchkissconsulting.net/2010/01/accessing-content-for-non-active-languages-with-qtranslate/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 21:17:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Technologies]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=271</guid>
		<description><![CDATA[I&#8217;ve recently been working on a new site for a large Jewish philanthropic organization, developing a (very) custom WordPress theme for their site&#8211; when it came to coming up with a way to handle bilingual English/Hebrew content, we tried a few WordPress plugins before settling on Qian Qin&#8217;s qTranslate, which has been wonderful&#8211; great user [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been working on a new site for a large Jewish philanthropic organization, developing a (very) custom WordPress theme for their site&#8211; when it came to coming up with a way to handle bilingual English/Hebrew content, we tried a few WordPress plugins before settling on Qian Qin&#8217;s <a href="http://www.qianqin.de/qtranslate/">qTranslate</a>, which has been wonderful&#8211; great user interface, easy for the client to grasp, easy to work with.  The one problem I encountered way that there is no easy way to reach across languages for content, which was necessary for one section of the site where English content needed to appear alongside Hebrew content.  Without any further ado, here&#8217;s the snippet of code I came up with to get at both languages&#8211; you are left with $p_title and $p_body which are both arrays, and you need to make sure to substitute your language in for Hebrew, and your language 2 letter code in for iw on line 3:</p>
<pre>$enddelim = '&lt;!--:--&gt;';
 $englishdelim = '&lt;!--:en--&gt;';
 $hebrewdelim = '&lt;!--:iw--&gt;';

 $getpost = get_posts('post_type=page&amp;include='.$post-&gt;ID);
 foreach($getpost as $p2) :
 setup_postdata($p2);
 $both_titles = 'blah'.$p2-&gt;post_title;
 $both_bodies = 'blah'.$p2-&gt;post_content;
 endforeach;

 if(strpos($both_titles, $englishdelim)) :
 $pt1 = explode($englishdelim, $both_titles);
 $pt2 = explode($enddelim, $pt1[1]);
 $p_title['english'] = $pt2[0];
 endif;

 if(strpos($both_titles, $hebrewdelim)) :
 $pt1 = explode($hebrewdelim, $both_titles);
 $pt2 = explode($enddelim, $pt1[1]);
 $p_title['hebrew'] = $pt2[0];
 endif;

 if(strpos($both_bodies, $englishdelim)) :
 $pt1 = explode($englishdelim, $both_bodies);
 $pt2 = explode($enddelim, $pt1[1]);
 $p_body['english'] = $pt2[0];
 endif;

 if(strpos($both_bodies, $hebrewdelim)) :
 $pt1 = explode($hebrewdelim, $both_bodies);
 $pt2 = explode($enddelim, $pt1[1]);
 $p_body['hebrew'] = $pt2[0];
 endif;</pre>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2010/01/accessing-content-for-non-active-languages-with-qtranslate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Calculating age with PHP using a birth date</title>
		<link>http://hotchkissconsulting.net/2009/11/calculating-age-with-php-using-a-birth-date/</link>
		<comments>http://hotchkissconsulting.net/2009/11/calculating-age-with-php-using-a-birth-date/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 08:21:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-To]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=258</guid>
		<description><![CDATA[UPDATED 12/2: Code updated for efficiency and code download link added.
Ran into a problem today&#8211; there&#8217;s no easy way to add and subtract dates in PHP and be left with standard units (year, month, day, etc), so I whipped up a quick script to do it&#8211; the biggest problem is months, here, since PHP deals [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATED 12/2: Code updated for efficiency and <a href="http://tr.im/Gqgq">code download link</a> added.</p>
<p>Ran into a problem today&#8211; there&#8217;s no easy way to add and subtract dates in PHP and be left with standard units (year, month, day, etc), so I whipped up a quick script to do it&#8211; the biggest problem is months, here, since PHP deals with second-based timestamps, and months don&#8217;t possess a standard number of seconds.  Without further ado, here&#8217;s the code&#8211; I hope it&#8217;s helpful to your projects:<br />
<span id="more-258"></span><br />
<code></p>
<p>//Set the $year, $month, and $day variables to the date you're calculating time since.</p>
<p>/////////////////////////////////////////////////////////////////////<br />
// Calculate age<br />
/////////////////////////////////////////////////////////////////////<br />
	//Set your time zone so PHP5 doesn't balk<br />
	date_default_timezone_set('America/Denver');<br />
	$birthday = strtotime($year.'-'.$month.'-'.$day);<br />
	$current_time = time();<br />
	$curr['month'] = date('n', $current_time);<br />
	$curr['lastmonth'] = $curr['month'] - 1;<br />
	$curr['year'] = date('Y', $current_time);<br />
	$curr['lastyear'] = $curr['year'] - 1;<br />
	$curr['day'] = date('j', $current_time);</p>
<p>	//get the time difference in seconds<br />
	$diff = $current_time - $birthday;<br />
	$age['years'] = intval($diff/31556926);<br />
	//get the remaining seconds<br />
	$diff = $diff - (31556926 * $age['years']);<br />
	//Now for the tricky part-- number of months<br />
	if($curr['month'] > $month) {<br />
		$age['months'] = $curr['month'] - $month;<br />
		if($curr['day'] < $day) {<br />
			$age['months']--;<br />
			$month_temp = strtotime($curr['year'].'-'.$curr['lastmonth'].'-'.$day);<br />
		} else {<br />
			$month_temp = strtotime($curr['year'].'-'.$curr['month'].'-'.$day);<br />
		}<br />
		//Get the remaining seconds<br />
		$diff = $current_time - $month_temp;<br />
	} elseif($curr['month'] == $month) {<br />
		if($curr['day'] >= $day) {<br />
			$age['months'] = 0;<br />
			//since months are 0, we don't need to alter diff<br />
		} else {<br />
			$age['months'] = 11;<br />
			//Get the remaining seconds<br />
			$month_temp = strtotime($curr['year'].'-'.$curr['lastmonth'].'-'.$day);<br />
			$diff = $current_time - $month_temp;<br />
		}<br />
	} else {<br />
		$age['months'] = $curr['month'] - $month + 12;<br />
		if($curr['day'] < $day) {<br />
			$age['months']--;<br />
			$month_temp = strtotime($curr['year'].'-'.$curr['lastmonth'].'-'.$day);<br />
		} else {<br />
			$month_temp = strtotime($curr['year'].'-'.$curr['month'].'-'.$day);<br />
		}<br />
		$diff = $current_time - $month_temp;<br />
	}</p>
<p>	//calculate days<br />
	$age['days'] = intval($diff/86400);<br />
	//get the remaining seconds<br />
	$diff = $diff - (86400 * $age['days']);</p>
<p>	//calculate hours<br />
	$age['hours'] = intval($diff/3600);<br />
	//get the remaining seconds<br />
	$diff = $diff - (3600 * $age['hours']);</p>
<p>	//calculate minutes<br />
	$age['minutes'] = intval($diff/60);<br />
	//get the remaining seconds<br />
	$diff = $diff - (60 * $age['minutes']);</p>
<p>	//and we're left with seconds<br />
	$age['seconds'] = $diff;</p>
<p>	print_r($age);<br />
</code><br />
Or you can <a href="http://tr.im/Gqgq">download the source file here</a>, if you're having copy/paste troubles.</p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2009/11/calculating-age-with-php-using-a-birth-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An easy way to handle previous and next product links</title>
		<link>http://hotchkissconsulting.net/2009/11/an-easy-way-to-handle-previous-and-next-product-links/</link>
		<comments>http://hotchkissconsulting.net/2009/11/an-easy-way-to-handle-previous-and-next-product-links/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 08:50:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How-To]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=254</guid>
		<description><![CDATA[I&#8217;m working on a custom eCommerce site for a customer right now, and ran into an issue&#8211; they wanted to have, on every product page, a forward and back button to get to the previous and next items.  The problem with this is that they may have arrived on the product page in a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a custom eCommerce site for a customer right now, and ran into an issue&#8211; they wanted to have, on every product page, a forward and back button to get to the previous and next items.  The problem with this is that they may have arrived on the product page in a couple of different ways, through search or browsing, with different criteria set.</p>
<p>I came up with this easy routine which goes through the result set, whether it&#8217;s search result or category view, then creates an array where the key is the current product ID, and the values are the IDs of the product before and the product afterward.  So if I&#8217;m on product 157, $ordering[157]['next'] will give me the ID of the next product.  Just pop it in a session, and you&#8217;re good to go.</p>
<p>Simple and straightforward&#8211; feel free to reuse all you like!<br />
<span id="more-254"></span><br />
<code><br />
			foreach($results as $row) {<br />
					/////////////////////////////////////////////////////////////////////<br />
					// so that we can capture previous, current, and next, we're going<br />
					// to process one row behind, so for the first row, don't put anything into<br />
					// our array<br />
					/////////////////////////////////////////////////////////////////////<br />
					if(!$curr) {<br />
						$curr = 'first';<br />
						$next = $row['id'];<br />
					} else {<br />
					// Everything moves back one space<br />
						$prev = $curr;<br />
						$curr = $next;<br />
						$next = $row['id'];<br />
					// It gets saved into the array<br />
						$ordering[$curr]['prev'] = $prev;<br />
						$ordering[$curr]['next'] = $next;<br />
					}<br />
				}<br />
				// Here we're handling the last row<br />
				$ordering[$next]['prev'] = $curr;<br />
				$ordering[$next]['next'] = 'last';<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2009/11/an-easy-way-to-handle-previous-and-next-product-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing Basecamp Tasks into iCal</title>
		<link>http://hotchkissconsulting.net/2009/11/importing-basecamp-tasks-into-ical/</link>
		<comments>http://hotchkissconsulting.net/2009/11/importing-basecamp-tasks-into-ical/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 10:24:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=246</guid>
		<description><![CDATA[I&#8217;ve been back and forth a thousand times on Basecamp&#8211; I love it and I hate it, and have tried every alternative, but I just keep coming back.  So instead of switching again, I&#8217;ve decided I should just start fixing the things that bug me, and I&#8217;ve started with the fact that I can&#8217;t get [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hotchkissconsulting.net/wp-content/uploads/2009/11/basecamp-logo-for-fluid.png"><img class="alignright size-full wp-image-251" title="basecamp-logo-for-fluid" src="http://hotchkissconsulting.net/wp-content/uploads/2009/11/basecamp-logo-for-fluid.png" alt="basecamp-logo-for-fluid" width="320" height="266" /></a>I&#8217;ve been back and forth a thousand times on Basecamp&#8211; I love it and I hate it, and have tried every alternative, but I just keep coming back.  So instead of switching again, I&#8217;ve decided I should just start fixing the things that bug me, and I&#8217;ve started with the fact that I can&#8217;t get a feed of my tasks into iCal.  Since ICS feeds are read-only, there&#8217;s no way to be able to check off basecamp tasks in iCal, but I&#8217;ve started using <a href="http://www.celmaro.com/minco/">Minco</a> to track my time (great app, by the way), and it pulls in a list of items to track from your iCal to do list.  I&#8217;m sure you see where this is going&#8211; if I can push my Basecamp tasks into iCal, then Minco can see them.  Maybe you have another reason for wanting your tasks in iCal, but this was mine.  Anyway, thanks to <a href="http://www.phpinsider.com/">Monte Ohrt&#8217;s </a><a href="http://code.google.com/p/basecamp-php-api/">Basecamp PHP API library</a>, I was able to throw together an API tool to pull my tasks and push them out into an ICS feed in just an hour!  I&#8217;ve made this tool available so you can easily drop it into iCal and away you go.  Or, if you&#8217;d rather dig into it yourself, you can download my code from: <a href="http://tr.im/EjnN">http://tr.im/EjnN</a><br />
<span id="more-246"></span><br />
To use this tool, all you need to do is make a couple quick edits to this URL:</p>
<p>http://bctasks.hdev1.com/mytasks.php?site=<strong>SiteURLSegment</strong>&amp;user=<strong>YourUsername</strong>&amp;password=<strong>YourPassword</strong></p>
<p>Username and Password should be self explanatory.  SiteURLSegment is the portion of your Basecamp URL between the http:// and the .basecamphq.com/ &#8212; if your Basecamp account is at http://hotchkissconsulting.basecamphq.com/, your SiteURLSegment would be hotchkissconsulting.</p>
<p>Nothing shows better than an example, though, so here&#8217;s what my URL would be if my password was &#8216;iLovePHP&#8217;</p>
<p>http://bctasks.hdev1.com/mytasks.php?site=hotchkissconsulting&amp;user=sam&amp;password=iLovePHP</p>
<p>Then, to feed your tasks into iCal, all you need to do is:</p>
<ol>
<li>Open iCal</li>
<li>Select &#8216;Subscribe&#8217; from the Calendar menu</li>
<li>Enter your custom URL</li>
<li>Make sure &#8220;Remove To Do Items&#8221; is <strong>NOT</strong> checked</li>
<li>Set your auto-refresh to however often you want to check for new tasks and get rid of completed ones</li>
<li>Press Okay</li>
</ol>
<p>and Voila, all your Basecamp tasks are there in iCal.</p>
<p><strong>Since BC tasks are context based </strong>(they sit within a project and a task list so you know what they&#8217;re about), I brought in this information, so your task in iCal will show up as &#8220;ProjectName ListName &#8211; Task Name&#8221;</p>
<p><strong>Also, I&#8217;ve put in &#8217;short name&#8217; functionality.</strong> A lot of my tasks are fairly verbose, and I want to be able to see what the task is quickly and easily.  So I put in support for short names&#8211; you can use this in the project name, task list name, and the title of the actual task.  All you have to do is put the name you want to show up in iCal inside [square brackets].  So, if I had a task list named &#8220;Preparations for Launch [Launch]&#8220;, the feed will only show the list name as &#8220;Launch&#8221;.  This helps to keep things short and reasonable.</p>
<p>Questions?  Comments?  Let me know!</p>
<p><strong>Note: I do <span style="text-decoration: underline;">not</span> store your Basecamp username and password&#8211; </strong>this information is passed directly through to 37signals and never gets stored on my server.  If you&#8217;re uncomfortable with this, feel free to <a href="http://tr.im/EjnN">download the source code</a> and run it on your server.</p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2009/11/importing-basecamp-tasks-into-ical/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Schedule of a Freelance Web Developer</title>
		<link>http://hotchkissconsulting.net/2009/11/schedule-of-a-web-developer/</link>
		<comments>http://hotchkissconsulting.net/2009/11/schedule-of-a-web-developer/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 00:38:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Consulting]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=242</guid>
		<description><![CDATA[It&#8217;s closing in on 6 months that I&#8217;ve been doing only freelance development&#8211; while I moonlighted and worked in an office for years, I love being my own boss, and part of that has been setting my own schedule.  It seems like there are never enough hours in the day, but here is the [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s closing in on 6 months that I&#8217;ve been doing only freelance development&#8211; while I moonlighted and worked in an office for years, I love being my own boss, and part of that has been setting my own schedule.  It seems like there are never enough hours in the day, but here is the pattern that I&#8217;ve found that seems to work, at least for the time being:</p>
<p><strong>10am</strong> &#8211; Wake up, check and respond to email, deal with any urgent issues</p>
<p><strong>10:30am</strong> &#8211; Breakfast time&#8211; grab a bite and dive in.  Morning time is multi-tasking time&#8211; I can do bug fixes, put together bids for projects, etc.  Anything that can be done in under an hour, this is the time for it.  Also, this is when I handle most of my phone and instant-message client communications with clients here in the states.</p>
<p><strong>1pm</strong> &#8211; <strong>7pm </strong>- This is my &#8216;me and my wife&#8217; time&#8211; generally, Becky and I will voyage into town, go to the gym (we play racquetball every day, and we love it!), maybe watch a movie, have a nice lunch, and enjoy life.  It&#8217;s nice to be able to run errands and go to the gym while most people are at work&#8211; a real time-saver!</p>
<p><strong>7pm &#8211; 3am</strong> &#8211; This is my focus and get things done time.  I&#8217;ll make a couple pots of coffee and get to work&#8211; This allows me to have fewer interruptions (I turn off my email alerts and chat and get down to business) and also allows me to communicate with my clients in Australia and, towards the end of the night, the UK.</p>
<p>So if you get an email from me in the middle of the night&#8211; don&#8217;t be alarmed, that&#8217;s just how I work!</p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2009/11/schedule-of-a-web-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Portfolio Updated</title>
		<link>http://hotchkissconsulting.net/2009/08/portfolio-updated/</link>
		<comments>http://hotchkissconsulting.net/2009/08/portfolio-updated/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 07:00:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://hotchkissconsulting.net/?p=235</guid>
		<description><![CDATA[Just a quick note to let everyone know that we went through and added some new sites into our portfolio at http://hotchkissconsulting.net/portfolio/, so go take a gander.  Also, make sure to keep your eyes peeled for new sites, as we have a few major launches scheduled throughout September.
To all our customers: thanks for making [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick note to let everyone know that we went through and added some new sites into our portfolio at <a href="http://hotchkissconsulting.net/portfolio/">http://hotchkissconsulting.net/portfolio/</a>, so go take a gander.  Also, make sure to keep your eyes peeled for new sites, as we have a few major launches scheduled throughout September.</p>
<p>To all our customers: thanks for making this a busy summer for us.  To all our future customers: we can&#8217;t wait to check out your project!</p>
<p>Best,<br />Sam</p>
]]></content:encoded>
			<wfw:commentRss>http://hotchkissconsulting.net/2009/08/portfolio-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
