Managing Python code with UTF-8 (french chars) in org-mode + babel + minted for LaTeX export

The goal of this article is to illustrate how to manage Python code which includes comments in UTF-8 characters inside a latin-1 source org-mode for LaTeX export.

Note that I’ve pasted in wordpress the HTML generated by org-mode, so I hope it isn’t broken too much.

My typical use case is a french lecture on Python where the text is written in french, as well as some of the code comments and examples

We’ll use org-mode’s babel module to include and manage the Python
examples. The goal is to write the source of the Python programs
directly in the same org source as the class book’s text, and to extract them into a subdir (with the “tangle” feature), so that they can be shipped to the students to experiment with.

The minted LaTeX environment is used, for babel, to make the Python syntax highlighting.

Continue reading “Managing Python code with UTF-8 (french chars) in org-mode + babel + minted for LaTeX export”

Conférence “L’économie du logiciel libre et la percée d’OpenStack dans le cloud” le 27/03 à Évry

L’association Minet organise une conférence le 27/03 dans les locaux de Télécom SudParis et Télécom École de Management à Évry, qui promet d’être intéressante.

Elle portera à la fois sur l’économie du logiciel libre et sur l’essort d’OpenStack dans le cloud.

N’hésitez pas à venir nombreux sur le campus pour écouter les interventions de Jonathan Le Lous, Julien Brichard et Raphaël Ferreira, et rencontrer votre serviteur 😉

Plus de détails sur le site de Minet.

Python RDF example of a MySQL triple store thanks to redland/librdf

In a way similar to my previous post about persisting graphs in PostGreSQL in PHP, here’s similar examples for Python and MySQL.

Note that you may need to adjust the MySQL table creation templates if you’re running librdf version 1.0.16 (see this bug for details).

The first example will load data from a file, and store the parsed model to the RDBMS, while the second example, will reload the model and issue queries on it.watch A Cure for Wellness 2017 movie now

These examples don’t do much, but hopefully, they’ll help you get started if you’re interested in using redland/librdf.

One potential benefit can be interoperability with other languages like PHP, for instance if you’re running harvesters in Python that will save facts in a triple store, which is then accessed by a PHP application that will publish a Web interface.

RDF development in PHP with a PostGreSQL triple store thanks to the LibRDF OO wrapper for redland/librdf

Redland/librdf offers powerful features like being able to persist an RDF model to a relational database (only PostGreSQL seems to work on my setup with 1.0.16, but I may have misconfigured it). You can then do SPARQL queries over the model, and lots of other nice things.

Unfortunately, the default PHP bindings are not really object-oriented, so the code isn’t looking so good.

But thanks to a gentleman named David Shea, there is an object-oriented library named LibRDF (case is sensitive), that helps write nice looking PHP.

I discovered it via the blog post of Felix Ostrowski, who took over the maintenance of the LibRDF library (still the docs live on the original author’s site).

In his post, Felix illustrates how you may use it to parse Richard Cyganiak’s FOAF profile.

But the examples he gives don’t illustrate the full potential of persistence of the RDF graph into the DB.

Here’s my contribution in 2 examples that will hopefully help : first, one that load Richard’s FOAF to the DB, and one, that later retrieve the saved model and perform the same query (both pushed to my github clone of the library).

There may be some problems with the use of librdf, including its availability, as it is not full PHP of course… and I’ve heard of memory management problems, but, depening on your needs, this may be quite handy for writing Linked Data applications.

The Debian Package Tracking System now publishes Turtle RDF meta-data

The Debian PTS now speaks the Turtle representation format for the export of RDF meta-data about Debian source packages.

Alongside HTML pages for humans, and the RDF/XML that had already been added to it this means that a new flavour of RDF is now available.

The Turtle format offers the benefits of both machine-readable meta-data, and a somehow human readable textual format too.

For instance, you may check the apache2 Turtle meta-data from the command-line with :
$ curl -L -s -H "Accept: text/turtle" http://packages.qa.debian.org/apache2

Here’s a link to a colorized HTML preview of http://packages.qa.debian.org/a/apache2.ttl.

Under the hood, the XSLT stylesheets of the PTS have been reworked to produce the Turtle format by default, and later convert them to RDF/XML.

Every Debian source package then has a reference URI in the Linked Data word, in the form http://packages.qa.debian.org/PACKAGE_NAME, that redirects, through proper content-negociation (the HTTP Accept header) to the HTML, RDF/XML or Turtle documents. For apache2, these are, resp. at http://packages.qa.debian.org/a/apache2.html, http://packages.qa.debian.org/a/apache2.rdf and http://packages.qa.debian.org/a/apache2.ttl.

The meta-data uses the model of the ADMS.SW ontology (1.0), and the content has also been slightly updated to make it more conformant to the ADMS.SW specifications (checks done with the ADMS.SW validator).

Let’s hope this makes RDF more familiar to Debian folks, and allows more Linked Data interlinking with other resources about FLOSS packages.