Skip to content

Instantly share code, notes, and snippets.

@virgium03
virgium03 / applicationContext.xml
Created April 10, 2013 11:43
How to enable JPA 2.0 on Weblogic 10.3 - add the following in the Spring applicationContext.xml configuration file - create a Maven EAR module with the pom.xml below - create an weblogic-application.xml file that allows us to load the JPA 2.0 and Hibernate classes from our app and not from Weblogic - put the weblogic-application.xml inside src/m…
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven mode="aspectj"
transaction-manager="transactionManager" />
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="persistenceUnit" />
<property name="dataSource" ref="dataSource" />
@virgium03
virgium03 / IsIterableInSameOrder
Created October 11, 2012 12:05
Matcher that tells us if a given iterable has the elements in the same order as the one it is compared to.
import static org.hamcrest.CoreMatchers.equalTo;
import java.util.List;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
import org.hamcrest.collection.IsIterableContainingInOrder;
import com.google.common.collect.Lists;
@virgium03
virgium03 / IterableHasItemWithPropertyAndValue
Created October 11, 2012 09:48
Check if an {@link Iterable} has one item with a given property name and property value.
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.hasProperty;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
/**
* Matcher that checks if an {@link Iterable} has one item with a given property
@virgium03
virgium03 / FixSubtitles.java
Last active November 18, 2015 21:24
Replace non ASCII characters from Romanian subtitle files with their counterparts
package org.vigi;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;