Skip to main content

Posts

Showing posts from 2017

How to write a Cron Job in Linux?

What is a Cron Job? Cron is a Linux utility where you can setup a task in your machine to run automatically, if required in a repetitive manner at a specific time and date. Such a task that you schedule is called a Cron Job . Here we'll look into how we can setup a cron job in a Linux machine. Follow the steps bellow. Step 1 : Place the script you want to schedule as a Cron Job to one of the following directories in your machine depending on how often you need to repeat the execution of the script. /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly For example, if you want to schedule your task daily, place the script in the /etc/cron.daily directory. Step 2 : Then give correct permissions to the script as follows. Assume script.sh is the script that you need to schedule. cd /etc/cron.daily chmod 755 script.sh   Step 3 : Then you should add a new Cron Job to crontab . crontab -e   Step 4 : Then you will be prompted with y

React

Come let’s start our journey through the world of React , an efficient and flexible JavaScript Library. Today we talk about something called Single Page Applications (SPA) with respect to web based applications. This is where the web application does not use different pages to show different views of the application. The different views will be loaded into the same page so that you don’t need to reload the page every time you need a different view. This is a great improvement in terms of performance. React helps us to achieve that in an easy flexible way. Let’s learn React. They say that the view is just a function of props and state. We’ll see how easy it’s going to be. Let’s set up the React development environment and go through a beginner’s guide to React. Come let’s get started. Note that we require the Babel and Webpack Libraries to start working with react. I’m assuming here that you are in an Ubuntu/Linux environment. You’ll see it by the commands I

How to read a file inside a jar using the command line?

It's simple. Assume the following. Your jar file : myJarFile.jar First you can list the contents of the jar to find the file you want using the following command.                              jar tvf myJarFile.jar Then from the list, pick the file you want and type in the following command to see the content of that file. Assuming the file within the jar is myFolder/myFile.txt ,                unzip -p myJarFile.jar myFolder/myFile.txt Then the contents of the file could be seen in the command line. Cheers.

Integrating the JaCoCo code coverage plugin into a Java Maven project for unit testing with testng

I’ll show how to do this for both offline instrumentation and for using the JaCoCo runtime agent. It is very easy because you don’t need to change the usual way of writing your tests. Its only a matter of changing the pom.xml file in your maven project. 1. JaCoCo code coverage with JaCoCo runtime agent Since we use testng for unit test writing, we put the following dependency under dependencies. < dependencies > < dependency > < groupId > org.testng </ groupId > < artifactId > testng </ artifactId > < version > ${testng.version} </ version > < scope > test </ scope > </ dependency > </ dependencies > Then under build, we first need to have the JaCoCo plugin put under the plugins section of your project pom.xml. (Note - this is the parent pom we are referring to) This plugin configuration