// La balistica delle armi di rappresaglia

Voglio condividere uno strano percorso di scoperta che segue su doppio binario la parabola delle Vergeltungswaffe, delle “armi di rappresaglia” naziste e degli ingegneri che in un modo o nell'altro presero parte ai loro progetti.

Ripercorro in ordine cronologico da cosa ero partito e a cosa sono arrivato.

  • avevo bisogno di scrivere correttamente il nome del padre della missilistica Von Braun e, sapendo che aveva progettato la V2 vado su wikipedia alla voce V2, trovandolo, ma scopro che quello che avevo in mente come V2 non era quello che è in realtà,
    visto che mi aspettavo questo:
    e invece mi sono imbattuto in questo:
  • ci vogliono pochi secondi seguendo qualche link in fondo alla pagina di wikipedia per scoprire che quello che avevo sempre pensato essere una V2 in realtà era una V1, poco male sbagliavo solo di un unità in fin dei conti ma in fondo alla pagina scopro che oltre alle V1 e V2 esisteva anche una V3 (di cui ignoravo l'esistenza)

// xmlsort: swiss army knife xml ordering utility

Goal

Sort an xml file or parts of it to avoid false positive differences comparing it with a previous version (stored in a version control system like GIT or Mercurial).

Did you have some experience changing 1 thing only in a server, dump again data and obtain dozens of changed files like this ?

diff --git a/geonode.xml b/geonode.xml
index f4fc60f..ffcdbfc 100644
--- a/geonode.xml	2012-10-24 09:25:42.198961002 +0200
+++ b/geonode.xml	2012-10-24 09:26:58.034957830 +0200
@@ -19,12 +19,12 @@
     <entry key="namespace">http://geonode.org/</entry>
     <entry key="schema">the_schema</entry>
     <entry key="Loose bbox">true</entry>
-    <entry key="Expose primary keys">false</entry>
     <entry key="fetch size">1000</entry>
     <entry key="Max open prepared statements">50</entry>
+    <entry key="Expose primary keys">false</entry>
+    <entry key="user">MYUSER</entry>
     <entry key="preparedStatements">false</entry>
     <entry key="Estimated extends">true</entry>
-    <entry key="user">MYUSER</entry>
     <entry key="min connections">1</entry>
   </connectionParameters>
   <__default>false</__default>

// Graphviz graph with dynamic layers into dokuwiki

Goal

Add layering feature to graphviz powerful tool and expose it by docuwiki graphviz plugin.

a : b : c

How to proceed

To be able to use this feature you need to install:

  1. the developing version of graphviz, you can find binary package here http://www.graphviz.org/Download..php
    OR
    compile sources, downloading them with the command hg clone http://hg.research.att.com/graphviz and following doc/build.html documentation.
  2. replace the standard version of the dokuwiki-plugin-graphviz with my fork that you can download from github here.

After both packages are installed you need to instruct dokuwiki to use the new graphviz suite of programs setting the Graphviz Plugin Settings part of the Docuwiki Configuration page with the correct new path for the dot command.

What's news

Following the layers usage described in the dotguide documentation you can see how layers work.

Layers are stacked from left to right.

The previous limitation where nodes and edges can appear on contiguous layers only is removed.

For each layer a transparent image is created and displayed together by the browser.

If you add a layer named _background_ it will be considered the background layer and not showed in the layers list.

Checkboxes and small javascript is automatically added by docuwiki plugin to be able to turn on and off each layer.

New dokuwiki graph tag attributes

There are two new attributes:

  • dpi=<dpi>: you can choose the number of <dpi> which to render the graph
  • slicespace=<pixels>: if present: render the graph as an isometric projection with a layer separation of <pixels> distance

a : b : c

show the source

TODO

Dokuwiki

  • Add a flag to avoid layers visualization (normal view).
  • Add a references system to draw the same graph many times with different layers turned on (in different documents too).

Graphviz

  • Add a field for layers description (to be use into dokuwiki instead of current displayed layer name).

// An object oriented approach to animate google maps markers

Goal

Obtain a good animation of markers, with 8 bit transparency channel, in google maps, and self-remove them at the end of the “movie”.

Approaching the problem

Google Maps API don't have a way to build animations with 8 bit transparency images as frames.

To achieve this purpose we use javascript, enriching the Marker object with our attribute mop_ct to save the index of the current animation frame.

At the end we remove the Marker itself from the page.

// Retrieves the current reading position in a file of any process on linux

Rarely I cross-post messages but for me this information was like a revelation so … have patience.

Question

How to get the current reading position in a file of a process on your machine ?

This information can be useful in an avalanche of circumstances

  • you are importing 10G dump.sql into your new database
  • a friend is downloading your last recorded song (copyright free, obviously ;-) ) from your home web-server and you want to know how many bytes you must still send to him before you can turn off the laptop
  • how long you must wait before a grep command finishes its work

Right Answer

Use cat /proc/<process pid>/fdinfo/<file_handle>

Example

For a demonstration keep this micro-program readdy.c and compile it: