Fork me on GitHub

Swiss Tournament in Ruby 0

Being a chess player (not a very good one), I’ve always been intrigued by Swiss Tournaments. They are so practical, and ensure that even a lowsy player like myself, can play the same number of rounds as any other player. That’s being inclusive!

I’ve played some knock-out tournaments (to me it meant being kicked off in the second or third round), and, given their nature, not-so-good players tend not to attend these tournaments (since their fun will, almost surely, end before long).

Well, to solve a very similar problem, but not in any game championship, a co-worker suggested we could use a Swiss Tournament system. I liked the idea, but not being sure it could really solve the problem, I had to quickly implement something to test our data with… so Ruby to the rescue!

In no time we were up and running, and apart from minor issues that were being fixed along the way, I guess it’s a pretty good implementation. You can checkout the code to get a feel of it. Of course, it doesn’t follow any rules from any Chess or Go association (Wikipedia, after all, was my guide here), but it serves our goal. Being a “proof-of-concept” code, feel free to improve it (just tell me about it, will you?).

Good tip: Readability 0

Folks at Arc90 have an interesting experiment going on: Readability. That’s a tool you just drag to your bookmarks toolbar to improve readability of anything…

I’ve been using it for some time now, and my experience, specially in news websites, has been greatly improved. If you are like me, that get really bothered by the usual clutter of todays websites, this tool is for you.

Real Life: Programming is about logic and simplicity 2

Why is it so hard for non-programmers to understand mutex locks?

No… I am not asking non-programmers to understand programming at all. But concepts that we use in programming that came from real-life in the first place? Come on… Programmers learned from real-life, not the other way around!

Let me explain: at the hospital, after a not so clever renovation, we ended up with an employee restroom that is far from work place (in fact, almost in another department). Most of the times it is occupied… So it takes a trip to the restroom just to learn that it cannot be used at that moment! In a busy morning, one of those trips is just what one can do!

As a programmer I suggested a mutex lock: change the restroom door lock and make only one copy of the key, that should be kept in a common place and returned after being used. If you want to use the restroom and it’s occupied, just learning the key is not there is enough to save a useless trip.

Come on… that is not a hard concept! As I said, we, programmers, learned it from real-life, in settings just as the one I described above!

Well, I just got the key (“acquired the lock”, in programmer speech) and went to the restroom. When I unlocked the door I was surprised by someone already using it! How embarassing! Someone had the smart idea of making a copy of the key! What part of the mutex concept did people not understand?

Luckily, most computational mutex algorithms prevent “lock cloning”... :-)

Regressão no atendimento do Banco do Brasil 10

Eu sempre disse que o Home Banking do Banco do Brasil era o melhor. Eu sempre achei muito concisa a apresentação, com uma página inicial personalizável com os links para o que você mais usa bem a mão. Até o pequeno probleminha que o tal do “Teclado Virtual” (em Java) representava não me afetava suficiente para mudar a minha opinião. Mais importante que tudo, funcionava perfeitamente no meu Debian.

Há alguns dias fiquei ainda mais feliz com o sistema, quando substituiram o teclado virtual por uma caixa de texto… Finalmente eu podia digitar a minha senha no bloco numérico do teclado “real”. No entanto essa felicidade acabou hoje…

Hoje tentei acessar a minha conta, como sempre faço nessa época do mês. O acesso era ainda mais importante, já que tenho de fazer uma pequena transferência para saldar uma dívida que vence hoje. Uma transferência entre contas BB resolveria o problema… Mal sabia o que me esperava…

Logo após digitar minha agência e conta recebo o aviso que não foi possível instalar o “Módulo de Segurança”, sugerindo que instalasse o Java, junto com um 0800 caso continuasse com problemas. Liguei às 15:55 e depois de 8 minutos na espera, Luciane me atende. Após as confirmações de agência, conta, etc, eis o diálogo:

BB: O Java está instalado? Eu: Sim (pensamento: obviamente).

BB: Desinstalou e instalou novamente? Eu: (p: não… não estou em Windows.) Sim (menti).

BB: Qual a versão do Internet Explorer? Eu: (p: ahh… ela pensou q eu estava no Windows) Nenhuma, eu uso Firefox.

