<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Antonio Terceiro's RSS feed</title><link>http://softwarelivre.org/terceiro</link><description>Antonio Terceiro's content published at Software Livre Brasil</description><item><title>How to make a grad student freak out</title><description>&lt;p&gt;So that grad student has just submitted his thesis and you are
invited to review it. With these quick tips, you can test the
limits of the student&amp;#8217;s willpower, and make his degree a little
more deserved by putting him up for some constructive mind games.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://softwarelivre.org/articles/0043/3370/how-to-make-a-grad-student-freak-out.png" alt="" /&gt;&lt;/p&gt;</description><pubDate>Sun, 20 May 2012 10:43:59 -0300</pubDate><link>http://softwarelivre.org/terceiro/blog/how-to-make-a-grad-student-freak-out</link><guid>http://softwarelivre.org/terceiro/blog/how-to-make-a-grad-student-freak-out</guid></item><item><title>Chamada de grupos de usuários Debian no Brasil</title><description>&lt;p&gt;Um tempo atrás o servidor de listas do &lt;span class="caps"&gt;CIPSGA&lt;/span&gt;, onde ficavam as listas
dos grupos de usuários Debian, subiu no telhado.&lt;/p&gt;
&lt;p&gt;A partir de hoje vamos recriar as listas dos grupos de
usuários na infraestrutura do próprio Debian. Pra isso, vamos utilizar o projeto &lt;a href="http://alioth.debian.org/projects/debian-br"&gt;debian-br no alioth&lt;/a&gt; e criar as listas lá dentro.&lt;/p&gt;
&lt;p&gt;A lista principal, usada pra articulação dos grupos de usuários regionais (ou seja, a lista antes conhecida como &amp;#8220;debian-br&amp;#8221;), vai ser a &lt;a href="https://lists.alioth.debian.org/mailman/listinfo/debian-br-geral"&gt;debian-br-geral&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;O padrão de nomes para as listas regionais vai ser o seguinte: debian-br-gud-&lt;code&gt;$uf&lt;/code&gt;, onde &lt;code&gt;$uf&lt;/code&gt; é a sigla do estado. Por exemplo, as listas para o Debian-RS e Debian-BA já foram criadas, e são chamadas debian-br-gud-rs debian-br-gud-ba, respectivamente.&lt;/p&gt;
&lt;p&gt;Para solicitar a criação de novas listas, favor criar um &lt;a href="http://alioth.debian.org/tracker/?group_id=30064"&gt;novo tíquete&lt;/a&gt; no projeto debian-br, do tipo &amp;#8220;Support Request&amp;#8221;.&lt;/p&gt;
&lt;p&gt;Infelizmente, não se tem backup sequer da lista de e-mails inscritos; por isso, além de recriar as listas vai ser necessário que todo mundo se inscreva novamente. Depois da criação da lista do seu estado, favor espalhar a notícia!&lt;/p&gt;</description><pubDate>Fri, 23 Mar 2012 22:17:54 -0300</pubDate><link>http://softwarelivre.org/terceiro/blog/chamada-de-grupos-de-usuarios-debian-no-brasil</link><guid>http://softwarelivre.org/terceiro/blog/chamada-de-grupos-de-usuarios-debian-no-brasil</guid></item><item><title>Thesis submitted</title><description>&lt;p&gt;Last Friday, after 5 long years, I have finally submitted my PhD thesis. It was
quite a relief, more or less as if an elephant was taken off my back.&lt;/p&gt;
&lt;p&gt;An English title for my thesis would be &lt;em&gt;Structural Complexity Characterization in Software Systems&lt;/em&gt;. Here is an abstract:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This thesis proposes a theory to characterize structural complexity in
software systems. This theory aims to identify (i) the contribution of
several factors to the structural complexity variation and (ii) the
effects of structural complexity in software projects.
Possible factors in the structural complexity variation include: human
factors, such as general experience of the developers and their
familiarity with the different parts of the system; factors related to
the changes performed on the system, such as size variation and change
diffusion; and organizational factors, such as the maturity of the
software development process and the communication structure of the
project.
Effects of structural complexity include higher effort, and consequently
higher cost, in software comprehension and maintenance activities.&lt;/p&gt;
&lt;p&gt;To test the validity of the proposed theory, four empirical studies were
performed, mining data from free software project repositories. We
analyzed historical data from changes performed in 13 systems from
different application domains and written in different programming
languages.&lt;/p&gt;
&lt;p&gt;The results of these studies indicated that all the factors studied
influenced the structural complexity variation significantly in at least
one of the projects, but different projects were influenced by different
sets of factors. The models obtained were capable of describing up to
93% of the structural complexity variation in the projects analyzed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Keywords:&lt;/strong&gt;
Structural Complexity,
Software Maintainance,
Human factors in Software Engineering,
Mining Software Repositories,
Theories in Software Engineering,
Empirical Software Engineering,
Free/Open Source Software Projects.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Those who read Portuguese can check out &lt;a href="http://app.dcc.ufba.br/~terceiro/tese.git"&gt;the actual thesis
text&lt;/a&gt; as a &lt;span class="caps"&gt;PDF&lt;/span&gt; file.&lt;/p&gt;
&lt;p&gt;Most of the studies discussed in the thesis are presented in English in &lt;a href="/terceiro/publications"&gt;papers&lt;/a&gt; I have published during the last years.&lt;/p&gt;
&lt;p&gt;My defense is going to be on March 23rd. If you happen to be at Salvador at that day, please feel cordially invited.&lt;/p&gt;</description><pubDate>Tue, 28 Feb 2012 21:44:52 -0300</pubDate><link>http://softwarelivre.org/terceiro/blog/thesis-submitted</link><guid>http://softwarelivre.org/terceiro/blog/thesis-submitted</guid></item><item><title>A visual cheat sheet for ANSI color codes</title><description>&lt;p&gt;Now and then I want to output some &lt;a href="http://en.wikipedia.org/wiki/ANSI_escape_code"&gt;&lt;span class="caps"&gt;ANSI&lt;/span&gt; color escape codes&lt;/a&gt; from software I write, and I always end up doing some trial-and-error to figure out the exact codes I want. Sometimes it&amp;#8217;s overkill to add a dependency on an &lt;a href="http://packages.debian.org/sid/ruby-term-ansicolor"&gt;existing library&lt;/a&gt; that already deals with it, or the language I am using does not have one.&lt;/p&gt;
&lt;p&gt;There are a lot of listings of the &lt;span class="caps"&gt;ANSI&lt;/span&gt; color codes out there, but I couldn&amp;#8217;t find one that matches the actual codes with the resulting effect in a visual way. Even the Wikipedia article has a colored table with the actual colors, but I have to lookup manually which code combination produces which color.&lt;/p&gt;
&lt;p&gt;So I spent a few minutes to write a shell script that prints all useful combinations, formatted with themselves. This way I can quickly figure out which exact code I want to achieve the desired effect.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://softwarelivre.org/articles/0040/0610/ansi-color-demo.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The code for now is &lt;em&gt;very simple&lt;/em&gt;:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;
#!/bin/sh -e

for attr in $(seq 0 1); do
  for fg in $(seq 30 37); do
    for bg in $(seq 40 47); do
      printf "\033[$attr;${bg};${fg}m$attr;$fg;$bg\033[m "
    done
    echo
  done
done
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Is there a package in Debian that already does that? Would people find it useful to have this packaged?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;update:&lt;/strong&gt; it turns out you can find some similar stuff on google images. It was a quick and fun hack, though.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;update 2:&lt;/strong&gt; Replacing &lt;code&gt;echo -n&lt;/code&gt; with &lt;code&gt;printf&lt;/code&gt; makes the script work independently if /bin/sh is bash or dash. Thanks to &lt;em&gt;cocci&lt;/em&gt; for pointing that out.&lt;/p&gt;</description><pubDate>Sat, 28 Jan 2012 11:17:28 -0200</pubDate><link>http://softwarelivre.org/terceiro/blog/a-visual-cheat-sheet-for-ansi-color-codes</link><guid>http://softwarelivre.org/terceiro/blog/a-visual-cheat-sheet-for-ansi-color-codes</guid></item><item><title>Life after exec()</title><description>&lt;p&gt;From the &amp;#8220;not necessarily big news, but still useful&amp;#8221; department.&lt;/p&gt;
&lt;p&gt;The situation: for Very Good Reasons™&lt;sup class="footnote"&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;, you want to replace your current process by calling &lt;a href="http://en.wikipedia.org/wiki/Exec_%28operating_system%29" title=""&gt;exec&lt;/a&gt;, but you still want to have the chance to do something after the process you exec()ed finishes.&lt;/p&gt;
&lt;p&gt;This is a simple technique I just came up with: just before replacing the current process by calling &lt;code&gt;exec()&lt;/code&gt;, you &lt;a href="http://en.wikipedia.org/wiki/Fork_%28operating_system%29"&gt;&lt;code&gt;fork()&lt;/code&gt;&lt;/a&gt; a process in the background that will wait for the current process id to disappear from  the process list, and then does whatever you want to do.&lt;/p&gt;
&lt;p&gt;A simple proof-of-concept I wrote is composed of two bash programs: &lt;code&gt;wrapper&lt;/code&gt; and &lt;code&gt;real&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;real&lt;/code&gt; is really simple: it just waits a few seconds and then prints its process id to the console:&lt;/p&gt;
&lt;pre style="background: #eeeeec; padding: 5px; border: 1px solid #d3d7cf;"&gt;&lt;code style="color: #2e3436;"&gt;#!/bin/bash
  
sleep 5
echo $BASHPID
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;wrapper&lt;/code&gt; is the program that handles the situation we want to exercise: it replaces itself with &lt;code&gt;real&lt;/code&gt;, but still has the chance to do something after &lt;code&gt;real&lt;/code&gt; finishes. In this case, &lt;code&gt;wrapper&lt;/code&gt; notifies the user that &lt;code&gt;real&lt;/code&gt; finished.&lt;/p&gt;
&lt;pre style="background: #eeeeec; padding: 5px; border: 1px solid #d3d7cf;"&gt;&lt;code style="color: #2e3436;"&gt;#!/bin/bash

echo $BASHPID
real_program_pid=$BASHPID
(
  while ps -p "$real_program_pid" &amp;gt;/dev/null; do
    sleep 0.1s
  done
  notify-send 'real program finished'
) &amp;amp;
exec ./real
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;One nice property that &lt;code&gt;wrapper&lt;/code&gt; explores is that when &lt;code&gt;exec()&lt;/code&gt; starts &lt;code&gt;real&lt;/code&gt;, it really &lt;strong&gt;replaces&lt;/strong&gt; &lt;code&gt;wrapper&lt;/code&gt;, and therefore has the same process id (in this case accessible by bash in the &lt;code&gt;$BASHPID&lt;/code&gt; variable). Because of this, the background process that &lt;code&gt;wrapper&lt;/code&gt; starts just before the &lt;code&gt;exec()&lt;/code&gt; call already knows which process it has to watch for.&lt;/p&gt;
&lt;p&gt;The actual code for waiting is not optimal, though. I cannot use &lt;code&gt;waitpid()&lt;/code&gt; (the &lt;code&gt;wait&lt;/code&gt; builtin in bash), since &lt;code&gt;real&lt;/code&gt; is not a child process of &lt;code&gt;wrapper&lt;/code&gt;. I went with a brute force approach here, and I am pretty sure there is a cheaper way to wait for a random &lt;span class="caps"&gt;PID&lt;/span&gt; without a busy loop (but that wasn&amp;#8217;t the point here).&lt;/p&gt;
&lt;p&gt;&lt;a name="fn1" /&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt;
&lt;strong&gt;update:&lt;/strong&gt; I &lt;em&gt;am&lt;/em&gt; aware of the classic &lt;code&gt;fork()&lt;/code&gt;/&lt;code&gt;exec()&lt;/code&gt; pattern. My Very Good Reasons™ include the fact that I can&amp;#8217;t control the flow: I am writing a plugin for a program that calls its plugins in sequence, and after that, calls &lt;code&gt;exec()&lt;/code&gt;, but my plugin is interested in doing some work after &lt;code&gt;exec()&lt;/code&gt; finishes.&lt;/p&gt;</description><pubDate>Mon, 09 Jan 2012 10:43:56 -0200</pubDate><link>http://softwarelivre.org/terceiro/blog/life-after-exec</link><guid>http://softwarelivre.org/terceiro/blog/life-after-exec</guid></item></channel></rss>
