Posts

Showing posts from 2017

Manage Windows Registry from JAVA

import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import java.util.prefs.Preferences; public class WinRegistry {   // inspired by   // http://javabyexample.wisdomplug.com/java-concepts/34-core-java/62-java-registry-wrapper.html   // http://www.snipcode.org/java/1-java/23-java-class-for-accessing-reading-and-writing-from-windows-registry.html   // http://snipplr.com/view/6620/accessing-windows-registry-in-java/   public static final int HKEY_CURRENT_USER = 0x80000001;   public static final int HKEY_LOCAL_MACHINE = 0x80000002;   public static final int REG_SUCCESS = 0;   public static final int REG_NOTFOUND = 2;   public static final int REG_ACCESSDENIED = 5;   private static final int KEY_ALL_ACCESS = 0xf003f;   private static final int KEY_READ = 0x20019;   private static Preferences userRoot = Preferences.userRoot();   private stat

Read Windows Registry from JAVA

// Gets value from property, if it does not exist, gets it     // from Windows registry     private String getValueFromPropertyOrLocalMachineRegistry(Properties props,             String propname, String registryPath, String registrykey) {         String value = props.getProperty(propname);         if ((value == null) || (value.trim().isEmpty())) {             try {                 value = WinRegistry.readString(                         WinRegistry.HKEY_LOCAL_MACHINE,                         registryPath,                         registrykey);             } catch (Exception ex) {                 return value;             }         }         return value;     } ----------------------------------------------------------------------------------------------------------- import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import java.u

JAVA JPA WITH HIBERNATE AND H2 Tutorial

Image
JAVA JPA WITH HIBERNATE AND H2 Tutorial Setting the environment: Download and install H2 Database http://www.h2database.com/html/download.html Create a connection to the database, in my case I am using Netbeans. Creation of a new Database Connection can be done from the Services Tab, Databases node: Have in mind that it is not possible to test the connection before the JDBC URL has been written into. Select the PUBLIC schema when asked. And put a name onto it, I decided to name it as "Hibernate 101 on H2" Download Hibernate http://sourceforge.net/projects/hibernate/files/hibernate3/ JPA with Hibernate: For the shake of portability and standarization we will be using JPA. Natively speaking, Hibernate relies onto a context configuration file -  hibernate.cfg -  and a single or many persistence configuration files  - hibernate.hbm.xml - .  On the other hand JPA configuration is based on just one file:  persistence.xml.  Netbeans offe

A Wonderfully Integrated Native Object Oriented Neural Network API: WINOONNA

Image
WINOONNA on Github: Now that Neural Networks are in fashion (back again) under the fancy name of 'DeepLearning', I am  making the library I developed back in 2011 public. A Wonderfully Integrated Native Object Oriented Neural Network API: WINOONNA https://github.com/sciencetechworks/WINOONNA