[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 “[3/4] Docker: SpringBoot, Hibernate & Web API”

[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 “[2/4] Docker: Setting up MySQL”

[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.

 

C#


Below are some code snippets / recipes that I have had prepared for myself and I thought of sharing with ya’ll as a firs post in C# category. If you do not find one that you are looking for or want more, just drop me a request or comment below, I’d try to address the request.

Example Description Download
Global Variables in C# Different scenarios as your requirement and need zip
Text to SQL Server Read a text file and insert all records in SQL Server. zip
Update combobox items according to selection of column-name in other combobox zip
MySQL(SQL Server) To MsAccess Copy table of Ms-Access from the data of the MySQL zip
(Basic) Reading Ms-Excel spreadsheets Reading data from Excel sheets using C# zip
Updating Ms-Excel spreadsheets Updating data of Excel sheets using C# zip
Accessing .config file The app.config can be used to access some setings (like conn string) anywhere in the project zip
MySQL (SQL Server) database to CSV Convert record set from MySQL query to csv file zip
String Delimiter Various illustrations in a single project, demonstrating ways to use the String.Split() function zip
Date – Times Gets the beginning and ending dates of

  • This Week
  • Last Week
  • This Month
  • Last Month
  • Last 6 Months
  • This Year
  • Last 3 Years
zip
Update/Delete CSV Here is the work around for Updating / Deleting records from CSV, which usually is just a file IO operation otherwise zip
json json in C# using JSON .NET & LINQ zip
json serialization serialization/de-serialization of json zip
Stateful iterations By using yield keyword, difference b/w IEnumerable and IEnumerator zip