teleren/devto huggingface dataset:
SOLID in Software Development - 5
Tags: programming, beginners, productivity, career
Published: 2023-11-15 14:00:17

**_Dependency Inversion Principle (DIP)_**

The **Dependency Inversion Principle (DIP)** states that "High-level modules should not depend on low-level modules; both should depend on abstractions." In other words, we should depend on high-level abstractions (interfaces, abstract classes) rather than on low-level concretions (concrete classes, implementations). This makes our code more flexible and easier to test.

Here is an example of how the DIP can be violated:

```java
public class EmailService {
    private SendEmailUseCase sendEmailUseCase;

    public EmailService(SendEmailUseCase sendEmailUseCase) {
        this.sendEmailUseCase = sendEmailUseCase;
    }

    public void sendEmail(String to, String subject, String body) {
        sendEmailUseCase.sendEmail(to, subject, body);
    }
}

public class SendEmailUseCase {
    private SMTPClient smtpClient;

    public SendEmailUseCase(SMTPClient smtpClient) {
        this.smtpClient = smtpClient;
    }

    public void sendEmail(String to, String subject, String body) {
        smtpClient.connect();
        smtpClient.send(to, subject, body);
        smtpClient.disconnect();
    }
}
```

The `EmailService` class depends on the `SendEmailUseCase` class, which in turn depends on the `SMTPClient` class. This violates the DIP because the `EmailService` class depends on a low-level concretion (`SMTPClient`). This makes the `EmailService` classless flexible and more difficult to test.

A better way to design this code would be to use an interface to abstract the `SMTPClient` class:

```java
public interface SMPTClient {
    void connect();
    void send(String to, String subject, String body);
    void disconnect();
}

public class EmailService {
    private SMPTClient smtpClient;

    public EmailService(SMPTClient smtpClient) {
        this.smtpClient = smtpClient;
    }

    public void sendEmail(String to, String subject, String body) {
        smtpClient.connect();
        smtpClient.send(to, subject, body);
        smtpClient.disconnect();
    }
}

public class MockSMPTClient implements SMPTClient {
    @Override
    public void connect() {
        // Implement mock connection logic
    }

    @Override
    public void send(String to, String subject, String body) {
        // Implement mock send logic
    }

    @Override
    public void disconnect() {
        // Implement mock disconnect logic
    }
}

public class SendEmailUseCase {
    private SMPTClient smtpClient;

    public SendEmailUseCase(SMPTClient smtpClient) {
        this.smtpClient = smtpClient;
    }

    public void sendEmail(String to, String subject, String body) {
        smtpClient.connect();
        smtpClient.send(to, subject, body);
        smtpClient.disconnect();
    }
}
```

This code follows the DIP because the `EmailService` class depends on an interface (`SMPTClient`) rather than on a low-level concretion (`SMTPClient`). This makes the `EmailService` class more flexible and easier to test.

<center>**** 💻ALL THE BEST💻 ****</center>
Wednesday Links - Editon 2023-11-15
Tags: java, jvm, intellij, git
Published: 2023-11-15 13:57:32

How to find dead code in your Java services (8 min)☠️
https://foojay.io/today/how-to-find-dead-code-in-your-java-services/

In-memory HttpServer Handler (1 min)🧠
https://inside.java/2023/11/06/in-memory-http-server-handler/

Exploring the OpenTelemetry Collector (7 min)🔭
https://blog.frankel.ch/opentelemetry-collector/

Micrometer 1.12.0 Released (30 sec)🎉
https://github.com/micrometer-metrics/micrometer/releases/tag/v1.12.0

BellSoft releases LibericaJDK with CRaC Support (4 min)🎉
https://bell-sw.com/blog/bellsoft-releases-liberica-jdk-lts-17-and-21-with-coordinated-restore-at-checkpoint-crac-for-fast-startup/

How Async-Profiler's crash handler works (5 min)💥
https://richardstartin.github.io/posts/async-profiler-crash-handler

Declarative Gradle (7 min)📃
https://blog.gradle.org/declarative-gradle

