teleren/devto huggingface dataset:
#1 | Web Services
Published: 2024-01-09 09:54:27

Today, let's discuss a bit about Web Services.

It's common for us to forget things over time, so today, let's revisit something that many may no longer recall.

Talking about Web Services, means realizing that they are nothing more and nothing less than solutions for applications to communicate with each other, in other words, for one application to talk to another, regardless of language, software, or hardware (regardless of the platform).

Initially, Web Services were created for message exchange using the XML (Extensible Markup Language) over the HTTP protocol, identified by a URI (Uniform Resource Identifier).

In summary, we can say that:

Web Services are APIs that communicate over networks using the HTTP protocol.

Note: Every Web Service is an API, but not every API is a Web Service.

APIs can run on different protocols, but Web Services run only on the HTTP protocol.

In this case, a Web Service ends up being an API that runs on the web.

URI: It's almost the same as a URL.

## Advantages
### Common Language

Due to the existence of many programming languages nowadays, making two different systems communicate is challenging. However, you can use a common language between both involved applications, such as JSON or XML.

### Integration

Since both applications have a common language for information exchange, new integrations become easier.

### Implementation Reusability

As the output is always the same, reusing this implementation becomes much easier.

### Security

The Web Service takes care of everything; the rest remains in the intranet, and only the Web Service has access to the database.

### Costs

In terms of cost, integrating becomes more affordable, especially if you have a Web Service. With it, you don't need to create new solutions for clients who want to access your data.

### Key Technologies
Architectures used in Web Services!
SOAP
It is more related to XML and will always be used with it.

### REST
It can be related to XML or JSON, as well as other markup languages.

About the Subject: Please make sure to share your perspective in the comments! This way, we become more consistent. And if this content is somehow conveying a wrong idea, feel free to correct it. It will be very helpful for me and the community.
Throw away layers in test AWS Lambda
Tags: lambda
Published: 2024-01-17 03:08:47

This is a python demo:

install lib in /tmp, then add /tmp to path

```Python
import os
import sys
os.system("pip install -r requirements.txt -t /tmp  -i https://pypi.tuna.tsinghua.edu.cn/simple")

sys.path.append('/tmp')
```
Front-end must be dumb
Tags: webdev, frontend, backend
Published: 2024-01-17 02:03:23

One of the problems I faced recently was the need to make the front-end application I am working on more dumb.

## Responsibilities 

The main need that moves us to create a dedicated back-end is to separate its responsibilities and methods from the front-end.

Think about this: your front-end is messy almost every time, and this may be a red flag to make you rethink about how much do you trust in your front-end.

Personally: I do not trust a bit on mine front-end applications, and this is why we need to make sure that the back-end is the smart one with more responsibilities.

![webdev structure schema](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fat9wgw4fzxbkt4igygr.jpeg)

## Splitting applications

Let us suppose this scenario: your front-end does not have a service API layer, which means that your requests are created directly on the page like this:



![sample axios request](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j70mj28hnplphid17phc.png)



If you are creating these requests with no personalized service or a state machine and also using its response data in order to validate a rule or behavior, once you update your endpoint, entity or DTO, you will need to go at each one of the requisitions and change their behavior manually, so it can now work along with the new changes.

## Yin-Yang

Your web application must have its responsibilities well stablished and more importantly: well divided in each one of the endpoints.

Your front-end must be concerned on rendering the visual aspects of the application and your back-end must be the source of the intelligence of the business.

Once you understand this, let us now try to make the axios request work as it should:

![axios request that works along the back-end](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83bh1fxwtaic0cijgx9t.png)

This may be a really silly example of how things should work, but you need to focus on the behavior of the front-end: it only receives the information and send it to the user, having zero concern or any further validation about the response.

## The back-end side

There are some things you need to consider while creating a resilient back-end that will not allow any unwanted information or payloads to reach the front-end:
- Early return - get rid of those elses. your code legibility will be much superior after using early return.
- Try/catch - make sure that your back-end will be prepared for all of the known issues that could happen.
- Observability - your unknown bugs or error reports must go somewhere, and this magical place should be some observability tools.


![observability 3 steps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/waiqirfo27odysjgm762.png)

## Final considerations

Knowing that your front-end has limitations and your back-end does it as well will change your way of thinking about how web applications should work, and this kind of concern will be very healthy for your development career.
How GraphQL Works?
Published: 2024-01-16 05:49:03

GraphQL is a query language and runtime for APIs (Application Programming Interfaces) that was developed by Facebook. It provides a more efficient, flexible, and powerful alternative to traditional REST APIs. Here's an overview of how GraphQL works:

