jueves, diciembre 04, 2008

Resize Tango icons SVG to PNG with ImageMagick

Convert all images in Tango project with ImageMagickEnlace
For example, if I wanted to resize the .svg icons to png 40x40 size:

$ for i in `find -name *.svg`; do ./svg2png.sh '-density 60 -background transparent' 40x40 $i; done;

I have changed the content of svg2png.sh to:

#!/bin/sh

SVGCONVERT="convert"

ICONTEST=`echo ${3} | grep "icon$"`
if [ ! -z "${ICONTEST}" ]; then
exit 0
fi

ICONFILE=`basename ${3}`
ICONNAME=`echo ${ICONFILE} | sed -e "s/.svg//"`
DIRNAME=`dirname ${3}`
DIRNAME=${DIRNAME#*/scalable/}
if test `basename $SVGCONVERT` = "rsvg"; then
OPTIONS="-w ${1} -h ${1}"
else
OPTIONS="${1}"
fi

OUTDIR=${2}/${DIRNAME}
mkdir -p ${OUTDIR}

echo "${SVGCONVERT} ${OPTIONS} ${3} ${2}/${ICONNAME}.png"
${SVGCONVERT} ${OPTIONS} ${3} ${OUTDIR}/${ICONNAME}.png


If you want to change to .gif or .bmp files you should change the options in the convert call and the file extensions in the end of svn2png.sh.


jueves, noviembre 27, 2008

Playing with Matlab I - HyperSpectral Images (Indian Pines)

http://www.ehu.es/ccwintco/uploads/1/19/Clase_vision_hyper.zip

pines = fopen ('92AV3C.no_header');


fid = fopen ('92AV3C.no_header');

x = fread (fid);
x_pie = multibandread ('92AV3C.no_header', [145 145 220], 'int16', 0, 'bil', 'ieee-be');

imshow (x_pie[:170])

slice170 = squeeze (img(:,:,170));

imshow (slice170);

slice170 = squeeze (x_pie(:,:,170));

imshow (slice170);
imagesc (slice170);

imshow (slice170, [min(min(slice170)) max(max(slice170))]);


slice150 = squeeze (x_pie(:,:,150));

imagesc (slice150);

imshow (slice170, [min(min(slice170)) max(max(slice170))]);

pixel1x1 = squeeze (x_pie(1,1,:));
plot (pixel1x1)

[coeff, score, latent] = princomp (img_vec);
latent
latent_percent = (latent/sum(latent))*100 ;
varianzas = (latent/sum(latent))*100

i = 0 ;total=0;
while total < 99.5; i = i + 1; total = total + varianzas (i); end
i
i=0;total=0;
while total < 99; i = i + 1; total = total + varianzas (i); end
i
i=0;total=0;
while total < 95; i = i + 1; total = total + varianzas (i); end
i

pareto (varianzas)
[U,P] = NFINDR(x_pie, 9);
plot (U)
[U,P] = NFINDR(zscore(x_pie), 10);
score_reshaped = reshape (score, 145, 145, 220);
plut (U);
img_abundancia = FCLSU (zscore(img), U);

figure; imshow(squeeze(score,:,:,0));

figure; imshow(squeeze(score(:,:,1)));
figure; imshow(squeeze(score_reshaped(:,:,0)));
figure; imshow(squeeze(score_reshaped(:,:,1)));

imagesc (squeeze(img_abundancia(:,:,1)));
imagesc (squeeze(img_abundancia(:,:,2)));
imagesc (squeeze(img_abundancia(:,:,3)));
imagesc (squeeze(img_abundancia(:,:,4)));
figure; imagesc(squeeze(score_reshaped(:,:,4)));

imagesc (squeeze(img_abundancia(:,:,10)));

num_endmembers = size (U,2);


imagesc (squeeze(img_abundancia(:,:,8)));


figure; imagesc (squeeze(img_abundancia(:,:,9)));

figure; imagesc (squeeze(img_abundancia(:,:,4)));
figure; imagesc (squeeze(img_abundancia(:,:,6)));
figure; imagesc (squeeze(img_abundancia(:,:,7)));
figure; imagesc (squeeze(img_abundancia(:,:,3)));
figure; imagesc (squeeze(img_abundancia(:,:,10)));

help kmeans


[idx, c, sumd, dist] = kmeans (squeeze (145,145,:), 17);

[idx, c, sumd, dist] = kmeans (reshape (img_abundancia,145*145, 10), 17);

c


imagesc (idx);

imagesc (c);
imagesc (c,idx);
imshow (c,idx);
help kmeans
imagesc(c);
imagesc(idx);

classification_result = reshape (idx, 145, 145);
imagesc (classification_result)

[idx, c, sumd, dist] = kmeans (reshape (img_abundancia,145*145, 10), 10);


classification_result = reshape (idx, 145, 145);


imagesc (classification_result);


domingo, octubre 19, 2008

ExpressCard hot plugging

I bought a Dawincontrol DC-300 eCard and it didn't work out of the box.

Firstly I thought it could be a driver problem, but then I realized that there were no ExpressCard module running. I searched for it and also found this.

I executed: sudo modprobe pciehp, plugged in the card and it worked.

martes, octubre 14, 2008

How to work better

  1. Do one thing at a time.
  2. Know the problem.
  3. Learn and listen.
  4. Learn to ask questions.
  5. Distinguish sense from nonsense.
  6. Accept change as inevitable.
  7. Admit mistakes.
  8. Say it simple.
  9. Be calm.
  10. Smile

viernes, junio 06, 2008

Backup and sync your Firefox bookmarks with your personal server

I was waiting for an update of Google Browser Sync for Firefox 3, but I decided to try Foxmarks to synchronize the bookmarks from my desktop computer, my work computer and my laptop.
It works pretty well.
In its configuration menu there is an option to use a personal server as bookmark sync server.
I looked for it in the internet and found this.
An article that explains how to use an FTP server to sync your bookmarks with Foxmarks.

jueves, junio 05, 2008

Cómo instalar el VMware Workstation en Ubuntu 8.04

Dedicado a unos amigos muy amigos....

1. Suponemos que ya habéis comprado el VMware Workstation para la versión de GNU/Linux que usáis, es decir, 32 bits o 64. La última que hemos comprado era la 6.0.3. El software viene en un paquete con extensión .tar.gz. Voy a suponer que lo tenemos en el directorio /opt .

2. Como estamos en GNU/Linux, en vez de deciros dónde tenéis que hacer clics (que es un coñazo), os voy a poner los comandos que tenéis que ejecutar. Ejecutar significa escribirlos en una terminal (se encuentra en Applications->Accessories->Terminal) y después pulsar Enter.

3. Aquí va la serie de comandos y las salidas marcadas con >> (tranquilos, no son chicas, son lo que te muestra en la terminal el programa) :

- cd /opt
- tar xvzf VMware_Workstation_6.0.3.tar.gz
- cd vmware-distrib
- sudo ./vmware-instal.pl

>> Installing VMware Workstation.

>> In which directory do you want to install the binary files?
>> [/usr/bin]

- Presiona Enter.

>> What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
>> [/etc]

- Presiona Enter

>> What is the directory that contains the init scripts?
>> [/etc/init.d]

- Presiona Enter

>> In which directory do you want to install the daemon files?
>> [/usr/sbin]

- Presiona Enter

>> In which directory do you want to install the library files?
>> [/usr/lib/vmware]

- Presiona Enter

>> The path "/usr/lib/vmware" does not exist currently. This program is going to
>> create it, including needed parent directories. Is this what you want?
>> [yes]

- Presiona Enter

>> In which directory do you want to install the manual files?
>> [/usr/share/man]

- Presiona Enter

>> In which directory do you want to install the documentation files?
>> [/usr/share/doc/vmware]

- Presiona Enter

>> The path "/usr/share/doc/vmware" does not exist currently. This program is
>> going to create it, including needed parent directories. Is this what you want?
>> [yes]

- Presiona Enter

>> The installation of VMware Workstation 6.0.3 build-80004 for Linux completed
>> successfully. You can decide to remove this software from your system at any
>> time by invoking the following command: "/usr/bin/vmware-uninstall.pl".

>> Before running VMware Workstation for the first time, you need to configure it
>> by invoking the following command: "/usr/bin/vmware-config.pl". Do you want
>> this program to invoke the command for you now? [yes]

- Presiona Enter

>>Making sure services for VMware Workstation are stopped.

>>Stopping VMware services:
>> Virtual machine monitor done
>> Blocking file system: done
>> Bridged networking on /dev/vmnet0 done
>> Host network detection done
>> DHCP server on /dev/vmnet8 done
>> NAT service on /dev/vmnet8 done
>> Host-only networking on /dev/vmnet8 done
>> Virtual ethernet done

>> Configuring fallback GTK+ 2.4 libraries.

>> In which directory do you want to install the theme icons?
>> [/usr/share/icons]

- Presiona Enter

>> What directory contains your desktop menu entry files? These files have a
>> .desktop file extension. [/usr/share/applications]

- Presiona Enter

>> In which directory do you want to install the application's icon?
>> [/usr/share/pixmaps]

- Presiona Enter

>> Trying to find a suitable vmmon module for your running kernel.

>> None of the pre-built vmmon modules for VMware Workstation is suitable for your
>> running kernel. Do you want this program to try to build the vmmon module for
>> your system (you need to have a C compiler installed on your system)? [yes]

- Presiona Enter

>> Using compiler "/usr/bin/gcc". Use environment variable CC to override.

>> What is the location of the directory of C header files that match your running
>> kernel? [/lib/modules/2.6.24-18-generic/build/include]

- Presiona Enter

>> Salen cosas de la compilación del módulo vmmon, no suele dar errores.

Hasta que no veas unas cosas sobre la network de la máquina virtual, dale a todo que Enter.
Como a los locos.

Luego cuando salgan para configurar los distintos tipos de redes. Si te pregunta si quieres configurar las redes, dile que sí.
Yo utilizo bridge y NAT, aunque en estos momentos no os preocupéis de configurarlo correctamente ya que en la aplicación es posible configurarlo en la interfaz (como a vosotros os gusta).

No instaléis el Eclipse Integrated Virtual Debugger ya que sé para qué vais a usar el VMware. Y tampoco sé muy bien para qué sirve.

Después le dices a todo que sí, otra vez, y está instalado.

Lo tenéis en Applications->Systems Tools->VMware Workstation.

martes, mayo 27, 2008

How to install Cisco VPN client for Ubuntu Hardy Heron

Sé que no es de buen agrado pegar el link directamente en un post, pero este me ha venido muy bien, lo llevaba bastante tiempo buscando y lo más importante, funciona.

Primero os descargáis la versión 4.8.01.0640 desde aquí. Si queremos pasar del registro, he encontrado el archivo en la Wiki de un grupo muy bueno de investigación de la UPV.

La explicación, si la leeis hasta el final sirve tanto para amd64 como para i386.

Ahora, para mí caso en la UPV/EHU...el archivo ehu.pcf será el siguiente:

[main]

Description=conexion a ehu

Host=158.227.0.11

AuthType=1

GroupName=EHU

EnableISPConnect=0

ISPConnectType=0

ISPConnect=

ISPCommand=

Username=scpbalon

SaveUserPassword=0

EnableBackup=0

BackupServer=

EnableNat=1

CertStore=0

CertName=

CertPath=

CertSubjectName=

CertSerialHash=00000000000000000000000000000000

DHGroup=2

ForceKeepAlives=0

UserPassword=

enc_UserPassword=

GroupPwd=VPNs

enc_GroupPwd=

ISPPhonebook=

NTDomain=

EnableMSLogon=1

MSLogonType=0

TunnelingMode=1

TcpTunnelingPort=10000

SendCertChain=0

PeerTimeout=90

EnableLocalLAN=1




lunes, abril 07, 2008

Repetitive tasks

#!/bin/bash

for i in `seq 0 99`; do

echo $i - I will never use copy and paste again.;

done;

jueves, marzo 13, 2008

VTK + ITK project using CMake in Ubuntu Gutsy

Install ITK (from sources) and VTK (from apt packages).

1. Create a directory for the project.
2. Create a CMakeLists.txt file with the content:

PROJECT( myProject )

FIND_PACKAGE ( ITK )
IF ( ITK_FOUND )
INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND )

