teleren/devto huggingface dataset:
4 Steps to crack your next System Design Interview
Tags: beginners, architecture, microservices, java
Published: 2021-04-03 15:10:13

The system design interview is an **open-ended** conversation. You are expected to lead it.

To help solidify this process, You can use the following steps to guide the discussion.


<hr>

## 1. Outline use cases, constraints, and assumptions

Gather requirements and scope the problem. Ask questions to clarify use cases and constraints. Discuss assumptions.

- Who is going to use it?
- How are they going to use it?
- How many users are there?
- What does the system do?
- What are the inputs and outputs of the system?
- How much data do we expect to handle?
- How many requests per second do we expect?
- What is the expected read to write ratio?

## 2. Create a high-level design

Outline a high-level design with all important components.

- Sketch the main components and connections
- Justify your ideas

Example: 

![hld.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1617461183431/anzXnBHEI.jpeg)

## 3. Design core components

Dive into details for each core component. For example, if you were asked to design an Instagram like website, discuss things in detail for each module:

Example : 

##### - User Authentication & Authorization module 

1.  Login / Signup Flows.
2. How the user will be authenticated/authorized when he log in and try to access your application.
3. Database Schema 
4. What is your choice of the database? (SQL or NoSQL)
5. API and object-oriented design

##### - Timeline Module 

1. How user timeline will be shown based on his follows.
2. Database Schema
3. What is your choice of database? (SQL or NOSQL)
4. API and object-oriented design

Always give preference to complete the high-level design of end-to-end user flows for the given problem statement.  Pick a couple of modules from your design and try to deep dive into it by explaining the low-level design.

## 4. Scale the design


