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 , , | 2 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