teleren/devto huggingface dataset:
React Native’s Best Feature: Hot Reloading for Effortless Development
Tags: react, native, hot, reloading
Published: 2023-04-11 10:33:45

Hot reloading is a potent feature provided by the well-liked cross-platform mobile application framework React Native. Developers can see changes to their code in real-time using hot reloading without having to restart the entire programme. This feature allows for quick iteration and debugging, which ultimately leads to more effective and imaginative production.

Hot reloading eliminates the need to completely reload the application after each change, allowing developers to test out various code modifications and see the effects right away. For instance, a developer may easily alter the code and see the changes immediately reflected if they wish to modify the text on a button.

Here’s an example of how hot reloading works in React Native:


**import React, { useState } from 'react';
import { Text, View, StyleSheet, TouchableOpacity } from 'react-native';

export default function App() {
  const [count, setCount] = useState(0);

  return (
    <View style={styles.container}>
      <TouchableOpacity onPress={() => setCount(count + 1)}>
        <Text>You clicked me {count} times!</Text>
      </TouchableOpacity>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});
**

Let’s say we wish to replace “You clicked me” with “Click me instead.” Hot reloading is enabled, allowing us to easily edit the code without having to restart the application, and the change will take effect right away:


**import React, { useState } from 'react';
import { Text, View, StyleSheet, TouchableOpacity } from 'react-native';

export default function App() {
  const [count, setCount] = useState(0);

  return (
    <View style={styles.container}>
      <TouchableOpacity onPress={() => setCount(count + 1)}>
        <Text>Click me instead {count} times!</Text>
      </TouchableOpacity>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});
**

In conclusion, hot reloading is one of the most powerful features of React Native, allowing developers to see changes to their code in real-time and saving time and effort in the development process. By making it easier to experiment with different code changes, hot reloading can encourage more efficient and creative development.
Converting MKV Files for Compatibility with Older Devices and Software
Tags: mp3codec, videocodec, audiocodec, mpeg4
Published: 2023-04-18 05:49:03

---
title: Converting MKV Files for Compatibility with Older Devices and Software
published: true
date: 2023-04-11 09:48:33 UTC
tags: mp3codec,videocodec,audiocodec,mpeg4
canonical_url: 
---

### Introduction

MKV is a popular video format that supports multiple audio and video codecs. However, some older devices or software may not support the newer codecs used in MKV files, which can cause playback issues. To address this, you can convert your MKV files to an older video codec and audio codec that is more widely supported. In this tutorial, I’ll show you how to convert MKV files to an older video codec and audio codec, with a focus on using MP3 as the audio codec.

### Prerequisites

Before we begin, you’ll need to have the following software installed on your system:

