All posts by Robert Nasarek

First Steps in Postgres

By default, postgres allow only local connections and and uses peer authentification to access the databases. In some cases this provoke the error message “

FATAL: Peer authentication failed for user "postgres"

This is an explanation how to configure postgres to ask for encrypted password and allow remote connections.

Change password for rootuser “postgres”

Connect to the default database with user postgres

sudo -u postgres psql template1

Set the password for user postgres

ALTER USER postgres with encrypted password 'yourpassword';

Exit (ctrl + d)

Config your postgres to allow remote access and to ask for passwords

Get your IP



Find postgresql.conf

find / -name "postgresql.conf"

here /etc/postgresql/10/main/postgresql.conf

Edit the file

sudo vim /etc/postgresql/10/main/postgresql.conf


#listen_addresses = 'localhost'


listen_addresses = '*'

Find pg_hba.conf

sudo find / -name "pg_hba.conf

here /etc/postgres/10/main/pg_hba.conf

Edit the file

sudo vim /etc/postgresql/10/main/pg_hba.conf

Change lines

local    all    postgres              peer

local    all    all                   peer


local    all    postgress             md5

local    all    all                   md5

And add

host    all    all  md5

Restart the database

sudo /etc/init.d/postgresql restart

Check, if it worked

pql -U postgres

Exit (ctrl + d)

Create user and database

Create user with linuxusername

sudo createuser -U postgres -d -e -E -l -P -r -s $USER

Create database

createdb mynewdatabase

You can now remote connect to your database


Metamodels and how they relate – part 2: From QDA to XML/TEI

In the last post, I said something about the terms of Qualitative Data Analysis (QDA) in general, this post will be about projecting the method and terminology to TEI-XML. Annotating text has a long tradition in the Digital Humanities, so I don’t have to invent something from scratch. The TEI-XML data model can easily be used for QDA – but also brings some new terms with it, which I must combine with the QDA-terminology.
Continue reading Metamodels and how they relate – part 2: From QDA to XML/TEI

Metamodels and how they relate – part 1: Qualitative Data Analyses

During my data modeling process of historical occupations, I must go through various meta model transformations. Starting with Qualitative Data Analysis (QDA) in XML to structure the important segments of historical texts, I’m going on with that information to create normalised and enriched data in tabular form, which in turn is imported to a graph database to build an ontology. Surfing between the meta models may cause headaches, because there is a lot of terms to mix up and it is sometimes hard to decide which data from one point of model belongs to which point of another model. Attributes exist in XML, but also in relational databases; do they describe the same information? Do they contain the same data? What is the relationship between an individual in RDF/OWL and a tuple in a relational database? In this blog series I will walk through the meta models of Qualitative Data Analysis (QDA), XML, relational databases, simple graphs, the labeled property graph database neo4j and the ontology language RDF/OWL to focus on the terminology of each meta model and intersections and differences between the individual terms. Continue reading Metamodels and how they relate – part 1: Qualitative Data Analyses

Two Snakes and a Notebook

“The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text.”

A notebook consists mainly of markdown cells to build narratives around your code and code cells to define computional code respectively show output of executed code (see figure 1).

Cell Types
Figure 1: The main cell types

Jupyter offers the possibily to explain and run your code in blocks, which is quite nice – not only for data scientists, but for tutorial writers as well: you don’t have to do all the copy&paste stuff anymore. It supports code in many programming languages, Continue reading Two Snakes and a Notebook

Ubuntu in a Box

Linux is a wounderful operating system for coding and development, but Windows or Mac OS also have advantages. My favorite Linux distribution is Ubuntu (even if there are good reasons to use Linux Mint or Xubuntu). To combine the best of different operating systems, you don’t have to install them side by side: In many cases a virtual machine (VM) is sufficient, especially if your system has a SSD, 8 GB ram and an eight-core processor.

I’m using Oracle Virtual Box, because it’s free and together with an extension pack it delivers a bunch of useful options and features (like a shared clipboard or shared folders and so on). Continue reading Ubuntu in a Box

Ocropy OCR – good results for Gothic/Fraktur Typeface

Ocropy (also called ocropus) is not a standalone program for text recognition: it consists of several command line modules for

  • binarization (creates a binary raster graphic)
  • segmentation (splitting documents into lines)
  • optical character recognition (OCR)
  • controlling the recognised text and
  • training new character sets.

Continue reading Ocropy OCR – good results for Gothic/Fraktur Typeface