teleren/devto huggingface dataset:
ENG vs PAK 1st Test Day 2: Shafique and Haq
Tags: engvspak, pakvseng
Published: 2022-12-02 17:37:38

At close on day two, Imam-ul-Haq (90) and Abdullah Shafique (89) were approaching hundreds when umpires called Stumps with 17 overs remaining.
Pakistan's openers got among the runs on a placid pitch on Friday as they took the home team to 181 without loss in reply to England’s mammoth 657 in the first Test in Rawalpindi.

At close on day two, Imam-ul-Haq (90) and Abdullah Shafique (89) were approaching hundreds when umpires called Stumps with 17 overs remaining.

The home team still needs 277 runs to avoid the follow-on.

The pitch was again unresponsive to bowlers as the England attack, led by James Anderson, toiled in the same manner as the home side.
**[Read More](https://www.govtads.site/2022/11/15-Minute-Glutes-Workout-Exercise.html)**
Street Programmer: Metaphor
Tags: programming, github, community, devjournal
Published: 2022-12-02 17:22:25

Hello Punk! This time, i will show you brand new (artistic) community for Code Freestyler in the world. I just create this repository to collects public unconventional method that used in everyday professional works. Sometimes we need do freestyle in some situation and we got solution without any reason (it's wrong? No, just different with other).

## Welcome to SCP ([Street Programmer Community](https://github.com/StreetCommunityProgrammer))!

We are street programmer that work out of the box in every way of traditional theory and we're not calling snippet of code but called as Metaphor.

Basically programming language is a bridge to communicate with other people in the world without speak in their national language, we can collaborate each other without knowing our national language.

We called our member Punk/Freestyler/Software Freestyle Engineer that create some Metaphor to make this world more better.

{% github https://github.com/StreetCommunityProgrammer/metaphore %}

What your freestyle today, Punk?
Goroutine Race Condition
Tags: go, goroutine, webdev
Published: 2022-12-02 17:14:14

What is race conditions ?...

A race condition is a condition when more than one goroutine accesses the same data at the same time. Cause of that the data gets messed up, it's common case in concurrency programming.

How to solve it ?....

Golang provides a package called `sync.mutex`, when the race condition occurs, only one goroutine can access the data, with mutex all goroutines can access data, how it works ? mutex can control data flow using **lock** and **unlock** function

**Let's code**

###A.Validate Race Condition

####1.Initial variable with a function to increment the value

```
type counter struct {
	number int
}

func (value *counter) Add(param int) {
	value.number += param
}

```
####2.Run the counter function using goroutines and `sync.WaitGroup` 

```

import (
	"fmt"
	"sync"
)

func main() {
	var counter counter
	wg := new(sync.WaitGroup)
	for i := 0; i < 100; i++ {
		wg.Add(1)
		go func() {
			for i := 0; i < 100; i++ {
				counter.Add(1)
			}
			wg.Done()
		}()
	}
	wg.Wait()
	fmt.Println(counter.number)
}
```

Full code 

```
package main

import (
	"fmt"
	"sync"
)

type counter struct {
	number int
}

func (value *counter) Add(param int) {
	value.number += param
}

func main() {
	var counter counter
	wg := new(sync.WaitGroup)
	for i := 0; i < 100; i++ {
		wg.Add(1)
		go func() {
			for i := 0; i < 100; i++ {
				counter.Add(1)
			}
			wg.Done()
		}()
	}
	wg.Wait()
	fmt.Println(counter.number)
}
```
run the code using this command ```go run -race main.go```
add _-race_ flag is to detect race condition in our goroutine, and the result is:

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

race condition is detected **how we can solve this problem**..... ?

**Let's Solve**

In this case using `sync.mutex` package is the best solution, cause we can lock data when task is begin and unlock data when task is done.
###B.Solve Race Condition

####1.Add sync.mutex in counter struct
```
type counter struct {
	number int
	sync.Mutex
}
```
####2.Lock & Unlock data
```
func (value *counter) Add(param int) {
	value.Lock()
	value.number += param
	value.Unlock()
}
```
####3.Run Code
No race conditions will be detected and our problem is solved
```go run -race main.go```

result is `100000`

Conclusion
`sync.Mutex` is one of thread safe type, using this package makes our goroutines safer and far from race conditions

don't panic & stay safe, thanks
When can you declare yourself a Full-stack Dev?
Tags: discuss
Published: 2022-12-02 17:05:00

Hello 👋🏼

I was wondering if I should consider myself as a front-end or full-stack developer. Or at least how to present myself to companies.

And then, I asked myself... **at what moment can you consider yourself a full-stack developer?** What are the basics to know to become one? 


> For example, 
> I suppose that to be a self-proclaimed full-stack developer in JavaScript, you have to know at least one front-end framework (like [`Vue`](https://vuejs.org), [`React`](https://reactjs.org/), [`Angular`](https://angular.io/), [`Svelte`](https://svelte.dev/), [`Astro`](https://astro.build/) etc...), know the basics of the backend and its specificities, especially [`Node.js`](https://nodejs.dev) and all its aspects, know one or more frameworks (I think of [`Express.js`](https://expressjs.com/) or [`Fastify`](https://www.fastify.io/)), know how to create an API and databases, and know the principle of MVC in order to set up a good architecture.  
> 
> _If there is something missing, don't hesitate to tell me_.
Making API calls in JavaScript.
Tags: javascript, programming, api
Published: 2022-12-02 16:50:49

To make an API call in JavaScript, you can use the `fetch()` function. This function allows you to make requests to a specified URL and return the response in the form of a promise, which you can then process further as needed.

Here's an example of how you might use the `fetch()` function to make a GET request to an API endpoint:

```
fetch('https://www.example.com/api/endpoint')
  .then(response => response.json())
  .then(data => {
    // do something with the data
  });

```

In this example, the `fetch()` function makes a GET request to the specified URL, and then the resulting promise is processed with the `.then()` method. The first `.then()` method call takes the response from the request and converts it to a JSON object, which is then passed to the second `.then()` method as the `data` argument.

You can also use the `fetch()` function to make other types of requests, such as POST, PUT, and DELETE, by passing an options object as the second argument to the function. For example:

```
fetch('https://www.example.com/api/endpoint', {
  method: 'POST',
  body: JSON.stringify({
    key: 'value'
  }),
  headers: {
    'Content-Type': 'application/json'
  }
})
  .then(response => response.json())
  .then(data => {
    // do something with the data
  });

```

In this example, the `fetch()` function makes a POST request to the specified URL, and the options object passed as the second argument specifies that the request body should be a JSON object with a `key` and a `value` property. The `headers` property is used to set the `Content-Type` of the request to `application/json`.

I hope this helps!
Hyperiondev - Web Development bootcamp. Dec 22
Tags: bootcamp, webdev, beginners, codenewbie
Published: 2022-12-02 16:46:44

**Here begins an idea of tracking my progress through a bootcamp**

The concept being that writing an explanation of what I'm learning will in turn re-enforce concepts and lessons learnt.

So as of Mon 5th December I intend to log my progress day upon day through the online bootcamp provided by [hyperiondev](https://www.hyperiondev.com/).

I was lucky to get a fully paid scholarship for this education at a time I was considering my of the other bootcamps out there.

My coding background - Having toyed with code over the past two or so years, drifting from tutorial to tutorial, freecodecamp to codecademy, youtube channel to dev blog post. I've gathered a rough bunch of understanding of html, CSS, JS, python, flask, SQLite. However whenever it comes to actually building something my house of cards quickly tumbles to the ground.
I even made it through the rather excellent Harvard CS50x course. Yet despite feeling like a superhero at the end of it, I still struggled to implement what I thought I'd learnt.
SO it's thime for a more focused and mentored track. One which I hope will reaffirm my knowledge and build out from that foundation. Also one which will challenge me to reach out to employers, to network and to see what skills and projects the real world needs. Here I feel is the real benefit of the bootcamp experience. 

So let us see.
How to use variable inside variable in angular template?
Published: 2022-12-02 16:41:16



I am new to angular , can someone tell me if I can use variable inside variable in angular. Explaination:

I am creating one dropdown input component where it will make api call to get data. There is an `@Input() selector:string = "" `which will tell what to select from data

Inside template it will run *ngFor loop, then inside html I want to display as kind of like that:

`**<option *ngFor="let item of data" [value]="item.id">
        {{ item.{{selector}} }}
 </option>**`

In other module it will be used as:

    1.In one module `**<app-input [selector]="'name'"></app-input>**`
    2.Another one. `**<app-input [selector]="'id'"></app-input>**`

How Can I use selector inside this any way?
How to Build a Strong Relationship in Society
Tags: beginners, news, discuss
Published: 2022-12-02 16:32:18

We all know how important relationships are. They provide us with support, love, and a sense of belonging. But what makes a relationship strong? And how can we build such relationships in society? In this blog post, we will explore how to build strong relationships in society. From developing trust to being there for one another, we will look at what it takes to create and maintain these important bonds.

## The Different Types of Relationships in Society
There are many different types of relationships in society. The most common are family relationships, friendships, romantic relationships, and work relationships.
Each type of relationship has its own unique challenges and rewards. Family relationships are often the most complex, as they involve a wide range of emotions and responsibilities. Friendships can be close and supportive, but they can also be complicated by jealousy or competition. Romantic relationships can be thrilling and passionate, but they can also be stormy and challenging. Work relationships can be fulfilling and productive, but they can also be stressful and demanding.
No matter what type of relationship you have, it's important to nurture it and work hard to keep it strong. By investing time and effort into your relationships, you can build lasting bonds that will enrich your life in many ways.

## The different types of images we share

[Gods Images](https://www.godwallpapersinhd.com/) are a powerful way to connect with others and build relationships. There are different types of images we share, each with its own purpose.
Selfies are a great way to show off your personality and connect with friends and followers. They're also a fun way to document your life and experiences.
Posed photos are perfect for capturing memories and moments, whether it's a family vacation or a special event. They help us remember the good times and the people we shared them with.
Candid shots are natural and unplanned, making them great for showing off your everyday life. They give friends and followers a glimpse into your world, letting them see what you're up to on a day-to-day basis.
Action shots are dynamic and exciting, frozen moments that capture the energy and movement of whatever is happening in the frame. They're perfect for sports, adventure, and any other activity that gets your heart racing.
Evaluation board using Luos and One Wire
Tags: opensource, tutorial, microservices, luos
Published: 2022-12-02 16:31:32

One of the Luos Creators Salem#3488 on Discord, build a setup using Luos and One Wire to make an evaluation board.

⏩ Check out his [project](https://www.youtube.com/watch?v=Ta_8kWHGv8Y)

If you have been working on any projects using Luos and you want to give them a platform, upload a video of your project to Youtube and send us the link via Discord!
Explaining my standard golangci-lint configuration (.golangci.toml)
Tags: go, staticanalysis, linter, video
Published: 2022-12-02 16:27:37

In this video I walk you through my default .golangci.toml file (which you can download [here](https://gitlab.com/-/snippets/2281719)), to explain which linters I use and why.

{% youtube https://youtu.be/gpa1kIusbws %}
Aplicações Web com Arquitetura Serverless na AWS
Tags: devops, sre, aws, serverless
Published: 2022-12-02 16:03:00

Imagina uma Aplicação Web onde não precisaremos nos preocupar, por exemplo, com patches do sistema operacional, recursos de CPU, memória e disco, escalabilidade e etc.
Fiz um novo post falando como fazer isso usando a nuvem AWS:
[https://brenocarvalho.cloud/2022/12/01/aplicacoes-web-com-arquitetura-serverless-na-aws/](https://brenocarvalho.cloud/2022/12/01/aplicacoes-web-com-arquitetura-serverless-na-aws/)
From losing a database of 3000+ users to re-gaining authority back
Published: 2022-12-02 15:48:29

Hello friend. Today, I am gonna share my experience from total loss to re-gaining authority back. Before starting, you may ask what’s the web app about? The web app’s purpose is/was to secure invalid traffic to your website when you share it on social media, as Adsense hates invalid traffic and might suspend your account if you get any.

Two years ago, I made a platform for securing URLs and protecting them from Invalid traffic in Adsense using Django, CSS, and some basic JS, and after three months of launching I started getting pretty good traffic and sessions.

For two years it worked well, and then I thought of migrating the web app to new technology. Over the course of time, I learned Svelte/Kit, React, and NextJs.

I chose SvelteKit because of its simplicity. I did REST API with DRF and frontend/middle-end with SvelteKit. While migrating the app production, there was a sudden jam in the server, so I had to restart the whole system.

After restarting the whole system, I **lost the database** cluster from the whole system, and you may say didn’t you have a backup? Well, I did have snapshots. But the issue it the whole AWS Lightsail snapshots got “corrupted” (let’s say) because the cluster was not found in any of those snapshots.

So, I deployed the new web app with a new database instance. It looked good. I had to re-work or let’s say start from zero on re-populating it.

I personally talked to the users; gamers, streamers, and bloggers. The good thing is they responded well.

The web app started getting hits again. It worked pretty well. Now, we have reached 341 users, with 765+ URLs secured. And you might ask what is the web app? It’s [Xoomato, the invalid traffic protector](http://xoomato.com/).

I am just happy to share this story with you.
Long running process in NodeJS
Tags: node, javascript, webdev, tutorial
Published: 2022-12-02 15:30:24

More often than not, we don’t come across the situation where, in the context of Javascript based web application, a client request needs to run really long before its able to send response back to the client. While there can be many ways to handle such situation, such as queues, one solution can be, off-loading the processing of long running request to another thread. This method, of course, has its own list of pros and cons.

Pros:
- Does not involves external components such a queue
- NodeJS supports IPC when using the module child_process
- Child process executes independent of parent process
- Parent process can pass argument to the invoking of child process, which are received as CLI arguments.

Cons
- If the child process fails / crashes, there is no simple way to put retry.
- Since the child process runs separately, it will consume some memory of its own because of independent execution context.
- If required, a polling mechanism has to be built to know the status of child process.

Nevertheless I have created a very simple example of the aforementioned concept. Please find it [here](https://github.com/vishalraj82/nodejs-ipc). The [README.md](https://github.com/vishalraj82/nodejs-ipc/blob/main/README.md) describes how the solution works.
OWASP API Security Top 10 API6:2019 Mass Assignment with Example
Tags: security, api, webdev, opensource
Published: 2022-12-02 15:30:00

Mass Assignment vulnerability leads to an attack that occurs when an attacker is able to send data to an API that is then used to automatically populate multiple fields in the system. This can be used to bypass security controls, change data, or perform other malicious actions.

In this blog, I have explained about the OWASP API Security Top 10 API6:2019 Mass Assignment with Example.

{% embed https://blogs.appsecworld.com/2022/11/owasp-api-security-top-10-api6-2019-mass-Assignment.html %}
Being a Developer Advocate: Week 13
Tags: devrel, learninpubli
Published: 2022-12-02 15:21:30

This week we went back to fundamentals. I learned a lot about DevRel metrics and what type of DevRel I like most.

## Onboarding
Following the devastating Developer Experience audit last week, we doubled down to improve our onboarding docs.

![One does not simply do onboarding!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ackvhp0qlkny62l6f42.png)

I did some work giving the thing structure and a native English-speaking colleague of mine made sure it is concise:

> Germans have a verbose way of writing English! 😅

I learned a few things:

- _is going to_ is a phrase we are taught at school, but it is better to replace it with _will_
- Be upfront with the shortcomings of your product to avoid frustration
- There are many details missing that are important and you are blind to them personally
- Add a section at the start of the guide where you give the structure of the onboarding (creates the correct expectation)
- Add a _What to do next_ section at the end helps the user to evaluate your product further
- Remote Development Environments which require not setup except an account there are a game change (We are setting up [Gitpod](https://www.gitpod.io/))
 
## DevRel Metrics
I was blown away by this blog [Measuring DevRel](https://www.swyx.io/measuring-devrel)!

From that, I learned that I am a content-focused Developer Advocate as I enjoy creating every kind of content 😎

Also, in nearly every sentence there is gold; I will use it to define our key metrics to measure.

_Hint: Your north star metric is always **Monthly Active Developers**_

And also we I will try to get a grip on [DevRel qualified leads](https://www.marythengvall.com/blog/2019/12/14/devrel-qualified-leads-repurposing-a-common-business-metrics-to-prove-value) as the wonderful Mary Thengvall suggests!
Python Lambda:Filter Functions
Tags: beginners, python, programming, tutorial
Published: 2022-12-02 15:14:44

If you’re looking for a way to simplify your code, then lambda filter might be the answer. 

**Lambda** **filter** is a powerful tool in Python that allows you to filter out elements from an iterable object, such as a list or a dictionary, without having to write out a for loop. It’s a great way to quickly reduce complexity and make your code more readable. Let’s look at an example to see how lambda filter works.

Say we have a list of numbers and we want to filter out all the even numbers. Here’s how we would do it with a for loop:


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

Now, let’s see how we would do this with a lambda filter:


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

As you can see, we’ve reduced the amount of code needed to achieve the same result. With lambda filter, we can pass a function as an argument to filter out elements from an iterable. The function will be applied to each element in the iterable, and if the function returns True for that element, it will be included in the result.

In this example, we used a lambda function to check if each element in the list was even. If it was, the element would be included in the result. If it wasn’t, it would be filtered out.

Lambda filter can be a great way to simplify your code and make it more readable. With just a few lines of code, you can reduce complexity and make your code more efficient. Give it a try and see how it works for you!
Media Query in CSS Full Tutorial
Tags: css, tutorial
Published: 2022-12-02 15:04:22

Media Query in CSS Full Tutorial | Responsive Layout HTML CSS

in this video tutorial you will learn Media Query in CSS step by step with practically and also you will learn Responsive Layout in HTML and CSS3.

media query is very important and helpful to manage the site layout on different devices, when you will increase and decrease the browser site, then your site don't display perfectly on the web. 

So, when you will manage the site with different layout, you need to use media query to manage the screen size layout and display the site on different devices perfectly.

Furthermore, during this time have bunch of new features in CSS3 such as units em, rem, vh and also vw units. You must be know all about it. inside the tutorial you will also learn usage of Units step by step.

I've made complete tutorial for everyone they are interested in HTML and CSS3. Inside the tutorial have a complete usage of media query and also have units usage.

Once you learn How to use media query and also units, then you will learn How to use media Query in CSS3 to make a responsive website. 

So, hope this tutorial are helpful and beneficial for you. 

{% embed https://www.youtube.com/watch?v=fyihkxsOHTs %}.
CSS Grid Tutorial For Beginners
Tags: css, tutorial
Published: 2022-12-02 15:02:43

CSS Grid Tutorial For Beginners

in this tutorial we will learn CSS Grid Tutorial For Beginners. If you are beginners in CSS, then CSS grid very helpful for you to design the website template responsive.

So, today I'm going to teach with you CSS Grid from scratch. in this complete video tutorial you will learn all of CSS grid properties that are very helpful for designing web pages.

hope this tutorial is helpful and beneficial for you.

{% embed https://www.youtube.com/watch?v=IXD5vJ1r4BE %}.
Comment corriger : File is not `gofmt`-ed with `-s` (gofmt)
Tags: go, french
Published: 2022-12-02 15:02:00

Quand vous effectuer le lint de votre projet, vous pouvez tomber sur l'erreur suivante :
```bash
pkg/apis/dogs.go:11: File is not `gofmt`-ed with `-s` (gofmt)
```

Pour résoudre ce soucis, utilisez la commande suivante :
```bash
gofmt -s -w .
```
Cela va simplifier le code *(avec l'option `-s`)* et écrire le résultat dans les fichiers *(avec l'option `-w`)* sur tous les fichiers du dossier courant *(avec `.`)*.

---

J'espère que ça vous aidera! 🍺

---

<center><h3>Vous voulez me supporter?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>