teleren/devto huggingface dataset:
Golang 101: İşaretçiler (Pointers)
Tags: go, pointers
Published: 2021-10-20 07:44:59

Değişkenler hafıza da (`memory`) "değişken adresi" ve "değeri" şeklinde tutulurlar. Bir değişkenin değerini değiştirmek istediğimizde hafıza da o değişkenin adresine gider ve değerini değiştiririz. 

İşaretçiler ise hafızadaki değişkenin adresini almak veya bu adresteki değeri değiştirebilmemiz için kullanılmaktadır.

```golang
package main

import "fmt"

func main() {

	i := 1
	fmt.Println(i)

	islem(i)
	fmt.Println(i)

	islemptr(&i)
	fmt.Println(i)

	fmt.Println(&i)

}

func islem(deger int) {
	deger = 0
}

func islemptr(deger *int) {
	*deger = 0
}
```
```
1
1
0
0xc000126000
```
[çalıştır!](https://go.dev/play/p/Qjp5K6AApLJ)

Örnekte görüldüğü üzere `i` değişkenine değer atanıp ekrana yazdırılıyor.

```golang
func islem(deger int) {
	deger = 0
}
```
Fonksiyonlar da girdi için kullanılan parametreler aslında girilen değerin hafıza da yeniden oluşturulmasını sağlar. Yani örnekte `deger` adında yeni bir değişken oluşturup buna fonksiyon içerisinde atama yapmaktadır. Bu durumda fonksiyon dışındaki `i` değişkenine bir etkisi olamamıştır.

```golang
func islemptr(deger *int) {
	*deger = 0
}
```
Bu fonksiyonda ise `int` değer bulunduran hafıza adresi alacağını `*int` türü ile belirtiyoruz. Fonksiyonu çalıştırırken ise işaretçimiz (pointer) `i` değişkeninin adresini `&` sembolü ile fonksiyona giriyor. Ardından fonksiyon içerisinde `*` sembolü ile de ilgili adresin değerini değiştireceğimiz belirtilmiş oluyor.

Yani değişkenin **adresini** `&` sembolü ile, değişken adresindeki **değerini** `*` sembolü ile belirtiyoruz.
MongoDB - Aggregate Pipeline 
Tags: beginners, tutorial, mongodb, database
Published: 2021-10-20 07:35:07

As we have discussed MongoDB basics ([link](https://dev.to/sharan_710/hey-mongo-14h6)).
Now, let's explore the MongoDB Pipeline concept 🔎

### Why MongoDB Pipeline? 🤔

The input of the pipeline can be one or several collections. The pipeline then performs a transformation on the data until our expected result is achieved.

With the help of a pipeline, we can break down a complex query into simple stages, in each of which we can execute the different operations on the data. This also helps us in checking whether our query is functioning properly at each stage by examining both its input and output as the output of each stage will be the input of the next stage.
Below is an illustrated example of a pipeline:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sn7qeythboe2b9t7mc9c.gif)
 
 

### Aggregation 

Aggregate operations process data records and return the computed result. Aggregate operations can perform many operations on the grouped data to return a single result.
The Syntax for aggregate: db.CollectionName.aggregate(operation) 


Now, if you want to display count, then you will use the following aggregate() method: 


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


Here, We have grouped the documents by type field and on each occurrence of a type field, the value of sum will be increased.
Equivalent SQL Query for this will be:
select type, count(*) from ProductCatalog group by type


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


### Pipeline


MongoDB supports the pipeline concept in the aggregation framework in which we execute an operation on some input and use the output as input for the next command and so on. 
There is a set of stages and they are taken as the set of documents as input and produces a resulting set of document. This can be used as an input for the next stage and so on.

Following are the stages in the aggregation framework:

1. $project: Used to select the specific field from the collection.

2. $match: It's a filtering operation. Equivalent to where clause in RDBMS.

3. $group: This groups the document.

4. $sort: Sorts the document.

5. $limit: Used to limit the documents in the output 


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


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


Thank you!! Feel free to comment on any type of feedback or error you have 😄✌
Test React.useEffect on Enzyme
Tags: react, enzyme, testing
Published: 2021-10-20 07:16:59

## What

Normally (in my legacy code base) I've always found that my legacy code from the old project use `shallow` to test the component. But the problem is `shallow` doesn't trigger `React.useEffect` that's why I googling and not it here.

## Example component to test 

```jsx
const Component = ({ callMe }) => {
  React.useEffect(() => {
    callMe()
  }, [])
  return <>Yikes</>
}
```

## Work around 

```jsx
description('Component', () => {
  it('should call `callMe` on mount', () => {
    const mockCallMe = jest.fn()
    mount(<Component callMe={mockCallMe} />)

    expect(mockCallMe).toHaveBeenCalled()
  })
})
```

to solve this issue, instead of use `shallow` just use `mount`, the difference is `mount` are really mount component but `shallow` are just render

## Long term

switch to `@testing-library` if you have effort 😆
Recommend books
Tags: php, javascript, codeigniter, c
Published: 2021-10-20 07:10:49

Hello fellow DEV denizens:
Can someone recommend top notch books in the following areas?:
1. PHP (OOP, MVC, CodeIgniter, Laravel)
2. JavaScript (AJAX, JQuery, Vue)
3. C (Since PHP is entirely written in C)
4. Any other books that can move one towards subject mastery.
5. How does one become a guru in Linux, C, PHP, JavaScript?
   (a) What are specific steps for someone with a background in 
       Computer Science (Bsc and Msc)?
Best content to include in a default route?
Tags: javascript, webdev, programming, api
Published: 2021-10-20 06:45:51

I feel like this is a good point for a discussion and not a question. I have the set of URLs as follows.

https://domain/api/users
https://domain/api/users/:userId
https://domain/api/posts
https://domain/api/posts/:postId

As usual I return json content when the above APIs are called.

What should be returned if the following APIs are called?

https://domain/api/
https://domain/

Is it just 404-Not Found?
What is more suitable?
Delete comment and discuss in @dsabyte.com
Tags: react, node, javascript
Published: 2021-10-20 06:40:22

Now, i have added a way to delete comment and discuss.

Visit [@dsabyte](https://dsabyte.com) and then click on `posts`. Then click on any post, you'll see a way to comment and add discuss at the bottom of the post.

Now, you can add comment or add discuss. After adding, you only can edit or delete comment or discuss.
CTA Button Success and Difficulties
Published: 2021-10-20 05:31:29

# Success

When it comes to the CTA button there was little success due to my lack of knowledge regarding coding in general. I understand the logic behind it however which allows me to cross reference other individuals work as well as what the professor went over in order to create something I can call my own. Presenting code in class in a step by step way was also a help, especially when it came to the icons and how to import the packages.

## Difficulties

As stated before my coding strengths are not what got me this far in my IT career. I have experience with JavaScript, Java, C++, and some swift however this experience has come with great deals of struggle. For some reason this aspect of technology does not come natural and without a teacher there to actually go step by step things become impossible. There was one specific aspect regarding the button that did not make any sense to me before someone explained it and that aspect was the hover feature. I never knew there was a special command that implemented the tab key to work for those who use the keyboard for website navigation.

Despite my struggles I was still able to create a functional button that met all parameters set by the professor.

https://github.com/jmgiannetti/CTA-button/tree/master
Getting to know me
Tags: github, webdev, news, career
Published: 2021-10-20 06:28:49

![SOCIAL](https://media1.giphy.com/media/huyZxIJvtqVeRp7QcS/giphy.gif?cid=ecf05e47ph13jjhkfcev9l4mdgt676178ihihb70qcu6oey7&rid=giphy.gif&ct=g)

## 🌎 Hello world!
This is a dating post so that everyone who was interested in me could get to know me :)

## 🔥 What I am fond of
At the moment I work by profession as a web developer, my knowledge is still small, but I always try to come up with something, improve or make an innovation for myself, even though my strength is small, I believe that I can study everything very well!
Most of the time I write in PHP, but at home I also teach JS, namely node.js (express.js) and React

## 🎬 Public life
I have my own YouTube channel, at some time I was reviewing the creation of 3D models for minecraft texture packs, but soon I will completely redo it for a new one, even ideas and ideas have already appeared, I will blog, in general I will live in a new way :)
Here is his logo:
![Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fildnkbizlnpr91ydajh.png)
I study with friends in college, but we often call it sharaga, and
since we want to study new guys in our industries together and teach at the same time, we decided to call the channel Sharaga IT.

#### 👨‍🏫 Speaking of guys
It so happened that we are all Russians. The guys are masters of 1C, and if you delve into it, you can easily understand that there are no good lessons on 1C as such, so I hope that many will watch us because of such exclusive content!!!

## 🎖 Gratitude
Thank you for spending your time on me, I am very grateful to you!!!
I will be glad if you also subscribe to me on github, in return I will subscribe in response to you!
Links to all social networks will be below:

## ❤ Social network
[![github](https://img.shields.io/badge/github-%23000000.svg?&style=for-the-badge&logo=github&logoColor=white)](https://github.com/Damfler)

[![dev](https://img.shields.io/badge/dev.to-%23000000.svg?&style=for-the-badge&logo=dev.to&logoColor=white)](https://dev.to/damfler)

[![instagram](https://img.shields.io/badge/instagram-%23000000.svg?&style=for-the-badge&logo=instagram&logoColor=white)](https://instagram.com/damfler)

[![behance](https://img.shields.io/badge/behance-%23000000.svg?&style=for-the-badge&logo=behance&logoColor=white)](https://www.behance.net/dima_gashuk)

[![vk](https://img.shields.io/badge/vkontakte-%23000000.svg?&style=for-the-badge&logo=vk&logoColor=white)](https://vk.com/dima_gashuk)

[![youtube](https://img.shields.io/badge/YouTUbe-%23000000.svg?&style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/channel/UCWIbaZ6Nt-pRcRie3g8SqZw)
在 AWS EC2 架設 pure-ftpd 服務
Tags: aws, ec2, ftp
Published: 2021-10-20 06:24:29

有時候還是需要 FTP 這種老派的服務，總之就是要給它架起來！

搭配的系統是 Ubuntu 18.04 LTS，提供 FTP 服務的是 pure-ftpd，當初在調查 FTP daemon 的時候比較常看到別人是選用 vsftpd，可是設定好像有點複雜，最後找到 pure-ftpd 感覺比較簡單就挑它了！

本文單純就是架一台機台起來然後讓它提供 FTP 服務，不會涉及到 AWS S3。另外本文假設讀者已經懂得基本的 Linux 操作及 AWS 操作，故也不會講怎麼開 AWS / EC2 / IP / SSH / Cloud9 等主題。

在架設前需要了解一些 FTP 的基礎知識，特別是被動式 FTP（Passive FTP）的基本知識。由於 EC2 只認得自己的 Private IP，不認得自己的 Public IP，所以須強制指定它送出的 IP 設成 AWS Public IP，不然客戶端會無法正常使用。

## 安裝 pure-ftpd

```sh
ubuntu$ sudo apt update
ubuntu$ sudo apt install pure-ftpd
```

## 確認 pure-ftpd 正常運作

```sh
ubuntu$ service pure-ftpd status
```

應該會看到「Active: active (running)」的字樣，表示正常運作中。

## 設定 pure-ftpd

pure-ftpd 的設定都放在 /etc/pure-ftpd/conf/ 內，每個檔名代表一個設定項目，檔案的內容為該項目的設定值，通常為 yes 或 no 或 IP 或數字。完整的設定在 [pure-ftpd 的文件](https://download.pureftpd.org/pub/pure-ftpd/doc/README)內，你可以選擇花五個小時把它看完或者直接跟我下面的設定，有其它需求再問 Google 或 StackOverflow。

| 檔名               | 內容           | 說明                                         |
|--------------------|----------------|----------------------------------------------|
| NoAnonymous        | yes            | 禁止匿名登入                                 |
| UnixAuthentication | yes            | 直接用系統帳號作為 FTP 認證帳密              |
| DisplayDotFiles    | no             | 不顯示隱藏檔                                 |
| ForcePassiveIP     | AWS Elastic IP | 強迫對客戶端回覆 AWS Public IP               |
| PassivePortRange   | 30000 - 5000   | 被動模式可使用的 port 範圍                   |
| ChrootEveryone     | yes            | 只允許 FTP 用戶存取自己的家目錄              |
| TrustedGID         | 27             | 開放讓 GID = 27 的成員讀取所有目錄（大權限） |

## 設定 AWS 安全組（防火牆）

有幾個 port 必須打開才能夠提供服務，標準的 FTP 通訊 port 21 及前面指定的 port 30000 – 50000，以上這兩組 port 要到 AWS 安全組那邊去開放入站。

## 建 FTP 帳戶與群組

在建立之前，我們的計畫是不讓這些 FTP 用戶從 login 登入，只讓他們從 FTP 登入，所以要把 nologin 加入系統的 shell 清單內，並指定這些用戶使用 nologin。

系統的 shells 檔案在 /etc/shells，編輯它並在最後一行加入 /usr/sbin/nologin。

開始建帳戶與群組：

```sh
ubuntu$ sudo groupadd ftp
ubuntu$ sudo useradd ftp001 -g ftp
ubuntu$ sudo passwd ftp001
Enter new UNIX password: ftp001password
```

幫 ftp001 建家目錄並設定權限：

```sh
ubuntu$ sudo mkdir /home/ftp001
ubuntu$ sudo chown -R ftp001:ftp /home/ftp001
```

幫 ftp001 設 nologin：

```sh
ubuntu$ sudo chsh ftp001
Login Shell [/bin/bash]: /usr/sbin/nologin
```

這樣 ftp001 就設定好了，本節幾個步驟可以寫成 shell script 方便日後使用。
Intro to Blockchain: Etherscan
Published: 2021-10-20 06:22:51

The great thing about blockchain technology is that EVERYTHING is online. 
Etherscan is a search engine that lets you see all the transactions happening on the blockchain. 
To perform actions onto the blockchain, there needs to be a smart contract that has set functions. When these functions are called, usually, but depending on the type of function being called, a transaction is sent. Once this transaction is sent, it will forever be up on etherscan for people to view. If I make a transaction right now, you would be able to find my transaction and see what I did in the transaction.
How can you identify transactions? Say you made a transaction and you want to show your friend proof that you actually did what you were supposed to, a receipt, you can send them your transaction hash. With this transaction hash, you can find the transaction and easily see what was actually performed in that hash. This is a really easy way to do business as the blockchain can serve as the middleman. With the transaction hash serving as the receipt.
Improve Resilience with Controlled Chaos Engineering
Tags: aws, chaosengineering, reliability
Published: 2021-10-20 06:20:27

---
title: Improve Resilience with Controlled Chaos Engineering
published: true
description: Resources for the session Improve Resilience with Controlled Chaos Engineering
tags: aws,chaosengineering,reliability
---

This post contains resources for the session Improve Resilience with Controlled Chaos Engineering.

While the benefits of distributed computing are undeniable and have revolutionized IT, they do have some challenges. Architectures have grown increasingly complex and can be hard to understand and difficult to debug and test. Chaos engineering is the process of stressing an application in testing or production environments by creating disruptive events, such as server outages or API throttling, observing how the system responds, and implementing improvements. 

#### AWS Fault Injection Simulator
https://aws.amazon.com/fis/

#### AWS FIS Documentation
https://docs.aws.amazon.com/fis/

#### AWS Fault Injection Simulator Samples
https://github.com/aws-samples/aws-fault-injection-simulator-samples

#### Chaos engineering on Amazon EKS using AWS Fault Injection Simulator
https://aws.amazon.com/blogs/devops/chaos-engineering-on-amazon-eks-using-aws-fault-injection-simulator/

#### Increase your e-commerce website reliability using chaos engineering and AWS Fault Injection Simulator
https://aws.amazon.com/blogs/devops/increase-e-commerce-reliability-using-chaos-engineering-with-aws-fault-injection-simulator/

#### Chaos Testing with AWS Fault Injection Simulator and AWS CodePipeline
https://aws.amazon.com/blogs/architecture/chaos-testing-with-aws-fault-injection-simulator-and-aws-codepipeline/

If you have any questions, please reach out on [Twitter](https://twitter.com/GunnarGrosch) or [LinkedIn](https://www.linkedin.com/in/gunnargrosch/). Go experiment!
Working in public
Published: 2021-10-20 05:52:28

I see many people struggling to get the visibility they deserve as content creators even though they are very good

I've always seen Livestreams and working for a company as two opposites.

But can they coexist? 

Yesterday I tried this working-in-public experience and I liked it a lot. 

Here is the moment with Nimrod and Ido jumping in!
[![working in public](https://cdn.hashnode.com/res/hashnode/image/upload/v1634706177482/GH37eTvKW.png)](https://youtu.be/cU1yjEiLjQE?t=4809)

I worked on the official daily.dev documentation, using Docusaurus, an open-source tool by Facebook to write documentation.

Daily.dev https://daily.dev/

Docusaurus official website: https://docusaurus.io/

### What is it

Working in public is literally what the word suggests: doing what you get paid for but in a Livestream, which can last hours.

### What is it not

"Working in public" is a bit different from just working on your side project online or building in public because you get paid for it while you are working (and this is great!)

It's not your company "controlling your work"

### When

it is not always applicable, because often some sensitive data is used or the project is just secret, but it's at least worth thinking about whether some of the work can be done this way.

IMPORTANT: both sides must agree on this before, it's not the company forcing the person to go live to control them or you just going live and exploiting some secrets of the company!!!

### Where 

The Livestream should be done on the channels of the worker or where they prefer.

### Benefits for the worker

- they can focus on working without distractions (Social Media, emails, calls).
- they get the benefits of a Livestream (and also people helping you out!).
- they get the company support on your Livestreams, eg giveaways, promoting you...
- it's a great way to monetize your YouTube Channel or get affiliated on Twitch without spending extra time!

### Benefits for the Company

- in every moment, they can see the current status of the work.
- the product/company gets more engagement because of the nature of the Livestream.
- it is a way to make yourself known to more people, simply by showing it while working.

### Conclusion

In conclusion, if you are working for a company and you see a possibility of applying the "working in public", you can be the one to propose and try it.

 I always say to document what you do whenever is possible, and this was just me applying this concept.

Follow me on Twitter to know more: https://twitter.com/FrancescoCiull4

Good luck!
HTML tags | title
Tags: html, tags, title
Published: 2021-10-20 05:51:51

It is used to **define the title of the document**. It always goes inside `<head>`.

It can **only contain text**, any label inside it will be ignored.

It is a **mandatory and unique element**, you cannot have more than one `<title>` in an HTML document.

Is used for:
* Show in title bar or browser tab.
* Provide a title to the page when it is added to favorites.
* Show a title for the page in search engine results.

Title content is very important for SEO, as it is one of the components used by search algorithms to decide in what order the page will appear.

Some tips for writing good titles:
* It is better to be long and descriptive than short and generic (avoid titles of 1 or 2 words).
* Search engines usually show only the first 50-60 characters, so the length should not exceed that amount. If you have to, it is a good idea to make sure that the important information in the title is at the beginning and that no important content falls within the part that can be hidden.
* Don't use keyword lists, as it can lower your search results.
* Try to be as accurate and meaningful as possible.
* Try to be as unique as possible within the site itself. Duplicate or near-duplicate titles can contribute to inaccurate search results.

A very common navigation technique for assistive technology users is to first read the `<title>` and deduce the content of the page from there, since determining it from directly navigating the page is time consuming and can be confusing. Hence, **providing a title that is descriptive of the purpose of the page** is so important to these users.

The `<title>` **has to be updated to reflect significant changes in the state of a page**, for example when there are problems with the validation of a form.

- Type: *none*
- Self-closing: *No*
- Semantic value: *No*

[Definition and example](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title) | [Support](https://caniuse.com/mdn-html_elements_title)
5 weeks into full-time learning programming
Published: 2021-10-20 05:45:05

Note: The boot camp that I'm in is in the Republic of Korea (South Korea), and does not offer courses in overseas (unless you can listen lectures in Korean). So this post is not to promote a particular boot camp or any boot camp.

It's been five weeks since I started learning programming full-time, and I wanted to share some thoughts about pattern of learning process for programming I experienced. 

After weeks of learning how to code, I learned that the pattern of learning programming is a constant switch between panicking "I have no idea what's going on. This instructor makes no sense. Why does this thing go here? I need materials that explain things a lot easier" to one day waking up and thinking "This makes sense. Okay, so this works because variable is this thing, and it goes from here to there."

As long as I stuck to things I was working on, it worked out one way or another in the end. And I realized grit is really important when it comes to programming (well grit is important in almost every field...). 

So the lesson so far was don't panic when things don't make sense. Just "keep calm and code on."
Append VS AppendChild in JavaScript
Tags: javascript, devops, programming, webdev
Published: 2021-10-20 05:06:31

The append and appendChild Methods are too popular and used to add elements into the Document Object Model(DOM).

But there is a main difference between them, if you don’t get the hang of it, it may cause some errors in your project, so let’s see what is the difference between them, when to use append or appendChild in your project.
https://amkblog.com/javascript/append-vs-appendchild-in-javascript/
Dark mode support in @dsabyte.com
Tags: react, node, javascript, webdev
Published: 2021-10-20 04:46:17

I have recently added dark mode support in my website [@dsabyte](https://dsabyte.com).

Although i have not built the dark theme support by our self. I have used https://chakra-ui.com built in dark mode support solution. 

## How to use [chakra-ui](https://chakra-ui.com/)
Example is demonstrated here -> https://chakra-ui.com/docs/features/color-mode

## Thank You
Intro to Blockchain: What is a DAPP?
Published: 2021-10-20 04:44:37

DAPP? A decentralized application. The best way to explain this is in comparison to a WebApp, Web Application. The main key difference between the two is that a DApp talks to the blockchain whereas a WebApp does not.

So what exactly does a DApp do? A DApp provides a nice Frontend User Interface for the Ethereum Smart Contracts. Basically using the blockchain itself as its backend.
What does providing an interface for a smart contract mean? To a person not familiar with blockchain or smart contracts, the code of smart contract might be confusing if not all together terrifying. The frontend interface allows a user to perform the functions stored on the smart contract in a much user friendly manner. 
DApp's are really useful to introduce people into blockchain and slowly uncover the fact that the user can skip the DApp and go straight to the contract to perform all the functions.