Sorry, this entry is only available in Português Brasil.
05
May 09
Old School Techniques
Talking about old times stuff at the breakfast, it was so fortunate that I’ve already read a post about this issue earlier today.
Old-school programming techniques you probably don’t miss
I’m not a punch card time guy, but concerns like memory footprint size, code running faster and thread limitations still go around my mind nowadays.
Don’t forget to take a look at the comments section for more funny and informative stories.
28
Apr 09
Python-Debian Packaging for Maemo
Packaging a software component made using python to a Maemo device could be easier, if CDBS cared about hand-held devices and their limitations.
Knowing that using setup.py was the Right Way of Doing It™ for python applications I tried to push myself into making CDBS work together, but not without a little harassment.
First of all, such scope-limited distributions tend to gather components in customized places as to promote integration between them or just in sake of a plain different organization. This difficulty can be overcome by using pycentral and including the following line at debian/rules file.
|
1 |
export DH_PYCENTRAL=nomove |
Just as the manpage says, this will prevent the build-system from moving the files from the selected install prefix to a central place (like
/usr/share/pycentral).
Secondly, because of limited storage capacity and speed-up necessities, usually python components install just their .pyo files. This requirement made me struggle trough CDBS’ python-distutils.mk source code in hope for a simple fix. The answer I’ve found was to overrule the python-install target with the following commands (look here for the diff).
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
define FIXUP_DIST
-find $(DEB_DESTDIR) -name '*.py' -exec rm -f {} \;
-find $(DEB_DESTDIR) -name '*.pyc' -exec rm -f {} \;
-find $(DEB_DESTDIR) -name '*.egg-info' -type d -exec rm -rf {} \;
endef
ifeq (all, $(cdbs_python_module_arch))
common-install-arch common-install-indep:: python-install-py
python-install-py:
cd $(DEB_SRCDIR) && $(call cdbs_python_binary,python$(cdbs_python_compile_version)) $(DEB_PYTHON_SETUP_CMD) install --root=$(DEB_DESTDIR) $(DEB_PYTHON_INSTALL_ARGS_ALL)
$(call FIXUP_DIST)
else
common-install-arch common-install-indep:: $(addprefix python-install-, $(cdbs_python_build_versions))
python-install-%:
cd $(DEB_SRCDIR) && $(call cdbs_python_binary,python$*) $(DEB_PYTHON_SETUP_CMD) install --root=$(DEB_DESTDIR) $(DEB_PYTHON_INSTALL_ARGS_ALL)
$(call FIXUP_DIST)
endif # archall detection |
Let’s say it’s inside a file named debian/fixup.mk, then my complete debian/rules file would be like this.
|
1 2 3 4 5 6 7 8 9 |
#!/usr/bin/make -f
DEB_PYTHON_SYSTEM=pycentral
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk
include debian/fixup.mk
export DH_PYCENTRAL=nomove |
And this is the beauty of CDBS, a file which would be several lines long gets resumed to a few lines.
I’m still trying to find a way to make this code available for all my components without installing it to a globally reachable path, but did not find a thing such as a MAKEFILEPATH variable untill now. I guess a package like cdbs-maemo-dev.deb would be an appropriate place for stuff like this, but pushing it there is for another post.
09
Apr 09
Vim Scripting Using Python
Trying to solve a colleague’s problem when editing Edje files, I pushed myself into learning how to do scripting inside Vim.
Scripting wasn’t ever my choice for reasonably complex editing tasks since I refused to learn Yet Another Scripting Language just because my favorite editor wanted me to. But, for the sake of all lazy guys like me, Vim started to add python support, and python was a must learn bullet in my language listing.
However, not everything are flowers and the entry point must be configured using common vim script. Well, at least until vim supports python from its core, which – I believe – is not far from possible, since python integration has been voted as top priority for a long time.
To successfully import your python script inside vim context, one can wrap it into a vim function in an external file. Let’s call it extras.vim.
|
1 2 3 4 5 6 7 8 9 10 11 |
" Title-ize sentences using python str methods
function! PyMakeTitle() " the ! erases previous definitions
python << END " here-document (bash-style), read 'till given word
import vim
w = vim.current.window
b = vim.current.buffer
line, col = w.cursor
line -= 1
b[line] = b[line].title() # str.title() method
END
endfunction |
After using :source extras.vim command to load it, one can call this function by typing :call PyMakeTitle(). Remember repeating the :source step every time the script gets updated.
The net effect of this function is to turn all initial word letters in the current line into capitals. It proved me to be useful when editing a large LaTeX document where all section titles were small letters only.
If it comes to be a very useful function, you may map it to a key-stroke by using :nmap \t :call PyMakeTitle()<CR> inside your vimrc script.
A more complex example accessing internal vim properties. Ok, it’s a bit useless, but it demonstrates well such features.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
" Auto Documentation (example code)
function! PyCreateDoc()
python << END
import vim
name = vim.eval("expand(\"<cword>\")") # expand word under cursor
ts = int(vim.eval("&ts")) # tab space property
il = int(vim.eval("indent(\".\")")) # indentation on current line
w = vim.current.window
l, c = w.cursor
docstr = '%s# @brief %s - write description' % (' ' * il, name)
b = vim.current.buffer
b[l-1:l-1] = [ docstr ]
print 'Indent set is %d, cursor at (%d, %d)' % (ts, l, c)
END
endfunction |
With the cursor over a function name, type :call PyCreateDoc() and watch it insert a line above containing doxygen-like formatting.
For more examples, there is an excellent material at vim’s online help (see :h python). Furthermore, there are some plugins being made using only python, take a look at Omni Completion for Python (pythoncomplete.vim) for a good reference on the power of using python inside vim.
Happy Easter Vim’ing!
25
Mar 09
Git References’ Pointers
Earlier this year I’ve spent some time gathering references to study Git, the version control system everybody seems to love nowadays.
Thankfully, someone took the time to bind several useful links in one central webpage. If you wanna start studying Git, that’s the place to start. Kudos for such practical people (more specifically Scott Charcon and Petr Baudis).
http://git-scm.com/documentation
Just for reference, I’ll paste below the stuff I had.
Forwarded conversation
Subject: Git Documentation Pointers
————————
From: Milton Soares
Date: Mon, Jan 19, 2009 at 12:33 PMHi.
Just to organize and share all the references I’ve gathered about Git learning.
On-line Resources
$ git help git
$ man gittutorialGit Homepage Resources
http://www.kernel.org/pub/software/scm/git/docs/everyday.html
http://www.kernel.org/pub/software/scm/git/docs/user-manual.htmlSVN to Git crash course
http://git.or.cz/course/svn.html
Recording of the Git tutorial given by Bart Trojanowski for the OGRE
http://excess.org/article/2008/07/ogre-git-tutorial/
Palestra Git para o Google by Linux Torvalds
http://br.youtube.com/watch?v=4XpnKHJAok8
Git from the bottom up
http://www.newartisans.com/blog_files/git.from.bottom.up.php
———-
From: Milton Soares
Date: Tue, Jan 20, 2009 at 4:36 PMMore pointers:
GitWine – git tips by wine people
http://wiki.winehq.org/GitWine#head-079f5369fdb9346845a4a8c82475eb7a198312be
Git Wizardry
http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html
Git Wiki
Git Cheat Sheet
http://ktown.kde.org/~zrusin/git/
———-
From: Milton Soares Filho
Date: Sat, Feb 21, 2009 at 11:15 AMYet another usefull link (pretty graphical explanations on git objects).
Tv’s cobweb: Git for Computer Scientists
http://eagain.net/articles/git-for-computer-scientists/
19
Sep 08
Scrum Talk @ MAO
Por iniciativa da consultoria Massimus, ocorreu em Manaus, dia 2007-08-14 a partir das 20hs na sede da FGV uma palestra sobre desenvolvimento ágil, com tema Agile Estimating and Planning.
A palestrante foi Martine Devos, já conhecida do meu tempo prestando serviço para a BenQ-Siemens. Infelizmente os links para download dos slides no site da consultoria estão quebrados, porém os tópicos apresentados passam pelos abaixo.
- CaracterÃsticas do bom planejamento
- Problema da pirâmide Escopo x Prazo x Custo
- Exemplo de criação de estimativa ágil
O mais bacana dessas palestras sobre metodologias ágeis é perceber a reação da platéia, que frequentemente espanta-se ao encarar alguma definição ou processo totalmente diferente do que as disciplinas tradicionais de gerenciamento prezam – gerenciamento v1.0 ou industrial, como tenho visto em alguns lugares.
Pessoalmente, chamaram-me a atenção dois pontos, um sobre convergência na estimativa de tarefas e outro sobre mensuração de tarefas desconhecidas/inovadoras (como as wildcards do livro do Bruce Eckel).
Na primeiro, expus minha dúvida sobre a melhor maneira de proceder quando a equipe não chega num consenso quanto a estimativa de uma tarefa. A sugestão foi simples e direta: estimar em equipe consiste em fazer as perguntas certas sobre o problema atacado, de modo a quebrá-lo cada vez mais em problemas menores e consequentemente mais fáceis de estimar. Nada de fórmula mágica ou insegurança subjetiva, somente o bom e velho dividar pra conquistar que todos que já desenvolveram software já estão cansados de ouvir falar.
No segundo, pedi orientação sobre como uma equipe novata ou com pouca experiência no assunto do problema a resolver pode melhorar a qualidade de sua estimativa. Achei o método apresentado fantástico. O segredo é basear-se numa estimativa de algo conhecido – ou seja, estimativa de maior qualidade – e confiar na capacidade do cérebro de associação. Na prática, não se diz que uma tarefa pouco familiar X dura tantas horas, mas sim que essa mesma tarefa pode durar 3 vezes o tempo da tarefa Y, que se conhece muito bem.
Vale também lembrar que as práticas ágeis permitem refinamento com o passar do tempo, ou seja, quanto mais iterações houverem e mais histórico sua equipe construir, maior será a qualidade de suas estimativas. Aprende-se e agrega-se este aprendizado dentro do próprio projeto.
Parabéns ao pessoal da Massimus, Martine, Heitor Roriz e Mario Tomaselli, pela iniciativa. Acho muito importante trazer esses conceitos de ponta pra uma região tão cheia de projetos de software como o Pólo Industrial de Manaus, pois tenho muita fé que essas idéias trarão uma grande melhora nas condições de trabalho locais e na qualidade dos produtos desenvolvidos.
13
Feb 07
Formatura da Marrrrtha
Passei uma semana em Curitiba pra aproveitar a formatura da minha irmã, agora uma Turismóloga (ou turista, nunca sei direito, hehehe) capacitada pela Faculdades Integradas Curitiba.
A colação aconteceu no dia 01Fev, no anfiteatro do campus da rua Chile. Pra variar foi massante, mas valeu pra rever parentes a muito sumidos (meu caso, principalmente), presenciar o discurso de agradecimento aos ausentes proferido pela minha irmã (arranjamos até um vÃdeo pirata dele) e tomar uns goles na cachaçaria depois da cerimônia.
Já no baile a coisa foi diferente. Com carta branca do meu pai (hmm, carta cinza na verdade, mas não forcei a vista pra ver a diferença), desci três litros de Red Label em comemoração, um deles antes mesmo de sair de casa. O povo se divertiu demais! A noite inteira zoando com a famÃlia, com o Dinho Ouro Preto, namorado da minha irmã e com os poucos amigos que compareceram. Ganhei até um autógrafo no peito da celebridade presente.
SaÃmos do salão do clube Santa Mônica perto das seis da madrugada, com a firme intenção de tomarmos café-da-manhã juntos num tal de Babilônia. É claro que ninguém acertou o caminho. Teve neguinho que saiu do carro no meio da rua pra fechar a janela do outro lado. Até agora tento me lembrar como cheguei em casa, mas só recordo até o momento que larguei a Kaysa em casa (sim, eu estava dirigindo).
Parabéns, mana, muita sorte pra você nessa nova etapa de sua vida.
19
Jan 07
A Saga do Aparelho – A Amenização
Larguei os bets em Canoa Quebrada, resolvi fazer a barba com lâmina cega mesmo. Fogo é aguentar a coceirada no dia seguinte, ainda mais pra mim que já não tenho uma pele muito boa. Confira o antes e depois nas fotos abaixo.
Jà cheguei em Recife/PE e nada da bendita lâmina. Começo a achar que só em Taiwan pra encontrá-la. Paciência…
01
Jan 07
A Saga do Aparelho de Barbear
Ano retrasado comprei um aparelho de barbear elétrico da Philips (philipshave ph-444) pra tentar me livrar do domÃnio maléfico que a gillette ™ exercia em minha vida. Comprar refil de lâmina manual a cada duas barbeadas estava ficando muito chato e muito caro também. Sem falar que apertando a distribuição das lâminas de modelos mais antigos, a empresa praticamente obrigava os usuários a comprarem modelos mais novos (mais caros também).
Após um investimento razoável – uns duzentos reais na época -, passei seis meses maravilhado com a maquininha. Simples, limpo, prático e deixava uma textura agradável (ao menos não recebia muitas reclamações, hehehe).
Agora vem a armadilha manjada que caà de novo. A lâmina do aparelho elétrico não é eterna. Dura bastante, mas eventualmente deve ser substituÃda. Nesse ponto eu me danei, pois não encontrei uma loja em Manaus que vendesse a bendita. Em Belém não consegui procurar e em São LuÃs nada até agora.
Vamos ver até que estado terei que descer pra encontrar essa coisa. Enquanto isso vou deixando a barba crescer. Azar de quem me vê com essa cara de ogro.
PS: outra hora posto uma foto do meu estado lamentável.
15
Dec 06
Silêncio no Rádio
File -> Work Offline
Estou na eminência da viagem pelo litoral do Brasil, desde Belém até Porto Alegre. A internet aqui no apartamento está pra ser desativada junto com a linha telefônica. Isso significa ainda menos atividade aqui neste blog
Mas não se preocupem, manterei todos informados a partir do site que o Thiago preparou para a viagem.
Povo, não espere muita interação aqui a partir de agora. Estou saindo em breve de viagem pelo litoral brasileiro, desde Belém até o sul do paÃs. Quem quiser acompanhar, tentarei atualizar os blogs abaixo o máximo possÃvel.Blog Viagem: http://www.rockpesado.com.br
Blog Pessoal: http://msoares.dreamhosters.comAh, e-mail também terá prioridade maior que scrapbook
Sucesso pra todos.![]()