<?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>Karoshi Ethos &#187; Kung-Foo</title>
	<atom:link href="http://karoshiethos.com/tag/kung-foo/feed/" rel="self" type="application/rss+xml" />
	<link>http://karoshiethos.com</link>
	<description>Navigating the treacherous waters of interactive technology</description>
	<lastBuildDate>Fri, 11 May 2012 20:46:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Serving a Flash Socket Policy File From Processing</title>
		<link>http://karoshiethos.com/2010/03/26/serving-a-flash-socket-policy-file-from-processing-org/</link>
		<comments>http://karoshiethos.com/2010/03/26/serving-a-flash-socket-policy-file-from-processing-org/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 03:52:53 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Kung-Foo]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=500</guid>
		<description><![CDATA[Last night I spent way too long trying to get AS3 to communicate with a simple socket server I wrote in Processing. I've done this kind of thing before and seemed to recall that it was pretty simple. But in the meantime, Adobe, in an effort to be more secure, has changed the Flash player [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I spent way too long trying to get AS3 to communicate with a simple socket server I wrote in <a href="http://processing.org/" target="_blank">Processing</a>. I've done this kind of thing before and seemed to recall that it was pretty simple. But in the meantime, Adobe, <a href="http://www.adobe.com/devnet/flashplayer/articles/flash_player9_security_update.html#socket_policy" target="_blank">in an effort to be more secure</a>, has changed the Flash player to require a "<a href="http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security_04.html" target="_blank">socket policy file</a>". The socket policy file is very similar to the familiar crossdomain.xml file that defines security permissions for HTTP access. Unfortunately, the socket policy file must either be sent on demand from the sockets that the player is attempting to access, <a href="http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html" target="_blank">or from port 843</a> on the host that the player is attempting to connect to. If all you want to do is run a quick and dirty socket server and have Flash clients connect to it, this is all a huge PITA.</p>
<p>Since <a href="http://e-articles.info/e/a/title/Privileged-Ports-of-a-UNIX-machine/" target="_blank">ports below 1024 require root permissions</a> in order for processes to use them on OS X, and I didn't want to run some other server process just to serve policy files, I needed to kludge a way to send the policy file from my nice, elegant socket server every time a client connected and requested a policy file. The example below is a simplified version, as it only listens on one port - the project I was working on was basically a proxy from one SWF to another, so I had two socket servers that needed to listen for the requests for a policy file and respond. In this example, the server listens for connections on port 5208, and simply echoes incoming data from the client to System.out, and has some visual feedback in the window. When the incoming message contains the string "policy-file-request" (the entire message from Flash will be
<policy-file-request/> terminated with a null char), we simply spit back the XML for a wide-open socket policy, followed by a null char (This is required, or the Flash player will not accept the policy file. This is what tied me in knots last night. RTFM!)</p>
<pre class="syntax brush-java">import processing.net.*;

int bgLevel = 0;
int port = 5208;
Server server;

String flashDomainPolicy = &quot;&lt;?xml version=\&quot;1.0\&quot;?&gt;&quot;
                              +&quot;&lt;cross-domain-policy xmlns:xsi=\&quot;http://www.w3.org/2001/XMLSchema-instance\&quot; xsi:noNamespaceSchemaLocation=\&quot;http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd\&quot;&gt;&quot;
                              +&quot;&lt;allow-access-from domain=\&quot;*\&quot; to-ports=\&quot;*\&quot; secure=\&quot;false\&quot; /&gt;&quot;
                              +&quot;&lt;site-control permitted-cross-domain-policies=\&quot;all\&quot; /&gt;&quot;
                              +&quot;&lt;/cross-domain-policy&gt;&quot;;

void setup ()
{
  size(200, 200);
  server = new Server(this, port);
  background(bgLevel);
}

void draw ()
{
  Client client = server.available();

  if (client !=null)
  {
    String message = trim(client.readString());

    if (message != null)
    {
      if (match(message,&quot;policy-file-request&quot;) != null)
      {
        sendFlashPolicy(server);
      }
      else
      {
        server.write(message);
        System.out.println(message);

        // Change the background color to indicate message activity
        bgLevel = 255;
      }
    }
  }

  // Fade to black
  if (bgLevel&gt;1)
  {
    bgLevel-=2;
    background(bgLevel);
  }
}

void sendFlashPolicy(Server socketServer)
{
    socketServer.write(flashDomainPolicy+char(0));
    System.out.println(&quot;Sending Flash policy file&quot;);
}</pre>
<p>You can test this without a Flash client by firing up the sketch and telnetting to the port. Any strings you send will be echoed to System.out, unless you send the string "policy-file-request" in your message, which will result in the server sending the policy XML to you. You should be able to connect a Flash client to this server and start communicating right away.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2010/03/26/serving-a-flash-socket-policy-file-from-processing-org/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ClipStation Clipboard Writer 2.0 Released</title>
		<link>http://karoshiethos.com/2009/07/12/clipstation-clipboard-writer-20-released/</link>
		<comments>http://karoshiethos.com/2009/07/12/clipstation-clipboard-writer-20-released/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 00:55:57 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[ClipStation]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Kung-Foo]]></category>
		<category><![CDATA[SWFObject]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=408</guid>
		<description><![CDATA[ClipStation is a free lightweight solution for writing to your user’s clipboard from an HTML page. Using a small SWF that is embedded dynamically via JavaScript, you can pass an unlimited number of content clips onto the clipboard. ClipStation is designed to be lightweight, flexible, and easy to implement. What makes ClipStation different from other [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thirdpartylabs.com/clipstation/">ClipStation</a> is a free lightweight solution for writing to your user’s clipboard from an HTML page. Using a small SWF that is embedded dynamically via JavaScript, you can pass an unlimited number of content clips onto the clipboard.</p>
<p>ClipStation is designed to be lightweight, flexible, and easy to implement. What makes ClipStation different from other clipboard SWF solutions is the ability to decode HTML character entities, allowing you to pass complex HTML markup to the clipboard from within form elements, divs, pre tags, etc. We developed ClipStation for use on a widget sharing page we've implemented for a client. After looking around for a good lightweight cross-browser solution and coming up empty handed, we decided to build our own. We're now happy to offer it to you at the low, low price of free. </p>
<p>Version 2.0 includes changes to allow access to the clipboard in Flash Player 10. Adobe changed the security requirements for clipboard access in version 10 of the player; now a user action is required before a SWF may access the clipboard. Instead of using a single hidden instance of the ClipStation SWF, we embed an instance for every clip that the user clicks to perform the clipboard copy. A source distribution is available, so you can change the design to fit your needs.</p>
<p>More information and the release package can be found at <a href="http://thirdpartylabs.com/clipstation/">thirdpartylabs.com/clipstation/</a></p>
<p><a href="http://thirdpartylabs.com/clipstation/">»Download ClipStation 2.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2009/07/12/clipstation-clipboard-writer-20-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lazy developers, good libraries, and The 80/20 Rule</title>
		<link>http://karoshiethos.com/2008/07/31/lazy-developers-good-libraries-and-the-8020-rule/</link>
		<comments>http://karoshiethos.com/2008/07/31/lazy-developers-good-libraries-and-the-8020-rule/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 22:51:35 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Kung-Foo]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[SWFAddress]]></category>
		<category><![CDATA[SWFObject]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=59</guid>
		<description><![CDATA[I was searching for something or other related to SWFAddress the other day, and ran across a blog post talking about the launch of SWFObject2 and SWFAddress2, and how handy they were for building usable Flash sites. No surprises there, they are in fact very handy. What caught my attention was this comment on the [...]]]></description>
			<content:encoded><![CDATA[<p>I was searching for something or other related to <a href="http://www.asual.com/swfaddress/" target="_blank">SWFAddress</a> the other day, and ran across a blog post talking about the launch of <a href="http://blog.deconcept.com/swfobject/" target="_blank">SWFObject2</a> and SWFAddress2, and how handy they were for building usable Flash sites. No surprises there, they are in fact very handy. What caught my attention was this comment on the post:</p>
<blockquote><p>"We were looking at SWF Address a while ago. While it’s very cool it was useless for what we wanted. By using HTML anchors (# in the URL) the deep links are only relevant to client side logic inside the browser (JavaScript, HTML and Flash).</p>
<p>If you serve HTML content generated server side, in addition to flash there is no way to extract the deep link from the URL (after the #) as it’s not passed to the server in the request!</p>
<p>I will be interested to see if they have updated this in the new version… and also see what changes have been made to SWFObject2, or swffix or whatever it’s called these days."</p></blockquote>
<p>I had to read that twice.</p>
<p>SWFAddress is not a solution for implementing multiple content types. It's purpose in life is to keep the browser informed about the user's movements within a rich application. It does that job very well. One of the things you can do with SWFAddress is implement <em>your own</em> solution for managing your URLs across multiple content types.</p>
<p><a href="http://karoshiethos.com/author/jon/">Jon</a> and I are just finishing up a big client site for which we have a nifty flash client and an SEO/Usability optimized HTML version of all content on the site. SWFAddress allowed us to maintain a similar URI structure for both, and a little bit of custom javascript handles the translation of SWFAddress URIs, which all start with # to the standard URIs, and vice-versa. SWFObject handles the embedding of the Flash client. It's a really simple solution that took less than an afternoon to prototype and refine into a production-ready solution. I'm not saying this to make myself out to be a bad-ass, it's just <strong>not rocket science</strong>. All it takes is a general understanding of how the tools work, and the willingness to craft your own solutions to your specific problems.</p>
<p>There are well built, elegant, open source libraries to do just about anything these days. The thing is, they're libraries, tools, not complete solutions. They will solve the tough 80% of your problem for you. It's up to you to do the last 20% and make the tool work for you. Enter the <a href="http://en.wikipedia.org/wiki/Pareto_principle" target="_blank">80/20 rule</a>, or, more specifically, the <a title="2080 concept" href="http://en.wikipedia.org/wiki/2080_%28software_concept%29" target="_blank">2080 concept</a>.</p>
<blockquote><p>The 20 missing percent of functionality will take up 80% of the build time.</p></blockquote>
<p>If you expect canned solutions to solve your problems 100%, you will constantly be disappointed, and, most likely, be building poor software. If you go into your project knowing that a tool you will rely on provides a limited set of functionality, and you will need to do devote time and energy to make it fit, you will be more likely to succeed.</p>
<blockquote><p>"There is something to be learned from a rainstorm. When meeting with a sudden shower, you try not to get wet and run quickly along the road. But doing such things as passing under the eaves of houses, you still get wet. When you are resolved from the beginning, you will not be perplexed, though you still get the same soaking. This understanding extends to everything."</p>
<p style="text-align: center;"><em>-Yamamoto Tsunemoto, <a href="http://en.wikipedia.org/wiki/Hagakure">Hagakure</a></em></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2008/07/31/lazy-developers-good-libraries-and-the-8020-rule/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

