TouK Hackathon – March 2019

Hackathons are prone to fail. It’s because we have very little time to create something useful, actually working and making a wow!-effect.

So this time we wanted to run “THE HACKATHON”, a well-prepared event with a very high success rate. We called it “Ship IT!” to ensure that we will focus on delivering a working product, not only on having fun while making it. We formed an organising team responsible for internal communication, collecting the needs, removing obstacles and buying some snacks and pizza for the event itself.

We thought that if we want to succeed, we’ll have to prepare well. So each team gathered before the event and talked about their plans, the technologies they intend to use and what hardware they need to order. The organizers met with all teams, exchanged details and gave some good advice.

And finally, the day has come! Seven teams started the two-day hacking session at 9AM, continued until 5PM, and showed the demos of all seven projects after 4.30PM on the second day. We gathered 25 participants total.

Here is a quick presentation of the projects we delivered.

Lidar/ based robot

robot image We always wanted to build a fully autonomous vehicle to transport sandwiches and monitor the Wi-Fi quality over the whole office space. The first step we took was creating a remote controlled platform with Lidar, which allowed to build the office map and made a foundation for future experiments. We reached this goal with and mapped a few corridors and rooms in our office at the end of the hackathon. Now we’re almost ready to conquer Mars :D

Quak Liero-like Game

quak team Quak is a PvP platform game inspired by Liero or Soldat. We used a mix of Kotlin, libGDX and box2d (physics) to build a good-looking 2D game in less than 2 days. Destructible level as a mesh of boxes are generated from provided png layers. Additionally, we implemented some extras to diversify the player experience, such as multiple weapons, double jump, blood effects and explosions.

Quiz Game

quiz game DuckQuiz is a game we wanted to use at public event, e.g. conferences. It’s a little bit similar to the legendary Flappy Bird. Your goal is to make the title hero – a duck – go as far as possible! Correct answers give the duck a bump, so the more questions you answer correctly, the further the duck will go. Be careful, though! Three wrong answers will make a brick fall on the duck’s head! To spice things up a little, we decided to introduce a score threshold, which – once achieved – guaranteed a prize. Plus, of course, if you beat the highest score, you will make history as the reigning champion Duck Flyer. The quiz application is written in Kotlin for Android. We used RxJava and Retrofit for communication with the server. For the back-end side, we chose SpringBoot along with Kotlin. There is also a web-based “Hall of Fame” panel and a simple CMS which allows the management of the quiz questions, written in ReactJS.

Own Card Authorization system

demo4 We’re waiting for our private brand new vending machine which we’re going to use for distribution of snacks in Touk. We’ve noticed that we can communicate with it using MDB protocol. We’d like to authenticate in the machine with RFID cards which are commonly used in TouK to open doors. As a first step, we wanted to create authorization system based on RFID cards, but with additional PIN verification part added. Our system should be integrated with internal LDAP. We’ve separated our project into 4 modules: backend (spring boot), web frontend (scalajs-react), mobile app (android) and hardware device (arduino yun). Backend part connects all modules and allows matching RFID cards UID with LDAP logins. Web frontend is designed for users to set and manage their PINs. The mobile app at the moment is dedicated for our administrator to make pairing existing cards with LDAP logins easier. Finally, hardware device was created to read data from card, get PIN from user and check if PIN is correct (via backend). In the next step, we’d like to integrate our system with mentioned vending machine and make payments using it. There is also a plan to enhance mobile app and use it as mobile payment terminal and integrate web UI with Touk SelfCare system.

Notification lights

lights hackers Three suites (3 lights in red, yellow and blue) controlled by Raspberry Pi Zero W communicating with the managing service via MQTT protocol. The service handles messages from Rocket’s (our chat) outgoing web hooks and notifications from GitLab (e.g. opened merge requests).

Team gathering app (e.g. for football matches)

Team gathering app We regularly play football and volleyball after work, but we sometimes struggle with completing the teams. So far, we used a sign-up system based on Confluence pages, which is not mobile-friendly. We also wanted to allow registration for “reserve” players from outside the company. That’s why we built a simple mobile app with a sign-up form, game history and basic player ranking. The app was built with Dart using the Flutter framework and Firebase for storage and authorization.

Internal time reporting API

hr This HR project’s goal was to integrate and simplify the way we log time in our company. We’ve achieved that with a Google Calendar-like GUI and multiple microservices written in TypeScript, Python, Java and Scala!

The Grand Finale

demo1 At the end of “Ship IT!”, the teams had demonstrated the effects of their work. They shared some successes and other stories :) about the used software and hardware and the lessons learned during those two intensive days. The audience were amused when the robot started to explore the room. The Quak team had a bloody battle in their game. The lights were blinking when one of the team members wrote “kanapki” on our internal TouK chat.

demo2 demo3 demo5 demo6

It was very impressive that each team managed to deliver a viable result and show their projects in action. We can’t wait to run the next edition of The TouK Hackahton and hope there will be even more participants and surprising ideas to see.

You May Also Like

Using WsLite in practice


There is a example working GitHub project which covers unit testing and request/response logging when using WsLite.

Why Groovy WsLite ?

