teleren/devto huggingface dataset:
Ruby Array Methods That Will Blow Your Mind, Pt. 3: Lord of the Slices
Tags: webdev, ruby, rails, programming
Published: 2024-04-21 15:26:24

It's all about slicing in this part and we all know at some stage in your development journey, you will need to split an array in various forms. We went through some already but even some more won't be bad.🫥😉🫥

## slice

The `slice` method returns a portion of the array based on the provided indices. It does not modify the original collection but instead creates a new one that contains the specified elements. The indices can be provided as a start and length, or as a range.

```
array = [1, 2, 3, 4, 5]
array.slice(1, 3) 
# Output: [2, 3, 4]

array.slice(0..2)  
# Output: [1, 2, 3]
```

In the first example, the `slice` method starts at index 1 and takes 3 elements. In the second example, it takes the elements from index 0 to 2. Note that the original array remains unchanged.

## slice_before

The `slice_before` method is used to group consecutive elements based on a given block. It slices the array before a given element, creating an array of arrays based on the specified condition. This method is particularly useful when you want to split or group elements in a collection based on a certain condition.

```
array = [1, 2, 3, 4, 5, 6]
sliced_array = array.slice_before { |element| element.even? }
sliced_array.to_a 

# Output: [[1], [2, 3], [4, 5], [6]]
```

In the above example, the `slice_before` method slices the array before every even number. As a result, we get an array of arrays, where each sub-array starts with an even number and includes the following odd numbers.

## slice_when

The `slice_when` method is used to slice the array when the block's condition is true. It creates an array of arrays based on the specified condition. This method is particularly useful when you want to group consecutive elements in a collection based on a certain condition.

```
numbers = [1, 2, 4, 9, 10, 11, 12, 15, 16, 19, 20]
sliced = numbers.slice_when { |i, j| i+1 != j }
sliced.to_a 

# Output: [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20]]
```

In the above example, the `slice_when` method slices the `numbers` array when the condition `i+1 != j` is true. This results in groups of consecutive numbers being grouped together in sub-arrays.

## slice_after

The `slice_after` method is used to slice the array after a given element. It creates an array of arrays based on the specified condition. It slices the collection after a given element.

```
array = [1, 2, 3, 4, 5, 6]
sliced_array = array.slice_after { |i| i.even? }
sliced_array.to_a 

# Output: [[1, 2], [3, 4], [5, 6]]
```

In the above code snippet, the `slice_after` method is used to slice the array after every even number. The result is an array of arrays, where each sub-array ends with an even number.

Don't stop slicing till next time when we highlight the glue methods just incase you overslice😉😉.
How to enable Xdebug v-3.3.2 in Visual Studio Code
Tags: development, php, xdebug
Published: 2024-04-21 15:22:40

Today, I upgrade my project to new laravel version, v-10, and want to install xdebug for development a bit easier. I am around to search on the internet how to install xdebug in Laravel.

Firstly, I install xdebug.so in my local machine. Then, I check if it is installed already by the following command

```
$ php -m | grep xdebug
xdebug
```
Yes, it shows xdebug.

Secondly, I search on the internet that all the posts have been related to xdebug instruct me to find php.ini and add new lines in EOF.

```
[xdebug]
xdebug.remote_enable=1
xdebug.remote_autostart=1
```

Third, I create a launch.json file in VS code by clicking bug icon, then I select PHP (Xdebug)

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

Bump, snippet json file is generated automatically

```
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003
        }
    ]
}
```
Finally, I start Xdebug by clicking on Listen for Xdebug

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

In the result, no breakpoint is hit. Oops!

I try to search how and find that, the section in php.ini is out-up-dated. new Xdebug version uses another one to enable the mode, instead that, use it

```
[xdebug]
xdebug.mode=debug
xdebug.start_with_request=1
```
I try to turn on Xdebug mode again. Wow, one of breakpoints is hit.

Hope my post can help you navigate the situation when installing Xdebug v-3.3.2 in Visual Studio Code
Dominando os Desafios da Programação: Um Guia para os Erros Léxicos, Sintáticos e Semânticos
Tags: erros, programming, code
Published: 2024-04-21 15:12:16

Na jornada rumo à excelência na programação, enfrentamos uma série de desafios que testam nossa habilidade e perseverança. Entre estes desafios, destacam-se os erros léxicos, sintáticos e semânticos - obstáculos que podem comprometer a integridade e eficácia do código. Neste guia, vamos explorar esses erros em detalhes e discutir estratégias para identificá-los e corrigi-los de forma eficaz.

