<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>AaronHardy.com &#187; General Programming</title>
	<atom:link href="http://aaronhardy.com/category/general-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://aaronhardy.com</link>
	<description>For all your Aaron Hardy needs.</description>
	<lastBuildDate>Fri, 20 Apr 2012 14:53:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Studio J Online Scrapbooking</title>
		<link>http://aaronhardy.com/flex/studio-j-online-scrapbooking/</link>
		<comments>http://aaronhardy.com/flex/studio-j-online-scrapbooking/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 19:42:21 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[crafts]]></category>
		<category><![CDATA[digital]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[scrapbooking]]></category>
		<category><![CDATA[Studio J]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=851</guid>
		<description><![CDATA[Scrapbooking just went from crafty women huddled around piles of paper shreds to online digital awesomeness. Not that crafty women or piles of paper shreds aren&#8217;t awesome. Nay. But for many, this translates into finding babysitters or a willing spouse; finding large blocks of time; purchasing a gajillion expensive scissors, stamps, buttons, papers, and ribbons; [...]]]></description>
			<content:encoded><![CDATA[<p>Scrapbooking just went from crafty women huddled around piles of paper shreds to online digital awesomeness.  Not that crafty women or piles of paper shreds aren&#8217;t awesome.  Nay.  But for many, this translates into finding babysitters or a willing spouse; finding large blocks of time; purchasing a gajillion expensive scissors, stamps, buttons, papers, and ribbons; finding storage for such paraphernalia; and discovering craftiness from within.  I mean, seriously, does <a href="http://3.bp.blogspot.com/_Q1ewFxNaFHQ/SoDb83g9mnI/AAAAAAAAAbk/hjn-6J4BGaM/s1600-h/IMG_7885.JPG" target="_blank">this</a> or <a href="http://www.craftster.org/pictures/data/500/medium/126488_Messy_Room2.jpg" target="_blank">this</a> look fun to clean up?  I&#8217;ll pass.</p>
<p>For the last year and a half at <a href="http://mediarain.com" target="_blank">Rain</a> I&#8217;ve been working on <a href="http://studioj.com/" target="_blank">Studio J</a>, <a href="http://closetomyheart.com/" target="_blank">Close To My Heart</a>&#8216;s flagship online scrapbooking application.  It&#8217;s been quite a ride but the result is really quite revolutionary.<span id="more-851"></span></p>
<p>Here&#8217;s how it works.  Hop onto <a href="http://studioj.com/" target="_blank">Studio J</a>.  You don&#8217;t even need an account.  You can log in anonymously on the left side of the <a href="https://create.studioj.com/login" target="_blank">login page</a>.  Once the application opens, create a project.  Upload some photos.  Choose the kit (set of papers) you would like to use.  Choose the pattern (orientation of papers).  Choose from a few pre-designed mixes that will get you started out with a great-looking scrapbook spread.  Now drop in photos, brads, clasps, ribbons, and stickers.  Distress or swap papers at will.  Add some text.  The amount of customization possible for each of these elements really is amazing and Close To My Heart did their best to make it a powerful experience.  Once your spread is complete, you can order a copy that will be printed using CTMH&#8217;s super-high-quality printing process and materials and it will be shipped to your door.</p>
<p>I know it may sound like a sales pitch, but I really do think is a fantastic application of technology and CTMH put a lot of focus on giving customers what they want.  It was really fun to work on an app that gives users so much control.  To read a very fair review of Studio J, check out <a href="http://www.craftcritique.com/2010/09/scrapbooking-with-studio-j-by-close-to.html" target="_blank">this article by Craft Critique</a>.</p>
<h3>The Juicy Details</h3>
<p>You know how much I just loooove to talk about scrapbooking.  But oh how I love to talk tech so much more.  Here are some interesting tech aspects of Studio J particularly related to the frontend since that&#8217;s the portion with which I&#8217;m most acquainted:</p>
<p>For the most part, StudioJ is developed in Flex for the frontend and PHP on the backend.  The backend and assets are hosted on Amazon&#8217;s cloud infrastructure.  This provided some unique challenges but resulted in big scalability benefits.  For speed, some assets like user photos are uploaded directly to the cloud which requires an <a href="http://developer.amazonwebservices.com/connect/entry!default.jspa?categoryID=114&#038;externalID=1092">ActionScript Amazon API adapter</a> and a little trickery for integration with the rest of the backend.</p>
<p>To store a user&#8217;s spread data to be later edited and printed, we utilize SVG.  Every element on the spread in ActionScript has a counterpart element in an SVG document.  This translation and all the rotating, scaling, panning, colorizing, and other editing tools are provided by our in-house <a href="http://aaronhardy.com/flex/rain-svg/" target="_blank">Rain SVG</a> library.  This to me is the most powerful and distinctive part of the app.</p>
<p>To improve the user experience, we developed a queuing and caching system.  It allows us to cache assets (re-use the same bitmap data in multiple parts of the app and avoid Flex image item renderer flickering issues), prioritize HTTP requests (make sure whatever the user is viewing gets top priority), and even trigger timeouts and/or retry requests.  <a href="http://aaronhardy.com/flex/queue-n-cache/" target="_blank">I talked in-depth about this system at the 360|Flex conference</a> and Adobe is adding a similar system to the new <a href="http://opensource.adobe.com/wiki/display/flexsdk/Spark+Image" target="_blank">Spark image component</a> in Flex 4.5.</p>
<p>The new <a href="http://labs.adobe.com/technologies/textlayout/" target="_blank">Text Layout Framework</a> was used in providing text editing functionality on user spreads.  This <a href="http://forums.adobe.com/message/2793180" target="_blank">got a little tricky</a> when loading fonts at runtime.  It got even trickier when consolidating the undo history for multiple text flows into the spread&#8217;s overall undo/redo system.  Then we integrated custom support for <a href="http://aaronhardy.com/flex/size-text-to-container/" target="_blank">sizing text to a container</a>.</p>
<p>We used modules to reduce some of the initial app size and provide some domain logic distinction. We added image editing tools so you don&#8217;t have to drop into Photoshop to make some simple tweaks to your photos.  And the list goes on.</p>
<p>In the end, it&#8217;s an ambitious application and I&#8217;m glad I could contribute.  We have a lot of ideas for additional features and improvements and wish the best for its success.  Now <a href="http://create.studioj.com/" target="_blank">go try it out</a> and let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/studio-j-online-scrapbooking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaUtils: Detecting and Installing Java from AIR</title>
		<link>http://aaronhardy.com/flex/javautils-detecting-and-installing-java-from-air/</link>
		<comments>http://aaronhardy.com/flex/javautils-detecting-and-installing-java-from-air/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 05:27:17 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[java runtime environment]]></category>
		<category><![CDATA[JRE]]></category>
		<category><![CDATA[native process]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=706</guid>
		<description><![CDATA[Adobe AIR is a great way to bring the sexiness of Flash to the desktop. However, sometimes you need more low-level power for things like connecting to peripherals. For this reason, AIR applications are sometimes paired with Java applications to accomplish such tasks. But first, the user&#8217;s system must have an adequate Java Runtime Environment [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe AIR is a great way to bring the sexiness of Flash to the desktop.  However, sometimes you need more low-level power for things like connecting to peripherals.  For this reason, AIR applications are sometimes paired with Java applications to accomplish such tasks.  But first, the user&#8217;s system must have an adequate Java Runtime Environment (JRE) installed in order for the Java application to run in the first place.<span id="more-706"></span></p>
<p>Before we get too far, be aware that these JavaUtils are currently for Windows only.  Macs have their own version of the JRE that&#8217;s deployed through the Software Update feature so the process of detecting and installing the JRE is very different and is left for another day.</p>
<h3>The Short Story</h3>
<p>To get started with the utilities, first download the source by <a href="http://github.com/Aaronius/JavaUtils" target="_blank">checking out the git repository</a> or <a href="http://aaronhardy.com/samples/javautils/JavaUtils.exe">installing the sample application</a>.  If you choose to install the sample application, run the app and right-click on the stage to view the source.</p>
<p>The utilities include two executables: </p>
<ol>
<li>whereis.exe &#8211; This is used internally by the tools.  See the juicy details below if you care to learn more about this.</li>
<li>jre-blah-blah-blah.exe &#8211; This is the Windows JRE online installer found here: <a href="http://www.java.com/en/download/manual.jsp" target="_blank">http://www.java.com/en/download/manual.jsp</a>.  This is the installer that is used to install a JRE of your choice if the user&#8217;s system does not have an adequate JRE already installed.  Because it&#8217;s the &#8220;online&#8221; installer, it&#8217;s lightweight and lets you avoid bundling an entire JRE with your AIR app.</li>
</ol>
<p>There are two main utility classes:</p>
<ol>
<li>JavaValidationUtil &#8211; This is used to determine if the user has an adequate JRE installed.  Call validate() and it will dispatch an event letting you know if the user has a JRE installed and if the version is sufficient.</li>
<li>JavaInstallUtil &#8211; This is used to install the JRE if needed.  Call install() and it will dispatch an event letting you know when the installation is complete.
</ol>
<h3>The Juicy Details</h3>
<p>Let&#8217;s dig into the details of how this works.  Support for running other executables as described below comes from the new <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeProcess.html" target="_blank">NativeProcess</a> in AIR 2.0. </p>
<p><strong>Validation.</strong>  The first chore is to validate whether the user has a JRE installed and, if so, whether the JRE is sufficient for the application&#8217;s needs.  The developer provides the validation utility with a minimum acceptable version broken into four segments: major, minor, revision, and update.</p>
<p>Now we need to find the version of the installed JRE to compare.  But first we need to find out where the JRE is installed if one exists.  On Windows there&#8217;s an environment variable called PATH which contains several directories that should be searched to find an application when a command is executed in the command shell.  When you open up cmd, for example, you can type &#8220;notepad&#8221; and hit enter.  The fact that it&#8217;s able to open notepad isn&#8217;t magic.  Windows simply searches the PATH directories for notepad.exe and then executes it.</p>
<p>We need to do the same thing to find the java executable (java.exe).  On *nix operating systems this is pretty easy.  There&#8217;s a simple tool called whereis that comes with the operating system that searches the paths to find a given executable.  On Windows, not so much.  Luckily, our friends over at <a href="http://www.synesis.com.au/systools.html" target="_blank">Synesis</a> have released a similar tool for Windows that allows us to do the same thing.  We bundle whereis.exe with our AIR application.</p>
<p>We execute whereis.exe, passing in name of the executable we&#8217;d like to find (java.exe) as an argument.  If we don&#8217;t find java.exe, the user doesn&#8217;t have a JRE installed&#8211;at least not in the PATH paths.  And if a JRE does exist that&#8217;s not in those paths it could take a long time to find and we probably don&#8217;t want to mess with it anyway.  If java.exe is found, we then execute it passing in the -version argument.  Java will then output the version in a <a href="http://java.sun.com/j2se/versioning_naming.html" target="_blank">specified format</a> that we can then parse.  After we parse the version, we compare with the minimum acceptable version and dispatch appropriate events.</p>
<p><strong>Installation.</strong>  If no JRE is installed or the one installed isn&#8217;t adequate, the application would then generally notify the user they need a newer JRE and ask if they&#8217;d like to proceed with the installation.</p>
<p>If the user chooses to proceed, it&#8217;s time to execute the installer.  But there&#8217;s a catch.  In Windows, installer applications require &#8220;elevated privileges&#8221; before executing which means Windows nags the user asking for permission to install the JRE.  If I were to double-click the installer when it was on the desktop, it would appropriately nag.  However, if I execute the installer using AIR&#8217;s NativeProcess, nothing happens.  No error, no output, no nagging, no installing, nothing.  Is this a bug in AIR?  Eight ball says signs point to yes, but who knows, maybe Windows is to blame.</p>
<p>In my search for a workaround I found that by executing the installer from the command shell, Windows again appropriately nagged.  So then I tried executing cmd from AIR and having cmd execute the JRE installer by passing the path of the installer into cmd as an argument.  What do you know&#8211;Windows nagged appropriately and off goes the installation as planned.  When <a href="http://forums.adobe.com/thread/661442" target="_blank">presenting this problem on the Adobe AIR forums</a>, not receiving a response, then proposing the workaround, a member of the AIR engineering team seemed to think it was a good trick&#8211;nay, a great trick&#8211;so I guess that&#8217;s just the way we have to do things for now.</p>
<p>So first we use our trusty whereis.exe to find the location to cmd.exe.  Then we use cmd.exe to execute our Java installer by passing the installer path into cmd as an argument.  Windows prompts the user for permission and after permission is granted the installation proceeds as expected.  After the installation is complete, we dispatch an appropriate event.  Of course we also stay aware of fringe cases (like if the user cancels the installation) and likewise dispatch appropriate events.</p>
<p>Hopefully that&#8217;ll give you some good direction as you start your journey pairing your AIR app with Java.  Now go make something freaking fetching awesome.</p>
<div class="goodies"><a href="/samples/javautils/JavaUtils.exe">View Demo</a><a href="http://github.com/Aaronius/JavaUtils" target="_blank">Fork Project</a><br class="break"></div>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/javautils-detecting-and-installing-java-from-air/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RedLiteGreenLite</title>
		<link>http://aaronhardy.com/flex/redlitegreenlite/</link>
		<comments>http://aaronhardy.com/flex/redlitegreenlite/#comments</comments>
		<pubDate>Sun, 30 May 2010 21:44:42 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[amf]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[Google Apps Engine]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[messaging]]></category>
		<category><![CDATA[polling]]></category>
		<category><![CDATA[remoting]]></category>
		<category><![CDATA[RobotLegs]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=658</guid>
		<description><![CDATA[Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed. What is it? RedLiteGreenLite is a small, simple app that allows a group of people to communicate the status of something. The status can be either red or green and [...]]]></description>
			<content:encoded><![CDATA[<p><div id="flashcontent1304" style="width:215px; height:180px;"><strong>Please upgrade your Flash Player</strong> This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.</div><script type="text/javascript">
<!-- // <![CDATA[
var so = new SWFObject("http://aaronhardy.com/wp-content/plugins/air-badge/AIRInstallBadge.swf", "Badge", "215", "180", "9.0.115", "#343434");
so.useExpressInstall("http://aaronhardy.com/wp-content/plugins/air-badge/expressinstall.swf");
so.addVariable("airversion", "1.0");
so.addVariable("appname", "RedLiteGreenLite");
so.addVariable("appurl", "http://aaronhardy.com/rlgl/RedLiteGreenLite.air");
so.addVariable("appid", "RedLiteGreenLite");
so.addVariable("pubid", "");
so.addVariable("appversion", ".5");
so.addVariable("imageurl", "/rlgl/rlglinstallbadge.jpg");
so.addVariable("appinstallarg", "installed from web");
so.addVariable("applauncharg", "launched from web");
so.addVariable("helpurl", "help.html");
so.addVariable("hidehelp", "true");
so.addVariable("skiptransition", "false");
so.addVariable("titlecolor", "#00AAFF");
so.addVariable("buttonlabelcolor", "#00AAFF");
so.addVariable("appnamecolor", "#00AAFF");
so.addVariable("str_err_airswf", "<u>Running locally?</u><br/><br/>The AIR proxy swf won't load properly when this is run from the local file system.");
so.write("flashcontent1304");
// ]]&gt; -->
</script>
</p>
<h3>What is it?</h3>
<p>RedLiteGreenLite is a small, simple app that allows a group of people to communicate the status of something.  The status can be either red or green and the subject can be whatever.  That may sound a bit general, but that&#8217;s the point.  It can be used for whatever purpose your crazy mind can come up with.  I&#8217;ll get you started:</p>
<ol>
<li>At work, we have a single shower and a lot of shweaty guys after soccer.  So we know when the shower&#8217;s available, someone can turn the status red when he enters the shower and turn it green when he exits.  This way nobody has to keep stopping by the shower to see if it&#8217;s available.  When it&#8217;s green, it&#8217;s available.   When it&#8217;s red, it&#8217;s not.</li>
<li>At a call center, representatives are split into groups. When one group is on break, no other group is allowed to go on break.  Again, when the status is red, a group is on break and other groups must continue attending the phones.  When the lite is green, the next group is free to take a break.</li>
</ol>
<p>The process is pretty simple: join a group.  Other people join the same group.  When others in the group change the status, you&#8217;ll be notified.  When you change the status, others in the group will be notified.  The status of the group will be persisted across sessions.  In other words, if everyone logs out and then logs back in a week later, the status will remain as it was the last time it was set.<span id="more-658"></span></p>
<p>There&#8217;s no need to explicitly create a group.  When you attempt to join a group, the group will automatically be created if it does not already exist.</p>
<p>The app is free.  As in free free.</p>
<h3>What technologies are used?</h3>
<p>RedLiteGreenLite has a client portion and a server portion.</p>
<p>The client is the app users download and install on their computers.  It&#8217;s built in <a href="http://www.adobe.com/products/flex/" target="_blank">Flex</a> and published for <a href="http://www.adobe.com/products/air/" target="_blank">AIR</a>.  It uses the <a href="http://www.robotlegs.org/" target="_blank">RobotLegs</a> MVCS framework and makes use of <a href="http://en.wikipedia.org/wiki/Action_Message_Format" target="_blank">AMF</a> remoting and messaging.</p>
<p>The server portion is built in <a href="http://www.java.com/en/" target="_blank">Java</a> using <a href="http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/" target="_blank">BlazeDS</a> and is hosted on <a href="http://code.google.com/appengine/" target="_blank">Google Apps Engine</a>.</p>
<h3>Ooh, that&#8217;s simply juicy.  Tell me more.</h3>
<p>Don&#8217;t mind if I do.  First of all, BlazeDS is an open source implementation of AMF-based remoting and messaging.  Natively it&#8217;s not compatible with Google Apps Engine, but I wanted to use GAE because it&#8217;s extremely scalable, it&#8217;s free (let&#8217;s be honest&#8211;I&#8217;m cheap like that&#8211;this is the main reason), and I wanted the challenge.</p>
<p>To get BlazeDS working on GAE, I recommend following <a href="http://martinzoldano.blogspot.com/2009/04/appengine-adobe-blazeds-fix.html" target="_blank">Martin Zoldano&#8217;s blog post</a>.  Not only does he outline the steps you&#8217;ll need to take but he provides a critical patch to flex-messaging-core.jar as well.  While you can find this patch re-distributed elsewhere, I recommend posting a comment requesting that he email you the patched jar.  That&#8217;s how he seems to want to distribute his patch and I respect that.  He&#8217;s really helpful and quick to respond so it shouldn&#8217;t be much trouble.</p>
<p>Once BlazeDS was set up and configured, I started to plan the architecture.  First of all, I needed one client in the group to be able to send a message to the rest of the clients in the group.  This could be achieved through the messaging service BlazeDS provides.  However, messaging doesn&#8217;t store state; it just redistributes messages to clients.  I needed the group&#8217;s status to be persisted to storage so (1) when a new client joins a group it can retrieve the group&#8217;s current status and (2) the group&#8217;s status can be retained even when no clients are connected.</p>
<p>By default, BlazeDS&#8217;s messaging configuration uses ActionScriptAdapter to receive and distribute messages between clients.  It doesn&#8217;t persist messages.  To do so, I extend ActionScriptAdapter and persist the status to Google Storage before sending the message out to the other clients.  When clients connect to BlazeDS, they use remoting (not messaging) to retrieve the most recently persisted status for the group.  After the initial status is retrieved, the client talks to other clients using the messaging service.  You can see how this is set up in messaging-config.xml and PersistentASAdapter.java in the <a href="http://github.com/Aaronius/RedLiteGreenLite" target="_blank">server code</a>.</p>
<p>While GAE has been really nice to get the app up and running, it does have its downsides.  To send messages between clients, BlazeDS can use a few different techniques:</p>
<ul>
<li>Simple polling. The client, at a standard interval, simply asks the server if there is any new information.  The server responds to the request immediately regardless of whether there is new information.</li>
<li>Long polling. The client sends a request to the server.  The server holds onto the request until it has something useful to tell the client at which time it sends back the response.</li>
<li>Streaming.  The client opens an HTTP connection and the connection remains open.  The server shoots messages down the connection whenever it has something to say.  It&#8217;s an &#8220;infinate response&#8221;.</li>
</ul>
<p>While <a href="http://www.dcooper.org/blog/client/index.cfm?mode=entry&#038;entry=8E1439AD-4E22-1671-58710DD528E9C2E7" target="_blank">each approach has its pros and cons</a>, simple polling leaves a lot to be desired as it creates a lot of HTTP traffic.  Unfortunately, from my testing and research, GAE doesn&#8217;t seem to support either of the other two methods.  But hey, it&#8217;s free.  If any of you have a java environment and would like to host RedLiteGreenLite so we can step up our game, let me know.</p>
<p>Last but not least, RedLiteGreenLite is open source.  I&#8217;d love for you to <a href="http://github.com/Aaronius/RedLiteGreenLite" target="_blank">fork the project</a> and do something cool with it.</p>
<p>Now go have fun!  Install the client using the badge at the top of the post or fork the project using the link below.</p>
<div class="goodies"><a href="http://github.com/Aaronius/RedLiteGreenLite" target="_blank">Fork Project</a><br class="break"></div>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/redlitegreenlite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding nodes with a namespaced attribute using e4x</title>
		<link>http://aaronhardy.com/flex/finding-nodes-with-a-namespaced-attribute-using-e4x/</link>
		<comments>http://aaronhardy.com/flex/finding-nodes-with-a-namespaced-attribute-using-e4x/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 04:05:24 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[e4x namespace attribute hasOwnProperty XML]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=395</guid>
		<description><![CDATA[When digging through XML, e4x is definitely your friend but it can be tricky sometimes. I recently came across a situation where I needed to find all nodes with a certain namespaced attribute. I didn&#8217;t care what the attribute&#8217;s value was; I just needed to know which nodes had the attribute. Take the following XML: [...]]]></description>
			<content:encoded><![CDATA[<p>When digging through XML, e4x is definitely your friend but it can be tricky sometimes.  I recently came across a situation where I needed to find all nodes with a certain namespaced attribute.  I didn&#8217;t care what the attribute&#8217;s value was; I just needed to know which nodes had the attribute.<span id="more-395"></span></p>
<p>Take the following XML:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;catalog</span> <span style="color: #000066;">xmlns:ah</span>=<span style="color: #ff0000;">&quot;http://aaronhardy.com/music&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Empire Burlesque<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artist</span> <span style="color: #000066;">ah:verified</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Bob Dylan<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>USA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Columbia<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>10.90<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1985<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Hide your heart<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Bonnie Tyler<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>UK<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CBS Records<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>9.90<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1988<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">ah:verified</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Greatest Hits<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Dolly Parton<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>USA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RCA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>9.90<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1982<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cd</span> <span style="color: #000066;">ah:verified</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">ah:verified</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Still got the blues<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Gary Moore<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>UK<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Virgin records<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>10.20<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1990<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Eros<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Eros Ramazzotti<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;country</span> <span style="color: #000066;">ah:verified</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>EU<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>BMG<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>9.90<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1997<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/catalog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In this case I&#8217;m trying to find all nodes that have a &#8220;verified&#8221; attribute.  Again, I don&#8217;t care if the attribute&#8217;s value is true or false.  If the attribute weren&#8217;t in the &#8220;ah&#8221; namespace I would use this line of code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> nodes:XMLList = myXML..<span style="color: #66cc66;">*</span>.<span style="color: #66cc66;">&#40;</span>hasOwnProperty<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'@verified'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>However, since the attribute is in the &#8220;ah&#8221; namespace, the query takes this form:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;cc()&quot;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			protected <span style="color: #000000; font-weight: bold;">function</span> cc<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> myXML:<span style="color: #0066CC;">XML</span> = 
					<span style="color: #66cc66;">&lt;</span>catalog xmlns:ah=<span style="color: #ff0000;">&quot;http://aaronhardy.com/music&quot;</span><span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;</span>cd<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>title<span style="color: #66cc66;">&gt;</span>Empire Burlesque<span style="color: #66cc66;">&lt;/</span>title<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>artist ah:verified=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span>Bob Dylan<span style="color: #66cc66;">&lt;/</span>artist<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>country<span style="color: #66cc66;">&gt;</span>USA<span style="color: #66cc66;">&lt;/</span>country<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>company<span style="color: #66cc66;">&gt;</span>Columbia<span style="color: #66cc66;">&lt;/</span>company<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>price<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">10.90</span><span style="color: #66cc66;">&lt;/</span>price<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>year<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">1985</span><span style="color: #66cc66;">&lt;/</span>year<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;/</span>cd<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;</span>cd<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>title<span style="color: #66cc66;">&gt;</span>Hide your heart<span style="color: #66cc66;">&lt;/</span>title<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>artist<span style="color: #66cc66;">&gt;</span>Bonnie Tyler<span style="color: #66cc66;">&lt;/</span>artist<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>country<span style="color: #66cc66;">&gt;</span>UK<span style="color: #66cc66;">&lt;/</span>country<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>company<span style="color: #66cc66;">&gt;</span>CBS Records<span style="color: #66cc66;">&lt;/</span>company<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>price<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">9.90</span><span style="color: #66cc66;">&lt;/</span>price<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>year<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">1988</span><span style="color: #66cc66;">&lt;/</span>year<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;/</span>cd<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;</span>cd<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>title ah:verified=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span>Greatest Hits<span style="color: #66cc66;">&lt;/</span>title<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>artist<span style="color: #66cc66;">&gt;</span>Dolly Parton<span style="color: #66cc66;">&lt;/</span>artist<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>country<span style="color: #66cc66;">&gt;</span>USA<span style="color: #66cc66;">&lt;/</span>country<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>company<span style="color: #66cc66;">&gt;</span>RCA<span style="color: #66cc66;">&lt;/</span>company<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>price<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">9.90</span><span style="color: #66cc66;">&lt;/</span>price<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>year<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">1982</span><span style="color: #66cc66;">&lt;/</span>year<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;/</span>cd<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;</span>cd ah:verified=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>title ah:verified=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span>Still got the blues<span style="color: #66cc66;">&lt;/</span>title<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>artist<span style="color: #66cc66;">&gt;</span>Gary Moore<span style="color: #66cc66;">&lt;/</span>artist<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>country<span style="color: #66cc66;">&gt;</span>UK<span style="color: #66cc66;">&lt;/</span>country<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>company<span style="color: #66cc66;">&gt;</span>Virgin records<span style="color: #66cc66;">&lt;/</span>company<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>price<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">10.20</span><span style="color: #66cc66;">&lt;/</span>price<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>year<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">1990</span><span style="color: #66cc66;">&lt;/</span>year<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;/</span>cd<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;</span>cd<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>title<span style="color: #66cc66;">&gt;</span>Eros<span style="color: #66cc66;">&lt;/</span>title<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>artist<span style="color: #66cc66;">&gt;</span>Eros Ramazzotti<span style="color: #66cc66;">&lt;/</span>artist<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>country ah:verified=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span>EU<span style="color: #66cc66;">&lt;/</span>country<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>company<span style="color: #66cc66;">&gt;</span>BMG<span style="color: #66cc66;">&lt;/</span>company<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>price<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">9.90</span><span style="color: #66cc66;">&lt;/</span>price<span style="color: #66cc66;">&gt;</span>
							<span style="color: #66cc66;">&lt;</span>year<span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">1997</span><span style="color: #66cc66;">&lt;/</span>year<span style="color: #66cc66;">&gt;</span>
						<span style="color: #66cc66;">&lt;/</span>cd<span style="color: #66cc66;">&gt;</span>
					<span style="color: #66cc66;">&lt;/</span>catalog<span style="color: #66cc66;">&gt;</span>;
&nbsp;
				<span style="color: #000000; font-weight: bold;">var</span> ns_ah:Namespace = <span style="color: #000000; font-weight: bold;">new</span> Namespace<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'http://aaronhardy.com/music'</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #000000; font-weight: bold;">var</span> verified:QName = <span style="color: #000000; font-weight: bold;">new</span> QName<span style="color: #66cc66;">&#40;</span>ns_ah, <span style="color: #ff0000;">'@verified'</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #000000; font-weight: bold;">var</span> nodes:XMLList = myXML..<span style="color: #66cc66;">*</span>.<span style="color: #66cc66;">&#40;</span>hasOwnProperty<span style="color: #66cc66;">&#40;</span>verified<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>nodes.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>Hope that helps someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/finding-nodes-with-a-namespaced-attribute-using-e4x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Piano Marvel: Interactive Piano Lessons</title>
		<link>http://aaronhardy.com/flex/piano-marvel-interactive-piano-lessons/</link>
		<comments>http://aaronhardy.com/flex/piano-marvel-interactive-piano-lessons/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 03:48:23 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[adobe max award]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[merapi]]></category>
		<category><![CDATA[musicXML]]></category>
		<category><![CDATA[piano lessons]]></category>
		<category><![CDATA[piano marvel]]></category>
		<category><![CDATA[pianomarvel]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=341</guid>
		<description><![CDATA[Rain, where I work, has released yet another super-duper app. It&#8217;s called Piano Marvel and it&#8217;s set to revolutionize how people learn how to play the piano. I&#8217;m not a piano player myself, but I do remember taking private piano lessons as a kid. I hated it. It was monotonous, inconvenient, and felt like a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mediarain.com" target="_blank">Rain</a>, where I work, has released yet another super-duper app.  It&#8217;s called <a href="http://pianomarvel.com" target="_blank">Piano Marvel</a> and it&#8217;s set to revolutionize how people learn how to play the piano.  I&#8217;m not a piano player myself, but I do remember taking <a href="http://takelessons.com/category/piano-lessons" target="_blank">private piano lessons</a> as a kid.  I hated it.  It was monotonous, inconvenient, and felt like a chore.  I wasn&#8217;t intrigued and I don&#8217;t believe I was the only kid that felt this way.</p>
<p>A while back, <a href="http://hub.guitarhero.com/" target="_blank">Guitar Hero</a> hit the gaming industry by storm and <a href="http://www.youtube.com/watch?v=-XjaImfQK6U" target="_blank">kids flocked to learning the guitar</a>.  Sure, it wasn&#8217;t a real guitar, but it was still an instrument of sorts and kids were still learning hand-eye-ear coordination, rhythm, and other music essentials.  The game was a huge success, bringing in over $1 billion in sales in the first 26 months and set an industry record.</p>
<p>Why such a difference in my experience learning how to play the piano years ago and kids learning the pseudo-guitar with Guitar Hero?  Guitar Hero provides objectivity, benchmarking, competition, and addiction.  You can play with your friends in a fun atmosphere.  Piano Marvel takes these concepts and applies them to learning the piano.  Students play along to accompaniment, see exactly which notes they hit and when they hit them, and earn trophies as they complete increasingly difficult exercises.  They can practice whenever they choose and can even battle it out with their piano-playing comrades.<span id="more-341"></span></p>
<p><object width="560" height="340" data="http://www.youtube.com/v/QotI0BLTGNE&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/QotI0BLTGNE&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /></object></p>
<p>Now to the gushy technical stuff.</p>
<p>First, Piano Marvel is built using <a href="http://www.adobe.com/products/air/" target="_blank">Adobe AIR</a> and <a href="http://www.java.com" target="_blank">Java</a>.  Adobe AIR provides the high level of interactivity needed for such an application.  Java provides the ability to communicate with a MIDI keyboard.  Both are bridged using <a href="http://code.google.com/p/transmission-as3/" target="_blank">Transmission</a>&#8211;AIR talks to Java, Java talks to AIR.  All are deployed onto the user&#8217;s desktop with a single installer.  Both Windows and Mac are supported.</p>
<p>Second, all the exercise content can be easily managed by the administrator.  Let&#8217;s say the administrator wants to add an exercise.  He plays a little ditty in <a href="http://www.finalemusic.com/" target="_blank">Finale</a> using his keyboard, saves the musical notation as a <a href="http://www.recordare.com/xml.html" target="_blank">MusicXML</a> file, saves the accompaniment in <a href="http://en.wikipedia.org/wiki/Musical_Instrument_Digital_Interface" target="_blank">MIDI</a> format, and uploads both files using an online admin panel.  The next time students log in, they have a new exercise to conquer.</p>
<p>Third, all music notation is dynamic.  In other words, an exercise is not just a big graphic of sheet music.  Instead, MusicXML is loaded from the server at runtime.  The XML is immediately parsed and notes, accidentals, lines, dots, and all notation the user sees is drawn to the screen at that moment.  Resize the window and the music is redrawn, not simply scaled, to fit into the available space in the most elegant and readable way possible.  Because the MusicXML is very comprehensive in describing a musical piece, we can also use the XML to determine pitch and timing for evaluating a user&#8217;s performance.</p>
<p>Fourth, the user can tweak the tempo, only play a portion of an exercise, toggle accompaniment and metronome sounds, get note hints, watch tutorial videos, and more.</p>
<p>Fifth, the application was recently nominated as an <a href="http://max.adobe.com/awards/" target="_blank">Adobe Max 2009 Awards</a> finalist in the education category.  Yeah, we&#8217;re kind of a big deal.</p>
<p>If that isn&#8217;t enough, you can watch my ugly cakehole yack about Piano Marvel below:</p>
<p><object width="560" height="315" data="http://vimeo.com/moogaloop.swf?clip_id=5012163&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=5012163&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /></object></p>
<p>You can use a free demo account to get hooked then pay a low monthly fee after your trial period is over.  If you check it out using <a href="http://www.pianomarvel.com/users/free-trial/9CAEF13F" target="_blank">this link</a> you&#8217;ll only pay $12/month if you choose to sign up.  That&#8217;s less than the gas you&#8217;d pay for to visit a piano teacher.  All you need is a MIDI keyboard and a MIDI-to-USB adapter to get started.</p>
<p>Here are several screenshots of the app and its features.  Props go out to <a href="http://natescodevault.com/?p=241" target="_blank">Nate Ross</a> for letting me steal his screenshots and captions.</p>
<hr />
<div id="attachment_351" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-351" title="pianomarvel_tooltip" src="http://aaronhardy.com/wp-content/uploads/2009/09/pianomarvel_tooltip.png" alt="Create a rich interactive music notation engine." width="500" height="379" /><p class="wp-caption-text">Create a rich interactive music notation engine.</p></div>
<hr />
<div id="attachment_353" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-353" title="pianomarvel_scoring" src="http://aaronhardy.com/wp-content/uploads/2009/09/pianomarvel_scoring.png" alt="Display immediate feedback on all correct and incorrect notes that were played." width="500" height="209" /><p class="wp-caption-text">Display immediate feedback on all correct and incorrect notes that were played.</p></div>
<hr />
<div id="attachment_354" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-354" title="pianomarvel_controls" src="http://aaronhardy.com/wp-content/uploads/2009/09/pianomarvel_controls.png" alt="Have the ability to specify tempo, make music selections, and toggle fun accompaniment and metronome playback." width="500" height="124" /><p class="wp-caption-text">Have the ability to specify tempo, make music selections, and toggle fun accompaniment and metronome playback.</p></div>
<hr />
<div id="attachment_355" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-355" title="pianomarvel_lessons" src="http://aaronhardy.com/wp-content/uploads/2009/09/pianomarvel_lessons.png" alt="Create an environment that makes playing the piano addictive and entertaining." width="500" height="343" /><p class="wp-caption-text">Create an environment that makes playing the piano addictive and entertaining</p></div>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/piano-marvel-interactive-piano-lessons/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Kelly Clarkson iPhone App</title>
		<link>http://aaronhardy.com/general-programming/kelly-clarkson-iphone-app/</link>
		<comments>http://aaronhardy.com/general-programming/kelly-clarkson-iphone-app/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 18:18:28 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[General Programming]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[karaoke]]></category>
		<category><![CDATA[kelly clarkson]]></category>
		<category><![CDATA[open mic]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=330</guid>
		<description><![CDATA[The company I work at, Rain, has officially entered the iPhone development arena. This week we released an application for Kelly Clarkson (i.e., Sony BMG) called Kelly Clarkson: Open Mic. While I didn&#8217;t personally work on this application, I am proud of my co-workers and their serious skills at taking the app from scratch to [...]]]></description>
			<content:encoded><![CDATA[<p>The company I work at, <a href="http://mediarain.com" target="_blank">Rain</a>, has officially entered the iPhone development arena.  This week we released an application for Kelly Clarkson (i.e., Sony BMG) called <a href="http://click.linksynergy.com/fs-bin/click?id=K7DZFeWGdbQ&#038;subid=&#038;offerid=146261.1&#038;type=10&#038;tmpid=3909&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewSoftware%3Fid%3D326868892%2526mt%3D8" target="_blank">Kelly Clarkson: Open Mic</a>.  While I didn&#8217;t personally work on this application, I am proud of my co-workers and their serious skills at taking the app from scratch to the big show.<span id="more-330"></span></p>
<p>As a primer, the app challenges your singing abilities by allowing you to sing along with Kelly karaoke style.  You&#8217;re able to sing songs from her latest album, <a href="http://click.linksynergy.com/fs-bin/click?id=K7DZFeWGdbQ&#038;subid=&#038;offerid=146261.1&#038;type=10&#038;tmpid=3909&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewAlbum%3Fid%3D305149890%2526s%3D143441" target="_blank">All I Ever Wanted</a>, and then be scored based on pitch and timing.  If you&#8217;ve got singing skillz with a z then you might just win a chance to sing at Kelly Clarkson&#8217;s soundcheck, win tickets to the show, and go to a meet &#038; greet event.</p>
<p>Props back to <a href="http://www.ghostradio.net/2009/08/your-life-would-suck-without-this-app/">Josh Buhler</a> for gracing me with his singing abilities while testing the app.  Or so he says it was for testing anyway&#8230;</p>
<p>So there you go.  Buy it and try out your singing abilities.  Then send me a message from your iPhone telling me how exhilarating it was and make sure it says &#8220;sent from my iPhone&#8221; so I become increasingly more jealous.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/general-programming/kelly-clarkson-iphone-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rain SVG</title>
		<link>http://aaronhardy.com/flex/rain-svg/</link>
		<comments>http://aaronhardy.com/flex/rain-svg/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 17:46:20 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[graphic editor]]></category>
		<category><![CDATA[product designer]]></category>
		<category><![CDATA[raster]]></category>
		<category><![CDATA[scalable vector graphics]]></category>
		<category><![CDATA[svg]]></category>
		<category><![CDATA[vector]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=255</guid>
		<description><![CDATA[Businesses win customers when they deliver what customers want. Customers get what they want when they can customize products to their own preferences. At Rain, where I work, we recognize the profit potential that clients can achieve with this concept and have created many applications allowing users to design their own products. How do we [...]]]></description>
			<content:encoded><![CDATA[<p>Businesses win customers when they deliver what customers want.  Customers get what they want when they can customize products to their own preferences.  At <a href="http://mediarain.com" target="_blank">Rain</a>, where I work, we recognize the profit potential that clients can achieve with this concept and have created many applications allowing users to design their own products.  How do we do it?  Let&#8217;s talk SVG.</p>
<p>Suppose we create a simple product designer containing a single rectangle.  The user can rotate, scale, position, and color the rectangle. The rectangle will then be printed in spectacular fashion on the customer&#8217;s very own poster.  So, Jim hops into the application and moves the rectangle to the center of the poster, doubles its size, colors it blue, then rotates it 45 degrees.  He then saves his design.</p>
<p>How is Jim&#8217;s design saved?  That is, how is Jim&#8217;s design described in such a way that (1) he can later re-open it and continue modifying his rectangle and (2) a printing shop can print his poster at virtually any size without degrading its quality?<span id="more-255"></span></p>
<p>The most common way to save an image is by using a <a href="http://en.wikipedia.org/wiki/Raster_graphics" target="_blank">raster format</a> such as gif or jpg.  While there are very good use cases for such formats, this is not one of them.  A raster format describes an image by using a grid of pixels with each pixel carrying a color value.  For example, the pixel at 1, 1 is red; the pixel at 1, 2 is green; and so on.  Put all the pixels together and your eye sees an image.</p>
<p>Raster images don&#8217;t fulfill our requirements for a couple reasons.  First, raster images have no knowledge of internal elements.  It doesn&#8217;t store information about which pixels belong to a rectangle and which belong to a circle.  An application may be able to analyze the pixels and make a good guess, but because the &#8220;grid of pixels&#8221; is only two-dimensional, once elements begin to overlap and become more complex even guessing turns impossible.  This would greatly restrict the ability for our application to re-load a user&#8217;s work for further editing.</p>
<p>Second, because raster images are a grid of pixels with each pixel carrying a color value, the image cannot scale to an arbitrary size without loss of apparent quality, otherwise known as pixelation.  To illustrate, imagine an image one inch wide that has 300 pixels on the first row of the pixel grid. You later decide you would like to print the image at two inches wide instead of one inch wide.  The 300 pixels now must be spread across an area twice as wide as the original.  While the image is made larger, no additional detail is available for the added area.  The human eye begins to notice this extrapolation of data resulting in a loss of apparent quality.</p>
<p>So how do we store the data then?  We use a <a href="http://en.wikipedia.org/wiki/Vector_graphics" target="_blank">vector format</a>.  Rather than storing image data in a pixel grid, vector graphics store data by using points, lines, curves, and shapes.  Because the descriptors are all based on mathematics, the image can be enlarged to an infinite size without loss of quality.  Likewise, a certain knowledge of the design&#8217;s individual elements is retained and can be used when loading a design for further editing.  Below is a graphical comparison of vector and raster (bitmap) art:</p>
<div style="background-color:#ffffff; padding: 12px; text-align: center">
<img src="http://aaronhardy.com/wp-content/uploads/2009/07/vectorbitmapexample.png" alt="Vector vs. Raster (bitmap)" title="Vector vs. Raster (bitmap)" width="350" height="450" class="aligncenter size-full wp-image-266" style="display:block; margin-left: auto; margin-right:auto" />
</div>
<p>In 1999, a group of industry leaders collaborated to make a vector specification called <a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics" target="_blank">Scalable Vector Graphics</a> (SVG). Although other vector formats existed previously, they each carried various restrictions or encumbrances.  SVG was designed as a lightweight, open standard that could easily be used amongst a variety of applications on a variety of platforms.  Design and printing applications could easily store and exchange vector design information.</p>
<p>While SVG is a great format for storing design data, users still need an environment where they can interact with design elements and have all the functionality of a full application.  Using Flex, Rain is able to leverage both the ubiquitous Flash player browser plugin for interactivity and SVG for persistent storage.  Rain has developed a library which translates what users see in the browser to a SVG file stored on the server.  If users wish to continue editing their design, the SVG can be loaded back into the product designer.  When the user is ready to order, the SVG document can then be shipped off to the printer.</p>
<p>While that might seem impressive, the real power of Rain&#8217;s SVG library comes from the complementary tools built to empower clients and their users.  For starters, users can rotate, scale, crop, pan, color, add text, mask, draw, and drag-and-drop.  Clients can guide users by specifying specific areas to drag-and-drop photos, enabling or disabling certain tools for individual elements or types of elements, and providing pre-built design templates.</p>
<p>Because the library is our own, we can tweak it as necessary.  We understand that every product designer is unique and carries its own set of business rules and capabilities.  We have experience implementing product designers for a wide variety of products from logos to shirts to sports trading cards to keychains.  Dream away and we&#8217;ll make it happen, cap&#8217;n.</p>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/rain-svg/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>TileList Padding and Grid Lines</title>
		<link>http://aaronhardy.com/flex/tilelist-padding-grid-lines/</link>
		<comments>http://aaronhardy.com/flex/tilelist-padding-grid-lines/#comments</comments>
		<pubDate>Fri, 15 May 2009 02:53:43 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[grid lines]]></category>
		<category><![CDATA[gridlines]]></category>
		<category><![CDATA[item renderer]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[TileList]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=235</guid>
		<description><![CDATA[As you might know, designers can come up with some pretty funky ideas that don&#8217;t always match up with the default functionality of the framework you&#8217;re using. The pro is that your app turns out fresh and unique. The bad is that you&#8217;re the one that has to make it work. Of course, that also [...]]]></description>
			<content:encoded><![CDATA[<p>As you might know, designers can come up with some pretty funky ideas that don&#8217;t always match up with the default functionality of the framework you&#8217;re using.  The pro is that your app turns out fresh and unique.  The bad is that you&#8217;re the one that has to make it work.  Of course, that also might be why you have a job.</p>
<p>Recently I received a comp from a designer that looked more or less like this:</p>
<p><img src="http://aaronhardy.com/wp-content/uploads/2009/05/gridtilelist.gif" alt="Grid TileList" title="Grid TileList" width="190" height="240" class="alignnone size-full wp-image-236" /><span id="more-235"></span></p>
<p>If you analyze it a bit, you&#8217;ll notice it calls for padding around the internal contents of a TileList.  This padding isn&#8217;t meant to surround each item renderer individually, but instead around all the visible renderers collectively.  In the TileList component that comes with Flex, setting the built-in padding styles does the former.  Doing the latter is a more difficult task.  </p>
<p>The comp also shows grid lines, that is, lines separating the rows and columns of the item renderers.  The lines not only cross through the item renderer area but through the padding to the edge of the TileList, minus the scrollbars.  Unlike a DataGrid, TileList doesn&#8217;t provide any styles or properties to support this.  Then again, if you know something I don&#8217;t, let me hear about it.</p>
<p>So here we go.  I&#8217;ll save you the headache&#8211;you just kick back and enjoy.   <a href="/samples/gridlinetilelist/" target="_blank">See the example here</a> and right-click for the full source.</p>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/tilelist-padding-grid-lines/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nimbus &#8211; MVC Framework Intro</title>
		<link>http://aaronhardy.com/flex/nimbus-mvc-framework-intro/</link>
		<comments>http://aaronhardy.com/flex/nimbus-mvc-framework-intro/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 22:51:45 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[model view controller]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[nimbus]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[redo]]></category>
		<category><![CDATA[sequence]]></category>
		<category><![CDATA[undo]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=221</guid>
		<description><![CDATA[UPDATE: Since the writing of this post, I&#8217;ve converted to and fully endorse Robotlegs as my MVC framework of choice. I invite you to check it out. For those who don&#8217;t know, Nimbus is a Flex MVC framework (or micro-architecture for the technically-inclined). Sponsored by Rain, we develop it primarily for use on our applications [...]]]></description>
			<content:encoded><![CDATA[<hr/>
<b>UPDATE: Since the writing of this post, I&#8217;ve converted to and fully endorse Robotlegs as my MVC framework of choice. I invite you to <a href="http://www.robotlegs.org" target="_blank">check it out</a>.</b></p>
<hr/>
<p>For those who don&#8217;t know, <a href="http://code.google.com/p/nimbus-as3" target="_blank">Nimbus</a> is a Flex MVC framework (or micro-architecture for the technically-inclined).  Sponsored by <a href="http://mediarain.com" target="_blank">Rain</a>, we develop it primarily for use on our applications but make it available for public use and encourage the community to <a href="http://code.google.com/p/nimbus-as3" target="_blank">contribute</a>.</p>
<p>Nimbus pulls core concepts from <a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm" target="_blank">Cairngorm</a> but is meant to cut out a lot of the plumbing developers groan about when they hear &#8220;Cairngorm.&#8221;  It&#8217;s light, but it&#8217;s not <a href="http://i260.photobucket.com/albums/ii22/shastymax/fluffy.jpg" target="_blank">fluffy</a>.  Baked in are those rare and tasty flavor morsels you thought only existed in those <a href="http://laparisiennecentre.com/blog/nfblog/wp-content/uploads/2007/07/confetticupcakes.JPG" target="_blank">Funfetti cupcakes</a> <a href="http://www.chaos.gwdg.de/~sinan/resimler/GRANDMA_KISS.GIF" target="_blank">your grandmother</a> bakes with love on your birthday.<span id="more-221"></span></p>
<p>Until the end of 2008, Nimbus had been shaped, re-shaped, patched, and plugged.  A complete re-write was merited so that&#8217;s what we did.  And really, what makes for a better Christmas than sitting down with your stocking stuffed with jelly beans and re-writing an MVC framework.  A few months later, the code is settling down along with the sugar and we&#8217;re ready for action.</p>
<p>Here are some features of Nimbus:</p>
<ul>
<li>Notification system of command completion so portions of the application can know when a command has finished executing.</li>
<li>Nestable &#8220;macro&#8221; commands.  Think &#8220;I want commands A and B to run in parallel, then C, then D and E in parallel, but inside D I want F and G to run sequentially&#8230;&#8221;</li>
<li>Undo/Redo functionality.</li>
<li>Progress feedback system.  You as a developer can associate a processing message with each command or macro command to provide feedback to users.</li>
<li>Interaction blocking system.  While commands are executing, easily disable user interaction to protect your service calls.</li>
<li>Combinable commands.  Ensure that similar command instances can be grouped appropriately in the undo/redo history.</li>
</ul>
<p><em><a href="/flex/the-best-flex-mvc-framework/">Nimbus may not be right for everyone</a>.  Call your system administrator if your scalability problem worsens or is not better within 7 to 10 days.  This may mean that there is another condition causing your RTE problems.  Do not take Nimbus with alcohol.  Call your system administrator right away if after taking Nimbus you are unable to walk, drive, eat, or engage in other activities.  In rare cases, severe allergic reactions can occur.  Most MVC frameworks carry some risk of dependency.  Do not use MVC frameworks for extended periods without first talking to your system administrator.  You are encouraged to report negative side effects of Nimbus.  Visit <a href="http://code.google.com/p/nimbus-as3" target="_blank">http://code.google.com/p/nimbus-as3</a> for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/nimbus-mvc-framework-intro/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Meta-Learnings from Adobe MAX 2008</title>
		<link>http://aaronhardy.com/flex/meta-learnings-from-adobe-max-2008/</link>
		<comments>http://aaronhardy.com/flex/meta-learnings-from-adobe-max-2008/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 04:46:17 +0000</pubDate>
		<dc:creator>Aaron Hardy</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe max]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[Flash Catalyst]]></category>
		<category><![CDATA[microarchitectures]]></category>
		<category><![CDATA[Thermo]]></category>

		<guid isPermaLink="false">http://aaronhardy.com/?p=160</guid>
		<description><![CDATA[While I learned a fair share at Adobe MAX 2008, I&#8217;d like to focus this post on meta-learnings.  What are meta-learnings?  I&#8217;m not sure yet, but here we go: Gucci is to Hollywood as writing books is to nerds.  I don&#8217;t remember the number of times I heard someone flaunting his/her authorship on a book, [...]]]></description>
			<content:encoded><![CDATA[<p>While I learned a fair share at Adobe MAX 2008, I&#8217;d like to focus this post on meta-learnings.  What are meta-learnings?  I&#8217;m not sure yet, but here we go:</p>
<ul>
<li>Gucci is to Hollywood as writing books is to nerds.  I don&#8217;t remember the number of times I heard someone flaunting his/her authorship on a book, but I&#8217;m quite positive it surpassed the fingers on one hand.  Writing books is the new black when it comes to tech.</li>
<li>Adobe is very in-tune with their customers.  One of their general sessions was focused on presenting how Adobe is addressing <em>specific </em>customer problems.  Key corporate leaders presented in real style and with what seemed to be honest sincerity.  Being that I&#8217;ve seen the problems firsthand, I can honestly say they seem to know what their customers need and how to get there.  At one presentation, a member of the audience asked something related to accessing the screen dimensions of a cell phone an AIR application is running on.  I then overheard one of Adobe&#8217;s team members on the back row ask another team member, &#8220;Do you know if we do that?&#8221;  The other one said, &#8220;I don&#8217;t know, but let&#8217;s take a look at it.&#8221;  How many times can you ask a question about a product and get the immediate attention of the development team behind it?<span id="more-160"></span></li>
<li><a href="http://labs.adobe.com/technologies/flashcatalyst/" target="_blank">Adobe Flash Catalyst</a>, formerly named Thermo, is finally materializing and is starting to make sense.  It&#8217;s also a great example of how Adobe knows what its customers want.  One issue that has plagued both developers and designers is the gap between the two.  After a graphic designer designs (&#8220;mocks up&#8221;) an application&#8217;s interface, he/she passes it off to the developer.  It&#8217;s then the developer&#8217;s job to interpret how to implement the design.  Sounds easy enough, but that requires cutting the images up into smaller portions, hooking each element up to the programming logic that controls it, and, most importantly, interpreting how the user interacts with the design.  Given that an application&#8217;s graphic design usually comes to the programmer in a static form with no animation and relatively few, if any, side notes, that can leave a lot to be interpreted and a lot of code refactoring.  Adobe&#8217;s Flash Catalyst was built to address just that issue and I believe it will represent a huge paradigm shift in how an application&#8217;s graphic design is integrated with logic.</li>
<li>The <a href="http://www.tink.ws/blog/files/flex/FlipExample.html" target="_blank">3d flip</a> is the next bevel.</li>
<li>Listening to the Flex team brings a higher understanding of why things are done the way they are.  First of all, you get to know the developers, their limitations, and their frustrations.  Rather than reading marketing media, you hear their mostly-unfiltered opinions.  Most of them have ran into similar situations as you and also feel frustrated.  Try modifying a vertical scroll bar in Flex and placing the up and down buttons next to each other.  Sounds easy, but it takes some work and they know it.  After I&#8217;ve seen what they&#8217;ve been working on, it starts to make sense why they have continued to push off certain bugs in favor of enhancing the core architecture.</li>
<li>Related to my previous meta-learning, the Flex team members, as super-duper as they are, aren&#8217;t perfect.  Recently I was doing some research on a design principle called &#8220;<a href="http://www.adobe.com/devnet/actionscript/articles/oop_as3_03.html" target="_blank">composition over inheritance</a>&#8221; and would refer to the Flex 3 framework as a comparison.  I kept thinking, well, it certainly seems like there&#8217;s a lot of inheritance going on.  They must be doing things right though&#8211;they&#8217;re Adobe.  Well, sure enough it seems one of the main goals of the new version of Flex (Flex 4) is to do away with a lot of the inheritance and move to a more composition-oriented approach.  The benefits are almost immediately apparent after seeing a few demos.  The comparison of Flex 3 and Flex 4 is a great lesson in design patterns and shows how the Adobe team is learning along with the rest of us.</li>
<li>Flex microarchitectures/frameworks are like punk trends.  A decade ago, the trend was baggy jeans, cushiony shoes, and spiky hair.  I liked and still like most of the those trends for comfort and skateboardability.  Now it seems punks are having a hard time differentiating themselves from themselves.  They can barely fit in their pants, have their hair slicked over their eyes, and are back to paper-thin Converse Allstars.  Flex microarchitectures have similar trends.  It used to be that everyone was all gung-ho about them.  They loved em and thought they were cooler for having more than three on their resume.  Now you&#8217;ve got a bunch of people saying, &#8220;Nah, they suck&#8230;.I don&#8217;t even need them&#8230;and you suck for using them.&#8221;  As with the punk trends, <a href="http://aaronhardy.com/flex/the-best-flex-mvc-framework/" target="_blank">I sit in the middle</a>.</li>
</ul>
<p>That&#8217;s it!  Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://aaronhardy.com/flex/meta-learnings-from-adobe-max-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

