Monday, August 16, 2010

i118n

Am i the only one who finds himself writing "i118n" instead of "i18n" constantly? :)

Wednesday, July 7, 2010

Date format in Oracle SQL Developer

I know, i know... Oracle SQL Developer really sucks :) I think i got used to it, though...
Anyway, here is the line to set custom, detailed date format for a session:
alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
Uff, it took me quite a while to figure it out.

Thursday, April 22, 2010

Java "user.home" property

I was working on a Grails project, and noticed very poor perfomance of resolving the dependencies - no less than 5 seconds. My colleagues got this phase working at least 5 times faster!
After little investigation i've found out that problem was with Java "user.home" system property, pointing to the network path.
This situation causes even more troubles, as all the apps which use Java "user.home" create their ".something/" in the path, specified by this property. And after that they all work very slow because of network latency.
I've found a fix here:
http://stackoverflow.com/questions/2134338/java-user-home-is-being-set-to-userprofile-and-not-being-resolved
Basically, altering
CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop
value to  
%userprofile%\Desktop 
solved the problem.
Cool!

Monday, February 15, 2010

Clean code

I highly recommend this book to every software developer. Written in simple language, a lot of examples, very valuable insights.
Here is the mind map of the presentation, which i've done for my colleagues:
http://www.pdfhost.net/index.php?Action=DownloadFile&id=ecb41cfc27d3f05578a63d715fc9ec96

I cannot include presentation itself, as it contains company source code examples :/

Tuesday, November 3, 2009

Bye Bye Linux

Ok, i cannot handle it anymore... It just takes too much time and effort to make some specific things working correctly!
I believe it is cool system, but not for software development using latest technologies like GWT.
I am switching back to Windows. I will miss Ubuntu and bash... Especially bash!

Thursday, September 17, 2009

Hibernate, versioning and DRY

Recently i was working on a project, where we were using "tracked" objects. This is a kind of versioning mechanism, implemented on DB level using triggers.

When i was starting to implement tracked objects in Hibernate, i've noticed that there are few properties that every tracked object has:
  • T_PK - primary key in table with versions
  • T_START - starting moment for transcation
  • T_END - end moment for transcation
The idea was to add this stuff to some other Hibernate entity to not have it duplicated in every mapping file. I remembered that <class> element could have "abstract" attribute set to true, so i can just extend it and be cool. Not really :)

There are four types of inheritance relation used in Hibernate, well-described here:
http://simsonlive.wordpress.com/2008/03/09/how-inheritance-works-in-hibernate/
http://javavibes.wordpress.com/2009/06/22/hibernate-inheritance/
  1. One table per concrete class
    That sounded good at first glance, but it allows the reusing only on java side, and i don't care about it too much because it is auto generated.
  2. One table per concrete class with union-subclass mapping
    In this case all versed objects should be a <union-subclass>, plus they have to be in one hibernate mapping file with the parent class.
    Not sure if it is ok... It may produce what i want, but i have all the versed objects in one place. This option is supposed to be used for polymorphic queries, and i want to just have all the fields in one place.
  3. One table per class hierarchy
    It is just not suitable at all, we have a bunch of tables instead of one.
  4. Implicit polymorphism
    Again, not suitable because java objects are generated.
After i took a look into the possibility of using one aggregated object for versioning
http://docs.jboss.org/hibernate/stable/core/reference/en/html/components.html 
Got a few problems here also:
  • ID couldn't be a part of aggregated object
  • It is copy-pasting too
  • hbm2java produces strange things when component is in place (maybe i was doing something wrong, i haven't dig deep there)
Then i searched the Hibernate forum for topics about simple reusing of mappings, and i've found something interesting:
Turns out copy-pasting all these versioning information is the best way to do things? Looks like this.

Friday, August 28, 2009

VMware player - the ultimate hotkey destroyer

I've encountered very annoying issue while using VMware player - all my Linux hotkeys were suddenly dropped out when vmplayer was launched. I couldn't even open a new tab in Firefox until i execute setxkbmap command.
After searching on google and investigating different options for virtual machine i've found combination that particially solved problem.
<Win XP>.vmx file
  • isolation.tools.dnd.disable = "TRUE"
  • isolation.tools.copy.disable = "TRUE"
  • isolation.tools.paste.disable = "TRUE"
  • mks.keyboardFilter = "off"
Now it seems to work... but i cannot copy from host OS to hosted OS, which is kind of a pity :)