Report inadequate content

Restore broken hard disk creating an image with Ubuntu

If your boot partition has been damaged and you cannot boot Ubuntu you still might be able to recover your hard disk and save your data by making an image. All you need is the Ubuntu LiveCD and Partimage, an excellent tool for making backups, or the SystemRescueCD.

Here you'll find a detailed explanation on how to use partimage as well:
http://www.psychocats.net/ubuntu/partimage

{
}

Instalar Memcache en Mac

Instalar el demonio de memcached en Mac no es tan complicado como parece siguiendo estos sencillos pasos.

Primero de todo asegúrate que tienes todos los requisitos

Requisitos para instalar Memcached

  • Un compilador GCC. No te asustes! Viene instalando las XTools de Mac si es que ya no las tienes
  • Descargarte el script de instalación desde topfunky

Instalación del servidor Memcached

Abre una terminal i navega hasta la ruta donde te has descargado el script. Dale permisos de ejecución y ejecútalo. Así:

chmod +x install-memcached.sh
sudo ./install-memcached.sh
echo "export EVENT_NOKQUEUE=1" >> ~/.bash_profile 

La última linea añade al inicio de tu shell la variable de entorno que requiere Memcache. Si durante la compilación ves que algo falla es que el compilador no está bien instalado. Asegúrate de bajarlo e instalarlo correctamente.

Si has instalado correctamente el servidor podrás ver la licencia o el manual de ayuda

memcached -i
memcached -h

Ahora, para arrancar memcached en mac con 100MB de memoria en el puerto 11211 como demonio haz:

memcached -m 100 -p 11211 -d

Puedes conectarte ahora y ver si está funcionando:

telnet 127.0.0.1 11211
	Trying 127.0.0.1...
	Connected to artomb.local.
	Escape character is '^]'.
	stats
	STAT pid 97257
	STAT uptime 10
	STAT time 1266004819
	STAT version 1.1.12
	STAT rusage_user 0.004421
	STAT rusage_system 0.005540
	STAT curr_items 0
	STAT total_items 0
	STAT bytes 0
	STAT curr_connections 1
	STAT total_connections 2
	STAT connection_structures 2
	STAT cmd_get 0
	STAT cmd_set 0
	STAT get_hits 0
	STAT get_misses 0
	STAT bytes_read 7
	STAT bytes_written 0
	STAT limit_maxbytes 104857600
	END
	quit
Connection closed by foreign host.

Para pararlo, tampoco sin misterios, un kill y arreando:

killall memcached

Instalar Memcache para PHP en Mac y scripts MAMP

Si quieres además integrar todo esto en MAMP para que se inicie al arrancar y instalar las librerías PHP hay un tutorial inglés muy bueno en Lullabot

TortoiseSVN for Ubuntu Linux: The real alternative

RabbitVCS logoI have posted several articles regarding subversion in this blog. If you ask me one thing I like in Windows, then I only have one answer: Tortoise SVN client. This small application is the only thing I love in Windows, for anything else, I'd rather user Mac or Linux.

But now, there is a Linux alternative to Tortoise SVN called RabbitVCS. I've tried it and it works pretty well. This project, formerly NautilusSVN, looks really well and is inspired in the windows tool. By now, it offers a good support for SVN but the aim is to cover other Version Control Systems (VCS), like Git.

RabbitVCS is integrated smartly in the Nautilus context menu, like Tortoise does, and contains all the options you might need. Logs, updates, merge, commit, full checkout... anything... plus you can play in the terminal and create your own scripts!

If you are a developer and you work in a Linux environment, then you need this tool.

 

Rabbit VCS Log viewer

There is still a long way to walk for RabbitVCS but I am sure that in short will be a perfect replacement. We don't have to forget that TortoiseSVN offers many many advanced features (not just the common commands), but if you are a regular developer who works with a small group of developers and you don't have a lot of branches that need to merge, reintegrate and so on, this is definetelly a perfect option.

All ISO-639 language codes for MySQL

If you ever needed a mysql table with all the languages detailed in the ISO-639 language codes, here it is. I took the list from the registration authority and created the table in Mysql.

There are 21 languages that have alternative codes for bibliographic or terminology purposes. In those cases I took the bibliographic ones. The script contains the 2 and 3 letter ISO-639 language codes, as well as the English and French names of the languages.

