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) { […]

Java

Batching in Hibernate

Posted on

https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/batch.html https://abramsm.wordpress.com/2008/04/23/hibernate-batch-processing-why-you-may-not-be-using-it-even-if-you-think-you-are/   Most people who use batch probably find out about it by trying to perform a large operation and finding out the hard way why batching is needed. They run out of memory. Once this is resolved they assume that batching is working properly. The problem is that even if you are flushing […]

Java

Logging adapter for WebLogic

Posted on

https://docs.oracle.com/cd/E23943_01/web.1111/e13739/logging_services.htm#WLLOG199 To redirect messages from JDK logging system to WebLogic standard log files we need to add special ServletLoggingHandler. logging.properties: # Specify the handlers to create in the root logger handlers = weblogic.logging.ServerLoggingHandler # Register handlers for the com.foo.toyshop and its child loggers com.foo.toyshop.handlers = java.util.logging.ConsoleHandler, weblogic.logging.ServerLoggingHandler # Do not send the toyshop log messages […]

Java

Java Unsafe

Posted on

http://mishadoff.com/blog/java-magic-part-4-sun-dot-misc-dot-unsafe/   Java Magic. Part 4: sun.misc.Unsafe Java is a safe programming language and prevents programmer from doing a lot of stupid mistakes, most of which based on memory management. But, there is a way to do such mistakes intentionally, using Unsafe class. This article is a quick overview of sun.misc.Unsafe public API and few […]

Java

Mondrian and Pivot4J

Posted on

http://www.drdobbs.com/database/olap4j-online-analytical-processing-for/230800051https://github.com/OSBI/saiku/blob/master/saiku-core/saiku-olap-util/src/main/java/mondrian/olap4j/SaikuMondrianHelper.java