teleren/devto huggingface dataset:
Modules Status Update
Tags: puppet, community
Published: 2024-03-01 21:46:51

---
title: Modules Status Update
published: true
date: 2024-03-01 00:00:00 UTC
tags: puppet, community
canonical_url: https://puppetlabs.github.io/content-and-tooling-team/blog/updates/2024-03-01-modules-status-update/
---

## Happy Friday !!

As we bid adieu to yet another Friday, hope this message finds you well and in good spirits. This past week has been a steady journey for us, with our focus dedicated to ongoing projects and tasks. It’s been a period of quiet dedication, marked by progress on various fronts. As we embark on the weekend, may the warmth of the sun bring positivity and joy to your days. Let’s recharge our energies and look forward to the challenges and opportunities that the upcoming week will bring.

Here’s to another week of dedication, progress, and the pursuit of excellence. Wishing you all a restful and rejuvenating weekend ahead!

## Community Contributions

We’d like to thank the following people in the Puppet Community for their contributions over this past week:

- [`puppetlabs-package#316`](https://github.com/puppetlabs/puppetlabs-package/pull/316): “Remove unwanted lines from yum output”, thanks to [ememilyly](https://github.com/ememilyly)

- [`puppetlabs-stdlib#1384`](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1384): “Add function stdlib::sort\_by”, thanks to [XMol](https://github.com/XMol) and the following people who helped get it over the line ([bastelfreak](https://github.com/bastelfreak))
How To Make Greens Powder Taste Better 2022
Published: 2022-11-15 10:36:22

How To Make Greens Powder Taste Better 2022: Super greens powders are a healthy way to add extra nutrition to your diet, but frequently at the cost of flavor. Due to accessibility issues and the desire for better-tasting food, many people find it difficult to incorporate healthy superfoods into their regular diets.

The good news is that super green powders are more palatable than ever. They come in a variety of flavors, including chocolate and strawberry. Super greens powders are a nutritious way to supplement your diet. They can also make your food taste better by adding some superfoods to it. Nothing is worse than being forced to tolerate the bitter taste of your greens powder just because it is “healthy.” Although a super greens powder has a well-established reputation in the health and wellbeing industry, how can you improve the taste of greens powder? 

[Read Full Artical](https://trustyfashion.com/how-to-make-greens-powder-taste-better-2022/)
Introducing Noir: The Keyboard-Driven Database Management Client
Published: 2024-02-29 23:35:06

Have you ever found yourself juggling between your code editor and a database management tool, frustrated by the constant need to switch to the mouse for basic operations? As a developer, I certainly have. 

This was the primary motivation behind the creation of Noir, a keyboard-driven database management client designed to streamline your workflow without ever reaching for the mouse.

## Overview

Noir is all about efficiency and accessibility. It empowers you to accomplish everything you need using just your keyboard. With features like multiple simultaneous connections, query tabs, and the ability to export data in CSV or JSON array format, Noir provides a seamless experience for managing your databases. Supporting popular database systems such as PostgreSQL, MySQL, MariaDB, and SQLite, it caters to a wide range of developer needs.

## Why Noir?

What sets Noir apart is its keyboard-first approach. Built with web technologies, every element is designed to be navigable with ease using just the tab key. The sleek and modern interface, coupled with a lightning-fast grid for displaying results, ensures a delightful user experience. And with features like Vim mode, autocomplete, and customizable themes, Noir offers a level of customization that truly makes it stand out.

## Installation and Setup

Getting started with Noir is a breeze. Simply follow the instructions on our website at [noirdb.dev](https://noirdb.dev/). We provide platform-specific installation guides for Windows, macOS (both Intel and ARM), and Linux, ensuring a smooth setup process regardless of your operating system.

## Feedback and Roadmap

At Noir, we thrive on feedback. We believe in constant improvement, and your suggestions play a crucial role in shaping the future of our product. Whether it's a bug report, a feature request, or just a general comment, we welcome all feedback with open arms. Join our community, be part of the conversation, and help us make Noir even better.

We plan to constantly improve, fix and add features. Coming up next in the near future is query history and saved queries.

Think we're missing something?

Feel free to suggest on the issues tab over at [github.com/invm/noir](https://github.com/invm/noir).

## Conclusion

Ready to revolutionize your database management workflow? Dive into the world of Noir today. Visit our website at [noirdb.dev](https://noirdb.dev/) to get started, access our documentation, and explore the features firsthand. And don't forget to check out our GitHub repository at [github.com/invm/noir](https://github.com/invm/noir) to contribute to the project and join our growing community of developers. Noir: Where efficiency meets elegance.
Jest Node.js and React
Tags: webdev, javascript, beginners, programming
Published: 2024-02-29 23:29:59

Here's a Jest cheat sheet summarizing its key features for writing effective unit tests in your Node.js and React projects:

**1. Test Structure:**

* **`it` function:** Defines a single test case.
    * **`describe` block (optional):** Groups related test cases.

```javascript
describe("MyComponent", () => {
  it("should render correctly", () => {
    // Your test code here
  });
});
```

**2. Matchers:**

* **Basic matchers:**
    * `toBe`: Checks strict equality (===)
    * `toEqual`: Checks deep equality (regardless of object structure)
    * `toBeNull`
    * `toBeUndefined`
    * `toBeTruthy`
    * `toBeFalsy`
* **Number matchers:**
    * `toBeGreaterThan`
    * `toBeLessThan`
    * `toBeCloseTo` (allows for a precision parameter)
* **String matchers:**
    * `toContain` (checks if a substring exists)
    * `toMatch` (checks for a regular expression match)
* **Array/Object matchers:**
    * `toContainEqual` (checks if an array contains all elements in another array)
    * `toMatchObject` (checks if an object contains all properties and values in another object)

**3. Mocking:**

* **`jest.fn()`:** Creates a mock function for testing dependencies.
* **Mock assertions:**
    * `toHaveBeenCalled`: Checks if the function was called.
    * `toHaveBeenCalledWith`: Checks if the function was called with specific arguments.
    * `toHaveReturnedWith`: Checks the function's return value.

**4. Snapshot Testing:**

* **`toMatchSnapshot`:** Takes a snapshot of a value and compares it to a previously saved snapshot.
* Useful for ensuring UI components render consistently.

**5. Async/Await Testing:**

* Jest supports both `async/await` syntax and the callback approach with `done` for asynchronous testing.

**Additional Resources:**

* **Official Jest Documentation:** [https://jestjs.io/docs/getting-started](https://jestjs.io/docs/getting-started)
* **Interactive Jest Cheat Sheet:** [https://devhints.io/](https://devhints.io/)

Remember, this is a concise overview. Refer to the official documentation for in-depth information and examples for each feature.
Testing library for Node.js and React
Tags: webdev, javascript, beginners, programming
Published: 2024-02-29 23:28:51

While popularity isn't always the sole indicator of quality, based on current trends and community support, the most popular unit testing library for Node.js and React is:

**Jest** ([https://jestjs.io/](https://jestjs.io/))

Here's a breakdown of its advantages:

- **Strong integration with React:** Developed and maintained by Facebook, Jest boasts seamless integration with React thanks to its built-in support for `@testing-library/jest-dom`.
- **Out-of-the-box features:** Jest provides numerous features right out of the box, including:
    - Watch mode for automatic test reruns on code changes.
    - Mock implementation, snapshot testing, and extensive matchers for assertions.
    - Detailed test reports and coverage statistics.
    - Easy integration with CI pipelines.
- **Ease of use:** Jest is generally considered beginner-friendly and offers a straightforward setup process.

However, it's important to understand that "best" is subjective and depends on your specific context. Here's a comparative overview of potential alternatives:

| Library        | Advantages                                              | Disadvantages                                                 |
|----------------|-------------------------------------------------------|--------------------------------------------------------------|
| Jest           | Strong React integration, comprehensive features, ease of use | May be less customizable compared to some alternatives          |
| Mocha          | Flexible, well-established, asynchronous testing support  | Can require more setup and configuration                       |
| Enzyme         | Detailed DOM testing, useful for simulating user interactions | Can be slower due to full-DOM rendering, less suitable for isolated tests |
| React Testing Library | Promotes testing based on functionality and behavior, less dependent on implementation details | May require more experience to write effective tests |

Ultimately, the best approach is to **experiment and evaluate different libraries based on your project's needs and preferences**. Consider factors like your team's familiarity with specific tools, desired level of flexibility, and testing workflow integration.
$0.005 per In-use public IPv4 address per hour の明細が高額になる場合の対応を考える
Tags: aws, cost, japanese
Published: 2024-02-29 23:24:02

昨年の7月末に[「パブリック IPv4 アドレスの利用に対する新しい料金体系を発表 / Amazon VPC IP Address Manager が Public IP Insights の提供を開始」](https://aws.amazon.com/jp/blogs/news/new-aws-public-ipv4-address-charge-public-ip-insights/)で発表となっていたが、今年の2月よりパブリックIPv4アドレスについて時間あたり0.005ドル課金されるようになった。これはIANAからの割当が枯渇しているIPv4アドレスを取得するためにかかる費用を受益者負担するための取り組みであるが、2月分だけの該当明細の請求だけで200ドルを超えているAWSアカウントもあり、コスト削減のためにはアーキテクチャ変更を余儀なくされる。

![明細のイメージ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d3371gkhr3ejcv6tzv46.png)

取り組みとしては以下のように進めると良い。

1. 無料枠の範囲でIPAM(Amazon VPC IP Address Manager)を有効化し、パブリック IP に関するインサイトより課金対象となっているIPv4アドレスを把握する。
![パブリック IP に関するインサイト](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iyb846pacjcoa5bnf467.png)
1. 以下のいずれかの方法にてパブリックIPv4アドレスの割当数を減らす。なお、実現しやすい順に記載している。

* 冗長構成としているEC2やECSなどについては負荷に応じた台数になっているかを見直して、稼働台数を減らせないか検討する
* HTTPS通信をオフロードする目的だけにALBを使っているEC2が1台だけの構成となっているものは、ALBの代わりにCloudFrontに置き換えることを検討する（ただし、EC2にアタッチしているセキュリティグループにおいて、HTTPプロトコルの通信元を絞れなくなってしまうことに留意が必要）
* （開発用で利用しているAWSアカウントを対象に）ALBで3AZ構成になっているものは2AZ構成に変更する
* （開発用で利用しているAWSアカウントを対象に）同一VPCにて複数のALBがデプロイされているものは、1つのALBに集約できるようにターゲットグループを構成する。
* （ALBの配下にあるEC2やECSなど）グローバルIPが不要なものはプライベートIPのみにする(但し、EC2やECSタスク起点で外向きに通信が発生するものについてはNAT Gatewayが必要となる点に注意。S3などであればVPCエンドポイントを活用できる)
* IPv4ではなくIPv6で構成できるものについてはIPv6に変更([AWS内で完結するからパブリックIP通信でも安全 EC2でIPv6を使う手順と注意点](https://logmi.jp/tech/articles/324883)にも記載がある通り、十分なテストが必要)

IPv4アドレスの割り当てを1つ減らしても1ヵ月で3ドル程度しか削減効果はないが、これからずっと課金が行われ続けることを考えると今できることから取り組んでおきたい。
Memoization
Tags: webdev, javascript, beginners, programming
Published: 2024-02-29 23:18:06

Memoization is a technique used to optimize function calls by caching the results of expensive function calls and returning the cached result when the same inputs occur again. This can be especially useful in React applications to optimize the rendering performance.



In JavaScript and React (ES6 and later), you can implement memoization in various ways. One common approach is to use a cache object to store the results of function calls. Here's a simple example:



```javascript

// Memoization cache

const cache = new Map();



// Example function to be memoized

const expensiveFunction = (param) => {

 if (cache.has(param)) {

  console.log('Fetching from cache:', param);

  return cache.get(param);

 }



 // Perform expensive computation

 const result = /* perform computation based on param */;



 // Cache the result

 cache.set(param, result);

 console.log('Result not in cache. Calculating and caching:', param);



 return result;

};



// Example usage

const result1 = expensiveFunction('input1'); // Expensive computation

const result2 = expensiveFunction('input2'); // Expensive computation



// Subsequent calls with the same input will use the cached result

const result1Cached = expensiveFunction('input1'); // Fetching from cache

const result2Cached = expensiveFunction('input2'); // Fetching from cache

```



In the context of React, you can use the `useMemo` hook for memoization. Here's an example:



```javascript

import React, { useMemo } from 'react';



const MyComponent = ({ data }) => {

 // Memoize the result of the expensive computation based on data

 const result = useMemo(() => {

  console.log('Performing expensive computation based on data:', data);

  // Expensive computation based on data

  return /* result */;

 }, [data]); // Memoize only when data changes



 return (

  <div>

   {/* Render using the memoized result */}

   <p>Result: {result}</p>

  </div>

 );

};



export default MyComponent;

```



In this example, the `useMemo` hook is used to memoize the result of the expensive computation based on the `data` prop. The computation is only recalculated when the `data` prop changes.



Keep in mind that memoization is a trade-off between memory and computation. It reduces redundant computations but increases memory usage to store cached results. Always assess the specific needs and characteristics of your application when deciding whether to apply memoization.
Developer diary #3. Injection in constructor
Tags: android, kotlin, programming, java
Published: 2024-02-29 23:15:45

Today, I again made sure that injection in the constructor is the best way to pass dependencies to class. If you do it another way, you can get problems when you write tests. Injection into the constructor allowed you to very simply mock any dependencies. 

Sometimes, it is very desirable to use the static method of some utility class, but it turns into a headache when you start writing the tests. You will try to solve this problem by using some libraries. But it is a wrong way. A more efficient way is to wrap this class and pass through the constructor.

Constructor is the gate for dependencies.
Lambdaで.NET 7のカスタムランタイムを実行する
Tags: lambda, net7, japanese
Published: 2024-02-29 23:04:58

.NET6での実行速度をさらに改善するために.NET 7から対応しているAOTのメリットを享受しようとした。

結論としては実行した結果、実行時に以下の例外エラーが生成されてしまった。
Dynamic code generationの必要な実装が含まれている場合には移行できないので検討する上での注意事項してほしい。

> System.PlatformNotSupportedException: Dynamic code generation is not supported on this platform.

.NET8がLambdaで正式サポートされ、カスタムランタイムで実行せずにすむようになった時に、この部分の動きがどのようになるか確認してみたい。
The DevRel went down to Georgia...
Published: 2024-03-15 13:45:38

---
title: The DevRel went down to Georgia...
published: true
date: 2024-02-29 22:21:21 UTC
tags: 
canonical_url: https://alex.party/posts/2024-02-29-the-devrel-went-down-to-georgia/
---

Inspiration came from [Stu Robson](https://front-end.social/@sturobson/112014882524066324)

## The DevRel Went Down to Georgia

(to the tune of [The Charlie Daniels Band’s “The Devil Went Down to Georgia”](https://www.youtube.com/watch?v=wBjPAqmnvGA))

```
The DevRel went down to Georgia, they had some code to shill 
They were in a bind, cause they were way behind, and the VP wasn't thrilled
When they came upon this young dev pushing to main and cursing a lot
The DevRel sat right down and said, "Hey let me tell you what,

"You probably didn't know it but I've pushed main a time or two,
And if you care to have a share, I'll make a deal with you,
The thing my company makes can solve your primary issue,
I'll bet a sticker of gold against your role that it'll make it faster too."
The dev said "My names Sally and I've got stand-up in ten,
But if you wait, I can give an update, and then we can begin"

Sally commit and push your code and submit a new PR,
Cause the tests won't fail in CI, and the DevRel has a card
and if you wait, you'll win this shiny sticker made of gold
and if you leave, the DevRel gets your role

The DevRel opened up their mac, and said "I'll start this show"
And fire flew from their finger tips as they began to git clone
And they pulled a branch, and started to talk about their business
Then a band of recruiters joined in, and it sounded something like this

[insert amazing guitar/banjo/fiddle solo, overlaid with someone discussing some kind of generic developer product with a chorus of recruiter ooh-ing and ahhh-ing, and miscellaneous keyboard sounds]

Now when the DevRel finished, Sally said, "That's a pretty good dry run,
But come sit down in the chair right there, and let me show you my problem."

Fire up some docker, npm run
Add a little python, rust for fun
C Sharp in the backend, layer in some go
Tie it all together with a bit of "No Code"

Well, the DevRel bowed their head because they knew they can't compete
And they laid that golden sticker down as they got up from their seat
Sally said, "DevRel, don't feel too bad, or lose any morale,
The tool seems cool, I like your pitch, but I need it to support pascal!"

Fire up some docker, npm run
Add a little python, rust for fun
C Sharp in the backend, layer in some go
Tie it all together with a bit of "No Code"
```
netty5: UDP DNS client example (1)
Tags: netty
Published: 2024-02-29 22:10:20

[io.netty5.example.dns.udp.DnsClient](https://github.com/netty/netty/blob/netty-5.0.0.Alpha5/example/src/main/java/io/netty5/example/dns/udp/DnsClient.java) is DNS client to lookup A record of domain "www.example.com" by UDP.

# Setup *io.netty5.channel.Channel* instance

Please read the following code.

```java
EventLoopGroup group = new MultithreadEventLoopGroup(NioHandler.newFactory())
Bootstrap b = new Bootstrap();
b.group(group)
 .channel(NioDatagramChannel.class)
 .handler(new ChannelInitializer<DatagramChannel>() {
     @Override
     protected void initChannel(DatagramChannel ch) {
         ChannelPipeline p = ch.pipeline();
         p.addLast(new DatagramDnsQueryEncoder())
         .addLast(new DatagramDnsResponseDecoder())
         .addLast(new SimpleChannelInboundHandler<DatagramDnsResponse>() {
            @Override
            protected void messageReceived(ChannelHandlerContext ctx, DatagramDnsResponse msg) {
                try {
                    handleQueryResp(msg);
                } finally {
                    ctx.close();
                }
            }
        });
     }
 });
```

1. anything related to communication is executed in one of the threads of *EventLoopGroup*
1. *NioDatagramChannel.class* states that the underlying network library is Java NIO DatagramChannel
1. *handler()* accepts a subclass of *io.netty5.channel.ChannelInitializer* which implements the function *initChannel(DatagramChannel)*. It is to setup list of ChannelHandler in *ChannelPipeline*. I called this class **setup channel class**

*Channel* instances will be built and obtained in the following.

```java
final Channel ch = b.bind(0).asStage().get();
```

When *bind(0)* is called, *io.netty5.bootstrap.Bootstrap#init* is triggered.

```java
@Override
Future<Channel> init(Channel channel) {
    ChannelPipeline p = channel.pipeline();

    setChannelOptions(channel, newOptionsArray(), logger);
    setAttributes(channel, newAttributesArray());

    p.addLast(config.handler());

    return channel.executor().newSucceededFuture(channel);
}
```

Value of *config.handler()* is setup channel class. And then *io.netty5.channel.ChannelInitializer#handlerAdded* is triggered.

```java
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
    try {
        initChannel((C) ctx.channel());
    } catch (Throwable cause) {
        // Explicitly call exceptionCaught(...) as we removed the handler before calling initChannel(...).
        // We do so to prevent multiple calls to initChannel(...).
        channelExceptionCaught(ctx, cause);
    } finally {
        if (!ctx.isRemoved()) {
            ctx.pipeline().remove(this);
        }
    }
}
```

Setup channel class will be removed after *ChannelPipeline* is setup. Then the following will be in *ChannelPipeline*

- DefaultChannelPipeline$HeadHandler
- DatagramDnsQueryEncoder
- DatagramDnsResponseDecoder
- subclass of SimpleChannelInboundHandler
- DefaultChannelPipeline$TailHandler
Add swipe-able button in React
Tags: react, npm, frontend, tutorial
Published: 2024-02-29 21:37:55


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wfjn4aye00qkpxd4dnj.gif)

So I was struggling to find a right react component library for interactive button that can be swiped both in touch and mouse move.

Although I got a blog and found one react library which is not maintained now and has no support for TypeScript.

Inspired from the library , I polished the code , added latest React and TypeScript support and published as npm package.

**Let’s explore the magic!**

- We need to install the library package first.

`npm install react-swipeable-button`

or

`yarn add react-swipeable-button`

- Now we need to import the ‘SwipeableButton’ component from the ‘react-swipeable-button’ package.

To resize the button, we need to wrap it with a parent div and add CSS properties ( Here, we are using Tailwind).

```
import { SwipeableButton } from "react-swipeable-button";

function App() {

  const onSuccess = () => {
    console.log("Successfully Swiped!");
  };

  return (
    <div className="w-[500px] h-[100px] bg-white">
       <SwipeableButton
                  onSuccess={onSuccess} //callback function
                  text="Swipe me!" //string 
                  text_unlocked="yeee" //string
                  color="#16362d" //css hex color
                />
    </div>
  );
}

export default App;
```

- The props are optional but you need to use them for comprehensive customizations.

**To explore more about the package or for contribution, check the package link below.**
{% embed https://www.npmjs.com/package/react-swipeable-button %}
Should I stay or Should I go
Tags: blog, reflect
Published: 2024-02-29 21:27:16


When you start building websites its fun starting a new project. But what about those established projects?
When you start a project you get the lucky choice of what tools you work with. While when you work on Established Projects lets call EP for short you do not.
When that EP started they froze their packages and their dependencies. So even though you might be working with python 3.12.x, they might be on version 3.8.x or something but its not near the newest. When I was in a programming bootcamp all the groups recieved a project and decided if they would start from scratch or continue with the build previously. My team thought of rebuilding but our team lead advised us to continue and add features and refactor the build.

What did we do? We decided to continue on the project and it was a great decision. Even though we chose too continue and were not forced I think thats better to prepare than a new project. Unless your in the beginning at the ground floor, something of some sort will already be built and with that you earn the good and the bad of the technology used. Since there was most likely a reason for everything done even if no comments say so. But that doesnt mean when the project started the packages are still up to date, or there are updated best practices after a major version changes the API.

So many things that can be done that might get forgotten about.
They take time to finish and update the many lines of code and
changes in each spot of the code then you add testing it does not break. There is a lot to maintain in a project over the long run and the whole comes from the parts that create it.