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

<channel>
	<title>Lauro Moura</title>
	<atom:link href="http://lauro.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lauro.wordpress.com</link>
	<description>Software Livre, Python, C, etc...</description>
	<lastBuildDate>Wed, 04 Feb 2009 15:37:44 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='lauro.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9d936f7dda01120458c3d1ea04329bc0?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Lauro Moura</title>
		<link>http://lauro.wordpress.com</link>
	</image>
			<item>
		<title>Bossa Conference &#8216;09 &#8211; Programação</title>
		<link>http://lauro.wordpress.com/2009/02/04/bossa-conference-09-programacao/</link>
		<comments>http://lauro.wordpress.com/2009/02/04/bossa-conference-09-programacao/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 15:37:44 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[embarcados]]></category>
		<category><![CDATA[eventos]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[kde]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=232</guid>
		<description><![CDATA[Acabou de sair a programação inicial da edição desse ano da Bossa Conference e Python mais uma vez estará presente. Confira!
Extra &#8211; Vídeo da edição do ano passado
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=232&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Acabou de sair a programação inicial da edição desse ano da Bossa Conference e Python mais uma vez estará presente. <a href="http://www.bossaconference.indt.org/programme">Confira!</a></p>
<p>Extra &#8211; <a href="http://www.youtube.com/watch?v=sdo-bY6TBzA">Vídeo da edição do ano passado</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/232/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=232&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2009/02/04/bossa-conference-09-programacao/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>
	</item>
		<item>
		<title>Lambdas em laços for</title>
		<link>http://lauro.wordpress.com/2008/09/06/lambdas-em-lacos-for/</link>
		<comments>http://lauro.wordpress.com/2008/09/06/lambdas-em-lacos-for/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 23:57:05 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[programação]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[lambda]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=225</guid>
		<description><![CDATA[Duas vezes num espaço de pouco mais de poucas semana me deparei com duas situações em que o programador era vítima de uma característica pouco conhecida da instrução lambda de python.
Ambas as situações envolviam usar lambda dentro de um laço for para criar funções dinamicamente de acordo com o valor fornecido pelo for naquela iteração. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=225&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Duas vezes num espaço de pouco mais de poucas semana me deparei com duas situações em que o programador era vítima de uma característica pouco conhecida da instrução <code>lambda</code> de python.</p>
<p>Ambas as situações envolviam usar <code>lambda</code> dentro de um laço <code>for</code> para criar funções dinamicamente de acordo com o valor fornecido pelo <code>for</code> naquela iteração. Seria algo mais ou menos assim:</p>
<p><code>for x in range(10):<br />
algo_assincrono.connect(lambda : foobar(x))<br />
</code></p>
<p>No caso, o programador queria que a funcao <code>foobar</code> fosse chamada para cada <code>x</code> gerado no <code>for</code>, enquanto que na prática a função é sempre chamada com o último valor atribuído a <code>x</code>. Isso acontece porque a instrução <code>lambda</code> de python não é exatamente igual às outras lambdas de outras linguagens.</p>
<p>Em python, <code>lambda</code> é apenas uma mandeira simples de encapsular uma expressão dentro de uma função anônima, <strong>sem</strong> resolver os nomes das variáveis em tempo de definição. Ou seja, lambdas de python não possuem um escopo (espaço de nomes) próprio, trabalhando no escopo em que foram definidas. E como o laço <code>for</code> também não cria um espaço de nomes próprio, a variável <code>x</code> no caso acima estará com o último valor atribuído a ela até o momento da execução do lambda.</p>
<p>Uma alternativa para esse problema é usar aplicação parcial de funções, disponível como a função <code>partial</code> no módulo <code>functools</code>. Ela trabalha recebendo como primeiro parâmetro a função alvo e em seguida os argumentos que devem ser aplicados parcialmente, retornando uma função que receberá apenas os argumentos restantes. Por exemplo:</p>
<p><code>&gt;&gt;&gt; def foo(x,y,z):<br />
...     return x+y+z<br />
...<br />
&gt;&gt;&gt; foo(3)<br />
Traceback (most recent call last):<br />
File "", line 1, in<br />
TypeError: foo() takes exactly 3 arguments (1 given)<br />
&gt;&gt;&gt; from functools import partial<br />
&gt;&gt;&gt; bar = partial(foo, 3)<br />
&gt;&gt;&gt; bar(4,5)<br />
12<br />
&gt;&gt;&gt; bar(4)<br />
Traceback (most recent call last):<br />
File "", line 1, in<br />
TypeError: foo() takes exactly 3 arguments (2 given)<br />
&gt;&gt;&gt; bar(0,0)<br />
3<br />
&gt;&gt;&gt;<br />
</code></p>
<p>Voltando para o exemplo inicial, utilizando partial, ficaria assim:<br />
<code>for x in range(10):<br />
algo_assincrono.connect(partial(foobar, x))<br />
</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/225/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/225/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=225&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/09/06/lambdas-em-lacos-for/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>
	</item>
		<item>
		<title>Zen do Python na prática</title>
		<link>http://lauro.wordpress.com/2008/08/07/zen-do-python-na-pratica/</link>
		<comments>http://lauro.wordpress.com/2008/08/07/zen-do-python-na-pratica/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:08:03 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[duck typing]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=223</guid>
		<description><![CDATA[- Como é o jeito padrão de implementar árvore em python?
- Rapaz, até onde eu sei cada um implementa do jeito que precisa.
-  Sim, mas não tem um jeito &#8220;padrão&#8221;?
- Hum, acho que não.
- Então eu vou ter que implementar essa árvore e disponibilizar p/ cara p/ ele herdar dela e&#8230;
- Porque você precisa de [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=223&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>- Como é o jeito padrão de implementar árvore em python?</p>
<p>- Rapaz, até onde eu sei cada um implementa do jeito que precisa.</p>
<p>-  Sim, mas não tem um jeito &#8220;padrão&#8221;?</p>
<p>- Hum, acho que não.</p>
<p>- Então eu vou ter que implementar essa árvore e disponibilizar p/ cara p/ ele herdar dela e&#8230;</p>
<p>- Porque você precisa de uma árvore?</p>
<p>- Ah, eu tenho plugins e eles precisam retornar os menus e submenus na forma de uma árvore.</p>
<p>- Por que não diz ao cara apenas que ele precisa ter um atributo &#8216;children&#8217; com uma lista dos filhos que por sua vez podem ter também o atributo children e assim até chegar na folha da &#8216;árvore&#8217;. Dessa forma ele fica livre para implementar do jeito que quiser.</p>
<p>- É, boa idéia&#8230;</p>
<p><a href="http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Exceptions">É mais fácil pedir desculpa que pedir permissão</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/223/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/223/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/223/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=223&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/08/07/zen-do-python-na-pratica/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;Com mais dinheiro resolveremos nossos problemas!&#8221;</title>
		<link>http://lauro.wordpress.com/2008/06/04/com-mais-dinheiro-resolveremos-nossos-problemas/</link>
		<comments>http://lauro.wordpress.com/2008/06/04/com-mais-dinheiro-resolveremos-nossos-problemas/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 00:40:21 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[política]]></category>
		<category><![CDATA[economia]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=220</guid>
		<description><![CDATA[Trecho de um artigo no blog Productivity501 sobre um projeto de aumento nas taxas no estado de Michigan:
The thought of “if we only had more money we could fix our problems” is prevalent in government, business and personal life.  If your focus is on getting more money you will often overlook solutions that actually solve [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=220&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Trecho de um <a href="http://www.productivity501.com/michigans-big-bet/844/">artigo no blog Productivity501</a> sobre um projeto de aumento nas taxas no estado de Michigan:</p>
<blockquote><p>The thought of “if we only had more money we could fix our problems” is prevalent in government, business and personal life.  If your focus is on getting more money you will often overlook solutions that actually solve the problem.  Worse still, the “money” solutions often turn out to create new problems that are worse that what you were originally trying to fix.</p></blockquote>
<p>Em livre tradução:</p>
<blockquote><p>A idéia de que &#8220;se nós tivéssemos mais dinheiro nós poderíamos consertar nossos problemas&#8221; é predominante no governo, negócios, e vida pessoal. Se seu foco é em conseguir mais dinheiro você geralmente vai ignorar soluções que na prática resolvem o problema. Pior ainda, as soluções de &#8220;dinheiro&#8221; normalmente acabam criando novos problemas que são piores que os problemas originais.</p></blockquote>
<p>Não poderia concordar mais.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/220/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/220/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/220/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=220&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/06/04/com-mais-dinheiro-resolveremos-nossos-problemas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>
	</item>
		<item>
		<title>Raycife: Agora com sombras</title>
		<link>http://lauro.wordpress.com/2008/04/26/raycife-agora-com-sombras/</link>
		<comments>http://lauro.wordpress.com/2008/04/26/raycife-agora-com-sombras/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 18:10:20 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[ufpe]]></category>
		<category><![CDATA[raycife]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=216</guid>
		<description><![CDATA[Apesar de ter aumentado consideravelmente a granularidade (tá parecendo coisa de z-buffer ou algo do tipo), corrigi um bug besta pelo qual as sombras não estavam aparecendo: O raio de luz estava com a direção invertida (luz &#8211; ponto_de_verificação, e não ponto_de_verificação &#8211; luz)&#8230;
Abaixo, o resultado: 100&#215;100 pixels e 100 raios/pixel (26 minutos, mas usando [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=216&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Apesar de ter aumentado consideravelmente a granularidade (tá parecendo coisa de z-buffer ou algo do tipo), corrigi um bug besta pelo qual as sombras não estavam aparecendo: O raio de luz estava com a direção invertida (luz &#8211; ponto_de_verificação, e não ponto_de_verificação &#8211; luz)&#8230;</p>
<p>Abaixo, o resultado: 100&#215;100 pixels e 100 raios/pixel (26 minutos, mas usando o computador enquanto processava):</p>
<p><a href="http://lauro.files.wordpress.com/2008/04/cornell_shadows.png"><img class="alignnone size-full wp-image-217" src="http://lauro.files.wordpress.com/2008/04/cornell_shadows.png?w=100&#038;h=100" alt="" width="100" height="100" /></a></p>
<p>Próximos passos: resolver essa bronca de granularidade e adicionar reflexão especular.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/216/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/216/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=216&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/04/26/raycife-agora-com-sombras/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>

		<media:content url="http://lauro.files.wordpress.com/2008/04/cornell_shadows.png" medium="image" />
	</item>
		<item>
		<title>Status do projeto: raycife+</title>
		<link>http://lauro.wordpress.com/2008/04/23/status-do-projeto-raycife/</link>
		<comments>http://lauro.wordpress.com/2008/04/23/status-do-projeto-raycife/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 21:21:00 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[ufpe]]></category>
		<category><![CDATA[raycife]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=214</guid>
		<description><![CDATA[
Esse é o estado atual, apenas com iluminação ambiente e a componente difusa (e um belo bug de ordenação). A imagem de referência pode ser encontrada no fim dessa página.
Dados: Janela 200&#215;200 com 20 raios por pixel.
Tempo de processamento num Celeron 440 com 1 GB de RAM: +-15 minutos (muito lento&#8230;)
     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=214&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://lauro.files.wordpress.com/2008/04/foo.png"><img class="alignnone size-full wp-image-215" src="http://lauro.files.wordpress.com/2008/04/foo.png?w=200&#038;h=200" alt="First full window of raycife" width="200" height="200" /></a></p>
<p>Esse é o estado atual, apenas com iluminação ambiente e a componente difusa (e um belo bug de ordenação). A imagem de referência pode ser encontrada no fim <a title="Página do Raycife++" href="http://www.cin.ufpe.br/~marcelow/Marcelow/extraclasse-cg.html">dessa página</a>.</p>
<p>Dados: Janela 200&#215;200 com 20 raios por pixel.</p>
<p>Tempo de processamento num Celeron 440 com 1 GB de RAM: +-15 minutos (muito lento&#8230;)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/214/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/214/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/214/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=214&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/04/23/status-do-projeto-raycife/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>

		<media:content url="http://lauro.files.wordpress.com/2008/04/foo.png" medium="image">
			<media:title type="html">First full window of raycife</media:title>
		</media:content>
	</item>
		<item>
		<title>Profiling python com cprofile</title>
		<link>http://lauro.wordpress.com/2008/04/21/profiling-python-com-cprofile/</link>
		<comments>http://lauro.wordpress.com/2008/04/21/profiling-python-com-cprofile/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 15:16:33 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[otimização]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[raycife]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=213</guid>
		<description><![CDATA[Durante o desenvolvimento do raycife+, a performance estava ficando impraticável, chegando a cerca de 3 a 4 minutos para uma cena simples de 100&#215;100 pixels e 7 objetos no meu velho celeron. Seguindo as dicas desse site, rodei o cprofile e pude ver onde poderia ganhar tempo.
No arquivo principal do programa esse código que executa [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=213&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Durante o desenvolvimento do <a href="http://www.cin.ufpe.br/~marcelow/Marcelow/extraclasse-cg.html" target="_self">raycife+</a>, a performance estava ficando impraticável, chegando a cerca de 3 a 4 minutos para uma cena simples de 100&#215;100 pixels e 7 objetos no meu velho celeron. Seguindo as dicas <a title="Notas sobre uso do cProfile" href="http://blog.brianbeck.com/post/22199891">desse site</a>, rodei o cprofile e pude ver onde poderia ganhar tempo.</p>
<p>No arquivo principal do programa esse código que executa a função main com os argumentos fornecidos na string e salva o resultado num arquivo de log.</p>
<pre>if __name__ == '__main__':
    import cProfile
    cProfile.run('main(["raycifeplus.py", "./samples/cornellroomsmall.sdl"])' filename='raycife.cprof')</pre>
<p>Para ler o resultado do arquivo de saída:</p>
<pre>from pstats import Stats
stats = Stats("raycife.cprof")
stats.sort_stats('time').print_stats()</pre>
<p>Exemplo da saída:</p>
<pre>Mon Apr 21 11:23:35 2008    raycife.cprof

37298787 function calls in 237.746 CPU seconds

Ordered by: internal time

ncalls  tottime  percall  cumtime  percall filename:lineno(function)
1  168.955  168.955  237.734  237.734 ./raycifeplus.py:71(render)
26660558   46.400    0.000   46.409    0.000 /home/lauro/dev/raytracer/raycifeplus/gameobjects/vector3.py:165(__iter__)
5723042    9.791    0.000    9.807    0.000 /home/lauro/dev/raytracer/raycifeplus/gameobjects/vector3.py:265(__sub__)
2422914    4.633    0.000    4.636    0.000 /home/lauro/dev/raytracer/raycifeplus/gameobjects/vector3.py:369(__rmul__)
2422914    4.114    0.000    4.125    0.000 /home/lauro/dev/raytracer/raycifeplus/gameobjects/vector3.py:224(__add__)
10000    2.927    0.000    4.841    0.000 ./raycifeplus.py:80(render_pixel)
1472    0.478    0.000    0.916    0.001 ./raycifeplus.py:99(trace_point)
841    0.129    0.000    0.299    0.000 /home/lauro/dev/raytracer/raycifeplus/objfile.py:30(intersect)
1    0.119    0.119    0.182    0.182 /home/lauro/dev/raytracer/raycifeplus/pnm.py:18(write)
10000    0.044    0.000    0.044    0.000 /home/lauro/dev/raytracer/raycifeplus/pnm.py:15(set_pixel)</pre>
<p>Nesse caso, deu para ver que parte do tempo era perdido no módulo vector3, uma implementação de vetores em 3 dimensões usando python.</p>
<p>No próximo vou falar sobre uma tentativa rápida de implementar a mesma funcionalidade usando C++ e criando o binding usando o SIP.</p>
<p>Nota: O código acima ainda poderia ser refinado para receber argumentos na linha de comando mas como é apenas um teste rápido, pode ficar p/ depois uma flag &#8220;-p&#8221; para habilitar o profiling.</p>
<p>Nota2: Sim, eu sei que a otimização prematura é a raíz de todo mal mas nesse caso é um teste pontual que não vai mudar o algoritmo, além de poder conhecer novas tecnologias <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/213/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/213/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/213/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=213&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/04/21/profiling-python-com-cprofile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>
	</item>
		<item>
		<title>A distribuição Linux perfeita!</title>
		<link>http://lauro.wordpress.com/2008/04/19/a-distribuicao-linux-perfeita/</link>
		<comments>http://lauro.wordpress.com/2008/04/19/a-distribuicao-linux-perfeita/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 06:35:43 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[comic]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=211</guid>
		<description><![CDATA[
Traduzindo:
- Eu tenho 32 configurações do Linux rodando virtualizadas. E também tenho um algoritmo genético realizando seleção e mutação para produzir&#8230;
- A distribuição Linux definitiva!!!
- &#60;pinguim de boné&#62; Já existe, se chama Ubuntu.
- Eu não acredito em criacionismo&#8230;
Fonte: zoitz
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=211&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://lauro.files.wordpress.com/2008/04/linuxolution.png"><img class="alignnone size-full wp-image-212" src="http://lauro.files.wordpress.com/2008/04/linuxolution.png" alt="Linux evolution comic" /></a></p>
<p>Traduzindo:</p>
<p>- Eu tenho 32 configurações do Linux rodando virtualizadas. E também tenho um algoritmo genético realizando seleção e mutação para produzir&#8230;</p>
<p>- A distribuição Linux definitiva!!!</p>
<p>- &lt;pinguim de boné&gt; Já existe, se chama Ubuntu.</p>
<p>- Eu não acredito em criacionismo&#8230;</p>
<p>Fonte: <a href="http://www.zoitz.com/archives/35">zoitz</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/211/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/211/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=211&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/04/19/a-distribuicao-linux-perfeita/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>

		<media:content url="http://lauro.files.wordpress.com/2008/04/linuxolution.png" medium="image">
			<media:title type="html">Linux evolution comic</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8216;Use&#8217; o Google no seu site (com Python!)</title>
		<link>http://lauro.wordpress.com/2008/04/08/use-o-google-no-seu-site/</link>
		<comments>http://lauro.wordpress.com/2008/04/08/use-o-google-no-seu-site/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 12:07:33 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=209</guid>
		<description><![CDATA[Pelo menos é o que dá a entender o conceito do AppEngine.
Você desenvolve usando Python (Vem com django instalado, apesar de algumas mudanças \o/ ), manda o código e lá é hospedado e servido pela infra estrutura do Google. O pacote gratuito dá direito a 500MB de espaço e cpu/tráfego para +- 5 milhões de [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=209&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Pelo menos é o que dá a entender o conceito do <a title="Google AppEngine" href="http://code.google.com/appengine/">AppEngine</a>.</p>
<p>Você desenvolve usando Python (Vem com django instalado, apesar de algumas mudanças \o/ ), manda o código e lá é hospedado e servido pela infra estrutura do Google. O pacote gratuito dá direito a 500MB de espaço e cpu/tráfego para +- 5 milhões de page views. Há suporte para acesso aos serviços de dados (Datastore/BigTable) e contas (Google Accounts).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/209/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/209/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/209/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/209/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/209/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=209&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/04/08/use-o-google-no-seu-site/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>
	</item>
		<item>
		<title>Virtualizando as janelas</title>
		<link>http://lauro.wordpress.com/2008/04/07/virtualizando-as-janelas/</link>
		<comments>http://lauro.wordpress.com/2008/04/07/virtualizando-as-janelas/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 00:59:36 +0000</pubDate>
		<dc:creator>lauro</dc:creator>
				<category><![CDATA[ufpe]]></category>
		<category><![CDATA[virtualização]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://lauro.wordpress.com/?p=208</guid>
		<description><![CDATA[O Centro de Informática da UFPE faz parte do MSDN Academic Alliance e como resultado temos acesso a alguns softwares da MS. Semana passada baixei a imagem do Windows XP e estava (ainda estou) com preguiça de fazer backup -&#62; instalar windows -&#62; instalar ubuntu -&#62; instalar programas, portanto parti p/ virtualização.
Como primeira opção, já [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=208&subd=lauro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>O <a title="Centro de Informática" href="http://www.cin.ufpe.br">Centro de Informática da UFPE</a> faz parte do MSDN Academic Alliance e como resultado temos acesso a alguns softwares da MS. Semana passada baixei a imagem do Windows XP e estava (ainda estou) com preguiça de fazer backup -&gt; instalar windows -&gt; instalar ubuntu -&gt; instalar programas, portanto parti p/ virtualização.</p>
<p>Como primeira opção, já que estava instalado, tentei o <a href="http://fabrice.bellard.free.fr/qemu/">QEMU</a>. Muito lento, mesmo com o kqemu instalado. Começava a copiar uns arquivos e parava. Quando estava com o controle do mouse e teclado (<em>grab</em>), o computador ficava completamente sem responder (Tinha que matar o processo via ssh).</p>
<p>Então a solução seguinte foi o <a href="http://www.vmware.com/products/player/">VMWare Player</a>, apesar da bronca de criar uma nova imagem p/ ele. No QEMU basta uma imagem simples de HD ou CD mas o VMWare tem um formato próprio com uns arquivos extras.</p>
<p>Para isso, usei um <a title="Pasta com os scripts" href="https://garage.maemo.org/svn/maemovmware/scripts/">script</a> de <a title="Marcelo Lira a.k.a. Setanta" href="http://setanta.wordpress.com">Marcelo &#8217;setanta&#8217; Lira</a>, que ele usa no INdT p/ criar o <a title="Maemo SDK VMWare" href="http://maemovmware.garage.maemo.org/">Maemo SDK VMWare Appliance</a>. Bastou modificar algumas variáveis dentro dele, como a imagem a ser usada (ele usa a do Xubuntu) e o caminho padrão com os dados.</p>
<p>Resultado: Nesse exato momento, rodando o XP redondo, mas claro que não como um desktop decidado mas para o que preciso é suficiente. Ah, e com suporte a parar/reiniciar a qualquer momento <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lauro.wordpress.com/208/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lauro.wordpress.com/208/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lauro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lauro.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lauro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lauro.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lauro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lauro.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lauro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lauro.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lauro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lauro.wordpress.com/208/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lauro.wordpress.com&blog=222769&post=208&subd=lauro&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://lauro.wordpress.com/2008/04/07/virtualizando-as-janelas/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8bc0d4247b2318bdcd51417e2383952a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lauro</media:title>
		</media:content>
	</item>
	</channel>
</rss>