teleren/devto huggingface dataset:
How angular starts
Tags: angular, javascript, programming, typescript
Published: 2021-12-10 10:07:38

How angular starts executing?

1. There is file name called angular.json which act like a configuration for the whole application.

Its looks like this

```javascript
  "build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
        "outputPath": "dist/angular-starter",
        "index": "src/index.html",
        **"main": "src/main.ts",**
        "polyfills": "src/polyfills.ts",
        "tsConfig": "tsconfig.app.json",
        "aot": false,
        "assets": [
        "src/favicon.ico",
        "src/assets"
        ],
        "styles": [
        "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
        "src/style.css"
        ]
    }
}
```

The entry point will be mentioned in the "main" section.
Which is "**main.ts**" here.

The **main.ts** file creates a browser environment to run the app.

```javascript
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
```
Along with this it called a function called "**bootstrapModule**"

```javascript
platformBrowserDynamic().bootstrapModule(AppModule)
```

In the above code **AppModule** is getting bootstrapped.

AppModule is looks like this

```javascript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule
    ],
    providers: [],
    entryComponents: [],
    bootstrap: [AppComponent]
})
export class AppModule { }
```
If you see in the **AppModule** **AppComponent** is getting bootstrapped.

The **AppComponent** is defined in **app.component.ts** file.
Which looks like below

```javascript
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    title = 'angular';
}
```
These file interacts with the webpage and serves data to it.

After this its calls **index.html** which looks like this

```html
  <!doctype html>
  <html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Angular</title>
    <base href="/">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <app-root></app-root>
  </body>
  </html>
    
```
The html template of the root component is displayed inside the `<app-root></app-root>`
Azure Functions University - HTTP Lesson (Python)
Tags: azure, serverless, programming, python
Published: 2022-03-16 20:15:23

---
title: Azure Functions University - HTTP Lesson (Python)
published: true
date: 2021-12-10 00:00:00 UTC
tags: azure, serverless, programming, python
canonical_url: https://blog.marcduiker.nl/2021/12/10/azfuncuni-http-lesson-python.html
series: Azure Functions University
---

