teleren/devto huggingface dataset:
Typescript Numeric Range Type
Tags: typescript, webdev, programming, tutorial
Published: 2022-05-31 18:23:06

So you want a numeric range type, for example, from 30-40

the usual way is

```ts
type Thirty_to_Forty  = 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37| 38 | 39 |40
```

it is doable but 0 fun

what if you want a meta solution, from any range to any range, is it even possible? 

It is, here is how you do it

```ts
type CreateArrayWithLengthX<
    LENGTH extends number,
    ACC extends unknown[] = [],
> = ACC['length'] extends LENGTH
    ? ACC
    : CreateArrayWithLengthX<LENGTH, [...ACC,1]>

type NumericRange<
   START_ARR extends number[], 
   END extends number, 
   ACC extends number=never>
=START_ARR['length'] extends END 
   ? ACC | END
   : NumericRange<[...START_ARR,1], END, ACC | START_ARR['length']>

type TWENTY_TO_FORTY = NumericRange<CreateArrayWithLengthX<20>,40>
```
![Typescript Numeric Range Type](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kags4f1rqwozot8atwu8.png)

[Playground ](https://www.typescriptlang.org/play?#code/C4TwDgpgBAwgThAhsCBBOdEgOoEtgAWAMhAHYDmhAGgDwCwAUFM1EQKIByA4gCoASUCAA8UpACYBnKKQCuAWwBGEOABpGLKKhgxBIspKgzSAa1IB7AO6kA2gF0oAXih21DRgD5Hm7dYDkAGzJKAl97YVEDdm5+dRYAfm8YWOYALlgEZDQMLDxCEgpqGijePhVnADpKrRgVAEZbd0YmhlBIKA55ZVwAYwAlRAoIegYAZR5UXp4AfQne3QipWUVlFyhGTgARef1F+SVVNYZq7fFd5bgHUggAN2V3B0YxienZv0CCkLC9U6hNw4TjgAfX4cDaMNIdORdPoDchDayVcpPSYzXq9Oq2FSbFRAqDIl5ot5BQihRpuBgAegpjCpNOpLXA0B42E4PAAmlMeAB5KYAMS5kzZXkh0P6gxo8CQKHQmBw+GIxIItAATAAGdwqAAs6qAA)

keep in mind that there is a limit to how deep Typescript can recurse, and that number is 1000

Typescript will complain if your starting number is 1000 or your range size is 1000.
How to Share a Salesforce Scratch Org
Tags: salesforce, tutorial, collaboration, cloud
Published: 2022-05-31 18:11:30

A scratch org is a disposable deployment of Salesforce code and metadata. Sometimes it's helpful to share a scratch org with a teammate. In this scenario Person A wants to share their scratch org with Person B. Reasons for sharing an org include:

- Collaboration on a ticket

- Passing along an org that you no longer need so a teammate can jump right into development instead of spinning up a new org

## Instructions


Person A gets the Auth Url to provide for Person B by doing the following:

1. In the terminal run `sfdx force:org:display -u <YourOrgUsername> --verbose` and replace `<YourOrgUsername>` with your org username or simply `sfdx force:org:display --verbose` to use the default org.

2. Copy the value for Sfdx Auth Url and give it to Person B. The value will have the format "force://<refreshToken>@<instanceUrl>" or "force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>".

![SFDX Force Org Display Verbose Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4djhxjdvsvliukbo0pfl.png)


Then Person B stores the Auth Url by doing the following:

1. Create an auth.key file. 

2. Open that file with vscode or another text editor

3. Add the Auth Url provided by Person A

4. Save the file. It should looks something like this:![AuthUrl file example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/noogj773marh6f38rcm9.png)

5. In the terminal run the command `sfdx force:auth:sfdxurl:store -f ../auth.key` where `../auth.key` is the path to the file with the auth url info. This command will use that file to identify and connect to the scratch org. 

6. Open the org with the command `sfdx force:org:open` and voila! They're in Person A's org.



## Related articles

[Salesforce sfdxurl Commands](https://developer.salesforce.com/docs/atlas.en-us.228.0.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_auth_sfdxurl.htm)
Just launched an automated dev club!
Tags: startup, showdev, devjournal, watercooler
Published: 2022-05-31 18:11:14

Hey everyone 👋,

It is Arth from [ConnectDome](https://connectdome.com/) and I come bearing good news!

First, let’s get you acquainted with the subject.

## What is ConnectDome?

A platform for developers to meet other developers 1:1 and team up on projects seamlessly.

🦄 “**An automated feature-rich dev club on steroids.”**
<hr>

## But, what does this thing do?


🤝 NETWORK:

- **Meet developers 1:1 every week.**
    - Our AI matches you with a compatible developer.
    - Schedule a meeting with your match during the week.

🦄 BUILD AND SHIP:

- **Team up on projects**
    - We recommend projects other users are building.
    - Easily apply to one of the projects you like.
- **Build a team for your own project!**
    - We recommend your projects to compatible developers.
    - Easily evaluate and take in new members for your project.

> All your teams come with features like member management, group chat, and video chat (next release) to get you started.
> 

> Import a Github project OR create a new one from scratch. It is up to you.
> 
<hr>

We will send you an invite if:

- You requested one at [join.connectdo.me](http://join.connectdo.me)
- Or, had been invited to this waitlist by me.

**Or, you can [request an invite here](http://join.connectdome.com) and I’ll instantly send you one if you’re a dev :))**

### 💲 Pricing?

Free for you as an early user ❤️

### 📹 Demo

(Demo has music in background; feel free to mute)

[https://www.youtube.com/embed/r6Fu43r0Xpk&mute=1](https://www.youtube.com/embed/r6Fu43r0Xpk&mute=1)

---

I’ll keep you posted with any updates and cool ways to use ConnectDome!

**Regards,**

**Arth**

**Co-Founder, [ConnectDome](https://connectdome.com)**

[**Twitter**](http://twitter.com/connectdome) | [**Support Channel - Discord
**](http://discord.connectdome.com)
Free API Security Testing Report
Published: 2022-05-31 18:02:07

I'm a security specialist. I manage a great deal of APIs. With regards to security testing APIs, there aren't many devices for the gig.
Most devices were worked for web applications, particularly for checking security defects from heritage application server designs, program, meeting, account login, and so on. In any case, API has none of these issues.
With regards to API security testing, an alternate device is required that can dive deep into APIs, OAuth 2.0, and business-rationale defects as opposed to the inheritance approach.
We thought of this straightforward device that naturally security tests APIs. If it's not too much trouble, attempt this device and get a free API security testing report for your public, portable, and web APIs.


Here is the URL: https://apisec-inc.github.io/pentest/
Penetration Testing Stages and Methodologies
Tags: security, todayilearned, linux
Published: 2022-05-31 18:01:44

Penetration tests have multiple objectives and goals. Each penetration test is different based on the target scope. But there are methodologies that are same as foundational steps in order to achieve the goal. Penetration test stages:  

**Information Gathering**
This stage involves collecting as much publically accessible information about a target/organisation as possible, for example, OSINT and research. this stage has two sub-branches. Active and passive information gathering.  

**Enumeration** 
This stage involves discovering applications and services running on the systems. For example, web server and application version detection.

**Exploitation** 
This stage involves leveraging vulnerabilities discovered on a system or application. This stage can involve the use of public exploits or exploiting application logic.

**Privilege Escalation** 
after gaining initial access privilege escalation helps to escalate attacker's abilities to maximum (as root or admin user).

**Post-exploitation**
This stage involves process to target as many system as possible and escalate the attack surface of target. 

**Reporting** 
The final stage is to organize and document each step during the pentest and list all the discovered flaws and security suggestion in order to enhance the security  

## Methodologies 
 
**OSSTMM**
The Open Source Security Testing Methodology Manual provides a detailed framework of testing strategies for systems, software, applications, communications and the human aspect of cybersecurity. 
OSSTM is used during testing: 

1. Telecommunications

2. Wired Networks

3. Wireless Communication  

**OWASP** 
The "Open Web Application Security Project" framework is a community-driven and frequently updated framework used solely to test the security of web applications and services. 
All most all web applications are tested based on these guidelines. 

**NIST Cybersecurity Framework 1.1**
The NIST Cybersecurity Framework is a popular framework used to improve an organizations cybersecurity standards and manage the risk of cyber threats. This framework is a bit of an honourable mention because of its popularity and detail.

**NCSC CAF** 
The Cyber Assessment Framework (CAF) is an extensive framework of fourteen principles used to assess the risk of various cyber threats and an organization's defence against these.
How do you define an ideal portfolio?
Tags: webdev, discuss, career, portfolio
Published: 2022-05-31 17:59:39

Let's discuss portfolios today. I will engage the discussion with some questions. Here I go,
- What do you think about some must-have sections for a good portfolio? 
- As a developer, what color combination would you love to use in your portfolio?
- Do you prefer a simple portfolio, or do you like complex fancy works to show off skills? 
- Do you prefer to upload your detailed resume to your portfolio? If not, is it a privacy concern or something else?
Introducing Gamezap
Tags: gamedev, html, unity3d, phaser
Published: 2022-05-31 17:10:26

We are a small team of enthusiastic developers with the responsibility of managing a catalogue of casual games for people looking for entertainment. From an online portal, we make available thousands of games of great variety, which can be played for free.

Thanks to partnerships with major studios, you can find titles like [Microsoft Solitaire](https://gamezap.org/play/microsoft-solitaire), [Governor of Poker 3](https://gamezap.org/play/governor-of-poker-3), [sMeet](https://gamezap.org/play/smeet) and many other popular ones. In addition, the catalogue has numerous games from indie studios and independent developers.

So if you're a casual game lover, we invite you to find your favourite title. On the other hand, if you are a game developer, do not hesitate to contact us to make your game available to a wide audience.

Follow us on [Twitter](https://twitter.com/playOnGamezap), [Instagram](https://www.instagram.com/playOnGamezap/) and [Facebook](https://www.facebook.com/playOnGamezap/).
Visit [gamezap.org](https://gamezap.org/).

![Gamezap logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipgyr6zvbsuvfaj9s9z1.png)
SAP CPQ Integration with SAP Appgyver (Mobile App)
Published: 2022-05-31 17:27:27

Dear all,

This article describes how you can build your own mobile Application(app) for all devices using SAP Appgyver..   AppGyver is a no-code platform that allows users to easily build good-looking and professional applications without having to write a single line of code.

In below example, I have a chosen SAP CPQ integrated with SAP S4HANA as backend and SAP Variant Configuration and Pricing as pricing tool. when Sales Users created a quote and added  materials to offer to the customer.  Customer will provide the offer acceptance, so Sales users can find the quote details quickly through the App on the move..

Refer to Detailed blog link 
https://blogs.sap.com/2022/05/16/sap-cpq-integration-with-sap-appgyver-mobile-app/
Off topic Discussions
Tags: printer
Published: 2022-05-31 17:24:10


I need some images for my office work, but my old printer is not printing these pictures. A friend advised me to try the [HP 2623 printer](https://www.inkjetwholesale.com.au/printer/hp/deskjet-2623/14565/). Should I use it? And if anyone has ever used it before, please let me know.

I am waiting for your answer.
Day-98 Training At Ryaz
Tags: javascript, webdev, beginners, programming
Published: 2022-05-31 17:10:54

- Date:31/05/2022
- Day:Tuesday

Today, I started at about 10:30 am as I was in progress to complete the java script cource and the bidding project so, today I started with the left over task so, firstly I started with left over java script cource so, firstly I did error handling with try and catch statements The try statement allows you to define a block of code to be tested for errors while it is being executed. The catch statement allows you to define a block of code to be executed, if an error occurs in the try block.after this I did returning value from async function Async functions always return a promise. If the return value of an async function is not explicitly a promise, it will be implicitly wrapped in a promise and after this I did returning promise in parallel he Promise.all() method takes an iterable of promises as an input, and returns a single Promise that resolves to an array of the results of the input promises.at last I did Promise.race(),Promise.allSettled() all is fro handling many async calls and race is for where performance matters so, this way my day ended up and I got to learn many new things.with this I completed the cource.
Dynamially resizing a table
Tags: react
Published: 2022-05-31 17:01:32

Hi folks!

This is my first question ever on this site. If this is not the best place to post this, my apologies in advance!

So, I saw a recent interview question where the goal was, using React:
1) Download JSON data from a [remote api](https://jsonplaceholder.typicode.com/todos).
2) Display the data in a table.

My solution is [here](https://codesandbox.io/s/react-table-of-ids-lc6kgx?file=/src/App.js), which is nothing fancy but works okay.

My question is, if just for fun, we wanted to add another requirement:
3) Include increment/decrement buttons so users could increase/decrease the number of rows in the table dynamically.

[This solution seems to work](https://codesandbox.io/s/react-table-of-ids-for-loop-instead-of-map-rd066v?file=/src/App.js), but it seems rather hacky to me. Is there a more "Reacty" way to update the table rows, without calling the remote API more than once? Maybe another react hook would look cool?

Thanks in advance!
Patrick
How to add Dropbox to XAMPP using an Alias
Tags: php, mysql, xampp
Published: 2022-05-31 16:56:00

## How to Access an outside folder in Localhost
By default, localhost uses the htdocs folder, but we want it to use a specified folder inside of our dropbox called www.

We will achieve this by using an alias.

First, open httpd.conf; you can find this in `\xampp\apache\conf` or in the `XAMPP Control Panel` located in the Apache row, click `Config` then `Apache (httpd.conf)`.

Now, locate the `<Directory>` tag that should looks something like this; 
```
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
    # important content
</Directory>
```

You will want to copy the entire Directory tag and paste it below, then change the path to your specified folder like so

```
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
    # important content
</Directory>

<Directory "C:/your_path/">
    # important content
</Directory>
```

Eg. `<Directory "C:/Users/ash/Dropbox/www">`

Now, let's scroll down and find `<IfModule alias_module>` then locate and copy `Alias /webpath /full/filesystem/path`, then locate `ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"` and paste below like so
```
ScriptAlias /cgi-bin/ "C:/localservers/xampp/cgi-bin/"
Alias /webpath /full/filesystem/path
```
Now change the Alias to /your_folder /your_path
Eg. `Alias "/www" "C:/Users/ash/Dropbox/www"`.

Save and close, then restart Apache.
Now you can access, localhost/your_folder
Eg. `localhost/www`


But Wait! What if you wanna access your folder with just localhost
### How to change the default location using PHP
Inside of htdocs let's create an index.php or if one already exist, replace or edit it.

Then add the following snippet and change `/your_folder/` to your specified folder.
```
<?php
	if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
		$uri = 'https://';
	} else {
		$uri = 'http://';
	}
	$uri .= $_SERVER['HTTP_HOST'];
	header('Location: '.$uri.'/your_folder/');
	exit;
?>
```
Eg. `header('Location: '.$uri.'/www/');`

Save and close, then restart Apache.
Now go to localhost and it should automatically redirect to localhost/your_folder

and you're all set!
What does it take to pass a Microsoft coding interview?
Tags: career, eventdriven, programming, beginners
Published: 2022-05-31 16:14:46

# 

Join us for a fireside chat with another Hackpack Alumni who just got a job at Mircosoft. We are going to be discussing how they did it, the resources they used, and any tips/tricks they have.

There will also be an opportunity to ask questions at the end.

The event will be held through discord today 5/31 @ 2pm - [discord.gg/NKFGEzav5M?event=979830770774474..](https://discord.gg/NKFGEzav5M?event=979830770774474773)

This is a great opportunity to learn more about the programming interview process from someone who just went through it and succeeded.

### Other programming interview prep resources

Don't miss any of our future fireside chats by adding our events to your calendar - [discord.gg/HkHya4UK4J?event=970275330294153..](https://discord.gg/HkHya4UK4J?event=970275330294153257)

Community of engineers studying for programming interviews - [hackpack.io](https://www.hackpack.io/)

Programming interview prep newsletter - [fangprep.substack.com](https://fangprep.substack.com/)
The Ultimate Guide to HTTP Status Codes 🦸
Tags: webdev, beginners, http, api
Published: 2022-05-31 16:01:16

HTTP status codes are three-digit responses from the server to the browser that indicates the status of the request. It is divided into 5 different categories, each category represents a different kind of status
___
## 1XX: Information
Is a temporary status code which means that the server has received the request and is continuing the process
#### `100` Continue
#### `101` Switching Protocols
#### `102` Processing request
#### `103` Early Hints
___
## 2XX: Success
Means that the request was successful and the browser has received the expected information
#### `200` OK
#### `201` Created
#### `202` Accepted
#### `203` Non-Authoritative Information
#### `204` No Content
#### `205` Reset Content
#### `206` Partial Content
#### `207` Multi-Status
#### `208` Already Reported
#### `226` IM Used
___
## 3XX: Redirection
The type of status means you have been redirected and the completion of the request requires further action, not necessarily from your side
#### `300` Multiple Choices
#### `301` Moved Permanently
#### `302` Found
#### `303` See Other
#### `304` Not Modified
#### `305` Use Proxy
#### `306` Switch Proxy
#### `307` Temporary Redirect
#### `308` Permanent Redirect
___
## 4XX: Client Error
When the website or the page could not be reached and either the page is unavailable or the request contains bad syntax
#### `400` Bad Request
#### `401` Unauthorized
#### `402` Payment Required
#### `403` Forbidden
#### `404` Not Found
#### `405` Method Not Allowed
#### `406` No Acceptable
#### `407` Proxy Authentication Required
#### `408` Request Timeout
#### `409` Conflict
#### `410` Gone
#### `411` Length Required
#### `412` Precondition Failed
#### `413` Payload Too Large
#### `414` URI Too Long
#### `415` Unsupported Media Type
#### `416` Range Not Satisfiable
#### `417` Expectation Failed
#### `418` I'm a Teapot
#### `421` Misdirected Request
#### `422` Unprocessable Entity
#### `423` Locked
#### `424` Failed Dependency
#### `425` Too Early
#### `426` Upgrade Required
#### `428` Precondition Required
#### `429` Too Man Requests
#### `431` Request Header Fields Too Large
#### `451` Unavailable For Legal Reasons
___
## 5XX: Server Error
While the request might be valid, the server could not complete the request. These kinds of errors are mostly caused due to problems internally within server
#### `500` Internal Server Error
#### `501` Not Impemented
#### `502` Bad Gateway
#### `503` Service Unavailable
#### `504` Gateway Timeout
#### `505` HTTP Version Not Supported
#### `506` Variant Also Negotiates
#### `507` Insufficient Storage
#### `508` Loop Detected
#### `510` Not Extended
#### `511` Network Authentication Required
___
Finally, you may not need to memorize all of these status codes, but it's always good to know most of them, and organize your API responses as clear as possible
PID: The I as in integral
Tags: opensource, microservices, devjournal, luos
Published: 2022-05-31 15:48:47

In the previous post, we introduced you to what a PID control was and how the P — for proportional — worked in it. This post is about the I in PID: The I, as in integral.

⏩ https://www.luos.io/blog/pid-the-i-as-in-integral

Follow the guide and read the following post where we will talk about Derivative, the D in PID.
Top 7 Featured DEV Posts from the Past Week
Tags: icymi
Published: 2022-05-31 15:41:26

---
title: Top 7 Featured DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week
tags: icymi 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---

_Every Tuesday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week._ 

## Mind-blowing HTML Tips 

Check out these 8 helpful, lesser-known HTML tips! Props to @babib for sharing such a handy list with concise explanations.

{% embed https://dev.to/babib/7-shocking-html-tips-you-probably-dont-know-about-ggd %}


## Flutter 101

Flutter, an open source framework by Google, is great for building beautiful, multi-platform apps from a single codebase. @dmutoni helps you get started with Flutter in this guide!

{% embed https://dev.to/dmutoni/get-started-with-flutter-3k4 %}


## Exploring F#

@tunaxor talks about what the current landscape of front-end development for the F# ecosystem looks like. Over the last few years Fable has become quite capable!

{% embed https://dev.to/tunaxor/exploring-the-f-frontend-landscape-13aa %}


## Master RegEx in JS!

When you first encounter Regular Expressions, they may seem like a random string of gibberish. While they might look awkward (with a somewhat confusing syntax), they are also extremely useful. Learn more about them with @kai_wenzel!

{% embed https://dev.to/kai_wenzel/mastering-regular-expression-regex-in-javascript-54jo %}


## Complete Windows Developer Setup Guide

Ever wanted to develop in Windows? After a lot of trial and error, @stephanlamoureux has been able to piece together a pretty respectable Windows dev environment.

{% embed https://dev.to/stephanlamoureux/the-complete-windows-developer-setup-guide-fie %}


## How to Structure React Apps

Structuring React apps “the right way” seems to be the hot topic for as long as React has existed. React’s official opinion on it is that it “doesn’t have opinions.” Well, devs working in React certainly do, and here’s @adevnadia’s!

{% embed https://dev.to/adevnadia/react-project-structure-for-scale-decomposition-layers-and-hierarchy-4ioa %}


## Terminal-style Portfolio

Not all the greatest portfolios have the shiniest styling or the latest cutting-edge technology. Here’s @protium’s profile website: just a simple terminal!

{% embed https://dev.to/protium/my-profile-website-is-now-a-terminal-2j57 %}


_That's it for our weekly Top 7 for this Tuesday! Keep an eye on dev.to this week for daily content and discussions...and be sure to keep an eye on this series in the future. You might just be in it!_