teleren/devto huggingface dataset:
Docker remove all image, volume, container
Tags: docker, image, container, dockercompose
Published: 2022-05-13 03:08:29

Here I am going to write about removing docker images, volumes and containers. To do so, first of all, you need to shutdown the docker container.

```sh
docker-compose down
```
After that, you can follow following method to remove required things,

```sh
# To remove all the containers
docker rm -f $(docker ps -a -q)

# To remove all the docker images
docker rmi -f $(docker images -a -q)

# To remove all the volumes
docker volume rm $(docker volume ls -q)

# To delete everything
docker system prune -a --volumes
```
Binary search algorithm implementation in JavaScript
Tags: binarysearch, javascript, algorithms, programming
Published: 2022-05-13 03:01:31

Binary Search:- Binary search algorithm which works based on divide and conquer approach.

- It is used to search for any element in a sorted array.
- Compared to linear search, binary search is much faster with time complexity of O(logn) whereas linear search works in O(n) time complexity.

```
function binarySearch(list, item, left, right) {
    let mid = Math.floor((left + right) / 2)
    if (left > right) {
        console.log(left, right)
        return false
    }
    if (list[mid] == item) {
        return true;
    } else if (item < list[mid]) {
        return binarySearch(list, item, left, mid - 1)
    } else {
        return binarySearch(list, item, mid + 1, right)
    }
}

let list=[1,2,3,5,6,7,8,9];
console.log(binarySearch(list,10,0,list.length-1))
```

> Any comments and suggestions are welcome.
Simple way to Implement JS Cache using Closure. (JS developer need to know)
Published: 2022-05-13 02:45:07

In React, there are some functionality for cache using React hooks such as React.memo, useCallback, useMemo and so on.
In this time, we try to implement those cache action using closure in JS(ES6+).
Closure means the lexical context a function was declared in and the variables it has access to.

```
function fnGenerator(str) {
  const strLog = 'The string I was given is "' + str + '"';
  return function() {
    console.log(strLog);
  }
}
const fnRet = fnGenerator("BatMan");
fnRet();  // -> The string I was give is "BatMan"
```
To engage this theory, we can implement Cache functionality in JS.
Here is an example I did for fibonacci.

```
const originalFibo = (n) => {
  let res = [1, 1];
  if (res.length >= n )
    return res;
  while(res.length <= n)
    res.push(res[res.length - 1] + res[res.length - 2]);
  return res;  
}

const fbGenerator = (n) => {
  let res = [1, 1];
  return function() {
    if (res.length >= n)
     return res;
    while(res.length <= n)
       res.push(res[res.length - 1] + res[res.length - 2]);
    return res;
  }
}

const fibo = fbGenerator(100);
console.time('cache started');
for(let i = 0; i < 1000; i++)
  fibo();
console.timeEnd('cache ended');

console.time('original started');
for(let i = 0; i < 1000; i++)
  originalFibo(100);
console.timeEnd('original ended');
```
You will notice that this code snap dramatically decreases the runtime compared to original codesnap.
Don't do these DATA SCIENCE Mistakes
Tags: datascience, machinelearning, deeplearning, aws
Published: 2022-05-13 02:43:59

## **Beginner Mistakes :**

- Spending a lot of time on theory.
- Jumping directly into coding ML algorithms without learning the prerequisites.
- Thinking to build the future without knowing the basics.
- Not spending enough time on exploring and visualizing the data.
- Focusing on accuracy over understanding how the model works.
- Assuming the algorithm is more important than domain knowledge.
- Not having a structured approach to problem-solving.
- Learning multiple tools at once.
- Not learning/working consistently.
- Less communication.

## **Intermediate Mistakes :**

- Data Leakage.
- Sampling Bias.
- Too many redundant features.
- Bad Coding style.
- Unavailability of features in future.
- Not performing proper testing.
- Not Choosing the Right Model- Validation Frequency.
- Choosing the wrong tool to visualize.
- Paying Attention Only to Data.
- Building a Model on the Wrong Population.
- Ignoring the probabilities.
- Data Analysis without a Question/Plan.
- Don't Sell Well.

## **Mistakes to avoid while applying for jobs :**

- Do Not Lie.
- Using too many Data science Terms in your Resume.
- Overestimating the value of academic degrees.
- Do not narrow your search.
- Competitions are not Real-Life.
- Your LinkedIn profile is sacrosanct.
- Being unprepared to discuss projects.