## Erros Léxicos: Precisão na Linguagem da Programação
Os erros léxicos são como imperfeições na gramática de um idioma - pequenas discrepâncias que podem alterar completamente o significado de uma sentença. Na programação, essas imperfeições se manifestam quando palavras-chave são mal escritas ou símbolos são utilizados de forma inadequada. Considere o seguinte exemplo:

```
If x == 5:       # A primeira letra de "if" deveria estar minúscula
    print("Hello World")
```
Neste código, o erro léxico reside na letra maiúscula em "If", que deveria ser "if".

## Erros Sintáticos: A Importância da Estruturação Correta
A sintaxe é a estrutura que define a gramática de uma linguagem de programação. Erros sintáticos ocorrem quando essa estruturação é violada, resultando em código que não pode ser interpretado corretamente pelo compilador ou interpretador. Considere o seguinte exemplo:

```
print "Erro de sintaxe")  # Esqueceu de colocar os parênteses para a função print
```
A ausência do ponto e vírgula no final da linha resulta em um erro sintático.

## Erros Semânticos: Alinhando Intenção e Resultado
Embora o código possa estar gramaticalmente correto, ainda pode falhar em cumprir sua intenção original devido a erros semânticos. Esses erros ocorrem quando há uma discrepância entre a interpretação do programador e o comportamento real do programa. Considere o seguinte exemplo:

```
def media(lista):
    soma = 0
    for num in lista:
        soma += num
    return soma / len(lista)

lista = []
media(lista)     # Vai gerar uma exceção por tentar dividir por zero
```
A tentativa de calcular a média de uma lista vazia resulta em uma divisão por zero, um erro semântico.

## Conclusão: Navegando com Precisão no Oceano da Programação
Identificar e corrigir erros em programação é uma habilidade essencial para qualquer desenvolvedor. Os erros léxicos, sintáticos e semânticos representam desafios significativos, mas compreendê-los nos capacita a enfrentá-los com confiança e eficácia. Que este guia sirva como uma ferramenta valiosa em sua jornada de desenvolvimento, ajudando-o a navegar com precisão no vasto oceano da programação.
Introducing Ecla: A Versatile Programming Language for Learning
Tags: go, programming, opensource, codenewbie
Published: 2024-04-21 14:57:13


**Overview:** 💫
Ecla emerges as a beacon of innovation in the realm of programming languages, designed with a dual purpose in mind: to facilitate the learning of programming concepts and to empower developers to create robust applications efficiently. Tailored primarily for individuals venturing into the realm of computer science, Ecla also caters to seasoned coders seeking a versatile toolset.

**Design Principles:** 🎨
At the heart of Ecla lies a fundamental question: Can a programming language provide a seamless transition to mastering other languages without the burden of relearning syntax and concepts? Ecla's genesis stems from this inquiry, embodying a multi-paradigm approach. While still in its developmental stages, Ecla currently embraces functional programming concepts, paving the way for a broader spectrum of paradigms in the future.

**Educational Benefits:** 🎓
Ecla serves as an invaluable educational tool, offering a diverse array of programming concepts and syntaxes. By familiarizing oneself with Ecla, learners gain a foundation that transcends individual languages, facilitating a smoother transition to mastering other programming paradigms.

**Comparison with Existing Languages:** 🔧
Ecla embodies a fusion of programming concepts from various languages. Drawing inspiration from C and C++, its syntax bears a resemblance to GoLang, incorporating familiar elements such as semicolons. Moreover, Ecla boasts functionalities akin to industry-standard languages, with ongoing efforts to implement additional features to enrich its capabilities.

**Use Cases:** 💻
The versatility of Ecla extends beyond the realm of education, finding practical applications in real-world development scenarios. Whether it's crafting web servers, backend systems, or desktop applications, Ecla empowers developers to bring their visions to life with ease and efficiency.

