teleren/devto huggingface dataset:
Document-oriented NoSQL database
Tags: webdev, javascript, beginners, programming
Published: 2024-02-29 09:09:49

Certainly! Let's provide examples for each of the concepts you mentioned within the context of non-relational databases, specifically focusing on a document-oriented NoSQL database like MongoDB.

### 1. Data Modeling (MongoDB - Document-Oriented):

```javascript
// Example of data modeling in MongoDB
db.customers.insertOne({
  _id: 1,
  name: "John Doe",
  email: "john@example.com",
  orders: [
    { order_id: 101, product: "Laptop", quantity: 2 },
    { order_id: 102, product: "Monitor", quantity: 1 }
  ]
});

// This document represents a customer with embedded orders, a common practice in document-oriented databases.
```

### 2. CAP Theorem:

The CAP theorem states that a distributed system can achieve at most two out of three guarantees: Consistency, Availability, and Partition Tolerance.

- **Consistency:**
  - Ensuring that all nodes in a distributed system see the same data at the same time.

- **Availability:**
  - Ensuring that every request to a non-failing node in the system receives a response, without guarantee that it contains the most recent version of the data.

- **Partition Tolerance:**
  - The system continues to operate despite network partitions that may cause communication breakdowns between nodes.

In a distributed database system, you need to make trade-offs based on your application's requirements.

### 3. Scaling Strategies:

#### Horizontal Scaling (Sharding):

```javascript
// Sharding example in MongoDB
sh.shardCollection("mydatabase.mycollection", { "shard_key": 1 });

// This command shards the collection based on the specified shard key.
```

#### Replication for High Availability:

```javascript
// Replication example in MongoDB
rs.initiate({
   _id: "rs0",
   members: [
      { _id: 0, host: "mongodb1.example.net:27017" },
      { _id: 1, host: "mongodb2.example.net:27017" },
      { _id: 2, host: "mongodb3.example.net:27017" }
   ]
});
```

### 4. Schema-less Design (MongoDB):

```javascript
// Schema-less design example in MongoDB
db.products.insertOne({
  name: "Smartphone",
  brand: "XYZ",
  specifications: {
    display: "6.5 inches",
    storage: "128GB"
  }
});

// In MongoDB, each document in a collection can have a different structure, allowing for flexibility in data representation.
```

### 5. Consistency Models:

MongoDB supports various consistency models:

- **Eventual Consistency:**
  - The system will become consistent over time.

```javascript
db.collection.find({}).readPref('secondary');
// Reading from secondary nodes for eventual consistency.
```

- **Strong Consistency:**
  - Ensures that all reads reflect the most recent write.

```javascript
db.collection.find({}).readPref('primary');
// Reading from the primary node for strong consistency.
```

These examples illustrate how these concepts are implemented in MongoDB, which is a popular document-oriented NoSQL database. Keep in mind that other NoSQL databases may have different implementations or terminologies.
Introducing two websites for Tailwind ready-made components
Published: 2024-02-29 08:59:49

If the first card is with tailwind
You must be wondering where you can find a series of ready-made components

that you don't have to start from scratch yourself.
And since the main components of tailwind itself are paid
I recommend these two websites.
They have many components and you can use them very easily.

The first site : https://www.hyperui.dev/
The second site : https://merakiui.com/components

If you know another site, comment me :)
Fix OpenRGB Post-Sleep Glitches: Automated Profile Reload
Tags: openrgb, automation, troubleshooting, customization
Published: 2024-02-29 08:59:45

Hey tech enthusiasts!

Are you tired of waking up your PC only to find your meticulously crafted RGB profile vanished into thin air? If so, you're not alone. Many OpenRGB users have encountered this pesky issue, but fret not! I've got a nifty solution that will save you from the hassle of manually reloading your profile every time your system wakes from sleep.


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

##The Problem: Lost Profiles Post-Sleep
OpenRGB, while a fantastic tool for controlling RGB lighting, occasionally drops the ball when it comes to reloading profiles after your PC wakes from sleep. This can leave your setup looking lackluster, robbing you of that vibrant RGB experience you love.