1. **Schema Definition:**
   - GraphQL APIs are defined by a schema that describes the types of data that can be queried and the relationships between them.
   - The schema is a fundamental part of GraphQL and serves as a contract between the client and the server.

2. **Types and Fields:**
   - GraphQL schemas consist of types, and each type has fields.
   - Types can be objects (representing entities like "User" or "Post"), scalar types (representing simple values like integers or strings), or other complex types.

3. **Query Language:**
   - Clients specify the data they need using a query language that closely mirrors the structure of the response.
   - Clients can request specific fields on specific types and can even request nested data in a single query.

4. **Query Execution:**
   - When a client sends a GraphQL query to the server, the server validates the query against the schema.
   - If the query is valid, the server executes the query and returns the requested data in a JSON format.

5. **Resolvers:**
   - Resolvers are functions that are responsible for fetching the data for each field in a GraphQL query.
   - Each field in the schema has a corresponding resolver that defines how to retrieve or compute the data.

6. **Single Endpoint:**
   - Unlike REST APIs that often have multiple endpoints for different resources, GraphQL typically has a single endpoint for all queries and mutations.
   - Clients can request exactly the data they need, reducing over-fetching or under-fetching of data.

7. **Mutations:**
   - In addition to querying data, GraphQL supports mutations, which are used to modify data on the server.
   - Mutations are defined in the schema, and clients can use them to create, update, or delete data.

8. **Real-time Data with Subscriptions:**
   - GraphQL supports real-time updates through subscriptions. Clients can subscribe to specific events, and the server can push updates to clients when relevant data changes.

9. **Introspection:**
   - GraphQL allows clients to introspect the schema, query the types and fields it supports, and discover the capabilities of the API dynamically.

10. **Security and Authorization:**
    - GraphQL doesn't inherently enforce any specific authentication or authorization mechanisms. It's up to the developer to implement and enforce security measures based on the requirements of the application.

Overall, GraphQL provides a more flexible and efficient way for clients to interact with APIs by allowing them to request exactly the data they need, avoiding issues like over-fetching or under-fetching of data, common in traditional REST APIs.
These are alongside the FC 24 Angel Cup icons
Published: 2024-01-17 01:21:20




