Categories
AWS Bash Linux

SSH to AWS EC2 instance in 2 minutes

How to SSH to an AWS EC2 instance in 2 minutes. We automate most of the process using a bash script, jq and the AWS CLI. 1) Open SSH traffic to the EC2 instance Log into the AWS console and go to the EC2 instances section. Then click on blue Instance ID link of the […]

Categories
AWS SQL

Connect to AWS RDS MySQL from Elastic Beanstalk

In this article, we explain how to connect to a decoupled AWS RDS MySQL database from an AWS Elastic Beanstalk Docker environment. We will add the RDS security group to the Elastic Beanstalk environment. 1) Create the AWS RDS database Log into the AWS console, got to the RDS section, and click on the orange […]

Categories
AWS

AWS certificate manager: create a SSL certificate for a GoDaddy domain

How to create a SSL certificate for a GoDaddy domain, using AWS certificate manager. The process is pretty simple: 1) Create a random SSL certificate with AWS certificate manager which is a Certificate Authority (CA) 2) Add the CNAME DNS verification values given by AWS certificate manager to your domain in GoDaddy 3) Wait for […]

Categories
Java

Java Spring Boot app with JSP, API and static file endpoints in 5 minutes

We explain how to build a Java Spring Boot application with JSP, API and static file endpoints. Then we run the application locally and test the endpoints with cURL, to check that they respond correctly. All that in less than 5 minutes. 1) The JSP controller Let’s say we have a JSP file hello.jsp in […]

Categories
Java SQL

Debug Java HikariCP Pool for JDBC SQL with Logback

In this article, we will explain how to use and debug HikariCP Pool for JDBC SQL with Logback. The goal is to be able to monitor how many connections are opened / closed by the connection pool. We will do a multi-thread load test of SQL requests on the pool, and see how it reacts. […]

Categories
Java SQL

JDBC Java transaction rollback demo with batch inserts

In this tutorial, we will see how JDBC Java transactions rollbacks are useful, with a real world example and a full Java demo. We will look at the particular case of batch inserts. 1) Batch inserts without rollback Let’s use the following SQL table: Starting from a JDBC connection object called conn: , the batch […]

Categories
Java SQL

Java JDBC batch inserts and performance test with PostgreSQL

In this tutorial, we will see how to batch SQL insert queries, using Java JDBC. Then, we will do a performance test to compare batched inserts VS non-batched inserts. 1) The SQL table We will use the following table: 2) Batch inserts Starting from a JDBC connection object called conn: simply do: We use the […]

Categories
Java

Download an image directly with Selenium in Java

In this quick tutorial, we will explain how to download an image directly with Selenium in Java. The advantage of this method, instead of using a classic HTTP client like CURL, is that the website will behave exactly the same way as if you were browsing it with a classic browser like Chrome. 1) Setup […]

Categories
Java

Puppeteer Java and Playwright: how to scroll slowly to bottom of page

In this quick tutorial, we will see how to scroll slowly to the bottom of a web page, using Puppeteer Java and Playwright. Playwright is a new browser automation framework developed by Microsoft. It is based on JavaScript Puppeteer. Look here for a quick tutorial on how to use Playwright in Java. 1) Compute the […]

Categories
Java

Browser automation with Java equivalent of Puppeteer: Playwright

In this short tutorial, we will see how to do browser automation with a Java equivalent of JavaScript Puppeteer: a new framework developed by Microsoft called Playwright. 1) Import the dependency in your pom.xml In your pom.xml file, add: <dependency> <groupId>com.microsoft.playwright</groupId> <artifactId>playwright</artifactId> <version>1.15.2</version> </dependency> 2) Open Firefox and navigate to Wikipedia.com To open a Firefox […]