**Future Development:** 🚀
As Ecla continues to evolve, user feedback remains paramount in shaping its trajectory. Users are encouraged to explore Ecla, identify bugs, and propose enhancements to propel its development forward. Stay updated on the latest developments and contribute to the journey by visiting [ecla.dev](http://ecla.dev).

In conclusion, Ecla emerges as a transformative force in the programming landscape, bridging the gap between learning and development with its intuitive design and powerful capabilities.

> Feel free to star ⭐ the project on [github](https://github.com/Eclalang/Ecla) it really help us get more visibility, thanks in advance ❤️
가상계좌 업체 선정 팁
Published: 2024-04-21 14:51:54


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

**가상계좌 발급이**란 은행 또는 금융기관에서 고객의 요청에 따라 일시적으로 생성되는 계좌를 말합니다. 이 계좌는 주로 온라인 거래나 특정 목적의 결제를 위해 사용되며, 각 거래에 고유한 계좌 번호를 제공하여 보안성을 높이고 관리의 편의성을 제공합니다. 가상계좌 발급은 개인과 기업 모두에게 필수적인 서비스가 되고 있으며, 이러한 서비스를 이해하는 것은 현대 금융 환경에서 중요한 부분입니다.
가상계좌는 일시적으로 생성되어 특정 거래나 결제를 위해 사용되는 계좌입니다.

[가상계좌 발급](https://sketchfab.com/3d-models/365-dc0d735fcf5a4f478a194c10191a05f3)은 온라인 거래의 보안성을 높이고, 관리의 편의성을 제공합니다.

개인과 기업 모두 가상계좌 발급 서비스를 필수적으로 사용하고 있습니다.

가상계좌는 온라인 거래, 세금 납부, 기타 결제 목적 등 다양한 용도로 활용됩니다.

가상계좌 발급과 관련된 주의사항 및 사용 팁을 숙지하는 것이 중요합니다.
HTML - 17. Desain Layout with Table | iAppTech.id
Tags: webdev, beginners, programming, tutorial
Published: 2024-04-21 14:50:55


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

Welcome to iAppTech.id! 🚀

📚 Materi:
HTML — 17. Desain Layout with Table, watch it!

👋 Halo, iAppTechers!
Kami adalah channel yang berfokus pada pembahasan seputar Frontend Development. Di sini, kami membawa Anda ke dalam dunia desain antarmuka, pengembangan web, dan segala hal seputar Frontend.

🔗 Playlist HTML:
https://www.youtube.com/playlist?list=PLc6PvCQzjsh_kCOlaz4ZFr8s708gNNVSv

💬 Disclaimer:
Channel ini saya buat khususnya untuk saya pribadi, dikarnakan menurut saya ketika saya belajar harus membuat konten, kenapa? karna menurut saya hal terbaik ketika belajar adalah mengaplikasikannya kembali, ditambah saya paham bagaimana jangka memori otak saya yang lama-lama tergerus oleh usia kedepannya, makanya saya buat channel ini untuk e-Library pengetahuan saya dibidang IT khususnya Frontend Developer. Ditambah saya juga mempunyai salah satu prinsip yaitu:

"Jika seorang manusia meninggal dunia, terputuslah amalnya, kecuali dari tiga hal: sedekah jariyah, ilmu yang bermanfaat dan anak shaleh yang berdoa untuknya." (HR. Muslim).

🖥️ Apa yang Akan Kamu Temukan di Sini?
Dapatkan wawasan mendalam tentang berbagai teknologi frontend, tutorial praktis, tips & trik, serta eksplorasi proyek-proyek menarik. Kami akan memandu Anda melalui dunia seru Frontend Development!

☕ Traktir Saya Ngopi:
 https://saweria.co/appardana

🔔 Berlangganan Untuk Konten Berkualitas:
Jangan lupa tekan tombol subscribe untuk tetap terkini dengan konten-konten menarik kami. Kami sangat bersemangat untuk berbagi pengetahuan dan pengalaman dengan Anda!

⏰ Jadwal Ngonten: Setiap Selasa dan Kamis, pastikan Anda tidak ketinggalan!

🤝 Mari Bergabung dalam Komunitas:
- https://www.youtube.com/c/iapptech
- https://discord.com/channels/1171443162108141679/1171443165123854421

Terima kasih telah bergabung dengan iAppTech.id. Mari bersama-sama memperkaya pemahaman kita tentang Frontend Development!

✨ Don't forget, ngopi heula… ✨

iAppTech #iAppTechId #Frontend #frontenddeveloper #programming #programmer #web #webdevelopment #Aditria #Pardana #AditriaPardana
Don’t be fooled
Tags: softskills, softwareengineering, communication
Published: 2024-04-21 14:21:29

It took me a long time to figure this out, longer than it should have frankly.

I spent years being only interested in the craft of coding. I had many debates over the years with product managers and others regarding the speed of delivery. I always wanted to push for quality over time. I still do. 

Slowly over the years I have moved towards a true agile approach of defining and delivering an MVP which allows me to focus on quality and also go faster. 

But this isn’t what I’ve learned. What I learned is that with every job the challenge is people. 
In the past I somehow believed that focusing on the quality singularly would result in the work speaking for itself, but sadly this is no more true in the field of software than anywhere else. 

Whether it’s ‘right’ or ‘wrong’ we are dealing with people and what will grow you as an individual and grow your career more than anything is your ability to communicate with people in different roles and at different organizational levels. You can surely advocate for quality, as I will continue to do, but you must remember the goal which is to deliver something tangible of value to your customer, whether your customer is another team in your org, or an external client. 

I was fortunate that the debates I had regarding quality versus time have actually helped me become better at communicating those ideas with those other people, but looking back I think I could have made it easier on myself by being less of a zealot. 

I would encourage anyone, especially junior engineers, to focus on the people skills as much as the software skills. If you can master both you will be much more effective in your career.
OOPS (JavaScript)
Published: 2024-04-21 14:29:30

**_<u>Abstraction</u>_**
Showing only the information which is enough for the end user an hiding the implementation part.
For eg. -> Calling the sort function on an array.
The user knows the end point sort but doesn't know how it actually works.

**_<u>Encapsulation</u>_**
Binding the data objects and variables with their implementation.
For Eg. -> When we use an object (in js) and define a function that uses it we are trying to bind this function with that particular data which it is defined in.

**_<u>Inheritance</u>_**
Re-using an existing code and re-tweaking it to modify or add different features to make it more specialized . 
For eg -> A child object inheriting for a parent object.

**_<u>Polymorphism</u>_**
Poly -> many morph -> forms
Means taking many forms that is a particular method taking different forms in different contexts which is used when a child inherits form a parent and it wants to modify a current functionality of the parent -> it uses polymorphism to override it.
MJPEG stream demo server by Reactor netty
Tags: java, netty, reactiveprogramming, projectreactor
Published: 2024-04-21 14:27:01

A motion JPEG stream http server which is made by using Project Reactor framework. The source code is on [https://github.com/saladlam/netty-mjpeg-demo-server](https://github.com/saladlam/netty-mjpeg-demo-server).
DECISION TABLE
Published: 2024-04-21 14:25:22

A decision table is a structured representation of a decision-making process, often used in business analysis, software testing, and decision support systems. It helps organize complex logic and conditions into a tabular format, making it easier to understand and manage.

Here's a typical structure of a decision table:

**Conditions or Criteria:** These are the factors or conditions that influence the decision. They represent the different inputs or variables that need to be considered.

**Rules:** Each row in the decision table represents a specific combination of conditions and the corresponding decision or action to be taken based on those conditions.

**Actions or Decisions:** These are the possible outcomes or decisions that can result from the combination of conditions. Each action corresponds to a particular set of conditions being met.

**Columns:** Decision tables typically have columns representing each condition, as well as columns for the resulting actions or decisions.

The decision table allows for the representation of various combinations of conditions and corresponding actions, making it easier to visualize and analyze complex decision-making processes. It can also help identify inconsistencies, redundancies, or gaps in logic.

Now let's make a decision table for the following conditions:
1. Blank Field
2. Phone Number
3. Mail ID
4. Availability of Appointment Date/Time

_**PS: YOU CAN USE THE FORMULA 2^(NO.OF FIELDS/CONDITIONS) TO COME UP WITH RULES. HERE IT IS 2^4 THAT IS 16 RULES.**_

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dqv9kqblkyd23iuqwp2t.png)
Label Encoding && One-Hot Encoding
Published: 2024-04-21 14:22:20

Label Encoding ve One-Hot Encoding, kategorik verileri sayısal hale getirmek için kullanılan iki popüler tekniktir. Her ikisinin de kullanım durumları vardır:

**Label Encoding:** Bu teknik, nominal (isimsel) kategorik verileri sayısal hale getirir. Ancak, bu teknikle dönüştürülen verilerde bir "sıralama" ya da "önem" ilişkisi oluşabilir. Yani, model bazen 1'in 0'dan, 2'nin 1'den daha "önemli" olduğunu varsayabilir. Bu nedenle, _Label Encoding genellikle ordinal (sıralı) kategorik veriler için kullanılır_ çünkü bu tür verilerde zaten belirli bir sıralama vardır.

**One-Hot Encoding:** Bu teknik, _nominal kategorik verileri sayısal hale getirir_ ve her bir kategori için ayrı bir özellik (kolon) oluşturur. Her kategori için oluşturulan bu yeni özellikler, o kategorinin varlığını (1) veya yokluğunu (0) gösterir. Böylece, modelde yanıltıcı bir "sıralama" ya da "önem" ilişkisi oluşmaz. Ancak, One-Hot Encoding çok fazla kategoriye sahip verilerde çok sayıda özellik oluşturacağı için "boyutluluk laneti"ne yol açabilir. Bu durumda, daha düşük boyutlu bir kodlama tekniği kullanılabilir.

Hangi tekniğin kullanılacağına, verinin türüne, modelin türüne ve belirli bir durumun gereksinimlerine bağlıdır.

## Boyutluluk laneti

"One Hot Encoding" genellikle kategorik verileri sayısal formata dönüştürmek için kullanılan bir tekniktir. Ancak, bu teknik bazen "boyut laneti" (Curse of Dimensionality) adı verilen bir soruna yol açabilir.

Boyut laneti, verinin özelliklerinin (veya boyutlarının) sayısı arttıkça, bu boyutların her birinde yeterli miktarda veri elde etmek için gereken veri miktarının geometrik olarak arttığını ifade eder. Yani, boyut sayısı arttıkça, modelin bu boyutlardaki ilişkileri öğrenmesi ve genelleme yapabilmesi için gereken veri miktarı da çok hızlı bir şekilde artar.

One Hot Encoding'de, her kategori için ayrı bir özellik (veya boyut) oluşturulur. Bu nedenle, kategorik değişkenlerin çok fazla benzersiz değeri varsa, one hot encoding sonucunda çok büyük bir özellik matrisi oluşabilir. Bu durumda, modelin bu kadar çok özelliği öğrenebilmesi için çok daha fazla veriye ihtiyaç duyulur ve bu da boyut laneti sorununa yol açabilir.

Bu sorunu çözmek için farklı teknikler kullanılabilir. Örneğin, benzer kategoriler gruplanabilir veya daha az boyutlu bir gösterim sağlayan teknikler (örneğin, embedding) kullanılabilir.
System with real - time data using Javascript and Firebase
Tags: javascript, beginners, ai, html
Published: 2024-04-21 14:13:52



HTML:
```
<input id="username" type="text" placeholder="Username">
<input id="email" type="email" placeholder="Email">
<button id="create-user">Create User</button>

<div id="user-list"></div>
```
JavaScript:
```
const createUserButton = document.getElementById('create-user');
const userListDiv = document.getElementById('user-list');

createUserButton.addEventListener('click', createUser);

function createUser() {
  const username = document.getElementById('username').value;
  const email = document.getElementById('email').value;

  // Create a new user in Firebase Realtime Database
  firebase.database().ref('users').push({
    username,
    email
  });
}

// Listen for changes to the users data in real-time
firebase.database().ref('users').on('child_added', (data) => {
  const user = data.val();
  const userElement = document.createElement('div');
  userElement.innerHTML = `${user.username} (${user.email})`;
  userListDiv.appendChild(userElement);
});
``
input a username and email, and a button to create a new user. When the button is clicked, it creates a new user in Firebase Realtime Database. The code also listens for changes to the users data in real-time, and updates the user list div with the new user information.
Recover your stolen crypto assets with certified experts
Published: 2024-04-21 13:57:20

Have you fallen victim to cryptocurrency scams? Lost your hard-earned digital assets to cunning fraudsters? Don't despair! We're here to help you reclaim what's rightfully yours. we understand the frustration and devastation of losing your crypto investments to scams. That's why we've assembled a team of seasoned experts dedicated to recovering your stolen assets. With our proven track record and advanced techniques, we've helped countless individuals. Don't let scammers get away with your hard-earned money, Contact us now for a secure and efficient solution.


🌐 Contact Us 🌐
📞 Phone: +19723798586
📧 Email: writeus@mistroethicalhack.pro
🌍 Website: https://mistroethicalhack.pro/
📧 Telegram chat: https://t.me/Mistro_ethical
Demystifying AWS IAM: Best Practices for User Group Management and Role Creation
Published: 2024-04-21 13:45:33

Introduction: In this blog, we will explore the best practices for managing user groups, creating roles, and configuring STS policies in AWS IAM to ensure secure access to resources.

User Group Management: Create user groups to streamline permissions management and reduce the risk of errors. Follow the principle of least privilege and grant only necessary permissions to each group.

Role Creation: Define roles with specific permissions for entities like IAM users or AWS services. Adhere to the principle of least privilege, regularly review and update roles to align with security policies.

STS Policies: Define permissions for roles using STS policies to control actions and limit permissions scope. Review and test policies to ensure they align with access control rules.

Conclusion: Implementing effective user group management, role creation, and STS policy configuration enhances security, access control, and compliance in AWS IAM. Following best practices ensures a robust IAM strategy in the cloud environment.

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