Resource Bundles

Resource Bundles allows you to create localized multi language supported applications for each locale. The abstract class “java.util.ResourceBundle” offers such locale-specific resources. The abstract class is sub classed by “PropertyResourceBundle” and “ListResourceBundle”. Each of these classes have their own implementations in a application which I’ll show some examples how to. However, there are some important

FileVisitor Interface Sample

In this sample file visitor interface you can list all the folders and their regarding files   import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MyFileVisitor implements FileVisitor<Path> { private Map<String, List<String>> data = new HashMap<>(); private Map<String, IOException>

HSQL In-memory database hibernate maven config example

maven dependency <properties> <!– PROJECT DEPENDENCIES BEGIN –> <hsqldb.version>2.3.4</hsqldb.version> <!– PROJECT DEPENDENCIES END –> </properties> <dependencies> <dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>${hsqldb.version}</version> </dependency> </dependencies> hibernate configuration <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.archive.autodetection">class,hbm</property> <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property> <property name="hibernate.connection.username">sa</property> <property name="hibernate.connection.password">1</property> <property name="hibernate.connection.url">jdbc:hsqldb:mem:testdb</property> <property name="hibernate.hbm2ddl.auto">create</property> <mapping class="de.gameduell.entity.User"

The strictfp keyword in java

Today while I was preparing for OCP, I’ve come to meet a new non access modifier keyword called strictfp. Simply the keyword Strictfp ensures that you retrieve the same results of the floating point calculations on every platform X86 or AMD64. in case of not utilizing the keyword strictfp, the JVM implementation you use will result in using extra precision where

JSF a closable div

In this sample I’ve achieved one of demanded tasks at work regarding a closable mobile app pane, when the site is visited on mobile devices This is a good example also to study how to pass and set values in the backbean. Because we know what JSF is more of action based although there are

Forward Referencing

Today while I was studying for OCJP certification, I’ve learnt something new called Forward Referencing which yields to assigning a variable before defining it. So such below code will compile and work successfully public class ForwardReferencingExample { static { count = 2; } { count = 1; } public static int count; public static void main(String[]

Java ordinary object pointer OOP

I’ve come to find out this topic when I was watching a useful documentary about java fundamentals.  So the topic took my attention, and I’ve read some blogs regarding. It’s simply when you launch a 32 bit of jdk instance, defined variables will have such headers that will allocate some space in the memory, let’s assume