teleren/devto huggingface dataset:
The perfect way to Writing Code Documentation
Tags: programming, documentation, ethics, tutorial
Published: 2022-09-15 18:55:04

I have always had problems writing a well-documented code, this is pretty common for individuals who like me, work on many projects as a _one-man show_.


**The one-man show**
I was able to _juggle multiple tasks_ from different repositories, and what I thought was a _quick fix_ and an _easier way to finish tasks_ fast turned out to be hell for me in the _long run_. **Code maintenance** became a difficult and simple changes took a while before being implemented.

> How will writing clean code help

1. To have better _code documentation and understanding_
2. If you _have a team_ or want _public contributions_
3. To better maintain and build upon your repository

**After realizing**
After endless research on _proper code ethics_ that can cut across _different languages and frameworks_, I was able to compile a list of **four key practices** that helped writing _better and easy to maintain code styles_.

1. **README File** — This file should be placed at the _root of the project_. a good README file should contain **(Project description, Who maintains the project, Installation instructions, and how to contribute to the project)**

2. **Write documentation** on complicated functions — A good function documentation contains the following comments _( What a function does, what the function parameters are expected, and finally what the return response and data type will be)_ 

3. **Right Coding conventions** — proper file organization will _help contributors to find files_ and _classes easier_, applying the _right naming conventions_ might save a lot of dev time spent looking and understanding what the code means.

4. **Make Linters Your Friend** — Not everyone is comfortable with this, but having a clean code you must love linters. _Linter help to identify programming errors, bugs, stylistic and formatting errors, or even unused code_.

