teleren/devto huggingface dataset:
Azure Functions University - Calling third-party REST APIs (.NET 6)
Tags: azure, serverless, programming, dotnet
Published: 2022-03-16 20:09:26

---
title: Azure Functions University - Calling third-party REST APIs (.NET 6)
published: true
date: 2022-02-13 00:00:00 UTC
tags: azure, serverless, programming, dotnet
canonical_url: https://blog.marcduiker.nl/2022/02/13/azfuncuni-callingrestapis-lesson-dotnet6.html
series: Azure Functions University
---

![Calling third-party REST APIs .NET 6](https://blog.marcduiker.nl/assets/2022/02/13/AzureFunctionsUniversity_Calling3rdpartyRESTAPIs_dotnet6.png)

Hi serverless friends, we have a new Azure Functions University lesson for you! In this lesson we will learn how to call 3rd party REST APIs in Azure Functions written in .NET 6.

<!--more-->
## Lesson

You can find the lesson on GitHub: [Calling third-party REST APIs (.NET 6)](https://github.com/marcduiker/azure-functions-university/blob/main/lessons/dotnet6/http-refit/README.md).

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

The lesson consists of the following exercises:

| Nr | Exercise |
| --- | --- |
| 0 | Prerequisites |
| 1 | Creating a default HTTP-triggered function app |
| 2 | Defining a third-party REST API |
| 3 | Adding custom API parameters |
| 4 | Homework |
node -p process.versions 
Tags: node
Published: 2022-02-12 23:53:01

```
{
  node: '16.13.0',
  v8: '9.4.146.19-node.13',
  uv: '1.42.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.17.2',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1l+quic',
  cldr: '39.0',
  icu: '69.1',
  tz: '2021a',
  unicode: '13.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}
```
What is Ory Hydra?
Tags: php, go, opensource
Published: 2022-02-12 23:48:00

I'm trying to look for something to protect your API that contains permission given by your users. I've found the thing that calls OAuth 2.0. It is difficult to understand the first time. Because when I try to google find a lot of information and sometimes it conflict and lets you misunderstand the real concept.

Until I've found this guy to make me clear about OAuth

https://www.youtube.com/watch?v=996OiexHze0

However, I still need to find a way to have an OAuth server. Firstly, I looking at Auth0 and OKta to see How it works. So luckily my friend introduces me to Ory/Hydra.

https://www.ory.sh/hydra

**What is Hydra?**
Hydra is an OAuth 2.0 and OpenID Connect Provider. In other words, an implementation of the OAuth 2.0 Authorization Framework as well as the OpenID Connect Core 1.0 framework. As such, it issues OAuth 2.0 Access, Refresh, and ID Tokens that enable third-parties to access your APIs in the name of your users.

The benefit of this project it allow to setup OAuth server separate from Authentication service. In case if you already have Authentication system. It different with awesome project like Laravel passport that have complete OAuth server include authentication system in the same place.

Hydra support container :D
It so really easily to setup Hydra with docker image. You can running OAuth server in 5 minutes XD

**Hydra integration**
Hydra allow you to integrate your existing application to your OAuth server with SDK or make a request directly to API. Unfortunately if you want to use SDK because it requires old packages. In my case, I want to using Laravel 9 that requires Guzzlehttp 7.0+, but SDK requires 6.0 because SDK has been generates from OpenAPI generator need maintainer to understand how to use it.

Sometimes we might want any packages that have less code and are compatible with Laravel. I decided to create an unofficial package instead of maintaining an existing one.

**Laravel Hydra**
https://github.com/ALTELMA/laravel-hydra

This package provides a API Client for Hydra support Laravel. Next steps will add compatible with Lumen, too.

**Conclusion**
Ory Hydra is an awesome project, but still lack of documentation and need to take time to understand for How it works? Fee free to comments to your idea
Nf
Published: 2022-02-12 23:27:17


        <i class="small-play-btn"><span class="screen-reader-text">Small toggle button</span></i>
      </div>
      <div class="track-number">
        8.
      </div>
      <div class="track-title">
        <a class="playlist-track" href="#" data-play-track="8">Guster - Amsterdam</a>
      </div>
    </div>
    <div class="play-list-row" data-track-row="9">
      <div class="small-toggle-btn">
        <i class="small-play-btn"><span class="screen-reader-text">Small toggle button</span></i>
      </div>
      <div class="track-number">
        9.
      </div>
      <div class="track-title">
        <a class="playlist-track" href="#" data-play-track="9">O.A.R. - About Mr. Brown</a>
      </div>
    </div>
    <div class="play-list-row" data-track-row="10">
      <div class="small-toggle-btn">
        <i class="small-play-btn"><span class="screen-reader-text">Small toggle button</span></i>
      </div>
      <div class="track-number">
        10.
      </div>
      <div class="track-title">
        <a class="playlist-track" href="#" data-play-track="10">My Morning Jacket - Phone Went West</a>
      </div>
    </div>

  </div>

  <div>Music from the <a href="https://archive.org/details/etree" target="_blank">Live Music Archive</a></div>
</div>
Energías renovables: Ventajas de la energía geotérmica
Published: 2022-02-12 17:47:29

¿Qué es la geotermia o energía geotérmica?

Dicho brevemente, es la energía almacenada en forma de calor por debajo de la superficie sólida de la tierra.

El aprovechamiento de esta energía se realiza desde hace más de 40 años en países como Alemania, Austria, Suiza, Suecia, Francia, USA, por lo que su aprovechamiento es muy fiable por tratarse de una tecnología madura.

El corazón de la instalación geotérmica: la bomba de calor
El funcionamiento de la instalación parte de la [bomba de calor](https://millonesdevoces.org/), que funciona con un circuito similar al de un frigorífico, con el que se puede generar calor (para su uso en calefacción), frío (para aire acondicionado) y agua caliente de un modo muy eficiente.

La energía que produce la bomba de calor geotérmica es gratuita y renovable.

Ventajas de la geotermia
Estas son algunas de las ventajas de la geotermia:

Ahorro energético, Solución integral (Frio-Calor-ACS), Energía Renovable, Muy Bajas emisiones de Co2, Muy alta eficiencia (400-700%), Seguridad ya que no hay combustión ni humos ni residuos, No se necesitan depósitos de combustible, Mantenimiento muy reducido ,Solamente un contrato de energía, Alta fiabilidad de funcionamiento, Segura.
Leaving Notion for...
Tags: productivity, notes, notion, obsidian
Published: 2022-02-12 23:00:38

This post isn't about development, but it also can be helpful in the day2day work for the software developers.

## Why do I decide to abandon Notion in the first place?

I've been Notion-fan for a long time joined it at the early stages. But time passed, and I noticed that it became slow, messy, and complicated. No offline mode makes sometimes the whole thing non-usable.

## Obsidian

![friendship ended with Notion](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dojxibxbikuc3p16iii.png)

The main reason I choose Obsidian is because of its approach to storing notes. It uses a local vault which can be located in cloud storage like google disk for the sake of being able to work with notes on another pc and not worry about losing them in case some psycho(could be me???) burns the laptop.
## Is it worth it?
In my case, yes. 
There is a significant _feature gap_ between these two, but I use it mainly for note-taking so I probably find the ideal tool

I don't:
- Use my phone to work on the notes
- Use the templates
- Share my stuff with others
- Use it for database or project/task management

If your use case is similar, consider switching too.
But we'll see how it goes in my case.

Also I have the idea of using private Github repo as a backup storage just in case. Stay tuned.
Day 14 of 100DaysOfCode
Tags: 100daysofcode, github, webdev, template
Published: 2022-02-12 21:19:05

---
title: Day 14 of 100DaysOfCode
published: true
description: Day 14 of 100DaysOfCode
tags: '100daysofcode, github, webdev, template'
cover_image: 'https://raw.githubusercontent.com/InvalidLenni/dev.to-posts/main/posts/assets/100-days-of-code.jpg'
canonical_url: null
---

## Day 14 of 100 Days Of Code

Here can you find what I learned (& published) yesterday.

### What I published / coded (/ updated) yesterday?

* Day 14 of 100DaysOfCode started with...

* Publishing a [Linkweb like linktree template](https://github.com/InvalidLenni/linksite/)

* Add the linksite to my website. (https://invalidlenni.de/pages/links.html/)

* the day ended with a post about day 14.
Is this the official Dev.to IOS app?
Tags: question, ios, help
Published: 2022-02-12 20:34:17

https://apps.apple.com/za/app/devto/id1591660057

I only ask coz it doesn't feel official, yet none of the other ones seem any more official either lol.

EDIT: I'm having trouble uploading a screenshot so I added a link instead.
Python string of letters is a string of letters, but not with special
Tags: python, todayilearned
Published: 2022-02-12 20:29:45

---
canonical_url: https://waylonwalker.com/til/python-string-is-string/
published: true
tags:
- python
- til
series: til
title: Python string of letters is a string of letters, but not with special
---


In python, a string is a string until you add special characters.


In browsing twitter this morning I came accross this tweet, that showed that you can use `is` accross two strings if they do not contain special characters.

{% twitter 1492147596688871424 %}

I popped open `ipython` to play with this.  I could confirm on `3.9.7`, short strings that I typed in worked as expected.

``` python
waylonwalker ↪main v3.9.7 ipython
❯ a = "asdf"

waylonwalker ↪main v3.9.7 ipython
❯ b = "asdf"

waylonwalker ↪main v3.9.7 ipython
❯ a is b
True
```

Using the `upper()` method on these strings does break down.

``` python
waylonwalker ↪main v3.9.7 ipython
❯ a.upper() is b.upper()
False

waylonwalker ↪main v3.9.7 ipython
❯ a = "ASDF"

waylonwalker ↪main v3.9.7 ipython
❯ b = "ASDF"

waylonwalker ↪main v3.9.7 ipython
❯ a is b
True
```

If You can also see this in the id of the objects as well, which is the memmory address in CPython.

``` python
waylonwalker ↪main v3.9.7 ipython
❯ id(a)
140717359289568

waylonwalker ↪main v3.9.7 ipython
❯ id(b)
140717359289568

waylonwalker ↪main v3.9.7 ipython
❯ id(a.upper())
140717359581824

waylonwalker ↪main v3.9.7 ipython
❯ id(b.upper())
140717360337824
```

Finally just as the post shows if you add a special character in there it also breaks.

``` python
waylonwalker ↪main v3.9.7 ipython
❯ a = "ASDF!"

waylonwalker ↪main v3.9.7 ipython
❯ b = "ASDF!"

waylonwalker ↪main v3.9.7 ipython
❯ a is b
False
```

## What should you do

First and foremost, these are the exact pitfalls that `flake8` guards you against.  So the very first things you should take away here is that there is a lot of wisdom and value in `flake8`.

Second, the `is` comparison should be used for things that you want to compare to exact memmory addresses.  These include booleans and None.  Don't use `is` accross two assigned variables.
WHY JavaScript ???
Tags: javascript, beginners, programming
Published: 2022-02-12 20:23:29

When I started my experience in coding I didn't find understand which programing language I have to choose 
and with many researches I found out that the best choice is JAVASCRIPT which is is a dynamic computer programming language. It is lightweight and most commonly used as a part of web pages, whose implementations allow client-side script to interact with the user and make dynamic pages. It is an interpreted programming language with object-oriented capabilities. 
Also , I wanted to highlight many advantages of the usage of JavaScript:
**Less server interaction** − You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server.

**Immediate feedback to the visitors **− They don't have to wait for a page reload to see if they have forgotten to enter something.

**Increased interactivity** − You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard.

**Richer interfaces** − You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors. 

I wanted finally to encourage you to learn JS to be able to create beautiful web application and it's the starting point for many other opportunities
Will Quantum computing supersede Cloud computing?
Tags: quantumcomputing, cloud, sycamore, braket
Published: 2022-02-12 20:16:35

In this Blog I'll be sharing my view on **Quantum Computing** superseding **Cloud Computing**.

Let's start of by understanding what Quantum and Cloud computing is - 

**Quantum computers** use the properties of quantum physics to store data and perform computations. In the case of classical computers the information is stored in the form of bits that can either be 0s or 1s but in a quantum computer, the basic unit of memory is a quantum bit or qubit. 

Quantum computers have the unique ability to exist in more than one state simultaneously. So in situations where there are a large number of possible combinations, quantum computers can consider them simultaneously there by providing the output in a fraction of time.

**Cloud computing** is the delivery of online services (such as servers, databases, software) to users. With the help of cloud computing, storing data on local machines is not required. It helps you access data from a remote server. Moreover, it is also used to store and access data from anywhere across the world.

**Will quantum computing supersede cloud computing?**

As of now I think it's a **NO**, both quantum computing and cloud computing has their own advantages and disadvantages. 

Quantum computing will be more relevant to certain businesses where highly complex algorithms need to be evaluated which in a normal computer would take days, weeks, months or even years.

Quantum computing is highly efficient in situations where there are a large number of possible combinations as it can consider them simultaneously. For Example in the financial sector quantum computing can perform deep analytics to new, faster trading possibilities. But these kinds of highly complex algorithms and high processing power will be used by only a fraction of businesses. 

Not all organizations or technology based businesses require such high computational power for their application to operate, in that case a classical computer with specification optimized for their application would be more than sufficient.

The possibilities of Quantum Computing is immense and can benefit a lot of sectors, moreover more companies are investing on Quantum Computing(Amazon Braket, IBM, Sycamore), moreover a combination of quantum and classical computing can be also beneficial.
A "function type covariance" trap in typescript
Tags: typescript, javascript
Published: 2022-02-12 20:06:38

In JavaScript and TypeScript, functions are generic, which means a:
```ts
type f = (...args: [number]) => unknown
// aka: (foo: number) => unknown
```
is automatically a 
```ts
type f = (...args: [number, ...any[]]) => unknown
```

Reasonable. If a function *uses only* the first few arguments, it is *no harm* to provide more.

And here come "optional parameters" in TypeScript. No worry in JavaScript since there are no "non-optional parameters":
```ts
type g = (foo: number, bar?: number) => unknown
```
It is also a:
```ts
(foo: number) => unknown
```

Why not? the second parameter is optional, it can be used *like that*.

So now, a `g` **is** also an `f`.
But wait, remember we have the second form of `f`:

```ts
const H = (h: (foo: number, bar: string) => void) => {
  h(0, '')
}

const F = (f: (foo: number) => void) => {
  H(f)
}

const g = (foo: number, bar?: number) => {
  console.log(bar ?? 0 + foo + 1)
}

F(g)
```

TypeScript would gladly accept these code even in its most strict type checks, including `strictFunctionTypes`: a `g` is an `f`, we already know that, and an `f` is an `h`, we know that too. But is a `g` also an `h` ?

That is the question.

We have been using a lot of functional APIs. `Array.prototype.map` for example, accepts an executor `(element, index?, array?) => any`, which is practically an `element => any`.
But if the executor is from somewhere else in the later form, the "`g` is not `h`" can be a problem, a problem TypeScript unable to detect:

```ts
class Foo<T> {
  private foo: T[]
  ...
  function bar<U>(f: T => U) {
    return this.foo.map(f)
  }
  ...
}
```

Let's imagine what could happen here.
Deploy nestjs application to heroku (Success)
Tags: kaufmanbot, nx, heroku
Published: 2022-02-12 19:44:47

## Login in heroku

https://www.heroku.com/

## Create new application in heroku

https://dashboard.heroku.com/new-app

![Create new application in heroku](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lo3ee72i1pw9qr7g8zby.png)

## Connect exists repository from github to created application

https://dashboard.heroku.com/apps/kaufman-bot/deploy/github

![Connect exists repository from github to created application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91eazbm7g1j7pfdxgys7.png)
 
## Set branch name if not main

![Set branch name if not main](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hdpz599t79um8mnhoj0.png)

And click to **Enable Automatic Deploys**

After it click to deploy 
![After it click to deploy ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29d8lx4meeya4hcazaid.png)

Wait...

## Check output of site

> curl https://kaufman-bot.herokuapp.com/api
```
endy@endy-virtual-machine:~/Projects/current/kaufman-bot$ curl https://kaufman-bot.herokuapp.com/api
{"message":"Welcome to server!"}endy@endy-virtual-machine:~/Projects/current/kaufman-bot$ 
```

It was easy!!!
What the heck is single threaded and synchronous (JavaScript)
Tags: javascript, webdev, beginners
Published: 2022-02-12 19:10:08

A few days ago single threaded and synchronous were just 2 heavy words for me. If this is you right now, don't worry I'll try my best to make you understand.

So, let's get started:

Single threaded and synchronous are not that much different.

**Single threaded**: It can do only 1 thing at a time and has a single call stack (don't worry just read and soon you'll get what it is)

**Synchronous**: As the name suggests synchronous means to be in a sequence. So, basically a function has to wait for the earlier function to get executed and everything stops until the wait is over.

call stack is basically a data structure which records where in the program we are. If we step into a function we push it to the top of the stack and when we return a value from the function we basically pop the function off from the stack.

Let's understand it by running the below code:

```javascript
function multiply(a, b){
     return a*b;
}

function square(n){
     return multiply(n)
}

function printSquare(n){
     let squared = square(n)
     console.log(squared)
}

printSquare(4)
```
👇See how the above code executes: 
There will be a main() function when the file starts executing then we call printSquare which gets pushed over top of the stack which in turn calls square function which gets pushed over at the top of the stack which in turn calls the multiply function which gets pushed over at the top of the stack.

![20220202_020605.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1643748941627/dWX7KF4Kh.jpeg)

Now, as soon as a function returns some value it gets popped off from top of the stack. Even if a function does not have anything to return, it gets popped off from top of the stack after its execution (printSquare(4)). 
👇 See below:

![20220202_021639.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1643749164260/EbTak4knC.jpeg)

Due to this synchronous nature of JavaScript problem arises when we have a very heavy function in between which is taking 20-30 seconds or more time to execute. In this case everything else is stopped (does not matter where you click in the browser window) for some time and the call stack gets blocked until that function returns. 

To tackle this problem in JavaScript we made JavaScript asynchronous (where tasks seems to run in parallel) with the help of web API's. Actually, it only appears to be asynchronous, it still has only one call stack.
I'll explain this concept in my next blog and will give its link here once ready.

If you have any doubts feel free to post in the comment section, I'll try to answer as many doubts as I can.




**I write one article every day related to web-development (yes, every single f*cking day). Follow me here if you are learning the same..**

**Have an awesome day ahead 😀!**

**my twitter handle:** @therajatg

**If you are the linkedin type, let's connect**: https://www.linkedin.com/in/therajatg/
Add Google reCAPTCHA v2 to plain HTML
Tags: javascript, tutorial, html
Published: 2022-02-12 19:10:08

### What is it?
A [CAPTCHA ](https://en.wikipedia.org/wiki/CAPTCHA)is a test that helps to tell the difference between a bot and a human. 

The [reCAPTCHA](https://www.google.com/recaptcha/about/) is Google's implemenation of a CAPTCHA. Its very easy to integrate, without any third party libraries.

### What's The Purpose?
A reCAPTCHA can keep malicious software/bots from engaging in abusive activities on your website while allowing legitimate users access to your site.


### How to Integrate?
We will be using the v2 version.

**1. Create a site key**
You can create a site key from [Google reCAPTCHA Admin Page](https://www.google.com/recaptcha/admin/create). 

You also will need to add a site domain, where you would deploy the site. For testing you can add localhost and use the loopback address (127.0.0.1) or use a key from [reCAPTCHA automated tests guide](https://developers.google.com/recaptcha/docs/faq#id-like-to-run-automated-tests-with-recaptcha.-what-should-i-do). One of those keys is 
```md
6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
```
which we will use in our example.

**2. Add Widget to Markup**
The only thing we will need to add to our HTML is 
```html
<div
  class="g-recaptcha"
  data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"
>
</div>
```
this can be added to a form or used without one, depending on the use case. [Source](https://developers.google.com/recaptcha/docs/display?hl=en)

We will also need to add a cdn link to the head tag.
```html
<script src="https://www.google.com/recaptcha/api.js" async defer>
</script>
```

We can listen to callbacks from the widget and register our own handlers.
```html
<div
  class="g-recaptcha"
  data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"
  data-callback="onRecaptchaSuccess"
  data-expired-callback="onRecaptchaResponseExpiry"
  data-error-callback="onRecaptchaError"
>
</div>
```
these callbacks can be used to validate or invalidate our form or whatever we want to do.

I made a simple form that submits successfully when the reCAPTCHA validates successfully, its [here](https://google-recaptcha-huz.netlify.app/). I also added some basic styling to have a decent look and feel.

Hope this helps you in your Projects. Thanks for reading 😉.
Gradle Debugging Dependencies
Tags: gradle, java, beginners
Published: 2022-02-12 19:10:12

---
title: Gradle Debugging Dependencies
published: true
date: 2022-02-12 19:00:43 UTC
tags: gradle,java,beginners
series: "Sunday Snippet"
canonical_url: https://clavinjune.dev/en/blogs/gradle-debugging-dependencies/
---

![Sunday Snippet #4 gradle debugging dependencies](https://clavinjune.dev/img/sunday-snippet/image.png "Sunday Snippet #4 gradle debugging dependencies")

```shell
# gradle <module-name>:dependencies --configuration <configuration>
$ gradle :payment:payment-service:dependencies \
  --configuration runtimeClasspath > deps.txt
```