blog/archives/2006/11zack's home pagehttp://upsilon.cc/~zack/blog/archives/2006/11/zack's home pageikiwiki2009-11-28T12:00:16Znadahttp://upsilon.cc/~zack/blog/posts/2006/11/nada/2009-01-05T17:01:30Z2006-11-30T09:51:08Z
<h1>NaDa: There are no bugs in NaDa. It is impossible.</h1>
<p><strong><a href=
"http://www.bernardbelanger.com/computing/NaDa/">NaDa</a></strong>
è l'applicazione del giorno (o forse del secolo, ma me l'hanno
segnalata oggi, quindi ...).</p>
<p>Fossi negli autori mi azzarderei pure a mettere un "soddisfatti
o rimborsati": l'ho appena scaricato (ovviamente nella versione
.tar per GNU/Linux) ed in effetti mi sento già meglio!</p>
<p>Sto meditando di fare l'ITP in Debian, però vorrei collaboratori
per un progetto di collaborative maintenance su alioth ... Si
potrebbe pure chiedere la disattivazione del BTS per Nada, tanto
non ha bug ...</p>
<p>Che figata!</p>
<p><em>PS</em> e poi non è mica un byte qualsiasi, ma un
preziosissimo 0x0d !!</p>
stratus i owe you a beerhttp://upsilon.cc/~zack/blog/posts/2006/11/stratus_i_owe_you_a_beer/2009-11-28T12:00:16Z2006-11-30T09:30:32Z
<h1>Stratus: I Owe You a Beer</h1>
<pre><code>bzrtools (0.11.0-1) unstable; urgency=low
* New upstream release. (Closes: #389605)
-- Gustavo Franco <stratus@debian.org> Tue, 28 Nov 2006 12:21:48 -0200
</code></pre>
<p>According to my <a href=
"http://upsilon.cc/~zack/blog/posts/2006/10/bzrtools_not_up_to_date/">informal
bounty</a> I owe you a beer, to be paid at the next Debconf (let's
hope beer prices in Edinburgh have not raised too much since the
last time I've been there!).</p>
<p>Many thanks!</p>
vim ctrl rhttp://upsilon.cc/~zack/blog/posts/2006/11/vim_ctrl_r/2009-11-28T12:00:16Z2006-11-28T12:21:07Z
<h1>Vim's Feature of the Day #1: i_CTRL-R</h1>
<p>I'm really astonished of how much there's to learn about
<a href="http://www.vim.org">Vim</a> and how much you can forget
about it, especially because I consider myself a rather power user
of my beloved editor.</p>
<p>Digging into my <tt>~/.vim/after/ftplugin/tex.vim</tt> I found
some mappings that were laying there from quite a while (I think I
wrote them something like 4 years ago):</p>
<pre><code>vmap ,b "zdi\textbf{<C-R>z}<ESC>
vmap ,e "zdi\emph{<C-R>z}<ESC>
vmap ,t "zdi\texttt{<C-R>z}<ESC>
</code></pre>
<p>Looking at them I went through <tt>:help i_CTRL-R</tt> ... and
it's wonderful! Hitting CTRL-R in insert mode Vim enters in a
"waiting for a register name" mode and when received it inserts its
content without leaving insert mode.</p>
<p>That's amazingly quick, and I'm already addicted to two
<em>combos</em>:</p>
<ul>
<li>
<p><tt>CTRL-R "</tt> which inserts the content of the unnamed
register (i.e. the last stuff you yanked/deleted/...). That's
interesting since I often end up doing: go somewhere, yank, go
somewhere else, enter insert mode, type stuff, exit insert mode,
put, re-enter insert mode</p>
</li>
<li>
<p><tt>CTRL-R +</tt> which inserts the content of the X clipboard,
finally an handy way (or better, a way I'm apparently able to
remember) to copy stuff from a Gnome application and paste it back
in Vim without having to use the "edit" menu</p>
</li>
</ul>
cdbs relevancehttp://upsilon.cc/~zack/blog/posts/2006/11/cdbs_relevance/2009-11-28T12:00:16Z2006-11-16T10:13:24Z
<h1>/me on the Relevance of CDBS</h1>
<p>Whoa, people <a href=
"http://blog.sesse.net/blog/tech/Debian/2006-11-13-13-42_ngngng.html">
discussing</a> <a href=
"http://blog.einval.com/2006/11/14#aaargh_cdbs">about</a> <a href=
"http://blog.drinsama.de/erich/en/linux/debian/2006111502-cdbs-and-nmu">
CDBS</a>, I can't help joining them.</p>
<p>My position: I love CDBS. I started switching <a href=
"http://qa.debian.org/developer.php?login=zack%40debian.org">my
packages</a> to CDBS an year ago or so and nowadays I've almost
finished.</p>
<p>I understand that people not knowing CDBS might have trouble
fixing bugs in my packages, but that's life and it's the same as
having to fix a bug in a software written in a programming language
you are not fond of. It's just a matter of setting a minimal
standard: today people in the NM have to learn debhelper, tomorrow
they will have to learn CDBS too.</p>
<p>I think it's worth the effort, because CDBS, if used extensively
in our archive, has the benefit of providing a single place where
to massively make changes to potentially all packages of the
archive. That's a huge win for QA in Debian. The same does
debhelper, but it only takes care of technical aspects in the
packaging process while CDBS also takes care of behavioural
aspects.</p>
<p>Of course CDBS has drawbacks and nuisances (the available hooks
for examples are not properly standardized nor documented IMO), but
I think it's a step in the right direction. In Debian we should
push more and more toward the <em>possibility</em> of making
changes in a centralized/batch manner, so that when maintainers
tend to get MIA we have a quick and easy way to take over their
unfulfilled duties.</p>
<p>Collaborative maintenance is a social step in that direction,
CDBS is a technical one.</p>
more fp in python 2.5http://upsilon.cc/~zack/blog/posts/2006/11/more_fp_in_python_2.5/2009-11-28T12:00:16Z2006-11-11T10:21:38Z
<h1>More Functional Programming in Python 2.5, where's the
Syntax?</h1>
<p>I'm glad to read that <a href=
"http://www.devx.com/webdev/Article/33005/1954?pf=true">more
functional stuff is coming with Python 2.5</a>, especially for the
introduction of partial application, the heart of functional
programming.</p>
<p>Still, FP is not only about semantics, is also about fostering
code reuse and implementing stuff in more elegant and concise way.
For such stuff to be effective though, a nice and handy syntax is
(IMO) mandatory. Anyone knowing i J. Random Functional Language
(whatever Lisp dialect, ML, Haskell, ...) should be able to guess
how to apply function partially in Python.</p>
<p>Considering that Python has a long history of syntactic
extensions via PEPs (think about <a href=
"http://www.python.org/dev/peps/pep-0202/">list comp</a> or
<a href="http://www.python.org/dev/peps/pep-0289/">generator
expressions</a>) I fail to understand why to apply a function
partially I have to write something as ugly as:</p>
<pre><code>all_evens = functools.partial(all_divided_by, x=2)
</code></pre>
<p>It's only me or the most natural syntax, that everyone would be
able to guess out of the box, would have been:</p>
<pre><code>all_evens = all_divided_by(x=2)
</code></pre>
<p>?</p>
acquisti psicologici mancatihttp://upsilon.cc/~zack/blog/posts/2006/11/acquisti_psicologici_mancati/2009-01-05T17:01:30Z2006-11-10T18:26:47Z
<h1>Acquisti psicologici (mancati)</h1>
<p>Quando ancora abitavo con Luca, io e lui concordavamo sul
principio dell'<em>acquisto psicologico</em>. Sei depresso? Cosa
c'è di meglio dell'acquistare qualcosa per tirarti su?</p>
<p>Credo addirittura di avere letto tempo fa (data la portata della
notizia, probabilmente la fonte sarà la colonna di destra di
<a href="http://www.repubblica.it">Repubblica.it</a>) che
l'acquisto ha sul cervello lo stesso effetto della cioccolata e del
sesso, con il risultato di indurre felicità (chimica). Non è
importante se sia vero o meno, l'importante è l'effetto placebo che
questa convinzione ha su di me.</p>
<p>Data l'idilliaca giornata, oggi ho passato il pomeriggio
<em>tentando</em> di portare a termine acquisti psicologici.</p>
<ul>
<li>
<p>Primo acquisto: <strong>scarpe da pallavolo</strong> e
<strong>borsone per gli allenamenti</strong> (così la pianto di
presentarmi agli allenamenti con le scarpe in mano e l'invicta
sulle spalle). Vado da Decathlon, colleziono i vari item, mi
presento alla cassa, porgo il bancomat alla donzella, digito il
PIN. Lei mi fa: «dice "autorizzazione negata per disponibilità
insufficiente», con l'aria sorniona che sottintende "pulcioso
studentello con il conto in rosso". La tentazione di risponderle,
mentendo, «guardi che posso tornare e comprare la baracca per il
gusto di licenziarla» è forte. Resisto.</p>
<p>Non ho con me la carta di credito, quindi torno a casa per
prenderla. (Giunto a casa indago su cosa sia successo; semplice: ho
scazzato qualche spostamento di denaro da un conto all'altro e sono
effettivamente finito sotto di 200 €. Bene. Le banche sono chiuse
fino a lunedì e non posso invertire la situazione fino ad allora.
Ottimo. Mi toccherà campare sulla carta di credito per il week-end.
Saranno belle scene quelle in cui la presenterò domani sera alla
trattoria sperduta nel nulla pretendendo di pagare con quella.
Sublime.)</p>
<p>Con la carta torno da Decathlon e riesco a portare a casa il
maltolto. L'eccessiva complessità dell'acquisto me ne ha un po'
tolto il gusto, quindi ...</p>
</li>
<li>
<p>Secondo acquisto: <strong>guanti invernali per la moto</strong>.
Vado da Mingarelli, sto 25 minuti a scegliere quelli che fanno per
me, mi presento alla cassa e chiedo «posso pagare con la carta,
veeeeeero?». Risposta: «no, solo bancomat». Meraviglioso. Non
demordo: ho con me la carta, vado a prelevare con essa (spendendo
un fottiliardo per l'operazione, ma non ha importanza, l'acquisto
psicologico viene prima di tutto).</p>
<p>Mi fiondo al bancomat a fianco di Mingarelli, inserisco la
carta, so il PIN (N.B. non è il mio bancomat, ma la mia carta di
credito, sono fortunato da conoscere entrambi i PIN). La
macchinetta mi chiede un PIN di 6 cifre però, quello che io ricordo
ne ha 4 <img src="http://upsilon.cc/~zack/smileys/sad.png" alt=":-(" /></p>
<p>Ancora una volta non demordo, torno a casa, lascio l'auto. Salgo
in casa, verifico il PIN che mi ricordavo: È GIUSTO! sono solo 4
cifre. Scendo, prendo la moto (così potrò subito provare i guanti
nuovi), torno ad un bancomat, inserisco le 4 cifre, premo "conferma
dato", ... e va! Un giro inutile a casa, bastava premere "conferma
dato". W l'aumento del PIL grazie alla benzina consumata dai miei
mezzi di locomozione a scoppio.</p>
<p>Torno da Mingarelli con il contante e porto a casa i guanti.</p>
</li>
</ul>
<p>Che pomeriggio ben speso ...</p>
editing latex the vim wayhttp://upsilon.cc/~zack/blog/posts/2006/11/editing_latex_the_vim_way/2009-11-28T12:00:16Z2006-11-07T08:50:54Z
<h1>Editing LaTeX, the Vim way</h1>
<p><a href=
"http://www.hermann-uwe.de/blog/faster-and-more-comfortable-latex-editing-and-previewing-with-latexmk">
Uwe presented latexmk</a> as its way of previewing LaTeX output
while editing in <a href="http://www.vim.org">Vim</a>.</p>
<p>While I don't know <a href=
"http://www.phys.psu.edu/~collins/software/latexmk-jcc/">latexmk</a>
myself, I'm using quite a lot LaTeX recently (my Ph.D. thesis is
getting huuuge) and I'm co-maintaining <a href=
"http://packages.qa.debian.org/vim-latexsuite">vim-latexsuite</a>
in Debian. With vim-latexsuite what he wants can be achieved quite
easily too.</p>
<p>I keep on editing in Vim and can exploit the following shortcuts
(where <tt><Leader></tt> is usually mapped to backslash):</p>
<ol>
<li>
<p><strong><tt><Leader>ll</tt></strong> compile the current
LaTeX source, the generated format depends on the value of
<tt>g:Tex_DefaultTargetFormat</tt> (I use dvi, for a reason
explained below);</p>
</li>
<li>
<p><strong><tt><Leader>lv</tt></strong> fire up a viewer for
the compiled format, in my case this runs xdvi;</p>
</li>
<li>
<p><strong><tt><Leader>ls</tt></strong> move the DVI viewer
to the point the cursor is currently at in Vim, highlighting (in
xdvi) with a rectangle the current paragraph (believe me, this is
<em>amazing</em>);</p>
</li>
<li>
<p><strong><tt>CTRL+Mouse Click</tt></strong> (this in xdvi) do the
opposite of (3), i.e. move Vim to the point in the LaTeX source
file corresponding to where we clicked in xdvi.</p>
</li>
</ol>
<p>I don't really understand why Uwe want to see working previews
in PDF format, to me PDF is just the final output. DVI is much
better (especially for (3) and (4) above, but also because it takes
less time to be generated).</p>
<p>Oh, and of course vim-latexsuite is able to do a lot more, like
deciding whether LaTeX needs to be run again to fix dangling
references, use the quickfix window to jump to compilation error,
and so on ... End of the SPAM <img src=
"http://upsilon.cc/~zack/smileys/smile.png" alt=":-)" /></p>
<p><strong>PS</strong> these are my latex-specific vim settings
from my <tt>~/.vim/after/ftplugin/tex.vim</tt></p>
<pre><code>setlocal tw=80
setlocal ts=8
setlocal sts=1
setlocal sw=1
setlocal iskeyword+=\\
setlocal makeprg=make
setlocal keywordprg=:help
"setlocal formatoptions+=a
setlocal spell
vmap ,b "zdi\textbf{<C-R>z}<ESC>
vmap ,e "zdi\emph{<C-R>z}<ESC>
vmap ,t "zdi\texttt{<C-R>z}<ESC>
" Latex-Suite
let g:Tex_CompileRule_dvi = 'latex -interaction=nonstopmode -src-specials $*'
if v:servername != ""
let g:Tex_ViewRule_dvi = 'xdvi -editor "vim --servername ' . v:servername . ' --remote +\%l \%f"'
endif
</code></pre>
versioning etc w bzrhttp://upsilon.cc/~zack/blog/posts/2006/11/versioning_etc_w_bzr/2009-11-28T12:00:16Z2006-11-05T08:26:01Z
<h1>Versioning /etc with bzr for fun and profit</h1>
<p>Since mid October I rented a room to <a href=
"http://esaurito.net/blog">Godog</a>, here in Bologna (erm ...
Italy :-)). Living with another DD so far has been utterly fun: our
lives proceed normally, but when we occasionally met it's like
<em>hack time</em>: brainstorming and implementation of the first
hackish ideas that come to mind.</p>
<p>The first idea we deemed nice to be implemented has been
versioning <tt>/etc</tt> of our server (which we co-administer)
with <a href="http://bazaar-vcs.org/">bzr</a>. The requirements we
set forth where:</p>
<ol>
<li>
<p>who is changing stuff should be somehow <em>forced</em> to
document and commit its changes;</p>
</li>
<li>
<p>automatic changes performed by package upgrades should be
automatically versioned.</p>
</li>
</ol>
<p>Our current solution consists in a couple of hacks:</p>
<ul>
<li>
<p>the <em><a href=
"http://upsilon.cc/~zack/blog/posts/2006/11/versioning_etc_w_bzr/snapshot.py">snapshot.py</a>
plugin for bzr</em> we wrote (to be put in
<tt>~/.bazaar/plugins/</tt>), which adds a <tt>snapshot</tt>
command to bzr which takes a snapshot of the current status (i.e.
it automatically adds all unknown files and commit changes,
removals, ...);</p>
</li>
<li>
<p>the following <em>hook</em> in <tt>/etc/apt/apt.conf.d/</tt></p>
<pre><code> DPkg::Post-Invoke { "cd /etc && bzr snapshot"; };
</code></pre></li>
<li>
<p>a <em>loop at the end of <tt>.bash_profile</tt></em> for
ensuring that root is not allowed to logout when pending changes
have been left in /etc. Have a look at <a href=
"http://upsilon.cc/~zack/blog/posts/2006/11/versioning_etc_w_bzr/bash_profile">the end
of our .bash profile</a>.</p>
</li>
</ul>
<p>What's next? Well, <a href=
"http://www.enricozini.org/blog/pdo.html">Enrico</a> already set
forth the idea of an <em>housewarming bug squashing party</em> with
<a href=
"http://wiki.debian.org/LocalGroups#head-51dc281f8f2fc8bd539d609a7916d9651df3a569">
all DDs living in the Bologna area</a>. Sounds cool!</p>
my life wo caps lockhttp://upsilon.cc/~zack/blog/posts/2006/11/my_life_wo_caps_lock/2009-11-28T12:00:16Z2006-11-03T10:09:52Z
<h1>My life without CAPSLOCK</h1>
<p>Yesterday I spotted the option "Make CapsLock an additional
Ctrl" in the <a href="http://www.gnome.org">Gnome</a> keyboard
preferences (Desktop > Preferences > Keyboard > Layout
Options > Ctrl key position). I enabled it, obtaining the end of
errors due to erroneous enabling of Caps Lock (as suggested to me
by several people at <a href=
"http://debconf6.debconf.org">DebConf6</a>, but so far I've been
too lazy to learn how to do it with xmodmap).</p>
<p>In addition to feeling more relaxed when using <a href=
"http://www.vim.org">Vim</a> (we all know how dangerous can be Caps
Lock in Vim!), using Caps Lock as CTRL is actually <em>really
handy</em>, since key combinations involving CTRL can be formed
moving the left pinky way less: probably a dream of all <a href=
"http://www.gnu.org/software/emacs/">Emacs</a> users out there
<img src="http://upsilon.cc/~zack/smileys/smile.png" alt=":-)" /></p>
<p>Now it is just a matter of training my left pinky to stop going
in the bottom left corner of the keyboard ...</p>
first thoughts on rubyhttp://upsilon.cc/~zack/blog/posts/2006/11/first_thoughts_on_ruby/2009-11-28T12:00:16Z2006-11-02T10:12:56Z
<h1>First Thoughts on Ruby</h1>
<p>Following <a href="http://upsilon.cc/~zack/blog/posts/2006/11/flickr_download/">my
first experiences programming with it</a>, here is my current
<em>braindump</em> on Ruby (pros and cons mixed):</p>
<ul>
<li>
<p><em>cool</em>, it looks like an intersection among Python (clean
way of doing OO with steroids here and there, e.g. mixins), Perl
(quick and dirty syntax when dirtiness is needed, e.g. regexp),
OCaml (functional stuff to improve abstraction and reuse);</p>
</li>
<li>
<p>functional stuff is syntactically constrained (e.g.: why in the
world a method has the concept of <em>the</em> code block passed to
it and the nice <tt>yield</tt> syntax is meant to work on it only?,
why can't we just handle code blocks as first class values?);</p>
</li>
<li>
<p>some paradigm which are hard to program in other languages are
amazingly easy to program in Ruby (e.g. heavy threading);</p>
</li>
<li>
<p>the documentation of the language and of the library is probably
the most chaotic I've ever seen: I'm still unable to find a
rigorous definition of both the grammar and the semantics of the
language. The standard library is
well-documented/poorly-documented/read-the-code depending on which
module you choose.</p>
</li>
</ul>
flickr downloadhttp://upsilon.cc/~zack/blog/posts/2006/11/flickr_download/2009-11-28T12:00:16Z2006-11-02T10:12:56Z
<h1>Flickr_download (.rb): Flickr batch downloader</h1>
<p>A while ago I decided to give <a href=
"http://www.ruby-lang.org">Ruby</a> a try. And of course the best
way to do that on a programming language you don't know is write
something in it.</p>
<p>The result is <a href=
"http://upsilon.cc/~zack/blog/posts/2006/11/flickr_download/flickr_download.rb">flickr
download.rb</a>: <em>a batch downloader of <a href=
"http://www.flickr.com">Flickr!</a> photo sets</em>.</p>
<p>It handles all the stuff of Flickr! authentication/authorization
via the shared secret, API key and so on (see the <a href=
"http://www.flickr.com/services/api/">Flickr! API</a>). Then,
specifying the username of a photoset owner and the photoset
(either by title or id) it downloads in a batch fashion the best
available size of contained photos. Command line interface of
course.</p>
<p>Despite its simplicity and how useful it looks to me, I was
unable to find a similar tool already available somewhere. Maybe
because the usefulness of such an utility is diminished by the
requirement imposed by the Flickr! API that the owner of a photoset
must first authorize the tool before it can be used, but I still
found it very useful to download <em>my</em> photos batchly ...</p>
<h2>Requirements</h2>
<ul>
<li><a href="http://redgreenblu.com/flickr/">Flickr.rb</a> (not in
Debian), which in turn requires ...</li>
<li>... <a href=
"http://raa.ruby-lang.org/project/mime-types/">mime/types</a> (not
in Debian too),</li>
<li><a href="http://packages.debian.org/rdoc1.8">rdoc1.8</a>.</li>
</ul>
<h2>Sample usage</h2>
<pre><code>$ # let's try on my Debconf6 photo set
$ flickr_download -u zacchiro -i 72157594247689892
will download 53 photos(s)
starting download of http://static.flickr.com/73/222421262_38df10594a_o.jpg ...
starting download of http://static.flickr.com/91/222420881_3b49a57f11_o.jpg ...
starting download of http://static.flickr.com/61/222420518_b2ad6ddf1a_o.jpg ...
<snip>
starting download of http://static.flickr.com/72/222392122_80b8041c47_o.jpg ...
waiting for all downloads to complete ...
all done.
$
</code></pre>
<h2>Download</h2>
<ul>
<li><a href=
"http://upsilon.cc/~zack/blog/posts/2006/11/flickr_download/flickr_download.rb">flickr
download.rb</a></li>
</ul>