teleren/devto huggingface dataset:
Beginning My Programming Journey
Tags: beginners
Published: 2023-01-23 16:21:07

---
title: Beginning My Programming Journey
published: true
date: 2022-11-27 02:07:49 UTC
tags: #beginner 
canonical_url: https://theamazingatharva.hashnode.dev/beginning-my-programming-journey
---

# **About Me**

I am a high school student who wants to dive into the world of coding and tech in general. Having learnt the basics of java in school and a bit C through Youtube, I am excited to embark on a journey of learning new languages and have fun while doing so . I'm drawn to programming because I love technology, being creative, and solving problems. I enjoy the cerebral challenges that programming offers and the potential for coming up with and realizing fresh ideas.

# **Why I Decided To Learn To Code**

Over the past ten years, programming has been increasingly popular. And a lot of that enthusiasm came from the hope of obtaining a lucrative position. But in reality, coding has a ton of other benefits. And, to be honest, there are lots of things to appreciate about it. You constantly deepen your understanding of the issue and the solution as you develop a program or an app, experimenting with new frameworks, finding novel ways to approach challenging problems, and using new methodologies. This is what excites me the most - the vast canvas of possibilities not limited by anything.

# **First Step In My Journey**

I intend to understand the basics of C++ from beginning to end, getting to know its syntax and all the terminologies and lay the foundations for my journey into the interesting world of programming and tech. I also plan to document my journey and post my progress on this domain for myself and the world (hopefully) to see and have an impact in my learning curve as I grow. Do follow me on Twitter for updates and more - https://twitter.com/atharvas\_twt

Regards,

Atharva Salitri
Inicializando o mongoose no Nitro (a forma fácil, rápida e talvez a única...)
Tags: mongodb, mongoose, node, ptbr
Published: 2022-11-27 01:55:09

Oi! Nem eu esperava gostar tanto de escrever por aqui. No post passado expliquei como criar uma REST API simples utilizando o Nitro e o Prisma combinado ao MongoDB.

