Force Git to hard checkout a branch

I run into a situation with a git repository that I was no longer able to switch between branches. Git complains about uncommitted changes. But I was sure that my local repository should not have any changes.

For force a hard checkout and pull use the following git commands. NOTE: this will overwrite any local changes – so be careful:

git checkout mybranch
git fetch --all
git reset --hard origin/mybranch
git pull

 

 

How to develop a business application?

If you start developing a business application you have two different approaches. In the first one – and this is the typically one – you start with the modelling of business objects. For example you have a “car” which can be easily modeled in a business object. You have a “buyer” and a “seller” which can be also simply stored into separated data tables. That’s it! It looks so easy to develop a business applications like in this example for a “used car dealer”. What you do is to describe the real things from the surrounding world into objects using a programming language of your choice. Today we have a lot of frameworks to map the real world things into databases and object orientated application frameworks. This all works well – at a glance. But as we all know, the real world is anything but simple. And in the moment when you realize that “used cars”, “sellers” and “buyers” have more complex relationships you need new objects like a “sales contract” and a “driver‘s license”. A “credit agreement” and awarranty”. And you see that the things of the real world are not so easy as they seems to be in the first time.

A complete different approach to develop a business application is to get rid of the things of the real world. In this case you don’t look for what the persons do with the things. But you look for why they do the things they do. Now you are looking at the process behind the things in our real world – the business process. In the example of our “used car dealer” you can see a buyer showing interest in a car – his desire to buy. You see the dealer who tries to regulate the payment and all the things which can happen when you buy or sell a car.

Now when you try to model this in your business application your thoughts revolve around what people do and what happened during the entire process. And this is the idea of a business process application or a workflow application. Talking about the objects and data tables as we do in the beginning we now need objects like “events”, “activities”, “process states”, “actors” and “time ranges”. This is more abstract because we are now looking behind the things in your visible world. The funny part of this developing is, that you will realize that it does no longer matter if your seller sells cars or flowers or if you buyer is interested in a used car or a holiday travel. Your application becomes more abstract and you begin to model the real abstraction of the world.

When you start developing a business application in the second way you don’t ask your customer what the things are he what’s to save into a database. You ask him why he need an application to do his work better.

Take a look at our open source project Imixs-Workflow. It maybe can help you to get on that way.

Debian Jessie – systemd-shim

Yesterday I crashed my debian testing release (jessie) after I updated the system via

apt-get upgrade

The reason was a dependency conflict between systemd and systemd-shim. systemd-shim is necessary for different packages including the gnome-shell. After a long time of searching the web and reading many politically discussions about pros and cons of systemd in general, I was finally able to solve my problem with the following trick:

1) I uninstalled system-shim (8-2)

apt-get remove systemd-shim

2) Downloaded version 8-1 from https://launchpad.net/ubuntu/utopic/amd64/systemd-shim/8-1

3) installed the package ‘cgmanager’ manually

apt-get install cgmanager

4) installed the downloaded version 8-1 from commandline

dpkg -i systemd-shim_8-1_amd64.deb

5) installed the meta package ‘gnome’ again

apt-get install gnome

Now Gnome Shell is back again 🙂 Some conflicts are still there but I think this will be solved by updates in the next few days

GlassFish and PostgreSQL

To setup a PostgreSQL database connection in GlassFish is quite simple. There is one point which required special attention. First, it looks sufficient for the GlassFish DataPool configuration to only define the parameters “DatabaseName”, “User” and “Password”. By default, the URL has the value:

jdbc:postgresql://localhost/?loginTimeout=0&socketTimeout=0&prepareThreshold=5&unknownLength=2147483647&tcpKeepAlive=false&binaryTransfer=true&disableColumnSanitiser=false

But it is very important that the URL contains also the DatabaseName after the hostname:

jdbc:postgresql://localhost/[YOURDATABASENAME]?loginTimeout=0&socketTimeout=0&prepareThreshold=5&unknownLength=2147483647&tcpKeepAlive=false&binaryTransfer=true&disableColumnSanitiser=false

Otherwise it can happen that GlassFish losts the connection and is unable to find any tables. When you change your pool configuration don’t forget to restart GlassFish.

EclipseLink – DataSources!

If you configure postgresql in GlassFIsh or WildFly it seems to be very important that the additional property ‘url’ is always set with the corresponding jdbc connection url. Even if the setup wizzard (wildfly) did not fill this param!

JPA – EclipseLink – MySQL – @OneToMany

Today I was faced with a really strange problem concerning JPA, EclipseLink an MySQL. I have Service EJB (3.1) with some JPA Entity Beans. They are joined with @OneToMany constraints. I am deploying my application typically under GlassFish 3.1 with MySQL Database. Everything works fine so far. But in some really strange cases – long complex transactions with a lot of updates and inserts I got a JPA Exception like this:

