Marcos Dione: barely-working-centerline-JOSM-plugin

I just uploaded my first semi-automated change. This change was generated with my hack for generating centerlines for riverbank polygons. This time I expanded it to include a JOSM plugin which will take all the closed polygons from the selection and run the algorithm on them, creating new lines. It still needs some polishing, like making sure they're riverbanks and copying useful tags to the new line, and probably running a simplifying algo at some point. Also, even simple looking polygons might generate complex lines (in plural, and some of these lines could be spurious), so some manual editing might be required afterwards, specially connecting the new line to existing centerlines. Still, I think it's useful.

Like I mentioned last time, its setup is quite complex: The JOSM plugin calls a Python script that needs the Python module installed. That module, for lack of proper bindings for SFCGAL, depends on PostgreSQL+PostGIS (but we all have one, right? :-[ ), and connection strings are currently hardcoded. All that to say: it's quite hacky, not even alpha quality from the installation point of view.

Lastly, as imagico mentioned in the first post about this hack, the algorithms are not fast, and I already made my computer start thrashing the disk swapping like Hell because pg hit a big polygon and started using lots of RAM to calculate its centerline. At least this time I can see how complex the polygons are before handing them to the code. As an initial benchmark, the original data for that changeset (I later simplified it with JOSM's tool) took 0.063927s in pg+gis and 0.004737s in the Python code. More test will come later.

Okey, one last thing: Java is hard for a Pythonista. At some point it took me 2h40 to write 60 lines of code, ~2m40 per line!


openstreetmap gis python

Marcos Dione: configuring-power-and-hardware-related-events

A month ago I revived my old-laptop-as-server I have at home. I don't do much in it, just serve my photos, a map, provide a ssh trampoline for me and some friends and not much more. This time I decided to tackle one of the most annoying problems I had with it: That closing the lid led to the system to suspend.

Now, the setup in that computer has evolved through some years, so a lot of cruft was left on it. For instance, at some point I solved the problem by installing a desktop and telling it not to suspend the machine, mostly because that's how I configure my current laptop. That, of course, was a cannon-for-killing-flies solution, but it worked, so I could focus in other things. Also, a lot of power-related packages were installed, assuming the were really needed for supporting everything I might ever wanted to do about power. This is the story on how I removed them all, why, and how I solved the lid problem... twice.

First thing to go were the desktop packages, mostly because the screen in that laptop has been dead for more than a year now, and because its new space in the house is a small shelf in my wooden desktop. Then I reviewed the power-related packages one by one and decided whether I needed it or not. This is more or less what I found:

  • acpi-fakekey: This package has a tool for injecting fake ACPI keystrokes in the input system. Not really needed.
  • acpi-support: It has a lot of scripts that can be run when some ACPI events occur. For instance, lid closing, battery/AC status, but also things like responding to power and even 'multimedia' keys. Nice, but not needed in my case; the lid is going to be closed all the time anyways.
  • laptop-mode-tools: Tools for saving power in your laptop. Not needed either, the server is going to be running all the time on AC (its battery also died some time ago).
  • upower: D-Bus interface for power events. No desktop or anything else to listen to them. Gone.
  • pm-utils: Nice CLI scripts for suspending/hibernating your system. I always have them around in my laptop because sometimes the desktops don't work properly. No use in my server, but it's cruft left from when I used it as my laptop. Adieu.

Even then, closing the lid led to the system suspending. Who else could be there? Well, there is one project who's being everywhere: systemd. I'm not saying this is bad, but it is everywhere. Thing is, its login subsystem also handles ACPI events. In the /etc/systemd/logind.conf file you can read the following lines:

#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore

so I uncommented the 4th line and changed it so:

HandleLidSwitch=ignore

Here you can also configure how the inhibition of actions work:

#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes

Please check the config file's doc if you plan to modify it.

Not entirely unrelated, my main laptop also started suspending when I closed the lid. I have it configured, through the desktop environment, to only turn off the screen, because what use is the screen if it's facing the keyboard and touchpad :) Somehow, these settings only recently started to be in effect, but a quick search didn't gave any results on when things changed. Remembering what I did with the server, I just changed that config file to:

HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore

That is, “let me configure this through the desktop, please”, and now I have my old behavior back :)


PS: I should start reading more about systemd. A good starting point seems to be all the links in its home page.


sysadmin systemd acpi

Marcos Dione: dear-conference-speakers

Dear conference speakers:

Please test write your slides at 1024x768 resolution, on a projector.

Dear conference organizers:

Please remind your speakers to do so.

Dear conference attendants:

If you are at the back of the room and you can't see the text/code in the slides the speaker(s) is showing, please shout “I cant see shit!” in the appropriate language, and try to embarrass the speaker as much as possible.

Thanks in advance. Yours truly,

-- Marcos.

PS: I've been watching videos of talks in some conferences and I swear to $DEITY at in least 40% of the ones I was interested in, I couldn't read the code on the video. Sometimes the fonts are too small, sometimes the colors are not contrasting enough. Please, at least test your slides on a projector...

PSS: I know the resolution I'm suggesting is low. Be happy I'm not asking for 640x480 :-P

PSSS: Ok, attendants, don't embarrass/harass the speakers :)


rants

Mariano Guerra: This Week in WebAssembly II

Mariano Guerra: This Week in WebAssembly II

Juanjo Conti: Goodreads review: Yo también tuve una novia bisexual (Guillermo Martínez)

El libro tiene 3 partes.

La primera es muy buena.

En la segunda hay un par de capítulos que podrían haber sido omitidos. Referencias: la teoría sobre "refinamientos dicotómicos", aquel en el que se menciona a Sarmiento.

En la tercera decanta hacia final, cerrando muchos caminos. Aunque me faltó la explicación de porqué no manejaba.

Las referencias al 9/11 tampoco son cruciales.

El epílogo es un poco perturbador.

No es tan buena como Crímenes imperceptibles. Creo que lo que me gustó tanto de esta otra es que no le encontré fisuras mientras que en esta pude hacer en ejercicio de reconocer algunas grietas.

Rating: 4/5

Original: https://www.goodreads.com/review/show/1730970828

Marcos Dione: interesting-pycon-talks

Like I said in my last post[1], I'm looking at last PyCon's videos. Here are my selected videos, in the order I saw them:

Ned Batchelder - Machete-mode debugging: Hacking your way out of a tight spot. In fact, I saw this twice.

Larry Hastings - Removing Python's GIL: The Gilectomy

The Report Of Twisted’s Death or: Why Twisted and Tornado Are Relevant In The Asyncio Age

How I built a power debugger out of the standard library and things I found on the internet

Davey Shafik - HTTP/2 and Asynchronous APIs

Sumana Harihareswara - HTTP Can Do That?! Points for informative and funny.

Matthias Kramm - Python Typology Types are comming, so get used to them.

Scott Sanderson, Joe Jevnik - Playing with Python Bytecode Nice, very nice trick. I'm talking about the way the presentation is given.

Brian Warner - Magic Wormhole - Simple Secure File Transfer

And of course, the lighning talks. I always like these, because you can get exposed to any kind of things, some not even remotely connected to Python, but which can get your brain rolling down nice little bunny holes, or at least get a smile from you. So here:

LT#1. Please watch it at least between 20-25m.

LT#2

LT#3

LT#4

And of course, check the other ones, don't stop at my own interests.


[1] Yes, I started writing this a month ago.


python

Facundo Batista: Terminator moralinesco


AVISO: el siguiente texto puede tener spoilers sobre las pelis de Terminator. Yo te avisé.

No voy a entender nunca como en una película permiten violencia, violencia, violencia, violencia, violencia, y no un desnudo.

Y no estoy hablando de sexo, estoy hablando de cuerpos desnudos. Y ni siquiera estoy hablando de una película para niños (que lo podríamos charlar), sino para adultos (toda esa violencia es inaceptable para niños).

El caso puntual es Terminator: Genisys.

Hay varias situaciones, varias, donde el desnudo sería natural. Me refiero a que no es como se ve mucho en esas pelis clase B donde el asesino en vez de matar a la chica durmiendo la mata en la ducha y aprovechan para mostrarla en tetas.

No. En el caso de Terminator, el aparato que usan para moverse en el tiempo sólo lleva cosas cubiertas de material biológico (sí, la base científica de esto es discutible, pero ese es otro tema). Entonces, los humanos (todo biológicos) y robots (estructura artificial pero todos cubiertos de piel "viva") tienen que viajar desnudos.

Por dicha razón, sucede que en la Terminator original sí se ve algo: por ejemplo el culo del terminator...

El terminator de 1984, desde atrás

Pero vemos que en la nueva, que reproduce lo que pasó en la primera (con los cambios necesarios acorde a la vuelta de tuerca del guión), en la misma escena, ¡no muestra nada!

El terminator nuevo, desde atrás

También, en la original Kyle y Sarah se enamoran y tienen sexo (escenas muy ochentosas, pero con desnudos frontales de ambos). En la última los dos personajes se mantienen coqueteando pero sin concretar, prolijamente castos.

Los Kyle y Sarah originales

En la última hay una chica con papel protagónico que viaja en el tiempo. Acá tenemos una situación donde un desnudo sería totalmente natural, y la cámara está "forzadamente alta".

Cuidando la altura de la cámara

Incluso, cuando termina ese viaje en el tiempo, al "llegar al futuro", aparecen en una autopista y casi los pasan por arriba, pero sí: el foco está en taparse, no vaya a ser cosa.

Apareciendo en la autopista

Como vuelta de tuerca, ¿se podría argumentar que a Emilia Clarke le cueste o no quiera aparecer desnuda? No creo, muestra mucho más como Daenerys Targaryen en Game of Thrones.

También podemos pensar que a una película le resulte más complicado distribuirse y hacerse disponible en muchos paises o lugares en función de si muestran una teta o no. Puede ser. Ahí volvemos a que "asusta" o "indigna" más una teta o un culo que gente matándose entre ellos. Y ni hablar de un pene o una vulva... la escena siguiente es de la peli nueva, pero en la vieja es igual...

El terminator, desde adelante

En fin, no entiendo.

Mariano Guerra: This Week in WebAssembly I

(Hopefuly) weekly update on WebAssembly and WebAssembly related projects

Resources

Mariano Guerra: This Week in WebAssembly I

(Hopefuly) weekly update on WebAssembly and WebAssembly related projects

Resources