teleren/devto huggingface dataset:
The bad side about WordPress
Tags: wordpress, webdev
Published: 2022-04-03 09:00:53

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sqiijqlmj7f2zw2b62i1.jpg)
Is there something weird about the image above? Hint, look at the website's address, and then look at the CMS. I just copied my tech blog onto my computer, and we can do that to any website made from WordPress in the world.

You know the strange part? It's surprisingly easy to do so! I recently wrote an article about cloning dev.to, you can read it [here.](https://dev.to/freebeliever/cloning-devto-in-30-seconds-straight-12ip)

Anyway, back to WordPress. You know why WordPress website's are that easy to clone? It's because of the fact that their source code is basically just lying around. 

This isn't actually as concerning as it sounds, because it's technically illegal to copy someone else's work, it's called copyright.

Anyway, just beware that this is a key security factor, and as  long as you're aware of it, it's perfectly alright to use WordPress.

New Edit: So far, there is 10 comments, and everyone is negative. I understand that you can only get the HTML, CSS and JavaScript. I just found out that I can clone a page of my personal blog. If it isn't something you worry about, then don't worry about it.
Setting up project-level gitconfig
Tags: git, posts, bash, config
Published: 2022-04-03 08:57:09

Last week, I completely shifted my system to Arch Linux and during this process, I lost some config(s), settings, etc.

git config was one of them. I used to have a separate config like username, email, ssh key to use based on which project I was working on.
For example, my work projects require a different set of credentials (username, email, ssh-key) than the credentials I use on my personal projects.

I have done this before too but, after a while, I just tend to forget how to do it. This time, I am writing it in a post so that I can refer to it when required.

## Steps

1. Go to the directory where you store the projects and create a `.project.gitconfig` with the desired credentials:

```gitconfig
[user]
    name = work-username
    email = username@work-domain.com
```

2. Edit the user level `.gitconfig` present under `$HOME/.gitconfig` to include the following condition:

```gitconfig
[includeIf "gitdir:ABSOLUTE_PROJECT_DIRECTORY_PATH"]
	path = "ABSOLUTE_PROJECT_DIRECTORY_PATH/.project.gitconfig"
```
Basically, we are telling `git`:

> "If you find a `.git` directory nested under this path then, use these set of credentials."

## Verify

Now, go to a project inside the work/project-root directory and verify that the correct credentials is being used:
```bash
git config --list | grep -P "user|email"
```

## Note (or Gotcha)

Keep in mind that this config will only be used by `git` if it finds `.git` directory at that path or a parent `.git` directory.
For example:
```
work/
|- .work.gitconfig
|- project-a/
   |- .git/
|- project-b/
   |- .git/
``` 
Now, my `.work.gitconfig` will be used when I am inside `project-a` or `project-b` but, not inside `work`.
Queue Implementation Using Linked List in c++
Tags: queue, datastructure, linkedlist
Published: 2022-04-03 08:55:20

Queue Implementation Using Linked List in c++
A Queue is a linear structure that follows a particular order in which the operations are performed. The order is First In First Out (FIFO)

Imagine you are at the front of a bank’s cash counter. There are five people before you. The first five-person will be able to complete their works early because they’ve come before you. This is a proper example of a queue.
Queue Implementation Using Linked List in c++
A Queue is a linear structure that follows a particular order in which the operations are performed. The order is First In First Out (FIFO)

Imagine you are at the front of a bank’s cash counter. There are five people before you. The first five-person will be able to complete their works early because they’ve come before you. This is a proper example of a queue.

[Queue Implementation Using Linked List in c++
](https://www.cstutorial.org/data-structure/queue-implementation-using-linked-list-in-c)
Stack Implementation Using Linked List in c++
Tags: stack, datastructure, linkedlist
Published: 2022-04-03 08:54:15

Stack Implementation Using Linked List in c++
The stack and queue data structures are among the most widely used data structures. When we have no predefined size of the array, besides we need to perform push/ enqueue and pop/ dequeue operation in O(1) time complexity, most probably we need to use stack or queues there.

In this writing, I’m going to discuss the stack and queue and its implementation using a linked list. If you have no previous idea about what a linked list is, you are recommended to read this article before starting this.

What is a stack? 
Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out)

