Skip to content

Instantly share code, notes, and snippets.

@nhojpatrick
nhojpatrick / xyzThere
Created July 21, 2016 20:22
xyzThere
public boolean xyzThere(final String input) {
if (input == null
|| "".equals(input.trim())) {
return false;
}
if (input.contains(".xyz")
&& input.contains("xyz")) {
return false;
public class ArrayTest {
public static void main(final String[] args) {
final int D1 = 5;
final int D2 = 4;
int[][] table = new int[D1][D2];
for (int i = 0; i < table.length; i++) {
for (int j = 0; j < table[i].length; j++) {
if (i == j) {
table[i][j] = 1;
} else {
@nhojpatrick
nhojpatrick / SessionCheckFilter.java
Last active April 30, 2016 11:14
SessionCheckFilter
package tld.example.groupid;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.NotSerializableException;
import java.io.ObjectOutputStream;
import java.util.Enumeration;
import javax.servlet.Filter;
@nhojpatrick
nhojpatrick / TikaDetectTester.java
Created January 18, 2016 16:15
TikaDetectTester for tika user mailing list
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.apache.tika.config.TikaConfig;
import org.apache.tika.detect.Detector;
import org.apache.tika.io.TikaInputStream;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.mime.MediaType;
@nhojpatrick
nhojpatrick / all-build.log
Created March 13, 2014 08:58
vagrant-maven-plugin integration build.log failures
Running selector script: /Users/john/projects/nhojpatrick/github.com/vagrant-maven-plugin/target/it/projects/all/selector.bsh
Finished selector script: /Users/john/projects/nhojpatrick/github.com/vagrant-maven-plugin/target/it/projects/all/selector.bsh
Running pre-build script: /Users/john/projects/nhojpatrick/github.com/vagrant-maven-plugin/target/it/projects/all/prebuild.groovy
Finished pre-build script: /Users/john/projects/nhojpatrick/github.com/vagrant-maven-plugin/target/it/projects/all/prebuild.groovy
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building all 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
@nhojpatrick
nhojpatrick / HelloWorldTest.java
Last active August 29, 2015 13:56
struts2 issue
package tld.example;
import org.apache.struts2.StrutsTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
@RunWith(BlockJUnit4ClassRunner.class)
@nhojpatrick
nhojpatrick / XUACompatibleInterceptor.java
Created December 11, 2013 15:37
XUACompatibleInterceptor
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletResponse;
import com.rbsg.bizmon.core.constants.GUIConstants;
import org.apache.struts2.StrutsStatics;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
@nhojpatrick
nhojpatrick / IfElseNoBrackets.java
Created November 15, 2013 11:08
if without brackets testing else
public class IfElseNoBrackets {
public static void main(String[] args) {
System.out.println(test(10));
}
public static String test(int a) {
if(a%2 == 0)
return "even";
else
return "odd";
}
@nhojpatrick
nhojpatrick / playdeb.sh
Last active December 25, 2015 21:39 — forked from stefanbirkner/playdeb.sh
Update to work for play 1.2.3 and 1.2.5.3. Fix debian/rules executable warning message. Fix verbose unzip.
#!/bin/bash
# playdeb builds a debian package of the play framework. playdeb downloads
# the playframework by itself. You run it by
# playdeb.sh <version> <maintainer>
# Example:
# playdeb.sh 1.2.3 "Denny Colt <[email protected]>"
#
# The script has been tested with version 1.2.3, 1.2.5.3.
if [ -z $1 ]
@nhojpatrick
nhojpatrick / console.log
Created May 10, 2012 13:11
Axis2-j merge import and element
loki:merge-schema-import-plus-element john$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building axis2-j-merge-schema-import-plus-element 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ axis2-j-merge-schema-import-plus-element ---
[INFO] Deleting /Users/john/projects/tmp/axis2-j/merge-schema-import-plus-element/target
[INFO]