teleren/devto huggingface dataset:
JavaScript Promises
Tags: javascript, webdev, programming, web
Published: 2024-02-12 03:37:24

A _JavaScript Promise_ is an object representing the eventual completion or failure of an asynchronous operation. It allows you to handle asynchronous operations more elegantly and provides a way to perform tasks asynchronously and handle their results later.

Here's a real-life example story to illustrate JavaScript Promise:

Imagine you're a student waiting for your exam results. You have no control over when the results will be available, but you want to be prepared to celebrate or console yourself based on the outcome. So, you decide to use a Promise to represent this situation.


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

- In this example, _waitForExamResults_ is a Promise representing the process of waiting for exam results. Inside the Promise constructor function, there's a simulation of obtaining the exam score asynchronously after a delay of 3 seconds.
-     If the exam score is 60 or higher, the Promise resolves with a success message indicating the passing score. Otherwise, it rejects with an error message indicating failure.
-     The then() method is used to handle the fulfillment of the Promise (passing scenario), and the catch() method is used to handle the rejection of the Promise (failing scenario).
-     When you run this code, it first logs "Waiting for exam results...". After 3 seconds, it logs either "Success: Congratulations! You passed the exam with a score of X." or "Error: Sorry, you failed the exam with a score of X.", depending on the randomly generated exam score.
LunarVim + vim-iced Configuration
Tags: lunarvim, clojure, usability
Published: 2024-02-12 03:09:45

---
title: LunarVim + vim-iced Configuration
published: true
description: Making vim-iced usable with LunarVim!
tags: lunarvim, clojure, usability
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-02-11 19:37 +0000
---


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




