<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
<title>Notes</title>
<link>http://www.simplicidade.org/notes/</link>

<description>Building simplicidade.org: notes, projects, and ocasional rants</description>
<dc:language>en-us</dc:language>
<dc:creator>melo@simplicidade.org</dc:creator>
<dc:date>2010-02-19T12:18:09+00:00</dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=3.2" />
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>

<feedburner:info uri="simplicidade/notes" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://www.simplicidade.org/notes/42.xml" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Fwww.simplicidade.org%2Fnotes%2F42.xml" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Fwww.simplicidade.org%2Fnotes%2F42.xml" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Fwww.simplicidade.org%2Fnotes%2F42.xml" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://www.simplicidade.org/notes/42.xml" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Fwww.simplicidade.org%2Fnotes%2F42.xml" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Fwww.simplicidade.org%2Fnotes%2F42.xml" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Fwww.simplicidade.org%2Fnotes%2F42.xml" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><item>
<title>Battery</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/WOstw12YrZ0/battery.html</link>

<description>I bought a new batery for my laptop in October 2008. A couple of days ago, I started getting abrupt shutdowns, even before the low-battery warning pops up. And it doesn't enter sleep mode. It just goes puf, and powers off. Searching around for similar reports, it seems that my battery is kaput. Either a cell is damaged, or the battery is starting to swell. I'm guessing its the first one, since I don't notice any swelling. This is the third battery I've burned through with this laptop. The first one lasted from May 2006 up-to sometime early 2008. The...</description>

