teleren/devto huggingface dataset:
Event Listener API 👂♪♪:One Byte Explainer
Tags: frontendchallenge, devchallenge, javascript, webdev
Published: 2024-03-29 19:40:58

_This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature._

## Explainer
**Event Listeners API:**
**Song** **_"Listen" (Beyoncé):_** ♪♫ ♪ ♬
The web page listens for user interactions (clicks, scrolls) and reacts accordingly, mirroring the song's message of paying attention.

## Additional Context
Event Listeners are the secret sauce for making web pages interactive. They act like attentive assistants, constantly watching for user actions like clicks, key presses, or mouse movements. When a specific event happens, the Event Listener triggers a pre-programmed function, allowing your web page to react in a meaningful way. This can involve anything from displaying messages, updating content, or triggering animations. Event Listeners are essential for creating engaging user experiences and building dynamic web pages that respond to user input.


<!-- Team Submissions: Please pick one member to publish the submission and credit teammates by listing their DEV usernames directly in the body of the post. -->

<!-- Don't forget to add a cover image to your post (if you want). -->


<!-- Thanks for participating! -->
Helping You Build Machine Learning Products: CodeNewbie Podcast
Tags: codenewbie, podcast, career, ai
Published: 2024-03-29 19:38:54

### Happy Friday y'all!

If you are new here, hello and welcome! It's me Rachel, and I am here today with CodeNewbie Podcast, where we come to you weekly with an interview with a tech professional, sharing supportive advice for newbies in tech. 

This week we are coming at ya a little late, apologies, gosh!!! I have missed you all.

_Let's look at our new episode!_ 

![Sloth from Zootopia looking shocked.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46lew2gbcvf9xcifi5tt.gif)

---

