teleren/devto huggingface dataset:
WHY HTML DEVELOPERS USE BOOTSTRAP 5 ADMIN TEMPLATES TO MAKE DEVELOPMENT FASTER
Tags: admin, dashboard, template, bootstrap5
Published: 2022-09-30 11:43:27

There are so many ways that you can go with your website, trying to make it look beautiful and customize to your needs.

But, the question is why would anyone want to give that much effort when they can use Bootstrap 5 admin templates instead? These Bootstrap Admin Templates help you create professional and sleek-looking websites with minimal effort!

Bootstrap v.5.0 is a front-end framework that's really popular with developers, but what makes it so popular? That's why we're writing this blog!

Let's walk you through how Bootstrap Admin Templates Work and Why HTML Developers Use Them For Faster Development.


[Read more about WHY HTML DEVELOPERS USE BOOTSTRAP 5 ADMIN TEMPLATES
](https://www.ingeniumweb.com/blog/post/why-html-developers-use-bootstrap-5-admin-templates-to-make-development-faster/5481/)

The Muze dashboard template is designed to be clean and simple. It is fully responsive and comes with a number of features that make it easy to use and customizable.

Our Muze [bootstrap 5 admin dashboard HTML template](https://fabrx.co/muze-bootstrap-5-html-admin-dashboard-template/) is perfect for developers who want to create dashboards easily!



![Muze Admin & Dashboard
Bootstrap 5 Template](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrd803v4l6eioo7mkmbc.jpg)

![Bootstrap 5 admin dashboard template](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xb6180nont348g71o0dj.jpg)


![Muze admin is a responsive, retina-ready, and cross-browser compatible template](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ssozvidowbhoaaldimo.jpg)
Elasticsearch Basics: indexing and getting the 1st document
Published: 2022-09-30 11:23:34

At my blog I am constantly getting questions which are related to elastisearch basics. That is why I decided to add several articles around that theme. Here is the 1st one article devoted to "[Elasticsearch Basics: document oriented nature, indexing and getting first document using curl and REST API, Elasticsearch data layer architecture](https://sergiiblog.com/elasticsearch-basics-document-oriented-indexing-and-getting-first-document/)". Have a pleasant reading.
How to send a custom response when destination is down?
Tags: springboot, reactor, springgateway
Published: 2022-09-30 11:15:57

I am using Spring Cloud Gateway(Netty)

If the destination service is down the gateway throws  **java.net.ConnectException: finishConnect(..) failed: Connection refused ** and return a default response

Response returned - 
 {
    "timestamp": "2022-09-30T10:45:15.593+00:00",
    "path": "/myDestinationPath",
    "status": 500,
    "error": "Internal Server Error",
    "requestId": "12345-6"
}

Is there any way to send a custom/decorated response instead of this default response?
How to Get Slack Notifications on Your GitHub
Published: 2022-09-30 10:48:35

You probably know that GitHub has an [application](https://github.com/integrations/slack) that you can add to your slack workspace.

While this app is nice and dandy if you want to get notified about **all ** actions that happen on GitHub and keep subscribing and unsubscribing to the repositories you are interested in and could even make it publish reminders on a specific channel but it is very noisy.

After digging more into Github, you can find an exciting feature **(scheduled reminders)** that could enable you only to get notified for the PR you are requested to review, replies to your comments, or even commits...etc.
In real-time or a timed reminder which is something essential to have if you don't want to miss a single PR or be late on reviewing, so buckle up because I'm gonna walk you step by step on how to do it.

But before all of that make sure that you have admin permission on your GitHub organization or know someone who can allow the Github application to read your repositories info.

1. Open your profile, then click on settings
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opb0pjl96rtwsa668vg1.png)

2. Scroll down till you find scheduled reminders
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hj727uwwd02febxq6np2.png)
3. Select the organization that you want to get reminders for
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hkafc5371enpf286k9t.png)
4. Authorize the app, 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p3qrb7eddup755jvqjhx.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3w11709n5xzwlhyorl9d.png)
> you can allow the application to read specific repositories instead of all by clicking on only select repositories.

