Ir para o conteúdo
ou

Software livre Brasil

Tela cheia
 Feed RSS

Blog

28 de Maio de 2009, 0:00 , por Desconhecido - | Ninguém está seguindo este artigo ainda.
In this blog I share technical information, write about projects I'm involved with, or about cool/fun/interesting stuff I find.

A better svn diff

6 de Outubro de 2010, 0:00, por Desconhecido

Since I started using git, every time I need to use Subversion again I suffer. The output of `git diff` is so nice compared to the one produced `svn diff` that it hurts. I've alredy been struggling with that previously.

Now I think I've achieved the perfect solution to make `svn diff` behave just like `git diff`. I've documented it in this post hoping to help other poor souls like me who still have to use Subversion now and then.

Step 1: install colordiff. It's installed on Debian, so the installation required me no effort at all.

Step2 (optional): configure colordiff to use your preferred set of colors. My ~/.colordiffrc contains the following, to match the same colors used by default by `git diff`:

banner=no
color_patches=no
plain=off
newtext=darkgreen
oldtext=darkred
diffstuff=white
cvsstuff=darkyellow

Step 3: create a script to be called by Subversion when running `svn diff`. In my case, I called it svn-diff and stored it in ~/bin (which is in my $PATH), but you can put it in /usr/local/bin or any other directory that is in your $PATH. The contents of ~/bin/svn-diff is the following:

#!/bin/sh

 colordiff -u -L "${3}" -L "${5}" "${6}" "${7}"
 

 

After creating the script, you need to make it executable:

$ chmod +x ~/bin/svn-diff

Step 4: tell Subversion to use your script instead of plain diff on `svn diff`. To do that, locate the "helpers" section in your Subversion configuration file (~/.subversion/config), and set the diff-cmd setting to the name you gave to your custom script (svn-diff in my case):

[helpers]
diff-cmd = svn-diff

There is only one thing missing with regard to `git diff`: the nice pager behaviour. Git invokes that system pager in a way that less will receives the options "-FRSX". These options make less exit imediately if the output fits in one terminal screen and output the ANSI sequences (and thus colors) generated by colordiff in raw format, among other things. I couldn't find a way to emulate this: since `svn diff` will call our custom  diff command once for each changed file, we can't call the pager inside svn-diff. A comprimise is doing `svn diff | less -FRSX` , or setting the LESS environment variable to 'FRSX' and doing simply `svn diff | less`.

That's it! Now you can almost forget you are using Subversion (until you need to do some merging).



Getting more out of Gwibber

6 de Julho de 2010, 0:00, por Desconhecido

Gwibber has frustrated me as a microblog reader. A minor issue I have with it is that sometimes I just can't post/reply through it. I don't know whether it is related to the microblogging services have crashed, which is not Gwibber's fault, but it would be nice if if at least warned the user with a "could not send your post" error message.

But the major issue I have with it is that I cannot see enough back in time: since I definitively do not check it all the time, I often lose posts that were not done in the last 24 hours. I tried to solve this by unfollowing people that post a lot, but it did not solve the problem.

I've had read that the Twitter API , which is supported by StatusNet at identi.ca, supports a count argument, which indicated how many posts will be provided, and that it defaults to 20.

Then I did what every programmer should do: look at the source code. I looked inside the implementation of identi.ca account support in Gwibber source code, and found out that it already uses this parameter, although there is no user interface for setting it. Every account has a receive_count attribute that defines how many posts will be fetched from the servers, and it defaults to 20.

While there is no UI for receive_count, you'll need to set this attribute directly in gconf. I used gconf-editor for that, but there are a couple of other options out there. Go to apps/gwibber/accounts, find your accounts, and add a new integer key/value pair there, with key "receive_count", and the value you want to.

 

setting receive_count with gconf-editor



Distraction-free writing with vim and awesome

4 de Junho de 2010, 0:00, por Desconhecido - 1Um comentário

I've recently learn about distraction-free text editing from Lucas, and really liked the idea. Turns outs it is pretty easy to implement it with my beloved vim text editor.

Removing all distraction while using the console vim is trivial. I just need to switch my awesome workspace to full-screen layout, and that's it. The terminal window running vim will take the entire screen space, and then it's me and vim. No menus, no buttons, nothing.

