teleren/devto huggingface dataset:
When Inadequate IT Infrastructures Send You Running for Cover
Tags: buildpipeline, infrastructure, webdev, softwaredevelopment
Published: 2023-01-16 01:21:21

Not all engineers may suffer from inadequate IT infrastructure for pipelines, as it depends on the specific company and its policies towards IT infrastructure. However, many engineers may encounter challenges with pipeline infrastructure, particularly in companies that need to invest more in this area. Poorly maintained or outdated IT infrastructure can lead to slow development processes, difficulties with automation, and an increased risk of errors and defects in the software. Engineers may also have to spend more time troubleshooting and maintaining the infrastructure, which can take away from the time developers could spend developing new features and improving the software.

It's worth noting that some engineers may be working in companies with good IT infrastructure and may not have to deal with such challenges. Additionally, the role of IT infrastructure in software development is increasingly essential, and companies are investing more in IT infrastructure to support their software development pipeline.

Yet there are several reasons why IT companies may not invest in their pipeline infrastructure:

1. **Cost**: Investing in pipeline infrastructure can be expensive, and IT companies may need more money or resources. The cost of maintaining and upgrading the infrastructure can also be high, which may discourage companies from investing.

1. **Lack of understanding**: Some IT companies may need to fully understand the benefits of investing in pipeline infrastructure or may not be aware of the available tools and technologies.

1. **Short-term focus**: Some IT companies may prioritize short-term goals over long-term investments, which can lead to a lack of investment in pipeline infrastructure.

1. **Prioritizing development over operations**: Some IT companies may prioritize developing new features and products over the operations and maintenance of the pipeline infrastructure, which can lead to neglect of the infrastructure.

1. **Fear of disruption**: Investing in pipeline infrastructure may require changes to the existing processes and workflows. IT companies may be hesitant to make these changes if they fear they will disrupt their operations.

1. **Lack of ownership**: In some cases, IT companies might have a lack of ownership over the pipeline infrastructure, this could be the case when using cloud services, and the investment might not be considered a priority.

Overall, investing in pipeline infrastructure can be difficult for IT companies for various reasons, including cost, lack of understanding, short-term focus, and fear of disruption. However, it's important to note that investing in pipeline infrastructure can bring many benefits in terms of automation, scalability, and reliability, leading to improved software development, faster delivery, and better overall performance.
Entenda as vantagens de usar o Redis: Exemplo prático em Laravel
Published: 2023-01-16 00:43:42

Performance é um fator crítico em qualquer aplicação, especialmente em aplicações de alto tráfego. Bancos de dados comuns, como PostgreSQL, MySQL e Oracle, são amplamente utilizados e são projetados para gerenciar dados estruturados e relacionamentos entre tabelas.

No entanto, esses bancos têm alguns limites de utilização tanto para leitura quanto para escrita, pois são gravados em disco nos servidores. Apesar das grandes melhorias trazidas pelos SSDs, ainda há gargalos quando se trata de milhões de requisições.

Com o crescimento de toda aplicação, chega um momento em que apenas o banco de dados relacional com gravação em disco já não será suficiente para suportar toda a carga de acessos, o que leva à busca por soluções para este problema.

Uma solução amplamente utilizada por grandes empresas é o Redis, que é um banco de dados NoSQL muito rápido devido à sua arquitetura, pois armazena os dados na memória RAM do servidor, permitindo que ele seja muito mais rápido do que os armazenamentos em disco.

A velocidade de acesso à memória RAM é significativamente maior do que a velocidade de acesso ao disco. Isso se deve ao fato de que todos os bytes gravados na memória RAM podem ser acessados diretamente pelo processador em nanosegundos, enquanto os dados armazenados em disco precisam ser lidos através do trajeto: disco → memória RAM → processador, o que leva alguns milissegundos para ser processado.

Veja abaixo um exemplo usando PHP e Laravel em que a leitura de todos os posts de uma determinada tabela passa de aproximadamente 300ms para apenas 10ms, simplesmente com a implementação do Redis. Essa diferença de 290ms pode parecer insignificante em aplicações pequenas, mas em 1 milhão de requisições representa uma diferença significativa de 80 horas para completar a mesma tarefa.

