teleren/devto huggingface dataset:
What does 'batching' mean when we're talking about Apache KafkaⓇ?
Tags: apachekafka, beginners, todayilearned, programming
Published: 2022-10-28 20:14:27

Today I learned that when you hear the word 'batch' in the context of Apache Kafka, it can mean one of two things:

1. A reference to batch-only data processing systems. Batch-only systems process data in a _bounded_ way. That means that there's a[ start time and an end-time](https://www.oreilly.com/library/view/introduction-to-apache/9781491977132/ch06.html). Whether this batching is done in large or micro-batches, it is processed all at once. That's in contrast to the continuous data streaming that Apache Kafka enables, in which data is processed in event-sized pieces. 

2. Within the data streaming context, there's something called producer batching. It's a bit of a misnomer because it's not really related to the batch-only data processing systems. A Kafka producer, the client that publishes records to the Kafka cluster, compresses messages via a process called batching to increase throughput. This batching is part of the process handling data at once and in event-sized pieces, so it doesn't mean the same thing as batch-only data processing.

In conclusion, 'batching' means, in a very general way, 'grouping stuff together'. But 'producer batching' and 'batch-only data processing systems' do not share the term in any significant sense, because they are referring to the completely different functions I described above.
Is programming hard? ...The way I see it.
Tags: beginners, devjournal, jokes, programming
Published: 2022-10-28 19:55:24

Many people are interested in the tech field, but they have one question: how difficult is it? I pondered about it for a long time and came to the conclusion that programming is as difficult as male-female interactions. Consider this: if you approach someone you're interested in and they reject you at first, it doesn't imply they won't accept you later; nevertheless, you'll never know unless you try. So the best approach to finding out if programming is for you is to dive in and don't give up because you can't install a software package or your first few lines of code are producing an error; it could simply be playing "hard to get."

## Lovers spat
Let's imagine you've scaled through your first few lines of code; just know that no matter how smart you are, you will encounter a bug at some point. It is similar to how a couple, no matter how in love they are, quarrels from time to time. Most of the time, it's just a miscommunication. So, if you write code that the compiler or interpreter doesn't comprehend, it will throw a large error, which is normal; that's part of the learning process. There are numerous programming forums, such as Stack Overflow, that can assist you in resolving your problem. However, it is preferable if you can locate someone more experienced in that language than you who can offer you some time so that you and your beloved code can get to couples' counseling.

## I love them all I want them all
Just as some people must be perplexed by the dating pool due to the various attractive girls and handsome males they encounter, an aspiring programmer may be perplexed by the numerous programming languages and frameworks available. The truth is that you must decide what you want to learn each time, or you will begin to mix them up. just as a boy might start calling a lady by another girl's name. More importantly, you must understand a language and a few of its frameworks in order to create a comprehensive production-ready work. If you keep jumping from language to language framework to framework, you may never settle on one and build a family, oops  I mean an app.

## Obsessed with looking young
Have you ever met someone who is so preoccupied with looking young that they appear to be younger than their children? Some frameworks are so preoccupied with upgrades that a major version is released every six months. They might even launch a new version while you are still learning. So, at the very least, avoid these frameworks at the start of your learning journey. Beginning with such frameworks might be a perplexing experience.

Finally, avoid learning a dead language or framework, and avoid asking YouTube or Google if the language is dead. Find out how many job possibilities there are in it and how much they pay.

Watch the video

