Administración pública y Software Libre

Logo GNUDe nuevo tratamos de que la administración pública tome cartas en el asunto del software, y adopte una postura decidida por la inversión y el desarrollo local. Todo esto redundará en el beneficio de todos y todas.

Si tenéis un minuto echad una firma: https://www.change.org/p/administraciones-públicas-queremos-software-libre

Salud 🙂

Escrito en Software Libre | Tagged | Deja un comentario

Nokia N900 y Subversion

N900 photoSi es necesario utilizar Subversion con tu querido Nokia N900 y te encuentras con una violación de segmento cada vez que lo ejecutas, es posible que encuentres esto muy util: https://tbressure.wordpress.com/2011/11/04/retour-de-subversion-sur-le-n900/

Básicamente se trata de un problema con Apache Portable Runtime y en general la solución pasa por esto:

regular-user
# Open up your terminal and type:
apt-get install libaprutil1=1.3.9-2 libapr1=1.4.2-1

You got it!, use Subversion as usual 🙂

Escrito en Hardware, Maemo5 | Tagged , , , | Deja un comentario

Sandi Metz, great post

sandimetzlogoA great post from Sandi, regarding wrong abstraction when coding: http://www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction. I’ve seen myself in such a situation a lot of times, so time to change things! 🙂

Escrito en Programación, Ruby | Tagged , | Deja un comentario

LibreOffice headless: debugging session (OMG!)

Logo LibreofficeA couple of years ago I decided to try LibreOffice’s “–convert-to” parameter to generate different formats of a document, instead of using the ancient listen-on-port-8100 service and use an external Python script in order to do the dirty job of conversion. The results of the tests where great: excelent performance, reliable results, avoid the control of port 8100: IM-PRESSIVE! 🙂

Recently an ancient Rails 2.3 app was failing in the generation of PDFs via this 8100 port + Python script stuff 🙁 I could try to figure out which the error was (dive into Python) or migrate to that convert-to simple solution: no doubt!.

I change my scripts for PDF generation, but something nasty was waiting me around the corner 🙁

  • It didn’t work just out of the box.
  • Local development setup was working right.
  • Debugging time! 🙂

First I tried at CLI:


libreoffice --headless --convert-to --outdir /tmp my-test-file.odt

It works!. So problem is not neither with Libreoffice and Ruby version. Trouble is elsewhere. Next I consider my code: perhaps something was interfering and I decided to set a simple “runner” task just to call the system:


# simple-task.tb
`libreoffice --headless --convert-to --outdir /tmp my-test-file.odt`

Nope, seems to fail again 🙁 Then I tried to get the output error. I found an excellent post about: http://blog.bigbinary.com/2012/10/18/backtick-system-exec-in-ruby.html. So I changed my task:


# simple-task.tb
output = `libreoffice --headless --convert-to --outdir /tmp my-test-file.odt 2>&1`
Rails.logger.info('DEBUG: ' + output)

The output was a simple: “Error: source file could not be loaded” :/ After so many searches at DuckDuckGo (please avoid Google-vil) I found a tip at Stackoverflow here: http://stackoverflow.com/questions/37772250/using-soffice-within-python-command-works-in-terminal-but-not-in-python-subproc. Then I tried to reproduce it: yes if the source file (the one to be converted) does not exist then, the same error shows up!. Mmmm, path issue?, naaahh. Seems to be a dead-end, so time for lateral thinking 🙂

The server has some other apps with the same environment (Rails 2.3, Ruby 1.8.7): what if try the same runner task with them?. I found interesting results: some of them worked and some don’t. So the failure had to be with subtle difference somewhere between apps: almost there 🙂

Finally I found the guilty code: a stupid line at “config/environments/production.rb”:


ENV['TMPDIR'] = '/srv/rails/tmp'

That path does not exist in current server, so LibreOffice was unable to generate/find the middle temporary file in order to convert the document. Remove that line and yes!, I have it up and running again 🙂

What do I’ve learned after 2 days debugging session?:

  • I manage the stress better than 2 before 😀
  • Put configuration environment constants elsewhere is a bad habit
  • Debugging is nice: you learn a lot of things, but it so stressful 🙁
  • Going for a walk or so helps a lot in lateral thinking 🙂

Cheers! 🙂

Escrito en Programación, Ruby, Software, Solucioname esto... | Tagged , , , , , , | Deja un comentario

Thunderbird: insertar una imagen NO incrustada

thunderbirdMozilla Thunderbird es una herramienta muy poderosa y versátil. Recientemente he necesitado hacer que la imagen de un correo HTML apunte a un servidor, y sea cargada en el correo cada vez que este se abra por sus destinatarios.

Por defecto Thunderbird hace que una imagen que se añade a un correo HTML sea incrustada en el propio correo:


img src='http://mi-dominio.com/imagen.jpg'

Para forzar a la situación y hacer que la imagen no esté incrustada en el correo hay que usar un poco de “Mozilla-fu” 🙂


img moz-do-not-send='true' src='http://mi-dominio.com/imagen.jpg'

¡Gran parámetro, excepcional resultado! 😀

Escrito en Software, Software Libre | Tagged , , | Deja un comentario