BB: Firefox… sei… Qual a versão do Windows? XP? Eu: Não. Eu uso Linux (p: isso está ficando chato).

(longos segundos depois…) BB: O senhor precisa instalar o Java então. Eu: (p: ai meu Deus!) Eu já instalei o Java! Tenho a versão 1.6.0.15!

(longos segundos depois…) BB: Mas a última versão é a 1.6.0.17… o senhor precisa atualizar. Como o senhor usa Linux, o senhor não precisa do Módulo de Segurança… é só instalar a última versão do Java e pronto. Eu: (p: pouco provável que faça alguma diferença) Ok… Eu vou instalar o negócio… se continuar não funcionando ligo de volta.

Eu sei… eu sei. Pouco provável que uma sub-sub-sub-versão do Java faça qualquer diferença. Ainda mais considerando que essa versão foi lançada no finalzinho de 2009! E que papo é esse de que “Não preciso do Módulo de Segurança”? Mas, vamos lá…

Muito bem… instalada a versão que o BB quer… Vamos a ligação. Agora são 16:42… fico na espera por mais 9 minutos e sou atendido pela mesma Luciane (espantosamente). Verificações de rotina, dou o número do protocolo de atendimento anterior e eis o curto diálogo:

Eu: Bem, atualizei o Java conforme foi solicitado, mas persiste o mesmo erro. BB: Senhor Pablo, eu vou abrir o chamado para o segundo nível entrar em contato com o senhor por que não temos mais procedimentos.

Eu: E quando eles estrarão em contato? BB: Não sei lhe informar já que é outro setor.

Bem… Longos minutos depois ela me pergunta tudo de novo (qual versão disso, qual versão daquilo, blá, blá, blá), me dá um novo número de protocolo e reafirma que o “segundo nível” vai entrar em contato comigo.

Resultado: não paguei a dívida e resolvi blogar a respeito na esperança que o credor se compadeça de mim e perdoe os juros… Enquanto isso não consigo acessar a minha conta, algo que há apenas 10 dias tinha realizado com sucesso, sem atualizar ou instalar nada.

Pra aderir ao Twitt-speech: BB #FAIL!

Eu volto a blogar sobre isso, se (1) encontrar uma solução independentemente; (2) Voltar a funcionar espontâneamente; (3) Na improvável hipótese de ser contatado por um “segundo nível”. Enquanto isso, se alguém souber a solução, comenta aí!

Debian-RS and Vincent Danjean 0

The day before yesterday I learned that a fellow Debian Developer was visiting Porto Alegre Federal University to do some work on Parallel Computing: Vincent Danjean. People from local user group organized a last minute get-together at Cavanhas (that served as last meeting of the year) and we had the most pleasant time. Guaraldo registered the moment with his cellphone camera:

Vincent is flying back to France today or tomorrow. Hope he had a great time in Porto Alegre and have a safe trip back home.

Agora tá tudo explicado 1

Não resisti. Olha só a cópia exclusiva de um email que vazou recentemente:

From: Montgomery Burns
[mailto: Mr.Burns@springfieldnuclearplant.com ]

Sent: Tuesday , November, 09, 2009 3:38PM
Subject: Organizational Announcement

Dear all,

This morning our employee Homer J Simpson decided to leave Springfield
Nuclear Plant.
Please, join me in wishing good luck in his new role in Itaipu.

Mr.
Burns

Agora tá tudo explicado.

Looking for a new programming language to learn 21

I know it has been a long time since my last post. I am sorry about that, but life has it’s complications every now and then (as you know)... Well, on to the article.

Recently I had to reimplement in C a prefork server I wrote in Ruby for an internal project at Propus. Not that the Ruby version wasn’t enough (after all, although being in Ruby, I was using Unix plumbing, much in the fashion Ryan tell us about in the – now famous – I like Unicorn because it’s Unix article)... The problem is that, in one of our clients, the only version available for Ruby was 1.8.1.

Yeah… I know… But we were not allowed to upgrade and, although it didn’t seem at first, the same server presented a nasty memory leak in 1.8.1 that was not present in 1.8.7 and 1.9.1. I still don’t know where the problem is… I suspect some of the C-to-Ruby glues around TCP sockets might be blamed, but after a couple of days trying to figure it out, I decided it was easier just to reimplement it using C.