Imagine a case where you have a pile of books and the books are placed one upon another. Now you have to pick the bottommost book from the pile. To do so, you have to pick the topmost book first, then the second book, and so on until the last book. Here, we can say the book at the top was placed at the end. In the scenario, the pile is called a stack.

[Stack Implementation Using Linked List in c++
](https://www.cstutorial.org/data-structure/stack-implementation-using-linked-list-in-c)
Take care of internet traffic experience. Make cancelable requests with react-hooks.
Published: 2022-04-03 08:50:56

Ciao!

I want to raise an issue that is often being ignored.

Today apps generate and consume a huge amount of internet traffic. According to research from [Cisco](https://cyrekdigital.com/uploads/content/files/white-paper-c11-741490.pdf):
- in 1992 daily traffic reached 100GB per day
- In 2007 it increased to 2000 GB per second
- and, today, world traffic has increased to 150,700 GB per second

Amazing, isn't it? 🤖

In most cases, apps consume a lot of excess internet traffic. Modern web applications make a huge bunch of requests per conventional time unit then a lot of clients don't wait until all requests made by web apps are finished. As a result, the browser expects data that will no longer be used.

If you have an experience with React you can easily use the [npm](https://www.npmjs.com/package/react-cancelable) package that saves tons of internet traffic. The core motivation is to not wait for data you don't need.

Less data - less traffic consumed - "more 💰💰💰 saved".

And...

You can start to care about internet traffic experience today just for nothing!

https://vladagurets.github.io/react-cancelable
https://www.npmjs.com/package/react-cancelable
Stop Using Create-React-App!
Tags: react, javascript, cra, vite
Published: 2022-04-03 08:34:21

## STOP USING CREATE-REACT-APP, USE THIS INSTEAD~

Every React Developer starting its react journey starts either with The [React.js Documentation](https://reactjs.org) or with YouTube Tutorials.

The problem with that is both of them teach us to initialize our app with Create-react-app, or CRA for short.

Now, You might think, what's wrong with that?

Well, The actual problem with CRA is that it's too good!
A better way to say it will be, "It's just not for beginners"

CRA provides a bunch of tools not required for basic applications, which surely makes it overwhelming for beginners and makes our app slow in various ways.

Due to the excessive amount of libraries required by CRA, It takes a lot longer bundling time than <u>**VITE**</u>!

[Vite](https://vitejs.dev) makes it a lot easier for developers.

It doesn't require excessive libraries, making the bundling time drop at a significant rate!

It supports HMR, which is extremely useful for developing state based react components.

An insane feature that makes Vite faster than any bundling tool out there is that in a React app, instead of bundling our app and then sending it to the browser, it loads our raw JSX or TSX files!

CRA is not even close when compared to speed tests.

To get started with Vite JS, open a new Terminal Window and make sure you have NodeJS installed.

`npm init vite`

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

Enter your project's name and select the framework of your choice.
You can even choose between JS and TS.

And just like that, your React projects it set up literally under 5 seconds!

Just CD into your folder and install the necessary dependencies using `npm i` or `npm install`

Use `npm run dev` to start your local development server!

Or, to do all that quickly, just run: 

`cd <project-name> && npm i && npm run dev`

JUST VISIT `http://localhost:3000` AND HERE YOU GO!

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

 ---

#### Congrats! Now you can develop your React apps faster than ever!

> Hope you learnt something useful today, See you later!
Today's Daily Humor For Devs - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2022-04-03 08:00:20

---
title: "Today's Daily Humor For Devs - Daily Developer Jokes"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259427b3da.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_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:
___Q:___ Why do all HTML emails get blocked?

___A:___ Because they are all `<span />`.
 -->
Request Validation with Custom Message
Tags: ruby, rails
Published: 2022-04-03 07:55:19

Request Validation with Custom Message
Now we will discuss model-label validation in rails. Model label validation is very convenient and most helpful and that see very clean and also will discuss with validation message create with custom.

Usage

The scope option to check the Rails uniqueness validation rule for additional columns and generate errors when data is invalid.

Firstly, we define our rule in the desired model in rails for request validation and generate a custom message for specific errors.
[Request Validation with Custom Message
](https://www.cstutorial.org/ruby-on-rails/rails-request-validation-with-custom-validation-message)
Uniqueness Validation with Example
Tags: ruby, rails
Published: 2022-04-03 07:54:38

Uniqueness Validation with Example
Now we will discuss rails uniqueness validation. Unique validation is most important for our specific work as we want to create or save student information so we need to identify every student. Student roll is one of the primary identities of every student so we want to save student information we will have to know that does roll already exists.
rails provide a unique validation helper.

We will define our unique rule in our student_info model.
[Uniqueness Validation with Example
](https://www.cstutorial.org/ruby-on-rails/uniqueness-validation-with-example)
What is validation and why does need it?
Tags: rails, ruby
Published: 2022-04-03 07:53:52

What is validation and why does need it?
Validations are mainly used to ensure that only valid data is stored in our database. For example, it may be important for our application to confirm that every user provides a valid email address and mailing address. Model-level validations are the best way to ensure that only valid data is saved or stored in our database. That is database agnostic, cannot be bypassed by end-users, and are convenient or handy to test and maintain. Rails provide built-in helpers for common needs and allow us to create our own validation methods as well.

There are various other ways to validate data before it is saved or stored in our database, including native database constraints, client-side validations, and controller-level validations. Here's a summary of the pros and cons:

Database constraints and their stored procedures make the validation technique database-dependent and can make testing and maintenance more difficult or hard. However, if our database is used by other applications, it may be a good idea to use some constraints at the database level. Additionally, database-level validations can safely handle so

[What is validation and why does need it?
](https://www.cstutorial.org/ruby-on-rails/what-is-validation-and-why-does-need-it)
Inheritance In Ruby
Tags: ruby
Published: 2022-04-03 07:52:59

Inheritance In Ruby
Inheritance is used to inherit another class' members, including fields and methods. A sub class extends a super class' members or other properties.

Inheritance In Ruby
Inheritance is used to inherit another class' members, including fields and methods. A sub class extends a super class' members or other properties.

[Inheritance In Ruby
](cstutorial.org/ruby/inheritance-in-ruby)
How to Class Declaration in Ruby
Tags: ruby
Published: 2022-04-03 07:51:56

How to Class Declaration in Ruby
A class is a blueprint from which objects are created. The object is also called an instance of a class. Programmers can easily create a new class by class keyword. 

How to Class Declaration in Ruby
A class is a blueprint from which objects are created. The object is also called an instance of a class. Programmers can easily create a new class by class keyword. 
[How to Class Declaration in Ruby
](https://www.cstutorial.org/ruby/class-declaration)
Ruby | Array group by function
Tags: ruby
Published: 2022-04-03 07:51:15

Ruby | Array group by function
The group_by() function is an enumerable and inbuilt method in Ruby. Groups the collection by the result of the blocks or array. group_by function returns a hash value where the keys are the evaluated or appraised result from the blocks and the values are arrays of elements in the collection that correspond to the key. If no block is found, then an enumerator is returned.

Syntax: array.group_by { |obj| block }

[Ruby | Array group by function
](https://www.cstutorial.org/ruby/ruby-array-group-by)
Array Iterators
Tags: ruby
Published: 2022-04-03 07:50:34

Array Iterators
Array has an each method, which defines what elements should be iterated over and how. In case of Array’s each, all elements in the Array instance are yielded to the supplied block in sequence.

Note that this operation leaves the array unchanged.

Array Iterators
Array has an each method, which defines what elements should be iterated over and how. In case of Array’s each, all elements in the Array instance are yielded to the supplied block in sequence.

Note that this operation leaves the array unchanged.
[Array Iterators
](https://www.cstutorial.org/ruby/array-iterators)
Ruby | Array Example with Array method
Tags: ruby
Published: 2022-04-03 07:49:51

Ruby | Array Example with Array method
Elements in an array can be retrieved using the Array method. It can take a single integer argument (a numeric index), a pair of arguments (start and length), or a range. Negative indices start counting from the end, with -1 being the last element.

Ruby | Array Example with Array method
Elements in an array can be retrieved using the Array method. It can take a single integer argument (a numeric index), a pair of arguments (start and length), or a range. Negative indices start counting from the end, with -1 being the last element.
[Ruby | Array Example with Array method
](https://www.cstutorial.org/ruby/accessing-elements)
Ruby | Array
Tags: ruby
Published: 2022-04-03 07:48:57

Ruby | Array
Array Indexes

Array indexing starts at 0, as in PHP or C or C++ or Java programming language. A positive index is define the first element of the array and a negative index define the last element of the Array: 

Index 0 indicates the first element of the Array list.
Index 1 indicates the second element of the Array list.
A negative index is an offset, backwards, from the end of the array: as like 

 Index -1 indicates the last element of the Array list.
 Index -2 indicates the next-to-last element of the Array list.

[Ruby | Array](https://www.cstutorial.org/ruby/ruby-array)
Binary Search Algorithm with Time Complexity
Tags: searching
Published: 2022-04-03 07:47:55

Binary Search Algorithm with Time Complexity
What is binary search? Binary search is among the most fundamental algorithms in computer science. By using this algorithm, we can find an element from a sorted array in O(log n) time where linear search takes O(n) time.

Binary search vs Linear search
In linear search, we have to find each element from an array by checking each and every element of this array. This means we have to continue until we found the element we are searching for or we reached the dead-end of the array.

On the other hand, in binary search we use a sorted array where we always check the middle element of a range l to r, based on the element we just checked, we will decide if we will go left or right of the middle element. We won’t check the whole array.

[Binary Search Algorithm with Time Complexity
](https://www.cstutorial.org/algorithom/searching-algorithm-binary-search-algorithm-with-time-complexity)
Linear Search Algorithm with Example
Tags: searchin
Published: 2022-04-03 07:47:11

Linear Search Algorithm with Example
Searching plays an important role in our everyday life. You may need to find a word from a dictionary or find your friend from the crowd. But in programming, searching is finding an element from a data structure. Finding something from a collection of data is called searching. 

What is the linear search?
The most basic searching algorithm we have is linear search. This algorithm performs search operation in O(n) time, hence the name linear, pretty worse through. But why do we need to learn this algorithm? 


Why do we need to learn it?
We have to learn this algorithm to learn about searching in detail. It is a great algorithm to learn searching concepts. Letter on when we learn about more efficient searching algorithm like binary search, from there we can easily feel the difference of binary search from it. So let’s dive in.

[Linear Search Algorithm with Example
](https://www.cstutorial.org/algorithom/searching-algorithm-linear-search-algorithm-example)
Merge Sort Algorithm Tutorial with Time Complexity in c++
Tags: sortingalogorithm
Published: 2022-04-03 07:46:12

Merge Sort Algorithm Tutorial with Time Complexity in c++
Merge sort is a very essential algorithm in computer science. unlike the other algorithms we have learned earlier, this algorithm has a higher space complexity and lower worst-case time complexity. This algorithm works based on the divide and conquers concept we divide the array into two parts, sort them separately and merge them. 

The merge sort algorithm
The merge sort algorithm uses recursion to divide and sort the array separately and then merge them. So, I’ll consider that you already have the basics on the recursion techniques. 

What is divide and conquer
Divide and conquer is a concept where we divide a task into two similar tasks and use their solution to solve the problem. In this approach, we can easily solve a problem because when a task is divided into two smaller parts, it will be easy to handle.

[Merge Sort Algorithm Tutorial with Time Complexity in c++
](https://www.cstutorial.org/algorithom/merge-sort-algorithm-implement-with-time-complexity)
Selection Sort Algorithm Implementation Tutorial in c++
Tags: sort
Published: 2022-04-03 07:45:20

Selection Sort Algorithm Implementation Tutorial in c++
Selection sort is a sorting algorithm where we have to manage two subarrays, one subarray is sorted and the other is unsorted. We select the minimum from the unsorted subarray and place it at the end of the sorted subarray.

The selection sort algorithm tutorial
Like bubble sort, we need to use two loops for the selection sort. Say we need to sort an array in ascending order and let i be the variable that divides the array into two subarrays. 0 to the i-1 range is the subarray that is sorted and from i to n-1 is the subarray range that is unsorted. What we have to do is, we need to select the value of i as from 0 to i-1, the subarray is sorted. So we need to find the index of the minimum element for range i to n-1 and swap it with the element at i. 

Here I am showing you the ascending sorting process. Descending sorting is similar, we only have to find the maximum index from i to the n-1 range and swap it with i

[Selection Sort Algorithm Implementation Tutorial in c++
](https://www.cstutorial.org/algorithom/selection-sort-algorithm-implement-with-c)
MongoDB Connection using Mongoose
Tags: javascript, mongodb, webdev
Published: 2022-04-03 07:44:07

An important step in the process of Development is connecting with the database. This has been made easy with `mongoose`, which is an *npm dependency*. 

After you have initialized your express app, install mongoose using the following npm command : 
```
npm install mongoose
```

Mongoose can be used in 3 simple steps : 
## Setting up a port
Since `mongoDB` runs on a server, we need to run a mongoDB server locally. If you have mongoDB installed locally, just head to your preferred terminal and run : 
```
mongod
```
Your mongoDB server is up and running on **port: 27017**

## Importing Mongoose
You can import and use mongoose in 2 places : 
### In the `server.js` file
You can import and use mongoose in the main server file itself : 
```javascript
const mongoose = require("mongoose");
```

### In a Separate Database Folder
You can also implement the modular approach where you can create a separate `db` folder and setup connection inside it in a `connections.js` file.

## Connecting To Server
The final step is to initialize and setup the mongoDB connection. 
The process is to initialize the mongoose connection and listen for the result returned.

```javascript
const mongoose = require("mongoose");

mongoose
  .connect(process.env.DB_URL, {
    useNewUrlParser: true,
    useFindAndModify: false,
    useUnifiedTopology: true
  })
  .then((result) => {
    console.log("Database connected at port : "+process.env.DB_URL);
  })
  .catch((err) => {
    console.log(err);
  });
```

Now the question is what are these terms : 
```javascript
    useNewUrlParser: true,
    useFindAndModify: false,
    useUnifiedTopology: true
```
These are optional arguments being passed to the connection method.
### 1. `useNewUrlParser`
The underlying MongoDB driver has deprecated their current connection string parser. Because this is a major change, they added the useNewUrlParser flag to allow users to fall back to the old parser if they find a bug in the new parser. You should set
```javascript
useNewUrlParser: true
``` 
unless that prevents you from connecting.

### 2. `useFindAndModify`
`true` by default. Set to false to make findOneAndUpdate() and findOneAndRemove() use native findOneAndUpdate() rather than findAndModify().

> `findOneAndUpdate` allows for just updates - no deletes or replaces etc.

> `findAndModify` can do a lot more including replace, delete and so on.

### 3. `useUnifiedTopology`
`false` by default. Set to true to use the MongoDB driver's new connection management engine. This option should always be set to true, except for the unlikely case that it prevents you from maintaining a stable connection.

There we go! We have successfully setup a mongoDB connection.
Happy Hacking!!