teleren/devto huggingface dataset:
Build verified code with F*
Tags: csharp, beginners
Published: 2021-08-26 11:26:23

As much as we’ve abstracted and industrialized programming, under the hood it’s still math. The underlying mathematics of software drive our programming languages and our algorithms, providing tools and concepts we use to build code.

Code is complex, a knot of functions that execute in different ways at different times. We can think that it works, we can see that it works, but can we prove that it works? It’s possible to use some of the concepts at the heart of functional programming to design languages that produce code that’s mathematically provable, so we can use static analysis techniques to understand how our code will run under various starting conditions.

Having provable code is important when we want secure code. We need to be able to see where code violates type safety, where there’s a risk of unplanned halting or memory overruns. We know how code failures can affect the security of our applications, so we need to be able to prove that our code can never get into states that break our security model.

When we look at the cutting edge of computer science, we can see the intersection of math and code in experimental tools and languages that aim to implement some of these techniques. One such project is being worked on by Microsoft Research and the French national research center, Inria.

Introducing F*

Read More: https://hitechnoloy.ca/build-verified-code-with-f/
ความเห็นเกี่ยวกับ Haskell
Tags: haskell
Published: 2021-08-26 10:59:08

---
title: ความเห็นเกี่ยวกับ Haskell
published: true
description: 
tags: Haskell
//cover_image: https://direct_url_to_image.jpg
---

ผมเพิ่งเคยลองเขียน Haskell นิด ๆ หน่อย ๆ เรียกว่ายังรู้เรื่องก็ได้แต่อยากบันทึกความคิดของตัวเองไว้ จะผิดถูกอย่างไรก็เรียนเชิญอภิปรายได้เลยครับ

ผมมองว่าคุณของ Haskell มันทำให้ programmer เห็นได้ชัดว่า function ไหนไปยุ่งกับ IO หรือ database และ function ไหนไม่ยุ่ง

ถ้าเขียน Python ดูเผิน ๆ ไม่ไล่ดูเนื้อ function ทั้งสองแบบมันก็หน้าตาเหมือนกัน

พอเห็นได้ว่ามันต่างกัน ก็อาจจะคิดขึ้นมาได้ว่าควรเขียน function ที่อิสระจาก IO จาก database ให้มาก เพราะพวกนี้เขียนง่าย test ง่ายทั้ง auto ทั้ง manual  ทำ hot reload ก็ง่าย 

แต่คนที่สำเหนียกไม่ได้ก็มี เช่น (ผมเอง) ทำไปทำมามี monad กระจายไปทุก function
JavaScript Hoisting. What happens behind JavaScript ?
Tags: javascript, webdev, html, beginners
Published: 2021-08-26 10:53:15

If  you are looking for hoisting in JavaScript you might come across this definition.*"Hoisting is JavaScript's default behavior of moving declarations to the top".*

## But what actually happens behind JavaScript ?


Hoisting reefer to the process where compiler allocate memory for variable and function before executing code.

> **NOTE:-** Declarations that are made using var are initialized with a default value of undefined. Declarations made using let and const are not initialized as part of hoisting.

## Lets see how JavaScript work Behind?

When a JavaScript Code is executed ***Execution Context*** is created.

### What is Execution Context?

Execution Context is an abstract concept that hold information about environment within which code is being executed 
When we run JavaScript Code Execution Context is Created in two phase **Memory Creation** and **Code Execution**

![Execution Context](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g0sohf56259v1bzd0vtu.png)
if we break down Execution Context  we have 2 component
- Memory
- Code

>Memory Part is also called as *Variable Environment*.
Code Part is known as *Thread of Execution*.

Consider a code block
```javascript
var n=2;
function message(){
console.log("Hello JavaScript");
}
console.log(n);
message();
```
Output of this code block will be 
```
2
Hello JavaScript
```
When we will run this code Global Execution Context will be created and memory will be allocated to each variable and function after that only code will be allocated.
when variable n is encountered JavaScript reserve a memory space for *n*. Then JavaScript will store a special value *`undefined`*
and for function it will store entire function.

![Memory allocation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mpypupvc5dy5xzz8ay90.png)

This is what happens under the hood.
Now consider 
```javascript
console.log(n);
message();
var n=2;
function message(){
console.log("Hello JavaScript");
}
```
we are logging 'n' and calling function before declaring , we should be getting error but JavaScript works differently like we saw memory is allocated before execution 
that's why  output will be 
```
undefined
Hello JavaScript
```