It actually took less than a day to get the C version going… nothing fancy and, apart from memory footprint, just the same functionality and about the same speed of the Ruby version. But it was enough to remind me I really don’t like all the scaffolding one has to raise in order to make something useful in C. It’s not just a matter of SLOC (of course, C version was more than 3 times longer than Ruby one)... I am talking about all the manual memory management, pointer operations and the disgusting experience of dealing with strings in C. I know some people are addicted to that sort of thing like heroin, but to me it just slows development.

This experience made me think about learning a second compiled programming language. I do some Perl, a lot of Python and (of course) most of my work in Ruby, but those are all interpreted languages. For compiled languages I always resorted to C… So I am officially looking for a language to learn.

So far, the best candidates are OCaml (I got a little excited about JoCaml a few months ago, now I might get serious about it), Haskell, Lisp, Objective-C, Ada, and Vala. Of these, I’ve been reading a lot about OCaml… It seems a fine and expressive language, with decent foundations, object-oriented extension, broad standard library and (with JoCaml) concurrency… Also it might give me the proper excuse to finally wrap my mind around a functional language!

People keep me pointing to Java and Erlang… Well… for using Java I would much prefer using JRuby. Erlang, ITOH, has a weird syntax (at least to me) and it seems much of what makes it great will, eventually, be part of Ruby (or already is using libraries) – either that or I’ll just wait for Reia to be ready. Besides, neither can be compiled to native code (ok, that argument can be stretched both ways, so just ignore it).

So, what do you think? Any advice?

Feliz Dia do Médico 0

Eu acho piegas e meio sem sentido as pessoas que escrevem exaltando a própria profissão. Ontem foi dia do Médico e vimos uma saraivada de médicos em condições diferenciadas e reconhecidas professando as dificuldades por que passaram e passam e entoando mantras como “ser médico é sacerdócio” e tantos outros que ouvimos vez por outra. Adivinhem: eu sou médico… e a coisa não é bem assim…

Todos os anos se repete o padrão: perguntam para os médicos mais afortunados o que é ser médico, e o que representa ser médico nos dias de hoje, e as respostas não variam muito no espectro que vai do sacerdócio à poesia. Embora eu compartilhe de muitas dessas visões, insisto que elas só servem para “consumo interno”, e serviriam melhor se fossem guardadas para si, e não proferidas aos quatro ventos. Penso que é um desserviço que esses médicos prestam aos seus semelhantes… “Se medicina é um sacerdócio, vamos tratá-los como padres” é o que pensam os que contratam os médicos, ou seja, com remuneração capuchinha e os mantendo em permanente serviço… em missão. (Na realidade, um padre tem “ajuda de custo” paga pela diocese e que varia conforme a paróquia. Infelizmente não encontrei nada oficial a respeito, mas informações não oficiais trazem valores na ordem de R$ 2.000,00 – sem dedução de impostos, já que não se trata de salário).

Não quero ofender aos que professam essas coisas, muitos dos quais admiro tanto profissional quanto pessoalmente… Mas por que não perguntam para os médicos menos afortunados a mesma coisa? Talvez por que não gostem do que esses tenham a dizer? Talvez porque uma jornada de trabalho extenuante associada a uma remuneração completamente incompatível mantida por algum tempo seja o suficiente para destruir o poeta dentro de cada médico…

Começou a circular em 2003 (a referência mais antiga que tenho é do jornal da Sociedade Brasileira de Cardiologia) um texto que comparava, em Natal/RN, a evolução dos honorários dos médicos com a dos Promotores Públicos. Na época, o autor do texto reclamava que o médico recebia R$ 755,00 (3,14 vezes o salário mínimo) e um promotor público, R$ 8.000,00 (33,33 vezes). Passados 6 anos, melhorou muito! Hoje os médicos recebem R$ 2.000,00 (4,3 vezes) enquanto os promotores públicos, R$ 14.507,19 – inicialmente (31,19 vezes). Nesse ritmo, os médicos e os promores públicos do RN deverão ganhar a mesma coisa lá por 2060! Que avanço!