![Scaling your design - Image copyrights (RedisLabs)](https://cdn.hashnode.com/res/hashnode/image/upload/v1617461422540/euK5wFQ7S.png)

Identify and address bottlenecks, given the constraints. For example, do you need the following to address scalability issues?

- Load balancer
- Horizontal vs Vertical scaling
- Caching
- Database sharding

Discuss potential solutions and trade-offs. Address bottlenecks if any.

## Most Common System Design Questions

1.  Design URL shortening service like bit.ly
2. Design Social network like Facebook/Twitter/Instagram.
3. Design Cab booking system like Uber.
4. Design a Web Crawler.
5. Design Video Streaming Service like Youtube.
6. Design a system like Quora/Reddit.
7. Design ticket booking system like  [Ticketmaster](https://www.ticketmaster.com/) 

<hr>

## Thank you for reading
### If you like what you read and want to see more, please support me with  [coffee or a book](https://www.buymeacoffee.com/vishnuchi)  ;)
Postegro benzeri uygulama
Tags: postegro, uygulama, instagram
Published: 2021-04-03 15:06:35

Instagram gizli profilleri gösteren gizli uygulamalar sayesinde istediğiniz her profile erişme fırsatınız olacak. Postegro ve <a href="https://teknofobic.com/8-adet-postegro-benzeri-uygulama-2021/">postegro benzeri uygulama</a> ile bu işlemleri çok rahat gerçekleştirebilirsiniz. Bu uygulamaları kullanmadan önce bilmeniz gerekenler var. Bu yüzden yazımızı okumaya devam edin.
Weekend hack: a tiny tool to check internet speed right from Terminal
Tags: showdev, go, weekendhack
Published: 2021-04-03 14:21:14

---
title: Weekend hack: a tiny tool to check internet speed right from Terminal
published: true
description: 
tags: showdev, go, weekendhack
cover_image: https://raw.githubusercontent.com/adhocore/fast/main/assets/usage.png
---
Introducing a tiny utility built on Go using chromedp to check internet speed right from the terminal.

## How to use it?
Make sure you have a Chrome browser installed, then install `fast`:
```sh
go get github.com/adhocore/fast/cmd/fast
```

Finally, make sure `$GOPATH` or `$HOME/go/bin` is in your `$PATH` or `%path%`, then run
```sh
fast
```

You will see something like this
![fast](https://raw.githubusercontent.com/adhocore/fast/main/assets/usage.png)

---
{% github adhocore/fast %}
How to learn JavaScript by doing coding tasks in a professional IDE with hints?
Tags: javascript, beginners, codenewbie, vscode
Published: 2021-04-03 13:50:18

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/thk1yz89nublcffg31wl.png)

To become a programmer, **you need to code**. And not on your smartphone or browser, but in a professional Interactive Development Environment (IDE).

One of the best features of [CoderslangJS](https://js.coderslang.com) - is **practical tasks with automatic verification**.

You'll be solving your tasks directly in the **Visual Studio Code**. In 2021 - it's the most popular IDE among Full Stack JS devs.

## How to get tasks?

To make your learning process as efficient as possible, we've written the VSCode extension that you can get in the [official repository](https://marketplace.visualstudio.com/items?itemName=AgileNix.Coderslang).

Once you've installed the plugin, you can log in using your personal **API key**. If you've skipped the second lecture, you can always find the key in the Settings section above the lecture title.

![img](https://learn.coderslang.com/vscode-login-en.png)

Once you've logged in, you should choose the working directory. It will be used to store all your tasks and solutions. To download new tasks click the button "**Download tasks**".

## How to solve tasks?

After downloading the tasks, you'll see new folders inside the working directory. The task itself is located in the file **task.cdsl**.

When you open it, you'll see the task description and two buttons: "**Run your code**" and "**Submit task**".

![img](https://learn.coderslang.com/vscode-task-en.png)

Once you've solved the task, ran your code, and made sure that everything works fine, you can submit the task for verification.

The task verification is automatic and takes about 10 seconds. If something's wrong with the task description, we'll give you hints on what you should fix to pass the test.

![coding hints](https://learn.coderslang.com/vscode-errors-en.png)

As soon as you fix the issue, submit the task once more. If everything goes well, all the checks will become green and the task will be marked as "**DONE**".

![img](https://learn.coderslang.com/vscode-hints-en.png)

## What should I do if I can't solve the task?

1. Make sure that you've saved all the files before submission. To fix the problem once and for all, you can trigger the autosave option in "**File -> Auto Save**".
2. Read the task description and hints once more. Have you handled all the possible scenarios and corner cases?
3. Ask your questions in our [Telegram chat](https://t.me/coderslang_chat), [Twitter](https://twitter.com/coderslang) or write me an [email](mailto:welcome@coderslang.com). I'd be glad to help you.

So, are you ready to start [learning Full Stack JavaScript](https://js.coderslang.com)?
My javascript / tech / web development newsletter for 2021-04-03 is out!
Tags: javascript, tech, webdev, discuss
Published: 2021-04-03 13:27:51

---
title: My javascript / tech / web development newsletter for 2021-04-03 is out!
published: true
description: A roundup of all the best javascript, tech and web development links posted to my linkblog in the past week
tags: javascript, tech, webdev, discuss
---
In this week’s edition:

Congress, YouTube protection, Facebook feeds, Substack funding, Intel vs TSMC, NFT&Crypto surge, Deno, Apple privacy blocks, Google Maps, Cryptojacking, AirBnB training, NodeJS certification, Fastify

https://markjgsmith.substack.com/p/mark-smiths-newsletter-03-04-2021

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Discussion: How would you go about testing a bot which plays a game?
Tags: discuss, gamedev, testing
Published: 2021-04-03 13:21:49

Suppose you made a game playing bot (like [stockfish](https://stockfishchess.org/) for example). How would you check if the bot is good enough?

As you might have guessed, I was planning creating a bot so I thought I would put this question here. Maybe that bot will get it's own article.

PS: this is my first post!!
For...of Loop Refactoring
Tags: javascript, codequality
Published: 2021-04-03 13:20:14

**`for...of` loops over iterable objects, for example arrays or strings.** 

The for...of loop is easier to read than indexed `for` loops and can replace them in many cases.

For example,

```javascript
for (let i = 0; i < elements.length; i++) {
    const element = elements[i];
    console.log(element);
}

```

can be replaced by

```javascript
for (const element of elements) {
    console.log(element);
}
```

For..of loops have been introduced with ES6. Learn More: [for...of (MDN)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of)  

P42 now supports converting regular for-loops over arrays with index variables into more concise for-of loops. The refactoring is available on the playground and for all repositories.

[Try it out in the P42 VS Code Extension!](https://marketplace.visualstudio.com/items?itemName=p42ai.refactor)
How Dogfooding Our Own SAAS Product Got Us Our First 20 Customers
Published: 2021-04-03 13:12:49

We at Proxies API have clients who have used our Rotating Proxies Service for all sorts of web crawling use cases.

Since we are a Rotating Proxy Service that developers use to scale their web crawling, our ideal audience is developers. So we are always on the lookout for opportunities to help developers—especially developers who are involved in web scraping web crawling projects.

So we need to know when someone asks a question about anything to do with Web crawling/Web Scraping or Data Mining technologies.

So we have built our little web crawler behind the scenes to Quora and other social networks like Twitter, Facebook, Linkedin, Google News for people needing help with these technologies.

Since we started doing this, this is one of our primary drivers of traffic, which happened by merely finding and answering questions online about these topics on time.

Since we started this internal crawler, we have detected about 500 places across Quora, Linkedin, Facebook, Twitter, Reddit, etc. where we can add value.

Our bot returns a database of these opportunities like below for us daily, and its fun to watch everyone on the team try to take a crack at answering/helping them.
It has prompted many interesting discussions and knowledge sharing and research sessions amongst the team.

We have already posted about 110 answers in various places in a systematic way. Sometimes, these questions inspire an in-depth blog post on our blog as well. We even got some people from Quora who directly reached out and became our customers, plus we are helping them set up their entire crawling infrastructure!

We also feel like we have a pulse on the pain points that our potential customers face and have grown to have real empathy for them by just actively looking to help in any way we can.
How to Change or Disable the Proxy Server of Google Chrome on Windows 10
Published: 2021-04-03 13:11:49

Follow the steps below to change or disable the proxy server settings of Google Chrome on Windows.

Step 1. On the top right corner of Google Chrome, you will find an icon called Customise and Control. Click on that

Step 2. Now click on Advanced Settings

Step 3. Scroll to the 'Network' area of the settings and click on Change proxy settings

Step 4. Click on the Connections tab inside the Internet Options window. Now click on LAN Settings.

Step 5.

If you want to disable the proxy settings:

Un-check the option. Use a proxy server for your LAN

OR

If you want to change the proxy settings:

In the section Proxy server, make sure the option Use a proxy server for your LAN is checked.

Enter the new proxy server IP and Port. Also, enter the username and password if needed.

Step 6. Click OK and then click on Apply to save the new settings

That saves the proxy settings, and you can now navigate Chrome to a service like HTTPBin http://httpbin.org/ip to check if Chrome is using the proxy you typed in or not.
TIL PostgreSQL-style $facet
Tags: todayilearned, postgres, sql, database
Published: 2021-04-03 12:54:22

If you don't know yet, [$facet in MongoDB](https://docs.mongodb.com/manual/reference/operator/aggregation/facet/) allows you to run fork query into separate pipelines.

You can do this in PostgreSQL as well, using [CTE](https://www.postgresql.org/docs/9.1/queries-with.html) and JSON functions.

```sql
SELECT
  (
    SELECT json_agg(row_to_json)
    FROM (
      SELECT row_to_json(t)
      FROM (
        SELECT * FROM match_cte
        LIMIT ${limit} OFFSET ${(page - 1) * limit}
      ) t
    ) t1
  ) result,
  (
    SELECT COUNT(*) FROM match_cte
  ) "count"
```

I think this is especially more important for expensive queries that you cannot fully index somehow...
Laravel seeding the database
Tags: php, laravel
Published: 2021-04-03 12:43:51

Yesterday we made our first database, and another cool function of Laravel is the option to seed it.

The default installation comes with a basic `database/seeders/DatabaseSeeder`.

This is a collection place to run specific seeders. For our one, we will create a separate new one.

## Creating the Laravel seeder

Let's first generate a new seeder for our newly created books table.

```bash
php artisan make:seeder BookSeeder
```

This will generate the `BookSeeder.php` file for us. Let's change the run function to create 10 random books for us.

```php
public function run()
	{
	foreach (range(1, 10) as $index) {
		$year = rand(1700, 2020);
		DB::table('books')->insert([
			'title' => Str::random(10),
			'year' => $year,
		]);
	}
}
```

To run this function, we need to make one adjustment in our main DatabaseSeeder file.

```php
public function run()
{
    $this->call([
        BookSeeder::class
    ]);
}
```

And then, we can run it by executing the following command.

```bash
php artisan db:seed
```

This creates 10 random books, as you can see in the image below.

![Laravel seeded database](https://cdn.hashnode.com/res/hashnode/image/upload/v1617085232847/MG9_V_FbB.png)

## Using the Laravel seeder with a Factory

As you saw above, that is one way of entering our database entries. Still, we can also make use of something called Model factories.
They are generally used when you need to enter large data sets.

Let's create a new factory for our Books model.

```bash
php artisan make:factory BookFactory
```

The Factory, however, works on Models, so let's also create an empty Book model for now.

```bash
php artisan make:model Book
```

Then inside the BookFactory, we can set the model to be the Book model we just created.

```php
use App\Models\Book;

protected $model = Book::class;
```

And let's add some data for our definition.

```php
public function definition()
{
    return [
        'title' => $this->faker->realText(50),
        'year' => rand(1700, 2020),
    ];
}
```

This again will just generate some random text for our titles and pick a random year.

Next up, we need to make some changes to our `BookSeeder.php` file.

```php
Book::factory()
	->count(10)
	->create();
```

This says, use the BookFactory to create 10 entries.

If we now run our seeder again, we should see another 10 random entries.

![Laravel seeder with Factory](https://cdn.hashnode.com/res/hashnode/image/upload/v1617085921720/G6Rm2L7pL.png)

Pretty cool, right!

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
How to host Express app on Vercel
Tags: express, vercel
Published: 2021-04-03 12:39:04

**Disclaimer: Vercel configuration file uses legacy [builds](https://vercel.com/docs/configuration#project/builds) and [routes](https://vercel.com/docs/configuration#project/routes) properties.**

Last week I needed to host a simple [Express](https://expressjs.com/) app somewhere, and I decided to host it on [Vercel](https://vercel.com/) because of the excellent Developer Experience.

Here are the steps that I needed to do to make it possible:

First, we need to create a project directory. I decided to name it `vercel-express` and then change the directory to a newly-created directory.

```bash
# create a directory
mkdir vercel-express

# change directory
cd vercel-express
```

Then we will initialize git and add the `node_modules` directory to `.gitignore`.

```bash
# initialize git
git init

# add the `node_modules` directory to `.gitignore`
echo node_modules >> .gitignore
```

Next, we need to set up a new package. We are using the `-y` flag to skip the questionnaire.

```bash
npm init -y
```

Then we will create an `index.js` file and populate it.

```bash
# create a new `index.js` file
touch index.js
```

```js
// ./index.js
const express = require('express')

const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.send('Hello, Vercel!')
})

app.listen(port, () => {
  console.log(`Express app hosted on Vercel listening at port ${port}`)
})
```

To run an express app, we need to create a custom `vercel.json` config file.

```bash
touch vercel.json
```

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

After populating the `index.js` and `vercel.json` files, we can stage all of the files and commit them.

```bash
git add -A && git commit -m "Initial commit"
```

If you want to change the name for the main branch from `master` to `main`, simply run the `git branch -m master main` command.

For pushing code to the existing repository, follow the following code.

```bash
git remote add origin https://github.com/LukasPolak/vercel-express.git
git branch -M main
git push -u origin main
```

The Vercel config file includes legacy properties, but it works like a charm when writing this. Maybe in the future, I will update the tutorial with the recommended properties.
Use of for in loop
Tags: javascript, webdev, tutorial
Published: 2021-04-03 12:27:05

We have so many loops now in javascript to optimize our code and ignore using old for loop. One such case can be seen in below example.

We have given two array and asked to achieve an object like below


```
const keys = ["name", "city","gender", "job"];
const values = ["Test User", "Pune", "Female", "Developer"];

Desired Output
{
    name:"Test User"
    city:"Pune"
    gender:"female"
    job:"Developer"
}
```


***Using for loop:***

```
const obj = {}
for(let i = 0; i<keys.length; i++){
     obj[keys[i]] = values[i]
}
```


***using for in loop:***

```
const obj = {}
for(let i in keys) {
    obj[keys[i]] = values[i]
}
```

using for in loop our code looks more clean and its less complex and more efficient

I hope it will help someone

{% youtube QWh3IWmy-7Y %}
Github Externship Program
Tags: github, opensource
Published: 2021-04-03 12:24:04

Hello Everyone,

The GitHub Externship is a 90 days fellowship program. The GitHub Externship program is about learning, preparing students to be market-ready, strengthening industry-academia relations, and giving practical experience to students. This also aims to provide innovative solutions to the partner organizations on their existing challenges, organizations could potentially identify real talent that can be employed by the organizations at later stages.

If you want to know about Github Externship Program, you should check out this video.
https://youtu.be/woH-1LdmHV0
Generate random values in your properties - Spring Boot
Published: 2021-04-03 12:02:18

*During some configurations with Kafka, I was at a point where I need a different group id for each instance of the same service.*

*So to set up it, I looked for how I can make prefixed group ids. And I found this.*

---

In your application.properties or in your application.yaml, you can use the next functions to generate random values.

```yaml
# Random int
a=${random.int}

# Random int with a maximum value
b=${random.int(1000)}

# Random int in a range
c=${random.int[0, 9999])} 

# Random long with a maximum value
d=${random.long(100000000000000000)}

# Random long in a range
e=${random.long[10000, 999999999999999999])}

# Random 32 bytes value
f=${random.value}

# Random UUID
g=${random.uuid}
```

And if you want, you can use them in the middle of a string.

```yaml
h=test-${random.int}-value
```

<br/>

---

<br/>

I hope it will help you! 


*Don't hesitate to give some feedback to help me to improve my writing skills. Thanks!*
Article on Python Packaging (+ Free Access)
Tags: python, programming, datascience, tutorial
Published: 2021-04-03 12:00:27

{% medium https://towardsdatascience.com/how-to-package-your-python-code-df5a7739ab2e %}

[Free access link](https://towardsdatascience.com/how-to-package-your-python-code-df5a7739ab2e?sk=04d9f67c0654445bbcbbf6825f535900)

The most powerful feature of Python is its community. Almost every use-case out there has a package built specifically for it.

Need to send mobile/email alerts? pip install knockknock — Build ML apps? pip install streamlit — Bored of your terminal? pip install colorama — It’s too easy!

I know this is obvious, but those libraries didn’t magically appear. For each package, there is a person, or many persons — that actively developed and deployed that package.

Every single one.

All 300K+ of them.

That is why Python is Python, the level of support is phenomenal — mindblowing.

In this article, we will learn how to build our own packages. And add them to the Python Package Index (PyPI). Afterward, we will be able to install our packages using pip install! Let’s get started.
Daily Developer Jokes - Saturday, Apr 3, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-04-03 12:00:15

---
title: "Daily Developer Jokes - Saturday, Apr 3, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Saturday%2C%20Apr%203%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12592aa5db7.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
Asynchronous JavaScript is amazing.

I Promise you, await and see.
 -->