Transactions are an essential part of any business critical application as these ensure the integrity of the data being managed by the same application. Transactions ensure that the data remains in a consistent and integral state after this is manipulated, thus mitigating the risk of invalid states. Databases are synonymous with transactions, and many programming languages rely on the underlying database to provide the required transactional support. This works well when all modified state is found at the database level. Unfortunately, this is not always the case and there can be cases where the state is found at the application level rather than the database level. In this article we will see how we can use Multiverse (Git Hub), a Software Transactional Memory, to provide transactions at the software level without using any databases.

Albert Attard
Author: 6 months ago

There can be cases where we need to save large text data into a database tables. This data can take lots of space and may introduce new challenges which needs to be addressed. Backups for example may take longer and if uncompressed, these will take more space. In this article we explore several possibilities available when dealing with large data and compare the results obtained.

Albert Attard
Author: 7 months ago

Locking a file is quite simple in Java. The FileChannel (Java Doc) provides all methods we need to lock files. The tryLock() (Java Doc) method will try to obtain the lock on the file without waiting. If the lock is acquired an instance of FileLock (Java Doc) is returned, otherwise this method returns null.

Albert Attard
Author: 1 year ago

Selenium () is a comprehensive testing framework for web applications which allows us to take screenshots of web pages programmatically amongst many other things. It makes use of web browsers, such as FireFox (), to open the web page and then takes the screenshot. This guarantees a genuine representation of the web page.

Albert Attard
Author: 1 year ago

The Windows operating system (Homepage) provides useful information about video files playable by Windows Media Player (Homepage). This information includes the video length, frame width and height and other similar properties. Unfortunately there is no Java API which can easily retrieve such information. Instead we need to rely on third party native libraries such as MediaInfo (Homepage) and create wrappers around it. In this article we will see how to use the aforementioned third party native library to retrieve the video properties from a Java application.

Albert Attard
Author: 1 year ago

Cryptographic Hash algorithms (Wiki), such as SHA-1 (Wiki), are known for digesting inputs of any size into a fixed length, nondeterministic, output. Irrespective of the input size, the output is always of a fixed length, 160 bits (or 20 bytes) in case of SHA-1. Different hash algorithms produce different lengths. When processing large inputs, such as large files, it is convenient to work with streams, rather than loading all input to memory first.

Albert Attard
Author: 1 year ago

Databases are an important part of most applications irrespective of their size and nature. Data needs to be persisted and this is usually done through a database. OSGi (Home Page) is an emerging platform providing high degree of modularity and also supports the hot deployment and replacement of modules. This article describes how to use Flyway (Home Page), a database migration library, with Eclipse Virgo (Home Page) OSGi implementation (previously known as Spring Dynamic Modules (Reference Guide)).

Albert Attard
Author: 1 year ago

The Singleton (Wiki) pattern is quite an old and well known pattern. This pattern was discussed over and over again in many books and articles on the web. So why are we discussing it again here? This article is not about the Singleton pattern per se, but more about the Java Memory Model (Paper) and the concurrent access of shared objects.

Albert Attard
Author: 1 year ago