Logische Implicaties in Schematron

P -> Q equivalent aan not(P) OR Q Voorbeeld: Als “Voornaam” voorkomt, dan moet ook “Achternaam” voorkomen. Rule: “not(Voornaam) or Achternaam” ————————————————————– Schematron: Inverse Exclusive Or In logica: P and not(Q) or not(P) and Q

Read file contents

import sys, os f = open(‘/path/to/file.xml’, ‘r’) contents = f.read() first_line = f.readline() second_line = f.readline() list_of_all_lines = f.readlines() f.close()   http://docs.python.org/tutorial/inputoutput.html  

Text Encoding Initiative (TEI)

The Text Encoding Initiative (TEI) is a consortium that developed the standard for the representation of digital texts. The standard is widely spread, and currently in use by publishers, libraries and museums. Like a lot of standards for texts, TEI is also in XML. The TEI provides XML Schema’s for validating documents. It is very important to produce valid documents. Only when all organizations use the same XML Schema, the documents will be interoperal between [...]

iPhone update-day iOS5

Today, Apple will release version 5 of iOS for iPhone. This topic has been trending on Twitter all day. According to the last rumor the update will be available at 9pm in The Netherlands. Be sure to install iTunes 10.5 first! I am very curious for the new functions like the Notification Centre and iMessage. iMessage is the iPhone version of Blackberry Ping.

Backing up your Django database

python

First dump all the data in a file: » python manage.py dumpdata > data.json or » python manage.py dumpdata > data.json –natural Now load the data to your new database: » python manage.py loaddata data.json

Django / Python Query with variable number of arguments

python

Put all conditions in a kwargs dictionary: kwargs = {} kwargs[‘price__gt’] = 20 kwargs[‘category’] = ‘televisions’ kwargs[‘language’] = ‘NL/nl’ records = Product.objects.all().filter(**kwargs).select_related().order_by(‘order’) Does the following: Select all instances of de Product-model with a price higher then 20, in the category ‘televisions’ and language ‘NL/nl’.

Russian roulette for system administrators

Russian Roulette

Another day at the office? This game makes a boring day exciting. Try russian roulette for (Linux) system administrators: # [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Disclaimer: play at own risk

Regular Expression Testing Tool

Regular Expression Tool

With this tool you can create a regular expression and test it immediately with a teststring. This tool has been very useful while writing expressions.