Instalar subversion 1.5 en Ubuntu Hardy

En los repositorios de Ubuntu Hardy (la última versión LTS liberada hasta este momento) sólo se puede encontrar subversion 1.4 debido a que en este tipo de versiones de Ubuntu, las versiones de los paquetes no se actualizan tan a menudo (salvo por correcciones y bugs) como uno quisiera.

Entonces, para poder instalar subversion 1.5, se debe hacer una pequeña maniobra. Primero, agregar lo siguiente al archivo /etc/apt/sources.list:

deb http://ppa.launchpad.net/clazzes.org/ubuntu hardy main

Luego, actualizamos la base de datos de paquetes:

$ aptitude update

Después procedemos a instalar este sistema de control de versiones:

$ aptitude install subversion

Cuando ya esté instalada esta versión, quitamos o comentamos (con un #) la línea agregada en /etc/apt/sources.list:

#deb http://ppa.launchpad.net/clazzes.org/ubuntu hardy main

Finalmente, volvemos a hacer un update de los paquetes:

$ aptitude update

Ver la versión de Ubuntu

Para ver la versión de Ubuntu que está corriendo mi server, hago lo siguiente:

$ cat /etc/*-release

El resultado en mi caso es:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04"

Este procedimiento sirve también para otras distribuciones como Red Hat.

Una forma alternativa de hacerlo es mediante:

$ cat /etc/issue

Que mostrará por ejemplo:

Ubuntu 8.04 "Hardy Heron" \n \l

Aunque esta forma solo funciona en Ubuntu. En otras distros pueden probar:

$ cat /etc/motd

O también:

$ cat /etc/redhat-version

Una tercera forma, para las distrbuciones que adoptan LSB, es mediante el comando:

$ lsb_release -a

Esto mostrará:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 8.04.2
Release:        8.04
Codename:       hardy

Bug en WordPress 2.8 al actualizar plugins automáticamente

Luego de actualizar la versión de este blog a la última versión liberada hace unos días (tiene mejoras interesantes al UI), encontré un problema al tratar de actualizar o instalar plugins desde el Dashboard. Arrojaban este error:

Incompatible archive PCLZIP_ERR_BAD_FORMAT (-10) : Invalid archive structure

El problema es un bug en esta novísima versión. Para solucionarlo, hay que reemplazar el archivo wp-includes/http.php con la versión corregida, que se puede encontrar aquí. Si no quieres meterle mano a tu instalación, puedes esperar algunos días hasta que liberen un nuevo release corriendo esto.

UPDATE: Ya fue reportado el bug.

tinyint en MySQl y SQL Server

El tipo de dato tinyint tiene una pequeña diferencia entre ambos motores de BD. Lo común es que siempre ocupa un (1) byte (28 valores posibles, osea, 256). Lo que difiere es que en MySQL se puede marcar como signed o unsigned, lo que hace que pueda o no tomar valores negativos. Cuando es signed, el rango de valores posibles va de -128 hasta 127, y en caso de unsigned, puede tomar desde 0 a 255.

En cambio, en SQL Server (por lo menos en las versiones 2005 y 2008) solo puede tomar valores positivos. Por ello, el rango que puede tomar es de 0 a 255.

Pueden ver la documentación de este tipo de dato aquí para SQL Server 2005 y aquí para MySQL.

Desinstalar kernels antiguos en Ubuntu

Tras cada actualización del kernel de Linux, los anteriores quedan como recuerdo en el disco duro. El inconveniente principal de esto es que cada vez que arranques tu máquina, el menú del Grub (o Lilo quizá, aunque si usas Ubuntu, es poco probable que lo tengas) será cada vez más largo y con opciones (kernels antiguos) que muy probablemente no vuelvas a utilizar.

La solución a esto es desinstalar cada cierto tiempo los kernels obsoletos. En Ubuntu, podemos hacerlo de la siguiente manera:

Ver primero que versión del kernel estamos usando con el comando:

uname -r

Esto arrojará algo como:

2.6.28-13-generic

Ver que otras versiones tienen instaladas (a la izquierda de cada linea, hay una letra, todas las que tengan la letra i serán las que están en el sistema):

sudo aptitude search linux-image-2

Luego, desde consola ejecutamos el comando:

sudo apt-get remove --purge 2.6.28-11-*

Teniendo en cuenta que 2.6.28-11 es la versión que queremos quitar (OJO, deben reemplazar este valor por la versión que quieran quitar, que no sea la versión actual y preferiblemente dejen las dos últimas versiones por si la más nueva tiene algún problema).

El resultado de este comando será algo similar a esto (seguramente con variaciones dependiendo que tengan instalado):

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package 2.6.28-11
yorch@blackbird:~$ sudo apt-get remove --purge 2.6.28-11-*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting linux-image-2.6.28-11-generic for regex '2.6.28-11-*'
Note, selecting linux-headers-lbm-2.6.28-11-server for regex '2.6.28-11-*'
Note, selecting linux-image-2.6.28-11-server for regex '2.6.28-11-*'
Note, selecting linux-headers-2.6.28-11-generic for regex '2.6.28-11-*'
Note, selecting linux-headers-2.6.28-11-server for regex '2.6.28-11-*'
Note, selecting linux-headers-2.6.28-11 for regex '2.6.28-11-*'
Note, selecting linux-backports-modules-2.6.28-11-server for regex '2.6.28-11-*'
Note, selecting linux-backports-modules-2.6.28-11-generic for regex '2.6.28-11-*'
Note, selecting linux-restricted-modules-2.6.28-11-server for regex '2.6.28-11-*'
Note, selecting linux-restricted-modules-2.6.28-11-generic for regex '2.6.28-11-*'
Note, selecting linux-headers-lbm-2.6.28-11-generic for regex '2.6.28-11-*'
Note, selecting linux-image-2.6.28-11-virtual for regex '2.6.28-11-*'
The following packages will be REMOVED:
  linux-headers-2.6.28-11* linux-headers-2.6.28-11-generic* linux-image-2.6.28-11-generic*
  linux-restricted-modules-2.6.28-11-generic*
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 190MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 369744 files and directories currently installed.)
Removing linux-headers-2.6.28-11-generic ...
Removing linux-headers-2.6.28-11 ...
Removing linux-restricted-modules-2.6.28-11-generic ...
update-initramfs: Generating /boot/initrd.img-2.6.28-11-generic
Purging configuration files for linux-restricted-modules-2.6.28-11-generic ...
Removing linux-image-2.6.28-11-generic ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms
Uninstalling: vboxnetflt 2.1.4 (2.6.28-11-generic) (x86_64)

-------- Uninstall Beginning --------
Module:  vboxnetflt
Version: 2.1.4
Kernel:  2.6.28-11-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxnetflt.ko:
 - Uninstallation
   - Deleting from: /lib/modules/2.6.28-11-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod....

DKMS: uninstall Completed.
Uninstalling: vboxdrv 2.1.4 (2.6.28-11-generic) (x86_64)

-------- Uninstall Beginning --------
Module:  vboxdrv
Version: 2.1.4
Kernel:  2.6.28-11-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxdrv.ko:
 - Uninstallation
   - Deleting from: /lib/modules/2.6.28-11-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod....

DKMS: uninstall Completed.
Uninstalling: virtualbox-ose-guest 2.1.4 (2.6.28-11-generic) (x86_64)

-------- Uninstall Beginning --------
Module:  virtualbox-ose-guest
Version: 2.1.4
Kernel:  2.6.28-11-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxadd.ko:
 - Uninstallation
   - Deleting from: /lib/modules/2.6.28-11-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

vboxvfs.ko:
 - Uninstallation
   - Deleting from: /lib/modules/2.6.28-11-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod....

DKMS: uninstall Completed.
run-parts: executing /etc/kernel/prerm.d/last-good-boot
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.28-13-generic
Found kernel: /boot/memtest86+.bin
Replacing config file /var/run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done

Purging configuration files for linux-image-2.6.28-11-generic ...
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.28-13-generic
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done

dpkg - warning: while removing linux-image-2.6.28-11-generic, directory `/lib/modules/2.6.28-11-generic' not empty so not removed.

Luego pueden repetir el proceso para el resto de versiones que deseen.