teleren/devto huggingface dataset:
Next.js Shopping Website
Tags: react, nextjs, node, javascript
Published: 2022-04-30 17:44:20


 This is a shopping website developed using Next.js, Node.js, React, Redux, Algoliya Search, and Redis caching. Hosted on Digital ocean Ubuntu server 
https://github.com/bibinprathap/nextjs-e-commerce
 The mobile Application of this eCommerce application is developed using Flutter.The source code of this Flutter mobile app is available on https://github.com/bibinprathap/flutter-e-commerce-app 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pwioagr2sx2x0vi1fgan.jpg)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8p3lm0rg7xtmt3rxf5i9.jpg)
plusOne Array of Integers in Javascript
Tags: javascript, programming, challenge, webdev
Published: 2022-04-30 17:14:00

Increment the large integer by one and return the resulting array of digits.

Example:

Input: digits = [1,2,3]
Output: [1,2,4]
Explanation: The array represents the integer 123.
Incrementing by one gives 123 + 1 = 124.
Thus, the result should be [1,2,4].

Input: digits = [9]
Output: [1,0]
Explanation: The array represents the integer 9.
Incrementing by one gives 9 + 1 = 10.
Thus, the result should be [1,0].

Here is the my implementation:

```
function plusOne(digits: number[]): number[] {
   let n = digits.length;
    for(let i=n-1; i>=0; i--) {
        if(digits[i] < 9) {
            digits[i]++; return digits;
        }
        digits[i] = 0;
    }
    
    let newArr = Array.from({length: n+1}, () => 0);
    newArr[0] = 1;
    return newArr;
};
```

Please provide if you have more simplified and better solution. 

Thanks.
maxSubArraySum in Javascript
Tags: javascript, programming, challenge, webdev
Published: 2022-04-30 17:09:04

We need to find the contiguous subarray sum which has the largest sum. 

**Example:**

_

Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: [4,-1,2,1] has the largest sum = 6.
_

Here is the code:

```
function maxSubArray(nums) {
    let max = -Infinity;
    let sum = 0;
    for (let i = 0; i < nums.length; i++) {
        sum = sum + nums[i];
        if (max < sum) max = sum;
        if (sum < 0) sum = 0;
    }
    return max;
};
```

Please provide any simplified solution you have. 

Thanks.
Unable to HASURA_GRAPHQL_JWT_SECRET in docker-compose file
Tags: hasura, aws, cognit
Published: 2022-04-30 17:00:51

Trying to use HASURA_GRAPHQL_JWT_SECRET in docker-compose.yml ang getting below error,any help 

Error fetching JWK: ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol:
 AddrInfo {addrFlags = [AI_ADDRCONFIG], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 6, addrAddress = 0.0.0.0:0, 
addrCanonName = Nothing}, host name: Just "cognito-idp.us-east-1.console.amazonaws.com", service name: Just "443"): does not exist (Name or service not known)
Golang Inject Build Time Variable
Tags: beginners, go
Published: 2022-05-01 03:21:41

