teleren/devto huggingface dataset:
Make your state safe
Tags: react, beginners
Published: 2023-05-26 08:42:58

Imagine you have a simple component `Post` which just renders a post page.

```ts
export const Post = (): JSX.Element => {
  const [value, setValue] = useState<string>()
  const url = 'http://somewhere.com/something'

  useEffect(() => {
    axios.get(url).then<string>((response) => {
      setValue(response.data)
    })
  }, [])

  return <div>{value}</div>
}

```

Just for simplicity purpose let's output just a single string. 

And now a question: What will be if we go to another page (or `Post` component will be unmounted in some other way) before the data load finish?

In this case we will get this warning in the console:

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

Nothing is broken. The app still works. App users may not even notice any problems except for the red warning in the console.

You can leave it as is, but you should know that each such event causes a memory leak. At some point, it could become a problem.

The easiest solution is to use the `useSafeState` hook from the ahooks package. Just replace your `useState` with `useSafeState`, and everything will work out of the box.

```ts
const [value, setValue] = useSafeState<string>();
```

I highly recommend to check the source code of `useSafeState` and research how it works. The code is not too large, so it's not a big deal.

By the way `useSafeState` under the hood uses highly usefull `useUnmountedRef` hook, which checks if component is unmounted. 

However, that is a topic for another story :)
JS To TS（vscode plugin）
Tags: vscode, javascript, typescript, json
Published: 2023-05-26 08:40:21

**Function 1: **Convert API return data to typescript type declaration.PS: Automatically assign the type content to the clipboard
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ge56ybn6hsbm8c95qaqq.jpg)

Function 2: &nbsp；convert objects of JavaScript to typescript type declaration.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qr0hbxulyq05ec3bxcdk.jpg)

Function 3:&nbsp; a plug-in that converts the type provided by the Swagger document to the typescript type automatically.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9acz3t6ngrcsbr9qumhg.jpg)

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



## Keyboard shortcuts configuration.
- Default button configuration (window & mac)
1. Object conversion operation `ctrl+shift+j` (Function 1)
2. Swagger conversion operation `ctrl+shift+k` (Function 2)
- You can also make customize settings in the shortcut key setting interface.
- -
PS: [js to ts]https://github.com/AKclown/js-to-ts
House Call Doctor Singapore: Convenient and Personalized Medical Care at Your Doorstep
Tags: housecalldoctorsingapore, telemedicineconsultation, housecalldoctor, housedoctor
Published: 2023-05-26 08:37:54


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

