2007-10-17 12:13

Gonna get me one of these. Oh yes.

It's the second coming of the Toshiba Libretto, only this time it's:

  1. Cheaper
  2. Filled with Linux goodness.

It's the Asus eee. And the default UI is some sort of weirdized KDE. And it is going to sell a whole lot.

Really, lugging my current notebook is tiring, not having my own tools when I go to a customer's is annoying. This baby should fix that.

Sure, you Word/Excel/Powerpoint jockeys are going to be annoyed with a 800x600 screen, but it's awesome for ssh sessions.

2007-10-15 12:37

rst2pdf: now with working tables

Yup. Figured out column/cell spans in reportlab, found old rst2rst code that regularizes the table row/columns to be all the same number of elements, and voilá, tables work, including examples like this:

| header                          |
|          |    tr                |
+  tl      +------------+---------+
|          |    c       |  br     |
+----------+------------+         +
|           bl          |         |

Which generates nicely on PDF now. See it

The bad side is that it's now not a single file anymore, so I am needing a place to host SVN and whatever, because it's turning into a real project... and googlecode doesn't let me start more stuff.

2007-10-15 09:23

Maybe I should write an office suite.

Really. I already have a functioning slideshow program, a spreadsheet and I could write a word processor in a week (for some values of "word", "processor", "write", "week" and "a".)

Of course it would be a very awful office suite, but at least it would be small. I think I can put all that in 1MB including icons.

I could make stupidsheet pretty good, and tobogan is actually useful (if rough).

2007-10-11 08:30

rst2pdf again

I did a little (very little) more work on rst2pdf [1]


  • Headers
  • Footers
  • Footnotes (as endnotes, real footnotes are too much work because you have to reflow the text)
  • External links (http, email)
  • Some styling improvements (meaning: the output is not so painful in the eyes)
  • Paper size support
  • Real separators

Then there are some things you just get because it's done using reportlab:

  • TrueType font embedding (check the example below, and look at the monospaced font)
  • No hyphenation (although there is a project on the web that claims to have done it, I should check it out)

Still broken:

  • No way to put things like page numbers or section names in headers/footers
  • The footnotes are not linked to their contents and viceversa
  • In fact, no internal links work, including title references
  • Tables are pretty broken

And here is the usual version of the rst demo showing improvements.

[1] My tool to convert Rstructured Text to PDF

2007-10-10 17:39

Un post no-nerd | A non-nerd post

Un post no-nerd, y bilingüe.

Esto es acerca de mi vida personal, nada nerd, si no les interesa, al próximo ;-)

El sábado a la noche mi hijo Juan Francisco tenía un poquito de fiebre (38º). Lo llevamos al hospital, y le hicieron un análisis de sangre que mostró que tenía bajos los glóbulos blancos.

En resumen: quedó internado 3 días mientras los análisis descartaban todo tipo de enfermedades muchísimo peores que lo que en realidad tenía (Exantema viral). El ya está perfecto, es más, salvo por la erupción típica de esta enfermedad no tuvo ningún síntoma de nada, ni siquiera fiebre, mientras estuvo internado.

Algo importante: el Hospital Materno Infantil de San Isidro es excelente. Doctores, enfermeras, las voluntarias, todos se desviven por los chicos, y es un hospital público. Por suerte, mi cobertura médica va a reembolsar todos los costos de la atención, lo que va a ayudar al hospital, pero el servicio es buenísimo para todos los vecinos del municipio.

This is about my personal life, not nerdy, if you are not interested, read the next entry ;-)

Saturday night my son Juan Francisco had a little fever (100.4F). We took him to the hospital, and blood tests showed a low white cell count.

Short story: he stayed as a patient 3 days while analysis discarded all sort of diseases much worse than what he actually had (viral exanthem). He's all right now, in fact he had no symptoms at all except for the typical rash of this disease (not even a fever anymore).

Something important: The Hospital Materno Infantil de San Isidro is excellent. Doctors, nurses, volunteers, everyone give everything for the kids, and it's a public (free) hospital. Fortunately, my insurance will pay all the costs of caring for him, which will help the hospital, but the attention is awesome (and free) for anyone in the district.

2007-10-06 11:26

Done with rst2pdf for now

It works much better than it did last night.

The main missing/broken things are:

  • Tables
  • Links
  • Footnotes/citations
  • Headers/Footers
  • References
  • Table HEaders/Spanning cells
  • Lists that don't start at 1

The rest seems to be in working order and producing decent output already. It can process the ReST demo and it doesn't look bad: check it out

