<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Divagations of a developer</title>
	<atom:link href="http://baraujo.net/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://baraujo.net/blog</link>
	<description>Thoughts about software development, information retrieval and sometimes about fun stuff</description>
	<lastBuildDate>Sat, 08 May 2010 21:58:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Parallel package downloads for Debian-based distros</title>
		<link>http://baraujo.net/blog/?p=77</link>
		<comments>http://baraujo.net/blog/?p=77#comments</comments>
		<pubDate>Wed, 07 Apr 2010 15:40:32 +0000</pubDate>
		<dc:creator>baraujo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://baraujo.net/blog/?p=77</guid>
		<description><![CDATA[When trying to install some packages in my Karmic box and noticing that it would take a long time, I wondered why the downloads couldn&#8217;t be made in parallel &#8211; the one-of-a-time download method used by apt-get is far from optimal. A quick search resulted in these very useful blog posts &#8211; it seems that [...]]]></description>
			<content:encoded><![CDATA[<p>When trying to install some packages in my Karmic box and noticing that it would take a long time, I wondered why the downloads couldn&#8217;t be made in parallel &#8211; the one-of-a-time download method used by <code>apt-get</code> is far from optimal. A quick search resulted in these <a href="http://johntellsall.blogspot.com/2009/04/fast-parallel-downloading-for-apt-get.html" target="_blank">very</a> <a href="http://www.humbug.in/2010/fast-parallel-downloadingupgrading-for-ubuntu-using-aptitudeapt-getaria2c/" target="_blank">useful</a> blog posts &#8211; it seems that I wasn&#8217;t the only one with that question in my mind. So, starting from the solution from the second hyperlink and putting all inside a single bash script, we have:</p>
<pre class="brush: bash;">
#!/bin/bash
# Must be run with sudo or as (gasp!) root

apt-get -y --print-uris install &quot;$@&quot; |
egrep -o -e &quot;http://[^\']+&quot; |
aria2c -c -d /var/cache/apt/archives -i - &amp;&amp; apt-get install &quot;$@&quot;
</pre>
<p>You&#8217;ll need <code>aria2</code> for this, download it in the classic way <img src='http://baraujo.net/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> . In a nutshell, the script obtains the list of packages do be downloaded, pass them to <code>aria2</code> for downloading and runs the proper install command in the end. Now you just have to <code>chmod u+x</code> and it you&#8217;re set. For example, if you wanted to use <code>xfce4</code> in your Ubuntu box instead of Gnome, you could just do</p>
<pre class="brush: bash;">
$ sudo ./parallelInstall.sh xubuntu-desktop
</pre>
<p>and go grab a coffee. Other apt-get commands work: if you want to do an <code>apt-get upgrade</code> just change <code>install</code> to <code>upgrade</code> (or <code>dist-upgrade</code>) in the script. The script is not fully automated, you see &#8211; the last command may need mandatory interaction because installing things may nicely break your system without your ever noticing until the damage is done. If all the packages are from official repos and signed and whatnot, though, all will happen in a very automatic way <img src='http://baraujo.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Although this script is tailored for Debian-flavored distros, you could just adapt the first and last commands to match your favourite distro.</p>
]]></content:encoded>
			<wfw:commentRss>http://baraujo.net/blog/?feed=rss2&amp;p=77</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using an TV as secondary screen via HDMI &#8211; 1</title>
		<link>http://baraujo.net/blog/?p=63</link>
		<comments>http://baraujo.net/blog/?p=63#comments</comments>
		<pubDate>Tue, 26 Jan 2010 03:15:18 +0000</pubDate>
		<dc:creator>baraujo</dc:creator>
				<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[hdmi]]></category>
		<category><![CDATA[hdtv]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[netbook]]></category>

		<guid isPermaLink="false">http://baraujo.net/blog/?p=63</guid>
		<description><![CDATA[Why watch your favorite movie in your tiny netbook screen instead of a big fancy HDTV? If your box has a HDMI port, it's (kinda) easy.]]></description>
			<content:encoded><![CDATA[<p>If you have a fancy HD television and a box with a HDMI port, it&#8217;s (kinda) easy to setup your TV as a secondary monitor at full resolution, with audio support. Needless to say, it&#8217;s great for watch all those HD movies in a big TV instead of staring at your monitor or a small netbook screen <img src='http://baraujo.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>First, the video. Run <code>xrandr</code> and see which devices you have available. My Acer AS1410-8414 running Arch Linux gives thi﻿s output:</p>
<p><code> Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 8192 x 8192<br />
VGA1 disconnected (normal left inverted right x axis y axis)<br />
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 256mm x 144mm<br />
1366x768       60.0*+<br />
1024x768       85.0     75.0     70.1     60.0<br />
832x624        74.6<br />
800x600        85.1     72.2     75.0     60.3     56.2<br />
640x480        85.0     72.8     75.0     59.9<br />
720x400        85.0<br />
640x400        85.1<br />
640x350        85.1<br />
HDMI1 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 698mm x 392mm<br />
1920x1080      50.0*+   60.0<br />
1280x720       60.0     50.0<br />
720x576        50.0<br />
DP1 disconnected (normal left inverted right x axis y axis)<br />
HDMI2 disconnected (normal left inverted right x axis y axis)<br />
DP2 disconnected (normal left inverted right x axis y axis)<br />
DP3 disconnected (normal left inverted right x axis y axis)<br />
TV1 disconnected (normal left inverted right x axis y axis)<br />
</code></p>
<p>The GPU is a Intel GMA 4500MHD, by the way. LVDS1 is the default LCD screen and HDMI1 the port I&#8217;m using. So, to maintain your current screen and create a new one in the TV, run:</p>
<p><code>xrandr --output HDMI1 --auto --output LVDS1 --auto --left-of HDMI1 </code></p>
<p>This will output a screen on the TV with automatic resoution (1920&#215;1080, in my case), and also keep the current one in the laptop screen at the left side of the TV. Different GPUs have different ways of doing the same thing &#8211; in a laptop with a Quadro NVS 140M I was able to use <code>nvidia-settings</code> to configure a second monitor, even having the option of a unified desktop using TwinView (the same effect attained here) or two separate X screens. I suspect ATI-based GPUs have a fancy GUI program as well.</p>
<p>In a next post I&#8217;ll explain how to easily redirect the audio to the HDMI port using <a href="http://pulseaudio.org" target="_blank">PulseAudio</a>, if your system insists on outputting sound through your computer speakers. In this case, you could just use a cable with a 3.5mm plug in each end, but why waste plastic and metal when your powerful HDMI cable can transport sound too?</p>
<p>P.S.: I tried to watch a sample from the Apple QuickTime HD Gallery , but my netbook&#8217;s Core2 Solo 1.4GHz just doesn&#8217;t have what it takes to watch 1080p in all its glory. Meh <img src='http://baraujo.net/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://baraujo.net/blog/?feed=rss2&amp;p=63</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Algumas coisas sobre Recuperação de Informação</title>
		<link>http://baraujo.net/blog/?p=43</link>
		<comments>http://baraujo.net/blog/?p=43#comments</comments>
		<pubDate>Mon, 27 Jul 2009 14:49:37 +0000</pubDate>
		<dc:creator>baraujo</dc:creator>
				<category><![CDATA[IR]]></category>
		<category><![CDATA[information retrieval]]></category>
		<category><![CDATA[portuguese]]></category>

		<guid isPermaLink="false">http://baraujo.net/blog/?p=43</guid>
		<description><![CDATA[Uma visão geral sobre o surgimento da área e uma noção bem básica de algumas idéias trazidas por ela.]]></description>
			<content:encoded><![CDATA[<p><em>Antes de mais nada, um disclaimer: As informações postadas por aqui são provenientes da minha experiência pessoal com a área e de algumas pesquisas sobre o tema, portanto não garanto que sejam 100% corretas e/ou precisas. Caso você encontre algum erro ou algo do tipo, me avise nos comentários.</em></p>
<p>Não é novidade pra ninguém que existe mais informação disponível na Internet do que qualquer pessoa pode imaginar, e que é possível encontrar literalmente qualquer coisa que se queira. Devido a este fato, nos dias de hoje os serviços de busca ocupam um lugar central na experiência do usuário da grande rede, sendo integrados aos navegadores e passando a fazer bem mais do que apenas buscar informações textuais &#8211; há busca de imagens, localidades, vídeos e o que mais se puder extrair algum tipo de dado.</p>
<p>Apesar do uso da tecnologia ser recente, a tecnologia em si não é &#8211; remonta aos idos do século e do (pasmem) milênio passado, lá pelos idos de 1975, quando teria sido publicado por um cidadão chamado <a href="http://en.wikipedia.org/wiki/Gerard_Salton" target="_blank">Gerard Salton</a> um artigo entitulado &#8220;A Vector Space Model for Information Retrieval&#8221;,  que lançou as fundações para a Recuperação de Informação. No entanto, apesar de existirem diversas citações a este artigo, não há evidência que tenha sido de fato publicado e sim que tenha sido uma fusão entre dois artigos publicados por Salton neste mesmo ano e que falavam sobre o tema. Se você quiser saber mais detalhes sobre esta história, basta dar uma lida neste documento <a href="http://www.ideals.uiuc.edu/bitstream/2142/1697/2/Dubin748764.pdf">aqui</a>.</p>
<p>Imprecisões históricas a parte, este artigo seminal demonstrava um modelo matemático chamado modelo espaço vetorial, ou simplesmente modelo vetorial. Este modelo representa documentos (conteúdo textual como por exemplo artigos de jornal, páginas Web, artigos científicos, etc) como vetores em um espaço n-dimensional, onde n representa a quantidade de palavras únicas (termos) que ocorrem no interior de todos os documentos, e o problema da busca torna-se então &#8220;apenas&#8221; achar os vetores mais próximos ao vetor correspondente a consulta submetida. Simples, não?</p>
<p>Dito assim, parece tudo muito complicado, portanto vamos a um exemplo gráfico:</p>
<div id="attachment_46" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-46" src="http://baraujo.net/blog/wp-content/uploads/2009/07/vetores-300x244.jpg" alt="Exemplo de espaço vetorial" width="300" height="244" /><p class="wp-caption-text">Exemplo de espaço vetorial</p></div>
<p>Neste exemplo há apenas dois termos <em>pa</em> e <em>pb</em>, resultando em duas dimensões no espaço, e um documento, <em>dj</em>, onde cada termo aparece duas vezes. O vetor <em>q</em> representa uma consulta, que possui uma ocorrência da palavra <em>pb</em> e duas ocorrências de <em>pa</em>. Pode-se notar que há um ângulo θ entre estes vetores, que pode ser utilizado para indicar a distância entre eles. O que é utilizado, no entanto, é o cosseno deste ângulo, pois a medida que o ângulo tende a diminuir o cosseno tende a aumentar, servindo como uma medida prática de proximidade. Desta forma, quanto maior o cosseno, maior é a <em>similaridade</em> entre o documento e a consulta. No final das contas, basta ordenar os documentos por similaridade e <em>voilà</em>, uma consulta acabou de ser processada.</p>
<p>Uma coisa interessante nisso tudo é a noção de similaridade. Uma consulta recupera não só os documentos que contém os termos pesquisados mas também atribui a cada documento um valor que indica o quão <em>similar</em> ele é a consulta realizada, indo um pouco além de apenas fazer uma busca textual como qualquer SGBD faria. Há uma boa dose de matemática por trás disso tudo, pescando coisas da Álgebra Linear e da Teoria da Informação, mas isso é assunto pra um próximo post. Essa idéia de similaridade textual demonstrada aqui ainda é (imagino eu) utilizada em larga escala pelas máquinas de busca existentes nos dias atuais, juntamente com uma série de outros dados obtidos dos documentos para que no final tudo seja combinado em uma fórmula para enfim ordenar tudo para mostrar na tela do navegador. Só que isso também é assunto pra próximo(s) post(s).</p>
<p>Por enquanto é isso. <img src='http://baraujo.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://baraujo.net/blog/?feed=rss2&amp;p=43</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An example of transitional packages in Debian</title>
		<link>http://baraujo.net/blog/?p=17</link>
		<comments>http://baraujo.net/blog/?p=17#comments</comments>
		<pubDate>Fri, 17 Jul 2009 18:27:30 +0000</pubDate>
		<dc:creator>baraujo</dc:creator>
				<category><![CDATA[OSS]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[packages]]></category>

		<guid isPermaLink="false">http://baraujo.net/blog/?p=17</guid>
		<description><![CDATA[A small howto about making transitional packages in Debian(-like) distros.]]></description>
			<content:encoded><![CDATA[<p>When you have to change the name of your package (e.g. for complying with policies) or you make a new package that is meant to replace the old one (e.g. gcc4.2 -&gt; gcc4.3), you&#8217;ll have to deal with the fact that the other packages that use your old package as a dependency will not be immediately updated, or maybe never will. So, to overcome this issue, there is a useful trick: transitional packages.</p>
<p>Transitional packages are essentially proxies &#8211; packages that pull the correct dependencies when installed and can be removed without problems as soon as the installation finishes. Some of these packages also have scripts to make/ease the transition when it is necessary. With this package you&#8217;ll be able to ship your new/updated package without worrying breaking all the others that depend on it (provided that the funcionality stays the same) and then inform the maintainers that their packages need to be upgraded to the new version of the dependency.</p>
<p>As an example, suppose you used to maintain a package named foo that is used by other package, baz. You have made a completely new package, bar, and intend to completely replace foo. So, for making the transitional package, you add these lines to the debian/control file of bar:</p>
<p><code>Source: bar<br />
Section: unknown<br />
Priority: extra<br />
Maintainer: Bruno Araujo &lt;<span class="mh-plaintext">bru<a href='http://mailhide.recaptcha.net/d?k=01LGW2rKPiLtmMffjd5UpJsg==&amp;c=jt_C0g7qpCvQmScwIIwQDs0FZe80UOyCO9Tx_W0UfHE=' onclick="window.open('http://mailhide.recaptcha.net/d?k=01LGW2rKPiLtmMffjd5UpJsg==&amp;c=jt_C0g7qpCvQmScwIIwQDs0FZe80UOyCO9Tx_W0UfHE=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@baraujo.net</span>&gt;<br />
Build-Depends: cdbs, debhelper (&gt;= 5), [bar build dependencies]<br />
Standards-Version: 3.7.2</code></p>
<p><code>Package: bar<br />
Architecture: any<br />
<strong>Provides: foo<br />
Replaces: foo (&lt;&lt; 0.1-2)<br />
Conflicts: foo (&lt;&lt; 0.1-2)</strong><br />
Depends: ${shlibs:Depends}, ${misc:Depends}, [bar dependencies]<br />
Description: &lt;insert up to 60 chars description&gt;<br />
&lt;insert long description, indented with spaces&gt;<br />
</code></p>
<p><strong><code>Package: foo<br />
Architecture: any<br />
Depends: ${shlibs:Depends}, ${misc:Depends}, bar<br />
Description: Transitional package for bar<br />
This is a transitional package for foo, and can be safely removed<br />
after the installation is complete.</code></strong><strong><code><br />
</code></strong></p>
<p>The bold lines are the modification needed for providing the transitional package. Two modification were made:</p>
<ul>
<li>In the Package: bar section, three new keywords were added: Provides, Replaces and Conflics. They will be explained shortly.</li>
<li>The transitional package must have the same name of the package you intend to replace. Usually a short explanation about the nature of the package is written.</li>
</ul>
<p>The three keywords added to the bar package section are used to proper inform dpkg of the transitional package and to decide which actions will be taken should the need arise.</p>
<ul>
<li>The Provides keyword informs dpkg that the package bar provides a &#8220;virtual package&#8221; named foo (more details about virtual packages can be found on the <a href="http://www.debian.org/doc/debian-policy/" target="_blank">Debian Policy</a>)</li>
<li>The package bar should not be installed at the same time as the old package foo, so the Conflicts keyword indicates this.</li>
<li>If a conflict arises, the Replaces keyword indicates which package must be chosen for solving the conflict.</li>
</ul>
<p>Now, when you try to install the package baz, the transitional package foo will be installed with its dependency bar, which is the correct dependency that should be used. For more details about these keywords, see sections 7.4-7.6 of the <a href="http://www.debian.org/doc/debian-policy/" target="_blank">Debian Policy</a>. Note that, in this case, the only transition was pulling the correct dependency; in other cases, when some extra works needs to be done before or after installing the package,  one of the ways to do this work is including the necessary scripts and putting calls to them inside &lt;package&gt;.preinst (pre-installation) and &lt;package&gt;.postinst (post-installation) inside debian directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://baraujo.net/blog/?feed=rss2&amp;p=17</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Welcome. Welcome to City 17&#8230;</title>
		<link>http://baraujo.net/blog/?p=3</link>
		<comments>http://baraujo.net/blog/?p=3#comments</comments>
		<pubDate>Thu, 16 Apr 2009 17:30:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[meta]]></category>

		<guid isPermaLink="false">http://baraujo.net/blog/?p=3</guid>
		<description><![CDATA[&#8230;er, sorry&#8230; I couldn&#8217;t resist. Anyway, as the title of the blog implies, this is where I&#8217;ll write about some things related to software development, open source software and also about some of my topics of interest, e.g. Information Retrieval and Web search engines. &#8220;All work and no play makes Jack a dull boy&#8221;, as [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;er, sorry&#8230; I couldn&#8217;t resist. Anyway, as the title of the blog implies, this is where I&#8217;ll write about some things related to software development, open source software and also about some of my topics of interest, e.g. Information Retrieval and Web search engines. &#8220;All work and no play makes Jack a dull boy&#8221;, as the saying goes, so maybe some posts about gaming (PS3 ftw!) and daily random facts may find their way here. Also, as I&#8217;m not a native speaker, please excuse me if my English seems lousy somehow.</p>
<p>For the time being, I&#8217;ll search for a cool theme for the blog and tweak here and there. As soon as I have some interesting information I&#8217;ll post again <img src='http://baraujo.net/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>P.S.: the title of the post is a homage to Half-Life 2, just start playing it and you&#8217;ll understand. <img src='http://baraujo.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://baraujo.net/blog/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
