teleren/devto huggingface dataset:
Estrutura de Dados parte 2: Algoritmos de busca.
Tags: javascript, programming, tutorial, codenewbie
Published: 2023-02-17 19:54:15

Um dos conceitos mais importantes dentro da ciência da computação atualmente se refere à busca de dados dentro de uma estrutura. Com o número de informações disponíveis na rede, a busca eficiente por um elemento se tornou parte importante do trabalho de um desenvolvedor de software. Diante disso, surgem dois principais métodos de busca: o algorítimo de busca sequencial e o algoritmo de busca binária.

## Busca Sequencial

Como o próprio nome já sugere, o algorítimo de busca sequencial — podendo ser chamado também de busca linear — é uma estrutura de dados que percorre cada elemento de um vetor até encontrar o valor desejado. O algorítimo sequencial possui complexidade O(n), ou seja: apesar de funcionar para vetores com poucos elementos, o mesmo pode se tornar custoso na medida em que o número de elementos dentro do vetor cresce, tendo seu pior caso o enésimo elemento de um determinado array: A = {0... N-1}.

Veja o exemplo de um algoritmo de busca linear abaixo:


![Imagem mostrando o código para executar o algoritmo de busca linear](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bfryfy4kdk2ahjvtt53.png)

É importante notar no código acima que, apesar do vetor estar desorganizado, isso não altera o retorno da função. Isso ocorre porque o algoritmo de busca sequencial independe do vetor estar ordenado para funcionar!


## Busca Binária

Se a busca sequencial pode se tornar custosa a medida em que o número de elementos dentro de um vetor cresce, o algoritmo de busca binária surge como uma maneira mais eficiente de encontrar um elemento dentro de um array. 

Tendo seu tempo de execução **O(log n)**, o algoritmo funciona verificando o item que está no meio do vetor, e caso não seja o valor correto, podemos eliminar uma das metades do array. A partir disso, ele divide repetidamente a metade que possivelmente contem o item, até que a lista seja reduzida somente em um elemento.


![Imagem mostrando código para executar o algoritmo de busca binária](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvagq6sv2tk91skhn0ek.png)

Dividindo o número de elementos presentes no vetor a cada execução, o algoritmo binário diminui o número de interações necessárias para encontrar o elemento desejado, tornando-o assim mais eficiente que o algoritmo linear.

Abaixo uma comparação gráfica entre os dois:


![Gráfico demonstrando a eficiência de dos algoritmos](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ds698z3ats17bhs21pz.png)

Por levar em consideração os maiores e menores números de um vetor para fazer a divisão, o algorítimo de busca binária obrigatoriamente precisa de um array ordenado para funcionar. Por conta disso, pode ser necessária a utilização de um algoritmo de ordenação antes de utilizá-lo.
El TransPerfect Mountain Challenge 2023 inicia su cuenta atrás
Published: 2023-02-17 19:53:36

enía algunas tarjetas de crédito que mantenía al corriente de pago. En 2017, solicitó un crédito para someterse a un procedimiento de ortodoncia. Poco tiempo después, en su trabajo no le dejaron seguir haciendo horas extras, con la consiguiente pérdida de ingresos. Para pagar los créditos, el deudor intentó refinanciarlos mediante otras entidades que, aunque le permitían nuevos créditos, también le obligaban a solicitar importes más altos. En 2019, la empresa con la que seguía el tratamiento bucodental cerró y, al estar en medio del tratamiento, se vio en la necesidad de coger un nuevo crédito para pagar a otro dentista. En 2020, con la llegada del COVID-19, se redujeron los ingresos y no pudo seguir afrontando las cuotas de los créditos anteriormente contraídos. Además, a inicios de 2021, con la llegada de la borrasca Filomena, necesitó mudarse ya que en el piso donde se encontraba no tenía calefacción. A día de hoy, vuelve a estar contratado a jornada completa pero aún así no le ha sido posible hacer frente al pago de todas sus obligaciones con sus ingresos.

Una vez estudiado el caso, los abogados de Repara tu Deuda iniciaron los trámites para que pudiera acogerse a la Ley de Segunda Oportunidad. Ahora está liberado del 100% de sus deudas. Cada día se están produciendo cancelaciones de deudas en alguna parte de España. Esto está haciendo que muchas personas que se encuentran en una situación de bloqueo económico debido a las deudas confíen en la Ley de Segunda Oportunidad y soliciten el servicio de abogados especialistas en nuestro país. Según aseguran los abogados de Repara tu Deuda, "la Ley de la Segunda Oportunidad está siendo cada vez más conocida porque ha entrado en muchos hogares que anteriormente no sabían que existía un mecanismo legal desde el año 2015 previsto para la cancelación de las deudas".
https://www.informativosaopaulo.com/                           
https://www.desapertofinanceiro.com/                        
https://www.motivoempreendedor.com/  
https://www.belohorizonteuniversal.com/                  
https://www.correiorecife.com/                           
https://www.visaodosul.com/                              
https://www.brasiliadeultimahora.com/                      
https://www.somosnoticias.mx/
https://www.noticiasnacional.mx/
https://www.diariomeridiano.mx/
LeetCode #283 Move Zeroes with JavaScript
Tags: javascript, algorithms, leetcode
Published: 2023-02-17 19:33:38

