Trifork Blog

Category ‘Java’

How to Remotely Debug Application Running on Tomcat From Within Intellij IDEA

July 14th, 2014 by
(http://blog.trifork.com/2014/07/14/how-to-remotely-debug-application-running-on-tomcat-from-within-intellij-idea/)

In a Continuous Delivery set up, the biggest discrepancies usually exist between the two furthest endpoints of the delivery pipeline: Development environment and Production environment, with each components in the pipeline then approaching “production-like” as you move closer to production endpoint.

An ideal set up would be to have the development environment 'exactly' like the production environment, but we do not live in an ideal world, and for various reasons, there exists valid constraints that prevents this; from licensing constraints to privacy constraints (where production data is concerned).

It is then not an unusual occurrence to encounter bugs in production environment that cannot be successfully reproduced in the development environment.

Trying to pinpoint the cause of these kind of “issues” might quickly end up being a practice at taking shots in the dark: a very time-consuming and inefficient process.

It was this kind of situation I recently found myself, where, I had to rectify certain issues that were occurring in the production environment but could not be reproduced on the development machine.

Read the rest of this entry »

New features in Axon Framework 2.1

February 13th, 2014 by
(http://blog.trifork.com/2014/02/13/new-in-axon-2-1/)

Recently, Axon Framework 2.1 has been released. It comes packed with improvements and some exciting new features. In this post, I'll briefly iterate of what's new in this version.

Furthermore, we have also scheduled a few workshops and trainings.

Read the rest of this entry »

Apportable (a much better alternative to Phonegap) and AFNetworking 2.0

October 22nd, 2013 by
(http://blog.trifork.com/2013/10/22/apportable-a-much-better-alternative-to-phonegap-and-afnetworking-2-0/)

cocoahead_sm2On October 16th I attended CocoaHeads, an iOS developer meetup that is organized every few months by Peter Robinett of Bubble Foundry and other volunteers. Every time it's hosted at a different location. It was previously hosted at Spil Games, Xebia and NOS. This time it was hosted at eBuddy. The formula is simple: great speakers show up and talk about interesting frameworks, hacks, tricks and so on. During the presentations, attendees can enjoy some free drinks and food.

This was the fourth time I went and it was the best edition yet! That's why I decided to blog about it this time. I believe this was the best edition because there were talks given by two speakers from San Fransisco: Matt Thompson and Zac Bowling and they talked about some pretty interesting and even mind blowing topics.

Read the rest of this entry »

Windows Phone 8 - C# vs. Java

September 17th, 2013 by
(http://blog.trifork.com/2013/09/17/windows-phone-8-c-vs-java/)

csharp-vs-java
Welcome back to another brand new Windows Phone 8 blog! After I explored the UI and checked out the IDE it is now time to take a look at the programming language: C# or "C sharp". I want to focus purely on the language itself and compare it to the language I know best: Java. I was surprised how good C# was compared to Java. The syntax of both languages look a lot alike. I want to highlight some of the language features I discovered while writing my first app of which I thought: wow, I wish Java would have this!

Read the rest of this entry »

Hippo CMS Favorite Folders Plugin

July 17th, 2013 by
(http://blog.trifork.com/2013/07/17/hippo-cms-favorite-folders-plugin/)

hippo_logoAfter doing a number of big projects with Hippo CMS, I came up with the idea of creating a plugin. I'm always looking for ways to optimize the user experience as I think user experience is one of the most important parts of a product. Hippo allows you to store your content in a folder structure. In my projects I've noticed that most users only use a few folders to work in. Sometimes this folder is located on a deeper level in the folder structure, which makes the user need to click even more before he reaches his content. My plugin allows the user to mark a folder as a favorite folder. A link will be created on the dashboard (the first screen after log-in). Using this link, the user can quickly navigate to that folder. The favorite folders will also be available in the link picker as a separate section. Continue reading to find out how it works!

Download Hippo CMS plugin

Read the rest of this entry »

Checking return values in Java

July 2nd, 2013 by
(http://blog.trifork.com/2013/07/02/checking-return-values-in-java/)

The other day I made a stupid coding error. It took me the better part of an hour to track it down. We all have those moments. Blame it on a bad night's sleep, a brain fart, or perhaps the fact that your colleague at the next desk has been whistling that tune from Gotye's "Somebody I used to know" (you know the one) all day, completely driving you crazy and taking your focus off your code.
Read the rest of this entry »

From the trenches: Rendering Twitter Bootstrap form inputs for Spring-MVC with FreeMarker macros

May 27th, 2013 by
(http://blog.trifork.com/2013/05/27/bootstrap-spring-mvc-form-input-freemarker-macros/)

This is the first entry in a new series of what we hope will become a regular appearance on our Trifork blog: “from the trenches”, with blogs that explain in a no-nonsense just-the-tech fashion how we applied certain tools, technologies, libraries and frameworks in our own projects to solve real-world challenges that we faced while building solutions for our clients. We hope that by sharing the solutions we came up with, we can provide you with some examples and ideas that you can apply to your own projects -- with the confidence of knowing that these techniques have proven themselves in real production systems.

We are also open to your suggestions on what technologies you might want us to cover. So don't be shy and just drop us a note if you have any ideas.

In this first blog I’d like to cover how we used FreeMarker to build a small library of macros that make it very easy and effort-free to work with Twitter Bootstrap-based forms in a Spring-MVC application.

TL;DR: we've built a set of FreeMarker form macros for Spring-MVC apps with a Twitter Bootstrap-based frontend that allow one-liners in your form templates to render full Bootstrap-based HTML structures for various input types that include internationalized labels and rendering of binding and validation errors while allowing passing in custom attributes and nested contents. It’s awesome.

Read the rest of this entry »

Introducing a Query tool as an Elasticsearch plugin (part 1)

March 12th, 2013 by
(http://blog.trifork.com/2013/03/12/introducing-a-query-tool-as-an-elasticsearch-plugin-part-1/)

Es

In the past few weeks I have been working with Elasticsearch. I was missing a plugin to look at the data, create queries and evaluate different facets. That was when I decided to start working on a plugin that enables you to do just this.

I have been working on AngularJS together with Twitter Bootstrap, therefore the choice as to which technology to use was not a difficult one. I also used some additional libraries, but I'll tell you more on this later on.

Why did I put the part 1 in the title? I am going to split this information into two parts. This part deals with the setup of the plugin, the libraries I used and the functionality I implemented. Then the next part deals with providing more details about interacting with Elasticsearch; how I use the facets, create the queries, etc. I will also write down some lessons learned with respect to AngularJS in a later blog post.

Now let's move on and have a look at the features:

Read the rest of this entry »

Searching with the elasticshell

March 7th, 2013 by
(http://blog.trifork.com/2013/03/07/searching-with-the-elasticshell/)

elasticshell
So as promised here is a sequel to my previous post Introducing the elasticshell. Let's start exactly where we left off...

What about search?
We of course need to search against the created index. We can provide queries as either json documents or Java QueryBuilders provided with the elasticsearch Java API, which are exposed to the shell as they are.
Read the rest of this entry »

Introducing the elasticshell

March 6th, 2013 by
(http://blog.trifork.com/2013/03/06/introducing-the-elasticshell/)

elasticshell
A few days ago I released the first beta version of the elasticshell, a shell for elasticsearch. The idea I had was to create a command line tool that allows you to easily interact with elasticsearch.

Isn't elasticsearch easy enough already?
I really do think elasticsearch is already great and really easy to use. However, on the other hand there is quite some API available and quite some json involved too. Also, interacting with REST APIs requires a tool other than the browser to use the proper http methods and so on. There are different solutions available: some of them are generic, like curl or browser plugins, while others are elasticsearch plugins like head or sense, that you can use to send json requests and see the result, still in json format. What was missing is a command line tool, something that plays the role of the mongo shell in the elasticsearch world. That's ambitious, isn't it?

In the meantime the es2unix tool has been released by Drew, a member of the elasticsearch team. The interesting approach taken there is to hide all the json and show only text in a nice tabular format, providing an executable command that makes possible to pipe its output to other unix commands like grep, sort and awk. That's a great idea, and an even greater result I must say.

A json friendly environment
I decided to take another approach: provide an environment that makes it easier to play around with all that json. That's why I started writing a javascript shell, where json is native and it's relatively easy to provide auto-suggestions directly within json objects. I also wanted to use the elasticsearch Java API, which are complete, performant, and powerful, allowing to even fire a new node if needed.
Read the rest of this entry »