Reversible Debugging

I wasn't aware of Reversible Debugging. You do it in your head somehow but it will be great when it gets supported in GDB.

The FSF calls this a high priority Free Software project.

Discussion (3) Loading... Vote up! Vote down!

amarillismo

El amarillismo es aburrido. En los últimos días se ha dedicado bastante espacio en la televisión y en otros medios para cubrir la muerte de un niño de 11 meses a manos de su padre biológico. No es nada agradable que pasen en directo los momentos en los que están levantando un cadáver.

Pienso que a menos que una noticia (por dolorosa que sea) requiera atención inmediata es mejor enterarse de ella unos días después y no leer ni ver tantos detalles.

Discussion Loading... Vote up! Vote down!

Google Treasure Hunt 2008

I got a t-shirt and an iPod Nano from Google. I wasn't expecting the iPod at all!

It seems I did well in a problem in the Google Treasure Hunt. I hope they release more information about the contest (A weblog post or something).

I think I did well in the last problem.

This is a sample question:

Find the smallest number that can be expressed as
the sum of 3 consecutive prime numbers,
the sum of 63 consecutive prime numbers,
the sum of 201 consecutive prime numbers,
the sum of 689 consecutive prime numbers,
and is itself a prime number.
For example, 41 is the smallest prime number that can be expressed as
the sum of 3 consecutive primes (11 + 13 + 17 = 41) and
the sum of 6 consecutive primes (2 + 3 + 5 + 7 + 11 + 13 = 41). 

Here is the Python source code I used to find a solution : primes.py.

$ time ./primes.py 
664579
200
1
1
solution: 8013479

real    0m2.339s
user    0m2.208s
sys     0m0.132s

Discussion Loading... Vote up! Vote down!

pasto-2008

El Día Internacional del Software Libre fui a San Juan de Pasto. Conocí la plaza que queda junto a la alcaldía y los alrededores (me animé a caminar sólo). La Universidad de Nariño tiene un campus bonito.

De la ciudad me gustaron varias cosas: Bastante vegetación alrededor, poco tráfico vehicular y calles limpias. Sobra decir que la gente allá es muy amable.

Parece que el Aeropuerto actual lo cierran con frecuencia por mal tiempo pero me fue muy bien.

Muchas gracias a La Guardia de Tux por la invitación :-) Desde hace mucho tiempo quería conocer Pasto.

Discussion Loading... Vote up! Vote down!

modem-usb

If you ever need a modem that works out of the box in Linux you can try the USRobotics 56K USB Modem. It's a real modem (not a Winmodem) with a USB-Serial interface.

Discussion (3) Loading... Vote up! Vote down!

isnt-control-fun

Isn't control fun? : Ball and Plate control using a touchscreen.

They included this video:

Discussion (1) Loading... Vote up! Vote down!

select-timeout

From the select(2) Linux man page:

On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this. (POSIX.1-2001 permits either behavior.) This causes problems both when Linux code which reads timeout is ported to other operating systems, and when code is ported to Linux that reuses a struct timeval for multiple select()s in a loop without reinitializing it. Consider timeout to be undefined after select() returns.

I guess I should use gettimeofday(2) to make the following function adhere to the POSIX specification.

/*
 * Read from a file descriptor with a timeout.
 * If some data arrives and the timeout hasn't expired, keep reading.
 *
 * This functions has been useful to me in different contexts.
 * I use it to read from serial ports, mostly.
 * With a few changes in error management it should be useful for sockets as well.
 * timeout is in milliseconds.
 */

int
read_with_timeout(int fd, char *buf, int len, int timeout)
{
  fd_set rfds;
  struct timeval tv;
  int retval;
  int nread = 0;

  FD_ZERO(&rfds);
  FD_SET(fd, &rfds);

  tv.tv_sec = timeout / 1000;
  tv.tv_usec = (timeout % 1000) * 1000;

select_next:

  /* We rely on the value of tv after the select call.
   * This is a Linux-only thing.
   * TODO: Fix. */

  errno = 0;
  retval = select(fd + 1, &rfds, NULL, NULL, &tv);

  if (retval == -1)
  {
    if (errno == EINTR)
      goto select_next;

    perror("select");
    exit(1);
  }
  else if (retval)
  {
    if (len - nread > 0)
    {
      int r;
      r = read(fd, buf + nread, len - nread);
      if (r > 0)
      {
        nread += r;

        if (len - nread >  0)
          goto select_next;
      }
      else
      {
       /* you might get harmless reports of 0 length reads */
       fprintf(stderr, __FILE__" * read returned %d\n\n", r);
      }
    }
  }

  return nread;
}