FIND_PACKAGE ( VTK )
IF ( VTK_FOUND )
INCLUDE( ${USE_VTK_FILE} )
ENDIF( VTK_FOUND )

INCLUDE_DIRECTORIES(
${myProject_SOURCE_DIR}
)

ADD_EXECUTABLE( myProject myProject.cxx )

TARGET_LINK_LIBRARIES ( myProject
ITKBasicFilters ITKCommon ITKIO
vtkRendering vtkGraphics vtkHybrid
vtkImaging vtkIO vtkFiltering vtkCommon
)

3. cmake .
4. make

And that is it! All the dependencies will be linked automatically, if they're found, if not it will ask you for installation.


http://na-mic.org/Wiki/images/e/ed/Insight-VTK.ppt

jueves, febrero 28, 2008

NVIDIA CUDA in Ubuntu Gutsy

1. Install latest Nvidia drivers:
The easiest way is installing Envy.

$ wget -c http://albertomilone.com/ubuntu/nvidia/scripts/legacy/envy_0.9.10-0ubuntu4_all.deb
$ apt-get install fakeroot dh-make dpkg-dev xserver-xorg-dev module-assistant dkms dpatch
$ dpkg -i
envy_0.9.10-0ubuntu4_all.deb
$ envy -g

2. After successfully installing the Nvidia driver, restart the computer.

