Stuff I Wrote

Anatomy of a Twitter microservice

in Uncategorized - 1 min read
Here's a small presentation which was created as we've tried to build a microservice for our in-house Device Detection solution. As part of that exercise, we've adopted the Twitter microservice stack and this presentation will try to dissect the cross-cutting concerns a microservice stack has to deal with. We called this service affectionally µWURFL as it mimics the paid cloud WURFL service which we hope with their permission will be open-sourced (the wurfl.zip and binary dependencies will still require a deal with ScientiaMobile, which is totally worth it!)ScientiaMobile showed itself as a great partner and their API was very easy to integrate with.


http://slides.com/schrepfler/anatomy-of-a-microservice

Initial release of jira-maven-plugin

in Uncategorized - 1 min read
Several months ago I found a plugin made by George Gastaldi which allows performing some common JIRA actions when performing the version release on JIRA on release, creating the next release as well as generating the release notes.

Unfortunately our JIRA version doesn't support the WSDL API but it does the REST API so I decided to fork the repo in the hope one day I'll find the time to do so.
Yesterday was that day, I wrapped my sleeves, imported the dependency against the atlassian jira rest client and started to chop and migrate code over the new API.

There are no tests yet, the code is probably broken but the basis are there. I plan to add a couple of things as well, the release and tagging will not be performed unless all tasks with the given fixVersion are not closed/resolved and I'd like to generate some stats as part of the release.

If you feel adventurous and would like to help out as well, feel free to include the plugin to you project, how to do so can be found on the README.md.

How to install AMD Catalyst driver 13.11 on Ubuntu Linux Saucy

in Uncategorized - 1 min read
Download archive from here.

unzip amd-catalyst-13.11-beta-v9.4-linux-x86.x86_64.run.zip
sudo sh 'amd-catalyst-13.11-beta V9.4-linux-x86.x86_64.run' --buildpkg Ubuntu/saucy
sudo dpkg -i fglrx_13.250-0ubuntu1_amd64.deb fglrx-dev_13.250-0ubuntu1_amd64.deb fglrx-amdcccle_13.250-0ubuntu1_amd64.deb
sudo aticonfig --initial

Done.

Sim City Social to be switched off

in Uncategorized - 1 min read
After the unfortunate decision to turn Sim City Social off, my neighbour had a very nice subliminal message to EA Games, I could not have said it better myself.
Fuck EA Sports

Generating xml schema documentation elements from JAXB annotated classes

in Uncategorized - 3 min read
When you're in the business of creating Java Web Services today, be it JAX-WS or JAX-RS, one of the difficult things to get right is actually documenting the entities from a API developer point of view, especially in the scenario where your model is the code.
The main problem comes to the fact that a JAXB annotated model doesn't map anything to the generated schema contracts (be it  WSDL or WADL+XSD) and classes. This is understandable as Javadocs don't exist at runtime and there is no specific JAXB annotation that maps to the xs:annotation, xs:documentation and xs:appinfo schema elements. Various tools like enunciate and all provide some support to to compile time generation but from my point of view the generated wadl + schema (my main scenario) is not the same quality as is the runtime generated ones.
Can this be improved?
Some guys at the The Distributed Systems Group (DSG) of the Information Systems Institute at the Technical University of Vienna certainly thought so and they forked the JAXB API project to add the Java annotations for xs:annotation, appinfo and documentation, modified the JAXB implementation library schema generator to enhance the produced xsd by mapping the annotations to schema elements and also (which seems was their primary objective) added support for schema facets thus allowing you to express with annotations things like pattern facets, min/max etc.).
The project is hosted here but there's a fork which is a bit easier to test because they went around a bit the troublesome java endorsed directory classloading mechanism (needed because JAXB implementation classes are on a protected package within the JDK) (this might change in time).
All in all, it looks very promising as it works with JAX-RS and Jersey so, if they can unify the facets with the JSR-303 and JSR-349 annotations and also have it supported by the xjc binding compiler it would go a really long way in providing a much nicer API documentation (yes, yes, that's soooo 90'ies blah blah) and schemas but also declarative validation of service interfaces.
If you agree, point your browsers to the java.net JIRA and vote here.
All in all a nice renaissance for services considering Jersey 2.0 is coming up and all the hypermedia API standards that are emerging.
On a tangent, I believe a fair chunk of JAXB schema generation code was written by Kohsuke (of Hudson/Jenkins fame). If you dig in and read the code, your mind will warp, you have been warned.
Now, do your company a favor, make them buy OxygenXML and generate some nice docos!


Tell me how you build your buildings and I’ll tell you who you are

in Uncategorized - 2 min read
I have to admit that I succumbed to the temptation of starting SimSity Social several months ago. As a game that intrigued me even when I was a kid and a genuine fan of God/simulation games I just couldn't resist. All in all, I can say that even though the mechanics are not quite what a stand-alone simulation game usually brings to the table, the whole package is on the whole pleasing and engaging.
This however is not the subject of this post, this post is about some strange cities that my neighbors have built.
 This one is really special, very good distribution of population-boosting buildings and zones approach for businesses and factories. Can you say anal?
 Also very interesting vertically aligned buildings in columns shuffled between businesses, not obvious way to get high population but to be honest, I don't think he cares that much. Especially with all the police/hospital/firefighting facilities. Can you say square?
 This one is one of my favorites... What's with all the same buildings and businesses? Also, look at the nice flower plantation around the mayor's office :-)  Can you say particular?
This stuck me when I saw it, the owner, once expanded nicely on the main map, is slowly expanding over the island creating first the road grid, only to put the buildings at a later moment. Impressive! Organized and patient!

Selecting the name of the node in an of an XPath expression?

in Uncategorized - 1 min read

Selecting the name of the node in an of an XPath expression?
name(/path/to/node)

java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.SunJCE_b

in Uncategorized - 1 min read
Check if the user actually has access rights to these JVM jars
-rw------- 1 root root 2465 Apr 28 17:28 US_export_policy.jar
-rw------- 1 root root 2481 Apr 28 17:28 local_policy.jar

Spring Integration Http Outbound Gateway and variable url


I've recently had to deal with spring integration and in particular the http outbound gateway component. One possible use case for it would be to have to send the message out to an arbitrary url. In order to accomplish this, we can insert the final url in a custom header (here X-CUSTOM-HTTP-REQUEST-URL) and use the Spring expression language (SpEL) to extract the header value and pass that as a variable to the url property. Sweet!

 
<http:outbound-gateway id="httpOutboundGateway" request-channel="httpOutboundGatewayRequestChannel" url="{outboundGatewayUrl}" reply-channel="httpOutboundGatewayReplyChannel" expected-response-type="java.lang.String" charset="UTF-8">
<http:uri-variable name="outboundGatewayUrl" expression="headers['X-CUSTOM-HTTP-REQUEST-URL']" />
</http:outbound-gateway>

PS. If Spring Integration seems to be eating your headers, there's a reason for it, you need to specifically map all non standard headers. If interested post a comment.

SoapUI XPath gotcha

in Uncategorized - 1 min read
SoapUI has an interesting feature, it can actually wrap your JSON response and show it to you as an XML response rappresentation (by default). While your assertions will work in the editor tests will fail. Of course, there's no actual xml to validate on!