Java

Mutually recuresive type variable bounds

Posted on

http://stackoverflow.com/questions/23248103/example-8-1-2-1-of-java-language-specificationmutually-recursive-type-variable http://www.javaadvent.com/2013/12/type-safing-the-observer-with-mutually-recursive-bounds.html A recursive type is a type that uses itself in its definition. The simplest example is the linked list: class List<T> { T value; List<T> next; } Here, List<T> is recursively defined because it uses a List<T> in its own definition. A type variable bound (Foo in <T> extends Foo) is recursive if […]

Java

Apache Shiro

Posted on

https://shiro.apache.org http://meri-stuff.blogspot.ru/2011/03/apache-shiro-part-1-basics.html The following is a reprint from http://meri-stuff.blogspot.ru Apache Shiro, originally called JSecurity, is Java security framework. It was accepted and became Apache top level project in 2010. It aims to be powerful and easy to be used. The project is in active development with active both users and developers mailing lists. Most important areas are […]

Java

Running Spring application in WebLogic

Posted on

http://pauldone.blogspot.ru/2010/02/weblogic-and-spring.html   WebLogic and Spring In this blog topic I describe some of the integration points that WebLogic provides for Spring based applications. I have mixed feelings about Spring. I definitely prefer its primary focus on the Dependency Injection pattern (DI) instead of the more typical JavaEE model of using the Service Locator pattern (think […]

Java

JDBC url format

Posted on

In case of PostgreSQL it is documented here. With JDBC, a database is represented by a URL (Uniform Resource Locator). With PostgreSQL™, this takes one of the following forms: jdbc:postgresql:database jdbc:postgresql://host/database jdbc:postgresql://host:port/database In case of MySQL it is documented here. The general format for a JDBC URL for connecting to a MySQL server is as […]

Java

Functional data structures In Java

Posted on

Also known as purely functional data structures, these are immutable and persistent. The methods of functional data structures are referential transparent. A persistent data structure does preserve the previous version of itself when being modified and is therefore effectively immutable. Fully persistent data structures allow both updates and queries on any version. Many operations perform […]

Java

Integrating Java and JavaScript

Posted on

JSweet – transpiler from Java to JavaScript/TypeScript http://www.jsweet.org DukeScript runs Java VM inside of a browser with JavaScript support https://dukescript.com

Java

Cipher suites in Java SE

Posted on

http://www.techstacks.com/howto/j2se5_ssl_cipher_strength.html HOWTO: Distinguish the Good SSL Ciphers from the Bad in J2SE5 One of the things I am always forgetting with SSL in Java is the relationship between the names of the ssl ciphers and whether or not any particular cipher is weak, medium, strong, etc.  The tables below have been set up to provide […]

Java

How to check isolation level in hibernate session

Posted on

import java.sql.Connection; import java.sql.SQLException; import javax.persistence.EntityManager; import javax.persistence.FlushModeType; import javax.persistence.LockModeType; import javax.persistence.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.jdbc.Work; import static org.junit.Assert.assertTrue; import org.junit.Test;   public class TestIsolation { @Test public void testIsolationLevel() { Connection cc = null; Session session = null; Transaction txn = null; EntityManager entityManager = entityManagerFactory.createEntityManager(); […]

Java

Spring contexts

Posted on

Web Application context extended Application Context which is designed to work with the standard javax.servlet.ServletContext so it’s able to communicate with the container. public interface WebApplicationContext extends ApplicationContext { ServletContext getServletContext(); } Beans, instantiated in WebApplicationContext will also be able to use ServletContext if they implement ServletContextAware interface package org.springframework.web.context; public interface ServletContextAware extends Aware […]

Java

Basic map-filter-reduce pattern

Posted on

??? JDK 7 way public interface Mapper<T, V> { public V map(T t) ; } public interface Predicate<T> { public boolean filter(T t) ; } public interface Reducer<T> { public T reduce(T t1, T t2) ; } List<Person> persons = … ; int sum = persons.map( new Mapper<Person, Integer>() { public Integer map(Person p) { […]