![Http Lesson Python](https://blog.marcduiker.nl/assets/2021/12/10/AzureFunctionsUniversity_HTTP_Lesson_python.png)

Hi serverless friends, we have a new Azure Functions University lesson for you! In this lesson we will learn how to use the HTTP trigger in Azure Functions written in Python.

<!--more-->
## Lesson

You can find the lesson on GitHub: [HTTP Trigger (Python)](https://github.com/marcduiker/azure-functions-university/blob/main/lessons/python/http/README.md).

And you can watch the video on YouTube:
{% youtube fDnPGeRTwHc %}

The lesson consists of the following exercises:

| Nr | Exercise |
| --- | --- |
| 0 | Prerequisites |
| 1 | Creating a Function App |
| 2 | Changing the template for GET requests |
| 3 | Changing the template for POST requests |
| 4 | Adding a new function for POST requests |
| 5 | Homework |
Building a Twitter Spaces clone in React Native
Tags: react, reactnative, programming, tutorial
Published: 2021-12-10 09:20:34

In the mood to learn something new over the weekend?🧑‍💻 

100ms 🤝 GeekyAnts

Join speaker 🎙  Vipul Bhardwaj, Senior Engineer at #NativeBase, for a webinar 🎥  with #100ms on how to build a Twitter Spaces clone with #React Native.

What would you learn?

- What is NativeBase and how to build consistent UI with it
- What is Twitter Spaces and how does it work
- How to build Twitter Spaces with 100ms React Native SDK

Sounds exciting? then register now 👇
Tune in on 🗓 18th December

https://www.100ms.live/events/twitter-spaces-clone
LeetCode - Height Checker Solution
Tags: leetcode, python, beginners
Published: 2021-12-10 09:13:47

`A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected where expected[i] is the expected height of the ith student in line.

You are given an integer array heights representing the current order that the students are standing in. Each heights[i] is the height of the ith student in line (0-indexed).

Return the number of indices where heights[i] != expected[i].`

```
**Example 1:**

Input: heights = [1,1,4,2,1,3]
Output: 3
Explanation: 
heights:  [1,1,4,2,1,3]
expected: [1,1,1,2,3,4]
Indices 2, 4, and 5 do not match.

**Example 2:**

Input: heights = [5,1,2,3,4]
Output: 5
Explanation:
heights:  [5,1,2,3,4]
expected: [1,2,3,4,5]
All indices do not match.
Example 3:

Input: heights = [1,2,3,4,5]
Output: 0
Explanation:
heights:  [1,2,3,4,5]
expected: [1,2,3,4,5]
All indices match.
 

**Constraints:**

1 <= heights.length <= 100
1 <= heights[i] <= 100
```
**_SOLUTION :
Python Code:_**

```
class Solution:
    def heightChecker(self, heights: List[int]) -> int:
        expected = sorted(heights)
        count = 0
        for i, (height, expect) in enumerate(zip(heights, expected)):
            if height != expect:
                count +=1
        return count

        
```
NEWS Application using New York Times API
Tags: javascript, webdev, beginners, tutorial
Published: 2021-12-10 07:10:52


 Hello, I am back again with a new article; In this article, I will be showing how I built a **News Website** using **NY Times API**

Consider liking and sharing the article.

Let's get started,

{% youtube https://www.youtube.com/watch?v=d_35sByyMoY %}

### Step 1 - Register Application at **NY Times Developers**
- Go to [https://developer.nytimes.com/](https://developer.nytimes.com/)
- Sign up for an account, or sign in if already exists.
- Create a **New App**
![Create a new app](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5hr1ucotcwfvqcnmyjs.png)
- And save the API Key

### Step 2 - **Code**
- Fetch
(Note API KEY in the code has been deprecated use your OWN API KEY)
```js
await fetch('https://api.nytimes.com/svc/mostpopular/v2/viewed/1.json?api-key=iDFG30D2aGpr4OWWSJ6UBMBQh2S7oZpW')
.then(d => d.json())
.then(response => {})
```

- Fetching Results
```js
for(var i = 0; i < response.results.length; i++){
            const output = document.getElementById('output');
            
            try{
                output.innerHTML += `
                    <div class="card">
                    <div class="card-body">
                    <img src="${response.results[i]['media'][0]['media-metadata'][2].url}" class="card-img-top" alt="${response.results[i]['media'][0].caption}" title="${response.results[i]['media'][0].caption}"><br>
                    <h2 class="card-title">${response.results[i].title}</h2>
                    <div class="card-text">
                        <p>${response.results[i].abstract}</p>
                    </div>
                    </div>
                    </div>
                    <br>
                    `
                console.log(response.results[i]['media'][0].caption);
            }
            catch(err){
                console.log(err);
            }
        }
```

- **Result**
![Result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8phd58ln5zlfb5tdzyw.png)

* * *

Consider liking the article if you learnt something new.
react error
Tags: javascript, react, programming
Published: 2021-12-10 08:58:31


![Uploading image](...)when i type npm start then chrome screen show this type of message , please help me to fix this error.


"
×
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `App`."
Using Docker for your Elixir Phoenix application
Tags: elixir, phoenix, docker, productivity
Published: 2021-12-10 07:43:43

A nifty way to setup an Elixir development environment is to use Docker instead of using `asdf` or installing the Elixir toolchain locally.

Docker has the option to mount a directory into the container which we can exploit to mount whatever folder we are currently in by using the unix command `pwd` (print working directory).

We can also instruct Docker to expose a port and remove the container once it is stopped. Putting these things together we can get a Elixir environment entirely contained in Docker. The base of the command would be this in bash:

```sh
docker run --mount type=bind,source=$(pwd),target=/app -p 4000:4000 --rm elixir:latest
```

From this point we can extend it to do whatever we want with Elixir, such as running `mix` commands.
Although we have to create a Docker image that has these tools contained. Here is an example of a Docker image that you can build with `docker build -t elixir-env .` in the directory of the Dockerfile:

```Dockerfile
# Extend from the official Elixir image
FROM elixir:latest

RUN mix local.hex --force \
    && mix archive.install --force hex phx_new \
    && apt-get update \
    && curl -sL https://deb.nodesource.com/setup_lts.x | bash \
    && apt-get install -y apt-utils \
    && apt-get install -y nodejs \
    && apt-get install -y build-essential \
    && apt-get install -y inotify-tools \
    && mix local.rebar --force

ENV APP_HOME /app
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME

EXPOSE 4000

CMD ["mix", "phx.server"]
```

After creating the image and tagging it with `elixir-env` we can create a Phoenix application by running that container in bash:

```sh
docker run --mount type=bind,source=$(pwd),target=/app -p 4000:4000 --rm elixir-env:latest mix phx.server
```

But where this becomes really interesting is when you alias it to a function in your shell.
Doing that will give you the base CLI tool and make it just as accessible as having it installed locally.
To alias the function you simply do:

```sh
alias mix="docker run --mount type=bind,source=$(pwd),target=/app -p 4000:4000 --rm elixir:latest mix"
```

From here we can simply use `mix` to run any further invocations of that container. Thus we can replace it with the local installation and be oblivious to it running through Docker.

This technique is quite powerful for testing out environments or if you can't get a specific program to run locally on your machine because of conflicting dependencies. Creating a program running in Docker saves you from dealing with global dependencies and allows you the flexibility of a clean installation.
PBNs are a hot topic
Published: 2021-12-10 07:37:11

PBNs are a hot topic, but not all companies are aware of the importance of them. In this article, I will explain why buying links from PBNs is worth it and how to go about it.

PBNs have become an important part of many digital marketing strategies that are used by companies worldwide. There are different kinds of PBNs - some work with quality links while others work on volume. As a digital marketer, you should know the difference between these two types as well as their pros and cons.

PBNs work best if they're bought at low-key or discounted rates in order to get a better ROI and value for your money. This tactic also minimizes risk while increasing brand recognition and awareness in the long term [have a peek at this web-site](https://gfbninja.com).
ASGI: A brief overview
Tags: webdev, python, asgi
Published: 2021-12-10 07:33:12

[Starlette](github.com/encode/starlette), [FastAPI](github.com/tiangolo/fastapi), [Quart](gitlab.com/pgjonees/quart), all are web-frameworks, (backend), but, they all have one more thing in common. They are based on ASGI.

In [PEP-333](python.org/dev/peps/0333), WGSI was introduced, long ago, why? To facilitate the use of any web server with any WSGI-based framework. As a result, we have Flask, Django, Pyramid and other frameworks, and WSGI servers like Gunicorn.

## Why ASGI?

ASGI stands for Asynchronous Server Gateway Interface and it lets us use any ASGI web server with any ASGI-based framework.

Pretty much the same right? But, WSGI was sync and ASGI is async (obviously).

## What should I do with this info?

ASGI makes it much easier to make a web framework (though you don't have to) and it works on three components. ``scope``, ``send`` and ``recieve``.

## Scope

The scope is a python-dictionary object that contains information about the connection. Such as, is it http or https or ws(websocket) or wss(ws secured) or something else.

Eg:
 
```
{ 
  "type" : "http",
  "method" : "GET",
  "path" : "/api",
  "query_string" : "userid=999",
  "headers" : [
      b"accept-encoding": b"gzip, deflate, br",
      b"connection": b"keep-alive",
      b"cookie": b"a=b",
    ],
}
```


No text parsing, just use it. Pretty simple.

## Send

Sends a Python-dictionary object containing your response.

```
await send({
   'type': 'http.response.start',
   'status': 200,
   'headers': [
      b"content-type": b"text/html",
      b"date" : b"Fri, 10 Dec 2021 06:16:51 GMT",
      b"cache-control" : b"none",
      b"set-cookie": b"a=b"
    ]
})


await send({
    'type': 'http.response.body',
    'body': b"Hello user",
})
   
```

## Recieve

It is used get more info from the user after connection is established. Eg: HTTP body.

## But still, where do I use these?

It all is there in an ASGI callable as arguments.

It may be a function or a class.

Eg:
```
async def app(scope, recieve, send):
# Some logic here
```

or,
```
class App:
# other things
  async def __call__(self, scope, recieve, send):
   #Some logic here
```

## Conclusion

ASGI is used to make frameworks, but knowing it is needed for working with Starlette, and maybe other frameworks as  well. It can be used for making middlewares of other frameworks as well. It can be used for other protocols. There is a variety of things to build by following this specification. This was just a brief overview. Read the full specification at [asgi.readthedocs.org](asgi.readthedocs.org/). If you want to see an example of application of ASGI, look at an [HTTP framework named willpyre](github.com/Nafi-Amaan-Hossain/willpyre) that I made, or check some well known framework like Starlette, or Sanic.
Also, check some ASGI servers like [Uvicorn](github.com/encode/uvicorn), [Hypercorn](github.com/pgjones/hypercorn) or [Daphne](github.com/django/daphne) if you want to see how the specification is for the servers.


That was all. Hope you all stay well.
How to Implement Rate Limiting in Laravel 8
Tags: laravel
Published: 2021-12-10 07:25:19

Hello Artisan,

Do you know that you can restrict the amount of traffic for a given route or group of routes in Laravel using a rate limiter? Laravel includes powerful and customizable rate-limiting services and using that service we can define how many requests we will receive for a given route or group of routes.
So in this laravel 8 rate limiting tutorial, I will show you that how we can implement rate-limiting in Laravel using throttle middleware. So in this rate limiting laravel tutorial, you will learn how we can create laravel dynamic rate limiting system to block users too many requets. 
We will use RateLimiter facades to create rate limiting system in our Laravel application. So see the below example code of laravel throttle example with rate limiter class.

https://www.codecheef.org/article/how-to-implement-rate-limiting-in-laravel-8
Laravel 8 Upload Image to Storage Folder Example
Tags: laravel
Published: 2021-12-10 07:24:34

Hello Artisan,

In this Laravel tutorial, I am going to show you how to upload images to storage and show them in the blade file in Laravel. You know that uploading files to storage rather than the public are more secure for your application. In this example, you will learn how to upload images in storage and after uploading how to laravel display image from storage in blade we will see.
Before uploading image, we will generate image type, image path, image size, and original image name. After getting all of that information we will save that image into the database and storage and finally, we will show that image in laravel blade file.
This Laravel 8 image upload tutorial will work for your Laravel 5, 6, 7, 8 applications. So if you don't know how to upload image to storage then this example is for your. Let's start:

https://www.codecheef.org/article/laravel-8-upload-image-to-storage-folder-example
react-quickstart: A Modern Template to Jump Start your React Project
Published: 2021-12-10 07:07:55

A modern template to jump start your React project. The usual additions you make after CRA generation have already been done for you, including code styling rules, auto formatting, test setup, coverage reports, SCSS modules, redux setup and more (check the feature list below for more information). You can simply clone-build-run and start adding features, without spending time on setting up folder structures, linting, git hooks, etc.

Check it out at: https://github.com/sachie/react-quickstart
The number one recommendation - PSR-1
Tags: php, webdev
Published: 2021-12-10 07:06:27

>**Just the Gist**  
>PHP Standard Recommendation 1 (PSR-1) is Basic Coding Standards for PHP. It is a set of coding standards that gives us a recommended way to structure our code.

## The basics
Yesterday we had a first glance at PHP Standard Recommendations (PSRs). While these are not rules, they may provide just the structure needed to make spaghetti code in to lasagna. Today we see what PSR-1 (Basic Coding Standard) gives us for recommendation.

First, we use either `<?php` or `<?=` in our files. This means that we should avoid using `<?`. 
> The tag `<?` should be avoided since it can cause issues when generating XML documents. If you want to use it though, the setting `short_open_tag` in `php.ini` controls this.

Next, if we declare a new class, functions or constants in a file, we should avoid it causing side effects external to the file. This means for instance that we should not be updating any ini-settings or echoing out anything and then declare a class.

When we are on about classes, these should follow an autoloading standard. The current standard is PSR-4, which recommends us to use namespaces which goes hand-in-hand with the file structure. A class `HomeController` with a namespace `App\Controller` should be placed in folders and a file such as `App\Controller\HomeController.php`. Having multiple classes in a file is not recommended.

Following PSR-1, we get a structure that would look something like this:  
```php
<?php 
// Path: .\src\App\Controller\HelloController.php

namespace App\Controller;

class HelloController
{
    const HELLO_WORLD = 'Hello World';

    public function helloWorld()
    {
        echo self::HELLO_WORLD;
    }
}

```

What's not specified in PSR-1 is how we capitalize or underscore our variables (non-constants). All this PSR asks us is to be consistent with how we use it, be it `$PascalCase`, `$camelCase` or `$snake_case`. 

## Expanding
A closely related PSR is PSR-12 (Extended Coding Standard). PSR-12 is a recommendation that adds some additional rules to PSR-1. Among other things, it let's us know where to put our `declare` statements when present, to omit `?>` when dealing with files containing only PHP code, and how to use the `use` statements. If you feel the need to find more structure for your projects, PSR-1 and PSR-12 are good places to start!

## What about you?
Do you see any benefits of following Basic Coding Standard? Perhaps you already did, but didn't know it was PSR-1 or PSR-12 that you were following? Do you agree with PSR-1? Should PSR-1 also have given us a recommended way to write our variable-names? Comment below and let us know what you think ✍

## Further Reading
* PSR-1: Basic Coding Standard - https://www.php-fig.org/psr/psr-1/
* PSR-12: Extended Coding Standard - https://www.php-fig.org/psr/psr-12/
when if statement become AND operator
Tags: javascript, angular, vue, react
Published: 2021-12-10 07:05:56


I was going through a tutorial recently and I found out this developer kept using && operator to perform if statement. Take a look.


```
const status  = true

function logSomething(){

console.log('hello world');

}

=========if way========================


if(status) logSomething();

===================and way ======================

status && logSomething();

```
They do the same thing .Thanks for reading
Airgram - Reimagine meetings with Airgram. 
Tags: hr, engineers, journalists, freelancers
Published: 2021-12-10 06:41:53

Airgram is a meeting productivity software that helps you easily record, transcribe, and document Google Meet & Zoom calls. The vision of Airgram is to make meetings more productive and collaborative. 1) Live transcription with speaker attribution, which works in multiple languages incl. English, Spanish, French, German, Russian, Japanese, etc. 2) HD video recording (1080p) for easy review 3) Collaborative notes with timestamps 4) Integration with Slack for one-click sharing

https://www.airgram.io

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g23u8xandp3ueu8krwkn.png)
AI Mystic Release
Tags: ai, python, opensource
Published: 2021-12-10 06:38:23