These are alongside the FC 24 Angel Cup icons appear beat in the year. Admirers accepting had the adventitious to [FC 24 Coins](https://www.mmoexp.com/Fc-24/Coins.html) vote for the 11 best players, but new for FC 24 is icons that would accepting featured in Accretion Of The Year during their careers.

So far 12 players accepting been appear in the promotion, with two accepting the able 95 rating, but there is alone one name on everyone;s lips, Ronaldinho. The Brazilian allegory has been a able Accumulated in the FIFA alternation ashamed astern accepting been acclimatized for his adeptness and skills. 

Some of the best acclimatized players are additionally attainable to accretion in packs from the latest FC 24 Accretion Of The Week. With an LW position, the aloft Barcelona man will be one of the best basal cards in the adventuresome with 97 dribbling to bender his reallife abilities.

The added abecedarian to accepting a 95 appraisement is German striker Gerd Muller who is admired as one of the greatest goalscorers of all time. While his allembracing appraisement is 95, his stats don;t lath themselves to FC 24 ingame. The added standout calendar is Ruud Gullit, rated 94, who has become a basal in abounding able FIFA player;s teams in beside years.

The Dutch allegory is frequently activate in midfield, but his TOTY Accumulated calendar is a centermost exhausted as default. With position cards, he can be ashamed ashamed into midfield, which accoutrement his cool allround stats. The beside FC 24 Centurions beat gave players a adventitious to accretion upgraded versions of stars such as Neymar.

Matching Gullit;s 94 appraisement is aloft England captain David Beckham. Over the years the midfielder hasn;t had the able FIFA cards, but this acclimation has a 96 accidental carbon authentic him calamitous ashamed acclimatized time on the ball. 

Italian Angel Cup champ Alessandro Pirlo battery into [EAFC 24 Coins for sale](https://www.mmoexp.com/Fc-24/Coins.html) a affiliated chic as Beckham and with a 93 allembracing appraisement will be a acclimatized best to sit in the boilerplate of the park. There is additionally acclimatized to be a final Accretion Of The Year Accumulated appear in a Bandage Architectonics Claiming in FC 24 soon.

At the added end of the angle is accretion Angel Cup champ in Italian Alessandro Nesta alternating with Nemanja Vidic who are both rocks in defense. Added 2;s stars Claude Makelele, Edwin Van Der Sar, Ashley Cole, Robert Pires and Javier Zanetti additionally amore in the promotion.
Unfolding!
Tags: life, nontech, chatgpt
Published: 2024-01-07 16:11:55


Embark on the enchanting journey of self-discovery, where each individual, like a tapestry woven by time, unveils their unique likes and dislikes. As the kaleidoscope of life unfolds, presenting novel situations and unforeseen challenges, our thoughts undergo a metamorphosis, adapting to the ever-evolving circumstances.

Amidst this grand tapestry, there exists a profound realization – a moment of epiphany when one acknowledges that the true essence of living lies in surrendering oneself to the captivating allure of art. Like a sailor navigating the boundless sea of existence, we find solace and purpose in immersing our souls in the vast ocean of artistic expression.

Art, in its myriad forms, becomes the compass guiding us through the turbulent seas of emotions and experiences. It transforms the mundane into the extraordinary, unraveling the threads of imagination and weaving them into the fabric of our reality. To truly feel the pulse of life is to dance unabashedly with the symphony of colors, sounds, and emotions that art graciously offers.

Whether it be the strokes of a painter's brush, the melodic notes of a composer's masterpiece, or the poetic verses that resonate with the depths of our souls – each form of art becomes a portal, inviting us to explore the limitless realms of our own being. In the canvas of existence, the vibrant hues of artistic expression merge with the strokes of our own narrative, creating a masterpiece that is uniquely ours.

So, let your spirit be a canvas, receptive to the brushstrokes of creativity, and allow the tapestry of art to envelop you in its embrace. In this dance with the aesthetic, discover the profound beauty of living a life truly felt, a life immersed in the eternal sea of artistic wonders.

(Text generated using ChatGPT)
Setting up maintenance mode with Varnish
Tags: cache, cdn
Published: 2024-01-18 04:54:55

---
title: Setting up maintenance mode with Varnish
published: true
date: 2024-01-17 00:48:06 UTC
tags: cache,cdn
canonical_url: https://rafael.bernard-araujo.com/setting-up-maintenaince-mode-with-varnish.php
---

Varnish is ["the free, open-source software that enables super fast delivery of HTTP or API based content", "an HTTP reverse proxy that works by caching frequently requested web pages, so they can be loaded quickly without having to wait for a server response."](https://www.varnish-software.com/products/varnish-cache/).

If you need some sort of an alternative cloud or servers in datacenter Varnish can act as CDN, Load Balancer and Api Gateway layers at the same time. It is very powerful when you have to manage those services instead of using a Cloud service. And this is not that uncommon.

![How Varnish works](https://i0.wp.com/www.varnish-software.com/media/bymhguj3/varnish_v_squid_04.jpg?w=580&ssl=1)

Consider the use case where you need a maintenance window for a product for which you need to be sure that you are suspending all connections to the backend servers consistently. Performing a redirection in the CDN layer is the better choice.

> The Varnish Configuration Language (VCL) is a domain-specific programming language used by Varnish to control request handling, routing, caching, and several other aspects.

-- [https://www.varnish-software.com/developers/tutorials/varnish-configuration-language-vcl/](https://www.varnish-software.com/developers/tutorials/varnish-configuration-language-vcl/)

This is a very powerful language, that, for our use case, will allow creating a synthetic response to proxy the request to, instead of hitting the backends. There will be no need to create a web directory to be served for another web server, but just directly from Varnish.

![Varnish serving maintenance synth response](https://i0.wp.com/rafael.bernard-araujo.com/wp-content/uploads/2024/01/varnish-maintenance-mode.png?w=580&ssl=1)

```vcl
# default.vcl
sub vcl_synth 
{
    # previous headers manipulation if you like
    # and other code that you need for synth if you like
    # (...)

    # Adding an x-cache header to indicate this is a synth response
    set resp.http.x-cache = "synth synth";

    # Maintenance - we are calling the status for this synth 911 because we can have different synths
    if ( resp.status == 911 ) {
        set resp.http.Content-Type = "text/html; charset=utf-8";
        # You can put absolutely what you want
        synthetic ({"
<html>
<head>
    <title>Maintenance mode - Try again later</title>
</head>
<body>
<h1>This website is under maintenance.</h1>
</body>
</html>
"});
        return (deliver);
    }
}
```

Then I can forward everything that requests my-domain.com to the maintenance

```vcl
# includes/my-domain-hints.vcl

if ( req.http.host ~ "my-domain.com" ) {
    return(synth(911, ""));
    # All the other VCL configs are below here, but we are returning early above to the maintenance
    # (...)
}
```
Exploring Go's Concurrency: Goroutines and Channels
Tags: go, beginners, programming, tutorial
Published: 2024-01-17 00:31:21

## Introduction

Concurrency is a key aspect of modern programming languages. It allows multiple tasks to be executed simultaneously, making it possible to utilize system resources efficiently. One such language that supports concurrency is Go. Go's concurrency model is based on the concept of goroutines and channels. In this article, we will explore the advantages, disadvantages, and features of Go's concurrency model.

## Advantages

1. **Lightweight and Efficient**: Goroutines are lightweight, with minimal memory overhead, making it possible to run thousands of them in a single application. Additionally, they are scheduled by the Go runtime, avoiding the need for the programmer to manage threads.

2. **Simplicity**: Goroutines are easy to implement, making it simpler for developers to write concurrent programs. Channels, which are used for communication between goroutines, also follow a straightforward syntax.

3. **No Shared Memory**: In Go, communication between goroutines is accomplished through channels, eliminating the need for shared memory. This reduces the chances of data races and makes programs more stable.

## Disadvantages

1. **Learning Curve**: Programming with goroutines and channels requires a different mindset, and may take some time to master for those coming from other languages.

2. **Debugging**: With multiple concurrent processes, debugging can be a bit challenging as it is harder to trace the flow of execution.

## Features

1. **Buffered and Unbuffered Channels**: Channels in Go can either be buffered or unbuffered. Buffered channels can hold a certain number of values, while unbuffered channels can only transmit values when there is both a sender and receiver ready.

2. **Select Statement**: Go provides a select statement that allows for the synchronization of multiple channel communications. This makes it easier to handle data from multiple goroutines.

### Example: Using Goroutines and Channels

```go
package main

import (
    "fmt"
    "time"
)

func worker(done chan bool) {
    fmt.Print("working...")
    time.Sleep(time.Second)
    fmt.Println("done")

    // Send a value to notify that we're done.
    done <- true
}

func main() {
    done := make(chan bool, 1)
    go worker(done)

    // Block until we receive a notification from the worker on the channel.
    <-done
}
```

This example demonstrates how to create a goroutine and use a channel to synchronize execution flow in a Go program.

## Conclusion

In conclusion, Go's concurrency model is one of its strongest features, making it an excellent choice for developing highly efficient and scalable applications. It allows for lightweight and efficient execution of multiple tasks, while also simplifying the communication between them. Although it may have a learning curve, the benefits and features of goroutines and channels make it a powerful tool for any programmer looking to harness the power of concurrency in their code.
Please don't use short variable names
Published: 2024-01-19 10:30:56

---
title: Please don't use short variable names
published: true
date: 2024-01-17 00:00:00 UTC
tags: 
canonical_url: https://www.oliverdavies.uk/archive/2024/01/17/short-variable-names
---

When learning to code, one of the most confusing things was using short variable names in documentation and other people's code.

Things like `$k` and `$v` instead of `$key` and `$value` within loops, `$i` instead of `$index`, or `$e` when working with Exceptions.

I've also seen slightly better names, such as `$idx` for index or `$ctx` for context.

But what does this achieve?

Why not write the full variable name and clarify what it refers to?

It would be easier to read and understand for anyone reading the code, including Junior Developers and people new to your team or application.

There are no limitations - at least in the languages I use - to force this, such as a maximum number of characters in a file, so why not write the full variable name?

The only reason I can think of is to save time by pressing fewer keys, but code is read more than written, so it should be optimised for readability.

Your tests and CI pipeline don't have a preference.

The people reading the code will.

 P.S. Need help or want another pair of eyes on your code? Book a [1-on-1 consulting call](https://www.oliverdavies.uk/call) or an [online pair programming session](https://www.oliverdavies.uk/pair) with a 100% money-back guarantee.
What Non-Tech Skills Do You Value in Software Engineers?
Tags: discuss
Published: 2024-01-17 00:00:00

---
published_at : 2024-01-17 00:00 +0000
---
Technical skills are important, but what non-technical skills do you value most in a software engineer? Share your insights!
<br>
Follow the DEVteam for more discussions and online camaraderie! {% embed https://dev.to/devteam %}
Export default and module.exports in Javascript
Published: 2024-01-24 14:40:09

---
title: Export default and module.exports in Javascript
published: true
date: 2024-01-17 00:00:00 UTC
tags: 
canonical_url: https://andwati.github.io/blog/javascript-exporting-modules/
---

Modules are the building blocks of modern JavaScript applications, allowing for the encapsulation of code into reusable components. Two primary systems govern the exportation of these modules: export default in ES6 and module.exports in CommonJS.
Club Caddie - Cloud based, all-in-one, golf facility management software
Tags: reservations, hospitality, saasbilling, billing
Published: 2024-01-16 23:52:38

Club Caddie GMS (Golf Management Software) is a comprehensive cloud suite equipped to handle every need of public, semi-private, and country club golf course operations. Way more than just a POS & tee sheet, Club Caddie also builds the best-in-class software for country clubs, driving ranges, and golf simulator businesses.

[https://clubcaddie.com](https://clubcaddie.com)