Skip to content

Instantly share code, notes, and snippets.

View jroneil's full-sized avatar

Joseph ONeil jroneil

  • Massachussetts
View GitHub Profile
https://mappingsupport.com/p/gmap4.php?t=t2&label=on&markers=label=on||line=on%20width=2%20color=ff0000%20linesymbol=off%20dash=off||45.535574,-78.706140^Portage%20stor^%3Cem%3EPortage%20stor%3C/em%3E%3Cbr%20/%3E45.535574,-78.706140^default||45.545433,-78.719187^Gilmore%20iland^%3Cem%3EGilmore%20iland%3C/em%3E%3Cbr%20/%3E45.545433,-78.719187^default||45.564695,-78.722105^far%20end%20canoe%20lake^%3Cem%3Efar%20end%20canoe%20lake%3C/em%3E%3Cbr%20/%3E45.564695,-78.722105^default||45.567579,-78.718586^going%20up%20stream^%3Cem%3Egoing%20up%20stream%3C/em%3E%3Cbr%20/%3E45.567579,-78.718586^default||45.572296,-78.719680^portage%20start^canoe%20lake%20to%20joe%20lake^default||45.574128,-78.719315^end%20of%20portage^canoe%20lake%20to%20joe%20lake%20end^default||45.583800,-78.719830^Joe%20Island^%3Cem%3EJoe%20Island%3C/em%3E%3Cbr%20/%3E45.583800,-78.719830^default||45.593321,-78.723650^Teepee%20lake^4.3%20miles^default||45.607373,-78.727384^oxtongue%20river^5.3%20miles^default||45.614638,-78.723907^oxtongue^5.9%20mile
@Override
public String toString() {
StringBuilder result = new StringBuilder();
String newLine = System.getProperty("line.separator");
result.append( this.getClass().getName() );
result.append( " Object {" );
result.append(newLine);
//determine fields declared in this class only (no fields of superclass)
@jroneil
jroneil / Telosys Spring MVC - Spring Data JPA Note
Created May 9, 2017 13:58
Spring MVC - Spring Data JPA When updating to spring-data-rest-webmvc 2.01.RELEASE to 2.6.3.RELEASE and to Hibernate 5 some changes were need
JpaRepositoryConfig class changes
This import line may need to be removes depending on the database
import java.sql.Driver;
ApplicationConfig extends RepositoryRestMvcConfiguration {
This property is no longer available in RepositoryRestMvcConfiguration so make it local to ApplicationConfig to avaoid a lot of changes
private ConfigurableConversionService conversionService;
The setter method needs to change also
OLD
@Override
@jroneil
jroneil / telosys Spring MVC - Spring Data JPA updated POM
Last active May 9, 2017 13:48
Telosys 2.1.1 used and used Hibernate 4 I upgraded to Hibernate 5
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gov.dot.nhtsa.odi</groupId>
<artifactId>commrest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
@jroneil
jroneil / telosys Pom JPA-SPRING MVC
Created May 9, 2017 13:42
Currently telosys2.2.1 uses Spring 3.2.6.RELEASE I modified the pom to use spring 4.3.8.RELEASE
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.oneil.Jod</groupId>
<artifactId>telo</artifactId>
<version>0.1</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
javap -verbose MyClass | findstr "major"
Java 1.2 uses major version 46
Java 1.3 uses major version 47
Java 1.4 uses major version 48
Java 5 uses major version 49
Java 6 uses major version 50
Java 7 uses major version 51
Java 8 uses major version 52
@jroneil
jroneil / ExtractEmbeddedFiles.java
Created November 29, 2016 19:11
Remove PDF Metadata
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@jroneil
jroneil / PDFUtil.java
Created November 29, 2016 19:03 — forked from jribble/PDFUtil.java
Flatten PDF documents using PDFBox
package pdfutil;
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSStream;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDResources;
Transient -The Pojo has been create
Persistent- The object is in a traction following session.save() or session.saveOrUpdate() The object will sycronize and the majic happens
To load and object session.get() session.createCriteria()
Detached-After the transaction is complete to reattach and put in a persistent state you need to session.saveOrUpdate(), a sesssion.update(), or a session.merge()
session.saveOrUpdate(), a sesssion.update() Can cause problems if the objects are out of sync merge will over write the database
Removed after the object has been deleted and it can no longer be used
More that 3 children seem to cause problems with save and update in this case you have to perform the save and update manually rather that letting hibernate
do it automatically
@jroneil
jroneil / ExcelReading.java
Last active November 10, 2016 14:51 — forked from Munawwar/ExcelReading.java
Java - Apache POI - Convert XLS/XLSX to CSV
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;