<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:content="http://purl.org/rss/1.0/modules/content/">

<channel>
    
<title>Code</title>
<link>http://mikeheavers.com/index.php</link>
<description></description>
<dc:language>en</dc:language>
<dc:creator>mheavers@gmail.com</dc:creator>
<dc:rights>Copyright 2012</dc:rights>
<dc:date>2012-04-27T16:12:+00:00</dc:date>
<admin:generatorAgent rdf:resource="http://expressionengine.com/" />
    

<item>
<title>webGL circular camera rotation around a single axis in threeJS</title>
<link>http://mikeheavers.com/index.php/site/code_single/webgl_circular_camera_rotation_around_a_single_axis_in_threejs</link>
<guid>http://mikeheavers.com/index.php/site/code_single/webgl_circular_camera_rotation_around_a_single_axis_in_threejs</guid>
<description>
<![CDATA[
<p>For anyone who&#8217;s good with math, I suppose this is a fairly easy one, but if you&#8217;re not, rotating a camera in threeJS can be a bit tricky. I did a lot of asking around, and most of the answers I got involved using pre-built libraries such as the built in trackball controls, or the great drag-pan controls offered in the <a href="http://jeromeetienne.github.com/threejsboilerplatebuilder/" target="_blank">threejs boilerplate</a> from <a href="http://learningthreejs.com" target="_blank">learningthreejs.com</a>. The problem with these is that they allow for rotation along all axis, which makes things weird if you&#8217;ve got something that&#8217;s never</p>
<hr />

]]>
</description>
<dc:date>2012-04-27T16:12+00:00</dc:date>
</item>

<item>
<title>Converting a server&#45;reliant XML website using XML to run on the local file system.</title>
<link>http://mikeheavers.com/index.php/site/code_single/converting_a_server_reliant_xml_website_using_xml_to_run_on_the_local_file</link>
<guid>http://mikeheavers.com/index.php/site/code_single/converting_a_server_reliant_xml_website_using_xml_to_run_on_the_local_file</guid>
<description>
<![CDATA[
<p>Recently I had to convert a website that had once run off a server to run locally, so that we could demo the site without the need for an internet connection. The site didn&#8217;t use PHP or any server-side scripting language, so it seemed doable - the only problem was that it used data from an XML feed to create a single javascript in which all the XML data was stored. When accessed using the local file system, this was throwing a pesky access-control-allow-origin error. I figured at first that I</p>
<hr />

]]>
</description>
<dc:date>2012-04-24T20:37+00:00</dc:date>
</item>

<item>
<title>SVG path animations with D3</title>
<link>http://mikeheavers.com/index.php/site/code_single/svg_path_animations_with_d3</link>
<guid>http://mikeheavers.com/index.php/site/code_single/svg_path_animations_with_d3</guid>
<description>
<![CDATA[
<p>I recently stumbled on an incredible HTML5 graphics library called <a href="http://mbostock.github.com/d3/" target="_blank">d3</a>. It&#8217;s well documented, powerful, smooth, and pretty. The problem is, most of the folks that use it well are apparently geniuses, so support for learning from the ground up can be a bit limited. There are plenty of examples out there on how to build a bar chart, but not so many on how to do generic things like &#8220;apply a transition to property X of my SVG path.&#8221; </p>

<p>I spent half a day trying to learn how to tween the start</p>
<hr />

]]>
</description>
<dc:date>2012-03-27T17:57+00:00</dc:date>
</item>

<item>
<title>Load processing.js sketch with ajax on user click</title>
<link>http://mikeheavers.com/index.php/site/code_single/load_processing.js_sketch_with_ajax_on_user_click</link>
<guid>http://mikeheavers.com/index.php/site/code_single/load_processing.js_sketch_with_ajax_on_user_click</guid>
<description>
<![CDATA[
<p>I&#8217;ve had a few questions on this, so I figured I&#8217;d write a quick tutorial. Loading a java applet through AJAX doesn&#8217;t tend to work too well. Processing.js, however, makes this fairly easy, especially when coupled with jQuery. In order to load a sketch through AJAX, you need to include of course, jQuery and processing:</p>

<pre>
<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">&lt;</span><span style="color: #0000BB">script&nbsp;src</span><span style="color: #007700">=</span><span style="color: #DD0000">"https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"&nbsp;</span><span style="color: #0000BB">type</span><span style="color: #007700">=</span><span style="color: #DD0000">"text/javascript"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&lt;/script&gt;<br /></span><span style="color: #007700">&lt;</span><span style="color: #0000BB">script&nbsp;src</span><span style="color: #007700">=</span><span style="color: #DD0000">"&#123;site_url&#125;js/processing-1.3.6.min.js"</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">&lt;/script&gt;&nbsp;</span>
</span>
</code></div>
<hr />

]]>
</description>
<dc:date>2012-01-12T15:16+00:00</dc:date>
</item>

