teleren/devto huggingface dataset:
Why you're not Productive?
Tags: productivity, coding, development, beginners
Published: 2022-05-14 19:09:22

## Introduction

As my software engineering journey progressed, I found mistakes and short comings that slowed and lowered down my productivity bar. Years before, it seemed no problem 
until I put myself through a **Self Assessment process**!

*Today I would like to share those common Slippery Patches so you can get a feel and prepare yourself against them on the first hand*

## False Initialization (Lose the moment)

Being a human, we respond to everything that comes in for us. Either its a social interaction or work specific.

Region of time lapse must be ideal. As a developer, if a task is assigned to you, there should be a plan to implement and get along to finish line. 

Time can never be infinite, so if you initiate stuff at the right time the possibility ratio of success broaden itself. You definitely get a chance to submit work at time. Using 8 hrs to complete work daily is an Art. Undoubtedly, you'll learn this by time and experience.

If you are unable to do so, time is near when you get stuck in Late night spendings for work and get your ass safe!
This directly cast a negative impact on your personal life. Either your family, friends or your own space. 

## Lack of Prioritization

Active and Passive are two natures that live inside developers. The person with first always know what's ahead, he/she plans and set up their schedulers while others just procrastinate. 

This practice leads towards No Goal Achievement or Low Progess Levels. Also a common problem of those who are struggling to find a better fit between Work and Life.

## Useless Internet Surfing

Developers love to connect with global world and its really awesome. But surf wisely not blindly. If you're use to scroll feed of your favorite app, many times in an hour. Chances are there to spoil your productivity bar. By surfing wisely I mean to surf in a specific time to chill and relieve stress. Watch podcasts, read books or watch a movie when you feel tired or frustrated!

So thats all for now!!

**Have you faced these issues**? or **struggling to find a better fit**. Let me know inside comments so we can tie threads and learn together!
Controle de versão - O que é? Porque usar?
Tags: git, beginners, programming, productivity
Published: 2022-05-14 19:05:44

![Versão](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s9bevuirsbprvqghdavs.png) 

Um sistema de controle de versão é um software (ou mais de um) que se encarrega de gerenciar as mudanças nos arquivos físicos. Esses arquivos podem ser basicamente de qualquer tipo, como documentos, imagens e código fonte de algum programa. Por gerenciar mudança ele nos avisa se teve mudança em determinado arquivo, quem fez tal mudança, quando foi esta mudança feita e, idealmente, porque esta alteração foi implementada entre outras funcionalidades associadas à segurança e organização de arquivos e suas versões.

Porém, métodos sistêmicos não surtem o efeito desejado e acabam causando mais dor de cabeça, por diversos motivos na opnião de algumas pessoas.... Entre eles, falhas de processo e disciplina ou simplesmente um enorme trabalho pra descobrir o que foi alterado de uma versão pra outra, por isso é necessário que você conheça muito bem e pratique. 

Um sistema de controle de versão possui diversas vantagens no seu uso, dentre elas:

**Segurança:** Cada software de controle de versão de mecanismos para evitar possíveis corrupções em arquivos. Além disso, apenas pessoas autorizadas e identificadas podem mexer no código fonte controlado.

**Versionamento:** Caso se deseje voltar a versão de um determinado arquivo por algum erro cometido ou simplesmente mudança de escopo, é possível fazê-lo de forma simples e estruturada, minimizando eventuais erros e efeitos colaterais.

**Rastreabilidade:** Quando se trata de algo importante, é sempre interessante saber “Quem”, “Quando”, “Como”, “Por que” e “Onde”. Todos esses metadados estão disponíveis nas ferramentas mais populares de controle de versão.

**Organização:** Os sistemas que possuem interface visual disponibilizam uma visualização completa do ciclo de vida de cada arquivo controlado, desde sua criação até o momento atual.

**Colaboração:** O trabalho em equipe, principalmente as distribuídas, é muito facilitado. Pessoas que talvez nem se conhecem pode colaborar num determinado projeto cujo repositório central é disponibilizado a todos os envolvidos.

**Confiança:** O uso de repositórios remotos ajuda muito na recuperação de eventos imponderáveis. Situações do tipo “Perdemos o projeto inteiro que estava na máquina de fulano” são minimizadas. Além disso, é possível testar novas ideias sem danificar a linha base do desenvolvimento.