I’m a huge fan of Groovy WsLite project for calling SOAP web services. Yes, in a real world you have to deal with those - big companies have huge amount of “legacy” code and are crazy about homogeneous architecture - only SOAP, Java, Oracle, AIX…

But I also never been comfortable with XFire/CXF approach of web service client code generation. I wrote a bit about other posibilites in this post. With JAXB you can also experience some freaky classloading errors - as Tomek described on his blog. In a large commercial project the “the less code the better” principle is significant. And the code generated from XSD could look kinda ugly - especially more complicated structures like sequences, choices, anys etc.

Using WsLite with native Groovy concepts like XmlSlurper could be a great choice. But since it’s a dynamic approach you have to be really careful - write good unit tests and log requests. Below are my few hints for using WsLite in practice.

Unit testing

Suppose you have some invocation of WsLite SOAPClient (original WsLite example):

def getMothersDay(long _year) {
    def response = client.send(SOAPAction: action) {
       body {
           GetMothersDay('xmlns':'') {

How can the unit test like? My suggestion is to mock SOAPClient and write a simple helper to test that builded XML is correct. Example using great SpockFramework:

void setup() {
   client = Mock(SOAPClient)
   service.client = client

def "should pass year to GetMothersDay and return date"() {
      def year = 2013
      def date = service.getMothersDay(year)
      1 * client.send(_, _) >> { Map params, Closure requestBuilder ->
            Document doc = buildAndParseXml(requestBuilder)
            assertXpathEvaluatesTo("$year", '//ns:GetMothersDay/ns:year', doc)
            return mockResponse(Responses.mothersDay)
      date == "2013-05-12T00:00:00"

This uses a real cool feature of Spock - even when you mock the invocation with “any mark” (_), you are able to get actual arguments. So we can build XML that would be passed to SOAPClient's send method and check that specific XPaths are correct:

void setup() {
    engine = XMLUnit.newXpathEngine()
    engine.setNamespaceContext(new SimpleNamespaceContext(namespaces()))

protected Document buildAndParseXml(Closure xmlBuilder) {
    def writer = new StringWriter()
    def builder = new MarkupBuilder(writer)
    return XMLUnit.buildControlDocument(writer.toString())

protected void assertXpathEvaluatesTo(String expectedValue,
                                      String xpathExpression, Document doc) throws XpathException {
            engine.evaluate(xpathExpression, doc))

protected Map namespaces() {
    return [ns: '']

The XMLUnit library is used just for XpathEngine, but it is much more powerful for comparing XML documents. The NamespaceContext is needed to use correct prefixes (e.g. ns:GetMothersDay) in your Xpath expressions.

Finally - the mock returns SOAPResponse instance filled with envelope parsed from some constant XML:

protected SOAPResponse mockResponse(String resp) {
    def envelope = new XmlSlurper().parseText(resp)
    new SOAPResponse(envelope: envelope)

Request and response logging

The WsLite itself doesn’t use any logging framework. We usually handle it by adding own sendWithLogging method:

private SOAPResponse sendWithLogging(String action, Closure cl) {
    SOAPResponse response = client.send(SOAPAction: action, cl)
    log(response?.httpRequest, response?.httpResponse)
    return response

private void log(HTTPRequest request, HTTPResponse response) {
    log.debug("HTTPRequest $request with content:\n${request?.contentAsString}")
    log.debug("HTTPResponse $response with content:\n${response?.contentAsString}")

This logs the actual request and response send through SOAPClient. But it logs only when invocation is successful and errors are much more interesting… So here goes withExceptionHandler method:

private SOAPResponse withExceptionHandler(Closure cl) {
    try {
    } catch (SOAPFaultException soapEx) {
        log(soapEx.httpRequest, soapEx.httpResponse)
        def message = soapEx.hasFault() ? soapEx.fault.text() : soapEx.message
        throw new InfrastructureException(message)
    } catch (HTTPClientException httpEx) {
        log(httpEx.request, httpEx.response)
        throw new InfrastructureException(httpEx.message)
def send(String action, Closure cl) {
    withExceptionHandler {
        sendWithLogging(action, cl)

XmlSlurper gotchas

Working with XML document with XmlSlurper is generally great fun, but is some cases could introduce some problems. A trivial example is parsing an id with a number to Long value:

def id = Long.valueOf(edit.'@id' as String)

The Attribute class (which edit.'@id' evaluates to) can be converted to String using as operator, but converting to Long requires using valueOf.

The second example is a bit more complicated. Consider following XML fragment:

<edit id="3">
      <param value="label1" name="label"/>
      <param value="2" name="param2"/>
<edit id="6">
      <param value="label2" name="label"/>
      <param value="2" name="param2"/>

We want to find id of edit whose label is label1. The simplest solution seems to be:

def param = doc.edit.params.param.find { it['@value'] == 'label1' }
def edit = params.parent().parent()

But it doesn’t work! The parent method returns multiple edits, not only the one that is parent of given param

Here’s the correct solution:

doc.edit.find { edit ->
    edit.params.param.find { it['@value'] == 'label1' }


The example working project covering those hints could be found on GitHub.