<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>DreamingWell - Articles</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/" />
<modified>2010-04-14T21:50:02Z</modified>
<tagline></tagline>
<id>tag:dreamingwell.com,2010:/articles/2</id>
<generator url="http://www.movabletype.org/" version="4.25">Movable Type</generator>
<copyright>Copyright (c) 2010, wildag</copyright>

<entry>
<title>Scrollable Flex Charts</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2010/04/scrollable-flex.php" />
<modified>2010-04-14T21:50:02Z</modified>
<issued>2010-04-14T21:29:53Z</issued>
<id>tag:dreamingwell.com,2010:/articles/2.54</id>
<created>2010-04-14T21:29:53Z</created>
<summary type="text/plain">The majority of the work in this project was taken directly from MaximPorges.com article on Scrolling Large Data Sets in Flex Charts. The code posted in that article works very well for horizontal scrolling, but not at all for vertical...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>The majority of the work in this project was taken directly from MaximPorges.com article on <a href="http://www.maximporges.com/2008/11/15/scrolling-large-data-sets-in-flex-charts/">Scrolling Large Data Sets in Flex Charts</a>. The code posted in that article works very well for horizontal scrolling, but not at all for vertical scrolling. Several commenters on that page have posted needing vertical scrolling, and at least one noted that they'd made a fix. I was unable to find their fix, so I made my own. </p>]]>
<![CDATA[<p><br />
Below is a Flex Builder 3 project zip that includes my changes. This code works well for both vertical and horizontal scrolling, as a custom Chart Axis Renderer. Use the links below to see the working example, and the source code. </p>

<p><a href="http://dreamingwell.com/examples/flex/scrollableGraph/ScrollingChartsWithAxisRenderer.html">Working Example</a></p>

<p><a href="http://dreamingwell.com/examples/flex/scrollableGraph/srcview/">Source Code</a></p>]]>
</content>
</entry>

<entry>
<title>Excluding all but one directory in ASDoc 3</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2009/12/excluding-direc.php" />
<modified>2009-12-17T20:05:44Z</modified>
<issued>2009-12-17T19:03:52Z</issued>
<id>tag:dreamingwell.com,2009:/articles/2.53</id>
<created>2009-12-17T19:03:52Z</created>
<summary type="text/plain">ActionScript Doc (ASDoc) is a utility that ships with the Flex 3 SDK that generates documentation based on ActionScript code; its very similar to JDoc and JSDoc for Java and JavaScript. While ASDoc does have many handy features, one major...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>ActionScript Doc (ASDoc) is a utility that ships with the Flex 3 SDK that generates documentation based on ActionScript code; its very similar to JDoc and JSDoc for Java and JavaScript. While ASDoc does have many handy features, one major feature it lacks is the ability to limit generated documentation to a single directory/package of classes. Here is Adobe&#8217;s <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=asdoc_3.html">ASDoc command line guide</a>. </p>

<p>ASDoc supports excludes only by class name. You can use the -doc-sources command line option to specify a single sub directory/package, but then ASDoc will follow dependencies and generate documentation for those. There is an -exclude-dependencies command line option, but you can&#8217;t use it in conjunction with -doc-sources. There is also a -doc-classes, but exclude dependencies seems to have no effect. </p>

<p>The solution then is to specifically exclude all classes, by individual name. This would be too tedious to perform by hand, and wouldn&#8217;t be sustainable for development in teams. </p>

<p>I found a great article named <a href="http://www.amp-london.com/blog/2009/05/11/compiling-relevant-classes-in-asdoc/">Compiling Relevant Class in ASDoc</a> at AMP-London.com, that thoroughly explains how to exclude a single directory/package. However, I wanted a script that would exclude all directories/packages but my own from any project.  So I reworked their ANT build script and came up with my own. </p>

<p>The following ANT buildscript, which is based heavily on the one the one mentioned above, runs ASDoc on all classes in a single package, and excludes all others. </p>

