teleren/devto huggingface dataset:
RSocket e WebSocket
Published: 2021-06-22 00:47:36

Muito se comenta sobre adoção do paradigma reativo em aplicações backend, e nesse contexto surge algumas dúvidas.
Dentre as principais, está na comunicação http entre as aplicações, ou seja, a comunicação http é síncrona e o processamento é assíncrono. Detalhando:

cliente -> efetua uma requisição ao servidor
cliente -> aguarda a resposta

servidor -> recebe a requisição
servidor -> processa em um outro evento
servidor -> emite a resposta

cliente -> recebe a reposta e finaliza o processo

Caso deseje uma comunicação 100% assíncrona, podemos utilizar o socket reactive. Socket utiliza protocolo tcp ou http assíncrono, baseado em fluxos reativos. O dados são enviados de forma binária, onde não precisamos nos preocupar com a serialização / deserialização (por default utiliza-se json).

## Tipos de comunicação

#### Request - Response
Enviamos um mono e esperamos como resposta um outro mono

#### Request - Stream
Enviamos um mono e esperamos um flux

#### Fire-and-forget
Enviamos um mono e não esperamos resposta

#### Canal
Enviamos um flux e esperamos outro flux

## Exemplo de aplicação utilizando modelo de comunicação Canal.
Adicione as 2 dependências aos projetos client e servidor (pode utilizar o spring initializer).
```
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-rsocket</artifactId>
</dependency>

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
```
obs: caso utilize apenas o rsocket, a dependência webflux, não é necessária e configure apenas a porta tcp no servidor.

Para utilizar o protocolo http no servidor, adicione a seguinte configuração:

```
spring:
  rsocket:
    server:
      transport: websocket
      mapping-path: /rsocket
      port: 7000
```

Crie as 2 classes, tanto no client como no servidor
```
@NoArgsConstructor
@AllArgsConstructor
@Data
public class PersonIn {

    private String name;
}

@AllArgsConstructor
@Data
public class PersonOut {

    private String name;
    private String code;
}
```

Abaixo um exemplo de código no servidor e client:

Servidor: mapeamos via anotação @MessageMapping a rota que será utilizada.

```
@Controller
@Slf4j
public class PersonController {

    @MessageMapping("person")
    public Flux<PersonOut> addCode(Flux<PersonIn> fluxPerson) {
        return fluxPerson.doOnNext(p -> log.info("Receive : {}", p.toString()))
                .map(p -> {
                    var code = UUID.randomUUID().toString();
                    return new PersonOut(p.getName(), code);
                });
    }
}
```

Client: envio de um fluxo com 2 elementos e recebendo em algum momento as respostas.
```
var list2 = List.of(new PersonIn("Fabricio"), new PersonIn("Suzana"));
var fluxIn = Flux.fromIterable(list2);
RSocketRequester requester = builder.websocket(URI.create("http://localhost:8080/rsocket"));
requester.route("person")
	.data(fluxIn)
        .retrieveFlux(PersonOut.class)
	.subscribe(p -> log.info(p.toString()));
```
Socket é uma opção mais simples, para uso de uma comunicação full reactive.
Filter javascript
Tags: javascript
Published: 2021-06-22 00:41:08

Aqui vai algumas dicas de como utilizar o método "filter" em seu código !
este comando irá filtrar os "dados" que você deseja , para uma visualização ou etc...

vamos começar ! 

const car =[
{type:"ferrari",modelo:"f420",estadoDeVenda:"vendido"}{type:"volks",modelo:"v10",estadoDeVenda:"indisponível"}
]

o exemplo abaixo vai retornar apenas o "estadoDeVenda", pois estamos utilizando o método 'filter' , neste caso eu quero que retorne apenas os 'carros' que foram vendidos

const venda = car⇒car.estadoDeVenda === 'vendido'
console.log(carro.filter(Vendas))


outro exemplo 
sem criar uma variável

console.log(carro.filter(function(p){
return p.estadoVenda === 'vendido'})) 


Eai gostou dessas dicas ? caso algo não ficou claro para você deixe seu feedback !
Phaser 4 is coming
Tags: phaser, gamedev, javascript
Published: 2021-06-22 15:20:07

---
title: Phaser 4 is coming
published: true
date: 2021-06-22 00:00:00 UTC
tags: Phaser, gamedev, JavaScript
canonical_url: https://end3r.com/blog/phaser-4-is-coming/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2dzo7snx49o213uu8dz7.png
---