Achieving the same effect with gvim is a bit more tricky: besides putting the awesome workspace to use full-screen layout, you have to turn off both the menus and the toolbar. To do that, I mapped the F11 and F12 keys to turn the menus off and on, respectively, by adding the following lines to my ~/.gvimrc:

map <F11> :set guioptions-=m<CR>:set guioptions-=T<CR>
map <F12> :set guioptions+=m<CR>:set guioptions+=T<CR>

Distraction-free-gvim

You can check out the result in the above screeshot. Yes, that is my entire screen.

The tip for toggling menu and toolbars came from the vim wiki.

You ask me: what's the point of running gvim if you are disabling the menus and the toolbar? Several reasons: the fonts look nicer in gvim, the colors are better than the console ones, and I can turn the menu back on if I need (for example to do something I do not remember the command for).



A little more impressive

16 de Maio de 2010, 0:00, por Desconhecido

Impressive is a slide presentation application. Not a presentation authoring  application, it does very well a single job: presenting. To create the slides, you can use LaTeX and Beamer, or export a PDF file from OpenOffice.org, or (put your favorite slide authoring tool here). Impressive is packaged in Debian, and probably in other operating systems as well, so using it requires no effort at all.

Impressive has very nice features, such as an overview screen displaying thumbnails of all slides, zooming, highlighting specific areas of the slides, a spotlight that follows the mouse and even the possibility of scripting your presentations with arbitrary Python code.

Another great impressive feature is its collection of transition effects.I've just sent out a small contribution, adding a new transition effect: fade in/fade out: the current slide is faded out to black, and then faded the black in the next slide.

Impressive-fadein-fadeout

This seems to be the default transition effect in Apple's Keynote, and I must admit that it is very cool and I wanted it. :-)

So, with the patch I've just sent out, I hope to contribute with making impressive a little more impressive than it already is.

update(17/05): I already got a reply from Impressive's author Martin Fiedler, and the transition was already included in the subversion repository. His implementation is a lot better than mine. :-)



Noosfero Hacking Bar

30 de Abril de 2010, 0:00, por Desconhecido - 22 comentários

A Colivre convida a todos para o primeiro Noosfero Hacking Bar, no próximo dia 08/05 (um sábado), às 14h. NHB é um evento lúdico, onde nos reuniremos para desenvolver funcionalidades e consertar bugs no Noosfero, o seu software livre para redes sociais preferido.

Essa é a oportunidade perfeita para quem quiser começar a contribuir com o Noosfero: toda a equipe vai estar lá para orientar e tirar dúvidas.  Se você participa de uma das redes sociais que rodam Noosfero (softwarelivre.org, Cirandas, Unifreire, Ponto por Ponto, Circuito Fora do Eixo, entre outras), você vai ter a oportunidade de ter ajuda pra implementar aquela idéia fabulosa que você teve, ou de corrigir um bug que te incomodam.

Queremos fazer esse encontro num espaço descontraído, e por isso nos encontraremos no sushi bar do shopping Paseo Itaigara (só Flash, vá desculpando aí). Mas fazer um evento desse fora de um ambiente de escritório/laboratório faz com que seja necessário que se leve computadores. Quem não puder levar um computador próprio pode ir também, afinal programação em par é uma prática de desenvolvimento muito eficiente, e também divertida.

Mesmo quem não estiver em Salvador pode participar: estaremos no IRC, nos canais #noosfero-br (português) e #noosfero (em inglês) na Freenode.

Como se preparar para o evento:

  1. Dê uma olhada na lista de bugs e funcionalidade fáceis em aberto, e escolha um(a) que lhe interesse.
  2. Tente já instalar o ambiente de desenvolvimento no seu computador antes do dia do evento pra ganhar tempo. Em caso de dúvidas, pergunta na lista de discussão.

Resumindo:

  • O quê: Noosfero Hacking Bar
  • Onde: Sushi bar do Shopping Paseo Itaigara (Rua Rubens Guelli, 135, Itaigara), Salvador/BA
  • Quando: 08/05 (Sábado), às 14h