5. Configure the reminder to your liking
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cdvyajadovr25y2aqxiw.png)

Here is the ideal setup for me 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zcvegoanlzd1qtifk8h.png)



### Bouns tip
You can test your reminder by clicking on the below icon inside the **scheduled reminders** tap

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i7eli3o7gpovrlr8sb88.png)
ToolJet x Hacktoberfest'22
Published: 2022-09-30 10:43:09

It is October again!

> In open source, we feel strongly that to really do something well, you have to get a lot of people involved - [Linus Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds)

Hacktoberfest is a one-month event that encourages ~~developers~~ everyone to contribute to the open-source projects that they love. We are excited to announce that ToolJet will be participating in Hacktoberfest 2022.

ToolJet is an open-source low-code platform for building internal tools. We open-sourced ToolJet in June 2021. We have more than 13,000 stars and 200 contributors for our GitHub repository. The open-source community consistently help us improve ToolJet by contributing new features, reporting & fixing bugs, improving the documentation, helping us debug the bugs, and more.  

Before we dive in to the details of Hacktoberfest 2022, let's quickly recap of last year's Hacktoberfest.

![stats](https://blog.tooljet.com/content/images/2022/09/image.png)

We merged 159 pull requests from 72 new contributors during Hacktoberfest 2021.

## Hacktoberfest 2022

Hacktoberfest is an opportunity for everyone to get involved in open-source projects.

With great opportunity comes great swag. Every valid PR is eligible for ToolJet swags!

- **1 valid PR**: ToolJet stickers and t-shirt.
- **3 valid PRs** - ToolJet stickers, t-shirt, water bottle.
- **4 valid PRs** - ToolJet stickers, t-shirt, hoodie, water bottle.

**Additionally, the top 5 contributors will get a surprise gift this time!** 🥳

### How to participate

Every contribution matters. It can be bug fixes, new features, new plugins, code refactoring, improving the documentation, creating tutorials, adding more unit tests etc.

Not familiar with our codebase? no problem, we have tagged issues on Github with the label `good first issue` . You can view them here: [issues for newcomers](https://github.com/ToolJet/ToolJet/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22). Additionally, we've added labels for the frontend (ReactJS) and backend (NestJS). Please make sure that you are creating PR only for issues that are assigned to you.

We do not tolerate spamming. If you're finding it difficult to contribute code, you can still help by reporting spam PRs, which are PRs created just for the sake of creating PRs. Spam PRs should be labeled as `spam` or `invalid` as per the guidelines of Hacktoberfest.

### Resources

- [Setting up local dev environment](https://docs.tooljet.io/docs/contributing-guide/setup/docker)
- [Contributing guide](https://blog.tooljet.com/hacktoberfest-2022/Contributing%20guide.%20https://github.com/ToolJet/ToolJet/blob/develop/CONTRIBUTING.md)
- [Hacktoberfest resources](https://hacktoberfest.com/)

### Where to get help during Hacktoberfest

- We have a very active community on Slack. Feel free to join: [https://tooljet.com/slack.](https://tooljet.com/slack).
- You can email us at hello@tooljet.com

Looking forward to see you on GitHub!🚀
Share Component State with 'exportAs’ in Angular
Tags: angular, webdev, javascript
Published: 2022-09-30 10:38:37

In Angular when we build components with public properties or the state to share with others, some options come into our heads to solve it:

- Emit an event using the new value of the component state.
- Inject service with Subject to share the state.
- Inject the component as a dependency like  [How to Build Compound Components in Angular](https://www.danywalls.com/how-to-build-compound-components-in-angular) 

All options are valid, but we miss another way to share our component state in the template is using the `exportAs` property.

## The exportAs

The `exportAs` property takes the Component or Directive name instance to make it available in the template.

```typescript
@Component({
  selector: 'app-country',
  templateUrl: './country.component.html',
  styleUrls: ['./country.component.css'],
  exportAs: 'countryContext'
})
```

It give us access to the component instance, using local variable in the template. For example, we create the variable #country to point to the `exportAs: countryContext`  to access the `CountryComponent` instance and use it anywhere in the template:

```html
<div >
  From outside!
<app-nice-gif [selected]="country.selected"></app-nice-gif>
</div>
<app-country #country="countryContext"> 
 <app-country-flag [selected]="country.selected"></app-country-flag>
  <app-country-flag [selected]="country.selected"></app-country-flag>
  <app-country-flag [selected]="country.selected"></app-country-flag>
  <app-banner [selected]="country.selected"></app-banner>
</app-country>
```

## Recap

Using the `exportAs` help us not require changing the code in our components to inject a service o component as a dependency. The local variable gives the component access to all public methods or properties from the component only in the template.
When people ask you why, it is not always an attack - DrJoeAbah
Tags: writing
Published: 2022-09-30 10:30:26

####   Original Tweet from [@DrJoeAbah](https://twitter.com/DrJoeAbah)
{% embed https://twitter.com/DrJoeAbah/status/1575732874137210880 %}
When I first told my PhD supervisors that I wanted to focus my research on Nigeria, they asked me why. My first response was “Why not? Others have focused on other countries. What is wrong with Nigeria?” Wrong answer. They just wanted me to justify the choice I had made. Thread..

It took me a little while to learn that the right answer was: “I want to focus on Nigeria because it is the most populous black country on earth. 1 out of every 4 Africans is a Nigerian. 1 out of every 6 black people on earth is a Nigerian… 

It’s an oil-rich country  with high poverty rates. It has about 50% Christians, 50% Muslims, 100% people that believe in Juju &amp; 100s of ethnic groups. Therefore, my research will have high generalisability and will also test several theories on resources, religion and ethnicity.” 

The moral of the story? When people ask you why, it is not always an attack. Sometimes, they just want to know what informed your choices &amp; whether you can justify them. If I had said USA, they would have still asked me why. Don’t just be vexing anyhow. Take time to explain. End. 

#### Click [Here](https://www.knowledge-twitter.com/)  For More Posts Like This [https://www.knowledge-twitter.com](https://www.knowledge-twitter.com/)
218. Leetcode Solution in java
Tags: java
Published: 2022-09-30 03:38:00

```java

class Solution {
  public List<List<Integer>> getSkyline(int[][] buildings) {
    final int n = buildings.length;
    if (n == 0)
      return new ArrayList<>();
    if (n == 1) {
      final int left = buildings[0][0];
      final int right = buildings[0][1];
      final int height = buildings[0][2];
      List<List<Integer>> ans = new ArrayList<>();
      ans.add(new ArrayList<>(Arrays.asList(left, height)));
      ans.add(new ArrayList<>(Arrays.asList(right, 0)));
      return ans;
    }

    List<List<Integer>> leftSkyline = getSkyline(Arrays.copyOfRange(buildings, 0, n / 2));
    List<List<Integer>> rightSkyline = getSkyline(Arrays.copyOfRange(buildings, n / 2, n));
    return merge(leftSkyline, rightSkyline);
  }

  private List<List<Integer>> merge(List<List<Integer>> left, List<List<Integer>> right) {
    List<List<Integer>> ans = new ArrayList<>();
    int i = 0; // left's index
    int j = 0; // right's index
    int leftY = 0;
    int rightY = 0;

    while (i < left.size() && j < right.size())
      // choose the point with smaller x
      if (left.get(i).get(0) < right.get(j).get(0)) {
        leftY = left.get(i).get(1); // update the ongoing leftY
        addPoint(ans, left.get(i).get(0), Math.max(left.get(i++).get(1), rightY));
      } else {
        rightY = right.get(j).get(1); // update the ongoing rightY
        addPoint(ans, right.get(j).get(0), Math.max(right.get(j++).get(1), leftY));
      }

    while (i < left.size())
      addPoint(ans, left.get(i).get(0), left.get(i++).get(1));

    while (j < right.size())
      addPoint(ans, right.get(j).get(0), right.get(j++).get(1));

    return ans;
  }

  private void addPoint(List<List<Integer>> ans, int x, int y) {
    if (!ans.isEmpty() && ans.get(ans.size() - 1).get(0) == x) {
      ans.get(ans.size() - 1).set(1, y);
      return;
    }
    if (!ans.isEmpty() && ans.get(ans.size() - 1).get(1) == y)
      return;
    ans.add(new ArrayList<>(Arrays.asList(x, y)));
  }
}


```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/the-skyline-problem/
How to solve the problem of bugs?
Tags: bug, solve, explore, problem
Published: 2022-09-30 09:50:31

How to solve the problem of bugs?
This post is only to help newbie programmers and professionals know this job perfectly
1. Keep calm because there are bugs for everyone
2. Bring a cup of coffee for yourself (if you don't have one, you can also use tea)
3. Open stackoverflow site and search
4. If the previous method does not work, enter YouTube and search
5. Questions and answers on social networks
6. The last way to solve this issue is to study the document and the main description of the program
[instagram Follow Please](https://instagram.com/amirrezaheydariinsta)

Persian Version
چجوری مشکل باگ ها رو حل کنیم؟
این پست صرفا برای کمک به برنامه نویس های تازه کار است و حرفه ای ها این کار رو کامل بلد هستند
1.	آرامش خودتون رو حفظ کنید چون باگ برای همه وجود داره
2.	یک لیوان قهوه برای خودتون بیارید(اگر نبود میتونید از چای هم استفاده کنید)
3.	سایت stackoverflow رو باز کنید و سرچ کنید
4.	اگر روش قبلی جواب نداد وارد Youtube شوید و سرچ کنید
5.	پرسش و پاسخ در شبکه های اجتماعی
6.	روش آخر برای حل این موضوع مطالعه داکیومنت و توضیحات اصلی برنامه است
How to change default branch in SonarQube Community Edition
Tags: sonarqube, sast
Published: 2022-09-30 09:31:59

---
title: How to change default branch in SonarQube Community Edition
published: true
description: 
tags: SonarQube, SAST
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

Default Branch name in Community Edition
The default branch in SonarQube Community Edition is still locked to master. If you want to change that in SonarQube then there is no user interface option available, as is in higher editions under Administration –> Branches and Pull Requests.

You can use this url to get to the same page for your project and change the name there: https://sonarqube.server.url/project/branches?id=<your project name>
A golang library to retry operations with exponential backoff
Tags: showdev, go, programming
Published: 2022-09-30 09:30:02

I have created `go-again`,  a small library to retry operations using different timing algorithms. By default, it uses exponential backoff with a jitter to generate various delays for each retry.

{% embed https://github.com/jdvr/go-again %}

Retry any function using exponential backoff:
```go
package main

import (
	"context"
	"errors"
	"fmt"
	"net/http"

	"github.com/jdvr/go-again"
)


func main() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	apiResponse, err := again.Retry[*http.Response](ctx, func(ctx context.Context) (*http.Response, error) {
		fmt.Println("Running Operation")

		resp, err := http.DefaultClient.Get("https://sameflaky.api/path")
		if err != nil {
			// operation will be retried
			return nil, err
		}

		if resp.StatusCode == http.StatusForbidden {
			// no more retries
			return nil, again.NewPermanentError(errors.New("no retry, permanent error"))
		}

		if resp.StatusCode > 400 {
			return nil, errors.New("this will be retry")
		}

		// do whatever you need with a valid response ...

		return resp, nil // no retry
	})
	if err != nil {
		panic(err)
	}

	fmt.Printf("Finished with response %v\n", apiResponse)
}
```

# Exponential backoff and jitter

Quoting [Wikpedia](https://en.wikipedia.org/wiki/Exponential_backoff) about Exponential Backoff:

> Exponential backoff is an algorithm that uses feedback to multiplicatively decrease the rate of some process to gradually find an acceptable rate.

The idea is to generate longer wait periods between each retry, assuming the system will work at some point because the issue is just a matter of time.

Suppose you have an API to get the user profile that might fail. In that case, you can introduce a retry function to keep trying the request, and this retry will wait longer between each period. Now imagine that your API crashed due to workload.

Backoff won't help. Although the request will be triggered with a delay period, all the clients follow the same algorithm with the same delays, so your workload issue is even worse. 

The algorithm uses a jitter to solve the issue of the exact delays by generating a small random delay gap between different clients. Instead of having all clients waiting for 500ms, they pick a random number between 450 and 550, distributing the server workload wisely.

# Go Again

I created this library for fun, but it is production ready, and of course, I will use it as soon as I have the opportunity. It is inspired by [backoff](https://github.com/cenkalti/backoff), the library I am using now.

`go-again` goes beyond exponential backoff and offers another algorithm for [a constant delay](https://github.com/jdvr/go-again/#call-database-keeping-a-constant-delay) in case you want to keep it simple. Furthermore, you can define [your own algorithm easily by implementing an interface](https://github.com/jdvr/go-again/blob/main/again.go#L30).
Getting Doctrine's ChangeSet in a postUpdate event
Tags: symfony, doctrine
Published: 2022-09-30 09:11:27

Recently, I had the need of having the changes of an entity in a lifecycle event after the database was updated. Normally, the postUpdate event doesn't have access to this information. So, what to do?

I figured, that storing the changes during onFlush or preUpdate would do the trick, but how? I did not want to enforce extra database calls. Therefor, the in memory ArrayAdapter of symfony cache to the rescue.

According to the documentation:

> Generally, this adapter is useful for testing purposes, as its contents are stored in memory and not persisted outside the running PHP process in any way.

So it is gone after the running process? Exactly what I needed. Here's how I set it during a preUpdate.

```
class DoctrineSubscriber implements EventSubscriberInterface
{
    private ArrayAdapter $arrayAdapter;

    public function __construct(
    ) {
        $this->arrayAdapter = new ArrayAdapter();
    }

    public function getSubscribedEvents(): array
    {
        return [
            Events::preUpdate, //OR
            Events::onFlush,
            // THEN
            Events::postUpdate,

        ];
    }

    public function preUpdate(PreUpdateEventArgs $args): void
    {
        $entity = $args->getObject();

        if ($entity instanceof Meeting) {
            $this->arrayAdapter->get($entity->getId(), fn () => $args->getEntityChangeSet());
        }
    }
}
```

Then, you can easily retrieve it using the stored id as the key, like:

```
public function postUpdate(LifeCycleEventArgs $args)
    {
        $entity = $args->getObject();

        if ($entity instanceof Meeting) {
            $id = $entity->getId();
            $changeSet = $this->arrayAdapter->getItem($id)->get();
        }

    }
```

If for some reason the database wasn't updated due to errors, the postUpdate isn't called and the changeset disappears. Just as I needed.

If you want to be sure on listeners or subscribers changes your entity before persistence, you should/could use the onFlush event instead, like this:

```
public function onFlush(OnFlushEventArgs $eventArgs): void
    {
        $uow = $eventArgs->getObjectManager()->getUnitOfWork();

        foreach ($uow->getScheduledEntityUpdates() as $entity) {
            if ($entity instanceof Meeting) {
                $this->arrayAdapter->get($entity->getId(), fn () => $uow->getEntityChangeSet($entity));
            }
        }
    }
```

Because onFlush is the last event called before database persistence, we're pretty sure nothing altered the changeset afterwards.

As a disclaimer... I use uuid as the id, so I am pretty sure the cache key will be unique for that change.