## **Mistakes to avoid during Interviews :**

- Not asking enough questions.
- Discussing the old projects.
- Not considering the business impact.
- Not good at technical skills.
- Not being a problem solver.
- Not thinking from the interviewer perspective.
- Not supporting your statements with stats and facts.
- Failing to convey how you will help the company.
- Forgetting The Requirement.
- Not Using “I don't know" Judiciously.
- Focusing on Answer Rather than Approach.
- Not Taking the Opportunity to go into Details.
- Taking Failure Personally.

## **10 wrong reasons to become a DATA SCIENTIST :**

- You Think Its Easier to get a Job.
- No Interest in Coding or Programming.
- Your Primary Reason is Money.
- You Hate Math.
- An Overall Lack Of Passion.
- You Find Working With Data Annoying.
- Consistent Learning Is Boring.
- Lack of Communication Skills.
- Hate Collaboratively Working in a Team.
- Exploration And Working On Newer Projects does not really appeal to you.
For the last few days, gas fee has become ridiculously high $$$ so I've built an app to save money
Tags: blockchain, ethereum, showdev, web3
Published: 2022-05-13 02:43:26

Firstly, I am new to web3 so to get into that eco-system I wanted to build something small. One of the pressing issue in web3 especially in ETH is gas fee which is like a transaction fee. For many unknown reasons, gas fee has become ridiculously high for the last few days. 

Ex: To make a small transaction you got to shell out anywhere between $30 to $200. (At the time of writing this article it is ~$110)

Gas fee is calculated based on the complexity of the transaction, number of people transacting at the time of your transaction + some other factors.

To help others save $$$ on gas fee I've focused on one problem.
- Majority of the users make transactions on desktop instead of mobile(because the mobile adoption for web3 is not quite there yet), so I've focused to build a desktop app so it is right there on your desktop always 
- The app will show the user the ethereum price and gas fee based on the priority.
- To help save money, user can set reminders based on the gas fee. (For instance, if you're comfortable enough to make a transaction on eth when gas fee is 20 Gwei, you can set that value for the reminder)

> ETH Gas Alert

**Download for free - https://ethgas.carrd.co/?ref=producthunt
**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4kc14girkzv6n1okvhz4.png)


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


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

**Tech stack:**
Frontend: Swift(Appkit & UIKit)
Backend: Supabase(DB, API and Cron job)

> ETH Gas Alert

**Download for free - https://ethgas.carrd.co/?ref=producthunt
**

If you want to learn more about how I used Supabase you can read here https://dev.to/pradeepb28_/ive-built-a-mac-app-using-supabase-1ank (lmk if you need more information, happy to detail them)
How to define exceptions in Ruby C extension library
Tags: ruby
Published: 2022-05-13 02:39:55

## introduction

In the Ruby language, exceptions are defined by inheriting StandardError.

```ruby
class IndexedError < StandardError; end
```

So how do you define an exception class in Ruby C extension library?

## Define a exception class in C

When writing C extensions, exceptions can be defined in exactly the same way as in the Ruby language.

```c
VALUE rb_Bio;
VALUE rb_CGRanges;
VALUE rb_eIndexedError;

void Init_cgranges(void)
{
  rb_Bio = rb_define_module("Bio");
  rb_CGRanges = rb_define_class_under(rb_Bio, "CGRanges", rb_cObject);
  rb_eIndexedError = rb_define_class_under(rb_CGRanges, "IndexedError", rb_eStandardError);
// ...
```

## Call exception

You can use `rb_raise`.

```c
  if (RTEST(rb_ivar_get(self, rb_intern("@indexed"))))
  {
    rb_raise(rb_eIndexedError, "Cannot add intervals to an indexed CGRanges");
    return Qnil;
  }
```

Here, the instance variable `@indexd` is checked and if it is true, an exception is raised.
`RTEST` will determine true or false.

## Write a test

Using test/unit, I wrote a test as follows.
It raised an exception as expected.

```ruby
cgranges.index
assert_raises(Bio::CGRanges::IndexedError) do
  cgranges.add("chr1", 10, 20, 0)
end
```

That is all. Have a good day.
A tech company it's like a futbol team.
Tags: career, foreigners, perspective
Published: 2022-05-13 02:23:39

Own, manage or direct a tech company it's like a futbol team. You have a group of person working for the same objective:

> Could be won a tournament or win each game.

