Skip to content

Instantly share code, notes, and snippets.

public class JsonParser extends Parser {
public JsonParser(Parser successor){
this.setSuccessor(successor);
}
@Override
public void parse(String fileName) {
if ( canHandleFile(fileName, ".json")){
System.out.println("A JSON parser is handling the file: "+fileName);
import java.util.List;
import java.util.ArrayList;
public class ChainOfResponsibilityDemo {
/**
* @param args
*/
public static void main(String[] args) {
public class TextParser extends Parser{
public TextParser(Parser successor){
this.setSuccessor(successor);
}
@Override
public void parse(String fileName) {
if ( canHandleFile(fileName, ".txt")){
System.out.println("A text parser is handling the file: "+fileName);
@echo off
set DIR=%~dp0
set LIB=%DIR%..\lib\*
set BIN=%DIR%..\bin
REM ???
"%JAVA8_HOME%\bin\java" -cp "%LIB%" -Dlog4j.configurationFile="%BIN%\log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter" world-importer-config.json
#!/bin/sh
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bin=${DIR}/../bin
lib=${DIR}/../lib
java \
-cp "${lib}/*" \
-Dlog4j.configurationFile=${bin}/log4j2.xml \
org.xbib.tools.Runner \
{
"type" : "jdbc",
"jdbc" : {
"password" : "******",
"user" : "root",
"url" : "jdbc:mysql://localhost:3306/world",
"sql" : [ {
"statement" : "world.sql"
} ],
@sanaulla123
sanaulla123 / gist:2578499
Created May 2, 2012 17:31
try-with-resources in Project Coin Java 7
import java.io.Closeable;
import java.io.IOException;
/**
* Created by IntelliJ IDEA.
* User: mohamed
* Date: 2/5/12
* Time: 9:24 PM
* To change this template use File | Settings | File Templates.
*/
select
co.Code 'code',
co.name 'name',
co.Continent 'continent',
co.region 'region',
co.SurfaceArea 'surface_area',
co.IndepYear 'year_of_independence',
co.Population 'population',
co.LifeExpectancy 'life_expectancy',
co.GovernmentForm 'government_form',
@sanaulla123
sanaulla123 / world-index.json
Last active November 2, 2017 14:32
Index mapping structure for world index
{
"aliases":{},
"warmers":{},
"mappings": {
"world": {
"properties": {
"capital": {
"properties": {
"district": {
"type": "string"
@sanaulla123
sanaulla123 / CNNImplementation.java
Created March 27, 2012 17:47
CNN Algorithm Implementation for Iris Data set in Java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.net.URL;