teleren/devto huggingface dataset:
Cairo Chronicles: Exploring the Bustling Capital of Egypt
Tags: cairotravel, egyptadventures, gizapyramids, nilecruises
Published: 2024-01-23 02:07:15

Cairo, the pulsating heart of Egypt, is a city where ancient history and modern-day vibrancy converge. This sprawling metropolis, nestled along the Nile River, offers an endless array of sights, sounds, and experiences. From the majestic Giza Pyramids to the bustling Khan El-Khalili Bazaar, Cairo is a city that never ceases to amaze. Here's your ultimate guide to exploring the bustling capital of Egypt, where every corner tells a story.

**Unveiling the Wonders of Cairo**
The Giza Pyramids and the Sphinx: Your **[Egypt tours](https://www.onenationtravel.com/package-category/egypt-tours/)** won't be complete without a visit to these iconic symbols of ancient Egyptian civilization. The Pyramids of Giza, standing as the last of the Seven Wonders of the Ancient World, and the enigmatic Sphinx, are not just historical landmarks but symbols of human ingenuity.

**Egyptian Museum: **Dive into the history of ancient Egypt. Housing an extensive collection of artifacts, including the treasures of Tutankhamun, the Egyptian Museum is a treasure trove for history enthusiasts.

**Khan El-Khalili Bazaar**: Immerse yourself in the vibrant atmosphere of one of the oldest markets in the world. Browse through a myriad of shops selling everything from spices to souvenirs, and don't forget to haggle!

**The Nile River**: Uniquely experience Cairo by taking a traditional felucca ride on the Nile. It's a peaceful escape from the city's hustle and bustle, offering stunning views, especially at sunset.

**Local Cuisine and Culture**
Cairo is a haven for foodies. Traditional dishes like koshari, a mix of pasta, rice, lentils, and fried onions, and ful medames, a fava bean stew, are must-tries. Cafes and street vendors dot the city, offering authentic Egyptian flavors.

**Cairo's Hidden Gems**
Coptic Cairo: This historic area is home to ancient churches and a unique blend of cultures, showcasing a different side of Egyptian history.

**Al-Azhar Park:** A green oasis amidst the city's chaos, Al-Azhar Park offers panoramic views of Cairo and a peaceful retreat.

**Parting Words**
As our Cairo Chronicles come to an end, we leave you inspired to embark on your own journey to this city of contrasts. Cairo, with its blend of ancient marvels and contemporary life, is a destination that promises an adventure like no other.
To request with keep-alive using HTTP agent in Node.js
Tags: node, http
Published: 2024-01-23 01:51:44


# Request without Keep-Alive

As we all know that in browsers, multi HTTP requests can resue a TCP connection with the HTTP header "connection: keep-alive;". But how to do in Node.js?

For example, here is a simple code snippet of requesting in Node.js:

```js
// server.js
const http = require('http')

http
  .createServer((req, res) => {
    res.writeHead(200)
    res.end('Hello World')
  })
  .listen(3000)

// client.js
const http = require('http')

function request() {
  http
    .request(
      {
        host: 'localhost',
        port: 3000,
        pathname: '/',
      },
      (res) => {
        let buffer = []
        res.on('data', (chunk) => {
          buffer.push(chunk)
        })
        res.on('end', () => {
          console.log(buffer.toString())
        })
      }
    )
    .end()
}

request()

setTimeout(() => {
  request()
}, 1000)
```

When using wireshark to debug, we can find that the client port of two requets is different and there are two "Three-way Handshake" processes:

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

# Request with Keep-Alive using http.Agent

Now, let's request with keep-alive using http.Agent, we only need to add a short piece of code:

```js
const agent = new http.Agent({
  keepAlive: true,
})

function request() {
  http
    .request(
      {
        agent,
        host: 'localhost',
        port: 3000,
        pathname: '/',
      },
      () => {
        // ...
      }
    )
    .end()
}
```

But, the result of wireshark won't change! Actually, we need to specify the `maxSockets` of the `agent`:


```js
const agent = new http.Agent({
  keepAlive: true,
  maxSockets: 1,
})
```


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

Why? Because `maxSockets` indicats the max TCP connections that can be established per host. And the default value is `Infinity`. If we don't set its value, a new connection will always be established for every request.

Now, let's change our code a little:


```js
setTimeout(() => {
  request()
}, 10000) // 1000 -> 10000
```

The wireshark will show:


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

The keep-alive didn't work again! And we can see that the server send a FIN packet in about 5s. So is there any parameter for server to control the timeout? Yes, that is `keepAliveTimeout`，let's set it to 10s:

```js
const http = require('http')

const server = http
  .createServer((req, res) => {
    res.writeHead(200)
    res.end('Hello World')
  })
  .listen(3000)

server.keepAliveTimeout = 10000
```

And now the keep-alive works again.
Why devs need to embrace platform engineering?
Tags: devops, devrel, cloudnative, cloudcomputing
Published: 2024-01-23 01:18:56

Devs today in a typical software development role often spend a significant amount of time on the following depending on the size of the team: 

<br>

- Coding and development
- Debugging and troubleshooting
- Testing
- Code Reviews
- Documentation
- Research, Learning and skill development
- Deployment and DevOps

<br>

However engineers at scaling organizations face many challenges along with their growing infrastructure and have to master many tools and products, to get their applications operational such as:

<br>

- Automation
- Autoscaling
- Service Discovery
- Observability 
- Security and auditing
- CI/CD
- SAST, DAST
- Chaos Engineering
- Resource utilization and cost optimization

<br>

By providing a platform with common tools and capabilities, cognitive load on development teams can be reduced and therefore increasing developer productivity.

<br>

## But, what is platform engineering?
Platform engineering refers to the practice of building and maintaining the foundational infrastructure and tools that enable the development, deployment, and operation of software applications. It aims to improve developer experience and productivity by providing self-service capabilities that enhance efficiency, scalability, reliability, and security throughout the software development lifecycle.

<br>

Although the capabilities of building a developer platform depend entirely on the needs of the organization and its users, features such as consistency and efficiency enhance user experience. By providing golden pathways, teams can choose from a pre-approved selection of tools to help them get operational without having to worry about cloud infrastructure (eliminate writing IaC), setting up deployment pipelines(no more messing around with complex YAML files), orchestration of product releases (automate CI/CD), securing the environment (incorporate DevSecOps), access control (setting up SSO and RBAC), etc.

<br>

A misconception is that platform engineering is something that only makes sense in large teams. I would say platform teams are instrumental in paving the road to a consistent self-service whether big or small (not too small though). Hence many orgs are resorting to building tools that streamline dev & ops.

<br>

`TL;DR` ~ If you are building an organization that is set to scale rapidly, it is time to think about embracing platform engineering and ease developer toil.
Using Plug in Elixir Phoenix to transfer custom request header or params value to HTTP Headers
Tags: elixir, phoenix, http, programming
Published: 2024-01-23 01:07:37

Elixir's web framework Phoenix makes use of Plugs which are composable module layers through which the HTTP request passes through allowing the incoming request to be manipulated as it is processed. As per [Phoenix docs](https://hexdocs.pm/phoenix/plug.html) 

```
Plug lives at the heart of Phoenix's HTTP layer, and Phoenix puts Plug front and center. We interact with plugs at every step of the request life-cycle, and the core Phoenix components like endpoints, routers, and controllers are all just plugs internally
```

Recently building an API (yes Phoenix is now my go to choice for web dev :) ) I decided to use [simple_token_authentication](https://github.com/podium/simple_token_authentication) hex package instead of hand-rolling out an API Token checker. It has some nice features where it adds service name to the log metadata for the matching token and uses erlang's `persistent_term` to make some performance gains. Also you should never hand-roll out Auth(n/z) by yourself to avoid missing out on edge cases or introducing loopholes. 

The only shortcoming I faced with `simple_token_authentication` was that it requires that the API token should be sent in `Authorization` header for e.g `Authorization: <API TOKEN>`. Now this doesn't seem to be a problem when you are integrating your API with other services that you own (having API keys in mobile and web app are just useless for protection by exposing them publicly). This can be done as intended other than in case the `Authorization` header is not available or restricted for use and you would need to use a custom header to pass the value. Another case and more prominent one is when integrating your API with 3rd party service or webhook where you can't pass a value in a HTTP header and have to append it to your URL.

So in order to pick your API token  from HTTP header `X-API-TOKEN` or param `x_api_token`. You can add a plug that sits before `SimpleTokenAuthentication` Plug in the pipeline and it would transfer the value over to Authorization header. 

```elixir
defmodule MaverickWeb.Plugs.TransferApiTokenToAuthorization do
  @moduledoc """
  The TransferApiTokenToAuthorization Plug.
  """

  import Plug.Conn

  @api_key_header "x-api-key"
  @api_key_param "x_api_key"
  def init(opts), do: opts

  def call(conn, _opts) do
    token = get_token_from_header(conn) || get_token_from_params(conn) || ""
    conn = put_req_header(conn, "authorization", token)
    conn
  end

  defp get_token_from_header(conn) do
    case get_req_header(conn, @api_key_header) do
      [val | _] -> val
      _ -> nil
    end
  end

  defp get_token_from_params(conn), do: Map.get(conn.query_params, @api_key_param)

end
```

You can use this to transfer values  from any intended header or param to any header in your request.


Banner Image : https://blog.logrocket.com/wp-content/uploads/2022/10/phoenix-plugs-web-app-functions.png
Babau do pandeiro
Tags: hackincariri, flag
Published: 2024-01-23 01:06:25

Quem anda de pé

Quem anda de pé
Quem anda de pé
Quem anda de pé só anda de pontapé (bis)

HIK_OSINT_PRIVLEGIES_RESOLVED_014128756103_OSINT_PRIVLEGIES_BABAU_DO_PANDEIRO__OSINT
Madden NFL 24 Playoffs: Seattle wins with their Wild Card win in Washington
Published: 2024-01-23 00:47:58



I am sure that Madden NFL 24 is going to [Mut 24 Coins](https://www.mmoexp.com/Nfl-24/Coins.html) forget the Seahawks yet again and pick the Redskins with their Best Rookie Of The YearRobert Griffin III and their seven-straight wins to run over Seattle. Please do count as the Seahawks out. That's exactly what this team is all about. You and I, are Seattle fans. We wereborn with the chip on our shoulder. We weren't given anything. The same is true for Richard Sherman, or Wilson, and Doug Baldwin, or Brandon Browner. An even win? An 80-yard drive was needed to score the touchdown? Griffin winning the NFC East on national television? Phew!

The winner of this match will take on either the 49ers or Falcons. If the Vikings beat the Packers then the winner of the game between the Seahawks and Redskins will be facing the 49ers. But if Green Bay takes care of its business at home, the winner of the Seahawks-Redskins will be sent to Atlanta next week.

It's in This Stream Seahawks vs. Redskins 2013. Madden NFL 24 Playoffs: Seattle wins with their Wild Card win in Washington Seahawks fan infiltrates D.C. RGIII vs. Russell Wilson tops Wild Card weekend. See every one of the 42 storiesPeyton Manning breaks the record of TD passing in one single season

Peyton Manning broke the Madden NFL 24 record for passing touchdowns in a season when he scored four touchdowns in the Denver Broncos' win over the Houston Texans in Week 16. Manning now has 51 passing touchdown passes this season, surpassing Tom Brady and the 50 touchdown passes he hit in 2007 for [Madden nfl 24 Coins](https://www.mmoexp.com/Nfl-24/Coins.html) The New England Patriots.

Similar to Brady in 2007's record-breaking season, Manning's breakout year could lead to Madden NFL 24 MVP awards. Manning has been awarded the MVP award at four different times throughout his career, and is the most likely candidate to earn the title a sixth time. Manning currently has 5.211 yards in total passing during the season and has thrown just 10 interceptions, which is in addition to his record-setting number of touchdowns.
Automate CI/CD with CircleCI and Github
Tags: cicd, github, circleci, automation
Published: 2024-01-23 00:47:15

### Introduction
CircleCI is a service that detects changes in your codebase and executes tasks defined on it.

With the need for DevOps in the automation of our applications, I have been doing a few studies and I stumbled on CircleCI as a CI/CD tool and decided to look a bit deeper.

In this post, I will be explaining with a simple demo an introduction to CircleCI.

### What is CI/CD?
This is a common term that everyone uses, it explains the continuous integration and continuous deployment

Continuous Integration (CI) - When you push a code update, you want to know if the code is still okay. For example, does the code compile (build), and do all of the tests pass?

Continuous Deployment (CD) - After making a code update, deploy that code to wherever it is supposed to be. For example, deploy a server to AWS. CI/CD is extremely valuable because automation saves time and optimizes workflows, which is especially important when working with others.

### Setting up CI with CircleCI
From the GitHub repository, activate CI on it by configuring CircleCI.

First, generate a configuration file in order for CircleCI to understand what we want it to accomplish. Create a folder called ".circleci" and a file called "config.yml" inside it.

In the config.yml add this code:

```
version: 2.1
jobs:
build:
working_directory: ~/circleci-python
docker:
- image: "circleci/python:3.6.4"
steps:
- checkout
- run: python3 main.py
test:
working_directory: ~/circleci-python
docker:
- image: "circleci/python:3.6.4"
steps:
- checkout
- run: python3 main-test.py
workflows:
build_and_test:
jobs:
- build
- test:
requires:
- build
```
**NOTE:** make sure your config.yml is indented correctly

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

Now let's push our new config file to GitHub.

CircleCI should detect the code changes and run our build_and_test workflow for our branch. Also, the jobs run on CircleCI must be visible.

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

#### Testing the CircleCI
In the main-test.py file, I added a new line of code

**assert Add(6,6) ==11**

that is false, to check how the build output will act.

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

### Conclusion
CI/CD is important, and I have shown how it can be integrated with a simple project.I will be setting up more complicated projects in the future.Look out for more on this post.
EOL of MongoDB 4.4
Published: 2024-01-23 00:46:16


One of the NoSQL databases used by most developers is MongoDB. Currently, the most recent version is 7.0, but I think there are many people still using 4.x.

# MongoDB Release History

Version	Release Year
7.0	2023~
6.0	2022~
5.0	2021~
4.4	2022~
4.2	2019~
4.0	2018~

February 29, 2024 is said to be the End Of Life (EOL) of MongoDB 4.4.

It is said that upgrading to 5.0 does not require application changes.

# Main Features

## Version 5.0
Stable API, designed to preserve application behavior through upgrades
Native time-series collections and clustered indexing
Windows functions and new temporal operators
Live resharding
Schema validation diagnostics
x509 certificte rotation
Resumable index builds

## Version 6.0
New aggregation stages and operators, including $sortArray
Sharded $lookup and $graphlookup
Pre- and post- document images for change streams
Sharding improvements
Time series improvements including column compression, additional secondary index types, and more
File copy based initial sync and encrypted audit log (Enterprise)

## Version 7.0
Queryable encryption
Better storage compression and optimization for time series collections
Compound wildcard indexes
User roles variable for aggregations
Improved query performance for grouping and reshaping documents, filtering and sorting documents, and working across collections

# Upgrade Guide
https://www.mongodb.com/docs/manual/release-notes/5.0-upgrade-standalone/
Using Decorators in Python
Tags: beginners, programming, tutorial, python
Published: 2024-01-23 00:31:52

## Introduction

Decorators in Python are a powerful tool for modifying the behavior of functions and classes without altering their original code. They are a form of syntactic sugar that enables higher-order programming and code reusability. By using decorators, developers can add functionality to existing code without having to modify it, making their code more efficient and flexible. In this article, we will delve into the features, advantages, and disadvantages of using decorators in Python.

## Features

Python decorators are functions that take another function as an argument and return a modified version of that function. They use the "@" symbol before the decorator name to apply it to the target function. Decorators can be used for various purposes, such as logging, caching, authentication, and more. They make use of closure and function annotations to modify the behavior of functions.

### Example of a Simple Decorator

```python
def simple_decorator(func):
    def wrapper():
        print("Function is being called")
        func()
        print("Function call is complete")
    return wrapper

@simple_decorator
def say_hello():
    print("Hello!")

say_hello()
```

This code snippet defines a simple decorator, **simple_decorator**, that adds print statements before and after the execution of the **say_hello** function, without modifying the **say_hello** function's original code.

## Advantages

1. **Code Maintainability and Reusability**: Decorators allow for the addition of functionality without changing the original code, making it easier to maintain and reuse.

2. **Modularity**: By separating concerns, decorators help make the code more modular and easier to understand.

3. **Promotion of DRY Principle**: Decorators help reduce code duplication, adhering to the DRY (Don't Repeat Yourself) principle.

## Disadvantages

1. **Complexity for Beginners**: Decorators can be difficult to grasp for beginners, making the learning curve steeper.

2. **Debugging Challenges**: Since decorators modify the behavior of functions, debugging can become more complex.

3. **Potential for Unexpected Results**: Improper use of decorators can lead to difficult-to-trace errors and unexpected results.

## Conclusion

In conclusion, decorators are a useful feature in Python that offers a concise and elegant way to modify function behavior. They promote code efficiency, maintainability, and modularity. Developers must carefully use decorators to avoid any unforeseen errors. By considering their advantages and disadvantages, developers can make an informed decision on whether to use a decorator or not in their code. With proper usage, decorators can enhance the functionality and readability of Python code.
How Crucial Are Code Reviews?
Tags: discuss
Published: 2024-01-23 00:00:00

---
published_at : 2024-01-23 00:00 +0000
---
How can organizations encourage a focus on the impact of code on maintenance, performance, and consistency during code reviews?
Follow the DEVteam for more discussions and online camaraderie!
{% embed https://dev.to/devteam %}
Why use automation tools for dependency updates
Published: 2024-01-26 20:34:06

---
title: Why use automation tools for dependency updates
published: true
date: 2024-01-23 00:00:00 UTC
tags: 
canonical_url: https://www.oliverdavies.uk/archive/2024/01/23/why-use-automation-tools-for-dependency-updates
---

Last week, I recorded an episode of [Beyond Blocks](https://www.oliverdavies.uk/podcast) with Eirik Morland - the Developer of violinist.io, a tool for automating dependency updates in PHP projects.

Instead of a person manually running `composer update` in each project, tools like Violinist can do that for you and submit pull or merge requests to your project for you to review.

But why would you want this?

There are technical reasons, such as not having to rely on everyone having the same local environment and avoiding potential conflicts, and consistency by ensuring the same command is run every time.

But, the big advantage, in my opinion, is the time it saves and allows you to reuse.

Instead of manually updating each project's dependencies, I can focus on tasks that deliver value to my customers and clients and move us towards our objectives.

Dependency updates, such as a new version of Drupal core or a contrib module, don't contain any perceived value compared to other tasks, such as adding a new feature or fixing a bug.

They happen behind the scenes, often invisibly, without any visual changes to show an update has been done.

If they aren't done often, they will be riskier to deploy due to the larger changes, and the longer it takes, the greater the potential for insecure versions to be exploited - potentially affecting your reputation and your customer's and with any remedial work taking the focus from other tasks.

Having a service like Violinist performing the updates for you means they can be applied and deployed more regularly, reducing the risk and making it easier to stay up-to-date and run secure versions of your dependencies.

 P.S. If you're creating a new Drupal module, try my [free Drupal module template](https://github.com/opdavies/drupal-module-template).