Hey there Devs,
It's me Dave again....
We have created a New AI called "AI Mystic" some features are not available but...It will be available soon.
I prefer this app to run in the desktop or laptop cause in the server some modules aren't working, but if you want you can try it in the Web. This AI will soon be integrated with the [DaveWebOS](https://dev.to/david050708/daveos-free-user-friendly-1kam) soon

Live Link: https://app.codingrooms.com/w/QfGmy2bAiuK7

Thank You
La compraventa de segunda mano es cada vez más utilizada

Published: 2021-12-10 00:23:29

Dámelo Dámelo es un centro comercial en la web donde emprendedores y comercios pequeños pueden vender todo tipo de productos. Dentro de la app se puede ofertar desde un coche o un barco, hasta ropa o accesorios. La plataforma es muy variada y ofrece una amplia gama de categorías como hogar, ocio, informática, salud, entre muchos más, que le permite a los usuarios acceder a prácticamente todo lo que deseen.

La plataforma también dispone de anuncios de empleo en distintas categorías que le permite a los profesionales ampliar sus posibilidades de contratación tanto de empleos temporales como fijos.

La primera en ofrecer compraventa de artículos por municipios
El valor diferencial de Dámelo Dámelo es que es la única aplicación en la que todos los comercios de distintas áreas están en un centro comercial virtual, distribuidos por distritos y municipios. Por lo que, por ejemplo, si se quiere vender un producto en Valencia o Girona o cualquier otra parte del país, el usuario solo debe poner el filtro de la zona para encontrar los posibles compradores de la forma más rápida.

La plataforma ofrece a los usuarios la posibilidad de comunicarse de manera directa y sencilla, hasta cerrar el trato de la compraventa del producto o servicio. Tanto compradores como vendedores que desean explorar las opciones y categorías disponibles de Dámelo Dámelo, pueden crear un perfil en la web y recibir notificaciones y alertas sobre nuevos productos o servicios que les puedan interesar, todo dentro de una app rápida, segura y muy fácil de usar.
[
ver mas...](https://red-financiera.com/)