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

<channel>
	<title>James Ward - RIA Cowboy &#187; Python</title>
	<atom:link href="http://www.jamesward.com/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamesward.com</link>
	<description>Rich Internet Applications &#124; Flex &#124; Adobe AIR &#124; Java &#124; Open Source &#124; Linux &#124; Enterprise Software &#124; Cloud</description>
	<lastBuildDate>Mon, 08 Mar 2010 21:16:19 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Need a QuickFix? Try Google App Engine, Adobe AIR, and Flex</title>
		<link>http://www.jamesward.com/2008/06/12/quickfix-google-app-engine-adobe-air-flex/</link>
		<comments>http://www.jamesward.com/2008/06/12/quickfix-google-app-engine-adobe-air-flex/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 22:09:13 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/wordpress/?p=284</guid>
		<description><![CDATA[Last week I spent a few hours with Dick Wall of the Java Posse working on an application which combines Google App Engine, Adobe AIR, and Flex.  This was a fun experiment that turned into a pretty cool application.  The application, named QuickFix, sends an image to Google App Engine which does an [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I spent a few hours with Dick Wall of the <a href="http://www.javaposse.com/">Java Posse</a> working on an application which combines Google App Engine, Adobe AIR, and Flex.  This was a fun experiment that turned into a pretty cool application.  The application, named QuickFix, sends an image to Google App Engine which does an &#8220;I&#8217;m Feeling Lucky&#8221; transformation on the image and sends it back.  Here&#8217;s a screenshot of it fixing one of the photos I took at the Java Posse Roundup this past winter:<br />
<a href="http://airquickfix.appspot.com/"><img src="http://www.jamesward.com/wordpress/wp-content/uploads/2008/06/quickfix.png"/></a></p>
<p>You can get the application by going to:<br />
<a href="http://airquickfix.appspot.com/">http://airquickfix.appspot.com/</a></p>
<p>All of the source code can be found in the <a href="http://code.google.com/p/air-quick-fix/">air-quick-fix project</a> on Google Code.</p>
<p>The division of work between Dick and I worked really well.  Dick worked on the back-end code in Python while I worked in Flex on the front-end.  We used PyAMF to connect the back-end to the front-end.  PyAMF made the whole process very easy.  The only challenge was in figuring out how to transform the data types correctly.  The first version of the application came together in a couple of hours.</p>
<p>The back-end Python code is really simple.  Here is the method that is called from the client (trimmed down a bit):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> fiximage<span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>:
&nbsp;
  image_in = Image<span style="color: black;">&#40;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  image_in.<span style="color: black;">im_feeling_lucky</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  image_out = ByteArray<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  image_out.<span style="color: black;">write</span><span style="color: black;">&#40;</span>image_in.<span style="color: black;">execute_transforms</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">return</span> image_out</pre></div></div>

<p>In this code, the data which is passed to the method is just a ByteArray containing the image.  The data is turned into an Image, the im_feeling_lucky transform is specified, then run &#8211; taking the bytes and sending them back to the client.</p>
<p>The front-end Flex code that sends the image to the back-end is also really simple:</p>
<p>The RemoteObject (AMF networking API in Flex) is defined as:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:RemoteObject</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;ro&quot;</span> <span style="color: #000066;">destination</span>=<span style="color: #ff0000;">&quot;image&quot;</span> <span style="color: #000066;">endpoint</span>=<span style="color: #ff0000;">&quot;http://airquickfix.appspot.com/image/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></div></div>

<p>The function which actually makes the request to the back-end is:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> stream:FileStream = <span style="color: #000000; font-weight: bold;">new</span> FileStream<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
stream.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span>startFile, FileMode.<span style="color: #006600;">READ</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> imageData:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
stream.<span style="color: #006600;">readBytes</span><span style="color: #66cc66;">&#40;</span>imageData<span style="color: #66cc66;">&#41;</span>;
ro.<span style="color: #006600;">fiximage</span><span style="color: #66cc66;">&#40;</span>imageData<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In this Flex code the image file is opened, read into a ByteArray, then sent to the fiximage method on the back-end.</p>
<p>There is a bunch of other Flex code that creates the UI, handles selecting, saving, and dragging and dropping images but is all pretty straightforward.</p>
<p>Dick and I really enjoyed creating this application together.  It shows off some of the strengths of each technology well and shows how easy it is to use the technologies together.  Let us know what you think about the application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2008/06/12/quickfix-google-app-engine-adobe-air-flex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rich-Client Misconceptions &amp; Adobe&#8217;s Open Screen Project</title>
		<link>http://www.jamesward.com/2008/05/08/rich-client-misconceptions-adobes-open-screen-project/</link>
		<comments>http://www.jamesward.com/2008/05/08/rich-client-misconceptions-adobes-open-screen-project/#comments</comments>
		<pubDate>Thu, 08 May 2008 14:10:49 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://www.jamesward.org/wordpress/?p=276</guid>
		<description><![CDATA[Artima recently posted two interviews with me which relate to Flex.  First is an interview about Adobe&#8217;s Open Screen Project.  The second is called Rich-Client Misconceptions.  Also Bruce Eckel recently posted a very interesting article on Artima called &#8220;Concurrency with Python, Twisted, and Flex&#8220;.  Let me know what you think about [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://artima.com">Artima</a> recently posted two interviews with me which relate to Flex.  First is an interview about <a href="http://www.artima.com/forums/flat.jsp?forum=270&#038;thread=230045">Adobe&#8217;s Open Screen Project</a>.  The second is called <a href="http://www.artima.com/lejava/articles/javaone_2008_james_ward.html">Rich-Client Misconceptions</a>.  Also Bruce Eckel recently posted a very interesting article on Artima called &#8220;<a href="http://www.artima.com/weblogs/viewpost.jsp?thread=230001">Concurrency with Python, Twisted, and Flex</a>&#8220;.  Let me know what you think about those.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2008/05/08/rich-client-misconceptions-adobes-open-screen-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upcoming Events: CodeMash, RIA Jam, Flex-TurboGears Jam</title>
		<link>http://www.jamesward.com/2007/12/18/upcoming-events-codemash-ria-jam-flex-turbogears-jam/</link>
		<comments>http://www.jamesward.com/2007/12/18/upcoming-events-codemash-ria-jam-flex-turbogears-jam/#comments</comments>
		<pubDate>Wed, 19 Dec 2007 00:14:59 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.jamesward.org/wordpress/2007/12/18/upcoming-events-codemash-ria-jam-flex-turbogears-jam/</guid>
		<description><![CDATA[It&#8217;s hard to believe that 2007 is almost over.  It&#8217;s been an amazing year!  Thanks for reading and contributing.  I&#8217;m looking forward to another great year in 2008.  And it all begins when I hit the road the second week of January for CodeMash 2008.  I went to CodeMash last [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s hard to believe that 2007 is almost over.  It&#8217;s been an amazing year!  Thanks for reading and contributing.  I&#8217;m looking forward to another great year in 2008.  And it all begins when I hit the road the second week of January for <a href="http://www.codemash.org">CodeMash 2008</a>.  I went to CodeMash last year and really enjoyed the conference, especially the water slides.  :)  I&#8217;ll be speaking again at CodeMash 2008 about Adobe AIR and Flex.</p>
<p>The week following CodeMash there will be a <a href="http://www.mindviewinc.com/Conferences/RIAJam/Index.php">RIA Jam in Ann Arbor</a>.  The RIA Jam will be hosted by <a href="http://srtsolutions.com/">SRT Solutions</a> and <a href="http://www.mindview.net/">Bruce Eckel</a>.  My friend and co-RIA-conspirator, <a href="http://blogs.msdn.com/joshholmes/">Josh Holmes</a>, will also be there helping people learn Silverlight while I help people learn Flex and AIR.  In February Bruce will also be hosting another <a href="http://www.mindviewinc.com/Conferences/FlexTGJam/Index.php">Flex Jam in Crested Butte, Colorado</a>. The Jam in February will cover Flex, TurboGears, integrating the two and hopefully some exploratory work into integrating Flex with <a href="http://liftweb.net">Lift</a>, the new Scala based web framework.  I will be there helping people learn Flex and undoubtedly learning some new things myself.</p>
<p>The Jam and Open Spaces style events that Bruce hosts are my favorite events of the year.  The events in Crested Butte are always so refreshing.  While most conferences keep me indoors for days at a time, Bruce&#8217;s event encourage attendees to get outside, into open spaces.  For me this helps to relax my mind which makes it much easier to learn and focus.  At the Crested Butte events in the summer we hike for a few hours every day and in the winter we ski / snowshoe.  These events are also incredibly affordable since there isn&#8217;t a high cost associated with putting them on.  And as a bonus attendees to the Jams will receive a free copy of Flex Builder 2.  If you are learning Flex, no matter what level, you will learn more in these few days than you will at any other conference.  They are hands-on events so you actually learn through experimentation and peer interaction.</p>
<p>I&#8217;ll be at many other events in 2008 and hope to see many of you somewhere along the way.  Until then have a happy and safe holiday season.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2007/12/18/upcoming-events-codemash-ria-jam-flex-turbogears-jam/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex and TurboGears at CodeMash &#8211; DisplayShelf Widget</title>
		<link>http://www.jamesward.com/2007/01/20/flex-and-turbogears-at-codemash-displayshelf-widget/</link>
		<comments>http://www.jamesward.com/2007/01/20/flex-and-turbogears-at-codemash-displayshelf-widget/#comments</comments>
		<pubDate>Sat, 20 Jan 2007 17:40:46 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Widgets]]></category>

		<guid isPermaLink="false">http://www.jamesward.org/wordpress/2007/01/20/flex-and-turbogears-at-codemash-displayshelf-widget/</guid>
		<description><![CDATA[This past week I spoke at the CodeMash conference.  It was a really great event full of stimulating conversation.  Even more fun than trying to surf in the wave machine was an Open Spaces style session that Kevin Dangoor (creator of TurboGears) and I hosted.  We had planned to just sneak off [...]]]></description>
			<content:encoded><![CDATA[<p>This past week I spoke at the <a href="http://www.codemash.org">CodeMash</a> conference.  It was a really great event full of stimulating conversation.  Even more fun than <a href="http://video.google.com/videoplay?docid=-2676913860949129275&#038;hl=en">trying to surf in the wave machine</a> was an Open Spaces style session that <a href="http://www.blueskyonmars.com/">Kevin Dangoor</a> (creator of TurboGears) and I hosted.  We had planned to just sneak off into a corner and turn <a href="http://www.quietlyscheming.com/blog/">Ely Greenfield</a>&#8217;s <a href="http://www.quietlyscheming.com/blog/components/tutorial-displayshelf-component/">DisplayShelf component</a> into a <a href="http://www.turbogears.org">TurboGears</a> Widget.  However, word quickly spread that we were going to do this and everyone wanted to watch as we coded.  We had a bunch of fellow geeks huddled around every spare laptop and monitor we could find.  I shared my screen with VNC so that everyone could watch what Kevin and I were doing.  It was by far the best geek-out session I have had in a long time!  Check out a screenshot of the DisplayShelf widget in a TurboGears application, showing a picture of our geek-out session:</p>
<p><img src="http://www.jamesward.org/wordpress/wp-content/uploads/2007/01/tg_pic.jpg"/></p>
<p>Continue reading to learn more about what we built, how we built it, and how you can use it&#8230;<br />
<span id="more-88"></span><br />
The DisplayShelf is similar to the iTunes cover art display.  It&#8217;s built with the free Flex SDK, open source, and MIT licensed.  Earlier in the week I made the DisplayShelf work with TurboGears, but it wasn&#8217;t yet a reusable widget.  Kevin walked me through the process of converting my test application to a real widget.  In about twenty minutes we had most of the widget setup. To expedite the process we used an existing project to test the new widget. This particular project had previously been used to get the DisplayShelf running, sans-widget.  Very few times in my sixteen years of programming adventures have things with this many moving parts worked on the first try.  I coded the 3 lines nessecary to use the new widget, went to my browser and hit reload, one hundred percent convinced I would see an error message.  I saw the DisplayShelf, which I thought was actually still cached somewhere from my previous project.  I reloaded again, expecting to see an error.  No error.  I reloaded the TurboGears server, again expecting to see an error.  No error.  What is wrong?  Where is the error?  Surely this didn&#8217;t work first try!  I viewed the source of the web page and sure enough it was using the new DisplayShelf widget!  Everyone (excluding Kevin) was pretty amazed.  I guess Kevin is accustomed to these types of successes with TurboGears.</p>
<p>The next step was to upload the new widget to the <a href="http://cheeseshop.python.org/pypi/DisplayShelf/1.0">Cheese Shop</a>, a home for Python based widgets.  Kevin walked me though the process.  I expected this to be tedious&#8230;  Packaging things up in some strange way, navigating a difficult web site, uploading, etc.  Kevin again blew us away with the simplicity of doing this sort of thing.  Literally it was two commands to get our widget on the Cheese Shop.  Again everyone except Kevin is amazed.</p>
<p>Now that the widget was built and posted in the Cheese Shop it was time to test using the widget from scratch.  I did this with Kevin&#8217;s help, while someone else tired on their own computer.  Within a few minutes we both had applications which were using the new widget!  Again everyone except Kevin is amazed.  See the recurring theme?  Coming from a variety of backgrounds we couldn&#8217;t believe how easy it was to build web applications and use widgets with TurboGears.  Kevin just smiled as we all had epiphanies.</p>
<p>Using Flex for rich widgets in TurboGears applications is a great combination of technologies.  You get two great programming models and seamless interaction with both the <a href="http://labs.adobe.com/wiki/index.php/Flex_Framework:FABridge">FABridge</a> and with TurboGears&#8217;s JSON support.  A few months ago Bruce Eckel and I recorded a <a href="http://www.jamesward.org/wordpress/2007/01/10/bruce-eckel-is-thinking-in-flex/">screencast</a> of us building an application with a Flex front-end and a TurboGears back-end.  The application we built used JSON to expose the TurboGears back-end to Flex.  We had really great success with this approach.  At CodeMash we took another approach and used the FABridge to pass objects from TurboGears to a Flex application.  Both approaches work really well and depending on what you are building, one may be more applicable than another.</p>
<p>Now lets walk through how you can use the DisplayShelf component in your TurboGears applications.  This assumes that you already have TurboGears installed.</p>
<p>1) Get the DisplayShelf component from the Cheese Shop:</p>
<div width="100%" style="background: #cccccc; overflow : auto; padding: 6px;"><code>easy-install DisplayShelf</code></div>
<p>2) Create a new TurboGears application using the quickstart wizard:</p>
<div width="100%" style="background: #cccccc; overflow : auto; padding: 6px;"><code>tg-admin quickstart</code></div>
<p>3) In the created project directory, start the TurboGears server with the created start script (your start script name is based on your package name):</p>
<div width="100%" style="background: #cccccc; overflow : auto; padding: 6px;"><code>python start-dstest.py</code></div>
<p>4) Add the DisplayShelf widget to your controllers.py file:</p>
<div width="100%" style="background: #cccccc; overflow : auto; padding: 6px;"><code>from displayshelf.widgets import DisplayShelf</code></div>
<p>5) Return the DisplayShelf widget in your default template:</p>
<div width="100%" style="background: #cccccc; overflow : auto; padding: 6px;"><code>&nbsp;&nbsp;&nbsp;&nbsp;def index(self):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return dict(shelf=DisplayShelf())</code></div>
<p>6) Copy some images into the static/images directory.</p>
<p>7) Replace the body of the welcome.kid file with the DisplayShelf (specify an array of the images in your static/images directory):</p>
<div width="100%" style="background: #cccccc; overflow : auto; padding: 6px;"><code>${shelf(['static/images/1.jpg','static/images/2.jpg','static/images/3.jpg','static/images/4.jpg'],height='600')}<br />
</code></div>
<p>8) Load <a href="http://localhost:8080/">http://localhost:8080/</a> in your browser.</p>
<p>That&#8217;s it!  You are now using the DisplayShelf in your TurboGears app! If you start the TurboGears toolbox and go to <a href="http://localhost:7654/widgets/">http://localhost:7654/widgets/</a> you will also find the DisplayShelf in the Widget Browser.</p>
<p>It&#8217;s that easy!  Thanks Kevin and <a href="http://compoundthinking.com/blog/">Mark</a> for all your help this past week getting me up-to-speed on TurboGears!  TurboGears truly is a world class web application framework!  And the widget system is by far the best I&#8217;ve ever seen!  Now lets get some more Flex based widgets created!  :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2007/01/20/flex-and-turbogears-at-codemash-displayshelf-widget/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Bruce Eckel is Thinking in Flex!</title>
		<link>http://www.jamesward.com/2007/01/10/bruce-eckel-is-thinking-in-flex/</link>
		<comments>http://www.jamesward.com/2007/01/10/bruce-eckel-is-thinking-in-flex/#comments</comments>
		<pubDate>Wed, 10 Jan 2007 19:39:04 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.jamesward.org/wordpress/2007/01/10/bruce-eckel-is-thinking-in-flex/</guid>
		<description><![CDATA[Update: You can download the source code for this screencast here.
Recently Bruce Eckel and I had the chance to record a screencast of us pair programming with Flex &#038; TurboGears:
http://www.adobe.com/devnet/flex/articles/eckel_video.html
The results were great &#8211; a fantastic UI on top of a simple back-end!  Both Bruce and I learned a lot creating this screencast and [...]]]></description>
			<content:encoded><![CDATA[<p><font color="red">Update: You can download the source code for this screencast <a href="/downloads/flex_and_tg-address_example.zip">here</a>.</a></font></p>
<p>Recently Bruce Eckel and I had the chance to record a screencast of us pair programming with Flex &#038; TurboGears:<br />
<a href="http://www.adobe.com/devnet/flex/articles/eckel_video.html">http://www.adobe.com/devnet/flex/articles/eckel_video.html</a></p>
<p>The results were great &#8211; a fantastic UI on top of a simple back-end!  Both Bruce and I learned a lot creating this screencast and I hope you will enjoy watching it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2007/01/10/bruce-eckel-is-thinking-in-flex/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