- FFmpeg: a powerful command-line tool for converting and manipulating video and audio files. You can download FFmpeg from the official website: [https://ffmpeg.org/](https://ffmpeg.org/)
- Install the libmp3lame codec:

```
sudo apt-get install libmp3lame-dev -y
```

### Steps to Convert MKV Files to Older Video Codec and Audio Codec

1. Open a terminal window on your system.
2. Navigate to the directory where your MKV file is located.
3. Run the following command to convert the MKV file to an AVI file with MPEG-4 Part 2 video codec and MP3 audio codec:

```
ffmpeg -i input.mkv -c:v mpeg4 -b:v 5M -c:a libmp3lame output.avi
```

4. In this command, we are using the -i option to specify the input file (replace input.mkv with the name of your input file), the -c:v mpeg4 option to specify the MPEG-4 Part 2 video codec, the -b:v 5M option to set the video bitrate to 5Mbps (you can adjust this value as needed), and the -c:a libmp3lame option to specify the MP3 audio codec.

5. Wait for FFmpeg to finish the conversion process. This may take some time, depending on the length and size of your input file.

6. Once the conversion is complete, you will have a new file named output.avi in the same directory as your input file.

7. Test the output file to ensure that it plays back correctly on your target device or software.

### Conclusion

Converting MKV files to an older video codec and audio codec can help ensure compatibility with older devices and software that may not support newer codecs. By following the steps in this tutorial, you can easily convert your MKV files to MPEG-4 Part 2 video codec and MP3 audio codec using FFmpeg. Remember to experiment with different video and audio bitrates to find a balance between file size and quality that works for your needs.

### Demo — Code Walkthrough

{% gist https://gist.github.com/byteshiva/9711d1d64d21a19845bd605681f0d7b0 %}
Rise of low-code and no-code tools
Tags: salesforce, saas, agile, cloud
Published: 2023-04-11 09:41:12

The rise of low-code and no-code tools in Salesforce development has brought significant benefits to businesses, but it has also addressed real-life problems that companies face in an increasingly competitive market.

For instance, one of the biggest challenges businesses face is the need to deliver solutions quickly and efficiently. With low-code and no-code tools, businesses can develop custom applications faster than ever before. For example, a nonprofit organization was able to develop a Salesforce application to manage its donations in just a few weeks, compared to the six months it would have taken using traditional coding methods.

Another challenge that businesses face is the shortage of skilled developers. According to a 2020 survey by the International Data Corporation, the demand for developers is expected to exceed supply by 30% in 2022. Low-code and no-code tools can help address this shortage by enabling non-technical stakeholders to participate in the development process. This can also help to reduce the risk of human error.

Furthermore, low-code and no-code tools have made it possible for businesses to create custom applications that are tailored to their specific needs. For example, a construction company was able to develop a Salesforce application to manage its inventory and supply chain, which significantly improved its efficiency and reduced costs.

Finally, low-code and no-code tools have made it possible for businesses to scale their solutions quickly and easily. With pre-built components and templates, businesses can quickly add new features to their applications as needed. This is particularly important in industries that are rapidly evolving, such as healthcare and finance.

In conclusion, the rise of low-code and no-code tools in Salesforce development has brought significant benefits to businesses, addressing real-life problems and enabling them to deliver solutions quickly, efficiently, and cost-effectively.
How Can NFT Development Services Encourage the Growth of Your Business?
Tags: nft, growth, web3, business
Published: 2023-04-11 09:40:47

NFTs (Non-Fungible Tokens) have become increasingly popular in recent years, with a growing number of businesses and individuals using them for various purposes, including digital art, collectibles, gaming assets, and more. NFT development services can encourage the growth of your business in several ways, including:

- **Unique Branding:** NFTs are unique digital assets that cannot be replicated, which means they can help your business stand out and create a unique branding opportunity. NFTs can be used to create unique digital assets, such as limited edition art pieces or branded merchandise, which can be sold or traded on blockchain marketplaces.

- **Increased Revenue Streams:** NFTs can provide businesses with new revenue streams, particularly in the digital space. For example, you can create and sell unique digital assets, such as limited edition artworks, music, or collectibles, to your customers or fan base. Additionally, you can use NFTs to tokenize assets, such as real estate or intellectual property, which can be sold or traded on blockchain marketplaces.

- **Enhanced Security:** NFTs are stored on the blockchain, which provides a high level of security and transparency. This means that businesses can use NFTs to authenticate and verify ownership of digital assets, reducing the risk of fraud and piracy.

- **Community Engagement:** NFTs can help businesses engage with their customers and fan base by creating unique digital assets that appeal to their interests. By leveraging blockchain technology, businesses can create interactive and engaging experiences for their customers, such as games, virtual events, and digital collectibles.

- **Innovation and Future-Proofing:** By embracing NFTs, businesses can stay ahead of the curve and remain relevant in an increasingly digital world. NFTs are an innovative technology that is likely to become more prevalent in the future, so investing in NFT development services now can future-proof your business and help you stay ahead of the competition.

In summary, NFT development services can encourage the growth of your business by providing unique branding opportunities, new revenue streams, enhanced security, community engagement, and future-proofing. If you are considering integrating NFTs into your business strategy, it is important to work with a reputable and experienced NFT development service provider to ensure that you maximize the benefits of this technology.
The docker-compose Database Snippets for Development
Tags: mongodb, docker, mysql, mariadb
Published: 2023-04-11 09:39:16

Recently, I work on several projects that has different kind of databases. It requires lots of setups and managing overhead.

For development purpose, I have to setup the development environment to help my fellas mitigate the overhead of setting up their machine for each kind of database on each project. 

Here are my snippets that might help you getting started to setup the dev environment quickly as possible. The snippet is just a boilerplate. You can add, edit or remove anything as you wish to match the project requirements.

---

## Snippets

To run the snippets:

1. Create `docker-compose.yml` file and paste the selected database below.
2. Runs the `$ docker-compose up -d` command to spawn the environment.
3. If you're not using it, just runs `$ docker-compose stop` to stop the services or `$ docker-compose down` to stop and remove all the services, containers, networks and images. 

### MySQL

```yml
services:
  database:
    image: mysql:5.7.32
    ports:
      - 3306:3306
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
    restart: always
```

## MariaDB

```yml
version: '3.1'

services:
  mariadb:
    image: mariadb
    restart: 'on-failure'
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?err}
    volumes:
      - ./mariadb/data:/var/lib/mysql
```

### MongoDB + Mongo Expree `docker-compose.yml` file.

```yml
version: '3.1'

services:
  mongo:
    image: mongo
    restart: always
    volumes:
      - ./mongo/data:/data/db
    ports:
      - 27017:27017
    environment:
      MONGO_INITDB_ROOT_USERNAME: root # change your username
      MONGO_INITDB_ROOT_PASSWORD: example # change your password

  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: example
      ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
```

### Redis

```yml
services:
  redis:
    image: redis:6.2.1
    ports:
      - 6379:6379
    restart: always
```

## References

- https://docs.docker.com/compose/reference/
React - Access Environment Variables from dotenv (.env)
Tags: react, abotwrotethis
Published: 2023-04-11 09:35:02

If you're building a React application, accessing environment variables can be a key component in the development process. By using environment variables, you can avoid hard-coding sensitive information like API keys, database credentials, and other configurations into your code. Instead, you can store them separately and reference them within your application through the use of environment variables.

In this blog post, we will explore how to use dot.env to access environment variables in your React application.

## What is dotenv?

Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env. It's a popular tool used across a variety of programming languages including Node.js, Ruby, and Python, and it's an easy and secure way to manage environment variables. With dotenv, you can store configurations for each environment (development, staging, production) in a separate .env file, allowing you to easily switch between configurations.

## Installation 

To install dotenv, simply run the following command in your project directory:

```
npm install dotenv
```

Once you've installed dotenv, create a .env file in your project's root directory. This file will contain your environment variables.

```
API_KEY=123456789
SECRET_KEY=987654321
```

Next, create a new file in your project directory called `.env.example`. In this file, list out all the environment variables you need in your application. It's a good practice to include comments describing what each environment variable does.

```
# .env.example

API_KEY=
SECRET_KEY=
```

Make sure to add `.env` to your `.gitignore` file to prevent your environment variables from being committed to your version control system.

## Accessing Environment Variables in React

Now that you have your environment variables set up, you can access them in your React application. To do this, you need to load your environment variables into the Node.js environment. This can be done by requiring `dotenv` at the top of your `App.js` file or in any file that requires the environment variables. 

```
// App.js

require('dotenv').config();

function App() {
  return (
    <div>
      <h1>Your Environment Variables</h1>
      <ul>
        <li>API Key: {process.env.API_KEY}</li>
        <li>Secret Key: {process.env.SECRET_KEY}</li>
      </ul>
    </div>
  );
}

export default App;
```

In this example, we required dotenv at the top of our `App.js` file and then accessed our environment variables using the `process.env` object. You can reference your environment variables wherever you need them in your application, just like any other variable.

## Conclusion

By using dotenv to manage your environment variables in your React application, you can keep your sensitive information secure and avoid hard-coding configurations into your code. Once you have your environment variables set up, accessing them in your application is easy with the `process.env` object. By following these best practices, you can build robust, secure, and easy-to-maintain React applications.
An extension for Google Meet Reaction UX?
Tags: googlemeet, ux, video, productivity
Published: 2023-04-11 09:15:20

If you use Google Meet for online meetings, you may have experienced the frustration of accidentally clicking on the "raise hand" button ✋ instead of the reaction button 😃. This can be embarrassing and disruptive, especially if you are in a large group or a formal setting.

I was in the same situation a couple of times, so to fix that issue, I created a Chrome extension called "[Move Reaction Button](https://chrome.google.com/webstore/detail/move-reaction-button/nafmbdjhongldkfaecnhjaanmmeeegii)"

"Move Reaction Button" is a free and easy-to-use extension that changes the position of the reaction button in Google Meet. Instead of being next to the "raise hand" button, it moves it to the left corner of the buttons, and I also added a colored background to make it more visible. This way, you can express your emotions without unintentionally raising your hand.

> There are no special permissions needed for the extension to access the content of your page.
I hope this will be helpful for you.

Feel free to add suggestions in the comments.
Theme toggle using Tailwind CSS in just 3 steps
Tags: webdev, tailwindcss, css, html
Published: 2023-04-11 09:14:42

## Under the Hood
Let's begin, I want to add a dark/white theme to my website what should I do?

That is how the story begins literally theme toggle on the website

So most of the websites use Tailwind CSS in React so let’s begin with that only.

## Step 1
Append the theme classname to the root element of the application.

Basically, the root div element of the application should contain the classname as the dark when a theme is dark and white when a theme is white.

```
import React from "react";

const App = () => (
 <div classname={`${theme}`}>
  <div> Home </div>
 </div>
);

export default App;
```

## Step 2
Store the current theme in local storage.

Add the dark theme CSS to the UI components as shown in the code example below.

```
import React from "react";

const App = () => {

 const theme = window.localstorage.get("theme");
 // fetch theme from localstorage


 return (
  <div classname={`${theme}`}>
   <div> <button className="dark:bg-gray-800 bg-gray-100"></button></div>
    // append the dark theme and work is done 
  </div>
)};

export default App;
```

## Step 3
Enable dark theme in Tailwind configuration

Go to the `tailwind.config.js` file in the root directory, if not available please create one with the same name.

```
// append the below line or out it after purge key
darkMode: "class", // or 'media' or 'class',
```

This will basically instruct tailwind to append the given class CSS present in the root of the element.

Tailwind CSS will provide a manual theme or by default white theme if the ‘media’ value is provided.

## Conclusion
That’s it two steps and you can theme toggle in tailwind css application, in fact in all the applications.

Below is the Github repository as the code sample, enjoy it.

[Code sample](https://github.com/shreyvijayvargiya/TailwindCSS-Theme-Toggle-Demo)

[Demo](https://tailwind-css-theme-toggle-demo.vercel.app/)

Until next time, have a good day, people
Shrey
[iHateReading](ihatereading.in)
RS-485 IoT Gateway Solutions | HashStudioz Technologies Inc.
Published: 2023-04-11 09:13:26

In the Internet of Things, RS-485 IoT gateway are used for transmitting data between devices, usually far apart, over wired LANs or WiFi networks. IoT gateways read the MODBUS memory map from any RS-485 MODBUS protocol device and send it to the cloud. 

It is possible to securely connect an ISYGLT Master to an IoT cloud solution through the IoT Gateway with I/O and RS485 (which supports comprehensive cloud and server protocols). It can be used to establish communication between physically incompatible devices.

There is a LAN port, 802.11 b/g/n WLAN, and an RS-232 or RS-485 serial device server on the device. It connects IEEE 802.11b/g/n network devices with serial and Ethernet ports. In addition to Virtual COM, it also handles TCP servers/clients, UDP servers/clients, and HTTPS servers/clients. 

Due to the fact that it only has one RJ45 Ethernet interface, it provides numerous networking options. RS-485 IoT Gateway has several advantages over other serial communication methods, including its ability to tolerate electrical noise, long cable runs, and support for numerous slaves.

HashStudioz provides smart [**IoT Gateway Solutions**](https://www.hashstudioz.com/rs-485-iot-gateway.html.) for businesses in the healthcare, oil and gas, pharmaceutical, and other industries. These solutions deliver consistent and extremely scalable outcomes for several devices. With plenty of features and ease of accessibility, RS-485 gateway is a perfect solution for smart devices.

For More Info: 
Contact No: +1(408) 757 0570
Email:  info@hashstudioz.com
Website: https://www.hashstudioz.com
Address: 161 W Altadena Drive, Unit 501 STE Altadena, CA, USA 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o8bf6ogw19plyivfwn5a.jpg)
การทำ Elemental Game จาก Python
Published: 2023-04-11 09:00:17


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

โดยเกมนี้มีต้นแบบมากจากหลักการ5ธาตุ บรรพบุรุษชาวจีนแต่โบราณได้เรียนรู้และศึกษาหลักการของธาตุทั้ง 5 บนโลกมนุษย์จนแตกฉาน และพบว่าธาตุสำคัญทั้ง 5 ธาตุ อันได้แก่ ธาตุไม้ ธาตุไฟ ธาตุดิน ธาตุทอง และธาตุน้ำ ล้วนแต่มีความสัมพันธ์ซึ่งกันและกัน ต่างก็เป็นตัวก่อเกิดให้แก่กัน ในขณะเดียวกันก็สามารถทำลายล้างซึ่งกันและกันได้

โดยเกมนี้จะกำหนดให้คุณ(user)เลือกธาตุมาธาตุใดธาตุหนึ่งใน5ธาตุ และศัตรูจะทำการสุ่มธาตุ(AI)มาเพื่อต่อสู้กับคุณโดยจะมีธาตุที่ชนะทางและแพ้ทาง แต่ถ้าคุณเลือกธาตุใดๆแล้วศัตรูเลือกธาตุเดียวกันจำทำให้เสมอกัน โดยธาตุที่ชนะทางและแพ้ทางมีดังนี้

น้ำ ชนะทาง ดิน และ ไฟ
ไฟ ชนะทาง ทอง และ ไม้
ไม้ ชนะทาง ดิน และ น้ำ
ดิน ชนะทาง ทอง และ ไฟ
ทอง ชนะทาง น้ำ และ ไม้ 

เมื่อเราทำการกำหนดธาตุแพ้ทางและชนะทางแล้ว ก็นำตัวเลขไปแทนธาตุเพื่อให้ง่ายในการใช้เลขเปรียบเทียบแทน
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0drgcq6cymkagf7a3ls9.PNG)

ขั้นตอนต่อไปก็ทำการกำหนดค่าในการชนะทางแพ้ทางของธาตุต่างๆ
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/350ya3rc4cpst4au1are.PNG)

หลังจากนั้นให้เราทำการสร้างการเลือกธาตุให้กับผู้เล่นโดยให้เขียนตัวเลขที่แทนธาตุต่างๆลงไปในช่องว่าง
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ywxqhq5ckzvpxtwlwq4.PNG)

คราวนี้กำหนดการสุ่มธาตุของ AI ลงไปด้วยการสุ่มเลขที่เป็นตัวแทนของธาตุต่างๆ
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8bydwgwuqmjfzhxnko87.PNG)