This is a preview:

CREATE TABLE `i18n_language_codes` (
  `3letter` char(3) NOT NULL COMMENT 'ISO 639-2 Code',
  `2letter` varchar(2) default NULL COMMENT 'ISO 639-1 Code',
  `english_name` varchar(255) default NULL,
  `french_name` varchar(255) default NULL,
  PRIMARY KEY  (`3letter`),
  KEY `2letter` (`2letter`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO i18n_language_codes (3letter,2letter,english_name,french_name) VALUES
('aar','aa','Afar','afar'),
...

Download Mysql languages dump (structure and data):

download the ISO-639 MySQL script from GitHub

{
}

Fill: Smarty PHP plugin to fill variables in string (sprintf brother)

Today I quickly created a plugin for Smarty to fill variables inside a string (subject) using the passed parameters as variable names. I use this specially while constructing URLs because my addresses are translated and they "subjects" are always variables. This plugin does nearly the same you could do with the sprintf modifier, but I placed this behaviour inside a function.

The "subject" defines the string containing the pattern to be filled and containing the vars to be filled, and the variables are any string surrounded by your preferred delimiter (defaults to %). Let's see an example on how it works on these small Smarty snippets:

{fill subject="Hello %user%, welcome aboard!" user=Fred}
Outputs: Hello Fred, welcome aboard

You can use variables instead of static content as well (the normal usage):

{assign var=user value='Fred'}
{assign var=subject value='http://domain.com/profile/%user%/options'}

{fill subject=$subject user=$user }
Outputs: http://domain.com/profile/Fred/options

If you don't like the delimiter used by default (%) you can declare others in the call, and you can declare as many variables as you want:

{fill subject="Welcome __user__, make yourself confortable with the __plugin__ plugin."
        user=Fred
        plugin=fill
        delimiter='__'}
Outputs: Welcome Fred, make yourself confortable with the fill plugin. 
{fill subject="http://||subdomain||.domain.com/||page||/||action||"
        subdomain='www'
        page='my-first-post'
        action='vote'
        delimiter='||'}
Outputs: http://www.domain.com/my-first-post/vote

To download this plugin see the Github link OR you can copy paste the source code in the new file:

/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty {fill} function plugin
 *
 * Type:     function
* Name: fill
* Input:
* - [any] (required) - string * - subject (required) - string * - delimiter (optional, defaults to '%' ) - string * Purpose: Fills the variables found in 'subject' with the paramaters passed. The variables are any word surrounded by two delimiters. * * Examples of usage: * * {fill subject="http://domain.com/profile/%username%" username='fred'} * Output: http://domain.com/profile/fred * * {fill subject="Hello %user%, welcome aboard!" user=Fred} * Outputs: Hello Fred, welcome aboard * * {fill subject="http://||subdomain||.domain.com/||page||/||action||" subdomain='www' page='my-first-post' action='vote' delimiter='||'} * Outputs: http://www.domain.com/my-first-post/vote * * @link http://www.harecoded.com/fill-smarty-php-plugin-311577 * @author Albert Lombarte * @param array * @param Smarty * @return string */ function smarty_function_fill($params, &$smarty) { if ( isset($params['delimiter']) ) { $_delimiter = $params['delimiter']; unset($params['delimiter']); } else { $_delimiter = '%'; } if ( false !== strpos($_delimiter, '$' ) ) { $smarty->trigger_error("fill: The delimiter '$' is banned in function {url}", E_USER_NOTICE); } if (!isset($params['subject']) || count($params)trigger_error("fill: The attribute 'subject' and at least one parameter is needed in function {url}", E_USER_NOTICE); } $_html_result = $params['subject']; unset( $params['subject'] ); foreach($params as $_key => $_val) { $_html_result = str_replace( $_delimiter . $_key . $_delimiter, (string)$_val, $_html_result); } if ( false !== strpos($_html_result, $_delimiter) ) { $smarty->trigger_error("fill: There are still parameters to replace, because the '$_delimiter' delimiter was found in $_html_result"); } return $_html_result; } /* vim: set expandtab: */ ?>

Teclados mediacenter para el comedor

Actualmente dispongo de un ruidoso PC de DELL con la última versión de Ubuntu que utilizo a modo de media center en el comedor de casa. Estoy contentísimo de como funciona, pero para manejarlo tengo uno de los teclados más grandes de la historia (uno de esos que tienen botones hasta para tirar de la cadena del baño remotamente) junto con otro ratón que me desespera al uso.

El teclado no lo puedo perder porque es grandioso, pero el ratón lo pierdo casi a diario (además que funciona realmente mal), asi que harto de la situación me dispongo a buscar una teclado con ratón/trackpad integrado para el comedor (también debería cambiar el PC por un Mac Mini, menos bulto y más majo, pero eso ya es otro tema).

El mercado de teclados aptos para mediacenter no es muy amplio, cosas a valorar:

  • Que tenga un trackpad o similar
  • Que sea pequeño o muy pequeño
  • Que sea wireless y tenga un buen alcance
  • Que se pueda cerrar para que no le entre el polvo

Esto es lo que he encontrado, la cosa no es que esté para tirar cohetes...:

Logitech diNovo Mini

diNovo MiniEste teclado bluetooth tiene una duración de 30 días por carga de pilas, pero son recargables y se pueden tener cargadas en unas 4 horas. El alcance es de máximo 10 metros (más que suficiente en un comedor). Dispone de retroiluminación por lo que es práctico durante una sesión de cine donde todo está oscuro. El ClickPad puede usarse para mover el ratón o para desplazarse por los menús. Algunos usuarios han dicho que es compatible también con Mac pese que la web dice que es compatible con Windows y con PS3 solamente.

Este sin lugar a dudad es el que más me gusta de todos los teclados, ojo al precio...

Precio: 160 EUR

Ver el teclado en la web de Logitech

Logitech diNovo Edge

diNovo EdgeSi el anterior era caro, este le supera. Es mucho mayor que el anterior, pero quizá sea interesante para quien quiera un teclado de trabajo

Precio: 180 EUR

Ver el teclado en la web de Logitech

Keysonic Wireless Blueetooth

Keysonic Wireless Bluetooth KeyboardEste teclado bluetooth de membrana viene con un trackpad clásico y dos botones. Hay otro modelo similar en color plata. Mide unos 30cms de ancho y parece bastante interesante, pero no he encontrado ninguno con teclado español..

Precio: Al cambio unos 40€ aprox.

Teclado inglés en Amazon

Adesso Wireless keyboard

AdessoSimilar al anterior, tampoco lo he visto disponible con teclado español. Dimensiones más o menos contenidas, sin mucho más que destacar.

Precio: 110 USD

Web del producto

USB 2.4GHz RF Entertainment Slim Keyboard with Smart TouchPad

Slim Keyboard con Smart TouchPadEl touchpad puede ser utilizado también como teclado numérico, pero este es un teclado normal en tamaño, de unos 42cm de ancho. Excesivo si se quiere algo reducido, tampoco lo he visto disponible con teclado español. Otras funciones interesantes son que se puede utilizar el trackpad como en los Macs, para ampliar imágenes reducir, etc... con diferentes movimientos de los dedos.

Precio: 69 USD

Tienda con el producto

Apple Wireless keyboard

Apple WirelessPese a que es de Apple (para usar con un mac mini) Este teclado bluetooth es para mi el que esteticamente más me gusta. Pero por ahora seguiré con mi Ubuntu y además se necesita un ratón adicional, por lo que queda descartado de mi lista también.

Precio: 79€

Teclado de Apple

Y tu... ¿Sabes de algún otro que pueda ir bien?

Evitar que se abra iTunes al conectar el iPhone o Ipod

Esto es una chorrada, pero si sincronizas tu dispositivo con más de un ordernador y te interesa que al enchufarlo no se abra el iTunes hay que seguir estos sencillos pasos (esto vale para Windows y Mac):

  1. Enchufar el iPhone (o iPod) al ordenador
  2. En el iTunes, en el menú de la derecha, hacer click en el dispositivo
  3. Quitar la marca de la casilla "Sincronizar automáticamente al conectar este iPhone"
  4. Pulsar Aplicar.

y esto es todo! La siguiente vez que lo conectes, no se abrirá iTunes.

iTunes

Dirty Twitter

Fuck! I can't believe there is a service out there that filters all the world tweets and presents only the dirtiest ones... The offender site is called Cursebird, and that is his job plus it does it well.

Dirty twitter

So we all will have to watch our sayings more than ever...