<?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>2011-06-27T22:18:08Z</modified>
<tagline></tagline>
<id>tag:dreamingwell.com,2011:/articles/2</id>
<generator url="http://www.movabletype.org/" version="4.34-en">Movable Type</generator>
<copyright>Copyright (c) 2011, wildag</copyright>

<entry>
<title>Flex Mobile Custom URL Schemes</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2011/06/flex-mobile-cus-2.php" />
<modified>2011-06-27T22:18:08Z</modified>
<issued>2011-06-27T21:55:02Z</issued>
<id>tag:dreamingwell.com,2011:/articles/2.60</id>
<created>2011-06-27T21:55:02Z</created>
<summary type="text/plain">Android and iOS support launching applications via custom URL schemes, or in other words, apps can be launched by the user clicking a link or button other than the icon on the start screen. This feature allows developers to add...</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>Android and iOS support launching applications via custom URL schemes, or in other words, apps can be launched by the user clicking a link or button other than the icon on the start screen. This feature allows developers to add links on public websites, or use "launch URL" commands in applications, that will cause the mobile OS to open a specific application.</p>

<p>Flex Mobile, using Adobe Air's android and iOS packager, supports these custom url schemes. The configuration for this custom scheme is done in the AIR application description XML file. The following shows an example custom url, use of that URL in regular HTML that would be placed on a website, and the configuration </p>

<p><br />
<strong>Example Custom URL Scheme</strong><br />
myapp://</p>

<p><br />
<strong>Example HTML Link</strong><br />
<div class="code"><pre>&lt;a href="myapp://"&gt;Open MyApp&lt;/a&gt;</pre></div></p>

<p><strong>Example XML for Android</strong><br />
<div class="code"><br />
<pre><br />
&lt;android&gt;<br />
        &lt;manifestAdditions&gt;&lt;![CDATA[<br />
			&lt;manifest android:installLocation="auto"&gt;<br />
			    &lt;uses-permission android:name="android.permission.INTERNET"/&gt;<br />
			    &lt;uses-permission android:name="android.permission.CAMERA"/&gt;<br />
			    &lt;uses-permission android:name="android.permission.RECORD_AUDIO"/&gt;<br />
				&lt;application&gt; <br />
                    &lt;activity&gt; <br />
                        &lt;intent-filter&gt; <br />
                            &lt;action android:name="android.intent.action.MAIN"/&gt; <br />
                            &lt;category android:name="android.intent.category.LAUNCHER"/&gt; <br />
                        &lt;/intent-filter&gt; <br />
                        &lt;intent-filter&gt; <br />
                            &lt;action android:name="android.intent.action.VIEW"/&gt; <br />
                            &lt;category android:name="android.intent.category.BROWSABLE"/&gt; <br />
                            &lt;category android:name="android.intent.category.DEFAULT"/&gt; <br />
                            &lt;data android:scheme="myapp"/&gt; <br />
                        &lt;/intent-filter&gt; <br />
                    &lt;/activity&gt; <br />
                &lt;/application&gt; <br />
			&lt;/manifest&gt;<br />
		]]&gt;&lt;/manifestAdditions&gt;<br />
    &lt;/android&gt;<br />
</pre><br />
</div></p>

<p><strong>Example XML for iOS</strong><br />
<div class="code"><br />
<pre><br />
 &lt;iPhone&gt;<br />
     &lt;InfoAdditions&gt;&lt;![CDATA[<br />
	&lt;key&gt;UIDeviceFamily&lt;/key&gt;<br />
	&lt;array&gt;<br />
		&lt;string&gt;1&lt;/string&gt;<br />
		&lt;string&gt;2&lt;/string&gt;<br />
	&lt;/array&gt;<br />
              &lt;key&gt;CFBundleURLTypes&lt;/key&gt;<br />
		&lt;array&gt;<br />
			&lt;dict&gt;<br />
				&lt;key&gt;CFBundleURLName&lt;/key&gt;<br />
				&lt;string&gt;com.dreamingwell.myapp&lt;/string&gt;<br />
				&lt;key&gt;CFBundleURLSchemes&lt;/key&gt;<br />
				&lt;array&gt;<br />
					&lt;string&gt;myapp&lt;/string&gt;<br />
				&lt;/array&gt;<br />
			&lt;/dict&gt;<br />
		&lt;/array&gt;<br />
	]]&gt;&lt;/InfoAdditions&gt;<br />
   &lt;requestedDisplayResolution&gt;high&lt;/requestedDisplayResolution&gt;<br />
 &lt;/iPhone&gt;<br />
</pre><br />
</div><br />
</p>]]>

</content>
</entry>