Something I was hoping and waiting for - [Richard Davey](https://twitter.com/photonstorm), the author of [Phaser](https://phaser.io/), is currently working on the fourth version of the framework full time.

I don’t want to put any pressure on the development of **Phaser 4** , which might, or might not get released this or the next year, but the work is currently ongoing. That’s great news, especially since previous effort was delayed by a huge [Phaser 3.50 release](https://enclavegames.com/blog/ept-updated-phaser-3-50/).

Next version will bring a whole lot of changes, way more than you could imagine: from an [organization’s repository on GitHub](https://github.com/phaserjs/phaser) and a [totally new website](https://phaser4.io/), through modularity and customizable builds, to using **TypeScript** and **ECS** internally.

At some point I was hoping to build new games for [our Grant for the Web grant](https://enclavegames.com/blog/final-grant-report/) using Phaser 4, but that ultimately never happened. This does not mean I don’t plan to, on the contrary - the eBook I’m yet to write needs examples, [Enclave Games](https://enclavegames.com/) don’t plan on stopping the [releases](https://enclavegames.com/blog/body-guard-making-of/) of [new games](https://enclavegames.com/blog/forest-cuties-making-of/), so this will happen eventually. Especially since Rich released a [Game Web Monetization plugin](https://github.com/photonstorm/gamewebmonetization) (as part of his grant) I haven’t even tried yet.

I’m seeing this version change as the time to upgrade my own tooling, coding setup, and approach, since I don’t use any package managers or build tools. That should’ve happened a few years ago already, but I was busy chasing deadlines and didn’t have much time to learn new things.

If you’re curious about the **progress of Phaser 4 development** , make sure to follow [Rich’s Dev Logs on Patreon](https://www.patreon.com/photonstorm/posts).
Debugging Boolean Expressions of Fielded Buffers
Tags: oracle, tuxedo, fml32
Published: 2021-11-03 06:23:41

---
title: Debugging Boolean Expressions of Fielded Buffers
published: true
date: 2021-06-22 00:00:00 UTC
tags: oracle,tuxedo,fml32
canonical_url: http://aivarsk.com/2021/06/22/fboolpr32/
---

I described the `SIGFPE` bomb of [Boolean Expressions](https://dev.to/aivarsk/boolean-expressions-of-fielded-buffers-5c4d-temp-slug-948738) before. Going through the list of the C functions I was reminded of the `Fboolpr32` function that prints the expression tree as it was parsed. Ten minutes later I had added it to the [Python Tuxedo library](https://pypi.org/project/tuxedo/). So let us look at the `SIGFPE` bomb again:

```
>>> import tuxedo as t
>>> t.Fboolev32({"TA_STATUS": "OK123"}, "TA_STATUS %! 'OK.*'")
Floating-point exception

```

Now we can investigate and verify how it was parsed by Oracle Tuxedo:

```
>>> t.Fboolpr32("TA_STATUS %! 'OK.*'", sys.stdout)
( ( TA_STATUS[0] ) % ( ! ( 'OK.*' ) ) )

```

Indeed, it is interpreted as the `%` modulo operation and `!` negation. And here is what the developer intended to write:

```
>>> t.Fboolpr32("TA_STATUS !% 'OK.*'", sys.stdout)
( ( TA_STATUS[0] ) !% ( 'OK.*' ) )

```

P.S. I have even implemented the `Fboolpr32` function for [my Open Source replacement of Oracle Tuxedo](https://github.com/fuxedo/fuxedo/blob/master/src/expr.cpp#L428)
Please stop using freelancer.com
Published: 2021-06-21 23:55:22

this platform is a scam you can take a look at this please remove freelancer.com https://www.complaintsboard.com/freelancercom-b102094#c1283956 , i don't know why this site still gain so much traction please use other platform other than this or find a remote job somewhere else other than this site and please share the words so that people doesn't end up like me thank you
Functional Programming: Refactoring Global Variables Out of Functions
Tags: javascript, devops, beginners, programming
Published: 2021-06-21 23:30:48

* So far, we have seen two distinct principles for functional programming:

1. Don't alter a variable or object - create new variables and objects and return them if need be from a function.

2. Declare function parameters - any computation inside a function depends only on the arguments passed to the function, and not on any global object or variable.

* Let's rewrite the code so the global array `bookList` is not changed inside either function. The `add` function should add the given `bookName` to the end of the array passed to it and return a new array (list). The `remove` function should remove the given `bookName` from the array passed to it.

* Note: Both functions should return an array, and any new parameters should be added before the `bookName` parameter.
```
var bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];

// Change code below this line
function add (bookName) {

  bookList.push(bookName);
  return bookList;
  
  // Change code above this line
}

// Change code below this line
function remove (bookName) {
  var book_index = bookList.indexOf(bookName);
  if (book_index >= 0) {

    bookList.splice(book_index, 1);
    return bookList;

    // Change code above this line
    }
}

var newBookList = add(bookList, 'A Brief History of Time');
var newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
var newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');

console.log(bookList);
```
* Answer:
```
var bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];

function add (books, bookName) {
  let copyBooks = [...books] <--- we used a copy of the array in our functions.
  copyBooks.push(bookName);
  return copyBooks ;
  
}

function remove (books, bookName) {
  let copyBooks = [...books]
  var book_index = copyBooks.indexOf(bookName); // <-- is just finding if the book exists in the copyBooks(bookList) in this case for `newestBookList` book_index would be on position 1.
  if (book_index >= 0) { // <-- (1 >= 0)
    copyBooks.splice(book_index, 1); // <-- (1, 1) removes 'On The Electrodynamics of Moving Bodies' 
    return copyBooks;

    }
}

var newBookList = add(bookList, 'A Brief History of Time');
var newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
var newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');

console.log(newestBookList); // will display ["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]
```
Full GitHub Actions Course [FREE] 💥📽️🚀
Tags: github, tutorial, devops, beginners
Published: 2021-06-21 23:24:30

In this GitHub Actions Tutorial you will be able to go from zero to hero in 90 minutes. By the end of this course, you will have a __deep understanding__ of the concepts and a great overall big picture of how GitHub Actions works and is used in the whole software development process.

And the best part? ___It is completely free, and takes only 90 minutes___!

The course is a __mix of theoretic explanations and hands-on demos__ to follow along, so you get your first hands-on experience with Actions and feel more confident using it in your projects.

The course is available here: 🤓

{% youtube TLB5MY9BBa4 %}

[Link to the video: https://youtu.be/TLB5MY9BBa4](https://youtu.be/TLB5MY9BBa4)

### Course Overview 📘

This is what this course is all about:

#### 1. GitHub Actions Overview

- What is GitHub Actions
- Advantages of GitHub Actions over other CI platforms
- Key functionalities of GitHub Actions
- Actions components: Events, Triggers, Workflows, Actions
- Types of Actions: JavaScript vs Container
- Actions Creation: Monolithic vs Chainable
- Starter workflows
- GitHub Actions Syntax
- Governance of GitHub Actions
- Debug and Troubleshooting

#### 2. Actions CI, CD & Release

- CI Workflows structure
- Matrix build
- CI Workflows examples: Docker, Web Apps, etc.
- CD Workflows structure
- CD Workflows examples: Docker, Azure, AWS, Serverless, ECS, Kubernetes, etc.
- GitHub Actions Environments overview
- Protection Rules and Approvals
- Deployment Logs overview
- GitHub Actions Environments: creation, management, and usage

#### 3. Self-Hosted Runners

- Difference between Hosted runners and Self-hosted runners
- Configure Self-hosted runners
- Runner Groups and why to use them
- Best practices for Self-hosted runners
- Dynamically scale Self-hosted runners

#### 4. Secret Management

- GitHub Actions Secrets Overview
- Type of Secrets: Organization vs Repository vs Environment
- Limitation of GitHub Secrets
- Secrets: creation, management, and usage
- Third party actions for secrets (Azure KeyVault, and more)

#### 5. Advanced GitHub Actions

- API availability
- Passing Parameters to Actions
- Repository Dispatch with custom events
- Control the flow of the workflow with Conditionals


__Like, share and follow me__ 🚀 for more content:

📽 [YouTube](https://www.youtube.com/CoderDave)
☕ [Buy me a coffee](https://buymeacoffee.com/CoderDave)
💖 [Patreon](https://patreon.com/CoderDave)
🌐 [CoderDave.io Website](https://coderdave.io)
👕 [Merch](https://geni.us/cdmerch)
👦🏻 [Facebook page](https://www.facebook.com/CoderDaveYT)
🐱‍💻 [GitHub](https://github.com/n3wt0n)
👲🏻 [Twitter](https://www.twitter.com/davide.benvegnu)
👴🏻 [LinkedIn](https://www.linkedin.com/in/davidebenvegnu/)
🔉 [Podcast](https://geni.us/cdpodcast)

<a href="https://www.buymeacoffee.com/CoderDave" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 30px !important; width: 108px !important;" ></a>

{% youtube TLB5MY9BBa4 %}
There is Always Room for Improvement - a Rails Story
Tags: rails, ruby, learning
Published: 2021-06-21 23:16:53

Before I ever considered software engineering as a career, I suggested meeting a friend for a workday at a coffee shop. At the time, I was pursuing a career as a contemporary dancer and in the midst of planning movement and music for a new dance piece that I was choreographing. My friend already worked full-time as a software engineer but also worked on freelance software projects. At my suggestion of a workday, he said “there is always more work to do” and that he could definitely use a work buddy. At the time, I didn’t think much of his wording; every field requires plenty of work. But a year later, as I transitioned to software engineering myself and enrolled in the Flatiron program, I found that phrase bouncing around in my head more and more. As I completed my third project with Flatiron — a Ruby on Rails content management system — I kept coming back to it.

There is infinite room for improvement in software development. As I planned out my application, I had a ton of ideas for really cool features. I wanted my content management system, called Cafe Directory — a user moderated resource of cafes and coffeeshops throughout the US — to have useful functionality that would allow a user to find the exact cafe that they wanted at any particular moment. I wanted it to rival GoogleMaps or Yelp, but with user generated content, a la Wikipedia. Of course all of these big names that provided inspiration are maintained by whole teams of people with significantly more knowledge and tools at their disposal that myself (at the current moment). I quickly realized that I probably couldn’t create a Cafe Directory that would allow a user to do an open-ended search by location, hours, speciality, keyword, etc in merely a few weeks. Even gathering data on all of these details would be fairly time consuming. Rather, I could create a cool application that would allow a user to filter or search by one thing, in order to practice implementing scopes. Eventually, with more time and knowledge, hopefully I could return to the application and add additional search features.

Eventually, I came to the question of “what is the point of completion?” After adding multiple validations, editing Rails form helpers, and fiddling with CSS for many hours, I decided that “completed” could be considered to be “reached” once the application met the project requirements (with a few added details that I was personally very excited about) as long as the code was fairly DRY. So about two weeks after generating my Cafe Directory Rails application with the command rails new cafe-directory, I submitted my final git push to GitHub and closed my text editor. I look forward to moving forward with my studies at Flatiron and increasing my knowledge. Perhaps as I learn more languages and frameworks, I can circle back to this app and some of the additional functionality that JavaScript enables.

** Originally published March 23, 2021 via github.io
Sharing a Sinatra Experience
Tags: sinatra, refactorit, looping
Published: 2021-06-21 23:13:04

As I neared the end of my second project with the Flatiron school, a Sinatra app using ActiveRecord, one of the most exciting parts was refactoring my code. In the beginning of my project, I was concerned about how I would receive certain pieces of user data in a consistent manner from all users. To ensure standardization of the necessary data in new user entries, I decided to use dropdown menus in several fields of my form field. This meant that users could only choose the best match from the options given, rather than input information in any form they liked. This, in turn, allowed my tables to have uniform, matching entries in their cells.

As I neared the end of my project, I was happy to see that the dropdown menus seemed to be working. On the user side (what could be seen in my browser through the Shotgun gem), my app was looking clean and organized. However, looking behind the scenes in the views, my `html.erb` view files were long, and filled with repetitive code that was very easy to get lost in. 

![un-refactored code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mu87vwib76qglh0youbt.png)


As you can see in the above image, the only thing that changes in each option of the top `<select>` field (`fertilization_schedule[value]`) is the value itself. Luckily, with the use of ERB and the ever helpful Ruby `each` method, the code was able to be cleaned a bit. 

![refactored code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vc95dzidqai4gnorz5ju.png)

For the first `<select>` field in `fertilization_schedule[value]`, I created a range from 1 to 10 and iterated over each of those numbers. I used the ERB tag `<%= %>` to place the current value of `i` inside the value attribute and also to have it render in the html itself. This ERB tag (`<%= %>`) works very similarly to string interpolation; the value of the evaluated Ruby code inside the tag is rendered as html in the view. The code containing the parts of the `each` method that should be evaluated as Ruby code but NOT rendered as html were placed inside this ERB tag `<% %>`, which evaluates Ruby code but does not output the result.

I was able to follow the same process with my `fertilization_schedule[frequency]` `<select>` field. In this case, I first created an array containing the values I wanted to output: `["day", "week", "month", "season"]`. I then iterated over this array, once again using ERB `<%= %>` to “interpolate” Ruby values I wanted to have rendered and `<% %>` to signify code that should merely run as Ruby for the proper functioning of the code. 

![browser view](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/659afl7f4zfk9lrz9wt3.png)

In the end, the user side of the experience remained the same. The dropdown menus continued to function properly. They served both to guide users about what data to input, and regulated the data that the app received. Behind the scenes however, the app now runs in a slightly more dynamically coded and responsive manner.

** Originally published February 10, 2021 via github.io
¿Existe el Desarrollador Senior o Junior?
Tags: devlive, developers
Published: 2021-06-21 23:10:07

En la industria del desarrollo de software existen múltiples perfiles principalmente basados en las tecnologías que se usan y el nivel de experiencia. Sin embardo después de 5 años de experiencia en la industria me parece que esos perfiles "Senior" o "Junior" no son tan simples de definir.

Pero antes de empezar, quiero resaltar que esta es una opinión personal por lo que tal vez mucho no estén de acuerdo con lo que este en este post pero eso es bueno ya que fortalecerá la conversación, ahora si vamos a empezar.

Imagen aquí

En diversos artículos de otros blogs o en ofertas laborales suelen definir a los perfiles junior como profesionales con no mas de 2 años de experiencia y a los senior con mas de 5 o 6 años de experiencia. Pero es ahí donde, para mi, entra lo relativo del termino, es decir experiencia en una tecnología en especifico, o quizá experiencia en el campo laboral.

Desde mi punto de vista un desarrollador senior(basado en los años de experiencia) siempre aporta muchas ideas a un equipo de trabajo, es decir, sabe como mejorar algunos procesos, conoce metodologías de desarrollo pero cuando un desarrollador con ese perfil se incorpora a un equipo de trabajo podría no estar familiarizado quizá con el stack tecnológico, por ejemplo un desarrollador web empieza a hacer desarrollo móvil, este desarrollador aportara mucho en ideas pero seguramente necesitara mentoría en algunas cosas que no conoce de la tecnología usada, entonces es un senior solo por la experiencia, o es un junior por que no conoce la tecnología al 100%.

En este sentido, lo que yo creo es que si es un senior, por que esa experiencia lo llevara a entender mejor y mas rápido otras tecnologías, es decir aun que necesitara de mentoría, ese desarrollador será capaz de resolver muchas cosas por si mismo, y aportara al equipo con ideas y propuestas, lo que es algo que suele dificultarse un poco a los Junior.

Por esta razón para mi el perfil de desarrollador senior y por ende el junior si existe, pero no será un desarrollador que conoce todas las tecnologías o muchas tecnologías si no uno que tendrá todo un set de habilidades blandas y tecnológicas que lo llevaran a tomar muchas mas y mejores decisiones de las que podría tomar un desarrollador junior.
Functional Programming: Passing Arguments to Avoid External Dependence in a Function
Tags: javascript, devops, beginners, programming
Published: 2021-06-21 23:00:38

* Continuing from the last post. We didn't alter the global variable value, but the function `incrementer` would not work without the global variable `fixedValue` being there.

* Another principle of functional programming is to always declare your dependencies explicitly. This means if a function depends on a variable or object being present, then pass that variable or object directly into the function as an argument.

* There are several good consequences from this principle. The function is easier to test, you know exactly what input it takes, and it won't depend on anything else in your program. This can give you more confidence when you alter, remove, or add new code. You would know what you can or cannot change and you can see where the potential traps are.

* Finally, the function would always produce the same output for the same set of inputs, no matter what part of the code executes it.

* Let's update the `incrementer` function to clearly declare its dependencies. Let's write the `incrementer` function so it takes an argument, and then returns a result after increasing the value by one.
```
var fixedValue = 4;

function incrementer () {

};
```
* Answer: 
```
var fixedValue = 4;

function incrementer (num) {
return num + 1;

};

console.log(incrementer(5));
```
* The function `incrementer` did not change the value of fixedValue and the function also took an argment `num`.