teleren/devto huggingface dataset:
about-me
Published: 2024-01-16 21:07:52

Greetings, I’m Jaykishan Mutkawoa or simply Nitin or Jay to those who know me. This blog is my space to share insights on Linux, Open Source, DevOps, Technology, and anything else intriguing that crosses my path. Back in the day, I actively participated in Open Source and Linux meetups, as well as Hackathons. Originally from the enchanting island of Mauritius in the Indian Ocean, I was raised in a small village: “Riviere Des Anguilles“, my journey took a turn in October 2019 when I moved to the United States. Currently, I’m engaged as a System Operation Specialist at NASDAQ – the National Association of Securities Dealers Automated Quotations. Beyond the tech realm, I find joy in exploring Psychology, Science, Space, Futuristic Physics, and Language. Join me as I unravel the complexities of technology and share my experiences on this exciting journey.

My Track

2005 – I found myself in a private school, navigating the challenges of obtaining my School Certificate. However, at that point in my life, securing employment took precedence over academic pursuits. My primary assets at the time were my proficiency in running and holding a red belt in tae kwon do.

2005 – [First job] I vividly recall the moment in a classroom when I received a response from the Commissioner of Police in Mauritius, notifying me of a required physical aptitude test. Fortunately, I successfully navigated through it. On the eve of that notification, I sat in a classroom, and the very next day, I bid farewell to school life to join the esteemed ranks of the Mauritius Police Force in June 2005. It was during my training that I realized I held the distinction of being the youngest member in my batch.

Throughout my eight-year tenure in the Police Force (from 2005 to 2013), Linux, in those days, was more of a recreational pursuit for me. Amidst duties that involved sentries of prisoners and patrols, I carried my Linux notes in my pocket, often consulting them in moments of reflection. Transitioning to a fully flexible Linux-savvy individual proved challenging, given the demanding nature of my law enforcement responsibilities.

My training journey led me through the intricacies of the Police Training School at the SMF (Special Mobile Force) complex, and after nine months of intensive preparation, I commenced my professional career in law enforcement. My initial assignment placed me in a quaint village in the south of the island at the Souillac Police Station. Subsequently, I experienced diverse roles and responsibilities as I was transferred across various units, including DSU, CID, Regular Force, ADSU, and more. Each transfer brought new challenges and opportunities, contributing to a comprehensive and dynamic career within the Mauritius Police Force.

READ More here https://tunnelix.com/about-me
How to center a div ? Seriously!
Tags: center, div
Published: 2024-01-16 20:52:00

---
title: How to center a div ? Seriously!
published: true
description: Yes, how to center a div?
tags: ["center", "div"]
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
published_at: 2024-01-16 20:52 +0000
---

Well, glad you asked !

```css
.center {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
```

or tailwind way !

```html
<div class="h-screen flex justify-center items-center">
  One does not simply center a div
</div>
```

Or make it even funky.

```js
window.addEventListener('resize', centerDiv);
document.addEventListener('DOMContentLoaded', centerDiv);
function centerDiv() {
   let container = document.querySelector('.center');
   let windowHeight = window.innerHeight;
   let containerHeight = container.offsetHeight;
   let containerWidth = container.offsetWidth;
      
   // Calculate the position to center the div vertically
   var topPosition = (windowHeight - containerHeight) / 2;
   // Calculate the position to center the div horizontally
   var leftPosition = (containerWidth / 2);
   // Apply the margin to the div
   container.style.marginTop = topPosition + 'px';
   container.style.marginLeft = leftPosition + 'px';
}
```
How to parse FormData values with Netlify Functions V2
Tags: netlify, functions, form
Published: 2024-01-16 20:48:25

