Skip to main content

Ralsina.Me — Roberto Alsina's website

DBUS-reactor, or AsusOSD must die!

How to write a tiny python app (less than 50 lines) that re­acts to events on the DBUS bus­es. For ex­am­ple, dis­play­ing a no­ti­fi­ca­tion when you press one of your key­board­s' spe­cial keys.

Read all about it

I knew not doing it was smarter, or how HTML5 and Qt do my work for me.

I wrote a while ago a RSS pro­gram called uRSSus. I ex­pect I am the on­ly us­er of it be­cause it has some prob­lems (all of them my fault ;-) but I re­al­ly like it.

For a while now I have want­ed it to have pod­cast sup­port. The thing is... that al­ways seemed like a lot of work. Sure, us­ing phonon I can cre­ate an au­dio play­er and ev­ery­thing, but...

I am us­ing a HTML wid­get to dis­play the post­s, so I would have to find a way to add the au­dio play­er to the UI and ... too much work.

So, to­day I woke up and thought... wait a minute... Qt's HTML wid­get is based on We­bkit. And We­bkit sup­ports HTM­L5. And HTM­L5 has an "au­dio" tag.

So, if I fixed uRSSus to fetch the en­clo­sure links, and added them in the database, and then added this to the post tem­plate:

<?py for enclosure in  post.enclosures: ?>
  <audio autobuffer="Yes" controls="controls" src=#{enclosure.href}></audio><br>
<?py #end ?>

Would­n't that ac­tu­al­ly work? Well, yeah!

urssus26

So there you have it, I was right not to im­ple­ment it, be­cause the eas­i­est way is to let Qt do it ;-)

Rant: Being annoying is not a way to make me your customer

I have been a cus­tomer of Fib­er­tel for my broad­band needs for sev­er­al years. Their ser­vice has not sucked bad, even if I had a few prob­lems in the past.

How­ev­er, a month ago, I de­cid­ed to switch to a com­pet­ing ser­vice for a good rea­son: it's much much much cheap­er [1]

Since I am not stupid, I can­celed late with Fib­ertel, so I would have a full month of over­lap­ping ser­vice. I thought hey, maybe I would come back if the new ser­vice sucks [2]

What hap­pened next has been in­creas­ing­ly an­noy­ing.

First Fib­er­tel called the per­son who con­tract­ed the ser­vice (not me). That's rea­son­able.

Then they called me to ask me why I was can­celling. I exlained that the oth­er ser­vice is (all things con­sid­ered) about 75% cheap­er for the same per­for­mance. I sup­pose that's rea­son­able too.

What start­ed be­com­ing less and less rea­son­able are the next 5 call­s, each of­fer­ing cheap­er rates, but still more ex­pen­sive than my new ser­vice.

What was not rea­son­able was that they start­ed call­ing to tell me tech­ni­cal­ly un­sound bull­shit to scare me in­to their ser­vice again.

What is def­i­nite­ly not rea­son­able is that they called me 6 times, even af­ter I told them to stop call­ing me in the third cal­l.

What is in­cred­i­bly stupid and an­noy­ing was that they de­cid­ed to block my in­ter­net ac­cess in or­der to show me an ad about the same of­fers I AL­READY DE­CLINED and un­til I clicked that ad I could not use the In­ter­net.

What is freak­ing nuts is that be­cause I have an ac­cess point I could­n't see the sa­tan-­damned ad, so I was left with­out in­ter­net un­til:

  • I re­­moved the ac­cess point

  • Hooked my note­­book to the ca­ble mo­­dem

  • Got re­­jec­t­ed by it

  • Hooked back the AP

  • Got the MAC from it

  • Faked my note­­books MAC

  • Clicked the Cthul­hu-pissed ads

  • Hooked back the AP

  • Un-­­faked my MAC

So, I need­ed to spend an hour do­ing this.

There­fore, dear Fib­ertel, your com­pa­ny al­so pro­vides ca­ble TV. I am pissed at you. I have de­cid­ed to buy ser­vice from Di­recTV ex­clu­sive­ly to piss you of­f.

Yup, I, who have been pay­ing you ev­ery month $230 for years, will pay you $0 next month. I could have paid you $100, but no, you had to be ass­es about it. You could­n't let me go. Well, I do not like be­ing pestered. I do not like that you act­ed like a spurned 17-year old [3]

Fib­ertel, I kin­da liked you, but my opin­ion of you has gone low­er.

Al­so, any Fib­er­tel cus­tomers out there: if you ask to can­cel the ser­vice say­ing you switch be­cause of the price, they will of­fer you 3Mbps for a year for $79. If you say no, they will of­fer you 3 free month­s.

That's a $600 sav­ing, so go ahead and take their mon­ey.

My first public python code works!

No, this is not a post an­nounc­ing I just wrote my first pub­lic python code. This is a post about my first pub­lic python code... from 1996!

In 1996, the soon-­to-be-here year of the Lin­ux desk­top was fu­eled by one of the mar­quee open source ap­pli­ca­tions of the time: LyX.

LyX was (is) a sort of word pro­ces­sor where you wrote and gen­er­at­ed La­TeX which then pro­duced what­ev­er you used to print. But I am di­gress­ing: LyX was cool be­cause it used one of the first good free graph­i­cal toolk­it­s: XForm­s.

Ok, it was not re­al­ly free, be­cause you could­n't dis­trib­ute patch­es.

And it was not all that good ei­ther, but we were com­par­ing it with Mo­tif, so it was much more free and much bet­ter than that mon­stros­i­ty.

BTW: The lat­est re­lease of XForms is from au­gust of 2009.

At the time, a 25-year-old me was in love with Python 1.3. Here's how I de­scribed it:

Python 1.3

It's a beau­ti­ful ,free, lan­guage. Get it from ft­p://ft­p.python.org http://www.python.org

Yes, Python 1.3. So, I want­ed to use this C GUI tool­kit used in this cool ap­p, and this neat lan­guage I was learn­ing and use them at the same time.

I ran (not walked) to my faith­ful Slack­ware 3.0 ELF in my 486DX2 PC and start­ed hack­ing. In a week­end or so I had a work­ing bind­ing.

I even start­ed writ­ing the holy grail of desk­top ap­pli­ca­tion­s, a GUI ver­sion of Pine, us­ing python and its IMAP mod­ule (python mail­er, or PyM):

//ralsina.me/static/im1.jpg
//ralsina.me/static/im2.jpg

I re­leased ver­sion 0.1 al­pha in 1996, May 13 ... and a few months lat­er Matthias Et­trich start­ed KDE and I found Qt and nev­er thought about XForms again.

Un­til this month.

For rea­sons that don't mat­ter, I men­tioned PyM in the PyAr mail­ing list the oth­er day, and ... well, would pyx­forms still work?

Why, pret­ty much, yeah!

I got the pyx­form­s-0.1-al­pha sources from some­where in the in­ter­net, in­stalled XForms 1.0.92sp2 (yes, the lat­est re­lease, from three months ago), of course I al­ready had python 2.6.4 in­stalled, added a set­up.py, edit­ed 10 lines of code and...

im1

Yes, it work­s. You can get this 0.2 ver­sion (co­de­name "C­thul­hu was here") here just 13 years af­ter 0.1.

No, I don't un­der­stand the weird round­ed cor­ner­s, or why the cur­sor looks weird and old when it's in­side the win­dow.

It's a RE­AL­LY small and fast toolk­it, though.

Hon­est­ly, is it use­ful for ay­one? Al­most cer­tain­ly not. Am I amazed some­thing I wrote in 1996 still work­s? Oh, yeah I am.


Contents © 2000-2023 Roberto Alsina