teleren/devto huggingface dataset:
Installing node-rdkafka on M1 for use with SASL
Tags: tutorial, todayilearned, node, linux
Published: 2022-10-14 20:25:29

If you're using Kafka in a Node.js app, it's likely that you'll need `node-rdkafka`. This is a library that wraps the [librdkafka ](https://github.com/edenhill/librdkafka)library and makes it available in Node.js. According to the project's [README](https://github.com/Blizzard/node-rdkafka), "All the complexity of balancing writes across partitions and managing (possibly ever-changing) brokers should be encapsulated in the library." 

Installation steps may vary depending on the machine you're using, and whether you need SASL/SSL (Simple Authentication and Security Layer) support. You might need this, for example, if you're connecting to Confluent Cloud, as it is a required protocol to protect resources (see [docs](https://docs.confluent.io/cloud/current/cp-component/clients-cloud-config.html#connect-clients-to-ccloud)). 

Here's a short, step by step guide on installing the `node-rdkafka` client specifically on M1 (the first chip released by Apple specifically for Mac, [article here](https://www.apple.com/newsroom/2020/11/apple-unleashes-m1/#:~:text=for%20the%20Mac-,M1%20is%20Apple's%20first%20chip%20designed%20specifically%20for%20the%20Mac,chip%20it%20has%20ever%20created.)). 

Currently, as of September 30 '22, you have to do it manually. You can [find the reason why](https://github.com/confluentinc/confluent-kafka-python#install) in the `confluent-kafka` Python client README.md:

>
NOTE: The pre-built Linux wheels do NOT contain SASL Kerberos/GSSAPI support. If you need SASL Kerberos/GSSAPI support you must install librdkafka and its dependencies using the repositories below and then build confluent-kafka using the instructions in the "Install from source" section below.
>

Here are the steps you'll need to take for SSL/SASL support (run in your home directory):

```
git clone https://github.com/edenhill/librdkafka.git
cd ./librdkafka
./configure --install-deps --source-deps-only
make
sudo make install
```

Then, 

1. Use [homebrew](https://brew.sh/) to [install openssl](https://formulae.brew.sh/formula/openssl@1.1).

2. Navigate out of `./librdkafka` and into your Node.js project directory.

4. Export these variables with these commands, to make sure that the path to openssl is correct: ```
export CPPFLAGS=-I/opt/homebrew/opt/openssl@3/include
export LDFLAGS=-L/opt/homebrew/opt/openssl@3/lib
```

5. install `openssl` with `npm install openssl`

6. Next, install `node-rdkafka` -- now you've got SSL support for your Node.js/Kafka project! 

Hopefully this helps! If you're still running into issues, you can post a request for help in [Confluent Community](https://www.confluent.io/community/ask-the-community/).
Como listar los posts de un blog de Blogger en mi web
Published: 2022-10-14 20:16:08

Para listar los posts de un blog de blogger usando un criterio de búsqueda se debe usar las API de JSON de blogger, aquí hay un código que me encontré que puede ser muy útil para todos los que lo necesiten

```
<html>
<body>
<div><ul id="postList12"></ul></div>
<script type="text/javascript">
	var startIndex = 1;
	var maxResults = 50;

	function sendQuery12()
	{
	   var scpt = document.createElement("script");
	   quer="Arboleda";
	   quer=quer.toLowerCase();
	   scpt.src = "http://elblogdenimu.blogspot.com/feeds/posts/default?q=label:"+quer+"&alt=json&callback=processPostList12&start-index=" + startIndex + "&max-results=" + maxResults;     
	   document.body.appendChild(scpt);
	}

	function processPostList12(root)
	{
	   var elmt = document.getElementById("postList12");
	   if (!elmt)
		  return;

	   var feed = root.feed;

	   if (feed.entry.length > 0)
	   {
		  for (var i = 0; i < feed.entry.length; i++)
		  {
			 var entry = feed.entry[i];
			 var title = entry.title.$t;
			 

			 for (var j = 0; j < entry.link.length; j++)
			 {
				if (entry.link[j].rel == "alternate")
				{
				   var url = entry.link[j].href;

				   if (url && url.length > 0 && title && title.length > 0)
				   {
					  var liE = document.createElement("li");

					  var a1E = document.createElement("a");
					  a1E.href = url;
					  //a1E.textContent = title+"  "+feed.entry.length;
					  a1E.textContent = title;

					  liE.appendChild(a1E);
					  elmt.appendChild(liE);
				   }

				   break;
				}
			 }
		  }

		  if (feed.entry.length >= maxResults)
		  {
			 startIndex += maxResults;
			 //sendQuery12();
		  }
	   }
	}

	sendQuery12();
</script>
</body>
</html>
```
Trending open source repositories on GitHub
Tags: opensource, dotnet, aws, react
Published: 2022-10-14 19:02:58

Hello everyone!

In this very short blog we want to list out a few open source code that is interesting to collaborate and is trending now, so that is a way to gain visibility as a developer:

- [AWS Actions](https://github.com/aws-actions/configure-aws-credentials): It's an open source project from AWS which the goal is to get easy to Configure AWS credential and region environment variables for use in other GitHub Actions.

- [dotnet/aspnetcore](https://github.com/dotnet/aspnetcore): Is a cross-platform framework for ASP.NET applications.

- [React router](https://github.com/remix-run/react-router): Is a declarative router for React applications.

- [SerenityOS](https://github.com/SerenityOS/serenity): For those who like Unix with the '90s interfaces, that's an graphical Unix-like operating system for x86 computers.

[CTO.ai](https://cto.ai/) also have an open source project that you can contribute. Feel free to code and share your know-how on it. Visit our [workflows-sh repository](https://github.com/orgs/workflows-sh/repositories) to see the code.

Happy coding and happy Friday :)
[Fivem] [RageUI] - Script Teleport Builder
Tags: programming, productivity, gamedev, showdev
Published: 2022-10-14 20:06:26

**Preview :**

[Vidéo de présentation](https://www.youtube.com/watch?v=4KP3K-iFQ0U)

Serveur Discord avec le lien du script : [Le repère des tanches](https://discord.gg/yQcMBUUkNc)

Voici mon script en **RageUI** pour créer / supprimer des points de téléportation sur FiveM disponible sur mon Discord !

Features :

➤ Création de point de téléportation sans reboot
➤ Suppression de point de téléportation avec reboot
➤ Suppression de point de téléportation via un nom !
➤ La langue (FR/EN)

En cas de question et/ou de problème venez me contacter sur mon discord : **_p0p0_l4_t4nch3#1847_**

------------------------------------
Réseaux Sociaux :

➤ [Twitch](https://www.twitch.tv/p0p0_l4_t4nch3)
➤ [Instagram](https://www.instagram.com/p0p0_fivem/)
➤ [Dev.to](https://dev.to/p0p0)
➤ [Twitter](https://twitter.com/L4P0p0)

✉️ Mail Pro : popodevfivem@gmail.com
Find ES6 features in any JS code
Tags: javascript, webdev, opensource, productivity
Published: 2022-10-14 19:52:06

I came across a problem where I had to find the ES6 features used by any javascript project and other data regarding their use. When I reached out to stackoverflow, I could find only one relevant [post](https://stackoverflow.com/questions/45377684/how-to-check-if-you-have-written-es6-code) which asks you to use linters like [jshint](https://www.jslint.com/)/[jshint](https://jshint.com/) or compilers like babel. Jslint didn't seem to report anything specific to ES6 and Babel converts all the ES6+ features to ES5 but doesn't report anything regarding which constructs were used or how many times they were used. However, Jshint reported all ES6 features used in the code along with some metadata. And, to suit my needs, I ended up writing a python script that calls Jshint on all JS files in a project and presents the features used in the project and the number of times they were used across all files. You can find the code here : [jsHintRunner](https://github.com/MadhuNimmo/jsHintRunner)

Feel free to report a bug/issue or open a PR if you have improvement ideas.

Hope this helps someone at some point.
Lookup for a value in a column and get another value in python pandas
Tags: python, programming, pandas, numpy
Published: 2022-10-14 19:45:14

Hello Everyone,

*I know it is a fundamental question, but I couldn't solve it.
Any help will be appreciated*

@ralphbrooks , @julienkervizic adding you to get quick response!! Please excuse me.



*I hope this can help to understand my issue.*

(Plese find the image below) 
I have total 1058 records in `list1[ID]` which has matching records in `list2['Positionnummer']`.
So when both equals I want to get corresponding value from `list2['New Bewehrungsgehalt']` and append to out output list i.e `value`, if not equal append old(default) value to the list `value`. 
At the end I want `len(list1)` == `len(value) i.e 1058`.

> For example: in first iteration when `U1.ST.XX` from `list1[ID]` ==
> `U1.ST.XX` from `list2['Positionsnummer']` then `value.append(New
> Bewehrungehalt) i.e '88888888'`, if not matching append the default value.

    import pandas as pd
    
    list1 = pd.read_excel(r"C:\Users\kuk\Downloads\Dynamo\dummy.xlsx", sheet_name='Sheet1')
    list2 = pd.read_excel(r"C:\Users\kuk\Downloads\Dynamo\dummy.xlsx", sheet_name='Sheet2')
    
    list2=((list2.dropna(subset=['Positionsnummer'])).drop_duplicates(subset=['Positionsnummer'])).reset_index()
    
    value=[]
    for i in range(len(list1)):
    
        for j in range(len(list2)):
            if list1["ID"][i] == list2["Positionsnummer"][j]:
                value.append(list2['New Bewehrungsgehalt'])
                break
            else:
                value.append(list2['Bewehrungsgehalt'])
                break

But I am not getting as I wanted. I tried using break, continue everything, but it is not working.

 - When using break, it's appending 6 times when it is not matching
 - When using continue, appending '*I don't know*' many times.


![Please find the image here](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9ipxls6qzm1g0zv1e7d.png)
Javascript vs React!
Tags: react, javascript
Published: 2022-10-14 19:33:19


- If React is written in JavaScript, then how is it different than the plain JavaScript? 
- JavaScript can also be used to build Web Applications, then why do we need React? 

I would say React is an abstraction on top of JavaScript. React is basically a JavaScript Library which is popular because of its dynamic approach.  Let's look at some of the few advantages of using React over JavaScript. 

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

I tried adding few basic differences only , but there's a lot more to it. I hope it helped you in giving an overview of React and its usage. 

**Conclusion-**
It's completely your choice whether to use JavaScript or React for your web development. As mentioned, For scalable and more complex applications React would work better than JavaScript. But if your application doesn't have much complexity, you might want to use JavaScript because of its simpler syntax and basic setup.
🧱 Make templates with Mason CLI
Tags: flutter, package, template
Published: 2022-10-14 19:14:36

[🇫🇷 French version](https://aymeric-le-feyer.notion.site/Faire-des-templates-avec-Mason-CLI-b97efe55173344c7a5e96529ff5d5b97)

## Template and rule

🧑‍💻 The job of a developer is also copy/paste of already existing snippets. Why reinvent the wheel with each new project?

A **template**, or boilerplate, allows you to start a project or a new feature with a solid code base.

To facilitate the usage of **template**, [BrickHub](https://brickhub.dev/) offers a new tool : [Mason CLI](https://pub.dev/packages/mason_cli).


![Mason's logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9ksuyhh6ts0vfjxfu2l.png)

➡️  The promise is simple, that of being able to create reusable bricks in your projects, all via a CLI. (Command Line Interface)

🧱  A brick being a set of files that can be generated according to different parameters.

![Usage of the brick **hello**](https://raw.githubusercontent.com/felangel/mason/master/assets/mason_demo.gif)

> Usage of the **hello** brick

The brick [flutter_getx]
(https://brickhub.dev/bricks/flutter_getx/0.2.0) available on [brickhub](https://brickhub.dev/) allows to create a Flutter project with the GetX architecture. It is enough to give some parameters to create the project.


![Addition of the brick **flutter_getx** and usage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/98d37j7o978p2v6nsy9a.gif)

> Addition of the brick **flutter_getx** and usage

👉  With templates, it is possible to simplify project creation.

## Bring your brick to the building

➕ To create a custom brick, just place all the files to be generated in the `__brick__` directory after entering the following command :

```bash
mason new <BRICK_NAME>
```

![Example of using the command `mason new`](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tnynkon6y0vwin4o28bl.png)

> Example of using the command `mason new`

![Architecture of a new brick](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p82ihrd3ws1vivud1a7m.png)

> Architecture of a new brick

ℹ️  The `brick.yaml` file lists all the bricks of the project.

🥸  The *[mustache](https://mustache.github.io/)* notation is used to inject variables in files.

```markdown
Hello {{name}}!
```

🖥 Once your brick has been created, it is possible to publish it on [brickhub](https://brickhub.dev/) so that other users can use it. In a professional setting, it is possible to host your bricks elsewhere and then add them to the project manually, by changing the reference of the bricks registered in the `.mason` folder of your project.

📑  For more information on creating custom bricks, the official documentation is well provided → [https://pub.dev/packages/mason_cli](https://pub.dev/packages/mason_cli)

 

**And now ? All that remains is to test the power of the tool on your side, and perhaps you will use it in your next projects?**
What is the Good Point about Influencer’s Websites
Tags: portfolio, webdev, beginners
Published: 2022-10-14 19:01:52

I'm going to create my portfolio website. Before doing that, I checked the influencers' websites. I will write what they have in common.

___
The below link is my reference websites

- Cassidy Williams
https://cassidoo.co/

- Jhey Tompkins
https://jhey.dev/

- Jason Lengstorf
https://www.jason.af/

- Sara Soueidan
https://www.sarasoueidan.com/

- RACH SMITH
https://rachsmith.com/
___

##Simple is Best

The contents of their websites are self-introduction, career histories, products, and contacts. They minimize their information to appeal so they have a few pages. Viewers can see their websites with as few clicks as possible. It enables viewers to see who they are and what kinds of skills they have easily. In terms of design, their background colors are simple like white, cream-yellow, and light gray. The line colors are mainly black. Then a point color or an animation is used as a decorative accent. Less information and less decoration give viewers comfortable feelings. 

##White space and Alignment
They make efficient use of white space and alignment. White space and alignment emphasize information. If you check [Cassidy William's website](https://cassidoo.co/), you can understand what I said. Her main page has the main contents situated in the middle and There is much white space outside of that. The contents have no outline but the alignment of the text gives us the impression it has an outline.

##Playful
The purpose of creating portfolio websites is to appeal their skills to potential clients and the company’s recruiters who are hiring however, they also do not forget appealing their sense of fun. Please check [Jason Lengstorf's website](https://www.jason.af/). On the upper right, you can see his face. If you click his head, the brain appears and we can see his website's content. This kind of playful mind offers great entertainment for views and we have a desire to know more about him.  

##Responsive and Dark mode
Of course, All influencers' websites that I checked are responsive so viewers can see websites via laptop, tablet, and smartphone perfectly. In addition, two-thirds of those have a dark mode button. For web developers who are used to dark mode while they are writing codes, it is getting more common.
ElasticSearch cluster first-aid kit
Published: 2022-10-14 18:46:44

Here are some useful commands I used in the past to help you fix your yellow or red cluster, especially when you have unassigned shards. If you have suggestions for improvements please let me know in the comments. I wish you a great day !

```
# see cluster health
GET _cluster/health?pretty
 
# see nodes status
GET _cat/nodes?pretty&v=true

# see a summary of the JVM statistics (memory usage, does GC is triggering a lot, etc.) 
GET /_nodes/stats/jvm?pretty
 
# see shards status
GET /_cat/shards?v

# see shards allocation (useful to detect if a node has a disk space full)
GET /_cat/allocation?v
 
# get detailed reason for the first unassigned shard
GET /_cluster/allocation/explain

# get the reason for any unhealthy shard
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason

# the detail of an unhealthy shard can be found here : https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html#_example_with_reasons_for_unassigned_shards:~:text=unassigned.-,reason,-%2C%20ur

# if the unassigned shard belongs to an index you can get rid of (logs of a past day for example), the easiest fix is to remove the related index
GET _cat/indices?v
DELETE /your_index
 
# if the unassigned shard belongs to an index you can NOT get rid of (production data), then try to reroute it to another node (if it fails the precise reason will be described) : example for primary shard #2 (use "allow_primary": false for a replica shard) of your-index (remove the ?dry_run parameter to actually reroute the shard)
POST _cluster/reroute?dry_run
{
    "commands" : [
        {
          "allocate" : {
              "index" : "your-index", "shard" : 2, "node" : "new-node-name", "allow_primary": true
          }
        }
    ]
}

# if you stuck shard is not in UNASSIGNED status but rather in INITIALIZING status
## if you are with ES7+ then you can force the reassignment of the shard with the command above, but replace allocate with allocate_stale (I never tested it myself actually, only read about this)
## if not and you are comfortable, you can try to reboot the node currently assigned to this shard : after the restart, the shard should be back to UNASSIGNED status and you will be able to use the command above (I never tested it myself actually, only read about this)

# check your cluster settings (allocation rules for example)
GET _cluster/settings
 
# exclude the IP of a bad node for the shard allocation
PUT _cluster/settings
{
  "transient" :{
      "cluster.routing.allocation.exclude._ip" : "your-node-ip"
  }
}
 
# check your index settings (shards and replicas number for example)
GET /your-index/_settings
 
# if you have a replica unassigned shard, a known workaround is to put to 0 the number of replicas (it will delete replica shards) then put it back to its original value (it will recreate them). But I recommend to AVOID doing this as it will put a big load on the cluster, and it's a risky procedure especially if the state of the cluster is red
PUT /your-index/_settings
{
    "index" : {
        "number_of_replicas" : 0
    }
}
```
Qual a diferença entre Vulnerabilidade, Ameaça e Risco?
Published: 2022-10-14 18:43:45

A palavra “ameaça” é frequentemente confundida (ou usada como sinônimo) com as palavras “risco” e “vulnerabilidade”. 

São termos muitas vezes inter-relacionados, mas não significam a mesma coisa. Em Segurança de Aplicações (AppSec), é importante diferenciar entre ameaça, vulnerabilidade e risco.

Entender a diferença pode te ajudar a compreender o verdadeiro risco para a sua aplicação e negócio.

**O que é vulnerabilidade?**
Pode ser representada por uma falha ou fraqueza: 
• No design do sistema;
• Nos procedimentos de segurança;
• Em controles internos;
• No próprio código da aplicação; 
• Em pacotes de terceiros, etc. 

Podendo ser explorada por criminosos cibernéticos.

**O que é ameaça?**
De modo geral, é a circunstância ou evento com potencial para impactar negativamente o sistema via a exploração por qualquer agente através de uma vulnerabilidade

**O que é risco?**
É a intersecção de ativos, ameaças e vulnerabilidades.
Ou seja:

Ativo + Ameaça + Vulnerabilidade = Risco. 

Logo, é o potencial de perda, dano ou destruição de um ativo quando uma ameaça é explorada por conta de uma vulnerabilidade.

**Classificação de Risco**
A [OWASP](https://owasp.org/www-community/OWASP_Risk_Rating_Methodology) possui o seguinte modelo padrão para classificação de risco:

Risco = Probabilidade * Impacto 

Através de dados sobre o agente de ameaça, tipo de ataque, vulnerabilidade envolvida e o impacto nos negócios.

Observando a gravidade geral de um risco com um exemplo da OWASP:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3f25gnfvr9d9v3xd4fxj.PNG)

A probabilidade é "média" e o impacto técnico é "alto", portanto, de uma perspectiva puramente técnica, parece que a gravidade geral é "alta". No entanto, observe que o impacto nos negócios é realmente "baixo", com isso, a gravidade geral é descrita como "baixa". Nesse sentido, entender o contexto das vulnerabilidades que você está avaliando é essencial para tomar boas decisões de risco. 

Compreender essas diferenças é o primeiro passo para alcançar uma abordagem de gerenciamento de vulnerabilidade mais eficiente e uma cultura alinhada ao gerenciamento e redução de risco.


Leia mais sobre: https://bit.ly/3OVTR5d