I spend 3 hours trying to understand that. All the blog posts related to this topic do not work. Netlify Functions V2 uses [Request API](https://developer.mozilla.org/en-US/docs/Web/API/Request). I used Node.js v20 to parse FormData values in `multipart/form-data` requests. You can see how easy it is with the example below. This function returns form data values as JSON in response.

```js
export default async function (event) {
  const data = await event.formData();
  const fields = {};

  for (const pair of data.entries()) {
    fields[pair[0]] = pair[1];
  }

  return new Response(JSON.stringify(fields), { status: 200 });
}
```
I hope this helps you. Have nice coding!
How to Learn Java: A Guide for Beginners
Published: 2024-01-16 20:39:35

Java is one of the most popular and widely used programming languages. It powers enterprise applications, Big Data solutions, mobile apps, and more. Here is a structured guide on how to learn Java for beginners.

## Learn Java Syntax 

Java has C/C++-like syntax with some differences. Go through the basics - variables, data types, functions, classes, etc. Focus on concepts like:

- Object-oriented programming 
- Data encapsulation
- Inheritance 
- Polymorphism

Practice by writing simple Java programs using OOP principles. Resources like Codecademy, Udemy, and Hyperskill have great interactive courses.

## Work with Java Development Kit 

Install Java Development Kit (JDK) on your computer. Learn to compile code, run using java command, debug programs etc. Familiarize yourself with tools like javac, jshell, jar, javadoc etc.

## Understand Core Libraries

Explore essential core libraries like:

- java.lang - Provides utility classes 
- java.io - For input/output operations
- java.util - Data structures like ArrayList, HashMap etc.
- java.net - For networking and connecting to URLs
- java.sql - For interacting with databases

These classes will be used extensively in your projects.

## Practice with Sample Projects

Apply your Java skills by building mini projects like a calculator, TicTacToe game, To-do list manager etc. Use object-oriented design,exception handling, take user inputs and outputs.

## Explore Frameworks and Tools

Look into popular frameworks like Spring for backend development, Android for mobile dev, as well as build tools like Maven and Graddle. These are used extensively in Java web and enterprise development.

Learning a language goes beyond just syntax. Follow these steps to gain professional Java skills for both core and enterprise application development.
The .each method with do - end blocks and pipes ||
Tags: beginners, ruby
Published: 2024-01-16 20:35:11

**What is the .each method?**
The .each method is an iterator method that is used to iterate over elements in an enumerable object, such as an array, hash, or range. It allows you to perform a specific action for each element in the collection.

**Using .each with do - end blocks:**

```
# Using .each with a do - end block to iterate over elements in an array
numbers = [1, 2, 3, 4, 5]

numbers.each do |num|
  puts num * 2
end

```
In this example, the do - end block is used to define the code that will be executed for each element in the numbers array. The variable num represents each individual element during each iteration.

**Using .each with pipes ('||'):**
You can also use pipes (| |) to specify the block parameters. The following example achieves the same result as the previous one:

```
# Using .each with pipes (| |) to iterate over elements in an array
numbers = [1, 2, 3, 4, 5]

numbers.each { |num| puts num * 2 }

```
In this example, the block is written in a single line using braces ({ }). The variable num is still used to represent each element during iteration.

**How and when to use .each method?**

1) Iterating Over Arrays:

```
fruits = ["apple", "banana", "orange"]
fruits.each { |fruit| puts "I love #{fruit}" }

```

2) Iterating Over Hashes:

```
person = { name: "John", age: 30, city: "New York" }
person.each { |key, value| puts "#{key}: #{value}" }

```

3) Performing Actions on Each Element:

```
numbers = [1, 2, 3, 4, 5]
squared_numbers = []
numbers.each { |num| squared_numbers << num**2 }

```

4) Iterating Over a Range:

```
(1..5).each { |num| puts num }

```
The .split method
Tags: beginners, ruby
Published: 2024-01-16 20:00:12

**What is a .split method?**
The .split method is a string method that is used to split a string into an array of substrings based on a specified delimiter. By default, the delimiter is a space, but you can provide any character or regular expression pattern to determine where the string should be split.

**Example:**

```
# Using .split to split a string into an array of words
sentence = "This is a sample sentence"
words = sentence.split

puts words
# Output: ["This", "is", "a", "sample", "sentence"]

```

You can also provide a custom delimiter as an argument to .split. For example, using a comma as the delimiter:

```
# Using .split with a custom delimiter (comma)
csv_data = "John,Doe,30"
fields = csv_data.split(',')

puts fields
# Output: ["John", "Doe", "30"]

```