House Call Doctor Singapore provides convenience and personalized treatment. Our devoted team of experts offers high-quality medical care to your door. Say goodbye to long waits and travel hassles as our skilled physicians give complete consultations and treatments in the convenience of your own home. Learn about all the services :- [https://www.whodoyou.com/biz/2181770/dc-medical-services-pte-ltd-singapore-sg]
Getting Started with the MATCH Clause in Apache Age
Tags: apacheage, cypher, database, graphdatabase
Published: 2023-05-26 08:36:36

**Introduction:**
The MATCH clause is a fundamental component of graph querying in Apache Age.The MATCH clause provides a flexible and expressive way to traverse the graph, specify conditions, and filter results based on patterns. It allows you to define relationships, specify properties, and traverse paths within the graph. The power of the MATCH clause lies in its ability to capture complex graph patterns and retrieve the relevant data efficiently.

In this blog, we will explore the key elements and usage of the MATCH clause in Apache Age, providing a comprehensive understanding of its capabilities.

**Basic syntax and structure:**
It starts with the keyword "MATCH" followed by the pattern specification.

`MATCH (node:label) 
RETURN node `

**Example:**

```
MATCH(movie:Movie)
return movie.title
```

the above query will return all the nodes with Movie label on it

**Relationship Matching:**
You can also retrieve nodes based on the relationships using match clause. To do this you use the following pattern 
`MATCH (node:label)<-[: Relationship]-(n) 
RETURN n `

**Example:**

```
MATCH (:Person {name: 'Hassan'})-->(movie)
RETURN movie.title
```
the above query returns any node with outgoing relation to the person node with name property Hassan

**Filtering with WHERE Clause:**
You can use the WHERE clause to apply filters and conditions to the matched nodes and relationships. It allows you to specify constraints and logical expressions to further refine the query results.

```
MATCH (person:Person {name: 'John'})-->(friend:Person)
WHERE friend.age > 25
RETURN person.name
```
The above query will return any node with outgoing relation to the person node with name property John and filters the node based on the age greater then 25

**Conclusion:**
This is a basic example, but the MATCH clause can be extended to include more complex patterns, multiple relationships, and additional conditions as per the requirements of your graph analysis.
[Watch] Loom 2 YouTube Video Transfer
Tags: webdev, programming, extensions, javascript
Published: 2023-05-26 08:33:41

No frameworks were used in the client side just vanilla Javascript, CSS and HTML and some few research on YouTube Data API V3 and Loom video transcoding. Repo in Github is still private, will open soon.

[![Watch the video](https://img.youtube.com/vi/b5b7p0bSvF8/default.jpg)](https://youtu.be/b5b7p0bSvF8)
Writing the perfect résumé to land your first Go job
Tags: career, go, cv, resume
Published: 2023-05-26 08:27:07

Looking to switch to Go professionally?

You've been programming for a few years. You know one or two languages already, but you're struggling to land your first Go job.  In this video I critique the résumé/CV of someone in this exact situation, and offer tips to improve the chances of landing your first Go job.

{% youtube https://youtu.be/D6hM5CuR2_8 %}
xTerm.js - Setting Scrollback to '9999999' for Enable scroll buffer.
Published: 2023-05-26 08:18:59

{% github https://github.com/xtermjs/xterm.js/issues/518 %}

The scrollback buffer is used to store the data that has been typed into the terminal, but has not yet been scrolled off the screen. 

![Setting Scrollback!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fiik7o1o4f804m67d6au.png)

## scrollback is not buffer-size

The buffer-size property is used to control how much data can be stored in the terminal buffer, including the scrollback buffer.

```
{ 
  scrollback: 9999999,
  buffer-size: 9999999
}
```

**Example code in HTML**

{% gist https://gist.github.com/ubinix-warun/365a8f0fff255ba95e0e5dddd6a1383e %}
Re-Post: My Love Hate Relationship with Kendo Grid — Part 1: The Broken Child Grid on Deployment
Tags: telerik, dotnet, csharp, aspdotnet
Published: 2023-05-26 08:18:58

**Originally published at:** https://roughiain.medium.com/my-love-hate-relationship-with-kendo-grid-part-1-the-broken-child-grid-on-deployment-dfdc3989da57

So a while ago I decided to merge my various GitHub accounts into one account, during this process I lost some gist's which were embedded in the original of this blog post. :(

So here is the article again with the some edits...

##  My Love Hate Relationship with Kendo Grid — Part 1: The Broken Child Grid on Deployment
For years I have been involved in a love hate relationship with Telerik’s Kendo Grid. Hours have been wasted debugging small things and hours have been saved on massive tasks.

Some technical info on today's tryst with Kendo:
* UI for ASP.NET Core R2 2019 SP1
* Development machine windows 10
* Production Ubuntu 18.xx 
* ASP.NET Core SDK: 2.2

One of the many joys of programming is discovering the feature that worked 100% on your local machine breaks on production(do i need sarcasm tags?).

This is the simple grid that broke on deployment[1]

Everything worked on my local environment, the child grid bound, expanded and contracted, displayed all the correct data.

On production in developer console …

```
Uncaught SyntaxError: Invalid or unexpected token
```

Looking at inspect source in the browser, and the JS code that Kendo generates: I noticed the JS contained extra line breaks. So could the line breaks in the Razor page be affecting the Kendo JS???

Yup, one small commit to remove a line break in the child template script and it was fixed.


![GIT DIFF](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cmpewiklip5kpxoq9wwz.png)
¿Por qué deberías usar una VPN en Fedora?
Tags: spanish, security, vpn, fedora
Published: 2023-05-26 08:12:35

La privacidad y seguridad digital son dos temas que se están volviendo cada vez más relevantes en nuestra vida cotidiana. Con cada día que pasa, nuestra dependencia de las tecnologías digitales crece, y también lo hacen las amenazas a nuestra privacidad y seguridad. Una de las herramientas que podemos utilizar para protegernos en línea es una Red Privada Virtual, o VPN. Pero, ¿por qué deberías usar una VPN en Fedora? Aquí te lo explicamos.

**Privacidad**

Una VPN es esencialmente un túnel seguro a través del cual puedes enviar y recibir datos en internet. Al usar una VPN, tu proveedor de internet y cualquier otra entidad que esté tratando de espiar tus actividades en línea solo verán que estás conectado a una VPN, pero no podrán ver qué estás haciendo.

Si estás utilizando Fedora, una distribución de Linux conocida por su enfoque en la privacidad y seguridad, probablemente te importe mucho tu privacidad. Usar una VPN es una forma efectiva de mejorar tu privacidad en línea, porque te permite enmascarar tu dirección IP y ocultar tus actividades en línea.

**Seguridad**

En adición a la privacidad, las VPN también ofrecen un nivel adicional de seguridad. Cuando te conectas a una VPN, tus datos son cifrados antes de que sean enviados a través de internet. Esto significa que, incluso si alguien logra interceptar tus datos, no podrán leerlos.

Si estás utilizando Fedora en una laptop y a menudo te conectas a redes WiFi públicas, el uso de una VPN puede ser especialmente importante. Las redes WiFi públicas suelen ser menos seguras y son un objetivo común para los ciberdelincuentes.

**Acceso a contenido geobloqueado**

Finalmente, las VPN también te permiten acceder a contenido que está geobloqueado. Al conectarte a un servidor VPN en otro país, puedes hacer parecer que estás en ese país, lo que puede permitirte acceder a contenido que de otra manera no estarías disponible en tu ubicación.

Si eres un usuario de Fedora y quieres acceder a contenido de otros países, o simplemente quieres una capa adicional de privacidad y seguridad, usar una VPN puede ser la respuesta.

Ahora, puede que te estés preguntando, ¿cuál VPN debería usar con Fedora? Bueno, hemos investigado este tema y hemos preparado una lista de las mejores VPN para Fedora que puedes encontrar [aquí](https://yourgeekweb.com/es/2023/05/26/las-mejores-vpn-para-linux-fedora/).
Help me undertstand the concept of Laravel
Tags: laravel, beginners, webdev, php
Published: 2023-05-26 08:05:59

Hello, my name is Denny. I am beginner of laravel framework here.
There are a lot of question in my head..
1. If i make an app like e-commerce, how many controller i need? which mean, it must have, signup,signin,product,etc.. So are different route must have their own controller?
2. Model, i know model is database layer,but can you help me understand the basic concept of it?

Thanks, i think thats all!

Sc image : https://selftaughtcoders.com/from-idea-to-launch/lesson-17/laravel-5-mvc-application-in-10-minutes/
Grow Digital Institute - Digital Marketing Courses in Borivali, Mumbai
Tags: digitalmarketing, digitalmarketingcourse
Published: 2023-05-26 08:04:04

[Grow Digital Institute](https://growdigitalinstitute.com) a leading provider of digital training institute in Borivali, Mumbai offers 100% practical and Advanced Digital Marketing Courses in Mumbai. At Grow Digital Institute, we believe in providing our students with hands-on experience, so you can expect to work on real-life projects and gain practical knowledge to apply in the real world
10-Hour Sleep Aid: Relaxing Sounds and Soothing Melodies for Deep Sleep
Tags: 10hours, sleepaid, relaxingsounds, sleepsoother10h
Published: 2023-05-26 07:46:12

The Power of [Relaxing Sounds](https://www.sleepsoother10h.com/2023/05/10-Hour-Sleep-Aid-relaxing-sounds-deep-sleep.html) and Soothing Melodies
Relaxing sounds and soothing melodies have been utilized for centuries to induce calmness and aid in sleep. They have the ability to transport us to serene environments, creating an atmosphere conducive to deep relaxation. Whether it's the gentle lapping of ocean waves, the rustling of leaves in a tranquil forest, or the soft melodies of a soothing piano, these sounds have a profound impact on our well-being.


Promoting Relaxation and Stress Reduction
One of the key benefits of a 10-hour sleep aid with relaxing sounds and soothing melodies is its ability to promote relaxation and reduce stress. The melodic tunes and rhythmic sounds help to slow down our racing thoughts and create a peaceful ambiance. As we listen to these soothing sounds, our bodies respond by releasing tension, allowing us to unwind and enter a state of tranquility. The result is a significant reduction in stress levels, paving the way for a more restful sleep.

from [sleepsounds10h.com](https://www.sleepsoother10h.com/)
Developing on ChromeOS: Exploring the ChromeOS Flex and Nix Combo
Tags: webdev, linux, nix
Published: 2023-05-26 07:40:13

## Introduction
Developers have traditionally relied on Windows, macOS, or Linux distributions as their primary development environments. However, with the advancements in ChromeOS, the operating system developed by Google, it's worth exploring the possibilities it offers for developers. In this article, we will dive into ChromeOS as a development environment and explore the combination of [Crostini](https://chromeos.dev/en/linux) and [Nix](https://nixos.org/) to enhance your development workflow.

## ChromeOS: embracing the cloud
ChromeOS is an operating system designed around the Chrome web browser, emphasizing cloud-based applications and services. While not initially considered a full-fledged development platform, ChromeOS has evolved and now offers options to support developers.

## Linux Support with Crostini
One of the key features that make ChromeOS more developer-friendly is Crostini. Crostini enables the execution of a Linux container within the ChromeOS environment. This Linux container provides access to a terminal, package manager, and the ability to run Linux applications, opening up the door to a range of development possibilities.

## Nix: Reproducible Environments
Nix, a powerful package manager and build system used primarily in the Linux ecosystem, can significantly enhance your development workflow on ChromeOS. With Nix, you can define your development environment as a set of packages and configurations, ensuring reproducible builds and the ability to create isolated development environments.

## Installing Nix
To install Nix on your ChromeOS device, follow these steps:

1. Open a terminal in your ChromeOS environment (using Crostini).
2. Run the following command to download and execute the Nix installation script:
```sh
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
3. Follow the instructions presented during the installation process. The script will guide you through setting up Nix and configuring your environment.

Once the installation is complete, you'll have Nix available in your ChromeOS environment.

## Unlocking Development Potential
Combining ChromeOS and Nix can unlock new possibilities for developers on Chromebooks. The Linux environment provided by Crostini allows you to leverage the Linux ecosystem and run various development tools and programming languages. Nix ensures reproducibility and simplifies the sharing of development setups across different machines.

## Conclusion
While ChromeOS was initially perceived as a limited platform for development, the introduction of Crostini, along with the reproducibility of Nix, has expanded its potential as a viable development environment. Developers can now harness the power of ChromeOS, leverage Linux tools and applications and ensure consistent development setups with Nix. While ChromeOS may not be suitable for all development workflows, it's certainly worth exploring for web and cloud-based development tasks.
How To Squash Commits Locally
Published: 2023-05-29 06:39:22

---
title: How To Squash Commits Locally
published: true
date: 2023-05-26 07:05:52 UTC
tags: 
canonical_url: https://blog.afrieirham.com/how-to-squash-commits-locally
---

If you're like me, you're probably familiar with "squash and merge" when merging pull requests on GitHub.

If you're also like me, you're now trying to figure out how to do this seemingly simple "squash and merge" thingy locally for some reason.

Whether you've been asked to do it because that's how your team has done it (read: my team) or you're curious how to do it just to learn you've come to the right place.

# The Mechanism

The main idea of squashing your commits is you need to reset or undo your commits until the very last one you want to squash. Then just git commit again.

### **1. Reset to your last N commit**

Where, N = number of commits you want to squash

For example, if you have 3 commits that you want to squash, you can simply `git reset --soft HEAD~3`

**IMPORTANT** : make sure it's a \*_soft\*_ reset by using the `--soft` flag.

Otherwise, you will lose all of your progress. We don't want that.

### **2. Re-commit**

This is pretty straightforward, just `git commit -m ...`

* * *

And that's it, it's pretty simple when you know now but it was quite confusing if you're used to the 1-click squash and merge button on GitHub.

At least that was the case for me. 🥲
Tech Taboo: What's A Tech Trend You Just Can't Get Behind?
Tags: discuss
Published: 2023-05-26 07:00:00

Most of us love to stay on top of the latest tech trends, but not every new development gets us excited. VR? AR in everyday life? Cryptocurrency? Self driving cars? 🚗🤖 What's the one tech trend you just can't get behind? 

Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}

[Image by pch.vector on Freepik](https://www.freepik.com/author/pch-vector)
What Questions Should New Coders Ask to Find the Right Employer Fit?
Tags: discuss, beginners, codenewbie, career
Published: 2023-05-26 07:00:00

As a new coder, finding the right employer fit is crucial for a fulfilling and successful career. To ensure compatibility and alignment with your professional goals, it's important to ask targeted questions during the interview process. 

Let's kick off the discussion by sharing the key questions new coders should ask to find the perfect match with potential employers. From company culture to growth opportunities, let's explore the critical factors that contribute to a successful coding journey.

TBH: these questions are applicable and beneficial at any stage of our careers!

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* [https://dev.to/codenewbieteam](https://dev.to/codenewbieteam) *%}*
How to integrate a live Chat to Magento 2
Tags: magento, magento2, magento2tutorial
Published: 2023-05-26 06:47:01

The significance of Live Chat for any eStore owner is widely recognized, but mere words cannot adequately convey the importance of integrating Live Chat into Magento 2. It offers real-time customer support, enhances sales, and generates valuable customer behavior data for further analysis. With a multitude of Live Chat services available today, selecting the right one can be overwhelming. However, this article aims to provide a step-by-step guide on **_How to integrate a live Chat to Magento 2_** sites.

In the present era, there is a wide array of Live Chat services available for your selection. In this article, we will walk you through the process of integrating a live chat feature into Magento 2 sites.

For more information , please visit this :- **_[https://webguru.dev/how-to-integrate-a-live-chat-to-magento-2/](https://webguru.dev/how-to-integrate-a-live-chat-to-magento-2/)_**
Basic GDB
Tags: apacheage
Published: 2023-05-10 18:10:49

The GNU Debugger, also known as GDB, is an effective tool for debugging C and C++ programmes. It enables developers to find and resolve bugs and other problems by analysing and comprehending the behaviour of their code during execution.

The fundamentals of using GDB, such as setting breakpoints, looking at variables, and navigating programm execution, will be covered in this blog.

**Setting breakpoints**
Setting breakpoints in your code is the first step in utilising GDB. Breakpoints are places in the code when the program will halt execution so that you can inspect its behavior and state.

Use the break command, the name of the function or file, and the line number where you wish to place the breakpoint in GDB to create a breakpoint. For instance, you would run the following command to establish a breakpoint at line 10 of a file called my_program.cpp:

```
(gdb) break my_program.cpp:10
```

**Investigating variables**
Using the print command once you've set a breakpoint, you can check the values of the variables in your programme. For instance, if you wanted to print the value of a variable called x, you would type the command:

```
(gdb) print x
```

The watch command can also be used to keep an eye on a variable's value and halt the programme if it changes. You would type the following command to watch a variable called y:

```
(gdb) watch y
```

**Program navigation**
You can use a number of GDB commands to browse programme execution once you've established breakpoints and looked at variables.

Use the run command to launch the programme and start running it. Use the step command to go through the programme line by line. Use the continue command to continue execution until the following breakpoint or watchpoint.

Additionally, you can go up and down the stack by using the up and down commands and the backtrace command, which displays a stack trace of the recent function calls.

**Conclusion**
GDB is an effective tool for debugging C and C++ programmes. Developers can obtain a better knowledge of the behaviour of their code and quickly find and fix problems by establishing breakpoints, looking at variables, and navigating programme execution.

Although some of the fundamental GDB commands and features have been discussed in this blog, there is still plenty to learn. For more complex usage, such as remote debugging, sophisticated breakpoints, and other features, the GDB documentation is a fantastic resource.