teleren/devto huggingface dataset:
What is Recursion?
Tags: computerscience, programming
Published: 2021-03-14 07:09:50

<h3> What is Recursion</h3>

In Computer Science, <i>recursion</i> is a method in which a function calls itself. We can use recursion to solve many different problems such as:
<ul>
<li><i>Towers of Hanoi</i></li>
<li><i>Tree Traversals</i></li>
<li><i>DFS(Depth First Search) For Graphs</i></li>
</ul>


An analogy that better explains this term is as follows: 

"I'll be back in 10 minutes. But If I am not, just read this message again."

<hr/>

<h3>Recursion vs. Iteration</h3>

<h4>Recursion</h4>
<ul>
<li>Recursive functions call themselves until a condition (base case) is met.</li>
</ul>

<h4>Iteration</h4>
<ul>
<li>iteration uses a looping structure (while, do while, for, foreach) in order to repeat a section of code until a certain condition is met.</li>
</ul>

<hr/>

<h3>Code Examples</h3>


<h3><i>Iteration</i></h3>

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

<p>This code snippet is an example of a basic for loop. Here, we are iterating or looping through all the numbers until we reach 100. </p>
<ul>
<li>If the number is divisible by 3 & 5, we print "FizzBuzz" to the console.</li>
<li>If the number is only divisible by 3, we print "Fizz" to the console. </li>
<li> If the number is only divisible by 5, we print "Buzz" to the console. </li>
<li> Finally, if it is not divisible by any of these numbers, print the number to the console. </li>
</ul>

<h3><i>Recursion</i></h3>

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

<p>This code snippet is an example of using recursion to solve the same problem. </p>
<ul>
<li>Our base case or condition is: If the number is greater than 100, stop the function.
<li>After establishing our base case, now we can start our loop. </li>
<li>If the number is divisible by 3 & 5, we print "FizzBuzz" to the console.</li>
<li>If the number is only divisible by 3, we print "Fizz" to the console. </li>
<li> If the number is only divisible by 5, we print "Buzz" to the console. </li>
<li> At the end, we call our function within itself and keep incrementing by one. 
</ul>
What is Big O Notation?
Tags: computerscience, algorithms, programming
Published: 2021-03-14 07:08:15

<h2>What is Big O Notation?</h2>

In Computer Science, Big O Notation is used to describe the performance of an algorithm. In other words, how well will this algorithm scale as the input grows larger? With Big O Notation, we are always taking into consideration the worst case because that is how we will see how efficient our algorithm is.

I do want to preface this by saying, we are not concerned with how fast your program runs. That is dependent on various different things like: 

1. How old is your computer?
2. How much RAM does it have?
3. How many CPU's does it have?

I think you get the point. 

Here is a great visualization of Big O Notation.


![big-o-chart-tutorial-bazar-aymptotic-notations-1.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1613426743269/r7dhZphVI.png)

<hr/>
<h3>O(1)</h3>
O(1) means the algorithm runs in constant time. No matter how large the input/data size, the run time complexity of this algorithm is in constant time. It never changes. 

![carbon.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1613427468975/So1BU3DSU.png)

The cost of this operation is constant. It does not matter if the data set is 10 or 1,000,000. You are only accessing the first index of the array. 

<hr/>

<h3>O(N)</h3>
O(n) means the algorithms runs in linear time. As the data/input size grows, the run time complexity of this algorithm increases.


![carbon (1).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1613428361514/4w56S5CWk.png)

The cost of this operation grows linearly. This is because we are looping over the array. This array be be 10 or 1,000,000. This means it would also print 10 or 1,000,000 times. 

<hr/>

<h3>O(N^2)</h3>

O(N^2) means our algorithm runs in quadratic time. As our data/input size grows, our algorithm gets slower and slower. 


![carbon (2).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1613429262639/7NIH4LC9s.png)

The cost of this operations grows in quadratic time. This is because we are doing one loop throw an array, and within that loop, we are doing another loop. So, you can imagine that if we had 1,000,000 values in our array, our algorithm would not be very efficient. 

<hr/>

<h3>O(Log N)</h3>
O(Log N) means our algorithm runs in logarithmic time. As our data/input size gets larger, the more efficient our algorithm is. 

Examples include:
<ul>
<li>Binary Search</li>
<li>Certain Divide and Conquer Algorithms</li>
<li>Calculating Fibonacci Numbers </li>
Signal for Help
Tags: carolineleaf, neurocycle, behaviorhacking, neurohacking
Published: 2021-03-14 07:03:13