<div class="code">
<pre>
&lt;project name=&quot;AsDocTest&quot; default=&quot;main&quot; basedir=&quot;.&quot;&gt;

    &lt;!-- The location of your FlexSDK directory --&gt;
        &lt;property name=&quot;FlexSDK.dir&quot; location=&quot;/Applications/Adobe Flex Builder 3/sdks/3.4.0&quot;/&gt;

        &lt;!-- The location of the ASDoc executable --&gt;
        &lt;property name=&quot;bin.dir&quot; location=&quot;${FlexSDK.dir}/bin&quot;/&gt;        

        &lt;!-- The output directory for your documentation --&gt;
        &lt;property name=&quot;output.dir&quot; location=&quot;${basedir}/asdoc-output&quot;/&gt;

        &lt;!-- SWC file library path --&gt;
        &lt;property name=&quot;swcLibraryPaths&quot; value=&quot;libs&quot;/&gt;

        &lt;!-- The root to your class package directory --&gt;
        &lt;property name=&quot;classesRoot&quot; value=&quot;${basedir}/src&quot;/&gt;

        &lt;!-- the directory/package that you'd like to document, all others will be excluded --&gt;
        &lt;property name=&quot;includedDirectory&quot; value=&quot;/com/edge/&quot; /&gt;

        &lt;!-- the ant description of this script --&gt;
        &lt;target name=&quot;main&quot; depends=&quot;clean,manifest,asdocme&quot; description=&quot;full build of asdocs&quot;/&gt;

        &lt;!-- erase all previous asdoc output --&gt;
        &lt;target name=&quot;clean&quot;&gt;
                &lt;delete dir=&quot;${output.dir}&quot; failOnError=&quot;false&quot; includeEmptyDirs=&quot;true&quot;/&gt;
                &lt;mkdir dir=&quot;${output.dir}&quot;/&gt;
        &lt;/target&gt;

        &lt;target name=&quot;manifest&quot;&gt;

                &lt;!-- Get the list of all files, exclude those that we wish to document (not a typo) --&gt;
                &lt;fileset id=&quot;sources&quot; dir=&quot;${basedir}/src&quot;&gt;
                        &lt;exclude name=&quot;**${includedDirectory}**&quot;/&gt;
                &lt;/fileset&gt;

               &lt;!-- convert the names of excldued classes to packages with class names --&gt;
                &lt;pathconvert property=&quot;classes&quot; pathsep=&quot; &quot; refid=&quot;sources&quot;&gt;
                        &lt;chainedmapper&gt;
                                &lt;globmapper from=&quot;${basedir}/src/*&quot; to=&quot;*&quot;/&gt;
                                &lt;mapper type=&quot;package&quot; from=&quot;*.as&quot; to=&quot;*&quot;/&gt;
                        &lt;/chainedmapper&gt;
                &lt;/pathconvert&gt;

                &lt;!-- echo the exlcusions for debugging purposes --&gt;
                &lt;echo message=&quot;manifest = ${classes}&quot;/&gt;

        &lt;/target&gt;

        &lt;!-- Run asdoc --&gt;
        &lt;target name=&quot;asdocme&quot;&gt;

                &lt;exec executable=&quot;${bin.dir}/asdoc&quot; failonerror=&quot;true&quot;&gt;

                        &lt;!-- define the src path of the package directory --&gt;
                        &lt;arg line=&quot;-source-path '${basedir}/src'&quot;/&gt;

                        &lt;!-- tell asdoc to include all sources under the root --&gt;
                        &lt;arg line=&quot;-doc-sources '${classesRoot}'&quot;/&gt;     

                        &lt;!-- define the output directory ---&gt;
                        &lt;arg line=&quot;-output '${output.dir}'&quot;/&gt;

                        &lt;!-- define the location of any swcs we're using --&gt;   
                        &lt;arg line=&quot;-external-library-path=${swcLibraryPaths}&quot;/&gt;

                        &lt;!-- define the excluded classes (all of them outside our included directory) --&gt;
                        &lt;arg line=&quot;--exclude-classes ${classes} --&quot;/&gt;

                &lt;/exec&gt;
        &lt;/target&gt;
&lt;/project&gt;
</pre>
</div>
]]>


</content>
</entry>

<entry>
<title>Generating ASDocs in Flex Builder 3</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2009/09/generating-asdo.php" />
<modified>2009-09-29T18:57:57Z</modified>
<issued>2009-09-29T18:38:11Z</issued>
<id>tag:dreamingwell.com,2009:/articles/2.52</id>
<created>2009-09-29T18:38:11Z</created>
<summary type="text/plain">ASDoc&apos;s plethora of command line options can be frustrating to contend with. Here&apos;s an easy way to generate ASDocs for any project in Flex Builder 3....</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>ASDoc's plethora of command line options can be frustrating to contend with. Here's an easy way to generate ASDocs for any project in Flex Builder 3.</p>]]>
<![CDATA[<ol>
	<li>Create a new "External Tool" 
<ol><li> Click Run -> External Tools -> Open External Tools Dialog</li>
<li>Click the "new" icon to create a new external tool</li>
</ol></li>

<p><li>Assign this tool the name "Generate ASDoc"</li><br />
<li>Under "Location" use the "Browse the filesystem button" to find the asdoc executable in your Flex SDK.<br />
<ul><br />
	<li>Mac OSX: /Applications/Adobe Flex Builder 3/sdks/3.3.0/bin/asdoc</li><br />
	<li>Windows: C:\Program Files\Adobe Flex Builder 3\sdks\3.3.0\bin\asdoc.exe</li><br />
</ul><br />
</li></p>

<p><li>Under "Working Directory" enter <i>${project_loc}</i></li><br />
<li>Under "Arguments" enter </p>

<pre style="code">-source-path=./src -doc-sources=./src -window-title="${project_name}" -main-title="${project_name}" -external-library-path=./libs</pre>

<p></li></p>

<p><li>Click "Apply"</li><br />
<li>Click "Close"</li></p>

<p>To generate ASDocs for any project in Flex Builder, click on the project in the "Flex Navigator" list, and then click the "External Tools" button (or Run->External Tools->Generate ASDoc).</p>

<p>The "Console" window will show the warning and error output from asdoc. The generated docs will be placed in a new folder named "asdoc-output" at the root of your project.</p>

<p>If you receive an error about "variable references ... ${project_loc}", you didn't click on your Flex project before clicking "Generate ASDocs".<br />
</ol></p>]]>
</content>
</entry>

<entry>
<title>Using IPTables to Block SSH Brute Force Attempts</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2009/08/using-iptables.php" />
<modified>2009-08-29T22:25:20Z</modified>
<issued>2009-08-29T22:11:45Z</issued>
<id>tag:dreamingwell.com,2009:/articles/2.51</id>
<created>2009-08-29T22:11:45Z</created>
<summary type="text/plain">Most Linux distributions have no SSH brute force counter measures &apos;out of the box&apos;. You can use this simple command line set to configure an IPTables rule that blocks SSH attempts from any IP after 3 failed ssh logins. iptables...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Linux</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>Most Linux distributions have no SSH brute force counter measures 'out of the box'. You can use this simple command line set to configure an IPTables rule that blocks SSH attempts from any IP after 3 failed ssh logins.</p>

<div class="code">

<p>iptables -N SSH_CHECK</p>

<p>iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j SSH_CHECK</p>

<p>iptables -A SSH_CHECK -m recent --set --name SSH</p>

<p>iptables -A SSH_CHECK -m recent --update --seconds 60 --hitcount 4 --name SSH -j DROP</p>

</div>

<p>Source: <a href="http://hostingfu.com/article/ssh-dictionary-attack-prevention-with-iptables">Hosting Fu</a></p>]]>

</content>
</entry>

<entry>
<title>Introducing ChargeWell.com, an online shopping cart for small businesses</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2009/03/introducing-cha.php" />
<modified>2009-03-10T15:57:27Z</modified>
<issued>2009-03-10T15:21:30Z</issued>
<id>tag:dreamingwell.com,2009:/articles/2.50</id>
<created>2009-03-10T15:21:30Z</created>
<summary type="text/plain">Today I&apos;m proud to announce the first open beta of a new online shopping cart at ChargeWell.com! We&apos;ve made available a limited number of free accounts. Just use the &quot;Register&quot; button at the top right of ChargeWell.com. ChargeWell is a...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Javascript</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>Today I'm proud to announce the first open beta of a new online shopping cart at <a href="http://www.chargewell.com">ChargeWell.com</a>! We've made available a limited number of free accounts. Just use the "Register" button at the top right of ChargeWell.com.</p>

<p><a href="http://www.chargewell.com">ChargeWell</a> is a shopping cart that can be placed on your current website, in under 20 minutes! There's no software to install on your server, and you don't need a developer. ChargeWell is added to your site with just five lines of javascript; that we'll give you. The cart appears in a "lightbox" over your website. Be sure to checkout our <a href="http://www.chargewell.com/demos">demos</a>!</p>

<p>ChargeWell is starting out with support for both Google Checkout and PayPal. If you offer Google Checkout, you'll also automatic Google Analytics integration. In the future we plan to add support for direct credit card processing and other 3rd party processors.</p>

<p>The beta already has tons of features like tax calculations, custom shipping options, inventory tracking, ordering options and a complete invoicing system. We're soliciting your feedback for new features, so please <a href="http://www.chargewell.com/contact">drop us a line</a> or catch us on <a href="http://www.twitter.com/chargwell">Twitter</a>!</p>

<p>All of ChargeWell's future announcements will be made on <a href="http://www.chargewell.com/blog">ChargeWell's Blog</a>.</p>]]>

</content>
</entry>

<entry>
<title>Speed web page rendering by combining JavaScript and CSS files, with PHP and Memcached</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2009/03/speed-web-page.php" />
<modified>2009-03-09T03:20:05Z</modified>
<issued>2009-03-09T02:29:13Z</issued>
<id>tag:dreamingwell.com,2009:/articles/2.49</id>
<created>2009-03-09T02:29:13Z</created>
<summary type="text/plain">Web browsers have built-in logic that determines when linked resources such as JavaScript and CSS are downloaded. Because of the nature of JavaScript execution and CSS rendering, the browser may delay it&apos;s request for each resource, even when that&apos;s detrimental...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Javascript</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>Web browsers have built-in logic that determines when linked resources such as JavaScript and CSS are downloaded. Because of the nature of JavaScript execution and CSS rendering, the browser may delay it's request for each resource, even when that's detrimental to speed at which the page is rendered. Tools such as <a href="http://developer.yahoo.com/yslow/">Yahoo! YSLow for Firebug</a> will help you determine when this is a problem. You can simply combine all of the JavaScript and/or CSS files into a single .js or .css file at the server. The browser will then need only download that single combined JavaScript or CSS file. This article will show you how to use Memcached, in PHP, to automatically combine files in an efficient method. </p>

<p>The following image shows resource downloads as individual javascript files. As you can see, the requests for individual .js files are delayed, even though that may not be necessary.</p>

<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://dreamingwell.com/articles/archives/assets_c/2009/03/Picture 1.php" onclick="window.open('http://dreamingwell.com/articles/archives/assets_c/2009/03/Picture 1.php','popup','width=968,height=426,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">View image</a></span></p>

<p>By combining the sources of JavaScript files, the we can reduce the total time to load the JavaScript code, and thereby dramatically decrease the total rendering time. The following image shows the same time graph after combining the JavaScript files.</p>

<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://dreamingwell.com/articles/archives/assets_c/2009/03/Picture 2.php" onclick="window.open('http://dreamingwell.com/articles/archives/assets_c/2009/03/Picture 2.php','popup','width=662,height=187,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">View image</a></span></p>

<p>While speed is our goal in production environments, the ability to debug efficiently is a goal in development environments. Combining JavaScript files into a single long file makes debugging extremely difficult. Therefore we must make some logical choices and implement a system that allows for both. </p>

<p>The following PHP code takes an array of relative path's to desired JavaScript files, and creates a simple Memcached buffer of the combined result, only in the production environment. An MD5 hash of the concatenated filenames is used as the unique key.<br />
<div class="code"></p>

<p>/* An array of JavaScript files to be included in our page */<br />
$javaScriptFiles[] = "/v1/yui/yahoo-dom-event/yahoo-dom-event.js";<br />
$javaScriptFiles[] = "/v1/yui/element/element-beta-min.js";<br />
$javaScriptFiles[] = "/v1/yui/datasource/datasource-min.js";<br />
$javaScriptFiles[] = "/v1/yui/datatable/datatable-min.js";<br />
$javaScriptFiles[] = "/v1/yui/element/element-beta-min.js";<br />
$javaScriptFiles[] = "/v1/yui/button/button-min.js";<br />
$javaScriptFiles[] = "/v1/yui/connection/connection-min.js";<br />
$javaScriptFiles[] = "/v1/yui/yahoo/yahoo-min.js"; <br />
$javaScriptFiles[] = "/v1/yui/event/event-min.js"; <br />
$javaScriptFiles[] = "/v1/yui/json/json-min.js"; </p>

