teleren/devto huggingface dataset:
Turning your API Specification into Executable Contracts - Introducing Contract Driven Development with Specmatic
Tags: testing, development, api, microservices
Published: 2024-03-20 02:39:56

{% embed  https://www.youtube.com/watch?v=7OvTanLjm20 %}

Are microservices driving you crazy?

Naresh Jain's talk at YOW 2023 focused on the main benefits of contract-driven development (CDD) with the use of [Specmatic](https://specmatic.in/appearance/contract-driven-development-turn-your-api-specification-into-executable-contracts/), an open-source tool he co-created. 

He highlights that CDD is essential for organizations with a large number of microservices to ensure all services are properly integrated and working harmoniously before deployment. 

He demonstrates how CDD can speed up deployment times and enable independent and parallel development across teams, a crucial factor in agile microservices ecosystems. Besides testing for compatibility and eliminating integration surprises, Specmatic facilitates visualizations of service dependencies and API coverage, further aiding in maintaining a good system architecture. 

Specmatic supports testing and development with OpenAPI, AsyncAPI, and SOAP specifications (more on the way). By leveraging Specmatic in CI pipelines, companies can programmatically ensure that all contracts are honored before accepting pull requests, therefore embedding contract validation into the heart of the development workflow. 

The video highlights the power of Specmatic in intelligent service virtualization, automated test generation from specifications, and implementing fault injection scenarios through examples—all without writing additional code. 

Embrace contract-driven development with tools like Specmatic offers the promise of more robust, predictable, and efficient software delivery cycles.
Do you know that 0.1 + 0.2 is not equal to 0.3?
Tags: programming, javascript, beginners, tip
Published: 2024-03-20 02:28:05

Yes, this is a well-known issue in JavaScript (and many other programming languages) that use binary floating-point numbers. The problem arises from the fact that some numbers cannot be represented exactly in binary floating point, which leads to small rounding errors.
Here's an example:
```js
console.log(0.1 + 0.2);  // Outputs: 0.30000000000000004
```
Floating-point numbers are a way of representing real numbers in computer systems. They are used to approximate real numbers, but they can't always do it perfectly due to the way they are stored in memory.

In many programming languages, including JavaScript, floating-point numbers are represented according to the IEEE 754 standard. This standard represents numbers in binary, which means they are expressed as a sum of powers of 2.

While some numbers can be represented exactly in this system (like 0.5, which is 2^-1), others cannot. For example, the decimal number 0.1 cannot be represented exactly as a finite binary fraction. In binary, 1/10 is an infinitely repeating fraction.

When you perform arithmetic operations with these approximated numbers, the small errors can accumulate, leading to unexpected results. For example, in JavaScript, the expression 0.1 + 0.2 doesn't exactly equal 0.3.

This is not a flaw in the programming languages themselves, but a consequence of using binary floating-point numbers. To deal with this, programmers often use special libraries for high-precision arithmetic, or use techniques to compare floating-point numbers with a certain tolerance, rather than expecting them to be exactly equal.

Yes, there are libraries in JavaScript that can help with precision issues related to floating point arithmetic. One of them is `decimal.js`.

Here's an example of how you can use it:

First, install the library:
```nodejs
npm install decimal.js
```

Then, use it in your code:
```js
const Decimal = require('decimal.js');

let result = new Decimal(0.1).plus(new Decimal(0.2));

console.log(result.toString());  // Outputs: 0.3
```

This library allows for much more precise arithmetic than JavaScript's native Number type. Try [Playground](https://codesandbox.io/s/decimaljs-playground-m8knp)
Productive tools to track your focus
Tags: productivity, discuss
Published: 2024-03-20 02:15:21

As a self-taught student, I must use all my efforts to keep my mind without distractions to keep good progress while studying. Lately, I've been using the Pomodoro technique and it has become a hobby to know some websites of this productive tool. What's your favorite one? I'd like to know some websites to allow the user to see your focus progress and make some interactions with others inside the platform.

PS.: Unfortunately, I have been having trouble with [LifeAt](https://lifeat.io/r), frequently, the timer stops and I lose track of my progress.

Please, share your favorite Pomodoro website and tell me why you love it!
Tuning System Performance
Published: 2024-03-20 02:00:58

**Adjusting Tuning Profiles**

Administrator sistem dapat mengoptimalkan kinerja sistem dengan menyesuaikan berbagai pengaturan perangkat berdasarkan berbagai beban kerja kasus pengguna. Daemon tuned menerapkan penyesuaian penyetelan baik secara statis maupun dinamis, menggunakan profil penyeselan yang mencerminkan kebutuhan beban kerja tertentu.

-Penyetelan Statis

Daemon tuned menerapkan pengaturan sistem saat layanan dimulai atau saat pemilihan profil penyetelan baru. Penyetelan statis mengkonfigurasi parameter kernel yang telah ditentukan sebelumnya dalam profil yang diterapkan tuned saat runtime. Dengan penyetelan statis, parameter kernel diatur untuk harapan kinerja keseluruhan, dan tidak disesuaikan saat tingkat aktivitas berubah.

-Penyetelan Dinamis

Dengan penyetelan dinamis, daemon tuned memonitor aktivitas sistem dan menyesuaikan pengaturan tergantung pada perubahan perilaku saat runtime. Penyetelan dinamis terus-menerus menyesuaikan penyetelan untuk mencocokkan beban kerja saat ini, dimulai dengan pengaturan awal yang dideklarasikan dalam profil penyetelan yang dipilih.

Sebagai contoh, perangkat penyimpanan mengalami penggunaan tinggi saat startup dan login, namun memiliki aktivitas minimal saat beban kerja pengguna terdiri dari menggunakan browser web dan klien email. Demikian pula, perangkat CPU dan jaringan mengalami peningkatan aktivitas selama penggunaan puncak sepanjang hari kerja. Daemon tuned memonitor aktivitas komponen-komponen ini dan menyesuaikan pengaturan parameter untuk memaksimalkan kinerja saat waktu aktivitas tinggi dan mengurangi pengaturan saat aktivitas rendah. Daemon tuned menggunakan parameter kinerja yang disediakan dalam profil penyetelan yang telah ditentukan sebelumnya.
Accessing Network-Attached Storage
Published: 2024-03-20 01:50:54

 **Mounting Network-Attached Storage (NAS) dengan NFS
**

Versi NFS default di Red Hat Enterprise Linux 8 adalah 4.2. Versi mayor NFSv4 dan NFSv3 didukung. NFSv2 tidak lagi didukung. NFSv4 hanya menggunakan protokol TCP untuk berkomunikasi dengan server; versi NFS sebelumnya bisa menggunakan TCP atau UDP.

Server NFS mengekspor share (direktori). Klien NFS melakukan mount sebuah share yang diekspor ke titik mount lokal (direktori), yang harus ada. Share NFS dapat di-mount beberapa cara:

-Secara manual, menggunakan perintah mount.
-Secara otomatis saat boot menggunakan entri /etc/fstab.
-Atas permintaan, menggunakan layanan autofs atau fasilitas systemd.automount.
Apa itu SELinux?
Published: 2024-03-20 01:25:39

SELinux (Security Enhanced Linux) merupakan fitur keamanan penting dalam sistem Linux yang mengontrol akses ke file dan sumber daya lainnya pada level yang sangat detail. Selinux menggunakan kebijakan yang didefinisikan oleh pengembang aplikasi untuk menentukan aksi dan akses yang diperbolehkan untuk setiap program biner, file konfigurasi, dan file data yang digunakan oleh aplikasi.

Ada tiga mode SELinux:
1. Enforcing: Menegakkan aturan kontrol akses.
2. Permissive: Merekam peringatan aturan yang dilanggar tanpa menegakkan aturan kontrol akses, biasanya digunakan untuk pengujian dan perbaikan masalah.
3. Disabled: Menonaktifkan SELinux sepenuhnya, tidak merekam atau menolak pelanggaran.

Konsep dasar keamanan SELinux adalah memberikan lapisan keamanan tambahan pada sistem dengan menggunakan kontrol akses yang lebih canggih, yaitu mandatory access control, yang berbasis objek. Setiap file, proses, direktori, dan port memiliki label keamanan khusus yang disebut konteks SELinux, yang menentukan apakah suatu proses dapat mengakses file, direktori, atau port tersebut.

Kebijakan SELinux yang paling umum adalah kebijakan bertarget (targeted policy) yang didasarkan pada konteks tipe (type context) dari file, proses, dan direktori. Pengetahuan untuk bekerja dengan SELinux mungkin membutuhkan waktu, namun kebijakan penegakan (enforcement policy) SELinux mencegah terjadinya penyebaran masalah keamanan dari satu bagian sistem ke bagian lainnya. Jika SELinux tidak berfungsi dengan baik pada suatu subsistem tertentu, Anda dapat menonaktifkan penegakan aturan untuk layanan tersebut hingga menemukan solusi untuk masalah yang mendasarinya.
Python Terminal Game - Codecademy Project
Tags: python, gamedev, codecademy, beginners
Published: 2024-03-20 01:15:21

https://github.com/PhilE88/py-adventure
[](https://github.com/PhilE88/py-adventure)


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

This is a basic terminal game written in Python. It's a survival type game where you have to make sure you don't go hungry or thirsty for too long. Drinking and eating cost money, and money is earned based on 3 different levels of risk. See how long you can last!

Note that this will probably only work on Windows, as it uses the 'winsound' library for sound effects.
How to use AI to generate charts? --Diagram AI
Tags: productivity, architecture, design, web
Published: 2024-03-20 00:59:54


https://chromewebstore.google.com/detail/diagram-ai/klbgbmoinfidmgmjlliilmbofaokkilo

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4yy52fhpxsoyw9mnxh3m.png)
Use ChatGPT to draw flow charts, sequence diagrams, class diagrams, entity relationship diagrams, and state diagrams in natural language.
The generated charts can be edited, and charts can be exported in SVG , PNG.
Top 10 Git Commands I Use Every Day
Tags: webdev, programming, tutorial, beginners
Published: 2024-03-20 00:54:31

Over the years, I've found myself relying on a core set of Git commands on a daily basis. These commands help me manage code changes, synchronize with team members, and maintain a clean project history.

Here's a rundown of the top 10 Git commands that are indispensable in my daily workflow.

## 1. `git clone`

Before you can work on a project, you need to get it onto your local machine. The `git clone` command does just that by copying an existing Git repository from a remote location to your local machine.

```bash
git clone <repository-url>
```

## 2. `git status`

Once you've started making changes, it's crucial to keep track of your work. The `git status` command provides a summary of which files have been modified, which are staged for commit, and which are not being tracked by Git.

```bash
git status
```

## 3. `git add`

When you're ready to save changes in Git, you first need to stage them using the `git add` command. This command updates the index with the current content found in the working tree, to prepare the content staged for the next commit.

```bash
git add <file-or-directory>
```

## 4. `git commit`

Committing is like taking a snapshot of your project's currently staged changes. The `git commit` command captures your changes in a new commit along with a log message from the user describing those changes.

```bash
git commit -m "Your commit message here"
```

## 5. `git push`

After committing your changes locally, you'll want to share them with your team or update the remote repository. The `git push` command uploads your commits to the remote repository.

```bash
git push origin <branch-name>
```

## 6. `git pull`

To synchronize your local repository with the remote, use the `git pull` command. It fetches and merges changes on the remote server to your working directory.

```bash
git pull origin <branch-name>
```

## 7. `git branch`

Working on a new feature or fix? The `git branch` command helps you manage your branches and ensures that you're working in the right context.

```bash
git branch <branch-name>
```

## 8. `git checkout`

Switching between branches is a common task. The `git checkout` command lets you navigate to different branches in your repository.

```bash
git checkout <branch-name>
```

## 9. `git merge`

Once your feature or fix is ready, you'll need to merge your branch back into the main branch. The `git merge` command combines the history of the specified branch into your current branch.

```bash
git merge <branch-name>
```

## 10. `git log`

To view the commit history of your project, the `git log` command is invaluable. It shows the chronological commit history for the current branch.

```bash
git log
```

Incorporating these commands into your daily workflow can significantly improve your productivity and collaboration efforts on any Git-based project.
```

Besides all the commands above, I will check [dev resources](https://cheatsheet.md) in case I forget something.

Hope this tip helps!
The project IDX
Tags: ide, google, cloud, idx
Published: 2024-03-20 00:39:00

**Project IDX** is an experimental IDE aimed to bring entire full-stack, multiplatform app development workflow to the cloud. The **Project IDX** is built by **Google**. Currently this IDE is not openly available for all. For now only few of developers are have access to it because they have joined the wait list earlier. Luckily I am one of them. It has been quite a while I got the access to it but I have tried it till last week.

![Project IDX home page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jihfbsu5swi3gh7kgl0t.png)
Take a look in its homepage.

Currently we can only have _**2 project**_ at a time.

Here you can import your project from github or you can create a new project with template provided by them.

## Project Templates

As it now we have 5 sub categories in templates. Those are -
- **Web App**
- **Backend**
- **Mobile**
- **AI & ML**
- **MISC**

we will discuss about these templates later. Let's create a project quickly to get started. For this I am going to select **Misc** template which is basically a blank project.

## Create a project

Creating a new project in **Project IDX** is very easy. Just few click and done your project is ready to jump start in coding.

* **Step 1:** Firstly select your template then do a simple click on it. You will greeted with this dialog asking for project name.

![Project IDX new project creation page 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lokj0b6gsh4cney7kih3.png)

* **Step 2:** Enter the project name then click on create button and done. Wait for few minutes untill it build and setup the workspace.

![Project IDX new project creation page 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7o5l7tbdg5fa7pssob2.png)

* **Step 3:** Once the workspace is set up start coding.

![Project IDX workspace image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dedln6314ga9a0jsdb5w.png)

The interface of **Project IDX** is very similar to VS Code. So if you are familiar with VS Code you won't have any problem migrating to it.

For this blank project we have a blank workspace which we have to configure. In the Readme file of the workspace we a link to a idx guide website where they explain how to configure a blank workspace.

If you don't want the headache of configuring the workspace, IDX contains a lot of prebuild workspace template. We will discuss about that later.

For now let's wrap up. Stay in touch to get all updates in IDX.
Object oriented programming
Tags: learning
Published: 2024-03-19 00:59:10

Almost everything in ruby is an object. Class names in ruby use CamelCase. `initialize` is a method used to boot up each object the class creates. Use `@` before a variable to signify that it always is an instance variable. This means that the variable is attached to the instance of the class. 

`@` - whenever a class is created, it has to have your `@` and each instance of your class will have its own `@`. Scope of a variable is the context in which it is visible to the program. 

Global variable - available everywhere
Local variable - only available in methods
Class - only available in classes
Instance - only available in instances of classes.

Class variable begin with `@@`
Global variables inside a method or class begin with `$`

Inheritance - process by which one class takes on the attributes and methods of another. It is used to express and is-a relationship. When you call `super` from inside a method, that tells ruby to look in the superclass of the current class and find a method with the same name as the one from which `super` is called. If it finds it, ruby will us the superclass version of the method. Mixins, allow for data and functions of multiple classes to be put in one. 

If you want to end a ruby statement without going on a new line you can just type a semicolon. 

Public methods allow for an interface with the rest of the program. Private methods are for classes to do their work undisturbed. In private methods, methods cannon be called with an explicit receiver. in order to access private info we have to create public methods such as `attr_reader` and `attr_writer`. These are shorthand notations for defining getter and setter methods within a class for instance variables. Important in object orienting encapsulation principle. 

module - a toolbox that contains a set of methods and constants. These are written in CamelCase. Constants included in methods are defined with all caps. 

name-spacing - how ruby separated methods and constants.
scope resolution operation - ruby's way of saying it tells rubys where you're looking for a specific bit of code. 

If we say `Math::PI` ruby knows to look inside the math module to get that PI, not any other PI. 

In the following code : `def initialize (name, balance=100)`
This signifies an optional parameter
Ruby is saying that you can pass 1 or 2 arguments to `initialize`. If you pass 2, it uses your balance argument to set `@balance`. If you only pass `name`, `balance` gets a default value of 100 and this is what is stored in `balance`. 

In Ruby , private methods can be called without an explicit receiver within the context of a class.
Understanding Memory Management in Rust
Tags: rust, tutorial, programming, productivity
Published: 2024-03-20 00:29:00

## Introduction

Rust is a modern systems programming language that provides strong memory safety while maintaining high performance. As with any programming language, efficient memory management is crucial in Rust to prevent issues such as memory leaks and dangling pointers. In this article, we will explore the concepts of memory management in Rust and how it differs from other languages.

## Advantages of Memory Management in Rust

1. **Ownership and Borrowing Model:** Rust uses a unique ownership model where each variable has a single owner. This prevents multiple threads from simultaneously accessing the same data, eliminating data races.
2. **No Garbage Collection:** Unlike languages like Java and C#, Rust does not have a garbage collector. This reduces overhead and allows for better control over memory usage.
3. **Built-in Memory Safety Checks:** Rust's compiler performs strict memory safety checks at compile time, preventing common errors like buffer overflows and dangling pointers.

## Disadvantages of Memory Management in Rust

1. **Steep Learning Curve:** The advanced concepts of ownership, borrowing, and lifetimes in Rust can be challenging for beginners to grasp.
2. **Requires Explicit Memory Allocation:** Rust does not have automatic memory allocation, so programmers need to manually allocate and free memory when needed.

## Features of Memory Management in Rust

1. **Memory Layout:** Rust provides control over the layout of data in memory, enabling developers to optimize memory usage.
2. **Safe Pointers:** Rust's pointer types, such as raw pointers and reference pointers, ensure type and memory safety.
3. **Memory Sharing:** Rust's borrowing mechanism allows for multiple references to the same data, enabling efficient memory sharing without sacrificing safety.

### Example of Rust's Ownership and Borrowing

```rust
fn main() {
    let s1 = String::from("hello");
    let s2 = s1;

    // This will cause an error because s1's value has been moved to s2
    // println!("{}, world!", s1);
    println!("{}, world!", s2);
}
```

In this example, the ownership of the string "hello" is moved from `s1` to `s2`. Attempting to use `s1` after the value has been moved will result in a compile-time error, showcasing Rust's strict ownership rules.

## Conclusion

In conclusion, Rust's memory management features provide a balance between performance and safety. The ownership and borrowing model, along with built-in safety checks, make it easy to write efficient and secure code. However, this also comes with a learning curve and a need for explicit memory management. Overall, understanding memory management in Rust is crucial for writing secure and performant applications.
Welcome Thread - v268
Tags: welcome
Published: 2024-03-20 00:00:00

---
published_at : 2024-03-20 00:00 +0000
---
![Bill Hader's character Stefon on SNL waving](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqo2xkvpl0gft3at3oyu.gif)

---

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

3. Come back next week to greet our new members so you can one day earn our [Warm Welcome Badge](https://dev.to/community-badges?badge=warm-welcome)!
Going Green with Paper Egg Cartons: Easy Steps for a Greener Tomorrow
Tags: papercarton, eggcarton, ecofriendly, sustainability
Published: 2024-03-19 23:06:37

**Introduction**

In today's world, looking after our planet is super important. Small changes can make a big difference, like switching to eco-friendly paper egg cartons. But why are these cartons so cool, and why should you use them? Let's break it down.

**Why Eco-Friendly Paper Cartons Are Awesome**

Traditional egg cartons are usually made of plastic or foam, which isn't great for the environment. But eco-friendly paper cartons are different. They're made from recycled materials, like old newspapers or cardboard, which means we're giving stuff that would've been thrown away a new life.

**What Makes Them Special**

These paper cartons aren't just good for the planet; they're also really good at keeping your eggs safe. They're strong and sturdy, so your eggs won't get squished or broken on their way home from the store. Plus, when you're done with them, you can toss them in the recycling bin, and they'll break down without causing any harm to the environment.

**Easy Ways to Make a Difference**

Making the switch to eco-friendly paper egg cartons is easy. Next time you're at the store, just look for the ones made from recycled materials. They're usually right next to the regular cartons, and they cost about the same too. By choosing eco-friendly options, you're doing your bit to help the planet without having to make any big changes to your routine.

**Join the Green Team**

Using eco-friendly paper egg cartons might seem like a small thing, but it's actually a big deal. It's a simple way to make a positive impact on the environment and show that you care about protecting our planet. So why not give it a try? Together, we can make a big difference, one egg carton at a time.

For more information, visit: https://poultrycartons.com/