nexoBlogs network
Anonymous Anonymous

TortoiseSVN for Ubuntu Linux: The real alternative

Sunday, 25 de October del 2009
filed under , ,

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

See photo album »

All ISO-639 language codes for MySQL

Saturday, 05 de September del 2009
filed under ,

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.

You can download the ISO-639 MySQL script here (right click and save)

The file is encoded in UTF-8 (so if you display it in the browser you'll see the letters messed up)

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

Thursday, 06 de August del 2009
filed under , , ,

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 right click and save the following link as function.fill.php in your plugins directory.

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)<2) { $smarty->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

Thursday, 06 de August del 2009
filed under ,

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?

See photo album »

Evitar que se abra iTunes al conectar el iPhone o Ipod

Wednesday, 03 de June del 2009
filed under , , , ,

iTunes

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

Friday, 08 de May del 2009
filed under ,

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...

non-RDBM distributed databases, map/reduce, key/value and cloud computing

Monday, 30 de March del 2009

I've been playing recently with several distributed databases with the aim of choosing the best solution for my needs. Since there isn't much documentation on the web with a general overview on the subject, I write here some comments, thoughts and my humble experience. Hope it's usefull for you, this document is not a comparison of performance, or a "mine is bigger than yours",  just some ideas ;)

My background
Being my experience based on relational databases (like MySQL or Postgres) and Object oriented databases (like ZODB) it was very easy for me to get hooked on this new challenge, anything but the relational databases (no offense). Last year, in Mainz, Germany, and after having heard a lot of buzz on the subject, Jan Lehnardt gave an interesting lecture on CouchDB. (BTW, thanks Jan for all the questions you answered to me). That event was the firestarter and since that I've been trying things... So I am a newbie in this expert area.

Now, I am working on a project that performs WRITES on very large set of data. All this data doesn't need to be in a relational database since it's a simple collector of activity, flat and with a variant structure that writes some gigabytes every day that must be processed at night, under different criteria.

To store this, I started doing some research on what I could use to store that data, and here are some of the things I tried. The principles were:

  1. Horizontally scalable
  2. Able to handle and process a lot of non-trivial data
  3. Able to write at least 1000 reqs/s, non-bulk
  4. Open source

(I still have a decision to make)

Tokyo Cabinet + Tokyo Tyrant (key/value)

Tokyo Cabinet is library of routines for managaing a database that in conjunction with Tokyo Tyrant, the network interface, create an excellent network database. Tokyo supports up to 8 Exabytes of data and it's really fast both in write and in read. Currently is used in the Japan's Mixi Social Network (more than 14 billion page views monthly). It's a key/value database.

From the sysadmin point of view was a lovely product, easy to install, start, manage, backup or replicate. It's everything as easy as they state in the website, and it works. If you, like me, are a Memcached lover, Tokyo is completely compatible with the memcached protocol, allowing you to do delights as "persistent but volatile data" . You can run the database in memory-only or with persistence (If you want in-memory, I think memcached is slightly faster for that purpose, but it's just my impression on few tests, do yours or Google it).

To start a master-slave system is as easy as (you might want only a master, or several slaves):

Start the Master: ttserver -port 1978 -sid 1 casket-1.tch

Start the Slave: ttserver -port 1979 -sid 2 -mhost localhost -mport 1978 -rts 2.rts casket-2.tch

Where casket are the databases and the extensions define what algorythm you want to use. Easy as hell. Just be aware to set a different and unique identifier (sid) for every server and say the slaves who is the master host (mhost). That would run a master and a slave on the same machine on ports 1978 and 1979.