{% embed https://youtu.be/xGIebnRhVnE %}
Week 6: search index and distribution
Tags: rdoc, sqlite, markdown, aws
Published: 2022-10-28 19:53:03

This is a third progress report for a command line tool called "Posh TUI". It's an API documentation browser —like [Dash](https://kapeli.com/dash), but for your console.

Software is not yeat available, but there is a [limited pre-sale for a lifetime license](https://skatkov.gumroad.com/l/pxbxx). It includes all future updates for free, but also I'll be closely listening to feedback and will be building future roadmap based on it.

## Recap

Previously I have explained, that project consists of two big parts that need to work together.

- Documentation generation and hosting
- TUI app that would allow to review/search documentation

Since I'm unable to render html in console, documentation have to come in form of Markdown. Two weeks ago, I embarked on a journey to build RDoc plugin to generate markdown documentation for Ruby and libraries.

## Progress report

### RDoc-markdown gem

[![](https://asciinema.org/a/1dtu94Spv0UfylwTRJksyk7Nx.png)](https://asciinema.org/a/1dtu94Spv0UfylwTRJksyk7Nx) Building markdown documentation and previewing it!

I'm excited to report, that I completed rdoc-markdown gem. Version 0.3 of this library produces not only markdown files, but also search index file. It probably still has some quirks that would need fixing, but this is already enough for me to move forward and build a TUI client.

Since plugin was built as open source, I made sure that it's easy to approach for collaborators. Don't be shy and take a peak! I'm always open to feedback.

While working on TUI client, I'll be showing off this plugin in different ruby communities. This may yield some great improvements and feedback or will just pass unnoticed.

### Docsets delivery

Another part of puzzle is how to deliver docsets, to smplify things I decided to just distribute all docsets as one archive. Docsets includes only ruby language and Ruby on Rails frameworks that did not reach end of life. In terms of size, that's not a big package to download.

This delivery mechanism will not scale well with more docsets. But I guess that will be a good problem to have later. For now, I can just skip all of it.

I have packaged 3 latest Rails release and 3 latest Ruby releases. And currently using those for local tests.

I did [apply for Free AWS credits](https://aws.amazon.com/free/) as a startup founder and got approved within 2 days. Now I'll have credits to distribute these free of charge for myself. Thank you, Amazon.

## What's next?

At this stage, most of the "back office" things are finished, and I'm ready to work on a client facing TUI app. My goal for next 2 weeks would be to deliver first prototype to existing customers.

It might not do much, but it should already be possible to play around with it and have a reliable delivery mechanism where people can validate their licenses and update their software.

Off I go to work on most exciting part of this project!
Discussion and Comment of the Week - v22
Tags: bestofdev
Published: 2022-10-28 19:51:20

This weekly roundup highlights what we believe to be the most thoughtful and/or interesting discussion of the week. We're also be highlighting one particularly cool comment in each installment. 🙌

The DEV Community is particularly special because of the kind and thoughtful discussions happening between community members. As such, we want to encourage folks to participate in discussions and reward those who are initiating or taking part in conversations across the community. After all, a community is made possible by the people interacting inside it.

## Discussion of the Week

Gotta give it up for @shahednasser for initiating a super helpful discussion around underrated tools! 🙌

{% embed https://dev.to/medusajs/whats-an-underrated-tool-that-more-developers-should-know-about-2mk2 %}

There are loads of great suggestions throughout the discussion section of this post. Vivaldi, Alfred, vim, fig... the list goes on and on. If you're looking for tools and productivity hacks, hop in there. If you know of some that haven't been mentioned, please share! 🙌

Side note: if you like participating in (or even just tuning into) discussions follow @shahednasser for lotsa good ones!

## Comment of the Week

As for our comment of the week, this one goes to @panditapan for their response to @maddy's entertaining and instructive [7 Key Red Flags To Watch For In Software Job Listings](https://dev.to/maddy/7-key-red-flags-to-watch-for-in-software-job-listings-1m7b): 

{% embed https://dev.to/panditapan/comment/22fc7 %}

Pandita chimes in with a well put eighth point, noting interviews that trail on and on forever and ever are more hassle than they're worth. While I can appreciate trying to select the best candidates for the job, 10 stages is pretty ridiculous! And, as Pandita puts it in a follow-up response to Maddy 👇, it just seems unnecessary and could easily be avoided.

{% embed https://dev.to/panditapan/comment/22ff2 %}

Lesson to recruiters and those in hiring, for the sake of your candidates try to keep your interview process as streamlined as can be.

## What are your picks?

There's loads of great discussions and comments floating about in this community. These are just a few we chose to highlight. 🙂

I urge you all to share your favorite comment and/or discussion of the past week below in the comments. And if you're up for it, give the author an @mention — it'll probably make 'em feel good. 💚
GitHub.com Magic Tip
Tags: github, webdev, productivity, devops
Published: 2022-10-28 19:48:34

I'm sure the majority of developers are aware, but if you're not, visit GitHub.com, open any repository, and press . (dot) button and see the magic. 

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

Make sure you are logged in with your GitHub account.
Reflections
Published: 2022-10-28 19:41:44

The past four months have been a WHIRLWIND. Over the course of my time in Flatiron's Software course, I learned so much and met many incredible people. Read on to hear more about my experience with Flatiron.

I'll start off by talking about why I chose to do a tech bootcamp. My introduction to programming was somewhat unconventional. It occurred early on in my life and accidentally while playing the computer game MarbleBlast Gold. I had completed all of the levels and wanted a new challenge, so, at ten years old, I turned to the internet in hopes of finding additional levels. I unfortunately did not find any new levels, but I did find a Youtube tutorial demonstrating how to modify the levels that already existed. 

After following the tutorial, I had written my first lines of code. But I didn't know this at the time. All I knew was that I had typed some weird-looking words and symbols into a big black box, and had been able to customize the levels in my favorite game.

Fast forward 10+ years, and I found myself feeling unchallenged at work. I missed using my brain to solve complex problems, and knew that no amount of crossword puzzling would fill that void. I learned about tech bootcamps from a family friend who had completed one, and I started looking into them. I took the plunge and enrolled at Flatiron after dipping my toe into the programming pool through some free courses, and I'm so glad that I did.

Going into a tech bootcamp, I had some expectations and tons of questions. I knew that I would come out of the bootcamp with the ability to conceptualize, design, and build websites, but I really had no idea what that entailed. What was a backend? How did it communicate with a frontend? When would I start cracking cringey coding jokes? (The answer to that last one was two weeks in. What's a ghost's favorite data type? A BOOlean! Awful, I know)

Now, four months later, I have answers to all of those questions and so many more. I learned that JavaScript can be vanilla, which I guess makes frameworks such as React spicy? And I learned that Semantic UI can be both a help and a hinderance. Most importantly, though, I learned which parts of the app-building process I enjoy most and which parts make me want to escape from reality by blasting pop-punk.

Angst aside, I have enjoyed these past four months so much. I feel empowered and prepared to enter the job market, hiring freezes be damned. I plan to take the skills I gained over the past several months to a career focused on bridging the gap between tech and business, and I am excited to do so.
Astro Build like an Astronauts!
Tags: javascript, webdev, programming, beginners
Published: 2022-10-28 19:31:40

**What is Astro build?**
[Astro](https://docs.astro.build/en/getting-started/) is a content focused frontend web framework, which is build so fast. Its comes with new architecture which is developer friendly and flexible to use.

**How does it work?**
Simply run a command with your favaouite package (npm, yarn, pnpm) manager then it will create a static project. But when you run astro command that will ask some questions, its recommended strict site use, if you want to change you can change it also it has some pre built projects, you can select any project from the list or you choose a blank project. Have fun!

Run Command:
- Yarn: yarn create astro
- Npm: npm create astro@latest
- Pnpm: pnpm create astro@latest

**Why choose Astro Build for your project?**
Well, Essentially a build system, Astro takes a promising new approach to front-end JavaScript. It content focused that means its fast build for content. Have a look Astro key features.

**Component Islands:** A new web architecture for building faster websites.
**Server-first API design:** Move expensive hydration off of your users’ devices.
**Zero JS, by default:** No JavaScript runtime overhead to slow you down.
**Edge-ready:** Deploy anywhere, even a global edge runtime like Deno or Cloudflare.
**Customizable:** Tailwind, MDX, and 100+ other integrations to choose from.
**UI-agnostic:** Supports React, Preact, Svelte, Vue, Solid, Lit and more.

**How difference from others frontend UI Build?**
It has lots of integrations to according to our requirement for a project and also much better customizable which is better than from Gatsby. It also a powerful feature which is called @astro/mdx. It like JSX that means you can use code and import other files in .mdx and also you can treat as md file. Which is makes Astro is an astronauts! 
Seriously once you try this you’ll love it. 
I hope for lots of functionality ahead in the future from Astro build.
Ruby on Rails Serializers
Tags: ruby, beginners
Published: 2022-10-28 19:27:43

## Serializers

What is a Serializer? 

ActiveModel::Serializers allows you to gather the information you wish to be rendered from the specific model. With the right relationships in place this can become the most amazing gem you come by in Ruby.


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

In my most recent project you can see I used my `User Serializer` to help create an image Url for an uploaded image. As well as rendered the pets that were correlated to the `User`. In the `attributes` section in the `Serializer` is where you choose what attributes from the given model you wish to display when rendering. 

This allowed me to fetch my full user information without having to do multiple fetch request and doing a filter on the pets to compare the user id to the owner id that is in the pet model. 

With the help of the Serializer, you can see above that I was able to design how the `:featured_image` element was being displayed in the fetch. I choose to do it that way, because if the image wasn't posted correctly it wouldn't add that attribute to the post request, which allowed me to render a default image in return. 

You can use this in many different ways and I only began exploring how much you can do with `Serializers`. Can't wait to see what more I can learn
Displaying Validation Errors on Frontend (React & Rails)
Tags: webdev, beginners, react, programming
Published: 2022-10-28 19:11:57


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

## Introduction

Do you want to know how to display your validation errors on the frontend of your application? Then, follow along! If you have your backend set up properly, you should have a private method in your application controller that displays an object with the key, errors. It should look something like this: 

```
class ApplicationController < ActionController::API
    rescue_from ActiveRecord::RecordInvalid, with: :invalid

...

private 

def invalid(e)
    render json: { errors: e.record.errors.full_messages }, 
    status: :unprocessable_entity
end
```

## Displaying Errors on Frontend

Now that you have your backend set up, we can move to the frontend to display these errors for the user. In the component where we would like our errors to be shown, we will need set a state for these errors with an initial value as an empty array ([]). 

```
import React, {useState, useEffect} from 'react';

export default function OurComponentFunction() {
   const [errors, setErrors] = useState([])
...
}
```

Then, wherever you are fetching the data for which you want the errors to be displayed, you will need to create an if statement. The if statement will state that if there are errors associated with the data, then you will set the errors state with those specific errors. If there are no errors, then the frontend will carry on as expected and display the data needing to be displayed. In the example below, we fetching from "food" and trying to create a new food post. 

```
function handle Submit(e) {
  e.preventDefault();
  fetch("/food", {
     method: "POST", 
            headers: {
               "Content-Type": "application/json",
                accepts: "application/json",
              },
            body: JSON.stringify({
               name: name, 
               category: category
            }),
        })
            .then((r) => r.json())
            .then((data) => {
                if(data.errors) {
                   setErrors(data.errors)
                } else {
                   addNewFoodToArray(data)
                }
            })
 }
```

Now, that we have our errors being set in the errors state, we need to render it so that it can be shown on the application browser for the user. We will need to map through all the errors in the errors state so that we can return each error individually in an element tag of your choice. In the example below, we are using the 'p' tag. 

```
return (
...
   {errors.map((error) => {
       return <p>{error}</p>
   }
)
```

## Conclusion

Finally, you have the tools and knowledge to try displaying your own errors on your application browser for the user to see! Go ahead and give it a try!
Function Friday – Xpath
Tags: development, flow, functionfriday, powerautomate
Published: 2022-11-03 17:53:53

---
title: Function Friday – Xpath
published: true
date: 2022-10-28 18:46:47 UTC
tags: Development,flow,FunctionFriday,PowerAutomate
canonical_url: https://barretblake.dev/2022/10/function-friday-xpath/?utm_source=rss&utm_medium=rss&utm_campaign=function-friday-xpath
---

Power Automate doesn’t give you any built-in methods for editing XML content, and that’s fine. XML is a devil-spawned file format that should die thousands of deaths and never see the light of day again. But, if you’re forced to use XML and need the ability to search and parse that XML in your flows, then Power Automate provides you a means for doing that search: XPath.

The format is simple:

```
xpath(<XML>, <XPATH>)
```

The <XML> parameter is the XML text to search, be it literal or a variable. And the <XPATH> parameter is the pattern to search for. The return value can be a bit of a pain. If only a single result occurs, you get that XML node result. If multiple matches are found, then you get an array of results. So your code will have to figure out whether you are dealing with a single result or an array.

Take, for instance, the following XML data stored in a string variable named jedi:

```
<?xml version="1.0"?>
<jedi>
  <knights>
    <knight>
      <name>Mace Windu</name>
    </knight>
    <knight>
      <name>Obiwan Kenobi</name>
    </knight>
    <knight>
      <name>Anakin Skywalker</name>
    </knight>
  </knight>
  <apprentices>
    <apprentice>
      <name>Ahsoka Tano</name>
    </apprentice>
  </apprentices>
</jedi>
```

The following XPath query will return an array:

```
xpath(jedi, '/jedi/knights/knight/name') // returns ['<name>Mace Windu</name>','<name>Obiwan Kenobi</name>','<name>Anakin Skywalker</name>']
```

While the following XPath queries will return a single value:

```
xpath(jedi, '/jedi/apprentices/apprentice/name') // returns '<name>Ahsoka Tano</name>'
xpath(jedi, '/jedi/knights/knight/name[first()]') // returns '<name>Mace Windu</name>'
```

If your XPath query returns a data value instead of a node (for example, if you search for the value of the first name node instead of the node itself), then your return result can be any value and won’t necessarily be a valid XML node. And, of course, if no results are found, your return value will be null.

So, the code you implement to process the result of your search must be able to handle all four of these use cases, making the manipulation of XML a pain to work with in Power Automate. You can do it. But if you have another option, I’d recommend you opt for that instead.

The post [Function Friday – Xpath](https://barretblake.dev/2022/10/function-friday-xpath/) first appeared on [Barret Codes](https://barretblake.dev).
Primeiros passos em Ruby
Published: 2022-10-28 18:39:49

```
class HelloRuby # nome da classe tem que ser maiúsculo

	def initialize hello #construtor que recebe hello como parametro
		@helloMarina = hello # criando variável helloMarina para receber hello do construtor
	end

	# metodo pra imprimir hello
	def imprime 
		puts @helloMarina # printando variável
	end
end

hello = HelloRuby.new "marina" # instanciando a classe HelloRuby e passando "marina" como parametro para o contrutor
hello.imprime # chamando método imprime
```
What was your win this week?
Tags: discuss, weeklyretro
Published: 2022-10-28 18:31:36

Hey folks! 👋

Hope everybody is having a fantastic Friday and that you all have wonderful weekends!

Looking back on this past week, what was something you were proud of accomplishing?

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Fixing a tricky bug
- Watching a horror flick 😱

---

Y'all enjoy yourselves!

![Beetlejuice saying "It's showtime!"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6mn6lww5wrn9evqwiwmj.gif)