Esse pontos apresentados acima impactam diretamente na produtividade e na sanidade da equipe de desenvolvimento e dos gestores do projeto. Então pare com pensamentos limitantes e opte por utilizar o controle de versão **NÃO IMPORTA QUAL SEJA**! Particularmente gosto bastante do GIT (o mais utilizado), mas cabe você, sua equipe ou organização decidir qual o melhor. Só peço que pare de salvar seus arquivos em diversos arquivos `.rar` e colocando como backup para ter rastreabilidade ou não fazer nada.
Rust: Assertions in API doc?
Tags: rust
Published: 2022-05-14 18:30:40

---
title: Rust: Assertions in API doc?
published: true
description: 
tags: rust

---
I've looked a bit at the API documentation for Rust.  I was surprised to see that very often the documentation for a method uses one or more assertions about the returned value, instead of showing the returned value itself.

This contrasts sharply with corresponding documentation for other languages.  Does anyone know the motivation for this?

- [Rust](https://doc.rust-lang.org/std/primitive.f64.html#method.acos).
- [Ruby](https://docs.ruby-lang.org/en/master/Math.html#method-c-acos) (btw, I wrote this one).
- [Python](https://docs.python.org/3/library/math.html?highlight=acos#math.acos).
- [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos).
- [C++](https://www.cplusplus.com/reference/cmath/acos).
How to Dockerize a Next.js app
Published: 2022-05-14 18:21:36

Use this example dockerfile to dockerize and build your Next.js app as an image.

```
# Node version
FROM node:14-alpine as build

RUN apk update
RUN apk --no-cache --virtual build-dependencies add \
    jpeg-dev \
    cairo-dev \
    giflib-dev \
    pango-dev \
    python3 \
    make \
    g++ 


# Set the working directory
WORKDIR /app

# Add the source code to app
COPY . /app

# Install all the dependencies
RUN yarn install --frozen-lockfile

# Generate the build of the application
RUN yarn build

# Production image, copy all the files and run next
FROM node:14-alpine AS runner
WORKDIR /app

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

# Copy the build output to replace the default nginx contents.
# COPY --from=build /app/next.config.js ./
COPY --from=build /app/public ./public
COPY --from=build --chown=nextjs:nodejs /app/.next ./.next
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/package.json ./package.json

USER root

EXPOSE 3000

CMD ["yarn", "start"]
```

Then run the following to build it:
`docker build --no-cache -t latest .`
`docker run latest`


You can now use this to push to Google Cloud Container Registry
How to set proxy with authentication in selenium chromedriver python?
Tags: python, selenium, chromedriver, authentication
Published: 2022-05-14 18:21:16

**Selenium Chrome Proxy Authentication in Python**

_Setting chromedriver proxy with Selenium using Python_

If you need to use a proxy with python and Selenium library with chromedriver you usually use the following code (Without any username and password:

{% embed https://gist.github.com/itsmnthn/fe3a6fb4be6ffc97e74ec307c6c103b4.js %}

This works fine unless proxy requires authentication. if the proxy requires you to log in with a username and password it will not work. In this case, you have to use more tricky solution that is explained below. By the way, if you whitelist your server IP address from the proxy provider or server it should not ask proxy credentials.

_HTTP Proxy Authentication with Chromedriver in Selenium_

To set up proxy authentication we will generate a special file and upload it to chromedriver dynamically using the following code below. This code configures selenium with chromedriver to use HTTP proxy that requires authentication with user/password pair.


{% embed https://gist.github.com/itsmnthn/3627d9d9c6c1382a7c7646eb299c7623.js %}

Function get_chromedriver returns configured selenium webdriver that you can use in your application. This code is tested and works just fine.

Read more about [onAuthRequired](https://developer.chrome.com/docs/extensions/reference/webRequest/#event-onAuthRequired) event in Chrome.
Reddit API is such a mess
Tags: api, javascript, webdev
Published: 2022-05-14 16:19:59

I really hate both reddit.com and its mobile app, and was looking for an alternative. I just wanted something minimalistic and lightweight. Apollo, Slide, Narwhal, Comment, BaconReader, photon-reddit... I tried everything I could find and none of them felt _nice_ to use. So, I thought I could make own, how hard can that be? Fetch some data from the API and display it.

Oh, how wrong I was.

First of all, the documentation, uh, leaves a lot to be desired. There's no response body example so I had to call each of them before using them. Some parameters are just left unacknowledged.

My biggest complaint is that there's no easy way to tell if the post is a text, image, GIF, video, embedded video, or embedded image.

`is_self` means it's a text. `is_video` means it's a video, but not, since you also have to check `post_hint === 'rich:video'` and `domain === 'v.redd.it'`. But even if you know what kind of media it is, getting the media URL is in its self is a hurdle. Sometimes you have check `media_embed`, maybe `media_metadata`, or `preview.images[0]`. Oh, and `media.reddit_video`.

And the inconsistency.

Sometimes nsfw items are marked as `over_18` and other times as `over18`. Some key-values are missing depending on which endpoint you call, like `description` from users missing when you search users by a query. Icon URLs are included in either `community_icon` or `icon_img`.

And finally, getting the next batch of items.

Reddit API only gives you a max 100 or so items for each API call. If you want to get the next batch of posts, you have you use the `after` id provided by the previous call. Fine, it works. But, how do you get the next batch of comments in a comment section? Well, the API returns you all the comment ID of comments that weren't included in the first batch. You can get the content of each comment using their ids, but replies to those comments are missing. There's an endpoint that gives you the comment with the replies, but it's missing crucial information like who made them. And don't forget that the object that includes that list of comment ids are inside an array of totally different comment-objects. 

There are API wrappers like Snoowrap but I am not willing to see any more response body from reddit.com.

So, my solution?

Create an API wrapper that does all the work for you and returns a clean response body without the fat. Still very much in progress though: https://github.com/pilcrowOnPaper/corsica.
Review my resume
Tags: help, discuss, resume, beginners
Published: 2022-05-14 18:16:24

Hey guys, this is my resume which I have created, can you suggest me any required changes,  any kind of feedback , it will be helpful.
  
[Link of my resume ](https://drive.google.com/file/d/1gYeRRJyvcuKAMcFCW0Tp8vrYHyNPRXqJ/view?usp=drivesdk)
Include Dotenv File to Makefile
Tags: beginners, shell, unix
Published: 2022-05-21 02:36:24

---
title: Include Dotenv File to Makefile
published: true
date: 2022-05-14 17:00:01 UTC
tags: Beginner,shell,unix
series: "Sunday Snippet"
canonical_url: https://clavinjune.dev/en/blogs/include-dotenv-file-to-makefile/
---

 ![Sunday Snippet #17 include dotenv file to makefile](https://clavinjune.dev/img/sunday-snippet/image.png "Sunday Snippet #17 include dotenv file to makefile")

## Directory Structure

```shell
$ tree -a .
.
├── .env
└── Makefile

0 directories, 2 files
```

## Dotenv File

```shell
$ cat .env
FOO=12345
```

## Makefile

```shell
$ cat Makefile
include .env

example:
	@echo "${FOO}"
$ make example
12345
```
What does "coaching" mean to you?
Tags: beginners, codenewbie, programming, productivity
Published: 2022-05-14 16:59:53

I'm interested in learning what most developers associate with the word *coaching*. Many of us come from a self-taught background, while others come from more traditional schooling. And there is an entirely new generation of folks coming from specialized web development schools. In many of those environments the word mentorship is often used to describe the act of teaching or guidance. But does that also insinuate the act is free? 

And what is the difference in expectations if it isn't free? Does the word coaching change if you're paying for the service?

What do you think of when you hear the phrase **professional coaching** for software development?
How to inject subclass at runtime in Spring Boot
Tags: java, spring, programming, beginners
Published: 2022-05-14 16:47:02

I am new to Spring Boot. I am writing a sample project to learn. I have a superclass service. I have two subclass services which extend superclass service. In RestController I want to dynamically use one of the subclass based on a if condition. Is it a good idea? Any better way to do that? I know that if else condition to use a concrete class is bad.
Setting up Laravel with SQL Server AND Laragon on Windows
Published: 2022-05-14 16:26:39

I just want to share how I connect my laravel project with sqlserver. 

I assume that you already have Laragon and SQL Server in your local system. 

Step 1. Download the PHP driver [here](https://github.com/Microsoft/msphpsql/releases/tag/v5.10.0)
  * Go to the bottom of the page then download windows-8.1.zip (since I'm using PHP 8.1
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ktp31rtjgy6q10j1yg8o.png)
  * Extract the zip file to a folder, then go to folder named x64, you will see the following dll
     ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvh9mywaedmmjbwxnbia.png)
  * Then copy these dll to your php folder inside the laragon folder, mine is  C:\laragon\bin\php\php-8.1.5-nts-Win32-vs16-x64\ext
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j20ppu76rp5gydxmwegh.png)
  * Then Edit your php.ini, add the extension
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6uqwgphagm2mb11hffo.png)
  * Then restart your laragon server

Step 2. Make a new laravel app using laragon quick app menu
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0ybjhbs8mnqu2d1sdvf.png
)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a465e1hxqhlcpgtb03c5.png)
  * Then we need to update the .env file
```
DB_CONNECTION=sqlsrv
DB_HOST=127.0.0.1
DB_PORT=1433
DB_DATABASE=lara-sqlserver
DB_USERNAME= sa
DB_PASSWORD= 12345678 
```
  * Next, create the database in sql management studio, mine is lara-sqlserver
  * Before running the migration, make sure to enable tcp-ip in sql configuration manager
   ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opikbte4ce6kxwgqvbl5.png)
 
  * then run the migration

   ```
     php artisan migrate
   ``` 
  * if everything works fine you should see this in your terminal
     ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iyhnoaaphswfoqss9zml.png)
 
**Thanks guys!**
When I need use Typescript?
Tags: javascript, beginners, webdev, tutorial
Published: 2022-05-14 16:07:17

Do you know what Typescript is? If you don't know, lets learn how to use it!

Typescript is a superset of Javascript, but what does is mean? It's basically our beloved Javascript + someone functions!

The most importante function we have is to include typing in Javascript.

> But why?

When you declare an object, a variable a function whatever, you say what king of value is will receive!

This helps to avoid assign wrong values to variables, and thanks this our dear text editors end up getting much better, because they can warn if we doing something wrong before we even execute the code!

In my opinion, if you don't use Typescript, start as soon as possible!

> But when and which project to use?

In all possible, from basic to advanced, there is no reason not to use Typescript 🚀

.
.
.
.
.
From post in PT-BR
Instagram: @imatheus.max
Post: https://www.instagram.com/p/CdivOVjOon-/
PHP Hangman Game
Tags: php, game, dev, ajax
Published: 2022-05-14 15:54:11

Hello to everyone.

In these days I’ve found an old project of mine and I decided to give it some refactoring.
It’s a very simple Hangman Game developed using PHP & JS.
It can be played in English or in Italian and you can play against the PC, which will chose a random word you'll have to guess among 60 thousand for each language, or you can play it with a friend inserting a custom word.
A working example is [HERE](https://bit.ly/3wd6fqs)
But there I’ve created a public GitHub repo too: [Hangman Repo](https://github.com/MasonMassyJames/hangman)

Any feedback is welcome.

Hope you enjoy 😊
Create Custom Logs in Laravel
Tags: laravel, webdev, beginners, tutorial
Published: 2022-05-14 15:38:18

Log is a way which we can use to keep track of input data, output data, requests made through our applications, log system error messages, notify about informations to teams. In our laravel applications we can use logging services to create logs. Here we will create custom logs in laravel also. Laravel logging is based on “channels”. Each channel represents a specific way of writing log information.

Laravel uses the **config/logging.php** file for log’s configuration. To log the information laravel uses the channel name from this file based on environment production or local. By default, Laravel use the stack channel when logging messages. You can read in detail about [Laravel logs here](https://laravel.com/docs/8.x/logging).

## Creating Logs in Laravel
If you are using the controller or model or custom class then you have add this line at top. In blade templates you can directly use Log.

**use Log;**

```php
$message = 'Custom String'; //string logs
$message = ['key' => 'value']; //array logs

Log::emergency('Emergency message : ', $message);
Log::alert('Alert message : ', $message);
Log::critical('Critical message : ', $message);
Log::error('Error message : ', $message);
Log::warning('Warning message : ', $message);
Log::notice('Notice message : ', $message);
Log::info('Info message : ', $message);
Log::debug('Debug message : ', $message);
```
Now, open **storage\logs\laravel.log** and you will see your logs.

## Create Custom Logs in Laravel
To create custom logs just add the below code in your config/logging.php file inside the channels array.

```php
'channels' => [

        'custom_log_channel' => [
            'driver' => 'single',
            'path' => storage_path('custom_logs/laravel.log'),
        ],

    ]
```
Here we have used the driver single (A single file or path) and our path. Now log using the below code.

```php
Log::channel('custom_log_channel')->info('Custom LOGS => ',['name' => 'Custom Logs Working..']);
```
Now, open the file **storage\custom_logs\laravel.log** and you will see your logs.

---

Please like share and give positive feedback to motivate me to write more.

For more tutorials [visit my website](https://www.w3courses.org/tutorials/).

Thanks:)
Happy Coding:)
A complete game development blog #0: Project UFO defence
Tags: csharp, unity3d, gamedev, beginners
Published: 2022-05-14 15:29:32

To get straight to the point, this is a hobby project idea that I have been toying around with for a little while, that I'm finally hoping to bring to fruition. I've had many a project that have fizzled out after the first few weeks, so now I'm grabbing the bull by the horns. I'll document every bit of progress on dev.to, and store it all on git to keep myself glued to the project.


**The Game**

So far the game has simply been called "Project UFO Defence". You guessed it, it's inspired by the original XCOM from the year 1994, "X-COM: UFO Defence". I feel It's a style of game that hasn't really been recreated. Obviously I'm a big fan of the reboot franchise, but I just feel something about the game significantly changed bringing it to 3D, something that I'm hoping to put my twist on. I haven't done much designing yet for the game. I'll get on this as soon as the base systems are in place. It'll be a lot easier to design a lot of the systems and make changes once you have a feel as to how the game looks and plays on the very foundational level.

So this is the starting point:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxkg394yhepzibv0ncmx.png)

The graphics are all free to use recourses from sites like opengameart.org that I slapped in for testing purposes. I haven't ever worked on an isometric game before so tiling it was interesting. I'll see in the future how I'll do the sprites, I might have to try my hand in making some artwork, who knows.

Git: https://github.com/PuustelliJoona/ufo-defence
LinkedIn: https://www.linkedin.com/in/joona-puustelli-aa031b23a
Dev.to: https://dev.to/puustellijoona
Create Multi Select Checkbox at ease :D
Tags: react, javascript, html
Published: 2022-05-14 15:07:00

Here, I would like to share code snippet to create your own Multi Select Checkbox with React basics. 

It renders a checkbox list that uses a callback function to pass its selected value/values to the parent component.

- Use React.setState() to create a data state variable and set its initial value equal to the options prop.
- Create a function toggle that is used to toggle the checked to update the data state variable and call the onChange callback passed via the component's props.
- Render a <ul> element and use Array.prototype.map() to map the data state variable to individual <li> elements with <input> elements as their children.
- Each <input> element has the type='checkbox' attribute and is marked as readOnly, as its click events are handled by the parent <li> element's onClick handler.

```javascript
const style = {
  listContainer: {
    listStyle: 'none',
    paddingLeft: 0
  },
  itemStyle: {
    cursor: 'pointer',
    padding: 5
  }
};

function MultiselectCheckbox({ options, onChange }) {
  const [data, setData] = React.useState(options);

  const toggle = item => {
    data.map((_, key) => {
      if (data[key].label === item.label) data[key].checked = !item.checked;
    });
    setData([...data]);
    onChange(data);
  };

  return (
    <ul style={style.listContainer}>
      {data.map(item => {
        return (
          <li key={item.label} style={style.itemStyle} onClick={() => toggle(item)}>
            <input readOnly type="checkbox" checked={item.checked || false} />
            {item.label}
          </li>
        );
      })}
    </ul>
  );
}
```

## Usage

```javascript
const options = [{ label: 'Item One' }, { label: 'Item Two' }];

ReactDOM.render(
  <MultiselectCheckbox
    options={options}
    onChange={data => {
      console.log(data);
    }}
  />,
  document.getElementById('root')
);
```

Hope this helps you, ;)