teleren/devto huggingface dataset:
How to Solve the 'setState is not a function' Error in React
Published: 2023-03-29 10:44:05

- 
The setState function is an important method in React that is used to update the state of a component. However, sometimes you may encounter an error that says "setState is not a function". This error occurs when you try to call setState on a component that is not a class component or when the this keyword is not properly bound to the component's instance. Here are some ways to solve this error: 

(1) Make sure your component is a class component: setState is a method that is only available in class components. If you are using a functional component, you can convert it to a class component by using the class keyword and extending the React.Component class.
(2) Bind the this keyword to the component's instance: When using setState in a class component, it is important to bind the this keyword to the component's instance. This can be done in the constructor of the 
component by using the bind method:
```
constructor(props) {
  super(props);
  this.state = {
    // initial state
  };
  this.handleChange = this.handleChange.bind(this);
}
handleChange() {
  this.setState({ // update state });
}
```
(3) Check the spelling of setState: Make sure that you are spelling setState correctly and that it is not a typo.
(4) Check the scope of setState: Make sure that you are calling setState within the scope of the component's instance. For example, if you are passing a function as a prop to a child component and that function calls setState, the this keyword may not be properly bound to the component's instance, causing the error.
By following these steps, you should be able to solve the setState is not a function error in your React application.
OTel for the rescue - dev first API observability
Tags: opentelemetry, api, microservices, observability
Published: 2023-03-29 10:36:45

This article discusses how API observability powered by OTel distrubted tracing and instrumented data helps developers debug issues much faster and minimize MTTR in microservices. 
 

We all know the davatages of APIs, today's SW developement pretty much relaes on them. But, here as well, distributed architectures make it hard to have control and visibility over all APIs across all microservices, and know where exactly they are used and how. 

Actual instrumentated data improves the developer experience by providing API observability and troubleshooting capabilities. In short, it enables visibility into API inventory, specs & runs and therefore is helping identify and debug issues instantly and minimize MTTR. This article is written by a developer at Helios, using API observability features in the platform to monitor and troubleshoot the app she works on. 

Specifically, she talks about applying API observability in the following ways:

- Using an auto-generated API catalog, enabling discovery of the entire API inventory used by an application
- Using API overview and spec tools, providing access to API documentation and performance as calculated automatically based on instrumented API calls
- API troubleshooting, allowing immediate access to different kinds of API errors and failures – including the full E2E context coming from distributed tracing and context propagation
 
Continue to the full article to learn more and review examples: 
[](https://gethelios.dev/blog/api-observability-leveraging-otel-to-improve-developer-experience/)
Why DevOps is Critical for Enterprise Development
Tags: devops
Published: 2023-03-29 10:32:44


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3y6czr6tyopady2u07j.png)
DevOps is an approach that combines the development and operations teams to work together throughout the entire software development lifecycle, from planning to deployment and maintenance. The DevOps approach emphasizes collaboration, automation, and continuous improvement to enable faster delivery of high-quality software.

In today’s fast-paced business world, where time to market is critical, DevOps has become an essential aspect of enterprise development. DevOps practices enable enterprises to deliver software at a faster pace, with greater efficiency and reliability, while reducing costs and minimizing risk.

Some of the DevOps practices that are critical for enterprise development include continuous integration and continuous delivery (CI/CD), automated testing, infrastructure as code (IaC), and monitoring and logging. These practices enable enterprises to build, test, and deploy software more rapidly and efficiently, while ensuring high quality and reliability.

DevOps solutions can help enterprises to achieve these practices by providing tools and platforms that enable automation, collaboration, and integration between development and operations teams. DevOps automation tools like Jenkins, GitLab, and Ansible can help enterprises to automate tasks and workflows, while DevOps implementations like Kubernetes and Docker can enable containerization and orchestration of applications, leading to improved portability and scalability.