Exemplo de código sem ache, com resposta média de 300ms

```php
<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Cache;
use App\Http\Controllers\Controller;
use App\Models\Post;

class PostsController extends Controller {
	public function index() {
		return response()->json(Post::all());
	}
}
```

Exemplo de código com cache utilizando Redis, com resposta média de 10ms

```php
<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Cache;
use App\Http\Controllers\Controller;
use App\Models\Post;

class PostsController extends Controller {
	public function index() {
		$cacheKey = 'posts';
		$cacheDuration = 60; //in seconds
		$posts = Cache::remember($cacheKey, $cacheDuration, function() {
			return Post::all();
		});
		return response()->json($posts);
	}
}
```
Cloud Computing Models - AWS
Published: 2023-01-16 00:41:44

## Infrastructure as a Service (IaaS)

Infrastructure as a Service, sometimes abbreviated as IaaS, contains the basic building blocks for cloud IT and typically provide access to networking features, computers (virtual or on dedicated hardware), and data storage space. Infrastructure as a Service provides you with the highest level of flexibility and management control over your IT resources and is most similar to existing IT resources that many IT departments and developers are familiar with today.

- Amazon Web Services
- Google Cloud
- Microsoft Azure
- IBM Cloud
- EC2

## Platform as a Service (PaaS)

Platforms as a service remove the need for organizations to manage the underlying infrastructure (usually hardware and operating systems) and allow you to focus on the deployment and management of your applications. This helps you be more efficient as you don’t need to worry about resource procurement, capacity planning, software maintenance, patching, or any of the other undifferentiated heavy lifting involved in running your application.

- Google App Engine
- Red Hat OpenShift
- Heroku
- Apprenda
- RDS

## Software as a Service (SaaS)

Software as a Service provides you with a completed product that is run and managed by the service provider. In most cases, people referring to Software as a Service are referring to end-user applications. With a SaaS offering you do not have to think about how the service is maintained or how the underlying infrastructure is managed; you only need to think about how you will use that particular piece of software. A common example of a SaaS application is web-based email where you can send and receive email without having to manage feature additions to the email product or maintaining the servers and operating systems that the email program is running on.

- HubSpot
- JIRA
- Dropbox
- Gmail
- Trello
- Slack
- Office 365
- S3

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