Want to keep in touch online? [Medium](https://medium.com/@itskenzylimon) | [Twitter](https://twitter.com/ItsKenzyLimon) | [Instagram](https://www.instagram.com/itskenzylimon) | [Behance](https://www.behance.net/itskenzylimon)
¡Como utilizar javascript en Github Actions y hacer un cocktail!
Tags: javascript, github, devops, node
Published: 2022-09-15 18:51:15

Hace tiempo que venía pensado en como podría ejecutar un bloque de código de Javascript en un step de Github Actions, ya que muchas veces se me hace incómodo tratar datos con comandos de Bash. Cuando me veo en estos casos, siempre digo: ¡Qué fácil sería hacer esto con Javascript! Una tarde me puse a ver si esto era capaz, tras varias pruebas me di cuenta de que sí que era posible.

Gracias a que los Runners de Github nativamente contienen Node.js podemos ejecutar los scripts sin problema, e incluso si utilizamos la versión v18 de Node.js podremos hacer uso de node-fetch para hacer peticiones dentro de nuestros scripts. 

Para llamar a las variables que tenemos dentro del script desde otro step, deberemos hacer console.logs de los valores de la siguiente forma:

`console.log(::set-output name=NOMBRE_VARIABLE_GITHUB_ACTION::${nombreVariableJavascript})`

Después añadiremos al mismo step un campo llamado id con el valor que identifique al script. El valor lo podremos llamar tal que así.

`echo ${{ steps.id_step.outputs.NOMBRE_VARIABLE_GITHUB_ACTION }}`

Para pasar inputs al script de Javascript, deberá ser a base de variables de entorno dentro del step, ya que pasárselas como argumentos no funciona correctamente.

Aquí se puede ver un breve ejemplo de como se haría.

```
name: Greet myself
on:
  push:
jobs:
  greet:
    runs-on: ubuntu-latest
    steps:
      - name: Get name
        run: |
          console.log(`::set-output name=name::${process.env.ENV_NAME}`)
        shell: node {0}
        id: greet
        env:
          ENV_NAME: victor

      - name: Hello Victor
        run: echo hello ${{ steps.greet.outputs.name }}
```

En [mi repositorio](https://github.com/victorargento/victorargento) de Github he subido una action que nos devuelve la receta para hacer un cocktail y hacemos uso de un script de Javascript.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrepfiyj19m4fah5ghgf.PNG)
Binary
Published: 2022-09-15 18:49:33

Vrezh Hakobyan (AUA)


As we know, people use standard numbers for their usual tasks. The system of modern numbers is based on ten digits from 0 to 9. This system is simple for humans to understand because we have used it since childhood. Although the ten-based system of numbers is the primary system that people use, it is ununderstandable for computers. Now you can ask why? To answer this question, we need to understand how computers work. Computers only can understand two conditions. These conditions are when the electricity is ON or when it's OFF. So, let's assume that the condition ON is 1 and the condition OFF is 0. Now, we have a system of two numbers called binary. But how can we represent other numbers like 3 , 10 or billion? As you noticed, we have only two digits- 0 and 1. Let's assume that we have a lamp that is turned off. Logically, we can say that it represents the number 0 zero and when we turn it on, it will mean the number 1. Now let's add one more lamp which is turned off. As a result, our first lamp is on, and the second is off. In this case, we can assume that the result of these two combined lamps is 2. This way, we can turn all lamps on to represent the number 3. So, to get the number, we can turn these two lamps on or off and then add new lamps. This principle is used in computers to understand information. From the beginning of the history of computers until now, the binary system has been the only way for people and computers to understand each other. It's possible that people will use other numbering systems in the future to program computers, but the binary system for computers will remain of the greatest inventions in history.
Kotlin 基礎 Part 3 -- 配列をひとつひとつ処理する
Tags: kotlin
Published: 2022-09-15 18:38:32


## Kotlin の共通仕様

回している中身は it でアクセスできる

---

# 元の配列を書き換えない処理

実行結果を新しい変数に入れて、それを使う。

---

## forEach

配列の中身を全て回してひとつひとつ処理を動かす
返り値はないので、結果を変数に入れることはできない。

```kotlin
numbers.forEach {number->
	println("This Unit Cost is: ${number + 440} yen.")
}
```

```kotlin
This Unit Cost is: 540 yen.
This Unit Cost is: 640 yen.
This Unit Cost is: 740 yen.
```

---


## map

https://qiita.com/watame/items/87b7923d4f3f59ffb653#map

配列一つ一つに処理して,
結果を配列で返す。
イテレーション(反復される単位) は it で表現できる。

```kotlin
val numbers = listOf(100, 200, 300)
val numbersWithDeliveryCost = numbers.map { it + 440 }
println(numbersWithDeliveryCost)
```

> [540, 640, 740]

商品に配送料を追加する例。

```kotlin
val numbers = listOf(100, 200, 300)
numbers.map {number->
	println("This Unit Cost is: ${number + 440} yen.")
}
```

```php
This Unit Cost is: 540 yen.
This Unit Cost is: 640 yen.
This Unit Cost is: 740 yen.
```

商品ごとに配送料を通知する例。

forEach と同じく関数に書いておけば、即時実行される。
なので return を書かずに配列の中身一つ一つで処理を走らせるのにも使える。
必ず走らせる場合は forEach の方が望ましい？要検証

---

## filter

配列をひとつひとつ条件に照らし合わせて
結果が true だったものをまとめた配列を返す

```kotlin
	val numbers = listOf(100, 200, 300)
	val numbersUnder300 = numbers.filter {number->
		number < 300
	}
	println(numbersUnder300)
```

> [ 100, 200 ]

300 円未満の商品だけ絞り込む例。

---

## find

https://pouhon.net/kotlin-collection-method/1434/

内部の条件でみつけた最初の一つを結果にいれる

ひとつしか返ってこない。

```kotlin
	val numbers = listOf(100, 200, 300)
	val firstNumbersUnder300 = numbers.find {number->
		number < 300
	}
	println(firstNumbersUnder300)
```

> 100

300 未満は 100 と 200 があるが
最初にヒットした 100 しか返ってこない。

---

## sorted

https://kotlinlang.org/docs/collection-ordering.html#natural-order

元の配列をソートしたインスタンスを作成する。

```kotlin
	val numbers = listOf(9,5,2,3,100,5,1)
	val sortedNumbers = numbers.sorted()
	println(sortedNumbers)
```

> [1, 2, 3, 5, 5, 9, 100]

// TODO 日付 

---

# 元の配列を書き換える

配列に対して実行するものなので、元の配列が書き換わる。
普通に listOf で作った配列には使えない。
専用の書き換えられるリストである mutableListOf で
作った配列にのみ使用できる。

## sort

https://pouhon.net/kotlin-collection-method/1434/

```kotlin
	val numbers = mutableListOf(9,5,2,3,100,5,1)
	numbers.sort()
	println(numbers)
```

> [1, 2, 3, 5, 5, 9, 100]

元の配列自体を書き換えられる。
O que é Big Data?
Published: 2022-09-15 18:25:13

**Big Data** é um conjunto de dados ou dataset grande demais para um banco de dados convencional e que também pode ser definida como um conjunto de dados que precisa ser processado e é gerado em grande volume, velocidade e variedade. Esses dados são usados em processos de tomada de decisão em organizações afim de otimizar processos ou recursos. Esse é um conceito que se popularizou em 2008 com a ascenção das redes sociais.

Big data pode ser gerada por **máquinas**, **humanos** e **organizações**. **Máquinas** podem gerar uma quantidade enorme de dados com seus **sensores**, **cameras**, **satélites** e **rádios**. Uma caraterística popular em dados gerados por máquinas é sua necessidade de processamento em tempo real para otimizar a tomada de decisão. Por exemplo um avião gera 2.5 bilhões de terabyte por ano através de seus sensores instalados nos motores. 

**Humanos** podem gerar toneladas de dados através das **mídias sociais**, subindo suas **fotos**, postando atualização de **status** e subindo **vídeos**. Uma caraterística comum de dados gerados por humanos é que em sua maioria são **desestruturados**. Já os dados que são gerados por **organizações** geralmente são informações altamente **confiáveis**, **bem definidas** e **estruturados**. Podem ser geradas por sistemas de gestão como um ERP, produzindo dados como **registros** e **transações**.

Fonte: https://www.iosrjournals.org/iosr-jce/papers/conf.15013/Volume%202/1.%2001-05.pdf?id=7556
Resume Review - Summer 23 internship
Tags: resumereview, softwareengineer, developer
Published: 2022-09-15 17:55:44

Hi all. Please review my resume and provide your feedbacks. All suggestions are appreciated. I am applying for summer 23 internships.
Resume Link: https://drive.google.com/file/d/1iNOJJBY_ipFiDmtIsSEbwtwhtPU1HYg2/view?usp=sharing
Thanks in advance.
using related_name in Django
Tags: django, python, webdev
Published: 2022-09-15 17:18:54


*In this Blog we are going to talk about, How to use the `related_name` parameter in Django. When we create any type of relating in Django, Django by Default creates a backward relating or you can say it is a reverse relation. with the `related_name` attribute, we can give a name to the reverse relation.*

*Let’s try to understand this with an example:-*

```python
from django.db import models
from django.contrib.auth.models import User
# Create your models here.

class Note(models.Model):
    user = models.ForeignKey(User,on_delete=models.CASCADE)
    content = models.TextField()
```

> *in the upper model, we have one too many relations, a user can create as many notes as many he wants. Lets’ try to access all the notes of a currently logged-in user*

```python
def get_notes(request):
    user = request.user
    notes = Notes.objects.filter(user = user)    
    context = {
        "notes":notes
    }
    return render(request, 'home.html',context)
```

*Here we directly access all the notes of currently logged-in users using the Notes model, now let’s say I don’t want to use the Notes model to access notes of currently logged-in users, I want to access Notes for the currently logged-in user using reverse relation. We already know that Django by default creates reverse relations and we can use that relationship with the `_set` object. Here we are trying to get all the notes of currently logged-in users.*

```python
def get_notes(request):
    user = request.user   
    notes = user.notes_set.all()
    context = {
        "notes":notes
    }
    return render(request, 'home.html',context)
```
> *Here we can access all the todos of the currently logged-in users, using `_set` object.* 

*Now let’s add the related_name attribute and see what changes and simplicity it provides.*

```python
from django.db import models
from django.contrib.auth.models import User
# Create your models here.

class Note(models.Model):
    user = models.ForeignKey(User,on_delete=models.CASCADE,related_name="notes")
    content = models.TextField()
```
> *In the above code we have added `related_name = "notes"` parameter.*

```python
def get_notes(request):
    
    user = request.user
    notes = user.notes.all()
    context = {
        "notes":notes
    }
    return render(request, 'home.html',context)
```

*As you can see using the related name attribute make our code more readable, you can use the related name attribute in all types of model relations in Django.  If you want to disable Django's default reverse relation then you can add  `related_name = “+”` and this will disable Django's default reverse relation.*


```python
from django.db import models
from django.contrib.auth.models import User
# Create your models here.

class Note(models.Model):
    user = models.ForeignKey(User,on_delete=models.CASCADE,related_name="+")
    content = models.TextField()
```
> this will disable Django's default relation.
Workplace Discrimination in Software Engineering: Forms, Causes, and Effects
Tags: career, devops, webdev
Published: 2022-09-15 17:11:09

Hello!
My professor and I are working on a project about discrimination in software engineering. We are based at Seattle University and really need responses on our survey. If you work in software engineering, we would really appreciate if you took the time to take this survey. It means a lot!
Thank you!

Here is the link: http://bit.ly/SE_Discrimination
Introducing Mantine DataTable
Tags: react, typescript, datatable, mantine
Published: 2022-09-15 17:04:03

---
title: Introducing Mantine DataTable
published: true
description: A "dark-theme aware" table component for your Mantine UI data-rich applications, featuring asynchronous data loading support, pagination, multiple rows selection, column sorting, custom cell data rendering, row context menu, and more.
tags: react, typescript, datatable, mantine
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cal97bpp2lhaw7y20dr7.png
# Use a ratio of 100:42 for best results.
---

> Mantine DataTable brings datagrid-like functionality to your data-rich user interfaces.

I've been working for a while with [Mantine.dev](https://mantine.dev/) and I believe that, at the moment, it is one of the best React UI frameworks out there. But it was missing a very useful functionality, which many people in the community [kept](https://github.com/mantinedev/mantine/discussions/195) [asking](https://github.com/mantinedev/mantine/discussions/1057) about, and that was a **data-table/data-grid component**. So, being a keen supporter of open-source and the idea that we each should contribute to the development of beautiful, useful projects, I decided to build [Mantine DataTable](https://icflorescu.github.io/mantine-datatable/) and release it under MIT license.

The entire codebase is written in TypeScript, component properties are well typed and documented with JSDoc, so you can build type safe applications with confidence. The component supports asynchronous data loading, pagination, multiple rows selection, column sorting, custom cell data rendering, row context menu, global application dark theme, and more.

Head over to [the project's website](https://icflorescu.github.io/mantine-datatable/) for a quick start and to learn how to use it and configure it for various scenarios by browsing through the comprehensive list of examples.

Also, if you find the project useful, it would help a lot if you could star the [GitHub repository](https://github.com/icflorescu/mantine-datatable), [spread the word](http://twitter.com/share?text=Build%20data-rich%20React%20applications%20with%20Mantine%20DataTable&url=https%3A%2F%2Fgithub.com%2Ficflorescu%2Fmantine-datatable&hashtags=mantine%2Cdatatable%2Cdatagrid%2Creact&via=icflorescu) or hire [my services](https://github.com/icflorescu) to build front-end/full-stack stuff.
Burnout
Tags: devjournal, webdev, beginners, programming
Published: 2022-09-15 17:03:06

No. not the video game (although that was a fantastic game);

Developer Burnout is what happens when you overflow your brain with self expectations, when you want to be recognized by your superiors and/or when you plan to study for 48h in a day. 
What you want to do is plant your feet back on the ground and stop thinking for a second. Think of it as releasing your foot from the gas pedal. WE NEED to do that, weekly, if not daily.
Get yourself some hobbies and free your mind and soul from shackles and set yourself free, up to the point where you won't ruin your professional life.
Fibonacci Series Java program
Tags: fibonacci, java, javacode, tutorial
Published: 2022-09-15 16:38:08


Hi all, 
this is a sample easy program example for Fibonacci Series 
We are creating a static method from a Class called Series. 
Without creating a object of it. we are calling the method in the Main() of the program. N is the number for which you want the fibonacci Series to be created. 

```
import java.util.Scanner;

class Series
{	
	static void SeriesFibonacci(int N)
	{
		int num1 = 0;
		int num2 = 1;
		
		for (int i=0;i<=N;i++) {
			System.out.print(num1 + ",");
			int num3 = num1 + num2;
			num1 = num2;
			num2 = num3;
					
		}
	}
}

public class fibinnacoSeries {
	public static void main(String[] args) {
		
		Scanner Scanner = new Scanner(System.in);
		System.out.println("Enter the number for the fibinnanco series : ");
		Series.SeriesFibonacci(Scanner.nextInt());
		
	}

}
```

## Output for N = 20 

```
Enter the number for the fibinnanco series : 
20
0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,
```
TypeScript: why static typing matters
Tags: javascript, typescript, webdev
Published: 2022-09-15 16:34:28

**The biggest feature that TypeScript brings to the table is static types.** But, what are the advantages of static types over the dynamic typing in regular JavaScript?

A very common type of bug in JavaScript and dynamic languages happens **when you pass a variable with the wrong type or the wrong structure.** Those kind of errors are hard to catch before running the code. Also, the more complex the code is, the hardest it is to find those bugs.

Strict typing practically eliminate the entire category of bugs. When you create methods and functions, it forces you to specify the data types for the parameters and you'll get errors if you call those functions using parameters with the wrong data types. In most code editors and IDEs, you'll get the error messages as you type.

It also **makes the code more "self-documented"**, as the type information makes it easier to understand how functions, classes and other structures work. If you have to refactor code or remove technical debt, this makes the task easier.

Another advantage of static typing is that **it integrates better with autocomplete tools**, making them more accurate and reliable. That makes you write code faster. Static-typed code is easier to read for humans and for robots!

However, if you've never used a statically typed language before, it takes time to get used. At the beginning, it may feel limiting because you lose some flexibility. For example, you can't combine variables with two different data types that easily. But you can get used to it with enough practice.

---

If you liked this article, you'll love my JavaScript Newsletter.
Every other Monday, I'll send you easy and actionable steps to level up your JavaScript skills. Check it out: https://nicozerpa.com/newsletter
Serverless Design Patterns and Antipatterns | Serverless Masterclass webinar
Tags: webdev, programming, serverless, codenewbie
Published: 2022-09-15 16:26:04

> Topic: Serverless Design Patterns and Antipatterns
> Date: September 28, 2022, 8.30 am - 9.30 am PST | 9-10 pm IST

[REGISTER FOR FREE WEBINAR](https://meeting.zoho.com/meeting/register?sessionId=1036215453&src=9caba54907c651c1418499d00eb14193)

Learn the best ways to architect serverless applications, the ideal patterns and best practices for serverless applications, and the anti-patterns to avoid.

Agenda

- Understand components of serverless designs.
- Learn about reusable architectural patterns.
- Explore how you can leverage the ideal patterns in your serverless projects.
Basics of Rails Generators
Tags: rails, ruby
Published: 2022-09-15 16:22:12

Rails generators have become common practice for me since we started learning Rails because they have streamlined the process of creating files. The purpose of this blog is to have a descriptive list of the different generators available. Above all, Rails generators are terminal commands. If you follow their rules and conventions, you will be able to use them efficiently.

##Set Up
Before you start typing terminal commands, it's important to know what you are going to create. If you are creating a table, make sure you know the name of the table, the names of the columns, and the datatype for each column. While it's not obligatory to write out every piece of information in the terminal, it does make it more efficient. For each table we follow our MVC - Model, View, Controller. Therefore, we will be creating a model, a controller, and a serializer for each table.

### Model
The first generator on the list is the model. This needs to be first because it's the piece of the puzzle that sets up our table and its columns. To create the model, run this command:
`$ rails generate model table_name column_a:datatype column_b:datatype` and so on. This command also creates the migration that goes with the model.

One of my favorite things about Rails is that it lets us use 'g' instead of typing 'generate.' It also sets the default datatype to be string, so you don't need to specify that one. All other datatypes need to be specified.

### Controller
The controller is the middle-person between the model and the view. We can create it using a rails generator as follows:
`$ rails g controller table_name`

### View
For the view side of things, we use serializers. Therefore, we will use this command: 
`$ rails g serializer table_name`

### There's gotta be another way...
There is! When you are setting up a Rails application and you know that you're going to need a model, a controller, and a serializer, we can use a resource generator.

### Resource
The resource generator takes care of creating a model, a controller, a serializer, a migration, a test suite, and adds the route. The command looks like this:
`$ rails g resource table_name column_a:datatype column_b:datatype`

### What if I mess up?
If you make a mistake or need to redo any of these generators, we can use the drop command as such:
`$ rails drop [generator] table_name`
The generator depends on what you need to drop, whether it be a model, a controller, a serializer, or a resource. And again, Rails lets us use 'd' instead of the word 'drop.'

### Final thoughts
* Rails generators are a way of creating files through the terminal, but it doesn't mean it's the only way of doing things. 
* At Flatiron, we've learned to add `--no-test-framework` at the end of our rails generator commands so we don't mess with the existing test suites.