<p>/* Determine whether this is the DEV server. If so, just write the javascript includes out as normal. */<br />
if($isDevServer) {<br />
/* Include individual files on DEV server */<br />
 foreach($javaScriptFiles as $javaScriptFile) {</p>

<p>	echo '<script type="text/javascript" src="$javaScriptFile.'"></script>'."\r\n";<br />
 }<br />
} else {<br />
	<br />
	/* create an MD5 hash of the file names */<br />
	$md5Str = "";<br />
	foreach($javaScriptFiles as $javaScriptFile) {<br />
		$md5Str .= $javaScriptFile;<br />
	}<br />
	<br />
	$md5Value = md5($md5Str);<br />
	<br />
 	/* Connect to the Memcached server */<br />
 	$memcache = new Memcache;<br />
	$memcache->connect('localhost', 11211) or die('unable to memcache');       </p>

<p>	if($buffer = $memcache->get('javaScript'.$md5Value)) {<br />
		/* Already in buffer, nothing to do */<br />
	} else { </p>

<p> 	 	/* scripts arn't in memcached, so add them */<br />
		$buffer = "";<br />
		foreach($javaScriptFiles as $javaScriptFile) {<br />
			$buffer .= file_get_contents($_SERVER["DOCUMENT_ROOT"].$javaScriptFile);<br />
		}<br />
	  <br />
	  $memcache->set('javaScript'.$md5Value,"".$buffer,0,1800);<br />
	}<br />
	<br />
	/* Write out the javascript file name */<br />
	echo '<script type="text/javascript" src="/js/collected/'.$md5Value.'.js"></script>'."\r\n";<br />
	<br />
} ?></p>

