teleren/devto huggingface dataset:
5 Free eBooks for Developers
Tags: webdev, beginners, codenewbie, python
Published: 2021-08-02 05:14:00

# Introduction

Here a list of 5 eBooks that are created by professional and are very beneficial for developers for improving technical, marketing and soft skills. 

This list of books were sent as **Newsletter** of the subscribed user. A new list of free eBook is coming this **Wednesday**. So subscribe it to get more books like this.

# [Weekly Newsletter of SurajOnDev](https://www.getrevue.co/profile/surajondev)

![Weekly Newsletter of SurajOnDev](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/boivc5mdfzzs2kt0s5wg.PNG)

## What you will get?

- **Read of the Week**: 5 best articles hand-picked by myself from different platforms. This article will be developer, self-growth, and productivity-oriented.

- **Tool of the Week**: A resource or tool link that will help in easing your work.

- **Our latest blog post**: Latest 3 blog post from SurajOnDev that is me.

- **Free eBook and Resources**: Occasionally you will get free eBook that are by developers and for developers.

**Frequency**: Weekly
**Subscribe Here**:  [Weekly Newsletter of SurajOnDev](https://tripetto.app/run/4OQIUAO89L)

---

## 2 FREE Sections of the Web Developer Knowledge
*What do you get?*
*1. A complete Web Developer Roadmap with free resources*
*2. How to grow your Twitter account*

Get eBook Here: [**Web Developer Knowledge**](https://vladpasca5.gumroad.com/l/2-free-sections)

--

## How To Be Creative
*So you want to be more creative in art, in business, whatever. Here are some tips that have worked for me over the years.*

Get eBook Here: [**How To Be Creative**](https://www.porchlightbooks.com/blog/changethis/2004/how-to-be-creative)

---

# The Guide to Wireframing

*For Designers, PMs, Engineers, and Anyone Who Touches Product*

Get eBook Here: [**The Guide to Wireframing**](https://www.uxpin.com/studio/ebooks/guide-to-wireframing/)

---

# Speak Like A Leader: Effective Communication Skills

*Inside this eBook, you will discover the topics about*
- *what is effective communication in a good leader*
- *know your audience*
- *much more...*

Get eBook Here: [**Speak Like A Leader**](https://cero.gumroad.com/?_ga=2.249078919.1067598590.1626671761-1944177497.1615261608#BFpEN)

---

# Getting From Employee 5 to 50 - A Startup Hiring Guide

*Your first five hires pretty much chose themselves. (“You’ll give this your all? Okay, you’re in!”) But getting from 5 to 50?*

Get eBook Here: [**Getting From Employee 5 to 50**](https://go.workable.com/startup-hiring-guide)

# Last Note

If you want to get free eBook on regular basis. So subscirbe the newsletter [**Weekly Newsletter of SurajOnDev**](https://tripetto.app/run/4OQIUAO89L)

*I hope you like the blog post. Thanks for reading it.*
I'll give you an example for hardware to your ceph cluster
Published: 2021-08-02 04:59:21

---
title: I'll give you an example for hardware to your ceph cluster
published: true
description: In this video we will cover what I use in my ceph cluster. I'm not an hardware reviewer but this is an example of what kind of hardware that could be used in a ceph cluster. Especially if you want to create a cluster for home use or testing.
tags:
cover_image: 
---

{% youtube B6XXOVcLhzA %}

In this video we will cover what I use in my ceph cluster. I'm not an hardware reviewer but this is an example of what kind of hardware that could be used in a ceph cluster. Especially if you want to create a cluster for home use or testing.
July 2021 - Notes
Tags: database, networking, paas, postgres
Published: 2021-08-02 04:53:31

*Apparently, I've been really in to PaaS.*

July was a busy month. We shipped our first software to customers at the new startup, and social activity picked up as people decided to venture out in to the world again post-vaccination, but despite that, I still found a handful of new things to include here.

Interesting things from the past month:

- [Tailscale](https://tailscale.com/) continues to be one of my favorite pieces of software. They make steady improvements, both in features and quality, constantly *[1]*.
 Check it out if you haven't. Their new pricing plans make the free version really useful, especially combined with the [sharing](https://tailscale.com/blog/sharing-over-tailscale/) feature they released earlier this year.

- Speaking of mesh networks. I played with [fly.io](https://fly.io) a little recently and it might be one of the more interesting of *Heroku but not owned by Salesforce* platforms that have popped up in the last few years. It's not as first-use friendly and slick as [Vercel](https://vercel.com), but its seemingly more flexible and it might appeal to you if, like me, enjoy the idea of using a PaaS, but also easy to provision ad-hoc wireguard mesh networks sound fun. [This post][fly-ssh] on how their ssh feature works is great.

- Also, to continue the theme of startups making older tech seem trendy and approachable, I like where both [Supabase](https://supabase.io/) and [Planetscale](https://www.planetscale.com/) are headed. Each company is taking a different approach. Supabase is trying to be a whole platform built on top of PostgreSQL and compete against Firebase *[2]*.  Planetscale, on the other hand, seems more focused on directly addressing the operational pains of building on a relational database at any scale *[3]*.  Both of them have useful free plans, by the way.

- Any list of storage tech wouldn't be complete without somehow working Redis in so I'll mention [Upstash](https://upstash.com), *serverless redis*, with a usage-based billing model that makes a lot of sense for small projects or prototypes *[4]*.

---

  1. Their team seems to all use Twitter to get customer feedback and just generally vent in a fun way. [@apenwarr](https://twitter.com/apenwarr) [@dave_universetf](https://twitter.com/dave_universetf) [@bradfitz](https://twitter.com/bradfitz)
  1. The way they have integrated their [auth with PostgreSQL row level security][auth] is fun.
  1. Their design aesthetic and attention to detail might be the most early-Heroku/Stripe-like I've seen in awhile.
  1. Fly is also a fan of  [abusing Redis](https://fly.io/blog/last-mile-redis/)  to scale their hosted PostgreSQL.

[fly-ssh]: https://fly.io/blog/ssh-and-user-mode-ip-wireguard/
[auth]: https://supabase.io/docs/guides/auth#row-level-security
Make you coder friends triggered!
Tags: javascript, trolling
Published: 2021-08-02 04:42:19

### I found another way by which you can troll your friends!
> Umm... I am learning java.. busy.. 
> ##### `const` needed? or this will happen: 

**Code:**
```javascript
document.querySelector = document.body;
document.getElementById = document.body;
document.getElementsByClassName = document.body;
document.getElementsByName = document.body;
document.getElementsByTagName = document.body;
// Always return body element
// Bonus: Errors
// + open Stackoverflow, etc - no avail!!!
```
Create a Netflix clone from Scratch: JavaScript PHP + MySQL Day 7
Tags: javascript, webdev, tutorial, php
Published: 2021-08-02 04:35:08

Netflix provides streaming movies and TV shows to over 75 million subscribers across the globe. Customers can watch as many shows/ movies as they want as long as they are connected to the internet for a monthly subscription fee of about ten dollars. Netflix produces original content and also pays for the rights to stream feature films and shows.

In this video,we will create our database

{% youtube iRTquZpi6qI %}

In this video,we will create the config file

{% youtube ebnnK_vlpy0 %}

In this video,we will testing connection to mysql

{% youtube f0NDYKaui6M %}

If you like my work, please consider
[![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jm11knj7d8zwcvo150q2.png)](https://www.buymeacoffee.com/cglikpo)
so that I can bring more projects, more articles for you

If you want to learn more about Web Development, feel free to [follow me on Youtube!](https://www.youtube.com/c/ChristopherGlikpo)
Laravel Clear Cache Using Artisan Command
Tags: laravel, command, clear, cache
Published: 2021-08-02 04:09:04

In this tutorial I am giving you information about laravel artisan command which can help you to clear you application's cache, route cache, clear your application's view, and clear your config cache as well as.

We can run these all command in command line interface (CLI) as well as we can create one function which has stored all these function and run direct this function without open your terminal.


1. php artisan route:cache
2. php artisan cache:clear
3. php artisan view:clear
4. php artisan config:cache

So,let's start.

> Clear Config Cache

This command  is used for clear/delete config bootstrap/cache/config.php file of your application.

```
php artisan config:cache
``` 

> Clear Route Cache

This command is used to clear route cache of your application.

```
php artisan route:cache
``` 

> Clear Cache Laravel Application

This command is use for clear your application cache :

```
php artisan cache:clear
``` 

> Clear View Cache Laravel

This command is use to clear view cache of your application.

```
php artisan view:clear
``` 

Above all commands are use only in your local command window , As we don't have an access of SSL on shared hosting servers. So, we can also clear the cache by typing the code in route file. Go to your routes/web.php file and put below code.

```
<?php

Route::get('/clear-cache', function() {
	 $exitCode = Artisan::call('config:cache');
     $exitCode = Artisan::call('cache:clear');
     $exitCode = Artisan::call('view:clear');
     $exitCode = Artisan::call('route:cache');
});
```

After adding above code we can clear all cache  , view  , route , config in local environments as well as in live server also.

For run this route you need to open your browser and after add this route like below.

```
https://your_site_name/clear-cache
```

---

You May Also Like :

- **_[Read More : Laravel Datatable Example Tutorial](https://www.techsolutionstuff.com/post/laravel-datatable-example-tutorial)_**

- **_[Read More : Laravel AJAX CRUD Example Tutorial](https://www.techsolutionstuff.com/post/laravel-ajax-crud-example-tutorial)_**

- **_[Read Also : Laravel 6 CRUD Tutorial with Example
](https://techsolutionstuff.com/post/laravel-6-crud-tutorial-with-example)_**
Otimizando com Doctrine - find vs getReference
Tags: doctrine, php, getreference
Published: 2021-08-02 04:03:52

Nesse post quero compartilhar com vocês uma maneira de otimizarmos uma busca utilizando o ORM Doctrine.

## find()
Considerando uma aplicação que trabalha com Categoria e Post, se eu tiver que consultar uma determinada Categoria para relacioná-la com Post, posso usar o find() como vemos abaixo:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zuubawz38kahxykhzv1a.png)
 
Colocando uma lupa nessa busca, podemos observar o seguinte resultado:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59g73kwtem7669vr626l.png)

Até aqui, tudo certo. O resultado trouxe todos os dados da entidade Categoria desejada (id=1).

O ponto é que para relacionar essa Categoria a um Post, preciso apenas do id dela. Os demais campos, bem como as informações de posts, association, collection e outros são desnecessárias para este caso.
 
## getReference()
O Doctrine nos oferece um outro método chamado getReference().

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3z4b8dfc8jkx35t8ert2.png)
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dcl8ckuxl71mlk83lwem.png)
 
Olhando agora para o resultado gerado pelo getReference(), vemos também a entidade Category, porém, tendo apenas o campo id hidratado.

### Ou seja, o getReference é bem mais rápido que o find()! 

E isso é muito útil em casos onde é preciso ter apenas o id da entidade para realizar uma ação, como por exemplo a deleção, onde não preciso ter no resultado da busca todos os campos da entidade, mas apenas o id.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kq59j2oxb9nq7c4uyot5.png)

Comparando o tempo de resposta entre o find() e o getReference() em nosso ambiente de desenvolvimento não vamos perceber praticamente diferença alguma. 
Contudo, no ambiente de produção, que certamente existem entidades com muito mais campos e relacionamentos e dezenas de centenas e até milhares de registros, essa diferença será significativa.

Com o getReference() o processamento é menor, o uso de memória é menor, o aceso ao banco de dados é muito menor, pois o Doctrine se preocupará em pegar apenas o id.

E isso é crucial para a aplicação que está rodando em produção. Imagine uma página que tem uma quantidade enorme de acessos simultâneos que realiza essa busca...

Outro benefício está no custo. Se a aplicação está hospedada em algum Cloud Service Provider como o GCP, AWS ou Azure, usar menos processamento e memória significa ter uma conta menor no final do mês para pagar.

E assim termino este post. Usei exemplos bem simples para demonstrar o getReference() e o benefício de usá-lo nos casos em que só precisamos ter o id da entidade.

Agora é só por em prática!

Há braços e até o próximo artigo.

Thiago Luna - [Linkedin](https://www.linkedin.com/in/thiago-luna/)
CMS Survey - Packt
Published: 2021-08-02 03:42:18

The global content management market size is anticipated to grow from USD 6.9 billion in 2021 to USD 14.3 billion by 2026, at a Compound Annual Growth Rate (CAGR) of 15.7% during the forecast period. Based on multiple sources of research, surveys, and analytics, it is estimated that there are more than two billion websites online thereby creating a huge market presence for the top CMS platforms and their increased adoption over the period. CMS is witnessing increased adoption owing to technological innovations in product offerings, a rise in need to improve performance operational efficiency, a surge in demand for analytical solutions, and an increase in application areas among end-users.

We at Packt are actively looking to seek your views to develop community-driven learning resources to enhance user knowledge. This short survey would help us gain insights into the current state of the content management system (CMS) and the key challenges you face while working with any CMS platform, thereby allowing us to serve your unmet needs better.


Here is the link to the survey: https://forms.office.com/r/xfwCtGRSU5
What is useEffect?
Published: 2021-08-02 01:58:36

Hooks have become the greatest thing since sliced bread when it comes to programming React components. Everyone has heard of the useState hook. It is one of the biggest selling points of using hooks in React. But another main hook that is available to programmers is called useEffect. But what does it do? How does it help us programmers? And more importantly, how do we use it?

The useEffect hook lets you perform side effects in function components. These side effects are usually a function that is passed into the useEffect hook. You can do many things inside of the useEffect hook actually. One of the most common would be to perform data fetching by connecting to an API and saving the returned data to a variable. 

```
useEffect(()=>{
	console.log(“side effect”)
});
```

This hook is how you would add lifecycle events, such as componentDidMount, to a functional component. However, the entire lifecycle can be handled within one useEffect hook. There is no need to create the componentDidUpdate or ComponentWillUnmount. So you will have less repeat code in your component.

Sometimes you only want your component to rerender at specific times. To help with this, you can pass an optional second parameter into the useEffect hook. This second parameter is an array. This will only allow a rerender of the component if the array changes. Keeping the array empty will limit the render to only when the component mounts.

```
useEffect(()=>{
	console.log(“side effect”)
},[]);
```

The useEffect hook makes it very simple for a developer to create side effects in components without using several different lifecycle methods. You can also use this hook many times in your components. This will help separate unrelated logic and keep your code specific.
Mining Monero using Github Actions ⛏️
Tags: github, todayilearned, blockchain
Published: 2021-08-02 01:05:50

Update: so it seems that if you try to mine Monero using Github Actions, Github will suspend your account:

![](https://i.imgur.com/cL7v5Pp.png)

To preface this article: **don't do this**.

This article is for educational purposes only.

A few months ago, my software manager sent me a reddit post about people using Continuous Integration to mine Monero.

The case for using CI to mine Monero exists because the mining algorithm used for mining Monero (randomX) decreases the profitabilty gap between using a GPU & using a CPU to mine.

Thus, it made it somewhat profitable to mine XMR with a CPU (this is where CI comes into the mix).

RandomX took ASIC miners out of the equation, supposedly decentralizing Monero further as institutional miners who had the capital to afford ASICs were disincentivised to purchase ASICs to mine Monero, and were forced to choose either CPU or GPU mining.

To support Monero's case: this lowered the amount of obvious attack points which regulatory bodies could target if they wanted to take down the mining network.

It would be a lot easier to target several massive mining companies, by threatening them with legal notice, than to target several hundreds of thousands of owners of CPUs.

As a detriment, illegal botnets started mining XMR on unconsenting victims' CPUs, and streaming websites started mining XMR via a JS script.

Now, if someone was to go about trying to mine XMR with Github Actions, this is how they might do it:

First, make a new Github repo, then add a Github Actions workflow.

For the basics of this, follow this [official guide](https://docs.github.com/en/actions/quickstart)

In the `main.yml` file:

```
name: xmr miner 🦹‍♂️

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Installs xmrig
        run: |
          sudo apt update
          sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
          git clone https://github.com/xmrig/xmrig.git
          mkdir xmrig/build && cd xmrig/build
          cmake ..
          
      - name: Runs xmrig
        run: |
          ./xmrig -o pool.minexmr.com:443 -u {yourXMRAddress} -k --tls --rig-id workflow


```

Replace `{yourXMRAddress}` with a target XMR address.

To trigger this workflow, commit something random to your repo.
An Example of a Closure in JavaScript
Tags: javascript, programming, webdev
Published: 2021-08-02 00:51:07

Hi everyone, 

The concept of the closure is one of the tougher concepts for me when I first started learning JavaScript in depth. If you are new to the concept, a closure is essentially a function bundled together with its surrounding state, which typically includes variables that the closure needs. A closure is typically a function within a larger function, which serves as a "bubble." All the variables within this larger function bubble are only accessible by methods in the closure.

The JavaScript engine is smart enough to realize that the variables are needed, so the engine's garbage collector does not obliterate them.

Below is a quick example of an object with four functions that are actually closures. 

<code>get</code>, <code>set</code>, <code>increment</code>, and <code>reset</code>. They all act on a variable called <code>count</code>, which sits within the immediately invoked function expression (IIFE) holding the closure.

Each function, which comes bundled with its surrounding environment, is a closure. 

{% jsfiddle https://jsfiddle.net/nevkatz/nm631eq5/ html,js,result%}

* the <code>get</code> method will simply get the <code>count</code> value.

* the <code>set</code> method sets the <code>count</code> value to any value we want.

* the <code>increment</code> method will increment the existing value by the amount passed in as a parameter. If no value is passed in, it increments the value by 1.

* the <code>reset</code> method resets the value to zero.

These methods are the only way the user can access the <code>count</code> value. In this way, the use of a closure causes the <code>count</code> value to act in a similar way to that of a private variable in a Java object; it cannot be accessed outside the object, so methods are required to retrieve its value or update it.

In the demo, you will see that an <code>init</code> method grabs some references to the HTML elements we print to and then calls all the methods. Take a look at how they are called and see if you can understand what causes these particular values to be printed out.

I hope this quick post gives you a solid idea of what closures are about. Thanks for reading!

## Elsewhere
For a tutorial on closures with an easy on-ramp, check out <a href="https://javascript.plainenglish.io/javascript-closures-and-their-scope-bubbles-a6bef7a4824e?sk=a0bf906dc1895a6b21508ef82479df7e">JavaScript Closures and Their Scope Bubbles</a> on Medium.
Replace routes if you don't want to add them to history
Tags: vue
Published: 2021-08-02 00:23:33

## Background

When building applications, we often have multiple pages like the home page `/home`, profile `/profile` and others. We navigate between those pages using client side routes like `vue-router`. Each page is given a route when requested, it displays that particular page. We, hence, can navigate between the different pages by requesting their routes. when clicking the browser back button, it takes us to the previously requested route.

## Issue

In the profile page, I might have nested pages with nested routes and a sidebar on the left side to navigate between the profile routes which could be `info` (`/profile/info`)to display the information about the user, `payment` (`/profile/payment`) to display their payment history, and `message` (`/profile/message`) page.

If I navigate to the info route, then to payment, the back button takes to the info. However, I want to technically disable the back button in the profile page so that it never takes back to another nested route within the profile.

Regardless of how many times, I navigate between the profile routes. When I hit the back button, I want to go back to the `home` page.

## Solution

We need to replace the routes so it is not pushed into the history stack.

There are a few ways of doing that in `vue-router` whether you are using programatic navigation or `router-link`


```js
 // Programmatic navigation
router.push({ path: '/profile/info', replace: true })
or
router.replace({ path: '/profile/info' })
// router-link
 <router-link to="/profile/info" replace>Info</router-link>
```

Thanks for reading
Should I use Arrow Function? or Regular Function? 🤔
Tags: javascript, frontend
Published: 2021-08-02 00:15:24

## My conclusion

I go with Arrow Function(most of the cases)

## Reasons

Arrow function can be less bug-prone
- It does't allow duplicate argument names
- No hoisting with using `const` 
- It cannot define with the same function name with using `const`

## When to use Regular function

- We we want to leverage the difference of `this` behavior for regular function
- In typescript, when you want to use [Function Overloads](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads)
(Thanks for your comments, @lexlohr 😉)

## Difference in details

There are other differences between Arrow and Regular functions as well. And following reference explains very well on that with good example codes 👍

## Reference

- [Arrow function expressions - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)
- [Regular vs Arrow Function - DEV Community 👩‍💻👨‍💻](https://dev.to/suprabhasupi/regular-vs-arrow-function-4kpe#this)
- (Written in Japanese)[JavaScript: 通常の関数とアロー関数の違いは「書き方だけ」ではない。異なる性質が10個ほどある。 - Qiita](https://qiita.com/suin/items/a44825d253d023e31e4d?utm_source=pocket_mylist)