---
title: Signal for Help
published: true
description: 
tags: carolineleaf, neurocycle, behaviorhacking, neurohacking 
//cover_image: https://direct_url_to_image.jpg
---
Cognitive Control and Self Regulation seem like a similar skill.

I have been studying an addiction to sugar and related food products that contain added sugar.

I have noticed that this leads to procrastination issues and I am keen on figuring my way out of it.

Alas, the process has been slow and I have started to measure my progress in signals that I get about the whole issue, using the Neurocycle system, by #carolineleaf.
Chatter. The latest reactJS coding challenge in react-coding-challenges on GitHub.
Tags: react, challenge, github, javascript
Published: 2021-03-14 06:09:06

Hello! My name's Alex and I built the react-coding-challenges collection on GitHub. Find them [here](https://github.com/alexgurr/react-coding-challenges).

**So what are the coding challenges?** They are a series of small incomplete React apps you can use to test yourself in a variety of ways, or for example, as small code challenges for interview candidates. Get more information and deep dive in this [dev post](https://dev.to/alexgurr/react-coding-challenges-for-interviews-beginners-1hlk).

Today I'm excited to announce the latest challenge, **Chatter**. A chat application to test your knowledge of sockets (socket.io), hooks and callbacks. It talks to my server [Botty](https://github.com/alexgurr/botty). Check it specifically out [here](https://github.com/alexgurr/react-coding-challenges/tree/master/chatter) or head over to the main code challenges repository. All UI/UX was done by me from scratch.

If you need access to the coding solutions, you can get an invite [here](https://www.solutions.alexgurr.com/).

![Alt Text](https://puu.sh/Hp0C2/cb14e843de.png)
#3 Adding MongoDB to react-express-graphql project
Tags: mongodb, graphql, express, javascript
Published: 2021-03-14 06:07:44

#Setting up Mongo Account
Sign up with [Mongo DB Account](https://account.mongodb.com/account/login) and click on Create a New Cluster. You may select any free-tier cluster. Note that if you already have a cluster running for a project, you may need to create a new one as only one cluster is free per project. Once you're done creating a new cluster, initiliazing one may take few minutes, meanwhile you can set up Database access and Network settings.![MongoDB settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oesqvrv0dccegvr1ol9o.png)
Click on Add New Database User. Enter the credentials and click on add user. ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yue4i0qb9gelz5qf0a70.png)
Now click on Network access and add IP Address there.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ey2cyxll8co24x2t1ql8.png)

#Adding Mongoose in express
Now Go back to your express code and import the mongoose npm package using 
```
npm install mongoose
```
Let's import mongoose by adding
```
const mongoose = require("mongoose");
```
Connect to your mongo client by adding the below lines to your express server.
```
const PORT = process.env.PORT || 5000;

mongoose.connect(``,{
    useNewUrlParser:true,
    useUnifiedTopology:true
}).then(()=>{
    app.listen(PORT, () => {
        console.log(`Server is running on ${PORT}`);
      })
}).catch(err=>{
    console.log(err)
})

```
We are going to add the connection string to the empty template string, so quickly navigate to your cluster in mongo and click on connect an application and copy the connection string.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xo5q8y95sovgztu04ao.png)
and paste that string so that the final code looks like this. Don't forget to replace <password> with the actual one.
```
mongoose.connect(`mongodb+srv://Mehak:<password>@cluster0.xgyma.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`,{
    useNewUrlParser:true,
    useUnifiedTopology:true
}).then(()=>{
    app.listen(PORT, () => {
        console.log(`Server is running on ${PORT}`);
      })
}).catch(err=>{
    console.log(err)
})

```
Now run your server and voila! it's done!!..

#Creating a schema
Create a new user.js file and let's create a user schema there. We'll add two basic fields of username and password and export it. The code looks super simple.
```
const mongoose=require('mongoose')

const userSchema= new mongoose.Schema({
    email:{
        type:String,
        required:true
    },
    password:{
        type:String,
        required:true
    }
})

