Friday, October 9, 2009

Ubuntu 9.10 Karmic Koala

A nova versão do Ubuntu está preste a sair. Neste momento ainda se encontra em versão beta, no entanto para todos os que quiserem ajudar a testar e fazer report de bugs, podem fazer o download em http://www.ubuntu.com/testing/karmic/beta.

Monday, September 21, 2009

Os Partidos Políticos Portugueses e o Vegetarianismo

O Centro Vegetariano há cerca de algumas semanas questionou os vários partidos políticos portugueses sobre assuntos do interesse da comunidade vegetariana portuguesa. Aparente até ao momento em que o artigo, que se encontra no site, foi escrito, apenas o Bloco de Esquerda se prontificou a dar conhecer a sua opinião, posições e propostas a todos nós. Resta também realçar que o Bloco de Esquerda é também dos únicos partidos que se pronunciou contra as touradas ou outro tipo de violência animal disfarçada de espectáculo ou arte.
Seria curioso e enriquecedor para a democracia portuguesa também conhecer a posição dos restantes partidos acerca deste assunto, fico e ficamos a aguardar.


Podem ler o conteúdo da resposta do BE ao Centro Vegetariano em: http://www.centrovegetariano.org/Page-20.html

BE contra os Rodeios: http://matportugal.blogspot.com/2008/09/bloco-de-esquerda-tambm-contra-rodeios.html

Thursday, September 10, 2009

Swap partition and hibernation in Ubuntu

Hello lads,

today i was having some trouble hibernating my laptop after resizing of the swap partition, because Ubuntu was telling me that it couldn't find my it.
So what happened was that the partition identifier changed since the resizing of the partition, not the common identifier like /dev/sda5, but the UUID (Universal Unique Identifier) which is now used to identify the partitions in "modern" Linux.

So this was how I fixed it:

I used fdisk to know discover the name of my swap partition

$ sudo fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xd53d826f

Device Boot Start End Blocks Id System
/dev/sda1 1 1824 14651248+ 83 Linux
/dev/sda2 7562 7821 2088450 5 Extended
/dev/sda3 1825 7561 46082452+ 83 Linux
/dev/sda5 7562 7821 2088418+ 82 Linux swap / Solaris

Looked up the UUID of the partition

$ sudo vol_id --uuid /dev/sda5
415df585-960f-49ca-b056-6202c1daac39

Edited my swap line in /etc/fstab, which is the file responsible for tracking devices, mounting points and other stuff (generally speaking)

$ vim /etc/fstab

Changed the swap line to look like this, and saved the file

UUID=415df585-960f-49ca-b056-6202c1daac39 none swap sw 0 0

Note that I used the UUID given by vol_id command

Then updated /etc/initramfs-tools/conf.d/resume with the UUID i got above

RESUME=UUID=415df585-960f-49ca-b056-6202c1daac39

This file is responsible for telling where to look up for the saved desktop state, generaly the swap partition, when the machine resumes from hibernation.

Finally I updated the boot-up scripts by doing

$ sudo update-initramfs -u

After this we can either restart the computer or just run

$ sudo swapon -a

to active all swap spaces available.

Et voilà I was done, and the hibernation worked!

Friday, July 10, 2009

Compiz giving me a headache

A while ago after disabling compiz to do some troubleshoot on some applications, I got some trouble trying to enabling it again, I was constantly getting the following message:

/usr/bin/compiz.real (core) - Error: Could not acquire compositing manager selection on screen 0 display ":0.0"
/usr/bin/compiz.real (core) - Fatal: No manageable screens found on display :0.0

after some googling I came to this solution:

- run in the terminal
gconftool-2 --set --type=bool /apps/metacity/general/compositing_manager false

- logout/in and we're ready to re-enable the wonderful desktop effects!

Tuesday, June 30, 2009

Vim in hexadecimal mode

To set your favourite text editor to edit your files in hexadecimal you may use in normal mode:

:%!xxd

and to get back to ascii mode:

:%!xxd -r

Thursday, May 28, 2009

Dump terminal output to a file

Easy way to redirect the output of a command to both file and terminal:

bash$ my_command 2>&1 | tee my_log.txt

Great =)

Monday, May 25, 2009

Killing processes started in the current terminal

Imagine you're running some application, lets call it "foo", using an unix user shared with your work colleagues, and this application is also launched by them at the same time you're working. So along the time you may have several instances of this application, several processes with distinct PIDs. And all the sudden you need to kill all the instances that you previously launched but you need to avoid to kill the ones being used by your fellow colleagues. This is one way to do the trick.

Start by retrieving your tty (teletypewriter),

bash$ tty
/dev/pts/4

And then kill the process "foo" for the current "tty" you're using,

bash$ kill `ps -le | grep foo | grep "pts/4" | cut -d" " -f6 `


PS: If know a way to include the retrieval of the tty inside the grep command let know =)