In the same way, your tech company has a group of people trying or
working for the same objective: make a profit, build/maintain a product, etc.

![Futbol like a tech company](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/th5wy7ve2g68lfw2cz96.jpg)
 

You are the CEO/CTO and you are the director too, you don't play
directly the games, but you have to see everything goes on wheels. You contract a Technical Director to manage the team, to check everything and other of your responsibility is select the best players what you can pay. You try to get the best talent, the best defence or the best goalkeeper.

![the CEO its like roberto sedino](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/au09y3zeqd7ysp0d3jas.jpg)
 

In the same way, the tech companies have these needs, to search for the best elements for work on your stack. And one of the advantages of the futbol, it's the rules of the futbol, it's the same around the world, in tech Javascript or Python

is the same in Canada, Mexico or Salvador.

Then, when you want to go to the next level and win easier, you might hire some foreigners to get strength.


![Contrata a algun supercampeon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pdbtd02ccuc24gyfrhxg.jpeg)


You can look out of your border limits to get the best team player you can get from  outside. Doing that you have some advantages:

* *Loyalty*, because the person who will receive sponsorship, will be thankful for all the effort you did to bring to him and his family.

* *Diversity*, you will bring the style of playing from another side, your others players will know a new style.

* *Top Talent*, you have not restricted a group of players working in your league, you can select the best talent in the world.

If your tech company wants to have the best defense or the best
offensive.

Take a look at https://visto.ai
How a Canadian Tech Company can hire a foreign developer?
Published: 2022-05-13 02:19:45

If you are a Canadian Tech company and you want to hire some foreign software developers,
you are very lucky, you don't have deal with the normal LMIA:

* You don't have to [advertise the job offer for 3 months][2].
* You don't have to [wait 53 business days for processing your LMIA][1]

Really?, ooh yes!

Your tech company can apply to program  called the [Global Talent Stream (GTS)][3].
It is an expedited work permit for tech workers only and can take as little as 4-6 weeks.

If you are reading this, you would like to run quickly....

But they are two main requirements for hire to your rockstar developer.

1. You need to join all requirements together and also submitted to the IRCC
portal, and they will be a response with a Positive LMIA if you did correctly.

2. After having a LMIA you need your developer gather her main documentation
for submit to the IRCC and get a workpermit.

How long it can take ? Well, depending on the nationality of the developer.
Could be variable.


Easy? In theory everything is on the [GTS][4] website. But you don't have
time to deal with immigration(IRCC) or reading a lot of unknown terms.


Here where the <https://visto.ai> team  gain the scene. We develop an application for
Automated application preparation, tracking, LMIA generation, gather
documentation and more.



[1]: https://www.canada.ca/en/employment-social-development/services/foreign-workers/labour-market-impact-assessment-processing-times.html
[2]: https://www.canada.ca/en/employment-social-development/services/foreign-workers/median-wage/high/requirements.html#h2.6
[3]: https://visto.ai/how-the-global-talent-stream-can-help-you-find-a-tech-job-in-canada/
[4]: https://www.canada.ca/en/employment-social-development/services/foreign-workers/global-talent/requirements.html
50+ hints JS(ES6+) developer must know (first part)
Published: 2022-05-13 02:19:35

## Code snips which will help you to be a Senior JS(ES6+) developer.
If you think you are a JS engineer, I recommend you to read this at least one time.

**1. REFERENCE**

```
// bad
var a = 1;
var b = 2;
// good
const a = 1;
const b = 2;

// bad
var count = 1;
if (true) {
  count += 1;
}
// good, use the let
let count = 1;
if (true) {
  count += 1;
}
```
**2. Objects**

Use the literal syntax for object creation

```
// bad
const item = new Object();
// good
const item = {};
```

Use computed property names when creating objects with dynamic property names.

```
function getKey(k) {
  return `a key named ${k}`;
}

// bad
const obj = {
  id: 5,
  name: 'San Francisco',
};
obj[getKey('enabled')] = true;

// good
const obj = {
  id: 5,
  name: 'San Francisco',
  [getKey('enabled')]: true,
};
```
Use object method shorthand.

```
// bad
const atom = {
  value: 1,

  addValue: function (value) {
    return atom.value + value;
  },
};

// good
const atom = {
  value: 1,

  addValue(value) {
    return atom.value + value;
  },
};
```
Use property value shorthand

