teleren/devto huggingface dataset:
Olá, venho aqui para explicar um conceito relativamente simples mas de grande importância: Funções de Alta Ordem em Java!
Tags: java, programming, map, functional
Published: 2021-05-24 22:13:12

## O que é uma função de alta ordem?
Nada mais é que uma função que retorna uma outra função ou que recebe a mesma como parâmetro.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qm8rlzltyr9ehpyashqi.png)
Como podemos ver que a função executarOperação esta recebendo outra função como parâmetro... 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q72zyra3ci4ge4porg6g.png)

Lembrando também que por ser um paradigma de programação funcional, utilizando o conceito de interfaces funcionais, ficaria dessa maneira: 
Utilizando a anotação @FunctionInterface para respeitar as regras de implementação de uma Lambda, justamente por ser uma interface com somente um método abstrato. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sr6fy1z6x46ziu3wau9r.png)

Em Java é mais comum a gente receber uma função por parâmetro do que retornar uma função, porém, com a necessidade como do exemplos de criar vários cálculos, para facilitar só basta receber os valores e apenas criar o comportamento dele.
Adding Select2 to Laravel (The Laravel-Mix Way)
Tags: laravel, webpack, jquery, npm
Published: 2021-05-24 21:54:46

I will keep adding more js package that I use or you might use when you're using jQuery in the stack, this time is `Select2`. `Select2` gives you additional input on the `<select>` element to filter the options. Now let's find out how to add it to your laravel app with Laravel-Mix.

## Prerequisites to code along

Have your own laravel app and you ever use sass/scss and javascript with laravel (using laravel-mix). Not to mention, you already have jQuery installed in your app.

## Installing Select2

Open your terminal, go to your laravel app, and here is the command to install:

```
npm install select2 --save-dev
```

## Applying Select2 JS

In your entrypoint or bootstrapped js file, you may have a similar code like this:

```js
window._ = require('lodash');

try {

    window.$ = window.jQuery = require('jquery');

} catch (error) {
    console.log(error);
}
```

now we just add the select2 below the jquery requirement and apply the select2 globally to any `<select>` element in your web (You may want to change it to your preference):

```js
window._ = require('lodash');

try {

    window.$ = window.jQuery = require('jquery');

    require('select2');
    $('select').select2();
    
} catch (error) {
    console.log(error);
}
```

## Applying Select2 CSS

At this point, your select2 won't work unless you apply the style as well. In your sass/scss entrypoint file, add this line:

```scss
...

@import "~select2/dist/css/select2.css";

...
```

## Build!

```
npm run development
``` 
or

```
npm run production
```

## Test it!

Let's put this simple `select` html element from [w3schools](https://www.w3schools.com/tags/tag_select.asp) in your web:

```html
<label for="cars">Choose a car:</label>

<select name="cars" id="cars">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>
```

And see it whether it applies or not by yourself, let me know if it doesn't 👻.


________________

```
version used:

node v14.16.0
npm 6.14.11
laravel-mix 6.0

```
How to avoid Meltdown, Spectre and CSRF Attacks on Web with CORP, CORB, and CORS?
Tags: webdev, security, cybersecurity
Published: 2021-05-24 21:33:26