<entry>
<title>Flex Mobile DisplayObject List (Video)</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2011/06/flex-mobile-dis-1.php" />
<modified>2011-06-27T19:36:34Z</modified>
<issued>2011-06-01T15:34:39Z</issued>
<id>tag:dreamingwell.com,2011:/articles/2.58</id>
<created>2011-06-01T15:34:39Z</created>
<summary type="text/plain"> Flex SDK 4.5 for mobile shipped with an IconItemRenderer that is extremely efficient at showing static images in a list. However, most enterprise and data driven applications are going to need to show dynamically created, interactive, and data driven...</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><iframe width="640" height="510" src="http://www.youtube.com/embed/OozHlx1psu8" frameborder="0" allowfullscreen></iframe></p>

<p>Flex SDK 4.5 for mobile shipped with an IconItemRenderer that is extremely efficient at showing static images in a list. However, most enterprise and data driven applications are going to need to show dynamically created, interactive, and data driven content in the list; something IconItemRenderer simply can't do. The video in this article shows my implementation of a DisplayObjectItemRenderer and supporting list. This component supports all of the features of the standard Spark list, in addition to efficiently displaying a DisplayObject. </p>

<p><a href="/examples/flex/displayObjectList/DisplayObjectListMobile.fxp">Flex Builder 4.5 Source Code</a></p>]]>

</content>
</entry>

<entry>
<title>Flex Mobile Custom View Panning (Video)</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2011/05/flex-mobile-cus.php" />
<modified>2011-05-31T23:51:51Z</modified>
<issued>2011-05-31T21:37:24Z</issued>
<id>tag:dreamingwell.com,2011:/articles/2.56</id>
<created>2011-05-31T21:37:24Z</created>
<summary type="text/plain"> Flex SDK 4.5 mobile view navigator framework does not make use of the multi-touch features of the Flex 4.5 SDK. As stock, the framework provides &apos;navigation&apos; buttons and an api to switch between views. The video above previews and...</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><iframe width="640" height="510" src="http://www.youtube.com/embed/zIw6DmJq3e0" frameborder="0" allowfullscreen></iframe></p>

<p><br />
Flex SDK 4.5 mobile view navigator framework does not make use of the multi-touch features of the Flex 4.5 SDK. As stock, the framework provides 'navigation' buttons and an api to switch between views. The video above previews and explains my PanView implementation. The source code link below contains a Flex Builder 4.5 Project.</p>

<p><a href="/examples/flex/panview/PanView.fxp">Flex 4.5 Project - Source Code </a></p>]]>

</content>
</entry>

<entry>
<title>Flex Threading Class</title>
<link rel="alternate" type="text/html" href="http://dreamingwell.com/articles/archives/2011/01/flex-threading.php" />
<modified>2011-01-28T19:56:20Z</modified>
<issued>2011-01-28T18:39:57Z</issued>
<id>tag:dreamingwell.com,2011:/articles/2.55</id>
<created>2011-01-28T18:39:57Z</created>
<summary type="text/plain">Adobe&apos;s Flash player run time environment does not support multi-threading; except for very specific external interactions. Flash player uses an ancient frame-by-frame single threaded monolithic execution model. This means that drawing in the UI and handling user interactions are directly...</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>Adobe's Flash player run time environment does not support multi-threading; except for very specific external interactions. Flash player uses an ancient frame-by-frame single threaded monolithic execution model. This means that drawing in the UI and handling user interactions are directly blocked by data processing and other heavy lifting work. </p>

<p>The Flex framework's UIComponent implements a standard invalidate/update pattern that relieves much of the UI's drawing impact in well written components. UIComponent also has the callLater method. However, there's no equivalent for simple back-end data processing. </p>

<p>The "Thread.as" ActionScript class in the Flex Project linked below can be used by any Flex class to implement a "threaded" worker. Simply create a "worker" function that does a single unit of work; usually from a queue of pending work. Then create an instance of this Thread class, supplying the worker thread as the first argument. Remember to keep the worker thread very lightweight, doing as little as is absolutely possible. </p>

<p>The worker function will be called repeatedly, until it returns a "true", indicating that the work is complete. The logic of this class will take care of exactly when to call the worker function, so as not to impede the timely advancing of the Flash Player's frames. Thus the appearance of "background processing" while the user is still able to interact with the UI.</p>

<p>You can optionally provide a "work complete" function, that is called once at the completion of work. </p>

<p>This implementation also takes multiple parallel executing threads into consideration. Note that the allotted time for execution is divided equally among all executing threads. However, you can still choke out the available computing resources with too many threads, or a worker function with a long execution time. </p>

<p><a href="/examples/flex/thread/ThreadExamples.html">Running Example</a><br />
<a href="/examples/flex/thread/srcview/ThreadExamples.zip">Source Code</a></p>]]>

</content>
</entry>

<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>

</feed>
