page banner
avatar
'Creating a custom website or a theme with Grain' post illustration
Creating a custom website or a theme with Grain

Grain theme is a project that provides a layout-based skeleton for creating static websites by only adjusting the configuration and adding a content. This post shows how to use the theme template in order to create a custom Grain theme — starting from defining content files and page layouts, and up to building user-friendly, page-formatting tools.

avatar
'Changing the Grails project configuration from within a plugin' post illustration
Changing the Grails project configuration from within a plugin

This code snippet shows how to update project configuration settings from a Grails plugin executable script. The script changes the configuration by copying the settings from a default config file, placed in the plugin's folder, to the Config.groovy. This is usually very useful during a plugin installation when you need to provide some default configuration:

avatar
'Building ESME with Logica OpenSMPP Java library' post illustration
Building ESME with Logica OpenSMPP Java library

Short Message Peer to Peer (SMPP) is an open, telecommunications industry protocol for exchanging text messages (SMS) between short message service centers (SMSC) and External Short Messaging Entities (ESMEs). The protocol is often used for connecting to SMS centers in order to send messages to mobile devices.

avatar
'Designing a log of database queries for MongoDB' post illustration
Designing a log of database queries for MongoDB

The database query log could be a crucial part of a database restoring process required after data corruption caused by either an illegal update operation or a damage of database files. The main task here is to find the right format for storing the queries.

avatar
'MongoDB java driver. The custom builder for update operations.' post illustration
MongoDB java driver. The custom builder for update operations.

Java driver for MongoDB does not provide any utility classes that could help with building update queries. If you want to create a query to update or increment field values, you usually have to use BasicDBObjectBuilder. This is intuitive approach, but queries defined in such a way are quite hard to read and maintain.

avatar
'How to intercept and log stdout and stderr messages with log4j' post illustration
How to intercept and log stdout and stderr messages with log4j

Log4j doesn't allow to catch stdout and stderr messages out of the box. However, you can still intercept them with a custom output stream, which is especially useful when you have to log data that third-party libraries write to the standard streams.

This has already been done by Jim Moore (have a look at the LoggingOutputStream in the log4j source code). The issue is that this LoggingOutputStream requires org.apache.log4j.Category and org.apache.log4j.Priority which are now partially deprecated.