Choosing the right [DevOps solution](
https://cloudzenix.com/devops/devops-solutions-services/
)

) provider is critical for successful DevOps implementation. CloudZenix is a leading provider of DevOps solutions, with expertise in automation, infrastructure as code, and cloud-native development. With CloudZenix, enterprises can achieve faster software delivery, greater efficiency, and improved reliability, leading to improved business outcomes and competitive advantage.

In conclusion, DevOps is critical for enterprise development, enabling faster delivery of high-quality software with greater efficiency and reliability. DevOps practices, solutions, automation, and implementations are key to achieving these benefits, and [CloudZenix ](https://cloudzenix.com/)can help enterprises to achieve successful DevOps implementation and reap the benefits of faster innovation and competitive advantage. [https://cloudzenix.com/contact-us/](https://cloudzenix.com/contact-us/)
Example: API Metrics with Prometheus and Grafana
Tags: metrics, grafana, tutorial, go
Published: 2023-03-29 10:31:05

This post is a follow-up to the previous posts on [designing metrics for event-driven systems](https://rnemet.dev/tags/metrics/). This humble post is a practical example of how to implement the metrics API and how to use it to create a dashboard in Grafana.
I'm not using Kubernetes but Docker Compose; the concepts are the same. The reason is simplicity.

The code is available on [this GitHub repository](https://github.com/robert-nemet/dc-playground).

## The Scenario

The setup comprises two API services(`app` and `beta`) and a database(`postgres`). Liquibase creates the database schema.
API services are two instances of the same service. They connect to the same database.

They are calling each other via HTTP calls, like ping-pong. Then there is an echo endpoint that returns the request body and a counter endpoint that counts
the number of calls to the endpoint. The counter is stored in the database. Metrics are exposed on the `/metrics` endpoint.
Metrics are collected by Prometheus and displayed in Grafana.

In addition, a `vegeta` service sends requests to API services, like load testing.

The code is available on [the same repository](https://github.com/robert-nemet/dc-playground). It is done in Go. The code is not the focus of this post,
but I will show some snippets to give you an idea of how it is implemented.

If you are interested in this topic, [continue to my blog](https://rnemet.dev/posts/k8s/example_implement_metrics_api/).
integrate WP Job Manager with Mailchimp: methods, options and more
Published: 2023-03-29 10:24:11

Is there any way to integrate WP Job Manager with Mailchimp? How to create email campaigns for all job listing submissions.


Allthough there isn’t an official integration in the plugin, however there is a built-in RSS feed in the WP Job Manager that you can use to integrate with Mailchimp. The RSS feed is visible at https://yoursite.com/?feed=job_feed. You can find more details about the WP Job Manager RSS feed here:

https://wpjobmanager.com/document/rss-feed-for-jobs/

you can find more details on using the RSS feed with Mailchimp here: https://mailchimp.com/features/rss-to-email/


**Beside this: **it is possible to integrate WP Job Manager with Mailchimp. WP Job Manager is a popular WordPress plugin used for job board management, and Mailchimp is an email marketing service that allows you to create and send email campaigns.

There are several plugins available in the WordPress repository that can help you integrate WP Job Manager with Mailchimp. One such plugin is WP Job Manager - Mailchimp Integration, which allows you to add job listing submissions to your Mailchimp lists automatically.

Here's how you can integrate WP Job Manager with Mailchimp using the WP Job Manager - Mailchimp Integration plugin:

Install and activate the WP Job Manager - Mailchimp Integration plugin on your WordPress website.

Go to the Mailchimp settings page in the WordPress dashboard and enter your Mailchimp API key.

Map the WP Job Manager fields with the Mailchimp fields.

Enable the "Subscribe to Mailchimp" option for job submission forms.

Once the integration is set up, all job listing submissions will be added to your Mailchimp list automatically, and you can use Mailchimp to create email campaigns for these submissions.

If you prefer not to use Mailchimp, there are other email marketing services that you can consider, such as Constant Contact, GetResponse, or AWeber. You can use their APIs to integrate them with WP Job Manager or use a plugin that supports integration with your preferred email marketing service.
C++ Nested if...else
Published: 2023-03-29 10:20:31

Assalamu aleykum xurmatli dasturchi bugun siz bilan C++ dasturlash tilida **Nested if** - `ichma ich` **if** ni kirib chiqamiz.

Ba'zan biz boshqa **if** ichida yani bitta  **if ** iborasidan foydalanishimiz kerak. Bu ichki o'rnatilgan **if** iborasi sifatida tanilgan.

Buni `if` iboralarining bir nechta qatlami sifatida tasavvur qiling. Birinchi, tashqi `if` gap, uning ichida esa boshqa, ichki `if` gap bor.
**Uning sintaksisi:**

```
// outer if statement
if (condition1) {

  // statements

  // inner if statement
  if (condition2) {
    // statements
  }
}
```

**Eslatmalar:**

- Agar kerak bo'lsa, ichki `if` iborasiga `else` va `else if` iboralarini qo'shishimiz mumkin.

- Ichki `if` iborasi tashqi `else` yoki `else if` iboralari (agar mavjud bo'lsa) ichiga ham kiritilishi mumkin.

- Biz `if` iboralarining bir nechta qatlamlarini joylashtirishimiz mumkin.


**Misol uchun:**
```
#include <iostream>
#include <cmath>
#include <iosmanip>
using namespace std;

int main()
{

  int son;
  cin >> son;

  if(son > 0)
  {
    if(son % 2 == 0)
    {
      cout << "Musbat juft son";
    }
    else
    {
      cout << "Musbat toq son";
    }
  }
  else
  {
    if(son % 2 == 0)
    {
      cout << "Manfiy juft son";
    }
    else
    {
      cout << "Manfiy toq son";
    }
  }


  return 0;
}
```
How to make a simple chrome extension?
Tags: webdev, programming, tutorial
Published: 2023-03-29 10:18:40

Hello:)
This is some instructions to make a simple chrome extension

## Coding
First you will need to create a file called _`manifest.json`_
Then put this code in it

```
{
  "manifest_version": 3,
  "name": "",
  "version": "",
  "author": "",
  "description": "",

  "icons": {
    "128": "128.png"
  },
  "launch": {
    "web_url": "https://example.com"
    
  },
  "content_scripts":[
    {
      "matches": [
            "<all_urls>"
          ],
      "js": ["script.js"]
    }
```
Then create the script.js
And write some code in it.
Example:

```
alert("extension");
```
That all the code

## view it

1. Go to chrome://extension
2. Toggle the developer mode
3. Then click on pack extension then choose  your extension folder.
And that's it :)
if you have any question feel freee to comment below
How to Hire Video Resume Makers?
Tags: resume
Published: 2023-03-29 10:12:56

1. Research: Research different [UAE video resume makers online](https://www.cvdubai.ae/video-resume/), their services, and reviews to better understand the options available and make an informed decision.

2. Define your requirements and budget: Consider the type of video resume you want to create and your available budget.

3. Make a shortlist: Make a shortlist of video resume makers based on your requirements, budget, and reviews.

4. Contact the shortlisted: Contact the shortlisted resume makers and ask questions about their services, pricing, and turnaround times.

5. Compare quotes and choose: Compare the quotes you receive and choose the video resume maker that best fits your requirements and budget.
Apache AGE & PostgreSQL | Database Configurations Part II
Tags: apacheage, postgres, c
Published: 2023-03-29 09:57:25

Sup!

So let's get back to where we dropped off. We know how to open files to edit in terminal. Now we are going to edit some configurations in that file.

First of all, we will change the port number on which our database will run. Let's change it from **5432** to **5430** but this is up to you, you can make it whatever you want or leave it as it is.

To change this, scroll down the file a little until you see the port field. Just simple go ahead and change the number to whatever you want.

Next we have to add AGE extension to preloaded extensions so we don't have to load it every time we run this db.

Locate the field "**shared_preloaded_libraries**" and add '**age**' on the right side.

You can also search in the bottom to look for your desired field. Just press '**/**' followed by the word you are looking for and press **ENTER**.

Finally we have to add '**ag_catalog**' to the search_path. Similar steps, we can use '/' to search and then edit the field to include 'ag_catalog' as well.

Hope this helps in configuring files using vim.

Stay Tuned For More!

https://age.apache.org/
https://github.com/apache/age

Good Bye!
Apache AGE & PostgreSQL | Database Configurations
Tags: postgres, apacheage, c
Published: 2023-03-29 09:41:31

Welcome back!

In this blog, we are going to discuss how to configure database settings using command-line interface.

Inside the directory for the created database, for example "demo" in the last blog, there is a file named "postgesql.conf". We have to make changes in this file to suit our needs.

To open the file in terminal, write the following command:

**vim demo/postgresql.conf**

where again, 'demo' is our db name.

In this next blog, we will see how and what changes we have to make in this file.

https://age.apache.org/
https://github.com/apache/age

Thank You!
Building a Career in Cybersecurity
Published: 2023-03-29 09:40:44

Cybersecurity is a rapidly growing field and there has never been a better time to start a career in this industry. Cybersecurity professionals play an essential role in securing sensitive information and ensuring the safety of digital infrastructure. However, getting started in this field can be overwhelming for beginners.

To help you navigate the path to a successful career in cybersecurity, we have put together a beginner’s roadmap. Start by gaining foundational knowledge and certifications, such as CompTIA Security+ or Certified Information Systems Security Professional (CISSP). Once you have a strong understanding of the basics, consider specializing in a particular area of cybersecurity, such as penetration testing or incident response.

It is also important to gain hands-on experience through internships, bootcamps, or entry-level positions. Networking and staying up-to-date with industry developments can also help you stay ahead in this ever-evolving field.

Building a career in cybersecurity can be challenging, but with determination, a willingness to learn, and the right resources, it is possible to succeed. Start your journey today by following our beginner’s roadmap.

Reference: [https://techblog.cybersynctech.com/building-a-career-in-cybersecurity/](https://techblog.cybersynctech.com/building-a-career-in-cybersecurity/)
Zero Trust Cyber Security: A New Approach to Securing Networks
Published: 2023-03-29 09:40:02

As technology continues to advance, so do the threats to cyber security. In today’s world, companies and organizations face an increasing number of cyber attacks, and the consequences can be devastating. From data breaches to ransomware attacks, the risks are significant. This is why many organizations are turning to Zero Trust Cyber Security as a new approach to securing their networks.

Zero Trust Cyber Security is a security model that assumes that no user or device on a network should be trusted by default. It requires strict identity verification for every user, device, and application that tries to access the network, regardless of whether they are inside or outside of the network perimeter.

The Zero Trust model relies on several key principles, including continuous verification of identities and devices, least privilege access controls, and micro-segmentation of networks. This approach helps to reduce the risk of data breaches and cyber attacks by limiting access to sensitive data and applications.

Implementing a Zero Trust Cyber Security model requires a significant investment in technology and expertise, but the benefits can be significant. By taking a proactive approach to cyber security, organizations can better protect their data and minimize the risk of a cyber attack.

In conclusion, Zero Trust Cyber Security is a new approach to securing networks that is gaining popularity among organizations. By assuming that no user or device on a network should be trusted by default, and implementing strict identity verification and access controls, organizations can better protect their data and minimize the risk of cyber attacks.

To learn more about check out our article on this topic at [https://techblog.cybersynctech.com/art-of-web-development-node-js-and-django/](https://techblog.cybersynctech.com/art-of-web-development-node-js-and-django/).
Alternative ni written in fish
Tags: node, yarn, pnpm, bunjs
Published: 2023-03-29 09:37:12

## What is "ni"?

`ni` is a tool that selects and executes the appropriate package manager, such as npm or yarn, for each project.
It also provides commands such as `nun (npm uninstall)` and `nr (npm run)`, and common commands other than `install` have been standardized.

Internally, it uses logic that selects the appropriate package manager from lock files and the `packageManager` field in package.json.
https://github.com/antfu/ni/blob/main/src/detect.ts

In addition, the options are also converted appropriately according to each package manager, so it absorbs the differences between package managers.
https://github.com/antfu/ni/blob/main/src/agents.ts

## zsh version

Someone is working on an implementation of a [zsh version of ni](https://efcl.info/2023/03/24/ni/).
Unlike the original, this `zsh` implementation consolidates all the commands into the `ni` command, so commands such as `run` and `uninstall` are executed through `ni`.

## fish version

https://github.com/Karibash/ni.fish

There was a psychological hurdle to the fact that the original `ni` would define multiple commands with very short names.
I thought the zsh version's approach of handling subcommands was very good, so I created a similar plugin for fish.

Since it is a fish plugin, installation is easy.

```
fisher install Karibash/ni.fish
```

The package manager detection logic in the zsh version is slightly different from the original `ni`, but the fish version tries to use the same logic as much as possible.
It searches recursively for lock files in the parent directories, so it can correctly determine the package manager even when in a subdirectory of a monorepo such as `npm workspace`.

The simple usage is summarized in [README.md](https://github.com/Karibash/ni.fish/tree/main#-usage), so if you are interested in the details, please check it.
Also, issues, PR, etc. are welcome!
If you like it, I would appreciate a star to the repository.
Error: legacy-install-failure with pip install
Tags: python, abotwrotethis
Published: 2023-03-29 09:35:02

If you're working with Python, chances are you're using pip to manage your dependencies. Pip is the de facto package manager for Python and allows you to easily install, update, and uninstall packages.

But sometimes, you might run into a common error when trying to install packages: legacy-install-failure. This error can be frustrating, but fortunately, it's easy to fix. In this blog post, we'll walk you through the steps to resolve this error.

## Understanding the legacy-install-failure error

Before we dive into the solution, it's important to understand why this error occurs. The legacy-install-failure error happens when pip is unable to install packages due to an outdated version of setuptools.

To explain further, setuptools is a package that provides utilities for installing, distributing, and building Python packages. Pip relies on this package to install other packages. If the version of setuptools that you have installed is too old, pip may fail to install packages, resulting in a legacy-install-failure error.

## Resolving the legacy-install-failure error

Now that you understand why the legacy-install-failure error occurs, let's look at how to resolve it. There are two ways to fix this issue: upgrading setuptools or installing packages with pip in a different way.

### Upgrading setuptools

The first method is to upgrade setuptools to the latest version. To do this, you'll need to run the following command:

```
python -m pip install --upgrade setuptools
```

This will upgrade the setuptools package to the latest version, allowing pip to install packages without encountering the legacy-install-failure error.

### Installing packages with pip in a different way

If upgrading setuptools doesn't resolve the issue, you can try installing packages with pip in a different way. One way to do this is to use a different installation method, such as using the `--no-cache-dir` flag. This flag prevents pip from using any cached files during the installation process, which can sometimes cause issues.

To install a package using the `--no-cache-dir` flag, run the following command:

```
pip install package-name --no-cache-dir
```

This will install the desired package without using any cached files, which can sometimes resolve the legacy-install-failure error.

## Conclusion

The legacy-install-failure error with pip install can be frustrating, but it's easily resolved. By upgrading setuptools or installing packages with pip in a different way, you can ensure that your packages install without any issues. Remember to always keep your dependencies up to date and to check for any errors before you begin your development work. Happy coding!