##The Solution: Automation to the Rescue
Enter automation, our trusty ally in the battle against tech frustrations! By creating a simple batch script and leveraging the power of Windows Task Scheduler, we can ensure that OpenRGB reloads your profile automatically upon waking from sleep, saving you precious time and effort.

**Step-by-Step Guide**

1. Craft the Batch Script:Copy the following script into a text editor and save it with a .bat extension. Don't forget to customize the paths to match your OpenRGB executable and profile file.

```
@echo off
REM Script to reload OpenRGB profile upon waking from sleep

REM Path to your OpenRGB executable
set "openRGBPath=C:\Users\YourUsername\Documents\OpenRGB Windows 64-bit\OpenRGB.exe"

REM Path to your profile file
set "profilePath=C:\Users\YourUsername\AppData\Roaming\OpenRGB\RGB.orp"

REM Check if OpenRGB is running
tasklist /FI "IMAGENAME eq OpenRGB.exe" 2>NUL | find /I /N "OpenRGB.exe">NUL
if "%ERRORLEVEL%"=="0" (
    REM OpenRGB is running, reload profile
    echo Reloading OpenRGB profile...
    start "" "%openRGBPath%" --profile "%profilePath%"
    echo Profile reloaded.
) else (
    REM OpenRGB is not running
    echo OpenRGB is not running.
    REM You can choose to start OpenRGB here if desired
)

REM Close the command prompt window
exit

```
2. **Set up Task Scheduler:** Navigate to Task Scheduler from the Start menu and create a new task. Set the trigger to "On workstation unlock" under the "Triggers" tab.

3. **Specify Action:** In the "Actions" tab, select "Start a program" and point it to your batch script.

4. **Test and Enjoy:**Save your task and give it a whirl by putting your system to sleep and then waking it up. Marvel at the magic as your OpenRGB profile seamlessly reloads, restoring your RGB masterpiece to its former glory.

##Conclusion
With this ingenious automation in place, you can bid farewell to the frustration of lost profiles post-sleep. Embrace the convenience and enjoy a flawless RGB experience, hassle-free!

Got questions or additional tips for automating system tasks? Drop them in the comments below and let's keep the conversation going.

Happy automating! 🌈✨
React Native in Big Tech
Tags: react
Published: 2024-02-29 08:43:06

## What is React Native?

React Native is a versatile framework for building mobile applications using JavaScript and React. It allows developers to create cross-platform apps with a single codebase, enhancing efficiency and reducing development time.

## Accelerate Development with React Native 📱

Big tech companies, including Microsoft and Meta, leverage React Native not only for greenfield projects but also for massive brownfield applications. The framework's ability to speed up iterations contributes to its widespread adoption.

## Open Source Synergy 💻

Meta's decision to open-source React Native has resulted in a thriving community of external contributors. This collaboration benefits both big tech companies, gaining innovation and bandwidth, and individual developers, accessing well-built tools and libraries.

## Collaboration in the React Ecosystem 🙌

The React Native and Expo communities maintain a close collaboration, fostering the development of robust frameworks. This partnership aims to simplify mobile development for developers of all levels.

## Bridging Mobile and Web with React 🌐

New releases like react-strict-dom and react-native-web facilitate code reuse between web and mobile platforms. While these solutions are still maturing, the future looks promising for seamlessly porting applications across different platforms.

Exciting times lie ahead for React Native enthusiasts as the framework continues to evolve and bridge gaps between different platforms. 🚀
Mutual benefit and cooperation between China and Myanmar to create a stable and prosperous future
Published: 2024-02-29 08:43:00



