teleren/devto huggingface dataset:
What if we had a site where you are required to solve duplicated production bugs that other developers have faced?
Tags: discuss, watercooler
Published: 2022-09-01 16:00:31

We know all about Leetcode and Codewars and how these tend to train developers in abstract problem solving, but I haven't met a website that presents you with a production bug for you to solve. I find that this would be a lot more beneficial to learn how to identify and solve problems. Personally, I think it would be even better to use them in interviews. What do you think? And is there already a project like this? Share with the class. 

An example would be you're given a rails application that takes 2s to load up a page and you're asked to speed it up. 
Or an node application where an API endpoint is returning undefined and you're required to figure out why. 

I think this way you can see different solutions to your problem, if it's an optimization one, and you can even reference the problem when someone can't duplicate it locally.
🤔 ”I am unable to update my board using ST-Link”
Tags: opensource, microservices, luos
Published: 2022-09-01 15:51:36

When you try to update a card using ST-Link, an error message may appear on PlatformIO. This error is not expected if Platform IO has been successfully installed, but in some specific configurations it may happen.

⏩ Find the resolution of this symptom here: https://www.luos.io/faq/stlink

Otherwise, if you have encountered a problem with Luos, feel free to contact our maintainers via Discord (link in comment). We are an open-source project and we are happy to help you!
AWS Step Functions Add 14 New Intrinsic Functions
Published: 2022-09-01 15:44:57

---
title: AWS Step Functions Add 14 New Intrinsic Functions
published: true
description: 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

AWS added 14 new intrinsic functions to Step Functions. Beyond the "I can delete my Lambdas that were doing this now and using native Step Function JSON/YAML", I thought I'd list some of the awesomeness you can more easily do now. It's little, but still enjoyable.


https://aws.amazon.com/about-aws/whats-new/2022/08/aws-step-functions-14-new-intrinsic-features-process-data-workflows/


## ArrayContains

A lot of the if/then's which control conditional logic were often just relegated to small Lambdas to inspect strings in arrays. Given most were just strings, or checking a property value of an Object, you'd wish Step Functions could do this because it's mostly dealing with JSON Objects to begin with; now it's native and you can _see_ the logic in the Step Function vs. "whatever the Lambda did".


## ArrayGetItem

Many Lambdas used for Loops, or processing a list of things now go away because you can get an item at an index, moving many more state handling to Step Functions where it belongs.


## ArrayLength

Sometimes you have no data to process and that's ok, but hard to know if it was Step Function's fault or Lambdas; now "dude, no data in Array, we're good!" Some step functions can "succeed, fail, or no data". That last one is huge for more intelligent monitoring.


## JsonMerge

Huge. I'd make Parallel states just to emulate State Monads (a JavaScript promise that returns a tuple vs. just 1 piece of data). It made the Step Function complicated looking; now, "when 2 jay-sons come along... you must zip it!"


## UUID

So many Lambdas for this 1 function...

## ArrayPartition

Tricky, but still helpful. Often lists are too big for Map/Parallel. Now you can partition a big array. Instead of doing "one thousand things..." you can now do "10 at a time, then proceed to the next". For batch data, or emulating SQS batch. Godsend method.
Note about oh-my-posh, pwsh, wt + OSC99
Tags: ohmyposh, pwsh, osc99, wt
Published: 2022-09-01 15:38:49

When using a fancy theme in oh-my-posh, and we want to ensure the OSC99 gets registered to recall the previous PWD, make sure to fork the theme and add this to it:

```
   "pwd": "osc99"
```

Without this, osc99 will not be emitted, thus preventing Windows Terminal from restoring your session.

> NOTE: This was corrected thanks to @jandedobbeleer (see comment section). Previously, the key and value was ` "osc99": true`
What's the difference between "title tag" and "meta title"?
Tags: webdev, programming, html, seo
Published: 2022-09-01 15:26:12

Difference: The tag <title>Example of a title</title> is referred to as the Page Title. The tag <META NAME="Title" CONTENT="Page Title Here"> is referred to as a meta title. The name of the webpage is displayed in both tags.
When building websites, meta descriptions and page titles are frequently used. Despite the fact that these two terms appear to be different, they are the same. They generally mean the same thing, at least.

The tag <title>Example of a title</title>, which is located in the head tag of a webpage, is referred to as the "Page Title." The webpage's title serves as the page title. When he makes a website, the creator is obligated to do this. A [title tag is necessary](https://cdn.omtvchannel.com/1661787501.png) for every webpage.
Squares With Three Sides
Tags: adventofcode, algorithms, programming, javascript
Published: 2022-09-01 15:08:35

## [Advent of Code 2016 Day 3](https://adventofcode.com/2016/day/3)

## Part 1

### Three sums and three comparisons
I need to determine which three-sided shapes are valid triangles.