I say, good for half a day of hacking, and will now stop, because it's a weekend and I have a family :-)

But that doesn't mean you can't try it for yourself. Just run it thus:

python rst2pdf.py myrstfile.txt

And you will get (hopefully) a myrstfile.txt.pdf

Let me know how it works, and if it doesn't and it's not related to one of the things I mentioned above as broken, send me a test file!

2007-10-05 22:26

Generating PDFs from Restructured text

This has always been possible, going via LaTeX.

However, LaTeX being what it is, you either need to learn it, or you end up with rather plain-looking documents.

While that's ok for a manual, I want to use Restructured Text for everything involving documents.

So, I looked for another solution. Sadly, I could not make the existing rlpdf writer work, sooooo I decided to write my own tool.

Since I intensely dislike the Visitor pattern involved in writing a regular docutils writer, I adapted my old rst2rst.py and ended with rst2pdf.py which just traverses the tree recursively and writes the PDF using ReportLab.

And it took me about 3 hours to make it work:

  • For a limited subset of RST (no footnotes, no links, no decoration)
  • For some subset of tables (no col/row spanning)
  • With limited "styling" (it's mostly there, but I need to write a lot of ReportLab styles.

How well does it work... rather well.

Here's a generated PDF of The RestructuredText Primer

Ignore aesthetics, and consider function, it's pretty good.

2007-10-03 16:41

Templates that create templates...

... or why flexibilty is good sometimes.

After some dabbling with Lurker, I decided it's just too much trouble for the prototype site and went looking for alternative mailing list archivers.

I found few, and decided to try MHonArc.

Then I tried to make it fit the rest of the site. Ouch.

It's not that MHonArc doesn't provide a way to customize the generated HTML. It provides one.

A terribly convoluted one where instead of writing a template for MHonArc to fill it has its template and it's filled from the data and from a resource file you write.

For example, I expected writing a template like this (stupid example):

<h1> my archives </h1>

So that MHonArc would put a toolbar and the contents where I tell it to.

In reality, MHonArc has a hardcoded template like this:

        (AUTHORBEGIN |
         DAYBEGIN |
        (AUTHOREND |
         DAYEND |

And you tell it what IDXPGEND should be, or it uses its default value. And there is one of these things, with similar but different variables, for each kind of page it generates.

So, you can customize your layout by putting things like this in a resource file:


Which is doable. But you end with static pages. How can you make that work well with a modern site without duplicating the whole base layout? Not to mention all the niceties like having your username in the toolbar and whatever.

Generate page templates instead.

I customized the MHonArc layout to generate neat Mako templates that inherit the "real" base layout template.

I only had to be careful to escape the $ signs as $$ if I wanted them to survive until Mako saw them.

Then create a view that processes the templates instead of serving the static files and it works like a charm.

A simple, but neat hacklet, I think.

2007-10-02 14:11

Everything is still around

For a project I am doing for one of my customers, I needed a mailing list archive. I looked, and it seems the nicer one is Lurker.

Sadly, there are no RPM packages, so I had to build it manually... and ran into mimelib. Which, looking closer, is the same mimelib from Doug Sauder I used in KRN back in the late 90s.

And which I had a hand in GPLing, too. And it's still in use. One of the things I always liked about FLOSS: nothing ever really gets thrown away.

2007-09-14 18:35

New library: ChipScene

This is the real outcome of my PyWeek failure: a neat library.

Take Chipmunk and Qt mash them up, and what do you get?

A OpenGL-accelerated, multiplatform, easy-to-use playground!

But watch the silly video that shows no interesting features instead:

You can't see it but there are 29 balloons, numbered, that bounce around happily.

Performance in the video sucks because I had to disable OpenGL in order to capture it correctly (and video recording kills my notebook,anyway). That demo normally runs in 3 seconds, not 57.

Here's the non-boilerplate code for that demo:

def fillWorld(scene):
  for x in range(1, 29):
      b=cs.CPBodyItem(bpos=[0+13*random.randint(0,25), -50-30*random.randint(0,10)],m=10)
      s=cs.CPCircleShapeItem(10, b, e=.5, offset=[0, 0])
      t=QtGui.QGraphicsSimpleTextItem(str(x), s)
      t.setPos(-5, -5)
  items.append(cs.CPSegmentShapeItem([0, 50], [500, 450], 1, None, e=.7))
  items.append(cs.CPSegmentShapeItem([0, 450], [500, 50], 1, None, e=.7))

  for i in items:

Neat, isn't it?

You can get it at the ChipScene google code project including, of course, the source.

Contents © 2000-2019 Roberto Alsina