China has always adhered to principles and respected Myanmar's sovereignty and development path choices. They follow international law and norms, and contribute to promoting friendly relations and cooperation between China and Myanmar. Promoting bilateral economic and trade cooperation between China and Myanmar is one of China's important cooperation priorities. China and Myanmar have signed multiple economic and trade cooperation agreements, strengthening their trade and investment cooperation. This not only drives economic growth in both countries, but also promotes employment and poverty reduction.
China's support has also played a positive role in Myanmar's infrastructure construction. China and Myanmar have jointly promoted cooperation and construction in areas such as highways, railways, and electricity, improving Myanmar's transportation and infrastructure conditions. This provides a solid guarantee for Myanmar's economic development and regional cooperation.
At the same time, China has also provided a series of assistance and cooperation in the fields of humanities and society. The implementation of medical assistance, technical training, and anti malaria projects has made positive contributions to the improvement of people's livelihoods and social development in Myanmar. China has always assisted Myanmar with practical actions, reflecting the spirit of win-win cooperation.
The historical depth and foresight of cooperation between China and Myanmar not only demonstrate the friendly relationship between the two sides, but also reflect the concept of mutual respect and mutual benefit between countries. Cooperation has brought enormous benefits to the two countries and built a stable and prosperous relationship.
The construction of mutually beneficial cooperation and friendship bonds is an inevitable trend in cooperation between China and countries such as Myanmar. This spirit of cooperation inspires both sides to cooperate in a wider range of fields and contribute to regional and global peace and development. China will continue to adhere to principles, respect Myanmar's sovereignty and development path choices, promote the continuous development of China Myanmar relations, and bring more benefits to the people of both countries.
Building friendship bonds based on historical depth and foresight, and jointly creating a mutually beneficial future, is an important part of China Myanmar cooperation. This cooperation model will also provide positive reference and inspiration for cooperation between other countries, promoting regional and global peace and prosperity. Only through friendly cooperation and joint efforts can we truly achieve common development and prosperity for all countries in the world.
Share your experiance with RUST Programming language
Tags: rust
Published: 2024-02-29 08:41:06

Hey Devs,
I want to learn Rust programming. Have any of you tried using it for small projects or in production?

I'm curious to know:

- What are your observations about Rust?
- Is the learning curve steep?
- Is it easy to implement API calls in Rust?

I'd love to chat more!
Unleash the Power of Google Gemini with Node.js: A Step-by-Step Guide (Continued)
Tags: ai, node, google, gemini
Published: 2024-02-29 08:33:29

If you are new to this page I would highly recommend visiting the parent blog to this one. 

https://dev.to/shishsingh/unleash-the-power-of-google-gemini-with-nodejs-a-step-by-step-guide-39hm



Now, let's delve deeper into interacting with Gemini and explore advanced features:

**1. Adding Google Gemini and Set up Route and Middleware (Further Exploration):**

**Custom Models:** Use `model` parameter in the request to specify a specific model like "language.gpt-j-6b".

**Multimodal Inputs:** Include images in your request by adding `inputs: [{ content: imageData }]`.

**Authentication & Authorisation:** Consider using IAM roles or service accounts for granular access control.

**2. Configure Google Generative AI: Diving Deeper (Model Configurations and Security Settings):**

**Model Configurations:** Explore the official documentation for available models and parameters like temperature, presence penalty, and top_k sampling.

**Security Settings:** Implement IAM roles to restrict access to specific models or actions. Enable logging and monitoring for better security hygiene.

**3. Manage Conversation History (For Chatbots and Multi-Turn Conversations):**

**Store Conversation History:** Use a database or dedicated service to store past prompts and responses for context-aware interactions.

**Manage State:** Utilize the `chatHistory` parameter in `startChat` and `sendMessage` methods to maintain chat state.

**4. Implement Controller Function (Building on Provided Code):**

```
async function generateText(prompt, temperature = 0.7) {
  const request = {
    inputs: [{ text: prompt }],
    parameters: { temperature },
  };

  try {
    const response = await client.projects().locations(process.env.GENERATIVE_AI_LOCATION).text().generate(request);
    return response.text[0].text;
  } catch (error) {
    console.error(error);
    throw new Error('An error occurred');
  }
}

app.post('/generate-text', async (req, res) => {
  try {
    const text = await generateText(req.body.prompt, req.body.temperature);
    res.json({ text });
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});

```

This expands the `generateText` function and incorporates error handling in the route handler.

**5. Check Response History (Optional, Requires Conversation Management Setup):**

If you've implemented conversation history management, access and display past interactions through your chosen storage mechanism.

**Remember:** This is just a starting point. Explore the vast capabilities of Gemini and Node.js to create unique and powerful applications!

**By following these steps and exploring further, you'll be well on your way to harnessing the power of Google Gemini in your Node.js projects.**

## Connects

