teleren/devto huggingface dataset:
A counter that listen keyboard events 🕹️
Tags: rust, tutorial, programming, beginners
Published: 2023-11-27 17:58:10

How to make a dynamic number counter so that when you press the up arrow, a number is added and when you press the down arrow, a number is subtracted?

I asked myself that question and proceeded to try to solve that algorithm in my mind first and then in code, here is the result.

Let's add the keyboard handler [k_board](https://crates.io/crates/k_board)

`cargo add k_board`

Let's add the program logic:

```rust
use k_board::{Keyboard, Keys};

fn main() {
    let mut number: i8 = 0;
    print_number(&mut number, 0);
    for key in Keyboard::new() {
        match key {
            Keys::Up => print_number(&mut number, 1),
            Keys::Down => print_number(&mut number, -1),
            Keys::Enter => break,
            _ => {}
        }
    }
}

fn print_number(number: &mut i8, operation: i8) {
    std::process::Command::new("clear").status().unwrap();
    *number += operation;
    println!("{}", number);
}
```

See you soon love ❤️
Python quiz 🤔: Can You Spot the Correct Python String Formatting?
Tags: python, programming
Published: 2023-11-28 20:37:05

💡As I mentioned before, learning PEPs can help you learn Python. This post is about [PEP-0498 - Literal String Interpolation](https://peps.python.org/pep-0498/).

So, [follow me](https://dev.to/vladignatyev) to learn 🐍 Python in 5-minute a day fun quizzes! 

# Quiz 1 out of 64
Which one of these code samples below is done right for string formatting in Python? Answer with **0** for the first sample or **1** for the second sample. 

## Sample 1
```
name = "Alice"
age = 30
greeting = f"Hello, {name}. You are {age} years old."
print(greeting)
```
## Sample 2
```
name = "Alice"
age = 30
greeting = "Hello, {name}. You are {age} years old."
print(greeting)
```

Share your thoughts and open up the explanation in the comments below! Let's see who gets it right! 🌟👩‍💻

> or [Go to Quiz 2/64](https://dev.to/vladignatyev/python-quiz-264-pep-8-formatting-quiz-4232)
interrupt method
Published: 2023-11-30 04:27:22

Interrupting a blocked thread (wait, sleep, join) will clear the interruption status
Interrupting a normally running thread will not clear the interruption status.
The interrupt state can be used to stop a thread.
# Two-stage termination model
Gracefully terminate the T2 thread in the T1 thread and give T2 a chance to take care of the aftermath (release locks and resources)

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

Interrupting the park thread will not clear the interruption status
After the interrupt flag is true, calling park again will fail.

# Not recommended method

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

Will destroy the synchronized code block and cause deadlock
WHO IS A FULL STACK DEVELOPER?
Published: 2023-11-30 06:42:34


A full-stack developer is a software engineer who can build both the front-end and back-end of a website or application.

 They are responsible for designing, developing, and maintaining the entire software stack of a web application, which includes the user interface, server-side logic, and database.

 Full-stack developers are proficient in both front-end and back-end technologies and have a good understanding of how they interact with each other.

 They are also skilled in programming languages such as HTML, CSS, JavaScript, Python, PHP, Ruby on Rails, and CakePHP. 

Full-stack developers can work in-house or at a computer development company that engineers websites, software, and other components for other businesses1. 

If you’re interested in becoming a full-stack developer, you can start by learning the necessary skills and technologies through online courses and tutorials.


HOW LONG DOES IT TAKE TO BECOME A FULL-STACK DEVELOPER ?

The time it takes to become a full-stack developer can vary depending on the amount of time and effort you put into learning. 

The time it takes to become a full-stack developer can vary depending on your learning pace and the amount of time you can dedicate to learning.

 However, with the right resources and dedication, you can become a full-stack developer in as little as 90 days or as long as 6 months or more.
Productivity: Go-to shortcuts
Tags: devtools, productivity, codingtips
Published: 2023-12-11 12:54:47

Just stumbled upon a game-changing shortcut in my favorite IDE. 🚀⚡️ Share your go-to productivity hacks and let's compile a toolbox of brilliance. What shortcuts or features have revolutionized your coding workflow? Let's boost each other's productivity! 💻✨
Introducing Squaredev AI Platform!
Published: 2023-12-12 11:15:13

We are excited to share something that we hope you’ll love: the Squaredev AI Platform. This API-first platform is designed to empower developers with the tooling required to build LLM based applications.

##Key Features:##

- **Create and Store Embeddings with Ease:**
Generating and storing embeddings is as simple as making a single API call.

- **Semantic Search:**
Explore the capabilities of semantic search to make your search results more precise and relevant.

- **Open Source LLMs**
Access the benefits of Open Source Large Language Models at a fraction of the cost.

- **Build Your Own Assistant**
We are creating a super-easy RAG API (coming soon).


We plan to deliver the ultimate developer experience, promoting the next wave of AI applications and revolutionizing user experiences on both web and mobile platforms.


##Sign Up for the Waitlist Now!##
Be among the first to experience the Squaredev AI Platform. Sign up for our waitlist today and enjoy free access to the API for the first three months!


[Check for more details at Squaredev](squaredev.io)
[Join the waitlist now!](https://6x4lr3sawa0.typeform.com/to/yO8rFXgs?typeform-source=docs.squaredev.io)

PS. We are also thinking of open sourcing the whole platform. Feedback is much appreciated on this.

![Stay Tuned](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxmuy2ii7lbkc0rvq7tq.jpg)
Luxury Redefined: Ivory County's Exquisite 3/4/5 BHK Apartments in Noida
Tags: ivorycounty, ivorycountynoida, ivorycountyprice, ivorycountynoida115
Published: 2023-12-12 12:22:56

In the heart of Noida, **[Ivory County](https://www.ivorycountys.in/)** unveils an extraordinary residential experience with its collection of **3/4/5 BHK apartments**. Elevating the standards of luxury living, these apartments are more than just living spaces, they are a statement of sophistication, comfort, and modern design.

Ivory County caters to diverse preferences and lifestyles. Whether you seek a cozy space for your family or a sprawling residence for grandeur, Ivory County has meticulously designed floor plans to suit your needs. Step into a world where modern design meets timeless elegance. Ivory County's apartments are crafted with precision and attention to detail. From spacious living areas to stylish kitchens and well-appointed bedrooms, each residence reflects a commitment to unmatched quality and aesthetics.

Experience a lifestyle of opulence with **[Ivory County Noida](https://www.ivorycountys.in/)** unparalleled amenities. Residents can enjoy state-of-the-art fitness centers, swimming pools, landscaped gardens, and community spaces that foster a sense of community and well-being. The project is not just about living, it's about living exceptionally. Ivory County embraces the future of living with smart solutions integrated into every apartment. From smart lighting and security systems to energy-efficient features, residents can enjoy the convenience of technology seamlessly enhancing their daily lives.

Nestled in a prime location in Noida, Ivory County apartments offer a strategic advantage. Enjoy proximity to key business districts, educational institutions, healthcare facilities, and entertainment hubs, ensuring that every convenience is within reach. Choose from a range of thoughtfully designed floor plans to find the apartment that perfectly suits your lifestyle and preferences. Investing in Ivory County's 3/4/5 BHK apartments is an investment in luxury living. Experience a life of comfort, style, and modern conveniences.

**Contact Us Today:**
**Ready to explore Ivory County 3/4/5 BHK apartments in Noida? Contact us today to schedule a visit and learn more about how Ivory County can redefine your living experience.**

**To know more, please visit:** [https://www.ivorycountys.in/](https://www.ivorycountys.in/)
What does life on the edge with Upsun look like? 🤔
Tags: webdev, devops, productivity, cloud
Published: 2023-12-12 16:31:43

**Life on the edge: Understanding the Upsun edge layer**

What exactly is edge and what does life on the edge with Upsun look like? And what are the key things you should know about how the edge layer works?

Let's take a deep dive into understanding the Upsun edge layer and why you need it.

Peel back the edge layers in our **[latest blog post](https://upsun.com/blog/edge-layer-upsun/?utm_source=social&utm_medium=organic-social&utm_campaign=upsun-blog-2023).**
catchAsync dynamic function create
Published: 2023-12-13 04:49:49

## // catchAsync
## //==>src/app/utils/catchAsync.ts

```ts
import { NextFunction, Request, RequestHandler, Response } from 'express';

const catchAsync = (asyncFn: RequestHandler) => {
  return (req: Request, res: Response, next: NextFunction) => {
    Promise.resolve(asyncFn(req, res, next)).catch((err) => next(err));
  };
};

export default catchAsync;
```
What is the concept of asynchronous programming in Full Stack?
Tags: fullstack
Published: 2023-12-13 07:13:40


Asynchronous programming is a fundamental concept in full-stack development that allows for more efficient and responsive handling of tasks that may take time to complete, such as I/O operations, network requests, or database queries. In a full-stack context, where applications involve both client-side (front-end) and server-side (back-end) components, asynchronous programming is crucial for ensuring that the user interface remains responsive while waiting for data or operations to complete.

At its core, asynchronous programming is about managing concurrency and non-blocking operations. In traditional synchronous programming, when a task is initiated, the program blocks and waits for that task to finish before moving on to the next one. This can lead to performance bottlenecks and unresponsive user interfaces, especially in web applications where multiple users might be making requests concurrently.

In contrast, asynchronous programming allows a program to initiate a task and then continue executing other tasks without waiting for the first one to complete. When the initial task finishes, it can signal the program to handle the result. This approach is particularly valuable in full-stack development because it enables efficient handling of multiple client requests on the server and responsive user interfaces on the client side. APart from it by obtaining [Full Stack Developer Certification](https://www.edureka.co/masters-program/full-stack-developer-training), you can advance your career in Full Stack. With this course, you can demonstrate your expertise in the basics of Web Development, covers JavaScript and jQuery essentials, guide you to build remarkable, many more fundamental concepts, and many more critical concepts among others.

In web development, for instance, asynchronous programming is frequently used for tasks like fetching data from a server, making AJAX requests, or handling user input. JavaScript, a key language in full-stack development, relies heavily on asynchronous operations. Promises and async/await are common tools used to manage asynchronous code in JavaScript, making it easier to write and reason about asynchronous tasks.

On the server-side, in languages like Node.js or Python, asynchronous programming is essential for handling multiple client requests concurrently, which is crucial for building scalable and responsive web applications. By avoiding blocking operations, these server-side technologies can efficiently manage a high volume of client requests.

In summary, asynchronous programming in full-stack development is a critical concept that allows developers to write code that efficiently handles tasks that may take time to complete, ensuring responsive user interfaces and scalable server-side operations. It enables concurrency, non-blocking behavior, and efficient handling of I/O operations, making it a fundamental skill for modern web and application development.
[diário de estudo] o react e o tailwind
Tags: react, tailwindcss, study, braziliandevs
Published: 2023-12-15 13:46:32

olá! tudo bem? 👋

_`pega um café e o seu patinho de borracha que esse post contém: recomeços e crises de estilização`_

para dar o pontapé nos estudos, eu resolvi iniciar com um projeto que eu já havia feito alguns anos atrás enquanto testo algumas ferramentas novas. dessa forma, eu consigo trabalhar dentro de um território familiar, mas com algumas coisas novas para explorar.

a primeira coisa nova que eu testei foi iniciar o projeto usando o `vite`. até agora, eu sempre usei o `create react app` para criar os projetos react, e fiquei até um pouco maravilhada como realmente criar um projeto com o `vite` é muito mais rápido.

o grande desafio apareceu mesmo com o `tailwind`! até então, a minha zona de conforto é muito com o `styled-components`. gosto muito como ele funciona e também a liberdade que ele dá para estilização, enquanto a componentização dá uma facilidade que o `css` puro com o `react` fica meio chato. já o `tailwind` trabalha um pouco parecido com o `bootstrap`, setando as estilizações pelas classes.

o `tailwind` não é difícil de trabalhar, mas ainda estou descobrindo como ainda ter a minha liberdade de criar e personalizar os elementos usando apenas as estruturas do `tailwind`. para isso, eu foquei em um componente só e criei uma tela de login que acabou ficando assim:

![Print da tela de uma página de login de fundo branco com os campos "Endereço de e-mail" e "senha" e um desenho ao lado com os elementos em tons de amarelo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8p92yfdjrvzgee11mblk.png)

esse foi o resultado depois de algumas horas tentando desvendar a documentação do `tailwind` (que ainda estou tentando me encontrar nos elementos) e de adaptação de componentes estilizados que a documentação oferece. o lado bom de trabalhar com ferramentas como o `tailwind` e o `bootstrap` é que há uma certa agilidade na hora de criar os elementos visuais, pois eles já vem prontos de certa forma, porém em outro lado quando queremos adaptar ou ter mais liberdade nas estilizações precisamos nos manter dentro dos padrões do que ele permite (principalmente se você não quer misturar ou adicionar o seu próprio `css`, como é o meu caso).

a próxima etapa será criar os elementos estáticos da aplicação que serão apenas exibidos em tela em certos momentos; e então replicar uma parte do login para a tela de cadastro.

até a próxima 🦖
Normalizing or interpolating values in JavaScript/TypeScript
Tags: normalization, interpolation, javascript
Published: 2023-12-13 23:14:56

These are three common normalizing functions I use in JavaScript when working with CSS animations/transitions, especially when playing with motion sensors.

## Standard Normalization

This function scales a number so that it falls within a standard range of 0 to 1. This is the common meaning of "normalization" in data processing.

Commonly used in data processing and analysis to standardize different sets of data on a common scale, such as in machine learning feature scaling.

```typescript
function normalize(
  value: number, 
  minValue: number, 
  maxValue: number
): number {
    if (maxValue === minValue) {
        return value === minValue ? 1 : 0;
    }
    return (value - minValue) / (maxValue - minValue);
}

// Example Usage
console.log(normalize(15, 10, 20)); // 0.5
console.log(normalize(30, 20, 40)); // 0.5
```

## Linear Interpolation

This function maps a number from one range to another. It's a form of linear interpolation. 

Useful for scaling values, normalizing data to a different range, or converting between different measurement scales.

```typescript
function linearInterpolation(
  value: number,
  originLowerBound: number,
  originUpperBound: number,
  targetLowerBound: number,
  targetUpperBound: number
): number {
  // Note: we should use the `normalize` function above
  // const ratio = normalize(value, originLowerBound, originUpperBound)
  const ratio =
    (value - originLowerBound) / (originUpperBound - originLowerBound);
  return ratio * (targetUpperBound - targetLowerBound) + targetLowerBound;
}

// Example Usage
const mappedValue = linearInterpolation(5, 0, 10, 0, 100);
console.log(mappedValue); // Should output 50
```

For example: [1,5] & [10,50] ranges. 

- 1 outputs 10
- 2 outputs 20
- ...

## Modular Arithmetic-Based Wrapping

This function ensures that a given value is wrapped within a specified numeric range. If the value exceeds the range, it wraps around within this range using modular arithmetic.

Ideal for cyclic or repeating ranges, like **angles** (think CSS transformations from 0 to 360 degrees), hours on a clock, or other periodic values.

```typescript
function cyclicInterpolation(
  value: number,
  lowerBound: number,
  upperBound: number
): number {
  // adding 1 to include the upper bound in the range
  const shiftedUpperBound = upperBound - lowerBound + 1;
  const shiftedValue = value - lowerBound;
  return (
    lowerBound +
    // adding parenthesis for emphasis
    (((shiftedValue % shiftedUpperBound) + shiftedUpperBound) %
      shiftedUpperBound)
  );
}

// Example Usage
console.log(cyclicInterpolation(5, 3, 7)); // Outputs 5
console.log(cyclicInterpolation(6, 3, 7)); // Outputs 6
console.log(cyclicInterpolation(7, 3, 7)); // Outputs 7
console.log(cyclicInterpolation(8, 3, 7)); // Outputs 3 - restarts cycle
```

For example: [1,10]

- 1 outputs 1
- 9 outputs 9
- 10 outputs 10
- 11 outputs 1 - going back to the beginning
Animated texture library for react-three-fiber available in react's hooks base
Tags: react, three, png, gif
Published: 2023-12-14 07:21:04

## Introduction

We have created a simple library that will load animation textures by specifying an image file (gif/png/apng) file.
[Repository](https://github.com/activeguild/animation-texture)


Frames are parsed using [gifuct-js](https://github.com/matt-way/gifuct-js) and [UPNG.js](https://github.com/photopea/UPNG.js). The frame parsing process has a large impact on the main thread, so it is executed on the web worker.

It can be used without preparing a sprited image.

## Install

```bash
npm i animation-texture
```

## Usage

```ts
import React, { useRef, useEffect } from "react";
import * as THREE from "three";
import { useAnimationTexture } from "animation-texture";

interface Props {
  url: string;
}

export function Model({ url }: Props) {
  const { animationTexture } = useAnimationTexture({ url });
  const meshRef = useRef();

  useEffect(() => {
    if (meshRef.current && animationTexture) {
      meshRef.current.material.map = animationTexture;
      meshRef.current.material.needsUpdate = true;
    }
  }, [animationTexture]);

  return (
    <mesh ref={meshRef} position={new THREE.Vector3(0, 0, 0)}>
      <planeGeometry args={[1, 1]} />
      <meshBasicMaterial transparent side={THREE.FrontSide} />
    </mesh>
  );
}
```

#### Pre-load if necessary.

```ts
import React from "react";
import * as THREE from "three";
import { preLoad } from "animation-texture";

export default function App() {
  preLoad('/sample.png');
  return ...
}

```

## Demo

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

I believe there is still significant room for performance improvement.
ChatGPT Coding CheatSheets
Tags: chatgpt, ai, promptengineering
Published: 2023-12-15 03:25:33

**Explain why a piece of code isn't working**
```
Why this code is not working?
var x = 5;
var y = 0;
console.log(x/y);
```

**Explain what a piece of code means**
```
What does this code do?
function addNumbers(a, b) {
    return a + b;
}
```

**Rewrite the code using the specified language*
```
Translate this code into Python:
function addNumbers(a, b) {
    return a + b;
}
```

**Code an entire software program**

```
Write a program that calculates the factorial of a given number in python.
How do I make an HTTP request in Javascript?
```

**Generate regular expressions (regex)**
```
Create a regex that matches all email addresses?
Generate 8-digit password regex
```

**Add comments to your codebase**
```
Add comments to this code: 
function addNumbers(a, b) {
    return a + b;\n}
```

**Change the CSS of a line of code**
```
Update the CSS for this line to change the font color to blue?
<p class=\"example\">Hello, QuickRef.ME!</p>
```

**Change the HTML of a line of code**
```
Add a class of \"header\" to this header tag?
<h1>Hello, QuickRef.ME!</h1>
```

References:

- [ChatGPT Cheatsheet](https://simplecheatsheet.com/chatgpt)
- [Simple Cheatsheet](https://simplecheatsheet.com)
A verse about Panama
Tags: poetry
Published: 2023-12-15 18:08:05

In Panama, where peace was my quest,
In suburbs, I hoped for quiet rest.
But alas, a supermarket grand,
Expensive and loud, my peace was canned.

To the beaches of Panama City, I strayed,
A dumpster of trash on the coasts displayed.
No serene waves, just a rubbish sea,
Disappointment washed over me.

On the Caribbean coast, seafood delight,
But closures due to protests, a sorry sight.
Restaurants shuttered, no shrimp or fish,
Protest aftermath was my culinary wish.
Muhammad Awais
Published: 2023-12-16 19:26:22

👋 Hi there! I'm Muhammad Awais, a passionate Principal Software Engineer / Full Stack Software Engineer with 8+ years of experience who finds joy in crafting exceptional web experiences using JavaScript, Typescript, Angular, React, Vue, NodeJS, ROR 🚀. and leading the team of 4+ developers across the globe. My days are filled with lines of code, bringing creativity to life through top-notch technology stack.

🎤 When I'm not immersed in coding, you can often find me on the tech speaking stage, sharing insights and trends in software development. I thrive on inspiring and connecting with fellow developers, fostering a community that shares a love for opensource and innovation.

🌐 With 8+ years of experience in the industry, I've honed my skills in building scalable, efficient and performant softwares and enterprise applications for multiple domains including various domains like Ecommerce, Fintech, Audio Streaming, News Media, Logistics, Automotive, EdTech and others 🚀. From Angular to React and Vue, I'm always eager to explore cutting-edge frameworks and stay ahead of the technology curve.

📈 As an advocate for best practices and accessibility, I believe in creating inclusive digital experiences that leave a lasting impact. I'm also a community representative and contributor of (Google Developers, Angular, JetBrains, AWS, Auth0, Postman, DigitalOcean) 🇵🇰🇺🇸🇿🇦🏴󠁧󠁢󠁥󠁮󠁧󠁿🇬🇧

🌟 Let's connect and collaborate on exciting software projects (frontend + backend) or catch me at the next tech event, sharing my knowledge and passion for all things software and web development. Together, we can shape the future of digital experiences! Feel free to reach out for opportunities or a friendly tech chat. 🤝

Introduction: https://youtu.be/89t-cRNvfMU
Portfolio: https://bit.ly/muhammadawaisshaikh
Resume: https://bit.ly/muhammad-awais-resume