Tratar de remuneração é fácil e objetivo: os números são frios e qualquer adolescente do ensino médio tem ferramentas para analisá-los (talvez não a experiência para interpretá-los, mas isso é outra história)... Mas não quero tratar só de remuneração… Sem dúvida a medicina tem suas peculiaridades. Tratar com o ser humano doente, enquanto a maioria das profissões trata com o ser humano sadio, não é para qualquer um. Sem dúvida é uma vocação. Concordo com a opinião de um de meus mestres: “Formar um médico é como formar um filósofo”, mas acho que vai além: um filósofo capaz de apoiar o ser humano nos piores momentos de sua vida orgânica, no momento da dor e do sofrimento. Algumas pessoas poderão dizer que existem momentos piores do que esses… na minha humilde opinião, essas pessoas nunca passaram pelos momentos extremos que fazem parte do cotidiano de nossos pacientes.

É verdade que a medicina avançou muito e está em um período particularmente interessante, com avanços em ritmo quase exponencial. Mas com cada avanço, as áreas não cobertas por conhecimento sólido acabam crescendo também, a medida que descobrimos nuances ainda desconhecidos previamente. No entanto, nunca o que aprendemos na faculdade foi mais verdade do que hoje: “Se puderes curar, cura; se não puderes curar, alivia; se não puderes aliviar, consola.”. Nisso se resume a real missão do médico: um pacto inequívoco com o paciente… o médico sempre tem algo a fazer, seja curar, aliviar ou consolar.

Com isso em mente, qualquer pessoa que acredita que saúde se compra está cometendo um erro filosófico grave: está dizendo que os abastados tem mais direito a saúde do que os desafortunados. Ora… a aplicação desse pacto entre médico e paciente não varia de acordo com as condições financeiras do último (ou não deveria), mas varia conforme as do primeiro (infelizmente). Na velocidade pós-moderna de transformação do conhecimento, um médico que recebe uma remuneração que permita uma educação continuada, uma situação familiar e social confortável (sem preocupações), necessidades básicas satisfeitas e tenha uma jornada de trabalho que permita pensar em cada paciente (ao invés de funcionar no “modo automático”) pode mover-se no espectro desse pacto entre consolar e aliviar, ou entre aliviar e curar!

Em última instância, é interesse da sociedade ter médicos bem remunerados. No entanto, a sociedade caminha no sentido oposto: pulveriza as faculdades médicas em nome de interesses comerciais, aumentando o número de vagas, azeitando a “linha de produção” de médicos que acabam em um mercado competitivo, aceitando remunerações vis que, acabam por piorar a própria capacidade de honrar a aplicação daquele pacto. A sociedade entende que temos médicos inaptos e responde criando mais faculdades e o ciclo vicioso está formado, alimentando-se do próprio monstro que criou e sendo alimentado por ele.

Mas aí entram convênios, governos e sistemas de saúde… cada um com o seu próprio conjunto de interesses. Olhando para esses interesses fica cada vez mais difícil acreditar que tenham entrado nessa história do lado dos médicos e pacientes… Mais provável que estejam do seu próprio lado, os convênios forçando cada vez mais trabalho em menos tempo para aumentar seu lucro; os governos usando a saúde como moeda de troca por votos e a falta de regulamentação da profissão como forma de controle dos profissionais; e os sistemas de saúde obrigando pacientes a intermináveis filas para atendimento, às vezes ativamente atuando contra uma maior eficiência.

Aquele texto de 2003 circula até hoje nos emails dos médicos (eu sempre recebo uma ou duas cópias nessa época do ano), invariavelmente adicionado a um chamado a ação, a um chamado para a união dos médicos bonzinhos contra os interesses mauzinhos de convênios, governos e sistemas de saúde. Eu acho tal chamado completamente ineficiente. Os advogados de tal chamado invertem o que propõe o autor original com a ilusão de que é preciso construir um “grande movimento nacional” e então partir para ação… é justamente o contrário! Temos de mudar as pequenas coisas do nosso dia-a-dia, olhando sempre para como melhor podemos exercer a nossa profissão e mostrar para os que nos administram que estamos certos naquele pequeno e específico ponto. Acaba que, fazendo isso, estamos exatamente construindo um “grande movimento nacional”, só que do Jeito Certo™: de baixo para cima.

