Trifork Blog

Posts Tagged ‘javascript’

GOTO Amsterdam 2015: AngularJS Track

May 1st, 2015 by

AngularJS: King of the castle


We looked at the web development corner and saw the big 3 technologies; HTML, Javascript and CSS all loosing interest. Frameworks, on the other hand, are gaining more and more attention from the community. These days there is one framework that stands out from the rest: AngularJS.

Read the rest of this entry »

Setting up Maven to use Grunt/NodeJS

October 7th, 2014 by

grunt-logo For one of our projects we wanted to automate javascript concatenation/minification/tests and incorporate it into our maven build. While there are a number of maven plugins for those tasks, I’ve found that depending on another technology offered so much more and basically ended up integrating Grunt into our maven build. Grunt is a task runner which runs in node.js and it along with its plugins (tasks) are distributed with NPM. One could compare it with Maven + Ant with one big advantage for frontenders, it’s all javascript driven. This advantage means there’s a wider scenery of tooling catered specifically (but not exclusively) for frontend development and makes it quite delightful to find and use tools. It will feel weird to integrate a dependency manager and task runner into another dependency manager and task runner, but it actually makes sense from a polyglot point of view. Don’t worry though, we will be using Maven to add Grunt to the build.
Read the rest of this entry »

Creating charts with C3.js

July 29th, 2014 by

Trifork LogoEverybody remembers that project where you need to display some data in a chart. When you select a library to create these charts you will obviously have a few requirements. One of the requirements will probably be that the charts must look good to impress your customer and if they don’t look the way you want, they must be at least be easy to style. But the most important requirement will be that the code to achieve your goal must be minimal and easy to understand. So one of the well known JavaScript library to create all kind of charts is D3.js. This library provided us the option to create a simple line chart with a tooltip that shows some data. So we thought that this would be a good fit for our project and started to create a chart. But wait… I see you thinking.. the title said C3.js and now you’re using D3.js?! Keep on reading to find out why! Read the rest of this entry »

Internationalization with AngularJS

April 10th, 2014 by


Many web applications need to support multiple languages. The process of building in this support in a piece of software can be split in two parts: Getting it technically ready to support multiple languages/regions, and getting it ready for a particular language/region. The first part is called internationalization, often abbreviated to i18n (18 being the number of characters left out in the abbreviation). The second part is called localization, abbreviated as L10n. In this blog post, we’ll see how we can support i18n in an AngularJS-based web application. There is an example project available containing all source code. It’s a Maven project based on Tomcat 7 (Servlet API 3.0) and JDK 6, and can be downloaded here. The example builds on a an example case I created as part of a previous blog on AngularJS.

Read the rest of this entry »

Dynamic web forms with AngularJS

April 3rd, 2014 by


When we’re building web applications containing data entry forms, it’s sometimes a requirement that (part of) the form is dynamic, in the sense that the fields to be included in the form need to be determined at runtime. For instance, this may be required if application managers need to be able to add new data fields quickly through a management console, without support by a programmer.

Read the rest of this entry »

Web forms with Java: AngularJS and other approaches

March 20th, 2014 by


After learning about AngularJS a couple of months ago, I started using it on new Java web projects, and that has been a great pleasure. If you haven’t worked with AngularJS yet, you may be wondering what the hype is all about and whether or not it’s a thing worthwhile of investing your time in. In this blog, I’d like to put some of the merits of AngularJS in the spotlights, by comparing it to some other approaches for web application programming in the Java world.

Read the rest of this entry »

Meteor – Client & Server Programming in One

January 9th, 2014 by

In this blog post I want to introduce to you a relatively new JavaScript framework which is called Meteor. The Meteor framework provides the feature to write server and client side code just in HTML 5, Javascript, and CSS. Right now there is just a preview version available (Preview, nonetheless this preview version is quite powerful already. Therefore you can find already a number of meteor application on the market. For example, an application called Share with 911, Interview, ApplyBin, etc. In this blog entry, I want to present some of the features such as the how to write server side and client side code. I want to explain what are templates in the meteor framework and how they are used. Additionally I will show you where and how to store static content such as images and other resources. In the end I will give you my own conclusion and a tutorial to help you get started.

Read the rest of this entry »

Twitter Bootstrap, why you should *not* use it

June 4th, 2013 by

We all know Twitter Bootstrap, a great tool for quickly building “sleek and intuitive” web applications. But why are people actually choosing to use Twitter Bootstrap and why? And more importantly, why I think you should *not* use it (in most cases)!

Disclaimer: I am a frontend developer and wrote this blog entry from my point of view, so if you are a backend developer, take this with a pinch of salt and don’t be offended 😉

You hear it all the time: “You should really use Twitter Bootstrap! It’s really good and easy to use”. Also, I notice that bootstrap enables backend developers to quickly set up a frontend using twitter bootstrap. And suddenly they have to admit that a little frontend development can actually be a lot of fun. However, typically things turn bad once the project progresses…

So what can bootstrap do for you and what makes that people find it useful:

  • Quickly create a layout (fixed, fluid and responsive)
  • Quickly create a form
  • Everything imediatly in the same style
  • Reasonable grid system
  • Tables
  • Buttons

And there are many other useful things that bootstrap offers and allows you to add in no time. Just dive into it, it’s more than worth it…

When and what for should you use bootstrap?

  • A backend system without too much commercial purpose
  • A website without fancy design
  • Show (preliminary) functionality to a product owner during a project

So what remains and why should you *not* use bootstrap?

You have to consider that most frontend developers get their thrill from translating a spiffy design to HTML/CSS using client-side scripting when needed. They are typically good at just that thing using their own preferred tools and frameworks and typically less good at modifying existing code bases that they didn’t create from scratch.

So when better not?

  • When you are just interested in the grid layout, then there are better and more resource-friendly alternatives
  • If you are only using one or two features, why not build them yourself? (why not reuse?)
  • When dealing with a design of your own, you might end up removing bootstrap specifics or trying desperately to override them

To conclude, there are defintely reasons and scenarios where Twitter Bootstrap can be handy, but make sure that you don’t shoot yourself in the foot, because it might cause you more work in the long run. Especially when using bootstrap in a larger project, it might save you time in the beginning, but it might start to bother you and cost you greatly a little further down the road. In those cases, setting up your project correctly yourself from the beginning, is a more recommendable approach.

Searching with the elasticshell

March 7th, 2013 by

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

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 »