<?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>Solution Hacker &#187; 4.2. Visualize Your Data</title>
	<atom:link href="http://www.solutionhacker.com/category/data-intelligence/data-visualization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.solutionhacker.com</link>
	<description>This blog provides solutions for enterpreneurs!</description>
	<lastBuildDate>Wed, 04 Aug 2010 11:37:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Adobe Air with SQLite database</title>
		<link>http://www.solutionhacker.com/uncategorized/adobe-air-with-sqlite-database/</link>
		<comments>http://www.solutionhacker.com/uncategorized/adobe-air-with-sqlite-database/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 05:57:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[4.2. Visualize Your Data]]></category>
		<category><![CDATA[6. Uncategorized]]></category>
		<category><![CDATA[adobe air]]></category>
		<category><![CDATA[offline synchronization]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/?p=240</guid>
		<description><![CDATA[Recently, I am trying to build an interactive reporting tool that needs to deal with lots of data. The data is not dynamic because it is basically data from historical performance log files. However, the volume of the data is large (over few millions of rows) and I still want my clients to interact with [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I am trying to build an interactive reporting tool that needs to deal with lots of data. The data is <strong>not</strong> dynamic because it is basically data from historical performance log files. However, the volume of the data is <strong>large</strong> (over few millions of rows) and I still want my clients to interact with large amount of data in ease. With this, I am looking into Adobe AIR as I heard that it comes with in-memory database &#8220;<strong>SQLite</strong>&#8220;. I believe it should have better performance than web-based application because data is local and SQLite is lightweight and fast. Apart from that, SQLite supports <strong>parameterized query</strong>, <strong>strongly-typed result</strong>, <strong>asynchronous/ synchonous processing</strong>, <strong>indexing, view, trigger,</strong> <strong>transaction</strong> and most of <strong>SQL92</strong>. On top of that, it is <strong>small footprint, cross-platform and open source</strong>. The tradeoff for SQLite is its weak support in <strong>concurrency</strong> because it is using<strong> table exclusive lock</strong>. However, it is totally fine for desktop application because it normally only serves one user. For more info of SQLite, check out my notes below.</p>
<p><u>Update</u></p>
<p>SQLite 3 is released that addressed some of its issues in version 2.</p>
<ul>
<li>BLOB support</li>
<li>Fulltext searching</li>
<li>Connection shared between threads</li>
<li>Improve concurrency</li>
</ul>
<p>However, it still doesn&#8217;t support writeable view, nested transaction and foreign key.</p>
<h2>Presentation</h2>
<p>Here is a nice presentation from Paul Roberson, look at it first.</p>
<p><embed width="400" height="305" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" swliveconnect="true" type="application/x-shockwave-flash" seamlesstabbing="false" name="flashObj" base="http://admin.brightcove.com" flashvars="videoId=1741212624&amp;playerId=1596744118&amp;viewerSecureGatewayURL=https://console.brightcove.com/services/amfgateway&amp;servicesURL=http://services.brightcove.com/services&amp;cdnURL=http://admin.brightcove.com&amp;domain=embed&amp;autoStart=false&amp;" bgcolor="#FFFFFF" src="http://c.brightcove.com/services/viewer/federated_f8/1596744118"></embed></p>
<p><strong>&#160;Note from the video:</strong></p>
<ol>
<li>Warm up with general SQL Tips (Join favors subquery, Avoid IN, Avoid LIKE, Specify columns name in select and insert, Avoid unnecessary join)</li>
<li>AIR SQL connection can connect up to 10 databases at a time, you can use qualifier for your tables.</li>
<li>Don&#8217;t reuse the same SQL Statement for different prepared statements.</li>
<li>Use transaction to do batch insert/ update/ delete operations (48x faster!)</li>
<li>Index columns in WHERE clause, use together index together</li>
<li>Create table structure before you add data because internally SQLite&#8230;?</li>
<li>Handle large resultset in parts for perceived performance gain (<a href="http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7d4c.html#WS5b3ccc516d4fbf351e63e3d118666ade46-7d46">detailed</a>)</li>
</ol>
<p>There are several things I want to find out:</p>
<ol>
<li>Can SQLite handles large dataset?
<ul>
<li>Yes. According to spec, it can handle terabyte of data.</li>
</ul>
</li>
<li>Does SQLite support pagination?
<ul>
<li>Yes. Look at SQL Statement object.</li>
</ul>
</li>
<li>How SQLite synchronize with the updated data from the remote database?
<ul>
<li>Strategies: overwrite vs delta (timestamp, field by field comparison, dirty flag)</li>
<li>Live cycle data service has built-in SQLite synchronization support including offline caching and conflict management.</li>
<li><a class="linkification-ext" href="http://coenraets.org/blog/2008/05/insync-automatic-offline-data-synchronization-in-air-using-lcds-26/" title="Linkification: http://coenraets.org/blog/2008/05/insync-automatic-offline-data-synchronization-in-air-using-lcds-26/">http://coenraets.org/blog/2008/05/insync-automatic-offline-data-synchronization-in-air-using-lcds-26/</a></li>
</ul>
</li>
</ol>
<h2>Some notes about SQLite</h2>
<p>Below are some SQLite tips and practices I obtained from different sources:</p>
<ul>
<li>A big advantage of sqlite above a flat file is the possibility to index your data.</li>
<li>Using parameterize query protects against sql injection, and makes the &#8216; problems go away. It is also much faster because sqlite can reuse the execution plan of statements when you use parameters.</li>
<li>Make sure to import the records <strong>in a transaction</strong> so that it doesn&#8217;t spend a lot of time creating indexes until everything is imported.</li>
<li>The SQLite documentation states that SQLite databases can be <strong>terabytes</strong> in size, and that the primary limitation of SQLite is concurrency (many users at the same time).</li>
<li><em>&#8220;The SQLite database is pretty damn fast. I was getting near instantaneous searching with databases that were ~100,000 records. Somewhere around 800,000 – 1,000,000 records you start losing performance, waiting a few seconds for a search&#8221;</em> &#8211; by <a href="http://www.wabysabi.com/blog/">Daniel</a></li>
<li>Each database is contained within a single file.</li>
</ul>
<h2>Reference</h2>
<p>Below are some good links I have found:</p>
<ul>
<li><a href="http://www.lfpug.com/flexair-developing-for-large-datasets/">Develop air application with large dataset</a></li>
<li><a href="http://www.peterelst.com/blog/2009/06/26/sqlite-at-the-lake/">SQLite at the Lake &#8211; Peter Elst</a> (06/26/2009)</li>
<li><a href="http://www.dehats.com/drupal/?q=node/58">SQLite admin tool by David Deraedt</a> &#8211; not open source</li>
<li><a href="http://coenraets.org/blog/2007/10/new-air-sqlite-administration-app-with-source-code/">Another SQLite admin tool by Christophe Coenraets</a> (10/2007) &#8211; open source</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/5817">Firefox SQLite Manager plugin</a> &#8211; support csv import. However, the project is no longer active.</li>
<li><a href="http://www.peterelst.com/blog/2008/04/18/sqlite-in-adobe-air-session-video/">Adobe Air and SQLite video session</a> (4/18/2008) &#8211; it contains 3 interesting examples.<a href="http://coenraets.org/blog/2007/10/new-air-sqlite-administration-app-with-source-code/"><br />
    </a></li>
<li><a href="http://blog.affirmix.com/2009/01/28/getting-started-with-adobe-air-and-sqlite-and-avoiding-the-problems/">Get started with adobe air and sqlite</a> (1/28/2009)</li>
<li><a href="http://www.adobe.com/devnet/air/flex/articles/air_sql_operations_print.html">Develop the connection and statement pool</a></li>
</ul>
<p>&#160;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/uncategorized/adobe-air-with-sqlite-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Startup Sequence</title>
		<link>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-startup-sequence/</link>
		<comments>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-startup-sequence/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 06:56:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[2.1. Architect Corner]]></category>
		<category><![CDATA[4.2. Visualize Your Data]]></category>
		<category><![CDATA[dynamic loading theme]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[preloader]]></category>
		<category><![CDATA[startup events]]></category>
		<category><![CDATA[SystemManager]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/?p=217</guid>
		<description><![CDATA[Magic behind the scene I always wonder how my Flex application displayed on the Flash Player in browser. Why decompile Flex SWF will give me 2 frames movie? What is SystemManager and how can I get a handle of it? Many of these kind of questions are at the lower level. The level that makes [...]]]></description>
			<content:encoded><![CDATA[<h2>Magic behind the scene</h2>
<p>I always wonder how my Flex application displayed on the Flash Player in browser. Why decompile Flex SWF will give me <strong>2 frames movie</strong>? What is <strong>SystemManager</strong> and how can I get a handle of it? Many of these kind of questions are at the lower level. The level that makes Flex application possible. Normally, we don&#8217;t need to dive into this to write a Flex application. However, it would make me feel more comfortable to understand this before I advocate Flex as the main part of our company&#8217;s UI strategy.&#160;</p>
<p>To understand how your Flex application got loaded and display on Flash Player, you can read this great <a href="http://iamdeepa.com/blog/?p=11">article</a>. I am going to put down the sequences in steps below:</p>
<h2>Flex is a 2-frame movie</h2>
<p>The <strong>first frame</strong> of a Flex SWF contains the <strong>SystemManager</strong>, the <strong>Preloader</strong>, the <strong>DownloadProgressBar </strong>and some glue helper classes. Remember, the Preloader is what creates the DownloadProgressBar control which displays the progress of a Flex application downloading and being initialized. The <strong>second frame</strong> of a Flex SWF contains the rest of the Flex framework code, your application code and all of your application assets like embedded fonts, images, etc.</p>
<p><span id="more-217"></span><br />
By creating a 2-frame movie, Flex applications can take advantage of the <strong>streaming </strong>support built into the Flash Player and a preloader can appear before all of the Flex framework code and your application code are downloaded.</p>
<blockquote>
<p>The .swf format is a progressive download format which means that Flash player can access content on frames as they download without having to wait for the entire file to download.</p>
</blockquote>
<p><u>Here are the steps</u>:</p>
<ol>
<li>First, enough bytes for <strong>frame 1</strong> are streamed down to the Flash Player.</li>
<li>The Flash Player executes those bytes by creating a <strong>SystemManager </strong>instance.</li>
<li>SystemManager instruct the Flash Player to stop at the end of frame 1.</li>
<li>SystemManager then goes on to create the <strong>Preloader </strong>which creates the <strong>DownloadProgressBar </strong>control and pops that up on the client screen.</li>
<li>The Preloader then starts tracking the rest of the bytes streaming in from the Flex SWF.&#160;</li>
<li>Once all the bytes for the Flex framework and application code are in, the System Manager goes on to frame 2 and instantiates the <strong>Application </strong>instance.</li>
<li>Once the Application instance has been created, the SystemManager sets <strong>Application.systemManager</strong> to itself. This is how you, the application developer, can access the SystemManager at a later time.</li>
<li>The Application dispatches the <strong>preinitialize event</strong> at the beginning of the initialization process.</li>
<li><strong>Application goes on to create its children. </strong>The method createChildren() is called on the application. At this point each of the application’s components is being constructed, and each component’s createChildren() will be also called. For detail, look at <strong>component lifecycle section</strong>.</li>
<li>The Application dispatches the <strong>initialize event</strong>, which indicates that all application’s components have been initialized. However, at this state,  all the components are not yet laid out.</li>
<li>Eventually, once all the Application child controls and containers have been created, sized and positioned, the Application dispatches the <strong>creationComplete </strong>event.</li>
<li>Once the creationComplete event has been dispatched, the Preloader removes the DownloadProgressBar control and the SystemManager <strong>adds the Application instance to the Flash Player display list</strong>. (The Flash Player display list is basically the tree of visible or potentially visible objects that make up your application. When you add and remove child components to your application, your basically just adding and removing them from the display list).</li>
<li>Once the Application is added to the Flash Player display list, the Application dispatches its <strong>applicationComplete</strong> event</li>
<li>The Application has been created and is up on the screen ready to be interacted with.<br />
    &#160;</li>
</ol>
<h2>Component Architecture</h2>
<p>&#160;This is the best video I have found that discuss the component lifecycle in detail &#8211; Thanks for Deepa.</p>
<p><embed height="350" width="550" flashvars="v=~b64~aHR0cDovL2Fkb2JlLmVkZ2Vib3NzLm5ldC9mbGFzaC9hZG9iZS9hZG9iZXR2Mi9tYXhfMjAwOF9kZXZlbG9wLzE1OTY3NDE2MTNfMjkzMTA5MzAwMV8yMDAxLS1zdWJyYW1hbmlhbS10dWUtMTMwcG0tZGV2ZWxvcC5mbHY/cnNzX2ZlZWRpZD0xNTM4NCZ4bWx2ZXJzPTI=&amp;w=550&amp;t=http://tv.adobe.com/MAX-2008-Develop/Creating-New-Components-in-Flex-3-by-Deepa-Subramaniam.htmlvi+f15384v1002&amp;h=350" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" quality="high" loop="false" play="true" name="AdobeTVPlayer" bgcolor="#000000" src="http://tv.adobe.com/Embed.swf"></embed></p>
<p class="MsoNormal" style="text-align: left;">Below is summary I took from the video above, in case you don&#8217;t want to spend an hour to listen to this. However, I really think you should. To start out, Deepa introduced component and skinning architecture &#8220;<strong>Spark</strong>&#8221; that is part of Flex 4 <strong>Gumbo</strong>. Spark is built on top of <strong>Halo </strong>(ie. Flex 3 component architecture) and components using Halo or Spark can co-exist. Then,&#160; Deepa put her focus to talk about how to develop her custom video component on top of Halo and Spark for comparison. Spart is great that it can factor out the layout code from component.</p>
<p class="MsoNormal" style="text-align: left;">Halo component lifecycle can be separated into 3 phases:</p>
<p><u><strong>Phase 1 &#8211; Initialization</strong></u></p>
<ol>
<li><u>Construction</u>
<ul>
<li>Choose the right base class and provide default constructor (ie. zero argument). By extending <strong>UIComponent</strong>, you inherit all of the lifecycle methods, events and properties. Also, since UIComponent extends from <strong>EventDispatcher</strong>, your component inherits the ability to listen and dispatch events.</li>
<li>Best practice: Call super() and add event listener. Minimal work should occur here.</li>
</ul>
</li>
<li><u>COnfiguration</u>
<ul>
<li>setter and getter for properties.</li>
<li>Involve in invalidation and validation cycle. Detail later.</li>
<li>Best practice: Setter should not expect the internal children have been created and you want your setter to be fast. Use _xxx for storage variable and have dirty flag for your variable. Throw events out when the internal state of your component get changed.</li>
</ul>
</li>
<li><u>Attachment</u>
<ul>
<li>Component are added to the flash <strong>display list </strong>by its parent via <strong>addChild()</strong> call. Without attachment, component lifecycle will be stalled. Nothing is going to happen to your component. So, this is an important step.</li>
<li>Display list is a tree of visible or potentially visible objects in your application. At the root of the display list is your main application. Thing like containment hierarchy and rendering order are all maintained by the display list.</li>
</ul>
</li>
<li><u>Initialization</u>- 5 lifecycle actions occur here.
<ul>
<li><strong>preinitialize </strong>event is dispatched. It signifies that you as component that has been added to the display list by your parent via addChild().</li>
<li><strong>createChildren()</strong> &#8211; walk through all your children, create, configure and attach them to the display list. Best practice: Call super.createChildren(), construct if not exist and attach your children via addChild(). If your child component is dynamic and data driven, use <strong>commitProperties()</strong> b/c it gets called at every invalidation and validation cycle. <em>Halo rules: Container &#8211;&gt; nested structure of UIComponents &#8211;&gt; MovieClip, Video, Shape and Sprite.</em></li>
<li><strong>initialize </strong>event is dispatched. It signifies that you and all your children are created and attached.</li>
<li>First <strong>invalidation/ validation pass </strong>occurs,</li>
<li><strong>creationComplete</strong> event is dispatched. Ready for prime time.</li>
</ul>
</li>
</ol>
<p><u><strong>Phase 2 &#8211; Update</strong></u></p>
<p>At this phase, your component is fully initialized and ready for usage. Now, it needs to know how to update. And update occurs when its internal state has been changed by like user interactions. To respond to the changes, component uses the invalidation and validation cycle. The key here is to flag the changed variable dirty during invalidation and later handles it during validation right before rendering. So, you can have many invalidation and one validation that gives better performance via avoiding repetitive work. To better understand this approach, Deepa talks about <strong>Flash Player Elastic Racetrack</strong> that has 2 parts: code execution and rendering. If either part taking too long, Flash player cannot get its job done faster than 1 frame per second. You will see your application with lag and halt, that is bad!&#160;</p>
<ol>
<li>Invalidation/ Validation can be split into 3 phase. 
<ul>
<li>InvalidateProperties &#8211;&gt; commitProperties</li>
<li>InvalidateSize &#8211;&gt; measure (measure may not be called. Don&#8217;t have your code depends on it)</li>
<li>InvalidateDisplayLIst &#8211;&gt; updateDisplayList</li>
</ul>
</li>
</ol>
<p><u><strong>Phase 3 &#8211; Destruction</strong></u></p>
<ol>
<li>Detachment</li>
<li>Garbage Collection</li>
</ol>
<p>&#160;</p>
<h2>What is Mixin?</h2>
<p>When you put the [Mixin] metadata just above your class definition and add a static init function to the class like so,</p>
<pre name="code" class="java">
[Mixin]
public class Model {
	public static function init (systemManager : ISystemManager)   {
		trace ("I get called first")
	}
}
</pre>
<p>The static init function will be called as soon as your application loads (assuming this class is referenced somewhere in the app), much like static initialization blocks in Java. This is useful if you have some code that you want to run before any of the other code in the class.</p>
<h2>Reference</h2>
<p>Below are some interesting articles I found related to this article</p>
<ol>
<li><a href="http://npacemo.com/wordpress/2008/07/06/flex-application-bootstrapping-totally-custom-preloader/">Create Custom Preloader</a>, <a href="http://www.onflex.org/ted/2006/07/flex-2-custom-preloaders.php">Ted has an article related to this too</a></li>
<li><a href="http://www.insideria.com/2008/04/flex-ria-performance-considera.html">Speed up startup loading time</a></li>
<li><a href="http://userflex.wordpress.com/2008/02/07/preload-runtime-styles/">Dynamic loading a new custom theme without fraction seconds delay</a></li>
<li><a href="http://tv.adobe.com/#vi+f15384v1002">Deepa presentation in MAX</a></li>
<li><a href="http://www.adobe.com/support/documentation/en/flex/1/mixin/mixin2.html">Introduction to mixins</a></li>
</ol>
<p>&#160;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-startup-sequence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Annotated Charting</title>
		<link>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-annotated-charting/</link>
		<comments>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-annotated-charting/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 23:02:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[4.2. Visualize Your Data]]></category>
		<category><![CDATA[annotation]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[google finance]]></category>
		<category><![CDATA[line chart]]></category>
		<category><![CDATA[range selector]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/?p=201</guid>
		<description><![CDATA[Recently, I want to extend the LineChart in Flex. I want to have line chart with event annotated like Google Finance. &#160; First of all, I googled the Net to see whether anyone had already done it. It was even better if I could find any open source project related to this. Below are the [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I want to extend the LineChart in Flex. I want to have line chart with event annotated like Google Finance.</p>
<div align="center"><a href="http://meutzner.com/examples/flex_finance/Flex_Finance_Step5.html" target="_blank">  <img border="0" alt="" src="http://meutzner.com/examples/flex_finance/flex_finance.jpg" /></a></div>
<div align="center">&#160;</div>
<div style="text-align: left;">First of all, I googled the Net to see whether anyone had already done it. It was even better if I could find any open source project related to this. Below are the interesting things I found:</div>
<ol>
<li><a href="http://www.djindexes.com/DJIA110/learning-center/">Dow Jone Interactive Chart </a>(commerical &#8211; it is exactly what I am looking for)</li>
<li><a href="http://demo.quietlyscheming.com/InteractiveBubble/InteractiveBubble.html">Interactive Bubble Chart</a> (open &#8211; although it is not exactly want I want, but if I believe the code can benefit me if I need to customize line chart. <img src="../../../../../wp-includes/images/smilies/icon_cool.gif" alt=":cool:" onclick="grin(':cool:');" /> I may just need to draw the interactive small bubble on the line to get my job done!)</li>
<li>This <a href="http://demo.quietlyscheming.com/ChartSampler/app.html">demo </a>gives you tons of chart samples. They are all great example although none of them satisfy my current need.</li>
<li>This <a href="http://www.stretchmedia.ca/blog/index.cfm/2007/3/28/Chart-Milestones-using-annotationElements">demo </a>is close to what I want. From this demo, I notice I can use &#8220;<strong>annotationElement</strong>&#8221; to draw on top of the data series. However, the trick is to convert the data points to pixel coordinate in order for me to draw something that can move along with the graph even someone stretches it. To make thing easier, Ely Greenfield has created <strong>DataDrawingCanvas </strong>that helps us draw on the chart with only data points specified instead of pixel coordinates. This class extends the <strong>ChartElement </strong>like <strong>AnnotationElement </strong>does (<a href="http://www.quietlyscheming.com/blog/charts/easy-custom-charts/">blog</a>). That is amazing!! Thanks!!! <img onclick="grin(':smile:');" alt=":smile:" src="../../../../../wp-includes/images/smilies/icon_smile.gif" /></li>
<li><a href="http://meutzner.com/examples/flex_finance/Flex_Finance_Step5.html">Google Finance Chart</a> (It is exactly what I want. I wonder I can get the source of it)
<ul>
<li>I have found the blog and <a href="http://meutzner.com/examples/flex_finance/Flex Finance PPT.ppt">powerpoint </a>of this sample (1/7/2009)</li>
<li>Google uses the Flash/ JavaScript integrate kit to get it works (<a href="http://www.mikechambers.com/blog/2006/03/21/google-finance-flash-ajax-integration/">blog</a>) &#8211; I heard that it is very nice combination of Flash and AJAX. This is similar to <a href="http://www.measuremap.com/">MeasureMap</a>&#8216;s use of the kit.</li>
<li>It is open source example!!! (<a href="http://www.meutzner.com/blog/attachments/360/srcview/index.html">code</a>). Thanks for Brendan Meutzner!!</li>
<li>Brendan also shows us how he created his demo in 5 steps to help us understand how to build it ourselves.</li>
<li><a href="http://www.meutzner.com/blog/attachments/360/Flex_Finance_Step1.html">Step 1</a>, <a href="http://www.meutzner.com/blog/attachments/360/Flex_Finance_Step2.html">Step 2</a>, <a href="http://www.meutzner.com/blog/attachments/360/Flex_Finance_Step3.html">Step 3</a>, <a href="http://www.meutzner.com/blog/attachments/360/Flex_Finance_Step4.html">Step 4</a>, <a href="http://www.meutzner.com/blog/attachments/360/Flex_Finance_Step5.html">Step 5</a> &#8211; enjoy!!</li>
</ul>
</li>
</ol>
<h2>Reference</h2>
<p>Useful resources:</p>
<ol>
<li><a href="http://tv.adobe.com/#vi+f15384v1024">Data Visualization by Tom Gonzalez</a>. (Tom created an open source visualization framework named Axiis. It looks great. Once I get a chance, I will dig into it) &#8211; 7/31/2009</li>
<li><a href="http://www.onflex.org/ACDS/BuildingAFlexComponent.pdf">Building a Flex Component</a> by Ely GreenField</li>
<li><a href="http://www.adobe.com/devnet/flex/articles/components_separation.html">Create component and enforce separation of concern</a></li>
<li><a href="http://www.edwardtufte.com/tufte/">http://www.edwardtufte.com/tufte/ </a>(Edward Tufte &#8211; famous guy in data visualization)</li>
<li><a href="http://www.insideria.com/2008/03/image-manipulation-in-flex.html">http://www.insideria.com/2008/03/image-manipulation-in-flex.html</a> (Image Manipulation)</li>
</ol>
<p>&#160;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-annotated-charting/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flex Remoting and Session Management</title>
		<link>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-remoting-and-session-management/</link>
		<comments>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-remoting-and-session-management/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 10:10:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[2.1. Architect Corner]]></category>
		<category><![CDATA[4.2. Visualize Your Data]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/2008/06/22/flex-remoting-and-session-management/</guid>
		<description><![CDATA[Power of BlazeDS Recently, I found out that Adobe has released BlazeDS (subset of LiveCycleDS) that has 4 main advantages: AS3 to Java object communication (no XML passes back and forth is needed!) Boost up performance b/c AMF is a binary protocol Built-in proxy support that gets around the cross domain security issue from Flex [...]]]></description>
			<content:encoded><![CDATA[<h2>Power of BlazeDS</h2>
<p>Recently, I found out that Adobe has released BlazeDS (subset of LiveCycleDS) that has 4 main advantages:</p>
<ol>
<li>AS3 to Java object communication (no XML passes back and forth is needed!)</li>
<li>Boost up performance b/c AMF is a binary protocol</li>
<li>Built-in proxy support that gets around the cross domain security issue from Flex in ease.</li>
<li>Allow push messaging</li>
</ol>
<p>I have followed the guideline and set it up. Now my Flex application can call my Java object method without passing xml back and forth. It is awesome! During the setup process, you may experience your flex cannot find the destination set up in the server.</p>
<div class="content">
<blockquote>
<p>The error &ldquo;[MessagingError message=&rsquo;Destination &lsquo;SomeBean&rsquo; either does not exist or the destination has no channels defined (and the application does not define any default channels.)&rsquo;]&rdquo;.</p>
</blockquote>
</div>
<p>The trick here is to add a services argument to the mxmlc call, something of the form below should do the trick!&nbsp;</p>
<blockquote>
<p>-services &ldquo;[local path to your java project]/WEB-INF/flex/services-config.xml&rdquo;</p>
</blockquote>
<p>Now you may start enjoying how AS3 talks to your Java Object. However, if&nbsp; we bypass the Servlet layer in the code, how can we carry session across remote method calls? Great that I have found out how to handle it via this <a href="http://sujitreddyg.wordpress.com/2008/05/16/session-data-management-in-flex-remoting/">article</a>. In short, you can access Session from your Java object via:</p>
<blockquote>
<p>FlexContext.getFlexSession()</p>
</blockquote>
<p>Here is the quote I got from the <a href="http://livedocs.adobe.com/blazeds/1/blazeds_devguide/">BlazeDS developer guide</a>.</p>
<blockquote>
<p>The FlexContext class is useful for getting access to the session and the HTTP pieces of the session, such as the HTTP servlet request and response. This lets you access HTTP data when you use a Flex application in the context of a larger web application where other classes, such as JSPs or Struts actions, might have stored information.</p>
<p>The FlexSession class provides access to an ID and also provides <samp class="codeph">setAttribute</samp> and <samp class="codeph">getAttribute</samp> functionality. This is useful for storing data on the server that doesn&#8217;t have to go back to the client. However, FlexSession is not cluster-aware; if a client connects to a different server in the cluster, the client receives a new FlexSession. Nothing stored in the FlexSession attributes is persisted for clustering purposes. The FlexSessionListener class is useful for monitoring who is connected. You add a listener by using the static method to track new connections being made. You receive a reference to the session that was added. Each session can then report when it is destroyed to those same listeners. You use this for monitoring connections that close, and also to clean up resources.</p>
</blockquote>
<p>When I looked into the source of FlexContext, I noticed that it leverages <strong>ThreadLocal </strong>to store context info like request, response and session.</p>
<pre name="code" class="java">
    private static ThreadLocal sessions = new ThreadLocal();
    /**
     * The FlexSession for the current request.  Available for users.
     */
    public static FlexSession getFlexSession()
    {
        return (FlexSession)sessions.get();
    }
</pre>
<h2>Reference</h2>
<p>Below are some of the useful references I have read so far:</p>
<ol>
<li><a href="http://jim-boone.com/2008/04/10/ria-prototype-client-using-blazeds-messaging-and-jms-j2ee-server/#more-33">Jim Boone&#8217;s Blog</a></li>
</ol>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-remoting-and-session-management/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Power up Salesforce UI via Flex</title>
		<link>http://www.solutionhacker.com/uncategorized/power-up-salesforce-ui-via-flex/</link>
		<comments>http://www.solutionhacker.com/uncategorized/power-up-salesforce-ui-via-flex/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 09:27:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[4.2. Visualize Your Data]]></category>
		<category><![CDATA[6. Uncategorized]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[remoting]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[visualforce]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/?p=151</guid>
		<description><![CDATA[Get started Follow the steps below to get your first Flex salesforce app up in Salesforce. Register a developer edition account from Salesforce. Note: Dev account never expires but the account does come with a few limitations. You can only have two users, one an admin account so that you can build and install applications [...]]]></description>
			<content:encoded><![CDATA[<h2>Get started</h2>
<p>Follow the steps below to get your first Flex salesforce app up in Salesforce.</p>
<ol>
<li><a href="http://www.solutionhacker.com/wp-admin/post-new.php">Register </a>a developer edition account from Salesforce. <strong>Note</strong>: <span id="intelliTxt">Dev account never expires but the account does come with a few limitations. You can only have two users, one an admin account so that you can build and install applications and the other a normal user account so you can test your work from the perspective of a normal user. The account has a <strong>2MB </strong>data limit and you can send mass email. However, It is totally fine for playing around all the features that Salesforce provides. <br />
    </span></li>
<li><a href="https://wiki.apexdevnet.com/index.php?title=Special:Userlogin&amp;returnto=Members:Flex_Toolkit_download">Download</a> the Flex Salesforce Toolkit (ie. force.com-air_flex-1.0.zip). This toolkit provides the needed <strong>libraries </strong>to communicate  directly with your salesforce.com <strong>database records </strong>from within  a Flex application, using <strong>native ActionScript </strong>packages and  returning strongly typed classes.The documentation on the classes can be found  <a href="http://www.adnsandbox.com/media/flexsdk/docs/index.html">here</a>.</li>
<li>In this zip file, there is a library called <strong>as3Salesforce.swc</strong> in the bin  directory just off the root of this zip file. It is the library you need to associate to your Flex project.</li>
<li>Create a Flex project and include the swc library in it.</li>
<li>You can follow this <a href="http://www.apexdevnet.com/media/FlexArticleScreencast/flexscreencast.swf">screencast </a>to get your first project up.</li>
</ol>
<h2>What you can do after that?</h2>
<p>Now you have your Flex application run locally in Salesforce. Here is my TODO list and the solutions of each one.</p>
<ol>
<li>Run your app under your own website and pull info from Salesforce using the same api.</li>
<li>Run your app under Salesforce and have it pulled data from your system thru Flex Remoting (HTTPService, WebService, RemoteObject&#8230;etc).</li>
<li>Can we use the API to pull Salesforce metadata like SControl?</li>
<li>How can we provide our application via Apex Exchange?
<ul>
<li><a href="http://www.oreillynet.com/pub/a/network/2006/11/13/an-introduction-to-saleforcecoms-appexchange.html">Introduction of Salesforce&#8217;s AppExchange</a></li>
<li><a href="http://www.oreillynet.com/pub/a/network/2006/11/27/using-the-salesforcecom-api.html">Using Salesforce&#8217;s API</a></li>
<li><a href="http://www.oreillynet.com/pub/a/network/2007/01/22/packaging-for-salesforcecom-appexchange.html">Packaging for salesforce&#8217;s appexchange</a> </li>
</ul>
</li>
<li>How can we use the Salesforce Flex AIR Toolkit to make have your application deal with Salesforce in offline mode? Look into this article.</li>
</ol>
<h2>What Flex gives you but not original Salesforce UI?</h2>
<p>Now you know how to integrate Flex with Salesforce. But what problems that Flex helps us solving but not the original Salesforce UI?</p>
<ol>
<li>Capture user events on the fly and display additional fields or populate bunch of fields.</li>
<li>Visual the data via Flex charting.</li>
<li>Full control on the layout, and look and feel.</li>
</ol>
<p>&nbsp;&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/uncategorized/power-up-salesforce-ui-via-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe AIR vs Google Gear</title>
		<link>http://www.solutionhacker.com/data-intelligence/data-visualization/adobe-air-vs-google-gear/</link>
		<comments>http://www.solutionhacker.com/data-intelligence/data-visualization/adobe-air-vs-google-gear/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 18:24:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[4.2. Visualize Your Data]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/2008/04/16/adobe-air-vs-google-gear/</guid>
		<description><![CDATA[When you come to the world of offline/disconnected application, you will hear the new buzzwords &#8211; AIR and Gear. Before I talked about these technologies, I want to talk about what problem we are trying to solve first. What we need an application to be able to function offline? First, Internet access is not everywhere. [...]]]></description>
			<content:encoded><![CDATA[<p>When you come to the world of offline/disconnected application, you will hear the new buzzwords &#8211; AIR and Gear. Before I talked about these technologies, I want to talk about what problem we are trying to solve first. What we need an application to be able to function offline? First, Internet access is not everywhere. When you are on the plane, at the coffee shop, on the Maui beach etc, you may not be able to connect to your favorite Web applications. What if you want to look at some of your reports? I would like to see the traffics statistics for my own little <a target="_blank" href="http://www.justproposed.com">wedding website company &#8211; Jusproposed.com</a>. However, I don&#8217;t see Google Analytics available offine <img src='http://www.solutionhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>OK. There is need for it. Although the need may go away once the whole world is wired by WiFi or other technologies (may still take a while), we may want to solve this problem to improve user experience. Here is how the problem get solved in high level?</p>
<ol>
<li>User request is captured locally.</li>
<li>All your operation is handled locally to the local database.</li>
<li>When Internet access is available, synchronize the local database with the server database.</li>
</ol>
<p><strong>How Gear solves this? </strong>(I learn it <a href="www.colettas.org/?p=116">here</a>)</p>
<ol>
<li>LocalServer module captures browser HTTP and HTTPS requests if there is no internet access (Browser plugin works only with Firefox 1.5+ and IE6).</li>
<li>Database module (uses SQLite) stores the updates and provides the information needed. (<a target="_blank" href="http://www.mikechambers.com/blog/2007/05/30/apollo-beta-will-include-sqlite-embedded-database/">news</a>).Â When Internet access is available, it willÂ do the synchronization work for you automatically.</li>
<li>Google gear also provides background processing mechanism taht allows I/O or compute-intensive Javascript to run without blocking the user interface.</li>
</ol>
<p><strong>How AIR solves this?</strong></p>
<ol>
<li>Adobe AIR is desktop application that runs without browser.</li>
<li>Apollo provides SQLite as well for storing the updates and provides the information needed.</li>
<li>Sync module will do the synchronization work when Internet access is available.</li>
</ol>
<p><strong>My preference</strong></p>
<p>I have to pick either one of them. I would select AIR b/c ilike the power of Flex in UI. So, if AIR solves the problem, I may just stick with it. Simple?!! <img src='http://www.solutionhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Since I am working for the Performance Ad Network right now, if I can pull enough data across the wire and store it locally, then I can run OLAP and other complex queries and visualize the data with the advanced data grid and charting available in Flex, that will be awesome!</p>
<p>Update: Flex and Gear actually can work together! (Someone <a target="_blank" href="http://coenraets.org/blog/2007/06/flex-and-google-gears-sales-force-automation-application-with-offline-capabilities/">demonstrates </a>this combination via building a sales force application)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/data-intelligence/data-visualization/adobe-air-vs-google-gear/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Remoting &#8211; AMF</title>
		<link>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-remoting-amf/</link>
		<comments>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-remoting-amf/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 12:21:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[4.2. Visualize Your Data]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/2008/03/30/flex-remoting-amf/</guid>
		<description><![CDATA[Open up FDS? Adobe announced that it will open source the strip down version of LiveCycle Data Service called BlazeDS. From what I heard, BlazeDS provides AMF3 remoting without data management and its data push solution is not so scalable as LCDS. (features comparsion chart). The reason is that BlazeDB still uses the blocking IO [...]]]></description>
			<content:encoded><![CDATA[<h2><strong>Open up FDS?</strong>  </h2>
<p>Adobe announced that it will open source the strip down version of LiveCycle Data Service called BlazeDS. From what I heard, BlazeDS provides AMF3 remoting without data management and its data push solution is not so scalable as LCDS. (<a target="_blank" href="http://sujitreddyg.wordpress.com/2008/01/31/blazeds-and-lcds-feature-difference/">features comparsion chart). </a>The reason is that BlazeDB still uses the blocking IO to handle connections whereas LCDS uses Java NIO. The power of Java NIO is that the server thread will not be held up for the connection during the request is in process. (Detail <a target="_blank" href="http://sujitreddyg.wordpress.com/2008/02/04/blazeds-and-lcds-performace-difference/">here</a>).  So, BlazeDB is only good for tasting the power of AMG remoting and learning how AMG protocol being implemented.  </p>
<h2><strong>Future of GraniteDS</strong>  </h2>
<p>However, if all you need a solid AMF solution to connect Flex 2 with Java, take a look at GraniteDS. I heard that it does a great job. However, GraniteDS may become obsolete soon as the founder, Franck Wolff, seemed a bit caught off guard and unsure what the future held for GraniteDS. However, finally he decided to continue GDS development. Here are why GDS is still better than BlazeDS:</p>
<ol>
<li><strong>BlazeDS</strong> does not offer any data management features.</li>
<li><strong>FDS/LCDS</strong> has it own (proprietary and closed) data management system, offers (officially supported?) service factories for Spring and Hibernate (but without any lazy-loading support) and is, <em>say</em>, expensive.</li>
<li><strong>GraniteDS</strong> integrates with known enterprise J2EE persistence systems such as EJB3 (session and entity beans with full lazy-loading support) and with wildly used and open source frameworks such as Spring (with Acegi security) or JBoss/Seam (with conversation scope support &#8211; <em>new, coming in the next release</em>).</li>
<li><strong>GraniteDS</strong> provides a fast and powerful ActionScript3 code generator (Gas3): you just have to write your database model (EJB3 entity beans), Gas3 will generate corresponding ActionScript3 beans and Hibernate code generation tools will create your database tables. So, from an enterprise point of view, GraniteDS does not really compare to BlazeDS and, on the other hand, it seems to be <em>still</em> a powerful and free alternative to FDS/LCDS.</li>
</ol>
<p>Update: GraniteDS 1.0 is released. Here is an <a target="_blank" href="http://www.infoq.com/news/2008/02/granite-data-services">article </a>that discusses this release. </p>
<h2><strong>How about WebORB?</strong>  </h2>
<p>I also heard that WebORB is a powerful alternative to LCDS (compare them <a target="_blank" href="http://mxdj.sys-con.com/read/474885.htm">here</a>). Again it is Free! However, it is not open source and its license may constraint you doing some interesting things. I will check this out more. However, here is a promising comment from the director of scrapblog.com &#8211; a fancy Flex example on Web.  <em>&quot;Scrapblog.com needed a remoting solution to use with Flex 2, as it currently only supports Java. I didn&#8217;t think twice when choosing WebORB for this task. Version 3.0 [of WebORB] is simply amazing. You won&#8217;t experience the flexibility and responsiveness that WebORB offers with any other remoting solution. My hat goes off to Midnightcoders, keep the great work.&quot; &#8211; Omar Ramos, Scrapblog&#8217;s Director of R&amp;D.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-remoting-amf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex &#8211; Power of E4X</title>
		<link>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-power-of-e4x/</link>
		<comments>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-power-of-e4x/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 17:21:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[4.2. Visualize Your Data]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/2008/03/20/flex-power-of-e4x/</guid>
		<description><![CDATA[E4X is similar to XPath that is used to manipulate the structural xml in a scripting language. Here are some examples: Delete node from XML &#60;root&#62; &#60;level&#62; &#60;detail&#62;&#60;/detail&#62; &#60;/level&#62; &#60;level&#62; &#60;detail&#62;&#60;/detail&#62; &#60;/level&#62; &#60;/root&#62; I want to make a copy of this XML (could be either of the three types of XML objects) and remove the [...]]]></description>
			<content:encoded><![CDATA[<p>E4X is similar to XPath that is used to manipulate the structural xml in a scripting language. Here are some examples:</p>
<p><strong>Delete node from XML</strong></p>
<blockquote><p>&lt;root&gt;<br />
&lt;level&gt;<br />
&lt;detail&gt;&lt;/detail&gt;<br />
&lt;/level&gt;<br />
&lt;level&gt;<br />
&lt;detail&gt;&lt;/detail&gt;<br />
&lt;/level&gt;<br />
&lt;/root&gt;</p></blockquote>
<p>I want to make a copy of this XML (could be either of the three types of XML objects) and remove the &lt;detail&gt; nodes from every node no matter that hiarchy they are in.</p>
<blockquote><p>private function testXML():void {<br />
var xml:XML =<br />
&lt;root&gt;&lt;level&gt;&lt;detail&gt;&lt;/detail&gt;&lt;/level&gt;&lt;level&gt;&lt;detail&gt;&lt;/detail&gt;&lt;/level&gt;&lt;/root&gt;<br />
var test:XML = xml.copy();<br />
delete test..*.detail;<br />
trace(test.toXMLString());<br />
}</p></blockquote>
<p><strong>Add new node to XML</strong></p>
<blockquote><p>var newItem:XML =<br />
&lt;level id=&#8217;1&#8242;&gt;<br />
&lt;detail&gt;&lt;/detail&gt;<br />
&lt;/level&gt;<br />
test.appendChild(newItem);</p></blockquote>
<p><strong> Traverse</strong></p>
<blockquote><p> var myXML:XML =<br />
&lt;order&gt;<br />
&lt;item id=&#8217;1&#8242;&gt;<br />
&lt;menuName&gt;burger&lt;/menuName&gt;<br />
&lt;price&gt;3.95&lt;/price&gt;<br />
&lt;/item&gt;<br />
&lt;item id=&#8217;2&#8242;&gt;<br />
&lt;menuName&gt;fries&lt;/menuName&gt;<br />
&lt;price&gt;1.45&lt;/price&gt;<br />
&lt;/item&gt;<br />
&lt;/order&gt;</p>
<p>myXML.item[0].menuName (for element traverse, use index to identify an element)<br />
myXML.item.(@id=2).menuName (search an element using its attribute @)<br />
myXML.item.(menuName==&#8221;xxx&#8221;).price</p>
<p>var total:Number = 0;<br />
for each (var property:XML in myXML.item) {<br />
var q:int = Number(property.@quantity);<br />
var p:Number = Number(property.price);<br />
var itemTotal:Number = q * p;<br />
total += itemTotal;<br />
trace (q + &#8221; &#8221; + property.menuName + &#8221; $&#8221; + itemTotal.toFixed(2))<br />
}<br />
trace (&#8220;Total: $&#8221;, total.toFixed(2));</p></blockquote>
<p><strong> Assignment</strong></p>
<blockquote><p>myXML.item[0].menuName=&#8221;regular burger&#8221;;<br />
myXML.item[1].menuName=&#8221;small fries&#8221;;<br />
myXML.item[2].menuName=&#8221;medium cola&#8221;;</p>
<p>myXML.item.(menuName==&#8221;regular burger&#8221;).@quantity = &#8220;2&#8243;;<br />
myXML.item.(menuName==&#8221;small fries&#8221;).@quantity = &#8220;2&#8243;;<br />
myXML.item.(menuName==&#8221;medium cola&#8221;).@quantity = &#8220;2&#8243;;</p>
<p>var myXML:XML =<br />
&lt;order&gt;<br />
&lt;book ISBN=&#8221;0942407296&#8243;&gt;<br />
&lt;title&gt;Baking Extravagant Pastries with Kumquats&lt;/title&gt;<br />
&lt;author&gt;<br />
&lt;lastName&gt;Contino&lt;/lastName&gt;<br />
&lt;firstName&gt;Chuck&lt;/firstName&gt;<br />
&lt;/author&gt;<br />
&lt;pageCount&gt;238&lt;/pageCount&gt;<br />
&lt;/book&gt;<br />
&lt;book ISBN=&#8221;0865436401&#8243;&gt;<br />
&lt;title&gt;Emu Care and Breeding&lt;/title&gt;<br />
&lt;editor&gt;<br />
&lt;lastName&gt;Case&lt;/lastName&gt;<br />
&lt;firstName&gt;Justin&lt;/firstName&gt;<br />
&lt;/editor&gt;<br />
&lt;pageCount&gt;115&lt;/pageCount&gt;<br />
&lt;/book&gt;<br />
&lt;/order&gt;</p>
<p>myXML.book &#8211;&gt; XMLList (direct children of myXML object that has element name &#8220;book&#8221;)<br />
myXML..lastName &#8211;&gt; XMLList (any descendant that has element name &#8220;lastName&#8221;)<br />
myXML.book.author.lastName &#8211;&gt; XMLList<br />
myXML.book[0]<br />
myXML.book[0].title<br />
myXML.child(&#8220;book&#8221;).title<br />
myXML.book.(@ISBN=&#8217;0942407296&#8242;)<br />
myXML.book[0].@ISBN &#8211;&gt; output 0942407296<br />
myXML.book.(title==&#8217;Emu Care and Breeding&#8217;)<br />
myXML.book.(pageCount &gt; 100)<br />
myXML.book.(title.toString().search(&#8216;Emu&#8217;) &gt; -1)</p>
<p>var myXML:XML =<br />
&lt;order&gt;<br />
&lt;item id=&#8217;1&#8242; quantity=&#8217;2&#8242;&gt;<br />
&lt;menuName&gt;burger&lt;/menuName&gt;<br />
&lt;price&gt;3.95&lt;/price&gt;<br />
&lt;/item&gt;<br />
&lt;item id=&#8217;2&#8242; quantity=&#8217;2&#8242;&gt;<br />
&lt;menuName&gt;fries&lt;/menuName&gt;<br />
&lt;price&gt;1.45&lt;/price&gt;<br />
&lt;/item&gt;<br />
&lt;/order&gt;;</p>
<p>var total2:Number = 0;<br />
for each (var prop:XML in myXML.item) {<br />
total2 += prop.@quantity * prop.price;<br />
}</p></blockquote>
<p>http://www.devx.com/Java/Article/21383/1763/page/1</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-power-of-e4x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3 &#8211; Advanced DataGrid</title>
		<link>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-3-advanced-datagrid/</link>
		<comments>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-3-advanced-datagrid/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 07:34:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[4.2. Visualize Your Data]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/2008/03/03/flex-3-advanced-datagrid/</guid>
		<description><![CDATA[Since I am leading the reporting team in Adconion, I would like to spend sometime on the new component &#8220;Advanced Data Grid&#8221; from Flex 3. Being excited to know that this component has added many cool features on top of the DataGrid, I would like to find out whether it meets all my needs. Before [...]]]></description>
			<content:encoded><![CDATA[<p>Since I am leading the reporting team in Adconion, I would like to spend sometime on the new component &#8220;Advanced Data Grid&#8221; from Flex 3. Being excited to know that this component has added many cool features on top of the DataGrid, I would like to find out whether it meets all my needs. Before I introduce it to my company, I would like to write an example to exercise its power first. The example below will demonstrate some documented features in Advanced Data Grid and some custom features that I would like in my project. To make the example prettier, I would use Yahoo Flex Skin.</p>
<p><strong>Yahoo Flex Skin</strong></p>
<p><a href="http://developer.yahoo.com/flash/articles/assets/flex-skinning/yflexskin.html" target="_blank" title="yahooflexskin.JPG"><img src="http://www.solutionhacker.com/wp-content/uploads/2008/03/yahooflexskin.JPG" alt="yahooflexskin.JPG" /></a></p>
<p>Apart from providing you flex skin, Yahoo also shares with you some custom-made flex components. Among them, I  would like to look into Yahoo Map once I have time. (<a href="http://developer.yahoo.com/flash/maps/examples.html" target="_blank">http://developer.yahoo.com/flash/maps/examples.html</a>). However, it is out of my scope today.</p>
<p><strong>What I want to show you in my example</strong><br />
There are some cool features I want to try out in this example. Here is the list:</p>
<ol>
<li>Grouping</li>
<li>Tree view with &#8220;Expand All&#8221; and &#8220;Shrink All&#8221; features.</li>
<li>Multiple columns sorting</li>
<li>Auto-completed search filter</li>
<li>Smart resizing data grid</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-3-advanced-datagrid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex &#8211; Store data in client via SharedObject</title>
		<link>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-store-data-in-client-via-sharedobject/</link>
		<comments>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-store-data-in-client-via-sharedobject/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 18:41:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[4.2. Visualize Your Data]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/2007/12/05/flex-store-data-in-client-via-sharedobject/</guid>
		<description><![CDATA[IntroductionÂ  The SharedObject class functions like a browser cookie. You use the class to store data on the user&#8217;s local hard drive and call that data during the same session or in a later session. Below are the keys of using SharedObject: Applications can only access their own SharedObject data, and only if they are [...]]]></description>
			<content:encoded><![CDATA[<p><strong>IntroductionÂ </strong></p>
<p>The SharedObject class functions like a browser cookie. You use the class to store data on the user&#8217;s local hard drive and call that data during the same session or in a later session. Below are the keys of using SharedObject:</p>
<ol>
<li>Applications can only access their own SharedObject data, and only if they are running on the same domain. The data is not sent to the server and is not accessible by other Flex applications running on other domains.</li>
<li>When you create a SharedObject, Macromedia Flash Player creates a new directory for the application and domain, and creates an empty <strong>*.sol</strong> file that stores the SharedObject data. The default location of this file is in a subdirectory of the user&#8217;s home directory.</li>
<li>By default, Flash can save locally persistent SharedObjects of up to 100K in size. When you try to save a larger set of data, Flash Player displays the Local Storage dialog box, which lets the user allow or deny local storage for the domain that is requesting access.</li>
<li>Some important methods:
<ul>
<li>clear()</li>
<li>flush() &#8211; write to the file. If not, flex persists it when the application is closed. However, this does not provide the user with an opportunity to increase the available space</li>
<li>getLocal(&#8220;name&#8221;)</li>
<li>getSize()</li>
</ul>
</li>
<li>You can store simple data types in a SharedObject. These types are <strong>Number, String, Boolean, XML, Date, Array, and Object.</strong> After you assign values to the data property, you must instruct Flash Player to write those values to the SharedObject&#8217;s file. To force Flash Player to write the values to the SharedObject&#8217;s file, use the flush()  method:</li>
</ol>
<p><code>sharedObject_ID.data.variable = value; //store data<br />
</code></p>
<p><strong>LSO vs Cookie</strong></p>
<ol>
<li>LSOs are can store more data than cookies</li>
<li>LSOs never expire</li>
<li>LSOs arent transmitted between the client and the server</li>
<li>LSOs can store native ActionScript datatypes.Â </li>
</ol>
<p><strong>Reference</strong></p>
<p><a href="http://www.adobe.com/support/documentation/en/flex/1/lsos/lsos5.html">http://www.adobe.com/support/documentation/en/flex/1/lsos/lsos5.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/data-intelligence/data-visualization/flex-store-data-in-client-via-sharedobject/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