XMPP4R-Observable now on GemCutter 2

Just a quick update: XMPP4R-Observable is now on GemCutter. That’s due to GitHub disabling gem building, and although everybody can get the source from GitHub as usual, those who want to quickly install it using Rubygems can do:


bash$ gem install xmpp4r-observable -s http://gemcutter.org

Happy Hacking.

Ruby versus Python 12

This is not another rant to praise one in spite of the other (an everybody knows I love Ruby, so it would not be impartial), but sometimes people seems to live in another world and do things for the wrong reasons.

I just read this blog post by Kanwei Li in which he gives 2 or 3 reasons he ditched Ruby in favor of Python. First of all, both are great languages and, although I favor Ruby, I use Python for some projects and they are not all that different. Of course, everyone is free to choose which language one favors, but Kanwei seems to be “ditching” Ruby out of not knowing much about it, or out of preferring one style over the other…

His first “reason” is that in Python white spaces matter. I used to think this is just a matter of style, but every now and then mandatory alignment hurts me (just try to put together a code generator and you’ll notice it). Although my code is always correctly aligned, I like that it’s done so because I want it that way, and not because some language demands it. Rants and more rants have been written about Python’s mandatory alignment (or other languages lack of it), and I am not going through all of it… Just I don’t think it’s a good reason to ditch Ruby…

After, he makes a big deal out of Ruby’s ternary if. As written by him, he prefers

#python
if len(a) > 0:
        v = a[0]
        a = a[1:]
else:
        v = None
over Ruby’s ternary if

#ruby
v = a.empty? ? a.shift : nil
Hey! Come on… Ruby’s ternary if is not mandatory… It was copied from C just as a syntax sugar. You can do without it, just as in Python:

#ruby
if ! a.empty?
    v = a.shift
else
    v = nil
end
Better yet! you can use if’s return as v value:

#ruby
v = if ! a.empty?
    a.shift
else
    nil
end

How beautiful is that!

Python lacked ternary if for a long time, and when it finally acquired one via PEP 308 its syntax was made different from every other language! Although I don’t think that is a problem, some people might think it would be better not reinventing the wheel.

Next, Kanwei goes over a famous “problem” of Ruby: the lack of a sum method for Array. I admit it’s strange, but that is completely coherent: Ruby’s Arrays are ordered collection of objects and not mathematical arrays. How do you sum objects that are not numbers? Many different people will have many different answers to that, so Ruby leaves this decision for the programmer and provides basic methods to deal with collections of anything (that can be used to apply sum to numbers, if wished). So, in Ruby you have to use Array#inject to perform a sum:

[1,2,3].inject(0) { |sum, value| sum + value }

Array#inject (actually Enumerable#inject) was borrowed from Smalltalk and allows you to loop through an array, building up an “accumulator value” as you go. When it’s done, the final value of this accumulator is returned. Very useful for combining array elements, whether by summing them, building up a pretty display string, whatever. In the example above, I am initializing the accumulator with 0.

If you use Array to mathematical operations and you want your arrays to work that way, you can always add a sum method to Array class:

class Array
    def sum
        self.inject(0) {|sum, value| sum + value}
    end
end

Maybe it would be better if you just use Arrays as containers (as it was intended to) and implement that sum inside your own class… I completely agree with Reg Braithwaite here.

Kanwei also mention Python is faster than Ruby. That is true, but was “more true” some time ago. First of all, Python is older and has had more time to improve its speed. Ruby, ITOH, just now acquired a good VM and improvements to it finally can run parallel to improvements in the language itself, so I am expecting this to be less true every release. Python is already not getting much faster between releases, unlike Ruby (the differences between 1.8.7 and 1.9.1 are really impressive!). IMHO this is not a good reason to choose one instead of the other: if you really need speed, go for C :-)

Now this is something I find interesting Kanwei has mentioned: “Python is more production ready”. He argues that Google is using it, so it must be good. Well… I cannot argue against that: Google is really using Python. But IBM, Oracle, EA, Cisco, Siemens, etc are using Ruby… so that is just a matter of preferring one or another company. Both are production ready… I agree, though, that Ruby 1.9.1 has many differences from 1.8.7, and that that may be seen as some inconsistency, but Python also has changed a lot since its 2.0 version, for that matter. And the changes to Ruby brought many benefits… I think they worth it.