module.exports=mongoose.model("user",userSchema)
```
Structure in C Programming
Tags: c, programming, tutorial, beginners
Published: 2021-03-14 05:15:29

In this tutorial, we are going to discuss what are [structure in c programming](https://usemynotes.com/what-are-structures-in-c-programming/), how to create structure variables, and how to accessing structure members. So, let’s start with this wonderful concept.

## Introduction to Structure in C Programming
C also provides user-defined data types, like predefined data types (int, char, float, etc.). One such user-defined data type structure is. Structures are user-defined data types.

## Defining a Structure
The structure is defined using the struct keyword, after this keyword is defined, a unique name of the structure is assigned. The curly braces ({) are then used to create the variables and terminate the program by placing a semicolon (;) after the ending curly bracket (}).

```
struct struct_Name
{
  structure member 1;
  structure member 2;
  ..................
  structure member N;
};
```
## Creating Structure Variables
These variables can be created with 2 methods.
- With structure definition
- Without structure definition

### With Structure Definition
When we create variables with the Structure Definition type along with the structure definition, the variables are written by separating them with a comma (,) before the semicolon (;) of the end.
Like:-
```
struct shoes
{
  int price;
}t1,t2;
```
### Without Structure Definition
When we create variables without structure definition, then we use struct keyword. After using the struct keyword, the name of the structure is defined. You can define unlimited variables by separating from and then before the comma (,).
Like:-
```
struct shoes t1, t2, t3;
```
## Accessing Structure Members
We access Structure members for two reasons.
- To assign values ​​to members
- To print the values ​​of the members as output
Whenever we have to access a structure member, we do it using the dot operator.
Example -
``` 
#include<stdio.h>
/* Defining shoes structure */
struct shoes
{
  int price;
};
int main()
{
  /* Declaring variables of shoes structure */
  struct shoes t1;
  /* Assigning value to price of shoes */
  t1.price=999;
  printf(“The Price of the shoes is: %d”,t1.price);
return 0;
}
```

**Output**

```
The price of the shoes is: 999
```

Originally posted on - [Structure in C Programming](https://alimammiya.hashnode.dev/structure-in-c-programming)
RoadMap to learn MERN Stack for Beginners
Tags: javascript, node, react, express
Published: 2021-03-14 05:08:20

MERN Stack consists of four technologies. 

M - MongoDB 
E - Express 
R - React 
N - Node 

All these technologies are built on JavaScript. To learn JavaScript these are the best resources. 

https://www.Javascript.info 

Jonas schmedtmann Udemy Course 
https://www.udemy.com/course/the-complete-javascript-course/ 

After you have learnt JS then proceed to learn Node.js 

Node.js is a backend language used for highly scalable applications. Many companies have shifted to Node.js for the scalability and performance provided by Node.js

After learning Node, you should learn Express. Express is a framework built on Node.js. It is very lightweight and easy to learn. Simplifies development with Node.js.  

After Learning Express the next step is to learn MongoDB and Mongoose. MongoDB is a NOSQL database and Mongoose is a library that can be used with MongoDB.  

You can learn Node, Express and MongoDB from these Udemy courses. They are the best till date. 

1) Jonas Schmedtmann Udemy Course 
https://www.udemy.com/course/nodejs-express-mongodb-bootcamp/
 
2) Mosh Hamedani Udemy Course 
https://www.udemy.com/course/nodejs-master-class/ 

So, after learning Node, Express and MongoDB you’re already a Backend Developer. All that's left is to learn is the Front End. 

Now you should proceed to learn React. React is a frontend library that is developed and maintained by Facebook. It is super lightweight and is very powerful in performance for any web app. To learn React there are many resources available for free on the web. Also, after learning React you should learn Redux. Redux is state management tool used with React Apps. My personal favourite resources for learning React and Redux are the following.

CodeVolution YouTube Playlist 
https://www.youtube.com/watch?v=QFaFIcGhPoM&list=PLC3y8-rFHvwgg3vaYJgHGnModB54rxOk3 

Official React Docs 
https://reactjs.org/docs/getting-started.html 

Stephen Grider Udemy Course 
https://www.udemy.com/course/react-redux/ 

 
Learnt All of these technlogies ? Done. You're A MERN Stack Developer. 

Next Step :- Develop some projects to showcase in you portfolio.

Give a like to the post if this helps you out. Also comment down the resources from which you have learned MERN Stack to help others out.

The author of the article is the founder of startup Shashaan Web Solutions. Do check it out. https://www.shashaan.com
[ASP.NET Core] Using Bootstrap with package managers
Tags: aspnetcore, postcss, bootstrap
Published: 2021-03-14 04:58:32

## Intro
This time, I wll try using CSS of Bootstrap in ASP.NET Core projects.
And I want to add Bootstrap packages with package managers(ex. NuGet, NPM, etc.).

## CLI project templates
For example, when I create a new project with the MVC template, Bootstrap packages will be included in the project.

```
dotnet new mvc -n MvcSample
```

But they won't be managed by package managers.
They will be put into "wwwroot/lib/bootstrap/dist" directly.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yru6jbw061g9g5e47z3q.png)

So I must find another way.

## NuGet
I can install Bootstrap with NuGet package manager.

* [Download · Bootstrap](https://getbootstrap.com/docs/4.0/getting-started/download/)

But in my ASP.NET Core project, I couldn't get any Bootstrap package files after installing.
And I couldn't find how to use it.

So I gave up using NuGet to use Bootstrap.

## NPM + PostCSS
I also can install Bootstrap with NPM.

```
npm install --save bootstrap
```

The package files are in "node_modules" directory.
But how can I use them?

By default, ASP.NET Core doesn't publish "node_modules" directory.
And I don't want to do that, too.

So shall I copy the files into "wwwroot" directory manually?
I also don't want to do that.

So I decided to use PostCSS to import the Bootstrap files.

### postcss-import
I can import CSS files by "postcss-import".

#### package.json
```json
{
    "browserslist": [
		"last 2 version"
	],
    "dependencies": {
        "@microsoft/signalr": "^5.0.4",
        "autoprefixer": "^10.2.5",
        "bootstrap": "^4.6.0",
        "postcss": "^8.2.8",
        "postcss-cli": "^8.3.1",
        "postcss-import": "^14.0.0",
        "ts-loader": "^8.0.17",
        "tsc": "^1.20150623.0",
        "typescript": "^4.2.3",
        "webpack": "^5.24.4",
        "webpack-cli": "^4.5.0"
    },
    "scripts": {
        "css": "npx postcss postcss/*.css -c postcss.config.js -d wwwroot/css -w"
    }
}
```
#### postcss.config.js
```js
module.exports = {
    plugins: [
      require("postcss-import")(),
      require("autoprefixer")({
        "grid": true
      }),
    ]
  }
