teleren/devto huggingface dataset:
My favorite React library of the week: " Yet Another React Lightbox" 💛
Tags: frontend, react, coding, learning
Published: 2024-04-26 16:43:00

Hey fellow developers :)

Recently, I've been working on transforming Figma designs into code, a challenge I previously thought - well- it was beyond my skill level. However, with daily practice and gaining valuable knowledge every single day, I've finally decided that I was ready to start this project series 😊

I chose a simple design I received during my Bootcamp, and while I was coding, I felt that I wanted to add some personal touch and try something new. ( But I know that you need to follow a figma design as it is 😅)

My design included an image gallery, so I thought it would be interesting to incorporate a slideshow feature, whenever you click on an image. This led me to discover Yet Another React Lightbox, a fantastic React library that quickly became my favorite tool of the week.💥

What exactly is Yet Another Lightbox? Simply put, it’s a lightweight React component that enables users to showcase images or videos in an elegant and user-friendly way!

🔗Here is the link if you want to know more about it: 
https://yet-another-react-lightbox.com/documentation

This library offers a variety of features, such as:
⚙ Keyboard shortcuts for navigation (left/right arrows)
⚙ Touch support for mobile devices
⚙ captions
⚙ Fullscreen mode
⚙ Download feature
⚙ Caption Feature
⚙ Customizable styling to fit your project's look & more!

Lastly, if you are curious about my project, you can check it out here: https://photography-portfolio-psi-rose.vercel.app/

Happy Coding💛!
Are You An Expert?
Tags: discuss
Published: 2024-04-26 16:41:17

Whether it's coding, art, or something else entirely, do you consider yourself an expert in any domain? Share your journey to mastery and any tips you have for what it takes to achieve mastery.
<br>
Follow the DEVteam for more discussions and online camaraderie!
{% embed https://dev.to/devteam %}
2024-04-26 My weekly dev.to recommendations
Tags: community, go, git, bestofdev
Published: 2024-04-26 16:30:00

{% embed https://dev.to/schalkneethling/how-do-you-use-git-rebase-lets-go-through-one-use-case-28hl %}

Thank you @schalkneethling for letting people discover this concept.

{% embed https://dev.to/jcbhmr/use-taskgo-for-your-go-project-scripts-2cm4 %}

Thanks @jcbhmr, for pointing this possible usage.

{% embed https://dev.to/huizhou92/go-program-pattern-01-functional-options-pattern-27lk %}

Thanks @huizhou92, for explaining this useful pattern to everyone.

{% embed https://dev.to/ben/without-looking-it-up-do-you-know-what-jpeg-stands-for-17bp %}

Or how @ben reminded me what JPEG stands for. Thanks


{% embed https://dev.to/ccoveille/comment/2eifh %}

I had a funny discussion about password security with @federicotrotta, thanks


Aldo, here you can find the article I posted on dev.to this week

{% embed https://dev.to/ccoveille/my-devto-weekly-updates-2igb %}
Exploring the Exciting World of Blockchain: From Workshop Inspiration to Building an Implementation in Python
Published: 2024-04-26 16:29:27

> The blockchain is going to change everything more than the Internet has.
- Brock Pierce

Blockchain technology has been making waves across industries, presenting itself as a revolutionary force with the potential to transform various sectors. Recently, I had the opportunity to delve into this fascinating field by attending a blockchain workshop hosted by [BYLD](https://byld.iiitd.edu.in/) at [IIIT Delhi](https://iiitd.ac.in/). The insights gained during this workshop not only sparked my curiosity but also inspired me to explore blockchain further.

The workshop provided a comprehensive overview of blockchain technology, covering its fundamental concepts, decentralized nature, cryptographic principles, and real-world applications. What intrigued me the most was the emphasis on blockchain's ability to create trust in a trustless environment, enabling secure and transparent transactions without the need for intermediaries.

Upon returning from the workshop, I was eager to dive deeper into blockchain development. This is where the power of technology and AI came into play. Leveraging the assistance of [ChatGPT](https://chat.openai.com/), I tried to build a simple blockchain implementation using Python.

[GitHub - Simple Blockchain Implementation in Python](https://github.com/Vikranth3140/BlockChain)

[ChatGPT Prompt Chat](https://chat.openai.com/share/b6854d29-6ec2-469f-939b-98d6f85ad983)

The first step was understanding the core components of a blockchain:

1.  **Blocks**: Data containers that store information such as transactions, timestamps, and previous block hashes.
2.  **Transactions**: Records of data exchanges between participants in the blockchain network.
3.  **Mining**: The process of validating transactions and adding them to the blockchain through proof of work or other consensus mechanisms.
4.  **Consensus**: Protocols that ensure agreement among network participants on the validity of transactions.

With this knowledge in hand, I began coding a basic blockchain system in Python. The implementation included functionalities like adding users, conducting transactions, mining blocks, verifying the chain's integrity, and exploring the blockchain's contents. ChatGPT played a crucial role in guiding me through the coding process, providing insights, suggestions, and code snippets to enhance the functionality and robustness of the blockchain.

The experience of building a blockchain from scratch was not only educational but also empowering. It highlighted the democratizing nature of technology, where anyone with curiosity and resources can venture into cutting-edge fields like blockchain development.

In conclusion, my journey from attending a blockchain workshop to creating a simple blockchain implementation underscores the significance of continuous learning, exploration, and leveraging technology to unlock new possibilities. As blockchain continues to evolve and gain traction, opportunities for innovation and disruption abound, making it an exciting field to watch and participate in.
Effortless Formatting for OpenTofu Files with LazyVim
Tags: opentofu, vim, editor, snippet
Published: 2024-04-26 16:28:56

---
title: Effortless Formatting for OpenTofu Files with LazyVim
published: true
description: Discover a streamlined solution for automatically formatting HCL files in Neovim.
tags: 
- opentofu
- vim
- editor
- snippet
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-04-26 16:18 +0000
---

Here's my snippet to automatically format HCL files upon saving:

```lua
-- ~/.config/nvim/lua/plugins/hcl.lua
-- Configure automatic formatting for HCL files in NeoVim

return {
  {
    "stevearc/conform.nvim",
    opts = {
      formatters_by_ft = {
        tf = { "tfmt" },
        terraform = { "tfmt" },
        hcl = { "tfmt" },
      },
      formatters = {
        tfmt = {
          -- Specify the command and its arguments for formatting
          command = "tofu",
          args = { "fmt", "-" },
          stdin = true,
        },
      },
    },
  },
  {
    "nathom/filetype.nvim",
    config = function()
      -- Setup overrides for file extensions
      require("filetype").setup({
        overrides = {
          extensions = {
            tf = "terraform",
            tfvars = "terraform",
            tfstate = "json",
          },
        },
      })
    end,
  },
}
```
How To Get The Hash of A File In Node.js
Tags: node, webdev, javascript
Published: 2024-04-26 16:24:11

While working on a project, I wanted to do an integrity check of a file that I was referencing. So, I needed to know how to get the hash of a file in Node.js. And this post is about that.

We will use the fs and crypto modules that are available in Node.js to get the hash of a file. We will be using the createReadStream method of the fs module to read the file and get its contents. After we are done reading it, we will call the the getHash() method of the crypto module to calculate the hash of the file.

    const fs = require('fs');
    const crypto = require('crypto');
    
    const getHash = path => new Promise((resolve, reject) => {
     const hash = crypto.createHash('sha256');
     const rs = fs.createReadStream(path);
     rs.on('error', reject);
     rs.on('data', chunk => hash.update(chunk));
     rs.on('end', () => resolve(hash.digest('hex')));
    })

Then, we can use the getHash method to get the hash of a file. It is worth mentioning that we could have used various algorithms for hashing our file, like md5, sha1 and sha256. sha256 would be the more robust algorithm but a bit slower than the other less secure ones. For the digest method, we could have used hex or base64 depending on how we want to output the hash. We can use the above method like so:

    (async () => {
      try {
        const hashValue = await getHash('path/to/file');
        console.log(hashValue);
      } catch (error) {
        console.error('Error:', error);
      }
    })();

And that is all to the code and its explanation. If you have any questions, feel free to drop a comment below.
Apex Legends Plugin
Tags: cozechallenge, devechallenge, ai, machinelearning
Published: 2024-04-26 16:12:56

*This is a submission for the [Coze AI Bot Challenge](https://dev.to/devteam/join-us-for-the-coze-ai-bot-challenge-3000-in-prizes-4dp): Trailblazer.*

## What I Built

The plugin allows to quickly find information about the current or next map, data about players - how many kills, headshots, how many wins/losses, data about the strongest players in various seasons and much more.

## Demo

[Plugin Demo](https://www.coze.com/store/plugin/7362193808160882693)


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


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


![Map_Rotation1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/seby2jr6oyxmr20xmltq.png)![Map_Rotation2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kom9emwss57948b436jq.png)

## Journey

I love playing video games, and one of my favorite online shooters is Apex Legends.
Sometimes there is a need to get information without going to the game, such as changing maps or getting information that can't be obtained through the game but can be retrieved via API. That's what this plugin does. Hope it will helpful.

Thank you for the challenge!
Java Hibernate vs JPA: Quick Review
Tags: java, hibernate, jpa, programming
Published: 2024-04-26 16:03:53

**Introduction to [Java Hibernate vs JPA](https://bluebirdinternational.com/java-hibernate-vs-jpa/)**

**Java Hibernate:** An open-source Object-Relational Mapping (ORM) framework that simplifies database interactions by mapping Java classes to database tables. It's known for its robustness, offering features like high-level object-oriented query language (HQL), caching, and automated transaction management.

**Java Persistence API (JPA):** A Java standard specification that simplifies the management of relational data in applications using Java Platform, Enterprise Edition. It's widely adopted due to its ORM capabilities, allowing for flexible database interactions and being vendor-agnostic.

**Key Features and Differences**

**Feature Set:**

<u>Hibernate</u> offers advanced features like dirty checking, a more sophisticated caching mechanism, and custom SQL for fine-grained control.

<u>JPA</u> provides a more standardized approach with sufficient features for many typical database interaction scenarios, focusing on simplicity and portability.

**Performance:**

<u>Hibernate</u> is often faster in execution due to its mature caching and data management strategies.

<u>JPA</u> is designed to be flexible and is implemented by various providers, sometimes affecting performance consistency.

**Ease of Use:**

<u>Hibernate</u> might have a steeper learning curve due to its rich feature set and complexity.

<u>JPA</u> is generally easier to start with, especially for developers familiar with Java standards.

**Documentation:**

<u>Hibernate</u> benefits from a large, active community and extensive documentation that can help solve specific issues.

<u>JPA</u>, being a standard, has wide support across numerous Java environments and extensive documentation from multiple sources.

**When to Use Each**

**Hibernate** is ideal for complex transactions and scenarios where data handling requires a more nuanced approach. It's particularly useful in large applications needing deep integration with database operations.

**JPA** is suitable for applications where portability across different database systems is crucial. It simplifies development with a less steep learning curve, making it accessible for new developers and ensuring that applications are easy to maintain.
My Personal Brand in Software Architecture and Consultancy - Embracing Perfection and Continuous Improvement
Tags: perfection, consulting, improvement, architecture
Published: 2024-04-26 16:01:00

In the world of software and consulting, it's important to do a really good job because the work I do affects many projects and people. I have built my reputation around always trying to do my best, learning from my mistakes, and always trying to improve. This helps me be trusted by the people I work with and the clients I serve.

![](https://victorleungtw.com/static/7521f29f7086cb399053a11d970387b9/8aab1/2024-04-27.webp)

#### Striving for the Best

I always aim for the highest quality in my work. As a software architect and consultant, every detail matters—from the code I write to the plans I make. I check my work carefully to make sure it's the best it can be, which helps ensure that the final product is strong and reliable. This attention to detail builds trust with my clients because they see I'm committed to delivering great results.

#### Analytical and Detail-Oriented

I like to dive deep into the technical details and think through problems thoroughly. This careful, analytical approach is key in software architecture, where understanding every small part can make a big difference in the project's success. Keeping my skills up to date through certifications is important to me, and it keeps me ready to handle whatever comes my way.

#### Learning from Mistakes

Making mistakes is part of any job, but I focus on learning from them to avoid repeating the same errors. Every project teaches me something new, and I spend time studying and experimenting to make sure I keep getting better. This cycle of doing, learning, and improving is central to my work ethic.

#### Facing New Challenges

I believe that we grow the most when we try new and challenging things. Whether it’s a difficult project or a new task from my boss, I see each challenge as a chance to learn and improve. This keeps my job exciting and ensures that I'm always learning and evolving in my field.

#### The Value of My Approach

This approach to my work makes me a better software architect and consultant. It shows that I am dependable and good at solving problems. My focus on quality and improvement not only helps me grow but also makes the teams and projects I work on better.

In summary, my professional reputation is built on always trying to do the best work possible, being open to learning from every experience, and welcoming challenges that push me to grow. These qualities make me stand out and succeed in the fast-paced world of software architecture and consulting.
Agence Seo
Published: 2024-04-26 15:56:36

J'ai récemment découvert les services de l'[agence seo marseille](https://rhillane.com/agence-seo-montpellier/), et je dois dire que leur approche du SEO est exceptionnelle. Leurs experts m'ont aidé à optimiser mon site pour les moteurs de recherche de manière efficace et professionnelle. Si vous cherchez à améliorer votre visibilité en ligne, je recommande vivement leurs services. Leur expertise en SEO peut vraiment faire la différence pour votre entreprise.
Tips for Budgeting Packaging Materials
Tags: packagin, boxes
Published: 2024-04-26 15:55:46

Hey fellow entrepreneurs!

I wanted to share some tips on budgeting for packaging materials for small businesses. As we all know, keeping costs down is crucial, but we also want to maintain quality and professionalism in our packaging.

First off, consider buying in bulk. Purchasing larger quantities often results in lower unit costs, saving you money in the long run. Additionally, look for suppliers that offer discounts for bulk orders or loyalty programs.

Another tip is to explore alternative materials. Sometimes, there are more affordable options that still provide adequate protection for your products. For example, recycled or eco-friendly materials can be both budget-friendly and environmentally conscious.

Lastly, don't forget to negotiate with suppliers. Many are willing to negotiate prices, especially if you're a loyal customer or if you're purchasing large quantities.

What are your tips for budgeting packaging materials? Let's share our experiences and help each other out!

Regards,
Nova Gloriam
Little oak
Published: 2024-04-26 15:41:44



In the very centre of the forest, on the first day of spring, a little twig poked out of the ground.

Every day he grew a little bigger.

Every day new leaves unfurled.

Before the end of the summer, he had two little branches, and he was very proud of himself.

'Look at me!' he would shout out to his mummy. And Mother Oak would tell him he was perfect.

In the autumn his leaves turned beautiful colours and then fell to the ground.

And in the winter the snow fell in great drifts on the ground, and he could see the beautiful stars and the bright moon clearly through the branches of the bigger trees.

The little oak tree was happy.

And when the spring came again, even more leaves came poking out, and he started growing even more.

Every day he grew a little bigger.

But this year there was something new. By the end of the summer he had two little brown acorns with grey caps on his branches. He loved them so much.

'Look at these!' he would shout out to his mummy. And Mother Oak would tell him the acorns were beautiful.

But when autumn came and his leaves turned red and gold and orange, and all around him the forest was beautiful with colours, the little oak tree started to feel anxious.

And when he started seeing the other trees dropping their acorns to the ground it got even worse.

Every day he held on tighter and tighter to his little acorns.

At night he was afraid they would fall to the ground.

One day he was very upset, and Mother Oak asked him what the matter was.

The little oak tree was still very small. He told his mummy why.

'You don't need to worry,' she said reassuringly. 'If you let the acorns fall to the ground, then next year you will have even more.'

And so the little oak tree let them fall, and the winter came, and then spring and summer.

And the next year the little tree grew even bigger.

And every year there were more acorns in his branches.
Install helm chart from ECR
Published: 2024-04-26 15:41:43

1. Install helm plug-in.
` helm plugin install https://github.com/vetyy/helm-ecr.git --version 0.1.4`
2. Login to ECR
`aws ecr get-login-password --no-verify-ssl --region us-west-2 | docker login --username AWS --password-stdin XXXXXXXXXXXX.dkr.ecr.us-east-1.amazonaws.com`
3. Install helm chart
`helm install abc ecr://XXXXXXXXXXXX.dkr.ecr.us-east-1.amazonaws.com/abc/0.1.2`
Setup a Microservice
Tags: webdev, programming, devops, laravel
Published: 2024-04-26 15:14:20

{% youtube 9-Z3kKKpUFM %}
**docker-compose.yml**
```php
version: '3'

services:
  nginx_service1:
    build:
      context: ./service1/nginx
      dockerfile: Dockerfile
    volumes:
      - ./service1/nginx:/etc/nginx/conf.d/
      - ./service1:/var/www/html/service1
    ports:
      - "8000:80"
    networks:
      - networks_app

  db_server1:
    image: mysql:8.0
    container_name: db_server1
    restart: unless-stopped
    environment:
        MYSQL_DATABASE: db_hoanguyencoder
        MYSQL_ROOT_PASSWORD: 12345678
        MYSQL_PASSWORD: 12345678
        MYSQL_USER: hoanguyencoder
        SERVICE_TAGS: dev
        SERVICE_NAME: mysql
    ports:
      - '3306:3306'
    volumes:
      - ./service1/mysql:/docker-entrypoint-initdb.d
    networks:
      - networks_app


  nginx_service2:
    build:
      context: ./service2/nginx
      dockerfile: Dockerfile
    volumes:
      - ./service2/nginx:/etc/nginx/conf.d/
      - ./service2:/var/www/html/service2
    ports:
      - "8001:80"
    networks:
      - networks_app


  service1:
    build:
      context: ./service1
      dockerfile: Dockerfile.php7
    volumes:
      - ./service1:/var/www/html/service1
    networks:
      - networks_app

  service2:
    build:
      context: ./service2
      dockerfile: Dockerfile
    volumes:
      - ./service2:/var/www/html/service2
    networks:
      - networks_app


networks:
  networks_app:
    driver: bridge
```
TS: Types vs. Interfaces
Tags: typescript, interview, frontend, javascript
Published: 2024-04-26 15:14:15

A few days ago, we had a lively chat at work about how to type a package we're working on.

In the middle of our discussion, someone threw out there: 

> "Interface and type, they're basically the same, right?"

I was pretty taken aback! We ended up debating this a bit, and my colleague explained he meant that for a React app, it wouldn’t really matter whether we used types or interfaces for props or defining business models.

But actually, there are some important differences to keep in mind:

#### Type Aliases are super versatile.
You can use them for a bunch of different things like combining types, or defining arrays and tuples. No chance to implement that with interfaces:

```typescript
type SomeType = 'a' | 'b' | string;
type Pair = [number, number];
type NamedVariable = (Input | Output) & { name: string };
```

#### Declaration Merging with Interfaces
One cool thing about interfaces is that you can add more details to them later through something called declaration merging. It’s like saying:

> Hey, let’s add some more features to this existing interface 
and you can do it anywhere in your code.

```typescript
interface ICountry {
  name: string;
  capital: string;
}

interface ICountry {
  population: number;
  officialLanguage: string;
}

const france: ICountry = {
  name: 'France',
  capital: 'Paris',
  population: 67000000,
  officialLanguage: 'French'
};

```

#### Intersection vs Extending
Last but not least important thing to know is that type intersection and interface extensions work differently

```typescript
// It's OK
type TUser = {
  id: string;
}

type TUserData = TUser & {
  id: number;
}

// Definitely not ok
/*
Interface 'UserData' incorrectly extends interface 'User'.
  Types of property 'id' are incompatible.
    Type 'number' is not assignable to type 'string'.
*/

interface User  {
  id: string;
}

interface UserData extends User {
  id: number;
}
```

Some other details can be found at the section [Differences Between Type Aliases and Interfaces
](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces)

While my buddy thought there wasn't much difference, knowing these details can help you decide which one to use and when. It may seem insignificant, but it's good to know about it.

Finally, it doesn't really matter whether you use interfaces or types for defining props or business entities in your React app. The key thing is just to make sure everyone on the team knows and follows the same rules you've set up.