</div>

<p>Now create a "/js/collected" directory on your server and create the following .htaccess file. This redirects all HTTP requests for anything below /js/collected to an index.php file that we will create. </p>

<div class="code">
<pre>&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteCond %{REQUEST_URI} !index\.php$
RewriteRule .* ./index.php [L,QSA]
&lt;/IfModule&gt;</pre>
</div>

<p>Place the following code in an index.php file in the /js/collected directory. This file will be called, because of the .htaccess file. This file determines the Memcached key to use to find the requested javascript files and returns the combined output.</p>

<div class="code">

<p>/* Return a Javascript mime header */<br />
header('Content-type: application/javascript');</p>

<p>/* Determine the md5 file name from the URI requested */<br />
$urlParts = parse_url($_SERVER['REQUEST_URI']);</p>

<p>/* Find the mime type based on file extension */<br />
if(strrpos($urlParts["path"],".") === false)<br />
	$extension = "html";<br />
else<br />
	$extension = substr($urlParts["path"],strrpos($urlParts["path"], ".") +1);</p>

<p>$mimeType = $mimeTypes[$extension];<br />
$baseURI = "/v1/rest/";</p>

<p>$relativeURI = str_replace($baseURI,"",strtolower(str_replace(".".$extension,"",$urlParts["path"])));</p>

<p>$pathParts = split("/",$relativeURI);</p>

<p>$md5Value = $pathParts[4];</p>

<p>/* Connect to memcached */<br />
$memcache = new Memcache;<br />
$memcache->connect('localhost', 11211) or die('unable to memcache');       </p>

<p>/* Get the file contents out of memcached */<br />
if($buffer = $memcache->get('javaScript'.$md5Value)) {<br />
	<br />
	echo $buffer;<br />
	<br />
} else { </p>

<p>	echo "/* Memcached did not return a javascript file for the requested file */";<br />
}      </p>

</div>]]>

</content>
</entry>