---
title: Golang Inject Build Time Variable
published: true
date: 2022-04-30 17:00:01 UTC
tags: Beginner,golang
series: "Sunday Snippet"
canonical_url: https://clavinjune.dev/en/blogs/golang-inject-build-time-variable/
---

 ![Sunday Snippet #15 golang inject build time variable](https://clavinjune.dev/img/sunday-snippet/image.png "Sunday Snippet #15 golang inject build time variable")

```go
package main

import . "fmt"

var foo = "not injected"

func main() {
	Println(foo)
}
```

```shell
$ go run main.go
not injected
$ go run -ldflags "-X main.foo=injected" main.go
injected
```
Programming Tip #2: Avoid globals for dependencies; instead inject them as function arguments.
Tags: javascript, testing, programmingtips
Published: 2022-04-30 16:32:33

---
title: Programming Tip #2: Avoid globals for dependencies; instead inject them as function arguments.
published: true
description: 
tags: #javascript,#testing,#programmingtips
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ln3xwnm3z8oq978cwixg.png
---

Programming Tip #2: In JavaScript, Python, and Lua, avoid globals for dependencies; instead inject them as function arguments.

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

Learn More from Justin Searls and Dave Farley below.

{% youtube aTqC5CIy7mg %}

{% youtube llaUBH5oayw %}
Let's talk about DevOps
Tags: devops
Published: 2022-04-30 16:30:08

DevOps, unfortunately, is a misunderstood term. So, first of all, you need to understand that DevOps is not a tool or a job title. It is a **shared mindset**.

Who works with this kind of mindset knows, for example, that working in silos just doesn't work and Development and Operations must work together following lean and agile principles to deliver software rapidly and continuously.

It's about thinking differently, social coding, working in small batches, and again putting effort into delivering a minimum viable product. DevOps is also about working differently (TDD, BDD, CI, and CD).

But this is not all, DevOps demand organizing differently, perhaps putting energy to make the organization impact the design and measure differently because in the end, you get what you measure.

##So, let's talk about what DevOps is not:##
- Not simply combining development and operations
- Not a separate team
- Not a tool
- Not one size fits all
- Not just automation

_DevOps is a cultural change in which development and operations engineers work together during the entire development cycle._

We don't "do" DevOps
**We "become" DevOps**
SvelteKit Hooks
Tags: svelte, javascript, beginners
Published: 2022-04-30 16:28:13

A quick snippet to use sveltekit hooks because there isn't anything super obvious online.

It's a pretty simple idea. Hooks are functions that run on the server before each request, so in a hook file you can open a db, then inside the handle function that runs, add the connection to the locals variable which will then be available in the various http functions.

./src/hooks.js
```
export async function handle({ event, resolve }) {
    event.locals.db = "Hello";
    const response = await resolve(event);
    return response;
}
```

Now we have the db variable in our locals, which will pass to the get function.

./src/routes/[id].js
```
export function get({ locals, url, params }) {
    console.log(locals.db);
    ...
}
```

I think a bit more obvious documentation would be nice as my biggest issue was that I knew what sveltekit was doing but I wasn't sure how it was doing it.

The other thing to note is that locals isn't available in the load function. It's only available server side in the endpoints. To get locals into the load function, you would need to use the getSession function in hooks to add information to the request that goes out to the client.

Some cool ideas in all this.
Would you use an app to track blog posts?
Tags: webdev, discuss, help, startup
Published: 2022-04-30 16:07:24

I want to start working on a new project, but I am looking to find other people who have the same problem.

There are lots of dev related bloggers out there, they all post new blog posts on their own websites. Would you use a website (SaaS) that notified you every time some blog you follow posted new content? You get an email or SMS to say you need to check out a new post, and each post could be nicely organised into a reading list.

You'd still get directed to the original blog post's website, but the main problem being solved is keeping track of new blog posts and notifying you and keeping you up to date.

What do you think, is this something you would use and pay for?
Authentication: You don't have to reinvent the wheel
Tags: security, api, authentication
Published: 2022-04-30 16:02:57

Every application with user roles requires an authentication feature. Whether it is the good old username with a password or passwordless login, creating and maintaining it takes some time and effort.

## Bring Your Own Authentication

If you have enough time and budget to build an authentication and authorization process, then go for it.

The problem with this approach is that you cannot scale or it can consume your time and take extra effort for every project.

Back in 2010, at my first job, we were creating custom CMS using PHP and MySQL.

Though we had version control, every developer on the agency had their own variation. It took at least a few hours to alter database schema, user meta, etc, and refactor the code for each and every project.

I secretly wished to use a unified solution for this. This also poses security threats as well, some old versions of the software needed some love which they deserved. 

On the whole, it was a painful developer experience. 

> Think about spending more time on the authentication itself, instead of building the other features of the application!

Bringing your own authentication is not a feasible and best way to develop apps in my opinion. Would love to hear your thoughts on the comments.

## Customizing Existing Authentication

With the rise of open-source CMS, the time to build an app got reduced. Instead, we all focused on the customization.

> There is no good or bad CMS, as long as it comes with the features you need and it allows you to customize.

Over the years, I had the chance to work with WordPress, Drupal, Magento, and PrestaShop-based projects.

For some projects just adding the client’s logo and colors to the login page is enough, others required adding user roles and capabilities etc.

## Using an Authentication Provider

Gone are the days with monolithic CMS, we are now using microservices and headless apps.

Instead of building or customizing an existing one, we can now plug and play authentication.

This also removes the security related issues as they will be taken care of by the auth provider.

Most of the auth providers in the market come with extendable features.

_After trying few auth providers, I have started using Auth0 for both hobby and client projects too._

## Conclusion

Authentication is an important part of any application, but it should not take much time and efforts. Don’t reinvent it, find a solution that suits your needs and allows you to customize.

[Auth0](https://auth0.com/signup?utm_source=ambassador&utm_campaign=devrel&utm_medium=link_placement) comes with generous user limit of 7K monthly active users for its free tier, which is more than enough for a start.

I also like the ease of usage, developer experience and active user community.

Right from vanilla javascript to popular frameworks, Auth0 team and the community has [SDKs with detailed documentation](https://github.com/auth0).

Enough of recommendation, check out other auth providers too and chose the right one for you.

Happy coding!
IDM Crack 6.40 Build 11 Patch + Serial Key Download [Latest 2022]
Published: 2022-04-30 01:30:29

[IDM 6.40 Crack](https://orgcrack.com/idm-crack/) is the world’s first video downloader that allows users to quickly download videos and get amazing results. With this program you can download all applications, videos, MP3s and more. This software is simple and easy. Millions of people have this app installed to use the download. With this simple tool, it’s 5x faster. Apart from that, [IDM Crack](https://rarsoftpc.com/internet-download-manager-crack/) is a tool for increasing download speeds up to 5 times and keeping your content organized and downloaded. Complete error recovery and continuation functionality is interrupted or interrupted due to loss of connectivity, network problems, computer shutdown, and other unexpected illnesses. Now you can enjoy downloading your favorite movies and music in real time. Accuracy and perfect sound.
Section 1.3 - SnowPro Core Certification Study Guide
Tags: cloud, cloudskills, snowflake, examprep
Published: 2022-04-30 15:32:47

**This series is intended to be a personal study guide. Information may not be comprehensive or accurate. I am sharing it in case others find it useful. Please feel free to comment if any information is inaccurate.**

[Return to Exam Guide](https://dev.to/aidutcher/snowflake-snowpro-core-certification-study-guide-2jji)

**<u>1.3 Define the entities and roles that are used in Snowflake</u>**

[Overview of Access Control](https://docs.snowflake.com/en/user-guide/security-access-control-overview.html)

- _Outline how privileges can be granted and revoked_
     - Securable objects
          - Every securable object resides within a logical container inside a hierarchy of containers
          - Account object contains database objects, which contain schemas, which contain tables/views/functions/stages
          - Access to securable objects is allowed via privileges assigned to roles, which are then assigned to other roles or to users
          - Each object also has an owner that can grant access to other roles
          - Each object is owned by a single role, by default the one that created it; when role is assigned to users, they share control of the object
          - In a managed access schema, only the schema owner or a role with MANAGE GRANTS can grant privileges on objects in the schema
     - Roles
          - Privileges are granted to or revoked from roles
          - Roles are assigned to users, who can be assigned multiple roles
          - Users can choose which role is active in the current session to perform different actions
          - Users with certain privileges can create custom roles
          - System defined roles cannot be dropped and their privileges cannot be revoked
               - ORGADMIN: create accounts, view all accounts and regions, view usage info across org
               - ACCOUNTADMIN: encapsulates SYSADMIN and SECURITYADMIN
               - SECURITYADMIN: manage any object grant globally, create/monitor/manage users and roles
               - USERADMIN: dedicated to user and role management and creation
               - SYSADMIN: creates warehouses and databases in an account
               - PUBLIC: pseudo-role granted to every role and user
          - Custom roles: create a hierarchy of custom roles with the top-most level assigned to SYSADMIN, otherwise SYSADMIN won't be able to manage objects created by the custom role
          - Each active user can have 1 primary role and any number of secondary roles, and can switch between them
          - CREATE statements can only be performed by primary roles
             
- _Explain Role Hierarchy and Privilege Inheritance_
     - Roles can be assigned to other roles, creating a role hierarchy
     - Roles inherit all of the privileges assigned to roles below them in the role hierarchy

[Return to Exam Guide](https://dev.to/aidutcher/snowflake-snowpro-core-certification-study-guide-2jji)
Spectra - Ultimative Blöcke für Gutenberg
Tags: wordpress, astra, pagebuilder, wordpressplugins
Published: 2022-05-01 16:20:00

---
title: Spectra - Ultimative Blöcke für Gutenberg
published: true
date: 2022-04-30 15:23:09 UTC
tags: WordPress,astra,pagebuilder,WordPressPlugins
canonical_url: https://bloggerpilot.com/spectra/
---

![Spectra - Ultimate Gutenberg Blocks](https://bloggerpilot.com/wp-content/uploads/2022/04/spectra.png)

Das WordPress Plugin Spectra ist der Nachfolger des sehr erfolgreichen...

Der Original-Artikel erschien auf [Spectra - Ultimative Blöcke für Gutenberg](https://bloggerpilot.com/spectra/).

Zusammenfassend lässt sich sagen, dass Spectra alle Funktionen in einem praktischen Dashboard integriert hat. In Verbindung mit der einfachen Bedienung bietet Spectra seinen Nutzern ein bemerkenswertes Erlebnis.
Fixed: slow internet on WSL 2 on Ubuntu 22.04 LTS on Windows 11
Tags: windows11, win11, wsl, ubuntu
Published: 2022-04-30 15:08:02

When upgrading from Windows 10 to Windows 11, you can certainly run into a lot of problems. One of them is the really slow internet speed in Ubuntu 22.04 LTS in WSL 2.

To solve this problem, you will need to follow a short instruction.

_TL;DL: if it seems easier and faster to you - reinstall the WSL feature._

A possible solution for Windows 10 is described in the instructions here - https://townsyio.medium.com/wsl2-how-to-fix-download-speed-3edb0c348e29 .
The solution is to change the **vEthernet adapter (WSL)** settings.
But in my case, it was not on the list of available.
The solution from [the github issue](https://github.com/microsoft/WSL/issues/4901) helped me:

-  Run **PowerShell** as administrator and run the following command, it will disable **vEthernet (WSL)**:

`Disable-NetAdapterLso -Name "vEthernet (WSL)"`

-  In the **WSL** terminal, run the commands:  

`sudo echo "[network]" > /etc/wsl.conf`
`sudo echo "generateResolvConf = false" >> /etc/wsl.conf`
`sudo rm /etc/resolv.conf`
`sudo echo "nameserver 8.8.8.8" > /etc/resolv.conf`
`sudo chattr +i /etc/resolv.conf` 

-  And then turn off WSL in the **PowerShell** terminal: 
`wsl --shutdown`
Where to deploy your node.js app [April 2022]
Tags: node, javascript, devops, webdev
Published: 2022-04-30 14:52:31

These are some of the services I've been trying lately to deploy my backend applications.

## [Cloudflare Workers](https://workers.cloudflare.com/)

Great DX, docs and community. Free course on egghead.io. Not compatible with all npm packages.

## [Begin](https://begin.com/)

Begin deploys your app to AWS while offering a "vercel-like" frontend. Only compatible with npm for now. They respond quickly by email.

## [Railway.app](https://railway.app/)
Railway is really promising. The web-app UX/UI reminds me of [Linear](https://linear.app/). Really good docs.

## [Render.com](https://render.com/)
Vercel-like experience for backend apps. Kinda slow if you're on the free tier. Great developer experience and easy to use and get going.

## [Digital Ocean](https://www.digitalocean.com/)
Slightly  higher learning curve but great option. Tons of tutorials and great documentation.

## [Heroku](https://www.heroku.com/)

Pretty much same as Digital Ocean. Really popular for beginners.

# Honorable mentions

## [Flight Control](https://www.flightcontrol.dev/)

New tool I haven't had the chance to try yet but looks really promising :)

If you liked it consider [following me on twitter](https://twitter.com/jordienr) :)
Postman API 101 Workshop
Tags: postmanapi, postmanstudent, gssoc22
Published: 2022-04-30 14:37:11

_Thanking Blog!!!_      Learned about API's and works with **postman API's** . Get to know the deeper understanding of paths, query and methods. In practical session Sending different types of _requests_ and _responses_ receive. Creating my first **JSON** file with the Hands on session. Know about Future opportunities with **postman**  thank you!! **Ali Mustufa sir** thank you organization for providing such wonderfull session!! 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t46dbb14q33z5ssbu2pv.jpeg)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ilwjik4glhzxwbp22iq.png)
HackerRank #30 | Map | 🇧🇷
Tags: java, map
Published: 2022-04-30 14:32:38

[Este problema](https://www.hackerrank.com/challenges/phone-book/problem?h_r=profile) pede para que, a partir de uma lista telefônica, seja inserido um número e retorne a mesma quantidade de contatos relativo à esse número.

O código começa assim:

```
//Complete this code or write your own from scratch
import java.util.*;
import java.io.*;

class Solution{
	public static void main(String []argh)
	{
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		in.nextLine();
		for(int i=0;i<n;i++)
		{
			String name=in.nextLine();
			int phone=in.nextInt();
			in.nextLine();
		}
		while(in.hasNext())
		{
			String s=in.nextLine();
		}
	}
}
```

=========

O resultado final é:

```
package com.possible.map;

import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new File("input.txt"));
        int n = in.nextInt(); // quantidade de contatos que vc quer
        in.nextLine();
        HashMap<String,Integer> listaTelefonica = new HashMap<>();

        for (int i = 0; i < n; i++) {
            String name = in.nextLine(); // pega o nome
            int phone = in.nextInt(); // pega o telefone
            listaTelefonica.put(name, phone);
            in.nextLine();
        }

        while (in.hasNext()) {
            String s = in.nextLine();
            if(listaTelefonica.containsKey(s)) // se existir
                System.out.println(s + "=" + listaTelefonica.get(s));
            else
                System.out.println("Not found");
        }
    }
}
```

=========

#### Referências

[Map](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html) : Oracle
[HashMap](https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html) : Oracle
[Map](https://www.devmedia.com.br/conhecendo-a-interface-map-do-java/37463) : DevMedia
Build Multiplayer TicTacToe using Flutter & Node.js
Tags: flutter, node, tutorial, socketio
Published: 2022-04-30 14:09:09


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

Learn to build an online multiplayer tic-tac-toe game. This game uses Flutter, Node.js, Express, Socket.io, MongoDB and Mongoose. This Flutter tutorial is for beginners looking to get some experience in Node + Flutter. You will learn to create and join rooms, play realtime without having the need to refresh the screen, display points and create a glow themed UI in Flutter. We will build an app available for Android, iOS, Web & Desktop!

Link: https://youtu.be/Aut-wfXacXg
What are your thoughts on the Oculus Quest 2 or other VR hardware?
Tags: discuss, vr, oculus
Published: 2022-04-30 14:04:38

Hey peeps!

I've been considering picking up an Oculus Quest 2 recently. Games like Vader Immortal are sooooo tempting (by the way, [it's 50% off right now!](https://www.oculus.com/experiences/quest/682579266195262/)). And then there's [SynthVR](https://store.steampowered.com/app/1517890/SynthVR/#:~:text=SynthVR%20is%20the%20synth%20nerd's,world%20of%20modular%20synth%20music.) which I'm sure I could easily get lost in for hours on end! Not to mention, there's [some really slick architecture apps](https://architizer.com/blog/practice/tools/young-architect-guide-vr-software/) that will let you create a home or building and then walk through it.

I lean toward the Oculus because of its low price and wireless-ness. I also have a couple of friends from back home that each have one and I think it'd be fun to reconnect with them, goof around, and [play some putt putt](https://www.oculus.com/experiences/quest/2462678267173943/) (their game of choice, haha).

So, what do y'all think? If you have a Quest, I'd love to hear what games you'd suggest. If ya have some other form of VR, then please tell me about it! I'm curious to learn more before I take the plunge and make the purchase. 🙂
Discord OAuth2 redirect uri invalid
Published: 2022-04-30 13:57:57

Hey there! I tried creating a discord login for my website, but it always gives me the `Invalid OAuth2 redirect_uri` for my webpage even though it should be correct. My website is currently locally under localhost:3000 and I added the uri as `localhost:3000/api/auth/callback/discord`. Does anyone know what I did wrong here? I am using latest Next auth afaik.