Skip to content

Instantly share code, notes, and snippets.

@emmanuelbernard
emmanuelbernard / Simple Rsync backup
Last active August 29, 2015 13:57 — forked from Sanne/Simple Rsync backup
Support remove servers ; add compress and delete to rsync options
#!/bin/sh
# version 20140401
# Backup script using rsync to create multiple snapshots of the source.
# A little known trick of rsync is to be able to run a three-way comparison,
# so to only transfer the diffs but store a full copy in a new directory,
# while comparing and hard linking to the previous snapshot.
# This allows to make many frequent snapshots at minimal network and storage
# impact.
#
# This version doesn't do any form of rotation: you'll eventually run out of space.

The release 5.0.0.Alpha2 is now [available on our shiny new website=>http://hibernate.org/search/downloads/]: as the alpha1 release also did, it integrates with Apache Lucene 4.6.1, but now we do it better ;-)

[brush: xml] <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-search-orm</artifactId> <version>5.0.0.Alpha2</version> </dependency>

CouchDB dialect, enhanced query support and more: Hibernate OGM 4.1.0.Beta1 is out

It's my great pleasure to announce the release of Hibernate OGM 4.1.0.Beta1! This version shines with:

  • a new dialect for CouchDB,
  • support for query execution via JPA,
  • a new option API,
  • and much more including a version bump

But wait, hasn't the last released version been 4.0.0.Beta4? That's true indeed, and in case you were wondering, we did not forget to do a final release of the 4.0 line. The reason for the version bump is that Hibernate OGM is now compatible with JPA 2.1 and Hibernate ORM 4.3. To reflect this we thought it'd be a good idea to jump to a new minor version as well.

@Embeddable
class Address {
...
@Convert(...) private String city;
}
@Entity
@Convert(attributeName="homeAddress.city", disableConversion=true)
class Person {
ConstraintMapping mapping = config.createConstraintMapping();
mapping.type( GreetingService.class )
.method( "greet", User.class )
.returnValue()
.valid()
.convertGroup( Default.class ).to( User.class )
.convertGroup( Foo.class ).to( Bar.class );
//more "fluent" name?
ConstraintMapping mapping = config.createConstraintMapping();

Bean Validation 1.1 Feature Spotlight - Expression Language

It has been a couple of weeks since Bean Validation 1.1 has gone final. In the mean time, the Java EE 7 platform spec has been finalized, so it's about time to have a closer look at what you can expect from this update to the Bean Validation spec and its reference implementation, Hibernate Validator 5. Over the following weeks, we'll discuss the most exciting new features in a series of blog posts, starting today with the usage of expression language in error messages.

One of the lesser known facts about Java EE is that the Unified Expression Language (UEL) can not only be used in JSF or JSP pages, but actually in any application layer. Bean Validation leverages this to support the creation of constraint violation messages in a dynamic manner.

As an example, let's take a look at th

@emmanuelbernard
emmanuelbernard / beep.pl
Last active December 17, 2015 06:58 — forked from anonymous/beep.pl
Do not look for (and expand) message and nick when reacting to DCC sig
#
# Copyright (C) 2006-2012 Sebastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2011 Nils Görs <weechatter@arcor.de>
# Copyright (C) 2011 ArZa <arza@arza.us>
# Copyright (C) 2013 Emmanuel Bernard <code@mel.emmanuelbernard.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
private class Indexer {
public void consumes(Iterator<Tuple> entityTuples) {
while (Tuple tuple = entityTuples.next() != null) {
Entry entry = convertToEntry(tuple);
pushToExecutorQueue(entry);
}
//pushToExecutorQueue, execute method
public execute() {
#!/bin/bash
# Script to loop on local and remote branches, to delete all those which are
# already merged in master.
# Assumes "$USER" as your remote repository and "master" as your main branch.
# Careful if you use branches as tags!
#
# Inspired from http://devblog.springest.com/a-script-to-remove-old-git-branches
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
# Copyright (c) 2012 Sanne Grinovero
# Copyright (c) 2012 Emmanuel Bernard - made remote repo parameterized
@emmanuelbernard
emmanuelbernard / A1_NumberOfNodes_SingleNode.java
Created March 8, 2012 18:22 — forked from gunnarmorling/A1_NumberOfNodes_SingleNode.java
Options for property pathes for method validation
//Option #A1 (currently in draft): Have a single node representing a parameter or return value *and* the hosting method/constructor
//path to @NotNull on the "book" parameter of addBook()
Node(name=book, methodDescriptor=..., parameterDescriptor=..., constructorDescriptor=null)
//path to @NotNull on the "title" attribute of the book passed as argument to addBook()
Node(name=book, methodDescriptor=..., parameterDescriptor=..., constructorDescriptor=null)
Node(name=title, methodDescriptor=null, parameterDescriptor=null, constructorDescriptor=null)
//path to @NotNull on the "title" attribute of the 4th book in the list passed as argument to addAllBooks()