<?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>Eric Terpstra</title>
	<atom:link href="http://ericterpstra.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ericterpstra.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 19:43:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Code HTML5 in the Cloud with StackMob, Cloud9 and GitHub</title>
		<link>http://ericterpstra.com/2012/05/code-html5-in-the-cloud-with-stackmob-cloud9-and-github/</link>
		<comments>http://ericterpstra.com/2012/05/code-html5-in-the-cloud-with-stackmob-cloud9-and-github/#comments</comments>
		<pubDate>Tue, 15 May 2012 03:08:47 +0000</pubDate>
		<dc:creator>eterps</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ericterpstra.com/?p=180</guid>
		<description><![CDATA[In my recent efforts to learn more about modern Javascript I&#8217;ve been looking around at different Backend-as-a-Service (BaaS) companies.  They presumably would provide a dead simple server option for whatever I&#8217;m working on so I can focus all my attention on the front-end.  I signed up for a number of different accounts to explore the feature <a href='http://ericterpstra.com/2012/05/code-html5-in-the-cloud-with-stackmob-cloud9-and-github/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In my recent efforts to learn more about modern Javascript I&#8217;ve been looking around at different Backend-as-a-Service (BaaS) companies.  They presumably would provide a dead simple server option for whatever I&#8217;m working on so I can focus all my attention on the front-end.  I signed up for a <a title="Parse" href="http://parse.com" target="_blank">number</a> of <a title="Kinvey" href="http://Kinvey" target="_blank">different</a> <a title="Appcelerator Cloud" href="http://www.appcelerator.com/cloud" target="_blank">accounts</a> to explore the feature set and documentation, and settled on <a title="StackMob" href="http://stackmob.com" target="_blank">StackMob</a> due to the perceived ease of use, and the fact that their Javascript SDK is built on backbone.js (another current interest of mine).  After creating (and deleting) some dummy apps to get a feel for things, I eventually got a very simple, but usable, database put together.  What is interesting about StackMob is that they will host your front-end app, as well as provide the back-end.  Not only that, but you deploy to your front-end development server directly from GitHub.  It&#8217;s a pretty slick system.  And as soon as I realized that GitHub projects can be edited via the Cloud9 IDE, I had a nice little dev environment fully hosted in the cloud.</p>
<p>I&#8217;m not saying this combination is at all practical for serious use, but it could be useful in a pinch, or when monkeying around with some prototypes while using multiple computers.  Plus Cloud9 is just fun to look at, and this provided a good excuse to use it for real once in a while.  Oh, and it&#8217;s all free (as in beer).</p>
<p>To get started, sign up for a Stackmob account, and a <a title="GitHub" href="http://github.com" target="_blank">GitHub</a> account.  Both sites have amazing documentation for getting up-and-running on their respective services.  GitHub has very detailed instructions for setting up your account with a git client on Linux, OS X, and Windows.  If you haven&#8217;t already, <a title="Set Up Git" href="http://help.github.com/set-up-git-redirect" target="_blank">follow those instructions</a>, but do not yet create a repository.</p>
<p><a href="http://ericterpstra.com/wp-content/uploads/2012/05/StackMob-Getting-Started-with-Stackmob.png"><img class="alignright size-medium wp-image-183" title="StackMob - Getting Started with Stackmob" src="http://ericterpstra.com/wp-content/uploads/2012/05/StackMob-Getting-Started-with-Stackmob-135x300.png" alt="" width="135" height="300" /></a>Getting started in StackMob is just as easy.  Sign up for an account, then <a title="Create an App" href="https://www.stackmob.com/platform/account/apps/create" target="_blank">create an app</a>.  Every app generated by StackMob starts with a <em>Users</em> table, which is enough for now.  Grab the Javascript SDK from the <em>Get your <a title="SDK Setup" href="https://www.stackmob.com/platform/help/tutorials/gs_start" target="_blank">SDK page</a></em>, and follow the setup instructions in the <em><a title="Getting started with Javascript SDK" href="https://www.stackmob.com/platform/help/tutorials/html5_js_sdk" target="_blank">Setup your JS SDK Dev Environment</a></em> section.  Step 2 is optional if you just want to edit your app in the Cloud9 IDE.  Otherwise make sure you have Ruby installed and give it a try.  In Step 3, you will be instructed to create a GitHub repository. Do that.  While you are logged into GitHub, also set up <em>automatic fetching</em>, so your code will get deployed to your development server every time you push to GitHub.  The <em><a title="Hosting HTML5 on StackMob" href="http://www.stackmob.com/devcenter/docs/StackMob-Hosted-HTML5:-GitHub" target="_blank">Hosting Your HTML5 App&#8230;</a> </em>page has all the necessary instructions. Make sure you have committed and pushed some files (likely the StackMob SDK) to your GitHub repository.</p>
<p>By this point, you can edit files locally, push the files to GitHub, and see your changes reflected online.  To start editing online, go to <a title="Cloud9 Editor" href="http://c9.io" target="_blank">c9.io</a> and log in using your GitHub account.  When you reach your dashboard, you should see a big green button that says <em>Create New Project</em> in the left-hand sidebar, as well as a section in the sidebar labeled <em>Projects on GitHub</em>.  The URL for your dashboard is http://c9.io/yourgithubusername.  If you cannot see your GitHub project, click the refresh button in the far lower left corner of the screen.  Select your StackMob GitHub project from the sidebar menu, and click <em>Clone to Edit</em>.  In the modal window, select <em>Shared Development Server</em> and click Checkout. It will take a minute, but your project should be created and listed under <em>My Projects</em>. Select your project and click <em>Start Editing</em>.  You should be taken to the editor window where you can open and edit your project files.  Take a few minutes to admire the lovely UI and its many features, and edit a file or two.</p>
<p><a href="http://ericterpstra.com/wp-content/uploads/2012/05/bourbonflavors-Cloud9.png"><img class="size-medium wp-image-182 alignleft" title="Cloud9 IDE" src="http://ericterpstra.com/wp-content/uploads/2012/05/bourbonflavors-Cloud9-300x270.png" alt="" width="300" height="270" /></a>To test out your edits, open the console window (Menu: <em>Windows &gt; Console )</em> and run your usual git commands &#8211; e.g. <em>git commit -a -m &#8220;msg&#8221;</em> and <em>git push</em>. The Cloud9 git client will push your changes to your GitHub master branch, and those changes will then propogate almost immediately to your hosted StackMob application.</p>
<p>This is creating a web application in the cloud.  Development-in-the-cloud is not quite cut out for daily use, but if you really need to try out some code or get in a quick change from any computer (or tablet, or phone), this is a nifty way to do it.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2012/05/code-html5-in-the-cloud-with-stackmob-cloud9-and-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Test-Driven JavaScript Assessment &#8211; I Passed!</title>
		<link>http://ericterpstra.com/2012/05/a-test-driven-javascript-assessment-i-passed/</link>
		<comments>http://ericterpstra.com/2012/05/a-test-driven-javascript-assessment-i-passed/#comments</comments>
		<pubDate>Tue, 08 May 2012 02:57:33 +0000</pubDate>
		<dc:creator>eterps</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ericterpstra.com/?p=175</guid>
		<description><![CDATA[Over the past few weeks (months?), I&#8217;ve been making a grand effort to learn as much as I can about javascript.  I&#8217;ve gotten my hands on a couple good books, read countless articles, and most recently, stumbled upon a very interesting blog post.  Rebecca Murphey (of yayQuery! fame) recently created a series of failing unit <a href='http://ericterpstra.com/2012/05/a-test-driven-javascript-assessment-i-passed/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://ericterpstra.com/wp-content/uploads/2012/05/Mocha-Tests.png"><img class="alignright size-medium wp-image-176" title="Mocha Tests" src="http://ericterpstra.com/wp-content/uploads/2012/05/Mocha-Tests-201x300.png" alt="" width="201" height="300" /></a>Over the past few weeks (months?), I&#8217;ve been making a grand effort to learn as much as I can about javascript.  I&#8217;ve gotten my hands on a couple <a title="Javascript The Good Parts" href="http://www.amazon.com/exec/obidos/ASIN/0596517742/" target="_blank">good</a> <a title="Javascript Web Applications" href="http://www.amazon.com/JavaScript-Web-Applications-Alex-MacCaw/dp/144930351X/" target="_blank">books</a>, read countless <a title="Javascript Blogs" href="http://www.google.com/reader/bundle/user%2F13871755170619940312%2Fbundle%2FJavaScript" target="_blank">articles</a>, and most recently, stumbled upon a very interesting <a title="A Baseline For Front-End Developers" href="http://rmurphey.com/blog/2012/04/12/a-baseline-for-front-end-developers/" target="_blank">blog post</a>.  Rebecca Murphey (of <a title="yayQuery Podcast" href="http://yayquery.com/" target="_blank">yayQuery</a>! fame) recently created a series of failing unit tests in javascript and made a nice node.js app from them (<a title="js-assessment github" href="https://github.com/rmurphey/js-assessment" target="_blank">available on Github</a>).  This provides a nice exercise for anyone wishing to assess their fundamental javascript skills.  Given the fact that I had no idea where I stood in terms of skill, I thought I&#8217;d give it a go.</p>
<p>I&#8217;m glad I did.  Not only was it a mild wake-up call, but a great introduction to some topics that I don&#8217;t see often in the real world &#8211; topics like partial functions &amp; currying, closures, creating modules, and working with prototypes.  I&#8217;m not ashamed to say this took a better part of a Sunday afternoon, as it was quite rewarding to see that &#8220;<strong>100%</strong>&#8221; show up on the screen.  Some of the tests were ridiculously easy, some were challenging, and there were a few where I didn&#8217;t really know what I was supposed to do, but eventually got something working while sticking to the topic at hand.</p>
<p>I&#8217;ve uploaded a <a title="js-assessment-answers" href="https://github.com/ericterpstra/js-assessment-answers" target="_blank">fork of the project</a> to github with my completed answers.  More tests may be added into the future, so I&#8217;ll be able to simply pull them down and hack away.  It will also be nice for my future self to look back on this in a year or two and have a chuckle at the expense of my present self.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2012/05/a-test-driven-javascript-assessment-i-passed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Erase (zero out) free disk space on OSX, Windows and Ubuntu</title>
		<link>http://ericterpstra.com/2012/03/erase-zero-out-free-disk-space-on-osx-windows-and-ubuntu/</link>
		<comments>http://ericterpstra.com/2012/03/erase-zero-out-free-disk-space-on-osx-windows-and-ubuntu/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 18:36:58 +0000</pubDate>
		<dc:creator>eterps</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ericterpstra.com/?p=148</guid>
		<description><![CDATA[Three operating systems, three file systems, three methods to zero out disk space.  Fortunately, they are all pretty simple. Doing this is a good idea right before creating a drive image for backup, as it makes compression more efficient. OSX &#8211; HFS+ (Mac OSX Journaled) Open Disk Utility Click on the OSX partition Click Erase from <a href='http://ericterpstra.com/2012/03/erase-zero-out-free-disk-space-on-osx-windows-and-ubuntu/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Three operating systems, three file systems, three methods to zero out disk space.  Fortunately, they are all pretty simple. Doing this is a good idea right before creating a drive image for backup, as it makes compression more efficient.</p>
<h3>OSX &#8211; HFS+ (Mac OSX Journaled)</h3>
<ol>
<li>Open Disk Utility</li>
<li>Click on the OSX partition</li>
<li>Click <strong>Erase</strong> from the tabbar menu</li>
<li>Click <strong>Erase free space&#8230;</strong> button</li>
<li>Choose the <strong>Fastest</strong> option &#8211; this will fill the partition with zeros one time.</li>
</ol>
<div><a style="padding-left: 20px;" href="http://ericterpstra.com/wp-content/uploads/2012/04/OSXFreeSpace.png"><img class="size-medium wp-image-159 alignnone" title="OSXFreeSpace" src="http://ericterpstra.com/wp-content/uploads/2012/04/OSXFreeSpace-300x259.png" alt="" width="300" height="259" /></a></div>
<div></div>
<h3>Windows 7 &#8211; FAT32, NTFS, exFAT</h3>
<ol>
<li>Download <a title="SDelete" href="http://technet.microsoft.com/en-us/sysinternals/bb897443" target="_blank">SDelete from Microsoft Technet</a></li>
<li>Copy sdelete.exe to C:\Windows\System32 (or any folder in your system PATH).</li>
<li>Run SDelete from the command-line using:  
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sdelete <span style="color: #660033;">-p</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-z</span> c:\</div></div>
<p>(where &#8216;c&#8217; is the target drive letter)</li>
</ol>
<div><a style="padding-left: 20px;" href="http://ericterpstra.com/wp-content/uploads/2012/04/sdelete.jpg"><img class="alignnone size-medium wp-image-163" title="sdelete" src="http://ericterpstra.com/wp-content/uploads/2012/04/sdelete-300x151.jpg" alt="" width="300" height="151" /></a></div>
<h3>Ubuntu &#8211; ext3, ext4</h3>
<ol>
<li>Install the secure-delete package: 
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> secure-delete</div></div>
</li>
<li>Use fdisk to find the correct drive partition:
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fdisk <span style="color: #660033;">-l</span></div></div>
<p> The drive in question will be something like /dev/sda or /dev/sdb.  Each partition is numbered, like /dev/sdb1 and /dev/sdb2</li>
<li>Mount the drive partition (if it is not already):  
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb1 <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>hdd1</div></div>
</li>
<li>Run 
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sfill <span style="color: #660033;">-Ilz</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>hdd1</div></div>
<p>where &#8216;hdd1&#8242; is the location of the mounted partition in the filesystem.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2012/03/erase-zero-out-free-disk-space-on-osx-windows-and-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Triple Booting my PC with OSX Lion, Windows 7, and Lubuntu 12.04</title>
		<link>http://ericterpstra.com/2012/03/triple-booting-my-pc-with-osx-lion-windows-7-and-lubuntu-12-04/</link>
		<comments>http://ericterpstra.com/2012/03/triple-booting-my-pc-with-osx-lion-windows-7-and-lubuntu-12-04/#comments</comments>
		<pubDate>Sat, 03 Mar 2012 14:32:45 +0000</pubDate>
		<dc:creator>eterps</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hackintosh]]></category>

		<guid isPermaLink="false">http://ericterpstra.com/?p=136</guid>
		<description><![CDATA[My computer has three operating systems. &#8220;Why do you need three operating systems?&#8221; one might ask. First, because it&#8217;s cool, but mostly because it is quite practical for web and mobile development and playing games.  Linux and OSX are both great environments for trying out new-to-me technologies like node.js, Ruby on Rails, MongoDB, and all <a href='http://ericterpstra.com/2012/03/triple-booting-my-pc-with-osx-lion-windows-7-and-lubuntu-12-04/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://ericterpstra.com/wp-content/uploads/2012/04/triboot.png"><img class="aligncenter size-full wp-image-165" title="triboot" src="http://ericterpstra.com/wp-content/uploads/2012/04/triboot.png" alt="" width="600" height="198" /></a></p>
<p>My computer has three operating systems.</p>
<p>&#8220;Why do you need three operating systems?&#8221; one might ask.</p>
<p>First, because it&#8217;s cool, but mostly because it is quite practical for web and mobile development and playing games.  Linux and OSX are both great environments for trying out new-to-me technologies like node.js, Ruby on Rails, MongoDB, and all sorts of hackerish command line tools.  OSX has the added benefit of being able to deploy apps directly to my iPhone (as well as being the prettiest of the OSs).  And when it comes to playing the games, nothing beats Windows. OSX is starting to get some love from Steam, and quite a few interesting indie releases show up on Linux, but if you want a guaranteed awesome PC gaming experience, you need Windows.</p>
<p>Also, from a web-development standpoint, the ability to do cross-browser testing comes in very handy.  Plus, there are no development tools that are off-limits because the author decided to only release a Windows or OSX version.</p>
<p>So here is a basic rundown of my system, and how it was put together.  Rather than develop a detailed howto, I&#8217;ll leave it to the many talented bloggers out on the internets to provide the step-by-step.</p>
<h2>Required Hardware</h2>
<p>The most important element by far when installing OSX on a non-Mac is the motherboard.  It&#8217;s like the foundation on a house &#8211; it needs to be sturdy or everything comes crashing down.  Luckily, when I built my PC in early 2009, I purchased an Asus p6t, which just happens to be very compatible with OSX &#8211; as does the nVidia graphics card I picked up.  Apparently Gigabyte mobos are all the rage with the hackintosh crowd, so if you are in the market for a new build, or want to check your current hardware, see the following links when considering hardware:</p>
<ul>
<li><a title="TonyMac Golden Builds" href="http://www.tonymacx86.com/viewforum.php?f=264" target="_blank">tonymacx86 Golden Builds</a></li>
<li><a title="tonymacx86 Wiki" href="http://www.tonymacx86.com/wiki/index.php/Main_Page" target="_blank">tonymaxx86 Wiki</a></li>
<li><a title="Netbook Chart" href="http://www.mymacnetbook.com/compatibility-chart/" target="_blank">MyMacNetbook Compatability Chart</a></li>
<li><a title="OSX86 Project" href="http://wiki.osx86project.org/wiki/index.php/Main_Page" target="_blank">OX86 Project Wiki (see the Hardware Compatibility section)</a></li>
</ul>
<div>And if you are wondering if your existing hardware works, take a look at the following:</div>
<div>
<ul>
<li><a href="http://www.macbreaker.com/2012/01/is-your-computer-hackintosh-compatible.html" target="_blank">Can I Install OS X on my PC? Read this first.</a></li>
<li><a href="http://lifehacker.com/5869731/can-i-hackintosh-my-laptop" target="_blank">Can I Hackintosh my Laptop?</a></li>
</ul>
<div>As for Windows and Ubuntu, most mainstream motherboards are accepted, but check your manufacturers website for compatibility information.  Also, for discrete graphics in Ubuntu, go with nVidia, as they still support linux with proprietary drivers.</div>
</div>
<div></div>
<div>
<h2>Installation Media</h2>
</div>
<div>
<ul>
<li>OSX: 8GB or larger USB thumb-drive</li>
<li>Windows 7: 8GB or larger USB thumb-drive or blank DVD</li>
<li>Lubuntu: 1GB thumb-drive, blank CD, or blank DVD</li>
</ul>
<div>Preparing a bootable USB drive with OSX Lion is definitely the most inconvenient step of the whole process.  The ideal situation is to have a retail copy of OSX Lion, and an actual Mac available for temporary use. I actually cheated and had a friend at work create the OSX Lion installer for me (using his own hackintosh).  Luckily, there are scads of online tutorials for creating a Lion USB installer using a nifty tool called UniBeast.</div>
<div>
<ul>
<li><a href="http://tonymacx86.blogspot.com/2011/10/unibeast-install-mac-os-x-lion-using.html">Unibeast All-in-One USB  Installation Guide</a> (Stop at Step 3)</li>
<li><a href="http://waypastwarranty.wordpress.com/2012/01/07/so-you-want-to-create-unibeast-drive-for-hackintosh-but-dont-have-a-mac-heres-how-to-do-it-in-windows/">Creating a UniBeast Thumbdrive without a Mac</a> (you will also need a Snow Leopard DVD or ISO for this)</li>
</ul>
<div>Once the OSX USB drive is created, download <a title="MultiBeast" href="http://www.tonymacx86.com/viewforum.php?f=125" target="_blank">MultiBeast </a>and copy the file to the USB drive. This will be needed later.</div>
<div></div>
<div>Preparing  Windows and Ubuntu installation media is less of a task.  Because Windows 7 is a commercial operating system, you will need a licensed copy.  I purchased a copy when it was released, but others may have an OEM version baked into a manufacturers recovery disc.  If this is the case, you can get a clean Windows 7 ISO for re-installation from Microsoft.  There&#8217;s a <a href="http://www.pcworld.com/article/248995/how_to_install_windows_7_without_the_disc.html">great tutorial on how to re-install Windows at PC World</a>.  Creating a disc or USB drive for Ubuntu couldn&#8217;t be easier.  Simply visit the <a href="http://www.ubuntu.com/download/ubuntu/download">Ubuntu download page</a> and follow the instructions for your chosen medium.</div>
</div>
<div></div>
<h2>Adjust BIOS Settings</h2>
<p>Unplug any hardware that is not necessary for the installation of the operating systems (extra hard drives, USB hubs, printers, etc&#8230;).  Some BIOS settings may need adjusting as well.  If available, make sure the following settings are true:</p>
<ul>
<li>Quickboot is disabled</li>
<li>SATA is set to AHCI rather than IDE</li>
<li>The primary hard drive has priority and is the first boot device (or 2nd behind the optical drive)</li>
</ul>
<h2>Prepare Hard Drive</h2>
</div>
<p>Once all the installation media is ready to go, the targeted hard drive needs to be properly formatted.  Because OSX is very finicky about drives and partitions, you <em>must</em> use the OSX disc utility to format your drive.  In my case, I created five partitions on my 1.5TB hard drive.</p>
<ol>
<li>Insert the OSX Usb stick, power on, and tap the key for the alternative boot menu (F8 on my system)</li>
<li>Boot the USB Disk containing OSX Lion and wait for the installer to load</li>
<li>Open <strong>Disk Utility</strong> from the <strong>Applications</strong> menu</li>
<li>Select your hard drive in the left-hand column</li>
<li>Under <strong>Volume Scheme</strong>: separate the drive into at least 3 partitions.  I use 4 partitions (one for each OS, plus a shared FAT32 drive for file storage).</li>
<li>Click <strong>Options</strong>&#8230; choose <strong>GUID Partition Table</strong>, then click OK.</li>
<li>Click the first partition (Untitled 1). Type LION for the <strong>Name</strong>. Choose Mac OS Extended (Journaled) for the <strong>Format</strong>.</li>
<li>Click the next partition (Untitled 2). <strong>Name</strong> = WINDOWS7, <strong>Format</strong> = MSDOS (FAT).</li>
<li>If you have an extra partition for shared files, do the same for Untitiled 3. <strong>Name</strong>=FILES, <strong>Format</strong>=MSDOS (FAT)</li>
<li>The last partition <em>must be free space</em>.  It is important that the last partition is free, as this is where linux partitions will go.  Leaving it at the end of the disk will make things go more smoothly during the linux installation.</li>
<li>Click <strong>Apply</strong> and close Disk Utility</li>
<li>Shut Down (do <strong>not</strong> proceed with the installer)</li>
</ol>
<div>Again, check out TonyMacX86&#8242;s blog for a <a href="http://tonymacx86.blogspot.com/2009/11/dual-boot-windows-7-and-os-x-snow.html">nice guide on setting up a hard drive for multiple OSs</a>.  The article refers to Snow Leopard and dual booting, but many of the steps are identical to my setup.  The key is to set up the partitions first with Disk Utility, then instnall Windows and Ubuntu before OSX.</div>
<h2>Install Windows 7</h2>
<p>After setting up the hard drive partitions in the OSX Disk Utility, it&#8217;s best to set up Windows 7 next, as it has the most intrusive bootloader &#8211; which will get overwritten later.  Start this process with the PC shut down.</p>
<ol>
<li>Insert the Windows 7 installation media (USB or DVD).</li>
<li>Power up and boot into the Windows Installer.</li>
<li>Choose <strong>Custom (Advanced)</strong> for the installation type.</li>
<li>When presented with a list of drives, select the &#8216;WINDOWS7&#8242; partition.</li>
<li>Click <strong>Drive Options (advanced)</strong></li>
<li>Click <strong>format</strong>.</li>
<li>Click <strong>next</strong>.</li>
<li>Windows 7 will now install itself.  You may need to remove the installation media if the PC is set up to auto-boot from the Windows 7 disk.</li>
<li>When installation is complete, set up Windows, or Shut Down.</li>
</ol>
<h2>Install Ubuntu / Lubuntu</h2>
<ol>
<li>Boot with the Linux installation USB or CD.</li>
<li>Select &#8216;Install Ubuntu to the local hard drive&#8217; option (or something similar)</li>
<li>At the <strong>Allocate Drive Space</strong> screen, choose <strong> Something Else</strong>.</li>
<li>Under <strong>/dev/sda</strong> click <strong>free space.</strong> (If you have more than one hard drive, choose the free space on the appropriate drive).</li>
<li>Click <strong>Add&#8230;</strong></li>
<li><strong>Type for new partition: <em>Logical</em></strong></li>
<li><strong>New Partition Size in Megabytes:</strong> Set this to the amount of RAM in your machine (e.g. 4096)</li>
<li><strong>Location for new partition: <em>End</em></strong></li>
<li><strong>Use As: <em>swap area </em></strong>and click <strong>OK.</strong></li>
<li>You should see the swap space appear in your drive list. Click <strong>free space</strong> again.</li>
<li>Click <strong>Add&#8230;</strong> again.</li>
<li><strong>New Partition: <em>Logical</em></strong></li>
<li><strong>New partition size in megabytes: </strong>it should default to the maximum space available. If not click the up arrow until the number no longer changes.</li>
<li><strong>Location for new partition: <em>End</em></strong></li>
<li><strong>Use As: </strong>Pick <strong>Ext4</strong> if you work with huge files or need extra fast performance.  Choose <strong>Ext3</strong> if you want to access the linux file system from OSX (and possibly Windows with the right tools).</li>
<li><strong>Mount Point</strong>: Choose  the forward slash - <strong>/ </strong></li>
<li>Click <strong>OK</strong>.</li>
<li><strong>Device for boot loader installation:</strong> Choose the large linux partition that you just created (e.g. /dev/sda4).</li>
<li>Click <strong>Install Now</strong></li>
<li>Proceed through the Ubuntu installation</li>
<li>Shut down</li>
</ol>
<div>Here&#8217;s a <a title="Install Ubuntu" href="http://opensource-sidh.blogspot.com/2011/10/install-ubuntu-1110-and-windows-dual.html" target="_blank">nice guide with screenshots</a> for installing Ubuntu. Just remember to use the <em>end</em> of the drive.</div>
<h2>Install OSX Lion</h2>
<ol>
<li>Remove the Ubuntu installation media, and insert the OSX USB drive.</li>
<li>Boot the computer with the USB drive and enter the OSX Lion installer</li>
<li>Proceed through the installation process.  Be sure to select the LION drive as the target for installation.</li>
<li>When the installer ends, you will be at the Mac desktop.</li>
<li>Copy the <a title="MultiBeast" href="http://www.tonymacx86.com/viewforum.php?f=125" target="_blank">MultiBeast</a> file from your USB drive to the desktop (or download it if you have internet access)</li>
<li>Install and run MultiBeast.</li>
<li>Here is where things get tricky.  Everyone has different hardware, so there is no magic bullet.  I selected EasyBeast to get the absolute necessities, and then chose specific options for audio and ethernet.  Check<a title="Multibeast Option Guide" href="http://www.macbreaker.com/2012/01/how-to-use-multibeast-comprehensive.html" target="_blank"> this guide</a> for a great explaination of the MultiBeast options.</li>
<li>Reboot.</li>
</ol>
<h2>Win!</h2>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2012/03/triple-booting-my-pc-with-osx-lion-windows-7-and-lubuntu-12-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Making Of, &#8220;The Bogstras: The Video Game&#8221;</title>
		<link>http://ericterpstra.com/2012/01/the-making-of-the-bogstras-the-video-game/</link>
		<comments>http://ericterpstra.com/2012/01/the-making-of-the-bogstras-the-video-game/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 23:10:55 +0000</pubDate>
		<dc:creator>eterps</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://ericterpstra.com/?p=115</guid>
		<description><![CDATA[&#160; I recently put up a website featuring a Flash game I&#8217;ve been working on for a few months.  It is entitled, &#8220;The Bogstras: The Video Game&#8221; and features several of my family members as characters.  My reason for creating this game is twofold: First, I wanted to learn more about game development and needed <a href='http://ericterpstra.com/2012/01/the-making-of-the-bogstras-the-video-game/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><em><a title="The Bogstras" href="http://ericterpstra.com/2012/01/the-making-of-the-bogstras-the-video-game/bogstras/" rel="attachment wp-att-119" target="_blank"><img class="aligncenter size-full wp-image-119" title="Bogstras" src="http://ericterpstra.com/wp-content/uploads/2012/01/Bogstras.png" alt="" width="627" height="153" /></a></em></p>
<p>&nbsp;</p>
<p>I recently put up a <a title="The Bogstras" href="http://www.thebogstras.com" target="_blank">website</a> featuring a Flash game I&#8217;ve been working on for a few months.  It is entitled, &#8220;<a title="The Bogstras" href="http://www.thebogstras.com" target="_blank">The Bogstras: The Video Game</a>&#8221; and features several of my family members as characters.  My reason for creating this game is twofold: First, I wanted to learn more about game development and needed a hands-on project, and secondly, I needed a Christmas gift for my in-laws. The title was a no-brainer.  &#8220;Bogstra&#8221; is a portmanteau of &#8220;Terpstra&#8221; (my family name) and &#8220;Boger&#8221; (my wife&#8217;s family name).  After a few days of jotting down design concepts and cooking up a game plan, the journey had begun!</p>
<p>The object of the game is simple &#8211; pick a character, and complete a mission based around that character&#8217;s personal interests.  Complete each character&#8217;s mission and win the game!  It seemed like a simple enough idea when it popped into my head last September.  I set a goal to release the game the day before Christmas, and provide everyone featured in the game with a hard copy burned to a well-styled CD (with awesome cover art).  But alas, as with most software projects, &#8220;The Bogstras&#8221; fell victim to underestimated time requirements and the game was released in late January.  The good news is, my family didn&#8217;t mind too much.  They were still thrilled to see and play the game, and I managed to learn quite a bit about making games.</p>
<p><em>HOW</em></p>
<p>Choosing Flash and Actionscript 3 as a development platform was pretty much my only choice.  It&#8217;s the only language I&#8217;m comfortable with that is capable of building decent games.  Although even if I was an expert in C++ or XNA or whatever the hip new game platform might be, AS3 would still be the natural choice given the fact that the game is deployable via the web, and <a title="Flash Player Stats" href="http://www.adobe.com/products/flashplatformruntimes/statistics.html" target="_blank">everyone</a> has Flash Player installed.  I also happened to have a license of Flash Builder 4.6 available from my <a title="Mind Over Data" href="http://www.mind-over-data.com" target="_blank">workplace</a>.  And just so you know, a purchased license for Flash Builder allows for installation on 2 personal machines per user. Highly convenient.</p>
<p>With my base language and development tools already sitting in my lap, I went searching for a game framework to help me get started.  After reviewing <a title="PBE" href="http://pushbuttonengine.com/" target="_blank">many</a> <a title="Gaia" href="http://www.gaiaflashframework.com/" target="_blank">interesting</a>  <a title="as3isolib" href="http://code.google.com/p/as3isolib/" target="_blank">frameworks</a>, I finally narrowed it down to <a title="Flixel" href="http://flixel.org" target="_blank">Flixel</a> and <a title="Flashpunk" href="http://flashpunk.net" target="_blank">Flashpunk</a>.  I&#8217;m not entirely certain why, but I chose Flashpunk.  After perusing the <a title="Learn Flashpunk" href="http://flashpunk.net/learn/" target="_blank">tutorials</a>, and slapping together a couple prototype levels to test out the code myself, development was fully underway.  Flashpunk makes is super easy to get a simple game concept up and running very quickly, as it provides code for the game loop, containers (worlds), entities, collision detection, spritemaps, and so on&#8230;</p>
<p>My prototyped levels mainly consisted of little boxes moving around the screen shooting things and bumping into each other.  It quickly became clear that I would need some help with graphics.  I wanted the in-game characters to resemble the real-life people, so I decided to hire a pro for that. Nearly everything else was harvested from hundreds of Google searches.  Of course, no tile set or pixel art collection was ever perfect, so I had to do some pixel pushing myself.  I found an amazing free (shareware) tool called <a title="GraphicsGale" href="http://www.humanbalance.net/gale/us/" target="_blank">GraphicsGale</a>.  It&#8217;s sole purpose is pixel art and animation.  It made working with spritesheets, tilesets, and other pixel-perfect graphics a breeze.  I know I only scratched the surface of possible features, but what I did use was invaluable.  Although there were times where I needed to do some complex layering, or had to work with large jpeg images.  For that, <a title="Paint.net" href="http://www.getpaint.net/" target="_blank">Paint.NET</a> (also free) filled in all the gaps. With GraphicsGale and Paint.NET, I was never left wanting for any gfx editing features.</p>
<p>After smushing together some code and graphics, I was ready to start building levels.  Flashpunk has built in functionality to take advantage of grid-based tilesets, and there is a nice <a title="episode-3-using-tilemaps-and-grids" href="http://flashpunk.net/2011/05/episode-3-using-tilemaps-and-grids/" target="_blank">tutorial</a> on the Flashpunk website on how to implement this functionality.  However, there was also a nice <a title="Using Ogmo" href="http://flashpunk.net/2011/05/episode-4-setting-up-the-ogmo-editor-to-create-content/" target="_blank">tutorial</a> on how to take some severe shortcuts by using a tilemap generator &#8211; namely, <a title="Ogmo Editor" href="http://ogmoeditor.com" target="_blank">Ogmo Editor</a>. With this tool, it is a much simpler task to lay out repeating tiles and design levels from tilesets visually, rather than completely in code.  Ogmo exports the layout information in XML format, which is easily read and interpreted by Actionscript.  Using Ogmo was a tremendous time saver, and I highly recommend it for use with any 2d, tile-based flash game.</p>
<p>Since all of the background music was composed by <a title="Order of Tyr" href="http://videogamemetal.com" target="_blank">talented musicians</a> (not me), sound was pretty much an afterthought.  There were a few places were sound effects were necessary to enhance gameplay, and for that I turned to <a title="BFXR" href="http://bfxr.net" target="_blank">BFXR</a> by <a title="Increpare" href="http://www.increpare.com/" target="_blank">increpare</a>.  If you need a quick way to generate some bleeps, bloops, chimes, dings and zaps, then there is no better tool. Just keep clicking until you hear something you like, and save it as a .wav file.  The only hangup is that sounds must be in mp3 format to be embedded in a swf file, so <a title="Audacity" href="http://audacity.sourceforge.net/" target="_blank">Audacity</a>&#8216;s batch encoding feature was recruited for this task.  Incidentally, BFXR is a derivative project of <a title="SFXR" href="http://www.drpetter.se/project_sfxr.html" target="_blank">SFXR</a> by Dr. Petter, but adds quite a few new features, and comes in an installable Adobe AIR package.</p>
<p>A handful of other tools used in the project were subversion (svn) provided by <a title="project locker" href="http://projectlocker.com/" target="_blank">ProjectLocker</a>, <a title="Wordpress" href="http://wordpress.org" target="_blank">WordPress</a>, and good ol&#8217; pencil and paper.</p>
<p><em>WHO</em></p>
<p>Every great triumph has its cast of heroes.  The champions behind the aesthetic appeal of the Bogstras (which receives the lions share of praise) are true talents.  All nine of the characters, and their corresponding animations were hand drawn by Cecile Souza Santos, of Brazil.  I found her through the <a title="Pixel Joint Jobs" href="http://www.pixeljoint.com/forum/forum_topics.asp?FID=11" target="_blank">job postings</a> section in the <a title="PixelJoint" href="http://www.pixeljoint.com/" target="_blank">PixelJoint</a> forums.  Her past work was very impressive, and her 16-bit RPG style was exactly what I was looking for.  Needless to say, she was a good fit for this project.  She is still active in the <a title="Clest Portfolio PIxelJoint" href="http://www.pixeljoint.com/forum/forum_posts.asp?TID=10246&amp;KW=" target="_blank">PixelJoint forums</a>, and on <a title="Clest DeviantArt" href="http://clest.deviantart.com/" target="_blank">DeviantArt</a> with the handle Clest.</p>
<p>The music tracks were conceived and composed by Jordan B. Sanders &#8211; frontman for the <a title="Order of Tyr" href="http://videogamemetal.com" target="_blank">Order of Týr</a>.  Jordan is a co-worker of mine, and just happens to be an expert chiptune composer.  I&#8217;ve heard his music, both live and recorded, and knew that his work would be tip-top. And it was.</p>
<p>Last but not least are the countless individuals providing tips, tutorials, sample code, free images, and answered questions on the FlashPunk forums, StackOverflow, GitHub, and elsewhere on the internet.  If I were left solely with my own wits, this project never would have happened.  It is truly astonishing that I can shout a question out into the world, and no matter how technical or esoteric, I can be reasonably sure it will get answered.</p>
<p>Despite that the game was four weeks late, and has dozens of features left on the cutting room floor, I&#8217;m still pretty proud of it.  This was my first completed independent game project, and I think it turned out OK given the goals I began with.  I&#8217;m glad to have this done and behind me, but it also illuminated some interesting paths ahead.  There are definitely some game development concepts that need revisiting (A* pathfinding, pixel-perfect collision, Verlet integration, to name a few), and plenty of un-implemented ideas that could easily be retrofitted into a new game.  So enough jibba jabba, and back to work! (as soon as I catch that damn dog).</p>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2012/01/the-making-of-the-bogstras-the-video-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BourbonBasement.com</title>
		<link>http://ericterpstra.com/2012/01/bourbonbasement-com/</link>
		<comments>http://ericterpstra.com/2012/01/bourbonbasement-com/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 00:00:18 +0000</pubDate>
		<dc:creator>eterps</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://ericterpstra.com/?p=123</guid>
		<description><![CDATA[A few months ago, I received an email from a friend of mine quoting a Scotch Whisky review blog: &#8230;this Auchentoshan is our second sample courtesy of Saverio Schiralli Agencies Limited&#8230; followed by a heavily emphasis on courtesy, aka free Scotch.  Convinced that we would be showered with hand-selected bottles of Scotland&#8217;s finest, we decided <a href='http://ericterpstra.com/2012/01/bourbonbasement-com/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://ericterpstra.com/2012/01/bourbonbasement-com/bb/" rel="attachment wp-att-124"><img class="alignleft size-full wp-image-124" title="BourbonBasement.com" src="http://ericterpstra.com/wp-content/uploads/2012/02/bb.jpg" alt="" width="360" height="286" /></a>A few months ago, I received an email from a friend of mine quoting a Scotch Whisky review blog:</p>
<blockquote><p>&#8230;this Auchentoshan is our second sample courtesy of Saverio Schiralli Agencies Limited&#8230;</p></blockquote>
<p>followed by a heavily emphasis on <em>courtesy</em>, aka free Scotch.  Convinced that we would be showered with hand-selected bottles of Scotland&#8217;s finest, we decided to start a whiskey blog.  However, given the fact that I live in Tennessee, and my friends live in Chicago, it was eventually decided that I would blog about interesting bourbons and other American whiskeys, whilst the <a title="Dram of Scotch" href="http://www.dramofscotch.com" target="_blank">Scotch reviews</a> would come from the Windy City.  This made sense, as nearly every brand of bourbon under the sun is available in Memphis, while Scotch from small or unknown distilleries are impossible to come by around here.</p>
<p>Around April of 2011, I rolled up my sleeves, pulled the lowball glasses off the shelf, and got to work.  As soon as I had a shelf full of nearly full bourbon bottles and a scratchpad full of tasting notes, it was time to start the blog.  Once again, WordPress was my weapon of choice.  There&#8217;s no better way to get a nice looking blog online than with WordPress.  I found a  <a title="Sarah Neuber Design" href="http://www.sarah-neuber.de/">nice, flashy theme</a> while browsing SmashingMagazine, and did a little PHP-fu to fit it to my needs.  Although the theme was originally intended as a media portfolio, it works just as well for reviews.  I&#8217;m able to get four featured reviews, six recent reviews, and a blog post all above the fold without things feeling cluttered.  The slidey panel things are pretty snazzy, too.</p>
<p>What I learned the most from this project is that blogging is hard.  Technically, getting the site up and running was pretty straightforward.  Just a little bit of copy and paste to move some theme elements around, and a smattering of CSS did the trick.  The real effort came in writing the content.  I burst out of the gate with 4 or 5 solid entries and felt pretty confident.  I could almost taste the free bottles of whiskey.</p>
<p>After a couple weeks, though, I hit a wall.  It took ages to get another clever, original post out of my brain.   I kept at it, branching out from reviews to create a few general blog posts, and even a stop-motion-video to keep things fresh.  But as soon as <a title="The Bogstras" href="http://thebogstras.com" target="_blank">another project</a> popped up and took priority, things came to a grinding halt.  That, and I really don&#8217;t drink that much bourbon.  I enjoy a pinch or two on the weekend, but rarely imbibe on a weeknight.  With the lack of time and drinking, BourbonBasement entered into a blog purgatory.  It&#8217;s not quite dead, but not really alive either.  This is OK, though.  Whiskey itself ages slowly, and remains undisturbed for months at a time.  It refines itself as the months pass, and emerges years later with maturity and distinction.  In other words, there&#8217;s no rush.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2012/01/bourbonbasement-com/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Count the occurrences of an item in a List or Array</title>
		<link>http://ericterpstra.com/2010/11/count-the-occurrences-of-an-item-in-a-list-or-array/</link>
		<comments>http://ericterpstra.com/2010/11/count-the-occurrences-of-an-item-in-a-list-or-array/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 04:39:30 +0000</pubDate>
		<dc:creator>eterps</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[sourcecode]]></category>

		<guid isPermaLink="false">http://ericterpstra.com/?p=98</guid>
		<description><![CDATA[To view the flash content, please go to <a href="http://ericterpstra.com/2010/11/count-the-occurrences-of-an-item-in-a-list-or-array/">Count the occurrences of an item in a List or Array</a><br /><br />So I came across a situation where I had a whole bunch of items in a collection, and I needed to know how many of each kind there were.  In other words, I needed to know the number of each unique element in an IList, Array, ArrayCollection, or what-have-you.  I looked for some help online, <a href='http://ericterpstra.com/2010/11/count-the-occurrences-of-an-item-in-a-list-or-array/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[To view the flash content, please go to <a href="http://ericterpstra.com/2010/11/count-the-occurrences-of-an-item-in-a-list-or-array/">Count the occurrences of an item in a List or Array</a><br /><br /><p>So I came across a situation where I had a whole bunch of items in a collection, and I needed to know how many of each kind there were.  In other words, I needed to know the <em>number of each unique element</em> in an IList, Array, ArrayCollection, or what-have-you.  I looked for some help online, and fiddled around and got it working.  Then a few weeks later I had to do the same thing, and darn near forgot how I did this.  Here is the trick &#8211; SORT!</p>
<p>Sort the items in the array (alphabetically, numerically, chronologically, etc&#8230;) so that unique items are grouped together.  Then simply loop over the collection counting identical items, and when a new item occurs, make a note of how many you have of the first item, and start counting again.  Below is a quick example.  Click &#8220;Generate&#8221; to create a list of 50 items, where each item is going to be a fish, cat, dog or pony.  Then click &#8220;Count&#8221; to count the number of each one.  Also notice how the original list is now sorted so all the &#8216;dogs&#8217; and &#8216;cats&#8217; are together.</p>
<p>Here&#8217;s the meat of the code:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sortedList = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"><span style="color: #004993;">Array</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Sort Newlist Alphabetically</span><br />
newList<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">sort</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #3f5fbf;">/*&nbsp; Create an object to keep track of each unique item in the array. For example<br />
* &nbsp; { Name: 'cat'<br />
* &nbsp; &nbsp; Value: 7 &nbsp;}<br />
*/</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> countObject<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Create a var to store the previously examined item in the list.</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> previousItem<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Loop over all the items in the newArray</span><br />
<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span> <span style="color: #000000;">&#40;</span> <span style="color: #6699cc; font-weight: bold;">var</span> currentItem<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> <span style="color: #0033ff; font-weight: bold;">in</span> newList <span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
<span style="color: #009900; font-style: italic;">//If the current item in the list is different from the previous item, then create a new countObject and start counting the new item.</span><br />
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>previousItem == <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000066; font-weight: bold;">||</span> currentItem <span style="color: #000066; font-weight: bold;">!</span>= previousItem<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
<span style="color: #009900; font-style: italic;">//Create a new object</span><br />
countObject = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Set the name to the current item in the loop</span><br />
countObject<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span> = currentItem<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Count this item</span><br />
countObject<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">value</span> = <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Put the object in the sorted list so we can see it later</span><br />
sortedList<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>countObject<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">//Done. Set the current item to the previous item.</span><br />
previousItem = currentItem<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #0033ff; font-weight: bold;">else</span> &nbsp;<span style="color: #009900; font-style: italic;">//Otherwise, we haven't switched to a new item yet, so keep counting the current item.</span><br />
<span style="color: #000000;">&#123;</span><br />
<span style="color: #3f5fbf;">/*&nbsp; Find the last countObject in the sortedList, then add 1 to the value of that object.<br />
* &nbsp; For example, if we have looped over 3 cat items in a row, and the current item is also cat, then:<br />
* &nbsp; { Name: cat, Value: 3 + 1 }<br />
*/</span><br />
sortedList<span style="color: #000000;">&#91;</span>sortedList<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">value</span> <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>and <a href="http://ericterpstra.com/wp-content/uploads/CountUniqueElements/srcview/">Full Source</a> for the above example.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2010/11/count-the-occurrences-of-an-item-in-a-list-or-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Fountain Of Color &#8211; AS3 Animation Example from Foundation Actionscript Animation Book</title>
		<link>http://ericterpstra.com/2010/09/a-fountain-of-color-as3-animation-example-from-foundation-actionscript-animation-book/</link>
		<comments>http://ericterpstra.com/2010/09/a-fountain-of-color-as3-animation-example-from-foundation-actionscript-animation-book/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 22:10:38 +0000</pubDate>
		<dc:creator>eterps</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[sourcecode]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[If you are remotely interested in Actionscript, Flash, computer animation, games, or pretty stuff on computers &#8211; go get Kieth Peters&#8217; book, &#8220;Foundation Actionscript 3.0 Animation: Making Things Move.&#8221;  Then check out Keith Peters blog (but really his other sites).  After reading parts 1 and 2 of the book, which cover basic animation, I felt <a href='http://ericterpstra.com/2010/09/a-fountain-of-color-as3-animation-example-from-foundation-actionscript-animation-book/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-72" href="http://ericterpstra.com/2010/09/a-fountain-of-color-as3-animation-example-from-foundation-actionscript-animation-book/colorfountain-4/"><img class="alignleft size-medium wp-image-72" title="colorfountain" src="http://ericterpstra.com/wp-content/uploads/2010/09/colorfountain-170x300.jpg" alt="" width="170" height="300" /></a>If you are remotely interested in Actionscript, Flash, computer animation, games, or pretty stuff on computers &#8211; go get Kieth Peters&#8217; book, &#8220;Foundation Actionscript 3.0 Animation: Making Things Move.&#8221;  Then check out<br />
Keith Peters blog (but really his other sites).  After reading parts 1 and 2 of the book, which cover basic animation, I felt compelled to take one of the examples a bit further.</p>
<p>In Part 2: Basic Motion, the concepts of moving pixels programatically around the screen by shifting the x and y position every frame is introduced.  A &#8216;veloctiy&#8217; is assigned to both the x and y values to determine how many pixels the object moves per frame.  The fountain example in the book demonstrates these concepts by shooting a bunch of colored balls from the bottom of the screen, with slightly random values for the x and y velocity.</p>
<p>I added some controls, just for fun.  Use the up and down arrow keys to increase or decrease the height, and use left/right to change the direction.  Also, if you look at the code, I changed the concept of x and y velocities to <em>speed</em> and <em>angle.</em> So rather then setting a velocity value for the x and y values of each ball, I set a speed and angle, and use this information to update the balls&#8217; positions.  The original code remains in comments for reference.  Take a look.</p>
<p><strong><span style="font-size: 14px;"><a href="http://www.ericterpstra.com/wp-content/uploads/colorfountain/animation.html">FOUNTAIN DEMO</a> |  <a href="http://www.ericterpstra.com/wp-content/uploads/colorfountain/srcview/index.html">SOURCE CODE</a></span></strong></p>
<p><!--break--></p>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2010/09/a-fountain-of-color-as3-animation-example-from-foundation-actionscript-animation-book/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColorTransform Demo Application</title>
		<link>http://ericterpstra.com/2010/07/colortransform-demo-application/</link>
		<comments>http://ericterpstra.com/2010/07/colortransform-demo-application/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 20:33:10 +0000</pubDate>
		<dc:creator>ad</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[blogging]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[As a follow-up to my last post, I&#8217;m posting an app I made with Flex to demonstrate the effects of ColorTransform, both on a single colored object, and a Jpeg image.  Click the link below to start the app.  Once it shows up, use the color picker to choos a color.  This will change the <a href='http://ericterpstra.com/2010/07/colortransform-demo-application/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>As a follow-up to my last post, I&#8217;m posting an app I made with Flex to demonstrate the effects of ColorTransform, both on a single colored object, and a Jpeg image.  Click the link below to start the app.  Once it shows up, use the color picker to choos a color.  This will change the color of the large square displayed on the screen.  Slide the slider controls around to create a color transformation.  As the color transformation occurs, you will see the newly created color appear as a circle within the square.  The jpg image will also reflect the color transformation.</p>
<p><strong><span style="font-size: 16px;"><a href="http://www.ericterpstra.com/wp-content/uploads/colortransformdemo/ColorTransformDemo.html">COLORTRANSFORM DEMO</a> |  <a href="http://www.ericterpstra.com/wp-content/uploads/colortransformdemo/srcview/index.html">SOURCE CODE</a></span></strong></p>
<p><a href="http://www.ericterpstra.com/sites/default/files/colortransformdemo/ColorTransformDemo.html" target="_blank"><img style="width: 518px; height: 306px; margin: 5px;" src="/wp-content/uploads/ctdemo.jpg" alt="" /></a></p>
<p><!--more--></p>
<p><!--break--></p>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2010/07/colortransform-demo-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColorTransform in AS3 &#8211; What? How?</title>
		<link>http://ericterpstra.com/2010/06/colortransform-in-as3-what-how/</link>
		<comments>http://ericterpstra.com/2010/06/colortransform-in-as3-what-how/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 21:43:14 +0000</pubDate>
		<dc:creator>ad</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[sourcecode]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[ColorTransform is this mysterious class that had me baffled for quite a while.  You punch in a bunch of numbers, and somehow it is supposed to create one color from another.  But how?  How do the colors change? How do I get this thing to change the color of something on the screen when I <a href='http://ericterpstra.com/2010/06/colortransform-in-as3-what-how/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>ColorTransform is this mysterious class that had me baffled for quite a while.  You punch in a bunch of numbers, and somehow it is supposed to create one color from another.  But how?  How do the colors change? How do I get this thing to change the color of something on the screen when I want it to?  A fair bit of guesswork and luck was my answer.  Then I got learned up.  The Adobe LiveDocs got me started, but as for actually putting ColorTransform to good use in a real, live Flex project called for some additional know-how.</p>
<p>First, learn about colors on computers. You need to know what RGB stands for, and the difference between hexadecimal and decimal numbers.  Here&#8217;s a fun site called &#8220;<a href="http://www.tomjewett.com/colors/index.html">Color Tutorial</a>&#8221; (aptly named) to get you started.  And here&#8217;s a <a href="http://www.tizag.com/htmlT/htmlcolorcodes.php">nice little page</a> that demonstrates how RGB and hexadecimal numbers fit together.</p>
<p>Once you understand how colors are constructed from numbers, then understanding ColorTransform comes naturally.  All it does is jumble up the numbers with some simple math.  The math is explained in the AS3 documentation like this:</p>
<blockquote><p>When a ColorTransform object is applied to a display object, a new value for each color channel is calculated like this:</p></blockquote>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">New red <span style="color: #004993;">value</span> = <span style="color: #000000;">&#40;</span>old red <span style="color: #004993;">value</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #004993;">redMultiplier</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">redOffset</span><br />
New <span style="color: #004993;">alpha</span> <span style="color: #004993;">value</span> = <span style="color: #000000;">&#40;</span>old <span style="color: #004993;">alpha</span> <span style="color: #004993;">value</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #004993;">alphaMultiplier</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">alphaOffset</span><br />
New green <span style="color: #004993;">value</span> = <span style="color: #000000;">&#40;</span>old green <span style="color: #004993;">value</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #004993;">greenMultiplier</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">greenOffset</span><br />
New blue <span style="color: #004993;">value</span> = <span style="color: #000000;">&#40;</span>old blue <span style="color: #004993;">value</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #004993;">blueMultiplier</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #004993;">blueOffset</span></div></div>
<blockquote>
<div>If any of the color channel values is greater than 255 after the calculation, it is set to 255. If it is less than 0, it is set to 0.</div>
</blockquote>
<p>So there you have it.  A DisplayObject has some colors, and you can transform those colors by fiddling with the RGB values.  You can even transform the alpha channel (transparency).  But how do you know what colors you will end up with?  That was a head scratcher.  Unless you have color codes memorized and are quick with the arithmetic, it&#8217;s darn tough to get an exact idea.  Here are a few resources that explain ColorTransform, and show it in action:</p>
<ul>
<li> <a href="http://www.flashandmath.com/basic/colors/example2.html">ColorTransform in Flash CS3 and ActionScript 3</a>, from flashandmath.com</li>
<li> <a href="http://www.kelvinluck.com/2009/04/colortransform-explorer/">ColorTransform explorer</a> by Kelvin Luck</li>
<li> <a href="http://www.adobe.com/devnet/flex/samples/style_explorer.html">Adobe &#8211; Style Explorer</a></li>
</ul>
<p>There, lots of nice examples.  However, in order to really take advantage of colors and ColorTransform, you should really know how to manipulate color values on your own.  In the flashandmath page, you may have notices a line like this:</p>
<pre>RGB=(red&lt;&lt;16) | (green&lt;&lt;8) | blue;</pre>
<p>What?  Yeah, this is an example of a bitwise shift operation.  Double what?  Well, follow the <a href="http://www.moock.org/asdg/technotes/bitwise">link </a>from flashandmath to get a brief rundown.  The gist of it is, the little carrots &gt;&gt; help separate the R, G and B values from a color value, or put separate R, G, and B values back together as a single color with the &lt;&lt; symbol.  The nitty gritty is still a little fuzzy, but you don&#8217;t need to understand all the nuts and bolts to use the tool.</p>
<p>Of course, I haven&#8217;t mentioned HSV as an alternative to RGB.  But these resources are just the tip of the iceberg when it comes to color manipulation.  Check out these sites for extra credit if you are feeling ambitious:</p>
<ul>
<li> <a href="http://www.graficaobscura.com/matrix/index.html">Matrix Operations for Image Processing</a></li>
<li> <a href="http://beesbuzz.biz/code/hsv_color_transforms.php">HSV Color Transforms</a></li>
<li> <a href="http://www.quasimondo.com/archives/000565.php">Quasimondo ColorMatrix</a></li>
</ul>
<p>Enjoy!</p>
<p><!--break--></p>
]]></content:encoded>
			<wfw:commentRss>http://ericterpstra.com/2010/06/colortransform-in-as3-what-how/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