<item>
<title>A Simplified Vimeo (Froogaloop) Javascript API Example</title>
<link>http://mikeheavers.com/index.php/site/code_single/a_simpler_vimeo_froogaloop_javascript_api_example</link>
<guid>http://mikeheavers.com/index.php/site/code_single/a_simpler_vimeo_froogaloop_javascript_api_example</guid>
<description>
<![CDATA[
<p>Hi - recently I was trying to utilize the Vimeo Javascript API to do some basic event listening - I wanted to make sure that when one video in a series of videos finished playing, that it would load the next video and play it. Vimeo has 3 different APIs - a simple API which is used primarily to get information about a user&#8217;s videos, an advanced API which provides powerful functionality but requires cumbersome OAUTH authentication, and the froogaloop API, which helps facilitate the triggering</p>
<hr />

]]>
</description>
<dc:date>2011-12-06T17:05+00:00</dc:date>
</item>

<item>
<title>Creating a donut wedge in Flash AS3</title>
<link>http://mikeheavers.com/index.php/site/code_single/creating_a_donut_wedge_in_flash_as3</link>
<guid>http://mikeheavers.com/index.php/site/code_single/creating_a_donut_wedge_in_flash_as3</guid>
<description>
<![CDATA[
<p>I recently had a project in which I needed to draw a sort of graph in which there is a center circle, and wedge shaped pieces that surround that circle. Turns out drawing even drawing an arc is difficult in flash (much less a wedge, much less a wedge that has an inner radius). I went about this all the wrong ways until I found a <a href="http://code.google.com/p/leebrimelow/source/browse/trunk/as3/com/theflashblog/drawing/Wedge.as?r=17" target="_blank">package by Lee Brimelow</a>&nbsp; that allows you to draw a wedge - albeit without any center radius. This was close (a pie, not a donut), and seemed to be the most streamlined</p>
<hr />

]]>
</description>
<dc:date>2011-11-28T16:45+00:00</dc:date>
</item>

<item>
<title>Sort an Array of Objects by an Object Property in JQuery</title>
<link>http://mikeheavers.com/index.php/site/code_single/sort_an_array_of_objects_by_an_object_property</link>
<guid>http://mikeheavers.com/index.php/site/code_single/sort_an_array_of_objects_by_an_object_property</guid>
<description>
<![CDATA[
<p>This is a quick snippet that often comes in handy - you have a bunch of objects which are being added to an array in no particular order, and you want to sort that array into some logical order, using a common property that all of the objects possess. The code is simple:</p>

<pre><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">var&nbsp;array&nbsp;=&nbsp;</span><span style="color: #0000BB">&#91;</span><span style="color: #007700">(</span><span style="color: #0000BB">id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">),(</span><span style="color: #0000BB">id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">),(</span><span style="color: #0000BB">id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">name</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">value</span><span style="color: #007700">)</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">;<br /><br />function&nbsp;</span><span style="color: #0000BB">SortByName</span><span style="color: #007700">(</span><span style="color: #0000BB">a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">b</span><span style="color: #007700">)</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;</span><span style="color: #007700">var&nbsp;</span><span style="color: #0000BB">aName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">a</span><span style="color: #007700">.</span><span style="color: #0000BB">name</span><span style="color: #007700">.</span><span style="color: #0000BB">toLowerCase</span><span style="color: #007700">();<br />&nbsp;&nbsp;var&nbsp;</span><span style="color: #0000BB">bName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">b</span><span style="color: #007700">.</span><span style="color: #0000BB">name</span><span style="color: #007700">.</span><span style="color: #0000BB">toLowerCase</span><span style="color: #007700">();&nbsp;<br />&nbsp;&nbsp;return&nbsp;((</span><span style="color: #0000BB">aName&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">bName</span><span style="color: #007700">)&nbsp;?&nbsp;-</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">:&nbsp;((</span><span style="color: #0000BB">aName&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">bName</span><span style="color: #007700">)&nbsp;?&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /></span></span></code></div></pre>
<hr />

]]>
</description>
<dc:date>2011-11-01T19:58+00:00</dc:date>
</item>