<entry>
<title>Creating a scalable Flex Application with PHP, MemCached and AMF</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2009/02/creating-a-scal.php" />
<modified>2009-02-11T19:06:08Z</modified>
<issued>2009-02-11T14:42:33Z</issued>
<id>tag:dreamingwell.com,2009:/articles/2.48</id>
<created>2009-02-11T14:42:33Z</created>
<summary type="text/plain">MemCached is a free &quot;distributed memory object caching system&quot; that can work wonders on your application&apos;s responsiveness and server load. If your application does not need &quot;instantaneous&quot; data calculations for every user, you can use MemCached to greatly reduce your...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>PHP</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p><a href="http://www.danga.com/memcached/">MemCached</a> is a free "distributed memory object caching system" that can work wonders on your application's responsiveness and server load. If your application does not need "instantaneous" data calculations for every user, you can use MemCached to greatly reduce your server's processing load, thereby increasing the users/server ratio. This article explains the basic concepts that apply to any server language, and includes some sample Flex (AMF) and PHP code. </p>]]>
<![CDATA[<p><br />
<strong>Basic Concepts</strong></p>

<p>All client to server communication requires the server to perform a series of operations and return a result. For many communications, the server is performing the exact same series of operations, and returning the exact same result for every user. By caching (storing) the calculated results, and serving that cache back to the client, we can remove all of the repetitive processing out of the communications cycle. </p>

<p>So, applying this concept to a real world example, take a look at <a href="http://riastats.com">RIAStats.com</a>. The data displayed on the front page spans 30 days, and includes millions of records. Calculating this data takes quite a bit of time. Fortunately, there's no need to recalculate the percentages for every single visitor. Instead, we can calculate the percentages once, and cache the result. We then serve visitors the cached result.</p>

<p><em>Handling Results per Argument</em>:<br />
Most server methods take arguments that change the response. We can use a key-value pair concept to handle this. Simply concatenate the arguments into a unique string, to form your "key". Then cache the appropriate response, associating it with this unique key. </p>

<p>So again, take a look at <a href="http://riastats.com">RIAStats.com</a>, and see the drop down options at the top. Changing these clearly changes the arguments sent the server, and the results from the server. You'll probably notice when you hit an un-cached result, because the response takes a while. However, if you reload your browser, and ask for the same results a second time, the response will be much quicker. </p>

<p><em>Timing-out Results</em>:<br />
We probably don't want to keep cached results forever, because our data is likely to change. We'll simply set a cache timeout that will clear our results. With proper considerations, we can make our data both timely and efficient. </p>

<p><strong>Installing MemCached</strong></p>

<p><a href="http://www.danga.com/memcached/">MemCached</a> is an open source (and therefore cross-platform) executable that must be installed on your servers. Your first step will be to install and verify that the MemCached service is running on at least one of your test servers. Memcached has a <a href="http://www.danga.com/memcached/">website</a> and a separate <a href="http://code.google.com/p/memcached/">Google Code project</a>. (Search google for install MemCached for your operating system. For linux, here's a link to a <a href="http://74.125.47.132/search?q=cache:U7slYu3mgKsJ:www.ajohnstone.com/archives/installing-memcached/+memcached+install&hl=en&ct=clnk&cd=2&gl=us">google cache of install instructions</a>).</p>

<p>After installing the MemCached server, you'll need into add <a href="http://php.net/memcache">php-memcached</a> to your server. This provides php some built-in memcached communications functions.</p>

<p><strong>Example PHP</strong></p>

<p>The following PHP code comes directly from RIAStats and implements all of the above concepts with Memcached. We'll return an AMF encoded response, using this <a href="http://www.dreamingwell.com/examples/php/amf.class.zip">AMF encoder class</a> (zip file of a php class file).</p>

<div class="code">
&lt;?

<p>	require_once("amf.class.php");</p>

<p>	/* Listing out the 'arguments' used for this service */<br />
	$siteKey = $_GET["siteKey"];<br />
	$browser = $_GET["browser"];<br />
	$language = $_GET["language"];<br />
	$os = $_GET["language"];<br />
	$includeAboutRIA = $_GET["includeAboutRIA"];<br />
      <br />
    /* Init AMF encoder */<br />
	$encoder = new amfdata();<br />
  <br />
    /* Set the return content type, because we're doing AMF here */<br />
  	header('Content-type: application/x-amf');<br />
  <br />
    /* Create they 'key' for this value */<br />
    $memCacheKey = "statss".$siteKey."b".$browser."o".$os."l".$language."i".$includeAboutRIA;<br />
 <br />
    /* connect to memcached server */<br />
    $memCache = memcache_connect('localhost', 11211);</p>

<p>	/* Get the cached value for this 'key' */<br />
    $memcacheResult = memcache_get($memCache, $memCacheKey);</p>

<p>	/* Determine if there was a cached value */   <br />
    if($memcacheResult != false) {<br />
		<br />
		/*If so, return it */<br />
	    print $memcacheResult;<br />
        exit(0);<br />
    }<br />
    <br />
    $result = /* call some functions, do some operations, calculate somethings */</p>

<p>    /* encode the result */<br />
	$response = $encoder->getEncodedResponse($result);</p>

<p>    /* Cache the encoded response */<br />
    memcache_set($memCache, $memCacheKey, $response, 0, 86400);</p>

<p>	/* Print out the results, memcached will be used next time*/<br />
	print $response;<br />
	exit(0);<br />
?&gt;<br />
</div></p>]]>
</content>
</entry>

<entry>
<title>Transcoding MythTV for UPnP transport to a PS3</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2008/08/transcoding-myt-1.php" />
<modified>2008-09-17T17:22:10Z</modified>
<issued>2008-08-04T03:22:21Z</issued>
<id>tag:dreamingwell.com,2008:/articles/2.45</id>
<created>2008-08-04T03:22:21Z</created>
<summary type="text/plain">MythTV has a builtin UPnP server that can serve recorded shows to the PS3&apos;s UPnP client. However, the format that MythTV records may not be directly compatible with the PS3s video client. I use the following user job in MythTV...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>MythTV</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>MythTV has a builtin UPnP server that can serve recorded shows to the PS3's UPnP client. However, the format that MythTV records may not be directly compatible with the PS3s video client. </p>

<p>I use the following user job in <a href="http://mythtv.org">MythTV</a> to transcode recorded videos to a format that is compatible for the PS3 over UPNP. My <a href="http://www.pchdtv.com/">PCHDTV-5500</a> card captures audio in <a href="http://en.wikipedia.org/wiki/Program_stream">MPEG-PS</a> and the PS3 will only play <a href="http://en.wikipedia.org/wiki/MPEG_transport_stream">MPEG-TS</a> formats (thus the requirement to transcode the video file). </p>]]>
<![CDATA[<p>Be sure to change the two instances of "/storage/mythtv" to your appropriate mythtv video directory. </p>

<div class="code">
mythcommflag -c %CHANID% -s %STARTTIME% --gencutlist; mythtranscode -c %CHANID% -s %STARTTIME% -p autodetect -m -e dvd --honorcutlist; mv /storage/mythtv/%FILE%.tmp /storage/mythtv/%FILE%; mythcommflag -c %CHANID% -s %STARTTIME% --rebuild --clearcutlist;</div>

<p>This is script performs the following steps:</p>

<ol>
<li> converts the already created commercial list into a "cut list"</li>
<ul><li>Requires that commercial flagging run before this user job</li></ul>

<p><li> transcodes the captured video to a tmp file.</li><br />
<ul><li>this step also cuts commercials</li><br />
</ul><br />
<li> overwrites the original capture file with the new file</li><br />
<li> rebuilds the commercial flags so that a normal myth frontend doesn't skip the commercials that have been cut in the transcoding</li><br />
</ol></p>

<p>Enter the script above as a "User Job" and enable that user job on any recordings  (under advanced options in MythWeb) you'd like to be able to view on your PS3.</p>]]>
</content>
</entry>

<entry>
<title>Introducing RIAStats.com</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2008/07/introducing-ria.php" />
<modified>2008-09-15T15:38:49Z</modified>
<issued>2008-07-24T15:33:38Z</issued>
<id>tag:dreamingwell.com,2008:/articles/2.44</id>
<created>2008-07-24T15:33:38Z</created>
<summary type="text/plain">RIAStats.com collects statistics about Rich Internet Application browser plugin deployments and provides the results publicly. The site uses a small javascript, much like Google Analytics, to detect the presence and version of RIA plugins. Like google analytics, any web site...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p><a href="http://riastats.com">RIAStats.com</a> collects statistics about Rich Internet Application browser plugin deployments and provides the results publicly. The site uses a small javascript, much like Google Analytics, to detect the presence and version of RIA plugins. Like google analytics, any web site can include this javascript and receive customized statistics. </p>

<p>Today, RIAStats.com supports Flash Player and Silverlight detection. I'm looking into adding JavaFX. Any other suggestions are welcome! </p>

<p>You can sort results by browser, operating system and language. Statistics are available as a pie chart of the last 30 days activity and a line chart that shows daily percentages. When Adobe or Microsoft releases a new version of their plugin, we'll be able to track its penetration. </p>

<p>If you like the service, try adding RIAStats to your site. Hopefully this will become a useful resource for better understanding the deployment of RIA plugins for your target audience.</p>

<p><b>WARNING</b>: If you have silver light installed on your Mac and you use Firefox 3, be sure to get the latest updates! There was a bug in the first release that caused firefox to crash. </p>]]>

