Author: admin

  • Talk with AWS APIs – AWS SDK for Java

    So, you have your application deployed on AWS (maybe is just an EC2 instance or a beanstalk environment) and you need the application to know specific data about the environment it is deployed. Example given, the app needs to know if it is running on blue or green environment. These two environments are identical and…

  • Create an AWS Beanstalk Environment using Terraform

    A code example terraform/ˈtɛrəfɔːm/verb: terraform something to make a planet more like Earth, so that people can live on it Oops not this kind of terraform.. If you are a DevOps Engineer or you have widen responsibilities inside your team, probably you have needed to create a server on cloud , or a pipeline or whatever..And…

  • PostgreSQL : Write a function to iterate over the rows of a table and Update the Data

    Assume that you have a table where Subscriptions are stored, example given you have bought a new Spotify subscription, for 3, 6 or 12 months. In this table , the data that are kept are : the creation date (created_at) last update timestamp (last_updated) start_date of Subscription start_date of Subscription end_date of Subscription duration_in_months (3,6…

  • Implement a Redis Cache Service in Java

    What is Redis: Redis is an open source , in-memory data structure store used as a database, cache, message broker, and streaming engine.More info in https://redis.io/docs/about/ Jedis is a client library in Java for Redis Install RedisCheck the instructions in https://redis.io/docs/getting-started/installation/ Java implementation Add the Maven dependency in pom.xml Create a new class JedisCacheService Unit Test: Redis CLI You can verify…

  • Send Multiple Requests Concurrently in Java: Implement CompletableFuture

    Asynchronous programming in Action Modern life is fast.We eat fast food, demand faster internet, shorter delivery times and instant news. So modern applications need to be fast.Fast and reliable. One way to achieve this is by using asynchronous programming.In Asynchronous programming, main thread continues its execution without to be blocked by separate tasks that run…

  • My Git cheat sheet

    Git is the most commonly used version control system used among developers. No need to mention its advantages, you can google them! But, let’s admit it, all developers who love Git, have faced (or still face) difficulties with it and even the most experienced of them keep a cheat sheet to make their life easier.…

  • HttpClient with NTLM authentication

    Step by step, how to create an HttpClient that supports NTLM authentication in Java The Problem: Suppose that we have an instance of Apache HttpClient ( we will use the CloseableHttpClient implementation). We want to perform ΗΤΤP requests to a server that it uses the NTLM authentication security. Some Theory: NTLM is a challenge-response authentication protocol which uses three messages to…

  • Enums

    Sexy, Chic , Powerful Sexy and Chic because they produce elegant code by constraining the choices of what you can pass.Powerful, because by limit your choices , actually increase the code effectiveness (it means the code you write today will work if reused 10 years later ) But , first things first… What is an Enum type? They are classes that export one…