**How and when to use the .split method?**
The .split method is particularly useful when working with text data and you need to extract individual components from a delimited string. Here are some common use cases:

1) Parsing CSV (Comma-Separated Values) Data:

```
csv_line = "Alice,25,New York"
user_data = csv_line.split(',')

```

2) Extracting Paths or File Names:

```
file_path = "/path/to/my/file.txt"
parts = file_path.split('/')

```

3) Handling Input with Multiple Values:

```
user_input = gets.chomp
values = user_input.split(',')

```

4) Tokenizing Text:

```
text = "Tokenizing this text into individual words"
tokens = text.split(' ')

```
How to run nodejs on android tablet using termux (full guide)
Published: 2024-01-16 19:54:32


to run nodejs server on android tablet you need to download termux, then run

the first issue how to install and setup nodejs environment

### step 1

```bash
pkg update && pkg upgrade
```

### step 2

```bash
pkg install nodejs && pkg install git
```

or

```bash
apt install nodejs && apt install git
```

## the second issue how to create folder and edit files in it
in termux write

### first cd the default folder in termux

```bash
cd ~
```

### make directory

```bash
mkdir react-on-android
```

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

## clone project

```bash
git clone %url%
```

install packages

```bash
npm i
```

start server

```bash
npm run start
```

## Or create new project

initialize npm project

```bash
npm init
```

install npm package (react)

```bash
npm install react
```

create new project

```bash
npx create-react-app my-app-name
```

to run server

```bash
npm run start
```

## how to open project in code editor

am using acode

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

Add path

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

Select folder

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

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

Select termux

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p9rhuzj5elmb3rxjlcnd.jpg)
The .push method
Tags: beginners, ruby
Published: 2024-01-16 19:47:32

**What is a .push method?**
The .push method is a commonly used method for adding elements to the end of an array. It appends the specified object (or objects) to the end of the array and returns the modified array.

**Example:**

```
# Creating an array
my_array = [1, 2, 3]

# Using .push to add a new element to the end of the array
my_array.push(4)

puts my_array
# Output: [1, 2, 3, 4]

```
In this example, the .push(4) method is called on the my_array, and the integer 4 is added to the end of the array, resulting in [1, 2, 3, 4].

You can also use the shorthand notation '<<' for the same purpose:

```
# Using << to add another element to the end of the array
my_array << 5

puts my_array
# Output: [1, 2, 3, 4, 5]

```

**How and when to use the .push method?**
The .push method is particularly useful when you want to dynamically add elements to an array, especially when working with data that is generated or obtained during the execution of your program. It is commonly used in scenarios like:

1) Appending Elements in a Loop:

```
numbers = [1, 2, 3]
(6..10).each { |num| numbers.push(num) }

```

2) Building an Array Incrementally:

```
result = []
result.push("first")
result.push("second")

```

3) Adding Elements Based on Conditions:

```
fruits = ["apple", "banana"]
fruits.push("orange") if some_condition

```

4) Dynamic Data Collection:

```
user_names = []
user_names.push(get_user_input)

```

In summary, the .push method is a convenient way to add elements to the end of an array, and you would use it when you need to dynamically expand or modify an array during the course of your program.
The Array class
Tags: beginners, ruby
Published: 2024-01-16 19:37:54

**What is an Array?**
The Array class is an ordered, indexed collection of objects. They are mutable, meaning you can modify the elements of an array after it has been created. 

**Example:**

```
# Creating an array with three elements
my_array = [1, "hello", 3.14]

# Accessing elements by index
puts my_array[0]  # Output: 1
puts my_array[1]  # Output: hello
puts my_array[2]  # Output: 3.14

# Modifying elements
my_array[1] = "world"
puts my_array     # Output: [1, "world", 3.14]

# Adding elements to the end of the array
my_array.push("new element")
puts my_array     # Output: [1, "world", 3.14, "new element"]

```

**How and when to use the Array class?**
You use the Array class when you need to store and manage a collection of items, especially when the order of elements matters.

1) List of items: Arrays are great for representing lists of items.

```
user_names = ["Alice", "Bob", "Charlie"]

```

2) Data Transformation: Arrays are often used to transform or process data. You can iterate over the elements and apply operations or filters.