</content>
</entry>

<entry>
<title>Displaying a Shapefile (.shp) on a Map in Flex</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2008/06/displaying-a-sh.php" />
<modified>2008-09-15T15:39:23Z</modified>
<issued>2008-06-18T21:33:42Z</issued>
<id>tag:dreamingwell.com,2008:/articles/2.43</id>
<created>2008-06-18T21:33:42Z</created>
<summary type="text/plain">Using some of my previously covered material, I have created a Flex appication that displays Shapefile (.shp) polygons on a map. This demo includes three different shapefiles that give some information about Brazos County, TX. You&apos;ll notice that you can...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>Using some of my <a href="http://www.dreamingwell.com/articles/archives/2008/06/modestmap_examp.php">previously covered material</a>, I have created a Flex appication that displays <a href="http://en.wikipedia.org/wiki/Shapefile">Shapefile</a> (.shp) polygons on a map. This demo includes three different shapefiles that give some information about Brazos County, TX. You'll notice that you can interact with the polygons, change the 'Tile Provider' (yahoo, google, microsoft, etc) and change the dataset (shapefile). The demo also includes a DBF parser to display associated text data with each polygon.</p>

<p><a href="http://dreamingwell.com/examples/flex/shapefileFlex/ShapefileExplorer.html">Running Demo</a></p>

<p><a href="http://dreamingwell.com/examples/flex/shapefileFlex/srcview/ShapefileExplorer.zip">Source Code</a></p>

<p><a href="http://dreamingwell.com/examples/flex/shapefileFlex/ModestMap.zip">ModestMaps Project</a> (Required)</p>

<p>This project makes use of <a href="http://modestmaps.com">ModestMaps</a> and <a href="http://code.google.com/p/vanrijkom-flashlibs/">Vanrijkom's Flashlibs</a> to parse the shapefile and DBF file into objects.</p>

<p>This demo is the beginning of an alternative to <a href="http://www.ilog.com/products/ilogelixir/features/maps/">ILOG Elixr Maps</a>. However, ILOG's maps come with a wonderful tool that simplifies and converts mapping data to an action-script class.  As an alternative, you could use <a href="http://www.mapshaper.org/">MapShaper.org</a> to simplify your shapefiles into a reasonable dataset for parsing in Flex. </p>

<p>You can find tons of Shapefile data sets at <a href="http://arcdata.esri.com/data/tiger2000/tiger_download.cfm">ESRI's Arc Data Repository</a> or <a href="http://www.geographynetwork.com/">GeographyNetwork.com</a>.</p>

<p>I look forward to seeing how the community puts this to use.</p>]]>

</content>
</entry>

<entry>
<title>Google SocialGraph Explorer in Flex</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2008/06/google-socialgr.php" />
<modified>2008-09-15T15:39:36Z</modified>
<issued>2008-06-13T18:44:44Z</issued>
<id>tag:dreamingwell.com,2008:/articles/2.42</id>
<created>2008-06-13T18:44:44Z</created>
<summary type="text/plain">Just for fun, I&apos;ve created a Google SocialGraph Explorer application in Flex. Google&apos;s web spider picks up XFN and FOAF information. The Google SocialGraph API makes that data available through a JSON API. Running Demo Source Code This application makes...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>Just for fun, I've created a <a href="http://dreamingwell.com/examples/flex/googleSocial/GoogleSocial.html">Google SocialGraph Explorer</a> application in Flex. Google's web spider picks up XFN and FOAF information. The <a href="http://code.google.com/apis/socialgraph/">Google SocialGraph API</a> makes that data available through a JSON API.</p>

