Prerequisite Before you start this, Its good to follow the following articles. Running Rest API using Dropwizard Reading From Database Using Dropwizard Writing To Database Using Dropwizard I will assume that your dropwizard project is running. Dependency Add dependency of dropwizard-freemarker-views in your pom.xml Your pom.xml should look like this: https://gist.github.com/rohitsingh20122992/bc05fad912367fc094b3d86f0dbf1943 Freemarker Template Language Apache... Continue Reading →
Dropwizard : Write Data Into Database Using Hibernate
Please follow the first two part of the tutorial before starting this: Introduction To Dropwizard Read Data From Database Using Dropwizard Modify InfoDao To Persist Data Add a method to persist data https://gist.github.com/rohitsingh20122992/804fcb8d8278697b9bad67dc4d6eb596 Add POST API to store the info https://gist.github.com/rohitsingh20122992/ba92da47d24be1cbff32ea19106e92b9 Test Your API Run your project. Test using postman or any other rest client.... Continue Reading →
Dropwizard β Tutorial to write APIs to read/write from database using hibernate
Please go through the first part of this tutorial to set up your dropwizard project. For this project, we will assume you have a working dropwizard project. Add dependency to your pom.xml Please add dependency of hibernate and mySQL-connector to your pom.xml https://gist.github.com/rohitsingh20122992/b4256af30b3cecaf64e0454460c41d72 Create Info Table in MySql https://gist.github.com/rohitsingh20122992/eda65377e68f280758cea3ab54347486 Add some content to your table.... Continue Reading →
REST APIs using Dropwizard – Introductory Tutorial
Dropwizard is a popular java framework for restful service. It provides out of the box support for configuration, application metrics, logging and operational tools so the developers focus more on writing business logic and not on set ups. Agenda This tutorial should help you set up your dropwizard project and few APIs. Let's start! Create... Continue Reading →
Depth First Search In Python to print nodes of Graph
Graph Shown above is a simple graph. Let's define the characteristic of the graph: This is a connected graph. Meaning, you can travel from anywhere to anywhere in this graph. Read further here This is an undirected graph. That simply means we don't have any direction sense to the arrow connecting two nodes This is... Continue Reading →
Design Pattern – The Singleton Pattern
Definition Sorry about that whisky image. I, too, love click baits π The singleton pattern is a software design pattern that restricts the instantiation of a class to one object. Singleton pattern is a convention for ensuring one and only one object is instantiated for a given class. Usage Places where only one object is... Continue Reading →
Binary Heap – Data Structure
Usage In Heapsort In Priority Queue Not the garbage collector storage (as provided by JVM) Definition A binary Heap is an array object. We can view that array object as a near complete binary tree. A binary tree is said to be a complete binary tree when all the nodes except possibly for the leaves... Continue Reading →
A Tutorial on JVM – Run-Time Data Areas
Java code comprise of class and variable.Β Class and Variable come with different scope(private/public/static). All this takes memory. JVM has been given responsibility to run the java code. JVM gives memory for class/variables. But how does JVM manages memory? Let's imagine JVM memory as big box as it is shown in the picture below. We will... Continue Reading →
int vs Integer – Java Application Memory Usage
Before you read further, Please answer the following question: A. int a = 100; B. Integer b = new Integer(100); There are two java statements written above. What is the ratio of memory used by b to memory used by a in a 32 bit machine? The four options are: 1 1.5 2 4... Continue Reading →
Huffman Code – An example of Greedy Algorithm
Introduction A greedy algorithm always makes the choice that looks best at the moment. It makes a locally optimal choice in the hope that this choice will lead to a globally optimal solution. Greedy algorithms do not result in optimal solutions always but for many problems they do. A problem can be solved by Greedy... Continue Reading →