In our third episode of this season just came out with our host @saronyitbarek and [Pau Labarta Bajo](https://twitter.com/paulabartabajo_?lang=en), Machine Learning Engineer and Educator at Real-World Machine Learning.  

Pau talks to Saron about transitioning from working daily in Excel to Python, why data is everything, and what skills early developers need to foster if they want a career in machine learning. 

You can also find Pau on [Github](https://github.com/Paulescu) or [Machine Learning](https://www.ibm.com/topics/machine-learning).

---

If you would like to listen you can:

- [Listen on Apple Podcasts](https://podcasts.apple.com/us/podcast/codenewbie/id919219256?i=1000650593602)

- [Listen on Spotify](https://open.spotify.com/episode/5wiv58hooMfl0Vhdwx0wZt?si=a19c235b7bc648f1)

- Listen right here on DEV:

{% podcast https://dev.to/codenewbie/s27e3-helping-you-build-machine-learning-products-pau-labarta-bajo %}

Or, listen wherever you normally get your podcasts.


---

### Will see ya later for more CodeNewbie Podcast stuffs!

ALSO, if you are eager for more podcast-discussions, I also run [Podcast Palooza](https://dev.to/devteam/podcast-palooza-what-are-you-listening-to-interview-edition-3a8) on Mondays to share your favorite podcast-related content!

Sincerely,
**Rachel from the DEV and CodeNewbie Teams**
(they/them)

---

_PS: **WOW** We would love for you to review our podcast, drop a rating, drop a like, or whatever you can to show your support. It truly means a ton, we love to see your kind words, and we wouldn't be here without you!_
Run RSpec tests on changed files only
Tags: rails, rspec, testing, ruby
Published: 2024-03-29 19:29:23

I always do my best to run tests on my local machine before publishing a PR. However, depending on the size of the test base, this could be unsustainable.

To solve this, I at least run the tests on all `*_spec.rb` files of my current working branch (or stack of branches) that were changed (or created) since another branch. Usually, it’s main or staging.

Let’s look at the code below:

```git
o feature-2/more-features
|   changed file: user_spec.rb
o bugfix/fix-users-controller-params
|   created file: users_controller_spec.rb
o feature-1/branch-1-new-feature
|   updated file: product_spec.rb
|   updated file: new_payment_service_spec.rb
o main
```
*This is a purely didactic example*

This stack of branches has changed/created 4 spec files. Now, I want to run RSpec on only those four files, not on the entire test base.

To achieve this goal, I created a bash script to use git to list all changed `*_spec.rb` files and run the `rspec` command against them. Here is the code:

```bash
#!/bin/bash

# Set default branch name
branch_name="${1:-staging}"

# Get changed files with grep for _spec.rb extension
changed_specs=$(git diff --name-only --diff-filter=d "$branch_name" | grep _spec.rb)

# Check if any changed specs found
if [[ -z "$changed_specs" ]]; then
  echo "No changed _spec.rb files found between HEAD and $branch_name."
  exit 0
fi

echo "List of changed spec files:"
echo "$changed_specs"

# Run rspec with all changed specs
bundle exec rspec $changed_specs

echo "RSpec tests completed for changed _spec.rb files."
```
*[Click here to view and download this gist](https://gist.github.com/shayani/c4fd6c427f932ab9fe3e98185a912e61)*

Save this file and give it a name (I use `rspec_changed_files.sh`). 

Now, simply run it on your repo directory.
```sh
./rspec_changed_files.sh
```

By default, it will find the changed files related to the `staging` branch, but you can adapt the code or override the branch on the command line with another branch name or commit hash:

```bash
./rspec_changed_files.sh main
```

Output:
```bash
List of changed spec files:
spec/models/user_spec.rb
spec/controllers/users_controller_spec.rb
spec/models/product_spec.rb
spec/services/new_payment_service_spec.rb
....................

Finished in 0.60517 seconds (files took 1.81 seconds to load)
10 examples, 0 failures

RSpec tests completed for changed _spec.rb files.
```

Happy testing!
INT FLOAT COMPLEX - PYTHON
Tags: python, tutorial, programming, beginners
Published: 2024-03-29 19:21:26

Good day geeks!

## PYTHON UNLEASEH'D 06

This mediocre sounding blog is going to be interesting unlike its name I swear. No already known information here, not discussing basics, just (RARELY KNOWN) things for people shifting to python.


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


We have the following data types in python :

```
Text Type:	str
Numeric Types:	int, float, complex
Sequence Types:	list, tuple, range
Mapping Type:	dict
Set Types:	set, frozenset
Boolean Type:	bool
Binary Types:	bytes, bytearray, memoryview
None Type:	NoneType
```


1. Numeric Types

- Integers – This value is represented by **int class**. It contains positive or negative whole numbers (without fractions or decimals). In Python, there is **no limit to how long an integer value can be.**

- Float – This value is represented by the **float class**. It is a real number with a floating-point representation. It is specified by a decimal point. 

Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation.

- Complex Numbers – A complex number is represented by a complex class. It is specified as (real part) + (imaginary part)j. For example – 2+3j

### Program for complex numbers

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

AS MENTIONED, ONLY 'j/J' is allowed to represent imaginery part of complex number. Please try in your editor.

### Python has class for each data type, as read above. Okay
I guess there must be some methods associated with each class. Lets search about this and explore.

FROM STACKOVERFLOW -

> int is a class. The type of a class is usually type.

> And yes, almost all classes can be called like functions. You create what's called an instance which is an object that behaves as you defined in the class. They can have their own functions and have special attributes.

> (type is also a class if you're interested but it's a special class. It's a bit complicated but you can read more on it if you'll search for metaclasses)

We get plethora of methods and information🤯 about this 'int' class on writing `help(int)` in notebook. That's more than enough, lets wrap up🤐. These numeric types are associated with their respective classes and what all variables we create are instances. These classes have methods. ✔✔

[A good read on numeric data types of Python](https://medium.com/@artur-khudaverdiev/lesson-9-python-data-types-numeric-data-types-int-float-b5f009e69872)

We can use underscore as separators for big integer values like we use comma in maths.


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

Thanks for reading guys


If you liked the content, do react, or for any feedback/correction/suggestion feel free to reach out to me on [Linkedin](https://www.linkedin.com/in/sakshi9ain/) or can comment here...
Facts about WhatsApp
Tags: whatsapp, facts
Published: 2024-03-29 18:57:32

Certainly! Here are some facts about WhatsApp:

1. Founding: WhatsApp was founded in 2009 by Brian Acton and Jan Koum, former employees of Yahoo!.
2. Acquisition by Facebook: In 2014, Facebook acquired WhatsApp for $19 billion, making it one of the largest technology acquisitions in history.
3. User Base: As of early 2022, [WhatsApp](https://wagolden.com/) has over 2 billion monthly active users worldwide, making it one of the most popular messaging apps globally.
4. End-to-End Encryption: WhatsApp is known for its end-to-end encryption feature, which ensures that only the sender and recipient can read messages, providing a high level of privacy and security.
5. Voice and Video Calling: In addition to text messaging, WhatsApp also supports voice and video calling over the internet, allowing users to make free calls to other WhatsApp users anywhere in the world.
6. WhatsApp Web: WhatsApp offers a web-based version called WhatsApp Web, which allows users to access their messages and chats from a web browser on their computer. This feature syncs messages between the phone and computer.
7. Status Feature: WhatsApp includes a "Status" feature, similar to stories on other social media platforms, where users can share photos, videos, and text updates with their contacts that disappear after 24 hours.
8. Business Accounts: WhatsApp Business allows small and medium-sized businesses to communicate with customers through the platform, providing features such as business profiles, messaging statistics, and automated messages.
9. Group Chats: WhatsApp supports group chats with up to 256 participants, allowing users to communicate with multiple people simultaneously.
10. International Reach: WhatsApp is popular around the world, particularly in countries like India, Brazil, Mexico, and many others, where it is often the primary messaging app used by individuals and businesses alike.
Laravel 11 being slow and nothing is fixing it?
Published: 2024-03-29 18:36:06

I have been working with laravel 11 for a few days now and I'm nothing short of impressed(Apart from the middleware change).
Anyway, I got stuck yesterday mainly because my all my routes were taking around 20 seconds to load which was very unusual.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sps4qi41592aar7571cp.jpg)
So I did the usual, went over to the internet to check for potential solutions and nothing seemed to fix it. I even thought it's the middleware configuration changes in laravel 11 that were causing this.
I had to redo the project(it was a mini project), this time, inspecting each change and its response to duration of requests.
The issue seemed to be with blade icons.
Now when adding blade icons to your project you have to use composer right? So my guess is that blade icons are depreciated for laravel 11 and hence causing the problem(I am still trying to understand how).

Note: This is not for all libraries, just some.

I hope someone finds this helpful :)
O papel da pessoa desenvolvedora muito além do código
Tags: braziliandevs, discuss, rpa
Published: 2024-03-29 18:25:59

Estava acompanhando uma postagem no LinkedIn sobre como os times e as empresas precisam entender a importância do gerenciamento de projetos de automação. Você pode acompanhar a [postagem neste link](https://www.linkedin.com/feed/update/urn:li:activity:7179064607423029248/).

Entendo que é crucial que essa discussão ocorra entre as pessoas dos times de negócio e gestão. Mas essa preocupação deveria ser também considerada para pessoas desenvolvedoras e também outros papéis de pessoas tecnologistas.

Quando nos tornamos pessoas desenvolvedoras (independente do tipo de projeto que vamos desenvolver), colocamos na cabeça que _somos pessoas que fazemos apenas código_.

Mas na verdade, _somos pessoas resolvedoras de problemas_. Precisamos lembrar de exercitar esse papel, levando para os times que trabalhamos soluções que fazem mais sentido de acordo com os requisitos e projetos que temos que atender.

Além disso, resolver problemas não significa que vamos apenas desenvolver um código e acabou. Devemos encontrar soluções no mercado que nos ajudem, afinal de contas, nosso objetivo também é levar valor aos projetos que atuamos. Por isso é tão importante quando fazemos POCs (Proof of Concept, ou Prova de Conceito em português) das ferramentas que pesquisamos.

É nesse momento que testamos, avaliamos as funcionalidades e tentamos considerar quais serão os ganhos com aquela ferramenta. E isso vai muito além do que queremos. Por isso temos que entender o que as demais áreas precisam e o que de fato terá valor em nossa automação.

Um projeto de automação também é um projeto de software. E tal como um projeto de software, precisa de gerenciamento. Não basta entregar um executável para as pessoas usuárias. O que elas querem, no final do dia, é ter uma forma de orquestrar o que será executado.

Repare nas perguntas que as pessoas usuárias fazem:

- Como eu sei se deu certo?
- Como faço para agendar a execução?
- E se der erro?
- E se não executar?
- Como eu levo uma comunicação eficaz para o time sobre o que está acontecendo com as automações?
- Mas eu tenho uma planilha enorme de dados para consumir, e se falhar no meio do caminho?
- Quem pode acessar as informações?
- Onde eu coloco as senhas para autenticação nos sistemas?
- Eu posso executar mais de uma automação por vez?

Entre tantas outras. E unir código com uma solução que te permita proporcionar todo esse gerenciamento é de extrema importância, principalmente porque a operação de automações pode ser facilmente escalada. E como vamos gerenciar isso?

Aproveitando a discussão, quero compartilhar com vocês uma trilha de estudos que pode te ajudar a entender melhor como seguir essas práticas e o nosso papel: [trilha de estudos para Python RPA](https://dev.to/botcitydev/trilha-de-estudos-para-ser-uma-pessoa-desenvolvedora-python-rpa-3o85).

E o que você acha isso? Compartilhe suas experiências com a comunidade nos comentários e vamos trocar uma ideia.
Trickster- PicoCTF 2024
Tags: learning, writing, community, cybersecurity
Published: 2024-03-29 18:10:01

Hey you,
If you're curious👀 about web-exploitation
challenges, Trickster is a great example to follow through.🫶
Without saying more, let's get started.
Steps I followed👉

1. Carefully read the description
We can observe that **only PNG** images can be processed. As soon as I read that, my mind flew to this [TryHackMe]((https://tryhackme.com/r/room/rrootme)) challenge  💡 
2. Launched the instance
My guess was good. 😉

Given that only .png files are accepted, I needed to find a way to integrate a reverse shell code into a png file.

I went to [Reverse Shell generator](https://www.revshells.com/) and looked for a **PHP script**. I chose **PHP cmd**
![code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfu3j7w3sh0ryngvw8pw.png) and copied that into a textpad.


Given that it's in my habit to enumerate hidden directories when I encounter a web-shell challenge, I proceed further with this.
Something interesting is quickly found! 👇


![Enumerate hidden directories](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/616c1bygy363t9a0x4bu.png)

Accessed robots.txt and besides uploads folder, I discovered the instructions.txt file. Driven by curiosity, I accessed that file and discovered the following:

![instructions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/216vzz4di03s7ma2bzz0.png).
All right, so the PHP script must contain the PNG signature in the beginning.

Normally, I would have edited this using HexEdit. But I tried something easier which basically does the same as if I edited that in a hex editor: typed PNG at the beginning of the document. 🤓



![Magic bytes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sm7tkpaj83cha00qsub8.png)

I uploaded the file and...waited for the shell to appear. 😹 ❗Important❗the uploaded file has a double extension ➡️ **.png.php**

Yeah, it didn't go as expected so ⏭️ I tried to access /uploads folder. Too bad, I don't have access. 

🎯Then, I thought that I take advantage of local file inclusion, so I completed the path with the name of the uploaded file.

I was welcomed with this👇

![cmd line](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/boghhpnxuz1ms7r0lbzw.png)

Tried various commands, for instance pwd, ls, whoami. Then looked for all the the files which have .txt extension. Who knows, maybe there is a flag.txt 😃

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


![txt files](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rvqo125s9cnj82tgjlan.png)


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

In the end 👇
![flag](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mlmv0h3wlewy3c6lp4r2.png)

That's it! Congrats! 👏
------------------------
What are your thoughts?
The Big Shift: How Cloud Computing Took Over the World
Tags: webdev, cloud, computing, devops
Published: 2024-03-29 18:09:08

Cloud computing has become essential in handling information these days. This article explores how this technology went from a cool idea to something everyone uses. We'll look at where it all began, what major moments shaped it, and how it changed the use of computers.

_**From Dream to Reality**_

The early 2000s saw tech visionaries develop a new way to deliver computing power over the internet. Big names like Amazon, Google, and Salesforce were the first to make this a reality, paving the way for a massive change in the IT world.

_**Key Moments in Cloud Computing**_

1. 2006: The Cloud Opens for Business - Amazon Web Services (AWS) launches, offering on-demand cloud storage and computing that can grow as needed. This marked the start of a new age for cloud infrastructure.
Software on Demand Takes Off - Companies like Salesforce, Google, and Microsoft have started offering software that runs online, eliminating the need to install and maintain it on individual computers.

2. Building Apps in the Cloud Gets Easier - Platforms like Google App Engine and Microsoft Azure appear, giving developers tools to create, deploy, and scale their applications without managing the servers themselves.

3. Mixing and Matching Clouds - Businesses start using a mix of public cloud services, their servers, and even clouds from different providers. This lets them find the best balance of performance, cost, and reliability.
How Cloud Computing Changed Everything

4. Growing When You Need To, Shrinking When You Don't - Cloud computing lets businesses add or remove resources as needed, making it perfect for workloads that change over time. It also helps them use their resources more efficiently.

5. Saving Money - With cloud services, businesses only pay for what they use. This cuts down on upfront costs and ongoing expenses, making cloud computing a good option for companies of all sizes.

6. Speeding Up Innovation - Cloud services give developers access to cutting-edge technologies like artificial intelligence and big data analysis. This lets them create new things and drive digital transformation faster.

7. Reaching the Whole World - Cloud providers have data centers all over the globe. This lets businesses deploy apps and services closer to their users, which means things run faster and smoother.
Challenges and the Road Ahead

Cloud computing is great, but it also comes with challenges like data security, following regulations, and getting locked into a single provider's system. However, careful planning, good management practices, and strong security measures can help businesses avoid these risks and get the most out of the cloud.

**_The Future is Cloudy (and Bright!)_**

Cloud computing has gone from a niche technology to something critical for businesses to be innovative and adaptable. As more and more companies move to the cloud, the future holds even more possibilities for using cloud computing to succeed in the digital age.

Thanks for reading. Do comment and share.

Cheers.
Don’t Be a “Developer Robot”
Published: 2024-03-29 18:07:56





If you are reading this, you are likely a dedicated, self-taught individual, above average, seeking recognition that you have not yet achieved. Based on my experience and observation, I’ve noticed that the job market is saturated with what I call “developer robot”. These professionals merely share what they did and will do in the daily stand-up, disappear until their tasks are completed, and the only hint of proactivity you see is when they emerge briefly to ask for help with some detail in their tasks. For a long time, I was one of these developers, and I became quite frustrated with the stagnation it caused in my career. Therefore, I decided to write this article to highlight some points that propelled me to the next level.

## Always Offer Help
Be willing to assist your team, even if you don’t know the solution to the problem or it’s unrelated to programming (or your area of expertise). This not only demonstrates your concern for all team members (or even members from other teams) but also opens up learning opportunities whenever you help someone in various situations. Additionally, you will be building a valuable network and standing out even more.

## Be Proactive
Seize opportunities to demonstrate proactivity. When they ask in the daily stand-up who wants to start speaking or who could take on a particular task, take the initiative, avoiding the awkward silence that typically follows such questions. This will make you a key player on the team with a leadership aura.

## Take Responsibility
Face up to the responsibility for your mistakes and the success of your career. Be ready to tackle diverse challenges, even without the necessary knowledge, whether resolving issues arising from your development or taking taking on a new challenging project. As a developer, your primary role is to learn problem-solving, so don’t shy away from it.

## Don’t Stay Idle
When you finish your sprint tasks and have nothing else to do during it, don’t be a “developer robot” who takes the time to rest. Approach your leader, ask if there’s a task to advance, and help alleviate their workload. Check if other team members need assistance. If there’s nothing else to advance in the project, dedicate time to studying the business rules of the product you’re working on. There’s always something productive to do.

## Conclusion
Standing out is an active and daily task. You won’t be recognized just by writing the best code in the world. Behave like someone who deserves more, someone taking a step forward every day, a step no one else wants to take. Soft skills and hard skills complement each other.

```“NEVER ONE WITHOUT THE OTHER.” — Kindred```

Of course, maintain control to avoid overburdening yourself when adopting these new behaviors. Be aware and balanced when seeking the recognition you deserve.

If you’d like to support and motivate me to continue writing more articles,  [BUY ME A COFFEE](https://www.buymeacoffee.com/career.it) and make a difference in my work.