Solution to LeetCode's [283. Move Zeroes] (https://leetcode.com/problems/move-zeroes/description) with JavaScript.

## Solution
```js
/**
 * @param {number[]} nums
 * @return {void} Do not return anything, modify nums in-place instead.
 */
const moveZeroes = (nums) => {
  for (let i = nums.length - 1; i >= 0; i--) {
    if (nums[i] === 0) {
      nums.splice(i, 1);
      nums.push(0);
    }
  }
};
```
- Time complexity: O(n)
- Space complexity: O(1)

It is important to process from the back of the array, since 0 is added to the end of the array.
Terraform bastion module using autoscaling group
Published: 2023-02-17 19:32:49

Hi, devops fans

As continuation of post related to "[How to deploy high available Elasticsearch cluster at AWS OpenSearch using terraform](https://sergiiblog.com/how-to-deploy-a-high-available-cluster-at-aws-opensearch/)" a new articles appeared:

[Terraform bastion module using autoscaling group](https://sergiiblog.com/terraform-bastion-module/)

Have a pleasant reading
One App 5 Frameworks - Chapter 2: Vue
Tags: vue, webdev, javascript
Published: 2023-02-17 19:29:35

Vue is a lightweight, easy-to-learn JavaScript framework that's great for building user interfaces. It has a simple syntax and a reactive data model, making it easy to build dynamic, interactive applications.

## Learning Curve

In my experience, Vue has the lowest learning curve of the three frameworks. Its simple syntax and clear documentation make it easy to get started, even for developers who are new to front-end development. 

Angular, on the other hand, has a much steeper learning curve. It has a lot of features and concepts to master, and it can be overwhelming for developers who are new to the framework. 

React falls somewhere in between, with a moderate learning curve. It's relatively easy to pick up, but you'll need to use third-party libraries to add additional functionality.

## Performance

When it comes to performance and scalability, all three frameworks are capable of building high-performance applications. 

That said, Vue has a reputation for being particularly fast, thanks to its lightweight design and efficient rendering engine. Angular and React are also fast, but they may require more optimization to achieve the same level of performance as Vue.

## Developer Experience

Vue has a simple syntax and a clear separation of concerns between the template, script, and style, making it easy to understand and maintain.

I used Pinia as a store for the application I built, Its very lightweight and integrates very well with vue3.

## Conclusion
Vue is a very strong recommendation from me if you want to learn web development and don't have the time to explore and cherry pick all the options that react has to offer.

with Nuxt serving all the SSR requirements, Vue will be one of the frameworks I will take into initial consideration while developing any web application.

## Application
Checkout the application [here](https://github-repo-finder-vue.netlify.app/).
Java VS JavaScript
Tags: javascript, java, beginners
Published: 2023-02-17 19:28:45

Despite their similar-sounding names, Java and JavaScript are two completely different programming languages. While both are widely used in web development, they have distinct characteristics and use cases. In this article, we'll explore the differences between Java and JavaScript.

## Java: A General-Purpose Language

Java is a general-purpose programming language that was created in 1995 by Sun Microsystems. It was designed to be platform-independent, meaning that it can run on any device with a Java Virtual Machine (JVM) installed. Java is an object-oriented language, which means that it's based on the concept of objects, which have properties and methods.

Java is used for a wide range of applications, including desktop applications, mobile apps, and web applications. It's also used in server-side programming, such as building enterprise-level web applications. Some popular examples of Java-based frameworks and platforms include Spring, Hibernate, and Apache Struts.

## JavaScript: A Scripting Language for the Web

JavaScript, on the other hand, is a client-side scripting language that was created in 1995 by Brendan Eich at Netscape. It was initially designed to add interactivity to web pages, such as validating form data and creating pop-up windows. Today, JavaScript is used for a wide range of web development tasks, including creating dynamic user interfaces, building web applications, and creating server-side applications.

JavaScript is an interpreted language, which means that it's executed by the web browser on the client-side. It's often used in conjunction with other web technologies, such as HTML and CSS, to create interactive and responsive web pages. Some popular examples of JavaScript-based frameworks and libraries include React, Angular, and Vue.js.

## Differences Between Java and JavaScript

While Java and JavaScript share some similarities, they are different in many ways. Here are some key differences between the two languages:

### Syntax: 
Java and JavaScript have different syntaxes. Java is a statically typed language, which means that variables must be declared with their data types. JavaScript is a dynamically typed language, which means that variables don't need to be declared with data types.

### Object-Oriented Programming: 
Java is a pure object-oriented language, which means that everything in Java is an object. JavaScript, on the other hand, is a prototype-based language, which means that objects are created by cloning existing objects.

### Platform: 
Java is platform-independent, which means that it can run on any device with a JVM installed. JavaScript is executed by the web browser, which means that it can only run in a web environment.

### Libraries and Frameworks: 
Both Java and JavaScript have extensive libraries and frameworks that are used for web development. However, the libraries and frameworks used in Java are often geared towards enterprise-level applications, while those used in JavaScript are often used for front-end development.
PICO-8 Game : Tomato Run
Tags: gamedev, showdev, pico8, retro
Published: 2023-02-17 19:18:09

## Tomato Run

### Description

This is an endless running platformer game, where i you just have to earn the highest running distance, and highest points.

You may step on the crows to add more points!

You may double jump to avoid falling into the cliff.

You may shoot tomato seed to hurt these crows.

Collect higher points by stepping consecutively on the crow.

### Controls

#### Using keyboard

z to jump
x to shoot tomato seed
← to go slower
→ to go faster

#### Using gamepad

○ to shoot tomato seed
× to shoot tomato seed
← to go slower
→ to go faster

### Story

One beautiful day, when Tommy was just a normal tomato, he is just sitting on the field without doing anything. But magically, there is a fairy who gave Tommy a consciousness, then he starts moving.

Because Tommy has just had his consciousness, he knows nothing but to move forward.

Avoid the crows who are trying to eat Tommy. For them, Tommy is just a moving food.

The fairy gave tommy a power to shoot seeds. It is strong enough to hurt these crows.

### The Game

Please access the link below to play the game.

[https://takaneichinose.itch.io/tomato-run](https://takaneichinose.itch.io/tomato-run)
Operador Ternario en C#
Published: 2023-02-17 19:17:36

El operador ternario en C# es una herramienta útil para simplificar el código y tomar decisiones basadas en una condición booleana. 

los operadores ternarios son utilizado en muchos lenguajes de programación y puede resultar confuso si no comprendes adecuadamente su sintaxis y funcionamiento. 
En este artículo, vamos a explorar cómo funciona el operador ternario simple en C# y cómo puedes utilizarlo en tus proyectos.

En su forma más básica, el operador ternario(?) es una forma abreviada de escribir una sentencia if,else. 
Nos permite establecer un valor o una expresión basada en una condición booleana. La sintaxis del operador ternario es la siguiente:

```
condición ? valorSiVerdadero : valorSiFalso
```

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



En esta sintaxis, **condición** es la expresión booleana que se evalúa. Si la condición es verdadera, la expresión **valorSiVerdadero** se evalúa y se devuelve como resultado. Si la condición es falsa, se evalúa la expresión **valorSiFalso** y se devuelve como resultado. En otras palabras, el operador ternario funciona como una expresión que devuelve un valor u otro dependiendo de la evaluación de la condición.

Aquí hay un ejemplo de cómo se puede utilizar el operador ternario en C#:

```csharp
int edad = 23;
string comprobacionEdad = edad > 18 ? "Mayor de edad" : "Menor de edad";
Console.WriteLine($"El usuario es {comprobacionEdad}");
```

En este ejemplo, la variable edad se evalúa para ver si es mayor de edad. Si es así, la expresión "Mayor de edad" se devuelve como resultado y se asigna a la variable comprobacionEdad. Si edad es menor o igual a 18, la expresión "Menor de edad" se devuelve como resultado y se asigna a la variable comprobacionEdad.

Una de las ventajas de utilizar el operador ternario en lugar de una sentencia if-else es que puede ayudar a simplificar el código y hacerlo más fácil de leer. También puede ser más eficiente en términos de rendimiento, ya que evita la necesidad de ejecutar una sentencia if-else completa.

Es importante entender que el operador ternario no es adecuado para todas las situaciones. Si tienes una condición compleja o necesitas ejecutar varias instrucciones en cada rama de la sentencia if-else, es posible que sea más adecuado utilizar una sentencia if-else completa en lugar del operador ternario. Además, no abuses del operador ternario ya que el código puede volverse difícil de leer si se utilizan demasiadas expresiones complejas u operadores ternarios anidados.

En conclusión, el operador ternario es una herramienta útil que puede ayudarte a simplificar el código y tomar decisiones basadas en una condición booleana en C#. Si lo utilizas de forma adecuada, puede mejorar la legibilidad y la eficiencia de tu código. Sin embargo, es importante recordar que no es adecuado para todas las situaciones y que es importante utilizarlo con moderación.

Gracias por leerme, nos vemos en [Twitter](https://twitter.com/veronicaguamann).
Tables with Supabase
Tags: webdev, javascript, beginners, supabase
Published: 2023-02-17 19:16:10

{% embed https://www.youtube.com/watch?v=qX0YS2hYuOA %}

Supabase is an open-source database as a service (DBaaS) that allows developers to build scalable and secure applications quickly. One of the key features of Supabase is its support for tables, which are used to store data in a structured way. In this article, we'll explore how to use tables on Supabase.

To create a table on Supabase, you'll need to first create a new database. Once you've done that, you can create a new table by clicking on the "Tables" tab in the Supabase dashboard, and then clicking "Create Table". From here, you can define the columns for your table, along with their data types, constraints, and other attributes.

After you've created your table, you can start populating it with data. Supabase provides a range of APIs and tools for interacting with your table, including SQL queries, REST APIs, and GraphQL APIs. You can use these tools to insert, update, and delete data from your table, as well as to retrieve data for use in your application.

In addition to basic CRUD (create, read, update, delete) operations, Supabase also provides advanced features for working with tables, such as real-time updates, triggers, and indexes. Real-time updates allow you to receive real-time notifications when data in your table changes, while triggers allow you to automate certain actions based on changes in your table. Indexes, on the other hand, can be used to optimize queries and improve the performance of your application.

In conclusion, Supabase provides a powerful and easy-to-use interface for working with tables. With its support for real-time updates, triggers, and indexes, it's an excellent choice for building scalable and secure applications. Whether you're building a small web application or a large enterprise system, Supabase's tables can help you store and manage your data effectively.

Guillaume Duhan
Struggling to fix: Bluetooth connection failed: protocol not available?
Tags: bluetooth, linux
Published: 2023-02-17 19:03:15

Well after upgrading my Linux version am using Parrot Electro Ara 5.1 i was not able to use my JBL headphones since bluetooth threw an error i couldn't catch lol!
after a week of struggling with this issue i managed to solve it with just 5 lines of code. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f84pvc4x2r0zythzkq4x.png)

Below are the solutions to above problem. 
I preffered using Geany to edit 
sudo geany /etc/pulse/default.pa

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


(Edit geany to use editor of your preference)

Move to line 65 and comment this line 
```
load-module module-bluetooth-discover
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dusnj7i15sfn48uc2i1x.png)
 upon edit it should look like 
```
#load-module module-bluetooth-discover
```
Next edit the pulse-audio
sudo geany usr/bin/start-pulseaudio-x11
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4thl26kri5va4vt8bc0v.png)

Add to line 37

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



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

Add this line on line 37
/usr/bin/pactl load-module module-bluetooth-discover

save this script and you are good to reboot. 

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


Enjoy
Connect to Docker Containers with GoTTY
Tags: go, python, docker, gamedev
Published: 2023-02-17 18:31:44

### What I did

I would like to put my game in Python on my website. There're so many ways to implement my idea. Finally, I decided to use GoTTY to connect to my Docker container. 

Enter the container
```
docker exec -it [container id] sh
```

In the container, I executed the command like this
```
gotty -w -p 9998 python [your_script] 
```

### How it looks like
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mlcsbauokabiicd3867a.png)

> I used Caddy as my web server !!


### Reference
[GoTTY: Share your terminal as a web application](https://github.com/yudai/gotty)
[Caddy](https://github.com/caddyserver/caddy)
DevOps to DevTestOps
Tags: tutorial, devops
Published: 2023-02-17 18:25:58

DevTestOps is a combination of DevOps and continuous testing.

Testing in DevTestOps is early, often, and happens throughout the software development lifecycle. It allows for quick and reliable releases.
Conducting the testing process as early as possible in agile teams is crucial to move into the fast lane, and to do so requires DevTestOps.

According to mabl.com DevTestOps manifestoes are:-
    a) Continuous testing rather than waterfall testing.
    b) Applying all testing activities rather than only automated functional testing.
    c) Testing only those having values rather than testing everything.
    d) Testing happens across the team rather than testing in siloed testing departments.
    e) Focus on product coverage rather than code coverage.

While DevOps aims to work to increase the collaboration between developers and operation teams, the goal of all DevTestOps is to include continuous testing in the DevOps process.

In simple words, when continuous testing is merged with DevOps, it is called DevTestOps. Also, when we say continuous testing, it means that there is more focus placed on starting the testing process right from the requirement consideration and continuing it through the production and monitoring phase.

The ultimate motive of DevTestOps is to test as often as possible and automate the process, saving time and effort for developers, testers, operators, and other team members.