teleren/devto huggingface dataset:
Cloud native app development using Dell XPS 13 Plus Developer Edition and MicroK8s
Tags: dellxps13, kubernetes, ubuntu, docker
Published: 2022-10-20 02:43:56

The Dell XPS 13 Plus Developer laptop is an ideal machine to use for local cloud-native application development with Kubernetes and I’m going to show you how to get started.

Using MicroK8s is ideal for this use case, it’s a project from Canonical to enable lightweight single or multi-node Kubernetes environments. The XPS 13 Plus Developer Edition is a powerful laptop and if you want to know more about the specs please check out my colleague Barton George's blog for the details. Let’s explore why Dell XPS 13 Plus Developer Edition with MicroK8s is a great fit for cloud native development.

- The XPS 13 Developer edition comes with Ubuntu 22.04 LTS Linux.
- It comes preloaded with development toolchains like Python, PHP, Ruby, Go, Rust and more.
- Native support for snapd and the snap store.
- Easily install cloud native developer tooling such as Canonicals’ MicroK8s and Docker via snap.
- Native options for lightweight virtualization with LXD and multipass.
- MicroK8s closely follows upstream Kubernetes releases with snap channels.

[Step by step guide on how to use Dell’s XPS 13 Plus Developer Edition for Cloud Native App Development](https://www.dell.com/community/Developer-Blogs/Cloud-native-app-development-using-Dell-XPS-13-Plus-Developer/ba-p/8285390)
LeetCode's Add Two Integers Solution - Java
Tags: leetcode, java, tutorial, algorithms
Published: 2022-10-20 02:22:35

# 2235. Add Two Integers

## Intuition

I first looked at the inputs that are given to the program. I walked through a simple version of the problem in my head and then in pseudocode.

## Approach

I take the 2 inputs, add them together, and return the sum.

## Complexity

- Time complexity:
O(1)

- Space complexity:
O(1)

## Code

GitHub: <https://github.com/Verisimilitude11/LeetCode-Problems/tree/main/2235.%20Add%20Two%20Integers>

```java
class Solution {
    public int sum(int num1, int num2) {
        return num1 + num2;
    }
}
```
How would you explain JavaScript functions to a 5 yr old ?
Tags: javascript, beginners, functions, webdev
Published: 2022-10-20 02:09:03

##JS Functions 

Say you need someone to fix your pipes at home. 
Whom would you call ? 
A plumber! 

What does a plumber do? 
He fixes pipes, drains and deals with everything related to your water connection. 

Say you need someone to teach you math. 
Whom would you call ? 
A math teacher! 

What does a math teacher do ? 
She teaches everything relating to math like adding, subtracting , dividing and all the other good stuff. 

Say you need a 
.
.
.
.
.
.
.
.
You get the point. 

In JavaScript a function is a reusable piece of code that does a very specific task and it can be called anytime during the execution of the program.

So in the case of our plumber it would look something like this 

```
function plumber(){
console.log('I am here to fix your commode');
}

plumber();
```

What I have done above is called as a function declaration. 
I have declared a function called plumber in line 1 and subsequently in line 2 the function does whatever it is supposed to do. 

Declaring a function is not enough. Functions are reusable, hence we can call them anytime we need them. 

Back to our scenario. The plumber for whatever reason has forgot to  bring his equipment to work. Fortunately you have a spanner, hammer and a plunger at home. You give him the equipment. 

In programming it's called 'Passing the arguments' 

How would you do that? Simple. Pass them when you call the plumber.

`plumber(🔧,🔨,🪠)`

He will use the above equipment to fix your commode. 

```
function plumber(🔧,🔨,🪠){
🔧 + 🔨 + 🪠= 🚽
console.log('I am here to fix your commode');
}

plumber(🔧,🔨,🪠);
```
Hacktoberfest week 3
Published: 2022-10-20 02:07:57

For this week in hacktoberfest I worked on a react project. The task was fixing a bug inside their filter drop down menu where when a user selected a tag the content wasn't being filtered.

# What did i do

[AnkitaMalik22/devmate](https://github.com/AnkitaMalik22/devmate)

[Issue](https://github.com/AnkitaMalik22/devmate/issues/35)

[Pull Request](https://github.com/AnkitaMalik22/devmate/pull/69)

The most difficult part of this project was getting back into react. I used it a lot for my capstone project however I haven't touched it since. The bug wasn't to bad i just needed to reformat how they were doing the filtering, I just simplified their logic and made it work better.

# Whats next

My final pull request in hacktoberfest is going to be inside of telescope Seneca's own open source program.

[Issue](https://github.com/Seneca-CDOT/telescope/issues/3639)

###Wish me Luck!
Gentle Intro to Node Streams
Tags: node, streams, javascript, tutorial
Published: 2022-10-20 01:10:00

[Youtube](https://www.youtube.com/watch?v=2NFADNFeTZ4)
[Stackblitz](https://stackblitz.com/edit/node-catkqo?file=index.js)

[Reference](https://nodesource.com/blog/understanding-streams-in-nodejs/) 

## **There are 4 types of streams in Node.js:**

1. **Writable:** streams to which we can write data. For example, `fs.createWriteStream()` lets us write data to a file using streams.
2. **Readable:** streams from which data can be read. For example: `fs.createReadStream()` lets us read the contents of a file.
3. **Duplex:** streams that are both Readable and Writable. For example, `net.Socket`
4. **Transform:** streams that can modify or transform the data as it is written and read. For example, in the instance of file-compression, you can write compressed data and read decompressed data to and from a file.

```tsx
import * as fs from 'fs';
// this works but let's use async iterator aka for loop
// to show the readable stream is an array whose elements
// are loaded as chunks of data
// const asyncIterableLogChunks = async (readable) => {
//   readable.on('data', (chunk) => {
//     console.log(chunk);
//   });
// };
const asyncIterableForLoopForReadableStream = async (readable) => {
  for await (const chunk of readable) {
    console.log(chunk);
  }
};

const readable = fs.createReadStream('./file.txt', { encoding: 'utf-8' });
// asyncIterableLogChunks(readable);
asyncIterableForLoopForReadableStream(readable);
```

- The stream is an array of data loaded into server memory 1 chunk at a time and operated on, then sent somewhere, before the next chunk comes. It’s kind of like a roller coaster. Only one group can get in and ride at a time. You might say the chunks are, in a sense, synchronous with respect to each other, notwithstanding the fact that the chunking process of streams per se is async, meaning, it can be paused and resumed in order to accommodate other node processes in the event loop.
- Let’s pause and contemplate before we dive further. What is the point of this? To incorporate server side data fetching streamed into react components as props using higher order component pattern. That is my interpretation of React RFC 229

{% twitter 1582193355605221378 %} 
{% twitter 1582194272513986560 %} 
{% twitter 1582607440847470592 %}
Dynamic Scanning While You Work; Meet the OWASP PTK
Published: 2022-10-19 23:49:53

The Penetration Testing Kit, or PTK, is a tool we utilize heavily at True Positives to ease various tasks. It's a free, open-source browser extension developed by one of our firm's key advisors, Denis Podgurskiy. 

Designed for penetration testers, offensive security teams, and developers — PTK powers productivity with advanced recon, weaponization, attack-exploit capability, and carefully matched utilities.​

The tool gets enhanced quite often. To allow Selenium integration, most recently, which got it trending among security experts and developers.  

Learn more about the OWASP PTK.
(https://www.true-positives.com/ptk-tool​)

Learn more about True Positives, LLC,
True Partners in Application Security Assurance & Automation 
(https://www.true-positives.com)

Learn about Enterprise Level Application Security for your small business starting for Free. (https://www.true-inspect.com)
Day 639 : Trouble
Tags: hiphop, code, coding, lifelongdev
Published: 2022-10-19 23:32:20

_liner notes_:
- Professional : Not a bad day. Had a couple of meetings. Reached out to a couple of developers that expressed interest in a thing I'm building. Reviewed an application and got it up and running to test out the code. Then I checked over some documentation to make sure the code stuff made sense. I started working on a script since I'm having so much trouble pre-recording this talk. I don't know why I'm having such trouble with this. Good news is that I'm almost done. Bad news is that I think I'll have to record it tomorrow when I have a full day of meetings and a workshop that I'll be doing. Awesome! haha

- Personal : Last night, I basically spent a couple of hours trying to record this talk. I would make some progress and then something would mess up slightly and I'll start all over again. When I do it live, if I make a mistake there's no going back so I have to keep it moving. I also think a big part is that there are no other people. Just me and a camera. No feedback or energy. I even like doing it live online better than prerecording. Matter of fact, my workshop tomorrow is live online. So yeah, couldn't get it recorded, so I called it a night and watched the new episode of "Chainsaw Man" and went to sleep.

![View looking out on the Rarău Mountains, Romania chain of mountains covered in pine trees.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7yzphor4euswrc0hltj.jpg)

Going to finish the script. Setup the workshop. Maybe watch an anime. Go to bed so I can get up early and try to record the talk before my busy, meeting filled day. I'm out!

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube B-iP-L-RXHQ %}
Set Environment Variable (.env) in NextJS
Tags: javascript, nextjs, webdev, react
Published: 2022-10-19 23:09:43

**My environment variables aren’t working** 😱😱😱
You might be in this situation,  you want to use a .env file to hide API URL or secret key during development in your NextJS app. Let’s see how we can set things up correctly.

###How do I use environment variables in Next.js?
Simple! In the root of your Next.js application create a .env file. Inside this file, declare all environment variables you need like this:

```
STRIPE_KEY = "*************"
API_KEY = "<Your API KEY>"
```
Then, in your code you can reference these variables

##Using next.config.js
NextJS provides you with the feature of using environment variables in your application. You need to define your variable in a .env.local file in the root folder.
Create a.env.local file to declare all your environment variables.

```
API_KEY = "<Your API KEY>"
```
The variable defined in the .env.local is now available on the server side. If you console.log the **API_KEY** in the frontend, you will see undefined in the console of your dev tool.

```
console.log(process.env.API_KEY)
```
To get the environment variable available to the frontend we need to configure the next.config.js file.

```
const nextConfig = {
  env:{
    API_KEY: process.env.API_KEY
  }
}
```
Now the API_KEY will be available in the frontend and if you console.log, you will get the value.

‼️**Note: Restart the server to see the changes**



##Using ‘NEXT_PUBLIC_’
The latest version of nextJS comes with the feature to avail environment variables to the frontend without configuring the next.config.js. You have to prefix the variable in .env.local with **NEXT_PUBLIC_**

```
NEXT_PUBLIC_JWT_SECRET = "<Your secret>"
```
This will load the variable to the frontend with the name **NEXT_PUBLIC_JWT_SECRET**. You can access the value through **process.env.NEXT_PUBLIC_JWT_SECRET**

```
console.log(process.env.NEXT_PUBLIC_JWT_SECRET)
```
##Using ‘dotenv’ library
If you use the [dotenv](https://www.npmjs.com/package/dotenv) library to load the environment variable, you can integrate it easily in NextJS.
The process follows a similar pattern as configuring the next.config.js. Install the library and create the .env file in the root directory. Initialize the variable with the value as you normally do.

```
API_KEY = "<Your API KEY>"

```
Now, we have to configure the next.config.js. First, we need to import the dotenv library.

```
require("dotenv").config
```
Now, we have to load the variable to the frontend by adding it to the file.

```
const nextConfig = {
  env:{
    API_KEY: process.env.API_KEY
  }
}

```
Now, you will have the environment variables in the frontend.

##Conclusion
You can use any method mentioned above to load the environment variable. Thanks for reading the article.
SQLAlchemy Intro
Tags: sqlalchemy, python, database
Published: 2022-10-19 22:47:09

SQLAlchemy es una librería que facilita la comunicación entre programas hecho en Python y base de datos. Mayormente es utilizada como una ORM (Object Relational Mapper) que traduce las clases de Python a tablas en base de datos relacionales y que automáticamente convierte las funciones utilizadas a sentencias SQL. SQLAlchemy como la mayoría de herramientas provee una interfaz estándar que nos permite como desarrolladores crear la estructura y código de forma agnóstica del motor de base de datos a comunicarse, esto nos permite migrar de un motor a otro solo cambiando la cadena de conexión.

SQLAlchemy interactúa de forma directa con la API que integra la Base de datos de forma directa permitiéndonos utilizar funciones como connect, close, commit, rollback etc. Para cada motor de base de datos debemos de instalar el DBAPI que mas se adapte a nuestras necesidades para conectarnos a la base de datos.

Siempre que deseemos usar SQLAlchemy para interactuar con una base de datos, necesitamos crear una instancia de Engine (motor), esta instancia es la encargada de administrar dos factores cruciales Pools y Dialects. 

Para crear la instancia del motor de base de datos utilizamos el siguiente código:

from sqlalchemy import create_engine

engine = create_engine(f’{motor_DB}://{user}:{pass}@{dirección_server}:{puerto}/{base_datos}’)

La estructura anterior tiene variables que pueden ser extraídas de un archivo .env para mejorar el proceso de desplegué del programa. En algunos casos será necesario pasarle el parámetro del driver o un conector ODBC.

Las conexiones agrupadas son la implementación mas utilizada en el patrón de grupos de objetos, estos grupos son utilizados como objetos pre inicializados en cache para que estén listos para su uso. En lugar de invertir tiempo creando objetos que son utilizados frecuentemente el programa utiliza un objeto preexistente. La principal razón para utilizar este patron de diseño es para mejorar el performance. Con las conexiones a base de datos el tiempo consumido y la cantidad de recursos mal utilizados volverían nuestra aplicación lenta y pesa para cualquier servidor.

SQLAlchemy Dialects nos permite crear aplicaciones que se comunican con diferentes motores de base de datos en la misma API. Los motores de base de datos mas populares han agregado el uso de SQL dentro de dialects, sin embargo, esto en algunas ocasiones puede generar un serio problema debido a que el código SQL no es un estándar entre los diferentes motores de base de datos, ya que estos últimos han personalizado la sintaxis para obtener los mismos resultados. 

Para evitar que la migración de un motor a otro genere cambios significativos en nuestro código, se recomienda hacer uso del ORM como tal, crear la conexión de base de datos, crear los modelos de las tablas y los queries necesarios, con esto podremos asegurarnos que nuestra aplicación podrá mudarse de motor de base de datos con los cambios mínimos.

En el próximo post estaremos creando un ejemplo donde se incluyan el código SQL y una consulta con el ORM.
Full Stack Application with Azure SQL & Prisma
Tags: webdev, beginners, tutorial, azure
Published: 2022-10-19 21:40:10

Fullstack and Jamstack architectures are common nowadays, but they can be quite intimidating if you are just getting started in the web development space. So many concepts, technologies and patterns to grasp. And so many alternatives! 

Well, thanks to @glaucia86 you now have a *full series* on the top-notch technologies, like:

- Node.Js
- Prisma
- Azure SQL
- Azure Functions
- Azure Static Web Apps & GitHub Actions

With [37 small videos](https://learn.microsoft.com/en-us/shows/beginners-series-to-learn-a-full-stack-application-with-azure-sql-prisma/) from Glaucia and other amazing contributors (@ruheni and @cmaneu) you can really have a jumpstart in all related technologies. And of course, a full repository is available too:
https://github.com/glaucia86/azure-sql-prisma-vue

Don't miss this content, it is pure gold!

## Introduction

01 - Course Overview
02 - Learning Objectives

## Module 01 - Prisma Fundamentals

03 - What is Prisma?
04 - Why we Should use Prisma?
05 - Key Concepts about Prisma
06 - Important Resources & Recap

## Module 02 - Azure SQL Fundamentals

07 - Module 02: Overview
08 - What is Azure SQL?
09 - Why should we use Azure SQL?
10 - Azure SQL Support in Prisma
11 - Important Resources & Recap

## Module 03 - Azure Static Web Apps Fundamentals

12 - Module 03: Overview
13 - What is Azure Static Web Apps?
14 - Understanding the Azure Static Web Apps Workflow
15 - Why should we use Azure Static Web Apps?
16 - Which libs/frameworks can I use with Azure Static Web Apps?
17 - Important Resources & Recap

## Module 04 - Dev Tools

18 - Dev Tools Overview & Installation
19 - Configuring the .devContainer folder
20 - Important Resources & Recap

## Module 05 - Application Development

21 - Application Overview
22 - Forking the Front-End project
23 - Structuring the Back-End project
24 - Creating Database Server
25 - Creating Database
26 - Creating Shadow Database
27 - Installing Packages
28 - Modeling Database with Prisma
29 - Using Prisma Migrations
30 - Using Prisma Studio
31 - Developing 'CreateEmployee'
32 - Developing 'GetEmployees'
33 - Developing 'GetEmployee'
34 - Developing 'UpdateEmployee'
35 - Developing 'DeleteEmployee'
36 - Deploying the App with ASWA

## Module 06 - Next Steps

37 - Next Steps

Remember, here's the link to the video playlist

https://learn.microsoft.com/en-us/shows/beginners-series-to-learn-a-full-stack-application-with-azure-sql-prisma/

And here's the related GitHub repo:

https://github.com/glaucia86/azure-sql-prisma-vue
TILT: Things I Learned Today
Published: 2022-10-19 21:20:32

- When adding a new object using the .new method in the console, it is similar to adding the object/data in the database directory 
- Better understanding of the .order({}) method
- Better understanding of the .where({}) method 
- ApplicationRecord is where we retrieve the database schemas/database columns 
- Question: How do we know what classes / models are related to databases (so we know when to put them in the models folder)?
Matando pods jogando DOOM
Tags: kubernetes, braziliandevs
Published: 2022-10-19 21:07:57

Já imaginou matar `pods` usando a interface do DOOM?
Isso existe! kkk

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

https://github.com/storax/kubedoom
Free fitness coaching for IT professional
Tags: fitness, weightloss, fatloss
Published: 2022-10-19 20:26:26

Hey group 💪!
My name is Marius and **I help busy IT professionals to lose weight and get in shape without spending endless hours exercising.**

First of all: I have **nothing** to sell you. I am just looking for **free** **test** **clients**.

With my background in IT, I know the struggles you are facing. I faced them myself and built a system that makes losing weight and getting in shape as enjoyable as possible.

I am looking for **3-5 test clients** that want to beta test my program for **free**. The only thing I am asking in exchange is a testimonial if you are successful with my program.

**Requirements:**

- You are ready for a big change
- You are serious about your goals
- You are committed to following the program for at least 8 weeks

To apply for the coaching just comment down below 👇
We're blessed to work as Developers 🙏🏻🙏🏻
Tags: community, career, devjournal
Published: 2022-10-19 20:18:33

Hi guys, I'm [Kristian Lentino](https://www.linkedin.com/in/kristian-lentino-941694166/), 23 years old at the moment I'm writing this post and in these 2 days I was at **Codemotion**, **the biggest Italian conference for developers** where there were some really important speakers as the creator of Redis Salvatore Sanfilippo(Woooowwww the Redis's creator is Italian what an honor 😍😍) and more than 1k of super nerd devss!


![Gabriele Santomaggio speech](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l5tdgd1ujix3yxrpsve2.jpeg)

Today was the last day of the conference and when I was driving back home I was reflecting about how we're lucky in our jobs, yes lucky!
We have a lot of communities, tools for free made by passionate people who want to give their contribution to the entire world, speakers who introduce to you a lot of really interesting topics and help you to familiarise with them. Maybe the developer is the only job where you can find such a community, it's amazing to see how many passionate people you can find out there, both online and in conferences. I spent a lot of hours talking to total strangers discussing how I work,  what I think is important in a company and also dispensing some tips from my previous experiences to help other people to not redo my same mistakes. 

It was my first big conference about the devs world and it opened my eyes on how we can help each other and how our job is "open-source".

I really think that this aspect of ours is really important, we love to each other and help or just contribute to create new things because we are really curious people and we always want new stimulations that gives us the curiosity to put ourself in the game

What do you think about the conference world? Do you think that they're useful? if not, why? I'm really curious to hear a lot of different point of views!

Like some old anime's character said , after this conference I'm all fired up !!!

![Natsu fairy tail](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/svj1ac01awwdqx9qc0nw.png)


### Here some cool faces that were talking about GitOps, Docker, KS, Scala and many other topics


![Some happy faces](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/057xpvom8xn212c2ubn1.jpeg)