```
numbers = [1, 2, 3, 4, 5]
squared_numbers = numbers.map { |num| num**2 }

```

3) Collection of Objects: Arrays can hold objects of different types, making them versatile for storing heterogeneous collections.

```
mixed_data = [1, "hello", 3.14, { key: "value" }]

```

4) Stack or Queue: Arrays can be used as a simple stack or queue where you add or remove elements from one end. 

```
stack = []
stack.push(1)
stack.push(2)
popped_element = stack.pop

```

5) Working with API Responses: When dealing with API responses, you might use arrays to represent a list of items returned by the API.

```
require 'json'
require 'net/http'

api_url = URI.parse('https://api.example.com/data')
api_response = Net::HTTP.get(api_url)
data_array = JSON.parse(api_response)

```
verified woolen cloth trader
Published: 2024-01-16 19:34:05

Bhagwati Enterprises, [the Online Largest Cloth Exporter and Manufacturer Company in Haryana](https://www.bhagwati-enterprises.in, Knitwear, high-end apparel, and accessories of the finest quality are produced at the forefront of design, innovation, and full-scale production for high-end global fashion companies and shops across the world. With a commitment to providing great products that satisfy our clients' high expectations, Bhagwati Enterprises is perfectly positioned to keep on top of the current trends in the ever-changing world of fashion.
🎉 Samsung S24 Giveaway! 🎉
Published: 2024-01-16 19:27:32

We're thrilled to announce a fantastic giveaway where you have the chance to win a brand new Samsung S24! 📱✨ 
How to Enter:
[Registration And Fill Up You Details](https://sites.google.com/view/samsungs24giveaway/home)
Terms and Conditions:
You must complete all the entry steps to be eligible.
The winner will be randomly selected and announced on [10-02-2024].
The giveaway ends on [08-02-2024].
Open to [[Specify Eligibility]](https://sites.google.com/view/samsungs24giveaway/home
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lg43lar7hfnj0fmts0y8.jpg))
Good luck to everyone! 🍀

[[Win SamsungS24]](https://sites.google.com/view/samsungs24giveaway/home)
#SamsungS24 #Giveaway #FreePhone #ContestAlert
Copia de Snapshot de Banco de Dados RDS criptografado entre Contas AWS
Tags: aws, rds, awsrds
Published: 2024-01-16 19:24:44



1- Crie o Snapshot do seu banco de dados RDS, verifique se a chave de criptografia dele é a padrão; caso seja, crie uma nova chave KMS e realize uma cópia do Snapshot criado, trocando a chave KMS para a que foi criada, conforme exemplificado abaixo (caso você já tenha uma chave de criptografia que não seja a padrão, pode prosseguir para o passo 2 sem realizar a cópia do snapshot criado):



_-Criação de snapshot_
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b3mi7h9rsmsp38ohj6ix.png) 

_-Criação de copia do snpashopt_
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khxc7of8z546l3n801dq.png)

_-Trocando a chave kms da copia_

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

2- Acesse a chave KMS vinculada ao seu snapshot ou cópia, vá para a aba "Other AWS accounts" > "Add other AWS accounts", e adicione o ID da conta à qual deseja compartilhar o Snapshot.


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


3- Vá até a cópia do snapshot à qual foi trocada a chave do KMS em "Actions" > "Share snapshot".

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


4- Adicione o ID da conta à qual deseja compartilhar o Snapshot e clique em "Salvar".

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


5- Vá até a conta à qual o snapshot foi compartilhado, navegue até RDS, na aba "Snapshots" > "Shared with me", será possível visualizar o snapshot. Com isso, é possível realizar uma cópia desse snapshot para a nova conta, alterando a chave do KMS para uma de sua escolha pertencente a essa nova conta.

Ao realizar esse processo, você conseguirá criar um novo banco de dados RDS em sua nova conta sem depender da chave de criptografia da conta antiga.


## A utilidade de poder copiar Snapshots criptografados 

Copiar um snapshot RDS criptografado de uma conta da AWS para outra é como ter uma cópia de backup segura que você pode levar para onde precisar. Isso é útil porque, por exemplo, você pode querer testar algo novo em um ambiente separado ou compartilhar dados com outra equipe, ou até mesmo migrar um ambiente de uma conta para outra.

