teleren/devto huggingface dataset:
System Design : Basics
Tags: systemdesign, hld
Published: 2024-02-15 13:45:51

#Back of Envolp
Before Starting the HLD start with Back of Envolp Estimations

BOE drives decision for System Design:

##Consideration: Rough Estimation
- Keep assumption value simple like taking multiplication in 10.
- Lets see cheat sheet:
  Everything is is mul. 3 zeros

Value     ----------  |  Traffic      ------------  |  Storage
------------------------------------------------------------
| 3 Zeros----------->  |  Thousand----------- >  | KB
| 6 Zeros----------- > |  Million----------->    | MB
| 9 Zeros----------- > |  Billion----------- >    | GB
| 12 Zeros----------- > |  Trillion------ ----- >   | TB
| 15 Zeros----------- > | Quilon ----------- >    | PB

### Other Consideration
  char        - 2 byte
  long/double - 8 byte
  Image       - 300 KB

Formula:
X million User * Y mb      =       XY TB
6 zeros          6 Zeros          12 Zeros

so,
5 million User * 2 KB      =     10 GB
6 Zeros -----------3 Zeros -----------9 Zeros


# Lets take an example now, any Social Media

## Given Data :  
Total User  - > 1 Billion
DAU (Daily Active User) - > 25% Total User  - > 250 million User
Read & Write : 5 read & 2  write

## a) Traffic :
Calculations:
- 250 Million USer * (5 + 2) query / 1 Day (86400 sec = ~ 100000)
  17500 ~= 18 K Query/Sec.

## b) Storage Assumption : 
Every user writing 2 post ( lets say each is 250 char)
consider 10% User upload 1 image ( 1 img = 300 kb)

1 post - > 250 char = > 250*2 byte. 
2 post - > 500 char = > 1000byte = > 1 KB. 

250 million user * 1 KB = (250 * 10^6) * (1 * 10^3) = 250 GB/DAY

25 Million * 300 KB = 7.5 GB ~= 8 TB/DAY

### lets say we store data for 5 year then total storage requir :
5 year = 1825 days ~= 2000 day
Total Storage : 2000 * 250 GB + 2000 * 8 TB = 16.5 PB

## c) Ram Estimation :
- For each user last 5 post we are pulling each.
  1 post = 500 byte from above calculations.
  5*500 = 2500 byte / user ~ = 3000
- 250 million * 3000 = 750 GB - memory Space
- 1 Machine = 75 GB data in memory
  so 10 machine we needed for cache

### Latency : 95% 500ms (Rough Estimation)
- 18 Query/sec
- 1 server = > 50 thread = > 100 request / sec
- Server No : 18k/100 = 180 server

## Trade OFF
Since it is read heavy system , consistency we can ignore 
so in CAP theorem we need AP.
Javascript DevOps Conference
Published: 2024-02-15 13:42:47

Are you enjoying the JavaScript DevOps Conference as much as we are? It's the ultimate gathering for developers and architects shaping the future of JavaScript application development. From building robust infrastructure to ensuring top-notch security and performance, this event covers it all. See you there! 

https://www.relianoid.com/about-us/events/the-javascript-devops-conference/

#DevOps #JavaScript #TechConference #RELIANOID #Innovation #SoftwareDevelopment #OpenSource #Cybersecurity #Performance #Monitoring #CI/CD #BuildTools 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r178momkok5z8frhepqn.jpg)
Error while installing parcel bundler in ubuntu
Tags: webdev, react, ubuntu, javascript
Published: 2024-02-15 13:38:32

hi i recently shifted to ubuntu os and now I am trying to install parcel bundler but its showing some error please someone help me . I am here after searching the solution for it the whole day.[](
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yra7hgf1o1j93tc44s4t.png))

command: sudo npm install -d parcel

error : npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm info run @parcel/watcher@2.4.0 install node_modules/@parcel/watcher node-gyp rebuild
npm info run lmdb@2.8.5 install node_modules/lmdb node-gyp-build-optional-packages
npm info run msgpackr-extract@3.0.2 install node_modules/msgpackr-extract node-gyp-build-optional-packages
npm info run @parcel/watcher@2.4.0 install { code: 7, signal: null }
npm ERR! code 7
npm ERR! path /home/pratik/Desktop/new/node_modules/@parcel/watcher
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-02-15T12_17_03_228Z-debug-0.log
Mastering Common Database Objects - Series 1 .. n
Tags: database, sql, programming, awsbigdata
Published: 2024-02-15 13:32:38

In the series, I hope to cover some common database objects such as procedures, functions, triggers etc. while also providing frequent real-life scenarios where these objects are used. The scope of this series will be limited to the oracle PL SQL syntax. However, most objects exist in other database technologies and I am pretty sure that the knowledge gotten here will be transferable to other RDBMS systems.

> Get ready!!

Each coming article will focus on one database object only and will contain code snippets. The objects that will be covered are:

1. [Procedures](https://dev.to/ayokunle/database-procedures-3bd7)
2. [Functions](https://dev.to/ayokunle/functions-in-sql-179h)
3. [Packages](https://co.hashnode.dev/packages)
4. [Custom data types](https://co.hashnode.dev/custom-data-types)
5. [Database Triggers](https://dev.to/ayokunle/elevating-database-functionality-with-triggers-a-deep-dive-using-aws-rds-4ieo)

---
**Coming Soon**
1. Cursors
2. Jobs
How to install Python3 for Mac
Tags: python, webdev
Published: 2024-02-15 13:20:53

---
title: How to install Python3 for Mac
published: true
description: 
tags: Python,webdev
---

#Installing Python Environment

### 1. Optional: Install Python using Homebrew
- If you use Homebrew, open the Terminal and run the following command:
  ```
  brew install python
  ```

### 2. Or, Directly Download the Installer
- Visit the [official Python website](https://www.python.org/).
- Click on "Downloads."
- Choose the latest version of Python.
- Download the installer based on your operating system.
![Downloads.png](https://upload-images.jianshu.io/upload_images/3707284-ef6ba0d4c815a747.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

### 3. Run the Installer
- Once the download is complete, open the downloaded installer.
- Follow the on-screen instructions to complete the installation.


### 4. Verify the Installation
- Open the Terminal.
- Type the following command to check if Python is installed:
  ```
  python3 --version
  ```
- If the version information is displayed, the installation was successful.

Congratulations! You have successfully completed the first step in using Python.
Installing MySQL on Amazon Linux 2023
Published: 2024-02-15 13:18:55

MySQL does not come by default with Amazon Linux 2023. 

I ran into some challenges installing it, and had to consult multiple blogs for success. 

Follow these steps to install it. 

1. Download the RPM file

```
sudo wget https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm 
```

2. Install RPM file

```
sudo dnf install mysql80-community-release-el9-1.noarch.rpm -y
```

3. You need the public key of mysql to install the software. 

```
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
```

4. If you need to install mysql client:

```
sudo dnf install mysql-community-client -y
```

If you need server:

```
sudo dnf install mysql-community-server -y
```
Write Less Convoluted ViewModels with Swift Subscripts
Published: 2024-02-15 13:16:49

The Swift programming language provides many convenient language features to access data immediately—for instance, the built-in subscripts for arrays and dictionaries. But what about custom Swift objects? Today, you’ll learn how to access any property without relying on dot notation.

**Why Subscripts**
Subscripts can be particularly useful when working with multidimensional arrays or other complex data structures, as they provide you with a clean approach to accessing elements at specific indices or by key, exactly how you would access a value from an array or dictionary.

**Visualizing the Problem**
Let’s assume a scenario where you have a view that switches between four states. For each state, the requirements states (no pun intended) that the corresponding data should be fetched and presented to the end user. But, the corresponding objects are encapsulated within a parent object.

You immediately reach for your switch statement:

```Swift
switch state {
case .state1:    
    var object = object.correspondingObject
case .state2:
    var object = object.correspondingObject
case .state3:
    var object = object.correspondingObject
case .state4:
    var object = object.correspondingObject
}

```

And you did it; you got the job done.

But you could have just done:

```Swift
object[state]
```

And you’re done.

**Important note**
The return type of your subscript method should be a protocol that the encapsulated objects conform to.

**Understanding Subscripts**
Subscripts can make the code more readable and concise when accessing elements in a custom data structure, such as arrays, dictionaries, or custom classes. And like in the example above, they can be used to define custom access patterns for your types, allowing you to interact with your data in a natural and intuitive way.

**Summary**
In this exploration, we’ve dived into subscripts, a powerful feature in Swift that allows you to provide custom access to elements in your types, improving the clarity and usability of your code.

That’s all for now, fellow developers! I hope this post has shed light on the beauty of subscripts in Swift. If you have any questions or insights to share, feel free to leave a comment below. And don’t forget to connect with me on LinkedIn and Twitter for more insights and future posts. Happy coding!
Write a function that returns all prime numbers between two given numbers.
Tags: java, dsa, problemsolving, methods
Published: 2024-02-15 13:11:38

## Introduction
This problem is same as finding if a number is prime or not. But here we have to take a interval value and checks which numbers are prime between the interval using java methods and the interval value should be taken from the user.

## Steps

1. Take 2 inputs from the user
2. Run a for loop from small small one to high one.
3. Pass the loop value to isPrime() method.
4. Print the value.

## Java Code

```
package FunctionsOrMethods;

import java.util.Scanner;

public class PrimeBetweenInterval {
    public static void main(String[] args) {
        System.out.print("Please Enter the interval starting value of the interval: ");
        Scanner input = new Scanner(System.in);
        int num1 = input.nextInt();
        System.out.print("Now give the ending value of the interval: ");
        int num2 = input.nextInt();
        System.out.print("The prime numbers are: ");
//      -----------------+++++++++ Prime Between Interval ++++++++++--------------
        if ( num1 > num2){
            int temp = num1;
            num1 = num2;
            num2 = temp;
        }
        for (int i = num1; i <= num2 ; i++) {
            if (isPrime(i)){
                System.out.print(" " + i);
            }
        }
    }

    private static boolean isPrime(int num) {
        if(num <= 1){
            return false;
        }
        double length = Math.sqrt(num);
        for (int i = 2; i < length; i++) {
            if (num % i == 0){
                return false;
            }
        }
        return true;
    }
}

```


## Output Image

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/44w75c1of8l62a7avnf3.png)
Maximizing User Engagement: Tips for App Developers
Tags: appconfig, beginners, webdev, programming
Published: 2024-02-15 13:10:30

## Understanding User Behavior
When it comes to developing a successful app, understanding user behavior is key. By analyzing how users interact with your app, you can identify patterns and preferences that will allow you to tailor the app to their needs. Consider implementing analytics tools to track user actions and gather valuable insights for improving user engagement.

## Creating a Seamless User Experience
A seamless user experience is crucial for keeping users engaged with your app. Ensure that your app is intuitive and easy to navigate, with clear instructions and minimal friction points. By [optimizing the user interface](https://hyscaler.com/insights/ai-in-web-design/) and streamlining the user journey, you can enhance the overall user experience and encourage users to spend more time on your app.

## Implementing Personalization Features
[Personalization features](https://hyscaler.com/insights/personalized-healthcare-blockchain/) can significantly impact user engagement by making users feel valued and understood. Consider incorporating features such as personalized recommendations, tailored content, and customizable settings to create a more personalized experience for each user. By catering to individual preferences, you can increase user satisfaction and encourage long-term engagement.

## Encouraging Social Interaction
Social interaction plays a vital role in maximizing user engagement. Integrate social sharing options, interactive features, and community forums to encourage users to interact with each other and share their experiences. By fostering a sense of community within your app, you can create a more engaging and dynamic user experience that keeps users coming back for more.

## Leveraging Push Notifications
Push notifications are a powerful tool for re-engaging users and driving them back to your app. Use push notifications strategically to notify users of new content, promotions, or updates that are relevant to their interests. By sending timely and personalized notifications, you can rekindle user interest and encourage them to revisit your app regularly.

## Monitoring and Iterating
Continuous monitoring and iteration are essential for optimizing user engagement over time. Regularly analyze user feedback, app performance metrics, and user behavior data to identify areas for improvement and implement iterative changes. By staying agile and responsive to user feedback, you can continuously enhance the user experience and maximize user engagement.

In conclusion, maximizing user engagement requires a deep understanding of user behavior, a focus on creating a seamless user experience, the implementation of personalized features, the encouragement of social interaction, the leveraging of push notifications, and a commitment to monitoring and iteration.

By following these tips, app developers can create engaging and user-friendly apps that keep users coming back for more.
Tmail.io: A Perfect Partner for Professionals
Published: 2024-02-15 13:08:43

<p>There has to be a source that keeps everyone connected virtually. And in this digital world, email accounts have played a role of that source admirably. On one hand, Gmail accounts are a source of connection. On the other hand, it creates many issues. That's when smart brains came up with the idea of the <a href="https://tmail.io/temporary-disposable-gmail" target="_blank">temporary Gmail account</a> generator and temporary Gmail accounts.<br /><br /> Tmail.io is an excellent temporary Gmail account generator. This completely free service is for all your personal and professional purposes. People have used temporary Gmail IDs created by this generator a number of times and made the most out of them. Here's why it has been a preferred Gmail ID generator.<br /><br /> <strong>Personal Purposes:</strong><br /><br /> The need for temporary Gmail IDs for personal purposes is evident. People need it to get access to online content and services for the time being. If there is content or service that they will not require for a long time, they use a <a href="https://tmail.io/temporary-disposable-gmail" target="_blank">disposable email address Gmail</a>. It helps them sort their inboxes with needed and not needed emails. Tmail.io enables you to generate as many temporary Gmail accounts as you want. You can use these disposable email addresses for multiple purposes.<br /><br /> <strong>A Partner for Professionals:</strong><br /><br /> Professionals, like developers and testers, are often seen using disposable emails. They do so to simulate user interactions and reveal user issues and more. Tmail.io has been a perfect partner for testers and developers to generate temporary Gmail accounts. They use this generator platform to create disposable emails without the need to expose original credentials. Testers and developers take insights from simulated user interfaces to determine the products and identify potential risks and issues. Temporary Gmail accounts generated using this platform are perfect for this purpose, as they keep everyone's systems, devices, and personal details safe from exploitation.<br /><br /> <strong>Why this generator?</strong><br /><br /> There are several <a href="https://tmail.io/temporary-disposable-gmail" target="_blank">temporary Gmail</a> generators available. These generators offer somewhat the same services. However, Tmail.io is still one of the best. It can help you with multiple temporary Gmail addresses within seconds. Moreover, managing these disposable Gmail addresses will not be an issue for users. Along with this, you can use these addresses almost anywhere. There are no restrictions at all. After some time, these IDs will automatically get deleted, leaving you without any worry. Therefore, this temporary Gmail generator has been preferred by many people for personal and professional uses.<br /><br /> You can use this generator as well. Check it out at <a href="https://tmail.io/" target="_blank">https://tmail.io/</a> <br /><br /> Original Source: <a href="https://bit.ly/3SRqiWN">https://bit.ly/3SRqiWN</a></p>
Node.Js Express Typescript Deployment on Vercel
Tags: tutorial, node, typescript, api
Published: 2024-02-15 13:06:46

Just came across the web and tried to find good documentation on deploying Node.js Express Typescript to Vercel. It was not clear at all with my findings. Important instructions were missing, but I have customized some changes and got it to work in few minutes.

Create a **vercel.json** in the project root of your project if not existing already.

Add this code and change the **src** path according to your project setup.

`{
	"version": 2,
	"builds": [
		{
			"src": "src/api/index.ts",
			"use": "@vercel/node"
		}
	],
	"routes": [
		{
			"src": "/(.*)",
			"dest": "src/api/index.ts"
		}
	]
}`

I had my project setup with **src** folder and added the **api** folder to the **src** folder.

Inside the **api** folder, I create an **index.ts** file.

The **index.ts** file has this code:


import cors from "cors";
import dotenv from "dotenv";
import bodyParser from "body-parser";
import compression from "compression";
import helmet from "helmet";
import express from "express";
import router from "../routes/prisma";

dotenv.config();

const app = express();
/*
    Configurations
*/
app.use(
	cors({
		origin: "*",
	})
);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(compression());
app.use(helmet.crossOriginResourcePolicy({ policy: "cross-origin" }));
app.use("/api", router);
/*
    Routes
*/
app.all("*", (req, res) => {
	res.status(400).json({ error: `Route ${req.originalUrl} not found` });
});

export default app;


The most import code here is to 

> export default app;

That way this becomes serverless just like Vercel Serverless functions.

The **router** defines the all routes for the api itself.

Since I am using Prisma and with addition of mongo backup, I structured the folders for every ORM the project support.

Last thing was to add this precious line to the package.json:

`"vercel-build": "yarn generate", `

This line, gets prisma to initialize the client and be of use to the whole project.

The "vercel-build" works for any build you wish to have when using node.

I hope this was clear in a way to help with deploying node express to Vercel as serverless.

Leave a comment for any information you need from this.

Great🎉
Top Campus Placement Cell in Punjab
Tags: education, engineering, college, career
Published: 2024-02-15 13:04:41

**Global Institutes** boasts the most sought-after [Campus Placement Cell in Punjab](https://www.globalinstitutes.edu.in/top-placements/), ensuring unparalleled career opportunities for students. Our robust network, industry partnerships, and personalized guidance propel graduates towards successful careers in diverse fields, setting us apart in Punjab's educational landscape.
How to install the Node.js
Tags: node, webdev, javascript
Published: 2024-02-15 13:03:51


## Here are the steps to install Node.js on a Mac:

### 1. Visit the Node.js official website:

Open  the [Node.js official website].



### 2. Choose a version:

The website will display the latest stable version and the long-term support (LTS) version such as below picture. Depending on your needs, select a version. In general, choosing the LTS version is a good option.

![Download Picture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4mdz72x6ajpqm77zue9s.jpeg)


### 3. Run the Node.js installer:

Once the download is complete, run the downloaded installer. 


### 4. Verify the installation: 

After installation, you can verify if Node.js and npm were installed successfully by typing the following commands in the Terminal:

```
node -v
npm -v
```

If everything is set up correctly, these commands will display the installed versions of Node.js and npm like below picture.


![Verify Picture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh9ct1q0lwho8cz7pm0w.png)




Now, you have successfully installed Node.js. If you need to globally install Node.js modules later on, you can use the npm command.

I hope this helps! Feel free to ask if you have any further questions.
5 useful AI tools for developers
Tags: webdev, programming, ai
Published: 2024-02-15 12:58:55

I've been diving deep into [AI tools](https://bayesianhub.ai), and I've got to tell you, it's pretty mind-blowing what's out there now. It feels like we've hit a goldmine for boosting our productivity and making our lives a whole lot easier. So let me walk you through some of these gems I've discovered. I hope they'll make your work much easier!

First up, we've got **[DevGPT](https://bayesianhub.ai/tool/devgpt)**. It's like having a co-pilot while coding, suggesting entire lines of code or even functions as you type. Think of it as a pair programmer who's there 24/7, ready to pitch in with ideas or finish your sentences, but in code. It's incredibly versatile, supporting a wide array of languages. It's practically magic how it streamlines the coding process​​​​.

Then there's **[Gitwit](https://bayesianhub.ai/tool/gitwit)**. This tool is like a mind reader, offering eerily accurate code completions. It's like it knows what you're going to type before even you do. The support for over 30 languages is a game-changer. It learns from your style, making its suggestions more personalized and spot-on over time​​​​.

Lastly, have you ever wrestled with regular expressions? RegExGPT and AutoRegex turn what feels like arcane knowledge into something more approachable, decoding and generating RegEx patterns with ease. It's like they've cracked the code to make **[AutoRegex](https://bayesianhub.ai/tool/autoregex)** a breeze​​.

We've got this arsenal of digital tools at our fingertips, ready to tackle any challenge that comes our way. Integrating these into our workflow could revolutionize how we approach coding, don't you think? 

It's an exciting time to be a developer!

Btw have you tried some of them?