teleren/devto huggingface dataset:
Making mental model for Kafka
Published: 2024-03-28 16:15:13

I always get lost when trying to understand concepts like Kafka and messaging queues. Because before diving into a new technology or system, it's crucial for me to have a holistic view of how it works. The same challenge arises when I'm learning about Kafka.
However, recently on Discord in a private server, someone explained Kafka so clearly that it finally made sense to me. Here's how they explained it
well its not a detailed post on kafka but to make a picture of it
--
Asynchronous messaging plays a pivotal role in modern software architecture, particularly when it comes to decoupling components and improving response times. By leveraging message queues, we can separate the generation of events (producer) from their processing (consumer) in a highly efficient manner.

Consider a scenario where a user signs up on a platform, triggering multiple tasks such as sending emails or performing checks with external services (TaskA, TaskB, TaskC). If these tasks were handled synchronously, the system would have to wait for all tasks to finish before responding to the user, leading to increased response times.

However, adopting an asynchronous approach with a message queue allows us to queue these tasks and promptly respond to the user without waiting for task completion. This significantly reduces response times as tasks are processed independently by consumers, which could be services like mail servers or external check handlers.

One of the prominent tools in this domain is Kafka, widely utilized in streaming applications and microservices architecture. For instance, when an event occurs in serviceA (e.g., a product order), serviceA can publish this event to Kafka. Other services responsible for tasks like inventory management or order processing can then consume these events from Kafka, thus decoupling serviceA from the rest of the system. This decoupling enables scalable and flexible architectures where services can communicate seamlessly without being tightly coupled.


![Kafka digram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x46xjsbuo4r6u0691ynw.PNG)
Find memory address in Rust
Tags: rust, learning
Published: 2024-03-27 17:30:51

This code demonstrates a few concepts: variable declaration, value printing, converting a numeric value to its byte representation, iteration with enumeration, and printing memory addresses.


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

```
fn main() {
    // convert and find address
    let x: u32 = 32;
    println!("The Value of x is:{}",x);

    // Convert x to bytes and print each byte
    let bytes = x.to_ne_bytes(); // Covert to native endian bytes order
    for (i, byte) in bytes.iter().enumerate(){
        println!("Byte {} of x: {:08b}", i , byte);
        
    }

    println!("The address of x is: {:p}" ,&x);
    println!("The address of x is: {:p}", &x as *const u32);
    println!("The address of x is: {:p}", &x as *const _);
    
}
```

Converting to Bytes and Iteration:

`let bytes = x.to_ne_bytes(); // Convert to native endian bytes order`

The to_ne_bytes method converts the integer `x` into an array of bytes in the native endian order of the machine (either little or big endian, depending on the architecture).

```
for (i, byte) in bytes.iter().enumerate(){
    println!("Byte {} of x: {:08b}", i , byte);
} 
```

This loop iterates over the byte array. The enumerate method adds a counter `(i),` and for each byte in bytes, it prints the byte's index and its binary representation (:08b formats the byte as an 8-bit binary number).

Printing Memory Addresses:

`println!("The address of x is: {:p}" ,&x);`

This prints the memory address of `x.` The `:p` formatter is used for pointer types, and &x takes the address of `x.`

`println!("The address of x is: {:p}", &x as *const u32);`

This is similar to the previous line but explicitly casts the reference &x to a constant pointer type *const u32.

`println!("The address of x is: {:p}", &x as *const _);`

This line also prints the address of `x,` but uses type inference (_) for the pointer type. It's essentially saying "treat `&x` as a constant pointer to some type, but I don't care to specify what that type is."

The result:

```
The Value of x is:32
Byte 0 of x: 00100000
Byte 1 of x: 00000000
Byte 2 of x: 00000000
Byte 3 of x: 00000000
The address of x is: 0x16db4e474
The address of x is: 0x16db4e474
The address of x is: 0x16db4e474
```
Renaming variables in Swift closure capture lists
Tags: swift, swiftui, ios
Published: 2024-03-28 16:00:00

If you have written any Swift code, you probably have seen capture lists. Let me show them to you in case you're not sure what they are:

