Montag, 15. April 2013

Parent-aware unidirectional @OneToMany relationship in Hibernate/JPA

In a classical unidirectional one-to-many relation, the referred entity (Call) is not aware of its parent (Bill).
public class Bill { (...) @OneToMany( fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "billId") private Set calls; (...) }
Though, there may be some cases, where it is reasonable to make the information of the relation also available in the child entity (again, Call), e.g. if you want to retrieve all Calls of a specific Bill. An easy way to achieve that, is to explicetily add a @JoinColumn to the child entity. This column is completely managed by JPA/Hibernate, hence not modifieable.
public class Call { (...) @Column( insertable = false, updatable = false ) private Long billId; (...) }
This solution expects, that Id column of Bill is of type long. Use orphanRemoval=true, to force removal of not associated childs.

Samstag, 13. April 2013

Video lectures about machine learning

Some really good videos of an indian university, in the field of machine learning

Freitag, 5. April 2013

mutlitail - scrolback and pause features

The two probably most important features in multitail (via pantz.org).

Pause

To pause all the logs press the "p" key.

Scroll back

To use the log windows scroll back feature press the "b" key and select the log you want to scroll back through.
Maybe you will need those commandline options
-mb x Set scrollback buffer size (in bytes, use xKB/MB/GB). -M nlines Set the buffersize on ALL following files.

glogg - GUI-based log highlighting

Days ago, I mentioned a console based highlight tool multitail, today I want to suggest the GUI-based tool glogg. Glogg could be an *NIX alternative to the Windows flagship BareTail.
$ sudo apt-get install glogg

Montag, 1. April 2013

Apache2 file permissions

Directories
find /var/www -type d -exec chmod 0775 {} +
Files
find /var/www -type f -exec chmod 0664 {} +

Freitag, 29. März 2013

Terminator - multiple terminals in one window

Terminator is a handsome python implementation of a terminal emulator, that supports tiling, which is awesome. This means, several terminals are arranged in one window

Dienstag, 26. März 2013

Multitail: Log output highlighting in terminal

Multitail is a command line tool primarily used to merge several log files. It is also capable of highlighting the output from one or more log files. In Ubuntu, you simply create or extend your multitail configuration in your home.
vi ~/.multitailrc
and define there your custom color scheme named yourcolorscheme
colorscheme:yourcolorscheme cs_re:red,,bold:.*ERROR.* cs_re:green:INFO
When invoking multitail command, provide the designated color scheme (-cS) you want to use.
multitail -cS yourcolorscheme -f logs/server.log
Thanks to Gilles for the input.