TechBrain Review Newsletter 2024-07/08
TechBrain.one & Pexels.com

TechBrain Review Newsletter 2024-07/08

Hey there ??

?? Welcome to the TechBrain Review newsletter, Issue No. 7-8, July-August 2024! ??


This time a bit late due to vacation period, but I would like to present doubled package of goods:

#Technology

Use containers technology to develop and test locally

Docker containers provide an isolated environment for developing and testing applications (Java/Python/.NET/other), ensuring consistency across different environments. Here’s a guide to effectively use tools within Docker for sandbox development and testing.

1. Install Docker

2. Create simple Java app

In this example I'll use Java 21 and Maven.

Java servlet

package com.example;

import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html><body>");
        out.println("<h1>Hello, World! (Java 21)</h1>");
        out.println("</body></html>");
    }
}        

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0"
         xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>hello-world-java21</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>hello-world-java21</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.2</version>
            </plugin>
        </plugins>
    </build>
</project>        

3. Create Dockerfile

FROM tomcat:11.0-jdk21

# Remove default Tomcat applications
RUN rm -rf /usr/local/tomcat/webapps/*

# Copy our WAR file to the webapps directory
COPY target/hello-world-java21.war /usr/local/tomcat/webapps/ROOT.war

# Expose the default Tomcat port
EXPOSE 8080

# Start Tomcat
CMD ["catalina.sh", "run"]
        

4. Build Java app

mvn clean package        

5. Build the Docker Image

Navigate to the directory containing your Dockerfile and run the following command:

docker build -t hello-world-java21 .        

6. Run the container

Once the image is built, you can run it using:

docker run -d -p 8080:8080 --name hello-world-java21-container hello-world-java21        

7. Integrating with CI/CD

Docker integrates seamlessly with CI/CD pipelines, allowing for automated testing and deployment. In your pipeline configuration, add steps to build and run your Docker image.

8. Sandbox Development

Using Docker, you can quickly spin up containers for different versions of your application, test new features, and share your development environment with your team, ensuring everyone works in identical conditions.

9. Testing with Docker

Containers are perfect for testing. You can run unit tests, integration tests, and even performance tests within containers. This ensures that your tests run in a consistent environment, eliminating the "it works on my machine" problem.

Conclusion

Docker containers are powerful tools for Java development and testing. They provide isolated environments, ensuring consistency across different stages of the development lifecycle. By using Docker, you can streamline your development process, facilitate collaboration, and enhance the reliability of your Java applications.


#Management

Pomodoro technique

Credits: Pixabay (

The Pomodoro Technique, developed by Francesco Cirillo in the late 1980s, offers a simple yet powerful method to enhance focus and productivity. Named after the tomato-shaped kitchen timer Cirillo used, the Pomodoro Technique breaks work into manageable intervals, traditionally 25 minutes, separated by short breaks.

How It Works

  1. Choose a Task: Begin by selecting a task you need to accomplish.
  2. Set the Timer: Set a timer for 25 minutes. This period is known as one Pomodoro.
  3. Work Intensely: Focus solely on the task at hand until the timer rings. Avoid all distractions.
  4. Take a Short Break: Once the Pomodoro is complete, take a 5-minute break. Step away from your workspace, stretch, or grab a coffee.
  5. Repeat: After completing four Pomodoros, take a longer break of 15-30 minutes to recharge.

Benefits

  1. Enhanced Focus: By working in short, dedicated bursts, the technique reduces the mental strain associated with long periods of concentration.
  2. Reduced Procrastination: The Pomodoro Technique encourages immediate action, as each work period is limited.
  3. Increased Productivity: Regular breaks prevent burnout, allowing for sustained productivity throughout the day.
  4. Improved Time Management: By breaking tasks into smaller intervals, it becomes easier to estimate the time needed for each activity and prioritize effectively.

Tips for Success

  • Eliminate Distractions: Turn off notifications and create a quiet workspace.
  • Plan Your Pomodoros: At the start of the day, outline which tasks will fill each Pomodoro.
  • Adjust Intervals: While 25 minutes is standard, some may find longer or shorter intervals more effective.

The Pomodoro Technique’s blend of focused work and regular breaks is a straightforward yet transformative method to boost efficiency. Whether tackling complex projects or managing daily chores, this technique helps maintain a balanced approach to productivity, making it an invaluable tool for anyone looking to master their time.


#(Self)Development

RESTful vacation

Credits: Pixabay (

Understanding the importance of rest and vacation is crucial for fostering self-development and enhancing the learning curve. Regular rest and vacation periods provide essential mental and physical rejuvenation, preventing burnout and maintaining high levels of productivity and creativity. Breaks from routine work environments allow individuals to reset their minds, reducing stress and increasing overall well-being. This downtime is vital for cognitive processes, as it enables the brain to consolidate information, improve memory retention, and facilitate problem-solving abilities.

Vacations also offer opportunities for new experiences and perspectives, which can stimulate creativity and innovation. Engaging in different activities and environments during vacations can inspire fresh ideas and insights that can be applied to professional and personal life. Furthermore, rest and relaxation enhance emotional resilience, allowing individuals to handle stress and challenges more effectively upon returning to work.

Overall, taking time off from work fosters a balanced lifestyle, contributing to long-term professional success and personal fulfillment. By prioritizing rest and vacations, individuals can improve their learning curve, stay motivated, and achieve continuous self-development, ultimately leading to enhanced performance and satisfaction in their roles.


#Misc

Books that influenced me the most. Part 4

https://www.renaud-bray.com/Livres_Produit.aspx?id=1423711&def=Meditations,MARC+AURèLE,9780140449334

Marcus Aurelius' book, "Meditations," is a series of personal writings by the Roman Emperor, reflecting on Stoic philosophy and guidance for personal growth and ethical conduct. Written during his military campaigns between 170 and 180 AD, it provides a profound insight into the mind of a ruler grappling with the responsibilities of leadership while striving for personal virtue. The work is divided into twelve books, each offering thoughts and aphorisms on topics such as self-discipline, rationality, and the nature of the human condition. "Meditations" is not just a historical document but a timeless manual for inner peace and resilience.

Three key takeaways for modern users are:

  1. Embrace Impermanence: Marcus Aurelius frequently reminds readers that everything is transient. Accepting the impermanent nature of life can help individuals focus on the present and appreciate the moment, reducing anxiety about the future.
  2. Cultivate Inner Strength: The book emphasizes developing inner virtues like wisdom, courage, and self-control. By fostering these qualities, one can maintain composure and make rational decisions, even in challenging situations.
  3. Practice Mindfulness and Reflection: Regular self-examination and mindfulness are crucial for personal growth. By reflecting on one's actions and thoughts, modern readers can identify areas for improvement and align their lives with their values, leading to a more meaningful and fulfilled existence.


Thanks for reading this newsletter! I hope it was useful and you enjoyed it ?? I'm going to share more content related to Multi-Cloud Architecture (Azure, AWS, GCP, Alibaba, and Oracle), DevSecOps transformation, Productivity tips, and Education (5x University graduate in IT, Philosophy, Cognitive Science, Sociology and Education; getting more fluency in 5x languages ????????????????????).

Dr Przemys?aw Chmielecki

Rendez-vous dans le prochain épisode! Merci, très chers, d'être ici! ??


I encourage you to subscribe to this newsletter ?? and stay tuned for new technical and productivity content ??

要查看或添加评论,请登录

Przemys?aw Chmielecki, PhD的更多文章

  • Modern technology and ancient times

    Modern technology and ancient times

    It would seem that modern technological solutions such as cloud computing, containers or infrastructure as code cannot…

  • TechBrain Review Newsletter 2024-12 ????

    TechBrain Review Newsletter 2024-12 ????

    Hey there ?? ?? Welcome to the TechBrain Review newsletter, Issue No. 12, December 2024! ?? As a good tradition of this…

  • TechBrain Review Newsletter 2024-11

    TechBrain Review Newsletter 2024-11

    Hey there ?? ?? Welcome to the TechBrain Review newsletter, Issue No. 11, November 2024! ?? As a good tradition of this…

  • TechBrain Review Newsletter 2024-10

    TechBrain Review Newsletter 2024-10

    Hey there ?? ?? Welcome to the TechBrain Review newsletter, Issue No. 10, October 2024! ?? As in the recent issue, I…

  • TechBrain Review Newsletter 2024-09

    TechBrain Review Newsletter 2024-09

    Hey there ?? ?? Welcome to the TechBrain Review newsletter, Issue No. 9, September 2024! ?? As in the recent issue, I…

  • TechBrain Review Newsletter 2024-06

    TechBrain Review Newsletter 2024-06

    Hey there ?? ?? Welcome to the TechBrain Review newsletter, Issue No. 6, June 2024! ?? As in the recent issue, I would…

  • TechBrain Review Newsletter 2024-05

    TechBrain Review Newsletter 2024-05

    Hey there ?? ?? Welcome to the TechBrain Review newsletter, Issue No. 5, May 2024! ?? As in the recent issue, I would…

  • TechBrain Review Newsletter 2024-04

    TechBrain Review Newsletter 2024-04

    Hey there ?? ?? Welcome to the TechBrain Review newsletter, Issue No. 4, April 2024! ?? As in the recent issue, I would…

  • TechBrain Review Newsletter 2024-03

    TechBrain Review Newsletter 2024-03

    Hey there ?? ?? Welcome to the TechBrain Review newsletter, Issue No. 3, March 2024! ?? As in the recent issue, I would…

  • TechBrain Review Newsletter 2024-02

    TechBrain Review Newsletter 2024-02

    Hey there ?? ?? Welcome to TechBrain Review newsletter, Issue No. 2, February 2024! ?? As in the recent issue, I would…

社区洞察

其他会员也浏览了