<p><a href="http://dreamingwell.com/examples/flex/googleSocial/GoogleSocial.html">Running Demo</a></p>

<p><a href="http://dreamingwell.com/examples/flex/googleSocial/srcview/GoogleSocial.zip">Source Code</a></p>

<p>This application makes use of the <a href="http://code.google.com/apis/socialgraph/">Google SocialGraph API</a>, <a href="http://code.google.com/p/as3corelib/">CoreLib</a> for JSON parsing, <a href="http://mark-shepherd.com/blog/springgraph-flex-component/">SpringGraph</a> for the visualization, and <a href="http://labs.adobe.com/wiki/index.php/Cairngorm">Cairngorm</a> for the MVC framework. </p>]]>

</content>
</entry>

<entry>
<title>ModestMap Example in AIR (Updated)</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2008/06/modestmap-examp.php" />
<modified>2008-06-09T20:11:51Z</modified>
<issued>2008-06-08T05:49:12Z</issued>
<id>tag:dreamingwell.com,2008:/articles/2.41</id>
<created>2008-06-08T05:49:12Z</created>
<summary type="text/plain">The following was created as an example ModestMaps implementation in Adobe Air. This application shows the basic functionality of Modest Maps. You will need both of the following projects. The ModestMap Library is a checkout from the ModestMap SVN ModestMapAir...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>The following was created as an example <a href="http://ModestMaps.com">ModestMaps</a> implementation in <a href="http://adobe.com/air">Adobe Air</a>. This application shows the basic functionality of Modest Maps. </p>

<p>You will need both of the following projects. The ModestMap Library is a checkout from the <a href="http://modestmaps.mapstraction.com/trac/wiki/SubversionAccess">ModestMap SVN</a></p>

<p><a href="/examples/flex/modestmap-air2/ModestMapAir.zip">ModestMapAir Source Code</a><br />
<a href="/examples/flex/modestmap-air2/ModestMap.zip">ModestMap Library</a> </p>

<p>You can view the presentation I gave on this material via this Adobe Connect presentation recording.</p>

<p><a href="https://admin.adobe.acrobat.com/_a200985228/p21825398/">ModestMap Presentation</a></p>

<p>Two types of markers are shown in this demo. <br />
<ul><br />
<li>single point "pin" marker (Washington DC)<br />
<li>multi-point "polygon" square marker where the equator and prime merdian meet. <br />
</ul></p>

<p>The demo also shows how to switch "providers", and the various tile providers that are available.</p>]]>

</content>
</entry>

<entry>
<title>Available Mapping Solutions in Flex</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2008/06/available-mappi.php" />
<modified>2008-06-08T06:08:09Z</modified>
<issued>2008-06-07T20:18:02Z</issued>
<id>tag:dreamingwell.com,2008:/articles/2.40</id>
<created>2008-06-07T20:18:02Z</created>
<summary type="text/plain">Last week I gave a short presentation on available Flex mapping solutions to the DC Area Flex Users Group. We covered Yahoo Maps, ILOG Elixir, and ModestMaps. Below you&apos;ll find links to the slides I used during that presentation, in...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>Last week I gave a short presentation on available Flex mapping solutions to the <a href="http://dc-flex.org">DC Area Flex Users Group</a>. We covered <a href="http://developer.yahoo.com/flash/maps/">Yahoo Maps</a>, <a href="http://www.ilog.com/products/ilogelixir/features/maps/">ILOG Elixir</a>, and <a href="http://www.modestmaps.com">ModestMaps</a>. Below you'll find links to the slides I used during that presentation, in several formats.</p>

<p><a href="http://dreamingwell.com/examples/flex/maps/Flex Maps Presentation.ppt">Flex Mapping Solutions Power Point</a></p>

<p><a href="http://dreamingwell.com/examples/flex/maps/Flex Maps Presentation.html">Flex Mapping Solutions Flash Presentation</a></p>]]>

</content>
</entry>

<entry>
<title>Understanding Memory Leaks in ActionScript (Adobe Flex)</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2008/05/understanding-m.php" />
<modified>2008-09-15T15:43:36Z</modified>
<issued>2008-05-07T18:59:07Z</issued>
<id>tag:dreamingwell.com,2008:/articles/2.39</id>
<created>2008-05-07T18:59:07Z</created>
<summary type="text/plain">Thanks go to Danny of TheGoldHold.com for a bunch of this information! In ActionScript, there is no method to manually completely remove an object from memory. That task is soley the responsibility of the Flash Player&apos;s garbage collector (GC). The...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>Thanks go to Danny of <a href="http://thegoldhold.com">TheGoldHold.com</a> for a bunch of this information!</p>

<p>In ActionScript, there is no method to manually completely remove an object from memory. That task is soley the responsibility of the Flash Player's garbage collector (GC). The GC operates autonomously, and beyond the "Force GC" button in the Flex Builder memory profiler, there is no method to cause the GC to run. Therefore, memory leaks in Flex can be hard to understand and debug. </p>