Discussion (4) Loading... Vote up! Vote down!

mini-lzo

I used the library miniLZO to compress text in memory and I had good results. I needed to sort a 10GB file with a lot of redundant text with a special criteria (the file had a fixed field format with records), and I wanted to check if I could do it in memory.

I could sort the file using less than 1GB of RAM and no disk. The library is very fast and it has an example in C. I used it in Linux and HP-UX. I wanted to try this for a long time. It worked very well.

From the webpage:

miniLZO is a lightweight subset of the LZO library. We've created miniLZO for projects where it is inconvenient to include or require the full LZO source code just because you want to add a little bit of data compression to your application.

Discussion Loading... Vote up! Vote down!

to-do

Hace casi dos años escribí algo sobre la lista de cosas por hacer, en donde afortunadamente llegaron comentarios bien interesantes (creo que la foto de los gatos tiene algo que ver).

La charla de Randy Pausch (QEPD) me gustó.

En el primer comentario de Alejandro en mi entrada pasada ya tocaba el tema de dividir las tareas por prioridades e importancia (le faltó la Urgencia para tener en cuenta el esquema de Pausch), y otros comentarios también ayudan.

Usualmente el trabajo que uno hace tiene mucha carga adicional (overhead), y uno invierte mucho tiempo en tareas auxiliares que no son trabajo real, pero que toca hacerlas.

De la charla de Pausch me gustaron varias cosas.

Primero, el hacer el tiempo equivalente a dinero. Es algo que ya había pensado. Acualmente (hoy) le asigno el valor de 100.000 pesos colombianos a cada una de mis horas. Creo que es más fácil pensar en dinero que pensar en tiempo. Si uno piensa que ver TV por 3 horas cuesta 3 horas, parece menos que 300.000 pesos .En ocasiones (hablando de trabajo) uno consigue algunos cortos que pagan eso o más, pero no es la regla. Para otros trabajos que pagan menos (la mayoría) no sólo considero el valor de la hora, sino si el trabajo me gusta, si es fácil de hacer, el riesgo que tiene, si necesito plata urgentemente en el momento, si lo puedo hacer remoto ó si requiere horarios fijos, si trabajo con amigos o no, entre otros factores.

Otra cosa que me gustó de la charla fue hablar del costo de las tareas. Mientras más urgente sea, más caro será hacerlas. Por ejemplo: pagar algo a última hora puede implicar filas más largas porque la mayoría deja las cosas para última hora. Esto es algo evidente, pero no lo había tenido en cuenta como algo tan importante. Si uno deja todo para última hora el overhead de las tareas es mayor.

Todo lo que tenemos es el tiempo que nos queda... (frase robada).

Discussion (2) Loading... Vote up! Vote down!

desplazados

Esconder a los desplazados no hace que ellos dejen de existir.

Ver: Por lo menos 300 desplazados intentaron tomarse el parque de la 93 en el norte de Bogotá.

No se van a la ciudad por que quieren sino porque les toca. Por lo menos la mayoría.

Ver: 52 niños colombianos murieron de hambre

Las jóvenes madres de la comunidad de Conondó, Chocó, están viendo morir a sus pequeños hijos de física hambre. El Estado no llega por allá a auxiliarlas; sólo el ejército y los grupos armados ilegales que los tildan de ser cómplices de uno u otro bando. Informe especial para Semana.com de Mauricio Beltrán desde Chocó.

Discussion Loading... Vote up! Vote down!

icfp-2008

Here is a writeup for our participation in the ICFP contest:

I had lots of fun. We didn't do very well with the assigned task but we managed to send submissions (lightning and normal).

I really enjoyed working with Andrés and with Juan Manuel for the first time in a contest. And of course working again with Luis Felipe was a good experience.

In previous years we had issues with coordination because we were working from different cities and countries and it made our experience seem like a contest between team mates.

I don't think it happened because we're evil or because we didn't want to work with each other but rather because in previous years we had people wanting to write code in Python, in Common LISP and in Scheme. This year we standardized in Python even when half of the team didn't know the language very well before the contest and it did pay off. Even the new Python users liked the idea.