[<< Back to AWS Training](https://dev.to/c4rlosc7/aws-part-1-5hh0)
LeetCode #35 Search Insert Position with JavaScript
Tags: javascript, algorithms, leetcode
Published: 2023-01-16 00:29:56

Solution to LeetCode's [35. Search Insert Position] (https://leetcode.com/problems/search-insert-position) with JavaScript.

**You must write an algorithm with O(log n) runtime complexity.**

## Solution


```js
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number}
 */
const searchInsert = (nums, target) => {
  let left = 0;
  let right = nums.length - 1;
  while (left <= right) {
    const mid = Math.floor((left + right) / 2);
    if (nums[mid] == target) {
      return mid;
    } else if (nums[mid] < target) {
      left = mid + 1;
    } else {
      right = mid - 1;
    }
  }
  return left;
};
```

- Time complexity: O(log n)
- Space complexity: O(1)

Linear search would result in a time complexity of O(n), so I used a binary search to reduce it to O(log n).
How to debug Flutter app with real Android phone
Tags: flutter
Published: 2023-01-16 00:26:22

Thanks to this SO [answer](https://stackoverflow.com/a/54526682/3630417) for providing all the details! The below workflow has been tested on a Windows machine.

1. [Enable](https://developer.android.com/studio/debug/dev-options) Developer Options on the Android phone. Toggle `USB debugging` option.
2. Connect your Android phone with a USB cable and accept whatever pop up appears.
3. You should now see your phone listed. Running `flutter devices` should also list the device.

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

4. Choose the device and run the the app with the debugger. The app should open in your phone.

5. If it fails to build, keep an eye on the `Debug console` of your IDE, in my case VS Code.
7 programming 👩‍💻 tools 🔧 you should be using in 2023🎏
Tags: codequality, webdev, programming, devops
Published: 2023-01-16 00:25:48

- There are a variety of programming tools available for the software development process. 

- Choosing the best could be difficult.

- The following are the top 7 websites you can use to help you do your job.




Happy working

🎥 Websites links {% youtube djONtv0TM_E %}


####Bonus:

#### Web developers tools 🛠️ you need to know💡👩‍💻  

🎥 Websites links {% youtube lj4ZBJbV5yk %}

#### Top 6 🔥 API testing tools 2023🚀👩‍💻

🎥 Websites links {% youtube reu6fIYtoEs %}

#### 5 websites will make you a smarter 🏆 developer👩‍💻 

🎥 Websites links {% youtube LgkcEWC6uKY %}




### Connect with Me 😊

#### 🔗 Links

[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)

[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/Mahmoud42275)
How Long Does It Take To Create An Index?
Tags: postgres, sql
Published: 2023-01-16 00:20:06



---
title: How Long Does It Take To Create An Index?
published: true
description: 
tags: postgresql, sql
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-16 00:13 +0000
---

A [recent tweet](https://twitter.com/petervanderdoes/status/1614631740424818689) asked the following question.

> Does anybody know how long it should take to create an index of two integer columns with approximately 110 Million records in the DB? #postgres #postgresql #NotAnDBA

Let's put together an experiment. Create a table with 2 columns populated with 110,000,000 million rows. Each column has a random integer value.

Use the command line psql client that’s included with PostgreSQL to create the index. 

To see how long the `CREATE INDEX` statement will take toggle `\timing` from psql.

```sql
CREATE TABLE t (
    a INTEGER,
    b INTEGER
);
```

```sql
-- Populate 110,000,000 million records
INSERT INTO t(a,b)
SELECT
  (RANDOM() * 1000)::INT,
  (RANDOM() * 1000)::INT
FROM GENERATE_SERIES(1, 110000000) seq;
```

```sql
-- Confirm 110,000,000 records
SELECT COUNT(*) FROM t;
   count
-----------
 110000000
```

Enable timing to collect the duration of running the `CREATE INDEX` statement.

```sql
-- turn timing on
\timing
Timing is on.

-- Create index "t_a_idx" on table "t" on the "a" column
CREATE INDEX t_a_idx ON t (a);

Time: 52348.022 ms (00:52.348)
```

## Answer

In this test, it took about 52 seconds to create the index.


## Test Environment Details

* Tested on a M1 MacBook Air with 16GB RAM.
* The table has no sequences, constraints, or other indexes
* Vacuum was running but was cancelled when the `CREATE INDEX` started according to the `postgresql.log`.
* No other queries were running on the table.

This post is intended to be a demonstration of how to conduct this sort of experiment on your own and some of the factors that contribute to the time needed for index creation. 

The best way to answer questions like this is to create a test on your own server instance or using a separate disconnected instance made from a snapshot. 

In a production system with live queries, use the `CONCURRENTLY` keyword when creating indexes. While this lengthens the time to create the index, it avoids [blocking concurrent write operations](https://www.postgresql.org/docs/current/sql-createindex.html).

## Collect timing info

This experiment could be considered a best case scenario for my machine. The data was loaded into a minimal set of pages, with inserts and no updates or deletes. There were no other queries or background processes running.

A best case scenario gives us a starting point, but the best way to answer this question will be to try this out on your system. Good luck!
AWS Root User - AWS
Published: 2023-01-16 00:16:51

## AWS Root User

### Understand Authentication

When you create your AWS account, you use a combination of an email address and a password to verify your identity. If the user types in the correct email and password, the system assumes the user is allowed to enter and grants them access. This is the process of authentication.

### Understand Authorization

Authorization determines whether the user can perform an action—whether it be to read, edit, delete, or create resources.

### What Is the AWS Root User?

When you first create an AWS account, you begin with a single sign-in identity that has complete access to all AWS services and resources in the account. This identity is called the AWS root 
user and is accessed by signing in with the email address and password that you used to create the account.

[<< Back to AWS Training](https://dev.to/c4rlosc7/aws-part-1-5hh0)
Resilience Index
Tags: beginners, productivity, devops, discuss
Published: 2023-01-15 23:46:15

Check how adaptable and resilient your habits are, for free.

[**resilience.skara.ai**](resilience.skara.ai)

Stress goes hand in hand with productivity. The key to resilience is consciously shifting between different states of mind and emotions.
Check up on your habits, emotions, and perceptions regarding your personal energy management.
HTML Shorthands
Published: 2023-01-15 22:59:34

HTML shorthand is a way to write HTML elements more efficiently, by using fewer characters to achieve the same results. Here are a few tips and examples to help you get started:

Self-closing tags: Some HTML elements, such as images and line breaks, do not require a closing tag. These tags can be written as self-closing tags, which is the same as writing an opening tag with a "/" before the closing angle bracket.

Example:


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

Can be written as:


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

Boolean attributes: 

Some HTML attributes, such as "disabled" and "checked", do not require a value. These attributes can be written as boolean attributes, which is the same as writing the attribute name without a value.

Example:



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

Can be written as:


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

Omit optional end tags: 

Some HTML elements, such as "p", "li", and "dt", have optional end tags. These tags can be omitted, which will result in the same behavior.

Example:


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

Can be written as:


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

Conditional comments: Conditional comments are a way to target specific versions of Internet Explorer with different CSS or JavaScript code.

Example:


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

Remember, HTML shorthand can make your HTML more concise and easier to read, but be careful not to sacrifice clarity for brevity.
Straigth Outta... Czechia?
Published: 2023-01-15 22:31:18


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

Once i got a taste for some Straight Outta Compton but look what jumped ahead? That's right, our star REDZED and on the fourth place our hororcore master Řezník.
GraphMe: Visualize metrics from Prometheus and Datadog in Slack
Tags: chatops, devops, prometheus, slack
Published: 2023-01-15 22:25:38

I work in a big tech company, and being on-call is part of my duties. When in the middle  of an incident, quite some time is spent in front of  Grafana looking at graphs, analysing their trend and sharing them back in Slack.

During an incident, some time may also be spent in the UI of our time series database (not your standard Prometheus, but similar to it) crafting more or less esoteric queries, and again analysing trends and sharing them in Slack.

## Problem statement

The process of 1/ querying 2/ waiting 3/ taking a screenshot 4/ sharing it in Slack is repetitive and results in wasted time. When we do it 10+ times per hour, this accounts rapidly to a non-negligible amount of time. It is also difficult to be accountable, e.g., to precisely link a screenshot to the query that generated it.

Moreover, manually crafting queries against our time series database is known to be error-prone. Available metrics and tags are scarcely documented, and idiosyncrasies of how our time series database work are easy to forget. We tend to rely on copy/pasting and adapting (hopefully correctly) queries found *somewhere* inside a Google Doc or a wiki page.

## Introducing GraphMe

After watching several talks about [how GitHub engineers use Hubot](https://youtu.be/B3JBjj6-tf4?t=639) to solve most of their tooling issues, I was inspired to built my own "graph me" command. This led me to create [GraphMe](https://graphme.app), a Slack app that queries various time series databases, and displays graphs in Slack.

![Querying Prometheus from Slack](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xcsjebsuk0jqx5jfs7xt.png)

While GraphMe allows to execute random queries typed directly in Slack, it also allows to save some queries under an alias and reuse them later. This effectively creates a source of truth about metrics queries. No more time spent crafting the same query than last week! Saved queries can also be parameterized, which allows executing them in different contexts (e.g., a different environment or different host).

![Saving a graph](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wfhohh0wop91tgdtsyl2.png)

GraphMe has just been launched this week and, I am happily seeking feedback from early adopters! Do you feel the same pain than I feel? Does it fit well into your toolkit? What missing feature would help you be even more productive?

https://graphme.app
Post-Hackathon Advice: Turning Lemons 🍋 into Lemonade 🍹
Tags: discuss, career
Published: 2023-01-15 21:50:10

So I didn't win the most recent Hackathon I entered, but you know that doesn't matter, because I have never won a Hackathon (and probably never will).

But every Hackathon project I've built, I've turned into something more valuable.


So here's my [Cruddur app](https://dev.to/andrewbrown/cruddur-the-not-so-great-twitter-clone-using-ruby-sinatra-react-gcp-cloudrun-mongodb-atlas-terraform-1j43) 

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

And I've turned it into a [12 week bootcamp](https://docs.google.com/document/d/19XMyd5zCk7S9QT2q1_Cg-wvbnBwOge7EgzgvtVCgcz0/edit?usp=sharing). lol

This was my first Hackathon circa 2009?

I didn't win, but I did however flip this into getting multiple clients building tech coaching sites...

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


How is your post-hackathon project doing? 💭
Variables(Python)
Tags: programming, python, tutorial, github
Published: 2023-01-14 07:25:55

Variable это как пустая бутылка или емкость. А вода это название который будет находиться в variable. Есть три вида Variables первое это int а точнее integer используется для цифр. Второе это str string используется для текста. А третье это float используется для дробей.x = 5
       y = "Umidjon" string - str!
       print(x)
       print(y)
Если мы будем использовать Variables неправильно то в Консоли выйдет ошибка. А точнее Error.

#Полные цифры это - int!
x = 5
y = "Umidjon" #Это используется только для текста - str!
print(x)
print(y)


x = 4
x = "Umid"
print(x)

#int - для полных цифр
#float - для дробей
#string - для текстов
x = int(3)
y = float(2.5)
z = str("hello")

print(x)
print(y)
print(z)

x = "umid"
x = 'umid'
print(x)

a = 4
A = 5

myvar = "John"
my_var = "John"
_my_var = "John"
myVar = "John"
MYVAR = "John"
myvar2 = "John"

print(myvar)
print(my_var)
print(_my_var)
print(myVar)
print(MYVAR)
print(myvar2)

# error - если мы будем использовать Variables не правильно


#От многих значений к нескольким переменным
#Phyton позволяет назначать значения нескольким переменным в массиве:

x, y, z = "Orange", "Banana", "Cherry"
print(x)
print(y)
print(z)

#И вы можете назначить одно и то же значение нескольким переменным в массиве:

x = y = z = "Orange"
print(x)
print(y)
print(z)

#Phyton print() функция часто используется для вывода переменных.

x = "Phyton is awesome" 
print(x)

#Print() в функции вы выводите несколько переменных, разделенных запятыми:
x = "Phyton "
y = "is "
z = "awesome "
print(x + y + z)


#Unpack a Collection - Оберните пучок.

#Если у вас есть набор значений в списке' кортеж и т. д. Phyton позволяет извлекать переменные. Это называется распаковкой

#Для примера:
#Открыть список:

fruits = ["apple", "banana", "cherry"]
x, y, z = fruits
print(x)
print(y)
print(z)

 #Для чисел знак + действует как математический оператор:
x = 5
y = 10 
print(x + y)

#Phyton - Global Variables

#Global Variables - Глобальные Операторы

#Переменные, созданные вне функции (как во всех приведенных выше примерах), называются глобальными переменными.

#Глобальные переменные доступны каждому как внутри, так и за пределами функций.

#Для примера:
#Создайте переменную вне функции и используйте ее внутри функции
x = "awesome"

def myfunc():
  print("Phyton is " + x)

myfunc()

x = 500
y = 200
z = x*y
print(z)

x = 24
y = 9
z = x/y
print(z)

Цена = 3500.60
Количество = int(input("Сколько хлебов вам надо?"))

Вывод = количество * цена

print("количество:", вывод)
WHAT SPECS DO I NEED IN A WEB DEV PC?
Tags: amd, computer, webdev, pc
Published: 2023-01-15 21:24:50

What pc is good for web development? 

I’ve been using Mac, but I want a dedicated graphics card,

And people are calling out Apple on the comparison of the M1 chip, and the “mobile” bottleneck of power 


What would the best brand be for AMD for web development? 

Less then $1k