```swift
class Some {
  var number: Int = 42

  func method() {
    someNetworkRequest(callback: { [weak self] result in
      self?.number = result //     ^ this thing right here
    })
  }
}
```

That thing between the square brackets (`[ ]`) is the capture list. It allows us to define the context of the callback. In this case, we capture `self` weakly, to avoid memory cycles.

## The problem

With the introduction to iOS 17, SwiftUI gained a new `View` modifier: `onChange(of:action:)` where `action` takes two values, the old one and the new one. This allows code such as:

```swift
struct Some: View {
  @State private var isCreating: Bool = false

  var body: some View {
    Text("")
      .onChange(of: isCreating) { wasCreating, isCreating in
        guard wasCreating && !isCreating else { return }
        print("Finished creating")
      }
    }
}
```

> _This is just a simplified example to show the modifier. Just imagine that instead of a `Bool` we are using an enum with many cases._

On iOS 16 and prior, the modifier only provides the new value, making it difficult to check the current value and the previous one. There is however, a small workaround using capture lists:

```swift
onChange(of: isCreating) { [isCreating] newValue in
  guard isCreating && !newValue else { return }
  print("Finished creating")
}
```

Using a capture list, we can capture the current value, which is equivalent to the old value. And the callback provides us with `newValue`.

## The solution

The previous code works, but the naming is awkward. `isCreating` points to the old value, and `newValue` is too generic. We could rename it to `newIsCreating`, but still, not the best name.

Here is when renaming variables inside the capture list shines. Let's look at the example:

```swift
onChange(of: isCreating) { [wasCreating = isCreating] isCreating in
  guard wasCreating && !isCreating else { return }
  print("Finished creating")
}
```

Inside the capture group, we are declaring a new variable `wasCreating` which the value of the captured variable `isCreating` (the old value). Then the callback provides us with `isCreating` (the new value)

## Finishing

The examples shown may be obsolete with iOS 17 new modifier, but there are a lot of developers supporting iOS 16 and below. I wrote this article solving the exact problem I faced, but I'm sure there will be many, many situations where renaming a variable would be very helpful.
How to start with react
Published: 2024-03-28 15:51:47

We all know React is a framework even the birds on trees but it can be hard sometimes today we are going to be talking about react and how to use it. React is used in alot of places like Facebook,Instagram,Facebook marketplace ,etc.
It is recommmended to use Vite or Next with it today we will use vite to make a simple app with react.Lets start firsty we want to make a new vite project we can do that by running

```
npm create vite@latest
```

this will create our project. Two
You may be thinking how to inplement react when it gives you the option to chose a framework choose React today we will use Javascript so chose Javascript

it should look like this 

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

 Now lets make our app so
run

```
cd /yourprojectname
```

and run

```
npm install
```

we reccomend to use VS code for this project

now edit App.jsx


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

Remove everything in this part 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cwh54ftvy32s6pqx6q2v.png)

it should look like this


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


To make our app type this in the return

```
<h1>Hello Vite + React</h1>
```

and oh yeah we forgot something so lets run our server so run

```
npm run dev
```

now when we go to 

```
http://localhost:5173
```

it should look like this


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

now add this before the H1

```
 <a href="https://vitejs.dev" target="_blank">
          <img src={viteLogo} alt="Vite Logo" />
        </a>
        <a href="https://react.dev" target="_blank">
          <img src={reactLogo} alt="React Logo" />
        </a>
```

now when we save this is what we see


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


Happy coding
"Day 52 of My Learning Journey: Setting Sail into Data Excellence! ⛵️ Today's Focus: Maths for Data Analysis ( Per & Comb - 7)
Tags: data, datascience, dataengineering, developer
Published: 2024-03-28 15:25:57

PERMUTATION AND COMBINATION - 7



Combination ( Or Selection )


It has two concept 

Selection of different objects
Selection of alike objects.


Combination ( or selection of different objects )
Q1. Consider 4 different balls 
A,B,C,D
In how many ways can we select a ZERO ball ?

