teleren/devto huggingface dataset:
New Video: Coding Shorts - Response Caching in ASP.NET Core
Tags: aspnetcore, csharp
Published: 2022-07-31 07:30:49

---
title: New Video: Coding Shorts - Response Caching in ASP.NET Core
published: true
date: 2022-07-27 00:00:00 UTC
tags: 
  - aspnetcore
  - csharp
canonical_url: https://wildermuth.com/2022/07/27/new-video-response-caching-aspnetcore/
cover_image: https://wilderminds.blob.core.windows.net/img/2022/07/27/cover.jpg
---

After my recent video about [How ASP.NET Core Middleware Works](https://wildermuth.com/2022/07/17/coding-shorts-asp-net-core-middleware-explained/), I’m continuing to plow through some important pieces of middlware you might not be using. This time, I show you how to use Response Caching to lower load on your systems. Take a look:

- https://www.youtube.com/watch?v=46knd1DFtB4

> [Subscribe to my YouTube Channel](https://shawnl.ink/yt)

[![Creative Commons License](http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png)](http://creativecommons.org/licenses/by-nc-nd/3.0/)

 This work by [Shawn Wildermuth](http://wildermuth.com) is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License](http://creativecommons.org/licenses/by-nc-nd/3.0/).  
 Based on a work at [wildermuth.com](http://wildermuth.com).

* * *

If you liked this article, see Shawn's courses on [Pluralsight](http://shawnw.me/pscourses).
#JulyOT 27: Building Industrial IoT applications with the Microsoft Cloud
Tags: julyot, iot, ai, edge
Published: 2022-07-27 23:55:50

---
title: #JulyOT 27: Building Industrial IoT applications with the Microsoft Cloud
published: true
date: 2022-07-27 00:00:00 UTC
tags: julyot,iot,ai,edge
canonical_url: https://JulyOT.dev/blog/build-industrial-iot
series: JulyOT 2022
cover_image: https://JulyOT.dev/assets/images/JulyOT-banner-27-build-industrial-iot-769e90101fbcfc30812fee3b56e01ca6.png
---

_Here is your starting point to learn how the Microsoft Cloud for manufacturing and underlying Industrial IoT platform can help manufacturers implement secure and pervasive IIoT solutions._

## Industrial IoT and Microsoft[​](#industrial-iot-and-microsoft "Direct link to heading")

Manufacturers are pressured to innovate and digitally transform to keep up with the rapid pace of their markets, competition, supply chain pressures, worker shortage and productivity requirements. For that they need to leverage IoT that makes all this possible at scale. But to do this, manufacturers need to learn an all-new set of skills and technologies to best leverage this promise. We put together a comprehensive series of short videos walking through the shared challenges manufacturers are facing and how the Microsoft Cloud for manufacturing, powered by Azure and its IoT services, can help them transition into this new era of digitalization.

Read more about this on our [industrial IoT and Microsoft Blog post on the Microsoft IoT Tech Community](https://techcommunity.microsoft.com/t5/internet-of-things-blog/building-industrial-iot-applications-with-the-microsoft-cloud/ba-p/3581996?wt.mc_id=eventspg_16482_webpage_reactor).
Day 108: Back in action
Published: 2022-07-26 23:50:02

Hi!
Yesterday was a bad one but today I got payback and covered up even for yesterday it's really amazing what you can do in a full 1hour of focus but the React useEffect error that I once got came back and I couldn't fix it probably because I'm so tired I'll try again tomorrow
Also Tomorrow I will get started with Daily UI challenges for improving my designing skills but that will be after I finish the current task I'm working on 

We shall see about it 

Signing offf.....
Day 2: Commit Early & Often
Published: 2022-07-26 22:53:34


![man with head in hands](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v2cv1prrcbacnum9z8r9.jpg)
Today started with debugging git error from yesterday.  I did this by checking the logs. Inside the log discovered I need to insert the information below using the following commands:

git config --global user.email "[you@example.com](mailto:you@example.com)"
git config --global [user.name](http://user.name/) "Your Name"

Miraculously this worked!  This was my first foray into deciphering the information to find what is relevant to the problem and then researching and applying the solution.  i.e.: googling the whole error message :sweat: .  So, now I know what debugging is and how to do it :laughing:

Despite my plans for the day, this led to looking into the base differences between Git and Github.  Git is how I manage my code locally and Github is an application that moves the code from my local device, online.   From there I went down the Git rabbit hole, I quickly realized how expansive Github is.  I learned that while I am curious, I am not THAT curious…it works, imma move on.  I ended up renaming my default branch from Master to Main, how I found myself there, I don't know, I started with rabbit hole right?

##Rabbit Hole Diaries##
![Rabbit Jumping in hole](https://c.tenor.com/8z-Upx6ev6cAAAAM/running-home.gif)

**Task:** Move files from one directory to another.

**Result:** …cd, ls, cd, ls, cd, ls….google…this looks good…cp -r…yup, that's it…cd, ls, cd, ls….where are the files?  whelp, I lost the files….time to wrap it up….wait, why are they on my desktop…:boom:

well, now that I found the files… I quickly exited the terminal and dragged and dropped the files where I need them to be. 
![Files moving](https://thumbs.gfycat.com/GeneralScentedIndianglassfish-size_restricted.gif)


##Back on Track##

Now, I was finally able to move the files from my local device to Github.

1. created the repo in github with .readme
2. cloned repo to local directory (git clone xyz)
3. made changes in local directory 
4. pushed changes to Github
    - committed local code to GitHub through the command line. did this by using
        - **git init - b main**
            - Initialize the local directory as a Git repository.
        - **git add .**
            - gets files ready to move
        - **git commit -m “first commit”**
            - adding files to local git
        - **git push origin main**
            - pushes files to github

 Whew, what a day…I think I'm going to roll over the rest of the to-do list to tomorrow.

![Rabbit jumping out of hole](https://c.tenor.com/ZCuoWKH4emgAAAAC/hole-bugs-bunny.gif)
React-Query: staleTime vs cacheTime
Published: 2022-07-26 22:48:00

Se você já trabalhou com `react-query` provavelmente já se deparou tentando entender a diferença entre o `staleTime` e o `cacheTime` e, mais importante, o porque sua aplicação continuar fazendo chamadas ao servidor mesmo você mudando os valores deles.

Vou tentar explicar da forma mais breve possível para você poder voltar a trabalhar.

---

## Estado inicial

A sua aplicação ainda não fez nenhuma chamada ao servidor, neste caso, quando o `hook` for chamado, ele vai apenas buscar os dados no servidor e salvar no cache.

Agora, o que acontece quando o `hook` já tiver sido chamado ao menos uma vez e tento chamá-lo novamente? Bem, depende das seguintes situações.

---

### Situação 1
```
staleTime = 0
cacheTime = 5 min
```

Como o seu cache está configurado para 5 minutos, o react-query vai devolver os dados prontamente, entretanto, nesta primeira situação, como o `staleTime` é `0` os dados sempre serão obsoletos, portanto o `react-query` fica encarregado de fazer uma requisição em background para o servidor e atualizar os dados da query quando possível.

![react query fazendo chamada em background](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ffmzd0tv6rqjaawop0rn.jpg) 

---

### Situação 2
```
staleTime = 5 min
cacheTime = 5 min
```
Semelhante à primeira situação, o `react-query` vai
devolver os dados prontamente, porém, dessa vez o `staleTime` difere de `0`, logo o `react-query` não vai fazer nenhuma chamada em background, afinal o seu dado não está obsoleto 

![react query não fazendo chamada em background](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19z0lhdzh8eeen9vdnrz.jpg)

> Lembrando que, o cache mencionando aqui é apenas na memória do navegador, se o usuário recarregar a página o cache vai ser limpo, voltando para a situação inicial

---

Em ambas situações considerei o tempo entre a primeira e a segunda chamada do `hook` menor que cinco minutos, visto que em ambas, quando o tempo entre as chamadas é maior que cinco minutos, o `react-query` não utiliza o cache.

Espero que essa explicação rápida tenha conseguido sanar as suas dúvidas em relação ao assunto
WhatsApp / Website Automation
Published: 2022-07-26 22:19:23

Hello, hopefully posting in the right space. 
I am looking to source automated functionality between wordpress / php and WhatsApp. 

Basically, when a contact form is completed on a website such as Wordpress - using a contact plugin such as FluentForms / Gravity forms, an email notification is sent to the customer (out of the box functionality), but secondly and more importantly, an automated sequence of messages can be sent to the customer via whatsapp - using the mobile number as provided within the contact form originally.

Flow
Customer completes contact form > Automated email to customer and website admin > Whatsapp message created and set to customer using mobile number provided in form.

If anyone has specific experience of this previously, or willing to support with the development of this product, please let me know.
Top 7 Featured DEV Posts from the Past Week
Tags: top7
Published: 2022-07-26 21:48:48

---
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._ 

## On Criticism

Every developer has both been on the receiving and the giving end of criticism. It’s a vital part of our job, so let’s learn how to do it optimally with @lexlohr!

{% embed https://dev.to/lexlohr/about-criticism-12f3 %}


## You Don’t Need to be Perfect

We, as developers, want the best for ourselves and what we produce. As we build from scratch it’s natural to be committed to what we produce. @mstryoda questions if we have to be perfect or if we are unintentionally forced to.

{% embed https://dev.to/mstryoda/software-developers-you-neednt-be-perfect-17gn %}


## Retro Animated CSS Border

Inspired from the ShopTalkShow’s temporary theme, @chokcoco recreates a similar retro aesthetic. 

{% embed https://dev.to/chokcoco/fantastic-css-border-animation-5166 %}


## Clean Architecture: React

This text is part of a series of texts from @rubemfsv about Clean Architecture analysis applied with different frameworks and languages. This week, we’re covering React.

{% embed https://dev.to/rubemfsv/clean-architecture-applying-with-react-40h6 %}


## Quick History Lesson!

@iarchitsharma put together this remarkable post cataloguing the history of JavaScript. Class is in session!

{% embed https://dev.to/iarchitsharma/the-history-of-javascript-5e98 %}


## Drag and Drop from Scratch

Drag and drop applications are very common nowadays, they are great for the user experience and nowadays people notice when it’s missing. @franklin030601 shares an easy way to set it up in your React app without libraries.

{% embed https://dev.to/franklin030601/creating-an-app-using-drag-and-drop-with-react-without-libraries--5cg9 %}


## Keeping accessibility top of mind

This post about building with accessibility in mind is appreciated — and it's helpful whether you're building a new site or rebuilding an old one!

{% embed https://dev.to/hannakim91/building-or-rebuilding-a-website-with-accessibility-in-mind-1p92 %}


_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!_
JavaScript resources.
Published: 2022-07-26 21:42:13

Hello everyone,
There's this software engineering program that I'm enrolled in which has JavaScript as a core unit in the near future, I'm currently writing code in C and python but I'll like to learn **js** ahead, for a dive into its frameworks and stacks.
Any recommendations on the best **resources**, **roadmaps** and and general advice will be appreciated.
Thank you.
Ng-News: Episode 22/29
Tags: angular, javascript, webdev, programming
Published: 2022-07-26 21:06:27

{% embed https://youtu.be/u9sa11tX7y0 %}

## Angular 14.1

Angular 14.1 was released. A minor version upgrade means that we as developers don't have to change anything, but we get additional features, and there are quite some of them.

For example the CommonModule has now a standalone alternative. This means we can import directives like ngIf, NgFor or pipes like the asyncPipe directly.

Another new feature is the CanMatch RouterGuard. It allows us to assign multiple components to a route and we can define a logic which one of these components should be used.

We got an improvement in the testing area as well. The ComponentRef has a setInput method which sets an @Input property but also triggers the lifecycle hooks. This allows us to test the ngOnChanges hook with comonents that have ChangeDetectionStrategy set to OnPush.

For more information, check out the latest article of the ninja squad's blog.

{% embed https://twitter.com/cedric_exbrayat/status/1550140046384238592 %}

{% embed https://blog.ninja-squad.com/2022/07/21/what-is-new-angular-14.1/ %}

## Alex Okrushko on Testing

At the Angular Kenya meetup, Alex Okrushko, a member of the NgRx team, gave a talk about testing.

If you want to know why you should include the DOM interaction in your component tests, why you don't have to use the TestBed all the time, or some general tips on how to write quality tests then this talk is definitely for you. 

{% embed https://youtu.be/M39PAWttOWg %}

## Lightning Talks

There was mini conference with various lightning talks. It was organized by the Angular Community Meetup.

{% embed https://youtu.be/E9RDS7lcQns %}

## Other Updates

Next to Angular 14.1, we had other minor version releases. Playwright, E2E testing framework, with version 1.24, the old veteran bootstrap to 5.2 and also a with PrimeNg 14 a new major release.

Playwright 1.24: https://github.com/microsoft/playwright/releases/tag/v1.24.0

{% embed https://blog.getbootstrap.com/2022/07/19/bootstrap-5-2-0/ %}

{% embed https://www.primefaces.org/primeng-14-0-0-released/ %}
amazee.io (and Lagoon) join Mirantis
Tags: news, mirantis, opensource, growth
Published: 2022-07-26 21:27:12

We are thrilled to announce that amazee.io is joining the global team at Mirantis. The Lagoon team is so excited for the future of Lagoon, building on the success of Mirantis with their other open-source and Kubernetes-related offerings. 

https://www.amazee.io/blog/post/amazee-io-joins-mirantis

We'll be expanding our support for applications, frameworks, and languages - what would you like to see? Tell us here or join us on [Twitter](https://twitter.com/uselagoon) or [Discord](https://discord.gg/te5hHe95JE)!
Getting Started with Next.js - Typescript
Tags: typescript, javascript, react, nextjs
Published: 2022-07-26 21:11:41


## Getting Started with Next.js
A beginner guide Video in Urdu and Hindi for those  who want to learn Nextjs : 
### Getting Started with Next.js - Typescript in Hindi / Urdu 
{% embed https://youtu.be/O1peLlIJ4Bg %}

- You might want to generate static site with High perfomance and SEO. 
- Code has to be bundled using a bundler like webpack and transformed using a compiler like Babel.
You need to do production optimizations such as code splitting.
- You might want to statically pre-render some pages for performance and SEO. 
- You might also want to use server-side rendering or client-side rendering.
- You might have to write some server-side code to connect your React app to your data store.

## *Next.js*, the React Framework. 
Next.js provides a solution to all of the above problems. But more importantly, it puts you and your team in the pit of success when building React applications.
### Important features of Nextjs are : 
- File-base routing
- Server Side rendering
- API Routes
- Built-in support for Typescript and SaSS. 
- Static site generation


We can create a new NextJS project by running following command : 
`npx create-next-app step01 --ts`
Here in our project we use Typescript to create our components.We can start our NextJS application locally by running : 

 `npm run dev`

Then we can updated components in pages folder. A component exported from pages folder will be available as route in NextJS Application. 


<hr/>

#### Hello,  I'm Abdul Waqar

#### A Software Engineer using cutting Edge technologies to develop Super fast Software solutions . I like to write about React , NextJS, NodeJS, Cloud Computing and React Native for Hybrid Apps.

<p align="center">

<div class="green"  display="flex">
  <a href="https://www.facebook.com/abdulwaqar844"><img src="https://img.shields.io/badge/facebook-%231877F2.svg?&style=for-the-badge&logo=facebook&logoColor=white"></a>

<a href="https://www.youtube.com/channel/UCo4qO3unlA_ah0o-3nCTqNA"><img src="https://img.shields.io/badge/youtube-%23E4405F.svg?&style=for-the-badge&logo=youtube&logoColor=white"></a>

<a href="https://twitter.com/abdulwaqar844"><img src="https://img.shields.io/badge/twitter-%231DA1F2.svg?&style=for-the-badge&logo=twitter&logoColor=white"></a>

<a href="https://dev.to/abdulwaqar844"><img src="https://img.shields.io/badge/DEV.TO-%230A0A0A.svg?&style=for-the-badge&logo=dev.to&logoColor=white"></a></div>

</p>
Project: Treblle
Tags: api, monitoringapi, observability
Published: 2022-07-26 20:42:58

What early Treblle adopters are telling us is that they love features like Auto-generated API docs, because it provides them a single source of truth for the whole team (frontend, backend and QA testers). 

They adore the share-single-request feature to outside providers because it gives them proof of something went wrong with all the relevant data already in there (like a picture frozen in time). It's all there, headers, parameters, endpoints, time, geographic location, server... all of it. 

And what testers and product/project managers like is the ability to retrace the steps of a single user to get use cases the team didn't predict and to evaluate how good is the API performing in actuality. 

 Website: https://treblle.com/
What are background processes in computing?
Tags: computing, backgroundprocess, software
Published: 2022-07-26 20:40:00

_A background process does work for a computer in a way that optimizes performance of the user interface._

---

## Examples
- Running an automatic update for an application.
- A word processor printing a file.
- Checking the device’s network connection.

---

## How it works
The user interface is run on a particular thread (a thread is a sequence of programmed instructions executed by the CPU). Background processes are run on a separate thread from the user interface. And running these on a separate thread can have the potential to prevent background processes from affecting the performance of the UI. In some cases, background processes can run even if the application that triggered them is closed.

---

## What are they used for?
Background processes are ideal for tasks that have the potential to diminish the performance of a user interface. Examples of this include downloading or uploading large media files. Running these as a background process can prevent the tasks from slowing down the performance of the UI. They are also great for tasks that require little to no user interaction such as logging, system monitoring, scheduling and user notification.

---

## Getting started
...Coming soon.
Leet Code - Longest Common Prefix
Tags: javascript, beginners, programming, tutorial
Published: 2022-07-26 20:23:00

## Problem Statement

Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".

## Algorithm

- if array is empty, return a prefix of empty string Or if 
  array has 1 word, return the whole word.

- Iterate through letter of first word of Array , and compare 
  those letters to same Indexed letter to other world.

 **Example**   

```
   let strs = ["flower","flow","flight"]
   So What above line meaning is -
   str[0][0] === str[1][0],
   str[0][1] === str[1][1] and so on....  
```

- if the letters match continue to next set of letters 
  otherwise return the prefix

- If the letter is no longer matching then the first word 
  will mark where the longest common prefix is, so 
  we add to our empty string.

**First Try to Solve Problem using Algorithm**

## Javascript Function for Longest Common Prefix

```javascript
/**
 * @param {string[]} strs
 * @return {string}
 */
var longestCommonPrefix = function(strs) {
let result = "";
//array is empty, return a prefix of empty string
if (strs.length === 0) {return ""}

//array has 1 word, return the whole word
if (strs.length === 1) {return strs[0]}

//Iterate through letter of first word of Array
for(let i=0 ; i<strs[0].length ; i++){
//compare those letters to same Indexed letter to other world.
 for(let j=1 ; j< strs.length ; j++){
 if(strs[0][i] == strs[j][i]){
     continue;
 }else{
     return result
 }
 }

/*If the letter is no longer matching then the first word 
  will mark where the longest common prefix is, so 
  we add to our empty string*/
result += strs[0][i];
}
return result;    
};

```

## Test Cases
`Input: strs = ["flower","flow","flight"]
Output: "fl"`

`Input: strs = ["dog","racecar","car"]
Output: ""`

`Input: strs = ["",""]
Output: ""`
Making React less stupid: automatic `useMemo` and `useCallback` insertions are coming!
Tags: react, javascript, webdev, news
Published: 2022-07-26 20:20:23

---
title: Making React less stupid: automatic `useMemo` and `useCallback` insertions are coming!
published: true
description: useMemo and useCallback are important parts of the react ecosystem, but they are annoying as hell. Looking forward to seeing this automized!
tags: react, javascript, webdev, news
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvmdpd5zmvk9i8nr1ff3.png
# Use a ratio of 100:42 for best results.
---

Is it just me, or is the recently announced [optimizing compiler](https://reactjs.org/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022.html#react-compiler) an absolute treat that removes one of the most annoying aspects of modern React development? It finally takes care of the pesky old question of whether or not to bother adding `useMemo` or `useCallback` (and it comes with several more goodies).

The ups and downs of memoizing everything have been discussed again and again, including on [r/reactjs](https://www.reddit.com/r/reactjs/search/?q=usememo), more recently, [in this thread](https://www.reddit.com/r/reactjs/comments/rs25x2/any_downside_to_using_usememo_for_every_single/). That thread also includes several important comments by [u/acemarke](https://www.reddit.com/user/acemarke/) on this matter, where amongst others, he shares [his insightful blog post on "memoizing everything"](https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/#memoize-everything).

Of course, there are trade-offs to be made, but I love the fact that this difficult, and often just downright annoying decision making process of whether or not to add the call can finally be deferred to an automatic process. I for one have always been a big fan of the two, even at the cost of performance in some cases, just for the crucially important (and criminally under-documented) property of upholding [referential identity](https://www.google.com/search?q=referential+identity+"react").

I can't wait!