Poucas vezes tenho visto, por parte da imprensa, artigos sobre software livre que informem realmente de que se trata o mesmo, em uma linguagem acessível, sem “explicá-lo” como “software alternativo” ou coisas do gênero.
http://diplo.uol.com.br/2009-05,a2845
Arquivo do Autor: andreba
Software Engineering is Dead
http://www.codinghorror.com/blog/archives/001288.html
Software development is and always will be somewhat experimental. The actual software construction isn’t necessarily experimental, but its conception is.
I can publicly acknowledge what I’ve slowly, gradually realized over the last 5 to 10 years of my career as a software developer: what we do is craftsmanship, not engineering.
control is ultimately illusory on software development projects.
Extraindo o último elemento de uma linha com o awk

awk, o mastigador de linhas de texto
DISSE0074I Operation successfully submitted. Distribution ID is 1234567890.123456.
No caso eu preciso pegar o código numérico no fim da linha. Geralmente eu usaria apenas o comando cut, como: cut -d’ ‘ -f8, mas e se a mensagem variar de tamanho (quantidade de palavras)? Como saber o índice do último elemento?
Entra em ação o awk. Usando awk ‘{print $8}’ dá pra imprimir o elemento número 8; e há a variável NF que informa a quantidade de campos. Então dá pra extrair o último campo assim:
cat arquivo.txt | awk ‘{print $NF}’
Perfeito para o que eu queria.
Rogue'm Up 0.1
Atualização do Rogue’m Up. Agora é um pouquinho mais bonito e será usado para exemplificar técnicas simples de programação em C. Aqui:Update of Rogue’m Up. Now it’s a bit less ugly and will be used to show some simple C programming techniques. Here: Rogue’m Up project
It's all DNS's fault
English version below.
Retirado de http://www.debian-administration.org/users/lykwydchykyn/weblog/18:
I remember reading somewhere recently (and my experiences in the past pay testament to it):
If you see a baffling problem, it’s surprising how often its down to DNS or host name resolving.
Tradução livre do texto acima:
Eu me lembro de ter lido em algum lugar recentemente (e minhas experiências passadas confirmam isso): se você encontrar um problema que você não faça idéia de qual seja a causa, é surpreendente o quão comum que a causa seja DNS ou resolução de nomes.
Basicamente, o camarada atualizou o Debian e então um programa passou a ficar incrivelmente lento ao conectar com o MySQL. No final o problema era com o DNS.
Eu me lembro alguns anos atrás, quando minha máquina com Debian de uma hora para outra começou a levar vários minutos pra dar boot, quando antes ela iniciava em cerca de um minuto apenas. No fim o problema era o exim (configurado como servidor local), que tentava resolver o nome da máquina durante sua inicialização, e por causa de algum motivo estranho de que não me lembro agora, o arquivo /etc/hosts perdeu a entrada da própria máquina.
Então eis a lição… ao encontrar problemas estranhos sobre lentidão súbita e inexplicável, confira se a resolução de nomes está funcionando (DNS, arquivo hosts, WINS ou o que quer que seja)
(e eu acabei de me lembrar que esse tipo de problema já me deu muita dor de cabeça com o Tivoli Framework em várias ocasiões…)
Taken from http://www.debian-administration.org/users/lykwydchykyn/weblog/18:
I remember reading somewhere recently (and my experiences in the past pay testament to it):
If you see a baffling problem, it’s surprising how often its down to DNS or host name resolving.
Basically, this guy updated Debian and then some app started behaving very slow when connecting with MySQL. Turns out it was a name resolution problem (DNS).
I remember some years back ago, when my Debian machine suddenly started taking several minutes or so to boot up, when previously it just booted in a minute or so. Turned out the problem was with exim (configured as local server only), which tried to resolve the machine name during start up, and because of some weird reason that I can’t remember now, the /etc/hosts file lost the entry for the own machine.
So here’s the lesson… if facing weird problems concerning suddenly, unexplainable slowness, check if the name resolution is working (DNS, hosts file, WINS, or whatever)
(and I just remembered that these issues give me a lot of headache with Tivoli Framework in several occasions…)
Rogue'm Up
English version below.
Uns dois anos atrás, comprei numa promoção o livro Linux Application Development, e até hoje não consegui acabar de lê-lo. Acontece sempre isso com todo livro técnico que compro. Nunca consigo ler pelo menos um parágrafo de uma só sentada, sempre perco o interesse e vou fazer outra coisa.
Resolvi então mudar de estratégia: vou lendo os capítulos fora de ordem, procurando por temas que me interessem no momento. Vi então que o livro tem um capítulo sobre uso da lib S-lang, que serve para abstrair o acesso ao terminal (console). Tradicionalmente se usa a biblioteca ncurses, mas a S-Lang parece ser mais moderna.
Enfim, não só finalmente li um pouco mais do livro, como comecei a brincar com as funções da S-Lang e fiz um pequeno jogo, um shooter lateral, com o mesmo. Como a nave é representada pelo caracter @ e os inimigos são, digamos, familiares para quem já jogou um certo jogo em modo caractere, resolvi chamar este de Rogue’m Up – mistura de Roguelike com Shoot’em Up.
Ou seja, é um shooter para se jogar em modo caractere. Não espere nada muito bem feito, afinal foi só o resultado de uma tarde brincando com as funções da lib S-Lang. Movimente-se com as teclas wasd ou hjklyubn (todas minúsculas), atire com o espaço, saia com Q (maiúsculo). Cada colisão com um inimigo tira 2 pontos de HP.
Atualizado: agora com mais de uma versão e usado como exemplo de programação em C, aqui.
Two years or so ago I bought the book Linux Application Development at bargain price, but I still didn’t finished reading it. This always happens with all technical books I bought: I sit down to read the book, and before I finish even a chapter, I shift my attention to something else and drop the book.
I decided to change my strategy: now I’ll try reading the chapters out of order, selecting chapters by its themes, looking for something I’m interested in reading at that moment. Then I found that this book had a chapter about the S-lang lib. S-Lang provides an abstraction of the terminal (console), easing the programming of console applications. Traditionally the ncurses lib is more used and talked about, but S-Lang seems to be updated more often.
So I’ve finally advanced a little more in reading this book, and also spent some time playing with the S-Lang functions, enough to make a small game – a lateral shooter. The ship is an @ character and the enemies are, let’s say, somewhat familiar to anyone who ever played a certain character-mode game. And so I named this little experiment Rogue’m Up – from the wordsRoguelike and Shoot’em Up.
In other words, it’s a character-mode shooter. Don’t expect anything nice, this was just a result of an afternoon’s play with the S-Lang lib functions. Move the ship with the keys wasd or hjklyubn (all lowercase), shoot with the spacebar, quit with Q (uppercase). Every time an enemy collides with you, you lose 2 HP.
Updated: now with more than one version and used as example of C programming, here.
Things to do in Emacs 22: regexp
Stevey’s Blog Rants: Shiny and New: Emacs 22
It’s just like a normal M-x {query-}replace-regexp, but you’ll prefix any lisp expressions in the replacement string with the sequence `\,’ (i.e., a backslash and a comma). In this case, we match the whole word, and invoke the Emacs-Lisp function `capitalize’ to capitalize the word we just matched:
M-x replace-regexp
Replace regexp: \(\w+\)
Replace regexp with: \,(capitalize \1)
Movie: Wanted
English version below.
Coisas que eu aprendi com este filme:
- Cera de vela é um remédio curativo extremamente potente.
- Se o coração de uma pessoa for acelerado a 400 batimentos por minuto, esta pessoa ficará mais rápida e ágil, ao invés de morrer de derrame.
- Os tecelões medievais não só já conheciam código binário, como também já conheciam a tabela ASCII[*].
- Nunca, nunca, NUNCA fique de pé sobre um ‘X’.
[*] se ainda fosse EBCDIC eu até entendia… 😉
Things I’ve learned with this movie:
- Candle wax is an extremely powerful curative medication.
- If a person’s heart accelerates until 400 beats per minute, this person will become faster and nimbler, instead of dying of stroke.
- The medieval weavers not only already knew binary code, but also already knew the ASCII table[*].
- Never, EVER stand over the x spot.
[*] if it was EBCDIC I would understand… 😉
Plonq
English version below.
Faz um tempo que encontrei por acaso um joguinho chamado Qonk. Simples, pequeno, mas criativo. Exige estratégia e rapidez. Basicamente, o objetivo é conquistar um sistema solar, eliminando os concorrentes, conquistando outros planetas, e usando as naves espaciais produzidas por esses planetas para conquistar outros.
Também faz um tempo que conheci a linguagem Lua. Simples, pequena, mas criativa e bem flexível. E para conhecer melhor a linguagem e brincar um pouquinho com ela, instalei uma variante da mesma no meu Palm Tungsten: Plua. Como a melhor forma de aprender uma linguagem de programação é escrever um programa nela, resolvi tentar fazer um joguinho: um pequeno clone do Qonk. O jogo ainda não está completo mas já está funcional. Coloquei o jogo e o código fonte aqui:
Plonq
Some time ago I found a little game called Qonk. Simple but creative, it requires strategy and quick thinking. Basically, the goal is to conquest a solar system, eliminating the adversaries, conquering more planets, and using the spaceships produced by those planets to conquer others.
Some time ago, I also knew the Lua language. Simple, small, but creative and flexible. And in order to know it better, I installed a variant of it in my Plam Tungsten: Plua. Since the better way to learn a new programming language is to write a program in it, I decided to try making a little game: a Qonk clone. The game isn’t complete yet but already works. I’ve uploaded the game and its source code here:
Plonq
Pac-Man explained
English version below.
Lembram do romor sobre o filme do Pac-Man que rolou um tempo atrás? Bem, isto não tem conexão com o filme, mas provavelmente poderia ser a única explicação racional para a história do Pac-Man…
http://www.chrisroberson.net/2008/05/pac-man.html
Eu quero uma camiseta com essa imagem.
Remember the Pac-Man movie rumor a while back? Well, this is not connected to the movie, but this probably could be the only rational explanation behind Pac-Man’s story…
http://www.chrisroberson.net/2008/05/pac-man.html
I want a T-shirt with that pic.