A criptografia adiciona uma camada extra de segurança, como um cadeado digital, para garantir que seus dados estejam protegidos durante todo o processo. Essa flexibilidade é como ter uma chave que permite mover informações importantes de maneira fácil e segura entre diferentes partes da nuvem.

Resumindo, ser capaz de copiar snapshots criptografados é como garantir seus dados, facilitando sua movimentação e mantendo-os protegidos, não importa onde você precise usá-los na nuvem AWS.
4
Published: 2024-01-16 16:52:09

Hello, this is Bing. I can help you understand the code you sent me. 😊

The line of code `app.use(bodyParser.json());` is used in **Express**, a web framework for **Node.js**. It tells the application to use a middleware called **body-parser**, which can parse the body of incoming HTTP requests and make it available under the `req.body` property¹.

The `bodyParser.json()` function returns a middleware that only parses **JSON** data, which is a common format for exchanging data between web servers and clients². JSON data is a string that represents an object, array, or other value, and it can be easily converted to and from JavaScript objects³.

The `app.use()` function is a way to register a middleware for the application. A middleware is a function that can modify the request or response objects, or perform some logic before passing the control to the next middleware or handler⁴. By using `app.use(bodyParser.json());`, you are telling the application to use the body-parser middleware for all routes, and to parse the request body as JSON if the `Content-Type` header matches the `type` option².

Here is an example of how this code works:

```javascript
// Import express and body-parser modules
var express = require('express');
var bodyParser = require('body-parser');

// Create an express application
var app = express();

// Use the body-parser middleware to parse JSON data
app.use(bodyParser.json());

// Define a route that handles POST requests
app.post('/hello', function(req, res) {
  // Access the parsed JSON data from the request body
  var name = req.body.name;
  // Send a response with a greeting
  res.send('Hello, ' + name + '!');
});

// Start the server on port 3000
app.listen(3000, function() {
  console.log('Server is running on port 3000');
});
```

In this example, the application defines a route that handles POST requests to the `/hello` path. When a client sends a request to this path with a JSON body like `{"name": "Alice"}`, the body-parser middleware will parse the JSON string and create a JavaScript object with a `name` property. The route handler can then access this property from the `req.body` object and use it to send a personalized response.
An overview of Next Route Groups
Tags: nextjs, nextroutes, react, routes
Published: 2024-01-16 19:20:27

**Next Route Groups** are a way to organize routes in the app directory without changing the URL paths. By enclosing a folder name in parentheses, you can create a Route Group that helps keep related routes together. This allows for better organization and management of routes within the app.


![next-route-groups](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dunsbgryriejjbeapqi1.jpg)

In this example, `(admin-routes) (auth-routes) (client-routes)`
 are route groups. they are grouped together for better organization, without altering URL structure.

The URL path to the unauthorized page will be only `/unauthorized` .

**Next Route Groups** enables you to organize your content logically, create nested layouts, and maintain a clean URL structure.

---

**Thank you for reading.
If you liked this article shared it!
I appreciate your feedback.**
Видбудова ремонтно-строительная компания
Published: 2024-01-16 18:54:31

Компания "Видбудова" - ваш надежный партнер в сфере ремонта и строительства квартир. Мы предлагаем полный цикл услуг, начиная от выбора участка для строительства и заканчивая заносом мебели в ваш новый интерьер. Забудьте о заботах по сравнению цен и проверке надежности мебельщиков - наша команда берет это на себя, предоставляя вам готовые варианты с детальными плюсами и минусами для выбора.

Мы стремимся, чтобы каждая вложенная в нас гривна приносила вам надежные решения, соблюдение сроков и воплощение дизайнерских задумок в каждую мелочь. В отличие от общего стресса, сопутствующего процессу ремонта или строительства, компания "[Видбудова](https://www.vidbydova.com.ua/remont-kvartir/)" берет на себя ответственность за свои действия и придерживается договоренностей, минимизируя ваши хлопоты. Вам останется только наслаждаться результатами, согласовывая решения и радуясь обновленному пространству.

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