Monthly Archives: February 2014

Recursively walking directory using Java NIO

Sometimes you may need to recursively visit all files and subdirectories of given directory and perform some actions on it. The typical use case is searching files of a given type, copying or removing a directory including all its contents. … Continue reading

Posted in Java | Tagged , , | 4 Comments

Calculating cryptographic hash functions in Java

Cryptographic hash function is an algorithm which takes block of data of arbitrary length as an input and outputs a short fixed-length sequence of bits (usually 128-512 bits) and which ideally should have following properties: it is very easy to … Continue reading

Posted in cryptography, Java | Tagged , , , , | Leave a comment

Git: how to ignore files

When working with Git you will quickly come across several files which are present in the working copy for various reasons but which should not be tracked by Git. The typical examples are logs, compiled binaries or IDE configuration files. … Continue reading

Posted in Git, Version control | Tagged , , | Leave a comment

Git: how to use stash

Sometimes I have a situation that I am working on some feature on my own branch and suddenly someone comes to me and says that something really important has to be fixed or improved on the main branch. Usually it … Continue reading

Posted in Git, Version control | Tagged , , , | 10 Comments

How to parse XML documents using Streaming API for XML (StAX)

Streaming API for XML provides interface XMLStreamReader which gives a low-level but very efficient cursor-like API for reading XML documents. When using it we iterate over various events in XML document and extract information about these events. Once we are … Continue reading

Posted in Java, XML | Tagged , , | 1 Comment

Why I prefer Java over C++

C++ is a language I used for almost 2 years at work, for all my university projects except when there was an explicit requirement to use a different programming language and at home for very different tasks. The language alone … Continue reading

Posted in C++, Java | Tagged , , | 3 Comments

How to write XML documents using Streaming API for XML (StAX)

Nowadays XML became a de-facto standard for storing and exchanging documents over Internet. And because it was designed to be extensible, it can be easily adapted to almost every need. In this post I would like to describe how to … Continue reading

Posted in Java, XML | Tagged , , | 2 Comments

Definition of Done: or why it is very risky to say that something is done

General meaning of word done may seem obvious to everybody but once you start thinking about this, it becomes clear that done may have different meanings depending on the situation and personal point of view. In this article I would … Continue reading

Posted in Agile, Software development practices | Tagged , | 2 Comments

JSF Facelets: templates

Facelets were introduced in JSF 2.0 to resolve common inefficiencies in JSF when creating large-scale sites. Two most useful additions provided by facelets were the ability to reuse the code through templating and to create custom composite components conveniently. In … Continue reading

Posted in Java, Java EE, JSF | Tagged , , , | Leave a comment

Create temporary files and directories using Java NIO2

Temporary files and directories are very useful in many situations. One typical case is that you are writing some (usually large) file and you don’t want anybody to accidentally access and mess with it until is completely written and closed. … Continue reading

Posted in Java | Tagged , | 1 Comment