```
const lukeSkywalker = 'Luke Skywalker';

// bad
const obj = {
  lukeSkywalker: lukeSkywalker,
};

// good
const obj = {
  lukeSkywalker,
};

```

Group your shorthand properties at the beginning of your object declaration.

```
const anakinSkywalker = 'Anakin Skywalker';
const lukeSkywalker = 'Luke Skywalker';

// bad
const obj = {
  episodeOne: 1,
  twoJediWalkIntoACantina: 2,
  lukeSkywalker,
  episodeThree: 3,
  mayTheFourth: 4,
  anakinSkywalker,
};

// good
const obj = {
  lukeSkywalker,
  anakinSkywalker,
  episodeOne: 1,
  twoJediWalkIntoACantina: 2,
  episodeThree: 3,
  mayTheFourth: 4,
};
```
Only quote properties that are invalid identifiers.

```
// bad
const bad = {
  'foo': 3,
  'bar': 4,
  'data-blah': 5,
};

// good
const good = {
  foo: 3,
  bar: 4,
  'data-blah': 5,
};
```

Do not call Object.prototype methods directly.

```
// bad
console.log(object.hasOwnProperty(key));

// good
console.log(Object.prototype.hasOwnProperty.call(object, key));

// best
const has = Object.prototype.hasOwnProperty; // cache the lookup once, in module scope.
console.log(has.call(object, key));
/* or */
import has from 'has'; // https://www.npmjs.com/package/has
console.log(has(object, key));
```
Prefer the object spread syntax over Object.assign to shallow-copy objects. Use the object rest parameter syntax to get a new object with certain properties omitted.

// very bad
const original = { a: 1, b: 2 };
const copy = Object.assign(original, { c: 3 }); // this mutates `original` ಠ_ಠ
delete copy.a; // so does this
```
// bad
const original = { a: 1, b: 2 };
const copy = Object.assign({}, original, { c: 3 }); // copy => { a: 1, b: 2, c: 3 }

// good
const original = { a: 1, b: 2 };
const copy = { ...original, c: 3 }; // copy => { a: 1, b: 2, c: 3 }

const { a, ...noA } = copy; // noA => { b: 2, c: 3 }
```

Thanks for your time.
Next time, I will post about the important usage of Array in ES6+
Event Storming
Tags: eventdriven, beginners, todayilearned, braziliandevs
Published: 2022-05-13 01:06:20

## Today I Learned 11/05/2022

