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

<channel>
	<title>Aral Balkan &#187; SWX</title>
	<atom:link href="http://aralbalkan.com/category/development/swx/feed" rel="self" type="application/rss+xml" />
	<link>http://aralbalkan.com</link>
	<description>Passionate geekisms.</description>
	<lastBuildDate>Wed, 01 Feb 2012 18:53:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
		<item>
		<title>SWXformat.org gets a major update</title>
		<link>http://aralbalkan.com/1753</link>
		<comments>http://aralbalkan.com/1753#comments</comments>
		<pubDate>Mon, 15 Dec 2008 16:48:51 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[SWX]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1753</guid>
		<description><![CDATA[Did you think that SWX &#8212; the native data format for the Flash Platform &#8212; was dead? Think again! I just updated the SWX web site to WordPress 2.7 and a new theme in advance of some exciting announcements that the SWX team is going to be making in the coming days. Subscribe to the [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />Did you think that <a href="http://swxformat.org/" title="SWX: SWF Data Format">SWX</a> &mdash; the native data format for the Flash Platform &mdash; was dead? Think again!</p>
<p>I just updated the <a href="http://swxformat.org/" title="SWX: SWF Data Format">SWX web site</a> to WordPress 2.7 and a new theme in advance of some exciting announcements that the SWX team is going to be making in the coming days. </p>
<p><span id="more-1753"></span></p>
<p>Subscribe to the <a href="http://swxformat.org/feed" title="SWX: SWF Data Format">SWX RSS feed</a> or check the <a href="http://swxformat.org/" title="SWX: SWF Data Format">SWX web site</a> for updates!</p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1753/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>SWX contest winners announced</title>
		<link>http://aralbalkan.com/1113</link>
		<comments>http://aralbalkan.com/1113#comments</comments>
		<pubDate>Mon, 24 Dec 2007 11:12:51 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[SWX]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1113</guid>
		<description><![CDATA[The SWX contest winners have been announced. Read all about it on the SWX blog.]]></description>
			<content:encoded><![CDATA[<p id="top" />The <a href="http://swxformat.org/177" title="SWX Contest Winners at  SWX: SWF Data Format">SWX contest winners</a> have been announced.</p>
<p><a href="http://swxformat.org/177" title="SWX Contest Winners at  SWX: SWF Data Format">Read all about it</a> on the SWX blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1113/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>No, Adobe has not just killed SWX :)</title>
		<link>http://aralbalkan.com/1109</link>
		<comments>http://aralbalkan.com/1109#comments</comments>
		<pubDate>Fri, 14 Dec 2007 04:14:37 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SWX]]></category>
		<category><![CDATA[Amf]]></category>
		<category><![CDATA[blazeds]]></category>
		<category><![CDATA[FUD]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[misinformation]]></category>
		<category><![CDATA[RPC]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1109</guid>
		<description><![CDATA[The reports of SWX's death have been greatly exaggerated. Well, OK, the one report, that is. I'm referring to the blog post by David Arno that asks Has Adobe just killed SWX? David's post refers to the recent opening of the AMF format (good one, Adobe, and about time, I'd say) and the open source [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />The reports of SWX's death have been greatly exaggerated. Well, OK, the one report, that is.</p>
<p>I'm referring to the blog post by David Arno that asks <a href="http://www.davidarno.org/2007/12/13/has-adobe-just-killed-swx/">Has Adobe just killed SWX?</a></p>
<p>David's post refers to the recent opening of the AMF format (good one, Adobe, and about time, I'd say) and the open source release of <a href="http://labs.adobe.com/technologies/blazeds/">BlazeDS</a>. </p>
<p><span id="more-1109"></span></p>
<p>David states:</p>
<blockquote><p>Flash-based RIA developers wanting to pass data between the client and a back-end server have had to choose between three unappealing technologies: XML/JSON, Adobe’s official remoting technologies and unofficial third party tools based on “hacking” Adobe file formats. The first suffers from serialization/ deserialization and verbose data format overheads. The second is just plain expensive (and only works with Java back-ends). The third is of dubious legality.</p></blockquote>
<p>It's a good summary. Unfortunately, it's not accurate. Specifically, the bit about <a href="http://swxformat.org">SWX</a> being of "dubious legality". </p>
<p>Just to be clear, let me state this for the record: There is no doubt whatsoever about the legality of SWX, SWX RPC, SWX PHP or of any of the other implementations of SWX RPC (SWX Ruby, SWX Java, etc.) </p>
<p>It is actually quite unfortunate that Adobe's previously closed approach to all things Flash, including the "you can't make server products if you read the spec" clause in the Flash 8 spec, casts a shadow of doubt over products like SWX that benefit the Flash Platform instead of celebrating their contribution to the ecosystem. Well, I didn't read the SWF spec to create the AVM1 version of SWX PHP so it is not of "debious legality". Stating that SWX PHP is of "dubious legality" is nothing but FUD. </p>
<p>The same goes for the upcoming AVM2 version of SWX PHP that is based on the Flash 9 spec. The Flash 9 spec does not have the same server product restriction of the previous SWF specs so we are using it to create the AVM2 implementation. </p>
<p>David continues:</p>
<blockquote><p>Has Adobe just killed SWX? Until today, SWX lacked (as far as I could tell) the ability to pass complex objects back and forth between server and client, but it more than made up for this by the server providing the data as native SWF files.</p></blockquote>
<p>Unfortunately, again, the information here is just plain wrong.</p>
<p>The whole idea behind SWX is that you can pass complex objects back and forth between the tiers easily -- as they are passed as native data structures. When passing a complex data structure from client to server, SWX RPC encodes it in JSON format. When getting complex (and simple) data types from the server, you receive them as native ActionScript objects within a SWF. In fact, that's what SWX RPC is all about: native data -- both simple and complex. </p>
<p>Finally, David states:</p>
<blockquote><p>However now that AMFPHP is fully legal and SWX remains in the legal grey zone, to me the choice between AMFPHP and SWX becomes a no-brainer. I can see no reason now to use SWX.</p></blockquote>
<p>Again, SWX is not in a "legal grey zone" and the reasons for using SWX are the same as they have always been: simplicity.  </p>
<p>And, as SWX contains <a href="http://amfphp.org">AMFPHP</a> as a library, you are not locked into using SWX RPC in your application. You can start out using the SWX gateway and then switch to using the AMF gateway (or JSON or one of the other gateways provided by AMFPHP) without re-writing your server-side classes. Or use both gateways if you want to: AMF for a web view, for example, and SWX for a mobile view. </p>
<p>And finally, remember that SWX RPC is still the only performant RPC solution for Flash Lite 2+ as remoting is not supported there. As evidenced by the entries in the latest <a href="http://swxformat.org/contest">SWX contest</a> (one of the sponsors of which is Adobe), though, I would say that SWX use is far greater on the web than on mobile. This, as I understand from feedback on the <a href="http://www.flashmobilegroup.org/">Flash Mobile group</a>, is due to the relative lack of Flash Lite 2/3 development in general in the real world currently.</p>
<p>I am personally delighted that Adobe have opened up the AMF protocol and released an open source version of FDS/LiveCycle Data Services. This is something I've been pushing them to do both privately <a href="http://osflash.org/#osflash_philosophy">and publicly</a> for the longest time so I couldn't be happier. It's a big win for the Flash Platform. </p>
<p>Also, I'm very happy to see the progress made by Wade on AMFPHP. As I mentioned earlier, SWX PHP actually uses AMFPHP as a library and I have always supported (and continue to support) the AMFPHP project (just take a cursory glance at the web site if you need proof of that!) Heck, we'd all be calling it <a href="http://aralbalkan.com/103">INFRNO</a> if it wasn't for me! :) </p>
<p>I see AMFPHP and SWX as complimentary products. I made it a primary design decision of SWX PHP to have it be compatible with AMFPHP. I also urge other implementations of SWX RPC to maintain compatibility with the dominant open source AMF implementation on their respective platforms. </p>
<p>Adobe's latest move, far from killing SWX, will only strengthen the Flash Platform and all products on it, including SWX by winning us more developers.</p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1109/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>SWX Contest entries published!</title>
		<link>http://aralbalkan.com/1104</link>
		<comments>http://aralbalkan.com/1104#comments</comments>
		<pubDate>Mon, 10 Dec 2007 12:33:26 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[APIs]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[SWX]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1104</guid>
		<description><![CDATA[The 19 20 22 entries that we received for the SWX Contest have now been published on the SWX Contest page for public viewing. Due to the manageable number of entries, we're going to forego the first round of public voting (although you are welcome to leave comments on the entries) and allow our outstanding [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />The <strike>19</strike> <strike>20</strike> 22 entries that we received for the <a href="http://swxformat.org/contest">SWX Contest</a> have now been published on the <a href="http://swxformat.org/contest">SWX Contest page</a> for public viewing. </p>
<p>Due to the manageable number of entries, we're going to forego the first round of public voting (although you are welcome to leave comments on the entries) and allow our outstanding panel of judges to pick the winners from the Web, API, and Mobile categories in a single round of voting. </p>
<p><span id="more-1104"></span></p>
<p>We received <strike>8</strike> <strike>9</strike> 10 entries in the web category, <strike>3</strike> 4 in the mobile category, and we now have 8 new SWX APIs thanks to the contest, ranging from a generic XML to SWX parser called SWXml to APIs for popular services such as WordPress, Backpack, Technorati, Kuler, and Verisign/Paypal Payments Pro.</p>
<p>I want to take this opportunity to thank all the contestants for their hard work. Here's wishing all of you the best of luck!</p>
<p>The winners will be announced on December 24th, 2007. </p>
<p>Also, a big thank you to our sponsors: <a href="http://adobe.com/uk">Adobe UK</a>, <a href="http://lynda.com">Lynda.com</a>, <a href="http://buraks.com">Burak Kalayci (ASV)</a>, <a href="http://friendsofed.com">Friends of ED</a>, and <a href="http://aralbalkan.com">yours truly</a> (Nabaztag bunnies and iPod Touches).</p>
<p><a href="http://swxformat.org/contest/">View the SWX Contest entries</a>.</p>
<p><strong>Update: </strong> I messed up and forgot to add Julio Rodriguez's entry to the Web category this morning. I've now updated the page with his entry and informed the judges. Thanks for getting in touch with me Julio and apologies for the initial omission. </p>
<p><strong>Update: </strong> John Hattan's entries in the Web and Mobile categories also somehow ended up in the black hole of my email. Sorry, John, I've added them to the contest page and informed the judges now.</p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1104/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>SWX PHP AVM2/Flash 9: Status update</title>
		<link>http://aralbalkan.com/1098</link>
		<comments>http://aralbalkan.com/1098#comments</comments>
		<pubDate>Thu, 06 Dec 2007 10:37:07 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[SWX]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[avm2]]></category>
		<category><![CDATA[Flash 9]]></category>
		<category><![CDATA[team members]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1098</guid>
		<description><![CDATA[I know a lot of your are anxiously awaiting the AVM2/Flash 9 version of SWX PHP so you can start using SWX RPC in your ActionScript 3 and Flex 2/3 projects. I want to update you on where we are on that front. I'm excited to announce that we have three excellent developers who are [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />I know a lot of your are anxiously awaiting the AVM2/Flash 9 version of <a href="http://swxformat.org/documentation/#77">SWX PHP</a> so you can start using <a href="http://swxformat.org/documentation/#75">SWX RPC</a> in your ActionScript 3 and Flex 2/3 projects. I want to update you on where we are on that front.</p>
<p>I'm excited to announce that we have three excellent developers who are currently involved in writing the Flash 9 assembler for SWX and I'd like to introduce you to them. </p>
<p><span id="more-1098"></span></p>
<p>Richard Lord is an ActionScript, PHP, and all-things-binary guru who by day creates cool Flash games with his company <a href="http://bigroom.co.uk/">Big Room</a> in London. I met Richard at Flash on the Beach this year and he graciously agreed to help out with the project. Richard's just completed some of the key methods on the SWX 9 assembler and his code is going to make it _much_ easier for us to move on with the rest of it. </p>
<p>Also on the project are two of our newest members, Chris Sperry and Tom Kennett from <a href="http://www.flexiblefactory.co.uk/flexible/">FlexibleFactory</a> here in Brighton. This uber-geek duo are known as the Flash A-Team here -- because if you have a Flash problem that no one else can solve... well, you get the idea. In their spare time they do things like <a href="http://www.flexiblefactory.co.uk/flexible/?p=26">port Sinclair Spectrum emulators to Flash</a>. And now, they're on board with the Flash 9 version of SWX. Yay!</p>
<p>So things have kicked off and we're working on it. I'll update you guys again when we have more to share.</p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1098/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>SWX contest deadline is tomorrow!</title>
		<link>http://aralbalkan.com/1095</link>
		<comments>http://aralbalkan.com/1095#comments</comments>
		<pubDate>Sat, 01 Dec 2007 23:16:40 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[SWX]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1095</guid>
		<description><![CDATA[A quick reminder that the SWX Contest deadline is tomorrow. I've already received a number of entries (thanks guys and gals) and you can continue to send in entries until midnight (GMT) tomorrow night (December 2nd). For instructions on where to send your entries and the information to include, please read my post on SWX [...]]]></description>
			<content:encoded><![CDATA[<p id="top" /><a href="http://swxformat.org/150"><img src="http://aralbalkan.com/wp-content/uploads/2007/10/swx_contest_07.jpg" width="500" height="150"/></a></p>
<p>A quick reminder that the SWX Contest deadline is tomorrow. </p>
<p><span id="more-1095"></span></p>
<p>I've already received a number of entries (thanks guys and gals) and you can continue to send in entries until midnight (GMT) tomorrow night (December 2nd). </p>
<p>For instructions on where to send your entries and the information to include, please read my post on <a href="http://swxformat.org/150">SWX Contest Submissions</a> on the <a href="http://swxformat.org">SWX web site</a>. </p>
<p>Good luck! :) </p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1095/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>FlashBrighton&#8217;s Big Day Out: Beyond the buttons</title>
		<link>http://aralbalkan.com/1084</link>
		<comments>http://aralbalkan.com/1084#comments</comments>
		<pubDate>Tue, 20 Nov 2007 10:15:59 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[APIs]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[SWX]]></category>
		<category><![CDATA[Brighton]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[flashbrighton]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1084</guid>
		<description><![CDATA[Here's quick update on the session I'm presenting at FlashBrighton's Big Day Out (the event's now sold out) this Saturday. The talk is titled Beyond the Buttons: Learning new programming languages, development tools, and technologies is a fun (and essential) part of what we do but they are not ends in and of themselves. IDEs [...]]]></description>
			<content:encoded><![CDATA[<p id="top" /><a href="http://fbbigdayout.org/"><img src="images/fb_big_day_out.jpg" alt="Flash Brighton Big Day Out" /></a></p>
<p>Here's quick update on the session I'm presenting at <a href="http://fbbigdayout.org/">FlashBrighton's Big Day Out</a> (the event's now sold out) this Saturday. The talk is titled Beyond the Buttons:</p>
<p><span id="more-1084"></span></p>
<blockquote><p>Learning new programming languages, development tools, and technologies is a fun (and essential) part of what we do but they are not ends in and of themselves. IDEs like Flash and Flex Builder, languages like ActionScript 3, and technologies like AIR are merely tools, like the painter's brushes, easels, and paints, the animator's lightbox, and the photographer's camera. In this session, Aral looks beyond the tools to what you can make with them. You will not learn any new techniques or programming tricks but instead stock up on ideas and inspiration to spark your own creative endeavors.</p></blockquote>
<p>Looking forward to seeing some of you this weekend!</p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1084/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>Coming up: Mock data support and better default argument handling in the SWX Service Explorer</title>
		<link>http://aralbalkan.com/1083</link>
		<comments>http://aralbalkan.com/1083#comments</comments>
		<pubDate>Sat, 17 Nov 2007 19:34:58 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[APIs]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[SWX]]></category>
		<category><![CDATA[Tools and Utilities]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1083</guid>
		<description><![CDATA[I'm currently working on a stealthy little pet project of mine that involves creating a PayPal Website Payments Pro API in SWX. A couple of the methods in the API require quite a few arguments (all the billing-related fields for processing a credit card transaction, for example) and I quickly got sick of having to [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />I'm currently working on a stealthy little pet project of mine that involves creating a <a href="https://www.paypal.com/uk/cgi-bin/webscr?cmd=_wp-pro-overview-outside">PayPal Website Payments Pro API</a> in <a href="http://swxformat.org">SWX</a>. A couple of the methods in the API require quite a few arguments (all the billing-related fields for processing a credit card transaction, for example) and I quickly got sick of having to enter mock data manually in the SWX Service Explorer to test and debug methods calls. (This is one scenario where Transfer Object support would be helpful but adding that right now would complicate things too much.) So, to make things easier for myself (and hopefully some of you as well), I've added mock data support (both static and dynamic) to <a href="http://swxformat.org/documentation/swx-php/">SWX PHP</a> and the <a href="http://swxformat.org/php/explorer/">SWX Service Explorer</a>. </p>
<p><strong>Using mock data</strong></p>
<p><span id="more-1083"></span></p>
<p>In the SWX Service Explorer, methods that have mock data will have a "Use mock data" button enabled.</p>
<p><img src="images/sse_up1.gif" width="500" height="220" /></p>
<p>Clicking the button will fill the arguments with the mock data, as the following screenshot demonstrates. </p>
<p><img src="images/sse3.gif" width="500" height="235" /></p>
<p><strong>Creating static mock data</strong></p>
<p>The first way to create mock data is to include it in the JavaDoc-style comments in your service classes. Place mock data at the end of the comment and surround it in square brackets. </p>
<pre class="php"><span style="color: #808080; font-style: italic;">/**
   * Do a direct credit card payment.
   *
   * @param (str) A unique order id [12345-12345]
   * @param (str) Credit card number [5105105105105100]
   * @param (str) Card type (Visa, American Express, Mastercard, etc.) [Mastercard]
   * @param (str) 3 or 4 character Credit Security Code [123]
   * @param (number, 4 digits MMYY) Expiry date [1209]
   * @param (number) Amount to charge [2.50]
</span></pre>
<p>This is a quick and easy way of adding mock data to a method. The recommended practice here, when possible, is to place enough mock data in a method to allow the user to make a successful call via the SWX Service Explorer. This is in keeping with the SWX philosophy of making things Just Work and <a href="http://aralbalkan.com/687">Show, Don't Tell</a>. </p>
<p><strong>Generating mock data</strong></p>
<p>The new mock data feature does not limit you to static mock data. You can also generate dynamic mock data with a little bit of PHP. </p>
<p>To generate mock data for a method called <code>doDirectPayment()</code>, for example, you can include a private method called <code>_doDirectPaymentMock()</code> in your service class. This method gets called (and passed an array of any static mock data for the method, which you can either add to or ignore) by the service explorer. It expects an array of mock data (one for each argument) to be returned as per the following example. </p>
<pre class="php"><span style="color: #000000; font-weight: bold;">function</span> _doDirectPaymentMock<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$mockData</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// Generate a random order number</span>
    <span style="color: #0000ff;">$orderNum</span> = <span style="color: #ff0000;">'&quot;'</span>.<a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'ymd-H'</span><span style="color: #66cc66;">&#41;</span>.<a href="http://www.php.net/rand"><span style="color: #000066;">rand</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span>,<span style="color: #cc66cc;">9999</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">'&quot;'</span>;
    <span style="color: #0000ff;">$mockData</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$orderNum</span>;
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$mockData</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>In the above example, the order number needs to be unique so it's generated by code but all the other default values are statically obtained from the comments. </p>
<p><strong>Update: </strong>In the latest version of the SWX Service Explorer in SVN, the dynamic mock data now updates every time you press the <em>Use mock data</em> button.</p>
<p><strong>Default values for optional arguments</strong></p>
<p>I've also modified how default parameters are handled in the SWX Service Explorer. Previously, they were handled Really Badly (tm). i.e., they were basically ignored. Now, if your method has a default value defined, it is displayed in the SWX Service Explorer by default. This is true even if you define the default value as a constant (in PHP4, you must stick to the CONSTANT_NAMING_CONVENTIONS for constant resolution to work correctly.) </p>
<p>(Note that in PHP5, you must place all optional arguments at the end of your method signature. This is a best practice to follow in any case.) </p>
<p>The following screenshot shows how default values for arguments are handled in the new service explorer: </p>
<p><img src="images/sse1.gif" width="500" height="98" /></p>
<p>Currently, the changes outlined in this post are only available from the <a href="http://svn1.cvsdude.com/osflash/swx/trunk/">trunk of the SWX Subversion repository</a>. I'd appreciate it if you guys can test it out. After further testing, it will be included in the next SWX PHP release. </p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1083/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>Ted&#8217;s Pack of Cards in SWX</title>
		<link>http://aralbalkan.com/1079</link>
		<comments>http://aralbalkan.com/1079#comments</comments>
		<pubDate>Wed, 14 Nov 2007 18:40:53 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[APIs]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[SWX]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1079</guid>
		<description><![CDATA[This demo requires Flash. I was looking for a distraction from the PayPal integration stuff I'm working on today for my Super Secret New Project (tm) when I ran across Ted Patrick's Cards API post from yesterday and decided to quickly implement a SWX API for it. Ted has created a very simple REST API [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />
<div id="tedcards" align="center">This demo requires Flash.</div>
<p><script type="text/javascript" defer="defer"> /*<!--*/ var so = new SWFObject("swfs/cards.swf", "cards_swf", "501", "376", "8");  so.write("tedcards"); /*-->*/ </script></p>
<p>I was looking for a distraction from the PayPal integration stuff I'm working on today for my Super Secret New Project (tm) when I ran across <a href="http://www.onflex.org/ted/2007/11/apis-with-delimited-ascii-text-vs-xml.php">Ted Patrick's Cards API post</a> from yesterday and decided to quickly implement a <a href="http://swxformat.org">SWX</a> API for it. </p>
<p><span id="more-1079"></span></p>
<p>Ted has created a very simple REST API for a deck of cards. It currently has one method which returns a shuffled deck (or decks) of cards. </p>
<p>The <a href="http://swxformat.org/php/explorer">SWX API</a> for it was a cinch to write. Here's the PHP code for it:</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;../BaseService.php&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Cards <span style="color: #000000; font-weight: bold;">extends</span> BaseService
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> <a href="http://www.php.net/shuffle"><span style="color: #000066;">shuffle</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$numDecks</span> = <span style="color: #cc66cc;">1</span>, <span style="color: #0000ff;">$numJokers</span> = <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$url</span> = <span style="color: #ff0000;">&quot;http://onflex.org/api/games/cards/shuffle/1/$numDecks/$numJokers&quot;</span>;
&nbsp;
        <span style="color: #0000ff;">$result</span> = <span style="color: #0000ff;">$this</span>-&gt;_call<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #0000ff;">$shuffledDeck</span> = <a href="http://www.php.net/explode"><span style="color: #000066;">explode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'|'</span>, <span style="color: #0000ff;">$result</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$timeStamp</span> = <a href="http://www.php.net/array_shift"><span style="color: #000066;">array_shift</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$shuffledDeck</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'timeStamp'</span> =&gt; <span style="color: #0000ff;">$timeStamp</span>, <span style="color: #ff0000;">'deck'</span> =&gt; <span style="color: #0000ff;">$shuffledDeck</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>I wasn't sure if the timestamp was in there just to stop caching or whether it would be useful so I left it in :) </p>
<p>You can play with it online using the <a href="http://swxformat.org/php/explorer/">SWX Service Explorer</a> on the <a href="http://swxformat.org/documentation#92">Public SWX Gateway</a>. </p>
<p>The demo SWF you see at the top of the post calls the service using the following code:</p>
<pre class="actionscript"><span style="color: #0066CC;">import</span> org.<span style="color: #006600;">swxformat</span>.<span style="color: #006600;">SWX</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> swx:SWX = <span style="color: #000000; font-weight: bold;">new</span> SWX<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
swx.<span style="color: #006600;">gateway</span> = <span style="color: #ff0000;">&quot;http://swxformat.org/php/swx.php&quot;</span>;
swx.<span style="color: #006600;">encoding</span> = <span style="color: #ff0000;">&quot;GET&quot;</span>;
swx.<span style="color: #006600;">debug</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> callDetails:<span style="color: #0066CC;">Object</span> =
<span style="color: #66cc66;">&#123;</span>
    serviceClass: <span style="color: #ff0000;">&quot;Cards&quot;</span>,
    method: <span style="color: #ff0000;">&quot;shuffle&quot;</span>,
    result: <span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">this</span>, resultHandler<span style="color: #66cc66;">&#93;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// ... other stuff (UI, etc.)</span>
&nbsp;
swx.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span>callDetails<span style="color: #66cc66;">&#41;</span>;</pre>
<p>And, since the data is returned in a native SWF array, the result handler simply iterates over the array to display the cards:</p>
<pre class="actionscript"><span style="color: #000000; font-weight: bold;">function</span> resultHandler<span style="color: #66cc66;">&#40;</span>event:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> deck:<span style="color: #0066CC;">Array</span> = event.<span style="color: #006600;">result</span>.<span style="color: #006600;">deck</span>;
&nbsp;
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>; i &lt; <span style="color: #cc66cc;">52</span>; i++<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">var</span> cardInit:<span style="color: #0066CC;">Object</span> = <span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">_x</span>: x += <span style="color: #cc66cc;">50</span>, <span style="color: #0066CC;">_y</span>: y, <span style="color: #0066CC;">_width</span>: <span style="color: #cc66cc;">50</span>, <span style="color: #0066CC;">_height</span>: <span style="color: #cc66cc;">75</span><span style="color: #66cc66;">&#125;</span>;
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>i%<span style="color: #cc66cc;">12</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            cardInit.<span style="color: #0066CC;">_y</span> = y += <span style="color: #cc66cc;">75</span>;
            cardInit.<span style="color: #0066CC;">_x</span> = x = <span style="color: #cc66cc;">0</span>;
        <span style="color: #66cc66;">&#125;</span>
        <span style="color: #0066CC;">_root</span>.<span style="color: #0066CC;">attachMovie</span><span style="color: #66cc66;">&#40;</span>deck<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000;">&quot;card&quot;</span>+i, i, cardInit<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>Don't forget, like all the other SWX APIs, you can call this API from Flash 6+ (including FlashLite 2.0 and 2.1) using ActionScript 1 or 2 (not 3 yet).  </p>
<p><a href="downloads/swx_aslib_cards_demo.zip">Download the demo</a> (zipped; 2.6MB).</p>
<p>The demo includes the SWX ActionScript Library which comes with other SWX sample apps that you can play with.</p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1079/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
		<item>
		<title>SWXml RSS reader in three minutes by Dan Thomas</title>
		<link>http://aralbalkan.com/1077</link>
		<comments>http://aralbalkan.com/1077#comments</comments>
		<pubDate>Sun, 11 Nov 2007 11:07:54 +0000</pubDate>
		<dc:creator>Aral</dc:creator>
				<category><![CDATA[SWX]]></category>

		<guid isPermaLink="false">http://aralbalkan.com/1077</guid>
		<description><![CDATA[My friend Dan played around with SWXml yesterday and hacked together a simple RSS reader in three minutes: That’s incredible on the easy scale . . . if I used Flash regularly I think that would have taken me around one minute to do. Read Dan's post on SWXml here.]]></description>
			<content:encoded><![CDATA[<p id="top" /><a href="http://danny-t.co.uk/index.php/2007/11/10/swx-rss-reader-in-3-minutes/"><img src="images/dan_swxml_rss_reader.gif" width="500" height="130" alt="SWXML RSS reader"/></a></p>
<p>My friend <a href="http://danny-t.co.uk/">Dan</a> played around with <a href="http://aralbalkan.com/1075">SWXml</a> yesterday and hacked together a simple RSS reader in three minutes:</p>
<p><span id="more-1077"></span></p>
<blockquote><p>That’s incredible on the easy scale . . . if I used Flash regularly I think that would have taken me around one minute to do.</p></blockquote>
<p><a href="http://danny-t.co.uk/index.php/2007/11/10/swx-rss-reader-in-3-minutes/">Read Dan's post on SWXml here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://aralbalkan.com/1077/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc/2.0/uk/</creativeCommons:license>
	</item>
	</channel>
</rss>