Ok, that was really exciting for me but I found that despite Tokyo is wonderful and everything, as in memcached, you need to know the KEY of the element you want to retrieve (yeah, that's what a key/value is supposed to do). In my case, I need to map/reduce the vast amount of data, so Tokyo is not an option for me, but might be what you've been looking for. I'll use it for any other project, sure.

The weak points I found where that when used through the HTTP wrapper the performance goes down significantly. For instance, I had much better results using curl POSTs with CouchDB on a single node. Oh, and I hope you speak Japanese, you won't find much documentation in English ;)

Basic example on how to write data in Tokyo using the HTTP wrapper:

curl -s -X PUT -d "my_value" "http://127.0.0.1:1978/my_key"

But the fastest way is using the C binaries:

tcrmgr put -port 1978 127.0.0.1 "my_key" "my_value"

You can list the contents using:

tcrmgr list -port 1978 localhost

Here I link a presentation so you can see the whole pictureTokyo Cabinet and Tokyo Tyrant Presentation

CouchDB (document oriented database)

CouchDB is a schema-free document oriented database. A wonderful project of Apache with more community than the others behind it. CouchDB works using a RESTful HTTP/JSON API meaning that with simple HTML and JS you can create a dynamic website. Of course you can use other wrappers like PHPillow if you want to use PHP.

The default query language of the database is Javascript. You write map/reduce functions that are stored as views to get only the content of your interest, your docs are fully indexable, and although you might be pretty used to SQL do give CouchDB a chance.

Amongst all the systems is the one I like more as a product, although is not having a daemon for managing the service (tried the 0.9 from checkout) it is very easy to install and run.

Some things I really like:

  1. No language scripting needed
  2. The replication is bi-directional, peer-based
  3. Leave your nodes offline for a while, reconnect them and nothing happened.
  4. The Futon interface. Some sort of, let's say, phpMyAdmin where you can play and test your views

A basic sample of insertion using curl:

curl -s -X POST 'http://localhost:5984/mynewdb/' -H "Content-Type: application/json" -d '{ "my_key": "my_value" }'

If you want to insert a lot of documents you should insert documents in bulk mode. It's faster and your database will be more compact. Do not perform this test over a million iterations or your space disk will grow a lot.

What is CouchDB

MongoDB (document-oriented)

MongoDB is like CouchDB, another document-oriented database. This project was born this year 2009, so it's very young. With a colleague we tried to install the server and run it with the PHP libraries under CentOS, but it was completelly impossible.

Despite all, I'll keep an eye on it, very interesting as well, because:

  1. You can filter data by fields without knowing the keys (as couchDb)
  2. You can create indexes to accelerate the data filtering
  3. Sexy functionalities to operate with the database
  4. Internal drivers ready for C, Ruby or Python. A PHP module available.
  5. Without much learning curve
  6. Replication, failover and auto-sharding coming soon.

Project Voldemort (key/value)

Behind this curious name from Harry Potter there is an interesting Java distributed key-value system database. Project Voldemort handles replication and partitioning automatically, every server contains only a subset of the data and if a node fails your data integrity is not compromised, nor there is a central point for coordination. The balancer read from any node but writes in all them at the time, that can reduce your writing experience. This system is used in some parts of the well-known LinkedIn with 12TB of data. But I am not a big fan of Java, so I played a little bit, and after going nuts running the examples and installing the Ecplise stuff,  i tried something else, not for me :$  (Not a lover of Tomcat either)

Again, another key/value. Doesn't fit me at this moment.

Hbase (column-oriented)

Hbase is a Key/value Hadoop project. I am using it right now with the HTTP interface and it's very fast on writing (the quicker for my tests). If you want to serve your website content from this database, you better skip this one, the latency is high. I jumped from here to cloudera.

Some basics:

Create a table in Hbase:

 

curl -H "Content-Type: text/xml" -H "Accept: text/xml" -v -X POST -T - http://ip.to.hbase:60050/api/

Then paste something like this and press Ctrl+D twice after:

 

<?xml version="1.0" encoding="UTF-8"?>
<table>
<name>table1</name>
<columnfamilies>
<columnfamily>
<name>col1</name>
<max-versions>2</max-versions>
<compression>NONE</compression>
<in-memory>false</in-memory>
<block-cache>true</block-cache>
</columnfamily>
<columnfamily>
<name>col2</name>
<max-versions>2</max-versions>
<compression>NONE</compression>
<in-memory>false</in-memory>
<block-cache>true</block-cache>
</columnfamily>
</columnfamilies>
</table>

After version 0.19 the JSON notation will be supported, so you will be able to do things like:

curl -H "Content-Type: application/json" -H "Accept: application/json" -v -X POST -T - http://ip.to.hbase:60050/api/

{"name":"test5", "column_families":[{ "name":"columnfam1", "bloomfilter":true, "time_to_live":10, "in_memory":false, "max_versions":2, "compression":"", "max_value_length":50, "block_cache_enabled":true } ]}

 

 

Show tables in Hbase:
Any of these:

curl -v http://ip.to.hbase:60050/api/
curl -v -H "Accept: text/xml" -X GET http://ip.to.hbase:60050/api/

And to see the metadata of a table:

curl http://ip.to.hbase:60050/api/table1

 

Insert a row

 

curl -v -T row_contents.xml http://172.20.4.42:60050/api/table1/row/

 

... where row_contents.xml has something similar to the XML code pasted above.

Other commands...

Disable/enable a table:

curl -v -X POST http://ip.to.hbase:60050/api/restest/disable
curl -v -X POST http://ip.to.hbase:60050/api/restest/enable

PUT:

curl -v -T y.row http://ip.to.hbase:60050/api/table1/row/y?column=a

GET:

curl -v  http://ip.to.hbase:60050/api/table1/row/y    

SCAN

curl -v -T ./y.row http://ip.to.hbase:60050/api/table1/scanner?column=a:
curl -v -T ./y.row http://ip.to.hbase:60050/api/table1/scanner?column=a:
# That returns an ID, like b959591, retrieve it:
curl -v -T ./y.row http://ip.to.hbase:60050/api/table1/scanner/b959591

Cloudera (hadoop cluster)

Cloudera is a company that offers an Apache-licensed packed solution based on the Hadoop family. If you are interested in cloud computing and you have been after projects like the Yahoo!'s Pig or the Facebook's Hive,  then you'll like to know that Cloudera brings to the 'mere mortals' all that power in an easy RPM.

Cloudera combines the Hadoop cluster and filesystem HDFS with Hive and all the pain that is configure a Hadoop cluster. You will be able to summarie, analyze and query an ingent amount of data. Have a look at the latest video of training sessions to get an idea on how the Hive query language similar to SQL looks like. You can even download an VMWare virtual machine with the solution running.

I am recently looking at this, it's a lot more complex than any of the other solutions, but since I'll need to store and process several Gigabytes every day, this seems the way to go...  :_/ sniff...

If you are interested in this, you can also have a running Hadoop via Amazon Elastic MapReduce, billing is hourly and by machine.

More interesting projects:

The folling project aren't less interesting, nor I hadn't time to fully test, but for my current needs aren't suitable,  they are worth a mention anyway:

  • Disco Project: Another map/reduce framework started at Nokia. Uses python and quite simple.
  • LightCloud: Distributed key-value database using the Tokyo Tyrant network interface (Plurk open source)
  • Cassandra: Another Facebook project based on Google's BigTable
  • Hypertable: Also based on BigTable, a distributed storage system using a query language. It's not supporting load balancing as far as I am concerned.
  • Scalaris: An interesting key-value store allowing range queries, but it doesn't support persistence yet.
  • Redis: Not just another key/value. Has a lot of libraries for PHP, Python, Ruby, Lua, Perl... If the numbers are true it's fast as hell! A complete protocol to interact.
  • MemcacheDB: Memcache made persistent (key/value of course)

These are only a few ideas that may help to you. Hope it helped :)