We used some C++ code from Python thanks to swig.

We also met in real life and this helped a lot. The inter-personal communication bandwidth of a blackboard and a real-life meeting is by far bigger than the bandwidth of IRC.

Perhaps in the future if we work from different cities or countries we should try conference calls with Skype (I'd prefer a free software alternative but Skype is OK if we can't find one) and a virtual blackboard. Not all the time but for periodic team meetings and and peer to peer meetings.

Working in teams has a big overhead but it is more fun, specially if you don't care -that much- about the scores. When you work in a team in a contest like this one (with a single goal) you might not achieve your typical maximum performance but it don't think it really matters. The performance of the team is what matters and we have to improve it.

At some moment you should realize that it doesn't matter if you notice that the problem can be solved in a better way (specially if you don't have time to finish and debug a new implementation). You will notice that but it doesn't matter much. When you have reached the point of no return you should focus in making a good submission (specially when you have to send source code).

If the team is big perhaps it can be divided and try different approaches and then send the one that performs better. But it would be better if you do this after you've built the infrastructure that you need (simulators, visualization, etc) so that you can feel comfortable with this code-base and you don't feel like you need to reinvent the wheel.

Let's hope I can participate again next year and share a good time with my friends :-)

Discussion (4) Loading... Vote up! Vote down!

twitter

Salvense ustedes. Para mi ya es tarde.

Discussion (7) Loading... Vote up! Vote down!

reto-api

Terminó el reto de El Tiempo para el desarrollo de programas que usen el nuevo API que todavía está en pruebas.

En este hilo se anuncia el ganador.

Me sorprende que lograran escribir código en un entorno como el de la Campus Party en el que es difícil concentrase para hacer algo debido a que pasan muchas cosas al mismo tiempo.

El programa ganador probablemente no fue el que requirió más esfuerzo, pero es una buena idea que se ve bien. Es muy normal que Julian Amaya se encontrara sorprendido al ganar, ya que otros programas se veían más trabajados.

El programa de Santiago Villegas me recuerda a tumbolia:

Aca está el listado completo de programas:

Camilo Andres Galeano Prieto
http://www.evoled.com/wii/eltiempo/
Manuel Ignacio Rodriguez Fernandez
http://rapitors.net46.net/Prueba
Manuel Ignacio Rodriguez Fernandez
http://rapitors.net46.net/ZonaUsuario/index.xhtml
Andrés Sepúlveda
http://www.andressepulveda.com
Santiago Ramirez
http://72.47.252.70/eltiempo/index.php
John Jaiver Acosta Fernandez
http://www.expresionmedia.com/maquina/
Santiago Villegas
http://www.bioral.com.co
Julian Amaya
http://tiempoloverader.appspot.com/static/TiempoFeed.html
David Bello
http://pujaplicaciones.javeriana.edu.co/ElTiempo/
Fabian Andres Sabogal Ocampo
http://fvioz.eviled.org/
Aldemar Bernal
http://smart-feed.vertigoproject.net/
Alejandro Gonzalez
http://www.zerofractal.com/lab/eltiempo-api/noticias-petit.html

Discussion Loading... Vote up! Vote down!

ubuntu-and-debian-redbull

Logos de Debian y Ubuntu en la Campus Party de Colombia usando latas de redbull.

Ah?

En este video despiertan y entrevistan a quien se tomó el trabajo de hacerlos.

Discussion (1) Loading... Vote up! Vote down!

Pesadilla a lo Monterroso

Cuando despertó, Uribe todavía estaba allí y se quería quedar.

Discussion (1) Loading... Vote up! Vote down!

envosconfio

Nota:Esto es un borrador público, en evolución.

Por diversas circunstancias, he pensado que sería muy util un mecanismo para crear una red relaciones de confianza, que no sirva para firmar ni para encriptar. Un sistema que sea fácil de usar por personas no expertas en temas técnicos.

La idea sería que uno vea si los amigos de uno confían o no en personas, y así recursivamente. El mejor resumen sería:

Tener un grafo similar al que se crea en las redes sociales (grafos que permiten ir de un usuario a otro). En las redes sociales usualmente se busca el menor camino o la distancia promedio. En este caso lo importante sería ver si por intermedio de calificaciones hechas por amigos uno puede o no confiar en una persona.

