teleren/devto huggingface dataset:
Choose your pokemon
Published: 2022-04-22 14:57:38

This project is about choosing your pokemon. The first thing you will see is a Pokeball; after tapping on the ball, we will get a list of pokemon to choose from. After selecting specific pokemon, it should display the abilities and weight of each pokemon. It is similar to what we see in cartoons, how Ash Ketchum/Misty/Brock brings out a random Pokeball and with a word of the pokemon's name and pokemon comes out of the Pokeball.

To build this project, the first thing JS will listen to is an event of DOMContentLoaded; once it's done, it will make an asynchronous fetch request to the local API to fetch the list of pokemon. After receiving a success promise, it will display the list of pokemon. As it's looping through the list of pokemon, it's making another asynchronous fetch request to pokemon API with each pokemon name to fetch the abilities and weight. After it's done collecting the data, it will render the data on the screen.

This project listens to several event listeners. One of the event listeners I will mention is the "mouseover," which listens when the user hovers over an image of pokemon. It replaces it with the currently selected image at the top of the screen. It displays the abilities and weight of the pokemon.

The other thing I would like to mention is how the abilities are being rendered; since we are making another asynchronous fetch request. I have added another function to loop over the list of abilities and return the string of abilities separated with a comma using the ternary operator.
How to deal with problems
Tags: beginners, tutorial, career
Published: 2022-04-22 14:54:26

**This my method to understand my problems **

We all have problems in life and in our work .Most of the time the problem is not that big but what makes it hard is we don't know how to solve it or understand it .

I am not saying that what you are doing is wrong but sometimes you just need a fresh start or right motivation. Most of the time you need to write your problems in a paper (my preference)in more than 500 words or just a page full. If this problem is that much making you sick then it has a lot to tell. After you done that just read it and mark important points.

**Next step **

Now you have a clear understanding of what you are dealing with then its all up to you to find the answer you are looking for.

maybe this is not that useful but just give it a try and let me know in the comments . I am not an expert but will try my best


> Success Is For Those Who Think Big And Act Differently
1/100DaysOfFlutter : Dart Basics - Final v/s Const
Tags: flutter, dart, tutorial, codenewbie
Published: 2022-04-22 14:45:55

<!-- title: 1/100DaysOfFlutter : Dart Basics -->


# 1/100DaysOfFlutter : Dart Basics/Final v/s Const

## Variables in dart

1. **var**: variable can be reassigned.
2. **final**: variable can not be reassigned.
3. **const**: constant variable.

## Different between Final and Const
> in a easy way

```dart
final name;✅
// you assign value of final after declaration.
name = 'Dart'; ✅

// NOT POSSIBLE WITH DART
const pi;❌
// ERROR: cannot initialize const variable, assign a value to it.
const pi = 3.14;✅
```


## How dart code starts;
    
```dart 
void main() {
  print('Hello World');
}
```
in dart code, the **Main function** is the entry point of the program

    1. You wan to print something on the console; start with main().
    2. You want to return something; start with main().
    3. main() is starting.


## What is dart?
Dart is Static language; which meaning everything thing should have a type.
Name, Place, Animal, things
any things/ everything should have a type.

```dart
String name = 10;
int age = 10;
```

## print in dart.
    
```dart
print('1/100DaysOfFlutter : Dart Basics');
```

## String Interpolation in dart
this feature helps us to use variables in dart 

```dart
void main(){
    String name = 'Dart';
    print("Hello $name");
}
```

## Taking input in console.

```Dart

import 'dart:io';

void main(){
    stdout.write('Enter your name: ');
    String? name = stdin.readLineSync();
    // currently ignore "?"
    print('Hello $name');
}
```


## Data Types 🙈🙉🙊🐵 in dart: 

<!-- make a table with heading  datatype ; keyword  -->

**Number**: int, double, num
**String** : String
**Boolean**: bool (True or False)
**List**: List (Array)
**Map**: Map (Dictionary/ Object)
**Null**: null
**Dynamic**: *fancyname*
**Void**: void/nothing⛔
**Function**: Function/🤖