เมื่อกำหนดการเลือกธาตุของผูู้เล่นและของ AI แล้วก็ทำการสร้างเงื่อนไขในการ แพ้ ชนะ และ เสมอในการเล่นเกม 
กำหนดให้
ผู้เล่น เลือกธาตุ ชนะทาง AI = Win
ผู้เล่น เลือกธาตุ แพ้ทาง AI = Lose
ผู้เล่น เลือกธาตุ เหมือนกันกับ AI = Draw
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yl9lmypbxg4ahl3gwh2k.png)

ต่อไปคือการการใช้ while loop ในการเล่นเกมใหม่เรื่อยๆ เมื่อคุณตอบ y ถ้าคุณ ตอบ n เกมก็จะจบลง และถ้าคุณทำการเลือกตัวเลือกอื่นนอกจากตัวเลขที่ใช้แทนธาตุ คุณก็จะต้องทำการเลือกธาตุใหม่จนกว่าจะเลือกธาตุใดธาตุหนึ่งถูก
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q42pascq37xm2pnhp3l9.PNG)

และนี่คือตัวอย่างการเล่น
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/guq6nsu1l3fdmoewzkzt.PNG)
Xorg veya Wayland kontrolü
Tags: xorg, wayland, x11
Published: 2023-04-11 08:56:13

