teleren/devto huggingface dataset:
Java Interfaces Default Methods
Tags: java, development, programming
Published: 2023-09-14 09:14:07

In an application where an interface has one or multiple implementations, if we add a method to the interface, all of its implementations will be forced to implement it

But using default interface methods, we can add new methods to an interface that are automatically available in the implementations. Therefore, there’s no need to modify the implementing classes.

Let’s see an example


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

Here, we have our Animal interface containing two default methods, "sleep" and "wake up." Now, let's implement it in two classes, "Cat" and "Bird."

Cat class: 

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

Bird class:

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

Now, as you can see, we did not implement either of the two default methods in the “Cat” and “Bird” classes. However, as we can observe in our main method, these default methods are available in both classes.


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

So far so good . However, as you might have already guessed, this could lead to a big problem if we implement multiple interfaces with the same default method (the multiple inheritance dilemma v2.0 😅).

But don’t worry, the Java team has you covered. Let’s see an example. We’ll add a new interface called “Mammal” and implement it in our “Cat” class.


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

Now that our Cat class implements both the Mammal and Animal interfaces, it might get confused about which default method to use, and our application will raise the following error:


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

To fix this error, we should override the method and either create a new implementation of our own. In this implementation, if we want, we can basically call one of the old implementations explicitly using the super keyword. This allows us to specify which implementation to use and resolve the ambiguity.

Case 1 : Simple new implementation


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

Case 2 : as you may see I called both implementations to show you that it is possible , or you may choose the one that suits you


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

I hope you now have a clear understanding of what default methods are, and thank you for reading.

> Akihiki
DOM Manipulation with JavaScript: Bring Your Web Page to Life!
Tags: webdev, javascript, tutorial, beginners
Published: 2023-09-14 09:07:33

Hello beautiful people! 

Ever wondered how to make your web page interactive and dynamic? Well, that's where DOM _(Document Object Model)_ manipulation with JavaScript comes into play. In this quick read, we'll explore the basics of DOM manipulation and how it can add life to your web projects.

## Understanding the DOM

Before we dive into the magic of DOM manipulation, let's get the basics right. The DOM is a programming interface for web documents. It represents the structure of a web page and allows us to interact with its elements. Each HTML element on your page is a part of the DOM, and you can think of it as a tree-like structure.

![DOM tree](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bs59hw1b25jpjrj9aehw.png)

---

## Accessing DOM Elements

The first step in DOM manipulation is accessing the elements you want to work with. You can do this using JavaScript's **document object**. For instance, to select an element with an _id_ of `myElement` you can use:
```javascript
const element = document.getElementById('myElement');
```
You can also select elements by class, tag name, or other attributes using methods like `querySelector` and `querySelectorAll`.

---

## Modifying Elements
Now that you've got your hands on an element, it's time to make some changes. Here are a few common operations:

### Changing Text Content
```javascript
element.textContent = 'New Text Content';
```

### Modifying HTML

```javascript
element.innerHTML = '<p>This is a paragraph.</p>';
```

### Changing Styles
```javascript
element.style.color = 'red';
element.style.fontSize = '20px';
```

### Adding or Removing Classes
```javascript
element.classList.add('new-class');
element.classList.remove('old-class');
```
---

## Handling Events
DOM manipulation is not just about changing things; it's also about responding to user actions. You can use event listeners to make your page interactive. For example, to execute code when a button is clicked:
```javascript
const button = document.getElementById('myButton');
button.addEventListener('click', () => {
  alert('Button clicked!');
});
```

---

## Creating New Elements
Sometimes, you may want to add new elements to your page dynamically. You can create elements using document.createElement and then append them to the DOM.

```javascript
const newElement = document.createElement('div');
newElement.textContent = 'I am a new element';
document.body.appendChild(newElement);
```
---

## Removing Elements
And, of course, you can remove elements too!

```javascript
const elementToRemove = document.getElementById('toBeRemoved');
elementToRemove.remove();
```
---