- [O que é](#o-que-é)
- [Mapeamento dos eventos](#mapeamento-dos-eventos)
- [Cronologia](#cronologia)
- [Origem dos eventos](#origem-dos-eventos)
- [Formação de agregados](#formação-de-agregados)
- [Eventos pivotais](#eventos-pivotais)



## O que é
Técnica criada por Alberto Brandolini que ajuda a entender de forma mais clara o domínio das aplicações através dos eventos gerados por elas.

Normalmente acontece em forma de workshop. É uma dinâmica de grupo envolvendo domain experts e a área técnica.

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

Ele é feito usando post its de cores diferentes como podemos ver na imagem, cada cor tem um significado
 
## Mapeamento dos eventos

#### Laranja - Evento de dominio
![PostIt laranja](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/osn7y4u90mzvx4lgea88.png)

- verbo sempre no passado
- relevante para experts de domínio
- pode ser representado por um postit maior para representar o final de uma fase

#### Azul - Comandos
![PostIt azul](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/egl4mgdbvk5zgdd8z4eu.png)

- representa o que aconteceu no sistema para o evento ter sido gerado

#### Amarelo - Persona
![PostIt amarelo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19bqv74xfh7d3yb8xkdj.png)
 
- admin, fornecedor, etc...

#### Verde - Dados
![PostIt verde](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o99nmcckr7jp6a093wqn.png)

- dados necessários para tomar decisões
- ex: para um banco aprovar uma conta é feita uma pesquisa por varios dados dos clientes 

#### Roxo - Policy
 ![PostIt Roxo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdzwlykiknxcg30mqfuc.png)

- Quando X acontecer faça Y
- ex: quando a conta for aprovada envie um email
- pode ser feito manualmente ou automaticamente

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

Serve para definir a ordem dos eventos que podem inclusive acontecer de forma pararela
 
## Origem dos eventos
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kxtowlyocsblhlchzgt.png)

- pode ser uma ação iniciada por um usuário
- pode vir de um sistema externo
- pode ser resultado do tempo passando
- ou pode ser consequência de um outro evento

## Formação de agregados
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8l3wo4i07ftqlmjfekwr.png)

Ajuda a visualizar a formação de agregados e ter noção do tamanho desse agregado

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

São eventos que levam de uma zona para outra, por exemplo: se eu tenho um site que precisa de assinatura para acessar o evento pivotal é a assinatura ser aprovada pois esse evento vai levar da zona de assinaturas para a zona de acesso ao site
Retrospectives on the dislike button of Youtube
Tags: youtube, analytics
Published: 2022-05-13 00:23:41

Following experiments conducted earlier in 2021, Youtube had announced the removal of the "I don't like" counter from its video hosting platform. A change that aimed to protect videographers.
Then on November 10, 2021 the video hosting giant had announced the removal of the counter of "I do not like" content on its platform. A decision that the company had justified by the desire to preserve its creators from harassment and certain targeted attacks.

Initially the dislikes counter had already been temporarily removed during experiments, earlier in 2021.

Finally it is still possible to show that you don't like a video by pressing the thumb down. But the number is no longer displayed publicly. On the other hand, creators can always see it in their dashboard to get an idea of what works and what doesn't on their channel.


## PRESERVING RESERVING CONTENT CREATORS


The company had explained that it was the results of a previous experiment that led to this removal of the counter. According to the statement of Youtube, the data showed that this removal of the counter, while leaving users the opportunity to use the "I don't like" button, had led to a decrease in users who clicked on this button only to harm the creators. Malicious acts to which small channels were apparently particularly exposed. In this way, the risks of harassment will be reduced.

As a reminder, the most "disliked" video on YouTube is a video produced by the platform itself! The YouTube Rewind of 2018 has more than 15 million dislikes!

![Youtube rewind 2018 video](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cavnrbx8e4upnnyiisyy.jpg)


## MY CONCLUSION


First of all, I share the same opinion as the company. YouTube said that "we've heard in the course of the experiment that some of you have used the red thumbs counter to decide whether to watch a video or not. We know you might not agree with this decision, but we think it's the right thing to do for the platform." The decision is "one of many steps we are taking to continue to protect creators from harassment," he added. The goal is to foster respect, safety and inclusiveness on its platform, whose algorithm is sometimes accused of offering violent and offensive videos. 

Secondly, as a YouTube user, the number of Dislikes was a determining factor in deciding whether or not I could watch a video. This criterion can no longer be taken into account by users as a guarantee of quality or not of a content.

In conclusion, the decision of the giant Youtube certainly had disadvantages but with perfectly justifiable advantages. The proof, despite the 2 billion monthly users, we have rather quickly accepted this more or less radical change of the company. 


## BONUS


For all the fringe people who don't want to follow the current decision of the company 😅, you can still customize your Youtube channel to display the number of dislikes of a video. 
On that note I suggest you follow this tutorial:
https://www.youtube.com/watch?v=T5NEsBVqY28
Alexa Toolbar: Why The web site ranking Tool Closes Down, What's the alternatives?
Tags: alexa, toolbars, alternatives, ranking
Published: 2022-05-13 00:18:48

Alexa Toolbar: Why The web site ranking Tool Closes Down, What's the alternatives?

It's been a years running, now it's not existed anymore, it was given detailed information about the website and ranking and linked websites, and related competitions and similar websites, now it's gone...

The reason for this is the loss or low costs covered by profits, which cases to give up on the project. 

What is the alternatives?

Or nothing can be existing in order to replace the market gab?
What's the alternative to stumpleupon toolbar? it was a great experience and it was a great tool.
Tags: stumbleupon, productivity, websites, bookmark
Published: 2022-05-13 00:13:19

What's the alternative to stumpleupon toolbar? it was a great experience and it was a great tool.

For those who don't know, it was a tool to give you websites randomly and you upvote what you like and what you dislike, if you bored and want to surf the internet randomly and this also helps you bookmark websites as well, more virtual bookmark method.
What is the best time tracking software with screenshots that's free to use or open source?
Published: 2022-05-13 00:09:35

What is the best time tracking software with screenshots that's free to use or open source?

Well, if you are working with clients directly and want to provide proof of the work and task report, I believe that is required to have time tracking with report options, also it will be great if it have screenshots every few minutes...

Take f course optional but it will be great if it's free or open source.

Share your thoughts.