At last, Kanwei compares Python and Ruby docstrings. Here I also have to agree with him: Ruby docstrings sucks. Actually that’s why everybody uses rdoc instead (and that is much more powerful than Python’s docstrings). Again, I don’t think that is reason enough to ditch Ruby (actually, the existence of rdoc, rubygems & friends should bring people to Ruby instead), but that is a matter of personal taste.

Surely, Kanwei’s reasons were easy to argue against. There are areas were Python shines much more than Ruby (and vice-versa), but those Kanwei mentioned are not among them.

I think both languages are powerful enough, and both are way better than Perl or PHP, so either one you choose would be fine. Better if you don’t have to choose and use both ;). If you have to, ITOH, pay more attention on how you feel while coding in each one, and not to some cheap reasons such as above. If you are a programmer, what matters most is that you’ll spend a lot of time coding with any given language… let that be something pleasant then.

Good reading: Empire Rising by Sam Barone 0

I usually don’t write about this, but along with technical and medicine books, I am always reading some fiction book. It began as an habit (every night I read some pages) when I was a teenager and now it became an addiction. I am always looking for good fiction books to read.

About 3 months ago I bought a pocket book (Dawn of Empire) by a first-time author (Sam Barone), and found it such a good story that I finished it in about a week and began looking for the sequence (Empire Rising). The story is about the dawn of civilization in Mesopotamia, and how humans left their days as nomadic tribes/clans in order to build villages and farms, and all the challenges that such a change brings along with it (including building and maintaining empires).

It took until last week for my favorite bookstore to get Empire Rising to me, and I almost finished it already. So far I have to say it is even better than the first one!

So this is for the fiction books fans: get these two books at once! It’s amazing how a first-time author managed to write such great books. Sam Barone is really someone to keep an eye on. I am already looking forward his next books.

Code testing coverage 0

I like building tests for my code. That is not an old habit, it’s just something I’ve been developing in the recent months or some few years. No, I am not doing TDD (although that doesn’t sound like a bad idea): I just build tests after I code as a safeguard – to be sure I haven’t broken anything. I suspect there are more programmers like myself than those using tests as part of a TDD (BDD, SDD, etc) approach, but that is just an opinion.

Well I just recently became found of code coverage estimates and tools, and rcov is such a nice tool that sometimes I just find myself building tests just to “please” it. I also suspect there are at least a bunch of people that do the same. Here are the results of the test coverage of one of my projects:


spectra@rohan:~/work/xmpp4r-observable$ rake rcov
(in /home/spectra/work/xmpp4r-observable)
rm -r coverage
Loaded suite /usr/bin/rcov
Started
........................
Finished in 70.995814 seconds.

24 tests, 97 assertions, 0 failures, 0 errors
+----------------------------------------------------+-------+-------+--------+
|                  File                              | Lines |  LOC  |  COV   |
+----------------------------------------------------+-------+-------+--------+
|lib/xmpp4r-observable.rb                            |   648 |   414 |  61.4% |
|lib/thread_store.rb                                 |    58 |    39 |  87.2% |
|lib/observable_thing.rb                             |   187 |   118 |  91.5% |
+----------------------------------------------------+-------+-------+--------+
|Total                                               |   893 |   571 |  69.4% |
+----------------------------------------------------+-------+-------+--------+
69.4%   3 file(s)   893 Lines   571 LOC
spectra@rohan:~/work/xmpp4r-observable$

Sure it’s tempting to get more of lib/xmpp4r-observable.rb covered, isn’t it?

Apresentando XMPP4R-Observable 0

Há apenas alguns dias fiz uma apresentação no FISL10 sobre a utilização de XMPP PubSub com Ruby e sobre um fork de uma biblioteca popular à qual acrescentei os rudimentos do PubSub. Naquela mesma apresentação listei uma série de problemas que aquela abordagem tem e falei sobre um roadmap para o futuro…