IntelliJ HTTP Client: Using External Files As JSON Payload (1 min)📦
https://blog.mrhaki.com/2023/11/intellij-http-client-using-external.html

How git cherry-pick and revert use 3-way merge (8 min)🍒
https://jvns.ca/blog/2023/11/10/how-cherry-pick-and-revert-work/
SSHing your way into AppService
Tags: azure, devops, webdev, security
Published: 2023-11-15 13:54:15

When we started to migrate our core platform from a single virtual machine on DigitalOcean to a managed webapp solution on Azure, AppService, the first question was: can we recycle our CI/CD flows?

The answer was: yes! Together with fellow cloud engineer @ayoayomide , let us tell you how we did it! See the full story [here](https://medium.com/@sharesquare-engineering/appservice-meets-ci-cd-fb1729787f35).

_Spoiler alert_. We could keep our SSH-based deployment pipeline, written in [Deployer](https://deployer.org/), yet we had to enable and patch a rather hidden SSH feature in the Azure AppService itself.
Call Child Component's Functions From Parent Component
Tags: react, frontend, forwardref, reacthook
Published: 2023-11-15 13:51:21

Sometimes, we want to call functions from child components. It's easier to call the parent's function by sending the function as a property, but to call the child component's function is a bit tricky. In most cases, if we design the component properly with SOLID patterns, there are not many chances to face this situation.

##1. Using `forwardRef` and `useImperativeHandle`

You can wrap the Component that you want to access with `forwardRef` and define `useImperativeHandle`


```javascript

    import React, {
      forwardRef,
      useImperativeHandle
    };

    const TestComponent = forwardRef((variables, ref) => {

      useImperativeHandle(ref, () => ({

        customFunc() {
          // do what you want here: you can return value 
          // or call function inside of the TestComponent
        }
      }))

      return <div > Hello < /div>;

    })
```



and from another component,

```javascript
    import React, {useRef} from 'react';

    const AnotherComponent = () => {
      const compRef = useRef();


      return <div role="none" onClick={() => {
      // this func() will be replaced the function that you defined in the
      // useImperativeHandle from the TEstComponent
      compRef.func()
      }}>
        <TestComponent ref={compRef} />
      </div>
    }


```

##2. Using `React.useEffect` and `React.State`

You can update the state from the Parent Component and pass that state variable to the component that you want to receive.

```javascript

    import React, {
      useEffect,
      useState
    } from 'react';

    // Parent Component 
    const ParentComponent = () => {
      // better to use object due to refresh the variable
      const [state, setState] = useState(null);




      return <div role="none" onClick={() => {
        // if you click the parent component it will update state
        // and when the state is updated, then the Child Component will 
        // receive the update from the useEffect
        setState({update: 'update'});
      }}> 
              <ChildrenComponent update={state} /> 
             </div>;

    }

    const ChildComponent = ({update}) => {

    useEffect(() => {
    // this will be called whenever the update object is changed
    // so you can put something here to update the Child Component's state
    }, [update])

    return <div>Child</div>

    }
```
Navigating Secure Transactions: The Role of Payment Gateways
Tags: payment, fintech
Published: 2023-11-15 13:47:20

Secure transaction processing: Payment gateways ensure confidential and secure transfer of payment information, which builds confidence between buyers and sellers.
Accelerated authorization and processing: These gateways quickly authorize and process transactions, ensuring a seamless experience for both parties.
Support for different payment methods: From credit cards to digital wallets, payment methods cater to customer preferences
Strong security measures: Top [payment gateways](https://www.onepay.com/payment-methods/?utm_source=dev&utm_medium=social_bookmarking&utm_id=F001) implement strong security measures to protect sensitive information from cyber threats.
Customized Commerce Experience: Choosing the right payment method simplifies the transfer of funds, enhancing the overall transaction experience for businesses and consumers.
SOLID in Software Development - 3
Tags: programming, beginners, productivity, career
Published: 2023-11-15 13:40:53

**_Liskov Substitution Principle (LSP)_**

The Liskov Substitution Principle (LSP) states that objects of a superclass should be replaceable with objects of its subclasses without breaking the application. This means that subclasses should be able to fulfill the same contract as their superclass without introducing any unexpected behavior.

Here is an example of how the LSP can be violated:

```java
public class Rectangle {
    private double length;
    private double width;

    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    public double getArea() {
        return length * width;
    }
}

public class Square extends Rectangle {
    public Square(double side) {
        super(side, side);
    }

    @Override
    public double getArea() {
        return side * side * side; // This violates the LSP because it changes the behaviour of the `getArea` method
    }
}
```

The `Square` class is a subclass of the `Rectangle` class. However, the `getArea` method of the `Square` class violates the LSP because it changes the behaviour of the `getArea` method of the `Rectangle` class. This means that if we substitute an object of the `Square` class for an object of the `Rectangle` class, then the program may break.

A better way to design this code would be to have the Square class return the correct area:

```java
public class Rectangle {
    private double length;
    private double width;

    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    public double getArea() {
        return length * width;
    }
}

public class Square extends Rectangle {
    public Square(double side) {
        super(side, side);
    }

    @Override
    public double getArea() {
        return side * side;
    }
}
```

This code follows the LSP because the `getArea` method of the `Square` class does not change the behaviour of the getArea method of the Rectangle class.
<center>***** More to Part 4 *****</center>
<center>**** 💻ALL THE BEST💻 ****</center>
8 Essential Free Resources for Cloud Architects and DevOps Practitioners
Tags: career, devops, learning, terraform
Published: 2023-11-15 13:23:00

> Boost your skills in cloud architecture and DevOps with our top 8 free resources. Learn about Terraform, Azure, CI/CD, and more to advance your career in the cloud.

In the fast-evolving world of cloud technology, Cloud architects and DevOps practitioners must continuously update their skills. With new cloud services and features being released regularly, staying abreast of the latest developments is crucial. As the demand for professionals skilled in Infrastructure as Code (IaC) and Terraform grows, these free resources can be invaluable in keeping your skills sharp and your career on track.

## 8 Free Resources to Enhance Your Cloud and DevOps Skills

### 1. Terraform in 45 min

Learn to manage cloud infrastructures efficiently using Terraform. This resource is perfect for beginners and intermediate users looking to refine their Terraform skills.

### 2. Terraform Variables and How to Use Them
Understand the types of variables in Terraform, their applications, and best practices for using secrets. This guide is essential for mastering the intricacies of Terraform.

### 3. Terraform Modules and How to Use Them
Dive into Terraform modules, learn to create your own, and understand the challenges and best practices of maintaining modules within a team.

### 4. Build the Azure Landing Zone
A practical guide on designing and deploying a hub and spoke landing zone in Azure. Ideal for those looking to specialize in Azure infrastructure.

### 5. What CI/CD Means for the Infrastructure
Explore the latest trends and best practices in CI/CD. This resource includes real-world examples showing how continuous integration and delivery can streamline cloud infrastructure management.

### 6. Disaster Recovery for Cloud Infrastructures
Learn the fundamentals of disaster recovery planning for cloud infrastructure. Discover best practices and real-world examples of successful implementations.

### 7. Secrets in IaC and Building Secure Cloud Infrastructure
Gain insights into managing sensitive information in cloud infrastructures. Learn about security best practices and explore real-life use cases like Azure Key Vault and AWS KMS.

### 8. Unified Design Platform, Beyond IaC
Discover Brainboard’s approach to “design first, code when needed” and learn how to ensure that your infrastructure is secure, compliant, and budget-friendly before executing any code.

## Conclusion and Additional Resources
These resources offer a wealth of knowledge for Cloud architects and DevOps practitioners looking to stay ahead in their careers. For those interested in receiving these resources in PDF format or accessing video content, [visit Brainboard’s YouTube channel.](https://www.youtube.com/@brainboard/streams)
React component for a golden ticket
Tags: freecodez, react, html, blog
Published: 2023-11-15 13:17:46

Hey there, You are most welcome to this article. I hope you will enjoy this article. If you like this article then please share this article with your friends and colleagues. If you have any questions or suggestions regarding this article then please comment down below.

**React component for a golden ticket**

![React component for a golden ticket](https://res.cloudinary.com/dbw0zmw7u/image/upload/v1700054262/images/daqtkmrldflg2lnazgjy.webp)

For full source code visit : [https://freecodez.com/post/5mvuyhk](https://freecodez.com/post/5mvuyhk)


```
// https://freecodez.com
const Ticket = () => {
	return (
		<div class="one-div"></div>
	);
};

```

Source Code : [https://freecodez.com/post/5mvuyhk](https://freecodez.com/post/5mvuyhk)

For more such articles visit : [https://freecodez.com](https://freecodez.com/all)
Min-maxing: Why you should consider unoptimizing your life
Tags: webdev, productivity, career, development
Published: 2023-11-15 13:05:16

What is min-maxing? If you do not play video games you may not be familiar with the term. Min-maxing has its roots in gaming. It refers to the practice of playing a game with perfect mathematical efficiency, in-order to achieve the best possible chance at success. This could mean crafting the perfectly balanced gun in Call of Duty or choosing the perfect set of abilities for your class in a game like World of Warcraft. As an avid gamer and someone with a competitive nature I was a slave to the min-maxing process. Despite its clear hand in improving success, it sucks some aspects of the game away - the satisfaction of playing the game how you want to play it. You instead have to spend time doing research on how the play the game most efficiently. I didn’t realize how sucked into the process I was until it started bleeding into my life outside of video games.

I first noticed my addiction to min-maxing after I told myself I was going to start journalling. I began as most people do by handwriting my journal using a pen and paper. It didn’t take long before I began to question my speed while using a pen. Not only was it slow to journal with a pen, it was also less effective in-terms of storage, retrieval, and security. You can’t password protect a handwritten journal. At least not as easily as you can a computer. To be fair, the quality of my handwriting would probably not be decipherable by most either way. I was not naive to the fact that maybe efficiency was not the goal when journalling. Maybe the goal is to be more mindful and slow. So I dusted off my keyboard and started researching. I found arguments on both sides of the camp. I ended up trying out both hand written and typed to see if I preferred one or the other. Typing my journal opened a whole new can of worms as now I started looking into the best software for note taking and journaling. I spent a lot of time going down the the Obsidian rabbit hole..

After spending hours customizing note taking tools and trying different strategies I realized that I was not spending time doing what my original goal was in the first place - journalling. My takeaway from this was to always remind myself of my goal and to ensure that I do not get lost in the path to achieving that goal. Keep the path simple and allow yourself to dedicate all of your time walking down it.
32. A day in color (Day 30)
Published: 2023-11-15 12:59:12

Today, I delved into the fascinating world of Color Theory during a self-study session.

NOTE: Since we use American English in coding language, I am using COLOR, instead of COLOUR :)

Little did I realize the depth of research conducted on the subject of colors and their significance in design. Considering the ubiquity of colors in various aspects of our lives – from products and logos to clothes, house paints, and even food – it's evident that understanding the psychology of colors is crucial.

Take fast-food restaurants, for example. Many of them strategically incorporate red in their advertising and packaging, a choice rooted in the color's association with hunger. According to [Karen Haller](https://karenhaller.com/journal/branding-why-red-yellow-is-used-by-the-fast-food-industry), a behavior design consultant, red stimulates appetite, and attracts attention, while yellow elicits feelings of happiness and friendliness. The combination of red and yellow signifies speed and quickness, a tactic commonly employed by the fast-food industry.

Exploring the basics, there are three types of colors: Primary colors serve as the foundation for all others, secondary colors result from combining two primary colors, and tertiary colors emerge from mixing primary and secondary hues. Traditionally, red, blue, and yellow were considered primary, but recent research suggests magenta, cyan, and yellow as the new primary colors, as stated in an [article by Webflow](https://webflow.com/blog/color-theory).

Navigating the Color Wheel, initially, may seem perplexing in terms of practical application. However, mastering the art of using colors in design is crucial.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5625kzgnl2p1e1c9ota1.png)

It adds a layer of aesthetic appeal to your coding efforts, making the end product visually engaging for users. While it might pose a challenge for those more inclined to focus on code than creative expression, being creative with colors doesn't necessarily mean going overboard. Finding the right mix, even in a minimalist approach, can transform your coding work into a visually pleasing experience. This [website from Dulux](https://www.dulux.com.au/how-to/how-to-use-colour/how-to-use-a-colour-wheel/), explains the different methods of using a Color Wheel, which I need to study more.

Sweet colored dreams for now! Good night :)
simple flutter application example
Published: 2023-11-15 12:54:56

This is my personal experience as I am learning flutter and dart by myself, A simple flutter application example is very helpful for beginner mobile programmers in learning to create mobile applications with flutter. Practicing in making mobile applications with Flutter will hone your skills to become even better, so you have to keep practicing… and don’t get bored quickly. A simple Flutter app can vary depending on your creative ideas. For example, let’s create a simple app that displays a random motivational quote every time the user clicks a button.
[example](https://webbaliseo.com/en/flutter-app-example/)
Spring boot deploying old project
Tags: springboot, webdev, programming, node
Published: 2023-11-15 12:50:20

Hi guys hope Ur good I'm beginner to fullstack development and I'm using frontend as angular frame work and backend as spring boot framework i developed two projects first one run successful and second one also runs successful but when i open second project browser http://localhost:8080/api/login using this URL it deployes me old project i check internet to solve this issue but no use is anyone help on this issue as soon as possible
Unlocking the World of Finance: AAT Level 2 with Future Connect Training
Tags: webdev, beginners, tutorial
Published: 2023-11-15 12:38:09

The world of finance presents endless opportunities for those with the right qualifications and skills. If you're looking to embark on a career in accounting and finance, the Association of Accounting Technicians (AAT) Level 2 course is an excellent starting point. Among the reputable providers, Future Connect Training stands out as an institution that offers comprehensive AAT Level 2 courses, empowering individuals with the knowledge and expertise to flourish in the financial industry. In this blog article, we will explore the significance of AAT Level 2 and how Future Connect Training can set you on the path to a successful career in finance.
**Understanding AAT Level 2**
AAT Level 2 is the foundation of the AAT qualification pathway, designed to introduce beginners to the fundamental principles of accounting and finance. Whether you have no prior experience in this field or wish to reinforce your existing knowledge [aat level 2](https://www.fctraining.org/aat-level-2.php), AAT Level 2 is the perfect starting point.
The Level 2 course comprises essential modules that lay the groundwork for your accounting journey. Topics covered typically include bookkeeping transactions, bookkeeping controls, elements of costing, and computerized accounting. This comprehensive curriculum ensures that students develop a solid understanding of the core concepts required to excel in accounting roles.
**Future Connect Training:** A Leader in AAT Level 2 Education
When it comes to AAT Level 2 courses, Future Connect Training has established itself as a reputable and trustworthy provider aat level 3. Here are some reasons why Future Connect Training shines in delivering AAT Level 2 education:
Experienced and Knowledgeable Tutors: The success of any [educational institution](https://en.wikipedia.org/wiki/Association_of_Accounting_Technicians) lies in the expertise of its tutors. Future Connect Training takes pride in its team of experienced and knowledgeable tutors who possess a deep understanding of accounting principles. They are not only adept at conveying complex concepts in a clear manner but also offer valuable real-world insights from their own experiences in the financial industry.
**Interactive Learning Environment**: Future Connect Training fosters an interactive and supportive learning environment for its students. With small class sizes, each student receives individual attention, allowing for a more personalized learning experience.
smo services
Tags: smo, smoexperts, socialmediamarketing, socialmediaoptimization
Published: 2023-11-15 12:37:01


Ignite your social media presence with NextDynamix's **[smo services](https://nextdynamix.com/services/smo-services/)**. Engage your audience, build loyalty, & drive growth| Best Social Media Optimization Company

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gh6s1r9mwg5cw1iw1xcp.jpg)