some code snippets for QGIS plugins