Por eso, propongo crear el sistema (o la iniciativa) envosconfio.

Mi archivo sería uno como:

No es necesario listar a todos los conocidos. Vivimos en un mundo bastante conectado, y seguramente existirán diferentes caminos en la red que se forma para establecer relaciones de confianza con más personas.

Esto funcionaría bien en aplicaciones cerradas. Un ejemplo, es Orkut existe calificación de confianza. Hay tres caritas felices, y ahi las personas que confían en uno marcan el grado de confianza que tienen en uno. La idea central sería hacer algo similar, pero que no sea una red social, sino un estándar.

Es sólo una idea. Este asunto es muy complicado y no sabría en el momento como implementarlo. Nada más complejo que las relaciones humanas.

No sé si sea viable. Es sólo una idea, que vale la pena considerar.

Lo más difícil del asunto es hacer las calificaciones públicas.

Discussion (4) Loading... Vote up! Vote down!

utf8

Demoré mucho tiempo para usar UTF8 como localización por defecto.

utf8

Por fin.

Discussion (5) Loading... Vote up! Vote down!

songwrite2: El cantor de Fonseca (Carlos Huertas)

Actualización:

Terminé la canción completa ( versión lenta | versión rápida ).

He tratado de usar varios programas para hacer MIDIs a partir de partituras, pero no me ha ido bien con los que he probado. En todo caso es algo que quiero hacer y supongo que algún día aprenderé a usar uno bueno.

Por el momento encontré uno que es más bien sencillo, y gracias a eso pude ingresar parte de la canción El Cantor de Fonseca, de Carlos Huertas. (Aclaro que tengo la partitura en papel, no es de oido, los bajos si los puse).

El programa songwrite2 tiene sus errores pero funciona bien y no se bloquea. Es algo engorroso editar pensando en cuerdas y trastes y no transcribir una partitura directamente.

En todo caso, el que el método de entrada sea simple tiene sus ventajas: funciona y es predecible.

Programa songwrite2

Por esta vez, documentaré el proceso de conversión a MP3 para que no se me olvide (y tal vez sea útil para alguien más).

Primero, se usa el propio programa y se exporta un MIDI. Luego se usa TiMidity++ para convertir de MIDI a WAV.

 timidity -Ow -s 44100 -o output.wav cantor-de-fonseca.mid

Luego se usa un encoder (LAME) para convertir a MP3.

 lame -S -h -V2 -b32 -mj -q1 output.wav  cantor-de-fonseca.mp3

Copié los archivos a un servidor (temporalmente):

El archivo fuente de songwriter2 está acá.

Esta canción me gusta.

Discussion Loading... Vote up! Vote down!

robot-party

Yesterday I went to my first Robot Party hosted by Luis Felipe.

We started with a task: Build a simple self-balancing robot with two wheels.

We had available:

I was on a team with Diego. We advanced our design and we finished the basic structure. We also got the AVR working in a protoboard, but at 9PM Diego had to leave and we decided it was better if I joined Luis Felipe who had a working prototype with a simple ON-OFF control (he is very fast). This is what our structure looked like:

El que había iniciado con diego

When Diego left I helped Luis with ideas and with debugging and he ended up with a working proof of concept that could stay balanced using a PID controller.

Otra vista
Desde arriba

Unfortunately, we didn't have better sensors and since we used photo-resistors we had issues with light. This is the best video we could take ( Time to get an infrared camera :-) ).

I had a lot of fun but I felt a little frustrated because I didn't finish my own implementation. I know we would have finished it but finishing the real thing would have made me happier :-)

Perhaps next time we should not do a contest and instead work in a big team. The problem with this approach is that you always have ideas to try and having at least two teams allows everyone to try different ideas faster.

Discussion (3) Loading... Vote up! Vote down!

temblor

Hubo un temblor muy fuerte en Bogotá (de 5.5). Todavía estoy asustado. Estoy con Diego y con Luis Felipe en un 5to piso en una "Robot Party", armando dos robots de juguete.

Las comunicaciones están difíciles.

Discussion Loading... Vote up! Vote down!

Loading... Vote up! Vote down!

Last update: 2007-06-28 (Rev 11825)

svnwiki $Rev: 12966 $