teleren/devto huggingface dataset:
SNMP Metrikleri Prometheus'a Nasıl Yönlendirilir?
Tags: snmp, prometheus
Published: 2023-04-06 13:04:36

**:bangbang:** İlgili makinede SNMP v2 servisi kurulu olduğu varsayılarak anlatım gerçekleşmiştir. Eğer kurulu değilse, ilk adım olarak kurulumlarını gerçekleştirmeniz gerekmektedir. [Bu](https://dev.to/aciklab/ubuntu-uzerinde-snmp-servisi-kurulumu-47d8) kaynaktan yararlanılabilir.

##**1. SNMP Exporter Nedir?**

SNMP Exporter, Prometheus'a SNMP istatistikleri sağlamak için kullanılan bir araçtır.


##**2. Kurulum**

- Öncelikle Ubuntu makinenizde snmp_exporter dosyasını indirmek için aşağıdaki komutu çalıştırılır:

```bash
 wget https://github.com/prometheus/snmp_exporter/releases/download/v0.21.0/snmp_exporter-0.21.0.linux-amd64.tar.gz
```

- İndirilen dosyayı açmak için şu komut çalıştırılır:

```bash
 tar xvfz snmp_exporter-0.21.0.linux-amd64.tar.gz
```

- Daha sonra, dizinde snmp_exporter klasörü görülecektir. 

```bash
 ls
```

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

Bu klasöre şu komut ile gidilir:

```bash
 cd snmp_exporter-0.21.0.linux-amd64
```

- Gidilen dizinde snmp.yml dosyasının konfigüre edilip edilmediği aşağıdaki komut ile kontrol edilir:

```bash
 nano snmp.yml
```

##**3. SNMP Exporter Servisi Çalıştır**

- snmp_exporter servisini çalıştırmak için şu komut çalıştırılır:

```bash
 ./snmp_exporter&
```

- Ardından tarayıcıya "http://IP:9116/snmp?module=if_mib&target=IP" yazılır ve 9116 portundan gelen metrikler izlenir.


> IP: SNMP v2 servisi kurulu olan makine'nin IP'si yazılır.

##**4. SNMP-Prometheus Konfigürasyonu**

- Prometheus kurulu olan makinenin terminali açılır.

- Şu komut yardımı ile prometheus dosyasına gidilir:

```bash
 cd prometheus
```

- Ardından şu komut ile prometheus.yml dosyasının içine girilir:

```bash
 nano prometheus.yml
```

- Dosyanın içine girildikten sonra aşağıdaki satırlar eklenir:

```
  - job_name: 'snmp'
    scrape_interval: 5s
    static_configs:
      - targets: ['IP:9116']

```
> IP: SNMP yüklü olan makinenin IP'si yazılır.

- Dosya kaydedilip çıkılır.

- Dosyada değişiklik olduğu için sırasıyla şu komutlar çalıştırılır:

```bash
 docker-compose down
```

```bash
 docker-compose up -d
```

- SNMP kurulu makinede snmp_exporter servisinin çalışır halde olduğu kontrol edilir.


- Ardından tarayıcıya "http://IP:9090/targets?search=" yazılır ve en altta SNMP target'ının UP olduğu görüntülenir:

> IP: Prometheus kurulu olan makine'nin IP'si yazılır.


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


- Daha sonra tarayacıya "http://IP:9090/graph" yazılır ve arama kısmına grafiği görülmek istenen snmp verisinin expression'u girilir ve garfik görüntülenir (ÖR:snmp_packets_total seçilir.) :

> IP: Prometheus kurulu olan makine'nin IP'si yazılır.

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

- Ek olarak tarayıcıya "http://IP:9116/" yazılır ve _Config_ butonuna tıklanarak snmp.yml içeriği görüntülenebilir.

> IP: SNMP v2 servisi kurulu olan makine'nin IP'si yazılır.
Resolvendo problemas no HackerRank: Presenteando um amigo.
Tags: javascript, beginners, programming
Published: 2023-04-06 13:02:56

Olá, seja bem vindo a mais um Resolvendo problemas no HackerRank: No caso de hoje, vamos ajudar Taum a dar um presente para seu amigo analisando custos. Vejamos mais informações com a explicação detalhada e sua resolução.

**Taum and B'day -**

Taum está planejando comemorar o aniversário de seu amigo, Diksha. Existem dois tipos de presentes que Diksha deseja de Taum: um é preto e o outro é branco. Para fazê-la feliz, Taum tem que comprar presentes `b` pretos e presentes `w` brancos.

- O custo de cada presente preto é de `bc` unidades.
- O custo de cada presente branco é de `wc` unidades.
- O custo para converter um presente preto em um presente branco ou vice-versa é em `z` unidades.


Vejamos o código a seguir:

```
function taumBday(b, w, bc, wc, z) {
    // Write your code here
  b = BigInt(b);
  w = BigInt(w);
  bc = BigInt(bc);
  wc = BigInt(wc);
  z = BigInt(z);  
    
  if (bc >= wc + z){
    return w*wc + b*(wc+z)
  }     
  else if (wc >= bc + z){
    return b*bc + w*(bc+z)
  }    
    else{
     return b*bc + w*wc 
    }      
}
```

Este é um código JavaScript que define a função taumBday que recebe cinco parâmetros: b e w, que são as quantidades de presentes a serem comprados para pessoas do sexo masculino e feminino, respectivamente; bc e wc, que são os preços unitários dos presentes para homens e mulheres, respectivamente; e z, que é o preço unitário adicional que deve ser pago para converter um presente para o sexo oposto.

O primeiro passo da função é converter todos os parâmetros para o tipo BigInt, o que permite que o código lide com números muito grandes. Em seguida, a função verifica se o preço unitário dos presentes para homens é maior ou igual ao preço unitário dos presentes para mulheres mais o custo adicional z. Se isso for verdadeiro, a função retorna o custo mínimo para comprar presentes para todos, comprando presentes para as mulheres pelo preço unitário wc e presentes para os homens pelo preço unitário wc+z. 

Caso contrário, a função verifica se o preço unitário dos presentes para mulheres é maior ou igual ao preço unitário dos presentes para homens mais o custo adicional z. Se isso for verdadeiro, a função retorna o custo mínimo para comprar presentes para todos, comprando presentes para os homens pelo preço unitário bc e presentes para as mulheres pelo preço unitário bc+z. Se nenhuma dessas condições for satisfeita, a função retorna o custo mínimo para comprar presentes para todos, comprando presentes para homens e mulheres pelos preços unitários bc e wc, respectivamente.

O resultado será o seguinte:

```
5
10 10
1 1 1
5 9
2 3 4
3 6
9 1 1
7 7
4 2 1
3 3
1 9 2

input:

20
37
12
35
12
```

Assim, concluímos mais um _Resolvendo problemas no HackerRank:_ até a próxima.
We need to find Alternative Captachas
Published: 2023-06-12 17:17:06

---
title: We need to find Alternative Captachas
published: true
date: 2023-04-06 12:48:39 UTC
tags: 
canonical_url: 
---

The internet is an incredible tool that has revolutionized how we live our lives. It has made it possible to connect with people from all over the world, access information at a moment's notice, and complete transactions from the comfort of our own homes.

However, the ease with which we can do all of these things has also made it easier for malicious actors to exploit the system. One of the most common ways they do this is through bots, which are automated programs that can perform tasks at a much faster rate than a human can.

To prevent bots from accessing sensitive information or performing malicious actions, most websites often CAPTCHAs, which are challenges that only a human can complete. But as AI becomes more advanced, CAPTCHAs are becoming easier and easier to bypass. Researchers have found that bots can solve some CAPTCHAs with up to 99% accuracy. This means that most CAPTCHAs are no longer an effective barrier against bots.

For example, a simple program using GPT4 (with image recognition to recognize things) can easily bypass a modern reCaptacha. Plus, there are multiple CAPTCHA-solving services online. We need to find alternative captchas that are difficult to pass for bots, but easy to pass for humans.

We also have the problem of accessibility. Sound captchas are easy to pass with voice recognition software.

To address these challenges, researchers and tech companies are exploring alternative CAPTCHAs that are more secure and accessible, but this isn't easy: most captchas are easy to bypass or very difficult to implement.

[Cloudflare Turnstile](https://www.cloudflare.com/en-gb/products/turnstile/), for example, although a good Captcha, can be bypassed by more advanced bots. ReCAPTCHA is the same: it can be easily bypassed by an object recognition program.
LANGUAGE DETECTION THROUGH NLP
Tags: nlp, webdev, beginners, programming
Published: 2023-04-06 12:41:12

This article on the Soffos AI developer blog discusses how natural language processing (NLP) can be used for language detection. The post explains the basics of NLP and outlines the steps involved in building a language detection system using NLP techniques. The article also highlights some of the challenges involved in language detection and provides insights on how to overcome them.

Read Full Post here: [LANGUAGE DETECTION THROUGH NLP](https://www.soffos.ai/developer-blog/language-detection-through-nlp)
How to use Advanced Reporting functionality in Magento 2
Tags: magento, magento2, magento2tutorial
Published: 2023-04-06 12:40:30

Working a Web based business in the present market presents various difficulties, from drawing in clients to persuading them to make a buy. With expanding contest, it's urgent for online retailers to separate themselves and proposition customized encounters.

This is where Business Knowledge (BI) comes in. As a generally utilized BI instrument, it permits organizations to utilize information driven experiences to go with informed choices.

Here, we'll investigate **_How to use Advanced Reporting functionality in Magento 2_** and its effect on improving your Internet business with Magento Business Knowledge.

For more information, please visit this:- **_[https://webguru.dev/how-to-use-advanced-reporting-functionality-in-magento-2/](https://webguru.dev/how-to-use-advanced-reporting-functionality-in-magento-2/)_**
How to check if a file exists in Node.js?
Tags: node, webdev
Published: 2023-04-06 12:34:43

Mainly there are 2 ways in which we can check if a file exists.
We will be using the [fs](https://nodejs.org/api/fs.html) API provided out of the box by Node.js

## Synchronous way

We can use the [existsSync](https://nodejs.org/api/fs.html#fsexistssyncpath) method to check if a particular file exists.

```js
const fs = require("fs")

const exists = fs.existsSync("./reports/new.txt")

if (exists) {
  console.log("File exists")
} else {
  console.log("File does not exists")
}
```

> `existsSync` is a synchronous call and will block all the requests till the function returns control.

## Asynchronous way

If you want to check if a file exists asynchronously,
you can use the [access](https://nodejs.org/api/fs.html#fsaccesspath-mode-callback) method.

```js
const fs = require("fs")

fs.access("./reports/new.txt", fs.constants.F_OK, error => {
  console.log({ error })
  if (error) {
    console.log(error)
    return
  }

  console.log("File exists")
})
```
Learning to work with the DOM
Published: 2023-04-06 12:34:21

Before starting Flatiron's software engineering program, I completed my pre-work relying entirely on the tests to determine if I did what the tests asked me to do. It ended up being a series of events of me running the tests and seeing the red text and going from there. Never actually understanding what my current code was doing so wrong. 

While there was DOM manipulation in the prework, I had never really felt too comfortable using it at that point. Since I wasn't too confident in my skills I tended to stray from using it, only ever listening to the tests. 

Once starting the program and the tests are no longer in labs did it finally click that manipulating the DOM is a very useful tool.  


**How do you access the DOM?**

You can access the DOM right now!😲

Windows: ctrl + shift + i
Mac: Option + Command +I 

We can see how this tab is showing us the structure and contents of this website. Opening up the DOM from your own document becomes more plentiful with the information. Presenting you with your code as well as the structure (HTML). 
You'll notice how the tab allows changes to be made onto the web page. This real time modification is what makes the DOM a handy tool. 

**What you can use this magical tab for:**

Interacting with the DOM saves time from having to go back to your VS Code, change one line, then go back to the page, reload the page, see if anything changed.

Initially, I didn't think much about what the DOM could do for me. I saw the page, saw what it did and didn't do, then went and changed the code to see if it'll do what I want it to do. I would stare at the screen for hours on end trying to figure out what I wasn't doing right. After a couple of lectures, I realized that I'm suffering needlessly when I could've been using `console.log()` to see if my code even worked as intended. 

Constantly checking and making sure that the code I had written so far works the way I intended it to function. It has saved me so much time and mental energy. Before I felt like it was just me in a pitch-black room, arms stretched out, feeling for anything just to take one step and not fall on my face. 

Now if I need to pick out specific elements on the page I could easily hover over them to find their id highlighted in the HTML. Or even see silly spelling mistakes I missed, the console will tell me down to the exact line where it detected an error.

**Lesson I learned** 

Learning something new will always be an uncomfortable process. If you feel unsure about something, like I did with DOM, that is a good sign that you need to practice with it further. Esspecially if you're just starting out. Yes it's good you found something that feels comfortable but if there's a better way of doing it, it's worth the discomfort to  continue to flourish in your new journey.
How to get tomorrow's date in JavaScript?
Published: 2023-04-06 12:33:17

Do you want to find out what is the date tomorrow or the date after a given date? We will see how to do the same in this article.

[JavaScript Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) has 2 methods `setDate()` and `getDate()`. We can use them to find tomorrow's date:

```js
const today = new Date() // get today's date
const tomorrow = new Date(today)
tomorrow.setDate(today.getDate() + 1) // Add 1 to today's date and set it to tomorrow
console.log("Tomorrow is", tomorrow.toDateString()) // 👉 Tomorrow is Mon Nov 07 2022
```

Now the next question you will have is, will this work if today is the last day of the month or year?

Let's find out:

```js
const currentDate = new Date("2022-10-31")
const nextDate = new Date(currentDate)
nextDate.setDate(currentDate.getDate() + 1)
console.log("Next date is", nextDate.toDateString()) // 👉 Next date is Tue Nov 01 2021
```

The code will work even for 31st December.

> The time will be set to the exact time as today. If you want to reset the time to midnight, you can use `tomorrow.setHours(0,0,0,0)`

You can put the above code to a utility function to add a particular number of days to any date:

```js
const getNextDays = (currentDate = new Date(), daysToAdd = 1) => {
  const nextDate = new Date(currentDate)
  nextDate.setDate(currentDate.getDate() + daysToAdd)
  return nextDate
}
```
Can someone explain to me the difference between roles and Users in postgresql
Tags: help, postgres
Published: 2023-04-06 12:29:30

As I ask in stackexchange https://dba.stackexchange.com/q/325711/118215 whilsed I was looking in this answer https://dba.stackexchange.com/a/177272/118215 

I noticed that Roles is something different from Users. But I cannot understand the difference. Can someone explain to me why roles are different from users and what the use cases for each?
React in E-commerce. Why Should You Use It in Your Business
Tags: react, reactjsdevelopment, beginners, ecommerce
Published: 2023-04-06 12:27:59

In the fast-paced world of e-commerce, delivering a seamless user experience is crucial to success. That's where React comes in. React is a powerful JavaScript library that allows developers to create dynamic, interactive web applications with ease. From real-time updates to lightning-fast rendering, React has become a go-to choice for modern web development. But how can it benefit your e-commerce business specifically? In this article, we'll explore the advantages of using React in e-commerce, and why it should be on your radar if you want to stay ahead of the competition. So, buckle up and get ready to discover the power of React in e-commerce!

Read the article on [Liki Blog](https://likims.com/blog/react-in-e-commerce-why-should-you-use-it-in-your-business).
Programmatically Navigate Using React Router
Tags: react, webdev
Published: 2023-04-06 12:24:32

Do you want to redirect a user to another page when a certain event like a button click happens?
Are you using react-router in your application for handling routing?
Then in this article, we will see how to navigate programmatically using react-router.

## Project setup

Create a new react project using the following command:

```bash
npx create-react-app react-router-programmatic-routing
```

Now install `react-router-dom` and `history` packages:

```bash
npm i react-router-dom history
```

In index.js, wrap the App component with `BrowserRouter`:

```jsx
import React from "react"
import ReactDOM from "react-dom/client"
import "./index.css"
import App from "./App"

import { BrowserRouter } from "react-router-dom"

const root = ReactDOM.createRoot(document.getElementById("root"))
root.render(
  <React.StrictMode>
    <BrowserRouter>
      <App />
    </BrowserRouter>
  </React.StrictMode>
)
```

In `App.js` create a couple of routes one for the home and another for the dashboard:

```jsx
import { Link, Route, Routes } from "react-router-dom"

function App() {
  return (
    <div className="App">
      <nav>
        <ul>
          <li>
            <Link to="/">Home</Link>
          </li>
        </ul>
      </nav>
      <Routes>
        <Route path="/" element={<Home />}></Route>
        <Route path="dashboard" element={<Dashboard />}></Route>
      </Routes>
    </div>
  )
}

function Home() {
  return <button>Go to dashboard</button>
}

function Dashboard() {
  return <div>Dashboard</div>
}

export default App
```

## Navigating when the button is clicked

We can use the [useNavigate](https://reactrouter.com/en/main/hooks/use-navigate) hook
from react-router to navigate to the dashboard when the button is clicked.

```jsx
import { Link, Route, Routes } from "react-router-dom"
import { useNavigate } from "react-router-dom"

function App() {
  return (
    <div className="App">
      <nav>
        <ul>
          <li>
            <Link to="/">Home</Link>
          </li>
        </ul>
      </nav>
      <Routes>
        <Route path="/" element={<Home />}></Route>
        <Route path="dashboard" element={<Dashboard />}></Route>
      </Routes>
    </div>
  )
}

function Home() {
  const navigate = useNavigate()

  return (
    <button
      onClick={() => {
        navigate("/dashboard")
      }}
    >
      Go to dashboard
    </button>
  )
}

function Dashboard() {
  return <div>Dashboard</div>
}

export default App
```
Agile Methodologies: The Future of Software Development
Tags: agilemethodologies, softwaredevelopment, futureoftech, agilesoftwaredevelpment
Published: 2023-04-06 12:21:39

Software developers must find innovative ways to work together and produce high-quality solutions quickly as the industry gets more complex and hurried. Agile approaches can help with that. 

Agile techniques are a set of rules and procedures that put an emphasis on adaptability, teamwork, and client satisfaction. Agile teams produce functional software that satisfies the needs of the client by working in brief cycles, known as sprints, as opposed to adhering to a fixed plan. 

Some of the fundamental ideas behind agile approaches are as follows:

- Individuals and interactions over processes and tools
- Working software over comprehensive documentation
- Customer collaboration over contract negotiation
- Responding to change over following a plan

Agile approaches do not apply to all situations. Developers can use a variety of frameworks, including Scrum, Kanban, and Lean, to apply agile methods in their teams. Although each framework has its own set of guidelines and procedures, they all aim to produce high-quality software fast and effectively.


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

- Faster time-to-market: Agile teams work in short cycles, so they can deliver working software quickly and frequently.
-  Improved collaboration: Agile teams work closely together, so they can quickly resolve issues and make decisions as a team.
-  Better quality: Agile teams prioritize testing and continuous integration, so they can catch and fix issues early in the development process.
- Customer satisfaction: Agile teams prioritise customer collaboration, so they can deliver software that meets the customer's needs and expectations.


Agile methodologies are not without their challenges, though. Some common challenges include:

- Lack of structure: Flexible agile approaches can also result in a lack of structure and direction.

- Opposition to change: Agile approaches call for a culture transformation, and certain team members might be averse to it.

- Lack of planning: Agile teams must properly plan their sprints to avoid not delivering what the customer needs.


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

For software development teams looking to produce high-quality software rapidly and effectively, agile approaches are a strong tool. Agile teams can stay ahead of the market and produce solutions that satisfy their customers by placing a high priority on flexibility, collaboration, and customer happiness.