teleren/devto huggingface dataset:
Host your NodeJS app for free
Tags: node, cloud, hosting, app
Published: 2022-04-19 20:02:34

NodeJS are super easy and very convenient to start with but finding reliable hosting solutions that are free for developers is not easy at all. In this post we will see how to deploy, build and host a NodeJS app on [Qoddi App Platform](https://qoddi.com/?t=dev-nodejs). Qoddi is free for developers (no credit card required) and super affordable to use in production, can scale limitless and includes all your app needs to run.

Qoddi also includes a large catalog of Databases including MongoDB and PostgreSQL that can be deployed for free at the same time of your app.

## Deploy your NodeJS App Free

Start by creating a free account on [Qoddi App Platform](https://qoddi.com/?t=dev-nodejs) and log into your new account. Then, follow the steps below:

- Fork the [Getting Started with Node](https://github.com/qoddiapps/getting-started-with-node) repository to your GitHub account,

- Go to Qoddi and Click + on the dashboard page to create a new app.

- Choose a name, a location and if you want to deploy a database at the same time:

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

- Select GitHub as your Git provider and add the repository you forked before:


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

- Verify the details of your app and Click "Launch My App",

- Wait for Qoddi to import your code, build and deploy your NodeJS app and that's it! Your app is live:

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

## Do more

In this tutorial we covered the basic deployment of a NodeJS App. To continue there is several ressources you can consult:

- The [Qoddi's Marketplace](https://app.qoddi.com/marketplace/?cat=1d) contains a lot of databases you can deploy for Free including MongoDB, PostgreSQL, Redis, etc.
- The [Qoddi's Dev Center](https://devcenter.qoddi.com/node-js/) dedicated NodeJS page
- [Qoddi's blog](https://blog.qoddi.com) where we post content about Node and other languages.

Enjoy deploying your NodeJS app for free with [Qoddi App Platform](https://qoddi.com/?t=dev-nodejs)!
Why do array indexes mostly start at 0?
Tags: array, programming, computerscience
Published: 2022-04-19 19:29:55

Have you ever wondered why array indexes start at 0 in most languages? I did. The road to satisfy this curiosity led to a few revelations and fundamentals that we tend to forget a lot of times. Let's start by defining an array.

**Array** is typically a contiguous area within the computer memory. In most languages, the variable that we use to refer to this array is inherently a **pointer.** A pointer that stores the starting address of the contiguous portion of memory.

Let's take an example, say there's an integer array `arr` of 5 numbers in a language where every integer occupies 2 bytes of memory. Say, this array's contiguous area starts at byte address 44 and continues until 54 (requiring 10 bytes, i.e. 5 integers of 2 bytes each).

Within this, when referring to `arr[i]` we are essentially looking up the memory location in a shorthand way. 

```
arr[i] points to a location = Start Address + Data size * Index
arr[0] points to a location = 44 + 2*0 = 44
arr[1] points to a location = 44 + 2*1 = 46
arr[2] points to a location = 44 + 2*2 = 48
arr[3] points to a location = 44 + 2*3 = 50
arr[4] points to a location = 44 + 2*4 = 52
```
What difference would it have made had it started at 1 instead of 0?
```
arr[i] points to a location = Start Address + Data size * (Index - 1)
arr[1] points to a location = 44 + 2*(1-1) = 44
arr[2] points to a location = 44 + 2*(2-1) = 46
arr[3] points to a location = 44 + 2*(3-1) = 48
arr[4] points to a location = 44 + 2*(4-1) = 50
arr[5] points to a location = 44 + 2*(5-1) = 52
```
We would need to subtract 1 from every index we are accessing if we start indexing at 1. Looking keenly, we are offsetting from starting index to get every element. Using 0 as the index then means using an exact offset from starting point as the index whereas when using 1, we would have to compute the offset itself.

Why use 0 then? Using 0 allows us one less computation for accessing elements. Does this matter that much? Not today, but probably it mattered in the early days of computing to have algorithms in the most efficient way. Maybe, it was an efficiency hack for ancient computers.

Not just this, it also makes mathematical sense to use 0-based indexing. I would not dive much deeper here, but leave it to Dijkstra to [take home this point](https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF) using conventions of representing a sequence of natural numbers.

The simple choice of 0-based indexing simplifies a lot of mathematics on arrays for programmers and allows for some elegant implementations of some concepts like hash tables, consistent hashing, and binary heaps.

Nevertheless, more than a decision of computational efficiency or mathematical accuracy, it is a matter of linguistic choice. With some tweaks in the implementation of the array, you can make any arbitrary indexing work.
What are your favorite open source team applications?
Tags: opensource, discuss
Published: 2022-04-19 19:26:47

E.g. GitLab, the Matrix-Client of your choice, task or team management software and so on…

A few ideas:
- Gitea: A self hosted Git web interface (like GitHub)
- Mattermost/Focalboard: Nice Team Chat and task management tool
- Fosscord: An interesting idea of a self hosted Discord Server
Day 3: Still UI/bottom navigation bar (custom)
Tags: appwritehack, flutter
Published: 2022-04-19 19:10:17

I think I moved the biggest rock off the way by finishing up the custom bottom navigation bar, I could make the bottom navigation bar as buttons inside container that takes the screen width and the height of `BottomNavigationBar() //kBottomNavigationBarHeight` But because I'm fairly new to Flutter and there are a lot of stuff to learn, I thought to make a widget (and possibly a flutter package) and use it exactly like I'm using the built-in Flutter BottomNavigationBar widget or external package.<br>

The final result isn't as Flutter's BottomNavigationBar but it does the exact same thing, the only difference is the code implementation and how events are handled. Also before I forget to mention, I made changes in the `CustomButton` widget from [Day 2](https://dev.to/fathidevs/day-2-crafting-hapoc-ui-1p8p)<br><br>


![Preview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y4tez0ri2d6v10p068qj.gif)<br><br>

The funny thing is, the `CustomBottomNavigationBar` does not interact with clicks, it is basically a `container` with `CustomButton` widgets, what interact with clicks is the `CustomButton` itself, so in `CustomBottomNavigationBar(childeren: _items)` each item has its own `onPressed()` and because it is `VoidCallback` it does not return any args like in the normal `BottomNavigatoinBar` the `onPressed(index) => ...` returns an integer indicating the index of the current bottom navigation bar, in my `BottomNavigatoinBar`, this is how I managed to get the index:

```
onPressed: () {
          setState(() {
            _currentIndex = 1; // setting the index manually
          // setting the buttons bool values to appear as one 
         // button is pushed down at a time

            tapStatus[_currentIndex] = true; // the clicked button

            tapStatus[0] = false; 
            tapStatus[2] = false;
            _screenController.jumpToPage(_currentIndex);
          });
        },
```
I did not want to waste more time on making the `CustomBottomNavigationBar` receives click event, I might apply changes some other time

[check out my custom bottom navigation bar](https://dartpad.dev/51438a3b24dd6a6c91fd76af5ed358ac)
GNOME 42: New Features
Tags: ubuntu, linux, gnome
Published: 2022-04-19 18:55:58

## Table of Contents
1. [Compact Applets](#compact-applets)
2. [New Overall Appearance](#overall-appearance)
3. [New Remote Desktop Setup](#remote-desktop-setup)
4. [Redesigned Screenshot Tool](#redesigned-screenshot-tool)
5. [Two New Apps](#two-new-apps)

### Compact Applets
The Shell theme no longer uses "call outs" in applet pop ups. Applets are more compact.

![applets](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cs1bes8kgm8kazhw1pcv.png)
 

### Overall Appearance
#### New Appearance Hub
![appearance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ih7aou39vljv159w1o3.png)

#### Updated UI Visuals and New Modern Widgets
A bunch of GNOME’s core apps have now been ported to GTK4/libadwaita, with GNOME 42, including:

- Disk Usage Analyzer
- Characters
- Software
- Contacts
- Calendar
- Weather
- Clocks
- Fonts
- To Do
- Tour

![libawaita liftoff](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s3yuk1lmj9exlykn6uve.png)
 
### Redesigned Screenshot Tool
The new screenshot tool uses on-screen drag handles or snaps specific app windows. It's no longer a separate app; you simply hit `print screen` to run the program. Toggle from camera to recorder and you're also able to record your entire screen, a portion, or a single app window in the same manner.

![screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/64gv6eva5drn8c56n1cp.png)

### Two New Apps
Console replaces GNOME Terminal and Text Editor replaces Gedit in GNOME 42.

![new apps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hs4ebumqdovewrjzlq6i.png)
ECDSA in Bitcoin
Tags: bitcoin, crypto, cryptography, computerscience
Published: 2022-04-19 18:22:17

Here is this article in short video form:
https://www.youtube.com/watch?v=tl6RGKKvHto

Since I never took computer science courses, I have to catch up with some of the fundamentals, and I find them fascinating. One such fundamental of computer science is cryptography, and today I want to go through how it is applied to generate wallets in Bitcoin from scratch.

The math used to generate a wallet from scratch is called Elliptic Curve Cryptography. It used in Bitcoin and is crucial to maintaining the integrity of the protocol. The amazing part is that it is so secure, that you don't have to  even be connected to the internet because this process is just based on math.

Let’s get into how it works.

Everything is based on this curve called the Secp256k1 derived by the function 

```python
y = sqrt(x**3 + 7)
```

To use it, we generate any random number up to 2^256 and multiply it by a constant point G in the curve

The point G is constant for every bitcoin address and here it is as x and y coordinates:

![Two points that make up G](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9q0y37h6s9wjehe3s4zd.png)

The math that is more interesting and we are more concerned about is how to generate a public key from ANY random number. And that math is a simple function here:

```python
K = k  * G
```

where `k` is the private key, `G` is a constant point called the generator point, and `K` is the resulting public key. 

`k` can be anything, the important part is that it is random. Once you have a random value for `k` you just multiply that by G which is the process of extending a tangent until it intersects with a different point in the line and reflecting that point across the X axis.
![Image showing the above description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xvvi75nz4z6hya60uwh7.gif)

The result is called your public key and can be shared with ANYONE because it is extremely improbable that someone can derive the private key backwards from it.

You still have to run it through some hashing functions to generate an address, but this is pretty much it. This math has been around since the 80s and is considered secure enough to hide government secrets. By signing a transaction with that private key, you are basically proving that you are the only person with access to the private key used to generate that public key.
Web3.js with javascript
Tags: javascript, blockchain, web3, tutorial
Published: 2022-04-19 14:41:37

The Support of my programm is done from Web3.js[](https://web3js.readthedocs.io/en/v1.7.3/) documentations
Course Overview

1. Web3.js
** web3.js is a collection of libraries that allow you to interact with a local or remote ethereum node using HTTP, IPC or WebSocket.**
2.** Modules**
- Uses we can transfer ether in the wallet
- We can fetch the account balance 
3.Web3.js in chrome console
4.We generate ABI and ByteCode using Web3.js in our smart contract
5.Compilation of Web3.js
6.Deployement of Smart Contract
**Web3.js Prerequisites **
1. Blockchain
- Basic understanding of Blockchain
2. Ethereum
- Basic understanding of Ethereum
3. Solidity
- Basic idea about Solidity
4. JavaScript
- Basic understanding of JavaScript
**Software Requirement**
1. Node js
2. Ganache
3. Vs Code

**What is Web3.js**?
- Suppose we have a application and we want to connect our application with blockchain(Smart Contract),then we can use Web3.js in our applications to connect to the blockchain(Smart Contract).
- It acts as a interface between your peer world(application) and blockchain (Smart Contract).
- Web3.js is nothing but the interactions between our application and Smart Contract in Blockchain
**Web3.js**
- Installation of Web3.js
- Import of Web3.js
- To connect with Ganache
- To get the balance of an account
- to convert wei into ether
- to transfer ether from one account to another account
**Steps to proceed**

- node --v
- npm init -y
- npm install --save web3
```
let Web3 = require('web3');
//to check web3 is import or not 
console.log(" Web3", Web3);
//Now we will create a object named web3
let web3=new Web3(new Web3.providers.HttpProvider("Please give ganache url");
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52dw7astofoes37rds1m.png)
_Now we can control the Ganache_

- Now we will check how we can fetch the balance of Ganache of our account

```
web3.eth.getBalance("id of account").then(console.log);
//you will get the balance of the account 
//you need to have a little understanding of javascript
//then can also acts as a Promise
//if we want to get the balance 
web3.eth.getBalance("id of account").then(function(result){
console.log(web3.utils.fromWei(reults,"ether"));});
});
```
**How can we transfer ether from one account to another account?**

```
web3.eth.sendTransactions({from:" id of account where money need to be transfer",to:"id of account where money need to be sent",value:web3.utils.toWei("Amount to be transfer","ether")});
```
Main Source all the resources is [click here](https://web3js.readthedocs.io/en/v1.7.3/)
Thank You for Reading
Difference between Service and Service Provider
Tags: laravel, php
Published: 2022-04-19 17:58:14

This an Interview Question


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

👷‍♀️ Service: A class that you pass data to and get something in return or ask to do some work.

⚡ Provider: A class used to bootstrap the service, i.e. prepare it, read some config or bind an implementation.

Code example 👇 

![Code example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ty08abvdgjf2z75fmg6a.png)
Field Guide to Writing More Readable Code - Laravel
Tags: php, laravel, webdev, programming
Published: 2022-04-19 15:53:57

It's great news having this book that shows us how to write more flexible code for readers and I found this source https://laravel-news.com/basecode-a-field-guide-to-writing-more-readable-code that advertised that good news.

BaseCode focuses on code readability and other skills around writing clean, maintainable code for humans

- Writing code that prioritizes readability by humans, not a computer
- Avoiding code rot with analysis and automation
- Untangling nested code to improve visual honesty and reduce reader overhead
- Introducing objects to encapsulate complexity
- Refactoring long blocks of code by understanding reading levels
- Making naming things easy with context and time
- Using code as the primary signal, not comments
- Avoiding unnecessary code by using reasonable return values
- Delaying the need to remove duplication with the Rule of Three
- Improving code flow with symmetry
- Deferring design decisions to reduce anxiety when writing code

I hope you enjoyed with me and I adore you who search for everything new.
Day-69 Training At Ryaz
Tags: javascript, webdev, beginners, programming
Published: 2022-04-19 17:23:33

Date:19/04/2022
Day:Tuesday

Today, I started at about 10:40 am as I was in progress in compleating the java script course as I was done with upto ninth module and today I started with the rest of part so, firstly I started with the a closer look with functions it included the firstly the default parameter function as we pass the default parameters as we have to declare the function and pass the argument while declaring the function and after this I started with as how we can pass the arguments and it passes as a value or it pass as a reference.In Pass by value, function is called by directly passing the value of the variable as an argument. So any changes made inside the function does not affect the original value and In Pass by Reference, Function is called by directly passing the reference/address of the variable as an argument. So changing the value inside the function also change the original value. In JavaScript array and Object follows pass by reference property. and after this I started with first class and higher class functions. A programming language is said to have First-class functions if functions in that language are treated like other variables. So the functions can be assigned to any other variable or passed as an argument or can be returned by another function and in higher order function a function that receives another function as an argument or that returns a new function or both is called Higher-order functions. Higher-order functions are only possible because of the First-class function.and after this I started with function accepting callback function JavaScript functions are executed in the sequence they are called. Not in the sequence they are defined.A callback function is a function that is passed as an argument to another function, to be called back at a later time. A function that accepts other functions as arguments is called a higher-order function.so, this way my day ended up and got to learn many new things.
Paracetamol.js💊| #103: Explica este código JavaScript
Tags: javascript, webdev, spanish, beginners
Published: 2022-04-19 17:22:50

## **<center>Explica este código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
const dup = arr => Array.isArray(arr) && arr.map((item) => item * 2);

const [dos, , seis, ...resto] = dup([1,2,3,4,5]);
console.log(dos, seis, resto);
```

A. `2`, `6`, `[undefined, undefined]`
B. `2`, `6`, `[8, 10]`
C. `2`, `6`, `[4, 5]`
D. `SyntaxError`

Respuesta en el primer comentario.

---
map(), filter(), forEach() array methods in Javascript
Tags: javascript, programming, array, webdev
Published: 2022-04-19 17:21:01

## 1. forEach
- forEach method executes a provided function each array element only once in ascending index order.
- ForEach method is not execute empty elements.
- ForEach method is not return any value. Its return 'undefined'.


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

## 2. array.map()

- map method creates new array from calling a function for each array element.
- map method is not execute an empty elements.
- map method returns new array results of function for each array elements.
- map method not affect original array.

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

## 3. array.filter()

- 1. filter method creates a new array with all array elements that pass the test condition by provided function.
- 2. If condition fails it return an empty array.
- 3. filter method not affect original array.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4u7b8dqkowoz1pq4g322.png)
Meteor Impact 2022 talks proposals open!
Tags: meteor, impact, conference
Published: 2022-04-19 17:15:38

Meteor Impact 2022 is open for talk proposals!

The big change this year is that we are collecting information that we need to send you some cool stuff up front.

So if you want to speak at Meteor Impact this year, then submit your talk now, so that you can reserve the best spot:

# [Talk proposal form](https://docs.google.com/forms/d/e/1FAIpQLSeMcghka1stV_gD4r-tTlLxMdgMeogfoGaXOPNqiDaiB-Pmug/viewform?usp=sf_link)

--------
If you like my work, please support me on [GitHub Sponsors ❤️](https://github.com/sponsors/StorytellerCZ).
Node.js 18: fetch API, Test Runner module, and more
Tags: javascript, node, webdev, programming
Published: 2022-04-19 16:59:27

---
title: 'Node.js 18: fetch API, Test Runner module, and more'
published: true
description: Node.js v18 was released and we can find new amazing features in this major release.
tags: 'javascript, node, webdev, programming'
cover_image: 'https://raw.githubusercontent.com/cloudx-labs/posts/main/posts/navarroaxel/assets/nodejs-18-cover.png'
id: 1058907
---

This week Node.js v18 was released and we can find new amazing features in this major release. Let's check the most important ones. 🚀

## The fetch API

Say good bye to the `node-fetch` package, now the `fetch` API is available on the global scope by default.

```javascript
const res = await fetch('https://api.belo.app/public/price');
if (res.ok) {
  const data = await res.json();
  console.log(data);
}
```

We can make requests like we do in browsers. 🙌

## Test Runner module

Now, we can create tests in Node.js without needing an external package.

```javascript
import test from 'node:test';
import assert from 'node:assert';

test('synchronous passing test', (t) => {
  // This test passes because it does not throw an exception.
  assert.strictEqual(1, 1);
});
```

Also, we can group subtests within a parent test.

```javascript
test('top level test', async (t) => {
  await t.test('subtest 1', (t) => {
    assert.strictEqual(1, 1);
  });

  await t.test('subtest 2', (t) => {
    assert.strictEqual(2, 2);
  });
});
```

Learn more at <https://nodejs.org/dist/latest-v18.x/docs/api/test.html>.

## Prefix-only core module

Have you seen this strange import?

```javascript
import test from 'node:test';
```

Since this release all core modules can be imported using the `node:` prefix, there is no difference between importing `fs` and `node:fs`. But the `test` module only can be imported using the prefixed form: `node:test`.

💡 If when loading `node:test` the `node:` prefix is not included, Node.js will attempt to load a module named `test` from the `node_modules` folder.

## The V8 10.1

Node.js v18 comes with V8 engine v10.1 which is part of Chromium v101, in spite of the versions included in Node.js v17 that didn't include these features:

* The [`findLast` and `findLastIndex` array methods](https://v8.dev/features/finding-in-arrays).
* Improvements to the [`Intl.Locale` API](https://v8.dev/blog/v8-release-99#intl.locale-extensions).
* The [`Intl.supportedValuesOf` function](https://v8.dev/blog/v8-release-99#intl.locale-extensions).

## Conclusion

We've only mentioned the most notable changes in this release. Node.js v18 will be promoted to LTS in October of this year.

You can check the full changelog [here](https://github.com/nodejs/node/releases/tag/v18.0.0).
#90DaysOfDevOps - Introduction - Day 1
Tags: devops, 90daysofdevops, learning
Published: 2022-04-19 16:53:14

---
title: '#90DaysOfDevOps - Introduction - Day 1'
published: true
description: 90DaysOfDevOps - Introduction
tags: 'devops, 90daysofdevops, learning'
cover_image: null
canonical_url: null
id: 1060900
date: '2022-04-19T16:53:14Z'
---
## Introduction - Day 1 

hi