Monday, October 26, 2015

Windows Batch Script for Incremental Backup

Recently I faced with the problem when I wanted to do a backup of some directory just by one click. I didn't want to rename or change something manually each time I need to do a backup. All I want is just copy the content of one folder to some destination many times by one single mouse click. 

This means that each time I run a backup I want my script to check if there already exist some previous backup folder and if yes then to increment it's name and actually perform the backup. Thus if I will run the script 5 times then the destination directory will look like this:


Well I must confess it was not easy to find a solution for this relatively simple task. Therefore I decided to put a result of my research here in order to do someone's life easier.
Here is a Windows batch script that will do incremental backup for you:

Thursday, October 15, 2015

Java Spring Restful Web Service with Configurable MongoDB

Today I'll show you how to build Java RESTful Web Service that uses MongoDB database for storing and retrieving data. The service is written using Java Spring 4 technology. 

In this project I will show how to configure MongoDB database parameters in java properties file and how to consume it using Java Spring. If you're new to MongoDB then I suggest to read my previous article on How to Install and Run MongoDB on Windows.

I will not describe in details maven pom.xml structure just because you can simply download the whole project by clicking on the download link at the bottom of this page.

Here is the structure of the project:

Ok, so what this all about?

Monday, October 12, 2015

How to Install and Run MongoDB on Windows

This particular article is for those who are going to install and run MongoDB database for the first time.

  • First, download MongoDB from official MongoDB website

  • Once you done Unzip and put its content to your location, for instance C:\MongoDB\ 

  • This is how MongoDB server directory tree looks like after extraction

  • mongodb-directory-structure

  • Then go to C:\MongoDB\Server\config\ and create MongoDB configuration file - mongo.config 

  • Fill in corresponding data, for example this is content of my mongo.config:

                                   ## database directory
                                   dbpath = c:\MongoDB\Server\data

                                   ## database port number
                                   port = 27017

                                   ## logs will be created here
                                   logpath = c:\MongoDB\Server\logs\mongo.log