Sourcepole - Aktuelltag:sourcepole.ch,2013:mephisto/Mephisto Drax2013-05-02T18:22:55Zhdustag:sourcepole.ch,2013-05-02:64442013-05-02T18:21:00Z2013-05-02T18:22:55ZQGIS Cloud and Sourcepole are sponsoring Öcher-Safari
<p>QGIS Cloud and Sourcepole are proud to be official sponsors of the team <a href="http://www.oecher-safari.de">Öcher-Safari</a>, attending the Allgäu-Orient-Rallye. One of the last adventures in the world of cars. Sourcepole serves the team with know how, infrastructure and more. Information about the team and the charity ideas of this event you can find on <a href="http://www.oecher-safari.de">Öcher-Safari</a> and the official web site of the <a href="http://www.allgaeu-orient.de">Allgäu-Orient-Rallye</a>.</p>
tpotag:sourcepole.ch,2013-03-01:63002013-03-01T19:24:00Z2013-03-01T20:18:48Zinstalling Postgis 2.0 under Debian wheezy
<p>We’ll be using Postgis2.0 from UbuntuGIS, which has packages for a number of recent Ubuntu releases. Since Ubuntu precise has libc6 2.14 and Debian wheezy only 2.13 we fall back on Ubuntu oneiric for packages, which also has libc6 2.13.</p>
<p>However Postgis 2.0 in UbuntuGIS depends on a lot of llibraries which were in squeeze but live in wheezy under a higher version. Therefore we’ll install a lot of packages from Debian squeeze. Fortunately the libraries are versioned themselves and thus can be installed along the libraries from Debian wheezy.</p>
<p>Let’s go. Add the Debian squeeze sources:</p>
<pre><code># SRC="deb http://ftp.ch.debian.org/debian/ wheezy main"
# echo "$SRC" >> /etc/apt/sources.list
</code></pre>
<p>We’ll also add the security source, in case Debian releases a security update.</p>
<pre><code># SRC="deb http://ftp.ch.debian.org/debian/ wheezy main"
# echo "$SRC" >> /etc/apt/sources.list
</code></pre>
<p>You may want to replace ftp.ch.debian.org by a debian mirror nearer to you.</p>
<p>Now add the UbuntuGIS sources:</p>
<pre><code># SRC="deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu oneiric main"
# echo "$SRC" > /etc/apt/sources.list.d/ubuntugis.list
</code></pre>
<p>Now update and try to install postgis:</p>
<pre><code># apt-get update
# apt-get install postgresql-9.1-postgis
</code></pre>
<p>Create your database:</p>
<pre><code># sudo su
# su - postgres
$ psql postgres
postgres=# CREATE DATABASE your_db OWNER your_preferred_user:
</code></pre>
<p>Now add the postgis features to that database:</p>
<pre><code>$ psql -d your_db -f /usr/share/postgresql/9.1/contrib/postgis-2.0/
$ psql -d your_db -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql
</code></pre>
<p>That should be it. Let’s hope it works.</p>
<p>A final warning: you are mixing multiple distributions here. This can lead to problems. Due to version conflicts upgrading packages can become very difficult.</p>
<p>Tomáš Pospíšek <a>tpo_hp@sourcepole.ch</a></p>
admintag:sourcepole.ch,2013-02-25:62992013-02-25T20:16:00Z2013-03-08T13:26:44ZServing multiple WFS-T with TinyOWS
<p>Our favorite WFS-T server complement of UMN Mapserver is <a href="http://mapserver.org/trunk/tinyows/">TinyOWS</a>. We like the simplicity of it so much, that we packaged it for <a href="https://launchpad.net/~ubuntugis/+archive/ubuntugis-unstable/">Ubuntu</a> and added it to <a href="http://live.osgeo.org/en/overview/tinyows_overview.html">OSGeoLive</a>. Installation is easy:</p>
<pre><code>sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install tinyows
</code></pre>
<p>The simplicity is a little bit too much, when it comes to serve multiple WFS-T on the same server. There is only one configuration file, but we want a configuration for each service. There are solutions for that, but I never saw a documentation of the most elegant solution we found. It uses Apache rewrite capabilities to set the <code>TINYOWS_CONFIG_FILE</code> environment variable according to the called URL:</p>
<pre><code># URL rewriting
RewriteEngine On
# Forbid direct access
RewriteRule ^/cgi-bin/.*$ - [F]
# Rewrite /xxx to /cgi-bin/tinyows with TINYOWS_CONFIG_FILE=/etc/tinyows/xxx.xml
RewriteRule ^/(.+)$ /cgi-bin/tinyows [QSA,PT,L,E=TINYOWS_CONFIG_FILE:/etc/tinyows/$1.xml]
</code></pre>
<p>This configuration included in a virtual host declaration (wfs.example.com) serves your WFS-T on wfs.example.com/servicename.</p>
hdustag:sourcepole.ch,2013-01-28:62982013-01-28T14:59:00Z2013-02-15T12:51:43ZKursprogramm Frühjahr 2013
<p>Sourcepole bietet Grundlagen- und Aufbau-Kurse für den Betrieb von Geodaten-Infrastrukturen auf der Basis von PostgreSQL/PostGIS und Quantum GIS an. Detaillierte Informationen zu den Kursen, die im Frühjahr 2013 stattfinden, entnehmen Sie bitte <a href="http://www.sourcepole.ch/kurse">http://www.sourcepole.ch/kurse</a> Die Anmeldung ist ab sofort online möglich. Wir freuen uns darauf Sie in Zürich begüssen zu können.</p>
pkatag:sourcepole.ch,2012-12-15:62902012-12-15T20:36:00Z2013-02-15T12:51:48ZThe state of QGIS Globe
<p>The Region of Umbria, Italy, sponsored 4 days of work to update QGIS Globe for current QGIS versions. Most of the functionality is working again and the globe is now compatible with osgEarth 1.0 up to 1.3.
The bad news is, that the globe plugin is not working on Windows with OSGeo4W. It seems that one of the OSGeo4W libraries (GDAL?) is compiled with an incompatible MS compiler version. Christmas holidays are coming…</p>
<p>At least it gives Linux users the possibility to play with the globe using the current development version and do exciting stuff like Oslandia does:</p>
<p><a href="http://vimeo.com/54776907"> PostGIS 3D demo</a></p>
<p>Imagine someone would sponsor four <em>weeks</em> of QGIS Globe work!</p>
marcotag:sourcepole.ch,2012-10-30:62662012-10-30T15:54:00Z2013-02-15T12:52:11ZNew configuration options in QGIS server
<p>In QGIS server, it is now possible to selectively exclude layers from WMS publication. These layers will be available only on the desktop and hidden from WMS clients. Similarly, print layouts can be excluded from WMS publication. Of course, these settings are conveniently accessible from the project properties dialog of QGIS (but you need to have a nightly build or a recent compile):</p>
<p></p>
<p>Additionally, attributes per layer can be excluded from WMS or WFS publication in the vector properties dialog:</p>
<p></p>
<p>There is also a new request type called ‘GetProjectSettings’. The output of this request is similar to the GetCapabilities output, but with more details and more specific to QGIS:</p>
<ul>
<li>Initial visibility of layers</li>
<li>Information about vector attributes and their edit types</li>
<li>Information about layer order and drawing order</li>
<li>List of layers published in WFS</li>
</ul>
<p>These new features have been developed in collaboration and with funding from the <a href="http://gis.uster.ch">city of Uster</a>. More details are available on the <a href="http://hub.qgis.org/wiki/quantum-gis/QGIS_Server_Tutorial">QGIS server / webclient wiki page</a></p>
marcotag:sourcepole.ch,2012-10-02:62152012-10-02T07:21:00Z2013-02-15T12:52:16ZCreating png8 images with QGIS server
<p>For providing maps via WMS over the internet, it is important to generate image files with a small size. Because normally, most of the perceived WMS delay comes from transfering large images files over the internet (and not from map rendering itself). Therefore, QGIS server supports the conversion of png24 and png32 images into png8, therefore generating a file with only 1/3 resp. 1/4 of the original size (but with lower quality).
However, until recently, QGIS server was using the default algorithm from the Qt library for conversion to png8, resulting in very ugly png8 images if used with a transparent background and sometimes with shifted colors. Therefore, I decided to implement a better conversion algorithm: the median cut algorithm, which was first described by Heckbert in 1982 ( Paul S. Heckbert, Color Image Quantization for Frame Buffer Display. ACM SIGGRAPH ‘82 Proceedings). This algorithm creates color boxes in 4-dimensional colour space and subdivides at the mean of the largest dimension. It stops if the number of boxes equals the requested number of colors (256 in the case of png8 conversion). First tests show the quality of the converted images are quite good for vector maps. So a performant configuration for a webmap means probably to fetch background rasters as jpg and to overlay vectors as png8 with transparent background.</p>
<p>Let’s see with an example what the conversion from png24 to png8 means in terms of image quality. The first file is a png24 image, 590 KB size:
</p>
<p>And this one is the conversion to png8, only 190 KB size.
</p>
<p>To test the png8 conversion, you need to have the latest QGIS version from git (or a nightly build tomorrow). Then simply replace the FORMAT paramter in the url with ‘&FORMAT=image/png; mode=8bit’.</p>
tpotag:sourcepole.ch,2012-09-11:62002012-09-11T17:49:00Z2013-02-15T12:52:22ZHowto shrink a remote root ext3 filesystem on Debian wheezy
<p>This howto describes how to resize a root ext3 filesystem
on a remote Debian wheezy server.</p>
<p>This howto is not an original work but only an update of
an <a href="https://thunked.org/general/howto-shrink-a-remote-root-ext3-filesystem-t96.html">older howto by Stefan @ https://thunked.org/</a>.
This version is specifically adapted to a server running Debian wheezy.</p>
<p>DISCLAIMER:</p>
<pre><code>THERE IS A DECENT CHANCE THAT IF YOU FUCK THIS UP YOUR
REMOTE SYSTEM SIMPLY WONT BOOT AT ALL. I URGE YOU TO TEST
THIS LOCALLY BEFORE USING THIS METHOD ON A PRODUCTION
SYSTEM. ESPECIALLY IF YOUR SYSTEM IS NOT DEBIAN WHEEZY,
SINCE THAT'S THE ONLY ONE I HAVE TESTED.
</code></pre>
<p>THE QUICK WAY:</p>
<pre><code>If you don't want to read the whole thing you can only
execute the commands I run and probably skip the
explanations.
</code></pre>
<p>I’ve only done this on Debian Wheezy. If you’re using
another distro the initrd layout and init scripts may be a
bit different. However, I suspect it looks very similar on
almost every distro out there. On Debian my root partition
is an ext3 partition.</p>
<p>The general idea is pretty simple: you can’t shrink a
mounted partition and it’s impossible to unmount or replace
your root partition in a live system, so we have to resize
the partition before it is mounted. What we’ll do to
accomplish this is change the initrd image to make the init
scripts resize the root partition before mounting it. This
is by far the most flexible and easy method to resize your
root partition I could think of. Most suggestions I found
on google required you to create separate OS on a new root
partition and boot into that, but I did not have any space
to create a new root partition on my remote machine.</p>
<p>Unpacking the initrd image is fairly straight forward:</p>
<pre><code>$ mkdir ~/initrd; cd ~/initrd
$ gunzip -c /boot/initrd.img-3.2.0-3-amd64 | cpio -i --make-directories
62631 blocks
$ ls -l
total 40
drwxr-xr-x 2 root root 4096 Sep 11 20:23 bin
drwxr-xr-x 3 root root 4096 Sep 11 20:23 conf
drwxr-xr-x 6 root root 4096 Sep 11 20:23 etc
-rwxr-xr-x 1 root root 6797 Sep 11 20:23 init
drwxr-xr-x 7 root root 4096 Sep 11 20:23 lib
drwxr-xr-x 2 root root 4096 Sep 11 20:23 lib64
drwxr-xr-x 2 root root 4096 Sep 11 20:23 run
drwxr-xr-x 2 root root 4096 Sep 11 20:23 sbin
drwxr-xr-x 6 root root 4096 Sep 11 20:23 scripts
</code></pre>
<p>First, we have to copy all the programs we need to resize
our partition onto the initial ram disk. For my ext3 file
system I need e2fsck and resize2fs. The programs are
depending on a few libraries, so you’ll need to copy those
to the new initrd image too. Libraries can also depend on
other libraries, make sure you recursively check
dependencies until you don’t have any missing dependencies
anymore.</p>
<pre><code>$ ldd /sbin/e2fsck
linux-vdso.so.1 => (0x00007fff3594c000)
libext2fs.so.2 => /lib/x86_64-linux-gnu/libext2fs.so.2 (0x00007f7cdddd5000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f7cddbd1000)
libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007f7cdd9a9000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f7cdd7a4000)
libe2p.so.2 => /lib/x86_64-linux-gnu/libe2p.so.2 (0x00007f7cdd59c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7cdd214000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7cdcff8000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7cde01e000)
$ ldd /sbin/resize2fs
linux-vdso.so.1 => (0x00007fffa216a000)
libe2p.so.2 => /lib/x86_64-linux-gnu/libe2p.so.2 (0x00007fa01f7a2000)
libext2fs.so.2 => /lib/x86_64-linux-gnu/libext2fs.so.2 (0x00007fa01f55f000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007fa01f35a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa01efd3000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa01edb7000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa01f9b0000)
</code></pre>
<p>We only copy the libraries that are not yet present in the
initramfs. Fortunately in our case there are no recursive
dependencies of those libraries.</p>
<pre><code>$ for i in libext2fs.so.2.4 libcom_err.so.2.1 libe2p.so.2.3; do \
cp -i /lib/x86_64-linux-gnu/$i lib/x86_64-linux-gnu/; \
done
$ cd lib/x86_64-linux-gnu/
$ ln -s libcom_err.so.2.1 libcom_err.so.2
$ ln -s libext2fs.so.2.4 libext2fs.so.2
$ ln -s libe2p.so.2.3 libe2p.so.2
$ cd ~/initrd/
$ cp /sbin/e2fsck ~/initrd/bin/
$ cp /sbin/resize2fs ~/initrd/bin/
</code></pre>
<p>Next, we need to edit the init script. Debian uses busybox
in its initrd image so the init script will be interpreted
by a bourne shell. If you look through the init script file
you’ll find the moment where the script mounts the root
file system:</p>
<pre><code>$ cat scripts/local
...
# FIXME This has no error checking
# Mount root
if [ "${FSTYPE}" != "unknown" ]; then
mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
else
mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt}
fi
...
</code></pre>
<p>Simply add in the commands to resize the file system right
before the the file system is mounted. Resize2fs in Debian
does not want to resize the file system before it is
forcefully checked. It may be wise to add the -p or -y
flag to e2fsck. -y will answer yes to all questions, this
could prevent a hung system but may cause more damage to
your files or filesystem. The -p flag will only
automatically answer yes to safe operations. resize2fs
takes two parameters, the first is the block device that
has the ext2 or ext3 file system and the second is the new
size you want to give it. By default the size is in
blocks, but you can append a unit to change that. ‘K’ for
kilobytes, ‘M’ for megabytes, ‘G’ for gigabytes and ‘T’ for
terabytes. If you don’t specify a size, it will enlarge
the file system to the total size of the partition or
logical volume. After adding the commands the init script
will look something like this:</p>
<pre><code> #RESIZEROOTFS MODIFIED!!! DONT RUN MORE THAN ONCE
_log_msg "Starting e2fsck"
/bin/e2fsck -p -f -C 0 /dev/sda4 || true
_log_msg "Starting resize2fs"
/bin/resize2fs /dev/sda4 100G || true
# FIXME This has no error checking
# Mount root
if [ "${FSTYPE}" != "unknown" ]; then
mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
else
mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt}
fi
</code></pre>
<p>If you have access to the system’s console, you might want
to add a “-C 0” to e2fsck’s parameters. That will show you
the progress of the fscheck.</p>
<p>There’s one last thing we have to do before re-packing the
initrd image. e2fsck and resize2fs will fail if there is
no /etc/mtab file available so we’ll have to make sure
/etc/mtab exists.</p>
<pre><code>$ touch ~/initrd/etc/mtab
$ cd ~/initrd/
$ find ./ | cpio -H newc -o > /tmp/initrd.cpio
64097 blocks
$ gzip -c /tmp/initrd.cpio > /boot/initrd-resize.img
</code></pre>
<p>And lastly, we need to add a new default boot option in
grub. In Debian grub’s configuration file is constructed
from various bits under /etc/grub.d. The resulting total
configuration file is put under /boot/grub/grub.cfg. Open
up the grub.cfg file in your favorite text editor and look
for the default entry. It’s usually the first one, but may
vary. Add a copy of the original entry to
/etc/grub.d/40_custom and change the initrd image to the
one we just created.</p>
<pre><code>$ cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'resize' --class debian --class gnu-linux --class gnu --class os {
insmod gzio
insmod part_gpt
insmod ext2
set root='(hd0,gpt1)'
search --no-floppy --fs-uuid --set=root 0aa8bc27-17e3-4ae2-a9cf-497ab444970b
echo 'Loading Linux 3.2.0-3-amd64 ...'
linux /vmlinuz-3.2.0-3-amd64 root=UUID=660f79dc-c152-4e15-ad61-7075b42de609 ro quiet
echo 'Loading initial ramdisk ...'
initrd /initrd-resize.img
}
</code></pre>
<p>Now make sure that it’s this entry that will be booted into
by default. Set GRUB_DEFAULT in /etc/default/grub to the
name of the entry you’ve just created:</p>
<pre><code>$ cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
#GRUB_DEFAULT=0
GRUB_DEFAULT="resize"
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
...
</code></pre>
<p>Finally, you can reboot the system. When it comes back
online (if it comes back <em>grin</em>) your file system will be
resized. Be aware that e2fsck and resizefs take a <em>long</em>
time on big disks. On my system the two took <em>2 hours</em> for
a 1.5T filesystem. Thus don’t prematurely reboot your
system if it doesn’t come up again quickly.</p>
<p>Don’t forget to remove the new grub entry, so your file
system doesn’t get resized every time you boot.</p>
<p>Original howto at https://thunked.org/general/howto-shrink-a-remote-root-ext3-filesystem-t96.html</p>
<p>Original howto Written by Stefan @ https://thunked.org/</p>
<p>This version for Debian wheezy by Tomáš Pospíšek</p>
hdustag:sourcepole.ch,2012-08-20:61902012-08-20T11:49:00Z2012-08-20T11:49:42ZEigene GIS-Fachapplikationen mit QGIS entwickeln
<p>Als Ergebnis der Zusammenarbeit zwischen der Sourcepole AG und der Hochschule Rapperswil (HSR) ist ein Video entstanden, dass die Entwicklung eigener Fachschalen mit QGIS beschreibt.</p>
<p>Am Beispiel der Zonenplanung zeigt dieses Video, wie Sie mit Quantum GIS eine so genannte Fachapplikation erstellen könne. Sehen Sie Schritt für Schritt, wie sie Quantum GIS auf Ihre persönlichen Bedürfnisse anpassen können, passende Erweiterungen finden, eigene Eingabeformulare erstellen und eine Datenbank verwalten.</p>
<p>Die Grundlage zu diesem Video war ein Workshop auf dem Geosummit 2012 Bern, den Pirmin Kalberer entwickelt hat.</p>
<p>Das Video finden sie <a href="http://goo.gl/FwS2h">hier</a></p>
hdustag:sourcepole.ch,2012-07-27:61792012-07-27T08:54:00Z2012-07-27T08:56:02ZKursprogramm Herbst 2012
<p>Sourcepole bietet Grundlagen- und Aufbau-Kurse für den Betrieb von Geodaten-Infrastrukturen auf der Basis von PostgreSQL/PostGIS und Quantum <span class="caps">GIS</span> an. Detaillierte Informationen zu den Kursen, die im Herbst 2012 stattfinden, entnehmen Sie bitte dem <a href="/kurse">Kursprogramm</a>. Die Anmeldung ist ab sofort online möglich. Wir freuen uns darauf Sie in Zürich begüssen zu können.</p>
tpotag:sourcepole.ch,2012-06-20:61662012-06-20T14:36:00Z2012-06-20T20:54:21ZMicrosoft blocking emails to you
<p>It’s now a month, that we can’t send email to any Microsoft owned mail domain - for example to hotmail.com or to live.com.</p>
<p>Microsoft is blocking us. We can actually communicate with their first level support staff responsible for the mail servers, however they will neither tell us why we are blocked, nor what we have to do to get unblocked, nor when the block would get lifted.</p>
<p>They propose a whole laundry list of things for us to do - registering with them and constantly maintaining and monitoring our status at some service of theirs. We’d certainly spend half a week to implement those measures and then spend ongoing time to maintain them. But none of that is guaranteed to be of any help.</p>
<p>So if you need to email us then please do not use any of your hotmail accounts for the communication - we unfortunately can not reach you any more.</p>
<p>And it seems we’re <a href="http://www.google.com/search?q=microsoft+smtp+blacklist+SC">not the only ones</a> receiving that treatment by Microsoft.</p>
tpotag:sourcepole.ch,2012-06-07:61572012-06-07T15:10:00Z2012-06-07T15:10:46ZGenerating state machines with Dia
<p><a href="http://live.gnome.org/Dia">Dia</a> is a nice cross platform application
for diagram drawing. It can be scripted via <a href="http://python.org">Python</a>,
which opens the possibility to generate code from Dia diagrams.</p>
<p>Below we’ll create a python plugin that generates C code from UML state
machine diagrams. Doing the same for other languages should be trivial.</p>
<p>The first thing you need is Unai Estébanez Sevilla’s nice finite state
machine code generator. The <a href="/assets/2012/6/5/uml_stm_export.py">version</a>
that we are using here has been abstracted in order to be able to produce
code in various languages.</p>
<p><a href="/assets/2012/6/5/uml_stm_c_export.py">This</a> python plugin implements an exporter
to C code. To use it, you need to put
<a href="/assets/2012/6/5/uml_stm_c_export.py">it</a>, along with the
<a href="/assets/2012/6/5/uml_stm_export.py">base exporter</a> into your local
plugins directory under ~/.dia/python.</p>
<p>Let’s have a quick look at the code.</p>
<p>First we import the dia python module and the exporter base functionality:</p>
<pre><code>import dia
import uml_stm_export
</code></pre>
<p>Then we create our C exporter class that inherits from the generic
exporter:</p>
<pre><code>class CDiagramRenderer(uml_stm_export.SimpleSTM):
</code></pre>
<p>Next we define how the beginning of our generated code file should look
like. That could include general infrastructure independent of the
state machine diagram at hand. In our case, we want to encapsulate the
generated state machine code within a function:</p>
<pre><code>CODE_PREAMBLE="void config_stm(STM_t* stm) {"
</code></pre>
<p>We also define the postamble to close the function. After that come
generic functions that implement the class constructor
<code><strong>init</strong>(self)</code> and functions responsible for calling
the dia object parser <code>begin_render(self,data,filename)</code>.</p>
<p>Now we define our output generator <code>end_render(self)</code>. We
first traverse dia’s objects in order to find the state machine’s
initial state:</p>
<pre><code>for transition in self.transitions:
if(transition.source == "INITIAL_STATE"):
</code></pre>
<p>The initial state state gets a special treatment: we have a special
function call generated for it:</p>
<pre><code>f.write(" add_initial_state( stm, %s, %s );\n" %
(initial_state.name, initial_state.doaction))
</code></pre>
<p>Next we traverse all states and output code that will create them,
along with functions to be called within that state to decide on where
to transition next:</p>
<pre><code>for key in self.states.keys():
f.write(" add_state( stm, %s, %s );\n"
% (state.name, state.doaction))
</code></pre>
<p>And finally we output all the transitions between states:</p>
<pre><code>for transition in self.transitions:
f.write(" add_transition( stm, %s, %s, %s );\n" %
(transition.source, transition.trigger, transition.target))
</code></pre>
<p>and that’s nearly it. At the end of our generator we make sure to register it
with dia:</p>
<pre><code>dia.register_export("State Machine Cstma Dump", "c", CDiagramRenderer())
</code></pre>
<p>Done! Simple, isn’t it?</p>
<p>Finally please permit me to thank all the people that created such a powerful
tool free for us to use:</p>
<ul>
<li>Unai Estébanez Sevilla for the original STM generator</li>
<li>Steffen Macke and Hans Breuer, Dia’s current busy maintaners</li>
<li>Alexander Larsson, Dia’s original author</li>
<li>all the other contributors to Dia and free software</li>
<li><a href="http://panter.ch">Panter</a> for inviting me to their fabulous work week in
Greece where most of the hacking on the generator was done and
<a href="http://combitool.ch">Combitool</a> who supported this work by needing
a state machine generator in their current project.</li>
</ul>
<p>PS: Unai’s original text generator is now also “just” a “simple” <a href="/assets/2012/6/5/uml_stm_text_export.py">addon</a></p>
tpotag:sourcepole.ch,2012-06-07:61602012-06-07T14:38:00Z2012-06-18T09:44:38ZAutomatically restarting services after upgrades on Debian and Ubuntu
<p>There are various tools to automatically keep a Debian/Ubuntu system security wise up to date, among others the <a href="http://packages.debian.org/sid/unattended-upgrades">unattended-upgrades package</a>.</p>
<p>Also, there’s the checkrestart script from the <a href="http://packages.debian.org/sid/debian-goodies">debian-goodies package</a>, that scans all the open files on a system and tries to determine to what service they belong and how that service might be restarted.</p>
<p>The last piece that’d tie all those scripts together and would automatically restart all services that are using stale libraries or files was missing.</p>
<p>With the help of Michal Fiala there however is now the <a href="https://github.com/tpo/debian-goodies/blob/master/restart-services">restart-services</a> script, that does just that.</p>
<p>The script has not seen much real world usage and as such should be regarded as experimental (f.ex. by restarting /etc/init.d/screen it will as of the time of writing terminate existing screen sessions).</p>
<p>The script currently lives on <a href="https://github.com/tpo/debian-goodies">Github</a>. If you encounter any problem with the script then we’ll very much wellcome a patch that fixes it…</p>
<p>Tomáš Pospíšek </p>
<p>Update 18.6.2012: The most recent checkrestart (from debian-goodies 0.61) now excludes screen from beeing listed among the services to be restarted.</p>
pkatag:sourcepole.ch,2012-03-24:61402012-03-24T00:29:00Z2012-03-24T00:40:18ZQGIS - the FOSSGIS week
<ul>
<li><p><strong>Tuesday, 2012-03-20 11:00</strong>: <a href="http://www.fossgis.de/konferenz/2012/">FOSSGIS in Dessau, Germany</a> starts with a workshop for programming QGIS plugins</p>
<p>A great conference begins, with about 400 people attending presentations and workshops over three days.</p></li>
<li><p><strong>Tuesday, 2012-03-20 14:42</strong>: <a href="https://github.com/qgis/Quantum-GIS/commit/c27c89045c">Changeset c27c89045c</a>: “Add WFS support for QGIS server. Provided by René-Luc D’Hont”</p>
<p>Wow.</p></li>
<li><p><strong>Tuesday, 2012-03-20 14.48</strong>: QGIS 1.7.4 uploaded to DebianGIS</p>
<p>Ok, QGIS 1.7.4 is already a few weeks old. But current version on Debian is 1.4.0! This will be a long “new features” list for Debian users. Thanks for your work, Francesco!</p></li>
<li><p><strong>Tuesday, 2012-03-20 16:00</strong>: Marco Bernasocchi demonstrates a fully functional <a href="http://android.qgis.org/">QGIS on a Android tablet</a>.</p>
<p>GPS support, right click gesture, pinch zooming and offline editing plugin working. Just a few tickets are left for uploading it to Android market.
Hopefully we find another great student for this years follow-up <a href="http://hub.qgis.org/wiki/quantum-gis/Google_Summer_of_Code_2012#QGIS-for-mobile-phone-devices">GSoC project</a>!</p></li>
<li><p><strong>Wednesday, 2012-03-21 16.05</strong>: Victor Olaya, author of SEXTANTE, announces his work on a QGIS processing framework with toolbox, graphical modeler, batch processing interface, etc.</p>
<p>Wow!!</p></li>
<li><p><strong>Wednesday, 2012-03-21 18.30</strong>: QGIS and GRASS user meeting at FOSSGIS</p>
<p>Explaining whats going on in the QGIS code and the QGIS community. Live demonstration of <a href="/2011/12/30/raster-resampling-in-qgis">raster resampling</a> branch.</p></li>
<li><p><strong>Wednesday, 2012-03-21 20.18</strong>: Tim announces QGIS 1.8 RC1 for April 9th.</p>
<p>Test it before the hackfest in Lyon!</p></li>
<li><p><strong>Thursday, 2012-03-22 08:00</strong>: Bad news - three days in a row without any commit from jef!</p>
<p>What happened? Jürgen forgot to bring his power adapter to Dessau :-(</p></li>
<li><p><strong>Thursday, 2012-03-22 13:30</strong>: FOSSGIS is over</p>
<p>with well attended QGIS presentations and workshops.</p></li>
<li><p><strong>Thursday, 2012-03-22 23:37</strong>: <a href="https://github.com/qgis/Quantum-GIS/commit/05f7d6baea">Changeset 05f7d6baea</a> “fix warnings”, authored by jef-n</p>
<p>Jürgen is back home again. Phew!</p></li>
<li><p><strong>Friday, 2012-03-23 10:26</strong>: <a href="https://github.com/qgis/Quantum-GIS/commit/585e58179d">Changeset 585e58179d</a>: Nathan Woodrow merges native MS SQL provider, written by Tamas Szekeres, into master.</p>
<p>Good news for MS SQL users, but also for Tim: “Finally a way to stop having to use PostGIS all the time…”</p></li>
</ul>
<p>What a week for QGIS! Looking forward to more news from the <a href="http://hub.qgis.org/wiki/quantum-gis/7_QGIS_Developer_Meeting_in_Lyon_2012">QGIS Hackfest in Lyon</a>.</p>
pkatag:sourcepole.ch,2012-02-08:61322012-02-08T08:47:00Z2012-02-10T10:09:19ZFOSSGIS Konferenz 2012 in Dessau
<p>Die <a href="http://www.fossgis.de/konferenz/2012/">FOSSGIS und deutschsprachige Open Street Map Konferenz 2012</a> – die grösste deutschsprachige Anwenderkonferenz für Freie Geo-Informationssysteme und freie Geodaten –
findet vom 20. bis 22. März 2012 an der Hochschule Anhalt in Dessau-Rosslau statt.</p>
<p>Sourcepole ist mit folgenden Vorträgen und Workshops vertreten:</p>
<ul>
<li><a href="http://www.fossgis.de/konferenz/2012/programm/events/385.de.html">Neues vom QGIS Server und -Webclient</a></li>
<li><a href="http://www.fossgis.de/konferenz/2012/programm/events/460.de.html">TinyOWS - der schlanke WFS Server</a></li>
<li><a href="http://www.fossgis.de/konferenz/2012/programm/events/458.de.html">MapServer MapCache - der neue WMTS Tile Cache</a> </li>
<li><a href="http://www.fossgis.de/konferenz/2012/programm/events/397.de.html">Workshop: Neue Funktionen in QGIS für Poweruser</a></li>
</ul>
<p>Da mehr als 400 Teilnehmende erwartet werden, ist eine Registrierung bis zum 16. März 2012 notwendig. Das Anmeldeformular und andere organisatorische Informationen befinden sich auf der <a href="http://www.fossgis.de/konferenz/2012/">Konferenzseite</a>.</p>