[4/4] Docker: Front-end development w/ Java, SpringBoot MVC & RESTful Web API


Today we are going to talk about adding front end user interface to our application, from scratch. We can add the front end to our application using something called view resolvers. Our options are Apache Tiles, JavaServer Pages (JSP), etc. there are many other options, as well. Spring Boot supports FreeMarker templates, Groovy Templates and Themyleaf via “AutoConfiguration”, as the first class citizens. As the name suggests, we should not need to do a whole lot to get going with one of these. In this video we would be looking at Thymeleaf. I find it easy to use and feature rich at the same time. Thymeleaf is mostly HTML. Finally, we will talk about Web JARs & How to add Branding to our web application, using responsive web design. Continue reading →

Advertisements

SpringBoot: Debug faster


Tired of rebuilding your Spring Boot web application every time you change your HTML markup or Java class? Thanks to IntelliJ IDEA and SpringBoot DevTools, you can easily code and debug faster without wasting time rebuilding your application over and over again. The solution discussed here would run your project as soon as your code change, and it would refresh your Thymeleaf HTML templates for the front end without even having to rebuild the project.

The actual work required to configure your project is not much. All, in all, you need to Continue reading →

[3/4] Docker: SpringBoot, Hibernate & Web API


In previous episodes (Part1, Part2) we saw how to create Java Maven project from scratch using SpringBoot – followed by how to deploy the application to docker and then I also demonstrated how can you set up MySQL database server, with automated initialization of a fresh database instance.

Now, let’s see how to set up RESTful Web API to display data from database using Hibernate ORM. We’ll also see how to set up a local development environment and docker deployment environment to quickly switch between the two, and establish an efficient work-flow for your project. Next, we’d set up our project to perform CRUD operations using Hibernate. And finally, we will create our Web API endpoints which can serve the requests made from the browser, in JSON format.

Let’s Continue reading →

[2/4] Docker: Setting up MySQL


Previously, in this series we talked about getting started with docker and performing some elementary operations. In this episode, we’d dive deeper into docker, and then we’d swing by some of the commands you could use to follow along, and perform some common tasks in a terminal window.

Docker command line: Getting started

If you were to run a following command, you can see all containers, including the ones which are stopped, using the following command:

$ docker container ls -a

With following command, you can see all docker images:

$ docker image ls -a

As you can probably tell, this command is almost identical to the command to list (ls) all (-a).
Following are the equivalent commands to the two commands we saw above, respectively:

$ docker ps -a $ docker images -a

Let’s say you want to, download (pull) a docker image, say MySQL, in advance. It is just like cloning a repository from GitHub:

$ docker pull mysql

If no tag is specified, then :latest tag is assumed by default. Now to run this newly downloaded image, you can possibly run the following command:

Running the container:

$ docker run \
  -d
  -e MYSQL_ROOT_PASSWORD=p4$$W0rd \
  -e MYSQL_DATABASE=epidemics \
  -e MYSQL_USER=epidemics \
  -e MYSQL_PASSWORD=epidemics \
  -p 3306:3306 \
  --name mysql \
  --mount type=bind,source=/abs_path/,target=/docker-entrypoint-initdb.d \
 mysql

Continue reading →

[1/4] Docker: Java, SpringBoot, MySQL & docker-compose


I created a video, for a web conference for my school. In this video I talk about how to perform initial groundwork to perform initial set-up. In the 2nd episode, I would talk more about the docker-compose v2, v 2.1 and v2.3.

 

Screen Recording: Ubuntu


I have used CamStudio in Windows, and I am happy with it but, there are times when we have to make the most of what is available.This time, I needed to record screen-cast in Ubuntu.

# add-apt-repository ppa:maarten-baert/simplescreenrecorder
# apt update
# apt install simplescreenrecorder

Despite of being simple, it has all essential features of CamStudio for Windows or QuickTime for macOS, and it recorded very good quality of audio and video! Making itself my new favorite screen recording application.

Earlier, I tried using VLC for screen capturing, because it helps me to avoid yet another software program on my computer on my computer and, VLC also lets me choose file formats to save my recording to.

Here are the steps:

Continue reading →

Install OpenCV: ~10 min!


Disclaimers

  1. Tested on: Windows 7, Windows 10
  2. There could be other ways to get Open CV working on your Windows computer

Before installation

  1. Find you OS architecture
  2. Decide the Python version (e.g. 2.7 or 3.x)
  3. Install Anaconda, open terminal as administrator and , Continue reading →

IsClose() in python


This post tries to answer whether given numbers are comparatively close to each other. This can help if you are using Python for data science or in the area of computer vision doing computing with images. A quick stack-overflow search shows discussion around finding “nearest” value from a set of given values for any given number [1] [2] [3]. However, there could be a need to limit how much further the nearest number could be. I’d call this limit a “threshold”.

Quite a few times, in my Python (esp. in computer vision related) programming I come across scenarios when I want to tell if the two numbers are close to each other. Some might ask, “Well define close!?” or “How close?”, well … comparatively close.

Now Continue reading →