The proof for a valid triangle, per the instructions:
> the sum of any two sides must be larger than the remaining side

This seems like the best - perhaps only? - approach:
```
 |\
 | \  
 |  \
A|   \ B
 |    \
 |_____\
    C

A + B > C?
A + C > B?
B + C > A?
```

My algorithm in JavaScript:
```js
input.reduce((valids, triangle) => {
  let [A,B,C] = [...triangle.matchAll(/\d+/g)].map(el => +el[0])
  return valids += (
    A + B > C && 
    A + C > B &&
    B + C > A
  ) ? 1 : 0
}, 0)
```

It generated the correct answer for Part 1!

## Part 2

### Columns instead of rows
A fun twist that will require nested `for` loops instead of a single `reduce()`.

My algorithm as pseudocode:
```
Extract the digits from each line
  Generate a 3-element array in place of the string

Set valid count as 0

For each 3-element array except the last two, skipping two each time
  For each element in the array
    Generate a 3-element array containing the numbers in the same position as the element in the array...from the current and next two arrays
    Increment valid count by 1 only if each pair of side lengths is greater than the non-included side

Return valid count
```

My algorithm in JavaScript:
```js
let sides = input.map(
  line => [...line.matchAll(/\d+/g)].map(el => +el[0])
)
let valids = 0
for (let row = 0; row < sides.length - 2; row += 3) {
  for (let col = 0; col < 3; col++) {
    let [A,B,C] = sides.slice(row, row + 3).map(el => el[col])
    valids += (
      A + B > C && 
      A + C > B &&
      B + C > A
    ) ? 1 : 0
  }
}
return valids
```

It generated the correct answer for Part 2!

## I did it!!
- I solved both parts!
- I leveraged my growing familiarity with `regex`, `reduce()` and several array manipulation techniques!
- With the exception of Day 11, I continue a 2-star streak since Day 22!
Monthly Amazon Location Service Updates - 2022.08
Tags: amazonlocationservice, amplifygeo, amplify, amazonlocationserviceupdates
Published: 2022-09-01 14:53:02

