<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">

    <title type="text">Blog</title>
    <subtitle type="text">Blog:</subtitle>
    <link rel="alternate" type="text/html" href="/archive/" />
    <link rel="self" type="application/atom+xml" href="http://easy-reader.net/site/atom/" />
    <updated>2010-08-26T12:23:39Z</updated>
    <rights>Copyright (c) 2010, Aaron Gustafson</rights>
    <generator uri="http://expressionengine.com/" version="1.6.9">ExpressionEngine</generator>
    <id>tag:,2010:08:26</id>


    <entry>
      <title>Honored</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/08/26/honored" />
      <id>tag:,2010:/archive/1.547</id>
      <published>2010-08-26T11:51:38Z</published>
      <updated>2010-08-26T12:23:39Z</updated>
      <author>
            <name>Aaron Gustafson</name>
            <email>aaron@easy-designs.net</email>
                  </author>

      <category term="Potpourri"
        scheme="http://easy-reader.net/site/C183/"
        label="Potpourri" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="awards"
        scheme="http://easy-reader.net/site/C211/"
        label="awards" />
      <category term="CSS"
        scheme="http://easy-reader.net/site/C192/"
        label="CSS" />
      <category term="mobile"
        scheme="http://easy-reader.net/site/C201/"
        label="mobile" />
      <category term="web standards"
        scheme="http://easy-reader.net/site/C159/"
        label="web standards" />
      <content type="html"><![CDATA[
        <p>Late last week, the nominees for <a href="http://www.thenetawards.com/">the 2010 <cite>.net</cite> Awards</a> were announced and I was amazed to find myself nominated for not one, but two awards.</p>
<p><img src="http://farm5.static.flickr.com/4094/4908054443_faa37d91eb.jpg" alt="" height="328" width="500" /></p>
<p>The first nomination I received is for &ldquo;Standards Champion.&rdquo; It's an absolute honor to have been nominated alongside <a href="http://boxofchocolates.ca">Derek Featherstone</a>, <a href="http://molly.com">Molly Holzschlag</a>, <a href="http://adactio.com">Jeremy Keith</a>, <a href="http://zeldman.com">Jeffrey Zeldman</a>, and a handful of other folks who've not only played a pivotal role in the widespread adoption of web standards, but who&rsquo;ve also contributed greatly to my development as a web professional and educator.</p>
<p><img src="http://farm5.static.flickr.com/4123/4908648118_85008773b5.jpg" alt="" height="328" width="500" /></p>
<p>The second nomination I received was in the category of &ldquo;Mobile Site of the Year&rdquo; for <a href="http://colly.com">colly.com</a>. As some of you probably know, I wrote a little article on adaptive layouts with media queries for <a href="http://www.netmag.co.uk/zine/latest-issue/issue-205"><cite>.net</cite>&rsquo;s Summer Issue (#205)</a>. In that article, I gave <a href="http://colly.com">the homepage of Mr. Simon Collision</a> a makeover for the iPad and iPhone. Colly was so excited with what I'd done that he used my changes as a baseline to convert the remainder of his site to employ adaptive layouts. The adaptive redesign turned quite a few heads and became an <a href="http://www.zeldman.com/2010/06/23/responsive-design-is-the-new-black/">oft-cited example of adaptive layouts in practice</a>.</p>
<p>While I've received numerous awards for my work over the years, these two nominations were greatly appreciated. I offer my sincerest thanks to those who put my name in the hat. Win or lose, I can honestly say that I'm a very happy man.</p>
<p>Of course it wouldn't hurt if <a href="http://www.thenetawards.com/">you voted for me</a> though. ;-)</p>
<p>Public voting ends on 12 October 2010.</p>
<p>Full disclosure: I am also a judge in the <cite>.net</cite> Awards (as are several other nominees), but I did no lobbying to become a nominee.</p>
      ]]></content>
    </entry>

    <entry>
      <title>Be a good localStorage neighbor</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/08/02/be-a-good-localstorage-neighbor" />
      <id>tag:,2010:/archive/1.544</id>
      <published>2010-08-02T13:17:28Z</published>
      <updated>2010-08-02T19:56:29Z</updated>
      <author>
            <name>Aaron Gustafson</name>
            <email>aaron@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="(x)HTML"
        scheme="http://easy-reader.net/site/C190/"
        label="(x)HTML" />
      <category term="browsers"
        scheme="http://easy-reader.net/site/C194/"
        label="browsers" />
      <category term="coding"
        scheme="http://easy-reader.net/site/C158/"
        label="coding" />
      <category term="databases"
        scheme="http://easy-reader.net/site/C197/"
        label="databases" />
      <category term="JavaScript"
        scheme="http://easy-reader.net/site/C189/"
        label="JavaScript" />
      <category term="projects &amp; products"
        scheme="http://easy-reader.net/site/C162/"
        label="projects &amp; products" />
      <category term="web standards"
        scheme="http://easy-reader.net/site/C159/"
        label="web standards" />
      <content type="html"><![CDATA[
        <p>Most JavaScript developers are keenly aware of what they add to the global object and do their best to <a href="http://www.dustindiaz.com/namespace-your-javascript/">namespace their work</a> or <a href="http://robertnyman.com/2008/10/09/explaining-javascript-scope-and-closures/">sequester it in closures</a>. Namespacing and closures reduce the likelihood that necessary functions and variables will be accidentally overwritten, causing errors to be thrown and interfaces to break. Unfortunately, <a href="http://dev.w3.org/html5/webstorage/#the-localstorage-attribute">the <code class="js">localStorage</code> API</a>&nbsp;(available in most modern browsers) doesn't inherently support creating isolated caches for each script because the cache is site-specific and consists simply of key-value pairs. <a href="http://msdn.microsoft.com/en-us/library/ms531424(VS.85).aspx">Internet Explorer's <code class="js">userData</code> behavior</a>&nbsp;(which is available all the way back to IE5) does support sequestering the cache to a degree because you need to provide a name for it, but the API doesn't make a whole lot of sense and isn't at all equivalent to <code class="js">localStorage</code>.</p>
<p>Using the native APIs, it's quite easy to accidentally overwrite an existing key in the cache. Beyond that, a simple call to <code class="js">localStorage.clear()</code> will wipe out not only your own data, but anything else stored in the local cache. It's not good.</p>
<p>While working on <a href="http://eCSStender.org">eCSStender</a>'s implementation of client-side caching, I came to realize the problems with the current state of things and sought to address them by implementing faux namespacing via prefixed keys. I've since copied that code out of eCSStender and created a small library named <a href="http://github.com/easy-designs/Squirrel.js">Squirrel.js</a> that not only evens out the differences between <code class="js">localStorage</code> and <code class="js">userData</code>, but also makes it easier to manage your client-side data store in a manner unlikely to cause issues with other scripts also using client-side caching.</p>
<p>Here is a quick rundown of how Squirrel.js works:</p>
<p>&#123;exp:gist id="504869" file="Squirrel-examples.js"&#125;</p>
<p>For more, check out <a href="http://github.com/easy-designs/Squirrel.js">the Github page</a>. Feel free to let me know your thoughts on how easy it is to use and how it can be improved.</p>
      ]]></content>
    </entry>

    <entry>
      <title>Brooke Valentine&#8217;s Celebrity Girl Fight Game</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/07/24/brooke-valentines-celebrity-girl-fight-game" />
      <id>tag:,2010:/archive/1.540</id>
      <published>2010-07-24T13:54:33Z</published>
      <updated>2010-07-27T12:53:22Z</updated>
      <author>
            <name>Dave Stewart</name>
            <email>dave@easy-designs.net</email>
                  </author>

      <category term="Potpourri"
        scheme="http://easy-reader.net/site/C183/"
        label="Potpourri" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="animation"
        scheme="http://easy-reader.net/site/C155/"
        label="animation" />
      <category term="business"
        scheme="http://easy-reader.net/site/C154/"
        label="business" />
      <category term="Flash &amp; ActionScript"
        scheme="http://easy-reader.net/site/C195/"
        label="Flash &amp; ActionScript" />
      <content type="html"><![CDATA[
        <p>If you made something that was used by over Ten Million people, would you/it be a success?</p>
<p>Over the last 10 years I have made countless Flash games for various agencies and independent artists. I do the job and move on. Sometimes they barley rise to any notable or worthy existence and other&rsquo;s get viral and do well for a while.</p>
<p>From time to time I perform various searches out of curiosity to see if anything still lives. Today I thought I would hunt down a game I made back in 2007 for Brooke Valentine called Celebrity Girlfight. It&rsquo;s a boxing game where you battle against Paris Hilton, Jennifer Lopez, Lindsay Lohan, Lil Kim, Beyonce Knowles and Ciara. I was stunned to see &ldquo;About 691,000 results&rdquo; from Google.</p>
<p><img src="/img/posts/celebrity-girlfight.png" alt="" /></p>
<p>Clicking on the first result brings me to&nbsp;<a href="http://www.y8.com/games/Brooke_Valentine_Presents_Celebrety_Girl_Fight" target="_blank">y8.com</a>. It&rsquo;s one of those Flash game sites that collects them and offers them up for free, surrounded with advertisements.&nbsp;On this&nbsp;<strong>one site</strong>&nbsp;the game had been played&nbsp;<strong>2,371,316</strong>&nbsp;times with&nbsp;<strong>110,043</strong>&nbsp;positive votes (87.15%) vs.<strong>16,224</strong>&nbsp;negative. Over two million, wow!</p>
<p>I continued through one whole page of Google results, 10,000, 9,000, 20,000 plays, on and on and on. I bet if I was to go through more of the sites, the count would exceed ten million. <em>That&rsquo;s awesome</em> I thought.</p>
<p>Now in most situations, the Flash programmer does not put his name on the game and remains anonymous. That's fine, I realize the focus here is the artist, but I thought it would make an interesting blog post from the perspective of a developer. If I had 1&cent; for every time it was played I could have made upwards of $100,000.</p>
<p>It's food for thought.</p>
      ]]></content>
    </entry>

    <entry>
      <title>Give a hoot</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/07/19/give-a-hoot" />
      <id>tag:,2010:/archive/1.532</id>
      <published>2010-07-19T20:06:57Z</published>
      <updated>2010-08-02T19:57:59Z</updated>
      <author>
            <name>Aaron Gustafson</name>
            <email>aaron@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="coding"
        scheme="http://easy-reader.net/site/C158/"
        label="coding" />
      <category term="JavaScript"
        scheme="http://easy-reader.net/site/C189/"
        label="JavaScript" />
      <category term="optimization &amp; performance"
        scheme="http://easy-reader.net/site/C208/"
        label="optimization &amp; performance" />
      <category term="PHP"
        scheme="http://easy-reader.net/site/C191/"
        label="PHP" />
      <content type="html"><![CDATA[
        <p>As any competent JavaScript knows, it&rsquo;s not cool to litter the global namespace with variables, functions, and the like. It&rsquo;s far better to encapsulate your code in an object, a series of objects, or even a closure, exposing only what you absolutely need to via the global namespace. This helps reduce the potential for collisions that will probably cause your site to break.</p>
<p>Occasionally, however, even closures won&rsquo;t help you trap a given variable. Case in point:</p>
<p>&#123;exp:gist id="479723" file="pollutes.js"&#125;</p>
<p>If you&rsquo;re familiar with languages like PHP, you might think this simple closure creates two variables with the same value, but you&rsquo;d be wrong. It creates a local variable, <code class="js">a</code> and a global variable <code class="js">b</code>, both of which have their value set to 0.</p>
<p>&#123;exp:gist id="479723" file="example.php"&#125;</p>
<p>In PHP this means of sharing the value assignment of variables is perfectly legit; the difference, however, is how JavaScript and PHP treat variable scope. By default, every variable declared in PHP is scoped to the function it is called within. Global variables only come into play when you use the <code class="php">global</code> declaration or the <code class="php">$_GLOBALS</code> array. In JavaScript, by contrast, any variables not instantiated with a <code class="js">var</code> are added to the global namespace. Hence the namespace pollution in the above example.</p>
<p>Revisiting the closure, it's best to rewrite it in one of two ways to maintain the variable scope:</p>
<p>&#123;exp:gist id="479723" file="scoped-option-1.js"&#125;</p>
<p>or</p>
<p>&#123;exp:gist id="479723" file="scoped-option-2.js"&#125;</p>
<p>Which solution will work best is dependent solely on context. If you're minifying the code and the value being assigned is anything more than a single character, the latter is probably the way to go.</p>
<p>To help you discover and mitigate pollution in your own scripts (or to help you see what additions your standard JavaScript libraries are making to the global namespace), I&rsquo;ve created a little script called <a href="http://github.com/easy-designs/EmissionsTest.js">EmissionsTest.js</a>. It&rsquo;s pretty easy to use, you simply include it as the first script on your page (preferably in the <code class="html">head</code> of your document) and it does the rest. It will attempt to report its findings to the console (if your browser has one) or it will create a floating notice at the top of the page.</p>
<p>You won&rsquo;t want to include this script on a production site and it&rsquo;s still pretty basic, but it could be very useful for tracking down any accidental emissions in your script.</p>
      ]]></content>
    </entry>

    <entry>
      <title>Monitor Your Websites with Notifications</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/07/16/monitor-your-websites-with-notifications" />
      <id>tag:,2010:/archive/1.531</id>
      <published>2010-07-16T12:02:35Z</published>
      <updated>2010-08-10T11:58:36Z</updated>
      <author>
            <name>Daniel Ryan</name>
            <email>daniel@easy-designs.net</email>
                  </author>

      <category term="Process"
        scheme="http://easy-reader.net/site/C184/"
        label="Process" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="iOS"
        scheme="http://easy-reader.net/site/C200/"
        label="iOS" />
      <category term="mobile"
        scheme="http://easy-reader.net/site/C201/"
        label="mobile" />
      <category term="servers"
        scheme="http://easy-reader.net/site/C199/"
        label="servers" />
      <content type="html"><![CDATA[
        <p>If you&rsquo;ve ever been surprised to find out that one of your websites is down, you&rsquo;ve no doubt tried to figure out a good way to monitor their health. There are many services on the internet that will check in on your sites periodically and let you know when there&rsquo;s been a problem, but often these aren&rsquo;t real time enough. After a recent DDOS to one of the sites I run, I put together a simple Python script to check in on my sites and let me know if any of them return anything besides &ldquo;HTTP 200&rdquo; as the response code.</p>
<h2>Notifications</h2>
<p>I&rsquo;ve built in support for <a href="http://growl.info">Growl notifications</a> and iOS push notifications via <a href="http://boxcar.io">Boxcar</a>.  You could also modify the script to send emails, etc.</p>
<h3>Growl</h3>
<p>If you&rsquo;re running Growl on your Mac (maybe Windows as well, I haven&rsquo;t checked), you can receive Growl notifications by setting the <code>USE_GROWL</code> variable to <code>True</code> in the script. You can optionally then use <a href="http://prowl.weks.net/">Prowl</a> or <a href="http://howlapp.com/">Howl</a> to pass the same notices on to your iOS device, following either app&rsquo;s provided instructions.</p>
<h3>Boxcar</h3>
<p>Unlike Prowl and Howl, Boxcar doesn&rsquo;t require Growl (meaning it could work on a Linux box) and doesn&rsquo;t cost anything. To use Boxcar, you need to <a href="http://boxcar.io/site/providers">become a Boxcar provider</a>. Once you&rsquo;ve registered your provider, fill in the script&rsquo;s <code>BOXCAR_API_KEY</code> and <code>BOXCAR_API_SECRET</code> variables with the ones Boxcar gives you. Finally, set <code>BOXCAR_EMAIL</code> to the email address you registered with Boxcar and <code>USE_BOXCAR</code> to <code>True</code>.</p>
<h2>Installation</h2>
<p>&#123;exp:gist id="460331"&nbsp;file="check_site.py"&#125;</p>
<p>Save the contents of the script to a file called &ldquo;check_sites&rdquo; somewhere in <a href="http://en.wikipedia.org/wiki/Path_(variable)">your path</a>) and make the file executable (<code>chmod +x check_sites</code>). Edit the <code>sites</code> variable, creating an entry for each site you want to check. You can test the script by running <code>check_sites</code> on a command line. Finally, you need to <a href="http://adminschoice.com/crontab-quick-reference">set up a cron job</a> to periodically run the script. For example <code>0-59/5 * * * * /path/to/check_sites &gt;&amp; /dev/null</code> will run the script every five minutes. (You need to edit &ldquo;/path/to/check_sites&rdquo; to be the actual path of the script.)</p>
<p>That&rsquo;s it. Now you&rsquo;ll be alerted whenever the script finds an error with one of the sites in the list.</p>
<p>Cross-posted at&nbsp;<a href="http://dryan.com/articles/monitor-your-websites/">http://dryan.com/articles/monitor-your-websites/</a></p>
      ]]></content>
    </entry>

    <entry>
      <title>Template&#45;based Asset Munging in ExpressionEngine</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/07/11/template-based-asset-munging-in-expressionengine" />
      <id>tag:,2010:/archive/1.524</id>
      <published>2010-07-11T13:28:57Z</published>
      <updated>2010-07-26T00:56:59Z</updated>
      <author>
            <name>Aaron Gustafson</name>
            <email>aaron@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="content management"
        scheme="http://easy-reader.net/site/C203/"
        label="content management" />
      <category term="CSS"
        scheme="http://easy-reader.net/site/C192/"
        label="CSS" />
      <category term="ExpressionEngine"
        scheme="http://easy-reader.net/site/C202/"
        label="ExpressionEngine" />
      <category term="JavaScript"
        scheme="http://easy-reader.net/site/C189/"
        label="JavaScript" />
      <category term="optimization &amp; performance"
        scheme="http://easy-reader.net/site/C208/"
        label="optimization &amp; performance" />
      <content type="html"><![CDATA[
        <p>In our years of working with ExpressionEngine, we've tweaked our standard setup quite a few times. We generally handle most every asset, including CSS and JavaScript, as a template. Being a bit obsessed with organization and overall maintainability of code, we separate out our styles and scripts into separate templates for each major concern (e.g. typography, color, screen layout, etc.).</p>
<p><img src="/img/posts/2010-07-11-style-templates.png" alt="" /></p>
<p>A while back, it was not uncommon for us to include each of these assets into the document separately, but, as website optimization and performance folks will tell you, all of that separation leads to a lot of additional overhead because the browser must request each of those files individually. In the interest of streamlining the download process, we decided to merge all of the stylesheets together at the template level before sending them over the wire. Here's the simple recipe we devised:</p>
<p>&#123;exp:gist id="471560" file="main.css"&#125;</p>
<p>This framework allows us to pull in each template in the optimum way for progressive enhancement with only a single download on the user end, which is much faster. And server-side caching only adds to the speed improvements. Beyond that, we can continue to add new <code class="css">@media</code> blocks (including media queries) as necessary either within the embedded files or in this master one.</p>
<p>We use a similar setup for our JavaScript:</p>
<p>&#123;exp:gist id="471560" file="main.js"&#125;</p>
<p>In this particular example, we're including two jQuery plugins: <a href="http://github.com/easy-designs/FunctionHandler.js">FunctionHandler</a>&nbsp;and <a href="http://cherne.net/brian/resources/jquery.hoverIntent.html">hoverIntent</a>, along with <a href="http://eCSStender.org">eCSStender</a> before adding our <a href="/archives/2010/01/18/a-new-onload-scheme">page-specific code in FunctionHandler registrations</a>. (jQuery itself is loaded in from Google.)</p>
<p>Using ExpressionEngine&rsquo;s template system to manage the munging like this is dead simple and (from our experience evaluating other people&rsquo;s EE setups) often underused. Give it a shot on your next project.</p>
      ]]></content>
    </entry>

    <entry>
      <title>Subtree merge as an alternative to submodules with git svn</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/04/05/subtree-merge-as-an-alternative-to-submodules-with-git-svn" />
      <id>tag:,2010:/archive/1.490</id>
      <published>2010-04-05T11:45:12Z</published>
      <updated>2010-07-26T00:57:14Z</updated>
      <author>
            <name>Aaron Gustafson</name>
            <email>aaron@easy-designs.net</email>
                  </author>

      <category term="Process"
        scheme="http://easy-reader.net/site/C184/"
        label="Process" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="Git"
        scheme="http://easy-reader.net/site/C206/"
        label="Git" />
      <category term="Subversion"
        scheme="http://easy-reader.net/site/C207/"
        label="Subversion" />
      <category term="version control"
        scheme="http://easy-reader.net/site/C205/"
        label="version control" />
      <content type="html"><![CDATA[
        <p>We use <a href="http://subversion.tigris.org/">Subversion</a> as our version control system for all client work here at Easy because we absolutely love <a href="http://springloops.com" rel="external">Springloops' hosted Subversion service</a>, but we use <a href="http://www.kernel.org/pub/software/scm/git/docs/" rel="external">Git</a> for <a href="http://github.com/easy-designs" rel="external">all of our open source projects</a> because, well, Git is a lot more fun to work with and we love the community that's built up around <a href="http://github.com" rel="external">Github</a>. In order to have the best of both worlds when working on client projects, we use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html" rel="external">git-svn</a> as our front-end to Subversion. It's a great tool, but it's not without its limitations. One such limitation is its inability to translate <a href="http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#submodules" rel="external">Git submodules</a> into <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html" rel="external">svn:externals</a>. Thankfully, Git offers an alternative that is comparable and plays nicely with Subversion: <a href="http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html" rel="external">the subtree merge</a>.</p>
<p>When attempting to <code class="shell">dcommit</code> a Git repository containing a submodule, you'll likely receive a message like this:</p>
<blockquote cite="http://de-co-de.blogspot.com/2009/02/git-svn-and-submodules.html">
<p>952bee47201e87b0b0e851bcbe6c8940d429cda0 doesn't exist in the repository at /usr/local/git/libexec/git-core/git-svn line 3787 Failed to read object 952bee47201e87b0b0e851bcbe6c8940d429cda0 at /usr/local/git/libexec/git-core/git-svn line 480</p>
</blockquote>
<p>That annoying message is the painful reminder that you need to find another way to add content from another project into your repository. Subtree merge to the rescue!</p>
<p>If you've already hit the error, go ahead and delete your submodule folder(s) and the .gitmodules file and commit the changes to your repository to make the path available again. Next, from a shell within the root of your Git repository enter these commands at the prompt (replacing the capitalized phrases with your relevant information):</p>
<ol>
<li><code class="shell">git remote add -f LOCAL_NAME PATH/TO/GIT/REPOSITORY</code></li>
<li><code class="shell">git merge -s ours --no-commit LOCAL_NAME/BRANCH_NAME</code></li>
<li><code class="shell">git read-tree --prefix=PATH/I/WANT/IT/IN/ -u LOCAL_NAME/BRANCH_NAME </code></li>
<li><code class="shell">git commit -m "Merge of PROJECT"</code></li>
<li><code class="shell">git pull -s subtree LOCAL_NAME master</code></li>
</ol>
<p>To provide a fully fleshed-out example for you, I used the following to merge the master branch of eCSStender into the path vendors/ecsstender within another project.</p>
<ol>
<li><code class="shell">git remote add -f eCSStender git://github.com/easy-designs/eCSStender.js.git</code></li>
<li><code class="shell">git merge -s ours --no-commit eCSStender/master</code></li>
<li><code class="shell">git read-tree --prefix=vendors/ecsstender/ -u eCSStender/master</code></li>
<li><code class="shell">git commit -m "Merge of eCSStender into the vendors directory"</code></li>
<li><code class="shell">git pull -s subtree eCSStender master</code></li>
</ol>
<p>The beauty of this is that you can use that last line to pull in the latest version of the external project and then all you have to do is <code class="shell">dcommit</code> the changes to get them into Subversion. Problem solved.</p>
      ]]></content>
    </entry>

    <entry>
      <title>iPhone Controlling Flash with TUIO and UDP</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/03/19/iphone-controlling-flash-with-tuio-and-udp" />
      <id>tag:,2010:/archive/1.539</id>
      <published>2010-03-19T13:54:33Z</published>
      <updated>2010-07-27T21:16:00Z</updated>
      <author>
            <name>Dave Stewart</name>
            <email>dave@easy-designs.net</email>
                  </author>

      <category term="Potpourri"
        scheme="http://easy-reader.net/site/C183/"
        label="Potpourri" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="Flash &amp; ActionScript"
        scheme="http://easy-reader.net/site/C195/"
        label="Flash &amp; ActionScript" />
      <category term="iOS"
        scheme="http://easy-reader.net/site/C200/"
        label="iOS" />
      <category term="mobile"
        scheme="http://easy-reader.net/site/C201/"
        label="mobile" />
      <category term="projects &amp; products"
        scheme="http://easy-reader.net/site/C162/"
        label="projects &amp; products" />
      <content type="html"><![CDATA[
        <p>I am in the middle of constructing a&nbsp;<a href="http://www.google.com/search?rls=en&amp;q=FTIR+table&amp;ie=UTF-8&amp;oe=UTF-8">FTIR table</a>&nbsp;and&nbsp;I am going with the laser approach after less than satisfactory results using Infra Red LED&rsquo;s. It&rsquo;s going well and I have had some success with Fiducial tracking using my infra red modded webcam cam, plexiglass and such. I had been building the apps in Quartz Composer but I am not too familiar with Quartz yet.</p>
<p>Until my lasers arrive I decided to try and get some output from my iPhone, after all it&rsquo;s a great touch screen and a change from building apps in Flash, which I know better.&nbsp;How do you get Camera or iPhone touch data out over the network to your MacBook and then have Flash read it??? Long story. If you are interested in going down this rabbit hole, check out these links:</p>
<ul>
<li><a href="http://reactivision.sourceforge.net/">http://reactivision.sourceforge.net/</a></li>
<li><a href="http://www.tuio.org/?software">http://www.tuio.org/?software</a></li>
<li><a href="http://vimeo.com/7131693">Georg Kaindl&rsquo;s UDP Flash Bridge video</a></li>
<li><a href="http://bubblebird.at/tuioflash/">http://bubblebird.at/tuioflash/</a></li>
<li><a href="http://pixelverse.org/iphone/oscemote/">http://pixelverse.org/iphone/oscemote/</a></li>
<li>And for lasers:&nbsp;<a href="http://aixiz.globat.com/">http://aixiz.globat.com/</a></li>
</ul>
<p>As I recently discovered, there are a few different methods of tracking and a bunch of lib&rsquo;s on google code for such things.&nbsp;After trying most of them and trying a couple of different table designs, I decided to go with&nbsp;<a href="http://gkaindl.com/software/udp-flashlc-bridge">UDP-Flashlc Bridge</a>&nbsp;for UDP speed and&nbsp;<a href="http://bubblebird.at/tuioflash/tuio-as3-library/">TULO-AS3</a>&nbsp;for TUIO or Blob tracking in Flash and&nbsp;<a href="http://pixelverse.org/iphone/oscemote/">OSCemote</a>&nbsp;to track iPhone touches.</p>
<p>I find that sending the data over UDP using udp-flashlc-bridge is way faster and more efficient than XML- or TCP-based approaches. There is virtually no lag at all.</p>
<p>I modded my sea creature to work with a simple touch setup. Here is a crappy movie for now. I will do some nicer movies when I finish my table.</p>
<p>&#123;exp:easy_html5_video path="/img/posts/" file="iPadFlashUDP_SeaCreature" width="320" height="256"&#125;</p>
<p>The next thing was to get some multi touch functionality. This one took some head scratching and it still needs refinement. I started thinking about moving photos around, rotating, scaling and such. I realized I needed special <code class="as">movieClip</code> class I had created for my last big Flash project. A <code class="as">movieClip</code> class can be assigned a dynamic registration point and it&rsquo;s <code class="as">globalToLocal</code> coords work no matter how deeply nested it lives. This allows for the first finger touch to be set as the registration point for the photo and the next touch to be used as the operator for scaling and rotating. Here is another crappy movie.</p>
<p>&#123;exp:easy_html5_video path="/img/posts/" file="iPhoneTrack2" width="320" height="256"&#125;</p>
      ]]></content>
    </entry>

    <entry>
      <title>EE Tip: Counting the results of a nested query</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/03/17/counting-the-results-of-a-nested-query-in-expressionengine" />
      <id>tag:,2010:/archive/1.489</id>
      <published>2010-03-17T19:16:25Z</published>
      <updated>2010-07-26T00:57:26Z</updated>
      <author>
            <name>Aaron Gustafson</name>
            <email>aaron@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="content management"
        scheme="http://easy-reader.net/site/C203/"
        label="content management" />
      <category term="databases"
        scheme="http://easy-reader.net/site/C197/"
        label="databases" />
      <category term="ExpressionEngine"
        scheme="http://easy-reader.net/site/C202/"
        label="ExpressionEngine" />
      <category term="MySQL"
        scheme="http://easy-reader.net/site/C204/"
        label="MySQL" />
      <category term="PHP"
        scheme="http://easy-reader.net/site/C191/"
        label="PHP" />
      <content type="html"><![CDATA[
        <p>If you've built anything remotely challenging in ExpressionEngine, you've no doubt discovered things that are easier done in native PHP than in EE tags. A lot of it has to do with how ExpressionEngine parses templates and what gets parsed first.</p>
<p>One recent bugbear I ran into was trying to use the <code class="ee">{count}</code> "magic" variable from a call to <code class="ee">&#123;exp:query&#125;</code> that resided inside a <code class="ee">&#123;exp:weblog:entries&#125;</code> loop. I needed the <code class="ee">{entry_id}</code> from the entry in the SQL statement, but <code class="ee">{count}</code> (despite being used inside <code class="ee">&#123;exp:query&#125;</code>) was evaluating as the <code class="ee">&#123;exp:weblog:entries&#125;</code> count and not the <code class="ee">&#123;exp:query&#125;</code> count. To solve the issue, I came up with the following:</p>
<p>&#123;exp:gist id="335632" file="gistfile1.phtml"&#125;</p>
<p>You'll notice I'm using <code class="ee">&#123;exp:query&#125;</code> twice. The first time is to establish a variable in the SQL connection. Then I am free to use the variable in the second query and the count (returned as <code class="ee">{query_count}</code>) will be a count of the inner loop instead of the outer one.</p>
<p>It is important to note, however, that MySQL will evaluate the variable's incrementation before paying attention to any <code class="sql">ORDER BY</code> clauses, so your mileage may vary. Regardless, it's a handy technique.</p>
      ]]></content>
    </entry>

    <entry>
      <title>Audio Spectrum Analysis in JSON</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/02/23/audio-spectrum-analysis-in-json" />
      <id>tag:,2010:/archive/1.538</id>
      <published>2010-02-23T13:54:33Z</published>
      <updated>2010-07-27T12:28:09Z</updated>
      <author>
            <name>Dave Stewart</name>
            <email>dave@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="(x)HTML"
        scheme="http://easy-reader.net/site/C190/"
        label="(x)HTML" />
      <category term="browsers"
        scheme="http://easy-reader.net/site/C194/"
        label="browsers" />
      <category term="coding"
        scheme="http://easy-reader.net/site/C158/"
        label="coding" />
      <category term="Flash &amp; ActionScript"
        scheme="http://easy-reader.net/site/C195/"
        label="Flash &amp; ActionScript" />
      <category term="JavaScript"
        scheme="http://easy-reader.net/site/C189/"
        label="JavaScript" />
      <category term="PHP"
        scheme="http://easy-reader.net/site/C191/"
        label="PHP" />
      <category term="projects &amp; products"
        scheme="http://easy-reader.net/site/C162/"
        label="projects &amp; products" />
      <content type="html"><![CDATA[
        <p>I have been unsuccessful so far in syncing animation drawn in <code class="html">canvas</code> using Processing.js &amp; audio played using the browser <code class="html">audio</code> tag with audio spectrum data I create from a ByteArray in Flash. It works in Flash due to the fact that the spectrum analysis and animation are executed together in an <code class="as">onEnterFrame</code> event. The drawback to not having real time audio spectrum analysis from within the browser is the need to supply all the data to Processing.js at initialization. It can be rather large and I have yet to perfect syncing the reading of the array with the current time of the audio. Some sort of progressive data stream and excellent timing system?!?</p>
<p>It may be I just have to wait until this feature is implemented into browsers. In the meantime, I thought I would post the source for the the Spectrum Analysis tool I created for anyone wanting a quick way to get some data from their favorite tune and perhaps figure out a way to use it in a optimized fashion. The tool is very simple and outputs JSON with Left and Right channels as floating point numbers between 0 and 1.</p>
<p>You can use it to make stuff move to the groove. It has a simple execution of this in the ui for you to see. <a href="/img/posts/Audio_Spectrum_Output.zip">Download the Flash and PHP</a> and throw it on your local server.</p>
<p>The process of accessing audio data from within the browser is quite beyond me, I really just want to see what I can create visually in Processing.js and <code class="html">canvas</code>. Until it&rsquo;s available in an easy-to-use API, I just have to keep looking for a way to get spectrum data quickly, hence this contraption. Have fun.</p>
      ]]></content>
    </entry>

    <entry>
      <title>A Twitter Search Visualizer in Processing.js</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/02/19/a-twitter-search-visualizer-in-processing.js" />
      <id>tag:,2010:/archive/1.542</id>
      <published>2010-02-19T13:54:33Z</published>
      <updated>2010-07-27T13:16:34Z</updated>
      <author>
            <name>Dave Stewart</name>
            <email>dave@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="(x)HTML"
        scheme="http://easy-reader.net/site/C190/"
        label="(x)HTML" />
      <category term="animation"
        scheme="http://easy-reader.net/site/C155/"
        label="animation" />
      <category term="browsers"
        scheme="http://easy-reader.net/site/C194/"
        label="browsers" />
      <category term="JavaScript"
        scheme="http://easy-reader.net/site/C189/"
        label="JavaScript" />
      <category term="projects &amp; products"
        scheme="http://easy-reader.net/site/C162/"
        label="projects &amp; products" />
      <category term="web standards"
        scheme="http://easy-reader.net/site/C159/"
        label="web standards" />
      <content type="html"><![CDATA[
        <p>
<p>I jumped over from Raphael back to Processing again today. I have said it before: us Flash guys might get frustrated trying to pull off some simple stuff in either Processing or Raphael. Just keep in mind that they are young languages and the future looks bright.</p>
<p>Anyway, another attempt to do something here with Processing. It took a me minute to find an elegant way to get Twitter JSON data into Processing without being too sloppy. <a href="/demos/processing-tweets/">The visualizer</a> works perfectly in Safari and Chrome, but it&rsquo;s completely hosed in Firefox.</p>
</p>
      ]]></content>
    </entry>

    <entry>
      <title>Canvas, Audio, Raphael &amp;amp; Twitter</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/02/16/canvas-audio-raphael-twitter" />
      <id>tag:,2010:/archive/1.541</id>
      <published>2010-02-16T13:54:33Z</published>
      <updated>2010-07-27T14:54:06Z</updated>
      <author>
            <name>Dave Stewart</name>
            <email>dave@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="(x)HTML"
        scheme="http://easy-reader.net/site/C190/"
        label="(x)HTML" />
      <category term="animation"
        scheme="http://easy-reader.net/site/C155/"
        label="animation" />
      <category term="browsers"
        scheme="http://easy-reader.net/site/C194/"
        label="browsers" />
      <category term="JavaScript"
        scheme="http://easy-reader.net/site/C189/"
        label="JavaScript" />
      <category term="web standards"
        scheme="http://easy-reader.net/site/C159/"
        label="web standards" />
      <content type="html"><![CDATA[
        <p>Last week I worked up an audio visualizer in Flash for a friend that yielded some nice results. The ActionScript 3.0 ByteArray and computeSpectrum are powerful and have many potential uses. Doing the same thing with <code class="html">canvas</code> and JavaScript requires a more roundabout method that is less accurate but more gratifying from a coding perspective.</p>
<p>My journey down this rabbit hole led me to almost doing <a href="http://vocamus.net/dave/?p=914">this</a>. I got myself a copy of <a href="http://www.mozilla.org/projects/minefield">Minfield</a> and read up on how to build <a href="http://weblog.bocoup.com/javascript-fft-audio-sampling-in-firefox">my own audio patched version</a> of Firefox&hellip; yeah, not going to happen.</p>
<p>Needing more of a quick fix, I came up with two solutions. My first attempt at a solution was to build a Flash audio sampler that piped out the -1 to 1 floating point numbers to a file and use them in a JS array to manipulate coordinates of sprites on a <code class="html">canvas</code>. It worked quite well but the synchronization was off. I have not fixed this in that version but in the interim I got sidetracked and found another way to get some data. Quite simple really: load up an mp3 into Audacity and go Analyze -&gt; Time -&gt; Beat Finder. Set the tolerance to about 55 and this will generate beat labels. Export those to a text file and then clean up the numbers to get an array of milliseconds for your JS <code class="js">setInterval()</code>.</p>
<p>Granted this is not spectrum data&mdash;it&rsquo;s simpler beat info&mdash;but in a way it works better for animating sprites because it&rsquo;s cleaner. Spectrum data is very granular and works nice in widgets designed to show this (e.g. Graphs and Histogram visuals).</p>
<p><a href="/demos/audio-twitter/">This test shows twitter searches</a>&nbsp;on an HTML5 <code class="html">canvas</code> and moves them around in time to the beat of the music loaded in an audio tag. It&rsquo;s not very exciting at this point but it&rsquo;s got me thinking of some fun stuff to do. Every experiment like this is a step closer to moving away from Flash. I still can&rsquo;t settle on using Processing or Raphael though.</p>
      ]]></content>
    </entry>

    <entry>
      <title>See Creature</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/01/21/see-creature" />
      <id>tag:,2010:/archive/1.537</id>
      <published>2010-01-21T13:54:33Z</published>
      <updated>2010-07-27T12:17:13Z</updated>
      <author>
            <name>Dave Stewart</name>
            <email>dave@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="animation"
        scheme="http://easy-reader.net/site/C155/"
        label="animation" />
      <category term="design"
        scheme="http://easy-reader.net/site/C156/"
        label="design" />
      <category term="Flash &amp; ActionScript"
        scheme="http://easy-reader.net/site/C195/"
        label="Flash &amp; ActionScript" />
      <content type="html"><![CDATA[
        <p>I took a day to extend the tentacle class to work on 360&deg; and secondary motion from a parent node, but here it is, the first critter for my ocean. Thanks to Keith Peters book&nbsp;<a href="http://www.amazon.com/Foundation-Actionscript-3-0-Animation-Making/dp/1590597915">ActionScript 3 Animation</a>, useful formulas section for getting me through this. It kicked my butt and fried my brain, but it&rsquo;s so clear now. Onwards!</p>
<p>
<object data="/img/posts/SeaCreature1.swf" height="500" type="application/x-shockwave-flash" width="500">
<param name="src" value="/img/posts/SeaCreature1.swf" />
</object>
</p>
      ]]></content>
    </entry>

    <entry>
      <title>A new &#8220;onload&#8221; scheme</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/01/18/a-new-onload-scheme" />
      <id>tag:,2010:/archive/1.370</id>
      <published>2010-01-18T23:30:45Z</published>
      <updated>2010-07-26T00:57:46Z</updated>
      <author>
            <name>Aaron Gustafson</name>
            <email>aaron@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="coding"
        scheme="http://easy-reader.net/site/C158/"
        label="coding" />
      <category term="JavaScript"
        scheme="http://easy-reader.net/site/C189/"
        label="JavaScript" />
      <category term="web standards"
        scheme="http://easy-reader.net/site/C159/"
        label="web standards" />
      <content type="html"><![CDATA[
        <p>A few projects back, I decided to rethink our JavaScript organization strategy and came up with a new technique that, I think, helps us better manage behaviors from page to page.</p>
<p>For years, when I needed page-specific interactions, I would either embed the JS (unobtrusively, of course) at the bottom of the page or externalize it to a separate page-specific file. In some sites, that became a difficult setup to manage because we were juggling so many files and we were also forcing our users to download each of those files individually.</p>
<p>Looking for a better way to manage all of the code, I built <a href="http://github.com/easy-designs/FunctionHandler.js">FunctionHandler</a>. This script takes lets you declare blocks of JavaScript and then target them at pages based on the <code class="html">id</code> attribute on the <code class="html">body</code> element. When the targeted <code class="html">id</code> is encountered, the code block is executed on DOM ready. Here's a quick example:</p>
<p>&#123;exp:gist id="313553" file="gistfile1.js"&#125;</p>
<p>As you can see, using it is pretty simple: you make a call to FunctionHandler's <code class="javascript">register</code> method and pass it two arguments. The first is an array of the <code class="html">id</code> values you want this code block to execute on and the second is an anonymous function that wraps your code block.</p>
<p>What we've found really nice about this setup is that it encourages you to create discrete JavaScript components while, at the same time, easily allowing you to adjust the pages that those components run on by simply adding to or subtracting from the <code class="html">id</code> stack. You can even blanket every page with a given script by supplying a string value of "*" as the initial argument:</p>
<p>&#123;exp:gist id="313553" file="gistfile2.js"&#125;</p>
<p>Anyway, I just wanted to take a brief moment to share this script because we've found it pretty handy. Perhaps you will too.</p>
<p>PS - FunctionHandler is available in 3 flavors: native JS, jQuery, and Prototype.</p>
      ]]></content>
    </entry>

    <entry>
      <title>Logarithmic Spirals</title>
      <link rel="alternate" type="text/html" href="http://easy-reader.net/archives/2010/01/11/logarithmic-spirals" />
      <id>tag:,2010:/archive/1.536</id>
      <published>2010-01-11T13:53:33Z</published>
      <updated>2010-07-27T12:13:01Z</updated>
      <author>
            <name>Dave Stewart</name>
            <email>dave@easy-designs.net</email>
                  </author>

      <category term="Programming"
        scheme="http://easy-reader.net/site/C151/"
        label="Programming" />
      <category term="Tags"
        scheme="http://easy-reader.net/site/C209/"
        label="Tags" />
      <category term="animation"
        scheme="http://easy-reader.net/site/C155/"
        label="animation" />
      <category term="design"
        scheme="http://easy-reader.net/site/C156/"
        label="design" />
      <category term="Flash &amp; ActionScript"
        scheme="http://easy-reader.net/site/C195/"
        label="Flash &amp; ActionScript" />
      <content type="html"><![CDATA[
        <p>I spent last evening coding some circles &amp; spirals in Flash. I love spirals!</p>
<p>A logarithmic spiral, equiangular spiral or growth spiral is a special kind of spiral curve which often appears in nature. The logarithmic spiral was first described by Descartes and later extensively investigated by Jakob Bernoulli, who called it Spira mirabilis, &ldquo;the marvelous spiral.&rdquo;</p>
<p>This kind of simple Math and lengthy tweaking of geometry animation is akin to whittling a piece of wood for me, whenever I have some free time and get the urge to write some code with no particular objective. It&rsquo;s very relaxing.</p>
<p>It went through numerous iterations over the weekend and truly came to life when I started using Vectors and local3DToGlobal to convert the x,y,z coords to draw the 2D lines. Throwing in some random offsets from time to time helps keep it interesting. I used Math.sin and Math.cos a lot with random offsets to create smooth undulating motion that sometimes reminds me of jelly fish or some sort of under water plant waving around in the current. Other times it takes on a galaxy formation.</p>
<p>Watch it for 10 minutes or so and you will see some interesting spiral explosions. I can stare at it for 20-30 minutes.</p>
<p>
<object data="/img/posts/SpiralExperiments.swf" height="500" type="application/x-shockwave-flash" width="500">
<param name="src" value="/img/posts/SpiralExperiments.swf" />
</object>
</p>
      ]]></content>
    </entry>


</feed>