A brief and useful content about the mechanics on Cross-Origin Read Blocking, Cross-Origin Resource Policy and Cross-Origin Resource Sharing against [Meltdown, Spectre](https://meltdownattack.com/) and [CSRF](https://owasp.org/www-community/attacks/csrf) Attacks.

---

## CORB

By design, **Cross-Origin Read Blocking** validates browser requests before they even reach the server using their **MIME type** as a validation rule.

To enable it, send the HTTP header `X-Content-Type-Options: nosniff`  from the server.

---

## CORP

**Cross-Origin Resource Policy** is a complementary _CORB_ mechanism for validation applied to requests flagged with `no-cors` to invalidate them if they came from different domains or origin.

Send the header `Cross-Origin-Resource-Policy` from the server with values `same-origin ` or `same-site ` to invalidate `no-cors` requests from different domains or origin.

---

## CORS

**Cross-Origin Resource Sharing** is a logical context mechanism that ensures minimal security in the way that users consume web content using browsers instructing how the browser will validate the origin of the requests.

To define rules about how the origin of the request will be identified, send the HTTP header `Access-Control-Allow-Origin` using values like `<exact_request_origin>` and even a more generic approaches using `*`.

---

### Conclusion

Hope that now you understand a bit better why to use these **Cross-Origin Resource** features

Try don't disable or ignore them in your web applications. **Spectre, CSRF, and Meltdown attacks are really dangerous**.
TIL GameCreator Ragdoll Control
Tags: todayilearned, unity3d, gamedev, gamecreator
Published: 2021-05-24 21:08:22

2021-05-24

It's often quicker/simpler/efficient to write code instead of setting up a visual script. But there's something to be said for *expressing* the same result in an elegant visual script. It's like a creative restriction.

To control a Game Creator Ragdoll, one can loop through and alter the rigid bodies that get auto-generated at runtime.

One could search for the rigid bodies by component but I opted to store them in a List of GameObjects on the Character itself. It's a small list of 10 objects: spine, head, 4 legs and 4 arm pieces.
![List of rigid bodies that make up the ragdoll, pre-stored](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2l0o1q0kysr1y19a5aii.png)

Once that's done, it's just a matter of modifying the rigid bodies by looping through the list.
![An Action that modifies and resets rigid bodies](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o3hqf599lw0dyxvmw4gv.png)
The Modify action applies some upward force and turns off `Gravity` and ensures `Is Kinematic` is not turned on.
![Modify](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snuyz7dhnun9uv0vu3hv.png)
The Reset action sets Gravity back to the original value. 
![Reset](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjmgpufpk63joh5v1xm3.png)
End result:
![Animated GIF of a ragdoll being tossed and temporarily suspended](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1qbxv64lnkc0bz9tbxv.gif)
Selenium with Python Behave (BDD)- Allure Reports
Tags: python, behave, allure
Published: 2021-05-24 21:05:09


#*Como generar reportes atractivos Allure con behave(python bdd framework)*

## 1.Estructura Proyecto Behave Framework
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/003r5kuw435gfrcf44pa.png)
 
## 2.Instalar allure-behave
  -pip install allure-behave
  -pycharm package
  -npm install -g allure-commandline --save-dev

## 3.Ejecutar tests cases  y generar archivos de reporte de tipo json
  behave -f allure_behave.formatter::AllureFormatter -o reports/ features

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/331lxkt1vn5o4jn2fz3t.png)
 

## 4.Generar reportes Allure
  allure serve reports/
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nx4qv1epdm9h49evnv5q.png)
ngx-awesome-popup Interactive modals on steroids 🚀
Tags: angular, npm, typescript, opensource
Published: 2021-05-24 20:59:35

# What is it?

It's the npm library made for the Angular 9+

# What it does?

**It provides:**
- Evoking dynamic components in popup
- Toast Notifications
- Alert Box
- Confirm Box
- Cookie GDPR banner

# Why it is better than others?

**It has:**
- Clean API
- Better documented than others
- Easy to use
- d.ts files
- Awesome snippet generator
- Ability of global or local configuration
- Predefined styles
- Easy to change colors 
- Button generator
- Simple and powerful **D**ependency **I**njection 

# Show me the API!

**Okay**

```typescript
toastNotification() {
        const newToastNotification = new ToastNotificationInitializer();
        newToastNotification.setTitle('Title!');
        newToastNotification.setMessage('Message!');
        newToastNotification.setConfig({
            LayoutType: DialogLayoutDisplay.INFO // SUCCESS | INFO | NONE | DANGER | WARNING
        });
        newToastNotification.openToastNotification$();
    }
```


```typescript
confirmBox() {
        const confirmBox = new ConfirmBoxInitializer();
        confirmBox.setTitle('Title!');
        confirmBox.setMessage('Message!');
        confirmBox.setButtonLabels('Button1', 'Button2'); 
        confirmBox.setConfig({
            LayoutType: DialogLayoutDisplay.SUCCESS // SUCCESS | INFO | NONE | DANGER | WARNING
        });
        confirmBox.openConfirmBox$().subscribe(resp => {
            // button response
        });
    }
```