Acontece que acabei me convencendo de que não posso utilizar o PubSub no lado XMPP da biblioteca e uma forma de periodical pooling no lado Ruby. Resolvi, então, substituir a biblioteca que havia forkado por uma versão Observable, preservando as coisas boas do XMPP4R-Simple. O resultado chamei de XMPP4R-Observable, e acabo de publicar no GitHub.

Uma boa parte do código está coberta por testes (e “roubei” alguns dos testes da própria XMPP4R-Simple)... pretendo cobrir o restante ao longo do tempo (contribuições são bem-vindas). Por hora, chamei esse primeiro release de versão 0.5.1 e acrescentei um .gemspec para gerar um .gem automaticamente… No entanto, o GitHub ainda não publicou o .gem… Quando publicar, para instalá-lo deve ser tão simples quanto:


bash# gem sources -a http://gems.github.com
bash# gem install spectra-xmpp4r-observable

Não deixem de reportar qualquer erro. Happy hacking.

Update 2009-09-13 10:29:00: Acabo de confirmar que o .gem foi publicado pelo GitHub.

Update 2009-10-10 20:21:00: O .gem do XMPP4R-Observable vai ser mantido no GemCutter, a partir de hoje.

EeePC: Surviving liquid spills - phase II 3

About four months ago I described how my EeePC survived the spilling of orange juice over its keyboard. No! I never spilled anything on it again, if that’s what you’re thinking… But I noticed that some keys (those that got more juice on) began to malfunction. At the beginning I paid no attention to it, hoping that it would just go away, but, eventually, they just stop working… And those are not just unimportant keys… I am talking about arrows and the forward-slash (/) keys in the lower right corner of the keyboard!!! How could I survive without those keys, without a quick access to my bash history and vim search?

Well, I began googling around and found some good advice. Everything that made sense regarding how to cleanup my keyboard I compiled and, when I was enough confident it would work, I just follow the procedure I’ve devised. This is what I did:

  1. After turning it off and removing the battery, I removed the keyboard. Check the instructions I linked in my previous article for some pictures on how to do it.
  2. I poured 500 mL of distilled water in a clean plastic box (I bought 1L for BRL 20 at a local pharmacy), added enough dish detergent to make some foam (I was careful to select a non-biodegradable one) and drowned the whole keyboard in the solution.
  3. For the next 30 minutes I pressed and released the affected keys over and over again. My intention was to dissolve anything that might have remained from the orange juice.
  4. I left it soaking in the solution for the next 12 hours.
  5. The next day I got the keyboard out of the solution and used current tap water to remove any detergent still left in it. This might have took about 10 minutes.
  6. Our tap water is really clean, but its hard, and I would not like to remove any juice from the keyboard just to add some minerals that might have the same effect, so after I was certain all the detergent was removed, I left the keyboard in the remaining of the distilled water for another 12 hour soak.
  7. After that I just removed the keyboard from the soak, dried it a little bit using a paper towel and left it to air-dry (away from the sun). I don’t remember how long it took, but I believe not more than 4 hours… Those were hot days… Anyway, I was really sure it was dry.

When I plugged it back, surprise! All keys are working again! Of course, that was just what worked for me… Best advice still is: Keep liquids away your EeePC!

Caverna do Dragão 0

Uma das coisas que fiz nas minhas férias foi ler o roteiro do último episódio de “Caverna do Dragão” (Dungeons & Dragons para os anglófonos), um desenho animado dos anos 80 que fez a festa dos que eram crianças na época (eu inclusive) e dos que jogavam RPG (novamente, eu inclusive).

Eu tinha ouvido diversas teorias sobre o que representava o Realm da Caverna do Dragão, e o que as crianças estavam fazendo lá… algumas bastante fantasiosas, mas devo admitir que o roteiro real é bem mais interessante do que todas as teorias paralelas. Quem quiser dar uma olhada, o original em inglês está no site do roteirista (eu também achei uma tradução para o português). Não vou estragar a festa de ninguém adiantando o final, mas tenho certeza que vocês vão gostar.

Pena que não produziram o último episódio… Realmente seria um belo encerramento para a série animada… Dei uma procurada por aí e não me aguentei: acabei comprando o pacote com os 5 DVDs da série… Agora é só aguardar a chegada…