teleren/devto huggingface dataset:
Polymorphism in JAVA
Tags: java, polymorphism
Published: 2023-01-05 07:08:44

Polymorphism is the ability of a single object to take on multiple forms. In Java, polymorphism is implemented using inheritance, method overloading, and method overriding.

Here is an example of polymorphism using method overloading:

```
public class Calculator {
  public int add(int x, int y) {
    return x + y;
  }
  
  public int add(int x, int y, int z) {
    return x + y + z;
  }
}

Calculator calc = new Calculator();
int sum1 = calc.add(1, 2); // sum1 is 3
int sum2 = calc.add(1, 2, 3); // sum2 is 6

```
In this example, the Calculator class has two versions of the add method: one that takes two arguments and one that takes three arguments. Both of these methods have the same name, but they have different parameter lists, so they are considered to be overloaded versions of the same method.

Here is an example of polymorphism using method overriding:

```
public class Animal {
  public void makeSound() {
    System.out.println("Some generic animal sound");
  }
}

public class Dog extends Animal {
  @Override
  public void makeSound() {
    System.out.println("Woof!");
  }
}

Animal animal = new Dog();
animal.makeSound(); // prints "Woof!"

```
In this example, the Animal class has a makeSound method that prints a generic animal sound. The Dog class extends the Animal class and overrides the makeSound method to provide a specific implementation for dogs. When the makeSound method is called on a Dog object, the version defined in the Dog class will be used, rather than the version defined in the Animal class.
Login and Registration Form in HTML and CSS
Tags: html, css, tutorial
Published: 2023-01-05 07:01:42

Login and Registration Form in HTML and CSS

in this video we will learn how to create a Login and Registration Form in HTML and CSS. 

Login and Registrations Form are very important to getting the values from users. Once you got the values from users, then user will able to login the account.

After that, you will send the users with your application dashboards. So, we are going to create it step by step using HTML and CSS.

hope this tutorial is helpful and beneficial for you.

