Older blog entries for olea (starting at number 161)

How to use XPath expressions in shell scripting using xmllint

This is a minor tip I want to share. A little example of a nice software feature that made my day.

I've been messing with HTML scrapping and I took a look on xmllint (maybe new) features. My intention was to extract a particular pattern, for which the --xpath option could be fine. I've never been very good tuning xpath expressions so I made a search about how to approach this. I found an amazing feature of the xmllint shell mode. As explanation here I show the workflow used:

  • get your document, I used and HTML one
  • I didn't tested with broken HTML but you can test it with xmllint --html
  • get into shell: xmllint --html --shell [document], keep in mind [document] can be a remote URI.
  • in the shell mode you can search for a precise string, in my case I chose the one inside the desired pattern: grep [string]
  • here is when magic happens: xmllint answers with the xpath expression you can use for a xpath query
  • exit the shell
  • copy the extracted xpath expression to CLI: xmllint --html --xpath [xpath]
  • here it is.

You can tune your expressions adding new predicates, as using specific attributes, or extracting the text() node, etc.

Enjoy.

Syndicated 2012-04-04 20:00:00 from Ismael Olea

Repositorio CVS/SVN de LuCAS en github

Hace poco un colaborador del extinto TLDP-ES/LuCAS me preguntaba por las fuentes de uno de los documentos que alojábamos en el control de versiones del proyecto. Fue toda una agradable sorpresa. Desde la debacle de HispaLinux esos servidores desaparecieron de la faz de las IP.

Como tenía archivada una copia de la presunta última revisión del repo he aprovechado a subirla a un repo público, aunque sólo sea a efectos históricos. A partir de ahora está accesible en https://github.com/olea/LuCAS.

Descanse en paz LuCAS/TLDP-ES. Fue una gran satisfacción trabajar en él y creo que en su momento prestó un gran servicio en una época en la que las facilidades de autopublicación en Internet eran muy limitadas.

Syndicated 2012-04-04 16:32:00 from Ismael Olea

RetroShare for Fedora

I've made a pretty dirty porting of the RetroShare package from Unity Linux for Fedora. It's not published in my repository until a minimal QA could be done. You can download it using this interin URI: http://olea.org/tmp/retroshare/retroshare-0.5.2a-2.i686.rpm

Caveats:

  • it's build in F16
  • SPEC source still needs love, so there is a weird dependency error forcing to install with the --nodeps flag
  • I didn't have the time to run it yet, so maybe it's not even operative

You can report me any issue through the comments bellow.

Syndicated 2012-03-06 06:48:00 from Ismael Olea

Acceder a notificaciones.060.es con Fedora

A la hora de acceder al servicio de notificaciones oficiales de la administración pública española me he encontrado un problema con el uso de applet java con funciones criptográficas.

Mi configuración de partida consistía en

  • java-1.6.0-openjdk-1.6.0.0-65.1.11.1.fc16.i686.rpm
  • icedtea-web-1.1.4-4.fc16.i686.rpm

siendo icedtea-web el plugin java para navegadores (vía NPAPI) oficial de openjdk. No soy un gran usuario de applet vía web pero hasta ahora no recuerdo haber tenido ningún problema. Supongo que en este caso la clave está en los servicios criptográficos X.509.

Tras varias investigaciones esta es la configuración que me ha funcionado

  • Oracle JDK (en sabor RPM)
  • Scientific Linux java-1.6.0-sun-compat
  • he mantenido java-1.6.0-openjdk como alternativa java principal, lo cual es independiente del funcionamiento del plugin del original Oracle
  • adición de certificados X.509 a la infraestructura java de usuario (los applet no saben manejarlos desde el almacén del navegador) con ControlPanel:
    • [Seguridad]->[Certificados]->[CA de firmante]->[Importar]-> fichero FNMTClase2CA.crt
    • [Seguridad]->[Certificados]->[Autenticación de cliente]->[Importar] -> fichero con su certificado FNMT.
  • prueba de compatibilidad: enlace desde la especificación de requisitos de acceso.

Al acceder al certificado digital java pedirá la contraseña de protección que es exactamente la misma que tenía en el fichero importado.

Tras verificar el funcionamiento correcto he podido acceder a las notificaciones que tenía pendientes en notificaciones.060.es.

Ni con la configuración java afinada Chrome pasa la prueba (google-chrome-stable-17.0.963.56-121963).

Los usuarios de applet con funciones criptográficas que no usen servicios basados en certificados de la FNMT pueden encontrar útil la configuración general.

Lecciones aprendidas

  • El plugin de java ahora se llama libnpjp2.so, aunque siguen distribuyendo libjavaplugin_oji.so por motivos que desconozco. Me ha hecho perder una preciosa y enorme cantidad de tiempo con pruebas frustrantes.
  • Para los usuarios Fedora (y entiendo que CentOS, RHEL, etc) parece que tenemos la mejor manera de integrar el JDK oficial de Oracle a través del paquete java-1.6.0-sun-compat de Scientific Linux. Antes usaba la adaptación de JPackage java-1.6.0-sun pero creo que ya es innecesaria aparte de desactualizada.

Syndicated 2012-02-27 19:08:00 from Ismael Olea

Thinkfan for Fedora

Here it is the first release of Thinkfan, a simple and lightweight fan control program, for Fedora. As a thinkpad user so it's obvious what my interest is, but developer assures now can manage other computers fan too.

You can download from here:  http://olea.org/paquetes-rpm/repoview/thinkfan.html

Notes about this release:

  • Upstream tagged it as alpha until become more confident of it's stability. Feel free to test and contribute.
  • I've added it my first systemd configuration from scratch. Please send feedback if you detect any bug.

