Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre python (publicaciones antiguas, página 11)

Data aware widgets in KDE

Well, read­ing in plan­etkde about how nice da­ta aware wid­gets would be, I have to say this:

  • Da­­ta aware wid­gets are great

  • Da­­ta aware wid­gets in C++ are not the best pos­si­ble so­lu­­tion

Us­ing a high­er lev­el lan­guage, and specif­i­cal­ly a more dy­nam­ic lan­guage makes lots of things much sim­pler.

As a tiny, lame ex­am­ple, please check the lit­tle thing I wrote about da­ta aware wid­gets in python here.

I am sure that some of our bet­ter pro­gram­mers (or more cre­ative thinker­s) can come up with awe­some stuff if they di­vorce from C++ in this sub­ject :-)

Pissed off at SSH

Ok, not re­al­ly, since SSH has made my life much sim­pler than it would be oth­er­wise, but re­al­ly, it has some us­abil­i­ty is­sues.

And I mean re­al us­abil­i­ty is­sues, not the usu­al crap.

  • It can't be in­­te­­grat­ed in­­­to kde­wal­let

While there is a mech­a­nism to have a GUI ask­ing the pass­word, this helper app (askpass) does­n't get any ses­sion in­fo, so it's mean­ing­less, un­les you are try­ing to di­rect­ly start a X app over ssh.

Which you prob­a­bly aren't.

  • Fin­ger­print man­age­­ment suck­­s.

Sup­pose you have a fire­wal­l. You keep port 22 as a way to log in­to it, and for­ward port 23 to a mail serv­er in the DMZ. Well, it will com­plain and print huge, scary warn­ings each time you lo­gin in­to one or the oth­er, de­pend­ing on which one you used first.

Or, it can sim­ply refuse to con­nec­t.

And that's just the easy two.

What can be done?

  • Take the drop­bear client (not openssh, drop­bear code seems sim­­pler), and put a put­­ty-­­like UI in­­­to it. Use the kon­­sole kpart for dis­­­play.

  • Take the GTK ver­­sion of Put­­ty and hack it in­­­to KDE shape, put kde­wal­let in it. I don't quite like the idea of hav­ing a sea­­parate, dif­fer­­ent ter­mi­­nal app for re­­mote ses­­sion­s.

I would prob­a­bly go the drop­bear route if:

  1. I had a work­ing PyKDE (maybe some­­day)

  2. The idea of delv­ing in­­­to some­one else's C code did­n't make me nau­seous. (prob­a­bly af­ter I sur­gi­­cal­­ly re­­move my sense of taste).

Extreme code reuse

I am, as al­ways, play­ing with stuff. And I was faced with a prob­lem I must have solved a dozen times be­fore:

Giv­en a list of items with ob­vi­ous hi­er­ar­chi­cal names (say, a list of fold­er­s), turn it in­to a rea­son­able da­ta struc­ture.

Since there are not all that many names, there is no need to do it on-de­mand, or any­thing like that.

I must con­fess I suck at this kind of things be­cause I hve to ac­tu­al­ly think them through. I don't know how to do this kind of things.

Mind you, I have done it be­fore, but I said, hey, maybe google can help me...

And yeah! Python code from 1994 that does ex­act­ly what I need­ed. I had to touch a sin­gle line ( string.s­plit­field­s(a,'.') to a.s­plit('/') ) and it worked.

The In­ter­net nev­er for­get­s!

Sometimes things just click

I have been writ­ing we­b-based in­ter­faces for ap­pli­ca­tions for about 5 years. Noth­ing pub­lic, noth­ing very in­ter­est­ing, just tiny front ends for cus­tom tools in clients' in­stal­la­tion­s.

And I have hat­ed ev­ery minute of it. PHP hurt­s, Twist­ed hurt­s, mod­_python hurt­s...

For a cou­ple of months I have been us­ing Cher­ryPy and I fi­nal­ly am hav­ing fun do­ing it.

And af­ter I fig­ured out how to do AJAX us­ing it, it's even more fun ( be­cause the apps in­ter­ac­tion mod­el is not to­tal­ly brain­dead :-)

I don't ex­pect it to be as fun as PyQt/PyKDE, but it's to­tal­ly not aw­ful. I sup­pose the same epiphany comes to peo­ple when they use rails or some oth­er de­cen­t, pro­duc­tive, fun frame­work.

All in al­l, I could get used to this.

Linux: a not-unix-like OS.

Well, I am still ex­per­i­ment­ing with my con­cep­t-dis­tro.

I am now up to a run­ning PyQt us­ing uClibc, which I thought un­like­ly ;-)

I com­plete­ly re­moved all the sysv init stuff, and re­placed it with runit, which has an in­ter­est­ing ef­fec­t:

It boots to a graph­i­cal lo­gin in about 15 sec­ond­s. In­side qe­mu. In a 900Mhz duron. In­clud­ing ker­nel load­ing.

Of course the trick is that you have the lo­gin while stuff is still load­ing, but I am work­ing on that, too.

Since us­ing runit it's pret­ty sim­ple to get a over­view of where the boot­ing process is (ser­vices have de­pen­den­cies, they sim­ply get start­ed in or­der, and in par­al­lel), I will hack a sys­tem-wide ksplash-­like thing on a side of the xdm (prob­a­bly will end up writ­ing my own what­everd­m).

Think of it as Fe­do­ra's rhg­b, on­ly you can lo­gin in­stead of get­ting bored.

I al­so switched to a root-free sys­tem Ubun­tu style. Not de­cid­ed yet on it, but it's not hard to do (or use).

Next step: hack Knop­pix HW-de­tec­tion script (or rather re­write them in a re­al lan­guage).

I un­der­stand why there are 743 Lin­ux dis­tros. It's quite a lot of fun to hack one to­geth­er.

Oh, and it needs a name. It's not go­ing to be use­ful for any­one, it's just a per­son­al toy, but it needs one.

Come on, Plan­etkde guys, throw me names for a non-u­nix like lin­ux, if you dare ;-)

Contents © 2000-2023 Roberto Alsina