teleren/devto huggingface dataset:
How does the internet work? Simplified
Tags: internet
Published: 2022-10-10 05:03:21

***Note: In an attempt to simplify the workings of the internet. I've not included the technical jargon and avoided many parts of the internet.***
## So, What is the Internet anyways?
 If you’re imagining cloud stuff then please don’t that's the most incorrect picture of the internet. Internet is basically just wires which might be copper wire, fiber optics, or a cell phone network.
  
Computers connected to this wire can communicate with each other thus allowing people to share resources, information, etc. 

There are dedicated computers known as servers that are directly connected to the internet and store webpages, images, videos, etc. These servers have unique IP addresses. These IP addresses are like home addresses as you can use them to reach the server e.g 142.250.196.78. These numbers are difficult to remember so we’ve names basically these names are mapped into the IP address like.
        
[google.com](http://google.com) → 142.250.196.78. We’ll talk about this conversion in another blog.
        
### A youtube video journey story to discuss How the internet works?
Have you ever imagined or wondered how the youtube videos you would like to watch land on your computer so seamlessly? Here let's dig into the networking side of things.

This is a simplified illustration of what happens when you request a video on youtube.

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

First step: It goes through your router at your home.

Second step: Your router forwards that request to your ISP (Internet Service Provider).

Third step: From here your ISP may route your request anywhere around the world mostly to another ISP from where it has bought the bandwidth. So your request to youtube is now going to hop to multiple routers before it reaches its destination i.e YouTubes server.

you can use a program called traceroute to see how your request gets to youtube servers and how many hops it makes to reach youtube.

```
traceroute youtube.com
``` 


Fourth Step: The youtube server gets your request and sends back the video you requested the video file travels to your computer using the IP address. Remember while sending a request you give both the destination and source IP address here the source being your computer. 

All the data on the internet are transferred as packets. First, the video file is divided into packets and then sent across the internet, and when it lands on your computer. The data is reassembled this magic is done by the protocols. About which we’ll discuss in another blog post. 


This was a simplified version of how the internet works.
If you want to dive deeper into the technical details of how the internet really works then: 
https://web.stanford.edu/class/msande91si/www-spr04/readings/week1/InternetWhitepaper.htm

https://developer.mozilla.org/en-US/docs/Learn/Common_questions/How_does_the_Internet_work
Git worktree? What, Why and When
Published: 2022-10-10 04:41:33

I recently started using git worktree to see if it solves my pain-point and it does in some scenario. As it takes too long to explain how it works in blog, I just share scenario and you can learn what it is in YouTube videos if you want.

## pain point?

While I work on new feature in my branch, I often need to checkout another branch for code review of a pull request.

If I try to checkout to the PR branch, I may fail if I have working file(s).

```shell
error: Your local changes to the following files would be overwritten by checkout:
        test.txt
Please commit your changes or stash them before you switch branches.
Aborting
```

Then, I need to ``git stash`` to move my working files into stash stack or, ``git add/commit`` to clean my branch.

## Why this happens?

This is because ``git`` uses same working directory for all branches. This infers if we use separate working directory for branches, we won't encounter file conflict issue.

That's what we often do. We often clone to another directory for PR and keep original directory for our work. But we have to clean it by ourselves, and we need to clearly remember which folder contains which branch changes.

## Worktree

In this situation, ``git worktree`` does this for us. It creates directory for each branch, but it still works exactly same for git workflows. As it adds additional folders and objects, there are many best practices, as we may not expect others do the same, so we need to fully understand how worktree works. There are many useful videos in YouTube which explains very detail.

## References

[git worktree doc](https://git-scm.com/docs/git-worktree)
[Tech Tuesday - Git Worktrees](https://www.youtube.com/watch?v=OM--G11e9gg)
[How to Use Git Worktree | Checkout Multiple Git Branches at Once](https://www.youtube.com/watch?v=s4BTvj1ZVLM)
Rails Generators
Tags: rails, programming, ruby
Published: 2022-10-10 04:26:01

## Introduction

When building a rails application, we, as developers, must build the structure of our database as well as actions that allow the client to interact with our database and retrieve our data for the user. This requires us to create migrations, models, controllers, and routes. We can accomplish these tasks one of two ways: manually or using rails resource. Read on to learn about both of these methods and why developers generally prefer to use the second method.

## Manual Method

In order to build our rails application, we first must create our migration. We can do so by cding into our application and entering the following in the terminal:

```
rails g migration manual_method
```

Once we have our migration, we must build our table by specifying our attribute names and data types.

```
class ManualMethod < ActiveRecord::Migration[7.0]
  def change
    create_table :manual_methods do |t|
      t.string :attribute_1
      t.integer :attribute_2

  end
end

```

Now that we have structured our table, we need to create the schema for our database. We can do so by migrating our new migration.

```
rails db:migrate
```

With our table created, we can turn our attention to creating our model.

```
rails g model manual_method
```

In addition to our migration, schema, and model, we will also need a controller to hold our actions as well as a resource route that our front end can send requests to.

```
rails g controller manual_methods controller
```

```
Rails.application.routes.draw do
    resources :my_resources
    # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
  end
```
  

Whew, that's done. Now, imagine that we have an application with multiple models. In that case, we would need to repeat this entire tedious process for each of those models. Sounds like a lot of work, right? Well, it doesn't have to be. Thanks to rails' handy-dandy generate resource task, we can focus on the functionality of our application while rails handles the creation of our resources under the hood!

## Resource Method

Let's utilize the rails g resource task to achieve the same end result as in our previous example.

```
rails g resource resource_method attribute_1 attribute_2:integer
```

Rails will now do the work of creating our migration, model, controller, and resource routes. Pretty cool!


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

Once our migration has been created, we can see that it contains our attribute names and data types. All that's left for us to do is send our migration up.

```
rails db:migrate
```

## Conclusion

Rails g resource is a powerful tool for developers to utilize as it streamlines the process of building our database structure. Thanks to the work that rails does under the hood, we can spend less time structuring our database and more time working on the functionality of our application.
50 Python projects u must try 😤🧠
Tags: projectbenatar, python, training, leadership
Published: 2022-10-10 04:14:00



The best way to learn programming language is to build projects with it.


**Difficulty Level : Easy **
1. Send Automatic Emails using Python
2. Defang IP Address
3. Password Authentication using Python
4. Web Scraping to create a dataset
5. Resume Scanner
6. Merge Sort Algorithm
7. Pick a Random card using Python 8. Quartile Deviation using Python
9. Count Character Occurrences
10. Pyramid Pattern using Python
11. Sequential Search
12. Swap Variables using Python
13. Sorting NumPy Arrays
14. Validate Anagrams
15. Create Tables with Python
16. Recursive Binary Search
 17. Dijkstra's Algorithm using Python
18. Hash Tables using Python
19. Queues using Python
20. Validate a Binary Search Tree

**Difficulty Level : Intermediate**
1. Visualize a Neural Network using Python
2. Bias and Variance using Python
3. Get Live Weather Updates using Python
4. Count Objects in Image using Python
5. Scrape Trending News using Python
6. Real-time Stock Price Data Visualization using Python
7. OTP Verification using Python 8. Choropleth Map with Python
9. Egg catcher game
10. Extract Country Details

**Difficulty Level : Hard**
1. Convert Text to Numerical data
2. AUC and ROC using Python
3. Interactive Language Translator
4. Maximum Profit Finder
5. Language Detection
6. Histogram and Density Plots with Python
7. Radar Plot with Python
8. Create a Chatbot with Python
9. Stopwords Removal
10. Unicode Characters Removal

**Difficulty Level : Hard(II)**
1. Convert Text to Numerical data
2. AUC and ROC using Python
3. Interactive Language Translator
4. Maximum Profit Finder
5. Language Detection
6. Histogram and Density Plots with Python
7. Radar Plot with Python
8. Create a Chatbot with Python
9. Unicode Characters Remover
10. Stopwords Removal
1328. Leetcode Solution in CPP
Tags: cpp
Published: 2022-10-10 04:12:46

```cpp
class Solution {
public:
    string breakPalindrome(string palindrome) {
        int N = palindrome.size(), end = N / 2;
        for (int i = 0; i < end; ++i) {
            if (palindrome[i] != 'a') {
                palindrome[i] = 'a';
                return palindrome;
            }
        }
        if (N > 1) {
            palindrome[N - 1] = 'b';
            return palindrome;
        }
        return "";
    }
};
```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/break-a-palindrome/
Uso de sp_helptext nameprocedure en SQLSERVER
Tags: sql
Published: 2022-10-10 04:04:42

Al momento de editar un procedimiento almacenado y somos nuevos en el tema, nos encontramos con el problema: Que el editor nos tira una ensalada de código que no entendemos, un código similar al siguiente:

```sql
USE [SistemaVentas]
GO
/****** Object:  StoredProcedure [dbo].[ACTIVE_ROL]    Script Date: 10/9/2022 9:57:19 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ACTIVE_ROL](
  @Id int,  
  @Active  bit)
AS  
  UPDATE Roles
  SET Activo = @Active     
  WHERE id_rol = @Id;
```
**sp_helptext nameprocedure** nos ayuda a obtener el codigo limpio del procedimiento almacenado.

```sql
sp_helptext ACTIVE_ROL
```

Al ejecutar el comando **sp_helptext ACTIVE_ROL** obtenemos un codigo limpio como salida.


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

El cual podemos modificar sin confundirnos en un procedimiento de alta categoría.


Saludos!
Good Engineering is not Premature Optimization
Tags: communication
Published: 2023-01-09 02:48:30

---
title: Good Engineering is not Premature Optimization
published: true
date: 2022-10-10 04:00:00 UTC
tags: Communication
canonical_url: https://max.engineer/premature-optimization
---

The term “premature optimization” is often misused. It’s supposed to be about trading simplicity for unnecessary performance gains. Instead, it’s used as a blanket dismissal of anything unfamiliar. That’s both inaccurate and harmful. Here’s a list of when it’s not a premature optimization.

It’s not premature optimization on their part when:

- They solved a problem elegantly, in a way that you didn’t think of
- They solved a problem elegantly by deviating from the beaten path
- They designed a clear and fitting code pattern that you didn’t come up with
- They used a fitting data structure that you weren’t aware of
- They used a fitting algorithm that you weren’t aware of
- They achieved extra performance without sacrificing clarity, with an approach that you didn’t think of
- They configured a piece of infrastructure for the required use case
- They let an appropriate existing system handle the work that it’s good at handling

And they did that within the allotted time.

Respectively, it’s not premature optimization on your part when:

- You propose a clean and elegant solution that they didn’t think of
- You challenge an existing practice with a simpler/cleaner alternative
- You introduce a new code pattern going forward, which improves codebase clarity and consistency
- You recommend a minor code change to use a more fitting data structure that they weren’t aware of
- You note that there’s a more fitting algorithm that they may not have seen
- You explain how a small change can make the code more performant without sacrificing its clarity
- You suggest an infrastructure config appropriate for the required use case
- You push for letting an appropriate existing system to handle the work that it’s good at

And the time it would take to follow your advice is negligible.

I’m not saying that these are always desirable. I’m only saying that they are not premature optimization. It’s important to label other people’s work correctly (as well as your own). Lump good engineering with premature optimization, and you end up with all the consequences of bad engineering at once.
Build on ParallelChain Testnet 3 and get incentivized for it.
Tags: blockchain, dapp
Published: 2022-10-10 03:59:51

ParallelChain is a combination of a public and private blockchain where developers can create dApps on the their public chain, which can then be used by the public and even large enterprises using their private chain. Their private chain supports 144,000 TPS and 0.003 Latency (Proven). And clients include huge names such as Accenture. 

Once the full Mainnet launch in Q4 of this year, we will also be providing funding to developers to build their own dApps on ParallelChain. 

For our most recent Testnet 3 - We extend a special invitation to the developer community to try out Testnet 3 collaborate with our engineers to improve the network. We will make sure that **your valuable contributions will be suitably rewarded**. 

To enrol: please email dev@parallelchain.io and tell us a bit about yourself and developer experience, if any.
API? What?
Published: 2022-10-10 03:52:10

Most of us might have heard of the word API a lot in the tech world, such as Twitter API, Notion API, Google API and so on. So it’s time to debunk what an API is.

API stands for Application Programming Interface. It usually refers to REST API where REST stands for Representational State Transfer. API works just like a website where a call from the client (user) is sent to the web server and data is received back over the HTTP Protocol. While a website returns back a Graphical Output, an API usually responds back in a specific format such as JSON data.


![GitHub Website vs GitHub API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fp5wzvbptomhcbv96j3j.png)_Picture depicting GitHub Website vs GitHub API_


You can always access an API, take it’s data and pass it into another API and build some thing great. In a way that we can read data from API, we can similarly send data to an API. Before that we need to know what HTTP Request Methods are. There are two main HTTP Request Methods, GET and POST. GET method allows you to send a request to the API and receive back a response in a format such as JSON. POST method allows you to write data to the API and can be best done by mentioning the data in the body of the request. This cannot be accomplished within a browser instead we can use a software known as POSTMAN [https://www.postman.com/]. But to write data to a public API, the API owners usually require Authentication, and the most commonly used authentication is OAuth. An OAuth basically takes credentials in the form of username and password in exchange for an access token which needs to be passed to the API which lets you securely access the API and write to it. Suppose you want to send out a tweet using the Twitter API, you can get the access token of the Twitter API, and then use this access token to send out a tweet from Postman.

If you find this article useful, please feel free to like and comment.
JavaScript - Estrutura léxica
Published: 2022-10-10 02:50:58

Hello Devs, esse é mais um dos artigos/tutoriais que estou escrevendo sobre os meus estudos sobre Javascript, como o objetivo é se aprofundar ainda mais na linguagem estou dividindo em vários artigos pequenos, para que seja mais fácil o entendimento e que eu possa transmitir o que estou apreendendo de forma mais prática e funcional.

O que veremos:

1. Diferenças de maiúsculo e minúsculo
2. Comentários
3. Literais

## Diferenças de maiúsculo e minúsculo.

JavaScript e linguagem que existe diferença entre palavras que tenham letras maiúsculas e minúsculas, ou seja se escrevermos "Ola" e diferente de escrever "OLA", isso se aplica a palavras reservadas, funções e outros identificadores da linguagem.

Ná prática vamos tentar executar um função de controle o FOR

```javascript
var Things = "ola mundo";

FOR (var i = Things.length - 1; i >= 0; i--) {
	console.log(Things[i]);
}
```

Para execução do código iremos utilizar o site JSBin, você vai utilizar muito para executar os eu códigos. Ao executar o código acima temos um erro porque para usar o for devemos utilizar as letra em minúsculo "for".

## Comentários

Como qualquer linguagem de programação para ajudar programadores e pessoas que irão ler e compreender o seu código existe os comentários. 
Podemos utilizar os comentários em JavaScript de duas maneiras, quando queremos fazer um comentário que terá várias linhas:

```javascript
/* 
Isto é um comentário de multiplas linhas.
Você pode escrever mais do que uma linha.
*/
```

Ou podemos utilizar comentando apenas uma linha

```javascript
// Comentário de apenas uma linha
```

## Literais
 
Em JavaScript você utiliza literais para representar valores fixos que não variáveis, conforme execução do script exemplo, um texto fixo que você digita.



Ester tutorial/artigo está em desenvolvimento
Do not render page while hydration
Tags: react, beginners, tutorial
Published: 2022-10-10 02:44:18

Handles the mounted state of the component.

Useful for cases where a content should only be rendered on the browser and the DOM should stay the same on the server and on the re-hydration process.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/liejbvwmk8mikjzrmifo.png)
About Me
Tags: webdev, blog, programming
Published: 2022-10-10 02:30:09

## Who Am I?
I am Dom. I am 14 years old and just started High School. I started coding in 7th grade, during quarantine on a crappy chromebook. I started with HTML, CSS, and vanilla JavaScript. I was learning on Khan Academy, and completed the course that same year. I then moved on to Python, somethings that I liked about python was; simple, easy to read and write, and very accessible. I learned the basics of python but soon realized I liked it better when I was able to view my work. But, I did like automating tasks with python, my favorite automation was receiving text messages about bitcoin and Ethereum every 1 hour. I also learned just enough Java to create a robot for my school's First Robotics team, even though I was the only freshman and I had to build and code the robot by scratch, we still performed really good. I remember having to use the 2012 Apple MacBook Pros that had terrible battery life. At each of the competitions, I was the only middle schooler which made it very awkward for me to communicate with my alliance team, but I soon got over that sense of anxiety. That same year I applied to a high school to major in computer science, the school told me that they couldn't accept me because they didn't have enough space but they recommended me to my current high school where I am majoring in robotics. This summer I learned ReactJS and the basics of Django, and I finally learned how to use git and GitHub. Although I liked how easy it was to use Django, I couldn't understand the folder structure, but I found a alternative: NextJS. I am currently learning NextJS and created a list of languages I want to learn in the course of the next 5 years. Those languages are: 
- NextJS
- NodeJS
- Tailwind CSS
- SQL Lite

Based on those 4 languages you can see, I really want to become a full-stack developer. 

## Goals for After High School and College 
After high school and college I want to work as a full stack developer at a medium-sized company. Although, at FAANG companies you get paid a lot, you aren't really valued the same if you were to work at a start-up, but if you work at a start-up they depend you a lot more. Overall, medium-sized companies give me a good work-load and okay pay.

## Hobbies 

When I am not coding or working with robots I like to: 
- play the bass
- play Apex (I am terrible though)
- play soccer
- watch anime (I am not a weeb though)
Lab 4 - config file support & remote repos
Tags: git, github
Published: 2022-10-10 01:55:12

## Implementing config support in another repo

For Lab 4, I added support for reading and parsing a JSON config file to [Stefan's SSG](https://github.com/sfrunza13/SiteGenerationTool).

The code itself was difficult at first since I am not incredibly familiar with Python but it got easier as I continued once I was accustomed to the syntax structure (since Python itself is fairly easily).

I did run into quite a few problems since, as I stated, I am not very familiar with programming in Python.  However, since Python is a fairly easy-to-use language, it did not take me long to become familiar with the necessary syntax and logic in order to implement and test this config file feature.

Using Git was very easy this time for cloning the repo, creating a topic branch and updating the branch regularly with changes. I have performed these tasks via the Git CLI before so it was easy to do it again for Lab 4.

## Reviewing and Testing using remotes

For Lab 4, Maxim [implemented the config support](https://github.com/a-parris21/ap21-ssg/pull/25) for my repo.

This was my first time using Git's features for reviewing and testing via remote repos/branches. This was also my first time getting acquainted with remote-tracking branches. I thought they sounded complicated at first but they were actually fairly easy to use.

Additionally, Maxim's code did not generate any errors when I tested it and it functioned as intended. So after reading and testing it a few times, I just had to accept the PR since there was nothing that required fixing.