{% embed https://www.youtube.com/watch?v=UWaERxWn9GA %}
Responsive Sidebar Menu Using HTML CSS and JavaScript
Tags: html, css, javascript, tutorial
Published: 2023-01-05 06:59:21

Responsive Sidebar Menu Using HTML CSS and JavaScript

Hey Guys, recently, I've made the complete project namely Responsive Sidebar Menu that are help you to improve your HTML, CSS and JavaScript productivity. When you will create a dashboard you need to make sidebar menus because users will able to navigate the pages easily.

So, we are going to learn How to make responsive Sidebar menu using HTML CSS and JavaScript. Before watching the tutorial, you must have knowledge in HTML, CSS and JavaScript. then you will able to understand everything.

Inside the project I've used HTML to make a structure of the page, then I've used CSS to design the menus, then I've used JavaScript to hide and display the menus. Also I've used boxicons to display the icons. 

So, you will learn everything step by step, hope this tutorial is helpful and beneficial for you.

{% embed https://www.youtube.com/watch?v=w1FIdRKMhNQ %}.
How to Create Sticky Navbar using HTML CSS and JavaScript
Tags: html, css, javascript, tutorial
Published: 2023-01-05 06:57:04

How to Create Sticky Navbar using HTML CSS and JavaScript

in this video tutorial we will learn How to Create Sticky Navbar using HTML CSS and JavaScript. Basically, Navbar is very important to navigate the users.

Sticky navbar is used to display the each section that you've made inside the page.

When you will scroll down, then sticky navbar will appear top of the page that you've made.

So, I'm going to teach with You How you can use HTML, CSS and JavaScript to create a sticky navbar step by step.

{% embed https://www.youtube.com/watch?v=r8ARK6BEKhw %}.
Responsive Contact Us Form in HTML and CSS
Tags: html, css, tutorial
Published: 2023-01-05 06:56:20

Responsive Contact  Us Form in HTML and CSS

in this tutorial we will learn How to make Responsive Contact  Us Form in HTML and CSS. It's one most important project for users, who will able to contact you using contact form.

So, I'm going to teach you how you can create it using HTML and CSS3. It's fully responsive, you can add with your on project as well.

hope this tutorial is helpful and beneficial for you.

{% embed https://www.youtube.com/watch?v=WCLy5lP2ncw %}.
Why am I building Electrik
Tags: webdev, opensource, laravel, showdev
Published: 2023-01-05 06:55:43

Hello everyone!

This post is about why am I getting into building another starter kit.

**What's [Electrik](https://electrik.dev)**

Electrik is an open source Laravel starter kit. It provides all the essential functions required to get started with building your next SaaS application.

**What's different?**

Well for starters, Electrik does not have pay walls for premium features like other starter kits have. Another differentiator is its features, UI, etc.

**Why another starter kit?**

It's true that there are plenty of starter kits available out there. Some are good, some are bad. I am not saying that Electrik is the answer to all questions. But what motivated me to build Electrik is that I believe that if you are building an open source tool, then it should be 100% open-source with no paywalls for premium features. That's where Electrik is different. I have open sourced it with all the features that are required to build a SaaS application. As a developer, company, or an enterprise, you should not be concerned about trivialities of picking and joining multiple libraries and then configure them to make it workable. Electrik takes that pain away. And it helps in reducing the GTM time.

**Is anyone using it?**

Electrik has been around for around a year. And I have used it in multiple enterprise, bespoke applications. After seeing that it performs well, I decided to open source it.

Currently there are around 10-15 enterprises using Electrik

you can read more about it here:

1. Github - https://github.com/electrikhq/electrik
2. Website - https://electrik.dev
Inserting dummy 200000 data using Faker
Published: 2023-01-05 06:45:24

Browser could render 80,000 data but failed while trying to render 1 lakh.
2lakhs data could be inserted in MySQL under 20 secs with chunking.
3lakhs data insertion failed (Exception: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16777224 bytes))
```php
        $faker = Faker\Factory::create();
        $dt = [];
        $i = 0;
        $st = microtime(true);
        for($i=1; $i<=200000; $i++)
        {
            
            $et= microtime(true) - $st;
            array_push($dt, ['id' => $i,'names' => $faker->name]);
            // $dt[$i]=[
            //     'id' => $i,'names' => $faker->name
            // ];
        }
        $c_i = collect($dt);
        $chunks = $c_i->chunk(500);
        $b = [];
        try{
            foreach($chunks as $key => $c)
            {
                // $b = $c[$key]['id'].$c[$key]['names'];
                // return $c->toArray();
                DB::table('names')->insert($c->toArray());
            }
            return 'Done';
        }
        catch(Exception $e1)
        {
            return $e1->getMessage();
        }
```
Snow Owl: request-level network observability and routing for microservices
Tags: react, devops, node, testing
Published: 2023-01-05 06:38:57

Hi everybody! 👋 We're glad to be here.

Snow Owl is a low/no-code network traffic management platform for http/api requests. We'll be sharing developer updates here.

(Psst! DM us if you want early access 👀)

https://snowowl.co

https://docs.snowowl.co
Blockchain Training in Chennai
Tags: blockchain, bitcoin, blockchaintrainingchennai, tutorial
Published: 2023-01-05 06:11:07

The **[Blockchain Training in Chennai](https://intellimindz.com/blockchain-training-in-chennai/)** at IntelliMindz allows students to become thoroughly acquainted with critical concepts such as Bitcoins, Blockchain Architecture, HyperLedger, Multichain, Ethereum Ecosystem, Smart Contracts, Digital Ledger types, Cryptocurrency, Bitcoin, and Mining while being trained by Real-time Experts in Blockchain Technology. By the end of the Blockchain Training Course, you will be able to serve efficiently on various crypto means and various ways to distribute on the blockchain.
Outreachy Blog #3: The Project and EclipseAdoptium
Tags: opensource, moncon, eclipseadoptium
Published: 2023-01-05 06:00:00

Hello guys, as I end month two of my internship, I decided to reveal a bit more about my work with Eclipse Adoptium as an Outreachy intern.

I've been asked by peers multiple times what company I work with. Most people give me a confused look when I tell them about the Moncon project, so I go with infrastructure automation.

**What is the Moncon project?**

This project involves improvements to how the machines at the open source project are monitored.  It involves assessment and configuration of the Nagios server at the project.  

Nagios is a configurable server monitoring tool, monitoring elements such as connectivity, memory & CPU usage, disk space usage, system daemons etc. It consists of a monitoring server with agents on each remote host to be monitored. 

The aim of this project is to automate the Nagios server side configuration, by utilizing  a script/scripts and ansible(an open-source automation tool used for configuration management, application deployment, and task automation)  to handle the creation, and manipulation of the server side configuration files. 

**My Experience with Eclipse Adoptium community**

A fantastic community with very supportive and mentoring mentors who are passionate about producing high-quality open-source software. 
With the help of my mentors, I have so far been able to achieve significant milestones in my intern project.
I would say that I have learnt a lot thus far, and I still have a lot to learn.
**I wouldn't trade the experience for anything else; it's so far been a great learning experience  
**

If you'd like to contribute to a similar project you may consider joining in the[ Adoptium community](https://github.com/adoptium/adoptium) , [website](https://adoptium.net/)
And following the community on [linkedln](https://www.linkedin.com/showcase/adoptium/) for latest updates

Till then, Happy coding! 😊 and stay tuned for the next blog.
About useState in reactjs
Tags: webdev, react, beginners, nextjs
Published: 2023-01-05 05:55:22

The `useState` hook is a useful feature in React that allows you to add state to functional components. In this blog, we'll take a look at what the useState hook is, how it works, and how you can use it in your React projects.

#### What is the `useState` hook?
In traditional React applications, state is typically managed using class-based components, which have an internal state object that can be modified using methods like `setState`. However, functional components (which are functions rather than classes) do not have an internal state object and cannot use the `setState` method.

The useState hook is a way to add state to functional components in React. It allows you to store and modify state variables within a functional component, and it is designed to be easy to use and understand.

#### How does the useState hook work?
To use the `useState` hook in a functional component, you need to import it from the react library. Then, you can call the `useState` hook inside the component, passing an initial value for the state as an argument. The `useState` hook returns an array with two elements: the current state value, and a function for updating the state.

Here's an example of how you might use the useState hook to add a counter to a functional component:

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

function Counter() {
  const [count, setCount] = useState(0); // initial value is 0

  return (
    <div>
      <p>The current count is {count}</p>
      <button onClick={() => setCount(count + 1)}>Increment</button>
      <button onClick={() => setCount(count - 1)}>Decrement</button>
    </div>
  );
}
```
In this example, we use the useState hook to create a state variable called count with an initial value of 0. We also get a function called setCount that we can use to update the value of count.

We can then use the count variable in our component's JSX to display the current count, and we can use the setCount function as the event handler for the onClick prop of our buttons to increment or decrement the count.

#### How to use the useState hook effectively
One thing to keep in mind when using the useState hook is that it should only be used for values that change within the component. If you have values that need to be shared between multiple components, you should consider using a state management library like Redux or the React context API instead.

Additionally, it's important to remember that the useState hook should only be called inside the component that needs to use the state. Calling the useState hook from outside the component, or calling it multiple times within the same component, can lead to unexpected behavior.

Overall, the useState hook is a powerful tool for adding state to functional components in React, and it can help you create efficient and maintainable applications. By following best practices and understanding
Understanding stops property on LinearGradient in Flutter
Tags: flutter, beginners, dart, tutorial
Published: 2023-01-05 05:53:31

This is what the [official docs](https://api.flutter.dev/flutter/painting/Gradient/stops.html) say
> A list of values from 0.0 to 1.0 that denote fractions along the gradient.

## Problem
Lets say we have to create a bar which has a gradient going from red -> green -> blue -> black.
The percentages are as follows:
10% red
30% green
40% blue
Rest of it black (20%)

We might write something like this:
```dart
LinearGradient(
  colors: [
    Colors.red,
    Colors.green,
    Colors.blue,
    Colors.black,
  ],
  stops: [0.1, 0.4, 0.5, 0.2],
),
```
Here's what we get:
![Incorrect gradient](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bol9p0kqqywcxsyyz3a5.png)Of course this is not what we want.

### How to fix it?
Before we jump into the solution let's look at the problematic code
```dart
LinearGradient(
  colors: [
    Colors.red,
    Colors.green,
    Colors.blue,
    Colors.black,
  ],
  stops: [0.1, 0.4, 0.5, 0.2],
),
```
We have supplied `stops=[0.1, 0.4, 0.5, 0.2]`

#### How the `stops` property works
The `stops` property requires us to specify where the color should start from. So, if we have two colors, red and black and we want both of them to take 50% of the container, we can write
```dart
LinearGradient(
  colors: [
    Colors.red,
    Colors.black,
  ],
  stops: [0, 0.6],
),
```
Notice that I wrote `0.6` instead of `0.5`. If we write `0.5`, then it would look like a 40-60 split instead of 50-50. 

0 to 0.5 would be red, then 0.6 to 1 would be black.
The following code would also give us the same result

```dart
LinearGradient(
  colors: [
    Colors.red,
    Colors.black,
  ],
  stops: [0.2, 0.6],
),
```
This is because [as the docs mention](https://api.flutter.dev/flutter/painting/Gradient/stops.html#:~:text=If%20the%20first%20value%20is%20not%200.0%2C%20then%20a%20stop%20with%20position%200.0%20and%20a%20color%20equal%20to%20the%20first%20color%20in%20colors%20is%20implied), if the `stops` array doesn’t start with a `0`, it implicitly means that it would start with `0` and the first color in the `colors` array. Same thing happens with last value of `stops` array. It should either explicitly end with a `1`, or flutter will implicitly consider it as `1` with last color supplied in the `colors` array. So, actually flutter will interpret it as: 
```dart
LinearGradient(
  colors: [
    Colors.red,
    Colors.red,
    Colors.black,
    Colors.black,
  ],
  stops: [0, 0.2, 0.6, 1],
),
```
![Gradient Examples](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yt49oxvheude5iaub7js.png)

## Fixing the issue
Now that we know how the `stops` property works, we can get our desired gradient.
```dart
LinearGradient(
  colors: [
    Colors.red,
    Colors.green,
    Colors.blue,
    Colors.black,
  ],
  stops: [0.1, 0.4, 0.8, 1],
),
``` 
![Gradient fixed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gbdllup5oq422euoi0z5.png)

## Playground
I made a [dartpad link](https://dartpad.dev/?id=9c577bf3dcebf1a5aae37a5cac281761) if you want to play around with the examples above.
Features of Ruby on Rails
Tags: rails, ruby, programming
Published: 2023-01-05 03:30:00


## Features of Ruby on Rails

Hello Everyone, in this article, we are going to discuss about the features of popular framework for web development — “**Ruby on Rails”**. So let’s get started.

![](https://cdn-images-1.medium.com/max/3838/1*-3nesWANq1yosikNnTr1-Q.png)
<figcaption align = "center">
  <b> Image Created By -  
    <a href="https://dev.to/rutikkpatel"> 
      Rutik Patel
    </a>
  </b>
</figcaption>

<br/>
Ruby on Rails provides a lot of features that can help developers at any point during the web development process, as well as thereafter.

***Here are some list of the features:***

 1. MVC Architecture

 2. Active Records

 3. Inbuilt Testing

 4. Scalable

 5. Ease of Programming

&ensp;
### **1. MVC Architecture :**

MVC Stands for Model View Controller. Ruby on rails follows this MVC Pattern for development. There are also other frameworks available that follows MVC Architecture. So, if a developer is familiar with another MVC framework, they may quickly grasp the Rails framework.

&ensp;
### **2. Active Record :**

Active Record is an ORM (Object Relational Mapping) layer which execute between the database and the code. In simple way Active Record is powerful library of Ruby on Rails. Basically it is used to deal with backend database, migration and schema.

&ensp;
### **3. Inbuilt Testing :**

With the testing we can assure that our code run with desired functionalities. Rails provided inbuilt testing facility so we can test our application easily. when we generate model and controller rails will auto generate some skeleton test code inside test directory.

&ensp;
### **4. Scalable :**

Ruby on Rails helps developers to build highly scalable application. And the modules in the ruby on rails are incredibly flexible and they are in well-structured form, which allowing developers to make adjustments to your programs as needed.

&ensp;
### **5. Ease of Programming :**

Ruby on Rails has a straightforward syntax. It features easy English-like syntax codes that make creating different codes easier for developers. Understanding Ruby on Rails programmes is lot easier and takes considerably less time. Rails also helps with the generation of simple commands In HTML, CSS, and JavaScript Files.

&ensp;
![Photo by [Aaron Burden](https://unsplash.com/@aaronburden?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)](https://cdn-images-1.medium.com/max/9216/0*Ry5AaEMnMN4Wlyi6)
<figcaption align = "center">
  <b> Photo by -  
    <a href="https://unsplash.com/@aaronburden?utm_source=medium&utm_medium=referral"> 
      Aaron Burden
    </a>
  </b>
</figcaption>
Minimum Number of Arrows to Burst Balloons
Tags: javascript, leetcode
Published: 2023-01-05 05:40:38

[Minimum Number of Arrows to Burst Balloons](https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/)
```js
/**
 * @param {number[][]} points
 * @return {number}
 */
var findMinArrowShots = function (points) {
  // sorting of array based on end time
  points = points.sort(function (a, b) {
    return a[1] - b[1];
  });
  // keeping intial arrow count as 1 becoz we are assuming we need min 1 arrow to burst balloon
  // also as we will start from 1 index to check for remaining means already used 1 arrow before for 0th index
  let noOfArrow = 1;
  let lastEndsAt = points[0][1];
  for (let j = 1; j < points.length; j++) {
    let nextBeginsAt = points[j][0];
    if (nextBeginsAt > lastEndsAt) {
      noOfArrow++;
      lastEndsAt = points[j][1];
    }
  }

  return noOfArrow;
};

console.log(
  findMinArrowShots([
    [10, 16],
    [2, 8],
    [1, 6],
    [7, 12],
  ])
);

console.log(
  findMinArrowShots([
    [1, 2],
    [3, 4],
    [5, 6],
    [7, 8],
  ])
);


```
User Roles And Permissions Without Package Laravel 9
Tags: laravel, role, permission, php
Published: 2023-01-05 05:30:00

In this article, we will see user roles and permissions without a package in laravel 9. 

Here, we will learn how to create roles and permissions in laravel 9. Roles and permissions are an important part of many websites.

In this laravel 9 user roles and permissions example, we are not using any type of package like spatie/laravel-permission for user roles permissions in laravel. 

But you can use spatie/laravel-permission to create user roles and permissions tutorial in laravel 9.

So, let's see laravel 9 user roles and permissions without package, user roles and permissions tutorial in laravel 9, laravel 9 dynamic roles and permissions, and user roles permissions laravel 9.

Let's start to implement user roles and permissions without package laravel 9 tutorial.

```
Step 1: Install Laravel 9 App

Step 2: Create Laravel Auth

Step 3: Create Model and Migration

Step 4: Edit Migration Files

Step 5: Add Pivot Tables

Step 6: Setting up the Relationships

Step 7: Create Trait

Step 8:  Create CustomProvider

Step 9: Add Dummy Data

Step 10: Setup the Middleware
```
Request for help on React coding
Tags: react, webdev, beginners
Published: 2023-01-05 05:07:25

Hi Friends ,

I am trying to run this my first React.js project, but this is not working though code is correct. Not sure how to debug this.

Please help by review and fixing this code .

https://gist.github.com/codecademydev/2f0568c3775ccf5c67bcfee236ee5a5d

Appreciate your help ASAP.

Thanks,
Sudhakar
Leetcode question 58 Length of Last Word js solution
Tags: javascript, leetcode, beginners
Published: 2023-01-05 04:46:41

We can break the problem into 3 subproblems 

- Removing trailing spaces if they exist
- Finding the words present in that processed string
- And finally finding the length of the last word present in the processed string

We will tackle this subproblems one at a time.

## Step 1 : Removing whitespaces at the beginning and end of the string 
Since the string given to us might contain whitespaces in it, we need to remove them because if we don't remove them js treats them as different words.

To achieve this we make use of the `trim` method

```
const sWithOutWhiteSpaces = s.trim()
```
## Step 2 : Finding words present in string given
This step is very easy to do. We use `split` method achieve this.

```
const wordsInS = sWithOutWhiteSpaces.split(" ")
```
## Step 3 : Finding the last word in given string
Last word present in given string is the last element in array `wordsInS`. Length of that word is our required answer.

```
const lastWord = wordsInS[wordsInS.length - 1]
return lastWord.length
```
Total solution

```
var lengthOfLastWord = function (s) {
  const sWithOutWhiteSpaces = s.trim();
  const wordsInS = sWithOutWhiteSpaces.split(" ");
  const lastWord = wordsInS[wordsInS.length - 1];
  return lastWord.length;
};

```
If you submit at this point you will get these stats
![stats before optimization](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0o2dy49gpiyvwe14q5ms.png)

## Optimization
We can optimize the time and space required to run this program by chaining all the methods and make it into a single statement thereby reducing the amount of space used by our program since we are no longer using memory to store intermediate values linke wordsInS.

Now our solution looks like this

```
var lengthOfLastWord = function (s) {
  return s.trim().split(" ").pop().length;
};
```
## Time and space complexity
 - Time: **O(n)**
 - Space: **O(1)**

After doing above mentioned optimizations you will get these stats

![stats after optimization](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ali6akrf07t402ddp6y8.png)

I hope you found this article. If yes hit that like button.

**Happy Hacking**