so this is how it works you can access these variable and method even before actually initialization in your code
T-SQL: How To Use DENSE_RANK()
Tags: sql, tutorial, database
Published: 2021-08-26 10:40:42

In a previous lesson, we learned that we can apply ROW_NUMBER() to a data set and output the row number of the data set based on the order we specify. This means that if we have an alphabetized list, we could have ROW_NUMBER() return that list in an ascending or descending manner based on the alphabet. What may be a drawback here is that we have possible duplicates in the table, or we have possible multiples in the table and we want these multiples to be the same value rather than being different row numbers. Think of an example where we have millions of home sales organized by state and we want the states ranked by a number, rather than having the rows returned with the Nth value. In the video, [SQL Basics: How To Use DENSE_RANK() and Why](https://www.youtube.com/watch?v=guI2jEbmJ9k&list=PLHHm85xMQAYNScEs-nu9gzi2uoQ9JCCYA&index=15), we look at using DENSE_RANK() to solve a similar problem to this.

Some questions that are answered in the video:

- You'll notice that the table being used has merchants by names and product ids associated by the merchant. As a note, we would normally use an associative table here, but for the sake of this video, we are using this contrived example, as it helps to illustrate how we can use DENSE_RANK().
- In the video, both ROW_NUMBER() and DENSE_RANK() are compared side-by-side. Using merchant AAA as an example, how do these two return different values?
- Suppose we had 100 home sales by three states of Oklahoma, Kentucky and North Carolina - what would be the maximum DENSE_RANK() value if we ranked by state? What would be the maximum ROW_NUMBER()?
- In considering "groups" and "ordering" what would we use for "ordering" and what would we use for "grouping" when comparing ROW_NUMBER() or DENSE_RANK()?

Notice what happens when we add PARTITION BY with ROW_NUMBER() and then look at the data set with DENSE_RANK() in another column: we see the unique grouping (from DENSE_RANK()) along with the ordered value of that unique grouping (ROW_NUMBER() with PARTITION BY). This is extremely useful when we want to organize and order related data.

Ordering and grouping data sets help us solve numerous challenges with data. As previously mentioned, a business application of this might be home sales by state (or another area type that we want to group by). Often before we have our "final data product" we'll use this type of functionality to create our data sets and tables. We rarely will have a final data product that looks like the table in the video example: usually we'll have an associative table between these and that associative table can be created from the DENSE_RANK() functionality (provided the grouping remains the same).
Gerenciando políticas do AWS Organizations
Published: 2021-08-26 10:38:00

Beleza, passamos por uns 3 posts ate chegar aqui.  E aqui que todos os outros faz mais sentido 😁

A base das políticas do AWS Organizations são as políticas de controle de serviços (Service control policies), SCP, são aplicadas na conta e não existe hierarquia de SCP. Única ressalva e a respeito do Deny, caso algum serviço tenha uma SCP de deny esse serviço não poderá ser acessado mesmo que tenha uma allow explicita em alguma outra SCP.

Para construir uma políticas no Organizations com Terraform e bem simples, apenas precisa chamar o recurso e escrever o bloco content em json. 

```terraform
resource "aws_organizations_policy" "engenharia" {

  content = <<CONTENT
{
  "Version": "2012-10-17",
  "Statement": {
    "Effect": "Allow",
    "Action": "*",
    "Resource": "*"
  }
}
CONTENT
}
```

Alguns exemplos de SCP [aqui](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html)

Um ponto aqui que acho importante e a sintaxe do content. Ela é composta por elemento, proposito e efeitos suportados. 

Segue a tabelinha:

![sintaxe SCP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8vab3egazc3zlqbjyta6.PNG)

Tem alguma politicas que gosto de recomendar para quem está se aventurando aqui. 

Não permitir que uma conta saia da organização. 

```terraform
resource "aws_organizations_policy" "engenharia" {

  content = <<CONTENT
{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Deny",
        "Action": "organizations:LeaveOrganization",
        "Resource": "*"
    }
}

CONTENT
}
```

Restringir serviços não globais em região especifica

```terraform
resource "aws_organizations_policy" "engenharia" {

  content = <<CONTENT
{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Sid": "RestrictRegion",
          "Effect": "Deny",
          "NotAction": [
              "a4b:*",
              "budgets:*",
              "ce:*",
              "chime:*",
              "cloudfront:*",
              "cur:*",
              "globalaccelerator:*",
              "health:*",
              "iam:*",
              "importexport:*",
              "mobileanalytics:*",
              "organizations:*",
              "route53:*",
              "route53domains:*"
              "shield:*",
              "support:*",
              "trustedadvisor:*",
              "waf:*",
              "wellarchitected:*"
          ],
          "Resource": "*",
          "Condition": {
              "StringNotEquals": {
                  "aws:RequestedRegion": [
                      "sa-east-1"

							]
          }
      }
  }
}
CONTENT
}
```

Negar possibilidade de interromper o CloudWatch

```terraform
resource "aws_organizations_policy" "engenharia" {

  content = <<CONTENT
{
 "Version": "2012-10-17",
    "Statement": {
        "Effect": "Deny",
        "Action": "organizations:LeaveOrganization",
        "Resource": "*"
  }
}
CONTENT
}
```

\#vlwflw
Numeric separators
Tags: javascript
Published: 2021-08-26 10:09:24

"Numeric separators" has been added in ES2021.

Very useful to make numeric literals more readable by creating a visual separation between groups of digits 🙌

```javascript
 100000000 === 100_000_000; // true
```

## References

More details about "Numeric separators" 👇

[GitHub - tc39/proposal-numeric-separator: A proposal to add numeric literal separators in JavaScript.](https://github.com/tc39/proposal-numeric-separator)
How to achieve the "merge cells" from Excel in HTML using colspan and rowspan
Tags: html, tables
Published: 2021-08-26 10:00:29


**colspan** enables a cell to take the **width** of more than one cell or column.

![colspan visual example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bpp05wg1btmfpmgyo27k.jpg)

![colspan code example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbbxolwma78rxkktw2lr.jpg)

**rowspan** enables a cell to take the **height** of more than one cell or row.

![rowspan visual example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rh0ie3q6b252t05g1gfg.jpg)

![rowspan code example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tbqkwpaksg27dpzs99cv.jpg)

* It also works with Material UI.
SQL Performance - pagination scalability
Tags: sql, performance, pagination
Published: 2021-08-26 09:46:14

Recently I have been reading [SQL Performance Explained by Markus Winand](https://www.goodreads.com/book/show/17225810-sql-performance-explained) and I wanted to share with you what I have learned regarding SQL pagination scalability. 

Probably if you would be given the task to implement pagination, you would do it with `LIMIT` and `OFFSET` in a query. This would be completely fine, but it is good to know the limitations of it. 

The more you browse back in history (increase `LIMIT` and `OFFSET`) the more **response time increases.** This is due to the fact that DB has to count all rows until it reaches the requested page. 

An answer for that would be to include a `WHERE` statement in a query with `FETCH FIRST X ROWS ONLY`, which does not select previous results. Each "page" is limited with a different `WHERE` statement.  It also has its own limitations (harder to implement pagination, harder to browser backward, fetch arbitrary pages) but at a cost of simplicity, you get a performance increase. 

![Markus Winand SQL Performance Explained pagination scalability](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnxywsgiuwuxai5x5jnz.png "Pagination Scalability from SQL Performance Explained by Markus Winand")

Which option we should choose? As always in computer science - it depends :)

Let me know how do you use pagination and if you ever had any performance issues related to that.

P.S Remember that pagination needs deterministic order and do include `ORDER BY` in your queries when needed ;)
How to add a license to a GitHub repository in less than 2 minutes ✨
Published: 2021-08-26 09:42:48

---
canonical_url: https://blog.avneesh.tech/how-to-add-a-license-to-a-github-repository
---

### Introduction

You should add a license to your open-source projects for making it easier for people to contribute and many hackathons like the ones organized by Hashnode need a license.


### Adding the license
- Go to the repository you want to add the license to and click on Add file
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629966602935/bLSSSPG0Y.png)

