Configuration with Spring

As a little milestone in the “Variations” project I’ll introduce Spring as a configuration and dependency injection framework, inversion of control container and so on — after the big part Liquibase.

I will not give a full stack introduction to Spring. I suggest you to read a book in this topic, there are many good introductory and pro books about Spring on the market. If you want to have an application quickly up and running search between the guides on Spring (take a closer look at Spring Boot).

Continue reading

Running Liquibase Changesets — Part 3: Java application

Last time I’ve shown how to run Liquibase changesets from Maven and I gave a forecast for an ASAP post about Liquibase and Java. Well, the as soon as possible is more than a month but finally I’m here to show you a simple way to integrate Liquibase in your java application.

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

Handling ORA-01795 within a Spring application

OK, imagine you work on a software which has a lot of modules, you have a database in the background and you use it. You create, read, update and delete data, the reading queries contain sometimes an IN clause where you enter some values. Beside this you are damned you are forced you have to use Oracle as DBMS.

One day you get a bug report from your QA that something does not work what worked in the last… months. You look up the StackTrace (it’s good if you have one) and see following error message:

ORA-01795: maximum number of expressions in a list is 1000

Continue reading