## Putting It All Together
With these basic tools, you can perform a wide range of DOM manipulations, from updating text and styles to adding, removing, and responding to elements. The DOM is your playground, and JavaScript is your tool to create amazing web experiences.

So go ahead, experiment, and have fun bringing your web pages to life with DOM manipulation and JavaScript! 🚀
Laravel 10 Passport Authentication REST API Example
Published: 2023-09-14 09:07:09

Laravel 10 Passport is a Laravel package that provides an easy way to set up an authentication system for your API. It uses an OAuth2 server to create tokens for user applications that request to interface with the REST API. Only validated tokens are granted access.

## Laravel 10 Passport Authentication REST API Example

Here are some steps for setting passport in Laravel 10 to create rest api authentication:

- Create a new Laravel 10 project.
- Set up a database with the Laravel app.
- Install Passport Auth.
- Configure Passport Auth.
- Run migration.
- Define APIs route.
- Create Passport Auth Controller.
- Test Laravel REST API in Postman.

Read More [Laravel 10 Passport Authentication REST API Tutoiral Example](https://www.tutsmake.com/laravel-10-rest-api-authentication-with-passport/)
Solving "Diameter of Binary Tree" Leet code Question
Tags: java, programming, discuss, computerscience
Published: 2023-09-14 09:06:53

## Intuition
We want to find the diameter of a `binary tree`, which is the length of the longest `path` between any two nodes. This path may or may not pass through the `root`.

## Approach
We perform a depth-first traversal of the tree and calculate the height of each subtree. While calculating the height of each node, we also update the diameter if a longer path is found. The final result will be stored in the `diameter` variable.

**Time complexity**
O(n) - We visit each node once.

**Space complexity**
O(h) - Recursive call stack space, where h is the height of the tree.


## Code
```
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {

    int diameter = 0;

    public int diameterOfBinaryTree(TreeNode root) {
        height(root);
        return diameter;
    }

    public int height(TreeNode node){

        if(node == null) {
            return 0;
        }

        int lh = height(node.left);
        int rh = height(node.right);
        diameter = Math.max(diameter,lh+rh);

        return 1 + Math.max(lh,rh);
    }
}
```

Happy coding,
shiva
Understanding Network Topologies: More Than Just Maps
Tags: ccna, cisco, course, network
Published: 2023-09-14 08:44:35

**Introduction:**  
Network topologies are foundational to understanding how networks are designed and operate. While many might think of them as mere "maps" of a network, they play a crucial role in determining how data is transmitted and received within a network. This post will delve into the importance, characteristics, and types of network topologies.

---

**Why are Network Topologies Important?**  
1. **Visibility:** Topologies provide a clear view of the entire network infrastructure, allowing technicians to understand where devices are physically located.
2. **Logical Understanding:** Beyond the physical layout, topologies also depict how data flows within the network, which is essential for troubleshooting and optimization.
3. **Audience Communication:** For those explaining or presenting network designs, topologies offer a visual aid that makes complex network structures more comprehensible.

---

**Key Characteristics of Basic Network Topologies:**  

1. **Bus Network (Linear Bus):**  
   - All devices are connected to a single wire.
   - Only one device can transmit data at a time, making it prone to data collisions.
   - Commonly used in wireless networks where devices connect to a single access point.

2. **Ring Topology:**  
   - Data travels in one direction, reducing the chances of collisions.
   - Uses a "token" system where only the device with the token can transmit data.
   - More expensive and less common than other topologies.

3. **Star Topology:**  
   - Each device has a direct connection to a central switch.
   - Reduces data collisions as each device has its dedicated link.
   - Most modern wired networks use this topology due to its efficiency and scalability.

---

**Physical vs. Logical Topologies:**  
While the physical topology represents the actual layout of the network devices and their interconnections, the logical topology depicts how data flows within the network. It's crucial to understand that the physical and logical topologies might not always align. For instance, a network with a physical star topology might operate logically as a bus when broadcasting data.

---

**Conclusion:**  
Network topologies are more than just diagrams; they are strategic blueprints that dictate how networks operate, communicate, and troubleshoot issues. Understanding the nuances between different topologies and the distinction between physical and logical layouts is essential for anyone diving into the world of networking.

Stay tuned for a deeper dive into more advanced network topologies in upcoming posts!
Updates CKS are continuously being revised and up to date for relevance
Tags: webdev, beginners, tutorial
Published: 2023-09-14 08:35:26

[CKS Exam Dumps](https://dumpsboss.com/linux-foundation-exam/cks/ ) Master all of the CKS dumps examination questions and solutions on the scary day of examination may be no much less than a amusing day. Perform amazingly withinside the CKS examination and get licensed without problems. Instant Download with 360 DAYS Free Updates CKS  are continuously being revised and up to date for relevance and accuracy with the aid of using actual Linux Foundation-licensed experts. Sure gives this option and with none more fees it offers you the maximum up to date CKS  solutions to be had withinside the marketplace. Unlike the opposite organizations, We are imparting extraordinarily immediately to down load Certified Kubernetes Security Specialist (CKS) Exam exercise take a look at guidance software program and CKS .pdf questions which includes content material from the 2023. Instant Download with 360 DAYS Free Updates CKS  - Twofold Preparatton System CKS  - Twofold Preparatton System The examination bundle consists of a PDF model of the CKS  [CKS Dumps](https://dumpsboss.com/linux-foundation-exam/cks/ ) examination with forty eight real questions and solutions, an Interactive Test Engine Software (CKS ). The CKS Dumps (Test Engine simulator) offers you a higher and greater bendy manner to put together to your CKS examination certification. You can set up this CKS take a look at engine and examination simulator to your PC and exercise at domestic or workplace. Certified Kubernetes Security Specialist (CKS) Practice Questions The maximum superb hallmark of  CKS dumps exercise examination questions solutions is that they've been organized with the aid of using the Linux Foundation enterprise professionals who've deep publicity of the real Kubernetes Security Specialist examination necessities. 

Get Upto 60% Off ✔️https://dumpsboss.com/linux-foundation-exam/cks/
Know about us! RELIANOID
Tags: relianoid, sre, loadbalancing, global
Published: 2023-09-14 08:34:59


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ftlsgq70e54ok6xnqsrl.jpg)Please, visit:
https://www.relianoid.com/
We are also on:
Linkedin: https://www.linkedin.com/company/Relianoid
Instagram: @relianoidsre
Twitter: @relianoid
Fight back against the scammers and get a refund
Tags: reportscam, fundrecovery, scam
Published: 2023-09-14 08:18:15

[Report Scam](https://reportscam.net/) is a real scam recovery help community that helps scam victims in the most ethical way. We understand and analyze your case well and provide the best possible guidance. We are not like many fake scam recovery firms which scam victims again and do nothing! We are a community of experts providing Forex Trading Reviews, Cryptocurrency broker reviews, other scam brokers reviews, etc. 
Our experts guide you to the right fund recovery service or a lawyer in the field of expertise. If you are a victim of Cryptocurrency fraud, Forex fraud, or any other scam, report a complaint with us and get help! 
URL:	https://reportscam.net/
Install Docker Desktop on Ubuntu
Tags: docker
Published: 2023-09-14 08:15:10

## Install Docker Desktop on Ubuntu
[](https://docs.docker.com/desktop/install/ubuntu/)

click bellow mention the Url download .deb docker desktop 

## Install Docker Desktop:
Download latest DEB 
Install the package with apt as follows:

```
sudo apt-get update
sudo apt-get install ./docker-desktop-4.23.0-amd64.deb
```

## Launch Docker Desktop:

```
systemctl --user start docker-desktop
```

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



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8t3i3znujp0wzlfbwvz7.png)
VEULIO
Tags: webdev, softwaredevelopment, programmers
Published: 2023-09-14 07:59:48

Notre logiciel est conçu pour évoluer avec vous, vous fournissant des outils précieux pour développer et soutenir votre entreprise au fur et à mesure de sa croissance. 
N'attendez plus, explorez la flexibilité et la personnalisation que notre solution SAAS vous offre dès aujourd'hui !
VEULIO.COM
Filtering with React Server Components and URL Search Params
Tags: nextjs, react, servercomponent
Published: 2023-09-14 07:55:40

---
title: Filtering with React Server Components and URL Search Params
published: true
description: Use URL search params to filter data fetched from React Server Components
tags: nextjs, react, servercomponent
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/74e2ohbj7kc35tczxjlj.png
canonical_url: https://codebushi.com/react-server-components-and-search-params
---

Traditionally, when you wanted to filter your data using React, you would first store the original data in local state, with the useState hook.

There would be a useEffect that watches for any filter changes, and then you would re-fetch the data using the applied filters on the client.

Once you get back the filtered data, you update the useState and the list re-renders, showing only the filtered results.

{% youtube o9PUZ3sMV3I %}

With the rise of React Server Components in Next.js 13, fetching data happens more and more on the server instead of the client. How can you add filters on the client, but still re-fetch and display the filtered data on the server? Using URL Search Parameters!

Key Takeaways:

00:00 - Intro into the project

00:56 - Current code setup, using Next.js App router and fetching initial data on the server

02:20 - Traditional filtering using useState and client side data fetching

03:14 - Server Actions allow for the filters to be inside a form element, with the action property

04:01 - Seeing the checkbox filters showing up inside of the server action's function

04:33 - Using search query parameters, we can re-fetch our filtered data on the server

05:49 - Constructing the URL search parameters with server actions

09:00 - We have access to the search parameters from our page.tsx server component

11:00 - Use the search params to filter our data on the initial server page load

11:52 - Demo of the search params working with React server components

12:37 - Make our checkboxes aware of the URL search params, and have them checked by default if the value is in the url
WELCOME TO JK ENGINEERING WORKS
Tags: industrial, msflanges, manufacture, supplier
Published: 2023-09-14 07:51:56

[JK ENGINEERING WORKS](https://jkflanges.com/) is the Best Ms Flanges Manufacturer in Mumbai with family-owned business established in 1996, has built its reputation on the cornerstones of high-quality products, customer satisfaction & superior service. JK ENGINEERING WORKS was formed by well experienced Mr. JAVED KHAN to provide reliable and quality service to the Marine, Petroleum plants, Oil solvent plants, Water Treatment plants, Fertilizers Plant and Mechanical Heavy Industries.

JK Flanges Manufacturer are an ISO 9001:2015 certified company. Our organization is a team of expertise professionals comprising of qualified Engineers, Technical & Supervisory staff with diverse Technological excellence to impart the best services as per client requirement and to International standards. During the past 27 years we have been achieving our objectives of complete client satisfaction with the dedicated and devoted services. We arrange for door delivery to the customers if they need. Jk Flanges is the Best Industrial Ms Flanges Manufacturer in Mumbai, Ms Flanges Exporter in India, Industrial MS Flanges Wholesaler in Mumbai.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/md5sx9qhwcmtdntqz7ot.jpg)
React 2023 news
Tags: webdev, react, news, programming
Published: 2023-09-14 07:43:16

# What's New in React for 2023

React, the JavaScript library for building user interfaces, is undergoing significant developments in 2023. These updates promise to enhance the developer experience and enable the creation of even more powerful and efficient web applications.

## 1. React 19 and Concurrent Mode

React 19, slated for release in 2023, brings Concurrent Mode into the mainstream. This long-awaited feature is now stable and allows React applications to exhibit improved responsiveness and adaptability. Concurrent Mode ensures a smoother user experience by efficiently managing rendering priorities, especially beneficial for applications with complex UIs and varying network conditions.

## 2. Server Components

A groundbreaking addition to React's arsenal is Server Components. With Server Components, developers can create portions of a UI that can be rendered both on the server and the client. This approach significantly enhances performance by reducing unnecessary client-side rendering and delivering a faster initial load.

## 3. Suspense for Data Fetching

Managing asynchronous data loading in React applications becomes more straightforward with Suspense for Data Fetching. This feature streamlines the process of declaratively fetching data and managing loading states and errors. It simplifies code and enhances the user experience by ensuring that users see the UI in a consistent state.

## 4. Improved DevTools

React DevTools, the browser extension for debugging React applications, is receiving substantial updates. These enhancements offer developers deeper insights into their application's behavior and performance. The improved DevTools aid in identifying and resolving issues more effectively, making development more efficient.

## 5. Enhanced Accessibility Support

React remains committed to accessibility. In 2023, React's ecosystem will see additional features and improvements to facilitate the development of inclusive web applications. These enhancements will make it easier for developers to create web interfaces that are accessible to a wider audience.

These exciting developments in React for 2023 empower developers to build more responsive, efficient, and accessible web applications. By embracing these new features and staying updated with React's evolving ecosystem, developers can continue to create cutting-edge web interfaces and deliver exceptional user experiences.

---

If you liked my article, follow me on github -> [Matek's github](https://github.com/matek075)
The 10 tools I install on every new Mac I get
Tags: tools, productivity, developmentenvironment
Published: 2023-09-14 07:35:12

---
title: The 10 tools I install on every new Mac I get
published: true
description: Here's what I get started with when I install a new macbook
tags: tools, productivity, developmentenvironment
cover_image: https://images.unsplash.com/photo-1586864387789-628af9feed72?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2940&q=80
# Use a ratio of 100:42 for best results.
# published_at: 2023-09-14 07:12 +0000
---

I am currently on a company trip with my brand new MacBook and here are the things I always install first to get started:

* [Homebrew](https://brew.sh/) - makes installing of low level stuff a breeze (free)
* [Node/NPM](https://nodejs.org/en) - many things rely on it (free)
* [Dropbox](https://www.dropbox.com/) - still be best way to store and share content amongst machines, both Google Drive and Microsoft OneDrive drive me nuts with their file permission nonsense (paid)
* [VLC](https://videolan.org/vlc) - plays everything, has excellent keyboard shortcuts and can in a pinch even record screens for you (free)
* [VS Code](https://code.visualstudio.com) - coders gotta edit (free)
* [GitHub Desktop](https://desktop.github.com/) - much, much easier than installing and setting up Git yourself (free)
* [ImageOptim](https://imageoptim.com/mac) - file resizing and optimising images, even on the command line (free)
* [FFMPEG](https://ffmpeg.org/) - converts anything to anything on the command line (free)
* [Handbrake](https://handbrake.fr/) - batch conversion of videos made easy (free)
* [Screenflow](https://www.telestream.net/screenflow/overview.htm) - my go-to screen recording and video editing tool (paid)

Other essentials are a VPN (I use [Mullvad]( https://mullvad.net/en) and [ProtonVPN](https://protonvpn.com/)), but that's about it. 

Photo by <a href="https://unsplash.com/@imattsmart?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">iMattSmart</a> on <a href="https://unsplash.com/photos/sm0Bkoj5bnA?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
SAP TRM Online Training
Tags: saptrm, saptrmonline, sap
Published: 2023-09-14 07:23:20

[SAP TRM (Treasury and Risk Management)](https://bestonlinecareer.com/sap-trm-online-training/) is a comprehensive software solution designed to help businesses manage their financial risk and optimize their treasury operations, including cash and liquidity management, debt and investment management, and risk analysis. It enables organizations to make informed financial decisions and ensure compliance with regulatory requirements.
We have a new batch of **SAP TRM Module** to join that will give you hands-on experiences