2009-03-05 18:41

Changes in Lateral Opinion

Yes, the blog was looking old and ugly. So I changed it. Hope you like the new style, it's based on plaintxtBlog, from http://demo.plaintxt.org/

Not everything is adapted yet, but most places should look much better now.

The licensing of all original content has been changed to a Creative Commons license (non-commercial, share-alike, see the badge at the left).

Also, fewer ads, and a new Donate button I strongly encourage you to use ;-).

Oh, and I will try my best to also post the spanish translations of, at least, the posts. The code and long stories will probably stay english-only for a while.

2009-03-03 23:42

Blog readership statistics.

I am not sure if this is good or bad:

feedburner

On one hand, I have more subscribers than ever, even considering when this blog was in planetkde (BTW: maybe I should add my pyqt feed there again? Nah, I don't qualify as "active KDE contributor")

The dip in the last three monts was because I just posted nothing, and now I am posting again, it's doing well.

On the other hand, I am at 50-some subscribers, which is a bit pathetic for a blog that has existed for over 9 years ;-)

On the gripping hand (Larry Niven FTW!) I am having more fun with the blog than I had in quite a while, so I would post even if noone read it.

And in case you are wondering what that peak of over 6000 reach (the average is under 100!) it's this. That post had over 12000 visitors. My second most popular story had only 3800.

analytics

Here's the most popular content in the last 2 years or so, selected from 783 posts (784 with this one) and 47 longer stories:

  1. 12228 visitors: Windows: My eXPerience

    So I wanted to see what windows looked like. Don't worry, I feel better now.

  2. 3797 visitors: Making Linux systems that don't suck. Part II

    A rant on cron and at. I never imagined this would be number 2.

  3. 2968 visitors: BOP: Ball Oriented programming

    I am rather proud of this one: a pyqt-based graphical, animated interpreter for FLIP, a language based on balls :-)

  4. 2888 visitors: Good News: Linux gives life to old hardware. Bad News: Maybe in some cases it shouldn't.

    Silly, yes, but a cool picture :-)

  5. 1870 visitors: PyCells: The Python SpreadSheet redux

    My second or third attempt at writing a toy spreadsheet using python. I have been at it for about 5 years, apparently.

    This is popular... even when the code it describes is based on a completely broken library!

  6. 1841 visitors: Squid authentication via POP or IMAP

    This was already about 4 years old when I started counting, so I have no idea how many visitors it really had. It is a handy script, I still use it sometimes!

  7. 1813 visitors: The Linux Booting Process Unveiled

    I really expected this one to be much higher. It's even linked from wikipedia! Every day it has 2 or 3 hits. Then again, the first 3 years are not being counted ;-)

  8. 1706 visitors: Queue Management for Qmail

    While the tool it introduces is lame nowadays, the ideas are sound, and it explains a real problem.

  9. 1548 visitors: Custom widgets using PyQt

    Very obsolete, noone should read that.

  10. 1505 visitors: How to make your own distro in 3 not-so simple steps

    Oh, this one. It is wrong. It gives bad advice. Yet noone seems to notice ;-) Not my best idea, not my best effort, still get email about it every month or so.

2009-03-03 23:12

The shortest URL you will find anywhere

Following the path of the venerable tinyurl, http://Tinyarro.ws takes advantage of unicode to make things very, very, very short.

For example, this blog's URL would be http://➡.ws/콢

As you can see there is a tiny arrow (thus the name of the service) and a seemingly korean character.

The domain name is legal, that's just a one-character unicode name, which seems to be legal according to the rules of the ws TLD. Then a unicode path, again just one character.

Since unicode has several thousand glyphs, it is possible that about a trillion URLs could be done using only a 3-letter path, which is pretty awesome.

Of course you probably can't type the damn things, but you can copy&paste them.

If any of this doesn't work for you, get on the unicode wagon already!

2009-03-01 23:38

PyQt by example (Session 1)

I am finally publishing my LatinoWare 2008 tutorial, in revised and expanded form. It will probably be a 10-part series, and here is session 1

2009-03-01 10:43

Using assistant from PyQt

The uRSSus doc is slowly growing, so I hooked assistant to the UI. Not difficult, but I have not seen it elsewhere.

Here's how:

Assume the "Handbook action" is called action_Handbook. Set window.assistant to None in __init__.

def on_action_Handbook_triggered(self, i=None):
    if i==None: return

    if not self.assistant or \
       not self.assistant.poll()==None:

        helpcoll=os.path.join(os.path.abspath(os.path.dirname(__file__)),\
                              'help',\
                              'out',\
                              'collection.qhc')
        cmd="assistant -enableRemoteControl -collectionFile %s"%helpcoll
        self.assistant=subprocess.Popen(cmd,
                                        shell=True,
                                        stdin=subprocess.PIPE)
    self.assistant.stdin.write("SetSource qthelp://urssus/doc/handbook.html\n")

And that's it. Now I ned to figure out context help.

2009-02-24 21:42

Rawdog is flexible: using Mako templates

I am using rawdog for Planeta PyAr and I am very happy with it. One thing I really didn't like was the templating.

Why? It's basically undocumented, it looks ugly and it doesn't support template inheritance, which in this case is very useful, because I am actually doing two very similar planets: 1 2.

So, since I saw a plugin to use Vellum templates, which means the templating is pluggable, why not use my favourite templating library (Mako) instead?

It turns out to be very easy to do!

Just put this in your plugins folder and start using Mako templates (yes, the planet's config and stuff is in github. Why not?).

# -*- coding: utf-8 -*-
import rawdoglib.plugins

from mako.template import Template
from mako.lookup import TemplateLookup
from mako import exceptions

class MakoPlugin:
    def __init__(self):
        self.lookup = TemplateLookup(directories=['.'],\
                              output_encoding='utf-8',\
                              encoding_errors='replace')

    def fill_template(self,template, bits, result):
        self.lookup.put_string('actual',template)
        t=self.lookup.get_template('actual')
        try:
            r=t.render_unicode(**bits)
        except:
            r=exceptions.html_error_template().render()
        result.value=r
        return False

p = MakoPlugin()
rawdoglib.plugins.attach_hook("fill_template",\
                              p.fill_template)

Yup, 20 lines of code!

2009-02-23 11:22

rst2qhc 0.2: the insomnia release

Today I woke up at 6AM. I had nothing to do until 9, but I woke up and couldn't sleep again.

So, what can I do? I hacked rst2qhc a bit more :-D

Since this is a small project, it is quickly approaching feature complete status (there is really only so much this thing can do).

So, what's new?

  • Passing options to rst2html, so you can do things like set stylesheets.
  • Support for a manifest file, so you can list what files should be embedded in the helpfile.
  • Fixed project support. Now you can optionally ask rst2qhc to create a qhcp file that will build your document.
  • Better, more complete example that displays most features.

I have only one thing left in my TODO, which is calling the HTML writer via API instead of via system() because that way there is no need to define the keyword role in the document, and I can add syntax highlighting via pygments.

Since I now do have work to do, I will just release 0.2 now ;-)

You can get it from the usual place: http://rst2qhc.googlecode.com

And here's a sample of the input/output:

rst2qhc

Contents © 2000-2019 Roberto Alsina