Cómo reproducir ficheros .RMVB en Ubuntu

Saturday, 28 de February del 2009
filed under , , ,

Los ficheros .rmvb no se pueden reproducir por defecto en Ubuntu, esta extensión es para los de tipo RealMedia Variable Bitrate, pero instalando los códecs de Mplayer los podrás abrir sin problemas.

Lo primero que debes instalar, aunque no sea intuitivo es la librería libstdc++5, para hacerlo o bien abre Synaptic ( Sistema -> Administración -> Gestor de Paquetes )  y haz doble click sobre libstdc++5 o ejecuta en la terminal:

sudo apt-get install libstdc++5

Si ya tienes Mplayer instalado con los códecs prueba ya a ver si se pueden reproducir los ficheros. Si no, lo siguiente será instalar Mplayer,  a través otra vez de Synaptic o de la terminal

sudo apt-get install mplayer

Luego para instalar los códecs, bájatelos de la página Mplayer Binary Codec Packages (si no sabes cuál elegir lo más probable es que necesites el que se llama Linux x86). Descomprime la carpeta que te has bajado en el escritorio y abre la Terminal, ejecuta los siguientes comandos:

cd Escritorio  ( en función del idioma de tu Ubuntu puede cambiar)
cd essential-20071007
sudo mkdir -p /usr/lib/codecs
sudo cp * /usr/lib/codecs

A partir de este punto ya sólo te queda configurar Mplayer, para ello entra en las Preferencias y en la pestaña Codecs & Demuxer selecciona de los deplegables:

  • Video codec: RealVideo decoder
  • Audio codec: FFmpeg

y ya deberías poder reproducir los ficheros .rmvb en Ubuntu. Si te suceden cosas extrañas, como ver la imagen pequeña, no oír el Audio, o ver la imagen que da saltos, tendrás que hacer modificaciones en la configuración de Mplayer, como por ejemplo desactivar opciones tipo "Enable double buffering", "direct rendering", etc...

Mplayer CodecsMplayer prefs video

See photo album »

Sponsors

Comments

Cómo reiniciar o resetear un ipod colgado (konfusion)
GRACIAS tio! me salvas la vida! al desconectar mi iPod del pc se quedo colgado con la pantalla de ......(05 Feb)
Cómo reiniciar o resetear un ipod colgado (konfusion)
GRACIAS tio! me salvas la vida! al desconectar mi iPod del pc se quedo colgado con la pantalla de ......(05 Feb)
Cómo reproducir ficheros .RMVB en Ubuntu (Cómo reproducir ficheros .RMVB en Ubuntu « Robysottini's Blog)
[...]r prefs video" ......(03 Feb)
Cómo reiniciar o resetear un ipod colgado (yury)
gracias todo bien...(03 Feb)
Cómo reiniciar o resetear un ipod colgado (giovanni)
ME SALVASTE LA VIDA AMIGOOO MIL GRACIAS TE LO AGRADESCO ... A SEGUIR DANDOLE CAÑA AL IPOD JEJEJE ...(02 Feb)

Login

Otros blogs de nexoBlogs: