teleren/devto huggingface dataset:
Pointer and Array in C programming.
Published: 2024-01-04 23:49:00

**Printing corresponding address of each element of an array.**
```
int main() {
    
    int numbers[5] = {1, 2, 5, 8, 3};
    
    for (int i=0; i<5; i++){
        printf("%d = %p\n", numbers[i], &numbers[i]);
    }
    return 0;
}
```
Output:
```
1 = 0x7ffffa8cf140
2 = 0x7ffffa8cf144
5 = 0x7ffffa8cf148
8 = 0x7ffffa8cf14c
3 = 0x7ffffa8cf150
```

**Printing array elements address without index value.**
```
int main() {
    
    int numbers[5] = {1, 2, 5, 8, 3};

    printf("Array address: %p", numbers);
    return 0;
}
```
Output:
```
Array address: 0x7ffcf4fe97c0
```
- The memory address of the first array element and the address of the array is the same.This is because the address of the array always points to the first element of the array.
- Also in the above code to print the array address we have used only the name of the array instead of the `&` sign. This is because in most context array names are by default converted to pointers and we can directly use name of the array without `&` sign.

**Print other array elements address without index value**
`printf("Array address: %p", numbers + 1);` - this will print the second element.
`printf("Array address: %p", numbers + 2);` - this will print the third element.

**Printing array element's memory address using for loop without index value.**
```
int main() {
    
    int numbers[5] = {1, 2, 5, 8, 3};
    
    for (int i=0; i<5; i++){
        printf("%d = %p\n", numbers[i], numbers + i);
    }

    return 0;
}
```
Output:
1 = 0x7ffccb8a1d70
2 = 0x7ffccb8a1d74
5 = 0x7ffccb8a1d78
8 = 0x7ffccb8a1d7c
3 = 0x7ffccb8a1d80

**Access array element using pointer.**
In order to use array elements using pointers, we have to use `*(numbers + i)` 
```
int main() {
    
    int numbers[5] = {1, 2, 5, 8, 3};
    
    for (int i=0; i<5; i++){
        printf("%d = %p\n", *(numbers + i), numbers + i);
    }

    return 0;
}
```
Output:
```
1 = 0x7fff49ac30b0
2 = 0x7fff49ac30b4
5 = 0x7fff49ac30b8
8 = 0x7fff49ac30bc
3 = 0x7fff49ac30c0
```

**Change array elements using pointers **
```
int main() {
    
    int numbers[5] = {1, 2, 5, 8, 3};
    
    *numbers = 76;
    *(numbers + 1) = 89;
    
    printf("%d ", *numbers);
    printf("%d", *(numbers+1));

    return 0;
}
```
DeVILBISS México: Innovación y Excelencia en Equipos de Pulverización
Published: 2024-01-04 23:07:21

DeVILBISS México se ha establecido como un líder indiscutible en la industria de equipos de pulverización desde su fundación en 1888. Su trayectoria de más de un siglo ha sido marcada por una constante innovación y adaptabilidad, posicionándola a la vanguardia de la tecnología de acabado de superficies. La marca es reconocida por desarrollar algunas de las primeras pistolas de pulverización de alta eficiencia, revolucionando el mercado con tecnologías que mejoran significativamente el proceso de acabado en diversas industrias.

La gama de productos de DeVILBISS México incluye pistolas de pulverización y accesorios de vanguardia, diseñados para satisfacer las necesidades específicas de diferentes aplicaciones. En el sector automotriz, sus equipos son esenciales para aplicar pintura de manera uniforme y de alta calidad. En la manufactura, las herramientas DeVILBISS son fundamentales para aplicaciones que requieren un control preciso del material. La presencia de DeVILBISS México en sectores como la aeronáutica y la carpintería demuestra su adaptabilidad y compromiso con la precisión y calidad en cada acabado.

Lo que distingue a DeVILBISS México es su enfoque en la calidad superior y la precisión. La marca asegura que cada producto no solo cumpla con los estándares de la industria, sino que los supere, estableciendo nuevos referentes en términos de rendimiento y durabilidad. Este enfoque beneficia enormemente a los usuarios, ofreciendo una reducción en el desperdicio de material y un ahorro significativo a largo plazo.

DeVILBISS México no solo se centra en el presente, sino que también mira hacia el futuro. La empresa invierte continuamente en investigación y desarrollo, buscando innovar y anticipar las tendencias del mercado. Este compromiso con la mejora constante asegura que DeVILBISS México se mantenga a la vanguardia de la tecnología de pulverización, ofreciendo a sus clientes lo último en soluciones de acabado.

La sostenibilidad y el respeto por el medio ambiente son también aspectos clave en la filosofía de [DeVILBISS México](https://devilbiss-mexico.com/). La empresa está comprometida con el desarrollo de productos que no solo sean eficientes y efectivos, sino también amigables con el medio ambiente. Este enfoque holístico asegura que DeVILBISS México no solo lidere en términos de innovación y calidad, sino también en responsabilidad ambiental.

En conclusión, DeVILBISS México representa la excelencia en la industria de equipos de pulverización. Con su enfoque en la calidad, la innovación y la sostenibilidad, la marca no solo satisface las necesidades actuales del mercado, sino que también lidera el camino hacia el futuro, estableciendo nuevos estándares de excelencia en la industria. DeVILBISS México es más que una marca; es un sinónimo de calidad, innovación y compromiso con el futuro de la tecnología de pulverización.
Equipsa: Innovación y Calidad en Equipos de Pintura y Recubrimiento en México
Tags: equipsa, graco, sames, devilbiss
Published: 2024-01-04 22:55:49

[Equipsa](https://equipsa.mx/), un distribuidor líder en México, se ha consolidado como referente en la venta y servicio de equipos para la aplicación de pinturas y recubrimientos. Representando marcas de renombre mundial como Graco, [Binks](https://equipsa.mx/), Sames, [DeVILBISS](https://equipsa.mx/), y otras, Equipsa combina la excelencia en calidad con innovación tecnológica. Este artículo explora cómo Equipsa ha revolucionado el sector con soluciones personalizadas, soporte técnico experto y un enfoque en la satisfacción del cliente, destacando su compromiso con la eficiencia, durabilidad y tecnología de vanguardia en el mercado mexicano.

Equipsa se ha establecido como un pilar en la industria de aplicación de pinturas y recubrimientos en México, gracias a su enfoque en la calidad y la innovación. La empresa destaca por su sólida asociación con marcas líderes a nivel mundial como Graco, Sames y DeVILBISS, lo que les permite ofrecer una amplia gama de productos avanzados y soluciones personalizadas para satisfacer las necesidades específicas de sus clientes.

La clave del éxito de Equipsa radica en su compromiso con la tecnología y la eficiencia. Sus equipos de pulverización y acabado están diseñados para maximizar la productividad y reducir el desperdicio, lo cual es esencial en sectores como la industria automotriz, la construcción y la manufactura. La empresa también se distingue por su atención al detalle y su dedicación al servicio al cliente, proporcionando asesoramiento experto y soporte técnico integral.

Además, Equipsa se mantiene a la vanguardia de la innovación en su campo. Continuamente exploran y adoptan nuevas tecnologías para mejorar sus productos y servicios. Esto no solo beneficia a sus clientes en términos de calidad y rendimiento, sino que también refleja su compromiso con prácticas sostenibles y respetuosas con el medio ambiente.

Uno de los aspectos más destacados de Equipsa es su enfoque en la formación y el desarrollo de sus empleados. Esto asegura que su equipo esté siempre equipado con el conocimiento más actualizado y las habilidades necesarias para proporcionar el mejor servicio posible.

Equipsa se posiciona como un líder indiscutible en el mercado mexicano de equipos de pintura y recubrimiento. Su compromiso con la calidad, la innovación y el servicio al cliente, combinado con su asociación con marcas de renombre mundial, asegura que Equipsa continúe siendo un aliado valioso para las empresas en busca de soluciones de acabado de alta calidad.
Terraform for Google Cloud
Tags: terraform, iaac, googlecloud, devops
Published: 2024-01-04 22:50:32

Just leaving the link to my Terraform repo here. It's set up for various GCP services that I'm using in a project. Might be useful for some of you.

- VPC Configuration: A new VPC is configured with the intent to utilize all services within a single VPC.
- Compute Engine Setup: A compute engine is set up to read the Cloud SQL via a private IP, configured in another module. A startup-script.sh is included, which has code to establish SSH connection directly from the local machine.
- Cloud Run Creation: A Cloud Run is created in version V2 with Direct VPC Connection to Cloud SQL.
- Automated Cloud Build Mechanism: A mechanism is set where the cloud build is triggered automatically following the code push to the repository that builds the image.

[https://github.com/mazzasaverio/terraform-gcp](https://github.com/mazzasaverio/terraform-gcp)
Understanding Placement Groups: Optimize Your EC2 Instance Deployment
Published: 2024-01-04 22:49:02



Placement groups help you to organise your instances. They help to control where your instances are placed in a group of physical servers within an Availability zone in the AWS cloud. There are three types of placement groups:

-  Cluster

-  Partition

- Spread

#### Cluster
In the cluster arrangement, instances are packed close together in an Availability zone. This has the advantage of reducing latency because the instances are placed on the same hardware rack in the same AZ. It is recommended for applications that require low latency and high network throughput. The disadvantage of this arrangement is that if an hardware failure occurs, all the instances may be affected as a result of reduced hardware fault tolerance for instances within the group. One common error with launching instances in a cluster is insufficient capacity error. The solution to this is to stop and start all of the instances in the placement group and retry the launch. It is recommended to use a single launch request to launch the number of instances that you need in the placement group. A single launch request means launching the instances in a single API call (launch at once). Also, using the same instance type for all the instances will help to prevent this error.


To create a cluster placement group from the AWS CLI use the following command:

<pre>aws ec2 create-placement-group --group-name <my-cluster> --strategy cluster</pre>

#### Partition
In partition placement group, groups of instances are placed in different logical isolations called partitions. Each partition has its own hardware. Instances within a partition share the same hardware but they do not share hardware with groups of instances in another partition. This allows for isolation and minimises hardware failure within your application. It is beneficial for launching large distributed workloads and replicated workloads e.g HDFS, HBase and Cassandra. Partitions can be created accross multiple AZs in the same region.


To create a partition placement group named Phoenix-APP with six partitions from the AWS CLI use the following command:

<pre>aws ec2 create-placement-group --group-name Phoenix-APP --strategy partition --partition-count 6</pre>

#### Spread
In spread placement group, EC2 instances are placed accross distinct underlying hardware partitions to reduce the risk of failure by providing isolation. It is especially beneficial for critical applications. Instances can be placed accross racks or hosts. Racks can span accross multiple AZs in the same region. Hosts are applicable to AWS Outpost. In racks, a maximum of 7 instances per availability zone is permitted.

To create a cluster placement group from the AWS CLI use the following command:

<pre>aws ec2 create-placement-group --group-name <my-cluster> --strategy spread</pre>









Reference:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html?icmpid=docs_ec2
[Desafio] - Race Condition em Sistemas Distribuídos
Published: 2024-01-04 22:42:19

> Conteúdo original em https://twitter.com/zanfranceschi/status/1743040590751977636

---
Ei dev,

Eu tenho a solução para sua falta de novos problemas! Yey 🥹

Cola aqui pra resolver esse desafio de RACE CONDITION em um SISTEMA DISTRIBUÍDO de compras.

↓

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

---
DISCLAIMER: É um cenário simplificado e hipotético. (O diagrama tá em inglês porque vocês são tudo metido a besta, mas saibam que prefiro em pt_BR 💅).

Acredito que esse desafio seja adequado pra quem já é pleno – talvez os sandy e júnior sofram um pouco pra resolvê-lo.

---
CENÁRIO: Um conjunto de aplicações com serviços assíncronos de cadastro de cliente e processamento de pagamentos de compras.

However, existe a premissa de que um cliente já esteja persistido no banco do serviço de pagamentos para que os pagamentos sejam processados.

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

---
E para que essa premissa seja satisfeita, o serviço de cadastro emite um evento sempre que um cliente for cadastrado. A imagem mostra esse fluxo.

(Obs.: Esse padrão em que serviço de pgto guarda uma referência do cliente se chama "Event-Carried State Transfer" – já falei sobre.)

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

> https://twitter.com/zanfranceschi/status/1511294401603006465

---
O PROBLEMA:

Só que para novos clientes, às vezes acontece do comando para processar o pagamento ser consumido antes do consumo do evento de cadastro do cliente. Temos aí um cenário de RACE CONDITION! Ebaaa! 🥲

E aí, o pessoal te incumbiu de resolver esse problema.

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

---
E pro problema ficar ainda mais problemático (afinal queremos problemas aqui, não é mesmo?), te pediram pra evitar o uso de banco de dados para essa resolução – lhe pediram para que use outras filas (??).

E aí, dev com tempo livre em busca de problemas, como resolve isso?!

---
Muito obrigado a você que chegou até aqui!!! ♥️
Comment on peut containeriser une application Next.js
Published: 2024-01-04 22:41:06

Pour containeriser une application Next.js, vous pouvez utiliser Docker pour créer un fichier Dockerfile et un fichier .dockerignore. Voici un exemple de configuration basique :

**1- Créer un fichier Dockerfile :**

```
# Utiliser une image Node.js comme base
FROM node:18-alpine

# Créer un répertoire de travail dans le conteneur
WORKDIR /usr/src

# Copier package.json and package-lock.jsondans le conteneur
COPY package* .

# Installer les dépendances
RUN npm install

# Copier le source code
COPY . .

# Construire l'application Next.js
RUN npm run build

# Exposer le port utilisé par l'application Next.js
EXPOSE 3000

# Démarrer l'application
CMD ["npm", "start"]
```
**2- Créer un fichier .dockerignore :**

Créez un fichier nommé .dockerignore pour spécifier les fichiers ou répertoires à exclure lors de la copie dans l'image Docker. Par exemple :

```
node_modules
```
**3- Construire l’image Docker :**

Placez ces fichiers à la racine de votre application Next.js, puis exécutez les commandes suivantes dans votre terminal pour construire et exécuter le conteneur :

```
# Construire l'image Docker (assurez-vous d'être dans le répertoire contenant le Dockerfile)
docker build -t my-app .

# Exécuter le conteneur à partir de l'image construite
docker run --name next-container -p 3000:3000 my-app
```
Ce processus va créer une image Docker pour votre application Next.js et exécuter un conteneur basé sur cette image, rendant votre application accessible sur le port 3000.
AWS Terraform Meetups
Published: 2024-01-04 22:37:30

Hi Guys,

From Jan 14th onwards every week will be connecting for 30 to 45 mins by discussing by taking one  AWS Service then followed by Terraform coding.

Please join the Terraform linkedin group https://www.linkedin.com/groups/12729118/

Update me your email in the linkedin post/in this blog and so that i can send invite for the meeting.
https://www.linkedin.com/feed/update/urn:li:activity:7146558485785149441?utm_source=share&utm_medium=member_desktop

Happy Learning #AWS #Terraform.

Follow me in [Linkedin](https://www.linkedin.com/in/srinivasuluparanduru/) for more blogs and knowledge sharing.

Join the meetup 
https://www.oddcircles.com/events/ca412adc-967f-4735-8912-92b33e823340/Terraform%20Knowledge%20sharing%20with%20demos and record whether your attending the session and zoom link will be updated 1 hour before
New project : Remède
Published: 2024-01-04 22:20:51

Hi everyone, recently I created a new project named **Remède**

Remède is a **mobile application** that provide a **french offline dictionary**. It's 100% open source and you can download and re-use the dictionary as _JSON_, _SQLite_ or with the _public API_. 

## Actually

Actually, the project is functional but very young. I released the V1.0.0 last week and starting planning future functionalities to develop in 2024.

## Version 1.0.0

The version **1.0.0** has following functionalities:
- Download the dictionary
- Search a word
- Add a bookmark on a word
- Correct a text (third-party)
- Read cheat sheet (no sheet is finished yet)

## The goal

The goal is to publish Remède on the **Play Store** and provide a **simple and powerful** user experience.

I want to enhance the database with **rimes**, **examples usages**. I also want to provide cheat sheet about French grammar and orthography rules. You can **contribute [on github](https://github.com/camarm-dev/remede) to support and enhance Remède !**

It will be really cool to create a grammar / orthography corrector for Remède instead of using third-parties

Thanks for reading, please consider **react** to this post and **start** the [repository](https://github.com/camarm-dev/remede) to give this project a bit of visibility !
Have a nice code,
See you later
How do I approach coding interviews?
Tags: webdev, javascript, tutorial, react
Published: 2024-01-04 22:18:08

Approaching coding interviews can be a challenging but manageable task with the right preparation and mindset. Here are some tips to help you succeed in coding interviews:

## Understand the Basics:

Ensure you have a strong understanding of fundamental data structures (arrays, linked lists, trees, graphs, queues, stacks) and algorithms (sorting, searching, recursion).
Know the time and space complexities of common algorithms.

## Practice Regularly:

Solve coding problems regularly on platforms like LeetCode, HackerRank, or CodeSignal.
Focus on a variety of difficulty levels and different topics to enhance your problem-solving skills.

## Review Past Problems:

After solving a problem, review and understand the optimal solution.
Identify patterns and strategies used in solving different types of problems.

## Mock Interviews:

Practice mock interviews with a friend or use online platforms that provide interview simulations.
Get used to explaining your thought process, and practice coding on a whiteboard or an online coding environment.

## Time Management:

Practice solving problems under time constraints to simulate the pressure of a real interview.
Learn when to ask for hints or clarification if you get stuck.

## Learn from Mistakes:

Analyze mistakes and learn from them. Understand why a solution failed and how you can improve it.
Focus on writing clean, efficient, and bug-free code.

## Review Company's Tech Stack:

If possible, know the tech stack of the company you are interviewing for and practice problems related to those technologies.

## System Design Preparation:

For technical interviews that involve system design, practice designing systems and be familiar with key concepts (scalability, load balancing, databases, etc.).

## Behavioral Preparation:

Be ready for behavioral questions. Practice your answers to common questions about your experiences, challenges faced, and how you approached problem-solving in the past.

## Stay Calm:

During the interview, stay calm and think through the problem before jumping into coding. Clarify doubts and discuss your approach with the interviewer.

## Communication Skills:

Clearly communicate your thought process. Interviewers often value your approach and communication as much as the correctness of your solution.

## Stay Updated:

Keep up with the latest industry trends and news. Some interviews may include questions about current technologies or recent advancements.
Remember, consistent practice and a systematic approach to problem-solving are key. The more comfortable and confident you become with coding interviews, the better you'll perform.
How to Use Google Drive to Host Your Website
Published: 2024-01-04 22:06:53

Google Drive is not just for storing files - you can also use it to host simple static websites for free! In this article, we'll see how to deploy and share a website using Google Drive.

## Why Use Google Drive for Hosting?

Here are some benefits of using Google Drive for hosting:

- It's completely free.
- Files are synced and have high availability. 
- Websites are automatically HTTPS enabled.
- Easy to deploy updates by overwriting files.
- Quick setup with no server configuration needed.

Of course, there are limitations too. Google Drive has lower uptime guarantees compared to full-fledged hosting services. The free usage has bandwidth limits, so it's best for low traffic sites. Complex websites with server-side code are not supported.

Overall, it's a simple option for hosting small static sites or as a proof-of-concept before investing in paid hosting.

## Step 1 - Create a Public Folder 

First, create a new public folder in Google Drive that will contain the website files:

1. Login to [Google Drive](https://drive.google.com) and click New > Folder.

2. Name the folder (e.g. "my-website").

3. Right click on the folder > Share

4. In the dialog box that appears, change the access to "Public on the web" and click "Save".

5. Grab the URL next to "Link to share." This will be your website URL. 

## Step 2 - Add your Website Files

Now, put your website files like HTML, CSS, Javascript, images etc in this folder. 

For example, your folder could contain:

- index.html 
- style.css
- app.js
- images/logo.png

Make sure your main HTML file is named `index.html` - this will be loaded when people visit the website URL.

## Step 3 - Customize Domain (Optional) 

The Google Drive public URL tends to be long and cryptic. You can optionally set up a custom domain for more branding.

Some options for custom domains:

- **Subdomain:** Use a subdomain on a domain you own to point to the Google Drive URL.

- **Forwarding:** Forward or mask a domain to the Drive URL using services like [netlify](https://netlify.com). 

- **Google Sites:** Use Google Sites to get a sites.google.com domain for free.

And that's it! Your website should now be live and accessible to anyone on the web. Keep adding more content and make changes by overwriting the public folder.

While basic, Google Drive hosting is a neat way to quickly launch sites as a proof-of-concept or for sharing with a limited audience. With custom domains and regular updates, you can even run production websites.
Linux find: remove error lines from outputs
Published: 2024-01-04 22:03:33

## What I want to achieve
- find a specific file which I have read permission for
- ignore error lines of "Permission denied"

## What didn't work
Firstly I tried this command to remove the "Permission denied" lines.

```
$ find /path/ -readable | grep -v "denied"
```

However, it didn't work.

That's because the error messages are on a separate stream from the `grep` targets.

The "Permission denied" messages are printed to the standard error stream (stderr), while the `grep` command only filters the standard output stream (stdout).

## How to tackle
1. Redirect both output streams using `2>&1` which redirects stderr(file descriptor 2) to stdout(file descriptor 1).
```
$ find /path/ -readable 2>&1 | grep -v "denied"
```

2. suppress stderr putting away into `/dev/null/`, a special file that discards any data written to it, effectively silencing stderr.
```
$ find /path/ -readable 2>/dev/null
```