![img](https://day-journal.com/memo/images/logo/aws/location-service.png)

### Monthly Amazon Location Service Updates - 2022.08

<br>

This is a summary of the August updates for Amazon Location Service.

<br>

## 2022.08 Updates

[Amazon Location Service now supports circular geofences](https://aws.amazon.com/about-aws/whats-new/2022/08/amazon-location-service-supports-circular-geofences/)
Geofence now supports circular drafting with a specified radius.

[Amazon QuickSight launches new base maps for geospatial visualizations](https://aws.amazon.com/about-aws/whats-new/2022/08/amazon-quicksight-base-maps-geospatial-visualizations/)
Basemap can now be changed in Amazon QuickSight.

[Amazon Location Service Samples - Amazon Location Service Map Comparison](https://github.com/aws-samples/amazon-location-samples/tree/main/maplibre-gl-js-vue-amplify-compare-maps)
An application sample has been added to compare each style.

<br>

## Other Info

[Amazon Location Service Developer Guide](https://docs.aws.amazon.com/location/latest/developerguide)
Official Amazon Location Service Documentation.

[Amplify Geo Docs](https://docs.amplify.aws/lib/geo/getting-started/q/platform/js)
Official Amplify Geo Docs.

[Amazon Location Service Samples](https://github.com/aws-samples/amazon-location-samples)
Official Amazon Location Service samples.

[amazon-location-service-starter](https://github.com/dayjournal/amazon-location-service-starter)
Build environment to get started with Amazon Location Service.

[A Summary of How to Build Amplify Geo and Amazon Location Service](https://dev.to/aws-builders/a-summary-of-how-to-build-amplify-geo-and-amazon-location-service-5hal)
Summary of Amazon Location Service and Amplify Geo. (as of December 2021)  

[dev.to](https://dev.to/dayjournal)
Articles on Amazon Location Service.

[tags - Amazon Location Service](https://day-journal.com/memo/tags/Amazon-Location-Service)
[tags - Try](https://day-journal.com/memo/tags/Try)
Notes on Amazon Location Service. (Japanese)

<br>

## Related Articles

{% link https://dev.to/aws-heroes/monthly-amazon-location-service-updates-202207-4pf5 %}
Git commands to replace a branch with another branch
Tags: git
Published: 2022-09-08 13:45:08

---
title: Git commands to replace a branch with another branch
published: true
date: 2022-09-01 14:48:31 UTC
tags: git
canonical_url: https://davidloor.com/2022/09/01/git-commands-to-replace-a-branch-with-another-branch/
---

![Git commands to replace a branch with another branch](https://i0.wp.com/davidloor.com/wp-content/uploads/2022/09/pexels-photo-11035539.jpeg?resize=800%2C533&ssl=1)

1. `git branch -m my_feature_branch my_feature_branch_new_name # Rename my_feature_branch`
2. `git checkout my_feature_branch_new_name && git push origin my_feature_branch_new_name # Push the backup to the origin, so it is there as reference for other team members.`
3. `git checkout master # Checkout to the branch that will replace the my_feature_branch`.
4. `git checkout -b my_feature_branch # Create a new my_feature_branch off of the master branch in my example.`
5. `git push origin my_feature_branch # It will force to push the new branch to the origin too`
Simplify Generate URL for Resourceful Controller
Tags: laravel
Published: 2022-09-01 14:43:46

Today I come across a use case where I need to minimise writing `route('resources.index`)` and so on, all related to resourceful routes.

Can it be more simpler if based on given model, I can simply get the model's resourceful URL without think much what's the name of the resourceful route?

What I mean, I don't want to remember anything about given model, what's its route names. I assumed it should be some sort of standard naming convention.

For instance, if given model is `\App\Models\User`, it's URI always in lower case, plural and kebab case - `http://domain.com/users` for `users.index`, `http://domain/users/1` for `users.show`.

It's quite simple if you developing a small application. 

**BUT**, if you are handling a huge application, multiple modules and features in it, **best to keep it consistent and easy to maintain**.

Here how I solve the use case:

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


Use this trait in any models, and the usage:

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


With this solution, I make two things clear:

1. A standard naming convention for my URIs.
2. A seamless way to get model's URI 

And an absolute rule:

1. Your model need to use the trait.
2. Your route for the model need to be resourceful.

Another question, do you need to apply this to all models? Yes, but work smart - create a base model that later on, all models extend from the base class. Again, you model is maintainable for future use.
Find your way in GraphQL applications - Paths explained
Tags: graphql, security, javascript, pentest
Published: 2022-09-01 14:36:22

👋 Hey GraphQL folks!

We just published a [new article](https://blog.escape.tech/understanding-graphql-paths/) talking about GraphQL and it's path system.

We also introduce a new open-source python module: [graphenum](https://github.com/Escape-Technologies/graphenum)!

You can find the full code used in the tutorial [here](https://github.com/Escape-Technologies/blog-posts/tree/main/find-your-way-in-graphql).

Make sure to take a look !
Why we need backend and forntend?
Tags: webdev, javascript, programming
Published: 2022-09-01 14:35:39

Many beginner web developers do not understand the difference between the backend and the frontend, what is the difference? why is this necessary? why can't everything be written on the frontend? I will answer these in this article.

# What is the difference?
In very simple terms, the frontend is what the browser loads (it runs on your computer), the backend is what the browser doesn't see (it's run by another server), but the frontend code communicates with backend via HTTP requests.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2rthqc8a7nzg0ymwz9nh.jpg)

# Why is this necessary?
Not all websites need a backend, but if you want to communicate with a database or other service APIs, etc. you will probably need a backend.

## Secrets, tokens
If you need to communicate with a database or other api, you will soon encounter secrets / tokens. With thes secrets, anyone can access the database or anything that we use. Anyone can look at the javascript code on the frontend so e.g if the database communications were done here, the secret could be found quickly and our website would be easily hacked.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1em0v34bhmb657c8gn0i.jpg)


## Multiplatform

Another advantage of the backends is that it can serve more than one client. Which means that if we have a website and want to make it a mobile application, we don't need to rewrite the backend, only just the frontend. We can use the same backend api, with the same code on the web, mobile, and desktop.


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


## Performance
Not everyone has a gaming machine, or even if they do, many people view websites on mobile. The frontend code runs on your device. It is not good if a website uses your computer's resources to do bigger calculations because the user experience will be bad, it will result in a slow website or even it will be unusable.
The webpage size would be big and your browser has to download large files which results in slow and memory-heavy pages.


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


## Business logic, value
If everything were on the frontend, then our entire code would be public, anyone could view it, download it, or copy it.

I could go on and on, but I hope you can see why we separate our code to backend and frontend. Thanks for reading this 🙏 if you have any question leave a comment 🙂
mind the bootstraps
Published: 2022-09-01 14:25:14


![browse https://dougengelbart.org/content/view/256/](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dh0i2j60e8igzubpm4id.png)


![10 potentially damaging communications patterns, diagrams by @johncutlefish](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xa09c5opcoixlrpgfrfx.jpg)
[Meetup Nantes] - Résultat du sondage sur les lieux de meetup
Tags: meetup, sondage, nantes
Published: 2022-09-01 14:06:37

Post covid, plusieurs **communautés de développement Nantais** ont repris leurs évènements locaux avec plus ou moins de succès : manque de soumission de talk ou faible nombre de participants. Pourtant les conférences quant-à elle sont très attendues. La rapidité durant laquelle l'ensemble des billets sont vendus montre l'engouement autour de ces évènements. 

Pour essayer de comprendre cela, un sondage avait été partagé sur les réseaux sociaux avant l'été afin de cerner les attentes autour de ces évènements, et notamment au niveau emplacement géographique et horaire : en centre ville ou en périphérie nantaise ? le soir ou le midi ? en présentiel, en virtuel ou en hybride ? 

---

## 📊 Et voici les résultats

🙏 145 personnes ont pris le temps de voter, merci beaucoup !

⌛ En terme de fréquence (avant la covid), 25% des personnes n'assistaient pas à des meetups. 50% y assistaient 1 fois par mois. 15% plusieurs fois par mois et 11% "régulièrement" 

🏠 50% des votants habitent en dehors de Nantes. Pourtant, 70% assisteraient à des meetups dans le centre ville de Nantes. 

👥 Un meetup est pour 54% à réaliser en présentiel. 19% souhaiteraient de l'hybride, 10% pour du virtuel et 17 viendraient peu importe le format.

🕖 60% sont pour un meetup le soir, 25% soir ou midi.

Voici l'intégralité des données :

![Zone d'habitation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vum4gtzi5pwxbfspchi.png)


![Fréquence participation pré covid](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2eg2qhsbr3vo5wgtqqek.png)


![Souhait présentiel / hybride](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8s3f38i0wudc9zp1xohn.png)


![Souhait horaire](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o909nk1z7gcqa85cif0a.png)


![Souhait lieux géo présentiel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z3kaevhenxyorv7w1rgp.png)


![Désinscription ?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9n78li6snt66y24ql9e.png)



---

## ➡️ Quelques liens

- https://nantes.community/ : repo GitHub contenant la liste des communautés nantaises actives
- https://nantes-dev-community.slack.com : Slack pour les dév Nantais
What would you do if you had a year off between jobs?
Tags: anonymous, discuss, career, watercooler
Published: 2022-09-01 14:02:10

_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment or if you want to ask your own anonymous question._ 

***


I'm leaving my current company in about 3 weeks, and I'm wondering if I should jump back into work or just enjoy some time off. But then as I think about it, what would I do in the time away? Travel? Maybe take some courses or learn some new skills? It seems like a long time but a year is also so short so I'm just not sure!
Be human-friendly
Tags: webdev, javascript, beginners, firstpost
Published: 2022-09-01 14:00:57

While machines execute our code, they are not the sole or key audience we write for. The code we create should be easy to extend and maintain by other developers. Whether those developers are other-other, or just your future self.

I call this mindset _being human-friendly_.

> **Human Friendly Code** is nice to read, easy to understand, and feels safe to change.

In this article, we'll have a look at four simple ways to implement this approach.

## Introduce explanatory variables

Consider introducing variables to avoid code duplication or to make your code more expressive. In most cases, there’s no need to worry about extra bits of memory they would occupy.

```js
function canEdit (user, document) {
  return (
    user.role === 'admin' ||
    user.role === 'editor' ||
    document.owner === user.id
  )
}

function betterCanEdit (user, document) {
  const isStaff = ['admin', 'editor'].includes(user.role)
  const isOwner = document.owner === user.id

  // The general idea is now expressed in a single statement ✅
  return isStaff || isOwner
}
```

## Keep naming consistent

In general, you should aim for code that is easy to follow, so make sure your entities keep their names. The next snippet shows a bad example: it’s unclear if `user` and `client` are the same thing.

```js
function verify (user) {
  return user.id > 0 &&
      user.name !== ''
}

function print (clients) {
  const data = clients.map(client => ({
    ...client,
    status: verify(client) // ❌ Clients suddenly turn into Users
  }))

  console.table(data)
}
```

## Avoid unexpected behavior

From my experience, this usually comes from functions that mutate arguments. For instance, while this function does mix the elements of a list, due to .sort method it uses internally it also changes the original array, which may not be anticipated.

```js

function shuffle (list) {
  return list.sort(() => Math.random() > 0.5) // ❌ Elements are sorted in-place
}

function betterShuffle (list) {
  return list
    .slice() // ✅ Make a shallow copy first
    .sort(() => Math.random() > 0.5)
}
```

## Use simple statements

Making code all dense and terse can be a fun exercise. While the result may look cool, it would require more time and effort for others to understand.

```js
const modules = {}

// ❌ We assign and return value in a single statement
function loadModule (name) {
  return modules[name] = modules[name] || loadModule(name)
}

// ✅ This code is straightforward and reads nicely from top to bottom
function betterLoadModule (name) {
  if (modules[name] === undefined) {
    modules[name] = loadModule(name)
  }
  return modules[name]
}
```

Well, these are the four insights on making human-friendly code that I wanted to share with you.  There is no need to follow everything at once, if you aren't already. Just pick the idea that resonates most with you — and see how it goes.

Thank you for your time 🦊
Object Required