- Now click on Create new file. You will be directed to a page like this

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629966899567/te7BPbLGo.png)

- Type License as the name of the file and you should see Choose a license template button in the left corner.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629966978377/hzJq8_wyE.png)

- Now choose any License you need from the options given.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629967110027/GDlMTFHZe.png)

- MIT is one of the most famous licenses, So I am gonna choose that

- You can add the two details you are asked for there.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629967236301/MkJqdtXTk.png)

- You can either create a new branch and commit the file but I am going to commit it directly to the main branch for simplicity.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629967358126/BQrBSLlHk.png)


You have added a license to your repository 🎉.

![YayCongratsGIF.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1629967422477/VknqHbxp7.gif)

Now you can add it to your Readme as well. Here is a sample of how it is added in many repositories -
```
## 📝 License

Copyright © 2021 [Avneesh Agarwal](https://github.com/avneesh0612). <br />
This project is [MIT](https://github.com/avneesh0612/next-progress-bar/blob/main/LICENSE) licensed.
```

It will look like this in your readme

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629967732952/Mcxn8hqMc.png)


**Useful links-**

[Git and GitHub Crash course](https://avneesh0612.hashnode.dev/git-and-github-crash-course)

[GitHub](https://github.com)

[All socials](https://avneesh-links.vercel.app/)
TIL: ex and ch CSS relative length units
Tags: css, frontend
Published: 2021-08-26 09:22:16

## TIL

CSS relative length units

`ch`: the width of "0" of the element's font
`ex`: the height of "x" of the element's font

[CSS values and units - Learn web development | MDN](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units)

## When to use them 🤔

They are interesting, but don't know when to use them.
`ex` seems like it can be a good choice for approximating line length of some paragraphs.
But I think I will just use `%` instead for width.
A hands-on introduction to deep reinforcement learning using Unity ML-Agents
Tags: unity3d, machinelearning, deeplearning, tutorial
Published: 2021-08-26 09:21:48

> ⚠ Note: this series is still a work in progress.

> This series is up-to-date with the latest ML-Agents Release 18

## Purpose

There are plenty of great reinforcement learning (RL) courses out there. Just to name a few:

- [Introduction to Reinforcement Learning by David Silver](https://deepmind.com/learning-resources/-introduction-reinforcement-learning-david-silver)
- [Spinning Up by OpenAI](https://spinningup.openai.com/en/latest/)
- [Reinforcement Learning Specialization by University of Alberta](https://www.coursera.org/specializations/reinforcement-learning)

But if you're anything like me, you might prefer a 'learning by doing' approach. With hands-on experience upfront, it may be easier for you to grasp the theory and math behind the algorithms later.

In this series, I'll walk you through how to use [Unity ML-Agents](https://unity.com/products/machine-learning-agents) to build a volleyball environment and train agents to play in it using deep RL.

![Ultimate Volleyball](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lr2zmstgz4f1ppihy8g5.gif)

## Why ML-Agents?

ML-Agents is an add-on for Unity (a game development platform). 

It lets us design a complex physics-rich environment without needing to build any of the physics simulation logic ourselves. It also lets us experiment with state-of-the-art RL algorithms without having to set up any boilerplate code or install additional libraries. The nice graphics and interface are a plus.

## A (very brief) overview of reinforcement learning

In a nutshell, think about how you might teach a dog a new trick, like telling it to sit:

- If it performs the trick correctly (it sits), you’ll **reward** it with a treat (*positive feedback*) ✔️
- If it doesn’t sit correctly, it doesn’t get a treat (*negative feedback*) ❌

By continuing to do things that lead to positive outcomes, the dog will learn to sit when it hears the command in order to get its treat. Reinforcement learning is a subdomain of machine learning which involves training an ‘**agent**’ (*the dog*) to learn the correct sequences of **actions** to take (*sitting*) on its **environment** (*in response to the command ‘sit’*) in order to maximize its **reward** (*getting a treat*). 

This can be illustrated more formally as:

![Sutton and Barto](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x1zs6o1jtkn5ccfxgnwr.png)

Source: [Sutton & Barto](http://incompleteideas.net/book/bookdraft2017nov5.pdf)

For more on the theory, check out:

- [A (Long) Peek into Reinforcement Learning by Lilian Weng](https://lilianweng.github.io/lil-log/2018/02/19/a-long-peek-into-reinforcement-learning.html)
- [Reinforcement Learning: An Introduction by Sutton & Barto](https://web.stanford.edu/class/psych209/Readings/SuttonBartoIPRLBook2ndEd.pdf)
bearings market: What will be the Short-term Impact of Coronavirus?

Tags: bearing, market
Published: 2021-08-26 09:14:18

The global bearings market is expected to rise with an impressive CAGR and generate the highest revenue by 2026. Fortune Business Insights™ in its latest report published this information. The report is titled "Bearings Market Research Report offers exclusive insights into key trends, growth drivers, major restraints and leading companies with global competitive scope". The report discusses research objectives, research scope, methodology, timeline and challenges during the entire forecast period. It also offers an exclusive insight into various details such as revenues, market share, strategies, growth rate, product & their pricing by region/country for all major companies.

For More Information Visit @ https://www.fortunebusinessinsights.com/industry-reports/bearings-market-101608

The report provides a 360-degree overview of the market, listing various factors restricting, propelling, and obstructing the market in the forecast duration. The report also provides additional information such as interesting insights, key industry developments, detailed segmentation of the market, list of prominent players operating in the market, and other biogas market trends. The report is available for sale on the company website.

The Report Covers the Following, Major Points Precisely:

• Top Players That Are Operating in the Global Market
• Market Segmentation 
• Regional Analysis
• Deep Insights into the Market with Detailed Table of Content and Figures
• Global Market Predictions for Five Decades.

Key Questions Answered:

What are the key technological and Industrial Separator Market trends shaping the market?
What are the key opportunities in the market?
What are the key companies operating in the market?
Which company accounted for the highest market share?
Why Choose Fortune Business Insights?
What is the market size and growth rate of the global and regional market by various segments?
What is the market size and growth rate of the market for selective countries?
Which region or sub-segment is expected to drive the market in the forecast period?
What Factors are estimated to drive and restrain the Industrial Separator Market growth?
React Crash Course for Beginners 2021
Tags: react, javascript, beginners, tutorial
Published: 2021-08-26 09:11:31

React is the one of the most widely used JavaScript Library for sure.

Being good in React, will fetch you more job offers with good salary and benefits.

For any developer or new learner, its always good to start learning thee concepts of a any framework or library by start working on small Tasks or Assignments.

 That really make you assess yourself of where you are and how much you know.

I have made a video that illustrates how to start working on creating web page from the scratch. 

Prerequisites :
* Knowledge of HTML & CSS
* At least 2 months experience in JavaScript
* ES6 knowledge is an added advantage
  What you are gonna Learn after watching this video ?
* Tools & Runtime environment required to Create & work on React 
  application
* How to Create React App & Run it ?
* Component
* Functional Component & Class Components
* State
* Creating Simple RestAPI using NodeJs
* Fetching data from usersAPI
Watch Video & Kindly Subscribe to channel and encourage me to do more videos

{% youtube hilGMj8KNcs %}
How to stop VSCode showing "|REVERTING" in terminal bash for a failed revert
Tags: vscode, gitbash, git, cli
Published: 2021-08-26 09:10:20

Hi, I've tried to revert to an earlier commit, and it failed. So I did git reset --hard to reset, and it worked fine, however the above message was stuck in the git bash, so I found this: https://git-scm.com/docs/git-revert

git revert --quit

I know, straight forward, but took me a while to find.
Add Laravel Valet certificate to Postman
Published: 2021-09-18 17:49:04

---
title: Add Laravel Valet certificate to Postman
published: true
date: 2021-08-26 08:57:29 UTC
tags: 
canonical_url: https://dcblog.dev/add-laravel-valet-certificate-to-postman
---

 ![Add Laravel Valet certificate to Postman](https://dcblog.dev/assets/images/blog/tools/postman/add-valet-certificate-to-postman) 

When working with Postman on a local API served via Valet, you may run into the issue shown above, _SSL Error: Unable to verify the first certificate,_ well worry not, as the solution is simple.

## Step-by-step guide

1. 

Open preferences inside postman

2. 

Navigate to the ‘Certificates’ tab and turn 'CA Certificates' to 'On'

3. 

Click 'Select File' next to where it says 'PEM File'

4. 

Navigate to valets `.pem` certificate file

5. 

et voilà!

![](https://dcblog.dev/assets/images/blog/tools/postman/postman-ssl.png)

This is how it should look after completing the steps above.

The `.pem` path is:

```

/Users/<YOUR-USERNAME>/.config/valet/CA/LaravelValetCASelfSigned.pem
```