I wanted to create a quick blog post on how to get [vim-iced](https://github.com/liquidz/vim-iced) to work with LunarVim since I struggled to get it working and the instructions on vim-iced's website are focused around vim or Neovim.

Here are the steps that worked for me!

1. Add the following plugins to your `config.lua` file.

```
  {
    "guns/vim-sexp"
  },
  {
    "liquidz/vim-iced",
    config = function()
      vim.g.iced_enable_default_key_mappings = true
    end
  }
```   
Note: make sure to allow LunarVim to install the plugins! 

2. Add the `iced` command to your `PATH` by using the path to the `vim-iced` plugin that LunarVim installed. 

```
export PATH=$PATH:~/.local/share/lunarvim/site/pack/lazy/opt/vim-iced/bin
```

Run the following command in your terminal to confirm you are able to use the `iced` command.

```
iced version
```

The installed version of `vim-iced` will show after running this command. 
![terminal image of iced version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qpp2zfba0pa6lkwmfr4d.png)


3. Open your Clojure project with LunarVim and navigate to a Clojure file. Open the terminal and run `iced repl` to start the REPL. Navigate back to your Clojure file and run `:IcedConnect` to connect to the REPL. You will see a message that says "Connected." 


Congrats! You are now able to use vim-iced with LunarVim!
[20 Days of DynamoDB] Day 19 - PartiQL Batch Operations
Tags: dynamodb, serverless, database, cloud
Published: 2024-02-12 02:34:48

*Posted: 12/Feb/2024*

You can use batched operations with PartiQL as well, thanks to `BatchExecuteStatement`. It allows you to batch reads as well as write requests.

Here is an example (note that you *cannot* mix both reads and writes in a single batch):

```go
	//read statements
	client.BatchExecuteStatement(context.Background(), &dynamodb.BatchExecuteStatementInput{
		Statements: []types.BatchStatementRequest{
			{
				Statement: aws.String("SELECT * FROM url_metadata where shortcode=?"),
				Parameters: []types.AttributeValue{
					&types.AttributeValueMemberS{Value: "abcd1234"},
				},
			},
			{
				Statement: aws.String("SELECT * FROM url_metadata where shortcode=?"),
				Parameters: []types.AttributeValue{
					&types.AttributeValueMemberS{Value: "qwer4321"},
				},
			},
		},
	})

	//separate batch for write statements
	client.BatchExecuteStatement(context.Background(), &dynamodb.BatchExecuteStatementInput{
		Statements: []types.BatchStatementRequest{
			{
				Statement: aws.String("INSERT INTO url_metadata value {'longurl':?,'shortcode':?, 'active': true}"),
				Parameters: []types.AttributeValue{
					&types.AttributeValueMemberS{Value: "https://github.com/abhirockzz"},
					&types.AttributeValueMemberS{Value: uuid.New().String()[:8]},
				},
			},
			{
				Statement: aws.String("UPDATE url_metadata SET active=? where shortcode=?"),
				Parameters: []types.AttributeValue{
					&types.AttributeValueMemberBOOL{Value: false},
					&types.AttributeValueMemberS{Value: "abcd1234"},
				},
			},
			{
				Statement: aws.String("DELETE FROM url_metadata where shortcode=?"),
				Parameters: []types.AttributeValue{
					&types.AttributeValueMemberS{Value: "qwer4321"},
				},
			},
		},
	})
```

Just like `BatchWriteItem`, `BatchExecuteStatement` is limited to 25 statements (operations) per batch.

Recommended reading:

- `BatchExecuteStatement` [API docs] (https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/dynamodb#Client.BatchExecuteStatement)
- [Build faster with Amazon DynamoDB and PartiQL: SQL-compatible operations](https://aws.amazon.com/blogs/database/build-faster-with-amazon-dynamodb-and-partiql-sql-compatible-operations/) ([thanks Pete Naylor](https://www.linkedin.com/feed/update/urn:li:activity:7159047788788424704?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7159047788788424704%2C7159110011384688642%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287159110011384688642%2Curn%3Ali%3Aactivity%3A7159047788788424704%29) !)
A Guide to Crafting a Professional README.md File
Tags: github, githubactions
Published: 2024-02-12 02:30:00

Introduction:

A README.md file is a crucial component of any software project, serving as a comprehensive guide for developers and users alike. A well-crafted README enhances collaboration, clarifies project goals, and facilitates a smoother onboarding process. In this guide, we'll walk you through the steps to create a professional README.md file that effectively communicates your project's purpose and usage.

Step 1: Project Overview

Start your README with a concise project overview. Briefly describe the purpose, features, and goals of your project. Clearly state the problem your project aims to solve and why it matters.

markdown
Copy code
# Project Name

Brief description of your project.

## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
Step 2: Installation Instructions

Provide clear and detailed instructions on how to install your project. Include any dependencies, system requirements, or environment setup needed. Utilize code blocks to enhance readability.

markdown
Copy code
## Installation

1. Clone the repository
   ```bash
   git clone https://github.com/your-username/your-project.git
Install dependencies
bash
Copy code
npm install
python
Copy code

Step 3: Usage

Explain how users can utilize your project. Provide code examples, usage scenarios, and any relevant configuration settings. Make it easy for users to understand how to interact with your project.

```markdown
## Usage

```python
import your_module

# Example usage
result = your_module.some_function()
print(result)
yaml
Copy code

Step 4: Features

List and describe the key features of your project. Highlight what sets your project apart and how it addresses the identified problem.

```markdown
## Features

- Feature 1: Describe feature 1.
- Feature 2: Explain feature 2.
- ...
Step 5: Contributing Guidelines

Encourage contributions by providing clear guidelines for contributors. Include information on how to report bugs, suggest improvements, and submit pull requests.

markdown
Copy code
## Contributing

1. Fork the repository
2. Create a new branch
3. Make your changes
4. Open a pull request
Step 6: License Information

Specify the project's license to inform users and contributors about the terms of use and distribution.

markdown
Copy code
## License

This project is licensed under the [Your License] - see the [LICENSE](LICENSE) file for details.
Conclusion:

A well-crafted README.md file is an essential tool for effective project communication. By following these steps, you can create a professional README that enhances collaboration, facilitates understanding, and contributes to the overall success of your software project.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8p4aukfd7ngu5raojhu5.jpeg)
How To Understand a Condo Floor Plan: A Visual Guide for First-time Home Buyers
Tags: plan, floor, home, visual
Published: 2024-02-12 01:36:40




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

If you frequently shop for condos on property-selling sites, you may have already encountered diagrams detailing the property’s layout from above. These photos are [floor plans](https://federalland.ph/articles/how-to-understand-condo-floor-plan-visual-guide/). While they’re a handy tool to help homebuyers visualize their prospective homes, they’re sometimes too tricky to comprehend.

But what is a floor plan, and how do you decipher its symbols?

**Defining a Floor Plan**

A floor plan represents an area’s layout from the top-down perspective, exhibiting its dimensions, structures, and features (like walls, doors, and windows). More detailed plans also include colors, fixtures, furniture, and appliances to help you picture the property better.

That said, they aren’t exclusive to buyers. Architects, engineers, real estate agents, and homeowners use floor plans to visualize the space for renovation, decoration, restructuring, and other customizations. As such, floor plans are invaluable when you need a comprehensive understanding of the property.

Interpreting floor plans can be complicated, especially with their numerous symbols and figures. Here are some essential points you may encounter when studying one to help you navigate a floor plan.

•	**Compass:** First, you may notice the compass symbol, usually an arrow pointing to where the north is relative to the property. It’s beneficial for renovation, letting you identify where prevailing winds and sunlight come from.

•	**Entry and exit points**: These symbols indicate where the front doors and emergency exits are. They can assist in redecorating since you can optimize the space without blocking key areas and paths. They also help with emergency planning by establishing evacuation routes.

•	**Room dimensions:** These numbers are present on the diagram’s outer sides. They measure the condo and its rooms’ width, length, and height to help with renovation and decoration planning.

•	**Room names:** Every room in the floor plan usually has a label detailing its intended use. They aid contractors in identifying their corresponding fixtures and furniture while helping homebuyers understand the property’s layout more comprehensively. 

**Understanding Floor Plans**

Knowing how to read and comprehend floor plans is crucial when shopping for condos. They give you an idea of the property’s layout without being physically present with a realtor. Since plans identify fixtures, structures, and measurements, they also aid with renovation planning whenever you want to spruce up your home.

For more information, refer to the following visual guide to understand condo floor plans better.
Understanding JavaScript Operators: A Comprehensive Guide
Tags: webdev, javascript, beginners, programming
Published: 2024-02-12 01:29:59

JavaScript, as a versatile programming language, employs various types of operators to manipulate data, perform calculations, and execute logical operations. In this post, we'll explore the different types of operators, their use cases, and provide examples to enhance your understanding.

**1. Arithmetic Operators:**
These operators perform mathematical calculations.

```
Addition (+): Adds two values.
let result = 5 + 3; // Result: 8
```

```
Subtraction (-): Subtracts the right operand from the left operand.
let result = 10 - 4; // Result: 6

```

```
Multiplication (*): Multiplies two values.
let result = 3 * 7; // Result: 21
```

```
Division (/): Divides the left operand by the right operand.
let result = 20 / 5; // Result: 4
```

```
Modulus (%): Returns the remainder of a division.
let result = 15 % 4; // Result: 3
```

**2. Comparison Operators:**

```
These operators compare two values and return a Boolean result.
Equal (==): Checks if two values are equal.
let isEqual = 5 == '5'; // Result: true
```

```
Not Equal (!=): Checks if two values are not equal.
let isNotEqual = 10 != 5; // Result: true
```

```
Strict Equal (===): Checks if two values are equal and of the same type.
let isStrictEqual = 5 === '5'; // Result: false
```

```
Strict Not Equal (!==): Checks if two values are not equal or not of the same type.
let isStrictNotEqual = 10 !== '10'; // Result: true
```

```
Greater Than (>): Checks if the left operand is greater than the right operand.
let isGreaterThan = 15 > 10; // Result: true

```

```
Less Than (<): Checks if the left operand is less than the right operand.
let isLessThan = 7 < 12; // Result: true
```

**3. Logical Operators:**
These operators perform logical operations.

```
AND (&&): Returns true if both operands are true.
let isBothTrue = true && true; // Result: true
```

```
OR (||): Returns true if at least one operand is true.
let isEitherTrue = true || false; // Result: true
```

```
NOT (!): Returns the opposite Boolean value of the operand.
let isNotTrue = !false; // Result: true
```

**4. Ternary Operator:**
The ternary operator provides a concise way to write simple if...else statements.

Syntax:

```
condition ? expression_if_true : expression_if_false;
let isEven = (num) => (num % 2 === 0) ? 'Even' : 'Odd';

console.log(isEven(4)); // Output: 'Even'
console.log(isEven(7)); // Output: 'Odd'
```

**Summary:**
Understanding JavaScript operators is fundamental for any developer. These operators empower you to manipulate data, make decisions, and perform various operations within your code. As you delve deeper into JavaScript, mastering the usage of operators will contribute to writing more efficient and concise code.
The ü/ü Conundrum
Tags: javascript, programming, encoding, unicode
Published: 2024-02-12 01:23:23

I implemented search and filtering for entities on our product at epilot. The users were heavily using the feature, however, a unique issue surfaced: difficulties in filtering file names containing diacritical marks like umlauts (Äpfel, über, schön, etc.).

Intrigued, I delved into the logic to investigate. Initially, everything seemed in order. For instance, a file named “blöb” was saved precisely as “blöb” — no bizarre encoding alterations were apparent.

Can you spot any difference between “blöb” and “blöb”?

This time instead of typing the word in the search bar, I copied it from the uploaded and saved filename, and and voilà, the search functioned perfectly! 🤯. This definitely meant the file name was subtly altered upon upload, hinting at a background encoding transformation.

So, as anyone would, I employed the power of encodeURIComponent to see for myself what really was different.

There it was! The different types of encoding forms that led to this. Now you might be wondering (I was wondering too!):

> As if worrying about encoding wasn’t enough, now we’ve got to stress over its different types too 🤦‍♀ and wait, its 2024, and we are still grappling with Unicode character encoding problems?


![different encoding forms](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s8bqoa1seb9nj96uufxw.png)


The culprits in this case were these two contrasting encoding types: `%C3%BC` and `%CC%88`, leading to the search malfunction. This is a well-known issue with NFD/NFC encoding forms.

There is a detailed explanation [here](https://unicode.org/reports/tr15/#Norm_Forms).


![nfc and nfd](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iziylxqmjph9xw35fcpw.png)

Now imagine explaining this technical jargon that to a user! 😃

To fix it, I aligned the encoding type of the searched filename with that of the saved filename.
On MacOS, the encoding was NFD (for ö: 111 + 776), whereas on Linux, it switched to NFC (ö: 246).

The solution?

- Post-upload, before saving the file as an entity, I applied .normalize() to the filename, ensuring it was uniformly searchable.
- Additionally as a next cleanup step — to write a migration script to normalize the names of all existing files with non-ASCII characters.

A simple string normalise proved effective in this case. ✅

Read more about String.prototype.normalize() [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize#canonical_equivalence_normalization). There is also specific normalization option to pass to ensure canonically equivalent normalization — for example: string.normalize("NFC")

Here’s a visual representation of the problem with the solution output:

[files umlaut.mov](https://drive.google.com/file/d/1Jkp8ye47iRfDoeTaMQkkskY_BTHegj_D/view?source=post_page-----1b628e8cf36a--------------------------------)

Hope it helps!
Third-party Virtual Appliances
Tags: aws, elb, gatewayloadbalancer, beginners
Published: 2024-02-12 00:47:04

**What is Third-party Virtual Appliance, and where it is used in AWS Cloud ??**

Third-party virtual appliances: The pre-configured virtual machines images, that are provided by third-party venders and are ready to deploy in virtual environments are called "**This-party virtual appliances**".

`Virtual environments can be VMware, Hyper-V, VirtualBox, or cloud platforms like AWS, Azure and Google cloud Platform.`

Virtual appliances are designed for various purposes like application delivery, monitoring, networking or security. 
For example virtual image that have specific service like pre-installed and configured service for security that can be deploy in any virtual env.

Third-party virtual appliances provide ready to use solutions for various problems. Some examples of third-party virtual appliances are firewall appliances by Cisco, Database appliances from Oracle etc.
Introduction to Cybersecurity and Ethical Hacking
Tags: cybersecurity, security, programming, beginners
Published: 2024-02-12 00:29:55

## Introduction

In today's digital age, where technology is constantly evolving, the risk of cyber threats and attacks has also risen. This has led to the need for robust cybersecurity measures to protect our personal and professional data. Ethical hacking, a practice of testing security systems to identify potential vulnerabilities, plays a crucial role in ensuring the safety of our digital world. In this article, we will discuss the basics of cybersecurity and ethical hacking and their significance in today's world.

## Advantages

- **Protection of Sensitive Information:** The primary advantage of cybersecurity is the protection of sensitive information from cyber attacks. It helps prevent unauthorized access, data theft, and disruption of services.
- **Identification of Weak Spots:** Ethical hacking allows organizations to identify weak spots in their security systems and address them before any malicious hacker can exploit them. This proactive approach helps in protecting a company's reputation and preventing financial losses.

## Disadvantages

- **High Costs:** One of the most significant disadvantages of cybersecurity is the high cost involved in building and maintaining robust security systems. It requires constant updates, training, and skilled professionals to ensure maximum protection.
- **Potential Ethical Implications:** Ethical hacking can also have potential ethical implications as it involves potentially breaking into systems without proper authorization.

## Features

- **Cybersecurity Measures:** Some essential features of a good cybersecurity strategy include data encryption, firewalls, intrusion detection systems, and regular data backups. These measures help in securing data and preventing unauthorized access.
- **Ethical Hacking Techniques:** Ethical hacking uses techniques like penetration testing, vulnerability assessments, and social engineering to identify and patch vulnerabilities.

## Conclusion

In conclusion, cybersecurity and ethical hacking are vital in today's interconnected world. While cybersecurity provides the necessary protection against cyber threats, ethical hacking helps in identifying and addressing potential vulnerabilities. With the ever-growing threat of cyber attacks, it is crucial to have a robust cybersecurity plan in place and conduct regular ethical hacking assessments to maintain the security of our digital world.
WIZARD WEB RECOVERY HELP ME RECOVERY BACK MY STOLEN BITCOIN
Published: 2024-02-12 00:19:38

The journey of having my Bitcoin investment stolen was not only financially distressing but also deeply shook my trust and confidence in the security of online transactions. However, thanks to the expertise and dedication of Wizard Web Recovery, I now feel a renewed sense of trust in the virtual world. Their unwavering commitment to helping individuals like me regain what was taken from them has restored my faith that there are genuine and capable professionals out there who can protect our digital assets. I learned a lot from my regrettable experience about how crucial it is to put strong security measures in place while investing in Bitcoin. Precautionary measures and proactive approaches are essential to protect our digital assets from potential dangers. Investing in encryption technologies, two-factor authentication, and strong passwords can help stop theft and prevent unwanted access. The need for safe storage and contingency plans for bitcoin investments is among the most important lessons I learned from my experience. You can add a degree of security against possible loss or theft by keeping your bitcoins in a reliable wallet and routinely backing up your data. Multiple copies of your digital wallet kept in a safe location will help to guarantee that your savings stay safe even in case of unanticipated events. Keeping up with the most recent security developments and practices is essential. Keeping up with regular education regarding potential hazards and learning how to spot and steer clear of scammers will help protect your Bitcoin investments. Maintaining awareness and putting effective security procedures into practice will greatly lower your vulnerability to harmful assaults. Wizard Web Recovery has done amazing work, and for that, I am quite grateful. Their skill, knowledge, and constant encouragement during my recuperation have had a profound effect on me. They have my sincere gratitude for their unwavering devotion to assisting people like me in recovering their misplaced belongings and obtaining justice. Reflecting upon my journey, I realize that setbacks and challenges are an inevitable part of life, both in the physical and digital realms. However, it is how we respond and the help we seek that ultimately determines our ability to overcome adversity. My experience with Wizard Web Recovery has taught me the power of resilience and the importance of seeking assistance from experts when faced with daunting situations. To anyone who has experienced the loss of their bitcoin investments or any other digital assets, I want to offer a message of encouragement and hope. There are solutions out there, and organizations like Wizard Web Recovery are dedicated to helping individuals recover what is rightfully theirs. Never lose faith, seek expert help, and remember that even in the darkest of times, a smile can return to your face. 

Email = wizardwebrecovery (@) programmer(.)net
Web = www(.)wizardwebrecovery(.)net