I'll very probably contribute it to Fedora as soon I feel it's operational.

As usual, package is available in my repo. You can set up paquetes-rpm repository in yum.
Enjoy.

Syndicated 2012-01-19 01:32:00 from Ismael Olea

Bitcoin for Fedora

I'm uploading a first approach of Bitcoin software for Fedora (15) v0.5.0. Bitcoin is a peer-to-peer electronic crypto-currency cash system.

It's not trivial to build Bitcoin in Fedora since it uses Elliptic Curve Digital Signature Algorithm (ECDSA) «a cryptographic algorithm used by Bitcoin to ensure that funds can only be spent by their rightful owners», a feature of OpenSSL which has been restricted in Fedora due to patents concerns.

To circumvent this obstacle package includes pristine sources of OpenSSL from upstream and builds it for the sole needs of bitcoin compilation and static linking.

Notes about this release:

  • This is supposed to be fully operational; if you find a disarrangement please report through comments below.
  • Support of UPNP is deactivated for a while. I'll fix this as soon I get miniupnpc decently bundled.
  • Some love is pending to make rpmlint happy.
  • It, sadly, doesn't build with Mock. The cause is some of the juggling for compiling the upstream OpenSSL. I'll try some workaround for it.
  • If you rebuild de src.rpm in your system you must remove the openssl-devel package to avoid conflicts.

If I got satisfied about the final results I probably postulate it to RPM Fusion, since the patents concerns restricts it in Fedora. If someone is interested on taking the responsability of maintain it I'll be very happy to let it.

As usual, package is available in my repo. You can set up paquetes-rpm repository in yum.
Enjoy.

Syndicated 2011-12-07 21:40:00 from Ismael Olea

SparkleShare for Fedora

I've just uploaded my first SparkleShare for Fedora (15) v0.4.0. SparkleShare is a collaboration and sharing tool.

I'm not used to SparkleShare so I'm not sure if all dependencies are well tuned. I've activated the support of libnotify and smartirc4net. The first is working but I don't really know how it uses it and if it's really working. Integration with Nautilus is available too.

The package quality is a bit under Fedora requirements but it's, but the application seems to me mature enough to add it to Fedora. I encourage you to contribute it. In the middle, please report here any defect you detect.

It's available in my repo. You can set up paquetes-rpm repository in yum. Enjoy.

Syndicated 2011-11-15 19:12:00 from Ismael Olea

Setting up a Gmail backup


After reading the horror story of a hacked Gmail account I decided to get more benefit of my underused backup storage.

I currently have a desktop machine working as a server with Fedora Linux and an attached Drobo storage. Thus I set up the next configuration:

  • a Gmail account
  • OfflineIMAP for syncing to a local repository
  • drobo redundant storage with 4 hardisks
  • a maildir repository on the drobo
  • a daily cron entry

The thing is syncing right now.  Evolution is supposed to be able to access the local repo which is very nice to check the repo althought I plan to use for one direction sync only. If interested, OfflineIMAP is supposed to do double direction syncs smothly.

Some caveats:

I'm having random OfflineIMAP crashes so I'm doing the first full sync calling it manually inside a while true bash line, but as far as I read seems to be a mature program with specific support for Gmail IMAP server.

If you wish secured access take care to set up the ssl variable to yes for each repository since setting port to 993 is not enough.

For next steps I'm considering to switch definitively to the Google 2-step verification and to set up a duplicated cloud backup using Amazon S3 or similar. I'm open for other suggestions :-)

Syndicated 2011-10-18 17:03:00 from Ismael Olea

Frases del Quijote que no están en el Quijote: «ladran luego cabalgamos»

Hace tiempo me leí el Quijote, como a todo buen hispano-hablante se le supone, aunque lo acabara haciendo con treinta años largos, para mi oprobio. Y lo que me trae hoy hasta aquí es esa tan recordada cita de Cervantes atribuída a don Quijote, quien dirigiéndose a Sancho le responde con aquello de «ladran Sancho, luego cabalgamos» a la sazón de no sé qué perros. No recuerdo haberla encontrado nunca en el texto. Y hoy se me ha ocurrido comprobarlo mejor.

Tras buscar varias fuentes de la novela disponibles en la Red, la más adecuada a mi propósito hoy ha sido el Don Quijote de la Mancha que publica el Centro Virtual Cervantes por estar aparentemente completo en HTML en un formato bastante razonable. Lo siguiente es comprobar si aparece la expresión para lo que he usado la siguiente consulta en Google:

    http://www.google.es/search?&q=ladran+AND+cabalgamos+site%3Acvc.cervantes.es%2Fobref%2Fquijote

¿El resultado? Nada. Cervantes no puso esas palabras en boca del hidalgo Quijano. Un bulo. Pueden comprobar que la búsqueda aparentemente funciona usando otros términos como micomicona, barataria o fierabrás.

Invito al lector que haga uso de esta información para ridiculizar en público a cualquier atrevido ignorante.

PD: Si alguien puede comprobar que estoy en un error le agraderé la referencia.

Syndicated 2011-10-12 01:37:00 from Ismael Olea

21 Feb 2011 (updated 11 Oct 2011 at 21:04 UTC) »

How to see Al Jazeera in your Linux system

rtmpdump -v -r rtmp://livestfslivefs.fplive.net/livestfslive-live/ -y "aljazeera_en_high" -a "aljazeeraflashlive-live" -o -| mplayer -

Seen here.

Syndicated 2011-02-21 16:13:00 (Updated 2011-10-11 21:04:47) from Ismael Olea

152 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!