<?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>Disturbed Coder</title>
	<atom:link href="http://disturbedcoder.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://disturbedcoder.com</link>
	<description></description>
	<lastBuildDate>Mon, 13 Feb 2012 19:54:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>AS3MemoryMonitor</title>
		<link>http://disturbedcoder.com/?p=216</link>
		<comments>http://disturbedcoder.com/?p=216#comments</comments>
		<pubDate>Mon, 13 Feb 2012 19:54:17 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Actionscript3]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=216</guid>
		<description><![CDATA[AS3MemoryMonitor é um componente escrito em Actionscript3 para as tecnologias Flash, Flex e AIR. Ele surgiu da necessidade de monitorar o uso de memória dos aplicativos, para determinar pontos onde o consumo crescia demasiadamente e verificar se o lixo estava sendo coletado corretamente. Quando criado, ele se adiciona no stage e procura ficar no topo [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">AS3MemoryMonitor é um componente escrito em Actionscript3 para as tecnologias Flash, Flex e AIR.</p>
<p style="text-align: justify;">Ele surgiu da necessidade de monitorar o uso de memória dos aplicativos, para determinar pontos onde o consumo crescia demasiadamente e verificar se o lixo estava sendo coletado corretamente.<span id="more-216"></span></p>
<p style="text-align: justify;">Quando criado, ele se adiciona no stage e procura ficar no topo em relação aos outros objetos. Na sua interface exibe um gráfico de linhas que denotam três valores diferentes: o uso mínimo (em azul), o uso máximo (em vermelho) e o uso atual (em verde) de memória. Eles também são apresentados em números, além do frame rate que o aplicativo está rodando.</p>
<p style="text-align: justify;">Para ilustrar seu funcionamento, foi criado um pequeno teste que tem como objetivo criar vários objetos e depois descartá-los, para gerar lixo na memória. O teste é um sistema de partículas, onde cada uma se move em coordenas polares (com velocidade e cor aleatória).</p>
<p style="text-align: justify;"><a href="http://disturbedcoder.com/wp-content/uploads/2012/02/memory-monitor-test.png"><img class="aligncenter size-medium wp-image-219" title="memory-monitor-test" src="http://disturbedcoder.com/wp-content/uploads/2012/02/memory-monitor-test-300x225.png" alt="" width="300" height="225" /></a></p>
<p style="text-align: justify;">O componente precisa ser o mais leve possível, de forma a não gerar resíduos na memória e gastar pouco tempo da CPU. Como o gráfico é uma imagem vetorial, eu pretendia usar o método drawPath da classe Graphics para tornar o processo de desenho mais rápido. Entretanto, esse recurso está disponível apenas para o Flash Player 10, logo essa ideia foi abolida favorecendo as chamadas lineTo e moveTo.</p>
<p style="text-align: justify;">Assim, o componente é compatível com o Flash Player 9 e qualquer versão superior.</p>
<p style="text-align: justify;">Ele é distribuído sob a licença LGPL (Lesser GNU Public License).</p>
<p style="text-align: justify;"><a href="http://disturbedcoder.com/files/AS3MemoryMonitor" target="_blank">Executar aplicativo de teste</a><br />
<a href="https://github.com/loteixeira/AS3MemoryMonitor" target="_blank">Página do projeto no GitHub (com o código fonte)</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D216&amp;title=AS3MemoryMonitor" id="wpa2a_2"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=216</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ball.js &#8211; Experimento com Javascript, Node.js, Canvas e Websocket</title>
		<link>http://disturbedcoder.com/?p=203</link>
		<comments>http://disturbedcoder.com/?p=203#comments</comments>
		<pubDate>Tue, 22 Nov 2011 18:33:14 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=203</guid>
		<description><![CDATA[Em agosto deste ano, eu e Vinícius Krolow criamos um experimento baseado em uma ideia dele. Desenvolvemos o projeto em Javascript (tanto no front-end como no back-end com Node.js) usando Canvas para a parte gráfica e Websocket para a comunicação com o servidor. A aplicação é bastante simples, vários clientes quando conectados ao servidor podem [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Em agosto deste ano, eu e <a href="http://cobaia.net/" target="_blank">Vinícius Krolow</a> criamos um experimento baseado em uma ideia dele. Desenvolvemos o projeto em Javascript (tanto no front-end como no back-end com Node.js) usando Canvas para a parte gráfica e Websocket para a comunicação com o servidor.</p>
<p style="text-align: justify;">A aplicação é bastante simples, vários clientes quando conectados ao servidor podem jogar uma bola de um browser para o outro. Quando a bola sai dos limites da tela de um cliente, ela é recebida pelo próximo e assim sucessivamente.<span id="more-203"></span></p>
<p style="text-align: justify;">Usamos conceitos básicos da mecânica para modelar o movimento e controle da bolinha em duas dimensões (momento linear, atrito e colisão). No princípio havíamos planejado algo mais elaborado, mas por razões adversas acabamos finalizando em uma versão simples.</p>
<p style="text-align: justify;">Como o projeto foi um experimento, o seu desenvolvimento foi um grande aprendizado (principalmente no meu caso, que não sou um programador Javascript).</p>
<p style="text-align: justify;">Vídeo de exemplo:</p>
<p style="text-align: justify;"><object style="width: 425px; height: 350px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/NgA5EvOryU0&amp;feature" /><embed style="width: 425px; height: 350px;" type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/NgA5EvOryU0&amp;feature"></embed></object></p>
<p style="text-align: justify;">O código fonte do projeto está disponível no <a href="https://github.com/krolow/ball.js" target="_blank">GitHub</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D203&amp;title=Ball.js%20%26%238211%3B%20Experimento%20com%20Javascript%2C%20Node.js%2C%20Canvas%20e%20Websocket" id="wpa2a_4"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=203</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manifesto aos Programadores</title>
		<link>http://disturbedcoder.com/?p=181</link>
		<comments>http://disturbedcoder.com/?p=181#comments</comments>
		<pubDate>Wed, 19 Oct 2011 19:18:58 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=181</guid>
		<description><![CDATA[Faz sete anos que trabalho como programador. Durante este período fiz coisas o suficiente para entender como essa profissão funciona e como a sociedade vê e trata nossa classe. Existe um pensamento muito errado sobre programar. Uma vez que nosso trabalho se dá mentalmente, há a tendência de nos verem como preguiçosos, e até de [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Faz sete anos que trabalho como programador. Durante este período fiz coisas o suficiente para entender como essa profissão funciona e como a sociedade vê e trata nossa classe.</p>
<p style="text-align: justify;">Existe um pensamento muito errado sobre programar. Uma vez que nosso trabalho se dá mentalmente, há a tendência de nos verem como preguiçosos, e até de acreditarem que nosso trabalho é muito fácil.<span id="more-181"></span></p>
<p style="text-align: justify;">Quem nunca ouviu comentários do tipo &#8220;queria um trabalho como o teu, coisa boa passar o dia na frente do pc&#8221;?</p>
<p style="text-align: justify;">Mas aqui eu digo, meus caros, a maior parte das pessoas não aguentaria nossas atividades por uma semana sequer. Programar é mais do que brincar com o computador. Programar é pensar exaustivamente para criar sistemas cujo funcionamento é delimitado por (geralmente mal elaborados) briefings. É usar funcionalidades simples para criar comportamentos complexos, comportamentos estes que são apoiados, muitas vezes, em centenas (até milhares) de linhas de texto escrito em uma linguagem baseada em lógica e matemática.</p>
<p style="text-align: justify;">E quem menos entende a função que desempenhamos são nossos chefes, que com uma grande frequência nos dão prazos ridiculamente curtos para criarmos sistemas absurdamente elaborados. Mas a culpa não é dos nossos chefes. De quem é, então?</p>
<p style="text-align: justify;">O problema é a nossa sociedade. Estamos em uma época onde se espera que todos problemas sejam solucionados rapidamente. Essa época contemporânea informatizada dá a falsa impressão aos leigos que qualquer problema é simples de se resolver. Enganam-se eles.</p>
<p style="text-align: justify;">Ser programador é quase como ser um maratonista mental. Não temos tempo de pensar na melhor solução. Precisamos apenas encontrar qualquer solução que não vá nos fazer perder tempo. Precisamos sempre nos superar, ser ágeis e, como se não fosse o bastante, precisamos estar sempre estudando, pois as evoluções nessa área se dão muito rapidamente.</p>
<p style="text-align: justify;">Quantos de nós desenvolveu problemas de saúde por causa desta maldita profissão? Tendinite é o mais comum, mas vemos até complicações respiratórias por causa de horas de baixo de um condicionador de ar. Estamos sempre correndo pra satisfazer as expectativas dos clientes e chefes. O mercado é selvagem.</p>
<p style="text-align: justify;">O que mais surpreende nisso tudo é como os programadores de modo geral são submissos e aceitam essa situação que lhes foi imposta. Acho que é inerente ao ser humano aceitar a situação, por pior que ela seja, se ele não conhece outras possibilidades. Mas existem outras possibilidades se lutarmos por elas.</p>
<p style="text-align: justify;">Imagino o dia em que o programador será tratado com o devido respeito, pois a sociedade nos deve isso. O mundo do século 21 depende de nós para funcionar. Desde terminais de auto-atendimento de bancos até ligações telefônicas. Mas eles, que dependem de nós, nos tratam como nerds sem vida social que gostam de se submeter a essa situação patética.</p>
<p style="text-align: justify;">Meu sonho, ainda que distante e improvável, é ver um levante dos programadores. É nos ver unidos lutando por melhores condições. É ver uma greve global de programadores que fará o mundo parar e nos observar. Nos entender como seres humanos.</p>
<p style="text-align: justify;">Eu sei, esses ideais são quase inalcançáveis. Mas quem não sonha não vive.</p>
<p style="text-align: justify;">Pense nisso.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D181&amp;title=Manifesto%20aos%20Programadores" id="wpa2a_6"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=181</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS3Console 0.3</title>
		<link>http://disturbedcoder.com/?p=125</link>
		<comments>http://disturbedcoder.com/?p=125#comments</comments>
		<pubDate>Fri, 09 Sep 2011 21:25:46 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Actionscript3]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=125</guid>
		<description><![CDATA[For those who don&#8217;t know: AS3Console is a small and non-intrusive logging component for Actionscript3 language (Flash, Flex and AIR). And today I&#8217;m releasing version 0.3 with some nice improvements. The changes are described below: Top level println function: previous versions of AS3Console needed a lot of writing to print text into console window. Since [...]]]></description>
			<content:encoded><![CDATA[<p>For those who don&#8217;t know: AS3Console is a small and non-intrusive logging component for Actionscript3 language (Flash, Flex and AIR).</p>
<p>And today I&#8217;m releasing version 0.3 with some nice improvements. The changes are described below:</p>
<p><span id="more-125"></span></p>
<p><strong>Top level println function:</strong> previous versions of AS3Console needed a lot of writing to print text into console window. Since the component is a singleton, the call was:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">Console<span style="color: #000066; font-weight: bold;">.</span>getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>println<span style="color: #000000;">&#40;</span><span style="color: #004993;">text</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>Now a top level function behaves as an alias of the call, making faster to write strings to console. The function name is cpln (<strong>C</strong>onsole <strong>P</strong>rint <strong>LN</strong>):</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">cpln<span style="color: #000000;">&#40;</span><span style="color: #004993;">text</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p><strong>CodeEval plugin:</strong> an input plugin was added and it behaves similiar to Actinscript1 and Actionscript2 eval function. This plugin gets an input text from console, compiles it to AVM2 bytecode and execute it. To achieve this functionality the component uses <a href="http://eval.hurlant.com/" target="_blank">AS3 Eval Library</a>. Unfortunately, AS3Eval doesn&#8217;t seems to be updated for a long time.</p>
<p>To activate CodeEval plugin use the following code just after creating console singleton:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">CodeEval<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>And to evaluate any code from console input text field just type:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">eval cpln<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Running code from AS3Console! LOL&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p><strong>AssetFactory class:</strong> a new class was created to manage console appearance. On previous versions, the layout was hardcoded and really difficult to change. This simple class have methods which you must override to change console visual. To set a new AssetFactory just do the following:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">Console<span style="color: #000066; font-weight: bold;">.</span>getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>setAssetFactory<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> AssetFactory<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p><strong>FIREBUG_ECHO property:</strong> similiar to TRACE_ECHO, this new property allows console to redirect every output to firebug window. Usefull when developing a flash application to run within a web browser. To activate this functionality just set FIREBUG_ECHO property to true:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">Console<span style="color: #000066; font-weight: bold;">.</span>FIREBUG_ECHO = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p><strong>Where to download?</strong></p>
<p>AS3Console project was moved from GoogleCode to GitHub: <a href="https://github.com/loteixeira/as3console" target="_blank">https://github.com/loteixeira/as3console</a></p>
<p>Or you can download the packages here:<br />
<a href="https://github.com/downloads/loteixeira/as3console/as3console-0.3-src.rar" target="_blank">Download AS3Console 0.3 source code<br />
</a><a href="https://github.com/downloads/loteixeira/as3console/as3console-0.3-doc.rar" target="_blank">Download AS3Console 0.3 documentation<br />
</a><a href="https://github.com/downloads/loteixeira/as3console/as3console-0.3-demo.swf" target="_blank">Download AS3Console 0.3 demo<br />
</a><a href="https://github.com/downloads/loteixeira/as3console/as3console-0.3.swc" target="_blank">Download AS3Console 0.3 pre-compiled library</a></p>
<p>This software is open source and is distributed under the terms of the GNU Lesser Public License.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D125&amp;title=AS3Console%200.3" id="wpa2a_8"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=125</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript3 Ulam Spiral</title>
		<link>http://disturbedcoder.com/?p=114</link>
		<comments>http://disturbedcoder.com/?p=114#comments</comments>
		<pubDate>Thu, 28 Jul 2011 19:24:03 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Actionscript3]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=114</guid>
		<description><![CDATA[Ulam spiral is a simple method to visualize how prime numbers are distributed over a numerical set. It was created by Stanislaw Ulam in 1963, during a long and boring presentation. The construction of this spiral is pretty simple, the number one is placed at the center of the page and all underlying numbers are [...]]]></description>
			<content:encoded><![CDATA[<p>Ulam spiral is a simple method to visualize how prime numbers are distributed over a numerical set. It was created by Stanislaw Ulam in 1963, during a long and boring presentation.<br />
The construction of this spiral is pretty simple, the number one is placed at the center of the page and all underlying numbers are spiraled out. When observing the spiral it&#8217;s possible to note that prime numbers tend to group at the edges, creating a pattern.</p>
<p><span id="more-114"></span></p>
<p><a href="http://en.wikipedia.org/wiki/Ulam_spiral" target="_blank">Check Ulam Spiral article at Wikipedia</a></p>
<p>I created a version of Ulam Spiral using Actionscript3 with bitmaps. The algorithm iterates through every pixel and sets a color to it according to the correspondent number. Prime numbers are red, square numbers are green and regular numbers are black pixels.</p>
<p><a href="http://disturbedcoder.com/files/UlamSpiral/UlamSpiral.rar">Download Actionscript3 Ulam Spiral source code<br />
</a><a href="http://disturbedcoder.com/files/UlamSpiral/UlamSpiral.swf" target="_blank">Run Actionscript3 Ulam Spiral (requires Flash Player 9)</a><a href="http://disturbedcoder.com/files/UlamSpiral/UlamSpiral.rar"></a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D114&amp;title=Actionscript3%20Ulam%20Spiral" id="wpa2a_10"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=114</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Molehill Heightmap Viewer version 1.1</title>
		<link>http://disturbedcoder.com/?p=97</link>
		<comments>http://disturbedcoder.com/?p=97#comments</comments>
		<pubDate>Sat, 23 Jul 2011 21:43:20 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[Stage3D]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=97</guid>
		<description><![CDATA[Molehill Heightmap Viewer was updated to version 1.1 to fit the changes between Flash Player Incubator and Flash Player 11 Beta. The behavior of the application is pretty much the same, only the viewPort attribute of Stage3D has changed and a open source header was added to all files of the source code. You can [...]]]></description>
			<content:encoded><![CDATA[<p>Molehill Heightmap Viewer was updated to version 1.1 to fit the changes between Flash Player Incubator and Flash Player 11 Beta.</p>
<p>The behavior of the application is pretty much the same, only the viewPort attribute of Stage3D has changed and a open source header was added to all files of the source code.</p>
<p><span id="more-97"></span></p>
<p>You can download Flash Player 11 Beta <a href="http://labs.adobe.com/downloads/flashplayer11.html" target="_blank">here</a>.</p>
<p><a href="http://disturbedcoder.com/files/HeightmapViewer/HeightmapViewer-source.rar">Download Molehill Heightmap Viewer 1.1 source code</a><a href="http://disturbedcoder.com/files/HeightmapViewer/HeightmapViewer-binary.rar"><br />
Download Molehill Heightmap Viewer 1.1 binary package<br />
</a><a href="http://disturbedcoder.com/files/HeightmapViewer" target="_blank">Run Molehill Heightmap Viewer (require Flash Player 11)</a><a href="http://disturbedcoder.com/files/HeightmapViewer/HeightmapViewer-binary.rar"></a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D97&amp;title=Molehill%20Heightmap%20Viewer%20version%201.1" id="wpa2a_12"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=97</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript3 Load Queue</title>
		<link>http://disturbedcoder.com/?p=70</link>
		<comments>http://disturbedcoder.com/?p=70#comments</comments>
		<pubDate>Fri, 22 Jul 2011 18:43:38 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Actionscript3]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=70</guid>
		<description><![CDATA[LoadQueue is a utility class written in Actionscript3 to manage the process of loading several files at once. An example of the simplest scenario for using this class: var loadQueue:LoaderQueue = new LoadQueue&#40;&#41;; loadQueue.addEventListener&#40;LoadQueueEvent.LOAD_END, loadEnd&#41;; loadQueue.setFileList&#40;&#91;&#34;file1.txt&#34;, &#34;file2.jpg&#34;&#93;, &#91;LoadQueue.TEXT, LoadQueue.IMAGE&#93;&#41;; loadQueue.start&#40;&#41;; It&#8217;s important to specify the file type in setFileList method, because after the object dispatches [...]]]></description>
			<content:encoded><![CDATA[<p>LoadQueue is a utility class written in Actionscript3 to manage the process of loading several files at once.</p>
<p>An example of the simplest scenario for using this class:</p>
<p><span id="more-70"></span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> loadQueue<span style="color: #000066; font-weight: bold;">:</span>LoaderQueue = <span style="color: #0033ff; font-weight: bold;">new</span> LoadQueue<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>LoadQueueEvent<span style="color: #000066; font-weight: bold;">.</span>LOAD_END<span style="color: #000066; font-weight: bold;">,</span> loadEnd<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span>setFileList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;file1.txt&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;file2.jpg&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000;">&#91;</span>LoadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">TEXT</span><span style="color: #000066; font-weight: bold;">,</span> LoadQueue<span style="color: #000066; font-weight: bold;">.</span>IMAGE<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>It&#8217;s important to specify the file type in setFileList method, because after the object dispatches LOAD_END event you can retrieve the loaded objects already casted to correct type. However, you can use LoadQueue.UNDEFINED property to receive the raw data (a ByteArray in case of binary file or String for text file).</p>
<p>Whether you need to receive all events, here&#8217;s a list of them:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">ErrorEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ERROR</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">error</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// an error occurred when processing requests</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">IOErrorEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">IO_ERROR</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">ioError</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// a request has resulted in an IO error</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">SecurityErrorEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">SECURITY_ERROR</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">securityError</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// security problems - flash sandbox issues</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>LoadQueueEvent<span style="color: #000066; font-weight: bold;">.</span>LOAD_START<span style="color: #000066; font-weight: bold;">,</span> loadStart<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// load queue process started (before load any file)</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>LoadQueueEvent<span style="color: #000066; font-weight: bold;">.</span>LOAD_END<span style="color: #000066; font-weight: bold;">,</span> loadEnd<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// load queue process ended (after load all files)</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>LoadQueueEvent<span style="color: #000066; font-weight: bold;">.</span>FILE_START<span style="color: #000066; font-weight: bold;">,</span> fileStart<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// load queue starts to load a file</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>LoadQueueEvent<span style="color: #000066; font-weight: bold;">.</span>FILE_END<span style="color: #000066; font-weight: bold;">,</span> fileEnd<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// load queue has complete a file</span>
loadQueue<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>LoadQueueEvent<span style="color: #000066; font-weight: bold;">.</span>FILE_PROGRESS<span style="color: #000066; font-weight: bold;">,</span> fileProgress<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// load progress of a file</span></pre></div></div>

<p>After the loading process, you can retrieve the objects using getObjects method:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> objects<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = loadQueue<span style="color: #000066; font-weight: bold;">.</span>getObjects<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>This software is open source and is distributed under the terms of the GNU Lesser Public License.</p>
<p><a href="http://disturbedcoder.com/files/LoadQueue/LoadQueue-src.rar">Download LoadQueue source code and example application</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D70&amp;title=Actionscript3%20Load%20Queue" id="wpa2a_14"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=70</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Molehill Heightmap Viewer</title>
		<link>http://disturbedcoder.com/?p=38</link>
		<comments>http://disturbedcoder.com/?p=38#comments</comments>
		<pubDate>Tue, 12 Jul 2011 21:09:56 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[Stage3D]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=38</guid>
		<description><![CDATA[Heightmap terrains are widely used in games and geographic information systems. They are the ideal way to store terrain data, once the technique have a small memory footprint. You can read more about this topic in Heightmap article at Wikipedia. I had the idea to develop a Heightmap Viewer few years ago. Every time I worked [...]]]></description>
			<content:encoded><![CDATA[<p>Heightmap terrains are widely used in games and geographic information systems. They are the ideal way to store terrain data, once the technique have a small memory footprint.<br />
You can read more about this topic in <a href="http://en.wikipedia.org/wiki/Heightmap" target="_blank">Heightmap article at Wikipedia</a>.</p>
<p><span id="more-38"></span></p>
<p>I had the idea to develop a Heightmap Viewer few years ago. Every time I worked on a game, or any 3D software using terrains, I always thought on a tool to easily visualize heightmaps (and even customize them). This simple project was postponed because I would rather to create a multiplataform application, but the technologies from that time were too complicated, too heavy and OS-dependant  (an option was C/C++ using any free 3D engine). The ideal scenario was a platform-free application without need to install anything.<br />
Currently, thanks to Stage3D (Flash) and WebGL (Javascript), it&#8217;s possible to create such application to run on a web browser.</p>
<p>Molehill Heightmap Viewer was developed using Actionscript3 and Stage3D API, compiled via FlexSDK and uses <a href="http://www.minimalcomps.com/" target="_blank">MinimalComps</a> library to manage the graphical user interface. It was created without any engine or framework, using only Adobe utils classes, such as AGALMiniAssembler and PerspectiveMatrix3D. The application can load images (heightmaps or textures) from your computer or from the web, moreover the main SWF file is able to receive parameters in order to customize the behavior and appearance of loaded terrain. You can gather more information within application&#8217;s help.</p>
<p><a href="http://disturbedcoder.com/wp-content/uploads/2011/07/post-pic.png" target="_blank"><img class="aligncenter size-medium wp-image-44" title="Molehill Heightmap Viewer" src="http://disturbedcoder.com/wp-content/uploads/2011/07/post-pic-300x162.png" alt="" width="300" height="162" /></a></p>
<p>This software is open source and is distributed under the terms of the GNU Lesser Public License.</p>
<p>Note: to execute this program you need to install Flash Player Incubator (some kind of beta version). <a href="http://labs.adobe.com/downloads/flashplatformruntimes_incubator.html" target="_blank">Click here</a> to be redirected to the download page.</p>
<p><a href="http://disturbedcoder.com/files/HeightmapViewer/HeightmapViewer-source.rar">Click here</a> to download the source code.<br />
<a href="http://disturbedcoder.com/files/HeightmapViewer/HeightmapViewer-binary.rar">Click here</a> to download the pre-compiled binary package.<br />
<a href="http://disturbedcoder.com/files/HeightmapViewer" target="_blank">Click here</a> to run Heightmap Viewer application.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D38&amp;title=Molehill%20Heightmap%20Viewer" id="wpa2a_16"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=38</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AS3Console</title>
		<link>http://disturbedcoder.com/?p=29</link>
		<comments>http://disturbedcoder.com/?p=29#comments</comments>
		<pubDate>Thu, 07 Jul 2011 21:20:55 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Actionscript3]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=29</guid>
		<description><![CDATA[AS3Console é um componente para entrada e saída de texto desenvolvido em Actionscript3 para a plataforma Flash. Eu o criei ao trabalhar num projeto onde o arquivo SWF, obrigatoriamente, rodaria sobre uma camada de código Javascript, resultando num sistema que era executado somente no navegador. Já que não podia usar o trace, eu precisava de [...]]]></description>
			<content:encoded><![CDATA[<p>AS3Console é um componente para entrada e saída de texto desenvolvido em Actionscript3 para a plataforma Flash. Eu o criei ao trabalhar num projeto onde o arquivo SWF, obrigatoriamente, rodaria sobre uma camada de código Javascript, resultando num sistema que era executado somente no navegador. Já que não podia usar o trace, eu precisava de uma saída de texto sem instalar nenhum progama/plugin ou ocupar área na tela. Essa solução precisava ser invisível para o programa hospedeiro e também para o usuário final. Baseando-me nessas necessidades, eu escrevi este componente enquanto desenvolvia o projeto principal.</p>
<p><span id="more-29"></span></p>
<p>Suas principais caracteristicas são:</p>
<ul>
<li>o componente é um singleton, derivado da classe EventDispatcher;</li>
</ul>
<ul>
<li>suporta entrada e saída de texto;</li>
</ul>
<ul>
<li>teclas de atalho para esconder/exibir sua interface gráfica;</li>
</ul>
<ul>
<li>facilidade de remove-lo em releases; e</li>
</ul>
<ul>
<li>totalmente sem dependências.</li>
</ul>
<p>Finalizado o projeto principal, notei que o componente de console ficou razoavelmente útil. Então decidi torná-lo opensource e investir um pouco do meu tempo na melhoria dele.<br />
O projeto é distribuido sob a licença LGPL e está hospedado no google code. Lá é possível encontrar o código fonte, o SWC pré-compilado, a documentação e um aplicativo de exemplo.</p>
<p><a href="http://code.google.com/p/as3console/" target="_blank">Ir para a página do projeto</a><br />
<a href="files/AS3Console0.1/as3console-demo.swf" target="_blank">Executar o aplicativo de exemplo</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D29&amp;title=AS3Console" id="wpa2a_18"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=29</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash e Alchemy</title>
		<link>http://disturbedcoder.com/?p=22</link>
		<comments>http://disturbedcoder.com/?p=22#comments</comments>
		<pubDate>Thu, 07 Jul 2011 21:18:11 +0000</pubDate>
		<dc:creator>Lucas Teixeira</dc:creator>
				<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[C/C++]]></category>

		<guid isPermaLink="false">http://disturbedcoder.com/?p=22</guid>
		<description><![CDATA[Alchemy é um projeto de pesquisa da empresa Adobe Systems onde o objetivo é compilar códigos escritos em C/C++ para o bytecode da AVM2 (máquina virtual usada no Flash Player e Adobe AIR). Logicamente, o código gerado tende a ser mais rápido, graças a massiva otimização dos compiladores C e, também, devido o modelo de [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pt.wikipedia.org/wiki/Alchemy_%28Adobe%29" target="_blank">Alchemy</a> é um projeto de pesquisa da empresa Adobe Systems onde o objetivo é compilar códigos escritos em C/C++ para o bytecode da AVM2 (máquina virtual usada no Flash Player e Adobe AIR). Logicamente, o código gerado tende a ser mais rápido, graças a massiva otimização dos compiladores C e, também, devido o modelo de memória da linguagem onde &#8211; no reducionismo &#8211; tudo se resume a bytes.</p>
<p><span id="more-22"></span></p>
<p>Logo no começo dessa empreitada eu esperava uma diferença gritante de desempenho entre os códigos gerados. No entanto, de todos computadores que o aplicativo foi testado a maior diferença foi de oito frames por segundo a favor do Alchemy.</p>
<p style="text-align: center;"><a href="http://disturbedcoder.files.wordpress.com/2011/02/ps-screen.png" target="_blank"><img class="aligncenter" title="ps-screen" src="http://disturbedcoder.files.wordpress.com/2011/02/ps-screen.png?w=300" alt="" width="300" height="240" /></a></p>
<p><a href="http://disturbedcoder.files.wordpress.com/2011/02/ps-screen.png"></a>O teste consistiu na criação de um sistema de partículas (<a href="http://en.wikipedia.org/wiki/Particle_system">Particle System</a> em inglês) para simular fogo. Dois renderizadores foram criados: um escrito em Actionscript3 e compilado na IDE do Flash e outro em C compilado com o <a href="http://pt.wikipedia.org/wiki/Cygwin" target="_blank">Cygwin</a> através do Alchemy. O trabalho de cada renderizador consiste em desenhar o sistema de particulas sobre um bitmap que será exibido na tela. Os algoritmos desenvolvidos em ambas linguagens são extremamente semelhantes, ficando as diferenças a cargo dos diferentes conceitos das linguagens.</p>
<p>O código fonte é distribuído sob a licença LGPL (Lesser GNU Public License).<br />
<a href="files/ParticleSystem/particlesystem.rar">Download ParticleSystem &#8211; código fonte (Actionscript3 e C)</a><a href="http://dl.dropbox.com/u/7401593/particle-system.html" target="_blank"><br />
</a><a href="files/ParticleSystem/particle-system.html" target="_blank">Executar ParticleSystem (requer Flash Player 10)</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fdisturbedcoder.com%2F%3Fp%3D22&amp;title=Flash%20e%20Alchemy" id="wpa2a_20"><img src="http://disturbedcoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://disturbedcoder.com/?feed=rss2&#038;p=22</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

