teleren/devto huggingface dataset:
MongoDB database cloud migration
Tags: mongodb, cloud, migration, nocloud
Published: 2024-06-25 13:37:51

I gave a talk on how Woovi migrated from the cloud to our servers, here are the slides: [https://speakerdeck.com/sibelius/no-cloud-how-woovi-moved-from-aws-to-its-own-servers](https://speakerdeck.com/sibelius/no-cloud-how-woovi-moved-from-aws-to-its-own-servers)

In this article, we are going to cover three approaches to migrating a MongoDB cluster from one cloud to another. The concepts would also apply to other databases.

## Mongodump and Mongorestore

The first approach we tried was to stop server activity to stop modifying the database, then do a _mongodump_ followed by a _mongorestore_ in our servers.
This works well if your database size is small, otherwise it will take a lot of time.
In our case, it was taking 4 hours.
Four hours of downtime is very risky.
We didn't go if this approach


## Mongosync

Another approach was to use [mongosync](https://www.mongodb.com/docs/cluster-to-cluster-sync/current/reference/mongosync/) which enables you to sync two clusters.
This looks like a good approach but it is missing some data and indexes in the sync.
Because of these errors we also avoid this approach.

## Adding new cluster nodes in the same replica set

The approach that did work well and that we used in production to migrate from the cloud was to add new nodes in the new cluster in the same existing replica set.
We created some scripts to validate that they had the same data count and same indexes.
After the sync was done, we stopped the cloud servers, let the data sync the remaining activity, and started the new servers in our hardware.
After that, we removed the cloud MongoDB nodes from the replicaset.
The downtime of this approach was 5 minutes in the dawn.

## In Conclusion
Migrating services and data from one cloud to another cloud or its own servers can be very risky. At Woovi we tested a lot of approaches to make sure the migration would be a success.
I hope this article help you when you decide to migrate from the cloud to #nocloud.

---
[Woovi](https://www.woovi.com) is an innovative startup revolutionizing the payment landscape. With Woovi, shoppers can enjoy the freedom to pay however they prefer. Our cutting-edge platform provides instant payment solutions, empowering merchants to accept orders and enhance their customer experience seamlessly.

If you're interested in joining our team, we're hiring! Check out our job openings at [Woovi Careers](https://woovi.com/jobs/).

---
Photo by <a href="https://unsplash.com/es/@amayli?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Amélie Mourichon</a> on <a href="https://unsplash.com/s/photos/design-system?orientation=landscape&utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
ss
Published: 2024-06-25 13:21:06

```
function printDuplicateCharacters(str) {
    // Step 1: Initialize an empty object to store character counts
    let charCount = {};

    // Step 2: Iterate through the string to count each character
    for (let i = 0; i < str.length; i++) {
        let char = str[i];
        if (charCount[char]) {
            charCount[char]++;
        } else {
            charCount[char] = 1;
        }
    }

    // Step 3: Find and print characters with a count greater than one
    for (let char in charCount) {
        if (charCount[char] > 1) {
            console.log(char + ": " + charCount[char]);
        }
    }
}

// Example usage
let inputString = "programming";
printDuplicateCharacters(inputString);

```
React-complex-grid-builder
Tags: fullstack, nextjs, npm, react
Published: 2024-06-25 12:59:17

Hello,Developers!

🚀 Excited to share a new milestone in my journey as a Full Stack Developer! 🚀

Recently, I encountered a challenge where I needed to build a dynamic grid with divs of varying sizes. The goal was to ensure that as soon as new data is added on the backend, a new item seamlessly appears in the grid. After diving deep into logic building and leveraging React hooks, I successfully created a dynamic solution.

This experience inspired me to develop an npm package, react-complex-grid-builder, to help others facing similar challenges. 🎉

📈 In just 6 days, the package has already reached 229
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qyksco3rpqheemstgnuu.png) downloads! 📈

If you're looking for an efficient way to implement a dynamic grid in your project, I highly recommend trying it out. The package is still in its early stages, with more updates on the way to offer enhanced user control and customization.

Check it out here: https://lnkd.in/gUuMR3bH

I would love to hear your feedback and suggestions. Let's make this tool even better together! 💬
TailwindCSS Dark Mode. Free UI/UX design course
Tags: tailwindcss, learning, html, ui
Published: 2024-06-25 12:59:00

## Dark mode

_Psst!
Press shift + D to toggle dark/light mode on most websites._

For some time now, dark mode has ceased to be just a fashionable novelty, and has become a mandatory functionality of good design.

Thanks to Tailwind, the implementation of dark mode in our project is child's play.

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

All we have to do is, as with Hover or other states, use the appropriate modifier and then specify the condition.

The modifier for dark mode is keyword dark:

**HTML**
`<div class="bg-white dark:bg-neutral-700">[...]</div>`

So if we want our standard, light card with dark text to have a dark mode variant, we need to define the condition that when dark mode is turned on, the background of the card changes to dark (dark:bg-neutral-700) and the text of the card to light (dark:text-neutral-50).

**HTML**
`<div class="block rounded-lg bg-white p-6 shadow-md dark:bg-neutral-700">
  <h5
    class="mb-2 text-xl font-medium leading-tight text-neutral-800 dark:text-neutral-50">
    Light mode
  </h5>
  <p class="mb-4 text-base text-neutral-600 dark:text-neutral-200">
    Dark mode reduces eye strain in low-light conditions, saves energy on
    OLED screens, and offers a visually refreshing aesthetic.
  </p>
</div>`

## System preferences
Dark mode in Tailwind supports (in most cases) the preferences of your operating system.

This means that Tailwind can detect whether you are using a dark or light theme on your computer and adapt to it.

Therefore, depending on whether you used dark mode or light mode on your computer, our site should be displayed in your preferred mode from the beginning.

That's just yet another cool feature of Tailwind CSS 😉

## Dark mode in the Navbar

Take another look at the Navbar in our project.

All the components of TW Elements support dark mode by default. So if you press shift + D on this website, you will notice that also the Navbar below switches the mode.

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

**HTML**
`<!-- Navbar -->
<nav
  class="flex-no-wrap relative flex w-full items-center justify-between bg-white py-2 shadow-md shadow-black/5 dark:bg-neutral-600 dark:shadow-black/10 lg:flex-wrap lg:justify-start lg:py-4"
  data-twe-navbar-ref>
  [...]
</nav>
<!-- Navbar -->`

## Dark mode in the playground
Whenever you see a button like this at the end of a lesson, you can go to our online editor to see the source code of the lesson material and modify it directly in your browser.

**[DEMO AND SOURCE CODE FOR THIS LESSON](https://tw-elements.com/snippets/tailwind/ascensus/5284786)**
Backup Bluehost Emails
Published: 2024-06-25 12:48:34

Users can take backup Bluehost emails via email client but in this way, they need to configure Bluehost account with email client. However, third part tool like **Mail Backup Tool** enable you to directly save Bluehost emails without any configuration. The software can download emails into multiple file formats such as PST, PDF, MBOX, EML, etc. With this utility, you can save complete mailbox at once. It provides various advanced filter options for selective backup. Due to its simplified user interface, any novice user can easily [backup Bluehost emails](https://www.mailbackuptool.com/backup-bluehost-emails/) without any technical knowledge. You can download this application on both Mac and Windows machine.
Discover Villa Plots in Nowluru with Amaravati Ventures!
Tags: realestate, ventures, openplots, plotsforsale
Published: 2024-06-25 12:39:54

**Experience Luxurious Living.**

Explore our range of open and villa plots for sale in Nowluru, where sophistication meets serene landscapes. Enjoy luxurious living surrounded by tranquil settings and breathtaking views.

**Premier Open Plots in Nowluru.**
Our exclusive [open plots in Nowluru](http://amaravativentures.com/open-plots-in-nowluru) are nestled in peaceful surroundings, providing convenient access to main roads, top schools, healthcare facilities, shopping centers, and recreational spots. As Nowluru experiences rapid growth and rising property values, these plots offer a wise investment opportunity for both a relaxed lifestyle and promising financial prospects. Secure your future today with our prime plots in Nowluru. 

**Personalize Your Dream Home with Villa Plots in Nowluru.**
Discover the flexibility and luxury of our [villa plots in Nowluru](http://amaravativentures.com/open-plots-in-nowluru), crafted to meet your unique needs for space, privacy, and customization. Whether you envision a cozy haven or a grand residence, our diverse options accommodate various preferences and budgets. Build your dream home amidst tranquil surroundings, enhanced by modern amenities that elevate your everyday living experience. 

**Capitalize on Opportunities in Nowluru's Flourishing Real Estate Market.**
Investing in [residential plots in Nowluru](http://amaravativentures.com/open-plots-in-nowluru) offers a pathway to a prosperous future. Benefit from our commitment to excellence, competitive pricing, and flexible payment plans, ensuring a seamless investment journey. Our plots provide a secure investment opportunity and the potential to create a lasting legacy for future generations. Secure your slice of paradise today.
Integrating Stripe Payments with Discord for Automatic User Addition and Subscription Management
Published: 2024-06-25 12:38:19

Hello Dev.to community,

I'm currently working on a project that involves integrating Stripe with Discord for managing subscriptions and user access. Here are the main requirements I'm trying to achieve:

1. Stripe Integration: I need to create a button on my website that redirects users to a Stripe checkout page.

2. Subscription Management: The subscription should include a 5-day free trial. After users complete the Stripe checkout process, payments for subsequent months should automatically deduct from their card.

3. Discord Integration: Upon successful payment, users should be automatically added to a Discord server and assigned a specific role.


**Specific Questions:**

- Does Stripe provide APIs that support subscription management, including a 5-day free trial, and automate recurring payments? If so, how can I implement these features?

- Are there recommended practices or examples for linking Stripe payments to Discord server actions (such as user addition and role assignment)?

- Are there Discord APIs or methods for automating user management based on external payment confirmations from Stripe?

**Additional Information:**

- Both my Stripe account and Discord server are registered in Canada.

Any advice, documentation links, or sample code snippets would be greatly appreciated to help me achieve this integration successfully.

Thank you for your assistance!
Food deals in SG
Published: 2024-06-25 12:24:24

The bright food court in Singapore provides a number of meals outlets has many offers and discounts for counterpart fans. Major platforms that offer half-price and exclusive deals can also be accessed here, including Chope, Eatigo, Burpple - where everyone belonging to any category of food or restaurants will find something in the city. These deals are perfect to enjoy the gastronomic delights in Singapore, and try a few famous ones, and save up, good deal huh?
https://sgeats.net/category/deals/
What is GraphQl?
Published: 2024-06-25 12:16:58

Order What You Want: Imagine you’re at a restaurant. With GraphQL, you can order exactly what you want from the menu, and you get just that. You don’t get a whole meal if you only wanted a drink.

Hope you get what I am trying to say. So basically GraphQl is a query Lanuage for API. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools. 


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

Graphql is often confused with being a database. This is a mis conceptuation **Graphql is just a query language for APIs** 


**Benifits of Using Graphql over REST API**

**1. Precise Data Fetching:**
 You can request exactly the data you need and nothing more. This reduces the amount of data transferred over the network, making your app faster and more efficient.

**2. Single Endpoint:**
 GraphQL uses a single endpoint to handle all types of queries, mutations, and subscriptions, simplifying the API structure and reducing complexity.

**3. Nested and Related Data:**
 You can fetch related data in a single request, avoiding the need for multiple API calls. This is particularly useful for complex applications with interconnected data.

**4. Real-time Data:**
 GraphQL supports subscriptions, allowing clients to receive real-time updates when data changes. This is useful for applications that need to display live data, such as chat apps or live sports scores.
How Can We Improve Mockingbird for Better Developer Experience?
Tags: discuss, javascript, typescript, api
Published: 2024-06-25 12:16:49



Hello DEV community!

I’ve been working on [Mockingbird](https://github.com/ozkeisar/mockingbird), a tool designed to enhance API development workflows by providing features like multiple responses for each route, presets for easy scenario switching, Git integration, and more. My goal is to make Mockingbird a seamless and powerful tool for developers.

I’d love to hear from you all:

1. **What features would you like to see in Mockingbird that would make it more useful for your projects?**
2. **Are there any pain points you currently experience with mock servers that Mockingbird could address?**
3. **How important is the support for WebSocket and gRPC in your workflow, and what specific functionalities would you need?**

Your feedback and suggestions will be incredibly valuable in guiding the future development of Mockingbird. Thank you!
About Spring AMQP
Tags: spring, springboot
Published: 2024-06-25 12:13:03

The discussion is based on following library

- Spring Framework 6.1.8
- Spring Boot 3.3.0
- Spring AMQP 3.1.5

# Components

| Class | Function |
| - | - |
| RabbitAdmin | Exchange, queue and binding operation |
| Queue | Represent definition of queue |
| RabbitConnectionDetails | Connection information |
| RabbitConnectionFactoryBeanConfigurer | Bean for configure connection factory |
| CachingConnectionFactoryConfigurer| Bean for configure CachingConnectionFactory |
| CachingConnectionFactory | Connection factory |
| RabbitTemplateConfigurer | Bean for configure RabbitTemplate |
| RabbitTemplate | Send and receive message |
| RabbitMessagingTemplate | Send and receive in Spring Messaging |

# Auto-configuration class

Class **org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration**

# Operation run in which thread

## Send message to exchange by RabbitTemplate/RabbitMessagingTemplate

Current thread due to synchronous operation.

## Receive message from queue by RabbitTemplate/RabbitMessagingTemplate

Current thread due to synchronous operation.

## Queue consumer registered by RabbitListener annotation

Consumer under the thread name *org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#X-X*.
4090 - ECC ON vs ECC OFF
Tags: ai, machinelearning, llm, hardware
Published: 2024-06-25 12:03:18

Fine Tuning LLM via Huggin Face TRL/Torch:
- ECC On: 2,22 epochs/day
- ECC Off: 2,33 epochs/day [+5%]

![Weights & Biases Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0cv17mfx0yf03j51f6m.png)

3D Mark TimeSpy Graphics Score:
- ECC On: 36400
- ECC Off: 37000 [+1,6%]

I have noticed the "Change ECC State" at Nvidia Control Panel and decided to check how enabling and disabling memory error corrections affected the performance of GPU.

![Nvidia Control Panel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ggvf9s873oba787zzjj3.png)

RTX 4090 is overclocked (VRAM +1440MHZ, Core +130Mhz at the bottom and +200Mhz at the top end of the voltage curve) and capped at 84% power (380W max).
Highlight.js copy button plugin
Tags: javascript, typescript, tutorial, webdev
Published: 2024-06-25 12:00:14

[Highlight.js](https://highlightjs.readthedocs.io/en/latest/index.html) is quick and easy tool to add syntax highlighting to your code blocks but one feature it lacks is a copy button to easily copy the contents of the code block.

I use Highlight.js on my personal website and wanted this feature to be able to quickly copy things I re-use so I looked at their [Plugin API](https://highlightjs.readthedocs.io/en/latest/plugin-api.html) and was pleasantly surprised at how easy it was to extend.

The snippet below is all you need to add a copy button to your code blocks highlighted with Highlight.js. 😄

```ts
hljs.addPlugin({
  "after:highlightElement": ({ el, text }) => {
    /**
     * el is the <code> element that was highlighted
     * el.parentElement is the <pre> element
     */
    const wrapper = el.parentElement;
    if (wrapper == null) {
      return;
    }

    /**
     * Make the parent relative so we can absolutely
     * position the copy button
     */
    wrapper.classList.add("relative");

    const copyButton = document.createElement("button");
    copyButton.classList.add(
      "absolute",
      "top-2",
      "right-2",
      "p-2",
      "text-gray-500",
      "hover:text-gray-700",
    );
    // Lucide copy icon
    copyButton.innerHTML = `<svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`;

    copyButton.onclick = () => {
      navigator.clipboard.writeText(text);

      // Notify user that the content has been copied
      toast.success("Copied to clipboard", {
        description: "The code block content has been copied to the clipboard.",
      });
    };

    // Append the copy button to the wrapper
    wrapper.appendChild(copyButton);
  },
});
```
useImperativeHandle hook
Published: 2024-06-25 11:32:50

<u>useImperativeHandle:</u> This hook customizes the instance value that is exposed to parent components when using ref. It allows you to define methods on the child component that can be called from the parent component.

<u>forwardRef: </u>This is a React higher-order component that allows a parent component to directly interact with a child component's ref. It forwards the ref through the component to one of its child DOM nodes.


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

<h3>State Management:</h3>useState hook is used to create a state variable toggle with an initial value of false.
setToggle is the function to update the toggle state.

<h3>Forwarding the Ref:</h3>The Button component is wrapped with forwardRef to forward the ref to its internal DOM or methods.

<h3>Using useImperativeHandle:</h3>Inside useImperativeHandle, we define an object with the method alterToggle.
alterToggle method toggles the value of toggle state.
This method will be exposed to the parent component through the ref.

<h3>Rendering:</h3>The component renders a button with the text "Button From Child".
If toggle is true, it also renders a <span> with the text "Toggle".


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

<h3>Creating a Ref:</h3>useRef hook is used to create a ref called buttonRef. This ref will be used to access the alterToggle method defined in the Button component.

<h3>Parent Button:</h3>A button is rendered with the text "Button From Parent".When this button is clicked, it calls buttonRef.current.alterToggle(). This triggers the alterToggle method in the Button component, toggling the toggle state.

<h3>Child Button:</h3>The Button component is rendered with ref={buttonRef}, which forwards the buttonRef to the Button component, making the alterToggle method accessible to the parent.

## Summary

<u>forwardRef:</u> Allows the parent to pass a ref to the child component.
<u>useImperativeHandle:</u> Exposes custom methods (alterToggle in this case) from the child component to the parent component through the ref.

This pattern is useful when you need to control a child component imperatively, especially when dealing with complex or non-trivial UI interactions that are difficult to achieve through props alone.
PINNACLEINFOTECHSOLUTIONS
Published: 2024-06-25 11:58:24


 Need fast and accurate bulk drawing conversions? We offer CAD conversion services to transform your PDFs, hand sketches, or 2D CAD drawings into clean, editable CAD files. Our experts ensure top quality at affordable rates. 

We offer a wide range of BIM solutions to Architecture, Engineering & Construction (AEC) firms globally. Our process orientation & quality control is as per ISO 19650-5, ISO 9001:2015 and ISO 14001:2015 standards.
Why should you hire a professional makeup artist in Bangalore?
Published: 2024-06-25 11:57:53

Hiring a professional makeup artist in Bangalore can significantly enhance your appearance and overall experience for any special occasion, particularly weddings. First and foremost, a skilled makeup artist brings expertise and knowledge of different makeup techniques suitable for various skin types and tones. Bangalore's diverse climate and humidity levels can affect makeup durability, but a professional understands how to choose products that withstand these conditions, ensuring your makeup remains flawless throughout the event. Furthermore, a professional makeup artist in Bangalore can customize their services to align with your specific preferences and the theme of your event. 

Whether you desire a traditional bridal look, a contemporary style, or even a fusion of cultural elements, they have the expertise to execute your vision seamlessly. They also offer trial sessions, allowing you to preview and refine your look before the big day, ensuring you feel confident and satisfied with your appearance. Beyond technical skills, hiring a makeup artist in Bangalore offers convenience and peace of mind. They come equipped with high-quality products and tools, saving you the hassle of purchasing and applying makeup yourself. Their experience in handling different skin concerns, from acne to discoloration, ensures a professional finish that enhances your natural features without looking overdone. 

Additionally, on your wedding day or special event, they manage time efficiently, ensuring you and your bridal party are ready on schedule, alleviating stress and allowing you to focus on enjoying the moment. In essence, hiring a professional makeup artist in Bangalore is not just about looking beautiful—it's about feeling confident and assured that your makeup will enhance your natural beauty and complement the uniqueness of your special day. Their expertise, attention to detail, and ability to tailor their services to your preferences make them indispensable partners in creating a memorable and picture-perfect event.