Acontece que o Prisma não é o ODM mais famoso do MongoDB no universo JavaScript/Node. A biblioteca mais utilizada (e acredito que vai ser assim por muito tempo) é o [mongoose](https://mongoosejs.com/).


Vamos começar com a estrutura padrão do Nitro.

![browsercode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/53n7dnloy37306mray1i.png)
Se você não sabe como chegamos aqui, dá uma olhadinha no [post anterior](https://dev.to/s1d3a/uma-simples-api-rest-com-nitro-prisma-mongodb-5c5).

## Instalando o mongoose
Dentro do projeto, execute o comando a seguir para instalar o mongoose:

```
npm i mongoose
```

## Instanciando o mongoose
Diferente do Prisma, o mongoose não cria as conexões automaticamente. Precisamos criar uma instancia do mongoose no inicio da nossa aplicação, mas como fazer isso se o Nitro inicia automaticamente e todos os arquivos que criamos são rotas?

Para isso, o Nitro possui um sistema de plugins customizados. [Segundo a documentação](https://nitro.unjs.io/guide/advanced/plugins), cada plugin que escrevemos é executado de forma síncrona na primeira inicialização do servidor, que é o lugar mais adequado para inicializar o mongoose no Nitro.

Vamos criar uma pasta chamada ``plugins`` na raiz do nosso projeto, dentro dela criaremos um arquivo chamado ``mongooseConnect.ts``. O nome pode ser qualquer um de sua escolha.

Dentro do arquivo escreveremos o seguinte conteúdo:

```{js}
//plugins/mongooseConnect.ts

// Importação do mongoose
import mongoose from "mongoose";

// Definição do plugin
export default defineNitroPlugin(async (nitroApp) => {
  try {
    // inicializando a conexão com o mongodb
    await mongoose.connect("SUA URI DE CONEXÃO COM O MONGODB");
    console.log("MongoDB conectado");
  } catch (error) {
    console.error("Conexão com o MongoDB falhou", error);
  }
});

```

Para que o plugin funcione, precisamos registra-lo no arquivo de configuração do Nitro, o ``nitro.config.ts``. Faremos o registro da seguinte forma:

```{js}
//nitro.config.ts

import { defineNitroConfig } from "nitropack";

export default defineNitroConfig({
  // registrando o plugin
  plugins: ["./plugins/mongooseConnect.ts"],
});


```
Com essa configuração, você deve conseguir utilizar 100% do mongoose no seu projeto com Nitro. Até logo 👋👋👋👋👋
Release 0.4 - Week 1
Tags: react, javascript, programming, opensource
Published: 2022-11-27 00:28:43

For this release, I plan to work on a repository called [wedding](https://github.com/sean1093/wedding). The objective itself was to create a test gallery that would fit with the authors objective.

The thing is when the author first created the issue there was not that many details about how he wanted. So I just went off and created a test gallery that I thought he would like.

That was before, he told me what kind of requirements he would like. After finding out his requirements, I had to change up my approach completely, which is honestly a blessing in disguise. 

I have not worked much with react, only during school so that means working on this would allow me to hone my skills in `react`, which I have not done much of compared to others. I haven't even used react for a long while, so I need to relearn how the system works. I have to follow what the author already laid for me and build from there.

This is new because as of now, I am building a part of a web app **without** using `html` files whatsoever.

I'm hoping to be able to relearn how react works and build properly what the author is asking.
Kinoway
Tags: showdev, nextjs, redux, rust
Published: 2022-11-27 00:18:02



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


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


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


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

**_Movies — are an experience_**

[Kinoway](https://github.com/Tell396/kinoway) is a free and open client-based online movie service that uses the Kinopoisk API.

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

This service uses the Kinopoisk API and allows you to watch movies and TV shows for free.
At the moment the service is only available in Russian, but this will soon be fixed ^_^


_Dark mode:_
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5higko7qw9qxui33gbmr.png)

_Light mode:_
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nawfoz5ao4kcw9nhaltk.png)


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


**P.s: Due to the rapid addition of new features and changes, I suggest using the live site: [https://kinoway.vercel.app](https://kinoway.vercel.app)**

I hope you're interested in my project and leave your feedback about it)
EXE file (using Py installer) does not work in different computer
Published: 2022-11-27 00:00:07

Hello,
I use PyCharm as my text editor and created an executable file from python script using "auto-py-to-exe". Everything works in my computer. I am using Mac. However, when I transfer the exe file with folder to another pc or Mac, that computer does not even recognize the exe file as an executable file.
I am totally lost. Can anyone suggest me anything?
OSD600: Adding CI to Siteit
Tags: opensource, beginners, testing, javascript
Published: 2022-11-26 23:08:52

## Overview

For Lab 9, I was tasked with adding [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) to [Siteit](https://github.com/SerpentBytes/siteit) - an SSG tool that parses markdown and text files and renders results in HTML files.

I could have chosen other popular options, such as Travis CI, to integrate continuous integration, but since Siteit is already on GitHub, I decided to integrate CI using only [GitHub Actions](https://docs.github.com/en/actions).

### Initial Workflow

My initial workflow file was pretty simple, as I had one "build" `job` that did more than just _building_. It also ran linter, formatter, and unit tests. Everything seemed to work as expected until I looked at how my [lab partner](https://github.com/Myrfion) had integrated his CI workflow. 

### Making Improvements

My lab partner had sectioned `jobs` based on their purpose. This approach seemed more logical, and I realized I could improve my  CI workflow without running all scripts as part of the _build_ job. Therefore, I decided to refactor my workflow by adding the following jobs:

- linter
- formatter
- tests

The `job` names implies the function of each `job`. 
For instance,  _linter_ runs checks for linting errors using `eslint` and fixes them. On the other hand, _formatter_ runs checks for formatting using `prettier` and corrects them. Finally, _tests_ runs unit tests using the `jest` framework.

To view CI workflow implementation for Siteit, click [here](https://github.com/SerpentBytes/siteit/blob/master/.github/workflows/github-ci.yml).

## Final Thoughts

Implementing Continuous Integration using GitHub Actions was an overall fun experience. I got to familiarize myself with the YAML syntax and gain valuable experience using GitHub Actions.
The Best Country API to use for Your Next Coding Project in 2022
Tags: javascript, webdev, programming
Published: 2022-11-26 22:58:32

Through network systems, computer applications can connect with one another thanks to software-to-software interfaces, or APIs. Let's begin by outlining some fundamental API calls. APIs are essentially forms of communication, protocols, and structures. Due to the frequent differences across software systems, APIs can be a great source of data for information translation and coordination. Access rules may apply to the way a system responds to user information requests. Now that you are aware of what an API is, let's move on to API queries.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3xceqt0deqwzcgf01fl6.jpg)
It is quick and easy to integrate the country api. The time required to build an application from scratch is typically much longer. There are a ton of other advantages to this as well, like the ability to adapt. Everything will eventually need to be updated and changed. If developers want to stay current, they must stay on top of the most recent changes. The API provider oversees managing these modifications when APIs are used.
More Info: https://countryapi.io/
Open Source Analytics Dashboard
Published: 2022-11-26 22:43:32

Good afternoon!  Today, I am happy to anounce [OpenOps](https://github.com/ThePlugJumbo/openops), an open source, self hosted Next.js business dashboard.  OpenOps is a new tool that allows you to bring Google Analytics, PayPal, Stripe, and more into one UI.

I am just starting out on this project, and am looking for contributors.  If you are interested, check out the [GitHub issues](https://github.com/ThePlugJumbo/openops/issues) and feel free to submit a pull request.
top 10 tips for problem-solving
Tags: javascript, programming, webdev, algorithms
Published: 2022-11-26 22:41:36


**<u>solving the problem</u>**

**1- Understand the problem**

- Describe the problem for me on the paper so I can understand it
 
**2- Explore concrete examples**
- Understand the inputs and the outputs expected to out
- How to handle errors
- What happens when the user enters something invalid
 
**3- Break it down**
- break the problem into small parts and steps in the code place - - to solve the problem as steps to follow
 
**4- solve the problem in a simple way**
- Write the solution to the problem as simply as possible

---

**<u>Refactoring the solution</u>**
 
**5- Check the results**
- Make sure the output of your solution required one as output from your code
 
**6- Refactor the code for a better version**
- Go through the solution steps and check if we can write it in a better way
- Search if there is a helper function that can make the code run faster for time complexity
 
**7- Reuse my code**
- think if I can use some parts of my code as solutions for other problem
 
**8- work on time and space complexity**
- Work on making the code run faster than it exists
- Work on making the code not consume much memory space
 
**9- Search on google to find other solutions to learn from them**

**10- Share your solution**
- upload your solution on GitHub and share it with others
- explain it so you will learn as much as you teach

Follow Me On [LinkedIN](https://www.linkedin.com/in/mahmoud-alsayied/)
In-place Merge Sort in Java
Tags: mergesort, java
Published: 2022-11-26 22:32:19

# Plain In-place Merge Sort
Time complexity: {% katex inline %} O(N^2) {% endkatex %}

```java

class PlainInPlaceMergeSort {
	private void swap(int[] nums, int left, int right) {
		int temp = nums[left];
		nums[left] = nums[right];
		nums[right] = temp;
	}
	
	private void inPlaceMerge(int[] nums, int start, int mid, int end) {
		int leftPointer = start;
		int rightPointer = mid + 1;
		while (leftPointer <= mid && rightPointer <= end) {
			if (nums[leftPointer] <= nums[rightPointer]) {
				leftPointer++;
			} else {
				int currentRightElement = nums[rightPointer];
				int currentRightPointer = rightPointer;
				while (currentRightPointer > leftPointer) {
					nums[currentRightPointer] = nums[currentRightPointer - 1];
					currentRightPointer--;
				}
				nums[leftPointer] = currentRightElement;
				leftPointer++;
				rightPointer++;
				mid++;
			}
		}
	}
	
	private int getMid(int start, int end) {
		return start + (end - start) / 2;
	}
	
	private void inPlaceMergeSortHelper(int[] nums, int start, int end) {
		if(end - start < 2) {
			return;
		}
		int mid = getMid(start, end);
		inPlaceMergeSortHelper(nums, start, mid);
		inPlaceMergeSortHelper(nums, mid + 1, end);
		inPlaceMerge(nums, start, mid, end);
	}
	
	public void inPlaceMergeSort(int[] nums) {
		inPlaceMergeSortHelper(nums, 0, nums.length - 1);
	}
}
```

# Shell Sort Mixed In-place Merge Sort

Time Complexity: {% katex inline %} O(N*(logN)^2) {% endkatex %}

```java

class ShellSortMixedInplaceMergeSort {
	private void swap(int[] nums, int left, int right) {
		int temp = nums[left];
		nums[left] = nums[right];
		nums[right] = temp;
	}
	
	private void inPlaceMerge(int[] nums, int start, int end) {
		int length = end - start + 1;
		int comparisonRange = getComparisonRange(length);
		while (comparisonRange >= 1) {
			int pointer = start;
			while (pointer + comparisonRange <= end) {
				if (nums[pointer] > nums[pointer + comparisonRange]) {
					swap(nums, pointer, pointer + comparisonRange);
				}
				pointer++;
			}
			if(comparisonRange == 1) {
				break;
			}
			comparisonRange = getComparisonRange(comparisonRange);
		}
	}
	
	private int getComparisonRange(int previousLength) {
		return (int) Math.ceil((double) previousLength / 2);
	}
	
	private int getMid(int start, int end) {
		return start + (end - start) / 2;
	}
	
	private void inPlaceMergeSortHelper(int[] nums, int start, int end) {
		if (end - start < 1) {
			return;
		}
		int mid = getMid(start, end);
		inPlaceMergeSortHelper(nums, start, mid);
		inPlaceMergeSortHelper(nums, mid + 1, end);
		inPlaceMerge(nums, start, end);
	}
	
	public void inPlaceMergeSort(int[] nums) {
		inPlaceMergeSortHelper(nums, 0, nums.length - 1);
	}
}

```
Making TUI kanban app with BubbleTea | MongoDB Atlas Hackathon 2022 on DEV
Tags: atlashackathon22, go, tutorial, opensource
Published: 2022-11-26 22:16:02

## What I built
- A TUI(A terminal app with UI) Kanban app

I've taken what I saw in this [playlist](https://youtu.be/ZA93qgdLUzM) that was made by [@bashbunni](https://github.com/bashbunni) and took it to the next level.

I've made some adjustments and in order to this app be able to connect to a MongoDB and saved the data of the user.

### Category Submission:

- Think Outside the JS Box

### App Link

[repo](https://github.com/Grubba27/todo-list)

As it is a self-hosted app, you can download it and run it with the commands:

> make sure that you provide a MongoDB URL in the .env file, the same way it is shown in the .env.example

```bash
go get
go run .
```

### Screenshots

The main view:
![Main view](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/va3gm97o8suzocqlfpxi.png)

The loading view:
![loading vi](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtdjljtp6io3eegx7vdi.png)

The edit/add view:

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

 

### Description
This full-CRUD app runs in your terminal with a beautiful UI.
It has three columns, To-do, In Progress, and Done columns. Where you can add tasks to the queue and edit them, changing the description or task location

### Link to Source Code

[repo](https://github.com/Grubba27/todo-list)

### Permissive License
- MIT

## Background

I've decided to build this app because I wanted to learn Go and BubbleTea. Creating new features/recreating an app is an excellent way to get this knowledge.

Also, as a maintainer of an OSS project([MeteorJS](https://github.com/meteor/meteor)) that has MongoDB as its first-class citizen, I wanted to see what other MongoDB drivers look like with other languages that are not JS. And got happy with the results.


### How I built it
(How did you utilize MongoDB Atlas? Did you learn something new along the way? Pick up a new skill?)
I used MongoDB Atlas to save user's data in the database. So that whenever you close your terminal, you will not lose any data. 

I would say that I learned a lot about Go and BubbleTea and how to use them to make glamorous command-line apps.

Also, I think I got better at MongoDB in general. After all, I could turn my language-specific understandings with MongoDB into general ones because I used them in an unfamiliar language.

### Additional Resources/Info

Demo video:

Showing all CRUD operations
> Started deleting old documents from DB
>
>  Created some task
>
>  Edit its column


{% embed https://youtu.be/eBT3Y3xS9So %}
Backup/restore most of your Mac's dev tools easily
Tags: tooling, devops, todayilearned, productivity
Published: 2022-11-26 22:00:23

I was about to make a joke on Twitter the other day, saying how I move to a new Mac is basically about this command:

**brew install yarn nvm cowsay fortune tree direnv gh git-lfs imagemagick jq qpdf webp**

Because most of the tools I often use (besides VS Code) are living in the terminal installed by [brew](https://brew.sh/)

That's when I was discovering that brew actually has a subcommand called [bundle](https://docs.brew.sh/Manpage#bundle-subcommand). 🤯🤯🤯

Basically, it generates a "Brewfile" for you (like your beloved package.json files in node projects), writing out a list of packages (called formulaes here) that you have installed. 

All in all, it's a brilliant way to move all your devtools quickly from one Mac to another. 

##Give it a try!

1️⃣ Generate a Brewfile (acting as your lockfile) with
`brew bundle dump`

This file is totally human-readable, so when you `cat` it, you should see something like:

```
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
brew "cowsay"
brew "direnv"
brew "fortune"
brew "imagemagick"
brew "jq"
brew "neovim"
brew "nvm"
brew "qpdf"
brew "ripgrep"
brew "tree"
brew "yarn"
cask "firefox"
cask "font-hack-nerd-font"
cask "iterm2"
cask "signal"
```

2️⃣ Carry this Brewfile to your other machine, and just type

`brew bundle install`

It will install all the dependencies listed in your Brewfile.

That's it! 💪
When to use useRef() instead of useState()
Tags: react, beginners, programming
Published: 2022-11-26 22:00:00

In React, hooks are a way to use state and other React features without having to generate a class component. One of the most frequently used hook is `useState()`, however on occasion `useRef()` might be a better and more efficient way to manage state. 
A common use case is handling a form input field when the submit button is clicked. For example, lets look at the following code snippet:

```jsx
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');

const handleSubmit = (e) => {
  e.preventDefault();
  console.log(email, password);
};

return (
  <form onSubmit={handleSubmit}>
    <input
      type="email"
      value={email}
      onChange={(e) => setEmail(e.target.value)}
    />
    <input
      type="password"
      value={password}
      onChange={(e) => setPassword(e.target.value)}
    />
    <button type="submit">Submit</button>
  </form>
);
```

In the above example, we have two input fields, one for the email and one for the password. When the submit button is clicked, the values of the two input fields are logged to the console. The `useState()` hook is used to manage the state of the two input fields. Although, this code does what it's supposed to do, it also causes the component to re-render every time the input fields are changed. 

This is due to the usage of the `useState()` hook, which by definition causes the component to re-render every time the state is changed. This is not a problem in this example, but in a more complex application, this can cause performance issues. To avoid this, we can use the `useRef()` hook instead of `useState()`. 

```jsx  
const email = useRef('');
const password = useRef('');

const handleSubmit = (e) => {
  e.preventDefault();
  console.log(email.current, password.current);
};

return (
  <form onSubmit={handleSubmit}>
    <input
      type="email"
      value={email.current}
      onChange={(e) => (email.current = e.target.value)}
    />
    <input
      type="password"
      value={password.current}
      onChange={(e) => (password.current = e.target.value)}
    />
    <button type="submit">Submit</button>
  </form>
);
```  

## When to use `useRef()` instead of `useState()`

A rule of thumb is to use `useState` when you need to re-render the component when the state changes and `useRef` when you don't need to re-render the component when the state changes.
Here are some examples of when to use `useRef` instead of `useState`:

  * When you need to store a value that does not trigger a re-render when it is updated.
  * When you need to store a value that is not used in the render method.
  * When you need to store a value that persists for the lifetime of the component.
'Mastery' of software
Published: 2022-11-26 21:48:48

I think it's not the superhuman ability to retain unlimited information, but the ability to know just enough information that triggers relearning of what you need. Also the best engineers can relearn those things faster than others.

Examples might be knowing which books, RFCs, API refs and guides to re-read to perform well on an upcoming project vs not knowing or knowing poorly.

Another important skill related to re-learning is knowing that time is limited and it's just as important to know what NOT to spend time on as what you do.

So I think these 2 skills - relearning and time management take a long time to develop and are the key to longevity in being a software engineer.