<?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>ZBlog &#187; development</title>
	<atom:link href="http://blog.zarate.tv/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zarate.tv</link>
	<description>Using the law to keep justice away</description>
	<lastBuildDate>Wed, 08 Sep 2010 17:04:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Running Flash apps 24/7</title>
		<link>http://blog.zarate.tv/2010/05/03/running-flash-apps-247/</link>
		<comments>http://blog.zarate.tv/2010/05/03/running-flash-apps-247/#comments</comments>
		<pubDate>Mon, 03 May 2010 14:40:03 +0000</pubDate>
		<dc:creator>Zarate</dc:creator>
				<category><![CDATA[air]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[haxe]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://blog.zarate.tv/?p=1546</guid>
		<description><![CDATA[[UPDATE: I presented this alongside with Matt Pollitt at the London Flash Platform User Group, thanks to everyone that came down to the talk.  So sorry that I couldn't stay for longer, but had a train to catch. If you have any doubts or want to say something, just leave a comment and I'll [...]]]></description>
			<content:encoded><![CDATA[<p>[<em>UPDATE: I presented this alongside with <a href="http://www.mattpollitt.co.uk/">Matt Pollitt</a> at the <a href="http://www.lfpug.com/27th-may-2010-27052010/">London Flash Platform User Group</a>, thanks to everyone that came down to the talk.  So sorry that I couldn't stay for longer, but had a train to catch. If you have any doubts or want to say something, just leave a comment and I'll get in touch. <a href="http://www.lfpug.com/developing-flash-apps-to-run-247/">Video is now available</a>, go check it out if you missed it.</em>]</p>
<p>We are developing at <a href="http://ustwo.co.uk/">ustwo</a> a very interesting internal little project that needs to run 24/7. By default developers should always be very careful with memory leaks and hogging resources, but with an AIR/Flash app running non-stop every detail counts.</p>
<p>To top it up, the app must handle images, SWFs (AS2, AS3) and videos <strong>without going through developers</strong>. That means marketing can contact one of the designers, ask s/he to produce someething and put it to display without developer approval. Oh, and all assets are in the network, not in the machine. Scary. </p>
<p>Preliminary tests show we are doing OK, we&#8217;ve been running the app non-stop for 4 days without a crash or needing it to reboot. The player takes and releases memory when it needs to, transitions and animations look as smooth as the first day, etc.</p>
<p>Check out below some of our thoughts.</p>
<p><strong>FAIL, FAIL, FAIL</strong></p>
<p>Shit will happen, so be ready to fail. Assets won&#8217;t load, video will have the wrong codec, image will be 80mb, network will be down&#8230;.</p>
<p>That&#8217;s Google&#8217;s approach to servers. Instead of having a big fat multimillion dollar server, they have a farm of 100 mini-servers and they *know* one or two *will* crash everyday. They&#8217;ve build their systems to cope with failure and fail gracefully.</p>
<p>Also embed some default content for when everything else fails. </p>
<p><strong>RELEASE, RELEASE, RELEASE</strong></p>
<p>You must release resources. Explicitly remove every single listener you add, use FP 10 unloadAndStop and if you are in AIR don&#8217;t hold references to File objects (more about this in another post).</p>
<p>If you are a good dev, the Flash player will behave most of the times&#8230; </p>
<p><strong>MONITOR, MONITOR, MONITOR</strong></p>
<p>&#8230;but sometimes it won&#8217;t. Or something you didn&#8217;t even think was possible will happen in-your-face. You can&#8217;t prevent <strong>all</strong> errors, but you can react when they happen.</p>
<p>At the beginning we were trusting our own app to be its own watchdog, but then we got a nasty crash and obviously the watchdog failed as well. So we&#8217;ve created a <a href="http://blog.zarate.tv/2010/02/08/build-tools-with-haxe/">little haXe/Neko app</a> called &#8220;<em>the helper</em>&#8221; that is automatically called every minute and that checks the state of our app.</p>
<p>At the moment, the helper is being automatically launched using <a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html#//apple_ref/doc/man/5/launchd.plist">launchd</a> (fancy cron job for OS X), but that has very interesting side effects (again, more on another post).</p>
<p>The helper checks if our app is running using something like:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">ps</span> <span class="re5">-x</span> <span class="re5">-o</span> <span class="kw2">comm</span></div>
</li>
</ol>
</div>
</div>
<p>And parsing the result for a relevant match. If the app is not running, it starts it again using:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1">open <span class="sy0">/</span>path<span class="sy0">/</span>to<span class="sy0">/</span>our<span class="sy0">/</span>app</div>
</li>
</ol>
</div>
</div>
<p>Since we are using AIR 2 beta, we could implement a more refined communication system using the new <a href="http://www.adobe.com/devnet/air/flex/quickstart/interacting_with_native_process.html">Native Process API</a>, but for the time being checking if the app is running &#8220;<em>the hard way</em>&#8221; is enough.</p>
<p><strong>UPDATE, UPDATE, UPDATE</strong></p>
<p>Find a good mechanism to auto-update your app. Most 24/7 apps are unattended apps and they might well be in a different room / building / city / country. But even if you are just a few steps away, you still want to be able to remotely deploy a new version.</p>
<p>We decided to implement our own update system based on GIT commits instead of relying on AIR&#8217;s update framework.</p>
<p><strong>LOG, LOG, LOG</strong></p>
<p>Log as much as you can. You&#8217;ll be happy you did when you need to find out why your app crashed. Believe me, in this case more is more, even if you face huge log files. If you are a little bit consistent you can always build automatic parsing tools for your logs or just run a simple grep to find error traces.</p>
<p>BTW, we settled for a log file per day to avoid massive log files.  </p>
<p><strong>WARN, WARN, WARN</strong></p>
<p>As I said before, most of these apps run unattended, so you want to be notified as soon as possible when there&#8217;s an error. You can:</p>
<p>* Use a private Twitter account that people subscribe to.<br />
* Send an email. You can do that from Flash using for example <a href="http://www.bytearray.org/?p=27">SMTP Mailer</a> and a local SMTP server.</p>
<p>Whatever you do, don&#8217;t rely on one method only, specially Twitter, in case is down when the app needs it.</p>
<p><strong>REMOTE, REMOTE, REMOTE</strong></p>
<p>You either enable VNC, SSH or both. If you can&#8217;t, then be prepared for walking / driving / taking the bus a lot.</p>
<p>&#8211;</p>
<p>I&#8217;ll leave the details of running your apps using launchd and the peculiar way in which AIR holds &#8220;hard&#8221; references to files for another posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zarate.tv/2010/05/03/running-flash-apps-247/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build tools with haXe</title>
		<link>http://blog.zarate.tv/2010/02/08/build-tools-with-haxe/</link>
		<comments>http://blog.zarate.tv/2010/02/08/build-tools-with-haxe/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 21:40:21 +0000</pubDate>
		<dc:creator>Zarate</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[haxe]]></category>

		<guid isPermaLink="false">http://blog.zarate.tv/?p=1451</guid>
		<description><![CDATA[Remember how I&#8217;ve been lately pestering about how cool is learning to program in Bash? Well, I&#8217;m not retracting, but last couple of days I&#8217;ve been doing the same thing but using haXe + Neko + Xcross. And I like it better.
How is this better than the others?
I think it&#8217;s better than Bash because haXe [...]]]></description>
			<content:encoded><![CDATA[<p>Remember how I&#8217;ve been lately pestering about how cool is learning to program in Bash? Well, I&#8217;m not retracting, but last couple of days I&#8217;ve been doing the same thing but using <a href="http://haxe.org/">haXe</a> + <a href="http://nekovm.org/">Neko</a> + <a href="http://code.google.com/p/xcross/">Xcross</a>. And I like it better.</p>
<p><strong>How is this better than the others?</strong></p>
<p>I think it&#8217;s better than Bash because haXe is an OO language and it&#8217;s fully crossplatform (no bash in Win unless you use <a href="http://www.cygwin.com/">Cygwin</a>). I also think it&#8217;s better than <a href="http://ant.apache.org/">Ant</a> because you get rid of bloody-fatty Java as a dependency. </p>
<p><strong>How is this done</strong></p>
<p>In a nutshell: you program in haXe, compile to Neko and then pack to a native app using Xcross. Piece of cake! </p>
<p>Let&#8217;s say you need to read some config file, compile your AS using MTASC and copy the output file to several places.  Let&#8217;s assume a simple config file like this:</p>
<div class="codesnip-container" >tv.zarate.wadus.Main.hx<br />
wadus.swf</div>
<p>And that we pass it to our tool like this:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1">tool config.cfg</div>
</li>
</ol>
</div>
</div>
<p>Now the pseudo-code:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// Get application args, and use the first one</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> args : Array<span class="sy0">&lt;</span>String<span class="sy0">&gt;</span> = xa.<span class="me1">Application</span>.<span class="me1">getArgs</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> configPath : <span class="kw3">String</span> = args<span class="br0">&#91;</span>0<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Read the content of the config file and parse it</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> content : <span class="kw3">String</span> = xa.<span class="me1">File</span>.<span class="me1">read</span><span class="br0">&#40;</span>configPath<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> lines : Array<span class="sy0">&lt;</span>String<span class="sy0">&gt;</span> = content.<span class="kw3">split</span><span class="br0">&#40;</span><span class="st0">&quot;<span class="es0">\n</span>&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> <span class="kw2">class</span> : <span class="kw3">String</span> = lines<span class="br0">&#91;</span>0<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> swf : <span class="kw3">String</span> = lines<span class="br0">&#91;</span>1<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Call MTASC passing the output swf and the class read from the config file</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> args = <span class="br0">&#91;</span><span class="st0">&quot;-swf&quot;</span>, swf, <span class="st0">&quot;-main&quot;</span>, <span class="kw2">class</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> p = <span class="kw2">new</span> xa.<span class="me1">Process</span><span class="br0">&#40;</span>mtascPath, args<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> output = p.<span class="me1">getOutput</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> <span class="kw3">error</span> = p.<span class="me1">getError</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> exitCode = p.<span class="me1">exitCode</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Check MTASC exit code, if not 0, something went wrong</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span>exitCode <span class="sy0">!</span>= 0<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;xa.<span class="me1">Utils</span>.<span class="kw3">print</span><span class="br0">&#40;</span><span class="kw3">error</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;xa.<span class="me1">Utils</span>.<span class="kw3">print</span><span class="br0">&#40;</span>output<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>And now compiling:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1">haxe <span class="re5">-neko</span> wadus.n <span class="re5">-main</span> Wadus.hx</div>
</li>
<li class="li1">
<div class="de1">haxelib run xcross builder.n</div>
</li>
</ol>
</div>
</div>
<p>That should be it; we&#8217;ve read and parsed a config file passed as a parameter and then called MTASC handling the result. Then compiled to native Win, Mac and Linux apps. </p>
<p>As I said, that&#8217;s pseudo code, on a real life app you would definitely need more error handling or might have a more complex config file (maybe xml, try parsing xml in Bash!), etc., but since haXe is a really similar to Flash or JS, it feels very natural to me. Granted, you can do the same in Bash, but to my eyes is much more complicated.</p>
<p>Some more notes:</p>
<ul>
<li>From a Neko app you can call any other tool on your system. That includes SVN, Ant, GIT, grep&#8230; Whatever is there, you can call it.</li>
<li>Apps created with Xcross embed the Neko VM so they have zero dependencies (unless you use any of the tools described above, of course).</li>
</ul>
<p>We are investigating this route instead of Ant for our build scripts. You might think it&#8217;s kind of reinventing the Ant wheel, but we have the feeling that this is going to be <strong>much</strong> faster and flexible to our needs. </p>
<p>We&#8217;ll see : )</p>
<p>PS: I&#8217;ve used the xa.* package in the code, that&#8217;s a little project I&#8217;m working on to provide a simpler haXe API for backends. This is a spin-off of HippoHX and it&#8217;s not ready yet, but if you are interested you can follow the development in <a href="http://github.com/zarate/xapi">GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zarate.tv/2010/02/08/build-tools-with-haxe/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Make your console fly with Parallel Processing</title>
		<link>http://blog.zarate.tv/2010/01/21/make-your-console-fly-with-parallel-processing/</link>
		<comments>http://blog.zarate.tv/2010/01/21/make-your-console-fly-with-parallel-processing/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 09:12:51 +0000</pubDate>
		<dc:creator>Zarate</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://blog.zarate.tv/?p=1431</guid>
		<description><![CDATA[I reckon this is kind of a niche thing, but interesting nonetheless. 
Our current project at ustwo™ is a PureMVC-multicore application. Sounds really fancy, but it&#8217;s only a SWF loading SWFs.
To compile those SWFs we have some scripts using Ant, MTASC, SWFMill, Rhino and other tools. Updating from SVN and compiling 18 modules was taking [...]]]></description>
			<content:encoded><![CDATA[<p>I reckon this is kind of a niche thing, but interesting nonetheless. </p>
<p>Our current project at ustwo™ is a PureMVC-multicore application. Sounds really fancy, but it&#8217;s only a SWF loading SWFs.</p>
<p>To compile those SWFs we have some scripts using Ant, MTASC, SWFMill, Rhino and other tools. Updating from SVN and compiling 18 modules was taking around 90-100 seconds (that&#8217;s updating and compiling the whole project, you can compile single modules much faster).</p>
<p>Keep in mind that our compilation process is a little bit more than calling MTASC. We are running some pre-processing, generating exclude files and some other trickery to gain extra performance (we target mobile devices).</p>
<p>Anyway. Got a hint from one of our developers so I did some research to find a way to speed up compilation time. Since most of us have now dual-core machines we should be able to parallelize some of the work, right? Indeed we can.</p>
<p>Finding <a href="http://code.google.com/p/ppss/">PPSS</a> was quite easy but understanding how it to works was a little bit more complicated. I&#8217;m not going to bore you to death with the nitty-gritty, so this is the flow that adapted better to us:</p>
<p>* In bash parse the list of module folders and create a txt file containing the path to a script passing to it the path of the module as a parameter. One line per module:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sy0">/</span>path<span class="sy0">/</span>to<span class="sy0">/</span>script.sh path<span class="sy0">/</span>to<span class="sy0">/</span>module0</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">/</span>path<span class="sy0">/</span>to<span class="sy0">/</span>script.sh path<span class="sy0">/</span>to<span class="sy0">/</span>module1</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">/</span>path<span class="sy0">/</span>to<span class="sy0">/</span>script.sh path<span class="sy0">/</span>to<span class="sy0">/</span>module2</div>
</li>
<li class="li1">
<div class="de1">&#8230;</div>
</li>
</ol>
</div>
</div>
<p>* Feed that txt file to PPSS like this:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1">ppss <span class="re5">-f</span> moduleList.txt <span class="re5">-c</span> <span class="st_h">&#8216;bash $ITEM&#8217;</span></div>
</li>
</ol>
</div>
</div>
<p>That&#8217;s where the magic happens.  PPSS parallelizes each call to the compilation script using both CPUs. When you run it you can see they go all the way up to 80-90% usage, which is kind of the point.</p>
<p>We took some metrics and found a 40% speed improvement, sometimes even more. If you are a compulsive compiler like yours truly, this saves you quite some time.</p>
<p>Going from the serial approach to the parallel approach wasn&#8217;t straight forward. Mostly because I had to split the main script into several scripts and that caused some issues due to my bash programming limitations. This is what I learnt:</p>
<p>* If you execute a script from another, the child doesn&#8217;t have access to the variables defined by the parent unless you export them&#8230;<br />
* &#8230; but arrays don&#8217;t get exported.<br />
* Also, you can&#8217;t &#8220;escalate&#8221; exported vars from children to parents. The trick only goes from parent to children (security, I guess).</p>
<p>Anyway. Some more command line black magic under my belt, which is great. The console is a very, very powerful tool that can simplify and standardize daily tasks, which is a must when you are on a team of 10 devs. Not that it is the nicest programming language (actually, it&#8217;s pretty ugly), but its ubiquity makes learning it worthwhile.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zarate.tv/2010/01/21/make-your-console-fly-with-parallel-processing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Counting your lines of ActionScript</title>
		<link>http://blog.zarate.tv/2009/12/12/counting-your-lines-of-actionscript/</link>
		<comments>http://blog.zarate.tv/2009/12/12/counting-your-lines-of-actionscript/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 16:38:00 +0000</pubDate>
		<dc:creator>Zarate</dc:creator>
				<category><![CDATA[as2]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.zarate.tv/?p=1394</guid>
		<description><![CDATA[Have you ever been curious about how many lines of AS a project had? To be honest, I couldn&#8217;t care less but hey, there&#8217;re clients out there with pretty good reasons for it.
So, Google a little bit, first result takes me to CLOC.
In theory you should be able to restrict CLOC to a language only [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever been curious about how many lines of AS a project had? To be honest, I couldn&#8217;t care less but hey, there&#8217;re clients out there with pretty good reasons for it.</p>
<p>So, <a href="http://www.google.co.uk/search?sourceid=chrome&#038;ie=UTF-8&#038;q=count+lines+of+code">Google</a> a little bit, first result takes me to <a href="http://cloc.sourceforge.net/">CLOC</a>.</p>
<p>In theory you should be able to restrict CLOC to a language only but most likely due to my incompetence with regular expressions I couldn&#8217;t get it to work the way I liked it. So doing a little bit of command line trickery, I had to create a text file containing the path of the AS files I wanted to parse and then feed that to CLOC. This is how it looks:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">find</span> <span class="kw2">dir</span> <span class="re5">-type</span> f <span class="re5">-iname</span> <span class="sy0">*</span>.as <span class="sy0">&gt;</span> asfiles.txt</div>
</li>
</ol>
</div>
</div>
<p>Then send that to CLOC:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">perl</span> cloc <span class="re5">&#8211;list-file</span>=asfiles.txt <span class="re5">&#8211;quiet</span> <span class="re5">&#8211;report</span>=module_report.txt <span class="re5">&#8211;no3</span> <span class="re5">&#8211;strip-comments</span>=nc <span class="re5">&#8211;original-dir</span></div>
</li>
</ol>
</div>
</div>
<p>That would be the simpler option. But because my project is made of modules (it&#8217;s a multicore <a href="http://puremvc.org/">PureMVC</a> app) and the client wanted <em>both</em> stats per-module <em>and</em> global, I had to push it a little bit further. Basically create a stats file per module and then merge them together. Piece of cake:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">perl</span> cloc <span class="re5">&#8211;no3</span> <span class="re5">&#8211;sum-reports</span> &#8211;report_file=overall moduleReport1 moduleReport2 moduleReportN</div>
</li>
</ol>
</div>
</div>
<p>Where &#8220;overall&#8221; is the name of the final output file (actually, 2 files are created, one per file, other per language) and &#8220;moduleReportX&#8221; files are the partial report created before for each module.</p>
<p>Another good thing about CLOC is that it runs in both OSX and Ubuntu at least pretty much out of the box because both come with Perl installed. However, had a little problem in Ubuntu but contacted Al Danial (the author) and he fixed it right away. If you are running Perl 5.10, go to the line 1038 of CLOC and replace &#8220;%&#8221; by &#8220;@&#8221;.</p>
<p>Good to go!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zarate.tv/2009/12/12/counting-your-lines-of-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