```typescript
dialog() {
        const dialogPopup = new DialogInitializer(AnyAngularComponent);
        dialogPopup.setCustomData({myData}); 
        dialogPopup.setConfig({
            Width     : '500px',
        );

        dialogPopup.setButtons([
            new ButtonMaker('Submit', 'submit', ButtonLayoutDisplay.SUCCESS),
            new ButtonMaker('Cancel', 'cancel', ButtonLayoutDisplay.SECONDARY)
        ]);

        dialogPopup.openDialog$().subscribe(resp => {
            // button response
        });
    }
```

# How does it look like?

**Here's how!**

##### Toast Notifications
![Toast](https://costlydeveloper.github.io/ngx-awesome-popup/assets/toasts.gif)


##### Confirm box
![Confirm box](https://costlydeveloper.github.io/ngx-awesome-popup/assets/confirm-box-red.png)



##### Cookie banner
![Cookie banner](https://costlydeveloper.github.io/ngx-awesome-popup/assets/cookies-banner.png)

# Where to see more?

[Toast - playground](https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/toast-generator)
[Toast - StackBlitz](https://stackblitz.com/edit/minimal-toast-notification?file=src/app/app.component.ts)
[Confirm box - playground](https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/confirm-box-generator)
[Confirm box - StackBlitz](https://stackblitz.com/edit/minimal-confirm-box?file=src/app/app.component.ts)
[Dialog - playground](https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/dialog-showcase)
Using Git and GitHub to safely store your code
Published: 2021-05-24 20:18:37

For Python Frederick's July presentation, I presented on Git and GitHub for beginners who have never used either of those tools before.

In the presentation, I explained the core concepts of Git and demonstrated how to use Git with Visual Studio Code (VS Code). We covered why you would use Git and how you would use it to work with other people.

The demonstration also used GitHub to create a repository for a code project. We looked at a couple of methods of sharing code between people, including directly committing to a shared repository and working with Pull Requests.

The recording from the talk is available on YouTube. [Check it out!](https://www.youtube.com/watch?v=v98_7iHlYWM&list=PLFcKEo4b_n1wMFhbiedpMgh2VRT5uICuF)

{% youtube v98_7iHlYWM %}

<!--more-->

The material for the presentation is also available on GitHub. The presentation is in the [Python Frederick talks repository](https://github.com/python-frederick/talks/tree/master/2019-07-git-github).
DAY 2 of Coding Challenge! Forms and Ugly Tables    
Tags: html, beginners, webdev
Published: 2021-05-24 20:10:29

I'm very proud to say that I've written some of my first lines of code and drawn what I would say is a verryyy ugly chart. These concepts were easier to understand so I am very excited to start making these pages look spruced up with CSS! Even more importantly is the form infomation set to one day send to servers once it can be linked to Javascript 

Table Notes:

thead: semantically represents the header info of the table (categories to a table)

tbody: semantically represents the body info of the table (the input info)

tr: table row

th: placed for each cell

rowspan: an attribute to manipulate how many rows the info will be between. Standard set to "1"

colspan: an attribute to manipulate how many columns the info will be between. Standard set to "1"
Code:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7qrn7m4fpwbgmbb15551.PNG)

Result:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2v8w44cj1hsab9yvfek.PNG)

Forms:

button: Setting a button inside of a form will allow you to submit the form

input: this sets what type and category of info will be sent to the server
   type: what kind of data is this? (i.e. text, password, color, 
   etc.)
   id: specific to this one input. Only one named ID used per 
   input
   name: names the form sent

label: labels the input and links it with the for attribute connected to the same input ID.

code:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1swkgg7kn1i6i9cxntc.PNG)

result:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/unvi93tqgyfhkrjd55a2.PNG)
AI Seismic Fault Detection 
Tags: ai, machinelearning, deeplearning, geology
Published: 2021-05-24 19:33:27

Paradise AI ATTRIBUTE GENERATION
ATTRIBUTE GENERATION
Generate attributes to extract meaningful geological information and as input into machine learning analysis for advanced interpretation



ATTRIBUTE SELECTION
Identify attributes having the highest variance and contribution among a set of attributes in a geologic setting



MULTI-ATTRIBUTE CLASSIFICATION
Classify multiple attribute volumes simultaneously utilizing Self-Organizing Maps (SOM), an unsupervised machine learning process

Paradise AI MACHINE LEARNING GEOBODIES

MACHINE LEARNING (ML) GEOBODIES
Estimate the volume of reserves/resources and geologic features

Paradise AI DEEP LEARNING (DL) SEISMIC FACIES CLASSIFICATION

DEEP LEARNING (DL) SEISMIC FACIES CLASSIFICATION
Capture seismic facies based on distinctive seismic amplitude patterns using deep learning technology

Paradise AI DEEP LEARNING (DL) FAULT DETECTION

DEEP LEARNING (DL) FAULT DETECTION
Produce fault probability volumes based on already generated fault engines (models) or from interpreter guided trained engines

[Geoinsights](https://www.geoinsights.com/)
Conversational AI
Tags: ai, conversational, healthcare, virtualassistant
Published: 2021-05-24 19:26:31


We offer curated sets of skills for your industry that automate and resolve common use cases—delivering immediate results.
Build a virtual assistant for your business instantly. Each solution contains a suite of  industry-specific skills developed to automate and resolve all the common use cases. Embedded in every skill are multi-turn dialogs, training data, vertical models, and deep integration code. Simply import the skills you need and deploy.
[avaamo.ai](https://avaamo.ai)

[Marketing Assets](https://advertas.com)
Why should you learn Go?
Tags: go, beginners
Published: 2021-05-24 19:24:20

# Introduction
Learning a new programming language can be difficult sometimes. You may have reasons not to, possibly you're comfortable where you're at, or you may even just be a complete beginner! Whatever the case, you should (most likely) be a Gopher by the end of this post.

# Simplicity
One of the key aspects of Go is its simplicity. It's easy to read, write, and maintain. This is actually often one of the main motivators for learning the language. If you have experience with another programming language, then you should be able to easily pick up Go, as there is not much that is going to surprise you.

# Performance
Yes, you read it correctly. Go is both simple *and* fast. This performance spreads over a lot, so let's start with the compile time. The compilation time is actually extremely quick, often only taking seconds! Go has even been able to top languages such as Java in terms of speed. Don't believe me? Take an example instead. As you can see [here](https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/go.html) - Go tops Java in the majority of benchmarks.

# Job Opportunities
Jobs. Yes, jobs. Due to the simplicity and performance benefits, many companies have been adopting Go. So if you dream about working at a big company such as Google, Microsoft, or Facebook, then Go is most definitely a good choice. Even if not, there are *plenty* of smaller companies using Go as well. To support this, there are multiple websites dedicated to jobs just for Go! The top ones are [golangprojects](https://www.golangprojects.com/), [golang.cafe](https://golang.cafe/), and [welovego](https://www.welovegolang.com/).

# Conclusion
To conclude, those were a few (of the *very* many) reasons you might want to learn Go. I hope this was helpful to you, and if you have any feedback or critiques then feel free to drop a comment!
Facebook launches Dynaboard an evaluation-as-a-service for NLP
Tags: machinelearning, nlp, news
Published: 2021-05-24 19:16:40

In Natural Language Processing it is very difficult to gauge the performance of a model. Facebook has launched **Dynaboard** which ranks state-of-the-art language models like **BERT**, **RoBERTa**, **ALBERT**, **T5**, and **DeBERTa** on four common NLP tasks. The tasks are- 

* Natural Language Inference
* Question Answering
* Sentiment Analysis
* Hate Speech

For evaluating the models for these tasks first a new performance evaluation parameter was created that is known as **Dynascore**.
It takes into consideration different metrics which include 

* __Accuracy__ -  how many examples did the model get right as a percentage
* __Compute__ - To account for computation, we measure the number of examples that a model can process per second on its instance in our evaluation cloud
* __Memory__ - We average the memory usage over the duration that the model is running, with measurements taken each N seconds
* __Robustness__ - We evaluate robustness of a model's prediction by measuring changes after adding perturbations to the examples
* __Fairness__ - we perform perturbations of original datasets by changing, for instance, noun phrase gender (e.g., replacing “sister” with “brother”, or “he” with “they”) and by substituting names with others that are statistically predicative of another race or ethnicity. For the purposes of Dynaboard scoring, a model is considered more “fair” if its predictions don’t change after such a perturbation


Dynascore is calculated by giving different weightage to these metrics and combining them depending on the type of task. First the tasks mentioned above which form the Dynabench were solved statically. Dynaboard has helped to make this process more dynamic.

The objectives achieved by Dynaboard are-

* Reproducibility
* Accessibility
* Backwards Compatibility
* Forward Compatibility
* Prediction Costs

To know more about Dynaboard read the official [FB blog](https://ai.facebook.com/blog/dynaboard-moving-beyond-accuracy-to-holistic-model-evaluation-in-nlp/) and to know about further details of implementation read the [paper](https://dynabench.org/dynaboard.pdf).
What is a Smart Wi-Fi Switch ?
Tags: smartswitches, homeautomation, startup
Published: 2021-05-24 19:14:57

Smart Switches are the devices that let you access every connected device using your phones. You can use them from anywhere. Offices and homes are the favorite places people want to install these switches because of the convenience they provide.

<b> What is the purpose of smart switches? </b>

The purpose or motto of these smart switches is to give you access on the go. They give you the power to command your electrical appliances to go on or off on the go. This even helps you in saving electricity as you can turn the devices off if you left them on.

<b> To know more about Smart Switches : 
Visit : </b>
<a href="https://whitelion.in/">www.whitelion.in</a>

<b> Who is WhiteLion ? </b>

WhiteLion System Pvt. Ltd is the India's Leading smart switches manufacturer. WhiteLion believes in the power of technology and understands that technology improves lives. With this belief in mind, we have proceeded thus far into the terrain of <a href="https://whitelion.in/home-automation/">Home Automation</a> through our smart switches. In a short span, WhiteLion has become the largest manufacturer of smart switches in India. We wish to provide our customers with the latest technology that is trending in the world through our own research and development efforts. We are proud to have produced all our products in-house including the software for our mobile app. Our Wi-Fi enabled smart switches can be operated with a mobile app or through smart assistants like Alexa and Google Home.

<b> You can also visit our office at : Our Location details are :</b>

Head Office : Union Heights
8th floor, A wing,
Opp.Rahulraj Mall,
Bs.lalbhai contractor stadium,
Maharana Pratap Road,
Piplod,Surat-395 007

<b> For <a href="https://whitelion.in/contact/">WhiteLion Customer Support</a> : </b>

Call @ +91-70965 26279

<b> For Sales related queries </b>, 

Call @ 

+91-74050 29863
+91-261 242 9444

<b> This is our location on Google Maps </b> : <a href="https://www.google.com/maps/place/WHITELION+%7C+Home+Automation+Solutions/@21.1537036,72.7659507,17z/data=!3m1!4b1!4m5!3m4!1s0x3be04f359af015d5:0xe3b00a0465c0603c!8m2!3d21.153852!4d72.7681182">Click here</a>
Time For Stylish E-Bikes
Tags: bicycles, ebikes, green, cycle
Published: 2021-05-24 19:10:03


I made the purchase because it has rear and front basket connections. I get to deliver my sustainable orders and get a little exercise at the same timeRead more
Maleny Leal
Small Business Owner

Living in Texas, I’ve always known transportation to be capable by car and the thought of transporting any other way to be viable in cities like NYC or SF. However, since riding an [Euphree e-bike](https://euphree.com/) this has changed my mind how e-bikes are the new way of moving! I love how I save time on parking and traffic by zipping on the  e-bike to yoga, coffee, or grocery shopping. Thank you Euphree for changing my perspective and bringing convenience into my life!Read more
Ivana Chen
strategy consultant

"I had so much fun riding the Euphree e-bike with my friends - exploring the city, visiting restaurants, and spending time outside! It was super comfortable and easy to ride"Read more