```

Because I don't add any codes, I just import the Bootstrap CSS file.

#### main.page.css
```css
@import "../node_modules/bootstrap/dist/css/bootstrap.min.css"
```

Now I can use Bootstrap CSS files after executing "npm run css" command.

#### Before
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lxtjl7ba0j4tx9pbgy4k.png)

#### After
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4zmg2p1m94erqlb5jlkj.png)
Thoughts on the first post
Published: 2021-03-14 04:39:47

I do like how simple this editor is, but there are a few things I wish it had:

1. Tag selector
  - I like that there is a curated choice of tags to use for most relevant and adopted topics, but like right now, sometimes I don't know what would apply, and even if nothing did, at least I know that it's missing and could potentially do something about it. As it stands I just  ¯\\_(ツ)_/¯

2. Code editor
  - It would be nice to have an actual code editor. I really like the way it looks once posted, but I guess I'll stick to using an IDE or editor for code and then just copy and pasting it into the post.

3. Code copying
  - While I really like how code looks once posted, I really wish they had a way to click a button and copy the code. That kind of functionality should be default whenever blogging about code, since it makes it trivial to be able to get it and try it.

I'll definitely try to keep it up though, I'm remembering how I used to really be into writing for my LiveJournal way back in high school haha, so hopefully I still got it!
RAII and Its Advantages
Tags: cpp, oop, computerscience
Published: 2021-03-14 04:03:33

<h2>What is RAII?</h2>

<p>RAII (Resource Acquisition Is Initialization) is a common pattern in C++ for writing classes that manage resources. </p>

<h3>What does this pattern look like? </h3>

<ol>
    <li> The resource is stored as a private member of the class. </li>
    <li> Then, the class constructor takes ownership of the resource. </li>
    <li> Then, the classes public member function controls access to the resource. </li>
    <li> Finally, the class destructor releases the resource when it is no longer being used. </li>
</ol>

<h3>Advantages of RAII</h3>
<ul>
    <li>Obtaining access to the resource is straight forward and deterministic. Either the instance is successfully created or the resource is not usable. </li>
    <li> The instance will use move constructors and move assignments to correctly transfer ownership of the resource. </li>
    <li>You don't have to worry about the complex implementation of managing that resource through encapsulation. </li>
    <li> It  also provides exception safety in your code. </li>
    <li> It is used to implement many classes in the standard library, such as strings, vectors and fstream. </li>
    </ul>
How to implement a function with array
Published: 2021-03-14 03:55:00



     echo "<pre>";
    function groupByOwners(array $files) :array
    {
        $result=array();
        foreach($files as $key=>$value)
        {
            $result[$value][]=$key;
        }
        return $result; 
    } 
     $files = array
       (
        "Input.txt" => "Randy",
        "Code.py" => "Stan",
        "Output.txt" => "Randy"
       );

  var_dump(groupByOwners($files));
  //output
  array(2) {
  ["Randy"]=>
  array(2) {
    [0]=>
    string(9) "Input.txt"
    [1]=>
    string(10) "Output.txt"
  }
  ["Stan"]=>
  array(1) {
    [0]=>
    string(7) "Code.py"
   }
 }
Second time through school, first time in CS
Tags: swift, beginners, programmatic
Published: 2021-03-14 02:27:46

From some I hear you don't need it, but in my experience when I spoke to experienced, working developers, they have, or are in a computer science major. 

I completed a bachelors degree in IT management, back in 2016, but I did not go anywhere into with it. Still motivated, trying to learn more and keep up with the tech field.

I am lucky enough where I have been able to attend school once again, during this coronavirus quarantine time my goal is to study Computer Science, already have noticed how different school is today than last time I was in University.

Truth is, I was never taught an actual programming language the first time around in school.

Now that I have started an actual CS degree, they started with Java, eventually move into C/C++, and a little assembly. 

My goal that I am setting up today is to apply my learning from my classes into the swift programming language. Since I have been following iOS development for sometime, I started learning Objective-C a couple years ago, which ever will end up getting me a job first I feel like I will stick with.
TypeORM Tutorial: Migrations, queries, and more! | NestJS
Tags: beginners, tutorial, javascript, node
Published: 2021-03-14 03:01:52

---
title: TypeORM Tutorial: Migrations, queries, and more! | NestJS
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijik8lwm9dez2hlm8k16.jpg
published: true
description: In this video I walk you through a tutorial of TypeORM!
tags: beginners, tutorial, javascript, node
---

Quite possibly one of the best ORMs you can use with NodeJS (and even more so with NestJS) is TypeORM! 

[In this video](https://youtu.be/sNosL578ECo) I'll walk you through how to set it up, connect to your database, generate and run migrations for production use, use the Repository API, create custom queries, database relationships, and so much more! 

If you're looking to get started with TypeORM to create some CRUD APIs you're on the right post! :raised_hands:

{% youtube sNosL578ECo %}
Built Fitur! a Trello Clone in ReactJS
Published: 2021-03-14 02:36:30

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38h9yki5r7w45ool9hpl.png)

I spent the last couple of weeks creating this full-stack application to increase my understanding of how the web works and how the frontend and backend is connected. There is a lot of things I would of done differently if I was to start again like:

1. Think about the Minimum viable product(MVP) this will help you to clear your thoughts and not worry about features that are not yet needed. This was a really big issue for me adding code for features I did not yet need. Some of those feature was not worth it to implement causing me to waste a lot of time and causing a messy code base which I had to fix.

2. I don't know if this one will help anyone but try to think about the project on a whole and how each feature is connected and break it down to small pieces this also helped me to write cleaner code. for this project there is still a lot of work to be done.

## Main technologies used in this project
1. react
2. nextjs
3. react-query - state management
4. mongoDB/mongoose - database
5. next-auth - authentication
6. Typescript
7. react-beautiful-dnd - drag and drop
8. framer-motion - animation
9. react-toastify - toast notification


demo: https://fitur.herokuapp.com/
code: https://github.com/shanoysinc/fitur

my-portfolio: https://shanoysinc.vercel.app/

Would love to here your feedback on this project! ❤️
API Spring REST
Published: 2021-03-14 02:24:58

Noiteee ! 🖖

Acabo de lançar um novo projeto em meu portfólio no Github... dá uma olhadinha lá!

🚀 Projeto Web Service em Java com Spring Boot, implantado no Heroku consumindo uma instância do banco de dados PostgreSQL.

Github: https://lnkd.in/dVvmZfZ

#springboot #java #heroku #postgresql