<content:encoded><![CDATA[
<p>I bought a new batery for my laptop in October 2008. A couple of days ago, I started getting abrupt shutdowns, even before the low-battery warning pops up.</p>

<p>And it doesn't enter sleep mode. It just goes puf, and powers off.</p>

<p>Searching around for similar reports, it seems that my battery is kaput. Either a cell is damaged, or the battery is starting to swell. I'm guessing its the first one, since I don't notice any swelling.</p>

<p>This is the third battery I've burned through with this laptop. The first one lasted from May 2006 up-to sometime early 2008. The second one lasted a couple of months, then started to swell. And now this one, since Mon Oct 27 23:20:47 2008 until today.</p>

<p>Now you might wonder how can I know the exact date and time that I got the new battery. The answer is simple. Before I switched to the new battery, I wrote this script, <a href="http://github.com/melo/scripts/blob/master/bin/x-apple-log-battery-status"><code>x-apple-log-battery-status</code></a>, a quick and very dirty way of keeping track of all the stats about my battery.</p>

<p>I run it every 300 seconds. Given that the script logs the data to disk, it has to spin-up the disk and therefore influence the data collected, but I use my laptop intensely anyway. It rarely sleeps.</p>

<p>So I've recorded 53605 samples of my battery life. The first record is this:</p>

<pre><code>t:1225149647 # Mon Oct 27 23:20:47 2008
fully_charged: No
is_charging: Yes
external_connected: Yes
cycle_count: 1
time_remaining: 38
max_capacity: 6869
voltage: 12485
current_capacity: 6516
design_capacity: 6300
temperature: 3082
</code></pre>

<p>The last one so far:</p>

<pre><code>t:1266581334 # Fri Feb 19 12:08:54 2010
fully_charged: Yes
is_charging: No
external_connected: Yes
cycle_count: 561
time_remaining: 25013
max_capacity: 3367
voltage: 12459
current_capacity: 3335
design_capacity: 6300
temperature: 2944
</code></pre>

<p>As you can see, I've still have about 50% of the original capacity, but with 561 cycles.</p>

<p>The entire file is here: <a href="/share/battery_log.txt.gz"><code>battery_log.txt.gz</code></a>, 736Kb of gzipped data. You can do whatever you want with it, I only ask that if you do something interesting, send me a link.</p>

<p>Someday I'll dump this into a spreadsheet and do some pretty graphics.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=WOstw12YrZ0:Bg36LqSaFx8:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=WOstw12YrZ0:Bg36LqSaFx8:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=WOstw12YrZ0:Bg36LqSaFx8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=WOstw12YrZ0:Bg36LqSaFx8:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/WOstw12YrZ0" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1014@http://www.simplicidade.org/notes/</guid>
<dc:subject>Apple</dc:subject>
<dc:date>2010-02-19T12:18:09+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/02/battery.html</feedburner:origLink></item>
<item>
<title>Buzz off</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/qsJZxG95VG0/buzz_off.html</link>

<description>The lack of trust that Google as gained in the last year is impressive. Gone are the days that you could actually believe the "Don't be evil" corporate motto. The reality came crushing down, and Buzz is only one of the last proofs that "Don't be evil" is much different proposition than "Do good". I'm fortunate enough not to use a lot of Google services, but still the amount of information they have on me is scary. I knew some of it, and I was aware of the social graph efforts going on inside Google, in particular Brad Fitzpatrick work...</description>

<content:encoded><![CDATA[
<p>The lack of trust that Google as gained in the last year is impressive.</p>

<p>Gone are the days that you could actually believe the "Don't be evil" corporate motto. The reality came crushing down, and Buzz is only one of the last proofs that "Don't be evil" is much different proposition than "Do good".</p>

<p>I'm fortunate enough not to use a lot of Google services, but still the amount of information they have on me is scary. I knew some of it, and I was aware of the social graph efforts going on inside Google, in particular <a href="http://bradfitz.com/">Brad Fitzpatrick</a> work when he first joined <a href="http://www.google.com/">The New Borg</a>.</p>

<p>But the path they choose with Buzz, assuming that my address book or even my chat roster, has anything to do with my social network, is wrong on so many levels.</p>

<p>For the geeks at Google, it appears that one step in their quest to harness all of the human knowledge is to treat humans as a flat concept, without any levels in their social relations. I no longer have best friends, whom I trust almost everything about me but that rarely exchange electronic messages, but I keep in my address book, with some guy that asked me a couple of questions some months ago. All of them get put in the same basket. So the same level of trust and sharing privileges is attached to all of them <em>by default</em>.</p>

<p>What bothers me the most is that now, until I can find replacements for the services that I find useful at Google (address book and mail), I will have to create new empty random Google account, and use each one for parts of the data I have in there.</p>

<h3>The Future</h3>

<p>During my college days, I was specially interested on distributed systems. I intuitively believed that they were the only solution for resilient scalable network-oriented services. What I couldn't imagine was that just how much important they are for the little level of privacy that I expect from online services.</p>

<p>So one of my goals for 2010 is to split my online information across several online services. Also, study options to move them back to my control.</p>

<p>As for Google, I guess it is time to start working on active Google blocking tools. There is definitively a war coming.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=qsJZxG95VG0:z_504M-iKBI:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=qsJZxG95VG0:z_504M-iKBI:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=qsJZxG95VG0:z_504M-iKBI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=qsJZxG95VG0:z_504M-iKBI:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/qsJZxG95VG0" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1013@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2010-02-13T17:33:23+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/02/buzz_off.html</feedburner:origLink></item>
<item>
<title>Oh when the Saints...</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/-xkjqS_1dUs/oh_when_the_sai.html</link>

<description>... go marching in. Congrats to all the Saints fans, excellent second half, with a awesome starting play. Drew Brees MVP. Pity about not breaking the pass record. Tied with Brady at 32....</description>

<content:encoded><![CDATA[
<p>... go marching in.</p>

<p>Congrats to all the <a href="http://www.neworleanssaints.com/">Saints</a> fans, excellent second half, with a awesome starting play.</p>

<p><a href="http://www.neworleanssaints.com/Team/Roster/People/Drew%20Brees.aspx">Drew Brees</a> MVP. Pity about not breaking the pass record. Tied with Brady at 32.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-xkjqS_1dUs:aNWn9NCA768:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=-xkjqS_1dUs:aNWn9NCA768:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-xkjqS_1dUs:aNWn9NCA768:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-xkjqS_1dUs:aNWn9NCA768:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/-xkjqS_1dUs" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1012@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2010-02-08T03:02:25+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/02/oh_when_the_sai.html</feedburner:origLink></item>
<item>
<title>Creativity, hackers, and other stuff</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/lPgYqsbYR7w/creativity_hack.html</link>

<description>Below you'll find an article that I wrote to my local Mac users group. I haven't had the time to translate it into english, so unless you are willing to learn portuguese, you'll have to wait a bit. But for those that share my mother tongue, here it is. (para quem leu a versão na mailing-list, tem apenas pequenas alterações de estilo, e um "Resumindo:" lá pelo meio) A discussão que está a acontecer sobre o iPad, o efeito do modelo fechado e controlado pela Apple, e o que ele trás à criatividade e ao espirito hacker (no sentido cosquinhas,...</description>

<content:encoded><![CDATA[
<p>Below you'll find an article that I wrote to my local Mac users group. I haven't had the time to translate it into english, so unless you are willing to learn portuguese, you'll have to wait a bit.</p>

<p>But for those that share my mother tongue, here it is.</p>

<hr />

<p>(para quem leu a versão na mailing-list, tem apenas pequenas alterações de estilo, e um "Resumindo:" lá pelo meio)</p>

<p>A discussão que está a acontecer sobre o iPad, o efeito do modelo fechado e controlado pela Apple, e o que ele trás à criatividade e ao espirito hacker (no sentido cosquinhas, curioso, e não no sentido cracker) está mesmo muito interessante.</p>

<p>Acho que a questão da criatividade, que pelo que percebi começa com o <a href="http://www.tbray.org/ongoing/When/201x/2010/01/27/iPad">post do Tim Bray</a> que termina com a frase "For creative people, this device is nothing" é uma falsa questão.</p>

<p>Sinceramente, o bias natural do Tim Bray para a plataforma Android baralhou-lhe as ideias temporariamente. Basta apontar o trabalho do nosso Jorge Colombo com as capas da New Yorker como contra exemplo do seu argumento.</p>

<p>Mas mesmo que ele estivesse a dizer criativo como programador/developer, seria falso. Ninguém programa para o Android no próprio device. Estes devices não são computadores que possam existir no vácuo, são apêndices aos computadores que vamos ter em casa, ou no emprego.</p>

<p>O único contexto em que se pode ver o iPhone/iPad como limitadores de criatividade é nas politicas de aprovação da AppStore. Tudo o resto está disponível.</p>

<hr />

<p>A parte de discussão sobre hackers é muito mais perto do meu coração. Tanto quanto pude ver começa com esta frase do <a href="http://al3x.net/2010/01/28/ipad.html">Alex Payne</a>:</p>

<blockquote>
  <p>The thing that bothers me most about the iPad is this: if I had an iPad rather than a real computer as a kid, I’d never be a programmer today.</p>
</blockquote>

<p>Apenas é possível concordar com isso se se pensar que o iPad será o nosso único computador, e claramente que não foi desenhado para isso. <a href="http://diveintomark.org/archives/2010/01/29/tinkerers-sunset">Mark Pilgrim</a> parece concordar com esta visão negra do futuro dos hackers:</p>

<blockquote>
  <p>Once upon a time, Apple made the machines that made me who I am. I became who I am by tinkering. Now it seems they’re doing everything in their power to stop my kids from finding that sense of wonder. Apple has declared war on the tinkerers of the world.</p>
</blockquote>

<p>O meu percurso (assim como de outros nesta lista, estou seguro) é semelhante ao do Mark: primeiro computador aos 11, começar a programar aos 12, 13 em BASIC e depois Assembler; começar a montar os seus próprios PCs; usar Pascal, C; usar minix, linux porque nos dava o controlo da nossa máquina; o querer saber como funciona, desmanchar, abrir, mudar. No meu caso sempre fugi um pouco da parte electrónica da coisa, não me dou com electrónica, e mais focado na parte de software low-level.</p>

<p>Mas respondendo à pergunta: será que o iPad vai limitar a próxima geração de hackers? Eu podia dizer que não e explicar as minhas razões, mas acho que a <a href="http://smarterware.org/4941/hackers-dont-tinker-because-they-got-invited">Gina Trapani</a> tem uma resposta bem melhor que qq coisa que eu poderia escrever:</p>

<blockquote>
  <p>Because while we're all ranting about how closed the iPad will be, the jailbreak community is planning competitions to see who can crack it first. The sun isn't setting on tinkerers; their desire to crack things open intensifies when faced with something that's closed by design. The challenge is part of the appeal.</p>
  
  <p>...</p>
  
  <p>I'm of the mind that if someone wants to tinker, they will tinker, period. Because it's in their DNA, not because it's easy, and because by nature, tinkerers don't play by the rules.</p>
</blockquote>

<p>A parte que eu posso acrescentar à discussão é esta: em 1991, na Universidade do Minho, a vasta maioria dos alunos não tinha acesso à internet. Não tinham mail, ainda não havia Web nem browsers, começava a aparecer usenet. Nesse tempo, quem andava pelos centros de informática, ou estava lá o menor tempo possível para fazer os seus trabalhos e ir embora, ou então pertencia ao grupo de pessoas que queria perceber tudo, como é que aquilo funcionava, como usar (e abusar) do sistema. Era uma "guerra" contra os administradores de sistema, porque era divertido. O que se fazia era programar, aprender e trocar conhecimento. Não havia outro sitio onde o fazer.</p>

<p>Durante os anos em que o acesso começou a aparecer, 92 e 93, apenas esse grupo lhe prestou atenção. Era uma fonte de conhecimento inesgotável e finalmente disponível. Despertava o nosso sentido de saber mais. Se tivesse de dar um nome a este período, seria a nossa explosão cambriana.</p>

<p>Esse aceso não nos transformou em colectores passivos de informação. Apenas nos deu mais energia para as próximas experiências.</p>

<p>Mas a partir de 94, altura em que os browsers Web começaram a ficar acessíveis às massas, começaram a aparecer uma nova tribo. Passavam horas e horas nos centro de informática a consumir informação, mas sem produzir informação. Lembro-me de discutir isto com a minha tribo e alguém (sinceramente não me lembro do nome dele) dizer "mas isto é o que se espera de pessoas normais". Sem dúvida que o nosso "hubris" tecnológico já estava presente e separava-nos das "pessoas normais" :).</p>

<p>Resumindo: não é possível julgar um device ou um comportamento que esse device facilita da mesma forma pela tribo dos hackers e pelo resto das pessoas normais.</p>

<p>A verdade é que para muitas pessoas, o que é importante não é se o sistema é aberto, às cores, hack-able, ou não. O que interessa é que com ele consigam fazer as tarefas simples do dia-a-dia sem as preocupações que apenas devem (ou deviam) existir na cabeça dos profissionais de IT.</p>

<p>Relembrando o artigo da Gina: <em>...someone wants to tinker, they will tinker, period. Because it's in their DNA, not because it's easy...</em></p>

<p>Penso em pessoas como a minha mãe, ou a minha tia, que por mais brilhantes e cultas que sejam (e claramente o são mais do que eu) não se sentem à vontade em usar um desktop clássico (Windows XP, Vista, 7, e Mac OS X) sem se baralharem.</p>

<p>Uma parte do artigo do <a href="http://speirs.org/blog/2010/1/29/future-shock.html">Fraser Spiers</a>:</p>

<blockquote>
  <p>Secretly, I suspect, we technologists quite liked the idea that Normals would be dependent on us for our technological shamanism. Those incantations that only we can perform to heal their computers, those oracular proclamations that we make over the future and the blessings we bestow on purchasing choices.</p>
  
  <p>...</p>
  
  <p>Those of us who patiently, day after day, explain to a child or colleague that the reason there's no Print item in the File menu is because, although the Pages document is filling the screen, Finder is actually the frontmost application and it doesn't have any windows open, understand what's happening here.</p>
</blockquote>

<p>Ao olhar para os defeitos que a minha tribo atribui a esta nova plataforma, e seguindo um pouco a classificação dos mesmos que o artigo do <a href="http://www.lukew.com/ff/entry.asp?994">Luke Wroblewski</a> usa, podemos tentar vê-los do ponto de vista de uma "pessoa normal".</p>

<p>Quando se fala de multitasking, temos de clarificar exactamente o que queremos dizer com isso: correr várias aplicações ou partes delas ao mesmo tempo. De base, tanto o iPhone como o iPad, são um sistema multi-task, e apenas a limitação artificial da Apple em correr apenas uma aplicação ao mesmo tempo nos impede de o fazer.</p>

<p>Acho que é fácil de provar que a maioria das pessoas se baralha com multi-task. Basta pensar em todas as pessoas que já vimos a usar o Windows com todas as apps maximizadas, uma de cada vez. Ou de ver os problemas com o menu File > Print que o Fraser nos fala acima.</p>

<p>É claro que mudar rapidamente entre aplicações é importante, e essas mesmas pessoas o fazem, mas para tal não é necessário que a aplicação destino esteja a correr, desde que a ilusão criada pelo sistema operativo esteja bem feita.</p>

<p>Sem dúvida que várias features que a nossa tribo pensa em colocar nas suas aplicações passam por ter um processo em background a fazer qualquer coisa. Mas até as limitações actuais nas baterias estarem resolvidas, é possível argumentar que esses serviços devem ser feitos no nosso Mac/PC principal, e deixar a esse a tarefa de notificar o device que temos informação importante para ele, com a opção de enviar um link para a mesma informação que o device, transparentemente e sem a intervenção da app, obtem da rede para passar à app na próxima oportunidade.</p>

<p>Existem certas coisas que não são possíveis neste cenario, que normalmente envolvem informação que só o device pode ter (como o Bordalo nos diz, o Android dele adapta-se ao sitio onde está), mas até essas podem aparecer no futuro como um serviço do OS, disponível a todas as aplicações.</p>

<p>Quanto a não ter o plugin de Flash no Mobile Safari, <a href="http://www.simplicidade.org/notes/archives/2010/01/apple_vs_flash.html">já escrevi hoje sobre isso</a>; resumindo a minha visão da coisa, era importante ter a opção de correr Flash no iPad, mas dispenso claramente de o ter dentro do browser, até porque as utilizações mais práticas que tenho para ele, estão (ou estarão) disponíveis via HTML5.</p>

<p>Todo o processo de aprovação da AppStore, e as barreiras à distribuição de aplicações são aspectos claramente negativos, apesar de dar origem a alguns episódios cómicos dignos de Kafka. Neste aspecto, acho que um compromisso pode surgir em que todas as apps tem de ser assinadas pela Apple (existem vantagens claras nisso), mas a distribuição pode ser via Web.</p>

<p>Uma coisa pouco discutida, é o facto de os i{Pad,Phone}'s não mostrarem o filesystem aos utilizadores. Segundo parece, no iPad, os ficheiros da aplicação ficam guardados numa pasta dentro da aplicação (que pode ser exportada para o Mac/PC via file sharing), de forma a que quando se remove uma App, tudo o que está associado a essa App desapareça (é giro cruzar esta funcionalidade com a alteração do Mac OS X relativamente a deixar cair o suporte a creator codes).</p>

<p>Cada app fica com a responsabilidade de mostrar os seus documentos, e se acham que isso é anormal, é porque não tem prestado atenção ao que o iTunes e iPhoto andam a fazer à anos: a esconder o file system com uma visão do mesmo ajustada à tarefa, ou tipo de documentos, que estão a ser manipulados.</p>

<p>Será que isso escala para muitos documentos? Olhando para o iTunes e iPhoto parece que sim, mas é possível argumentar que só funciona nesses casos porque apenas consumimos os documentos, não os alteramos profundamente, como numa aplicação do iWork.</p>

<p>É sem dúvida uma questão de volume de documentos, e faz mais uma vez lembrar que o iPad não pode ser um computador autónomo, sem o Mac/Pc para o acompanhar.</p>

<p>Mas olhando para as limitações como decisões conscientes de design, é importante ter uma coisa em conta: a nível de hardware, o iPad não nos limita em termos de user-inteface porque todo o seu UI é gerado por software (excepção única à ausência de camara que para mim é ainda hoje um grande mistério). Logo tudo o que nós hoje vemos como limitação, pode ser alterado, ou removido no futuro. Veja-se o que aconteceu com copy-paste nos iPhone's.</p>

<hr />

<p>Como conclusão: para todos os efeitos, eu coloco-me claramente na tribo dos hackers. Ainda hoje continuo a abrir e fechar computadores como forma de hardware porn, principalmente máquinas antigas; ainda hoje continuo a continuar a ler e comprar livros para perceber como funcionam estes devices que nos intrigam; ainda hoje perco^Winvisto uma data de tempo todos os dias a estudar e a aprender com outros.</p>

<p>Por isso a minha posição sobre a politica da Apple não podia ser diferente daquela que a Gina Trapani tem:</p>

<blockquote>
  <p>First, know that I fundamentally agree with Alex and Mark: the closed nature of the iPad turns me off, and I wouldn't give one to my kid if I were encouraging her to learn about how computers work.</p>
  
  <p>...</p>
  
  <p>Even though I am critical of the iPad's closed nature and agree with Mark and Alex, I won't go as far as Alex did and say that it represents a dystopian future. I have more faith in our future tinkerers than that.</p>
</blockquote>

<p>Mas a verdade é que eu não quero ser apenas hacker, e existem ocasiões em que é muito agradável desligar essa parte da minha vida para me concentrar no que está à minha volta, e nessas alturas, ter um device que me trate abaixo das minhas capacidades para o dominar, é uma trégua simpática.</p>

<p>Acho que a tribo está ao rubro porque este gadjet não é para eles, e isso é algo a que não estamos habituados. </p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=lPgYqsbYR7w:gclo1NXSqIQ:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=lPgYqsbYR7w:gclo1NXSqIQ:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=lPgYqsbYR7w:gclo1NXSqIQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=lPgYqsbYR7w:gclo1NXSqIQ:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/lPgYqsbYR7w" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1011@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2010-01-31T12:15:08+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/01/creativity_hack.html</feedburner:origLink></item>
<item>
<title>Apple vs Flash</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/Fmlp445TQH8/apple_vs_flash.html</link>

<description>Update: Firefox also has multiple file upload since 3.6, fixed. As expected , the iPad will not support Flash, and this brought back all the discussion that went on when the iPhone appeared. I find it interesting that Gina Trapattani is seeing a reduction on Flash-enabled browsers (and thats not counting iPhones, just regular browsers) on her sites. Also Gruber (but he is counting iPhone's) and Alex Bayo. As a end-user I would not mind see Flash burn in hell. On a regular day, I used to have regular Safari crashes. Since I installed ClickToFlash, I don't see them anymore....</description>

<content:encoded><![CDATA[
<p><em>Update:</em> <a href="http://hacks.mozilla.org/2009/12/multiple-file-input-in-firefox-3-6/">Firefox also has multiple file upload since 3.6</a>, fixed.</p>

<p>As expected , the <a href="http://www.apple.com/ipad/">iPad</a> will not support Flash, and this brought back all the discussion that went on when the iPhone appeared. I find it interesting that <a href="http://smarterware.org/4978/flashs-decline-on-lifehacker-from-2006-to-2010">Gina Trapattani is seeing a reduction on Flash-enabled browsers</a> (and thats not counting iPhones, just regular browsers) on her sites. Also <a href="http://twitter.com/gruber/status/8417800859">Gruber</a> (but he is counting iPhone's) and <a href="http://twitter.com/waxpancake/status/8423814190">Alex Bayo</a>.</p>

<p>As a end-user I would not mind see Flash burn in hell. On a regular day, I used to have regular Safari crashes. Since I installed <a href="http://rentzsch.github.com/clicktoflash/">ClickToFlash</a>, I don't see them anymore. Maybe it is related, maybe not, but my suspicion is that the culprit is the Flash plugin.</p>

<p>But there are at least two features that I use several times per day that right now require Flash: multiple file upload, and clipboard access.</p>

<p>The first, multiple file upload, is solved by HTML5. Its in the spec, and implemented in <a href="http://webreflection.blogspot.com/2009/03/safari-4-multiple-upload-with-progress.html">Safari4</a> and <a href="http://hacks.mozilla.org/2009/12/multiple-file-input-in-firefox-3-6/">Firefox 3.6+</a>. I think that Chrome 2 already supports this too.</p>

<p>Regarding copy-to-clipboard, the situation is less clear. There is a <a href="http://dev.w3.org/html5/spec/Overview.html#copy-and-paste">section in the HTML5 spec about copy-and-paste</a>, but it is inside the drag and drop chapter, and I don't know how it can be used today, if at all.</p>

<p>So the two last remaining useful (as in work-related useful) uses of Flash will soon have HTML5-based replacements, and that means that I will not miss Flash at all.</p>

<p>But that is not to say that Apple is right about this. As the person who bought (or will buy) one of this Apple devices that lack Flash support, it should be my decision to enable or not a technology that for better or for worst is still widely used. I do not want a Flash plugin, but I would not mind a Flash runner app. A dedicated browser, totally written and supported by Adobe, and available for free on the App store. With that, I would have a choice to click the blue legos and see the the Web as Adobe think it should be. (<em>shudders</em>)</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Fmlp445TQH8:tn3XwUmqDEw:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=Fmlp445TQH8:tn3XwUmqDEw:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Fmlp445TQH8:tn3XwUmqDEw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Fmlp445TQH8:tn3XwUmqDEw:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/Fmlp445TQH8" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1010@http://www.simplicidade.org/notes/</guid>
<dc:subject>Apple</dc:subject>
<dc:date>2010-01-31T09:22:35+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/01/apple_vs_flash.html</feedburner:origLink></item>
<item>
<title>Clarifications about AnyEvent::Mojo</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/p644LxsKTms/clarifications.html</link>

<description>It seems that I need to clarify some stuff, based on Sebastian comments in my last post and via Twitter. I really hope this is the last time I have to talk about it. I rather spend my time coding. First, you can look at the code of AnyEvent::Mojo::Server::Connection: no private Mojo APIs are being used. They might have been with early releases, but as Sebastian says, I did work with him to improve Mojo so that I didn't have to depend on private APIs. That would be wrong. In fact, given that I was able to write a AnyEvent-based...</description>

<content:encoded><![CDATA[
<p>It seems that I need to clarify some stuff, based on Sebastian comments in <a href="http://www.simplicidade.org/notes/archives/2010/01/anyeventmojo_up_1.html">my last post</a> and via Twitter. I really hope this is the last time I have to talk about it. I rather spend my time coding.</p>

<p>First, you can look at the code of <a href="http://github.com/melo/anyevent--mojo/blob/master/AnyEvent-Mojo/lib/AnyEvent/Mojo/Server/Connection.pm"><code>AnyEvent::Mojo::Server::Connection</code></a>: no private <code>Mojo</code> APIs are being used.</p>

<p>They might have been with early releases, but as Sebastian says, I did work with him to improve <code>Mojo</code> so that I didn't have to depend on private APIs. That would be wrong.</p>

<p>In fact, given that I was able to write a <code>AnyEvent</code>-based <code>Mojo</code> server proves that the code was properly structured.</p>

<p>Second, I have no problems with changing state machines. I like state machines and expect them to change. I was eager to see Sebastian add a "pause" state, that would greatly simplify my own work regarding long-pooling. And the first break included changes in the state machine that I fixed on my side.</p>

<p>But the second break was caused not by the introduction of new states, but the abstraction of some code into the new <code>Mojo::IOLoop</code>. After the notification of no changes until 1.0.</p>

<p>Now, I totally accept that Sebastian needs to evolve his code base to support the new stuff he wants to support, like WebSockets. But it was nonetheless new code, and a re-factoring of all the Server interface.</p>

<p>I was pissed at having my code broken in that way after the "no changes" declaration, but only for a couple of days, <strong>but</strong>, and significantly more importantly, that has nothing to do with my deprecation of <code>AnyEvent::Mojo</code>.</p>

<p>I'm deprecating my module because there is a better way to do it now. I no longer need to keep this module up-to-date, I just have to work with the larger community of the PSGI/Plack, the Perl Web Server. It just makes sense to drop one-off module and switch to a system that is being reused by so many projects.</p>

<p>In a nutshell, I'm deprecating <code>AnyEvent::Mojo</code> because you have better solutions now. Solutions that I will move to and recommend to others. Solutions based on the <code>PSGI</code>/<code>Plack</code> stack, the <a href="http://plackperl.org/">Perl Web Server</a>.</p>

<p>I am glad to see a clarification about the deprecation policy in the <a href="http://github.com/kraih/mojo/commit/3c1d3f78a240b67c01a4511d018862b4c217efa8">Changes</a> and the http://github.com/kraih/mojo/commit/89fc6baf390d0065ad319abc540dc6a47e0bc812 for the Mojo project, I think it is a big step in the right direction; it can only give assurance to potential users of Mojolicious, and help the project.</p>

<p>I did learn a lot about HTTP that I hadn't pay attention before, the tiny details in the protocol. I do like <code>Mojolicious</code> MVC stuff, I just think that the <code>Plack</code> HTTP stack is better than the <code>Mojo</code> HTTP stack.</p>

<p>And I might get the cake and eat it too. I'll wait for <code>Mojo</code> 1.0 but it should be possible to use <code>Mojolicious</code>, the best part of the project, with <code>Plack</code>.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=p644LxsKTms:bV-1lc8nvgM:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=p644LxsKTms:bV-1lc8nvgM:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=p644LxsKTms:bV-1lc8nvgM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=p644LxsKTms:bV-1lc8nvgM:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/p644LxsKTms" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1009@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2010-01-29T11:54:30+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/01/clarifications.html</feedburner:origLink></item>
<item>
<title>Anyevent::Mojo update</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/sdeVWdbtwdk/anyeventmojo_up_1.html</link>

<description>The current version of AnyEvent::Mojo is failing some tests. The Mojo API that I was using changed yet again and I don't have the tuits to fix it right now. I'll explain how we got here, what are the next steps, and finally I'll comment on lessons learned. A long, long time ago... When I wrote AE::M, I was looking for a way to do long-polling in Perl, with decent performance and cool stuff like epoll/kqueue support. At the time, the only solution might have been POE, but I have other problems with that module, so I decided I wanted...</description>

<content:encoded><![CDATA[
<p>The current version of <a href="http://search.cpan.org/dist/AnyEvent-Mojo/"><code>AnyEvent::Mojo</code></a> is <a href="http://www.cpantesters.org/distro/A/AnyEvent-Mojo.html?grade=3&amp;perlmat=2&amp;patches=2&amp;oncpan=1&amp;distmat=2&amp;perlver=ALL&amp;osname=ALL&amp;version=0.8003">failing some tests</a>. The <a href="http://search.cpan.org/dist/Mojo/"><code>Mojo</code></a> API that I was using changed yet again and I don't have the <a href="http://www.perlfoundation.org/perl5/index.cgi?tuit">tuits</a> to fix it right now. I'll explain how we got here, what are the next steps, and finally I'll comment on lessons learned.</p>

<h3>A long, long time ago...</h3>

<p>When I wrote AE::M, I was looking for a way to do long-polling in Perl, with decent performance and cool stuff like epoll/kqueue support. At the time, the only solution might have been <a href="http://search.cpan.org/dist/POE/"><code>POE</code></a>, but I have other problems with that module, so I decided I wanted a <a href="http://search.cpan.org/dist/AnyEvent/"><code>AnyEvent</code></a>-based solution.</p>

<p>I went looking for a HTTP-stack that I could extend and found <a href="http://mojolicious.org/">Mojo</a>. The code was working and ready in a afternoon, and I was happy.</p>

<p>But then we had the <a href="http://labs.kraih.com/blog/2009/08/version-numbers-and-backwards-compatibility.html">famous</a> <a href="http://github.com/kraih/mojo/blob/33eb290df3825510eb7b88cb9eef581d9a7fec59/Changes">0.991250 release</a>. A lot of backwards incompatible changes, and AE::M broke. I was caught at a bad time and could not update my own module for some weeks. In the Changes file, Sebastian explained why he broke backwards compatibility and that it would be the last time before 1.0; so I finally found the time and updated my code.</p>

<p>CPAN Testers was giving me green lights once more, and I was happy.</p>

<p>Until 2 months later that is, when we got the new <a href="http://search.cpan.org/dist/Mojo/lib/Mojo/IOLoop.pm"><code>Mojo::IOLoop</code></a> code. AE::M broke again, and its broken since then. The place where I was using AE::M needed some fixes, and the work to adjust my code to the new <code>Mojo</code> is not as simple as it was the first time around.</p>

<p>So I took the dirty way out: included the last pre-<code>Mojo::IOLoop</code> code with my project, implemented the new features, and shipped. Not pretty. At all.</p>

<p>Meanwhile, in a distant planet, <a href="http://bulknews.typepad.com/">miyagawa</a> was busy changing the Perl landscape with regards to HTTP integration. He wrote the <a href="http://search.cpan.org/dist/PSGI/"><code>PSGI</code></a> spec, and the <a href="http://search.cpan.org/dist/Plack/"><code>Plack</code></a> toolkit. It is a <a href="http://bulknews.typepad.com/blog/2009/12/plackpsgi-ecosystem.html">wonderful piece of work</a>, and the <a href="http://plackperl.org/">Perl Web Server</a> of choice.</p>

<p>And <a href="http://bulknews.typepad.com/blog/2009/10/psgiplack-streaming-is-now-complete.html">after some API work</a>, with the help of <a href="http://nothingmuch.woobling.org/">nothingmuch</a>, it <a href="http://blog.woobling.org/2009/10/event-driven-psgi.html">included a very decent support for asynchronous HTTP servers</a>, including all the bits to make long-pooling work right.</p>

<p>Then in December, we got <a href="http://github.com/kraih/mojo/blob/master/lib/Mojo/Server/PSGI.pm"><code>Mojo::Server::PSGI</code></a>, native support for <code>PSGI</code> 
inside <code>Mojo</code>.</p>

<h3>Next steps</h3>

<p>Right now, I'm waiting for the next release of Mojo, and then I'll immediately release a new version of AnyEvent::Mojo, deprecating it.</p>

<p>With the native support for <code>PSGI</code>, there is no reason to maintain the AE::M interface, just use the <a href="http://search.cpan.org/dist/Plack-Server-AnyEvent/"><code>Plack::Server::AnyEvent</code></a> (or <code>AnyEvent::HTTPD::PSGI</code> when <a href="http://bulknews.typepad.com/blog/2010/01/is-plack-middleware-is-it-library-or-is-it-a-server.html">miyagawa finishes the cleanup he talked about</a>).</p>

<p>But I will update the AE::M one last time to make it compatible with <code>Mojo::IOLoop</code>, as soon as I have the time. I don't want to leave it broken.</p>

<p>In the meantime, if you are using AE::M, I suggest that you bundle an earlier version of <code>Mojo</code>. I'll run a <code>git-bisect</code> to figure out which version is best and update this post.</p>

<h3>Lessons learned</h3>

<p>Not sure. On one hand, it is a version below 1.0 so we can expect some breakage.</p>

<p>On the other hand, the Changes file mentions that no more backwards incompatible changes would be made to <code>Mojo</code> before 1.0.</p>

<p>I still like the <code>Mojolicious</code> MVC framework and the dispatcher behind it, but I fear the <code>Mojo</code> stack and deprecation policy of the project now.</p>

<p>For now, all my async work is moving to <code>Plack</code>. I still need a asynchronous MVC framework, but I can wait a bit, or even write a very simple one if need be. Maybe steal code that I like from the others.</p>

<p>But I'm back to <a href="http://www.catalystframework.org/"><code>Catalyst</code></a> (and I plan to talk about my feelings about the attribute-based dispatcher soon) because I feel safer. A lot safer. I know that there are other people out there that depend on <code>Catalyst</code> every day and in with big sites, much bigger than mine. And I trust the Cat developers not to break my code.</p>

<p>I do hope to see <code>Mojo</code> 1.0 soon, and I hope it goes well for all the gang at <code>#mojo</code>, but I will also look for some form of backwards compatibility policy before I even mention <code>Mojo</code> ever again in my presentations about Perl.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=sdeVWdbtwdk:vsuk6ayM8t4:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=sdeVWdbtwdk:vsuk6ayM8t4:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=sdeVWdbtwdk:vsuk6ayM8t4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=sdeVWdbtwdk:vsuk6ayM8t4:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/sdeVWdbtwdk" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1008@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2010-01-29T02:49:42+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/01/anyeventmojo_up_1.html</feedburner:origLink></item>
<item>
<title>iPad</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/Xg9CC4NY2jI/ipad.html</link>

<description>My take: what Rui said. My analysis: I like the price, the battery life and the screen size. I would like to have a webcam for Skype, but that wasn't meant to be. Maybe next time. I'll buy one, probably the 32G WiFi-only. It will replace my 17" Macbook for the non-work-related tasks that it does now. I keep my iTunes, iPhoto, and other media stuff on my desktop Mac at work, and I travel around with the Macbook. Its a pain to keep these media libraries synchronized with the laptop, but its painless to do it with the iPad....</description>

<content:encoded><![CDATA[
<p>My take: what <a href="http://the.taoofmac.com/space/blog/2010/01/28/2331#five-years-later--people-go-crazy-about-the-one-apple-product-that-i-wanted-all-along">Rui</a> said.</p>

<p>My analysis: I like the price, the battery life and the screen size. I would like to have a webcam for <a href="http://www.skype.com/">Skype</a>, but that wasn't meant to be. Maybe next time.</p>

<p>I'll buy one, probably the 32G WiFi-only. It will replace my 17" Macbook for the non-work-related tasks that it does now.</p>

<p>I keep my iTunes, iPhoto, and other media stuff on my desktop Mac at work, and I travel around with the Macbook. Its a pain to keep these media libraries synchronized with the laptop, but its painless to do it with the iPad.</p>

<p>For most of my travel, I should be able to just leave the Macbook at home now.</p>

<p>For work related tasks, if I can get a Remote Desktop client on it, I should be able to connect back to the desktop at the office, via my IPSec VPN, and solve small problems.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Xg9CC4NY2jI:TJOKhnxMObo:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=Xg9CC4NY2jI:TJOKhnxMObo:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Xg9CC4NY2jI:TJOKhnxMObo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Xg9CC4NY2jI:TJOKhnxMObo:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/Xg9CC4NY2jI" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1007@http://www.simplicidade.org/notes/</guid>
<dc:subject>Apple</dc:subject>
<dc:date>2010-01-29T02:26:30+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/01/ipad.html</feedburner:origLink></item>
<item>
<title>Real-time web</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/piWS1h3j4fo/realtime_web.html</link>

<description>There is a lot of stuff being written these days about real-time web. Some think that it is the next step, the next big thing. I find the concept interesting only from a technical point-of-view. All the details about a good real-time web is what passes for tech-porn around here. But from a human point-of-view, the concept is flawed. Or at least, my own brain finds the concept flawed. I can't keep up with a constant barage of updates. For quite sometime, I don't have a Twitter client (I only get status updates that contain a link via RSS), I...</description>

<content:encoded><![CDATA[
<p>There is a lot of stuff being written these days about real-time web. Some think that it is the next step, the next big thing.</p>

<p>I find the concept interesting only from a technical point-of-view. All the details about a good real-time web is what passes for tech-porn around here.</p>

<p>But from a human point-of-view, the concept is flawed. Or at least, my own brain finds the concept flawed.</p>

<p>I can't keep up with a constant barage of updates. For quite sometime, I don't have a Twitter client (I only get status updates that contain a link via RSS), I stopped using FriendFeed, and I've disabled or pushed to 8+ hours all of my checks for new mail or new articles on my feed reader. The only exception to the no-real-time updates I have is my instant messenger, and a lonely IRC client on the last virtual desktop of my system.</p>

<p>Not that it isn't helpful sometimes, its just not a good way to consume knowledge and information.</p>

<p>There are two very different concepts here: up-to-date information and real-time awareness.</p>

<p>I want the real-time web to succeed because it creates the necessary infrastructure to have up-to-date information in real-time, but I don't want to have the awareness of those updates shoved at me.</p>

<p>In an ideal future, you would have an application that sits on your mobile device, your smartphone or your tablet, that helps me manage the real-time stream. Some of my friends, <a href="http://nunonunes.org/">Nuno</a> and <a href="http://mat.su/">Pedro</a>, call this application <a href="http://en.wikipedia.org/wiki/Exocortex">Exocortex</a>.</p>

<p>Your Exocortex would subscribe to all your news feeds, your email, your Twitter/Facebook/Whatever stream. With the real-time web infrastructure in place, it would be constantly being updated with the latest information. He does not interrupt your concentration, he doesn't require your awarness; he just collects, organizes (preferably by learning what you like, and what is important to you), and indexes all. It fetches pages mentioned in the articles that you get and caches them (I find that I often click on the links but rarely follow to the second level).</p>

<p>Most of this happens locally on the device. It is a ecological crime not to use your local CPU. The cloud should not be CPU and storage outsourcer, but a meeting point and backup destination. Not the main point of consumption, but the backup destination. And yes, some business models would stop working.</p>

<p>Then, when you take your device, you get an interface into the latest trends, articles, web pages mentioned, all from the inside of your little information world, powered by your personal social network.</p>

<p>You can be offline and still see the latest information up to the moment you disconnected. Everything is cached locally, and if something is missing, you can pin it for later retrieval. I like to call this "close the laptop and go"-scenario. No need to sync the latest version.</p>

<p>So I welcome the real-time web, not because I want to be bothered every time someone farts on Twitter, but because I just want to take my iPad and go.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=piWS1h3j4fo:4g59X7-hjds:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=piWS1h3j4fo:4g59X7-hjds:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=piWS1h3j4fo:4g59X7-hjds:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=piWS1h3j4fo:4g59X7-hjds:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/piWS1h3j4fo" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1006@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2010-01-29T00:43:26+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2010/01/realtime_web.html</feedburner:origLink></item>
<item>
<title>Muito obrigado</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/yl09fN4xP48/muito_obrigado.html</link>

<description>I'm not American so officially I don't get a Thanksgiving holiday. Still, we are reaching the end of 2009 and looking back I think we do have a lot of things to be grateful for. Giving thanks, like Christmas, doesn't need a special day, and for us perl hackers our favorite team, the perl-porters, giving thanks couldn't be easier. So lets all, no matter where you are, run the perlthanks command line today, and celebrate our new schedule for Perl5 releases and happy days and long lives to our pumpkins. On a more individual note, I can't forget three little...</description>

<content:encoded><![CDATA[
<p>I'm not American so officially I don't get a Thanksgiving holiday. Still, we are reaching the end of 2009 and looking back I think we do have a lot of things to be grateful for.</p>

<p>Giving thanks, like Christmas, doesn't need a special day, and for us perl hackers our favorite team, the perl-porters, giving thanks couldn't be easier.</p>

<p>So lets all, no matter where you are, run the <code>perlthanks</code> command line today, and celebrate our new schedule for Perl5 releases and happy days and long lives to our pumpkins.</p>

<p>On a more individual note, I can't forget three little big persons: cog, ambs and Magda. YAPC::EU raised the bar on so many levels.</p>

<p>But we don't live without CPAN, and so we acknowledge the PAUSE and CPAN teams, and all individuals that keep the mirror network up and running.</p>

<p>Finally, to those teams that make my day-to-day simpler and fun: the Moose cabal and the Plack gang (with a note of envy for miyagawa productivity...).</p>

<p>To all, a very big Muito Obrigado.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=yl09fN4xP48:Dz9h4UPuK3E:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=yl09fN4xP48:Dz9h4UPuK3E:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=yl09fN4xP48:Dz9h4UPuK3E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=yl09fN4xP48:Dz9h4UPuK3E:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/yl09fN4xP48" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1005@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-11-27T07:40:43+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/11/muito_obrigado.html</feedburner:origLink></item>
<item>
<title>Feed generator</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/3eQiRosni9o/feed_generator.html</link>

<description>I was mostly away from Perl this last days, and I'm eager to get back to it next week. The small work I did was to start a script that converts a directory of files into a RSS or Atom feed. For now it sits at the app-files2feed repository. I need to fix the last bugs with enclosure support and add documentation before releasing it to CPAN. Non-perl work sucks....</description>

<content:encoded><![CDATA[
<p>I was mostly away from Perl this last days, and I'm eager to get back to it next week.</p>

<p>The small work I did was to start a script that converts a directory of files into a RSS or Atom feed.</p>

<p>For now it sits at the <a href="http://github.com/melo/app-files2feed">app-files2feed repository</a>. I need to fix the last bugs with enclosure support and add documentation before releasing it to CPAN.</p>

<p>Non-perl work sucks.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=3eQiRosni9o:AmYx9qry5UE:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=3eQiRosni9o:AmYx9qry5UE:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=3eQiRosni9o:AmYx9qry5UE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=3eQiRosni9o:AmYx9qry5UE:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/3eQiRosni9o" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1004@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-11-19T08:40:00+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/11/feed_generator.html</feedburner:origLink></item>
<item>
<title>More Browser::Open</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/2sLO-65cy2M/more_browserope.html</link>

<description><![CDATA[I pushed to CPAN a new release of Browser::Open. I've added more commands to test (courtesy of code "borrowed" from SD, and the Launchy gem), and made the test suite more robust in case we don't find a suitable command. &lt;rant&gt; I'm amazed that something as simple as opening a URL is such a complicated task on most UNIX-based systems. I have a single command to use on Mac OS X and on Windows based systems, but there seems to be no standard way of doing this simplest of things on UNIX systems. &lt;/rant&gt;...]]></description>

<content:encoded><![CDATA[
<p>I pushed to <a href="http://search.cpan.org/">CPAN</a> a new release of <a href="http://search.cpan.org/dist/Browser-Open/">Browser::Open</a>.</p>

<p>I've added more commands to test (courtesy of code "borrowed" from <a href="http://syncwith.us/sd/">SD</a>, and the <a href="http://copiousfreetime.rubyforge.org/launchy/">Launchy gem</a>), and made the test suite more robust in case we don't find a suitable command.</p>

<p>&lt;rant&gt; <br />
I'm amazed that something as simple as opening a URL is such a complicated task on most UNIX-based systems.</p>

<p>I have a single command to use on Mac OS X and on Windows based systems, but there seems to be no standard way of doing this simplest of things on UNIX systems. <br />
&lt;/rant&gt;</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=2sLO-65cy2M:SQltvJZB824:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=2sLO-65cy2M:SQltvJZB824:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=2sLO-65cy2M:SQltvJZB824:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=2sLO-65cy2M:SQltvJZB824:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/2sLO-65cy2M" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1003@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-11-10T00:37:14+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/11/more_browserope.html</feedburner:origLink></item>
<item>
<title>Syntax highlighter</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/2cuMXWZ18aU/syntax_highligh.html</link>

<description>I've activated a Javascript-based syntax highlighter. You can see the results on my latest post, Perl testing and git pre-commit hooks. I need to tweak my server setup to be a little bit faster loading all this javascript, so you might notice a delay before the highlighter does its job....</description>

<content:encoded><![CDATA[
<p>I've activated a <a href="http://code.google.com/p/syntaxhighlighter/">Javascript-based syntax highlighter</a>. You can see the results on my latest post, <a href="http://www.simplicidade.org/notes/archives/2009/11/perl_testing_an.html">Perl testing and git pre-commit hooks</a>.</p>

<p>I need to tweak my server setup to be a little bit faster loading all this javascript, so you might notice a delay before the highlighter does its job.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=2cuMXWZ18aU:46EnVBZ8QwQ:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=2cuMXWZ18aU:46EnVBZ8QwQ:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=2cuMXWZ18aU:46EnVBZ8QwQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=2cuMXWZ18aU:46EnVBZ8QwQ:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/2cuMXWZ18aU" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1002@http://www.simplicidade.org/notes/</guid>
<dc:subject>Meta</dc:subject>
<dc:date>2009-11-01T11:07:38+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/11/syntax_highligh.html</feedburner:origLink></item>
<item>
<title>Perl testing and git pre-commit hooks</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/rGMPXbw819c/perl_testing_an.html</link>

<description>An article on Colin's blog mentioned a technique that I also use, using your test suite as a git pre-commit hook. I'll expand on some of his ideas, showing my own setup. Before each commit you should run the full test-suite of your code. If your test-suite has grown so much that it takes a long time to run, it makes more sense to run a smaller part of it, and let the continuous integration system (you do have one, right?) report back any problems with your tree later. At the very least you should make sure that all your...</description>

<content:encoded><![CDATA[
<p><a href="http://www.perldreamer.com/blog/webgui-testing-skipping-the-skip-block">An article</a> on <a href="http://www.perldreamer.com/blog">Colin's blog</a> mentioned a technique that I also use, using your test suite as a <a href="http://git-scm.com/">git</a> <a href="http://book.git-scm.com/5_git_hooks.html">pre-commit hook</a>. I'll expand on some of his ideas, showing my own setup.</p>

<p>Before each commit you should run the full test-suite of your code. If your test-suite has grown so much that it takes a long time to run, it makes more sense to run a smaller part of it, and let the continuous integration system (you do have one, right?) report back any problems with your tree later.</p>

<p>At the very least you should make sure that all your modules compile correctly. And that means checking the <code>00-compile.t</code> test file.</p>

<p>To make the whole process automatic, I use the following <code>pre-commit-hook</code>:</p>

<pre class="brush: bash;">
#!/bin/sh

## Set any ENV vars that your test suite requires here

exec prove -l -Q t/00*
</pre>

<p>I usually write a script called <code>my-git-pre-commit-hook</code> and <code>exec</code> that one from the <code>.git/hook/pre-commit</code> file, this way I can run it by hand if I need to.</p>

<p>I also assume that all tests named <code>00-*</code> are important enough to run before each commit, which lets me add more specific tests at any point.</p>

<p>This solves half of the problem. I also don't want to keep editing the <code>00-compile.t</code> file each time I add another module to my project. So I wrote it like this:</p>

<pre class="brush: perl;">
#!perl

use strict;
use warnings;
use Test::More;
use Path::Class;
use File::Find;

my $lib = dir('lib')->absolute->resolve;
find({
  bydepth => 1,
  no_chdir => 1,
  wanted => sub {
    my $m = $_;
    return unless $m =~ s/[.]pm$//;

    $m =~ s{^.*/lib/}{};
    $m =~ s{/}{::}g;
    use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
  },
}, $lib);

done_testing();
</pre>

<p>This code uses <a href="http://search.cpan.org/dist/perl/lib/File/Find.pm"><code>File::Find</code></a> to list all the <code>.pm</code> files in your <code>lib/</code> directory, and then tries to use them. It also use submodules before using the main module, courtesy of the <code>bydepth</code> switch.</p>

<p>If a problem is found, it immediately bail out of the entire test suite, mentioning the file that has problems. On previous versions it would test all modules and only bail out at the end if any had problems. I found that version less productive because the same problem would be reported multiple times.</p>

<p>This works out fine for my projects. It adds at most a couple of seconds to each commit (in the current project it adds less than 4 seconds) but I find that acceptable.</p>

<p>It would be interesting to write a <code>00-test-commited-files.pl</code> file that would look at the files being updated by the commit and run the tests that cover them. This could be done with the help from <a href="http://search.cpan.org/dist/Devel-CoverX-Covered/"><code>Devel::CoverX::Covered</code></a> but I haven't done it yet.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=rGMPXbw819c:4hZpWRKaXro:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=rGMPXbw819c:4hZpWRKaXro:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=rGMPXbw819c:4hZpWRKaXro:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=rGMPXbw819c:4hZpWRKaXro:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/rGMPXbw819c" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1001@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-11-01T09:28:35+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/11/perl_testing_an.html</feedburner:origLink></item>
<item>
<title>A faster configuration for CPAN::Reporter</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/9Ph97RFCPKg/a_faster_config.html</link>

<description>The idea of CPAN::Reporter is great: take advantage of all those daily uses of the cpan shell to collect reports from a large network of users. I tried several times to enable CPAN::Reporter but I always found that it delayed just enough of my workflow that I found it a nuisance. After each test phase, it would start a SMTP connection and send the report. Those 3 or 4 seconds where a bit too much for me. After a bit of reading I found a good compromise to report my test runs without affecting the performance. The setup is simple:...</description>

<content:encoded><![CDATA[
<p>The idea of <a href="http://search.cpan.org/dist/CPAN-Reporter/"><code>CPAN::Reporter</code></a> is great: take advantage of all those daily uses of the <code>cpan</code> shell to collect reports from a large network of users.</p>

<p>I tried several times to enable <code>CPAN::Reporter</code> but I always found that it delayed just enough of my workflow that I found it a nuisance. After each test phase, it would start a SMTP connection and send the report. Those 3 or 4 seconds where a bit too much for me.</p>

<p>After a bit of reading I found a good compromise to report my test runs without affecting the performance. The setup is simple: make <code>CPAN::Reporter</code> write the test results to a directory and create a command to send them later.</p>

<p>To set this up, first you <a href="http://wiki.cpantesters.org/wiki/CPANInstall">install CPAN::Reporter as usual</a> and then you tweak the configuration to store the reports in a directory. My <code>~/.cpanreporter/config.ini</code> looks like this:</p>

<pre class="brush: plain;">
email_from = "Pedro Melo" <melo@simplicidade.org>
edit_report = no
send_report=unknown:yes fail:yes pass:yes na:no

transport=File /Users/melo/.cpan/reports
</pre>

<p>The trick is to use the <code>File</code> transport. You configure it with the directory where the test reports will be stored. In my case I choose <code>/Users/melo/.cpan/reports</code>. You need to make sure that directory exists.</p>

<p>From now on, every time you use the <code>cpan</code> shell to install a module, the test reports will be stored in you test report directory.</p>

<p>The final step is sending them. I wrote a simple script to take care of that, that you can find on <a href="http://github.com/melo/scripts">my scripts repository</a>: <a href="http://github.com/melo/scripts/blob/master/bin/x-perl-send-test-reports"><code>x-perl-send-test-reports</code></a> (<a href="http://github.com/melo/scripts/raw/master/bin/x-perl-send-test-reports">download</a>).</p>

<p>How and when you run it is up to you. You can run it manually from time to time, or from a cron, or use something like folder actions to monitor the directory and start the script whenever a new file is placed there. I run it manually for now.</p>

<p>My command line to use the script is this:</p>

<pre class="brush: bash;">
x-perl-send-test-reports         \
    --from melo@simplicidade.org \
    --server smtp.gmail.com      \
    --transport 'Net::SMTP::TLS
         User melo@simplicidade.org
         Password my_password
         Port 587'               \
    ~/.cpan/reports
</pre>

<p>So one less excuse not to report your test results. If you are not using CPAN::Reporter, start now.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=9Ph97RFCPKg:Vp8HBZG0PmA:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=9Ph97RFCPKg:Vp8HBZG0PmA:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=9Ph97RFCPKg:Vp8HBZG0PmA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=9Ph97RFCPKg:Vp8HBZG0PmA:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/9Ph97RFCPKg" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">1000@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-10-24T11:08:28+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/a_faster_config.html</feedburner:origLink></item>
<item>
<title>An update on PGP WDE</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/I3Ad9xLUt9E/an_update_on_pg.html</link>

<description>Since May I've been using PGP Whole Disk Encryption on my laptop and his Time-Machine external drive. Almost 6 months later I can report that it works great, you don't notice it at all. Strongly recommended, if you need this sort of thing. But there are no completely secure software-only solutions, and its good to know the limitations, like the "Evil Maid" Attacks on Encrypted Hard Drives. The comments on the article are also worth a read. There are some proposals in there that might work and defend against this kind of attacks....</description>

<content:encoded><![CDATA[
<p><a href="http://www.simplicidade.org/notes/archives/2009/05/security.html">Since May I've been using PGP Whole Disk Encryption on my laptop</a> and <a href="http://www.simplicidade.org/notes/archives/2009/05/pgp_wde_update.html">his Time-Machine external drive</a>.</p>

<p>Almost 6 months later I can report that it works great, you don't notice it at all. Strongly recommended, if you need this sort of thing.</p>

<p>But there are no completely secure software-only solutions, and its good to know the limitations, like the <a href="http://www.schneier.com/blog/archives/2009/10/evil_maid_attac.html">"Evil Maid" Attacks on Encrypted Hard Drives</a>.</p>

<p>The comments on the article are also worth a read. There are some proposals in there that might work and defend against this kind of attacks.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=I3Ad9xLUt9E:IyF7CnI1cKE:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=I3Ad9xLUt9E:IyF7CnI1cKE:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=I3Ad9xLUt9E:IyF7CnI1cKE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=I3Ad9xLUt9E:IyF7CnI1cKE:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/I3Ad9xLUt9E" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">999@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2009-10-23T13:41:21+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/an_update_on_pg.html</feedburner:origLink></item>
<item>
<title>Just another data point</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/kx1-ddh1hiE/just_another_da.html</link>

<description>(Update: I've pushed my code, including three new scripts, to the nfsd_report_bench/ directory on my examples repository. See below for some clarifications based on comments I received). A former colleague of mine at PT had a small reporting problem, and he ended up comparing several languages for the job: C, Perl, PHP, and Python. I was curious about the results, so I took the latest version of the Perl script that he was using and set off to work. The first thing that you should be aware is where your bottleneck is. Take a look at this small script: #!/usr/bin/env...</description>

<content:encoded><![CDATA[
<p>(<strong>Update</strong>: I've pushed my code, including three new scripts, to the <a href="http://github.com/melo/perl-examples/tree/master/nfsd_report_bench/"><code>nfsd_report_bench/</code> directory on my examples repository</a>. See <a href="#the_next_day">below</a> for some clarifications based on comments I received).</p>

<p>A former colleague of mine at PT had a <a href="http://blog.sig9.net/2009/10/17/php-vs-perl/">small reporting problem</a>, and he ended up comparing several languages for the job: C, Perl, PHP, and Python.</p>

<p>I was curious about the results, so I took the <a href="http://dev.sig9.net/PHPvsPerl/stats_basic_optimized_pl.txt">latest version of the Perl</a> script that he was using and set off to work.</p>

<p>The first thing that you should be aware is where your bottleneck is. Take a look at this small script:</p>

<pre class="brush: perl;">
#!/usr/bin/env perl

use strict;
use warnings;

my $lines;
while (<STDIN>) {
#  my @fields = split / /;
  $lines++;
}
print "$lines\n";
</pre>

<p>A basic line counter. Compare it to the system <code>wc</code>:</p>

<pre><code>$ gzcat nfsd.gz | time wc -l
 12236390
       16.86 real        16.24 user         0.43 sys
$ gzcat nfsd.gz | time ./wc_simple.pl 
12236390
       10.13 real         8.51 user         0.84 sys
</code></pre>

<p>So, a bit faster than the C version, doing 1.2M lines per second on my laptop.</p>

<p>But if you remove the comment on the <code>split()</code>, we have:</p>

<pre><code>$ gzcat nfsd.gz | time ./wc_simple_with_split.pl
12236390
       228.78 real       224.39 user         2.34 sys
</code></pre>

<p>A lot less: 53k lines per second.</p>

<p>So the first bottleneck is the <code>split()</code>. Lets improve on that. After some attempts I came up with this:</p>

<pre class="brush: perl;">
my $lines;
while (<STDIN>) {
  my ($ts)    = /^(\d+)/gc;
  my ($type)  = /(\w)\sV/gc;
  my ($op)    = /\s(\d\d?)\s\w/gc;
  my ($bytes) = /\w\s(\d+)\s/gc;
  $lines++;
}
</pre>

<p>I make use of the <code>gc</code> flags to start the next match where the previous one ended. I also take advantage of patterns in the lines that I need to match, like the <code>V</code> in the NFS version.</p>

<p>With this version we get:</p>

<pre><code>$ gzcat nfsd.gz | time ./wc_simple_with_regexps.pl
12236390
      109.62 real       107.42 user         1.55 sys
</code></pre>

<p>A bit better: 111k lines per second, a bit over 2x the previous result.</p>

<p>If we apply this gain to the <a href="http://dev.sig9.net/PHPvsPerl/">reported times for the Perl script</a> (419m11.267s), we get 200m49.97 which places Perl 1st, even above the C version by a minute or so.</p>

<p>My adjusted version of the <code>stats_basic_optimized.pl</code> script is <a href="http://www.simplicidade.org/share/melo_stats_basic_pl.txt"><code>melo_stats_basic.pl</code></a>.</p>

<p>This was good enough I think, but I wanted to study the I/O gains that could be made. Stop reading here if you are already bored, it will only get worse. We did manage to get a few more minutes back, though... ;)</p>

<p>So I went after the I/O performance. Fist I wanted to rule out the pipe as the bottleneck.</p>

<pre><code>$ cat /dev/zero | pv | cat &gt; /dev/null
4.61GB 0:00:10 [ 498MB/s]

$ gzcat nfsd.gz | pv | cat &gt; /dev/null 
1GB 0:00:04 [ 242MB/s]
</code></pre>

<p>So the pipe is not the bottleneck but we will never reach the full speed, <code>gzcat</code> will be our limitation.</p>

<p>I did try to read the gzip file directly into the Perl script and uncompressing it there, but it was <em>very</em> slow.</p>

<p>So assuming a limit of 242MB/s on the input side, how fast are we chopping lines? The size of the input is 1073743224 bytes, and our simple <code>wc_simple.pl</code> (no split, no regexp) took 10.13 seconds above, so we are chopping the input at a rate of 101MB/s.</p>

<p>So there is room to grow there (101MB/s to 242MB/s). I did some experiments:</p>

<pre><code>$ gunzip nfsd.gz
$ time wc_simple.pl &lt; nfsd
12236390

real    1m23.212s
user    0m7.434s
sys 0m2.166s
</code></pre>

<p>Yeah, the file doesn't fit in the cache like the gziped version, so there is real I/O, and the times go through the roof.</p>

<p>There is no point doing experiments with the big <code>nfsd</code> file. All of them will result in real I/O, and that is always slower than memory.</p>

<p>Lets try to do bigger reads and parse the results:</p>

<pre class="brush: perl;">
use strict;
use warnings;

my $size = shift || 2 ** 20; ## 1Mb default
my $offset = 0;
my $buf = '';
my $lines = 0;

while () {
  my $n = sysread(\*STDIN, $buf, $size, length($buf));

  while ($buf =~ /.+\n/gc) {
    $lines++;
  }
  last unless $n > 0;

  print "$lines $n\n" unless $lines & 0x1ffff;
  $buf = substr($buf, pos($buf));
}
print "$lines\n";
</pre>

<p>I tried several block sizes but with my OS the most I could read in one call was 64k. So asking 1MB and getting 64k reads we get:</p>

<pre><code>$ gzcat nfsd.gz | time  ./wc_batch.pl
12236390
    8.37 real         7.52 user         0.58 sys
</code></pre>

<p>We get 1.46M lines per second, a 17% improvement. Lets adjust to retrieve our fields. The inner loop becomes:</p>

<pre class="brush: perl;">
while ($buf =~ /(.+)\n/gc) {
  $_ = $1;
  my ($ts)    = /^(\d+)/gco;
  my ($type)  = /(\w)\sV/gco;
  my ($op)    = /\s(\d\d?)\s\w/gco;
  my ($bytes) = /\w\s(\d+)\s/gco;

  $lines++;
}
</pre>

<p>and the runtime:</p>

<pre><code>$ gzcat nfsd.gz | time  ./wc_batch_with_regexps.pl
12236390
   95.58 real        93.21 user         1.14 sys
</code></pre>

<p>So from 109.62s to 95.58s, 12% better (or comparing with our baseline <code>wc_simple_with_split.pl</code> at 228.78s, 58% better). Adjusting this to the reported results we would go from 419m11.267s down to 175m5.6842s.</p>

<p>I don't think I can improve on this unless we can have a bigger pipe reads. For example, forcing the reads to 8k:</p>

<pre><code>$ gzcat nfsd.gz | time  ./wc_batch.pl 8192
12236390
       12.08 real        10.93 user         0.70 sys
</code></pre>

<p>A lot worse compared with the 8.37s we got with 64k reads. So the size of the pipe is the next factor we could explore, if that is even an option with your kernel.</p>

<p>But I'm happy now.</p>

<p><a name="the_next_day"></a></p>

<h2>The next day</h2>

<p>Or so I though. First there was doubts that the split() was faster than regexps. I wrote <a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/bench_splitters.pl"><code>bench_splitters.pl</code></a> (<a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/bench_splitters_report.txt">output on my laptop</a>, <a href="http://github.com/melo/perl-examples/raw/master/nfsd_report_bench/bench_splitters.pl">download link</a>) to compare split with my regexps. The regexps are a bit over twice as fast, <strong>but</strong> I found big differences between the Mac OS system perl (5.8.8 on my Leopard OS) and the 5.10.1 that I compiled: system perl was between 20 and 30% faster.</p>

<p>The same <code>bench_splitters.pl</code> gives you the max rate of extraction that you can expect from the global script. I also included timing of the bookkeeping parts of the original script. The only noteworthy detail is the fact than when you hit the second level condition, you pay the price of the modulus operator big time. I also think that something is wrong with the input. Those time stamps don't look like normal second-precision time stamps. They are too big. So I don't know if <code>$ts % 3600</code> is the proper way to group performance by hour.</p>

<p>Second I wrote a <a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/max_line_rate.pl"><code>max_line_rate.pl</code></a> (<a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/max_line_rate_report.txt">output on my laptop</a>, <a href="http://github.com/melo/perl-examples/raw/master/nfsd_report_bench/max_line_rate.pl">download link</a>) that gives you the upper bound on the max rate that you can expect while parsing the required fields. You can run this script, and stop it at any point in time with ctrl-c, and it will print a performance report up to that point. Every 128k lines, a single line performance report is also printed.</p>

<p>You can use this <code>max_line_rate.pl</code> to compare your system perl with the 5.10.1 you compiled. I had much better performance with 5.8.8 in this particular application.</p>

<p>Finally I rewrote the statistics script. I did that to deal with the report that <a href="http://twitter.com/nunoloureiro/statuses/4969723345">my previous version was consuming 7.5Gb of RAM</a>. The reason is simple enough: I don't have access to the original input, only to a six-line excerpt that was posted. Therefore the regexps I use to extract the required fields might fail.</p>

<p>The new script, <a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/fast_stats.pl"><code>fast_stats.pl</code></a> (<a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/fast_stats_report.txt">output on my laptop</a>, <a href="http://github.com/melo/perl-examples/raw/master/nfsd_report_bench/fast_stats.pl">download link</a>), is more robust, and should deal with lines that cannot be parsed: it will print the line that couldn't be matched and ignore it. Also: I've included the output of the <code>ps</code> command at the start and end of both <code>fast_stats.pl</code> and <code>max_line_rate.pl</code> to show that the RSS doesn't change that much.</p>

<p>To compare the original <code>stats_basic_optimized.pl</code> with my <code>fast_stats.pl</code> I wrote a small shell script <a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/bench.sh"><code>bench.sh</code></a> (<a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/report.txt">output on my laptop</a>). The <code>nfsd.gz</code> input file was generated with the <a href="http://github.com/melo/perl-examples/blob/master/nfsd_report_bench/build_source_file.pl"><code>build_source_file.pl</code></a> script with the command:</p>

<pre><code>build_source_file.pl 1073741824 | gzip --best &gt; nfsd.gz
</code></pre>

<p>The new <code>fast_stats.pl</code> is almost twice as fast as the old one on my laptop.</p>

<p>On a final note (I wasted too much time already on this...), I'm not out to compare Perl with Python or Ruby or even PHPO. But I would like to know how we measure up against C though. The reason is simple: when Perl programmers feel that something is slow, they turn to C, not another scripting language.</p>

<p>This experiment is mostly to show that writing fast perl will sometimes take you to unexpected paths (like regexps beating a split), and that you should benchmark carefully if performance is critical to you.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=kx1-ddh1hiE:6xhp09XeCew:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=kx1-ddh1hiE:6xhp09XeCew:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=kx1-ddh1hiE:6xhp09XeCew:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=kx1-ddh1hiE:6xhp09XeCew:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/kx1-ddh1hiE" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">998@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-10-18T10:52:19+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/just_another_da.html</feedburner:origLink></item>
<item>
<title>CPAN::Shell 's' command</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/BnXY57qyQXw/cpanshell_s_com.html</link>

<description>I'm playing with a new command for the CPAN::Shell: 's' for search on http://search.cpan.org. It takes a single argument (can be a module, distribution, bundle or author name), checks the CPAN indexes to see which type it is, creates the proper URL for it at search.cpan.org and opens your browser with it. The last bit, opening a browser with it, is very very immature. Right now it only works on Mac OS X. I'm hopping to get the experience to do it right from the Browser::Open distribution. If no object is found, sends the user to the generic search interface....</description>

<content:encoded><![CDATA[
<p>I'm playing with a new command for the <code>CPAN::Shell</code>: '<code>s</code>' for <em>search on http://search.cpan.org</em>.</p>

<p>It takes a single argument (can be a module, distribution, bundle or author name), checks the CPAN indexes to see which type it is, creates the proper URL for it at <a href="http://search.cpan.org/">search.cpan.org</a> and opens your browser with it.</p>

<p>The last bit, opening a browser with it, is very very immature. Right now it only works on Mac OS X. I'm hopping to get the experience to do it right from the <a href="http://search.cpan.org/dist/Browser-Open/"><code>Browser::Open</code> distribution</a>.</p>

<p>If no object is found, sends the user to the generic search interface.</p>

<p>The current hackish implementation can be found on <a href="http://github.com/melo/cpanpm/tree/s_command">my <code>s_command</code> topic branch</a> (its a <em>topic branch</em>, I will rebase it on occasion onto master).</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=BnXY57qyQXw:bcfOVwejQAw:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=BnXY57qyQXw:bcfOVwejQAw:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=BnXY57qyQXw:bcfOVwejQAw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=BnXY57qyQXw:bcfOVwejQAw:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/BnXY57qyQXw" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">997@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-10-17T12:36:29+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/cpanshell_s_com.html</feedburner:origLink></item>
<item>
<title>Browser::Open</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/0HtRJO98PT4/browseropen.html</link>

<description>I've uploaded a small module to CPAN, Browser::Open (give it a couple of minutes to show up). It does one simple thing: given a $url, it opens the default browser with it. The difficult part is deciding how to open the "default browser". On Mac OS X, this is easy: just execute the open command. On Windows, there is a start command that should do the trick, but I'm not a Windows user so I cannot test this. Any Windows users out there that can point me to the relevant information on how to open a URL with a simple...</description>

<content:encoded><![CDATA[
<p>I've uploaded a small module to CPAN, <a href="http://search.cpan.org/dist/Browser-Open/">Browser::Open</a> (give it a couple of minutes to show up).</p>

<p>It does one simple thing: given a <code>$url</code>, it opens the default browser with it.</p>

<p>The difficult part is deciding how to open the "default browser". On Mac OS X, this is easy: just execute the <code>open</code> command.</p>

<p>On Windows, there is a <code>start</code> command that should do the trick, but I'm not a Windows user so I cannot test this. Any Windows users out there that can point me to the relevant information on how to open a URL with a simple command, I would appreciate it.</p>

<p>For Linux, you have too many choices it seems: you could use <code>gnome-open</code> but your user might be using KDE. There is a <a href="http://portland.freedesktop.org/xdg-utils-1.0/xdg-open.html"><code>xdg-open</code> command</a> described at the <a href="http://freedesktop.org/">FreeDesktop</a> site that seems to do what I want. We can always fallback to <code>firefox</code> though. Fragmentation++!</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=0HtRJO98PT4:oOmwdzxO3EI:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=0HtRJO98PT4:oOmwdzxO3EI:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=0HtRJO98PT4:oOmwdzxO3EI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=0HtRJO98PT4:oOmwdzxO3EI:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/0HtRJO98PT4" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">996@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-10-17T12:13:30+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/browseropen.html</feedburner:origLink></item>
<item>
<title>Java 1.6 on Leopard</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/kIK1730nnQs/java_16_on_leop.html</link>

<description>I did the research on this a month ago and I forgot to write it down, so I just spent another hour doing it again. I should know better by now. Anyway, you can download the Java 1.6 update for Mac OS X Leopard from the Apple Software site, but its only 64-bit. I do have a desktop that is 64-biT, unfortunately my Macbook Pro laptop is only a 32-bit Core Duo. Hence, I cannot run the new version of Java. If you do have a 64-bit CPU, and after you install the update, you might want to switch the...</description>

<content:encoded><![CDATA[
<p>I did the research on this a month ago and I forgot to write it down, so I just spent another hour doing it again. I should know better by now.</p>

<p>Anyway, you can download the <a href="http://www.apple.com/downloads/macosx/apple/application_updates/javaformacosx105update5.html">Java 1.6 update for Mac OS X Leopard from the Apple Software site</a>, <strong>but</strong> its only 64-bit.</p>

<p>I do have a desktop that is 64-biT, unfortunately my Macbook Pro laptop is only a 32-bit Core Duo. Hence, I cannot run the new version of Java.</p>

<p>If you do have a 64-bit CPU, and after you install the update, you might want to switch the default version of Java to 1.6. To do that, the proper way to do that is to run the <code>/Applications/Utilities/Java\ Preferences.app</code> and drag the 1.6 version to the top of the list.</p>

<p>I just wanted to try out <a href="http://jakeapp.com/">Jake</a>... Guess I wont be able to, at least not until I can get my hands on the wife's laptop... hmms... she's sleeping already...</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=kIK1730nnQs:10r62bkTV_M:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=kIK1730nnQs:10r62bkTV_M:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=kIK1730nnQs:10r62bkTV_M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=kIK1730nnQs:10r62bkTV_M:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/kIK1730nnQs" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">995@http://www.simplicidade.org/notes/</guid>
<dc:subject>Tips, Hints &amp; Tricks</dc:subject>
<dc:date>2009-10-12T23:00:40+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/java_16_on_leop.html</feedburner:origLink></item>
<item>
<title>Attaching jobs in Gearman</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/-1o7QVAbChU/attaching_jobs.html</link>

<description>I've used Gearman on and off in the past but for a new project, I've decided to explore some features I rarely made use of previously. Most notably, the unique ID that clients can submit with each job. Let me just clarify some behaviors for non-background jobs: the worker will execute the job until it finishes even if the client that submitted it dies; if the client dies before the job is passed on to a worker, it will be removed and will never execute. For background jobs, the behavior is different: a client submits a background job, the gearmand...</description>

<content:encoded><![CDATA[
<p>I've used <a href="http://gearman.org/">Gearman</a> on and off in the past but for a new project, I've decided to explore some features I rarely made use of previously. Most notably, the unique ID that clients can submit with each job.</p>

<p>Let me just clarify some behaviors for non-background jobs:</p>

<ul>
<li>the worker will execute the job until it finishes even if the client that submitted it dies;</li>
<li>if the client dies before the job is passed on to a worker, it will be removed and will never execute.</li>
</ul>

<p>For background jobs, the behavior is different: a client submits a background job, the <code>gearmand</code> daemon queues this (on stable storage if you use the <a href="http://gearman.org/index.php?id=manual:job_server#persistent_queues">persistent queues of the latest versions of the C implementation</a>), and sends it to a worker as soon as one is available.</p>

<p>This is basic stuff, I'm just making sure we are all on the same page regarding Gearman behavior.</p>

<p>Back to the the unique parameter. You can define a unique key for your jobs. Those keys should be unique per function, so you can have the same key on different functions and they will be two different jobs.</p>

<p>The fun part with unique is that you can have multiple clients listening to status and completion events of the same job if you share the key between them. Say that you start a job with a key <code>alpha</code>. If other clients submit a job with the same key, <em>and</em> (and this is an important) the job is still running, this second client will attach itself to the same job.</p>

<p>To test this I wrote a small shell script worker (save it as slow.sh and make it executable with <code>chmod 755 slow.sh</code>):</p>

<pre class="brush: bash;">
#!/bin/sh

echo "Starting a slow worker..." >>/dev/fd/2
for i in 5 4 3 2 1 ; do
  echo $i >>/dev/fd/2
  sleep 1
done
echo done $PID
</pre>

<p>This worker does nothing expect print to STDERR a count, and then sends to the client a done string with the worker process ID. But it takes 5 seconds to run so it allows us some time to switch between windows.</p>

<p>After you start your <code>gearmand</code> server (I used <code>gearmand -vv</code> just to have some debug) you can start a worker process like this:</p>

<pre class="brush: bash;">
gearman -w -f slow ./slow.sh
</pre>

<p>This worker registers the <code>slow</code> function and will execute the <code>slow.sh</code> per job.</p>

<p>Now open two new terminal windows and type on each one:</p>

<pre class="brush: bash;">
gearman -f slow -u alpha -s
</pre>

<p>This will submit a non-background job for the <code>slow</code> function, with the unique key <code>alpha</code>. The <code>-s</code> means that we won't be sending any data.</p>

<p>You'll see one execution of the worker, and then both clients will output something like this:</p>

<pre><code>done 57998
</code></pre>

<p>You can experiment, and attach the second client only half-way through the worker run. Or you can stop the worker, start both clients, and then start the worker. The result will be the same: both clients receive the output for the same job.</p>

<p>This is a very very cool feature, and can be used easily for slow processing inside a web request.</p>

<p>First, if a web request requires a slow processing phase, we store all the relevant data and submit a background job to do the processing with some random key. The user receives a "Processing page" on his browser, that includes this key.</p>

<p>A small javascript program using AJAX, connects to our long-pooling server and submits a non-background job to the same function and using the key. This second client request will now wait until the processing is done, and can even receive status updates from the worker and send them back to the browser.</p>

<p>This attach-to-job-using-key is very reliable. I've tested several combinations with and without workers running, strange order of job submission, adding multiple clients to the same job, and all of them work as expected.</p>

<p>The only real problem with this is that the clients need to use the same API that is used to submit a job. Instead of a new API, like <code>ATTACH_JOB</code> for example, you use the same <code>SUBMIT_JOB</code> API that you use for new jobs. This works fine, until your second client attaches with a key for a job that has already ended. The <code>gearmand</code> server will fail to find it, and will dutifully create a new job.</p>

<p>My current workaround for this is to send a specific payload on the attach requests, to signal the worker that this is a attach request and not a new job. The worker, if he detects this signal, just ends the processing. For example, if your jobs require payload data, you can use an empty data field as the flag.</p>

<p>This is not optimal of course, you would be waking up workers just to return immediately, but it would work.</p>

<p>If you have multiple <code>gearmand</code> servers, you need to make sure that the clients that will be attaching to a job use the same server. A solution would be to pass the server identification (IP or even better hash-of-IP) along with the key.</p>

<p>The traditional way of doing this is have the workers store the completed result in a database somewhere. The solution presented here does not invalidate that, it only provides a very light notification of completion to background jobs. It beats pooling the database to see if the background job is completed.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-1o7QVAbChU:d5G4JQC6kio:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=-1o7QVAbChU:d5G4JQC6kio:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-1o7QVAbChU:d5G4JQC6kio:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-1o7QVAbChU:d5G4JQC6kio:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/-1o7QVAbChU" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">994@http://www.simplicidade.org/notes/</guid>
<dc:subject>Tips, Hints &amp; Tricks</dc:subject>
<dc:date>2009-10-08T16:12:44+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/attaching_jobs.html</feedburner:origLink></item>
<item>
<title>Dist::Zilla::Plugin::LatestPrereqs</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/_ZrmHkB0oGk/distzillaplugin.html</link>

<description>This all started with an article by Marcel Gruenauer "hanekomu", "Repeatedly installing Task::* distributions". What he wants is a way to tell CPAN this: "install the latest versions of my dependencies". His solution wont work unfortunately. The code that he gives us will prevent the Task:: module from being installed but it will not guarantee that the latest version of the prereqs will be installed in the following runs. the reason is simple: if you don't ask for a specific version of your prereqs, CPAN will accept any version, so it will only install each prereq once, the first time....</description>

<content:encoded><![CDATA[
<p>This all started with an article by <a href="http://hanekomu.at/">Marcel Gruenauer "hanekomu"</a>, "<a href="http://hanekomu.at/blog/dev/20091005-1227-repeatedly_installing_task_distributions.html">Repeatedly installing Task::* distributions</a>".</p>

<p>What he wants is a way to tell <code>CPAN</code> this: "install the latest versions of my dependencies".</p>

<p>His solution wont work unfortunately. The code that he gives us will prevent the <code>Task::</code> module from being installed but it will not guarantee that the latest version of the prereqs will be installed in the following runs.</p>

<p>the reason is simple: if you don't ask for a specific version of your prereqs, <code>CPAN</code> will accept any version, so it will only install each prereq once, the first time.</p>

<p>The perfect solution would be to create a marker on each prereq that would tell the <code>CPAN</code> tool chain that you want the latest version. This does not exist yet. You could probably standardize on version -1 meaning the last one (on a twisted parallel with the last index of Perl lists), but its all speculation. Its just not supported yet.</p>

<p>The next best thing would be to include the version required on each of your prereqs, and keep those values up-to-date to the latest available on <code>CPAN</code> whenever you rebuild your package.</p>

<p>This is a half-way solution. It wont guarantee the latest version at the time your package is installed but it would make sure you get the latest version at the time your package was built on your system before uploading to <a href="http://pause.perl.org/">PAUSE</a>.</p>

<p>This is actually a good compromise given that you are probably listing the versions of the prereqs that you tested your package with on your system.</p>

<p>And, better yet, this half-solution can be automatized. I wrote a <a href="http://search.cpan.org/dist/Dist-Zilla/"><code>Dist::Zilla</code></a> plugin to do just that. The code is very simple and you can just adapt this into a <a href="http://search.cpan.org/dist/Module-Install/"><code>Module::Install</code></a> plugin or whatever you use to build your packages.</p>

<p>You can find the <a href="http://github.com/melo/dist-zilla-tools/tree/master/Dist-Zilla-Plugin-LatestPrereqs/">code for <code>Dist::Zilla::Plugin::LatestPrereqs</code> at my Github repository</a> for <a href="http://github.com/melo/dist-zilla-tools">Dist::Zilla tools</a>. Its not on <a href="http://search.cpan.org/">CPAN</a> yet, and for now there are no plans to publish it. The reason is simple: it requires a small patch to the core <code>Dist::Zilla</code>. <a href="http://github.com/melo/dist-zilla/commit/a616ea6c3aafaf4e1771bab0d0cffb2e8c12ac8a">The patch is a single commit that you can find on Dist::Zilla fork</a>. I've asked <a href="http://search.cpan.org/~rjbs/">Ricardo Signes</a> to accept the patch. If he likes the code, I'll release my plugin after the next <code>Dist::Zilla</code> release.</p>

<p>If you look at the <a href="http://github.com/melo/dist-zilla-tools/blob/master/Dist-Zilla-Plugin-LatestPrereqs/lib/Dist/Zilla/Plugin/LatestPrereqs.pm">LatestPrereqs code</a>, you'll notice that it is very simple, but it does load the <a href="http://search.cpan.org/dist/CPAN/"><code>CPAN</code></a> package and that is a big one. You could write this code directly on your <code>Makefile.PL</code> and have the very latest versions of your prereqs at install time, but this would assume that the system as a properly configured <code>CPAN</code>.</p>

<p>That was a risk that I'm not willing to take on my distributions. If you do it that way, ping me. I would like to follow your module <a href="http://static.cpantesters.org/">CPAN Testers</a> feed for a while.</p>

<p>Back to Marcel post, if you do need to prevent the install phase for your distribution, then I've also uploaded a <code>Dist::Zilla</code> plugin to do just that: <a href="http://search.cpan.org/dist/Dist-Zilla-Plugin-MakeMaker-SkipInstall/"><code>Dist::Zilla::Plugin::MakeMaker::SkipInstall</code></a>. It might be handy sometimes.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_ZrmHkB0oGk:oGkVB4vS53g:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=_ZrmHkB0oGk:oGkVB4vS53g:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_ZrmHkB0oGk:oGkVB4vS53g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_ZrmHkB0oGk:oGkVB4vS53g:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/_ZrmHkB0oGk" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">993@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-10-07T16:41:02+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/distzillaplugin.html</feedburner:origLink></item>
<item>
<title>AnyEvent::Mojo 0.8</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/iNpbrezlXCI/anyeventmojo_08.html</link>

<description>I've uploaded to PAUSE release 0.8 of AnyEvent::Mojo. It should be on your local CPAN mirror in a little while. This was a long time coming unfortunately, and I accumulated FAIL test reports on CPANTS, but its here now. Given that it uses the latest Mojo release, it supports HTTP keep-alive and pipelining, chunked-encoding and 100-Continue requests. Although the test suite passes, I'm not fully confident on the pipelining code. My next step is to write a client with a slow network reader to exercise some corner cases of that part of the code. In particular, I'm concerned about the...</description>

<content:encoded><![CDATA[
<p>I've uploaded to <a href="https://pause.perl.org">PAUSE</a> <a href="http://github.com/melo/anyevent--mojo/tree/v0.8">release 0.8 of AnyEvent::Mojo</a>. It should be on your <a href="http://mirrors.cpan.org/">local CPAN mirror</a> in a little while.</p>

<p>This was a long time coming unfortunately, and I <a href="http://www.cpantesters.org/distro/A/AnyEvent-Mojo.html">accumulated FAIL test reports on CPANTS</a>, but its here now.</p>

<p>Given that it uses the <a href="http://search.cpan.org/dist/Mojo/">latest Mojo release</a>, it supports HTTP keep-alive and pipelining, chunked-encoding and 100-Continue requests.</p>

<p>Although the test suite passes, I'm not fully confident on the pipelining code. My next step is to write a client with a slow network reader to exercise some corner cases of that part of the code. In particular, I'm concerned about the interaction of Mojo pipeline code with my request pause functionality that I use to implement long-polling servers.</p>

<p>It could be argued that long-polling and pipeline don't mix, but I think that the pause functionality could also be used on regular requests. For example, if one request needs an answer from a memcached server, the handler can start the memcached GET, pause the Mojo transaction, and resume it when the memcached response arrives. While that is going on, the server should be able to keep writing out previous requests, and reading the next ones.</p>

<p>Maybe thats a bit extreme, but I do hope to have this working, for complex pipelining situations.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=iNpbrezlXCI:pkyt17k3D_Y:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=iNpbrezlXCI:pkyt17k3D_Y:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=iNpbrezlXCI:pkyt17k3D_Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=iNpbrezlXCI:pkyt17k3D_Y:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/iNpbrezlXCI" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">992@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-10-04T08:28:35+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/anyeventmojo_08.html</feedburner:origLink></item>
<item>
<title>bash completion for Github gem</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/cgWeR8uLsK0/bash_completion_2.html</link>

<description>For some time now, I had the Github gem installed (if you want to know more, I suggest a old blog post about the Github gem). This gives you a small gh script that interface to Github APIs and make common operations like creating repositories, cloning, and fetching other repositories in the project network easy and fast. But I'm a lazy bastard, and the lack of a bash completion script was getting on my nerves. So here: you can get the new gh-completion.bash script from my repository. I've sent a pull request to Chris Wanstrath (defunkt) Please note that this...</description>

<content:encoded><![CDATA[
<p>For some time now, I had the <a href="http://github.com/defunkt/github-gem">Github gem</a> installed (if you want to know more, I suggest a old <a href="http://github.com/blog/214-the-new-improved-github-gem">blog post about the Github gem</a>). This gives you a small <code>gh</code> script that interface to Github APIs and make common operations like creating repositories, cloning, and fetching other repositories in the project network easy and fast.</p>

<p>But I'm a lazy bastard, and the lack of a bash completion script was getting on my nerves.</p>

<p>So here: you can get the <a href="http://github.com/melo/github-gem/blob/master/contrib/gh-completion.sh">new <code>gh-completion.bash</code> script</a> from <a href="http://github.com/melo/github-gem">my repository</a>. I've sent a pull request to <a href="http://github.com/defunkt">Chris Wanstrath (defunkt)</a></p>

<p>Please note that this is still work-in-progress.</p>

<p>Right now, most of the command and options have completion, but I'm still trying to understand certain operations (like <code>pull-request</code> and <code>track</code>) that I never use. I don't really understand what they do, so I have no way to create a decent completion rule for them.</p>

<p>But using this bash completion is totally safe... Until you hit the <code>ENTER</code> key, that is.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=cgWeR8uLsK0:sT5MIod3ia4:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=cgWeR8uLsK0:sT5MIod3ia4:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=cgWeR8uLsK0:sT5MIod3ia4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=cgWeR8uLsK0:sT5MIod3ia4:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/cgWeR8uLsK0" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">991@http://www.simplicidade.org/notes/</guid>
<dc:subject>Tips, Hints &amp; Tricks</dc:subject>
<dc:date>2009-10-01T16:22:41+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/10/bash_completion_2.html</feedburner:origLink></item>
<item>
<title>Generating charset_table maps for Sphinx</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/ZHDmOppPiIg/generating_char.html</link>

<description>At work, I wanted to improve the back-office search engine and installed Sphinx. On a regular basis, it indexes all our users, courses, teachers and other important tables. It works great, low install barrier, low maintenance, and it is very very fast. Perfect. One of the problems that we found, that limited the usefulness of the full-text search engine, is that a lot of our text has accents, and it would be better to ignore those. Also we don't need case-sensitive-ness. So I needed to generate a charset_table map, what Sphinx uses to normalize the text that you give him...</description>

<content:encoded><![CDATA[
<p>At work, I wanted to improve the back-office search engine and installed <a href="http://www.sphinxsearch.com/">Sphinx</a>.</p>

<p>On a regular basis, it indexes all our users, courses, teachers and other important tables. It works great, low install barrier, low maintenance, and it is very very fast. Perfect.</p>

<p>One of the problems that we found, that limited the usefulness of the full-text search engine, is that a lot of our text has accents, and it would be better to ignore those. Also we don't need case-sensitive-ness.</p>

<p>So I needed to generate a <a href="http://www.sphinxsearch.com/docs/current.html#conf-charset-table"><code>charset_table</code></a> map, what Sphinx uses to normalize the text that you give him to index.</p>

<p>And being a (very) lazy person, I prefer to write a Perl script to do it. The result is the <a href="http://github.com/melo/scripts/blob/master/bin/x-sphinx-charset-generator"><code>x-sphinx-charset-generator</code></a>, now part of <a href="http://github.com/melo/scripts/">my script stash</a>.</p>

<p>It takes an optional parameter, the charset that you are using on your text defaulting to 'utf8', the <a href="http://jeremy.zawodny.com/blog/archives/010546.html">loose version of UTF-8</a>, and generates a <code>charset_table</code> for the most common accented characters, mapping them to the lower-case version of the same letter without the accent.</p>

<p>I've only include the common Portuguese characters. Patches accepted for others characters that you might need.</p>

<p>The only part that I don't really like is that I need to apply the same logic to cleanup the strings that users use to search. I would prefer to have a module that would take the characters that I want to allow as valid, and have that module provide the <code>charset_table</code> and a function to clean search inputs. Interesting, but for now this will solve the important 80% of the problem.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ZHDmOppPiIg:gbgak3oJjQM:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=ZHDmOppPiIg:gbgak3oJjQM:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ZHDmOppPiIg:gbgak3oJjQM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ZHDmOppPiIg:gbgak3oJjQM:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/ZHDmOppPiIg" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">990@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-09-26T17:16:26+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/generating_char.html</feedburner:origLink></item>
<item>
<title>Tip: use pv to monitor mysql loads</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/Ldubm3i2azA/tip_use_pv_to_m.html</link>

<description>If you are fortunate enough to be able to reload your development databases from time to time with production data, this might help. The usual command you would use is something like this: gunzip -c db-backup.sql.gz | mysql -udevuser -ppass db_dev If your dump is big this can take a while and you wont have a clue about what is happening. Instead, install pipe viewer and do: gunzip -c db-backup.sql.gz | pv | mysql -udevuser -ppass db_dev and you get a nice speed meter. For even better results: dump=db-backup.sql.gz size=`gunzip --list $dump | perl -ne 'print "$1\n" if /\d+\s+(\d+)\s+\d/'` gunzip...</description>

<content:encoded><![CDATA[
<p>If you are fortunate enough to be able to reload your development databases from time to time with production data, this might help.</p>

<p>The usual command you would use is something like this:</p>

<pre class="brush: bash;">
gunzip -c db-backup.sql.gz | mysql -udevuser -ppass db_dev
</pre>

<p>If your dump is big this can take a while and you wont have a clue about what is happening.</p>

<p>Instead, install <a href="http://www.ivarch.com/programs/pv.shtml">pipe viewer</a> and do:</p>

<pre class="brush: perl;">
gunzip -c db-backup.sql.gz | pv | mysql -udevuser -ppass db_dev
</pre>

<p>and you get a nice speed meter. For even better results:</p>

<pre class="brush: perl;">
dump=db-backup.sql.gz
size=`gunzip --list $dump | perl -ne 'print "$1\n" if /\d+\s+(\d+)\s+\d/'`
gunzip -c $dump | pv -s $size | mysql -udevuser -ppass db_env
</pre>

<p>and you'll get a speed meter and an ETA. The second command will get the uncompressed size of the dump and use that to teach <code>pv</code> how much data to expect.</p>

<p><a href="http://www.ivarch.com/programs/pv.shtml">Pipe viewer</a> rockz.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Ldubm3i2azA:xvTGEgm3ick:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=Ldubm3i2azA:xvTGEgm3ick:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Ldubm3i2azA:xvTGEgm3ick:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Ldubm3i2azA:xvTGEgm3ick:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/Ldubm3i2azA" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">989@http://www.simplicidade.org/notes/</guid>
<dc:subject>Tips, Hints &amp; Tricks</dc:subject>
<dc:date>2009-09-24T17:52:45+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/tip_use_pv_to_m.html</feedburner:origLink></item>
<item>
<title>A new look at Mason</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/Fsp3xqSnhms/a_new_look_at_m.html</link>

<description>On my way to E5, I have to deal with all the legacy sites that came before it, and the vast majority of them are written in Mason. At the time, we used HTML::Mason 1.05, and only after 1.30-ish (when the internal buffering changes introduced in the 1.10 release where reverted) did we upgraded to something more recent. To get an idea of the size of this Mason project, the current sites have a little over 450 different components across 7 sites (different layouts but same content) and 1 management site. A lot of those components are no longer in...</description>

<content:encoded><![CDATA[
<p>On my way to <a href="http://www.simplicidade.org/notes/archives/2009/08/start.html">E5</a>, I have to deal with all the legacy sites that came before it, and the vast majority of them are written in <a href="http://www.masonhq.com/">Mason</a>.</p>

<p>At the time, we used <a href="http://search.cpan.org/dist/HTML-Mason/">HTML::Mason</a> 1.05, and only after 1.30-ish (when the internal buffering changes introduced in the 1.10 release where reverted) did we upgraded to something more recent. To get an idea of the size of this Mason project, the current sites have a little over 450 different components across 7 sites (different layouts but same content) and 1 management site. A lot of those components are no longer in use, and where left there due to bad VCS practices. I would estimate about 200 actual useful components. And it makes heavy use of <code>autohandlers</code>, <code>dhandlers</code>, and multiple component roots, to implement site inheritance.</p>

<p>The <a href="http://www.simplicidade.org/notes/archives/2009/08/template_system.html">E5 template discussion</a> is also still on my mind, without a clear winner yet.</p>

<p>And finally, last week I read <a href="http://www.openswartz.com/">Jonathan Swartz</a> article about what <a href="http://www.openswartz.com/2009/09/01/what-mason-2-0-would-look-like/">Mason 2.0 would look like</a>.</p>

<p>So I took the time last night to re-evaluate Mason. As most powerful tools (and be sure that it is a very powerful tool), the problem with Mason is that you can easlly make a big mess of things. More than with other solutions like Catalyst and Mojo, that provide you with a clear separation of Controller, Model and View, Mason make is very easy to mix the three. You could end up with a lot of logic that should be in your models inside your templates.</p>

<p>But it has several advantages:</p>

<ul>
<li>its easy to start and add a new page. Just create the file and start typing: no need to jump between controller and template, and a restart (this alone makes for speedy development);</li>
<li>it has decent wrapper functionality for skinning: <code>autohandlers</code> are great;</li>
<li>the multiple component roots logic is very powerful, and its used both during the dispatch phase and component calls;</li>
<li>the view logic is Perl: no need to learn a new language and be exasperated with their limitations like TT.</li>
</ul>

<p>There are several downsides of course: for one, the split of Controller/View of modern frameworks allows you to reuse controller logic with multiple views. For example, you could output HTML, JSON and XML with the same controller code.</p>

<p>But the biggest downside is this: deployment is a bitch.</p>

<p>For production environments, deployment usually means mod_perl but I find <a href="http://www.fastcgi.com/">FastCGI</a> easier to deploy now-a-days. Yet, this option is <a href="http://www.masonhq.com/?FastCGI">only briefly mentioned on the MasonHQ site</a>.</p>

<p>So I created a small experimental project (you can find all the files at the <a href="http://github.com/melo/exp-mason-fcgi">exp-mason-fcgi project on GitHub</a>). It has a <a href="http://github.com/melo/exp-mason-fcgi/blob/master/mason_fcgi.pl">FastCGI startup script</a> to power two virtual hosts. Each one shares a <a href="http://github.com/melo/exp-mason-fcgi/tree/master/master/">master component root</a>, and has a local per-site component root to override the master site behavior when needed.</p>

<p>The setup works just fine under <a href="http://nginx.net/">nginx</a>+FastCGI (<a href="http://github.com/melo/exp-mason-fcgi/blob/master/nginx.conf">partial nginx.conf included</a>), but I did get into some trouble. Mason usually delegates some stuff to <a href="http://httpd.apache.org/">Apache</a> and without his big daddy around, he can get lost.</p>

<p>The first problem is <a href="http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex">directory index files</a>. When you request a directory, Apache will help Mason out and point it to the proper <code>index.html</code> file. Without Apache, request to <code>http://your-fastcgi-mason-site/</code> will just fail, because Mason cannot find the component for <code>/</code>. It has no logic to map <code>/</code> into <code>/index.html</code> for example.</p>

<p>You could implement this with a global <code>dhandler</code>, and it is probably the best solution, because it can also deal with 404 situations (another one that Apache could cleanup after).</p>

<p>I have a <a href="http://github.com/melo/exp-mason-fcgi/commit/2360faa2c94f44b2be4f4cce6dbdcbfdbb788107">proof of concept hack in the repo that mimics the Apache DirectoryIndex directive</a>. It is a hack, it should be in the Interp.pm and not in the Request. I'll clean it up later. But it does work, and it might be useful in some scenarios.</p>

<p>This patch makes a <code>/</code> request work just fine.</p>

<p>The second problem I have with Mason is the order of evaluation of templates. The current order for a request to <code>/index.html</code> is <code>/autohandler</code> which calls <code>$m-&gt;call_next</code> and that calls the <code>/index.html</code> component.</p>

<p>This makes it hard to influence the wrapper with content generated by the <code>/index.html</code> component.</p>

<p>The solution was to create <a href="http://github.com/melo/exp-mason-fcgi/commit/814aa71a24b7e8b5d730446bca76b51876057f84">a new <code>HTML::Mason::Request</code> method called <code>scall_next()</code></a>. It merges the <a href="http://www.masonhq.com/docs/manual/Request.html#call_next"><code>$m-&gt;call_next()</code></a> and the <a href="http://www.masonhq.com/docs/manual/Request.html#scomp"><code>$m-&gt;scomp()</code></a> calls into one, and allows me to <a href="http://github.com/melo/exp-mason-fcgi/commit/54c68fa73d5bea05903e30419c33990e735161bb">use it in a <code>autohandler</code> like this</a>. The <code>$m-&gt;scall_next()</code> will call the next component, get the generated HTML, and only then generate the HTML wrapper.</p>

<p>The last piece of the puzzle is a way for the <code>/index.html</code> and the parent <code>autohandler</code> to communicate, for example, to pass along the title for the page.</p>

<p>The Mason-recommended way is to use <a href="http://www.masonhq.com/docs/manual/Request.html#notes"><code>$m-&gt;notes()</code></a> API, similar to the Catalyst stash concept. It works very well, but I prefer to take advantage of the fact that all components live inside the <code>HTML::Mason::Commands</code> namespace and just <a href="http://github.com/melo/exp-mason-fcgi/commit/f3ef0e0cef66ecf7db7e6671db08086f11b566fd">declare a shared <code>%stash</code> there and clean it up per request</a>. With this, its <a href="http://github.com/melo/exp-mason-fcgi/commit/bfe815aa90f686dc3a613629707af1bf4e128ab4">easy to implement dynamic page titles</a>.</p>

<hr />

<p>All in all, I keep coming back to Mason. I do like most of what it provides, and for quick sites, it beats all the other alternatives in Perl-land.</p>

<p>A couple of months ago there was some discussion about a option to give web developers that was FTP friendly, in that you could upload your pages to a server and it would just work. Mason is the closest that Perl has to that goal.</p>

<p>But the deployment must be made simpler, and that I one of the things that Mason 2.0 should focus on: make it simpler to deploy.</p>

<p>So my laundry list for Mason 2.0 (and most of them can be implemented on 1.x):</p>

<ul>
<li>FastCGI support out-of-the-box;</li>
<li>support for directory index files (without using <code>dhandlers</code>);</li>
<li><code>$m-&gt;scall_next</code>;</li>
<li>better hooks for debugging and 404 errors.</li>
</ul>

<p>I don't know. I'm strongly considering go Mason all the way for E5, and if that goes forward, I guess I'll have to write these four pieces myself.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Fsp3xqSnhms:Qp86FckQxcA:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=Fsp3xqSnhms:Qp86FckQxcA:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Fsp3xqSnhms:Qp86FckQxcA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=Fsp3xqSnhms:Qp86FckQxcA:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/Fsp3xqSnhms" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">988@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-09-19T12:38:21+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/a_new_look_at_m.html</feedburner:origLink></item>
<item>
<title>Bitten by prototypes</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/HsJ58nkdx2E/bitten_by_proto.html</link>

<description><![CDATA[I just spent the best part of an hour around a problem caused by the behavior of Perl prototypes. I used the following test case to figure it out: use Test::More tests =&gt; 1; use Encode qw( encode decode ); sub u8l1 { return encode('iso-8859-1', @_); } my $ola_u8 = decode('utf8', 'Olá'); my $ola_l1 = encode('iso-8859-1', $ola_u8); is(u8l1($ola_u8), $ola_l1); The output of prove x.t is this: t/x.t .. 1/1 # Failed test at t/x.t line 12. # got: '1' # expected: 'Ol?' # Looks like you failed 1 test of 1. t/x.t .. Dubious, test returned 1 (wstat 256, 0x100)...]]></description>

<content:encoded><![CDATA[
<p>I just spent the best part of an hour around a problem caused by the behavior of Perl prototypes.</p>

<p>I used the following test case to figure it out:</p>

<pre><code>use Test::More tests =&gt; 1;
use Encode qw( encode decode );

sub u8l1 {
  return encode('iso-8859-1', @_);
}

my $ola_u8 = decode('utf8', 'Olá');
my $ola_l1 = encode('iso-8859-1', $ola_u8);
is(u8l1($ola_u8), $ola_l1);
</code></pre>

<p>The output of <code>prove x.t</code> is this:</p>

<pre><code>t/x.t .. 1/1 
#   Failed test at t/x.t line 12.
#          got: '1'
#     expected: 'Ol?'
# Looks like you failed 1 test of 1.
t/x.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
</code></pre>

<p>The <code>got: '1'</code> had me for quite some time. Until I changed the <code>u8l1()</code> helper to this:</p>

<pre><code>sub u8l1 {
  return encode('iso-8859-1', $_[0]);
}
</code></pre>

<p>And it just works.</p>

<p>The problem is the definition of the <code>Encode::encode()</code> function. It has a prototype like this:</p>

<pre><code>sub encode($$;$)
</code></pre>

<p>So our <code>@_</code> is interpreted in scalar context, and so evaluates to the number of parameters, 1.</p>

<p>I don't like it at all because it changes the standard Perl behavior of expanding lists. Its action at the distance. The fact that you cannot pass a single element list is also not mentioned in the documentation.</p>

<p>The only really useful use of Perl prototypes is using a <code>&amp;</code> as the initial char, that allows you to write a function that looks like some built-ins like sort or map, that take a anonymous sub as the first parameter.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=HsJ58nkdx2E:rRJLnq9AdIM:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=HsJ58nkdx2E:rRJLnq9AdIM:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=HsJ58nkdx2E:rRJLnq9AdIM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=HsJ58nkdx2E:rRJLnq9AdIM:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/HsJ58nkdx2E" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">987@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-09-16T22:42:13+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/bitten_by_proto.html</feedburner:origLink></item>
<item>
<title>Stupidity</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/TKKMfs87BQM/stupidity.html</link>

<description>Just finished watching the first, and only, season of Firefly). I have only one question: who was the monster stupid that cancelled this show? What was he thinking?...</description>

<content:encoded><![CDATA[
<p>Just finished watching the first, and only, season of <a href="http://en.wikipedia.org/wiki/Firefly_(TV_series">Firefly</a>).</p>

<p>I have only one question: who was the monster stupid that cancelled this show? What was he thinking?</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=TKKMfs87BQM:WUOPPGn35wk:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=TKKMfs87BQM:WUOPPGn35wk:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=TKKMfs87BQM:WUOPPGn35wk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=TKKMfs87BQM:WUOPPGn35wk:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/TKKMfs87BQM" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">986@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2009-09-12T16:23:15+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/stupidity.html</feedburner:origLink></item>
<item>
<title>Log::Log4perl tip</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/QW8Qa97WWZE/loglog4perl_tip.html</link>

<description>I use Log::Log4perl for all my logging needs. Ok, I lie. I use a wrapper that deals with some stuff that I just don't like with Log::Log4perl, but that is a story for another day. One thing that we inherited from log4j was the notion that a message can match multiple loggers in your logging hierarchy. The logic is simple and explained in detail on a Log::Log4perl FAQ entry. If you write something like this in your logger configuration file: log4perl.logger.Cat = ERROR, Screen log4perl.logger.Cat.Subcat = WARN, Screen which define two loggers. Cat and Cat.Subcat, the second a subcategory of...</description>

<content:encoded><![CDATA[
<p>I use <a href="http://search.cpan.org/dist/Log-Log4perl/"><code>Log::Log4perl</code></a> for all my logging needs. Ok, I lie. I use a <a href="http://github.com/melo/mytk/blob/master/lib/MyTK/Logger.pm">wrapper that deals with some stuff that I just don't like with <code>Log::Log4perl</code></a>, but that is a story for another day.</p>

<p>One thing that we inherited from <a href="http://logging.apache.org/log4j/">log4j</a> was the notion that a message can match multiple loggers in your logging hierarchy.</p>

<p>The logic is simple and explained in detail on a <a href="http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#I_keep_getting_duplicate_log_messages!_What's_wrong?"><code>Log::Log4perl</code> FAQ entry</a>. If you write something like this in your logger configuration file:</p>

<pre><code>log4perl.logger.Cat        = ERROR, Screen
log4perl.logger.Cat.Subcat = WARN, Screen
</code></pre>

<p>which define two loggers. <code>Cat</code> and <code>Cat.Subcat</code>, the second a subcategory of the first, and then use:</p>

<pre><code>my $logger = get_logger("Cat.Subcat");
$logger-&gt;warn("Warning!");
</code></pre>

<p>you'll get a duplicate message in your log file because it matches both loggers.</p>

<p>I knew that and I always added a line saying:</p>

<pre><code>log4perl.additivity.Cat.Subcat = 0
</code></pre>

<p>that prevented this behavior, but this required a line like that per logger. Pain. Not lazy, at all.</p>

<p>But for some reason (stupidity comes to mind) I didn't read the FAQ completely, because at the end, there is a solution. Just put this in your logger configuration file:</p>

<pre><code>log4perl.oneMessagePerAppender = 1
</code></pre>

<p>Bliss, pure bliss.</p>

<p>Mind you that <code>oneMessagePerAppender</code> is not compatible with log4j, something that <code>Log::Log4perl</code> tries very hard to be, and therefore this feature is not documented at all except on this FAQ entry.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=QW8Qa97WWZE:bFbGIbZhS68:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=QW8Qa97WWZE:bFbGIbZhS68:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=QW8Qa97WWZE:bFbGIbZhS68:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=QW8Qa97WWZE:bFbGIbZhS68:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/QW8Qa97WWZE" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">985@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-09-10T11:51:35+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/loglog4perl_tip.html</feedburner:origLink></item>
<item>
<title>Problem solved</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/f854qBgq77w/problem_solved.html</link>

<description>I keep a pad of paper between me and my keyboard at all times. I used to take down notes, keep track of what I need to do today, small brain dumps, and random scribbles. But with my hands going about their bussiness, the corner of the paper starts to bend upwards. The solution is not rocket science. A simple paper clip. Problem solved....</description>

<content:encoded><![CDATA[
<p>I keep a pad of paper between me and my keyboard at all times. I used to take down notes, keep track of what I need to do today, small brain dumps, and random scribbles.</p>

<p>But with my hands going about their bussiness, the corner of the paper starts to bend upwards.</p>

<p><a href="http://www.flickr.com/photos/33449134@N00/3906616738" title="View 'Problem' on Flickr.com"><img src="http://farm3.static.flickr.com/2551/3906616738_078af35ca1.jpg" alt="Problem" border="0" width="500" height="375" /></a></p>

<p>The solution is not rocket science. A simple paper clip.</p>

<p><a href="http://www.flickr.com/photos/33449134@N00/3905836729" title="View 'Solved' on Flickr.com"><img src="http://farm3.static.flickr.com/2591/3905836729_b7cd855fd6.jpg" alt="Solved" border="0" width="500" height="341" /></a></p>

<p>Problem solved.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=f854qBgq77w:N5rTEIV4Xmo:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=f854qBgq77w:N5rTEIV4Xmo:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=f854qBgq77w:N5rTEIV4Xmo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=f854qBgq77w:N5rTEIV4Xmo:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/f854qBgq77w" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">984@http://www.simplicidade.org/notes/</guid>
<dc:subject>Tips, Hints &amp; Tricks</dc:subject>
<dc:date>2009-09-10T10:19:49+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/problem_solved.html</feedburner:origLink></item>
<item>
<title>Last chance to see</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/4JIM-Xlt9X8/last_chance_to.html</link>

<description>The book turns into a TV show. It might not have a comparison between riding a manta ray or riding a air-powered submersible thingie, but it shouldn't be too bad, given the two names associated with it....</description>

<content:encoded><![CDATA[
<p>The <a href="http://www.amazon.co.uk/Last-Chance-See-Douglas-Adams/dp/0330320025/ref=sr_1_3?ie=UTF8&amp;s=books&amp;qid=1252272927&amp;sr=8-3">book</a> turns into a <a href="http://www.stephenfry.com/2009/09/06/last-chance-to-see/">TV show</a>.</p>

<p>It might not have a comparison between riding a manta ray or riding a air-powered submersible thingie, but it shouldn't be too bad, given the two names associated with it.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=4JIM-Xlt9X8:l_Fze5YGIKA:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=4JIM-Xlt9X8:l_Fze5YGIKA:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=4JIM-Xlt9X8:l_Fze5YGIKA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=4JIM-Xlt9X8:l_Fze5YGIKA:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/4JIM-Xlt9X8" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">983@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2009-09-06T21:36:08+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/last_chance_to.html</feedburner:origLink></item>
<item>
<title>Bootstrap Perl</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/NwASbvlO9uk/bootstrap_perl.html</link>

<description>Whenever a new version of Perl is released, I install it in a separate directory and re-install all my modules into a new local::lib-powered directory. This takes a lot of time, but I had most of the process already in auto-pilot. But still it was a hack, so I decided to take the opportunity of the 5.10.1 release and make something more pretty and reliable. The result is my Perl bootstrap repo. There are two scripts. The first, bootstrap.sh, will install the local::lib module and prepare the environment. Its still not finished, it doesn't alter the .bashrc file, but it...</description>

<content:encoded><![CDATA[
<p>Whenever a new version of Perl is released, I install it in a separate directory and re-install all my modules into a new <a href="http://search.cpan.org/dist/local-lib/"><code>local::lib</code></a>-powered directory.</p>

<p>This takes a lot of time, but I had most of the process already in auto-pilot.</p>

<p>But still it was a hack, so I decided to take the opportunity of the 5.10.1 release and make something more pretty and reliable.</p>

<p>The result is <a href="http://github.com/melo/My-Perl-bootstrap/">my Perl bootstrap repo</a>.</p>

<p>There are two scripts. The first, <code>bootstrap.sh</code>, will install the <code>local::lib</code> module and prepare the environment. Its still not finished, it doesn't alter the <code>.bashrc</code> file, but it will get there.</p>

<p>The second, <code>install_deps.sh</code> will use the cpan shell to install a local <code>Task::Bootstrap</code> module. This <code>Task</code> has all the modules that I want installed.</p>

<p>There are still some problems. I still lack some distro prefs for a couple of them that pause the process and ask for user input. And some of the modules won't install without force (<code>Mac::Carbon</code> is the one that fails the most).</p>

<p>Other modules just don't install correctly on Mac OS X. <code>Danga::Socket</code> for example, requires <code>Sys::Syscall</code>, but this one fails the tests because Mac OS X lies about <code>sendfile</code> support: the <code>sys/syscalls.ph</code> includes the <code>SYS_sendfile</code> constant, but when you actually call it, we get a <code>Function not implemented</code>. I'm sure I could work around it, and probably fix it, but I no longer use <code>Danga::Socket</code> so I'll probably just remove that dependency.</p>

<p>The other was <code>Mac::AppleEvents::Simple</code>. Finder.app has a different naming scheme for its windows, and <code>t/simple.t</code> was failing. I've send a patch to the module RT Queue.</p>

<p>I still have small failures, but right now, I can mostly use this two scripts to setup a Perl environment from bare metal.</p>

<p><em>Update</em>: I removed my <code>~/.perl5/5.10.1/</code> directory and ran <code>time ./bootstrap.sh</code>. The results:</p>

<pre><code>real 56m4.598s
user 37m17.724s
sys  7m51.923s
</code></pre>

<p>So about an hour on a MacBook Pro 2.16Ghz Core Duo, running Leo.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=NwASbvlO9uk:hpy1_HStV-E:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=NwASbvlO9uk:hpy1_HStV-E:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=NwASbvlO9uk:hpy1_HStV-E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=NwASbvlO9uk:hpy1_HStV-E:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/NwASbvlO9uk" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">982@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-09-06T14:12:16+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/bootstrap_perl.html</feedburner:origLink></item>
<item>
<title>SAPO turns 14</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/IW8BIBmhEn8/sapo_turns_14.html</link>

<description>So 14 years ago a project was born in Aveiro. Just a couple of guys (there is a picture of them, but it was buried somewhere due to hair style issues), love for technology and an idea. Today the company has over 200 persons working there, keeps sharing their technology with us all, gives us access to a bunch of very cool APIs, and invites us to have fun from time to time. I was lucky enough to work there for a couple of years, and do hope to do it again sometime in the future, it was a lot...</description>

<content:encoded><![CDATA[
<p><a href="http://developers.blogs.sapo.pt/19900.html">So 14 years ago a project was born in Aveiro</a>. Just a couple of guys (there is a picture of them, but it was buried somewhere due to hair style issues), love for technology and an idea.</p>

<p>Today the company has over 200 persons working there, keeps <a href="http://softwarelivre.sapo.pt/">sharing their technology</a> with us all, gives us <a href="http://services.sapo.pt/">access to a bunch of very cool APIs</a>, and <a href="http://codebits.eu/">invites us to have fun from time to time</a>.</p>

<p>I was lucky enough to work there for a couple of years, and do hope to do it again sometime in the future, it was a lot of fun.</p>

<p>For now, a really big happy birthday to <a href="http://sapo.pt/">SAPO</a>.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=IW8BIBmhEn8:bk0wgTKmlJg:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=IW8BIBmhEn8:bk0wgTKmlJg:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=IW8BIBmhEn8:bk0wgTKmlJg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=IW8BIBmhEn8:bk0wgTKmlJg:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/IW8BIBmhEn8" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">981@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2009-09-04T11:43:28+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/09/sapo_turns_14.html</feedburner:origLink></item>
<item>
<title>When to upgrade to Snow Leopard</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/H1IsNrhdcT0/when_to_upgrade.html</link>

<description>This are the rules I use to do the upgrades between major versions of Mac OS X. You upgrade when: you have half-day of free time to do a clean install; all your must-have apps support the new version; any of your must-have apps requires the new version. I usually wait until the last item is true before doing the upgrade....</description>

<content:encoded><![CDATA[
<p>This are the rules I use to do the upgrades between major versions of Mac OS X.</p>

<p>You upgrade when:</p>

<ul>
<li>you have half-day of free time to do a clean install;</li>
<li>all your must-have apps support the new version;</li>
<li>any of your must-have apps requires the new version.</li>
</ul>

<p>I usually wait until the last item is true before doing the upgrade.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=H1IsNrhdcT0:WfZgnNBDmgc:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=H1IsNrhdcT0:WfZgnNBDmgc:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=H1IsNrhdcT0:WfZgnNBDmgc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=H1IsNrhdcT0:WfZgnNBDmgc:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/H1IsNrhdcT0" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">980@http://www.simplicidade.org/notes/</guid>
<dc:subject>Tips, Hints &amp; Tricks</dc:subject>
<dc:date>2009-08-30T14:28:20+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/08/when_to_upgrade.html</feedburner:origLink></item>
<item>
<title>Template systems</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/19fgA5Ch8Mg/template_system.html</link>

<description>I have a love/hate relationship with Template systems for quite some time. The following is a brain-dump about where I stand right now regarding which system to use in the E5 project. When I started using them at work (circa 1998 or 99) the goal was simple: separate programmers logic from the layout so that designers can tweak the templates without breaking the code. It was a simple and very worthwhile goal. And for the most part, it worked. You still need to coordinate which templates will be created, and how will the page be broken up into pieces to...</description>

<content:encoded><![CDATA[
<p>I have a love/hate relationship with Template systems for quite some time. The following is a brain-dump about where I stand right now regarding which system to use in the <a href="http://www.simplicidade.org/notes/archives/2009/08/start.html">E5</a> project.</p>

<p>When I started using them at work (circa 1998 or 99) the goal was simple: separate programmers logic from the layout so that designers can tweak the templates without breaking the code.</p>

<p>It was a simple and very worthwhile goal. And for the most part, it worked. You still need to coordinate which templates will be created, and how will the page be broken up into pieces to enable reuse of common parts, but it mostly worked.</p>

<p>The template systems where designed to be used by web designers, and given that those where accustomed to HTML tags, the more powerful template system that needed loops and decision constructs opted to create those with a simple syntax. The template systems became domain specific languages (DSL).</p>

<p>But, with the improvement of the HTML, CSS and JS capabilities, I don't know if the designers are still the target audience of template systems. As I split a set of HTML pages into a set of reusable templates, I try to create blocks that make sense in terms of caching, data-store life cycles, and other subtle factors that a web designer just doesn't care about. The page breakout is becoming a engineering exercise.</p>

<p>As programmers/engineers, we don't need the comfy world of a DSL. We want to work in the same language that we use to code. Templates are, at most, a small macro language that gets compiled into source code, in the same language that we have the rest of the system.</p>

<p>So I'm starting to move away from <a href="http://search.cpan.org/dist/Template-Toolkit/">Template Toolkit</a>, my preferred template system, into something that uses native Perl as the DSL. I don't know where I'll end up yet. I'm looking at <a href="http://search.cpan.org/dist/Tenjin/">Tenjin</a>, <a href="http://search.cpan.org/dist/Text-MicroMason/">Text::MicroMason</a>, and <a href="http://search.cpan.org/dist/Mojo/">Mojo::Template</a>. There aren't many template systems that use Perl as the control language, actually.</p>

<p>The first two should be the most stable ones, older ones. Tenjin is also the fastest template system I've tested, although speed wouldn't be a deal breaker.</p>

<h2>Controller-centric or View-centric render process</h2>

<p>But we can't judge template systems without considering where and how they will be used. In my case they will the
last step of a web request, handled by a web framework.</p>

<p>I'll use a BBC site page to illustrate my current dilemma, an article about <a href="http://news.bbc.co.uk/2/hi/technology/8220220.stm" title="BBC NEWS | Technology | Wikipedia to launch page controls">Wikipedia page controls</a>. Things of interest to me:</p>

<ul>
<li>the central part of the page is the main content, and directly related the the URL. This is the content that you came here to get. It has a lot of HTML before and after that are present to add value to the site (we hope), and provide exit destinations (the navigation and related stories);</li>
<li>the title of the page, early in the HTML, is also directly related to the URL and the story: this is important because the template system must support inside-out rendering (first the central part, and then the wrappers), or have all the information in memory before starting the render process;</li>
<li>some parts (the header, footer, and left-hand sidebar) are mostly static, and with low or no relation to the main content: in this case only the category of the article influences the navigation. It might also influence the related BBC sites;</li>
<li>the right-hand side shows related stories. The "related" part might be highly dynamic, or static per category or a mix in between. The related external links are probably part of the story.</li>
</ul>

<p>The path for a typical request (like  <code>/2/hi/technology/8220220.stm</code>) looks like this:</p>

<ol>
<li>collect all the important data from the URL: in this case the it seems to react to the <code>hi</code>/<code>low</code> part to pick the version of the master template, the category (controls the right-hand side column) and the article ID;</li>
<li>fetch the correct article and related informations (author, publish date, picture URL, caption...);</li>
<li>fetch the related articles for the right-hand sidebar;</li>
<li>call the view renderer with all of this.</li>
</ol>

<p>Pretty basic and straight forward. Steps 1, 2 and 4 don't pose to many questions, they are required on any pipeline I can think of.</p>

<p>But the proper way to do 3 is a matter of discussion. On one hand you can put enough information on the URL to decide what the right-hand sidebar needs and fetch it in with some calls inside the Controller (I'm assuming here a MVC-style framework). In this model the controller prepares everything that we need to display the page.</p>

<p>But this makes the view a bit inflexible because if we need to had another box the top or bottom of the page, we would need to tweak the controller code.</p>

<p>On the other hand if our template system is powerful enough, we can have a small API that we can call back into Perl land, and have these little reusable boxes generated for us. The view controls the entire process of display.</p>

<p>The advantage of having a decent view system, even a object oriented view framework, is the extensibility that you get. Imagine a Moose-based template system: view are classes that you can extend, override, add before and after processing. Rendering is just creating an instance and calling a small method, <code>as_string()</code> or even <code>stream_to_socket()</code>.</p>

<p>A system that brings the full power of Perl to the template world is <a href="http://search.cpan.org/dist/Template-Declare/">Template::Declare</a>. It treats templates as classes that you can subclass and extend. It seems very similar to what I like but I have zero experience with it so far.</p>

<p>No decisions have been made yet. I need to evaluate Template::Declare and see if it really fits my brain.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=19fgA5Ch8Mg:IVT3enVVjC4:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=19fgA5Ch8Mg:IVT3enVVjC4:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=19fgA5Ch8Mg:IVT3enVVjC4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=19fgA5Ch8Mg:IVT3enVVjC4:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/19fgA5Ch8Mg" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">979@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-08-25T17:22:22+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/08/template_system.html</feedburner:origLink></item>
<item>
<title>Start</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/BC3KV4i4vag/start.html</link>

<description> A beginning is the time for taking the most delicate care that the balances are correct. from Manual of Muad'Dib by the Princess Irulan extracted from Dune, by Frank Herbert In the next weeks I'll be publishing a series of articles about a new project that I'm starting. Actually, I started this project once already, but I didn't like the path it was taking, so I'm restarting it. The new system will replace the current EVOLUI.COM code base. Why rewrite a system that is in production for 8/9 years and that works reasonably well? There are several reasons actually....</description>

<content:encoded><![CDATA[
<blockquote>
  <p>A beginning is the time for taking the most delicate care that the balances are correct.</p>
  
  <blockquote>
    <p>from <em>Manual of Muad'Dib</em> by the Princess Irulan</p>
    
    <p>extracted from <em>Dune</em>, by Frank Herbert</p>
  </blockquote>
</blockquote>

<p>In the next weeks I'll be publishing a series of articles about a new project that I'm starting. Actually, I started this project once already, but I didn't like the path it was taking, so I'm restarting it.</p>

<p>The new system will replace the current <a href="http://evolui.com/">EVOLUI.COM</a> code base. Why rewrite a system that is in production for 8/9 years and that works reasonably well? There are several reasons actually.</p>

<p>The first reason is code rot: the current system is spread across 3 code bases (called internally E1 through E3). E1 was the first stab (who would guess, right?), and grew organically inside the company, without much planning, and coded by several programmers. E2 added a better management interface, and E3 added a new LMS and forum system.</p>

<p>A lot has changed in the last 8 years. And my inexperience in certain topics shows by the lack of proper tests and documentation. Also, it has grown to 850 Perl packages. Yes, eight hundred and fifty packages. I expect that more than half of those are no longer in active use.</p>

<p>The second, and more important reason, is that the new business requirements require a deep restructuring of the code, but given that we don't have a decent test suite, it would be madness to change stuff in one of those 850 packages.</p>

<p>The way I see it, I can write the new system properly, using a test-driven methodology, making sure that all the business logic is properly tested.</p>

<p>I'm not starting from scratch, I plan to reuse certain small but critical parts of the old system, but going over them to add tests and documentation.</p>

<p>The failed attempt was called E4, so this new version will be called E5.</p>

<p>I plan to cover the following topics (not sure of the order yet):</p>

<ul>
<li>source control, and ticketing systems;</li>
<li>project directory layout;</li>
<li>documentation techniques;</li>
<li>business layer techniques;</li>
<li>databases used and ORM layers;</li>
<li>web frameworks;</li>
<li>template systems;</li>
<li>logging;</li>
<li>smoke testing;</li>
<li>deployment.</li>
</ul>

<p>Hope you enjoy the ride.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=BC3KV4i4vag:27SiWCXNpgM:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=BC3KV4i4vag:27SiWCXNpgM:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=BC3KV4i4vag:27SiWCXNpgM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=BC3KV4i4vag:27SiWCXNpgM:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/BC3KV4i4vag" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">978@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-08-21T17:04:50+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/08/start.html</feedburner:origLink></item>
<item>
<title>Perfect day for walking</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/UrLIlXYQyAg/perfect_day_for.html</link>

<description>Today the sky was blue, without a single cloud. The kind of day that turns this little town into a small oven. But at the place where I usually do my mid-day walk, near the see, there was a strong wind, blowing from north-west. Just perfect to stretch the legs, listening to some music. Must find some time to go back there today....</description>

<content:encoded><![CDATA[
<p>Today the sky was blue, without a single cloud. The kind of day that turns this little town into a small oven.</p>

<p>But at the place where I usually do my mid-day walk, near the see, there was a strong wind, blowing from north-west.</p>

<p>Just perfect to stretch the legs, listening to some music. Must find some time to go back there today.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UrLIlXYQyAg:4I9W7iwLOwY:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=UrLIlXYQyAg:4I9W7iwLOwY:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UrLIlXYQyAg:4I9W7iwLOwY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UrLIlXYQyAg:4I9W7iwLOwY:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/UrLIlXYQyAg" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">977@http://www.simplicidade.org/notes/</guid>
<dc:subject>Life</dc:subject>
<dc:date>2009-08-21T15:53:56+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/08/perfect_day_for.html</feedburner:origLink></item>
<item>
<title>It lives...</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/4YkDMzI0bWA/it_lives.html</link>

<description>The biggest advantage of having my own business with my wife, and having a site that uses laziness as a design principle (everything should be automated) is the possibility of taking about 8 weeks of cool-down time with the kids. Thats what just happened around here, and I'm slowly returning to work....</description>

<content:encoded><![CDATA[
<p>The biggest advantage of having my own business with my wife, and having a site that uses laziness as a design principle (everything should be automated) is the possibility of taking about 8 weeks of cool-down time with the kids.</p>

<p>Thats what just happened around here, and I'm slowly returning to work.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=4YkDMzI0bWA:9H64oAcgyxM:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=4YkDMzI0bWA:9H64oAcgyxM:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=4YkDMzI0bWA:9H64oAcgyxM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=4YkDMzI0bWA:9H64oAcgyxM:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/4YkDMzI0bWA" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">976@http://www.simplicidade.org/notes/</guid>
<dc:subject>Life</dc:subject>
<dc:date>2009-08-21T15:49:09+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/08/it_lives.html</feedburner:origLink></item>
<item>
<title>Parrot</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/UXKDyzXd9eE/parrot.html</link>

<description>Excellent article about Parrot, by Allison Randal. Parrot’s record for a language implementation was a conference session where the speaker implemented the basics of the LOLCODE language from scratch as a live demonstration. It was a 5-minute lighting talk. I have to get the time to implement a DSL for something on top of Parrot, to see how it works. Right now I only compile Parrot to run Rakudo....</description>

<content:encoded><![CDATA[
<p><a href="http://www.linux-mag.com/id/7373">Excellent article about Parrot</a>, by Allison Randal.</p>

<blockquote>
  <p>Parrot’s record for a language implementation was a conference session where the speaker implemented the basics of the LOLCODE language from scratch as a live demonstration. It was a 5-minute lighting talk.</p>
</blockquote>

<p>I have to get the time to implement a DSL for something on top of <a href="http://www.parrot.org/">Parrot</a>, to see how it works. Right now I only compile Parrot to run <a href="http://rakudo.org/">Rakudo</a>.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UXKDyzXd9eE:gnkrhNOg9RY:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=UXKDyzXd9eE:gnkrhNOg9RY:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UXKDyzXd9eE:gnkrhNOg9RY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UXKDyzXd9eE:gnkrhNOg9RY:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/UXKDyzXd9eE" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">975@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2009-06-18T14:57:49+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/06/parrot.html</feedburner:origLink></item>
<item>
<title>Where to put you validation</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/sWs9Bhyt_S0/where_to_put_yo.html</link>

<description>Yesterday I saw a question by fREW Schmidt regarding where to place the validation code in your apps. I made a mental note to answer it, but as most of my mental notes, it was quickly forgotten. Today, a new article describes the answer he got. In the end he decided to put the validation inside the model. I can only say: good for you. But one of the reasons against the validation-inside-the-model that he received baffled me: Models don’t know about the current user (or other higher level information). If your models don't know who is the person authenticated...</description>

<content:encoded><![CDATA[
<p>Yesterday I saw a question by <a href="http://blog.afoolishmanifesto.com/">fREW Schmidt</a> regarding <a href="http://blog.afoolishmanifesto.com/archives/819">where to place the validation code in your apps</a>. I made a mental note to answer it, but as most of my mental notes, it was quickly forgotten.</p>

<p>Today, a <a href="http://blog.afoolishmanifesto.com/archives/828">new article describes the answer he got</a>. In the end he decided to put the validation inside the model. I can only say: good for you.</p>

<p>But one of the reasons against the validation-inside-the-model that he received baffled me: Models don’t know about the current user (or other higher level information).</p>

<p>If your models don't know who is the person authenticated (and please read <a href="http://www.blogger.com/profile/03975438115490089158">Yuval</a> <a href="http://blog.woobling.org/2009/06/users-accounts-identities-and-roles.html">article about modelling identity</a> to understand how complex it can become), then you are doing it wrong.</p>

<p>Models must know who is the authenticated user. They must know it because that is the only sane way to implement authorization inside your methods, and to generate a audit log of operations.</p>

<p>What I usually do is to create a Session class. For each request (be it Catalyst request, incoming email message, or XMPP request), I create a new Session instance initialized with the current user information plus some tidbits like channel (Web, email, XMPP) and IP address (if available).</p>

<p>Then all accesses to my API are either via the session object (create methods to access most important parts of your API), or by passing this session object to the API you are calling.</p>

<p>You should also use your Session as the access point to your logging and auditing capabilities.</p>

<p>The article mentions other issues like error messages. I haven't add the necessity of developing an application with multiple language support yet, but I think that the current throw-exception-objects strategy, with all the information (including the authorized user to figure our preferred language) will be able to deal with the problems that I can think of now.</p>

<p>In the end, I'm actually really curious about why would people think that putting your validation code in the controllers is a good idea.</p>

<p><em>Update:</em> a lot of stuff in the comments if you care about this topic.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=sWs9Bhyt_S0:hKA7n19VwLo:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=sWs9Bhyt_S0:hKA7n19VwLo:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=sWs9Bhyt_S0:hKA7n19VwLo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=sWs9Bhyt_S0:hKA7n19VwLo:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/sWs9Bhyt_S0" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">974@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-06-18T14:20:32+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/06/where_to_put_yo.html</feedburner:origLink></item>
<item>
<title>Hardware relax</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/dPiGpFSAg_I/hardware_relax.html</link>

<description>I like to tinker with hardware, specially old servers. I spent an hour upgrading our office server this morning. In a world of Ghz speeds, be prepared to slow down a little. The server was a dual-pIII (yes, Pentium III, Katmai generation) at 450Mhz (yes, mega) with 512Mb RAM (at 100Mhz, in 4 DIMMs). The upgrade replaced the CPUs with a pair of pIII 500Mhz (a 11% increase, not bad), and the memory to 1Gb at 100Mhz. Basically thats the best you can hope for with this Intel N440BX (aka Intel Nightshade) board. I don't have the full specs for...</description>

<content:encoded><![CDATA[
<p>I like to tinker with hardware, specially old servers.</p>

<p>I spent an hour upgrading our office server this morning. In a world of Ghz speeds, be prepared to slow down a little.</p>

<p>The server was a dual-pIII (yes, <a href="http://en.wikipedia.org/wiki/Pentium_III">Pentium III</a>, <a href="http://en.wikipedia.org/wiki/Pentium_III#Katmai">Katmai generation</a>) at 450Mhz (yes, <em>mega</em>) with 512Mb RAM (at 100Mhz, in 4 DIMMs). The upgrade replaced the CPUs with a pair of pIII 500Mhz (a 11% increase, not bad), and the memory to 1Gb at 100Mhz. Basically thats the <a href="http://download.intel.com/support/motherboards/server/n440bx/243701_002.pdf">best you can hope for</a> with this <a href="http://www.intel.com/support/motherboards/server/N440BX/">Intel N440BX</a> (aka Intel Nightshade) board.</p>

<p>I don't have the full specs for either of them but I would guess that the CPU inside the new <a href="http://www.apple.com/iphone/">iPhone 3GS</a> is a little faster than the <em>pair</em> of pIII I'm using.</p>

<p>The obligatory <a href="http://www.flickr.com/photos/melo/sets/72157619678855276/">Flickr set for enthusiasts of old hardware porn</a>.</p>

<p>I also uploaded a <a href="http://vimeo.com/5138602">small video showing the hardware boot up</a>, but had to use <a href="http://vimeo.com/">Vimeo</a> because <a href="http://www.flickr.com/">Flickr</a> limits video uploads to 90 seconds, and this server takes a bit more than that just counting the RAM...</p>

<p>I bought this server in 1999, to power the NFS server for the first launch of the <a href="http://mail.pt/">mail.pt</a> service. It was handed down through the times, from company to company, until it belonged to me after the demise of Prodigio. At the time it used two Mylex SCSI RAID controllers (I still have them, one of them in production) with 4 x 9Gb SCSI hard drives on each.</p>

<p>I have a quote for a €390 upgrade to a Core 2 Quad 2.8 Ghz with 8Gb RAM. I plan to do this sometime next month. But this old office server will not die. It will power a smoke server to test <a href="http://www.perl.org/">Perl</a> modules with several releases of <a href="http://www.freebsd.org/">FreeBSD</a>.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=dPiGpFSAg_I:CCQ17bv2SqU:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=dPiGpFSAg_I:CCQ17bv2SqU:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=dPiGpFSAg_I:CCQ17bv2SqU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=dPiGpFSAg_I:CCQ17bv2SqU:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/dPiGpFSAg_I" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">973@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2009-06-13T11:56:16+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/06/hardware_relax.html</feedburner:origLink></item>
<item>
<title>Puzzles</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/ORcRDfnlXTo/puzzles.html</link>

<description>Another puzzle by the Bram Cohen (the same who created BitTorrent) and Oskar van Deventer: the Geary cube. Some of their previous puzzles are very interesting like the JumblePrism or my two favorites, the RotaCubes and the Bramboules. Oscar van Deventer creates stranger things: the WimTvane or the Topsy Turvy are just two examples He also has a beautiful adding machine for kids. I like puzzles. Puzzles good....</description>

<content:encoded><![CDATA[
<p>Another puzzle by the <a href="http://bramcohen.livejournal.com/">Bram Cohen</a> (the same who created <a href="http://bittorrent.org/">BitTorrent</a>) and Oskar van Deventer: the <a href="http://www.youtube.com/watch?v=cf2OnAKUuZg">Geary cube</a>.</p>

<p>Some of their previous puzzles are very interesting like the <a href="http://www.youtube.com/watch?v=MFO5mnJCzWg">JumblePrism</a> or my two favorites, the <a href="http://www.youtube.com/watch?v=sLlLg6erIg0">RotaCubes</a> and the <a href="http://www.youtube.com/watch?v=V31NBbyzJVw">Bramboules</a>.</p>

<p>Oscar van Deventer creates stranger things: the <a href="http://www.youtube.com/watch?v=W8bPxpF35g8">WimTvane</a> or the <a href="http://www.youtube.com/watch?v=H8ZcYvU0sLY">Topsy Turvy</a> are just two examples</p>

<p>He also has a <a href="http://www.youtube.com/watch?v=2htm9C6DBd0">beautiful adding machine for kids</a>.</p>

<p>I like puzzles. Puzzles good.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ORcRDfnlXTo:kaJiM7hT1ao:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=ORcRDfnlXTo:kaJiM7hT1ao:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ORcRDfnlXTo:kaJiM7hT1ao:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ORcRDfnlXTo:kaJiM7hT1ao:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/ORcRDfnlXTo" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">972@http://www.simplicidade.org/notes/</guid>
<dc:subject>Fun</dc:subject>
<dc:date>2009-05-29T07:27:47+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/puzzles.html</feedburner:origLink></item>
<item>
<title>PGP WDE update</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/82MAhl6dANo/pgp_wde_update.html</link>

<description>I mentioned last week that I had started using PGP Whole Disk Encryption on my laptop (a first generation MacBook Pro 17" btw, it has a 32bit 2.16Ghz Core Duo with 2Gb RAM). I encrypted the external FW800 500Gb hard disk that I use exclusively for Time Machine last night. It took about 8 hours. So far so good. When I connect it to my mac, a PGP WDE dialog pop-up shows up, asking me for the correct pass-phrase. After I enter it, it shows up as a Time Machine external disk, and the backup starts. Be aware that, in...</description>

<content:encoded><![CDATA[
<p>I mentioned last week that <a href="http://www.simplicidade.org/notes/archives/2009/05/security.html">I had started using PGP Whole Disk Encryption on my laptop</a> (a first generation MacBook Pro 17" btw, it has a 32bit 2.16Ghz Core Duo with 2Gb RAM).</p>

<p>I encrypted the external FW800 500Gb hard disk that I use exclusively for Time Machine last night. It took about 8 hours. So far so good.</p>

<p>When I connect it to my mac, a <a href="http://www.pgp.com/products/wholediskencryption/">PGP WDE</a> dialog pop-up shows up, asking me for the correct pass-phrase. After I enter it, it shows up as a Time Machine external disk, and the backup starts.</p>

<p>Be aware that, in case of hard disk disasters, encrypting your TM disk can be more awkward than encrypting your internal hard drive.</p>

<p>With a normal non-encripted TM drive, you can boot your Mac from a Leopard DVD, and ask the Installer to restore a TM backup directly.</p>

<p>If you encrypt you TM disk, thats no longer an option. You have to install a bare bones system, install PGP WDE, and then restore the TM backup.</p>

<p>A possible solution (untested for now) is to have a clone of your internal hard drive (even an encrypted clone should work) that you update from time to time. Then you should be able to boot from the clone and restore a TM backup to the internal disk.</p>

<p>As I said, I  haven't tried this yet. It <em>should</em> work, I don't see any reason not to.</p>

<p>I do have a clone of my internal hard drive, thats the next one to encrypt. I'll check to see if he is still bootable afterwards, and I'll try to find an extra disk somewhere to restore a TM backup.</p>

<p>I'm really happy with PGP WDE, works great, no surprises so far.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=82MAhl6dANo:vcAcFVif9tk:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=82MAhl6dANo:vcAcFVif9tk:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=82MAhl6dANo:vcAcFVif9tk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=82MAhl6dANo:vcAcFVif9tk:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/82MAhl6dANo" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">971@http://www.simplicidade.org/notes/</guid>
<dc:subject>Tips, Hints &amp; Tricks</dc:subject>
<dc:date>2009-05-28T22:34:07+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/pgp_wde_update.html</feedburner:origLink></item>
<item>
<title>XMPP Waves</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/D5dzpmCK50k/xmpp_waves.html</link>

<description>Google kettle let go a cloud of vapor and named it Wave. Of course we cannot know how it works and how similar it is to Drop.io. Until we do know more about it, we can look through the Wave protocol draft spec, and notice that its built on top of XMPP. At the same event, the new XMPP-powered mini applications where also announced. Each one is a XML file with all the HTML, CSS, and JS files packed together. Time to see how long it will take a XMPP desktop client with access to a WebKit view to implement...</description>

<content:encoded><![CDATA[
<p>Google kettle let go a cloud of vapor and named it <a href="http://wave.google.com/">Wave</a>. Of course we cannot know how it works and how similar it is to <a href="http://drop.io/">Drop.io</a>.</p>

<p>Until we do know more about it, we can look through <a href="http://www.waveprotocol.org/draft-protocol-spec">the Wave protocol draft spec</a>, and notice that its built on top of <a href="http://xmpp.org/">XMPP</a>.</p>

<p>At the same event, the new <a href="http://googletalk.blogspot.com/2009/05/attention-nerds-new-gadgets-api-for.html">XMPP-powered mini applications</a> where also announced. Each one is a XML file with all the HTML, CSS, and JS files packed together. Time to see how long it will take a XMPP desktop client with access to a WebKit view to implement this extension. It reminds me all the discussions about embedded applications we had in the API mailing list last year.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=D5dzpmCK50k:wBoifuOTFqg:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=D5dzpmCK50k:wBoifuOTFqg:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=D5dzpmCK50k:wBoifuOTFqg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=D5dzpmCK50k:wBoifuOTFqg:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/D5dzpmCK50k" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">970@http://www.simplicidade.org/notes/</guid>
<dc:subject>XMPP</dc:subject>
<dc:date>2009-05-28T22:32:08+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/xmpp_waves.html</feedburner:origLink></item>
<item>
<title>Mercurial Plugin to use Git servers</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/O4ibqIv85EE/mercurial_plugi.html</link>

<description>The Github gang developed a Mercurial plugin, hg-git, that allows Mercurial users to push/pull from Git servers. It seems very good (I'm not a Hg user, so I don't really know). Lossless bi-directional synchronization. Nice....</description>

<content:encoded><![CDATA[
<p>The <a href="http://github.com/">Github</a> gang <a href="http://github.com/blog/439-hg-git-mercurial-plugin">developed a Mercurial plugin</a>, <a href="http://hg-git.github.com/">hg-git</a>, that allows <a href="http://www.selenic.com/mercurial/">Mercurial</a> users to push/pull from <a href="http://git-scm.com/">Git</a> servers.</p>

<p>It seems very good (I'm not a Hg user, so I don't really know). Lossless bi-directional synchronization.</p>

<p>Nice.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=O4ibqIv85EE:P3tV4e8l6LA:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=O4ibqIv85EE:P3tV4e8l6LA:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=O4ibqIv85EE:P3tV4e8l6LA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=O4ibqIv85EE:P3tV4e8l6LA:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/O4ibqIv85EE" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">969@http://www.simplicidade.org/notes/</guid>
<dc:subject>Tips, Hints &amp; Tricks</dc:subject>
<dc:date>2009-05-28T07:03:04+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/mercurial_plugi.html</feedburner:origLink></item>
<item>
<title>Nice</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/ufpYza6euww/nice.html</link>

<description>An article about immutable data structures (which is an excellent read in itself) has two interesting paragraphs about Git: Casual observers initially criticised git for having a model so simple it was actually naive. It turns out they were confusing the model with its on disk representation. Git makes this distinction very well, and the result is that it implements powerful features (for instance idempotent patch application) which are apparently too complicated in other systems. Git itself isn't simple at all, the problem of version control is a complicated one so any system dealing with it is inherently complex. Git's...</description>

<content:encoded><![CDATA[
<p>An <a href="http://blog.woobling.org/2009/05/immutable-data-structures.html">article about immutable data structures</a> (which is an excellent read in itself) has two interesting paragraphs about Git:</p>

<blockquote>
  <p>Casual observers initially criticised git for having a model so simple it was actually naive. It turns out they were confusing the model with its on disk representation. <a href="http://repo.or.cz/w/git.git?a=blob;f=Documentation/technical/pack-heuristics.txt;hb=HEAD">Git makes this distinction very well</a>, and the result is that it implements powerful features (for instance idempotent patch application) which are apparently too complicated in other systems. Git itself isn't simple at all, the problem of version control is a complicated one so any system dealing with it is inherently complex. Git's advantage is that it's built on a very simple and future proof core, allowing the complex parts to evolve more easily.</p>
</blockquote>

<p>A very nice way to put it, <a href="http://nothingmuch.woobling.org/">Yuval</a>.</p>

<p>I've linked this excerpt differently. The linked Git documentation file is well worth a read, if you care about why git turned out as it did. Not that much interesting for day-to-day usage though.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ufpYza6euww:zZuv6kvPqto:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=ufpYza6euww:zZuv6kvPqto:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ufpYza6euww:zZuv6kvPqto:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=ufpYza6euww:zZuv6kvPqto:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/ufpYza6euww" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">968@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2009-05-24T06:51:30+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/nice.html</feedburner:origLink></item>
<item>
<title>Psi with voice calls</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/CyCvqZOK2bs/psi_with_voice.html</link>

<description>The first release candidate of the 0.13 version of Psi was released just now, and it includes voice calls using Jingle RTP. I'll keep it running in case you need a guinea pig for tests. Very good news....</description>

<content:encoded><![CDATA[
<p>The <a href="http://delta.affinix.com/2009/05/23/psi-013-rc1-released/">first release candidate of the 0.13 version of Psi was released just now</a>, and it includes voice calls using <a href="http://xmpp.org/extensions/xep-0167.html">Jingle RTP</a>.</p>

<p>I'll keep it running in case you need a guinea pig for tests.</p>

<p>Very good news.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=CyCvqZOK2bs:yJ2PwyYKjQk:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=CyCvqZOK2bs:yJ2PwyYKjQk:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=CyCvqZOK2bs:yJ2PwyYKjQk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=CyCvqZOK2bs:yJ2PwyYKjQk:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/CyCvqZOK2bs" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">967@http://www.simplicidade.org/notes/</guid>
<dc:subject>XMPP</dc:subject>
<dc:date>2009-05-24T06:33:48+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/psi_with_voice.html</feedburner:origLink></item>
<item>
<title>local::lib bootstrap</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/_zpBK8_kZ8c/locallib_bootst.html</link>

<description>The local::lib module is an essential piece of my workflow nowadays. It allows me to easily keep each project Perl modules separate, and therefore minimize breakage. Bootstrapping local::lib was reasonably simple but it got a lot simpler with the latest 1.004001 version. Basically you can just pipe the output of a URL into perl to bootstrap it. The URL is some long beast in the cpansearch.perl.org site, impossible for me to memorize, so I created a shorter version, http:://bit.ly/local-lib. To bootstrap local::lib you now can: wget -O- http://bit.ly/local-lib | TARGET=target_dir perl or if you are a curl user: curl -L...</description>

<content:encoded><![CDATA[
<p>The <a href="http://search.cpan.org/dist/local-lib/"><code>local::lib</code></a> module is an essential piece of my workflow nowadays. It allows me to easily keep each project Perl modules separate, and therefore minimize breakage.</p>

<p>Bootstrapping <code>local::lib</code> was reasonably simple but it <a href="http://www.opensourcery.com/blog/hans-dieter-pearcey/locallib-followup-now-easy-bootstrapping">got a lot simpler with the latest 1.004001 version</a>. Basically you can just pipe the output of a URL into <code>perl</code> to bootstrap it.</p>

<p>The URL is <a href="http://cpansearch.perl.org/src/APEIRON/local-lib-1.004001/eg/scripted_install.pl">some long beast in the <code>cpansearch.perl.org</code> site</a>, impossible for me to memorize, so I created a shorter version, <a href="http:://bit.ly/local-lib">http:://bit.ly/local-lib</a>. To bootstrap <code>local::lib</code> you now can:</p>

<pre><code>wget -O- http://bit.ly/local-lib | TARGET=target_dir perl
</code></pre>

<p>or if you are a <code>curl</code> user:</p>

<pre><code>curl -L http://bit.ly/local-lib | TARGET=target_dir perl
</code></pre>

<p>I wish I didn't have to specify the <code>TARGET</code> environment. It should assume, like the previous bootstrap process, <code>~/perl5</code>. I'll whip up a patch tomorrow.</p>

<p>There is no permalink to the latest version of the bootstrap script, so until I can find a way to alter the destination URL, we are stuck with the current version of it. I do hope a more definitive URL shows up, like the suggested <a href="http://install.local-lib.pl/">http://install.local-lib.pl/</a>.</p>

<p>The process worked fine for me in a couple of servers around here, but it is not a complete bootstrap. This process installs the <code>local::lib</code> module but doesn't adjust your shell configuration to make the settings stick.</p>

<p>So after you need to run this:</p>

<pre><code>TARGET=perl6 echo "eval  \$(perl -I$TARGET/lib/perl5 \
    -Mlocal::lib)" &gt;&gt;~/.bashrc
</code></pre>

<p>(see the <a href="http://search.cpan.org/dist/local-lib/lib/local/lib.pm#SYNOPSIS"><code>local::lib</code> bootstraping section</a> for <code>csh</code> instructions)</p>

<p>Its an excellent service, and it can only get better.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_zpBK8_kZ8c:z-_mlrReVDU:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=_zpBK8_kZ8c:z-_mlrReVDU:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_zpBK8_kZ8c:z-_mlrReVDU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_zpBK8_kZ8c:z-_mlrReVDU:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/_zpBK8_kZ8c" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">966@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-05-23T07:31:45+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/locallib_bootst.html</feedburner:origLink></item>
<item>
<title>You are a terrorist</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/INm8mPwg_yc/you_are_a_terro.html</link>

<description>Coming soon to a EU country near you......</description>

<content:encoded><![CDATA[
<p><a href="http://vimeo.com/4632310">Coming soon to a EU country near you...</a></p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=INm8mPwg_yc:mnzjElC4NEg:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=INm8mPwg_yc:mnzjElC4NEg:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=INm8mPwg_yc:mnzjElC4NEg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=INm8mPwg_yc:mnzjElC4NEg:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/INm8mPwg_yc" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">965@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2009-05-23T07:31:12+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/you_are_a_terro.html</feedburner:origLink></item>
<item>
<title>38</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/21FfTHnESWk/38.html</link>

<description>One down, a lot more to go. Or so I hope......</description>

<content:encoded><![CDATA[
<p>One down, a lot more to go. Or so I hope...</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=21FfTHnESWk:GjosJIPnU94:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=21FfTHnESWk:GjosJIPnU94:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=21FfTHnESWk:GjosJIPnU94:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=21FfTHnESWk:GjosJIPnU94:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/21FfTHnESWk" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">964@http://www.simplicidade.org/notes/</guid>
<dc:subject>Life</dc:subject>
<dc:date>2009-05-23T06:20:51+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/38.html</feedburner:origLink></item>
<item>
<title>Pig farming is... strange</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/UilwB38bN6I/pig_farming_is.html</link>

<description>I love TED presentations, and I was curious about one of the latest ones: 10 things you didn't know about orgasm by Mary Roach. The presentation is very good, but starting around 10m25s there is a sequence about pig farming in the Netherlands that make me laugh out loud. Weird stuff. Update: well, chickens are even worse (PDF)......</description>

<content:encoded><![CDATA[
<p>I love <a href="http://www.ted.com/">TED</a> presentations, and I was curious about one of the latest ones: <a href="http://www.ted.com/index.php/talks/lang/eng/mary_roach_10_things_you_didn_t_know_about_orgasm.html">10 things you didn't know about orgasm</a> by <a href="http://www.ted.com/index.php/speakers/mary_roach.html">Mary Roach</a>.</p>

<p>The presentation is very good, but starting around 10m25s there is a sequence about pig farming in the Netherlands that make me laugh out loud.</p>

<p>Weird stuff.</p>

<p><em>Update:</em> well, <a href="http://www.youtube.com/watch?v=yL_-1d9OSdk">chickens are even worse</a> (<a href="http://improbable.com/pages/airchives/paperair/volume12/v12i5/chicken-12-5.pdf">PDF</a>)...</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UilwB38bN6I:bpjraux09WM:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=UilwB38bN6I:bpjraux09WM:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UilwB38bN6I:bpjraux09WM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=UilwB38bN6I:bpjraux09WM:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/UilwB38bN6I" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">963@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2009-05-23T00:01:49+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/pig_farming_is.html</feedburner:origLink></item>
<item>
<title>Offline</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/_TOEu_LrX5E/offline.html</link>

<description>For the past week or so, I've kept myself without network access for the larger part of each day. I check my email and RSS feeds early in the morning and late at night, just before bed, and keep my IM and IRC clients closed. I needed to take a break, really. I found myself in the worst productivity slump ever, and something had to change. I have lot of work piled up that I really want to get done: update the AnyEvent::Mojo module to support the latest Mojo developments, most notably support for pipelining commands; try out the Protocol::OpenID...</description>

<content:encoded><![CDATA[
<p>For the past week or so, I've kept myself without network access for the larger part of each day.</p>

<p>I check my email and RSS feeds early in the morning and late at night, just before bed, and keep my IM and IRC clients closed.</p>

<p>I needed to take a break, really. I found myself in the worst productivity slump ever, and something had to change.</p>

<p>I have lot of work piled up that I really want to get done:</p>

<ul>
<li>update the <a href="http://search.cpan.org/dist/AnyEvent-Mojo/">AnyEvent::Mojo</a> module to support the latest <a href="http://search.cpan.org/dist/Mojo/">Mojo</a> developments, most notably support for pipelining commands;</li>
<li>try out the <a href="http://github.com/vti/protocol-openid/">Protocol::OpenID</a> module that vti is writing: I promised him a <code>AnyEvent::Mojo</code>-based implementation;</li>
<li>finish the XMPP Radar application;</li>
<li>read through the new <a href="http://search.cpan.org/dist/AnyEvent-XMPP/">AnyEvent::XMPP</a> branch that Robin has been working on: it looks <em>significantly</em> better and more developer-friendly than the current one;</li>
<li>play around with real-time peer-to-peer synchronization of JSON-based documents: mostly a prototype to wrap my head around the problems of adding real-time replication to <a href="http://syncwith.us/">Prophet</a>.</li>
</ul>

<p>Thats the top 4, and I'm not even including $work stuff. On that side of things, I'm considering switching parts of <a href="http://search.cpan.org/dist/DBIx-Class/">DBIx::Class</a>-based that I have (and don't particularly like, and in need of some feature-upgrades) to <a href="http://www.iinteractive.com/kiokudb/">KiokuDB</a>. That's probably the top item.</p>

<p>So far, working offline is paying off. I'm clearly more productive and I'm slowly getting myself out of the hole. I wonder how long I'll keep myself sane this way...</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_TOEu_LrX5E:iabbl1HQfrw:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=_TOEu_LrX5E:iabbl1HQfrw:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_TOEu_LrX5E:iabbl1HQfrw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=_TOEu_LrX5E:iabbl1HQfrw:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/_TOEu_LrX5E" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">962@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2009-05-22T06:15:47+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/offline.html</feedburner:origLink></item>
<item>
<title>Security</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/bPo0XZKcOaA/security.html</link>

<description>One recurrent worry that I had was about my laptop security. At least once a week I get an email from a local portuguese Mac-zine about stolen Macbooks. When I got them, my first thought was always: if that happened to me, my $bussiness is screwed... So a couple months ago I started looking around for options to secure my two macs (desktop and laptop) and their Time Machine backup drives against physical theft. I bought a copy of PGP Whole Disk Encryption and I'm using it on my laptop. On day-to-day usage, you just don't notice the overhead. I...</description>

<content:encoded><![CDATA[
<p>One recurrent worry that I had was about my laptop security. At least once a week I get an email from a local portuguese Mac-zine about stolen Macbooks. When I got them, my first thought was always: if that happened to me, my $bussiness is screwed...</p>

<p>So a couple months ago I started looking around for options to secure my two macs (desktop and laptop) and their Time Machine backup drives against physical theft.</p>

<p>I bought a copy of <a href="http://www.pgp.com/products/wholediskencryption/">PGP Whole Disk Encryption</a> and I'm using it on my laptop. On day-to-day usage, you just don't notice the overhead. I suppose that if I had to do I/O intensive stuff I might, but so far it doesn't register at all.</p>

<p>The setup process is slow but painless. It took about 3 hours to encrypt my hard drive, and the laptop remains usable during the whole process. You can even stop and restart if you need to.</p>

<p>You can have several users each one with a different pass-phrase that can unlock the hard drive at boot time. I created two users, one for me, and another for disaster recovery. I generated a long random pass-phrase for the second user, printed two copies, and stored each copy on two different safe deposit boxes that I and my business parter have access to. This way, if I get hit by a bus, my partner can access the content of the drive.</p>

<p>My next step will be to encrypt the entire Time Machine external disk drive that I use. After that, I'll update the desktop machine and its Time Machine backup disk.</p>

<p>This should solve the physical theft problem. There are some precautions that you need to take though. For example, to be protected you must shutdown your laptop. When the laptop enters sleep mode, the hard drive remains "open". It would be nice to "lock" the hard drive when entering sleep mode, but I guess that it would require more support from Apple to do that. This is a problem for the laptop. I usually shutdown my desktop everyday when I leave the office. I do hope to see a lock-on-sleep feature in a future release.</p>

<p>But so far I'm very happy with this solution. Recommended.</p>

<p>Of course, I still have to worry about non-physical theft. People could still hack into my servers, or even hack into my desktop/laptop while they are running. But its a step.</p>

<p>The servers run with minimal services, and with a firewall active. I still haven't made the jump to a full SELinux enabled system, though. I do have a minimal port-knocking system for ssh connections, but its still experimental and only covers two of the ten servers I manage.</p>

<p>Also, some less secure services still share hosts with other higher security services. This is legacy from a time when I had less servers, and splitting them was not an option. My experiments with OpenVZ should provide an even better solution for this problem.</p>

<p>Small company, so small steps.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=bPo0XZKcOaA:GSiwY7jcXa8:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=bPo0XZKcOaA:GSiwY7jcXa8:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=bPo0XZKcOaA:GSiwY7jcXa8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=bPo0XZKcOaA:GSiwY7jcXa8:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/bPo0XZKcOaA" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">961@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2009-05-22T05:57:50+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/security.html</feedburner:origLink></item>
<item>
<title>OpenID</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/HIEiW60i7jQ/openid_1.html</link>

<description><![CDATA[I've switched providers of OpenID. I was using ClaimID, but now I'm using MyOpenID. The anti-pishing features are great, specially the personal icon feature. It basically sets a cookie on your browser, with a picture URL, and shows you that picture on the login page. If you don't see the picture, then the site didn't get the cookie, and the URL is probably fake. Simple and effective. I've also gained OpenID 2.0 and XRDS support, which is nice. And given that I was already using simplicidade.org as my identifier, I only had to update the &lt;link&gt;'s on that page to...]]></description>

<content:encoded><![CDATA[
<p>I've switched providers of <a href="http://openid.net/">OpenID</a>. I was using <a href="http://claimid.com/">ClaimID</a>, but now I'm using <a href="http://www.myopenid.com/">MyOpenID</a>.</p>

<p>The anti-pishing features are great, specially the personal icon feature. It basically sets a cookie on your browser, with a picture URL, and shows you that picture on the login page. If you don't see the picture, then the site didn't get the cookie, and the URL is probably fake. Simple and effective.</p>

<p>I've also gained OpenID 2.0 and <a href="http://en.wikipedia.org/wiki/XRDS">XRDS</a> support, which is nice.</p>

<p>And given that <a href="https://www.myopenid.com/help#own_domain">I was already using <code>simplicidade.org</code> as my identifier</a>, I only had to update the &lt;link&gt;'s on that page to point to my new provider.</p>

<p>OpenID delegation FTW...</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=HIEiW60i7jQ:4I2tiZL49DU:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=HIEiW60i7jQ:4I2tiZL49DU:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=HIEiW60i7jQ:4I2tiZL49DU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=HIEiW60i7jQ:4I2tiZL49DU:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/HIEiW60i7jQ" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">960@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2009-05-21T06:40:14+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/openid_1.html</feedburner:origLink></item>
<item>
<title>Designing JavaScript applications with Interface Builder</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/zA8O0QYMJqQ/designing_javas.html</link>

<description>Last year, I was amazed with the power of Cappuccino when they showed off a Keynote.app clone written entirely with JavaScript. The 280 North gang released version 0.7 this week, and inside there is a new tool that made my jaw drop. The nib2cib tool allows you to design your application with the gorgeous Apple Interface Builder, and then translate the resulting nib/xib into a cib that your JavaScript app can use directly. It even supports Target/Actions and Outlets... I'm not a JavaScript applications developer, but I find this truly impressive....</description>

<content:encoded><![CDATA[
<p>Last year, I was amazed with the power of <a href="http://cappuccino.org/">Cappuccino</a> when they showed off a <a href="http://280slides.com/">Keynote.app clone written entirely with JavaScript</a>.</p>

<p>The <a href="http://280north.com/">280 North gang</a> <a href="http://cappuccino.org/discuss/2009/05/20/cappuccino-07-now-available/">released version 0.7 this week</a>, and inside there is a new tool that made my jaw drop. The <a href="http://wiki.github.com/280north/cappuccino/nib2cib">nib2cib</a> tool allows you to design your application with the gorgeous Apple Interface Builder, and then translate the resulting nib/xib into a cib that your JavaScript app can use directly.</p>

<p>It even supports Target/Actions and Outlets...</p>

<p>I'm not a JavaScript applications developer, but I find this truly impressive.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=zA8O0QYMJqQ:H53Ni4__RBg:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=zA8O0QYMJqQ:H53Ni4__RBg:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=zA8O0QYMJqQ:H53Ni4__RBg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=zA8O0QYMJqQ:H53Ni4__RBg:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/zA8O0QYMJqQ" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">959@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2009-05-20T20:48:37+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/designing_javas.html</feedburner:origLink></item>
<item>
<title>Fixing the POD synopsis in OSX – take 3 (take your groff and run)</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/-KLjhe4SQeI/fixing_the_pod.html</link>

<description>Marcus started it, Tim teased me. I was bitten so many times by this that I had to take a stab at it. Following Tim's leads, I checked that the pod2man was producing proper nroff, with a \- for each -. It was. I tried to understand the groff tmac files, but I think we have here the first real proof that there are aliens out there, and they speak wonderful languages... Anyway, we turned to Google and after a bit of digging we ended up at the groff CVS and a recent change (rev 1.39), just 4 months old...</description>

<content:encoded><![CDATA[
<p><a href="http://marcus.nordaaker.com/2009/05/fixing-the-pod-synopsis-in-osx/">Marcus started it</a>, <a href="http://blog.timbunce.org/2009/05/19/fixing-the-pod-synopsis-in-osx-take-2-perldoc-nroff-and-utf-8/">Tim teased me</a>. <a href="http://rt.cpan.org/Public/Bug/Display.html?id=31422">I was bitten</a> so many times by this that I had to take a stab at it.</p>

<p>Following Tim's leads, I checked that the <code>pod2man</code> was producing proper <code>nroff</code>, with a <code>\-</code> for each <code>-</code>. It was. I tried to understand the <code>groff</code> tmac files, but I think we have here the first real proof that there are aliens out there, and they speak wonderful languages...</p>

<p>Anyway, we turned to Google and after a bit of digging we ended up at <a href="http://cvs.savannah.gnu.org/viewvc/groff/tmac/doc.tmac?root=groff&amp;r1=1.38&amp;r2=1.39">the groff CVS and a recent change (rev 1.39)</a>, just 4 months old so recent enough not to be included with Mac OS X. The description was promising:</p>

<blockquote>
  <p>tmac/an-old.tmac, tmac/doc.tmac: For -Tutf8, map -, -, ', and `
  conservatively to ASCII for the sake of easy cut and paste.</p>
</blockquote>

<p>The <code>doc.tmac</code> is important. When pod2man calls nroff, it asks for the <code>an</code> package. The <code>an.tmac</code> basically includes the <code>andoc.tman</code> and that one includes the <code>doc.tman</code> package.</p>

<p>At first I took the diff and tried to blindly apply it to the local <code>doc.tman</code> file. I don't speak alien, so although <code>nroff</code> didn't complain after my changes, it also keep on using the unicode hyphen symbol.</p>

<p>So I've downloaded the latest groff package (1.20.1) and did:</p>

<pre><code>tar zxf groff-1.20.1.tar.gz
cd groff-1.20.1
./configure --prefix=$HOME/bin/groff-1.20.1 \
   --with-appresdir=/tmp/gxditview
make -j 4
make install
</code></pre>

<p>You now have your own local groff install, including a brand new <code>nroff</code>.</p>

<p>To test it, I run:</p>

<pre><code>perldoc -n ~/bin/groff-1.20.1/bin/nroff local::lib
</code></pre>

<p>Copy and paste something in there with hyphens, like my nemesis <code>--bootstrap</code>, and you should see that your hyphens stay in glorious ASCII, no more of that unicode mumbo-jumbo.</p>

<p>So stick this into your <code>.bashrc</code>:</p>

<pre><code>alias perldoc='/usr/bin/perldoc -n ~/bin/groff-1.20.1/bin/nroff'
</code></pre>

<p>And live long and prosper.</p>

<p>Maybe it is possible to take the changes and port them successfully to groff 1.19.2, but I couldn't do it. If you do speak alien and you do port them to the <code>groff</code> shipped with Mac OS X 10.5, leave me a comment. Sticking a new <code>doc.tmac</code> in the `site_tmac/´ directory is a lot simpler than installing groff.</p>

<p><strong>Update:</strong> the <code>PROBLEMS</code> file (<a href="http://www.opensubscriber.com/message/groff@gnu.org/7584318.html">kudos to this thread where you can follow the whole argument with the same problem in Linux man pages</a>) that is included with groff mentions this problem:</p>

<blockquote>
  <ul>
  <li>The UTF-8 output of grotty has strange characters for the minus, the
  hyphen, and the right quote.  Why?</li>
  </ul>
  
  <p>The used Unicode characters (U+2212 for the minus sign and U+2010 for
  the hyphen) are the correct ones, but many programs can't search them
  properly.  The same is true for the right quote (U+201D).  To map those
  characters back to the ASCII characters, insert the following code
  snippet into the `troffrc' configuration file:</p>

<pre><code>.if '\*[.T]'utf8' \{\
.  char \- \N'45'
.  char  - \N'45'
.  char  ' \N'39'
.\}
</code></pre>
</blockquote>

<p>If you stick the above code into <code>/usr/lib/groff/site-tmac/troffrc</code> the output will be ASCII, even with the default Mac OS X groff, but the perldoc output starts with a couple of blank pages and a warning:</p>

<blockquote>
  <p>&lt;standard input&gt;:138: warning: can't find font `CW'</p>
</blockquote>

<p>So compiling groff is still the best solution.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-KLjhe4SQeI:3bDuxq8WA3Y:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=-KLjhe4SQeI:3bDuxq8WA3Y:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-KLjhe4SQeI:3bDuxq8WA3Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=-KLjhe4SQeI:3bDuxq8WA3Y:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/-KLjhe4SQeI" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">958@http://www.simplicidade.org/notes/</guid>
<dc:subject>Perl</dc:subject>
<dc:date>2009-05-20T06:13:17+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/fixing_the_pod.html</feedburner:origLink></item>
<item>
<title>Love/Hate and package managers</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/N3mTBf_Ede4/lovehate_and_pa.html</link>

<description>I have a long standing love/hate relationship with package managers. On one side, you have access to most of the software out there already compiled (presumably by someone who knows and uses the software and therefore is able to choose the proper, most useful, configuration options) and with all the administrative bits (startup scripts, example configuration files) in the "right" place (usually dictated by some standard like the LSB). On the other all the package managers that I know of (and this is really a cry for help, please tell me of exceptions to this rule) have a Highlander-fetish with...</description>

<content:encoded><![CDATA[
<p>I have a long standing love/hate relationship with package managers.</p>

<p>On one side, you have access to most of the software out there already compiled (presumably by someone who knows and uses the software and therefore is able to choose the proper, most useful, configuration options) and with all the administrative bits (startup scripts, example configuration files) in the "right" place (usually dictated by some standard like the LSB).</p>

<p>On the other all the package managers that I know of (and this is really a cry for help, please tell me of exceptions to this rule) have a Highlander-fetish with regards with package versions: there can be only one.</p>

<p>At any point in time, you can have one and only one version of a package installed it seems. If I have two applications running on some server, and you tested one of them with version X of the package P, and the other with version Y, you cannot have both versions installed at the same time. You have to pick the latest one and hope that backwards compatibility was not lost.</p>

<p>Most people with setups larger than mine that I talk to about this just tell me that "oh, you should split your applications on different servers, easier to manage, profile and tune". That's true, but most small mom-and-pop business don't have or don't want to spend capital to work around limitations on package managers.</p>

<p>There is also a good argument to be made for security. Keeping old versions around and in use is a security risk if the newest version was released to fix a security problems. I acknowledge this whole heartedly, but still, sometimes you know that you are using and old buddy version, but you still need to keep it running for some time, either because you evaluated the security problems and they don't apply to your configuration or because you need more time to test with the new version. We should be aware of the dangers you put yourselves in when you ignore upgrades like that, but you shouldn't be ruled by fear also. Analyze, weight your options, decide. Be rational.</p>

<p>One clean solution is a containers package like OpenVZ or FreeBSD jails or Solaris Zones: one kernel per server, several virtual servers. I admit that I strongly prefer this type of container-based virtualization solutions to the big ones that require processor support for decent speed, like VMWare, Xen or Parallels. I have a strong distaste for waste, and having multiple kernels running on the same metal, although extremely useful in some scenarios, is very wasteful of resources in the general case.</p>

<p>So although I just got a server at the office to have a second round of OpenVZ tests (and I'll probably use it in production for all my servers if I'm happy with them), I still believe that all of this is a big blanket over bad package managers.</p>

<p>My ideal package manager would create a base directory somewhere, lets say <code>/p</code>, and would create a set of directories, taking in account architecture, package name, and package version. For example, you could have perl 5.8.9 and perl 5.10 like this:</p>

<ul>
<li><code>/p/i386/perl/5.8.8/{bin,lib,...}</code></li>
<li><code>/p/i386/perl/5.10/{bin,lib,...}</code></li>
<li><code>/p/x86_64/perl/5.10/{bin,lib,...}</code></li>
</ul>

<p>Also, you could keep the notion of latest using: <code>/p/i386/perl/latest</code> as a symbolic link to <code>/p/i386/perl/5.10</code>. This way other packages can require any version of perl or a specific version of perl.</p>

<p>The <code>PATH</code> environment would be tailored to the specific versions of each package you want. Just include the proper <code>bin/</code> of the specific version you want. A global <code>/p/${arch}/bin/</code> could be setup with symbolic links to the <code>package/latest/bin/</code> files.</p>

<p>Clearly the solution of using OpenVZ is easier to manage today, no need to find or build a package manager like this, but still, I would really like to see it sometime.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=N3mTBf_Ede4:BgihlkEuHuw:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=N3mTBf_Ede4:BgihlkEuHuw:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=N3mTBf_Ede4:BgihlkEuHuw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=N3mTBf_Ede4:BgihlkEuHuw:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/N3mTBf_Ede4" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">957@http://www.simplicidade.org/notes/</guid>
<dc:subject>Rants</dc:subject>
<dc:date>2009-05-07T07:32:22+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/lovehate_and_pa.html</feedburner:origLink></item>
<item>
<title>Fast DNS queries with Perl</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/mY6kqZTpxb8/fast_dns_querie.html</link>

<description>For some jobs, you need to quickly resolve large amounts of DNS queries. The AnyEvent::DNS module allows you to resolve DNS queries fast and in parallel. To test this, I wrote a simple command line tool to check XMPP SRV records of a list of domains. Both server-to-server and client-to-server records will be checked and results printed out. All queries will be made in parallel. The code is at my Ironman repository. Click the "Raw" link to download (sorry, no direct link, GitHub lacks permalinks to the latest raw version of a file)....</description>

<content:encoded><![CDATA[
<p>For some jobs, you need to quickly resolve large amounts of DNS queries.</p>

<p>The <a href="http://search.cpan.org/dist/AnyEvent/lib/AnyEvent/DNS.pm"><code>AnyEvent::DNS</code></a> module allows you to resolve DNS queries fast and in parallel.</p>

<p>To test this, I wrote a simple command line tool to check XMPP SRV records of a list of domains. Both server-to-server and client-to-server records will be checked and results printed out. All queries will be made in parallel.</p>

<p>The code is at <a href="http://github.com/melo/Ironman/">my Ironman repository</a>. Click the "Raw" link to download (sorry, no direct link, <a href="http://github.com/">GitHub</a> <a href="http://support.github.com/discussions/repos/735-add-permalink-for-files">lacks permalinks to the latest raw version of a file</a>).</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=mY6kqZTpxb8:c7r53Xq4vQU:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=mY6kqZTpxb8:c7r53Xq4vQU:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=mY6kqZTpxb8:c7r53Xq4vQU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=mY6kqZTpxb8:c7r53Xq4vQU:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/mY6kqZTpxb8" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">956@http://www.simplicidade.org/notes/</guid>
<dc:subject>Iron Man</dc:subject>
<dc:date>2009-05-06T16:35:03+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/fast_dns_querie.html</feedburner:origLink></item>
<item>
<title>Third time is the charm</title>
<link>http://feedproxy.google.com/~r/simplicidade/notes/~3/TLpjFyaGoK8/third_time_is_t.html</link>

<description>I stop following a bunch of people on Twitter, and I've stopped using any kind of real-time Twitter client. Its an amazing waste of time. My new relation with Twitter can be summed up like this: I'll post links that I find interesting; I've subscribed the feed of mentions of @pedromelo: this allows me to read responses or comments about such links in my RSS reader, when I feel like it; I've created a feed with all the twits from my friends that contain a link: allows me to catch any links they find relevant. There. Twitter off....</description>

<content:encoded><![CDATA[
<p>I stop following a bunch of people on Twitter, and I've stopped using any kind of real-time Twitter client. Its an amazing waste of time.</p>

<p>My new relation with Twitter can be summed up like this:</p>

<ol>
<li>I'll post links that I find interesting;</li>
<li>I've subscribed the feed of mentions of <code>@pedromelo</code>: this allows me to read responses or comments about such links in my RSS reader, when I feel like it;</li>
<li>I've created a feed with all the twits from my friends that contain a link: allows me to catch any links they find relevant.</li>
</ol>

<p>There. Twitter off.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=TLpjFyaGoK8:JY1mI8P-k2U:QAbEOQDFbZY"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?i=TLpjFyaGoK8:JY1mI8P-k2U:QAbEOQDFbZY" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=TLpjFyaGoK8:JY1mI8P-k2U:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/simplicidade/notes?a=TLpjFyaGoK8:JY1mI8P-k2U:63t7Ie-LG7Y"><img src="http://feeds.feedburner.com/~ff/simplicidade/notes?d=63t7Ie-LG7Y" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/simplicidade/notes/~4/TLpjFyaGoK8" height="1" width="1"/>]]></content:encoded>

<guid isPermaLink="false">955@http://www.simplicidade.org/notes/</guid>
<dc:subject>Notes</dc:subject>
<dc:date>2009-05-06T14:59:17+00:00</dc:date>


<feedburner:origLink>http://www.simplicidade.org/notes/archives/2009/05/third_time_is_t.html</feedburner:origLink></item>


</channel>
</rss>