[#|2014-09-25T17:21:01.989+0200|WARNING|glassfish3.1.2|org.eclipse.persistence.session.file:/opt/glassfish-3.1.2/glassfish/domains/domain2/applications/office/office-ejb-1.0.0_jar/_org.imixs.workflow.jee.jpa|_ThreadID=160;_ThreadName=Thread-2;|Local Exception Stack: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`mydatabase`.`ENTITY_WRITEACCESS`, CONSTRAINT `FK_ENTITY_WRITEACCESS_writeAccessList_ID` FOREIGN KEY (`writeAccessList_ID`) REFERENCES `WRITEACCESS` (`ID`))
Error Code: 1451
Call: DELETE FROM WRITEACCESS WHERE (ID = ?)
    bind => [1 parameter bound]
Query: DeleteObjectQuery(org.imixs.workflow.jee.jpa.WriteAccess@5aa4670a)

I was confronted with such error messages in the past and solved them by changing the transaction boundaries in my code by encapsulating some of the jpa stuff in separate methods with new transaction context.

But The real reason for this kind of error is an inaccurate mapping of the database schema in MySQL made by EclipseLink. My table ‘ENTITY_WRITEACCESS’ is a crosstable needed for a @OneToMany relationship of my JPA entity beans.  I never looked at the schema in detail, because in my opinion that is stuff of the OR-Mapper.
The problem was that per default no CascadeType is defined for a @OneToMany relationship. But even when you define a CascadeType like CascadeType.DELETE – which is also implied by CascadeType.ALL – to your entity beans this will not necessarily be reflected to the database schema generated from the OR-Mapper. When you look at the generated schema you’ll notice that ON DELETE CASCADE is not added to the constraint. When you alter your schema and Add ON DELETE CASCADE to actual tables this will fix the problem above.

Note that this all depends on the JPA implementors how the constrains are created. So take a look at your generated table schemas.

Warum Aufgabenmanagement scheitert

In der heutigen Arbeitswelt sind wir es gewohnt, komplexe Aufgabenstellungen in kleineren oder größeren Teams zu lösen. Probleme, Aufgaben oder Projekte versuchen wir mal mehr, mal weniger erfolgreich zu strukturieren und die gemeinsame Arbeit daran zu vereinfachen. In der IT ist diese Disziplin der Teamarbeit sicherlich mit am meisten ausgeprägt. Es gibt unzählige Tools die uns bei der Koordination von Aufgaben in Projekten unterstützen. Manchmal gelingt es besser, manchmal aber eben auch schlechter. Warum ist das so? Warum kommen wir immer wieder mal an einen Punkt wo wir uns sagen ‘das hätte eigentlich besser laufen sollen’. Gerade in der IT versuchen wir dann meist mit Hilfe eines neuen Tools das Problem  künftig besser in den Griff zu bekommen – oder wenn wir richtig innovativ sind, programmieren wir uns gleich selbst ein solches Tool. Das ist übrigens auch der Grund warum es so extrem viele Projektmanagement Softwarelösungen am Softwaremarkt gibt. Continue reading “Warum Aufgabenmanagement scheitert”

Next Debian release will be incredible

The upcoming Linux distribution Debian 8.0 – code name ‘jessie’ – will become an amazing operating system.  I am testing the jessie release since one year and to me it looks promising what we can see so far.

For those who are not familiar with Linux distributions: Debian is the most used Linux destribution in the server world and most internet web servers are running on Debian. But Debian is also the base for the more known Ubuntu distribution. In fact everything you read about tips & tricks for Ubuntu is also valid for Debian and vice versa.

Unlike Ubuntu, Debian is an operating system which focuses on stability and sobriety. There is not a lot of bells and whistles. Debian uses the latest version of Gnome Shell for the desktop which is also focusing on clarity and simplicity. I personally like Gnome Shell and I recommend everyone to try it out.

systemd – speeds up booting

But one of the most impressive parts is the kernel architecture with the new “systemd” daemon. systemd is a system management which is the first process executed in user space during the Linux startup process. Therefore, systemd serves as the root of the user space’s process tree.  systemd allows more processing to be done concurrently or in parallel during system booting and reduces the computational overhead of the shell. systemd replaces the SysVinit concept and it results in an incredible increase of speed during the boot process. My own Ultrabook (Intel Core i7-3517U Ivy Bridge, 8GB RAM, 256 GB SSD) starts up in less then 10 seconds!

Altogether Debain feels very fast and compact. I like to work with this operating system and I like that debain is more clear as Ubuntu which becomes more and more confusing in its strategy (Unitiy vs Gnome, Mir vs Wayland).

Still not final….

Note that the Debian 8.0 which I am talking about is yet not final and still in a testing phase. This means you should not try it out if you are not familiar with Linux. Things can become broken and unstable. But if you can wait I guess Debian Jessie will be available in the end of this year.

 

New Version of Manik-Hot-Deploy for GlassFish and WildFly

Today I released a new Version of the Manik-Hot-Deploy Eclipse Plugin. The new version now stores the settings in a separate prefernces file stored in the project .settings/ directory. So now it is possible to share the Manik-Hot-Deploy settings with a source code repository in a team.

The Plugin can be used to deploy JEE applications in a GlassFish or JBoss/WildFly server. Manik-Hot-Deploy supports the hot deploy feature which speeds up development of JEE Web Applications.

https://github.com/rsoika/manik-hot-deploy

Debug an application in WildFly with Eclipse

You can debug a deployed applications running in WildFly with the Eclipse Debugging feature.

First you need to start WildFly in debug mode with the following command:

standalone.sh --debug --server-config=standalone.xml

Now WildFly starts in the debug mode and listens to the port 8787.

To enable debugging in your Eclipse IDE you now can add a new Debug Configuration:

wildfly_debug_eclipse

This will connect Eclipse to the WildFly Debug port.

Connection refused!

It may happen that – even if you have started glassfish in debug mode and configured all well – you got the following eclipse error message:

Failed to connect to remote VM. Connection refused.

eclipse-debug-02

In this case – it maybe can help if you add a project to the debug configuration. In the screen example above I have let the field ‘Project’ empty. It may help in some cases that you select a project there