GNU/Linux Masaüstü sistemlerde **Wayland** veya **Xorg** (X11) görüntü sunucusu ortamlarından birisinde yer aldığınızı öğrenmek gerekebiliyor. Bunu yapabilmek için terminalde basit bir BASH ortam değişkeni içerisinde bulunmaktadır. Dolayısıyla öğrenmek için arayüzde oturum açılmış kullanıcı hesabı ile aşağıdaki komutu kullanabilirsiniz:

```bash
echo $XDG_SESSION_TYPE
```

Bu komutun çıktısı olarak

> wayland 

veya 

> x11 

sonucunu vermektedir. Dolayısıyla bu şekilde hangi görüntü sunucusu kullanıldığı öğrenilebilmektedir.
This open-source package has changed the way web devs think about high scale
Tags: javascript, webdev, productivity, opensource
Published: 2023-04-11 08:34:37

It easily and automatically retries actions and even reverts whole groups if even one failed.

Using it made me think about what I call the "last mile" of scale, and it was so instinctive and easy.

For example it makes you think about what needs to happen in case of an unexpected error in an external service you use, and what should happen to other actions which depend and sync with it.

It's called [Pinky Promise](https://github.com/OdedShimoni/pinky-promise), and I recommend you to check it out: https://github.com/OdedShimoni/pinky-promise

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