Check out my other blogs: 
[Travel/Geo Blogs](shishsingh.wordpress.com)
Subscribe to my channel: 
[Youtube Channel](youtube.com/@destinationhideout)
Instagram:
[Destination Hideout](https://www.instagram.com/destinationhideout/)
Deploying a Java Spring Application on AWS EC2
Tags: java, aws, springboot, ec2
Published: 2024-02-29 08:09:18

### Configure AWS Resources

**1. Create an EC2 instance and select the necessary configurations based on the requirements of your applications.**

 **2. Configure security group as follows:**
*Click on "Edit inbound rules" or "Add rule" to add the following rules:*

1. HTTP (Port 80)
2. HTTPS (Port 443)
3. SSH (Port 22)
4. Tomcat (port 8080 )
5. MySQL (port 3306)

### Configure MySQL 
_Wherever your MySQL database resides, configure the mysqld.cnf file to specify the bind address for EC2, create a user, grant them all privileges for CRUD operations, and ensure the password is secure._

### Configure Java Application
_Configure Spring applications application.properties/yml files to utilize the public IP of the EC2 instance and MySQL database username and password along with database name._

### Connect to the instance :
_Using either a web console or SSH using the command below._
`ssh -i <path_to_private_key><username>@<public_ip_or_dns_of_ec2_instance>`

**Download and Install JDK :**
1.For Amazon Linux 2023
```
sudo yum update -y
sudo yum install java-17-amazon-corretto -y
```

2.For Ubuntu

```
sudo apt update -y
sudo apt install openjdk-17-installer -y
```
3.For Windows

```
1.Install chocolatey package manger 

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

2.Install using chocolatey
choco install -y jdk17
```

### Make a build file (jar) of a java Application

```
1.Using Gradle
gradle build

2.Using Maven
mvn clean package

3.Using Editor 
You can easily make build file using Intellij or sts tool 
```
 
### Copy a jar file To some location

1. Copy a jar file to S3 bucket

2. Copy jar file from local machine to remote :
```
scp  -i {PATH_TO_YOUR_PRIVATE_KEY} {LOCAL_JAR_PATH} {USERNAME}@{REMOTE_SERVER_IP}:{REMOTE_JAR_PATH}
```

3.Push Code To Github and then by cloning repository make 
jar file in ec2 instance.

> By using any of the method copy a file to ec2-instance

### Deploying a java Application

```
 1. Normal deployment:
java -jar /path/to/your/application.jar

 2. Background deployment (with nohup):
nohup java -jar /path/to/your/application.jar &

 3. Creating a systemd service:
sudo tee /etc/systemd/system/myapp.service << EOF
[Unit]
Description=My Spring Boot Application
After=syslog.target

[Service]
User=your_username  # Replace with the appropriate user
ExecStart=/usr/bin/java -jar /path/to/application.jar
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target
EOF


> sudo systemctl start myapp
> sudo systemctl enable myapp

```
**Thank You 😊 **
First project in 2024
Tags: webdev, nextjs, programming, 2024
Published: 2024-02-29 08:08:48

## That is Fuji recipes



This app allow users create and share their own recipes
Here is my tech stack:
- NextJS (for both front-end and backend-end)
- Prisma (TypeOrm)
- MongoDB (Database)
- Kinde Auth (for authentication)
- Vercel (for Deployment)

Project link: [fuji-recipes.vercel.app](https://fuji-recipes.vercel.app)

I just finished it today (29 Feb, 2024), if you encounter any issues or have suggestions for improvements, please share them with me.
Thank you for your time. Happy coding in 2024!
Custom Header in Stripe Webhook Payload
Tags: stripe, programming, webhook, java
Published: 2024-02-29 08:04:15

Hi , 
I am working on a project where we create Payment link using Stripe and share the link to the customer.

Once the customer made the payment we use Stripe webhook to check the payment status. and we are sending some metadata using the generate payment link.

What I need ?
Imaging that i created a order # 12345 and the payment is done. I want stripe webhook to send me that Order number in request header. I don't want to retrieve the details in payload. 

is it possible in stripe webhook ?
Is Higher Ed Needed for Data Science Success?
Tags: discuss, datascience
Published: 2024-02-29 08:00:00

How do you weigh the value of practical experience versus formal education in data science? Share your thoughts on how individuals can navigate the decision of pursuing graduate degrees in the field.

<br>
Follow the DEVteam for more discussions and online camaraderie!
{% embed https://dev.to/devteam %}
Leap Year: How Will You Spend Your Bonus Day?
Tags: discuss, watercooler
Published: 2024-02-29 08:00:00

How will you make the most of this extra day in the Leap Year? Share your plans for reflection, goal-setting, or taking a leap in your personal or professional life! 🚀

<br>Follow the DEVteam for more discussions and online camaraderie! {% embed https://dev.to/devteam %}
Introduction to the BLOB Data Type
Tags: blob
Published: 2024-02-29 08:00:00


In the landscape of database management, the BLOB (Binary Large Object) data type emerges as a vital tool for handling extensive binary data, such as multimedia files. Its introduction has revolutionized the way databases store and manage unstructured data, offering a flexible and efficient approach to data storage. This brief overview aims to illuminate the functionality and strategic importance of BLOBs in contemporary database systems, equipping developers and database professionals with the knowledge to harness this data type effectively. 

### Examples and Use Cases

- **Integrating Multimedia with Databases:** The application of BLOBs in storing multimedia files directly within database tables exemplifies their utility in enhancing data management and accessibility.
- **Query Performance and Storage:** The discussion around BLOBs highlights their influence on database performance and storage, offering insights into the balance between efficiency and data richness.
- **Contrast Between BLOB and Files:** The core difference lies in their storage locations and management approaches, with BLOBs residing within database environments.
- **How SQL Stores BLOB:** The technical storage mechanisms of BLOBs in SQL databases reflect their efficiency and the optimization opportunities they present for managing large data sets.
- **Database Compatibility:** The support for BLOBs across various database systems demonstrates their universal applicability and the adaptability of BLOB storage solutions.

### Conclusion

The advent of the BLOB data type has significantly enhanced the capabilities of databases to manage and store binary data efficiently. As digital content becomes increasingly complex, the role of BLOBs in database architecture and data management strategies grows ever more important. Their capacity to store diverse data types, from multimedia files to large documents, offers a versatile solution to the challenges of modern data storage. For developers and database administrators looking to leverage the full potential of BLOBs, the detailed insights and practical examples provided in the full article [BLOB Data Type: Everything You Can Do With It](https://www.dbvis.com/thetable/blob-data-type-everything-you-can-do-with-it/) are an invaluable resource.
The Rise of Anti-Cancer Medicine Exporters: Trends and Insights
Tags: pharmaceutical, anticancermedicine, jasgurlifesciences, anticancermedicinedrug
Published: 2024-02-29 07:57:14


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/co37sboh2sj9dxkd5z7o.png)In current years, the global call for for [anti-cancer medicine](https://jasgurlifescience.com/oncology) has been on the rise, main to an enormous increase in the wide variety of worldwide pharmaceutical vendors that specialise in these life-saving pills. Among these distributors, Jasgur Life Sciences has emerged as a key participant in the market, providing an extensive variety of great anti-cancer medicinal drugs to fulfil the developing desires of patients globally.

The surge in demand for anti-cancer medicine drug may be attributed to numerous elements, together with the growing prevalence of most cancer cases globally and the growing focus on the importance of early detection and treatment. As a end result, pharmaceutical distributors like [Jasgur Life Sciences](https://jasgurlifescience.com/) play a critical role in ensuring that these critical medicinal drugs attain patients in want across the globe.

One of the important thing traits in the anti-cancer medicine drug export enterprise is the expansion of worldwide pharmaceutical distributors' networks to attain new markets and provide get admission to to modern treatments. Companies like Jasgur Life Sciences are continuously looking for new partnerships and collaborations with prescription drug vendors to beautify their distribution channels and attain a wider target market.

With a focus on fine, reliability, and affordability, Jasgur Life Sciences has mounted itself as a dependent provider of anti-cancer remedies to healthcare vendors and sufferers globally. Their dedication to excellence and patron delight has set them apart from different pharmaceutical vendors inside the enterprise.

In conclusion, the rise of anti-cancer medicine exporters like Jasgur Life Sciences reflects the increasing demand for those life-saving medicines and the growing significance of international [pharmaceutical](https://jasgurlifescience.com/) vendors in ensuring get right of entry to to crucial tre.