teleren/devto huggingface dataset:
LeetCode 120. Triangle
(javascript solution)
Tags: algorithms, javascript
Published: 2021-04-23 03:29:06

###Description:
Given a triangle array, return the minimum path sum from top to bottom.

For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row.

###Solution:
Time Complexity : O(n^2)
Space Complexity: O(1)

```javascript
var minimumTotal = function(triangle) {
    // Start from the 2nd to the bottom of the triangle
    for (let i = triangle.length-2; i >= 0; i--)
        // Add previous row cells to current cells and set the sum that is the smallest
        for (let j = 0; j < triangle[i].length; j++)
            triangle[i][j] += Math.min(triangle[i+1][j], triangle[i+1][j+1])
    // The cell at the top of the triangle will be the smallest sum of the path that goes from the bottom to the top
    return triangle[0][0]
}
```
JavaScript Data Structures and Algorithms (Linked Lists, part 2: Doubly-Linked Lists)
Tags: codenewbie
Published: 2021-04-23 03:27:14

Hello and welcome back! On my last post, I went over the operations used when working with singly-linked lists, namely append, prepend, lookup, insert, and delete, by building a simplified linked-list from scratch. I'm sure the whole time you read my last you were wondering if I was aware that I hadn't mentioned anything regarding a node's pointers. Well, I forgot. So here I am covering one of the characteristics that separates a singly linked list from the next sub-data structure I will cover: doubly-linked lists.

**Pointers and Doubly Linked Lists**
If the namesake isn't enough of a giveaway, pointers in a singly-linked list point towards a single direction, from head to tail. This does not mean that a linked list is sorted, like an array. It means that the node in question simply points to another node in a sequential, but not enumerated, order. This is why looking up a node in a linked list has linear time complexity O(n). Singly linked lists require traversal to access their values. If we look back at arrays, we see that iteration, an array's equivalent to the lookup operation, also runs in O(n) time. One thing that array lookup has over linked lists, is random access of the elements in the data structure. We can look up array elements by their indices, and return a value in O(1) time, but to look up a node in a linked list requires traversal, starting from the head node, down the linked list one-by-one, comparing values until we reach the target node. That's where pointers come in. Pointers are refs to the next node in a linked list. It points our search in a sequential order. However, we there is a way to include pointers in two directions. *Doubly Linked Lists*, in fact, contain such pointers. One group of pointers leading from the head node to the tail node, and another set pointing from the tail node to the head node. Unfortunately, all this does is increase the allocated memory due to the second set of pointers. What's more is that lookup remains with a time complexity of O(n), since we must traverse a linked list the same, regardless of the starting end. 

I will keep this one brief, since the difference between doubly linked lists is pretty much splitting hairs. Traversal works the same way, plus a method for traversing from tail to head. Next time I will move on to the next data structure that is likely to be encountered during a technical interview: trees. Until next time!
LeetCode 64. Minimum Path Sum
(javascript solution)
Tags: algorithms, javascript
Published: 2021-04-23 03:19:03

###Description:
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.

Note: You can only move either down or right at any point in time.

###Solution:
Time Complexity : O(n^2)
Space Complexity: O(n^2)

```javascript
var minPathSum = function(grid) {
    // Create table
    const dp = new Array(grid.length).fill(0).map(() => Array(grid[0].length).fill(Infinity));
    // Add starting value
    dp[0][0] = grid[0][0]
    // Populate table
    for (let i = 0; i < dp.length; i++) {
        for(let j = 0; j < dp[0].length; j++) {
            // Add current cell total to cells to the right and below if the current cell + grid value of cell right/below is less than that cell's current total
            if(i+1 < dp.length) dp[i+1][j] = Math.min(dp[i+1][j], dp[i][j]+grid[i+1][j])
            if(j+1 < dp[0].length) dp[i][j+1] = Math.min(dp[i][j+1], dp[i][j]+grid[i][j+1])
        }
    }
    return dp[dp.length-1][dp[0].length-1]
};
```
On the hunt for ideas & collaborators for node-coding-challenges
Tags: node, challenge, github, javascript
Published: 2021-04-23 03:08:59

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