<item>
<title>Get an ISO 8601 Formatted Date in Javascript</title>
<link>http://mikeheavers.com/index.php/site/code_single/get_an_iso_8601_formatted_date_in_javascript</link>
<guid>http://mikeheavers.com/index.php/site/code_single/get_an_iso_8601_formatted_date_in_javascript</guid>
<description>
<![CDATA[
<p>Recently I had to submit an ISO 8601 timestamp in order to use Amazon&#8217;s AWS API - unfortunately there&#8217;s no cut and dry method of doing this in javascript like there is in other languages. I finally came across this method, which I figured I&#8217;d share.</p>

<pre><div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">ISODateString</span><span style="color: #007700">(</span><span style="color: #0000BB">d</span><span style="color: #007700">)</span><span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">pad</span><span style="color: #007700">(</span><span style="color: #0000BB">n</span><span style="color: #007700">)</span><span style="color: #0000BB">&#123;return&nbsp;n</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">10&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #DD0000">'0'</span><span style="color: #007700">+</span><span style="color: #0000BB">n&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">n&#125;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">d</span><span style="color: #007700">.</span><span style="color: #0000BB">getUTCFullYear</span><span style="color: #007700">()+</span><span style="color: #DD0000">'-'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">pad</span><span style="color: #007700">(</span><span style="color: #0000BB">d</span><span style="color: #007700">.</span><span style="color: #0000BB">getUTCMonth</span><span style="color: #007700">()+</span><span style="color: #0000BB">1</span><span style="color: #007700">)+</span><span style="color: #DD0000">'-'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">pad</span><span style="color: #007700">(</span><span style="color: #0000BB">d</span><span style="color: #007700">.</span><span style="color: #0000BB">getUTCDate</span><span style="color: #007700">())+</span><span style="color: #DD0000">'T'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">pad</span><span style="color: #007700">(</span><span style="color: #0000BB">d</span><span style="color: #007700">.</span><span style="color: #0000BB">getUTCHours</span><span style="color: #007700">())+</span><span style="color: #DD0000">':'</span></code></div></pre>
<hr />

]]>
</description>
<dc:date>2011-10-26T19:53+00:00</dc:date>
</item>

<item>
<title>A way around access control origin errors</title>
<link>http://mikeheavers.com/index.php/site/code_single/a_way_around_access_control_origin_errors</link>
<guid>http://mikeheavers.com/index.php/site/code_single/a_way_around_access_control_origin_errors</guid>
<description>
<![CDATA[
<p>Ever try to post to a web service or access AJAX data from a different domain, and get those annoying access-control origin errors? Often, these result from the remote host&#8217;s server configuration being not set up to accommodate requests from your IP. If accessing the remote server is something that is beyond your control, but you still need to be able to test your code, here&#8217;s an easy way around access-control origin errors.</p>

<p>1. You&#8217;ll need Chrome (although I&#8217;m sure this is possible with other</p>
<hr />

]]>
</description>
<dc:date>2011-09-15T14:46+00:00</dc:date>
</item>

<item>
<title>Dynamic Dependent Dropdown filtering with Codeigniter and JQuery</title>
<link>http://mikeheavers.com/index.php/site/code_single/dynamic_dependent_dropdown_filtering_with_codeigniter_and_jquery</link>
<guid>http://mikeheavers.com/index.php/site/code_single/dynamic_dependent_dropdown_filtering_with_codeigniter_and_jquery</guid>
<description>
<![CDATA[
<p>Say you&#8217;re building a form in which users can create a person, and assign that person a city to live in. But that city field needs to be populated depending on the state the person lives in, otherwise the city field will be enormously long (and there is more of a chance for user error and confusion). What you need is dynamic dependent dropdowns. Triple Ds! In order to accomplish this using Code Igniter, this is what I did:</p>

<p>HTML (view_form_all):</p>

<pre><div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">form_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'control_form/add_all'</span><span style="color: #007700">);&nbsp;</span></span></code></div></pre>
<hr />

]]>
</description>
<dc:date>2011-05-31T19:31+00:00</dc:date>
</item>

    
</channel>
</rss>