3. Install the Nvidia CUDA Toolkit

Download the Toolkit package from:
http://www.nvidia.com/object/cuda_get.html#linux

Decompress it and execute.

If you installed it in /usr/local/cuda:

- Change the /etc/ld.so.conf file:
Adding the paths:
/usr/local/cuda/lib
/usr/local/cuda/open64/lib

Then execute the command ldconfig.

- Link the binaries from /usr/local/cuda/bin in /usr/local/bin:


$ cd /usr/local/bin
$ ln -fs /usr/local/cuda/bin/* .

- Link the binaries from /usr/local/cuda/open64/bin in /usr/local/bin:

$ cd /usr/local/bin
$ ln -fs /usr/local/cuda/open64/bin/* .


3. Install the Nvidia CUDA Toolkit

Download the Toolkit package from:
http://www.nvidia.com/object/cuda_get.html#linux

Decompress it and execute.

By default it is installed in your /home directory in NVIDIA_CUDA_SDK.

In order to compile it you must install libglut3-dev package.

I will do some work with this library soon.


viernes, febrero 15, 2008

Deshabilitar la Touchpad en Ubuntu II

Tenía curiosidad de cómo hacer un comando que haga un switch del estado de la Touchpad.
Así, en vez de asignar dos combinaciones de teclas para habilitar/deshabilitar la touchpad, pueda hacerlo con una sola combinación de teclas.

El script es el siguiente:

#!/bin/bash
declare STATE=`synclient -l | grep TouchpadOff | tr -d [:alpha:][===][=\ =]`

if [ $STATE -eq 0 ]; then
synclient TouchpadOff=1;
else
synclient TouchpadOff=0;
fi

Lo guardáis en un archivo en el sistema. Donde queráis, el mío está en /home/alux/switch_touchpad.

Ejecutáis el configurador del compiz.
System->Preferences->Advanced Desktop Effects Settings

En el panel de configuración general, en la pestaña Commands, ponéis la dirección del script:
/home/alux/switch_touchpad

Y en la pestaña Actions, en la parte Commands ponéis la combinación de teclas que ejecute el script, por ejemplo: Ctrl+Alt+T

Ya ves, tengo demasiado tiempo libre.

jueves, febrero 14, 2008

Deshabilitar la Touchpad en Ubuntu

Para deshabilitar de manera rápida y sencilla la superficie táctil del portátil en Ubuntu.

Asegúrate de tener en la sección de configuración de la touchpad en el archivo /etx/X11/xorg.conf lo siguiente:


Option "SHMConfig"


En mi archivo se quedaría más o menos esto:


Section "InputDevice"

Identifier "Synaptics Touchpad"

Driver "synaptics"

Option "SendCoreEvents" "true"

Option "Device" "/dev/psaux"

Option "Protocol" "auto-dev"

Option "HorizScrollDelta" "0"

Option "SHMConfig" "on"

EndSection



La opción SHMConfig habilitada permite cambiar algunos parámetros de configuración de la touchpad sin tener que reiniciar el Xserver.


Después de editar el archivo es necesario reiniciar el Xserver, o para evitar líos, reinicia el ordenador.


Para deshabilitar la touchpad tienes que ejecutar:


$ synclient TouchpadOff=1


y para volver a habilitarla:


$ synclient TouchpadOff=0


Para hacer esto más sencillo, se puede configurar un par de combinaciones de teclas para que ejecuten estos comandos.


Esto se hace muy fácilmente con el CompizConfig Settings Manager si estás utilizando el Compiz. En las Opciones generales, en las pestañas "Comandos" y "Acciones"


via: ubuntu.wordpress


lunes, febrero 04, 2008

International Clock

Para instalar el reloj internacional para Gnome, descargad la versión para vuestra distribución en http://ppa.launchpad.net/jorge/ubuntu/pool/main/i/intlclock/ .


Una vez descargado el paquete debian tenéis dos opciones:


1. La rápida

Se abre una terminal y ejecutáis:


$ sudo dpkg -i intlclock_1.0-1ubuntu0_amd64.deb


2. La menos rápida

Clic derecho en el fichero

Seleccionáis "Abrir con GDebi...".

Ya con el GDebi abierto pulsáis: "Instalar paquete"

Inserís vuestra contraseña y voilá.


pkg-config y anjuta 2

He conseguido configurar Anjuta con pkg-config.

Las ventajas que tiene utilizar pkg-config es que te libras de añadir todas las librerías que te
hacen falta a mano.

pkg-config es una aplicación que busca en los directorios listados en $PKG_CONFIG_PATH (separados por ':' en linux, y ';' en Windows) archivos con la extensión .pc.

Por defecto, los directorios con archivos .pc en GNU/Linux están en /usr/lib/pkgconfig y /usr/local/lib/pkgconfig.

Dichos archivos .pc contienen información de flags, links, dependencias.... sobre las librerías instaladas en el sistema.

Prueba a ejecutar en una terminal: pkg-config --libs gtk+-2.0

O: pkg-config --cflags cairo

Esto es lo básico de pkg-config, tienes bastantes opciones más. Ya las iré describiendo si veo su utilidad.

Debemos pasar el texto resultante de la ejecución del programa pkg-config a otro programa (como por ejemplo, el gcc). Para ello basta con poner en la ejecución del gcc, la ejecución de pkg-config con comilla simple invertida: `pkg-config --libs gtk+-2.0`

En internet hay varios ejemplos de cómo hacer esto por línea de comandos con el gcc. Pero poco sobre cómo hacerlo en la configuración de Anjuta 2.

Así que para trabajar con gtk+-2.0 se debería dejar algo así:

Project->Properties:


















Target properties:

















El grito del gorila.

Install Anjuta 2.3.3 from sources in Ubuntu Gutsy


$ wget -c http://surfnet.dl.sourceforge.net/sourceforge/anjuta/anjuta-2.3.3.tar.bz2

$ wget -c http://ftp.gnome.org/pub/GNOME/sources/gtksourceview/2.1/gtksourceview-2.1.1.tar.bz2

$ sudo apt-get --purge remove anjuta

$ sudo apt-get autoremove

$ rm -rdv ~/.anjuta

$ sudo apt-get build-dep anjuta

$ sudo apt-get install libgraphviz3-dev binutils-dev valgrind

$ sudo chown alux /opt

$ cp gtksourceview-2.1.1.tar.bz2 /opt

$ cp anjuta-2.3.3.tar.bz2 /opt

$ cd /opt

$ tar xvjf gtksourceview-2.1.1.tar.bz2

$ rm gtksourceview-2.1.1.tar.bz2

$ cd gtksourceview-2.1.1

$ ./configure

$ make

$ sudo make install

$ tar xvjf anjuta-2.3.3.tar.bz2

$ rm anjuta-2.3.3.tar.bz2

$ cd anjuta-2.3.3

$ ./configure

$ make

$ sudo make install

$ sudo cp libanjuta/.libs/libanjuta.* /usr/local/lib

$ sudo cp libegg/.libs/libanjuta-egg.* /usr/local/lib

$ sudo ldconfig

$ anjuta

domingo, febrero 03, 2008

Instalar versao estável do Anjuta na Ubuntu Gutsy


$ sudo -s



$ echo "http://ppa.launchpad.net/robster/ubuntu gutsy main universe" >> /etc/apt/sources.list


$ apt-get update



$ apt-get upgrade



$ apt-get install anjuta autogen libtool devhelp



$ nano /usr/share/aclocal/lib3ds.m4



Change in line 4:



- AC_DEFUN(AM_PATH_LIB3DS,



+ AC_DEFUN([AM_PATH_LIB3DS],






I am trying to add dynamically linked libraries with pkg-config through anjuta 2.2.2.

In the Target Properties of the project I add:

In C++ Compiler flags: `pkg-config --cflags gtk+-2.0`

In Libraries: `pkg-config --libs gtk+-2.0`

This is how it works compiling through the command line, but anjuta doesn't get it.
Is it possible doing this?


Someone can help me??

lunes, agosto 27, 2007

Coisas para considerar para o 2007

Número 10 - A vida é transmitida sexualmente.

Número 9 - Boa saúde é somente o modo mais lento de morrer.

Número 8 - Os homens tem dois estados emocionais: Faminto e Fogoso. Se você o vê sem uma ereção, faça para ele um sanduíche.

Número 7 - Dê um peixe para uma pessoa e você a alimenta por um dia. Ensine um pessoa a usar internet e ela não te chateará em semanas.

Número 6 - Algumas pessoas são como um resorte...não servem para nada, mas você não pode evitar sorrir quando vê uma dar voltas descendo uma escada.

Número 5 - Os loucos pela saúde algum dia se sentirão estúpidos, deitados num hospital morrendo de nada.

Número 4 - Todos poderíamos aprender uma lição sobre o Tempo. Ele não presta atenção às críticas.

Número 3 - Por quê uma leve subida de impostos te custa 200 reais à mais e recortes substanciais de impostos te economizam 30 centavos??

Número 2 - Nos anos 60, as pessoas usavam ácido para fazer que seu mundo ficasse estranho. Agora o mundo é estranho e as pessoas usam Prozac para que fique normal.


NÚMERO 1 - Sabemos exatamente onde estão as vacas com síndrome das vacas loucas entre as milhões e milhões de vacas que existem no Mundo mas não temos a menor idéia de onde estão os imigrantes ilegais e os terroristas. Talvez deveríamos colocar o Ministério de Agricultura à cargo da imigração.



Visto aqui.