<p>I have created a <a href="http://dreamingwell.com/examples/flex/memoryleak/MemoryLeakTest.zip">MemoryLeakTest project</a> in Flex Builder that show examples that are and are not memory leaks. The project contains three applications, two with memory leaks and one with out. Each sample application adds and removes a single sub-component 100 times per second. This forces the garbage collector to run, and easily shows when a memory leak occurs. The source code contains comments that explain the memory leaks, and how to avoid them, but I'll go over them briefly here as well. </p>]]>
<![CDATA[<p><b>Flash Player Memory Allocation</b></p>

<p>Memory allocation speed inside the Flash player runtime is limited by the browser. Therefore, instead of making a large number of small requests for memory, flash player makes a small number of requests for large chunks of memory. Memory deallocation is also a slow process, so flash player is reluctant to give up memory; though it will do so as necessary.  </p>

<p><b>Garbage Collector Specifics</b></p>

<p>Objects are garbage collected only when they have no other objects that contain strong references. Flash Player's runtime keeps a reference table that is updated each time a reference is made between two objects. The Garbage Collector simply uses that table to determine which objects are completely de-referenced.</p>

<p>The Garbage Collector (GC) runs directly before additional memory is requested. This way flash player can gain the memory resources used by garbage objects, and can re-evalute the need to allocate additional memory; possibly saving time. It is important to note that GC does not run immediately when an object is completely de-referenced. So, even though you've completely de-referenced an object it can and probably will stay in memory. </p>

<p><b>Identifying Memory Leaks</b></p>

<p>Flex Builder 3 Pro includes a "Profiler" tool that can be used to identify memory leaks. In that tool is a "Force Garbage Collection" button. When your application is being profiled, simply click that button and monitor the "Live Objects" list. If you believe you have complete removed and dereferenced an object, its number of "instances" should have be reduced. </p>

<p>Use the "Cumulative Instances" to determine how many instances of that object were ever created, and the "Instances" column to determine how many of those instances still exist. If after creating and removing an object, then running "Force GC", those numbers are still the same, you probably have a memory leak. </p>

<p>The "Memory Usage" chart is another way to determine whether a memory leak exists; but only for small applications. The red line represents the maximum memory use, and the blue line represents the current memory use. If the blue line and red line never separate, you have a memory leak.</p>

<p><img src="/examples/flex/memoryleak/Bad-Memory-Usage.jpg"><br />
<center>Bad Memory Usage</center></p>

<p><img src="/examples/flex/memoryleak/Good-Memory-Usage.jpg"><br />
<center>Good Memory Usage</center></p>

<p><b>Memory Leaks by Reference</b></p>

<p>Because the garbage collector determines which objects to free by their references, it is important for the developer to keep up with what references they have created. A very simple example of this is creating a reference from a parent object to a child object.</p>

<p>In the following  example, a childObject is created, and then a second reference is made to that childObject. Because that second reference still exists at the end of this code, that childObject will never be freed; unless the parent object is garbage collected.<br />
<pre>    private var childObject:Object = {test: 'test'};<br />
    private var secondReference:Object = childObject;<br />
    childObject = null;<br />
</pre></p>

<p><b>Memory Leaks by Event Listeners</b></p>

<p>Incorrect use of EventListners are the number one cause of memory leaks in ActionScript. EventListeners push references of the callback object into an array on the target object. That reference keeps the Garbage Collector from destroying the call back object. There are a few exceptions to this rule. These do not block garbage collection:</p>

<ol>
<li>Weak References</li>
<li>Self References</li>
<li>References to Child Objects</li>
</ol>

<p>Weak references are created by setting fifth argument of "addEventListner" to "true". By default, eventListeners use strong references. Note that using a weak referenced eventlistner, and then having no other reference to an object means that object will be garbage collected, so be careful!</p>

<p>An example of a weak reference event listener.<br />
<pre>   someObject.addEventListener(MouseClick.CLICK, handlerFunction, false, 0, true);<br />
</pre></p>

<p>Self references are simply references by an object to itself. A common example is adding an eventListener to a component, and handling it inside of that component. </p>

<p>An example of a self reference event listener.<br />
<pre>    this.addEventListener(MouseClick.CLICK, handlerFunction);<br />
</pre></p>

<p>Child references are references to a child object. When a parent object is garbage collected, that destroys the references to the child object. So usually, this means the child object will also be garbage collected (unless outside references to that child object exist). Therefore, it is safe to add eventListeners to an immediate child object and not worry about memory leaks. You should note that the child object will not be freed until the parent object is freed!</p>

<p>An example of a childObject event listener:<br />
<pre>     private var childObject:UIComponent = new UIComponent;<br />
     addChild(childObject);<br />
     childObject.addEventListener(MouseEvent.CLICK, clickHandler);</pre></p>]]>
</content>
</entry>

<entry>
<title>Horizontal Scrolling in DataGrids with many Columns</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2008/05/horizontal-scro-1.php" />
<modified>2008-05-01T18:07:36Z</modified>
<issued>2008-05-01T17:51:10Z</issued>
<id>tag:dreamingwell.com,2008:/articles/2.38</id>
<created>2008-05-01T17:51:10Z</created>
<summary type="text/plain">Out of the box, horizontal scrolling in datagrids with many columns is not smooth; especially if your view has many visible rows. A cheap and easy way around this is to disable &quot;liveScrolling&quot;. Without liveScrolling, the datagrid will not redraw...</summary>
<author>
<name>wildag</name>
<url>dreamingwell.com</url>
<email>travis@dreamingwell.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://dreamingwell.com/articles/">
<![CDATA[<p>Out of the box, horizontal scrolling in datagrids with many columns is not smooth; especially if your view has many visible rows. A cheap and easy way around this is to disable "liveScrolling". Without liveScrolling, the datagrid will not redraw until mouseUp from the scroll.</p>

<p>To improve on that, I wanted to have vertical liveScrolling and horizontal non-liveScrolling. The solution is simply to use the following function as an event handler for the "scroll" event on the dataGrid. </p>

<p>
private function dataGridScroll(event:ScrollEvent):void
{
     exhaustGrid.liveScrolling  = (event.direction == "vertical");
}
</p>

<p>The downside is that the first vertical scroll after a horizontal scroll will not be a live scroll. I am sure there is an easy way around that.</p>]]>

</content>
</entry>

</feed>