Hi, my name's Alex and I created [react-coding-challenges](https://github.com/alexgurr/react-coding-challenges) on GitHub.

We've built up a community, got some ⭐️ and due to popular demand are expanding into the nodeJS space.

I'm on the lookout for challenge ideas, help or collaborators for the new open source repo, [node-coding-challenges](https://github.com/alexgurr/node-coding-challenges).

I'd love for this to have lots of challenges of varying difficulties, however maintaining this many open source projects at once is a real challenge!

Post an idea [here](https://github.com/alexgurr/node-coding-challenges/discussions/categories/ideas), get in touch at [alexgurr.com](https://alexgurr.com) or have a conversation in the comments below!

Take a look at the new challenge template [here](https://github.com/alexgurr/node-coding-challenges/blob/main/new_challenge_template.md) and [what makes a good challenge](https://github.com/alexgurr/react-coding-challenges/blob/master/README.md#what-makes-a-good-challenge).
Console Application Input Library in Java.
Tags: java, console, input
Published: 2021-04-23 02:51:31

Hi all, 
I will introduce a library to build console application with more easier, and with this library, you can make fine interactive methodology on your console application.

You can define queries for user input using this library on your application and later, you able to use the input data in your code.

All queries are managed with YAML file and you can redefine message content of it. 
You can manage trigger process by implementing ConsoleTrigger interface and treat user input data on this object.

More detail thing of this library to get, you can have it to visit below GitHub project.

## Dependencies

## Maven dependency
```xml
<!-- https://mvnrepository.com/artifact/io.github.9ins/console-input-manager -->
<dependency>
    <groupId>io.github.9ins</groupId>
    <artifactId>console-input-manager</artifactId>
    <version>1.0.1</version>
</dependency> 
```
 
## Gradle dependency
```groovy
// https://mvnrepository.com/artifact/io.github.9ins/console-input-manager
implementation group: 'io.github.9ins', name: 'console-input-manager', version: '1.0.1' 
```

GitHub link: [console-input][https://github.com/9ins/console-input-manager]
April 22nd, 2021: What did you learn this week?
Tags: weeklylearn, discuss, weeklyretro
Published: 2021-04-23 02:31:42

It's that time of the week again. So wonderful devs, what did you learn this week? It could be programming tips, career advice etc.

<center>

![Image of the brain](https://media.giphy.com/media/ojmB7lOn3VUU8/giphy.gif)
</center>

Feel free to comment with what you learnt and/or reference your TIL post to give it some more exposure.

{%tag todayilearned %}
Week1: NPM & Package-lock.json
Tags: npm
Published: 2021-04-23 02:10:37

###How to install npm
When you install nodejs you will get npm along with it
https://nodejs.org/en/download/

To check node and npm version
```
node -v
npm -v
```

#####NPM stands for Node Package Manager
- it is a package manager for Javascript

####The uses of npm are
- It is an online repository for the publishing of open-source Node.js projects

FOR EXAMPLE:
if you want to import the testing framework you can just install it by
```
npm install --save-dev jest
```
- It is a command-line utility for package installation, version management, and dependency management.

FOR EXAMPLE:
if you have module `@jest/core`, you can update to the latest version by
```
npm install @jest/core@latest
```

Once you install the library, it will store in `node_modules`

Normally, `node_modules` gonna be a big folder, so you do not push it into git. 

It is recommended to have `package.json` and `package-lock.json`, to help you know those libraries and their versions

To create a package.json file
```
npm init
```

Package.json - list the version of its dependencies (library we install), and also other project information such as name, version, author, script, etc.

Package-lock.json - list solely about the dependencies in depth

Now when you want to install those libraries, npm can get the info from `package-lock.json`

To install dependencies just run:
```
npm install
```


##Also keep in mind that:
- You can have only `package.json`
- But you can not have only `package-lock.json` file

`package-lock.json` have to come with `package.json`

** And both files need to be stored in git

Reference:
https://nodejs.org/en/knowledge/getting-started/npm/what-is-npm/
https://stackoverflow.com/questions/45052520/do-i-need-both-package-lock-json-and-package-json#:~:text=No.-,The%20package.,to%20a%20specific%20version%20number.
Azure SQL Revealed
A Guide to the Cloud for SQL Server Professionals
Tags: azure, microsoftazure, sql, database
Published: 2021-04-23 00:48:56

[Download your free copy of Azure SQL Revealed](https://reader.apressbooks.com/Microsoft/azure-sql-revealed/?ocid=eml_pg240146_gdc_comm_az&mkt_tok=MTU3LUdRRS0zODIAAAF8mbQv3PpmJIo-HIHrTgp08CgGEhbfmkrRsguNXYuDUgFvKIW74-CudPgxb5mopxnB17ak8XSQbSyHIc_-TdtmCJJvbDlwM5iznmd6GYBQ69tGJ2cLSyE) to:
Learn by doing as you work through examples and code downloads.

Understand the different Azure SQL services: SQL Server on Azure Virtual Machines, Azure SQL Managed Instance, and Azure SQL Database.

Determine which Azure SQL option best meets your needs.
Master securing your data, boosting performance, and achieving high availability with Azure.

[DOWNLOAD NOW](https://reader.apressbooks.com/Microsoft/azure-sql-revealed/?ocid=eml_pg240146_gdc_comm_az&mkt_tok=MTU3LUdRRS0zODIAAAF8mbQv3PpmJIo-HIHrTgp08CgGEhbfmkrRsguNXYuDUgFvKIW74-CudPgxb5mopxnB17ak8XSQbSyHIc_-TdtmCJJvbDlwM5iznmd6GYBQ69tGJ2cLSyE)

#azure #microsoft #sql #data #database #microsoftazure
100 days of machine learning 
Tags: 100daysofcode, machinelearning, python, pproductivity
Published: 2021-04-23 00:45:10

Hello forks!
I am an amateur developer and newbie at machine learning.
As you know this year has been tough not just healthwise, but also productivity wise.
So inorder to stat focused I am going start a blog post called 100 days of machine learning...
In this first we will cover machine learning from 0th level and then make two projects using the same!
Today marks as day 0.
Stay tuned!
How to make Spatie Ray work with Laravel Sail
Tags: laravel
Published: 2021-04-23 00:30:04

1) sail composer require spatie/laravel-ray --dev
2) php artisan ray:publish-config --docker
3) Set the values in ray.php to:

'host' => 'host.docker.internal',
'port' => 23517,
'remote_path' => '/var/www/html',
'local_path' => '/Users/me/projects/project'

<u>OR</u>

Add this to your .env file:
RAY_HOST=host.docker.internal
RAY_PORT=23517
RAY_REMOTE_PATH=/var/www/html
RAY_LOCAL_PATH=/Users/me/projects/project

4) Add '127.0.0.1 host.docker.internal' to /etc/hosts 

For docksal the setup is:

RAY_HOST=192.168.64.100
RAY_PORT=23517
RAY_REMOTE_PATH=/var/www/web
RAY_LOCAL_PATH=/Users/me/projects/project/web
How to redirect a user from the server or using the getServerSideProps() function in Next.js?
Tags: nextjs
Published: 2021-04-23 00:00:00

---
  title: How to redirect a user from the server or using the getServerSideProps() function in Next.js?
  published: true
  tags: Nextjs
  date: Fri Apr 23 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/redirect-user-from-server-getserversideprops-nextjs
  cover_image: https://melvingeorge.me/_next/static/images/main-57762bb7d08308090d8a9f1b0c8645ad.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/redirect-user-from-server-getserversideprops-nextjs)
  
To redirect a user from the server-side or using the `getServerSideProps()` function in Next.js, you can use the `redirect` key with an object containing the `destination` property set to the path you want to redirect the user to and a `permanent` property with a boolean value in the return object from the `getServerSideProps()` function.

It can be done like this,

```js
export async function getServerSideProps() {
  return {
    redirect: {
      destination: "/login",
      permanent: false,
    },
    props: {},
  };
}
```

For example, let's consider a Next.js page called `/app`, and we want to redirect the user to the page `/login` route if the user visits the `/app` page.

For that First let's create a Next.js Page called `app.jsx` like this,

```jsx
// Next.js Page: /app
export default function App() {
  return <div>Hello World!</div>;
}
```

Then we can create the `getServerSideProps()` function which will be called whenever the user visits the `/app` route or page.

It can be done like this,

```jsx
// Next.js Page: /app
export default function App() {
  return <div>Hello World!</div>;
}

// getServerSideProps() function
export function getServerSideProps() {
  // redirect logic here
}
```

Inside the function, we can redirect the user to a particular route using the `redirect` key with an object containing the `destination` property set to the path you want to redirect the user to, in our case, it is the `/login` route and the `permanent` property set to the boolean value `false` in the return object.

it can be done like this,

```jsx
// Next.js Page: /app
export default function App() {
  return <div>Hello World!</div>;
}

// getServerSideProps() function
export function getServerSideProps() {
  return {
    redirect: {
      destination: "/login",
      permanent: false,
    },
    props: {},
  };
}
```

Now whenever the user visits the `/app` page or route, he will be redirected to the `/login` page.

### NOTE: It is important to return the `props` object from the `getServerSideProps()` function even if you don't want any props to be passed to the page component.

### This feature is only available in Next.js version 10 and up.

That's it! 😃

### Feel free to share if you found this useful 😃.

---
Work as if your team is quitting
Tags: practices, devops, team, culture
Published: 2021-04-26 07:02:24

---
title: Work as if your team is quitting
published: true
date: 2021-04-23 00:00:00 UTC
tags: practices,devops,team,culture
canonical_url: https://jhall.io/archive/2021/04/23/work-as-if-your-team-is-quitting/
---

Long gone are the days of 30-year careers. The average job tenure according to a [2020 survey](https://www.thebalancecareers.com/job-tenure-and-the-myth-of-job-hopping-2071302) was 4.2 years.

This means if you have a team of 8, you can expect someone to leave every 6 and a half months, on average. Anecdotal evidence suggests it may be even more frequent for many IT-related roles.

Despite this, I frequently see managers, and even individual contributors, go into a panic when a colleague announces their plans to leave the company for greener pastures elsewhere.

Prepare yourself for the inevitable. Be constantly documenting any special knowledge, so knowledge doesn’t leave with your teammates. Increase your [bus factor](https://en.wikipedia.org/wiki/Bus_factor) with cross-training. And just be emotionally prepared for employee churn!

* * *
If you enjoyed this message, [subscribe](https://jhall.io/daily) to _The Daily Commit_ to get future messages to your inbox.
Como aprendi Go en 3 dias
Tags: discuss, go, spanish, backend
Published: 2021-04-22 23:59:11

En este post estaremos hablando acerca de **Go**, Compartiré algunos recursos, opiniones y recomendaciones que fueron muy útiles para mí.
Y sé lo que estás pensando y **SI!**, sé que el título puede parecer un poco clickbait, pero, **ESPERA!**
Puedo explicarte si esto realmente es cierto o falso.
Así que, empecemos.


## ¿Cómo logre esto?
Bueno, realmente no podría decir que domino Go, pero en estos 3 días me siento muy bien con los resultados obtenidos.
En estos 3 días mi rutina de estudio fue de alrededor de 4 horas, de las cuales 3 me las pasaba viendo tutoriales o la documentación oficial, y la otra hora me la pasaba experimentando cosas que quería saber si funcionaban o como funcionaban en Go.
Ahora mismo me siento bastante bien para empezar algunos proyectos pequeños y así mismo ganar experiencia.

## ¿Por qué el título?
El título puede ser completamente falso o engañoso en caso de que sea tu primer lenguaje, y si este es tu caso, no te preocupes, con el tiempo podrás aprenderlo también, pero claramente tendrás que ir más paso a paso.

Así que, de nuevo, el título no es literal, pero en caso de que este no sea tu primer lenguaje pues puedes empezar a aprender y en 3 días podrías hacer algunas cosas que más adelante te diré.

## En 3 días que debes o puedes aprender
3 días, esto puede sonar un poco loco, pero es posible aprender lo necesario para buscar un trabajo (Nah, estoy bromeando 🤣)
Bueno, después de esa mala broma, después de esos 3 días podrás empezar a hacer proyectos como alguna API simple y cosas por el estilo y así con el tiempo volverte un Master de GO.
Te recomiendo que empieces a aprender en este orden:

* Variables
* Primitives
* Constants
* Arrays y Slices
* Maps y Structs
* If y Switch Statements
* Looping
* Defer, Panic, y Recover
* Pointers
* Functions
* Interfaces

Sinceramente, para mí lo que más complicado me ha sido son los Pointers y las Interfaces, aún no los logro comprender al 100%, te recomiendo prestes mucha atencion a todos los temas pero mas en especial a esos porque pueden ser un poco confusos.

# Recursos
Los recursos que te dejaré acá son completamente GRATIS y los dividiré por idioma, Ingles y Español

### English resources 
* [FreeCodeCamp 7 hours course from scratch](https://www.youtube.com/watch?v=YS4e4q9oBaU) 
* [The official tour of Go](https://tour.golang.org/)
* [The playground of Go, without installations](https://play.golang.org/)

### Recursos en Español 
[Este repositorio ya trae una gran cantidad de recursos en español](https://github.com/gophers-latam/awesome-latam)

## Gracias por leer este post
Muchas gracias por leer este post hasta el final, si te ha gustado deja tu corazoncito y tu follow aca y en mi [github](https://github.com/SantiagoVA) donde en los proximos dias empezare a subir alguno que otro repositorio de algún proyecto en go :)
You're only as good as your last talk (100 Bytes Of Wisdom: Day 44)
Tags: career, journey, advice
Published: 2021-04-22 23:41:11

---
title: You're only as good as your last talk (100 Bytes Of Wisdom: Day 44)
published: true
description: Bytes of Wisdom is a new project by Sam Jarman that brings together snippets of advice for software engineers
tags: career, journey, advice
//cover_image: https://direct_url_to_image.jpg
---

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xxgjfcf3ecy276cxipzn.png)

They say musicians are only as good as their last concert – the same is true for speakers. Taking every talk seriously like the world's conference organising committee is in the room is key to succeeding as a public speaker. 

This takes work. I once got asked to speak at a new type of conference (which I'm was pretty excited about) and when I enquired how my name got in the hat, they referenced a previous conference talk.

Remembering back, I spent ages on that talk. I was thinking about it for about 6 months prior to writing it. I spent about 4 weekends at my desk writing the script and slides. I got a designer to do the slides and create custom imagery. I then practised the talk over and over. It would have been about 40-50 hours of work all up just for 30 minutes. When I got to the room, it was seemingly small, maybe 100 people at most. I was a little disappointed if I'm honest. Then after the talk, I realised there was a journalist in the room and a few other really important/influential people. Doors opened because I'd put the work in and done a good job. I haven't half-assed a talk since. I later presented that talk two more times and appeared on the conference organisers blog, which is notable in New Zealand. 

Heads up: As with any terse bit of advice, there will be exceptions of course, and subtleties and nuance that can't possibly be captured in a Byte of Wisdom. This has been what I've experienced, I'd love to hear yours in the comments too!

You can catch up with all the other bytes at http://bytesofwisdom.com/
What is .NET?
Published: 2021-04-22 23:28:59

.NET is a free, cross-platform, open source developer platform for building many different types of applications.

With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, and IoT.

Languages
You can write .NET apps in C#, F#, or Visual Basic.

C# is a simple, modern, object-oriented, and type-safe programming language.
F# is a cross-platform, open-source, functional programming language for .NET. It also includes object-oriented and imperative programming.
Visual Basic is an approachable language with a simple syntax for building type-safe, object-oriented apps.

Cross Platform
Whether you're working in C#, F#, or Visual Basic, your code will run natively on any compatible OS. Different .NET implementations handle the heavy lifting for you:

.NET Core is a cross-platform .NET implementation for websites, servers, and console apps on Windows, Linux, and macOS.
.NET Framework supports websites, services, desktop apps, and more on Windows.
Xamarin/Mono is a .NET implementation for running apps on all the major mobile operating systems.

One consistent API
.NET Standard is a base set of APIs that are common to all .NET implementations.
<a href="https://forums.asp.net/members/TOPPNG.aspx">free png</a>
Each implementation can also expose additional APIs that are specific to the operating systems it runs on. For example, .NET Framework is a Windows-only .NET implementation that includes APIs for accessing the Windows Registry.