Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Glassman aglassman

View GitHub Profile
@aglassman
aglassman / Application.java
Created Jul 19, 2016
Spring Cloud - Zuul - On Servlet 2.5
View Application.java
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Import;
@EnableCircuitBreaker
View thread-dump.txt
Attaching to process ID 419, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.121-b13
Deadlock Detection:
No deadlocks found.
Thread 2387: (state = BLOCKED)
- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
View stacktrace.txt
rg.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not instantiate value of type [simple type, class org.gmjm.logistics.domain.Hub] from String value ('http://localhost:8080/hubs/1044'); no single-String constructor/factory method
at [Source: HttpInputOverHTTP@207155db; line: 2, column: 30] (through reference chain: org.gmjm.logistics.domain.Route["originHub"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class org.gmjm.logistics.domain.Hub] from String value ('http://localhost:8080/hubs/1044'); no single-String constructor/factory method
at [Source: HttpInputOverHTTP@207155db; line: 2, column: 30] (through reference chain: org.gmjm.logistics.domain.Route["originHub"])
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:224) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.http.conver
View ServiceConfiguration.java
package com.example;
import org.h2.server.web.WebServlet;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ServiceConfiguration {
@Bean
View build.gradle
buildscript {
ext {
springBootVersion = '1.3.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
View SpringDataNeo4jDemoApplication.java
package org.gmjm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringDataNeo4jDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringDataNeo4jDemoApplication.class, args);
View DemoNeo4jConfig.java
package org.gmjm;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
@aglassman
aglassman / logFinancialHistory.js
Last active Dec 29, 2015
Some Google Apps Script for logging finances in a Google Spreadsheet.
View logFinancialHistory.js
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@aglassman
aglassman / JavaEightTests.java
Created Oct 7, 2013
This class will run a few simple tests using the new Java 8 features 'lambda expressions' and 'Streams'.
View JavaEightTests.java
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.stream.*;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;
public class JavaEightTests
{
@aglassman
aglassman / pythonchallenge_1-2.py
Created Oct 3, 2013
Python Challenge #1: A not as cool way.
View pythonchallenge_1-2.py
s="g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
o=""
for x in s:
if ord(x)>=ord('a') and ord(x)<=ord('z'):
o+=chr((ord(x)+2-ord('a'))%26+ord('a'))
else:
o+=x
print o
You can’t perform that action at this time.