Skip to content

Instantly share code, notes, and snippets.

@tfnico
tfnico / error.txt
Created April 24, 2014 06:32
GET on entity fails in spring-data-rest-2.0.0.RELEASE
# this is the error using spring-rest-data-2.0.0.RELEASE
# It worked fine in 2.0.0.M1
# I believe it's caused by https://jira.spring.io/browse/DATAREST-253 (but not sure)
2014-04-23 17:01:22,385 [main] INFO ServerConnector - Started ServerConnector@6f0e15e9{HTTP/1.1}{0.0.0.0:8000}
2014-04-23 17:02:34,801 [qtp186591455-21] TRACE HandlerMethod - Invoking [listEntities] method with arguments [org.springframework.data.rest.webmvc.RootResourceInformation@7bd766d, Page request [number: 0, size 20, sort: null], null]
2014-04-23 17:02:35,007 [qtp186591455-21] TRACE HandlerMethod - Method [listEntities] returned [PagedResource { content: [Resource { content: PlannedWorkload{id='142', processingDate=Thu Aug 22 13:46:11 CEST 2013}, links: [<http://127.0.0.1:8000/api/plannedWorkload/142>;rel="self"] }, Resource { content: PlannedWorkload{id='144', processingDate=Thu Aug 22 13:46:11 CEST 2013}, links: [<http://127.0.0.1:8000/api/plannedWorkload/144>;rel="self"] }, Resource { content: PlannedWorkload{id='146', processing
@tfnico
tfnico / error.txt
Created April 24, 2014 06:34
GET on entity fails in spring-data-rest-2.0.1.RELEASE (same in 2.0.2)
# after upgrading to spring-data-rest-2.0.1-RELEASE
2014-04-23 17:23:45,078 [qtp595100226-20] TRACE HandlerMethod - Invoking [listEntities] method with arguments [org.springframework.data.rest.webmvc.RootResourceInformation@3383d20e, Page request [number: 0, size 20, sort: null], null]
2014-04-23 17:23:45,279 [qtp595100226-20] TRACE HandlerMethod - Method [listEntities] returned [PagedResource { content: [Resource { content: PlannedWorkload{id='142', processingDate=Thu Aug 22 13:46:11 CEST 2013}, links: [<http://127.0.0.1:8000/api/plannedWorkload/142>;rel="self"] }, Resource { content: PlannedWorkload{id='144', processingDate=Thu Aug 22 13:46:11 CEST 2013}, links: [<http://127.0.0.1:8000/api/plannedWorkload/144>;rel="self"] }, Resource { content: PlannedWorkload{id='146', processingDate=Thu Aug 22 13:46:11 CEST 2013}, links: [<http://127.0.0.1:8000/api/plannedWorkload/146>;rel="self"] }, Resource { content: PlannedWorkload{id='148', processingDate=Thu Aug 22 13:46:11 CEST 2013}, links: [<http://127.0.0.1:800
@tfnico
tfnico / spring-rest-data-problems.md
Last active August 29, 2015 14:00
Having some problems with upgrading spring-rest-data

In the latest release of spring-rest-data (2.0.2), calling the root "descriptor" (/api/) works fine , but calling a GET on any entity (/api/plannedWorkloads) fails with an exception.

It works fine when using spring-rest-data-2.0.0.M1.

When switching to spring-rest-data-2.0.0.RELEASE: https://gist.github.com/tfnico/11243724

When switching tp spring-rest-data-2.0.1.RELEASE: https://gist.github.com/tfnico/11243762

Switching to spring-rest-data-2.0.2.RELEASE gives the same error as in 2.0.1.

@tfnico
tfnico / gist:5fd2dfea556d9a357a55
Created August 26, 2014 09:03
Set JAVA_HOME to whatever jenv says it is on OS X
#In my .zshrc:
#...
# Normal jenv config
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
# Now find the JAVA_HOME for it:
jenv_java=$(jenv global) # yields 'oracle64-1.6.0.54'
echo $jenv_java
jenv_java_without_oracle=${jenv_java#*oracle64-} # yields '1.6.0.54'
@tfnico
tfnico / keybase.md
Created September 24, 2014 08:10
Keybase proof

Keybase proof

I hereby claim:

  • I am tfnico on github.
  • I am tfnico (https://keybase.io/tfnico) on keybase.
  • I have a public key whose fingerprint is A72F 92D5 4452 28CA 05C5 F7DE 8B57 C065 E149 47C7

To claim this, I am signing this object:

@tfnico
tfnico / README.md
Last active August 29, 2015 14:11
Building and pushing docker images to GiantSwarm from your existing jenkins
  • Create a server to work as a Jenkins slave (implying you have an existing Jenkins) on DigitalOcean or whatever you use for getting servers up and running.
  • Install Ubuntu on it, and Java for running the Jenkins slave (current openjdk 7 should work)
  • Create a jenkins user, add a authorized_key that the Jenkins master can use for SSHing to it (see Jenkins docs for more info)
  • Install the latest docker (see Docker docs for info)
  • Add user jenkins to the docker group
  • Do sudo su jenkins, and (with your username/password)
    docker login https://registry.giantswarm.io
@tfnico
tfnico / gist:49b420562d886b693ce5
Created January 30, 2015 16:50
gradle-application-plugin launch script
#!/usr/bin/env bash
##############################################################################
##
## start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and APP_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Djava.util.logging.config.file=./etc/log.conf" "-Ddatabase.storage.hostname=some-titan"'
@tfnico
tfnico / fastbuild-pom.xml
Created January 14, 2011 22:12
An alternative pom
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.tfnico.examples</groupId>
<artifactId>foo</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>./pom.xml</relativePath>
</parent>
@tfnico
tfnico / guava-functional.java
Created April 20, 2011 13:20
Solving http://projecteuler.net/index.php?section=problems&id=1 being as functional as possible using Google Guava
static int solution(int limit){
ImmutableSet<Integer> numbers = intRange(1,limit);
return foldInsByAdding(Iterables.filter(numbers, dividableByThreeOrFive()));
}
private static Predicate<Integer> dividableByThreeOrFive(){
return new Predicate<Integer>() {
@Override
public boolean apply(Integer i){
return (i % 3 == 0) || (i % 5 == 0);
@tfnico
tfnico / factorial.weel
Created May 31, 2011 13:28
Weel examples
// Note the tail call optimization!
private func fact_f(n, result)
return n > 0 ? fact_f(n - 1, result * n) : result;
end
func fact(n)
return fact_f(n, 1);
end