Sol. There are 1 way.

Q2. Consider 4 different balls 
A,B,C,D
In how many ways can we select ONE ball ?

Sol. There are 4 ways.


Q3. Consider 4 different balls 
A,B,C,D
In how many ways can we select TWO balls ?

Sol. There are 6 ways.
        AB , BC, AC, AD, BD, CD


Q4. Consider 4 different balls 
A,B,C,D
In how many ways can we select THREE balls ?

Sol. There are 4 ways.
        ABC, BCD, ABD, ACD

Q5. Consider 4 different balls 
A,B,C,D
In how many ways can we select FOUR balls ?

Sol. There are 1 way.
        ABCD



SELECTION 
HERE EQUATING  (=)  HELP US TO KNOW THE NO. OF WAYS.
0 = ALL ( 1 WAY )
1 = N-1 
2 = N-2
3 = N-3   



100 BALLS
IN HOW MANY WAYS WE CAN SELECT ZERO BALLS = 1 WAYS
IN HOW MANY WAYS WE CAN SELECT ONE ABLLS = 100 WAYS
IN HOW MANY WAYS WE CAN SELECT TWO BaLLS = 

Now it is interesting 

100 * 99 / 2! * 98!

While  selection arrangement does not count.

In how many ways we can select ‘r’ balls = 100!  / r! * ( 100-r )!



In general  = n! / r! * ( n-r)!   = nCr

Total number of ways of selection of ‘r’ different objects out of n- different objects.

🙏 Thank you all for your time and support! 🙏
Deposit-Free Rental Solutions in Singapore
Tags: rent, deposit, asia, singapore
Published: 2024-03-28 15:23:06

