teleren/devto huggingface dataset:
Callback-based asynchronous functions
Tags: javascript, webdev, react, programming
Published: 2022-10-25 13:48:57

Let's face it. Sometimes you have to use an asynchronous function that uses the old callback-based approach. It might be part of a legacy codebase, or it could come from a library that hasn't had an update in over 5 years. 🤷‍♂️

So what do you do? Do you add messy callbacks to your code? 🙅‍♂️

What if I told you there is a way to make callback-based asynchronous functions work nicely with async/await? Not only that, but you won't have to make any changes to existing code.

The solution is to transform the callback-based function to return a promise. This called promisification. You can do that manually or by using util.promisify.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5nebi3v4nqd6nx5h948.jpg)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0ji3wq27ozrdjcn87yy.jpg)
GPDR consent : does it *have* to be a pop-up ?
Tags: webdev, ux, a11y
Published: 2022-10-25 13:47:54

I'm currently involved in a web accessibility project.

Web sites of businesses and organisation based somewhere in the Eu must obtain cookie consent from their users. 

I've seen only one tool used to express consent : pop-up. 

Under GPDR user must mark their consent by expressing a "clear positive action". 

Accessibility problem : cookie consent pop-up are not "seen" by the accessibility tools (one cannot navigate towards it by using a keyboard only).

Have you seen a cookie-consent method that is not a pop-up ? Any way you would make a pop-up accessibility-friendly ? 

Thanks in advance !
[Grind 169] 5. Valid Palindrome
Published: 2022-10-25 13:45:20

Problem Link: https://leetcode.com/problems/valid-palindrome/

Solution:

```go
func isPalindrome(s string) bool {
    var sb strings.Builder
    
    for _, c := range s {
        var str = string(c)
        if (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') {
            sb.WriteString(str)
        } else if (c >= 'A' && c <= 'Z') {
            sb.WriteString(strings.ToLower(str)) 
        }
    }
    
    s = sb.String()
    var n = len(s)
        
    for i := 0; i < n/2; i++ {
        if s[i] != s[n-i-1]  {
           return false 
        }
    }
    
    return true
}
```
Data Analyst: Reality vs Expectations
Tags: beginners, career, motivation, datascience
Published: 2022-10-25 11:17:26

