teleren/devto huggingface dataset:
[Advanced Node JS] 1 - Event Loop
Tags: javascript
Published: 2022-09-13 03:59:46

Event Loop is one of the most important concepts in JavaScript(Browser) & Node JS.

Event Loop is also the biggest difference between other classic programming languages like C/C++ or Java.

### Node JS vs Browser

Browser and Node JS both have their own Event Loop. Node JS Event Loop is a little bit complex and has more phases, but both shares the same concept. I am going to introduce the Browser's Event Loop.

[Difference Between The Event Loop in Browser and Node JS](https://dev.to/jasmin/difference-between-the-event-loop-in-browser-and-node-js-1113)


### Synchronous Call vs Asynchronous Call

**Synchronous calls goes to Stack**, just like other programming languages. They get executed until the stack is empty.

But **asynchronous calls goes to Queue (Event Loop)**. This is how Event Loop looks like in a simple code:

```js
while (queue.waitForMessage()) {
  queue.processNextMessage();
}
```

The message polling occurs when the stack is empty. **So all the synchronous calls will be processed first.** Since synchronous functions are pushed to the stack first, all queued functions(messages) need to wait to be processed.

```js

// Synchronous Call
console.log("1: Pushed to stack");

// Asynchronous Call
setTimeout(()=>{
    console.log("1: Pushed to queue");
}, 1000);

// Synchronous Call
console.log("2: Pushed to stack");

// > Output: 
// 1: Pushed to stack
// 2: Pushed to stack
// 1: Pushed to queue
```

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

The processing of functions continues until the stack is once again empty. Then, the event loop will process the next message in the queue (if there is one). Each message in the queue contains a function. **Therefore, polling a new message from queue will push a function on the top of the Stack.**

We would like to use the queue(Event Loop) when the function's workload is heavy. Normally on web browsers, when we call any Web APIs such as `setTimeout`, `eventListener` those function calls will be queued.
Add Two Numbers - LinkedList
Tags: javascript, leetcode
Published: 2022-09-13 03:58:24

Approach 1 : Simple & descriptive

```js
/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} l1
 * @param {ListNode} l2
 * @return {ListNode}
 */
var addTwoNumbers = function(l1, l2) {
    let carry = 0;
    let finalSum = []
    while(l1 || l2){  
        if(l1 && l2){
            let temp = l1.val +l2.val + carry;
            if(temp > 9){
                carry = parseInt(temp / 10);
                let lastNum = temp%10;
                finalSum.push(lastNum);
            }else{
                carry = 0;
                finalSum.push(temp)
            }
            l1 = l1.next;
            l2 = l2.next;
        } 
        
        if(l1 && !l2){
            let temp = l1.val + carry;
            if(temp > 9){
                carry = parseInt(temp / 10);
                let lastNum = temp%10;
                finalSum.push(lastNum);
            }else{
                 carry = 0;
                finalSum.push(temp)
            }
              l1 = l1.next;
        }
         if(l2 && !l1){
            let temp = l2.val + carry;
            if(temp > 9){
                carry = parseInt(temp / 10);
                let lastNum = temp%10;
                finalSum.push(lastNum);
            }else{
                 carry = 0;
                finalSum.push(temp)
            }
              l2 = l2.next;
        }
    }
    if(carry > 0){
        finalSum.push(carry)
    }
    return addATlast(finalSum);
};

const addATlast = (finalSumArray) => {
    let head = null;
    for(let i=0; i < finalSumArray.length; i++){
       head = createList(finalSumArray[i], head);
    }
    return head;
}
const createList = (val, head) => {
   if (head === null) {
        head = new ListNode(val);
      } else {
        let current = head;
        while (current.next) {
          current = current.next;
        }
        current.next = new ListNode(val);
      }
    return head;
}

```

Approach 2 : short but same as Approach 1

```js
var addTwoNumbers = function(l1, l2) {
    let head = new ListNode();
    let current = head;
    let carryOver = 0;
    
    while(l1 || l2){
        let sum = (l1?.val || 0) + (l2?.val || 0) + carryOver;
        if(sum.toString().length>1){
            carryOver = Number(sum.toString().substring(0,1))
            sum = Number(sum.toString().substring(1,2))            
        }else{
            carryOver = 0
        }
        current.next = new ListNode(sum);
        current = current.next ;
        if(l1) l1 = l1.next;
        if(l2) l2 = l2.next;
        
    }

    
    if (carryOver>0)  current.next = new ListNode(carryOver);
    return head.next;
};

```
12 Most Important Crawlers from the Internet
Tags: webdev, seo, java, opensource
Published: 2022-09-13 03:58:03

[Crawler Listing](https://www.bitslovers.com/crawler-listing/) – 12 Most Important Crawlers from the Internet

Article about Web Crawlers. 

How does the search engine work? Why crawler it's important? What are the rules? What are the most critical crawlers on the internet?

https://www.bitslovers.com/crawler-listing/
Event Hook Filtering and Okta Workflows
Tags: workflows, oktaworkflows, okta
Published: 2022-09-13 03:54:00

Event Hooks are outbound calls from Okta, sent when specified events occur in your tenant. They take the form of HTTPS REST calls to a URL you specify, encapsulating information about the events in JSON objects in the request body. These calls from Okta are meant to be used as triggers for process flows within your own software systems. Okta defines the REST API contract for the requests that it will send. Event Hooks are Okta’s implementation of the industry concept of webhooks. Okta’s Event Hooks are related to, but different from Okta [Inline Hooks](https://developer.okta.com/docs/concepts/inline-hooks/). Event Hooks are meant to deliver information about events that occurred, not offer a way to affect execution of the underlying Okta process flow. Also, Event Hooks are asynchronous calls, meaning that the process flow that triggered the Event Hook continues without stopping or waiting for any response from your external service.

To handle Event Hook calls from Okta, you have two main options:

1. Implement a web service with an Internet-accessible endpoint. It’s your responsibility to develop the code and to arrange its hosting on a system external to Okta. See this blog post for a Java example of how to code a web service endpoint: [Password Import Hook with Java Endpoint](https://iamse.blog/2022/07/06/password-import-hook/)

2. Use Okta Workflows. Using workflows to handle these events is super easy as Okta provides an Out of the Box connector that will automatically receive each type of event. Your workflow can then be used to process the event as desired. Now that Event Hook Filters are available (currently in beta at the time of writing this post), we now have an alternative way to handle Okta Events in Workflows in a more performant way.

See the fill article here: [event-hook-filtering-and-okta-workflows](https://iamse.blog/2022/07/12/event-hook-filtering-and-okta-workflows/)
Read Mifare Classic card using NFC-PCSC library - NodeJS & Socket IO
Tags: nfc, node, socketio, javascript
Published: 2022-09-13 03:49:11

## OBJECTIVE
Apply the tap and go so that the user doesn't need to interact with the person in charge on the station.

The challenge is to get the value stored in the smartcard and pass the data to the front end and then the front end will request the full information from the server.

The image below will be the setup.
![Setup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5s3j5bm3jgsn9cuzabae.jpg)

## Tools
I tried searching for a library that I can use to help me read the the smartcard sector using **NodeJS**. the client is using a MIFARE Classic card and I found this library [pokusew/nfc-pcsc](https://github.com/pokusew/nfc-pcsc) which uses a **javascript/NodeJS language**.

The nfc-pcsc have it's [own example](https://github.com/pokusew/nfc-pcsc/blob/master/examples/mifare-classic.js) for mifare-classic, the only needs to do is to apply the socketIO.

## Implementation

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2vwxe9aluu286d62uap.jpg)
This is the structure. The NodeJS App needs to be in the same station where the smartcard reader is connected. 
The client card contains a unique data as an identifier 

### Process:

1. Front end will establish a websocket to the NodeJS App
2. NodeJS App will start listening to any card that been tap.
3. If NodeJS Receive a card tapped, it will start reading the card Sector 2, after that, NodeJS App will emit to the front end what's 
the information it gets from the card. 
4. If Front end get the data, it will send the data it gets to the backend to fetch the full information.

You can check the whole code in my GitHub repo below.
https://github.com/VLDCNDN/smartcard-reader
{% embed https://github.com/VLDCNDN/smartcard-reader %}
AWS API Gateway Cheat Sheet
Tags: 30daysofaws, day05, certifieddeveloperassociate, apigateway
Published: 2022-09-13 03:02:07


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

 
- REST API, HTTP API, WebSocket API
- Deployment - point-in-time snapshot of your API Gateway API
- Endpoint - https://api-id.execute-api.region-id.amazonaws.com
    - Edge-optimized
    - Private
    - Regional
    - Stage - A logical reference to a lifecycle state of your API.
    - Route - URL path, Latency based routing,
    - Integration - Lambda, HTTP, Private VPC, CORS
    - Import/Export - Open API
    - AM User should have permission to enable logging

- Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs at any scale.
- Stage variables are name-value pairs that you can define as configuration attributes associated with a deployment stage of a REST API. The act like environment variables and can be used in your API setup and mapping templates.
- With deployment stages in API Gateway you can manage multiple release stages for each API, such as: alpha, beta, and production. Using stage variables you can configure an API deployment stage to interact with different backend endpoints.
- When you build an API Gateway API with standard Lambda integration using the API Gateway console, the **console** **automatically adds** the **required permissions**. However, when you set up a **stage variable** to call a Lambda function through our API, you must **manually** add these permissions.
- Integration timeout for AWS, Lambda, Lambda proxy, HTTP, HTTP proxy - 50 ms to 29 seconds
- You can enable **API caching** to cache your endpoint's responses, this reduces the number of calls made to your endpoint and improves the latency of requests to your API
- AWS Gateway Integration types:
  - AWS_ Proxy - lambda proxy integration
  - HTTP - http custom integration
  - HTTP_PROXY - http proxy


> - [Practice notes](https://romankurnovskii.com/en/docs/aws-certified-developer-associate/api-gateway/)
> - [Questions](https://dev.to/romankurnovskii/aws-ec2-top-
questions-certified-developer-exam-27oo)
What I learned during September 05-09 Week
Tags: beginners, javascript, java
Published: 2022-09-13 02:44:23

During this week I started to develop a full-stack application built with JavaScript : React  JS for the Frontend and Java Spring-boot for the Backend. 
I’ve learned a lot about how things work with Spring, the project is more structured and complex than Express and Node js technologies. The way Spring handle services, controllers and building API’s is secure and complete. 
On the other side connecting the backend server to React js help me to understand how things are connected and depend on each other. The main task was to build a CRUD as a To-Do list, this project help me to learn a lot and implementing it with two different technologies was a good idea. 
While I was working on the UI, React made things so much easier because as a component based library allowed me to recycle components that appeared more than one time at the interface. Also I passed the data on props to make everything dynamic. Working on the Backend building my endpoints with Spring was kind of difficult because returning status code responses isn’t as easy as returning it on Node js. 

I want to learn more about the Spring Framework and I’ll finish my To-Do app to practice my knowledge.
vscode with github
Tags: github, vscode
Published: 2022-09-13 02:38:59

1. open file folder
2. click the logo of split-road.
3. click initialize
4. add new file in traditional way
5. go back to split-road logo, add plus logo to track it ,and say something and clikc the click as committing.
6. if everything is committed for this branch, a publish icon shows up.
7. if new file modfication is then done, the publish icon goes away and step 4-5 can be repeated there.
8. Publish, you upload.
Create your first Application Load Balancer (ALB) : #LearnAWS
Published: 2022-09-13 02:28:15

In this post, you’ll learn the key steps to create your first Application Load Balancer (ALB) in AWS.

ALB is used to distribute the incoming traffic across multiple targets like EC2 instances — thereby providing single entry point to your applications. It works on Layer 7 (application layer) and provide additional functions like routing, health checks etc. You can read more about ALB in the [official AWS documentation](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html).

Here are the key steps to create your first ALB.

![Creating ALB in AWS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/li2lzv0wlwxgkkaiyw4v.png)

Do note that Target group and ALB configuration involve a few steps that are essential to make it work. Purpose of this post is to give a blueprint to make this happen, I will link to relevant content on the web that are more detailed.

Here are [step-by-step instructions](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancer-getting-started.html) from AWS to create your ALB.

> This is part of my post series, where you get concise and focused information to perform various operations in AWS. The posts give you a blueprint of activities to perform and link to deep-dive resources as required.

_This post was originally published in [Meet Ashwin blog](https://meetashwin.net/create-your-first-application-load-balancer-alb-learnaws-51416a0195e9), on 13 Sep 2022._
Create GIT Branch from a Commit
Tags: git, webdev, codenewbie, beginners
Published: 2022-09-13 01:51:27

Usually, a branch is created from another branch which is the latest HEAD commit of the branch. But what if you want to create a branch from a previous commit HEAD?

GIT branch can be created with a commit hash using the ‘git checkout’ command with ‘-b’ option and then pass a new branch name with the commit SHA.
```
$ git checkout -b <new-branch> <commit-sha>
```
Or, you can also use the 'git branch' command to create the branch without switching to the new branch.
```
$ git branch <new-branch> <commit-sha>
```

Here are the detailed steps to create a GIT branch from a commit hash with the git checkout command:

## 1. Find commit SHA with git log
The first step is to find the commit SHA from which you want to create the branch.

Use ‘git log’ command with ‘--online’ and ‘--graph’ options to get the commit SHA.
```
$ git log --oneline --graph

* 39710b8 (HEAD -> feature-2) Feature 2 added.
* ecddf76 Feature 1 added.
* 34cd5ff (new-branch, develop) Test commit.
```
Now you can see 3 commits in the git history.

## 2. Create new branch from commit SHA
Now let's assume you want to create a branch from the second commit with commit hash value 'ecddf76'.
```
$ git checkout -b feature-102 ecddf76
```

## 3. Confirm new branch head
Use 'git log' command again to make sure that the new branch is created from the correct commit SHA
```
$ git log --oneline --graph

* ecddf76 (HEAD -> feature-104) Feature 1 added.
* 34cd5ff (new-branch, develop) Test commit.
```

Now you have successfully created a new branch from a commit in the commit history.

Further reading: [https://www.atlassian.com/git/tutorials/using-branches/git-checkout](https://www.atlassian.com/git/tutorials/using-branches/git-checkout)

Original Post: [https://www.novicedev.com/blog/create-git-branch-commit](https://www.novicedev.com/blog/create-git-branch-commit)
Python can not do everything
Published: 2022-09-13 01:31:10

Many Python programmers do not enjoy coding with other programming languages. This is because they feel that other languages are much more difficult to use. They might be used to code with Python, which is the easiest programming language in the world.

If you are a hardcore Python fan, then you might be facing this issue. Being Pythonistas, we love Python so much because it is simple, popular, and powerful. Out of these, the main reason why we love Python is its simplicity.
Understand chars in 5 mins or less
Tags: programming, tutorial, productivity, c
Published: 2022-09-13 01:28:01

What is the `char` type in C and how should it be used.

Before we dive into these, let's have a quick glance at C types.

## Types In C
Types are useful to us because they allow us to handle values in a specific way.
In the backend though, C uses types to determine how much memory to allocate for a given value.
C is very particular about memory and it needs to know the type of every value.

## The Char type
This special type refers to printable and control character - _basically every key on your keyboard!_

### Declaring Characters
The syntax for declaring a variable as a `char` looks like this

```c
char character = 'Z';
```
> Note that single quotes `''` are used instead of double quotes `""`

Under the hood, all `char` type translate to an integer. So you declare character like this

```c
char c = 48
```
Or

```c
char c = '0'
```

You can view the a table of all characters and their integer representation [here](https://www.w3schools.com/charsets/ref_html_ascii.asp#:~:text=ASCII%20is%20a%207%2Dbit,are%20all%20based%20on%20ASCII.)

---

### Char Operations
C provides a library for handling characters in an exciting way 🔥
You can use that library by including the `ctype.h` library at the top of your script like this
```c
#include <ctype.h>
```
Here are a few utilities the library gives you for free...

### check is a character is lower case

```c
char c = 'a';

if (islower(c))
    // do something 
```
`islower` returns 1 if a character is lower case, and 0 if it's not.

### check is a character is upper case

```c
char c = 'A';

if (isupper(c))
    // do something 
```
`isupper` returns 1 if a character is upper case, and 0 if it's not.

### check is a character is an alphabet

```c
char c = 'A';

if (isalpha(c))
    // do something 
```
`isalpha` returns 1 if a character is an alphabet, and 0 if it's not.

### check is a character is a digit

```c
char c = '4';

if (isdigit(c))
    // do something 
```
`isdigit` returns 1 if a character is a decimal number, and 0 if it's not.

### check is a character is a digit or alphabet 

```c
char c = 'y';

if (isalphanum(c))
    // do something 
```
`isalphanum` returns 1 if a character is a digit or alphabet, and 0 if it's not.

Bet you can guess what these functions do

- `ispunc`

- `isspace`

You can also convert characters to uppercase and lowercase using `toupper` and `tolower` respectively.

```c
char c = 'A';

// Switch case
if (isupper(c))
    c = tolower(c);
else if (islower(c))
    c = toupper(c));
```

**Spoilers**
Emojis are also chars!

```c
char damn = '🥵'
```
How to create a test function and compile it using c++?
Published: 2022-09-13 00:42:35

Hi Team

I have a class that uses std::map, but i am struggling to create a test function that will test my logic scenario. The scenario is i have implemented a logic to function called void assign that loop through value associate with it and does not duplicate it.

How to i then create a test function from my class to test this scenario using c++?

`class interval_map {
	friend void IntervalMapTest();
	V m_valBegin;
	typedef std::map<K,V> m_map;
	
public:
	
	interval_map(V const& val)
	: m_valBegin(val)
	{}

	
void assign( K const& keyBegin, K const& keyEnd, V const& val )
{
    for( auto it = m_map.find( keyBegin ); * it != keyEnd; ++it )
    {
        * it = val;
    }
}

	// look-up of the value associated with key
	V const& operator[]( K const& key ) const {
		auto it=m_map.upper_bound(key);
		if(it==m_map.begin()) {
			return m_valBegin;
		} else {
			return (--it)->second;
		}
	}
};

int main()
{
    m_map map;
    m_map::iterator mpIter;
    
    int keyEnd, keyBegin;
    int count;
    
    // keep track of values with a std::set
    std::set<std::string> values;

    for(count = 0; count < 3; count++)
    {
        cin >> key;
        cin >> value;

        auto found = map.find(key);

        if(found != map.end()) // key already in map
            continue; // don't add it again

     
    }

    
    return 0;
}`

```

```
Low-Code And The Great App Development Explosion
Tags: webdev, javascript, programming, lowcode
Published: 2022-09-13 00:31:00

### How Many Apps Will Be Developed Using Low-Code In The Future?

The answer is a lot!

IDC has recently released its new IDC FutureScape predictions. Their Worldwide Cloud 2022 Predictions report included an important statistic on the use of low-code and no-code platforms:

> “By 2023, 60% of Net-New Applications Will Be Developed with No-Code/Low-Code Platforms, Up from 30% Today”


According to this statistic, the percentage of applications built using low-code/no-code will double compared to today. But the change in the actual number of applications developed will likely be even more significant.

### An Explosion In App Development

If application development occurred at a constant pace, the prediction would mean the number of applications built using low-code and no-code platforms would also double over the next 2 years. However, the number of applications developed each year is not constant. It’s rapidly increasing.

As demand for digital products and services increases, there has been a dramatic increase in the number and rate of applications produced. According to an earlier prediction by IDC in 2019:


> “By 2023, over 500 Million Digital Apps and Services Will Be Developed and Deployed Using Cloud-Native Approaches”


This is the same as the number of applications created over the past 40 years combined.

### Unleash Developer Productivity With Low-Code

Taken together, these two statistics show how truly staggering the increase in low-code and no-code application development will be. And the number of applications created each year will only continue to increase as the world becomes more digitalized.

Contrast this against the general skills shortage in software development. Better tools that simplify app development and make software developers more productive, will play an increasingly important role in app development. Not surprisingly even consultancy McKinsey says that to unleash developer productivity, leading companies need to invest in better development tools. Their research indicates that better development tools are "the top contributor to business success—enabling greater productivity, visibility, and coordination" in app development.

> "Our research shows that best-in-class [development] tools are the top contributor to business success—enabling greater productivity, visibility, and coordination."

Ready to give this a try? Build your first application using low-code today. Simply download and install Five from our website and you're ready to go!

---
Originally published at [https://five.co/low-code-and-the-great-app-development-explosion/](https://five.co) on May 20, 2022.