**🤝🏾Connect me on:**
**Twitter**: 🕊️[`@Abhayprajapati_`](https://twitter.com/Abhayprajapati_)
**Github**: 🐧[`@theabhayprajapati`](https://github.com/theabhayprajapati)
**Linkedin**: 📌[`@abhayprajaapati`](https://www.linkedin.com/in/abhayprajaapati/)
**Youtube**: 📺[`@Abhayprajapati`](https://www.youtube.com/channel/UCUrQHSjXEAyboKLN_M0w0Mg)
你的參數預設值不是你想的預設值
Tags: python
Published: 2022-04-22 14:45:33

撰寫函式的時候, 幫參數加上預設值是個便利的作法, 使用函式時就不一定要傳上一大堆的參數, 不過在使用參數的預設值時你可能沒有注意到預設值產生的時間點, 導致實際叫用函式時傳入了奇怪的參數值, 執行後得到異常的結果。

## 參數預設值只會在定義函式時產生 1 次

舉個例子來說, 如果我想要設計一個幫我以 hh\:mm\:ss 格式顯示時間的函式, 大概會這樣設計：

```python
>>> def print_time(t):
...     t_struct = time.localtime(t)
...     print(F'{t_struct[3]:02d}:{t_struct[4]:02d}:{t_struct[5]:02d}')
>>> 
```

實際使用時就像是這樣：

```python
>>> print_time(time.time())
22:09:19
>>> print_time(time.time())
22:09:22
>>> print_time(time.time())
22:09:24
>>>
```

但是我發現使用這個函式時最常傳入的就是現在的時間, 因此就幫參數 `t` 加上預設值如下：

```python
>>> def print_time(t = time.time()):
...     t_struct = time.localtime(t)
...     print(F'{t_struct[3]:02d}:{t_struct[4]:02d}:{t_struct[5]:02d}')
>>>
```

執行看看：

```python
>>> print_time(time.time())
22:05:44
>>> print_time()
22:05:33
>>> print_time()
22:05:33
>>> print_time()
22:05:33
>>>
```

直接傳入參數沒問題, 但是使用參數預設值時怎麼怪怪的, 雖然是在傳入參數叫用後才執行, 但時間點怎麼會比較早？而且不管叫用幾次, 參數的預設值都不會變？

這主要的問題就是參數的預設值是在定義函式的時候產生, 而且只會產生 1 次, 因此上例中雖然參數的預設值是叫用 `time.time()` 的傳回值, 但這只會執行 1 次, 因此之後不論在什麼時候叫用函式, 參數的預設值都會一樣。以剛剛的例子來說, `t` 的預設值就是定義函式時叫用 `time.time()` 傳回的時間點, 之後叫用函式時都不會再重新叫用 `time.time()`, 因此 `t` 的預設值都是同一個時間。

## 檢查是否有傳入參數再計算預設值

如果你的參數預設值需要隨叫用的時間點而變化, 那麼最好改成在函式中檢查是否真的有傳入參數, 然後再計算該時間點的預設值, 例如：

```python
>>> def print_time(t = None):
...     if t == None:
...         t = time.time()
...     t_struct = time.localtime(t)
...     print(F'{t_struct[3]:02d}:{t_struct[4]:02d}:{t_struct[5]:02d}')
>>>
```

執行後就會正確了：

```python
>>> print_time()
22:16:52
>>> print_time()
22:16:54
>>> print_time(time.time())
22:17:03
>>>
```

## 小心使用可變的資料當預設值

由於參數的預設值是在定義函式時產生, 若是以可變的資料當成預設值, 而且會在函式內變更資料內容, 下一次叫用時的預設值就會是變更後的內容, 例如：

```python
>>> def add_list(l = []):
...     print(l)
...     sum = 0;
...     for i in l:
...         sum += i
...     print(sum)
...     l.append(1)
>>>
```

這個函式會把傳入的串列內容印出後加總, 並在傳入的串列尾端加入新的項目 1, 所以執行結果會是這樣：

```python
>>> add_list([1, 2, 3])
[1, 2, 3]
6
>>>
```

如果不傳入參數使用預設值, 就會是這樣：

```python
>>> add_list()
[]
0
>>> add_list()
[1]
1
>>> add_list()
[1, 1]
2
>>> add_list()
[1, 1, 1]
3
>>>
```

你會發現每次叫用得到的加總值都會增加 1, 這是因為作為預設值的串列會在每次叫用時在尾端新增項目 1, 所以下次叫用時加總值就會多 1。

如果你希望每次叫用時預設值都要是空的串列, 那就一樣可以比照前面的作法, 先檢查是否有傳入參數, 再設定參數的預設值。

## 小結

Python 雖然有許多便利的語法, 但是如果沒有注意相關的細節, 往往會在遇到異常結果時不知所措, 但只要瞭解實際的運作方式, 就可以用正確的方式撰寫程式。
Go errors handing in JavaScript
Tags: javascript, typescript, go
Published: 2022-04-22 14:17:37

For exceptions, `try...catch` is the way to go in JS. By introducing `async/await`, we can use the `try...catch` statement for asynchronous code as well:

```ts
let greeting

try {
  greeting = await helloAsync("World")
}
catch(err) {
  greeting = "Hello World"
}

console.log(greeting)

async function helloAsync(name: string): string {
  if (name === "") {
    throw new RangeError("`name` can't be empty")
  }

  return `Hello ${name}`
}
```

The code is not the most elegant. When you have more "try...catches" in code, it becomes less readable. It's easier to assume that code is "perfect" and skip error handling. As a result, many developers are scared of using `throw new Error()`.

After spending some time with `golang`, I'm amazed how well the language is designed in this matter. Inspired by `golang`, I have created a simple utility called `go` which drastically simplify the error handling:

```ts
function go<T>(promise: T) {
  return Promise.resolve(promise)
    .then(result => [null, result] as const)
    .catch(err => [err, null] as const)
}
```

Here the example from the begging:

```ts
let [err, greeting] = await go(helloAsync("Andrii"))

if (err) {
  greeting = "Hello World"
}

console.log(greeting)
```

Take care, and watch for the errors!
Screencast: Setting up a GraphQL server in Rails
Tags: rails, ruby, graphql
Published: 2022-04-22 14:02:32

In this video I'm going to walk you through setting up a GraphQL server in Ruby on Rails.

- We will install the graphql gem
- Generate some graphql types for our model
- Create mutations for login/register
- Create a query for fetching info about the current user

{% youtube izgCaExV9Uo %}
Book Club: "Test Driven Development: By Example" #5
Tags: books, tdd, discuss
Published: 2022-04-22 13:58:14

---
title: Book Club: "Test Driven Development: By Example" #5
published: true
description: A chapter by chapter discussion of "Test Driven Development By Example" by Kent Beck
tags: books, tdd, discussion
series: Book club TDD By Example
---

## Chapter 5: Franc-ly Speaking

The key problem to be solved in this part of the book, is a multi-currency sum,

```
$5 + 10CHF = $10
```
<sup>Based on the real-life example from the book's introduction, we're working with US Dollars and Swiss Francs.</sup>

This chapter lets us break down this problem, because it's not possible to test everything that needs to happen to solve this sum in one test.

The way we wrote our previous test for multiplication means it can be reused for Francs instead of Dollars. We can rush our test to green by just copying the implementation for Dollar, and this feels to me like polymorphism: we have these two currencies which have different properties but behave in essentially the same way. How exciting! But to avoid getting ahead of myself, _write a test; make it compile; watch it fail; make it pass; ✨refactor✨_.

One thing I found tricky here was, how could I use the IDE to copy the code for me - if I tried to do a refactor here then I don't want to change my existing `Dollar` tests and class. I ended up copy/pasting and manually changing the occurrences of `Dollar` and `dollar` to `Franc` and `franc`, but I didn't feel good about it. I also have tests for francs and dollars in the same test class (which might be fine, except I called my test class `DollarTest`).

For now, I'll rename my tests to `MoneyTest` which is a better description of its content, until I know more about my design. 


🔎 View my code-along repo at https://github.com/ruthmoog/test-driven-development-by-example 

-----

![Book cover](https://learning.oreilly.com/library/cover/0321146530/250w/ ) Kent Beck's "[Test Driven Development: By Example](https://www.oreilly.com/library/view/test-driven-development/0321146530/)" was released in 2002. The book aims to explain how to use TDD to write quality code that works.
Apresentando adicli - Adianti Command Line Interface
Tags: adianti, framework, php, cli
Published: 2022-04-22 13:55:44

## adicli
Adianti CLI (Command Line Interface)

<img src="https://raw.githubusercontent.com/marcelonees/adicli/master/usr/share/adicli/images/screenshot.gif" alt="adicli screenshot">

A intenção de criar esta ferramenta de linha de comando não é substituir o [Adianti Studio](https://www.adianti.com.br/studio), que é uma ferramenta incrível e que aumenta em muito a produtividade, desenvolvido por [Pablo Dall'oglio](https://dalloglio.net).

Ocorre que o Adianti Studio foi descontinuado, em favor do novo [Adianti Builder](https://www.adiantibuilder.com.br).

Dessa forma, o adicli pretende ser uma interface rápida para criação de telas baseadas em templates, que podem ser customizados para atender necessidades específicas do desenvolvedor.

Os templates inclusos no adicli são os mesmos disponíveis no [Sourceforge](https://sourceforge.net/projects/adianti/) do Adianti.

Segundo o [site](https://www.adianti.com.br) do Framework Adianti:

>A missão da Adianti é aumentar a produtividade de sua comunidade.
Queremos ser vistos como os melhores parceiros de TI para o seu negócio.

## Sistemas Operacionais (testados):
- Debian Gnu/Linux 11 (bullseye)

## Suporte aos seguintes bancos de dados:
- PostgreSQL (psql)
- MySQL (mysql)
- MariaDB (mysql)
- Firebird (isql-fb)

---

## 🚀 Como instalar
Logado como usuário root, faça:
```
git clone https://github.com/marcelonees/adicli.git
cd adicli
./install.sh
```

---

## ☕ Como usar

O adicli é intuitivo, basta passar os parâmetros solicitados e ele irá gerar o arquivo php.

```bash
adicli -c database.conf \
       -t Table \
       -T Template \
       -M Model \
       -C ClassName \
       -O [tables|templates|examples]
```

---

## Exemplos de uso

Veja outros exemplos de uso à seguir.

---

### Criar o Model de Customers

```bash
adicli -c /etc/adicli/databases/mysql.conf  \
       -T /usr/share/adicli/framework/templates/model/Model.php \
       -A "Full Name <your_email@domain" \
       -t customers \
       -M Customers \
       -C Customers > Customers.class.php
```

---

### Criar um formulário de Customers

```bash
adicli -c /etc/adicli/databases/mysql.conf  \
       -T /usr/share/adicli/framework/templates/form/StandardForm.php \
       -A "Full Name <your_email@domain" \
       -t customers \
       -M Customers \
       -C CustomersForm > CustomersForm.class.php
```

---

### Criar uma listagem de Customers

```bash
adicli -c /etc/adicli/databases/mysql.conf  \
       -T /usr/share/adicli/framework/templates/list/StandardList.php \
       -A "Full Name <your_email@domain" \
       -t customers \
       -M Customers \
       -C CustomersList > CustomersList.class.php
```

---

### Listando as tabelas de um banco de dados

```bash
adicli -c database.conf -O tables
```

---

### Listando as templates disponíveis

```bash
adicli -O templates
```

---

### Listando alguns exemplos de uso

```bash
adicli -O examples
```

---

Mais informações, você encontra no GitHub do [Adicli](https://github.com/marcelonees/adicli).
14 dicas para ir bem em testes técnicos de projeto
Tags: hackeandoatechinterview
Published: 2022-04-22 13:55:41

Testes técnicos são sempre uma etapa importante para o processo seletivo e para conseguir sua vaga. Nesse artigo vamos abordar dois testes comuns, que são o de implementação de projeto e o de análise de projeto. Confira abaixo.

## Teste técnico de implementação de projeto

Nesse teste pode ser solicitado que você desenvolva um projeto específico, ou qualquer projeto também. Podem haver definições bem diretas e específicas, ou também nenhuma definição.

1. Preferencialmente, implemente com a stack da empresa.

2. Defina o projeto que deverá implementar. Caso ainda não esteja definido, você pode se inspirar em um desses: https://twitter.com/EngineerRabbit/status/1510979766668701702

3. Utilize design patterns.

4. Implemente testes unitários.

5. Atenção para as regras de negócio. Se alguma regra de negócio não ficar clara, pergunte até ficar.

6. Faça um read.me e entregue o projeto no GitHub, não em um arquivo zip.

7. Utilize pequenos commits e com um padrão.


## Testes técnicos de Análise de projeto 

Esse teste pode estar relacionado ao código fonte da empresa, a um pequeno projeto, ou pedaços de código. Pode ser um teste enviado, onde o dev deverá responder, ou um teste hands-on (feito em entrevista técnica).

8. Indique melhorias de arquitetura e design de código. Que você pode estudar no https://refactoring.guru/pt-br.

9. Organize o código, deixando declarações de variável e funções juntas. Assim, você conseguirá realizar a análise do código de forma mais simplificada.

10. Revise o código e aplique as técnicas mais comuns de entendimento de clean code.

11. Caso tenha código escrito em diferentes línguas (inglês/português) ou que usem diferentes termos para o mesmo conceito, indique que é uma boa prática estruturar.

12. Caso seja uma analise que será realizada e depois entregue, escreva um documento estruturado com as indicações de melhoria. 

13. Analise todos os cenários de teste disponíveis, e sugira caso ainda esteja faltando algum.

14. Verifique melhorias de performance algorítmica.

**Gostou das dicas? Deixe seu comentário!**
Paracetamol.js💊| #106: Explica este código JavaScript
Tags: javascript, webdev, spanish, beginners
Published: 2022-04-22 13:39:19

## **<center>Explica este código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
const gato = {
  id: 3,
  nombre:"Michi",
  emoji: "😺",
  saludar(){
    return "Hola " + this.nombre
  },
}

console.log(gato.despedirse?.())
console.log(gato.despedirse())
```

A. `TypeError: gato.despedirse is not a function`
B. `SyntaxisError` y `undefined`
C. `undefined` y `undefined`
D. `undefined` y `TypeError: gato.despedirse is not a function`

Respuesta en el primer comentario.

---
"Comments are useless and your should not use them" I Strongly Disagree
Tags: webdev, beginners, programming, productivity
Published: 2022-04-22 13:21:18

As a beginner developer. Sometimes it can be extremely difficult to find your way through your code. You know what you're doing but you don't know how you got there or where you're going. Trust me I have the same problem. My instructor has been blessing us with encouragement to not only write comments... but to write a TON of them. Comments are such a useful tool when you're first getting started so you can write yourself steps out piece by piece before you even lay out your code so you can really go through the motions of understanding deliverables.

I've only been programming for a few weeks now and when I first started I never used to write comments because I feared my code looked messy but in reality... It helped my code look cleaner and more professional in the long run because I knew where to start and where to go. The best part is... is at the end of the day. I doesn't matter how "messy" the code looks while you're writing it as long as the final product looks nice! I don't know why so early on I was stressed about having my code look perfectly clean cut and professional level. But I'm glad I've gotten over that hump in my learning. 

Comments have truly been a life saver for me in writing my own code but I think they should be implemented in every collaborative project to ever grace the internet because without them you can get lost in one another's code when merging files towards the end of the project. Having a list anyone can see of what you were doing and where things are supposed to go can make things so much smoother and at the end of the day the comments don't effect your code beyond line by line aesthetics and code will still run even if it's ugly.
Announcing PHPWeekly's 7 Day Book Giveaway
Tags: php, mysql, programming, books
Published: 2022-04-22 13:18:27

PHP Weekly News publishes free weekly newsletters to a growing number of active subscribers from beginners to well established developers and engineers who want to keep updated on anything and everything related to PHP.

We have been provided with 7 copies of the book PHP & MYSQL: Server-side Web Development by Jon Duckett to give away in a prize draw. 

It is easy to enter. You simply need to be a subscriber 
to PHP Weekly!

For more information on our book giveaway visit: 
https://www.phpweekly.com/bookgiveaway/
Testing in Laravel
Tags: php, laravel, webdev, testing
Published: 2022-04-22 13:18:19

Great news, I found this article https://laravel-news.com/how-to-start-testing that explains simple steps for everyone who wants to enter the world of Testing in Laravel by PHPUnit and PEST and delve deeper into it, and this article will only put you on the first path and I will not talk much about the importance of Testing.

- PEST: New Popular Alternative to PHPUnit

```php
namespace Tests\Feature;
 
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
 
class ExampleTest extends TestCase
{
    public function test_the_application_returns_a_successful_response()
    {
        $response = $this->get('/');
 
        $response->assertStatus(200);
    }
}
```
Do you know how the same test would look with PEST
```php
test('the application returns a successful response')->get('/')->assertStatus(200);
```


I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
First steps with React Native Expo CLI
Tags: reactnative, beginners, mobiledev, programming
Published: 2022-04-22 13:10:56

I hope this article will help you to avoid struggling from the first seconds of working with react native app 🤞.

When I came up with the idea for the final project, I thought it would better to do a mobile app (I wish I knew before what it would cost me 🤦🏻‍♀️😆). I was unfamiliar with mobile development when I started this journey, which is why I decided that the easiest way (for newbies 🤷🏻‍♀️) is to use Expo CLI instead of React Native CLI. Additionally, due to time limits, I only used iOS platform, and focused on the main goal and functionality, rather than doing less but covering both platforms. I will tell you everything that I now know based on this experience.

If you did not install React Native yet:
1. Check that you have installed:
   - node (version 12 or higher), 
   - npm/yarn,
   - code editor. 
2. Then you can run on your terminal:
   `npm install -g expo-cli` or `yarn global add expo-cli`.
3. Create a new project: 
   `expo init YourProjectName` 
   (you can choose any template you want, I did the first one - blank). 
4. Then go to your project folder `cd YourProjectName`, open your code and run it: 
   `npm start` or `yarn start`.

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

You can open expo developer tool in the browser (first link) and manage your process from there, or you can open it on you mobile phone, just install Expo Go and scan the QR code.

If you do not want to use your phone each time you need to check your progress, you need to install Xcode, and after running `npm start` command press **I** button, it will open iOS simulator (for Android simulator you need to install Android Studio). 
Installing Xcode can take some time, it took around 1 hr. Then tap Xcode on navbar -> Open Developer Tool -> Simulator. If you want to choose another type of device, then tap File on navbar -> Open Device -> choose whatever iOS device you want.
Yeey, now you can see your first result :)

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

You can tap **R** button to reload your simulator.

If you are working not only with front end, but also back end, you need to connect them to avoid CORS issue. If you add 
`"proxy": "http://localhost:3000"` 
to your client's **package.json**, then your client will know your server api and allow you to make requests to it.

Here is a React native documentation - https://reactnative.dev/docs/environment-setup
and Expo - https://docs.expo.dev/

Good luck!
How to Move Forward in DevOps ?
Tags: devops, beginners, cloud, webdev
Published: 2022-04-22 13:06:49

After watching many educational videos and learning about the fundamentals of Devops in theory, such as Continuous Integration, Continuous Testing, Continuous Deployment, and Continuous Delivery, I struggle as a beginner to move further without adequate guidance.

I started with Jenkins and gathered some knowledge on Jenkins.

What is the next step after this?