Author Archive


Hosting Static HTML Pages Using AWS Lambda and API Gateway

AWS Lambda and API Gateway are commonly used to create microservice JSON endpoints. In such applications, the static html content is usually stored in an S3 bucket. However if you are building a quick AWS lambda microservice prototype, it would be simpler to render static HTML from a lambda function. This has a number of […]

How to Pick a Random Number in Java

Random numbers have a wide range of programming uses such as in games, encrypting data etc. Java has multiple classes for generating random numbers. Deciding which one to use depends a lot on the program requirements. Here are some of the Random generator classes and their primary purpose, java.util.Random – This is the simplest implementation […]

Towers of Hanoi Recursive Solution in Java

Towers of Hanoi is a well known mathematical game/puzzle involving three pegs and a number of discs. The size of the discs are different and they are kept on the source peg with the smallest on the top and the biggest one on the bottom. The aim of the game is to move all the […]

Dice Roller in Java Source Code

A six faced dice is used in various gambling games. The following Java program simulates the standard 6 face dice game. The program uses an infinite loop to roll dice until the user decides to exit the program. In addition to printing the face value, the following program can also draw the dice face using […]

How to Remove Extension from Filename in Java

The following function removes extension from a filename using Java. However it will not modify the hidden file names in mac/linux which starts with a dot character. A different implementation is available as part of the Apache commons IO library. // Java example: removes extension from a file name. public class ExtensionRemover { public static […]