Thursday, November 8, 2012

Where i am starting from

So, the weight ins will be registered every morning at around 7 a.m. I normally get up at this time, hence it is natural to claim the scales at this stage of the day. It is also important to do it at the same time daily.
Occasionally of course weight in might occur later for example over the weekends. Today's weight is 117.3 which is slightly higher than i expected. But we will deal with it later.

Wednesday, November 7, 2012

Loosing wait. Again?

And here comes a realisation that something must be done with my growing weight. It took me good two and a half years to loose 55 kg back in 2008 but since my weight is constantly growing. I can keep it at the same level most of the time, but each trip anywhere in the world, whether this is a holiday or business trip, costs me few kgs.
So, here is the deal: starting from today i am coming back to the program that helped me back in 2008.
The main principles of the program are as follows:
  - carbs and fat or proteins should not be mixed in one meal;
  - no bad carbs should be consumed, i.e. no sugar, sweets, pasta, bread etc.
  - overall calories consumption should be kept in the region of 1500 a day;
  - no stimulants like caffeine or alcohol;
Obviously, it is unlikely that the last point can be followed in 100% of the cases but stimulants must be minimized.
And exercising is a key. Let's see how it goes.

I will keep this diary in case i need information in the future. As i do not believe it is the last time i am loosing the weight.

Thursday, September 13, 2012

How to check out a project from SVN repository ignoring some directories

I recently was working on the project with number of directories that were not used to build the project but were quite large in size. The obvious choice to ignore them on the checkout, however it is not that easily achievable using SVN.
So, here is a remedy (step-by-step guide):

  1. Identify names of directories that should be omitted from the checkout.
  2. Start general checkout of the branch: svn co <branch URL> <directory name>
  3. Interrupt checkout as soon as it creates directory (directories) that should be omitted.
  4. Delete directory that should be omitted from the disk.
  5. Run svn cleanup
  6. Do a checkout of the directory to be omitted specifying empty depth: svn co <branch URL>/directory --depth empty
  7. Do this for each directory that should be omitted. Note, that these directories could be situated at any level in the source tree, but the checkout with the empty depth should be done then from the directory that holds the one that should be omitted.
On the very large project it might make sense to do it iteratively, by running the updates and interrupting it immediately after the directory in question is created either by checkout or by update.

Wednesday, September 12, 2012

Magic of the disappearing hibernate session

In the past couple of years we came across a bizarre error on the number of occasions linked to the Hibernate session becoming not available to the thread.
It usually manifests itself with the following exception:

org.springframework.transaction.support.TransactionSynchronizationUtils - TransactionSynchronization.beforeCompletion threw exception
java.lang.IllegalStateException: No value for key [org.hibernate.impl.SessionFactoryImpl@2ea60563] bound to thread [WorkManager(2)-7]


However, from time to time it shows the different message with the similar message which reads that Hibernate session is not available to the current thread.

After some investigation it appears that it is highly likely that this exception occurs when the particular combination of the frameworks involved into the application. We observed it in the J2EE project that is built using combination of Hibernate and Spring running on JBoss 5.1 application server where transaction management is delegated to the JBoss.

It seems that Spring by default wraps the Hibernate's SessionFactory implementation into its own transactional version attached to Spring's transaction support. Since we delegated transaction management to JBoss Hibernate Session will not be bound to the Spring's transaction manager. But Spring's SessionFactoryUtil checks if it is bound to Spring's transaction manager and reports the error if it does not unless it is instructed not to do so.

In order to instruct Spring to ignore the fact that Hibernate session is not bound to the Spring's transaction support the following property should be added to the definition of the Hibernate Session Factory:

<property name="exposeTransactionAwareSessionFactory" value="false"/>

Note that this property makes sense only in case of JTA transaction manager involved and not required when local transaction manager is used.

Back to the future

It is two years since i have abandoned my own blog where i mostly wrote the solution to the technical problems that were encountered across various projects. Since, the old blog does only exist in the archives i need to move old articles here at some stage as it had proven before to be fairly useful at least for myself. Quite possible it might help the others in their quest as we seem to be making similar mistakes.