Le blog de pingou

To content | To menu | To search

Tag - Astuces

Entries feed - Comments feed

Tuesday, September 18 2012

Align text in python CLI

source.png

A small reminder on how to align text in python

Continue reading...

Monday, June 18 2012

Java JPA and rollback on MySQL

source.png

We (b8e5n and I) have been fighting for too long for this, so there it is dear lazy web.

Using the eclipse JPA (Java Persistence API) to connect to a MySQL database you might experienced some troubles.

Using the following piece of code:

transaction = manager.getTransaction();
transaction.begin();
try {
     // Add here your logic
     transaction.commit();
} finally {
     if (transaction.isActive()) {
           transaction.rollback();
     }
}

We kept running into the fact that the rollback never happened. The commit was performed or at least started and if something was going wrong at the database level (like an already existing primary key), the data already commited to the database would remain in there.

So yay for the half-commited data :-s

It took us a while but we finally ended up finding the solution on a lost corner of the web:

** Please take special note for MySQL database users: do make sure that your tables are InnoDB tables instead of MyISAM. If not, rollback will not occur.

Switching from MyISAM to InnoDB solved the problem for us, the transaction is either fully commited or not at all.

Hope this can help.

Tuesday, March 13 2012

Python notes to self

source.png

Small python optimization that I should really follow

Continue reading...

Friday, August 19 2011

Parrallel programming in python

source.png

A small example on basic parallel programming in python

Continue reading...

La programmation parallèle avec python

source.png

Un petit exemple basique de programmation parrallèle avec python

Continue reading...

Wednesday, August 17 2011

New repoquery

rpm.png

The new version of repoquery can do nice things.

Continue reading...

Une nouvelle version de repoquery

rpm.png

La nouvelle version de repoquery permet de faire des choses amusantes.

Continue reading...

Monday, January 31 2011

A simple pygtk R console

source.png

A simple pygtk R console with callback

Une petite interface en pygtk pour R avec affichage des sorties de R dans la fenêtre

Continue reading...

Sunday, April 25 2010

Trackpoint and mouse wheel on Fedora 13

How to configure your trackpoint to emulate mouse wheel on Fedora 13

Comment configurer le troisième bouton de votre trackpoint pour émuler la roulette de la souris sous Fedora 13

Continue reading...

Friday, September 11 2009

Trackpoint et molette de souris

Configurer un trackpoint pour remplacer la molette de la souris

Configure a trackpoint to emulate a mouse wheel

Continue reading...

Saturday, July 25 2009

Chiffrer sa clé usb sous Fedora

How to encrypt an usb key under Fedora

Comment chiffrer sa clé usb sous Fedora

Continue reading...

Saturday, January 5 2008

Regrouper des images

A small trick to merge pictures

Une petite astuce pour regrouper des images en un fichier

Continue reading...