MySQL query logging on Windows 7

I just spent 30 minutes on a seemingly trivial task. I wanted to see what the JPA is doing to my database so I decided to turn on mysql query logging. It should be simple three step operation:

  • Edit my.ini
  • add “log=query.log”.
  • restart Mysql

Tried it, did not work. I tried to put the my.ini file to all directories that MySQL is suposed to look into (c:\, c:\windows\, install dir). Nothing worked. Finally I checked the MySQL service startup commands and to my surprise there was

–defaults-file=”C:\ProgramData\MySQL\MySQL Server 5.5\my.ini”

I used standard MySQL installation for Windows, installed it as a service so I really do not understand that this is not mentioned in manual. Or I can not read. Anyway after I edited this file and put the “log=query.log” under [mysqld] group, restarted the server and finally the log was created in

c:\ProgramData\MySQL\MySQL Server 5.5\data\query.log

Heureka.

How to enable JPA 2.0 on Weblogic

I am experimenting with JPA 2.0 using eclipselink. When I tried to call my webservice, weblogic thrown a nasty error reporting “unknown method” when trying to call EntityManager method.

Well I asked google … it seems that Weblogic is shipped with JPA 1.0 by default. The official doccumentation on weblogic is confusing and provides code which is too complicated for what it really does. All you really to do is modify startWebLogic.cmd file:

c:\Oracle\Middleware\user_projects\domains\base_domain\bin\startWebLogic.cmd

and add to beginning:

SET wls_modules=c:\Oracle\Middleware\modules\
set PRE_CLASSPATH=%wls_modules%javax.persistence_1.0.0.0_2-0-0.jar;%wls_modules%com.oracle.jpa2support_1.0.0.0_2-0.jar
echo PRE_CLASSPATH=%PRE_CLASSPATH%

Be sure to use your paths. Restart weblogic and you are good to go.

Force eclipse to open xml when editing maven pom

Have you ever been annoyed by the fact that every time you try to edit maven pom in eclipse, it opens a GUI window? Not only the GUI is not much ussefull, but also it slows the loading of the pom quite a bit. Luckily it can be turned off.

Hint found here. Go to preferences > Maven > User Interface there is a check box for “Open XML page in the POM editor by default”. Uncheck it.

Eclipse key bindings

First thing first … Eclipse key shortcuts setup. You can not work with Eclipse effectively unless you know and use them. So To remap/investigate key bindings go to Window > Preferences > General > Keys. Remember, you need to first click unbind command before setting new key!! Otherwise your changes will be ignored. If there is a conflict, it will be shown in Conflict window. So here is my essential list of shortcuts:

Continue reading “Eclipse key bindings”

WordPress installation and setup

Finally kicked myself to set up my new website. I have a need to write. What about? Mostly about software development. Have just started in an unnamed company working with Java, J2EE, Weblogic, Maven, Oracle and all that jazz. The J2EE world seems very confusing to me. So many things are hidden behind annotations, conventions or just pure bullshit. So I’m experiencing lots of “heureka” moments which I would love to share.

So the wordpress is up and running. Theme istalled (used stardust) theme, image upload is working. Had to bypass the safe-mode on my hosting. Done that by defining the temp directory in wp-config.php (see below) and creating the wp-tmp dir with correct rights.

if ( !defined('WP_TEMP_DIR') )
  define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-tmp/');

Next I had to install code highlighter plugin. Result is seen in prev snippet :). It can be downloaded from here.

Thats it. Now to actually write something useful.