> _The first rule of data science is: don’t ask how to define data science_ - Josh Bloom ([Azam 2014](https://www.berkeleysciencereview.com/article/2014/04/27/the-first-rule-of-data-science))

If you are anything like me (I hope not), then you must like to spend your free time looking at job postings on LinkedIn to see what companies in your industry are looking for in a Data Analyst role. Whether for a new job or trying to keep your skills up to date, you'll notice that not all Data Analyst roles are the same. Having worked at 3 different companies ranging from mid-size ad agency, adtech startup and a big fintech I'm going to break 3 expectations of a Data Analyst and explain the reality to each one of them.

1. **You need to know how to code**
Starting off with this I'll say right now that the short answer is *drum rolls* it depends. In my experience, it is not always necessary and depends on what exactly you'll be working on. In my first role out of college as an analyst, I did not write nor used any line of code to do my job. I primarily used Excel and Tableau to work on my assigned tasks. It wasn't until my second and third job, that I got to start using SQL to pull data to build out some projects. My advice would be to defiantly learn SQL, it is a must if you want to be a Data Analyst or even take a step into the world of Data Science. Moving forward, I would recommend learning to code depending where you see yourself going in the long term of your career.

2. **Providing insights and predictions to the company**
Now for this, you will be providing insights for your company but not all roles will have you performing predictions. Especially in an entry level role, you will be to focus more on how clients and teams should interpret current data based on the business questions they want answer. It's not until you reach a senior analyst role or transition into a data scientist that developing predictive models becomes part your job or not. Which leads to my final point.

3. **Data Science is the same everywhere**
Initially, I thought this to be true when I was in college studying for my degree. I would read and listen to all these books related to Data Science then expect that once I got the role I would be doing those exact things. It wasn't until I started moving around from different companies to realize that each company has their definition to what is considered Data Science, Data Analyst, Data Engineer, and the list goes on. Which is why all jobs in this realm will never be the same. Different companies mean different jobs.

What were some of your expectations that you thought were true when becoming a Data Analyst or working in Data Science in general?
[Grind 169] 4. Best Time to Buy and Sell Stock
Published: 2022-10-25 13:43:48

Problem Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/

Solution:

```go
func maxProfit(prices []int) int {
    var profit = 0
    var n = len(prices)
    var left = 0
    var right = 1
    
    for right < n {
        if prices[right] > prices[left] {
            var diff = prices[right] - prices[left]
            if diff > profit {
                profit = diff 
            }
        } else {
            left = right
        }
        
        right++
    }
    
    return profit
}
```
Tiny Tips : Testing protected method without using friendship in C++
Tags: cpp, testing
Published: 2022-10-25 13:41:59

Assume you have this class to test:

**MyClass.h**
```cpp
class MyClass {
public:
    float publicMethod();
protected:
    float criticalInternalMethod();
};
```

`criticalInternalMethod()` implement a complex business logic or algorithm, but it is too internal to make it part of public API. How to test it ?

With GoogleTest, you can use the [FRIEND_TEST](https://google.github.io/googletest/reference/testing.html#FRIEND_TEST) macro. But it requires putting google header in public API, and a macro in class definition.

What you can do instead is this:

**MyClassTest.cpp**
```cpp
class MyClassTest : public MyClass
{
public:
    using MyClass::criticalInternalMethod;
};

TEST(MyClassShould, computeGoodResult)
{
    MyClassTest myClass;
    EXPECT_EQ(myClass.criticalInternalMethod(), 12);
}
```

This doesn't work for private method, but at least it avoids polluting public header only for the sake of testing.
[Grind 169] 3. Merge Two Sorted Lists
Published: 2022-10-25 13:39:39

Problem Link: https://leetcode.com/problems/merge-two-sorted-lists/

Solution:

```go
/**
 * Definition for singly-linked list.
 * type ListNode struct {
 *     Val int
 *     Next *ListNode
 * }
 */
func mergeTwoLists(list1 *ListNode, list2 *ListNode) *ListNode {
    
    var node = &ListNode{}
    var tail = node
    
    for {
        if list1 == nil || list2 == nil {
           break 
        }
        
        if list1.Val < list2.Val {
            tail.Next = list1
            list1 = list1.Next
        } else {
            tail.Next = list2
            list2 = list2.Next
        }
        
        tail = tail.Next
    }
    
    if list1 != nil {
        tail.Next = list1
    } else if list2 != nil {
        tail.Next = list2
    }
    
    
    return node.Next
}
```
🤯 Does Hackernoon team manually edit user article to inject crypto advertisement? [Updated]
Tags: discuss, watercooler, blog, writing
Published: 2022-10-25 13:37:27

To moderators: If this is not a right place to ask, please feel free to remove this post.
___

**Update 1**

A Hackernoon editor reached out to me and let me know there was an error on their auto TLDR generated system, so my TLDR was inserted incorrectly. My article was amended. To quote:

> There appears to have been an error with a feature that we use to generate TL;DRs that inserted the incorrect text.

I did scan over 50+ article to see if there are similar situations. Then found some that the TLDR has no connection to the article, such as below. _Certainly, I cannot say whether it was intended by the article author or resulted from a bug on Hackernoon system._

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

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

However, an issue regarding unrelated references or tags like crypto coins and companies is fairly widespread. Press on TLDR, or look at the bottom of the article, and you will notice them. If these are bugs, hopefully these will be fixed down the road.

___

**Original post**

Hackernoon is one of place to occasionally cross-post my article. However, there are a few things that I notice:

1. Sometimes they dropped my canonical link I had to manually edit afterward.
2. But it seems like an edit button is removed now? Or at least moved to some non-trivial location? At least for now, I cannot find a way to make changes to my article.
3. The TLDR became a place to inject crypto advertisement (by editor or some automated system I suppose?).
4. There are many references pointing to crypto materials, even though the article is not related at all.

What do you think?


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


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



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8iit71we8lglbp7sskyz.png)
DAY # 1 - Making The Most Out of Tutorial Hell
Tags: 100daysofcode, motivation
Published: 2022-10-25 13:37:02

Hello guys!

Remember tutorial hells? If you don't, then I am definitely writing this at the wrong forum.🤷‍♂️

I have tried many things in the past for learning to code. Books, Tutorials, Youtube, Udemy, YOU NAME IT. 

I have also dabbled with the art of blogging, and wishfully partaking in movements like #100DaysOfCode and all those, but I seem to beat every single one of those hacks, and simply refuse to get going or get regular with coding practices. 

Last night, I had an epiphany based on my love for youtube coding channels. 

what if I try to watch every single video of my favourite youtube coding channel one by one? I doubt if anybody has tried this before or if it even works? 

and as if watching every single video of 1 of youtube coding challenge was not difficult enough, I have also sentenced myself to blog my experience all the way. 

The blogging would contain my own ramblings about the concept I learn through those videos every day and also allow me to have a fake sense of responsibility? May be ONE of you could SHOUT AT ME for trying to skip the days?

Here to the new beginnings, 
Here to the new experiments
Here to the not failing,

let's get rooooooooooooooooooollllliiiinnnnnnnnng! 🐱‍🏍🎈🎈
[Grind 169] 2. Valid Parentheses
Published: 2022-10-25 13:36:45

Problem Link: https://leetcode.com/problems/valid-parentheses/

Solution:

```go
func isValid(s string) bool {
    var stacks = []rune{}

    var closeToOpen = map[rune]rune{
        ')' : '(',
        '}' : '{',
        ']' : '[',
    }

    for _, c := range s {

        n := len(stacks)

        if n > 0 {
            if stacks[n-1] == closeToOpen[c] {
                stacks = stacks[:n-1]
            } else {
                stacks = append(stacks, c)
            }
        } else {
            stacks = append(stacks, c)
        }
    }

    return len(stacks) == 0
}
```
Introdução ao DOM
Tags: javascript, braziliandevs
Published: 2022-10-25 13:27:25

<base target="_blank">
### O que é o DOM? (DOCUMENT OBJECT MODEL)

É uma representação estruturada do html que permite que o javascript acesse e manipule os elementos.

Quando um arquivo html é carregado no browser(navegador)
uma arvore de elementos é gerada: 
![DOM Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/27vwlxajejbrmj6cpcs4.png)
Perceba que a imagem lembra uma árvore genealógica, por isso a um conceito de elementos "pais" e elementos "filhos".

**O DOM não é javascript!**
O DOM é uma API, que significa que é uma interface que fornece recursos(métodos e propriedades) para ser manipulada pelo javascript.
Exemplo de um método do DOM:

```
document.querySelector(".user-panel");
```

Para finalizar segue um link de um repositório do projeto que eu coloquei em pratica conceitos do DOM: 
[Guess my Number repositório](https://github.com/g-101/guess-my-number)
How to Reverse a String in JavaScript
Tags: javascript, stringreverse, beginners, programming
Published: 2022-10-25 13:23:50

Here the task is 
let input_String = 'I love Myself'
Expected Output String: Myself love I

A built-in mechanism to reverse a string does not exist in JavaScript. However, reversing an array can be done using a built-in technique. In order to create an array, we must first convert our string.

Make an array of words from our string using split()
let input_String = 'I love Myself'
let arr_string = input_String.split(' ')
console.log(arr_string) //[ 'I', 'love', 'Myself' ]

We have array of words. To reverse the order, we can use our built-in array method. The array's items should be arranged in reverse.
let rev_string = arr_string.reverse()
console.log(rev_string) //[ 'Myself', 'love', 'I' ]

The words are in an array. The array will now be changed back into a string. Reconstruct the elements of our array as a string.
let join_string = rev_string.join(' ')
console.log(join_string) //Myself love I

We can now write on a single line.
console.log(input_String.split(' ').reverse().join(' ')) //Myself love I
Hacktoberfest : OpenSource Treasure
Tags: hacktoberfest, opensource, beginners
Published: 2022-10-25 07:14:40

Every one in tech community speaks of open source contribution and how it helps to upskill beginner developers. When I started my Developer journey, I got to know about the open source community but I wasn't able to contribute due to lack of skill and awareness of where exactly to contribute. Later, I was introduced to _Hacktoberfest_ by my college professor. In Hacktoberfest, it's like a quest, to get 4 Pull requests merged and you win a Tshirt. I learned how to contribute and made my contributions right away. The feeling of getting 4 PRs merged and winning a Tshirt boosted my adrenaline to contribute more towards the open source community. Just like me, My fellow classmates are enthusiastic about contributing too. It's my 2nd year of contributing to [Hacktoberfest](https://hacktoberfest.com/) and I maintained a repository too. It was a amazing experience and I wish to continue further. 
The reason I'm writing this is because there might be more people, who need a kickstart for their developer journey. Sometimes, A person needs is a small Acknowledgement, to start for better. If they could relate to me, I would be grateful. 
I've attached my first swag kit which I received last year. [](url)
![My_Swag_kit](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ickumhxkanngca56n02.jpg)
[Grind 169] 1. Two Sum
Published: 2022-10-25 13:19:11

Problem Link: https://leetcode.com/problems/two-sum/

Solution 1:

```go
func twoSum(nums []int, target int) []int {
    var n = len(nums)
    for i := 0; i < n; i ++ {
        for j := i+1; j < n; j++ {
            if nums[i] + nums[j] == target {
                return []int{i, j}
            } 
        }
    }
    return []int{}
}
```

Solution 2:

```go
func twoSum(nums []int, target int) []int {
    var data = make(map[int]int)
    for j, v := range nums {
        if i, ok := data[v]; ok {
            return []int{i, j}
        } else {
            data[target - v] = j
        }
    }
    return []int{}
}
```
Being an AWS CB, what do I get?
Tags: aws, community, progress
Published: 2022-10-25 13:17:20


After my Cloud Evangelist promotion at Webstep, I got a couple of questions about what an AWS Community Builder is. The questions were mainly about the benefits, and I can say if it's only the benefits you are asking for, then maybe you are thinking of it from the other way around, but as many have asked, here is a little drill down.

## What is AWS Community Builders?

It is a program organized by AWS, a unique opportunity that offers sessions including technical and non-technical knowledge sharing, networking with other AWS builders, insights into upcoming products, contact with the AWS service/product team, and much more.

## Out of my personal experience
Working with different services makes you wonder why a particular feature is similar to another, missing, or placed somewhere. Regardless, it is empowering to ask that question about the said feature and get it answered by that service/product team. It feels like you have access to information that could change the course of designing a solution based on facts you've got from the service developers themselves.

Having that access does it for me! But hey, there is more!
Like this fun thing: seek minute 1:30 for a bit of surprise ;)
{% embed https://youtu.be/dms7RlAPNDs %}

And no, I didn't have any paper to read from at the end :)

## Anything else?
They are plenty of benefits besides these that are copied directly from the community builder page (linked below):

* Access to AWS product teams and information about new services and features via weekly webinars
* Learning from AWS subject matter experts on a variety of non-technical topics, including content creation and support for submitting CFPs and securing speaking engagements
* AWS Promotional Credits and other helpful resources to support content creation and community-based work
* Some surprises!

For instance, that t-shirt you saw me wearing at the beginning of this article, for instance, was sent to me after some meetings with the community, a subscription to cloud tutorials, and yes, you read about the AWS Credits, but how about re:Invent? :)

Having your name listed on AWS, maybe?

![Saif's name shown in the AWS community builder directory](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ham9upl253doymm29d0o.png)

Ask me or look into the [AWS Community Builders program page](https://aws.amazon.com/developer/community/community-builders/) for some FAQs & application submissions.

Did this help you?

— [Saif](https://twitter.com/saifalzo);
Engineering Managers - What Do You Like About Your Job?
Tags: discuss, anonymous, career
Published: 2022-10-25 13:15:13

_This is an anonymous question sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment or if you want to ask your own anonymous question._ 

***
Zabbix admin yetkisi
Published: 2022-10-25 13:07:45

#Yetki Verme#
Servis varsayılanda zabbix servis kullanıcısı ile çalışmaktadır, yetkisi olmayan dosyaları okuma gibi işlemlerde **"[13] Permission denied."** hatası ile karşılaşılabilir. Hatayı çözebilmek için servisi kullanıcı ile çalıştırmamız gerekmektedir. Aşağıdaki adımlar bunun nasıl yapılacağını göstermektedir.
 
##Step-1##
**set_zabbix.sh** dosyası makine üzerinde yaratılır.

**set_zabbix.sh** dosyasının içeriği aşağıdaki gibi olmalıdır.

```
while getopts h:i: flag
do
    case "${flag}" in
        h) zbx_hostname=${OPTARG};;
        i) zbx_ip=${OPTARG};;
    esac
done
if test -z "$zbx_hostname" 
then
    zbx_hostname=$(hostname --short)
fi
if test -z "$zbx_ip" 
then
   echo "ip input olarak verilmek zorundadır!"
   exit
fi
sudo apt install zabbix-agent -y
version=$(dpkg -s zabbix-agent  | grep -i version | cut -d : -f 3 | cut -d . -f 1)
if [ $version -gt 5 ] ; 
then
    echo "Version: $version, yeni yapılandırma uygulanıyor"
    mkdir /etc/systemd/system/zabbix-agent.service.d 2>/dev/null
    echo """
    [Service] 
    User=root 
    Group=root
    """ > /etc/systemd/system/zabbix-agent.service.d/override.conf
    sed -i "/ServerActive=/d" /etc/zabbix/zabbix_agentd.conf; echo  "ServerActive=$zbx_ip" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/Hostname=/d" /etc/zabbix/zabbix_agentd.conf; echo  "Hostname=$zbx_hostname" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/Server=/d" /etc/zabbix/zabbix_agentd.conf; echo  "Server=$zbx_ip" >> /etc/zabbix/zabbix_agentd.conf
    systemctl daemon-reload
    systemctl restart zabbix-agent
else
    echo "Version: $version, eski yapılandırma uygulanıyor"

    mkdir /etc/systemd/system/zabbix-agent.service.d 2>/dev/null
    echo """
    [Service] 
    User=root 
    Group=root
    """ > /etc/systemd/system/zabbix-agent.service.d/override.conf

    sed -i "/ServerActive=/d" /etc/zabbix/zabbix_agentd.conf; echo  "ServerActive=$zbx_ip" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/Server=/d" /etc/zabbix/zabbix_agentd.conf; echo  "Server=$zbx_ip" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/AllowRoot=/d" /etc/zabbix/zabbix_agentd.conf; echo  "AllowRoot=1" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/Hostname=/d" /etc/zabbix/zabbix_agentd.conf; echo  "Hostname=$zbx_hostname" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/User=/d" /etc/zabbix/zabbix_agentd.conf; echo  "User=root" >> /etc/zabbix/zabbix_agentd.conf
    systemctl daemon-reload
    systemctl restart zabbix-agent
fi 

```

##Step-2##
Zabbix arayüzündeki Makine adı ve zabbix ip'si scripte input olarak aşağıdaki gibi verilmelidir.
NOT: hostname verisinin zabbix arayüzündeki gibi olması önemlidir.

```
sudo bash set_zabbix.sh -h "DNS DTL" -i "zabbix_ip"
```

Bu sayede Zabbix ve Liman üzerinde auth logları görüntülenebilir
How to make accurate time estimates in QA?
Tags: qa, timemanagement, testing, productivity
Published: 2022-10-25 12:51:17

Albert Einstein was ahead of time in many ways when he proclaimed that time is relative. Indeed, product development (including QA) is where one hour can be more like two or three hours.

What time estimation technique would you recommend to the junior version of yourself?

1. Poker planning
2. Adopt deadline-oriented approach
3. Move on from hours
4. Re-evaluate your estimates
5. Don’t do any estimates

Comment below!
And feel free to check [this article ](https://aqua-cloud.io/time-estimation-in-qa/?utm_source=devto&utm_medium=article&utm_content=tania&utm_campaign=distribution
) to learn more about each of them.