Java for Beginners 7 – Abstract Classes and Interfaces

The Java recognizes the limited nature of abstract classes and interfaces and their inability to become an object or a traditional class. Nevertheless, it is the absence of the qualities above and the ability to use abstract classes in various objects that proves to be incredibly useful to developers. In this article, I briefly outline the possible application of abstract classes and interfaces as well as provide examples to highlight the contrast between them.

[Read more…]

Java for Beginners 4 – Working with Java Loop Statements

Java recognizes three types of loops, namely ‘for,’ ‘while’ and ‘do-while’ loops that all accomplish the similar goals of iterating the block of code until a certain condition is met. The following article explores the differences between each of the loop variants and demonstrates the situations when choosing one type of loop over the other can be a benefit. There are many examples of using all three types of loops, but I’ve selected the general form and the infinite loop to illustrate the primary differences.

[Read more…]

Polyomino Combinatorics: How to count distinct n- letter long array permutations

Let’s say we have 3 arrays of following tetromino letters: J, L, O. Tetromino J is a 4 member long array (J[0],J[1],J[2],J[3]), signifying the number of positions J block can take. L tetromino is also a 4 member long array and O is a square tetromino that has only one position (1 member long array). How do we calculate the total number of all unique n-letter long permutations, without programmatically permuting through them? [Read more…]

Shell script to automatically remove old AWS Lightsail snapshots (and retain a specific number of backups)

In the first post, I have explained how to schedule nightly backups of Amazon Lightsail Instance by leveraging AWS Command Line Interface (CLI). In this post, I’ll show you how to create a bash file that can be scheduled to remove old AWS Lightsail snapshots and retain only a specific number of snapshots in your account.

[Read more…]