The concept of deposit-free living is revolutionizing the rental market in Singapore, offering a breath of fresh air for both tenants and landlords. Securing a rental property traditionally involved hefty deposits, often equivalent to several months’ rent, creating a significant financial burden for tenants. [Deposit-free rental solutions](https://www.rently.sg/blog/the-rental-maze-what-really-matters-to-tenants) are emerging as a game-changer, eliminating the need for these upfront costs and fostering a more accessible and flexible rental landscape.

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

## The Rise of Deposit-Free Rentals in Singapore

Singapore’s rental market is witnessing a transformative shift with the introduction of deposit-free rental solutions. This innovative approach is gaining traction, driven by the city-state’s constant pursuit of efficiency and inclusivity in its housing policies. Deposit-free solutions are becoming increasingly popular as more people seek flexible and less burdensome rental options.

[Continue reading about Deposit-Free Rental Solutions in Singapore](https://medium.com/@rentlysingapore/deposit-free-rental-solutions-in-singapore-478b72afdfd2)
ModernPools - Modern turnkey pool builder
Published: 2024-03-28 15:14:22

[ModernPools](https://www.modern-pools.com.ua/) successfully manufactures and installs turnkey plastic pools, sand pools, concrete pools, composite pools, hydromassage spa jacuzzis, baths, saunas, hamams. It also supplies safety cover, solar sheeting, heat pumps, outdoor pool fencing, other pool equipment and accessories, which are installed both in the residential segment and in hotel complexes, recreation centers and restaurants.
Best Website Development Services in worldwide
Tags: javascript, beginners, programming, tutorial
Published: 2024-03-28 15:09:45

We offer mobile-friendly, fast-loading, and modern-looking website development services at very low prices. Best UI/UX, Conversion Rate, and SEO Friendly, all tailored to enhance your online presence with top-notch [web development services](https://ramamtech.com/web-development-services).
Data Structures and Algorithms (DSA) beginner-friendly resources
Published: 2024-03-28 15:09:26

For those starting out with Data Structures and Algorithms (DSA), here are some beginner-friendly resources to help you get started. These resources have been personally used and found to be extremely beneficial.


𝐃𝐒𝐀 𝐂𝐨𝐮𝐫𝐬𝐞 𝐁𝐲 𝐒𝐭𝐮𝐝𝐲 𝐓𝐨𝐧𝐢𝐠𝐡𝐭: This course provides an engaging way to learn about basic Data Structures such as Stack and Heap. It's like reading a blog but with interactive features, and no sign-in is required.

Link —→ https://www.studytonight.com/data-structures/


𝐀 𝐕𝐢𝐬𝐮𝐚𝐥 𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧 𝐭𝐨 𝐀𝐥𝐠𝐨𝐫𝐢𝐭𝐡𝐦𝐬 𝐁𝐲 Educative.io: This course simplifies the learning of algorithms with visualizations, easy-to-understand explanations, and practical implementations. It's designed to make learning algorithms enjoyable.

Link —→ https://www.educative.io/courses/visual-introduction-to-algorithms


𝐌𝐢𝐜𝐡𝐚𝐞𝐥 𝐒𝐚𝐦𝐛𝐨𝐥'𝐬 𝐘𝐨𝐮𝐓𝐮𝐛𝐞 𝐂𝐡𝐚𝐧𝐧𝐞𝐥: If you prefer short and concise video tutorials, Michael Sambol's channel offers quick explanations for various algorithms in videos that are typically less than 4 minutes long.

Link —→ https://www.youtube.com/@MichaelSambol


Feel free to explore these resources and begin your DSA journey with confidence. Happy learning! 🚀
Meet Tilly: Crafting a Cute Tiger with CSS Magic
Tags: frontendchallenge, devchallenge, css
Published: 2024-03-28 15:04:02

---
title: Meet Tilly: Crafting a Cute Tiger with CSS Magic
published: true
tags: frontendchallenge, devchallenge, css
---

_This is a submission for DEV Challenge v24.03.20, CSS Art: Favorite Snack._

## Inspiration
Some time ago I was on a streak at cssbattle.dev. That was a lot of fun. And when I saw this challenge I knew I had to submit something cool. The idea came from a puzzle game from my godchild.

## Demo 
_Hint hover over Tilly_
{% codepen https://codepen.io/torbentee/pen/NWmjwbE %}

## Journey 
Most parts where quiet straightforward because I have some experience from cssbattle.dev. But the mouth and the straight line above it where very difficult. I tried different things and came up with a "U" and hiding some crooked parts beneath the vertical line. Which is actually several lines which are in a slight angle. All in all was is a fun journey to build a cute little tiger named Tilly.


## License
MIT License

Copyright (c) [2024] [Torben Tietze]
Good morning to Community! Introdução a API com 256 caracteres ou 32 caracteres:
Published: 2024-03-28 15:03:05

Cabeçalhos compatíveis.


Header          - Descrição - Método - Exemplo

Authorization.  - Seu token - Todas  - 
                  de portador

x-api-key       - Sua chave - Todas -   
                  de API         5102885b24cbd003d33c0

x-jw-ims-org-id - Sua ID da - Todas - 
                  organization   234bc00234caf0faa6f99

Content-Type   -  Formato   - PUT, - application/json
                  do conteúdo POST     
                  enviado ou
                  recebido

Accept-        -  Idioma    - Opcional - en-US                  
Language          usado para
                  mensagem
                  de erro




Parâmetros de POI.



Parâmetro    -   Descrição     -   Tipo    -   Limite

street       -   Endereço do   -   string  -    256
                    POI                        caracteres

country      -   País de       -   string  -    32 
                    POI                        
                                            caracteres
Learn Kotlin basics! with newbies
Tags: python, kotlin, beginners, learning
Published: 2024-03-28 14:55:11

According to me , you can go through the basics of Kotlin using the free w3schools website tutorial for it .
Here is the link for it  
https://www.w3schools.com/kotlin
LET'S TAKE THESE NOTES AS WELL-------
............>>>>>>>>>>>>>>> feel free to share this PDF with anyone for free,
latest version of it's notes book can be downloaded from:
https://goalkicker.com/KotlinBook
CSS Art - simple burger
Tags: frontendchallenge, devchallenge, css
Published: 2024-03-28 14:52:39

This is a submission for DEV Challenge v24.03.20, CSS Art: Favorite Snack.

I know, this is bad for health and planet. But apart from that, what's not to like ? 
Feelin' empty ? Go meaty !

{% codepen https://codepen.io/Cyril-FERRER/pen/ZEZXzEe %}

That "simple" burger is my very first pure CSS Art. A deliciously convoluted way to display a image !

Next time (yes, there will be more attempts), it will be interesting to refactor the code and to use SCSS, in order to increase the level of details ^^

***
The link for the codepen :
https://codepen.io/Cyril-FERRER/pen/ZEZXzEe

***
MIT License

Copyright (c) [2024] [FERRER Cyril]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Creating a "Hello, World!" Application with Django and Python
Tags: python, django, helloworld, webdev
Published: 2024-03-28 14:47:51

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It's built by experienced developers and takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel. In this article, we'll walk through the process of creating a simple "Hello, World!" application using Django.

**Step 1: Install Django**

Before we start, ensure you have Python and pip (Python's package installer) installed on your system. If not, you can download Python from the official site and pip will be installed along with it.

Once Python and pip are installed, you can install Django using the following command in your terminal:

`pip install django`

**Create a New Django Project**

After installing Django, the next step is to create a new Django project. This is done using the following command:

`django-admin startproject myproject`

Replace "myproject" with the name you want for your project. This command will create a new directory with the same name as your project, containing the necessary files for a Django project.

**Step 3: Create a New Django Application**

In Django, a project can consist of multiple applications. Let's create a new application within our project using the following command:


`python manage.py startapp myapp`

Replace "myapp" with the name you want for your application.

**Step 4: Write the "Hello, World!" View**

In Django, a view is a type of web response. A simple "Hello, World!" view can be created by editing the views.py file in your application directory. Replace its content with the following:


`from django.http import HttpResponse

def hello(request):
    return HttpResponse("Hello, World!")`

**Step 5: Map the View to a URL**

Next, we need to map the view to a URL. This is done by editing the urls.py file in your project directory. Replace its content with the following:


```from django.urls import path
from myapp.views import hello

urlpatterns = [
    path('', hello),
]```

**Step 6: Run the Server**

Finally, you can run the Django development server to see your "Hello, World!" application. Use the following command:

`python manage.py runserver`

Now, if you navigate to http://127.0.0.1:8000/ in your web browser, you should see your "Hello, World!" message.

**Conclusion**

In this article, we've walked through the process of creating a simple "Hello, World!" application using Django and Python. This is just the beginning of what you can do with Django. With its robust set of features and extensive documentation, Django is a powerful tool for web development. Whether you're building a small personal project or a large-scale web application, Django provides the infrastructure you need to develop quickly and efficiently.
🏏 5 Incredible Reasons to IPL Fantasy Cricket :
Published: 2024-03-28 14:42:51

1. Spectacular Action: In exciting matches, the IPL features the best cricket players in the world. Feel the heart-pounding intensity as the best cricket players compete on the biggest stage, creating memories with every match.

2. Global Action: IPL connects followers worldwide, cutting across national boundaries. Come celebrate the sport's worldwide appeal and cultural diversity with a diverse community of cricket aficionados from around the world.

3. Excitement to the Core: Playing fantasy cricket provides an individual experience. Assemble your ideal squad, plan ahead carefully, and play exciting, tailored head-to-head matches to create the cricket experience of your dreams.

4. Skill Enhancement: Strategy is key to winning at fantasy cricket. Explore player stats, understand tactical nuances, and sharpen your cricketing acumen to win the virtual arena.

5. Fun with Rewards: Fantasy cricket offers more than just excitement; it also offers financial incentives. Enjoy the excitement of winning, turn your love of cricket into real money, and remain up to speed with developments that happen in real time.

Enter the electrifying world of [IPL Fantasy Cricket](https://sciflare.com/fantasy-cricket-app-development/), where there are always exciting stories to be discovered in every match. Assemble your team, welcome the thrill, and set out on a cricket adventure unlike any other!

[Contact us](https://sciflare.com/contact/) to start creating your own [fantasy cricket](https://sciflare.com/fantasy-cricket-app-development/) app.