Skip to main content

Ralsina.Me — Roberto Alsina's website

The shortest URL you will find anywhere

Fol­low­ing the path of the ven­er­a­ble tinyurl, http://Tin­ takes ad­van­tage of uni­code to make things very, very, very short.

For ex­am­ple, this blog's URL would be http://➡.ws/콢

As you can see there is a tiny ar­row (thus the name of the ser­vice) and a seem­ing­ly ko­re­an char­ac­ter.

The do­main name is legal, that's just a one-char­ac­ter uni­code name, which seems to be le­gal ac­cord­ing to the rules of the ws TLD. Then a uni­code path, again just one char­ac­ter.

Since uni­code has sev­er­al thou­sand glyph­s, it is pos­si­ble that about a tril­lion URLs could be done us­ing on­ly a 3-let­ter path, which is pret­ty awe­some.

Of course you prob­a­bly can't type the damn things, but you can copy­&­paste them.

If any of this does­n't work for you, get on the uni­code wag­on al­ready!

PyQt by example (Session 2)

I am fi­nal­ly pub­lish­ing my Lati­noWare 2008 tu­to­ri­al, in re­vised and ex­pand­ed for­m. It will prob­a­bly be a 10-­part se­ries, and here is ses­sion 2.

See al­so ses­sion 1.

PyQt by example (Session 1)

I am fi­nal­ly pub­lish­ing my Lati­noWare 2008 tu­to­ri­al, in re­vised and ex­pand­ed for­m. It will prob­a­bly be a 10-­part se­ries, and here is ses­sion 1

Using assistant from PyQt

The uRSSus doc is slow­ly grow­ing, so I hooked as­sis­tant to the UI. Not dif­fi­cult, but I have not seen it else­where.

Here's how:

As­sume the "Hand­book ac­tion" is called ac­tion_Hand­book. Set win­­sis­tant 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:

        cmd="assistant -enableRemoteControl -collectionFile %s"%helpcoll
    self.assistant.stdin.write("SetSource qthelp://urssus/doc/handbook.html\n")

And that's it. Now I ned to fig­ure out con­text help.

Rawdog is flexible: using Mako templates

I am us­ing raw­dog for Plan­e­ta PyAr and I am very hap­py with it. One thing I re­al­ly did­n't like was the tem­plat­ing.

Why? It's ba­si­cal­ly un­doc­u­ment­ed, it looks ug­ly and it does­n't sup­port tem­plate in­her­i­tance, which in this case is very use­ful, be­cause I am ac­tu­al­ly do­ing two very sim­i­lar plan­et­s: 1 2.

So, since I saw a plug­in to use Vel­lum tem­plates, which means the tem­plat­ing is plug­gable, why not use my favourite tem­plat­ing li­brary (Mako) in­stead?

It turns out to be very easy to do!

Just put this in your plug­ins fold­er and start us­ing Mako tem­plates (yes, the plan­et's con­fig 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=['.'],\

    def fill_template(self,template, bits, result):
        return False

p = MakoPlugin()

Yup, 20 lines of code!

Contents © 2000-2023 Roberto Alsina