<?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>blog.joa-ebert.com - Blog of Joa Ebert &#187; Flash</title>
	<atom:link href="http://blog.joa-ebert.com/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joa-ebert.com</link>
	<description>Actionscript3, Flash, Scala, Java, C#, C++, Algorithms &#38; Imageprocessing</description>
	<lastBuildDate>Wed, 28 Jul 2010 16:47:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Apparat And Maven</title>
		<link>http://blog.joa-ebert.com/2010/07/03/apparat-and-maven/</link>
		<comments>http://blog.joa-ebert.com/2010/07/03/apparat-and-maven/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 09:10:06 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[flexmojos]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=610</guid>
		<description><![CDATA[Two days ago I made a major change to the Apparat repos [...]]]></description>
			<content:encoded><![CDATA[<p>Two days ago I made a major change to the Apparat repository. I completely restructured the layout and fully integrated Apparat with Maven. We have now a plugin and archetypes for easy tooling. I also synchronized Apparat with the Maven central repository two weeks ago.</p>
<p>You might ask what the hell this is about. So in the current state you can download Apparat from Google Code. Then you have to have a working Scala installation which has been used to build Apparat. Whenever Scala is updated, I have to updated Apparat, and you will have to download Apparat again and install a new Scala version. This is absolutely cumbersome. This will change of course when Scala 2.8 is officially released.</p>
<p>I know that some people will always require command line access for Apparat. I am sorry for you at the moment that we have to play this game until 2.8 is out.</p>
<p>For the rest this is good news. If you have a working Maven 3.x version you can use the Apparat plugin and get automatic updates. This means you have to configure your project only once and do not bother with Scala and Apparat anymore. In fact if you want to you could also use the Apparat snapshot repository and get live updates.</p>
<p>Project configuration and setup is something one should not have to deal with. Therefore you can use the archetypes. I have built one for TurboDieselSportInjection.</p>
<pre><code>mvn archetype:generate \
  -DarchetypeRepository=http://oss.sonatype.org/content/repositories/snapshots \
  -DarchetypeGroupId=com.googlecode.apparat \
  -DarchetypeArtifactId=apparat-archetype-tdsi \
  -DarchetypeVersion=1.0-SNAPSHOT</code></pre>
<p>This terminal command is all you need to do to create a new project that is ready to compile &#8212; with TurboDieselSportInjection enabled. And it will automatically use the latest Apparat version.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F07%2F03%2Fapparat-and-maven%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F07%2F03%2Fapparat-and-maven%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2010/07/03/apparat-and-maven/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/07/03/apparat-and-maven/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Apparat Example</title>
		<link>http://blog.joa-ebert.com/2010/05/26/new-apparat-example/</link>
		<comments>http://blog.joa-ebert.com/2010/05/26/new-apparat-example/#comments</comments>
		<pubDate>Wed, 26 May 2010 11:50:54 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[inline]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=595</guid>
		<description><![CDATA[Good news everyone. The Apparat inline expansion works  [...]]]></description>
			<content:encoded><![CDATA[<p>Good news everyone. The Apparat inline expansion works now to full extent after fixing some minor bugs. A complete example is also available. Just change the paths in the <code>build.properties</code> file and compile everything using Ant.</p>
<div align="center"><img src="http://blog.joa-ebert.com/wp-content/images/apparat-shot.png" width="399" height="183" alt="Apparat Example"/></div>
<p>Use the inline feature with care. Apparat does not try to optimize your code and performs nothing but dead simple inlining. This can lead to <b>slower</b> code due to the creation of lots of local registers. Your code gets also much bigger and will require more space in memory. I am actually not a fan of manual inlining at all. I think it makes only sense to inline code if you have a powerful optimizer available that will cleanup the whole mess.</p>
<p>The fun story about this example is that the inlined version is slower using the lastes Flash Player release candidate if you have only 40.000 particles. That is why I increased the number of particles to 80.000 ;). I developed the example using an old standalone player and the inlined version was nearly twice as fast. However when I watched the example in the browser with the latest release candidate the game was completely different. Kudos to Adobe for significantly improving the Flash Player performance!</p>
<ul>
<li><a href="http://www.joa-ebert.com/swfs/apparat-example/as3" target="_blank" title="Pure AS3 version">AS3-only Version</a></li>
<li><a href="http://www.joa-ebert.com/swfs/apparat-example/apparat" target="_blank" title="Inline version">Inline Version</a></li>
<li><a href="http://code.google.com/p/apparat/downloads/detail?name=apparat-ant-example.zip" target="_blank" title="Source">Source</a></li>
</ul>
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F26%2Fnew-apparat-example%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F26%2Fnew-apparat-example%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2010/05/26/new-apparat-example/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/05/26/new-apparat-example/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Inline Expansion</title>
		<link>http://blog.joa-ebert.com/2010/05/24/inline-expansion/</link>
		<comments>http://blog.joa-ebert.com/2010/05/24/inline-expansion/#comments</comments>
		<pubDate>Mon, 24 May 2010 18:12:57 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[inline expansion]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=593</guid>
		<description><![CDATA[In addition to macro expansion Apparat has now inline e [...]]]></description>
			<content:encoded><![CDATA[<p>In addition to macro expansion Apparat has now inline expansion as well. It works nearly the same way as macro expansion but without most of its limitations. To define a class for inline usage it must extend <code>apparat.inline.Inlined</code> and all its methods must be static. However the cool thing is that you can also return values in contrast to macro expansion. You can also pass normal parameters. For instance <code>FastMath.sin(FastMath.sqrt(2.0))</code> is valid code using inline expansion. It is enabled by default in TDSI.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F24%2Finline-expansion%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F24%2Finline-expansion%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2010/05/24/inline-expansion/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/05/24/inline-expansion/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Apparat For Scala 2.8 RC2</title>
		<link>http://blog.joa-ebert.com/2010/05/24/apparat-for-scala-2-8-rc2/</link>
		<comments>http://blog.joa-ebert.com/2010/05/24/apparat-for-scala-2-8-rc2/#comments</comments>
		<pubDate>Mon, 24 May 2010 13:44:37 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[7z]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[scala 2.8-rc2]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=591</guid>
		<description><![CDATA[Apparat is now available using the Scala 2.8-RC2 build. [...]]]></description>
			<content:encoded><![CDATA[<p>Apparat is now available using the Scala 2.8-RC2 build. You can <a href="http://code.google.com/p/apparat/downloads/list?q=label:scala-2.8.0.RC2" target="_blank" title="Apparat on Google Code">find appropriate downloads</a> now on Google Code by searching for the Scala version of your choice. 7z compression on OS X should work now as well.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F24%2Fapparat-for-scala-2-8-rc2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F24%2Fapparat-for-scala-2-8-rc2%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2010/05/24/apparat-for-scala-2-8-rc2/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/05/24/apparat-for-scala-2-8-rc2/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Macro Expansion</title>
		<link>http://blog.joa-ebert.com/2010/05/10/macro-expansion/</link>
		<comments>http://blog.joa-ebert.com/2010/05/10/macro-expansion/#comments</comments>
		<pubDate>Mon, 10 May 2010 17:31:34 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[inline]]></category>
		<category><![CDATA[macro expansion]]></category>
		<category><![CDATA[taas]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=588</guid>
		<description><![CDATA[Apparat has another new feature called Macro Expansion. [...]]]></description>
			<content:encoded><![CDATA[<p>Apparat has another new feature called <a href="http://code.google.com/p/apparat/wiki/MacroExpansion" title="Macro Expansion" target="_blank">Macro Expansion</a>. I talked about this with Nico Zimmermann at FFK in Cologne. Nico was using TDSI for a project but he was not very satisfied with it because you have to inline all inverse-square root tricks manually.<br />
This is why Apparat has now macro expansion. I am actually not a big fan of it. I think a good compiler would do this for you without you having to go through all the steps. Unfortunately writing this compiler will take longer than the couple of hours I have spent on the macro expansion today.</p>
<p>So if you want to have quick and dirty inlining capabilities: <a href="http://code.google.com/p/apparat/wiki/MacroExpansion" target="_blank" title="Macro Expansion">this is for you</a>. It is an easy fix for a feature a lot of people have asked for. I will continue working on TAAS to implement this much better in the future.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F10%2Fmacro-expansion%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F10%2Fmacro-expansion%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2010/05/10/macro-expansion/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/05/10/macro-expansion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apparat: Crunching SWF Files Since 2009</title>
		<link>http://blog.joa-ebert.com/2010/05/07/apparat-crunching-swf-files-since-2009/</link>
		<comments>http://blog.joa-ebert.com/2010/05/07/apparat-crunching-swf-files-since-2009/#comments</comments>
		<pubDate>Fri, 07 May 2010 15:37:04 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=578</guid>
		<description><![CDATA[Apparat has a great new feature that allows you to crea [...]]]></description>
			<content:encoded><![CDATA[<p>Apparat has a great new feature that allows you to create even smaller files. Basic SWF files are compressed using Java&#8217;s standard <code>java.util.zip.Deflater</code> class. This is perfectly fine. And I would even go with no compression at all during development.</p>
<p>However when deploying you can spend some extra time compressing your SWF files with the best tools available. <a href="http://www.7-zip.org/" target="_blank" title="7-Zip">7-Zip</a> is for instance such a tool and achieves a great compression ratio.</p>
<p>If you have the 7z executable on your <code>PATH</code> Apparat will make use of it to achieve the best compression for your SWF files. More configuration options are available <a href="http://code.google.com/p/apparat/wiki/HiddenGems" target="_blank" title="HiddenGems">here</a>.</p>
<p>This feature is currently only implemented for SWF files and not SWCs. However every tool will make use of it by default. So if you are running Reducer and have no graphics in your SWF files you can still get a better compression.</p>
<p>An example is straight from the sources:</p>
<blockquote><p><code>
<pre>reducer -i as3\Apparat.Tests.AS3\bin\Test07.swf
[i] Apparat -- http://apparat.googlecode.com/
[i] Launching tool: Reducer
[i] Waiting for 7z ...
[i] Compression ratio: <b>18.224573%</b>
[i] Total bytes: 310
[i] Completed in 547ms.</pre>
<p></code></p></blockquote>
<p>Note please that this SWF file does not contain any graphical assets and we got still a ratio of 18%. Our main <code>audiotool.swf</code> file is compressed by about 10% &#8212; about 200kb &#8212; and contains no graphical assets either.</p>
<p>You can download the latest Apparat on <a href="http://code.google.com/p/apparat/downloads/detail?name=apparat.zip"  target="_blank" title="Download Apparat">Google Code</a>. Please note that you will need <a href="http://www.scala-lang.org/downloads" target="_blank" title="Scala Downloads">Scala 2.8 RC1</a> as well.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F07%2Fapparat-crunching-swf-files-since-2009%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F05%2F07%2Fapparat-crunching-swf-files-since-2009%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2010/05/07/apparat-crunching-swf-files-since-2009/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/05/07/apparat-crunching-swf-files-since-2009/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Audiotool 1.0</title>
		<link>http://blog.joa-ebert.com/2010/03/25/audiotool-1-0/</link>
		<comments>http://blog.joa-ebert.com/2010/03/25/audiotool-1-0/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 17:34:19 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[audiotool]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=541</guid>
		<description><![CDATA[We have finally released the first version of the Audio [...]]]></description>
			<content:encoded><![CDATA[<p>We have finally released the first version of the <a href="http://www.audiotool.com/" target="_blank" title="Audiotool">Audiotool</a>. I am very thankful for all the kind tweets and happy that our work is now available to the public.</p>
<p>However the current version is named Fire<b>starter</b> for a reason. What you see online is just the tip of the iceberg. I can not wait to start implementing all the cool features that will separate us from traditional software ;)
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F03%2F25%2Faudiotool-1-0%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F03%2F25%2Faudiotool-1-0%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2010/03/25/audiotool-1-0/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/03/25/audiotool-1-0/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Compiling ActionScript In The Enterprise</title>
		<link>http://blog.joa-ebert.com/2010/03/06/compiling-actionscript-in-the-enterprise/</link>
		<comments>http://blog.joa-ebert.com/2010/03/06/compiling-actionscript-in-the-enterprise/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 13:29:16 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[asc]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[fdt]]></category>
		<category><![CDATA[fsch]]></category>
		<category><![CDATA[intellij idea]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=537</guid>
		<description><![CDATA[If you ask me if ActionScript is ready for the enterpri [...]]]></description>
			<content:encoded><![CDATA[<p>If you ask me if ActionScript is ready for the enterprise then this question is hard to answer. Every fairly huge codebase requires some maintenance. You will have to figure out a strategy to identify modules and separate them. You will also have to handle the dependencies between modules. Last but not least you have to compile those.</p>
<p>An important aspect is that when I am talking about modules  I am not talking about &#8220;Flex Modules&#8221; but the more generic term for a part of a project.</p>
<p>First of all you have to make sure to fulfill some requirements. You can not assume that every developer is working on the same platform using the same IDE with the same settings. But you must assume that your project will not be built from an IDE. You must also assure that the dependencies between projects are up to date across different platforms and IDEs. Once you have figured out how to do that you might want to think about a strategy to compile your modules.</p>
<p>Today I want to explore the idea of parallel compilation across a cluster of machines to yield optimal compile speed for ActionScript projects. First of all, you can not assume that a developer can always keep all modules up to date. Depending on the dependency graph of your projects compilation migh take very long. For instance we have 103 modules at Hobnox. This means we have 103 different compile targets with different dependencies, each yielding its own SWF/SWC file. We also have a &#8220;standard library&#8221; that is included in nearly every project. Changing this library will require the developer to recompile all 103 modules to update them.</p>
<p>To illustrate this example I want to explain what we went through.</p>
<ol>
<li>We used FDT to develop our project. Since FDT is Eclipse based every module was represented as a separate project with dependencies to other projects. FDT however compiles your project only once you launch it. And it does not do this automatically for your dependency graph. As a result you have to manually compile 103 modules in the correct order. This would not be the problem if FDT&#8217;s live error highlightning and code analysis would not work on a SWC basis. But since the actual source-code between projects is not analyzed we had to launch all 103 modules to propagate a possible error or change. This was for us the point when we had to make a switch.</li>
<li>Ant was our second idea to build our FDT projects automatically. However we had to keep module dependencies up to date in all the different Ant files because the FCSH requires that you include external libraries of a library also in a successor of another library. This means if A requires B and C requires A. Then C requires also B. So we had to keep 103 Ant targets up to date for each change.</li>
<li>A custom build. We started working with a custom build tool I have developed in Scala. This build tool was smart enough to figure out which modules have to be recompiled without launching the ActionScript compiler. It also figured out which projects could be compiled in parallel since the ActionScript compiler is written in a way that IO is not the only bottleneck. We had an enormous improvement in compile time and usability for the developer since module dependencies where handled automatically.</li>
<li>We switched from FDT to IntelliJ IDEA since it offered us more features that we needed. IntelliJ came also with a much better strategy to compile modules. Basically it had the feature we always missed for FDT to automatically include libraries and to compile modules in the correct order automatically. However the guys at JetBrains made a mistake by counting on FCSH. The short story is that FCSH is absolutely not capable of handling a large codebase. What happened to us was that when we started a build FCSH would take up as much memory as it could, getting much slower until it finally crashed. Then FCSH started from scratch, consumed the maximum amount of memory again and crashed. This happend until a project was finally compiled but took also more than 15 minutes for a single change we made. This was of course unacceptable. Fortunately JetBrains implemented a feature request from us into IntelliJ IDEA which comes close to our custom build. From now on projects are compiled in parallel without using FCSH and without asking launching the compiler if no change has been made. This way we are able to work again. However only if we compile just a short amount of all modules since the main bottleneck is still the compiler.</li>
<li>A continuous integration server was our last option. This is a custom build server and we are using it until today. After each SVN commit we are building the required modules and their dependencies now automatically on a dedicated server. A change in the standard library takes about four minutes to complete now on a quad core. But the good thing is that we have set our main project to exclude a lot of libraries. The custom build takes care of that and we are loading now modules from the server. That way we can still compile local and include libraries we frequently change. Other libraries are loaded from the server and included at runtime.</li>
</ol>
<p>So the question is if this is now the ultimate solution. A custom continuous integration server that takes more than 4 minutes to propagate a change after a SVN commit? I do not think so. And here comes Scala into the game again. There is a project available called <a href="http://code.google.com/p/swarm-dpl/" target="_blank" title="Swarm">Swarm</a>. It makes use of Scala&#8217;s support for serializable delimited continuations. This means you can pause the state of your current program, send it to a different node in your cluster and continue with the program on that machine. And Swarm makes this task extremely simple. So for now a new research project is to take advantage of this feature. We can basically have one master server like Hudson or TeamCity and write a plugin for it that makes use of Scala Swarm. Swarm could be based on nodes in the office, normal computers and maybe a couple of dedicated servers to compile modules in parallel on multiple nodes. Each node would have to keep the VCS up to date. That way we should be able to compile projects much quicker and have a much better workflow in a large codebase. Besides that if you work with a CI server than you could also have the task of code analysis using FlexPMD for instance done on another machine as well.</p>
<p>I am really looking forward to this project when I have some time to work on it. My goal is to develop a plug-in for <a href="http://www.jetbrains.com/teamcity/" target="_blank" title="TeamCity">TeamCity</a> that we will use internally first. I expect to reduce the time for a full rebuild from about 4min to something like 30sec. This would be a huge benefit. I also hope that we will be able to make that plug-in available to the public.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F03%2F06%2Fcompiling-actionscript-in-the-enterprise%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2010%2F03%2F06%2Fcompiling-actionscript-in-the-enterprise%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2010/03/06/compiling-actionscript-in-the-enterprise/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2010/03/06/compiling-actionscript-in-the-enterprise/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Polyglott Programming On The AVM2</title>
		<link>http://blog.joa-ebert.com/2009/11/16/polyglott-programming-on-the-avm2/</link>
		<comments>http://blog.joa-ebert.com/2009/11/16/polyglott-programming-on-the-avm2/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 10:49:19 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[polyglott]]></category>
		<category><![CDATA[taas]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=502</guid>
		<description><![CDATA[Take some time and think about this tweet for a moment. [...]]]></description>
			<content:encoded><![CDATA[<p>Take some time and think about <a href="http://twitter.com/jhooks/status/5688660297" target="_blank" title="@jhooks on twitter">this tweet</a> for a moment. It took me a while to realize that Joel Hooks is right. I was embaressed of myself. How could I forget about that? But I had also a big smile on my face at the same same time. Let me explain why.</p>
<p>The Java to SWF compiler does not compile Java sourcecode but JVM bytecode to ActionScript bytecode. This means I do not have to teach my program the Java language. It only understands JVM bytecode. This seems like an akward decision on the one hand since working on the bytecode level implies lots of problems. But it turns out that this was a really cool decision on the other hand. &#8220;<i>Java</i> to SWF compiler&#8221; is maybe the wrong description. &#8220;<i>any language that compiles to JVM bytecode</i> to SWF compiler&#8221; is maybe better.</p>
<p>So what does any language mean? Here is a <a href="http://en.wikipedia.org/wiki/List_of_JVM_languages" target="_blank" title="List of JVM languages">list of JVM languages</a>. Now you feel maybe like I did after reading that tweet. And I am really looking forward to get <a href="http://www.scala-lang.org/" target="_blank" title="Scala Language">Scala</a> up and running.</p>
<p>Some problems still exist. Threading is one issue and I will basically have to do what Scott Peterson did for Alchemy. But reflections, annotations and method overloading have to be solved as well. Some glitches may exist even after figuring everything out. Stacktraces will look pretty weird. However I think this is a really cool project.</p>
<p><b>Update:</b> I forgot to mention something important. Java supports native code. This means you can build a library that works with OpenGL for instance. Those native methods can not be converted. There are also some other things that do not work. File access is just one of them.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F11%2F16%2Fpolyglott-programming-on-the-avm2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F11%2F16%2Fpolyglott-programming-on-the-avm2%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2009/11/16/polyglott-programming-on-the-avm2/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/11/16/polyglott-programming-on-the-avm2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Getting Rid Of null</title>
		<link>http://blog.joa-ebert.com/2009/11/06/getting-rid-of-null/</link>
		<comments>http://blog.joa-ebert.com/2009/11/06/getting-rid-of-null/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 18:15:51 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[option]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=495</guid>
		<description><![CDATA[A couple of weeks ago I started learning Scala. I can h [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I started learning <a href="http://www.scala-lang.org/" target="_blank" title="Scala">Scala</a>. I can highly recommend it. The language has a lot of great approaches to multithreading and scalability. The reason why I like Scala is because it is so simple yet powerful.</p>
<p>Of course doing something at home influences work. I decided to write a build tool for the Hobnox AudioTool which is about 200 lines of Scala code. Cool thing is that this tool replaces a manually maintained Ant build and all project dependencies are always correct. Plus analyzing the dependencies in a more powerful way allows me to spawn the compiler in parallel. Building the AudioTool is now twice as fast and much more comfortable.</p>
<p>When learning a new programming language you also learn about new concepts. Functional languages in general have a different approach to nullable types. I know Scala is not the only one but let me introduce the concept in terms of ActionScript.</p>
<p>When you have a method that returns either a result or nothing: what do you do? Imagine you have some kind of service and a Dictionary of users. Requesting a user works by his unique id. The Dictionary is private to the class since you want to keep it read only.</p>
<p><code>
<pre>function getUser(id: String): User {
  return hasUser(id) ? users[id] : null;
}</pre>
<p></code></p>
<p>If I would now simply ask the service for an unknown user and do something like <code>if(getUser('xyz').isLoggedIn) { trace('Hooray'); }</code> I could probably and up with a null-reference error. No one checks for me if the user exists. So what else could we do? Write a lot of boilerplate code and prepend a check if the user is null or not each time we request one from the service. A much better approach in my opinion is to throw an error as early as possible. In this case we would rewrite the method to something like this:</p>
<p><code>
<pre>function getUser(id: String): User {
  if(hasUser(id)) return users[id];
  throw new NoSuchUserError(id);
}</pre>
<p></code></p>
<p>In this scenario we get informed about the error as early as possible. But we are stuck again. First of all ActionScript does not enforce you to catch possible exceptions. This means if you do not read the documentation of a method carefully or look into the source code of a method before calling it somewhere you will never know that it throws an exception. And what if we are actually in a scenario where we do not expect errors for non-existing objects? Think of the Dictionary object throwing each time an error when you access it and the result is null. How could I even check if an object exists in a Dictionary?</p>
<p><code>
<pre>try {
  dictionary[key];
  return true;
}
catch(noSuchElementError: NoSuchElementError) {
  return false;
}</pre>
<p></code></p>
<p>I guess you see that this can not be the solution to our problem. In a real world example you may deal with your own collection of objects instead of a Dictionary of course. So we have to get rid of exceptions and null for the optimal solution. Scala&#8217;s approach to this problem is the <a href="http://www.scala-lang.org/docu/files/api/scala/Option.html" target="_blank" title="Option type">Option</a> type. We always abuse <code>null</code> as a placeholder when we want to express that an element does not exist. The <code>Option</code> means that either <code>Some</code> or <code>None</code> result exists. Rewriting our <code>getUser</code> function using this approach would yield the following ActionScript code.</p>
<p><code>
<pre>function getUser(id: String): Option {
  return hasUser(id) ? new Some(user[id]) : new None();
}</pre>
<p></code></p>
<p>Why is this much better than the old approach? When calling the method you will always know that the method has only an optional result value. We get rid of the exception and <code>null</code> values. Our only problem at the moment is ActionScript. The result is now untyped. In an ideal world this method would be written as:</p>
<p><code>
<pre>function getUser(id: String): Option.&lt;User&gt; {
  return hasUser(id) ? new Some.&lt;User&gt;(user[id]) : new None.&lt;User&gt;();
}</pre>
<p></code></p>
<p>However we can still tackle this issue by implementing null-representations of our objects. Imagine the <code>User</code> class. You could rewrite the code to something like this.</p>
<p><code>
<pre>function getUser(id: String): IUser {
  return hasUser(id) ? user[id] : new NullUser();
}

final class NullUser implements IUser {
  public function get isLoggedIn(): Boolean { return false; }
  public function get name(): String { return 'null'; }
}</pre>
<p></code></p>
<p>And even if you are interested in null-reference errors you could rewrite your code to something like this:</p>
<p><code>
<pre>final class NullUser implements IUser {
  public function get isLoggedIn(): Boolean {
    CONFIG::ThrowNullReferenceErrors { throw new NullReferenceError(); }
    return false;
  }
  public function get name(): String {
    CONFIG:: ThrowNullReferenceErrors { throw new NullReferenceError(); }
    return 'null';
  }
}</pre>
<p></code></p>
<p>It is definitely a very different approach. A functional language like Scala allows you to deal much better with Options. But it makes sense to diferentiate between an uninitialized variable which is <code>null</code> and an optional result of a function. Unfortunately this is at the moment very painful with the lack of generics in ActionScript.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F11%2F06%2Fgetting-rid-of-null%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F11%2F06%2Fgetting-rid-of-null%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2009/11/06/getting-rid-of-null/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/11/06/getting-rid-of-null/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>TAAS As A Decompiler</title>
		<link>http://blog.joa-ebert.com/2009/09/29/taas-as-a-decompiler/</link>
		<comments>http://blog.joa-ebert.com/2009/09/29/taas-as-a-decompiler/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 09:59:30 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[decompiler]]></category>
		<category><![CDATA[haxe]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[taas]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=487</guid>
		<description><![CDATA[The TAAS compiler is different from the ActionScript co [...]]]></description>
			<content:encoded><![CDATA[<p>The TAAS compiler is different from the ActionScript compiler since its input is not ActionScript source code but already compiled SWF or SWC files. Just like the <a href="http://www.haxe.org/" target="_blank">haXe</a> compiler <a href="http://haxe.org/doc/flash/as3gen" target="_blank">can output AS3</a> instead of a SWF the TAAS compiler can do the same.</p>
<p>Now if you add one and one together you see that the TAAS compiler can be used as a very strong decompiler. My own tests have shown that it will work flawlessly where other commercial decompilers output rubbish. Since the compiler behaves like the Flash Player it will &#8220;execute&#8221; the bytecode in order to parse it which means it has a very highlevel understanding of the structure inside the SWF.</p>
<p>The only question is now what to do with the source code. I wrote the decompiler for my session at FOTB to show much easier how the optimizations behave. It is also a great tool to debug errors. But should it be opened or not?</p>
<p>To take it one step further one might also be able to write an obfuscator using the TAAS compiler. In my opinion it would be cool to have a strong decompiler and obfuscator, both being open source. We might also add an option to protect SWFs from the decompiler by adding something to the SWF metadata for instance. Of course this is just a simple rule which could be removed by someone once the code is open. What do you think?
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F29%2Ftaas-as-a-decompiler%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F29%2Ftaas-as-a-decompiler%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2009/09/29/taas-as-a-decompiler/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/09/29/taas-as-a-decompiler/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>FOTB Recordings</title>
		<link>http://blog.joa-ebert.com/2009/09/28/fotb-recordings/</link>
		<comments>http://blog.joa-ebert.com/2009/09/28/fotb-recordings/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 20:29:19 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=484</guid>
		<description><![CDATA[The people from Powerflasher were kind enough to upload [...]]]></description>
			<content:encoded><![CDATA[<p>The people from <a href="http://www.powerflasher.com/" target="_blank">Powerflasher</a> were kind enough to upload their recording of my FOTB session. I am sorry that the microphone stopped working at the end. But you might still be able to understand what I was talking about if you turn up the volume of your speakers.<br />
<span id="more-484"></span></p>
<div align="center">
<script type="text/javascript" src="http://de.sevenload.com/pl/admzN8j/400x258"></script>
<p>Link: <a href="http://de.sevenload.com/videos/admzN8j-Joa-Ebert-FOTB-Part-01"><img src="http://static.sevenload.com/img/sevenload.png" width="66" height="10" alt="Joa Ebert @ FOTB - Part 01" /></a></p>
<p><script type="text/javascript" src="http://de.sevenload.com/pl/Z4NlqkP/400x258"></script>
<p>Link: <a href="http://de.sevenload.com/videos/Z4NlqkP-Joa-Ebert-FOTB-Part-02"><img src="http://static.sevenload.com/img/sevenload.png" width="66" height="10" alt="Joa Ebert @ FOTB - Part 02" /></a></p>
</div>
<p>The recording of the jam session is also available.  I just want to note that I used the <a href="http://www.processing.org" target="_blank">processing</a> library inside Eclipse for the speedcoding. This time I also practiced at home unlike for other jam sessions. The visualizer was an homage to a <a href="http://www.youtube.com/watch?v=zCA79Du-WqY" target="_blank">table</a> designed by <a href="http://www.daftpunk.com/" target="_blank">Daft Punk</a> for <a href="http://www.habitat.net/" target="_blank">habitat</a>.</p>
<div align="center"><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6749871&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=6749871&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></div>
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F28%2Ffotb-recordings%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F28%2Ffotb-recordings%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2009/09/28/fotb-recordings/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/09/28/fotb-recordings/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Compiling Java and C# to SWF</title>
		<link>http://blog.joa-ebert.com/2009/09/28/compiling-java-and-c-to-swf/</link>
		<comments>http://blog.joa-ebert.com/2009/09/28/compiling-java-and-c-to-swf/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 13:41:03 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[soot]]></category>
		<category><![CDATA[taas]]></category>
		<category><![CDATA[visualbasic]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=480</guid>
		<description><![CDATA[At the end of my Leaving the Sandbox session I showed t [...]]]></description>
			<content:encoded><![CDATA[<p>At the end of my Leaving the Sandbox session I showed two projects I have been working on without telling anyone. The first was a compiler that could compile C# to SWF. The second was another compiling being able to compile Java to SWF. First of all I have to say that both tools are far from being finished. They are a so called proof-of-concept. For me it is enough to know that this is possible. I am also not sure if I will finish one of those tools.</p>
<p>So how does this work? Because I am now working on the AudioTool backend for our highly anticipated launch I had to switch to fulltime Java development. In order to understand the JVM better I started to search for the optimizations that the HotSpot VM performs and stumbled upon a framework called <a href="http://en.wikipedia.org/wiki/Soot_(computer_science)" target="_blank">Soot</a>. Voilà. Reading about Soot made me question why nobody is working on such a framework for ActionScript. Probably because universities see Flash just as a toy. For us developers being dependent on the Flash Platform it is of course more than that.</p>
<p>I will quickly explain what Soot does. It reads compiled Java <code>class</code> files and converts the machine code they contain into a three address code representaiton. This code is then heavily optimized. TAAS is basically doing the same. I also want to note that Soot is by far more complex and complete than TAAS right now. It would be megalomania saying that TAAS is Soot for ActionScript. But you get the idea. The one framework converts Java to three address code and the other framework converts ActionScript to three address code. Maybe it is possible to connect them.</p>
<p>This is what I did for the Java compiler. The whole pipeline looks like this:</p>
<ol>
<li>Compile Java sourcecode with the Java compiler of your choise</li>
<li>Use Soot to get the three address code representation of a compiled binary</li>
<li>Create TAAS expressions for the expressions that Soot uses</li>
<li>Connect the TAAS graph the same way the Soot graph is connected</li>
<li>Compile the TAAS graph to a SWF</li>
</ol>
<p>This is about it. There is some glue-code involved here and there and I did not implement all Java expressions yet. I did also not bother about threads. Basically one could do what Scott has done for Alchemy.  The cool thing is that we get highly optimized Java code because of the Java compiler and Soot. Then the TAAS compiler can run a second time after linking is done and perform platform specific optimizations like inlining and loop invariant code motion for certain expressions.</p>
<p>I already wrote a couple of classes and packed them in a SWC. Those mimic the behaviour of the Java classes like <code>java.lang.System</code> or <code>java.util.LinkedList</code>.  On the Java side I implemented the Flash classes like <code>flash.display.Sprite</code> and <code>flash.events.EventDispatcher</code>. The interesting part is that all the methods those classes contain are marked native which means they have no implementation since they are native to the Flash Player.<br />
This is also a great advantage. It is slow in Alchemy to call Flash methods and to communicate with Flash classes. The Java approach does not have this tradeoff. I also do not have to trigger the ActionScript compiler. The conversion form <code>class</code> to <code>swf</code> is entirely done using Soot and TAAS.</p>
<p>So far for the Java compiler. But in order to show a little bit more of the potential I wanted to have a C# compiler working as well. The great thing about advanced languages and a large community is that people have already built a lot of tools. It did not take too long to find an advanced framework that converts C# to Java. Actually this is not be the best approach. But I could not find the &#8220;Soot for C#&#8221; the evening before my FOTB session.</p>
<p>So I am using <a href="https://net2java.dev.java.net/">net2java</a> to convert .NET code like C# or VisualBasic to Java. That code is then compiled using the Java compiler and I am using Soot again to convert the code to TAAS without much stress.</p>
<p>For me the most important part is to know that it is possible to compile .NET source code and Java binaries to SWF. To complete those tools one just has to implement all the missing expressions and the standard Java library in Flash. Everything could also work the other way around. Compiling from TAAS to .NET, Silverlight and Java is another option.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F28%2Fcompiling-java-and-c-to-swf%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F28%2Fcompiling-java-and-c-to-swf%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2009/09/28/compiling-java-and-c-to-swf/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/09/28/compiling-java-and-c-to-swf/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>After The Sandbox</title>
		<link>http://blog.joa-ebert.com/2009/09/28/after-the-sandbox/</link>
		<comments>http://blog.joa-ebert.com/2009/09/28/after-the-sandbox/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 12:48:39 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[fotb09]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=477</guid>
		<description><![CDATA[In 2006 I got invited to the FlashForum Conference in D [...]]]></description>
			<content:encoded><![CDATA[<p>In 2006 I got invited to the <a href="http://www.flashforum.de/" target="_blank">FlashForum</a> Conference in Düsseldorf, Germany. It was my very first Flash conference and my topic was AS3 code optimization. I have talked a lot about bitwise operators, lookup tables and other techniques to speed your code up.<br />
Now about three years later I wanted to prepare a very special talk for FOTB and make a step forward by getting rid of old <a href="http://wiki.joa-ebert.com/" target="_blank">habits</a> and <a href="http://je2050.de/files/misc/as3opt.pdf" target="_blank">idioms</a>. </p>
<p>Before <a href="http://www.flashonthebeach.com/" target="_blank">FOTB</a> I was not sure if I can present <a href="http://apparat.googlecode.com" target="_blank">Apparat</a> at all. For me as an autodidact it is not always easy to solve certain issues. <a href="http://www.quasimondo.com/" target="_blank">Mario Klingemann</a> talked about <i>Magic Moments</i> in Brighton. I guess I had one after a long time of thinking and failing. I got really into the flow and everything became so clear. Stay tuned for more detailed posts on the technique behind the different compilers.</p>
<p><span id="more-477"></span></p>
<p>However this was a really special conference for me. The standing ovations made me completely happy and I was absolutely overwhelmed by the response. After all those sleepless nights it was a huge gift of appreciation for my work. I will definitely  never forget that moment and all I can say is thank you. If you spend so much time working on an opensource project this is really the best that can happen. “Leaving the Sandbox” came from a long background. The end of the session was a really emotional for me. Thank you John for inviting me.</p>
<div align="center">
<div style="width:425px;text-align:left" id="__ss_2042016"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=render-090922122545-phpapp02&#038;stripped_title=leaving-the-sandbox" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=render-090922122545-phpapp02&#038;stripped_title=leaving-the-sandbox" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></div>
</div>
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F28%2Fafter-the-sandbox%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F28%2Fafter-the-sandbox%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2009/09/28/after-the-sandbox/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/09/28/after-the-sandbox/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>TAAS progress</title>
		<link>http://blog.joa-ebert.com/2009/09/07/taas-progress/</link>
		<comments>http://blog.joa-ebert.com/2009/09/07/taas-progress/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 14:50:07 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[apparat]]></category>
		<category><![CDATA[taas]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=472</guid>
		<description><![CDATA[I have developed some other optimizations during the pa [...]]]></description>
			<content:encoded><![CDATA[<p>I have developed some other optimizations during the past couple of days. Including <a href="http://en.wikipedia.org/wiki/Strength_reduction" target="_blank" title="Strength Reduction">strength reduction</a> and optimizing <a href="http://en.wikipedia.org/wiki/Tail_recursion" target="_blank" title="Tail Recursion">tail recursive</a> calls.</p>
<p>Strength reduction can already handle about 55 different cases at the moment. For instance it will convert code like <code>if( x - 1 == 0 )</code> into <code>if( x == 1 )</code>. But it will also remove expressions that other optimizations could introduce. <code>x + 0</code> is something that might occur during inline expansion. Or <code>x + Number.NaN</code> for example. </p>
<p>But I really like the tail recursive optimizations. TAAS can detect if a method needs to call itself or not. Take this code for example:<br />
<code>
<pre>private function sum( i: int, value: int ): int
{
	if( i == 0 )
	{
		return value;
	}

	return sum( i - 1, value + i );
}
</pre>
<p></code></p>
<p>You see that the last statement <code>sum( i - 1, value + i )</code> is tail recursive. This means we can replace the recursive call to <code>sum()</code> with a jump to the beginning of the method after changing the method parameters. The <code>sum()</code> method becomes converted to something like a simple while loop. This means also that one could have written code like this in the first place since this optimization applies only to methods that do not have to be recursive after all.</p>
<p>Knock yourself out with some examples:</p>
<ul>
<li><a href="http://www.joa-ebert.com/swfs/taas/b00" target="_blank">Before</a> / <a href="http://www.joa-ebert.com/swfs/taas/a00" target="_blank">After</a> (Inline)</li>
<li><a href="http://www.joa-ebert.com/swfs/taas/b01" target="_blank">Before</a> / <a href="http://www.joa-ebert.com/swfs/taas/a01" target="_blank">After</a> (Inline)</li>
<li><a href="http://www.joa-ebert.com/swfs/taas/b02" target="_blank">Before</a> / <a href="http://www.joa-ebert.com/swfs/taas/a02" target="_blank">After</a> (Tail recursion)</li>
</ul>
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F07%2Ftaas-progress%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F07%2Ftaas-progress%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2009/09/07/taas-progress/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/09/07/taas-progress/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Euro Invasion At MAX 2009</title>
		<link>http://blog.joa-ebert.com/2009/09/03/euro-invasion-at-max-2009/</link>
		<comments>http://blog.joa-ebert.com/2009/09/03/euro-invasion-at-max-2009/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 20:18:24 +0000</pubDate>
		<dc:creator>joa</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[influxis]]></category>
		<category><![CDATA[max]]></category>

		<guid isPermaLink="false">http://blog.joa-ebert.com/?p=470</guid>
		<description><![CDATA[Since the news has spread pretty quickly I want to shed [...]]]></description>
			<content:encoded><![CDATA[<p>Since the news has spread pretty quickly I want to shed some light on this as well. <a href="http://www.influxis.com/" target="_blank">Influxis</a> has <a href="http://labs.influxis.com/?p=504" target="_blank">invited</a> a lot of European Flash developers to come to LA and attend Adobe MAX 2009. Those include Seb Lee Delisle, Ralph Hauwert, Mario Klingemann, Andre Michelle and me. I was absolutely overwhelmed when I heard about that idea first. I really want to thank the whole Influxis team for making this possible. You guys definitly rock! But I would also like to thank Adobe for sponsoring MAX passes in order to get everyone invited.</p>
<p>Hopefully I will meet a lot of interesting people and Flash Player engineers. It will be my first MAX so I am really curious.
<div class="tweetmeme_button" style="float: right; margin-right: 10px; margin-top: 38px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F03%2Feuro-invasion-at-max-2009%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.joa-ebert.com%2F2009%2F09%2F03%2Feuro-invasion-at-max-2009%2F&amp;source=joa&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<div style="float:right;margin:0px 16px 0px 4px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://blog.joa-ebert.com/2009/09/03/euro-invasion-at-max-2009/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.joa-ebert.com/2009/09/03/euro-invasion-at-max-2009/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
