Running Liquibase change sets — Part 1: command line

After a brief introduction into Liquibase I continue the topic with using this framework.

There are many options to use Liquibase, I’ll show you some (command line, maven and Java execution) but feel free to look at the website of the tool to get a more detailed documentation of the usages.

Continue reading

Liquibase change sets

As told before, we’ll take a closer look at Liquibase, and create the database with this tool. The documentation at the website is very good, they have a lot of tutorials for all needs, so I’ll give you only a short introduction how to convert the showed SQL script to Liquibase, how to run the change sets (from command line and Maven), and give some personal opinions. Later with the examples I’ll include the liquibase execution into the application, so it updates the database automatically at startup. Continue reading

Validating XML against XSD

Recently I got a question from one of our customers: how do we validate XMLs against their XSD definition? Because we offer an XML based interface to our system, where the customers have to provide the XML data which we read into the system — and naturally we give an Exception if the provided XML does not match our expectations (which is defined in the XSD naturally).

So we suggested some on-line resources where you can put in the XML and XSD and validate them and we mentioned the capability of open source tools too. After a few days I got an answer that they are not able to validate our example XMLs against the provided Schema so I should give a better hint how we do that. And this is why I created a simple Java application which takes some parameters and validates the XML against the XSD. After this, I looked up what could be done in this topic with Python.

Continue reading

Pythonic

So, as I mentioned before I’ll list some portions of Python code here, eventually describing the differences between earlier (2.7 and before) and newer (3 and above) versions of Pythons, have some GUI examples and such kind of work.

To not jump right into deep water I prepared a simple game “Guess the Number” in Python 2.7. This code is available here. The script should work with Python 2.7 (I tested it on my Raspberry PI having a Version ‘2.7.3rc2 (default, May  6 2012, 20:02:25) \n[GCC 4.6.3]’), but it could run with previous versions. If you are experiencing some problems feel free to bother me.

And as you can guess (no, not the number): it does not run with Python 3 (or it does not with my Python 3.3.1 (v3.3.1:d9893d13c628, Apr  6 2013, 20:30:21) [MSC v.1600 64 bit (AMD64)] on win32).

And why not? Because as many programming languages Python evolved too to a next level and the developers made this language more to look like common languages. The first thing you encounter is the behaviour of the “print” function: it works like a function so you have to enclose the output into brackets, or you’ll get an “invalid syntax” error message (or something similar) pointing to the first “print” statement in your source code.

So what I’m going to do is to take my 2.7 script and make it run under 3.3.1 — and after that I’ll try to run the same code with Python 2.7… Let’s get started.

Continue reading