01 January 2016

Tuesday, 03.01.2017

Friday, 30.12.2016

Succesfully deployed my first AWS lambda. Actually it was tricky to access it externally via API gateway due to unclear documentation.

Thursday, 22.12.2016

Get the plantuml source back from a PNG
java -jar C:/dev/tools/plantuml.jar -metadata startup.png

Wednesday, 21.12.2016

  • So, coloring output of cargo under cygwin works…​ somehow.

Monday, 05.12.2016

Sunday, 04.12.2016

Sunday, 20.11.2016

  • Interesting thoughts about CDI. have to follow this blog by Laird Nelson.

Saturday, 19.11.2016

  • Watched Testing made sweet with a Mockito

    • Capture method-arguments of mock-method-calls is possible.

    • Avoid creating new objects via "new". hard to test.

    • Avoid static methods. Hard to test.

    • Avoid singletons

    • Isolte non-testable code. E.g. views in MVP

    • Dont use mockito spies. Arggument is that tests might not be isolted if "real logic" is executed.

  • Write custom Mockito matcher. here

  • gradle build can be profiled; report is generated. nice. blog

Friday, 18.11.2016

  • Watched Maven for CDI Devoxx talk. Sources are here. Need to look into it further.

  • Building asciidoc with maven

<profile>
    <id>readme</id>
    <properties>
        <asciidoctor.maven.plugin.version>1.5.3</asciidoctor.maven.plugin.version>
        <asciidoctorj.version>1.5.4</asciidoctorj.version>
        <asciidoctorj.diagram.version>1.3.1</asciidoctorj.diagram.version>
        <jruby.version>1.7.21</jruby.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor.maven.plugin.version}</version>
                <dependencies>
                    <!-- Comment this section to use the default jruby artifact provided by the plugin -->
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby-complete</artifactId>
                        <version>${jruby.version}</version>
                    </dependency>
                    <!-- Comment this section to use the default AsciidoctorJ artifact provided by the plugin -->
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj</artifactId>
                        <version>${asciidoctorj.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-diagram</artifactId>
                        <version>${asciidoctorj.diagram.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <sourceDirectory>.</sourceDirectory>
                            <sourceDocumentName>README.adoc</sourceDocumentName>
                            <backend>html</backend>
                            <attributes>
                                <!--toc>left</toc-->
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <requires>
                        <require>asciidoctor-diagram</require>
                    </requires>
                    <attributes>
                        <!--graphvizdot>C:\dev\tools\graphviz-2.38\bin\dot.exe</graphvizdot-->
                    </attributes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>

Sunday. 13.11.2016

Saturday, 12.11.2016

Tuesday, 08.11.2016

Tuesday, 01.11.2016

  • Watched this talk on the scenebuilder. Learned some neat tricks.

  • Launch mintty from eclipse:

$ cat .metadata/.plugins/org.eclipse.debug.core/.launches/Open\ shell.launch
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="C:\cygwin64\bin\mintty.exe"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-e /bin/xhere /bin/bash.exe &quot;${selected_resource_loc}&quot;"/>
</launchConfiguration>
log4j.properties
log4j.appender.graylog2=org.graylog2.log.GelfAppender
# GELF UPD
log4j.appender.graylog2.graylogHost=192.168.99.100
log4j.appender.graylog2.graylogPort=12201
log4j.appender.graylog2.originHost=loggenerator-server-ip
log4j.appender.graylog2.layout=org.apache.log4j.PatternLayout
log4j.appender.graylog2.additionalFields={'environment': 'DEV', 'application': 'MyAPP'}
log4j.appender.graylog2.extractStacktrace=true
log4j.appender.graylog2.addExtendedInformation=true
log4j.appender.graylog2.facility=gelfappender-test
  • Also works generically for all different loggers: logstash-gelf

pom.xml
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>
<dependency>
    <groupId>org.graylog2</groupId>
    <artifactId>gelfj</artifactId>
    <version>1.1.13</version>
</dependency>

Tuesday, 25.10.2016

  • Great talk on hijacking HTTP sessions. Very enlightening.

    • Prefer cookies over URL rewrite with JSESSIONID

    • web.xml cookie flags: secure & http-only

    • use https

    • validate input to protect against XSS

    • protected against session-fixation by creating new session-id after login

    • protected against crsf by unique token in each request

Saturday, 22.10.2016

  • Watched this great intro to Hystrix from JavaOne. Also has sources on github.

  • Monolith to reactive; great talk explaining fundamental concept based on lagom.

Wednesday, 19.10.2016

Does nbm maven plugin not support to install custom plugins my plugin depends on when i use the nbm:cluster goal? Seems so, need to run this after clean build:

cp /Users/daniel/Library/Application\ Support/NetBeans/8.2/modules/org-netbeans-gradle-project.jar modules/
cp /Users/daniel/Library/Application\ Support/NetBeans/8.2/config/Modules/org-netbeans-gradle-project.xml config/Modules/
cp -R /Users/daniel/Library/Application\ Support/NetBeans/8.2/modules/ext modules/ext

Thursday, 6.10.2016

Tuesday, 4.10.2016

Monday, 3.10.2016

Started going through JavaOne sessions. Watched Ask the architects.

Sunday, 18.09.2016

Watched great Java 8 Lambdas MOOC.

Sunday, 11.09.2016

Started skimming through Javaworld talks. Watched great talk by David Blevins.

Friday, 9.09.2016

Finished watching great microservices talk by arun gupta.

Great talk on eclipse PDE tricks.

  • Plugin-Spy: ALT+SHIFT+F1 to see details of the selected plugin.

  • Plugin Registry to see plugins and extension points. There is also an CTRL+SHIFT+T like dialog.

  • DisplayView for debugging is nice

  • Add plugins to CTRL+SHIFT+T class search via context menu in plugin-view

Sunday, 21.08.2016

Asciidoctor tips. gradle-plugin with continous build feature is great.

Had a first look into jigsaw: here and the official quick starter guide.

Good stuff on vim and tmux.

Thursday, 18.08.2016

Ok, this seems to sum it up quiet nicely what options there are with git to handle CR/LF problems. .gitattributes is the solution. Legacy old way

core.autocrlf = input
core.safecrlf = warn

Two interesting approaches to integration-test large JavaEE applications:

  • 1: Deploy tests next to EAR using wildfly co-deployments. Deploy EAR once and only deploy tests as seperate wars.

  • 2: Deploy prebuilt EAR from Arquillian via file-ref.

I like this even though it is dead simple stuff. But if you have a simple jar to build, sometimes even ant/maven are overkill. Just a two-line shell-script is fine.

javac -cp ./src/main/java ./src/main/java/com/exec/one/*.java -d ./out/
jar cvfm ExecutableOne.jar ./src/main/resources/META-INF/MANIFEST.MF -C ./out/ .

Wednesday, 17.08.2016

Watch vJug talk on bytecode.

Tuesday, 16.08.2016

Read this on JavaEE testing via arquillian and docker. It does not discuss Arquillian Cube but uses testcontainers. There even is a RemoteWebDriver to interact with dockerized selenium-based browser-tests. I have to check this in more detail.

This prior article is also nice to see how easily testcontainers can start a DB from an arquillian test.

Monday, 15.08.2016

Watched Git From the Bits Up. Creating a low-level commit:

git init
echo "only work and no play make..." | git hash-object --stdin -w
git cat-file -p ea5eb97b094197070c5865d5e17e8e63c3ee285d
git update-index --add --cacheinfo 100644 ea5eb97b094197070c5865d5e17e8e63c3ee285d jonny.txt
git write-tree
git cat-file  -p 6b5f7b67962e61c3f0dbe80ac8092713b5f74f2f
git commit-tree 6b5f7b67962e61c3f0dbe80ac8092713b5f74f2f -m "Initial commit"
git cat-file -p 9c0f5e1774d6c4abdad907ba92d4c53d76328fe1
echo 9c0f5e1774d6c4abdad907ba92d4c53d76328fe1 > .git/refs/heads/master
git log
git checkout HEAD -- jonny.txt
git status

Sunday, 14.08.2016

Improved my bash with bookmarks. Loving it. Also, nice talk on Git Mastery.

Saturday, 13.08.2016

Watched this talk on Advanced Git. Checked this for good settings.

Friday, 12.08.2016

Great talk on git data-model here.

Thursday, 11.08.2016

Watched Demistifyng dynamicinvoke by Venkat. Watched nice Advanced Git.

Sunday, 07.08.2016

Finished Continuous Enterprise Development in Java. Great book on Arquillian.

Saturday, 06.08.2016

Iteresting article bu Uber engineers on usage of Postgres and MySQL with insight in technology. Add nice article putting it in perspective.

Friday, 05.08.2016

Nice commandline-utility to track file changes. inotifywait. Works great under cygwin.

Thursday, 04.08.2016

Effective Java Programming Language Guide is still the best. The free chapter on generics should be read by every Java programmer.

  • PECS stands for producer-extends, consumer-super

  • Do not use wildcard types as return types.

  • if a type parameter appears only once in a method declaration, replace it with a wildcard

Nice article for how to use the Java 8 API.

Tuesday, 02.08.2016

Great read on java agents and byte-code-manipulation with byte-buddy.

Monday, 01.08.2016

Interfacing with the wildfly http management interface with authentication enabled:

Authenticator.setDefault(new Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication("username", "password".toCharArray());
    }
});

URL url = new URL("http://localhost:9990/management");

HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
    wr.write("{\"address\":[\"subsystem\",\"naming\"],\"operation\":\"jndi-view\",\"json.pretty\":1}"
            .getBytes());
}

try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
    String inputLine;
    while ((inputLine = in.readLine()) != null) {
        System.out.println(inputLine);
    }
}

Sunday, 31.07.2016

Did some JavaFX hacking.

Saturday, 30.07.2016

  • Check MyClass.class.getClassLoader().getResource(…​) to load class as resource and see wher located.

  • Use javap -private to see class details

  • Use -verbose:class

  • -XX:+HeapDumpOnOutOfMemoryError (use eclipse memory analyzer)

  • javap -c -verbose

  • bitescript: Ruby DSL that looks close to bytecode

Friday, 29.07.2016

  • Continous Delivery: Every build could be a release. Maven has concept of SNAPSHOTs that by itself are not releases. Not reproduceable. Thus, generate releases each time instead of SNAPSHOT.

  • Also slow: You do mvn release:prepare and mvn release:perform seperately. So, two times compile, test, …​ cycle

  • Split up unit- and integration-tests. Run unit tests in test-phase and integration-tests in integration-test phase. Fail fast on unit-tests.

  • Multi-module builds: mvn deploy would deploy first artifact and then might fail on the second. → Do mvn deploy:deploy after all mvn install done.

  • Generate JaCoCo coverage report after integration-test phase

  • dont run mvn site in build because slow. instead e.g. call mvn pmd:check , mvn findbugs:check, mvn checkstyle:checkstyle directly. And fail build on violations.

  • Don’t use mvn release plugin. Does not fit nicely. SNAPSHOTS are not versioned. So, release is needed to push through pipeline. If always release, then maybe blocking the pipeline. If always SNAPSHOT first, it is cluncy because do stuff again for release → Work with SNAPSHOT but give it a version-number/buildnumber as soon as it enters the pipeline. Use mvn versions plugin (mvn versions:set -DnewVersion=1.0.203)

Build only specific reactor project and specific test to execute:

mvn clean install -pl testsuite/standalone/ -Dtest=MyTestClass

Created my jmh benchmark to check on some IO performance. Neat project and nice maven intregration/archetype.

@BenchmarkMode(Mode.AverageTime)
public class FileAccessTest {

	@Benchmark
	public void testFileAccess() {
		//...
	}
}

Thursday, 28.07.2016

Set mem limits and enable GC-log:

-Xms1024m -Xmx1024m -XX:MaxMetaspaceSize=128m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:gc.log

Wednesday, 27.07.2016

So, no idea why, but to make eclipse not behave strange sometimes, setting -vm with JDK path in eclipse.ini (otherwise, JBoss forge was complaining that it could not install arquillian plugin because not able to compile):

-vm
C:\Program Files\Java\jdk1.8.0_71\bin\javaw

Looked into UI-testing with arquillian. Did this tutorial. Also got ref here.

Set up my nexus/sonatype access. Maven stuff described here.

Tuesday, 26.07.2016

Looking into JBoss Forge and integration with Arquillian. Really nice.

By the way, this seems to be the latest adapter to use for wildfly (JBoss Tools use an older one):

<dependency>
  <groupId>org.wildfly.arquillian</groupId>
  <artifactId>wildfly-arquillian-container-remote</artifactId>
  <version>1.1.0.Final</version>
  <scope>test</scope>
</dependency>

Watched Advanced Annotation Processing with JSR 269. Sources here. And more reading here and here.

Got the annotation processor to work in eclipse after manual activation of annoatations jar and setting to batch-mode. But code-completion not yet working.

@SupportedAnnotationTypes({"example.ServiceConfig"})
@SupportedSourceVersion(SourceVersion.RELEASE_8)
public class Processor extends AbstractProcessor {
	@Override
	public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
		for (Element element : roundEnv.getElementsAnnotatedWith(ServiceConfig.class)) {
			processingEnv.getMessager().printMessage(Kind.WARNING, "++Found: " + element.getSimpleName(), null);
		}
		return true;
	}
}

Monday, 25.07.2016

JCA deep-dive for me today. Implemented own small file-JCA-connector based on connectorz. Also found this resource interesting.

Also, watched talk on CQRS.

Saturday, 23.07.2016

Friday, 22.07.2016

Thursday, 21.07.2016

Read up on caching with JPA. Nice summary here: Cache-coordination versus distributed caching, transactional versus non-transactional caches…​

Monday, 18.07.2016

Watched latest airhacks episode. Also read up on serverless architectures. Also, this one adption of the microservice approach.

Sunday, 17.07.2016

Skimmed through some talks today:

Saturday, 16.07.2016

Watched microservices talk. Slides are here.

Especially useful was the part on cascading timeouts: first system has biggest timeout; budget gets small for services upstream.

Friday, 15.07.2016

Forked/checked out jgit and egit. That was some sweat…​

Neat thing from the Developer Notes: Using a .p2f file to import/export required plugins (File/Import/Install/…​). Maybe i don’t need a bash-script :-)

Thursday, 14.07.2016

Provision eclipse plugins from the commandline (cygwin/bash/win7). Here for eclipse neon update-sites:

// download a plugin-zip; as an example how to provision a local zip-file
curl -L -J -O -x http://proxy.wincor-nixdorf.com:81 https://github.com/java-decompiler/jd-eclipse/releases/download/v1.0.0/jd-eclipse-site-1.0.0-RC2.zip

pushd eclipse
EXE=./eclipsec.exe

# Eclemma
ECLEMMA_IU=$($EXE -application org.eclipse.equinox.p2.director -noSplash -repository http://update.eclemma.org -list | grep EclEmma | cut -d= -f1)
echo "Installing ${ECLEMMA_IU}..."
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository http://update.eclemma.org -installIUs ${ECLEMMA_IU}

# Plantuml
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository http://plantuml.sourceforge.net/updatesitejuno/ -installIU net.sourceforge.plantuml

# AspectJ
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository http://download.eclipse.org/tools/ajdt/46/dev/update -installIU org.eclipse.ajdt.feature.group

# Groovy
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository http://dist.springsource.org/snapshot/GRECLIPSE/e4.5 -installIUs org.codehaus.groovy.eclipse.feature.feature.group

# Ivy
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository http://www.apache.org/dist/ant/ivyde/updatesite -installIUs org.apache.ivyde.feature.feature.group
# ivy settings; rootdir und externalibs.props

# Java Decompiler; example for a locally zipped plugin
set +H
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository jar:file:/$(cygpath -m ../jd-eclipse-site-1.0.0-RC2.zip)!/ -installIUs jd.ide.eclipse.feature.feature.group$EXE -application
set -H

JBOSS_UPDATE_SITE="http://download.jboss.org/jbosstools/neon/stable/updates/"

# JBoss Tools - General Tools
GENERAL_TOOLS=$($EXE -application org.eclipse.equinox.p2.director -noSplash -repository ${JBOSS_UPDATE_SITE} -list | grep GeneralTools | cut -d= -f1)
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository ${JBOSS_UPDATE_SITE} -installIUs $GENERAL_TOOLS

# JBoss Tools - Web Tools
WEB_TOOLS=$($EXE -application org.eclipse.equinox.p2.director -noSplash -repository ${JBOSS_UPDATE_SITE} -list | grep WebTools | cut -d= -f1)
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository ${JBOSS_UPDATE_SITE} -installIUs $WEB_TOOLS

# JBoss Tools - Server Adapter
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository ${JBOSS_UPDATE_SITE} -installIUs grep org.eclipse.wst.server.core.serverAdapter

# Forge
$EXE -application org.eclipse.equinox.p2.director -noSplash -repository ${JBOSS_UPDATE_SITE} -installIU org.jboss.tools.forge.feature.feature.group

popd

Wednesday, 13.07.2016

Had to debug an eclipse plugin today but did not want to run a second instance of eclipse for the debugger; so I used jdb. It is a nice tool. Connecting the debugger via shared-memory versus as socket is configured slightly different:

-Xdebug
// shared-memory (windows only)
-agentlib:jdwp=transport=dt_shmem,address=eclipse,server=y,suspend=n
// socket
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999

Then attach via:

// shared-memory (windows only)
jdb -attach eclipse -sourcepath <path>
// socket
jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=9999 -sourcepath <path>

Some nice stuff:

  • trace go methods traces methods on a thread

  • How to connect to a PID or a core-dump.

TODO: Try to look into all the tools listed here.

Tuesday, 12.07.2016

TODO: The handling of proxies with jGit could be improved. Got this info from forums. Will try to fix.

Monday, 11.07.2016

Wireshark comes with a nice commandline-interface called tshark. Detailed in this article. For Windows (7)/cygwin, it was a little bit more than just the line below:

./tshark -i LAN-Verbindung -Y 'http.request.method == "GET"' -T fields -e http.request.method -e http.request.uri -e ip.dst

We also need to make sure the packets go through the whole network-stack of windows as the loopback-interface cannot be sniffed out of the box:

// before
route add <external-ip> <external-gateway-ip>
// after/cleanup
route delete <external-ip>

Details are described in this post.

Saturday, 09.07.2016

Did vert.x introductory tutorial. Very well written.

Friday, 08.07.2016

Nice overview on what spring has to offer for microservices.

Thursday, 07.07.2016

Read this articel on the shades of the CAP theorem.

Wednesday, 06.07.2016

Watched Nine "Neins" on Java EE future. Interesting talk on what Java EE8+ should maybe adress…​

Monday, 04.07.2016

Getting cargo-tracker to run on wildfly 10.

Default datasources in Java EE 7. But need to 'enable_lazy_load_no_trans':

<persistence-unit name="CargoTrackerUnit" transaction-type="JTA">
	<properties>
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.format_sql" value="true" />
        <property name="hibernate.enable_lazy_load_no_trans" value="true" />
        <property name="hibernate.transaction.flush_before_completion" value="true" />
        <property name="javax.persistence.schema-generation.database.action" value="create"/>
	</properties>
</persistence-unit>

Sunday, 03.07.2016

JCA offers:

  • Connection Management

  • Transaction Management: participate in a JTA transaction

  • Security

  • Lifecycle

  • Workload Management (hand of work to app-server threads. think runnable.)

Presented sources for inbound connector here. More inbound connectors from tomitribe.io.

Outbound examples from link:http://connectorz.adam-bien.com.

  • Metrics via CDI (part of Deltaspike)

  • How to enhance annotations for CDI (@InterceptorBinding, @Nobinding)

  • How to enhance a producer; e.g. caching

  • How to integrate CDI into Apache Camel

Saturday, 02.07.2016

Looking into JBoss Forge. Eclipse Integration is nice: Ctrl+4 and Forge-Console view.

Integrated microscoped into my project for playing around; took me some time to find that I did not put the interceptor into my beans.xml.

Thursday, 30.06.2016

Watched Reza Rahman’s Testing Java EE Applications using Arquillian. The Git repo with examples is here

Wednesday, 29.06.2016

I love multitail! Monitor multiple logs merged into one with different color for each log (similar to docker-compose output):

multitail --retry-all --mergeall -ci green -i server.log -ci blue -i access-log.txt

Thursday, 24.06.2016