teleren/devto huggingface dataset:
Effortlessly Install or Switch Node Versions with NVM on Linux
Tags: linux, node
Published: 2023-01-20 08:13:59

Installing Node on a new Linux machine can be a frustrating experience, especially when you need a specific version or need to switch between different versions for different projects. The process of switching between versions can be a hassle and a nightmare. But there's good news! NVM (Node Version Manager) is a lifesaver for this problem. NVM makes it easy to install and switch between different versions of Node.js with just a few simple commands. Say goodbye to frustration and hello to easy Node version management with NVM on Linux.

#Run Any one of these command
```
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

# or

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
```
These commands will clone the nvm repository to a ~/.nvm directory on your device, and attempts to add the source lines from the snippet below to the correct profile file `~/.bash_profile` or `~/.zshrc` `~/.profile` or `~/.bashrc`

If it's failed to register then you need to manually input this snippet at the end the `/.bashrc` or `/.zshrc` if you use zsh

```
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
```

Now restart the terminal or run `source ~/.bashrc`

To verify if nvm is succesfully installed or not run `nvm -v`

In conclusion, NVM (Node Version Manager) makes managing Node.js versions on your Windows, Linux, or Mac device a breeze. With NVM, you can easily install, uninstall, and switch between different Node versions. To install the latest version of Node, simply run 
```
nvm install latest
```

To install a specific version such as X.Y.Z, use the command
```
nvm install 16.18.1 
```

You can also set a specific version as the default by running
```
nvm alias default vX.Y.Z
```

When you need to use a specific version on a project, simply run
```
nvm use vA.B.C
```

NVM is a valuable tool for managing multiple Node.js versions across different projects that require different versions.

Learn More about commands here https://github.com/nvm-sh/nvm#usage
HTML tags
Published: 2023-01-20 08:11:10

<bgsound>     <big>   <blink>   <blockquote>   <body>  <br>  <button>  <canvas>  <caption>  <center>  <citer>  <code>  <col>  <colgroup>  <content>  <data>  <datalist>  <dd>  <del>  <details>  <dfn>  <dialog>  <dir>  <dl>  <dt>  <em>  <embed>  <fieldset>  <figcaption>  fiqure>  <font>  <footer>  <form>  <frame>  <frameset>  <h1>  <head> <header> <hgroup>  <hr>  <html>  <i>  <iframe>  <image>  <img>  <input>  <ins>  <kbd>  <keygen>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5gt8ebs3uukehdgx0cbt.png)
Early bird for the CRUDor mvc system enterprise
Tags: mvc, webdev, opensource
Published: 2023-01-20 08:09:59

I would like to invite contributors to participate and help the building of this very simple, yet beautyfull system that I currently construct.

// at the bottom of this post I will put some tasks list of where you can help and fill in some codes.

it is written in php and mysql and it is based on simple MVC methodology.

but here, the main focus and most affords are put in to simplify and straight foreword all CRUD functionality.

talking about form creation on the fly, straight attached to a mysql table.

talking about field validation server side before saving, files uploads and saving all at once, and all you have to do is to write very few lines of code. where all the validation, files upload etc.. are taken care of in the background.

this project also gives a very vast permissions handling, called handle_access. it is mapping access for controllers a and each function in it, based on users log-in or logout, user types and rolls given for each function.

I know it sounds complicated to write such access_handling, but thanks to a cascading defaults fallback mechanism it is really simple to do.

you, actually don't have to worry about this at all!! unless you want to add special access to specific functionality. it is done with very few lines of code, inside the controller, inside the handle_access() function.

well.. this was a short description of what this system can do and there is much more to it...

so what do I need from you contributors?

one thing I need help with is commenting functions and describing what they do. this is one thing I keep failing to do. basically I do worry about naming the functions in a way that the name tells the whole story of what the function can do. so it is easy to understand but I really could help some commenting as well.

another thing I like to plan some multy language translation mechanism

I will put more task in the comments bellow in the future

So it is an open source, ofcourse! and i store it in github, an a public repository,so you can easilly clone and start commiting changes.

[Click here for the project's the Github repository](https://github.com/kobkob2018/my_new_mvc)

this is it!!!

wish us all lots of good luck and good practice.

deep thanks

kobkob
Today's Fun Joke For Developers - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes, watercooler
Published: 2023-01-20 08:00:12

---
title: "Today's Fun Joke For Developers - 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, #watercooler
---

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/5e1258e86d537.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:___ How does a developer make a cheer?

___A:___ ["hip","hip"] // (hip hip array!)
 -->
Domain Name System
Published: 2023-01-20 07:56:04

DNS stands for Domain Name System. It is a hierarchical and decentralized naming system for computers, services, or any resource connected to the Internet or a private network. It translates human-friendly domain names, such as www.example.com, into IP addresses, such as 192.0.2.1, that are used by computers to identify and locate resources on the Internet.

DNS works by resolving domain names to IP addresses through a series of queries. When a user types a domain name into their web browser, their computer sends a query to a DNS resolver, which is typically provided by their Internet service provider (ISP). The resolver then sends a query to a DNS server, which is responsible for the top-level domain (TLD) of the domain name, such as .com or .org. If the DNS server is not able to resolve the domain name, it sends a query to the next level of DNS servers, until the correct IP address is found.

To reserve a name for your website, you need to register a domain name. This can be done through a domain name registrar, which is an organization that manages the reservation of domain names. When you register a domain name, you are essentially renting the use of that domain name for a specified period of time, usually one year. Once you have registered a domain name, you can then point it to your website's IP address by configuring DNS settings for your domain.

There are also different types of domain names available, such as country code TLDs (ccTLDs) and generic TLDs (gTLDs) .ccTLDs are two-letter top-level domains and are specific to a country or territory. gTLDs are more general and include popular extensions such as .com, .net, and .org.

You can choose a registrar to register your domain name and also can check the availability of the domain. Once you have chosen the registrar and the domain name is available, you can buy it and point it to the IP address of your website and configure it according to your needs.
Bloom filters
Tags: datastructure, programming
Published: 2023-01-20 07:52:44

A Bloom filter is a probabilistic data structure used to test whether an element is a member of a set. The Bloom filter was invented by Burton Howard Bloom in 1970. It is a space-efficient data structure that is used to test whether an element is a member of a set or not. It is used in many applications where it is necessary to quickly determine whether an element is in a set or not, without having to store all of the elements of the set.

A Bloom filter is implemented as a bit array of m bits, all initially set to 0. It also has k hash functions, each of which maps or hashes an element to one of the m bits in the array. To add an element to the set, the element is passed through each of the k hash functions, and the resulting bits in the array are set to 1. To check if an element is in the set, the element is passed through each of the k hash functions, and if any of the resulting bits in the array are 0, the element is definitely not in the set. If all of the resulting bits are 1, the element may be in the set, but it could also be a false positive due to the probabilistic nature of the Bloom filter.

Bloom filters are used in many applications, such as in spell-checking, network routers, and databases, where it is necessary to quickly determine whether an element is in a set without having to store all of the elements in the set. They are also used in bioinformatics to quickly identify whether a DNA sequence has been previously observed.

Here's an example of a simple implementation of a Bloom filter in Python:

```
import mmh3

class BloomFilter:
    def __init__(self, size, hash_count):
        self.size = size
        self.hash_count = hash_count
        self.bit_array = [0] * size

    def add(self, item):
        for seed in range(self.hash_count):
            result = mmh3.hash(item, seed) % self.size
            self.bit_array[result] = 1

    def check(self, item):
        for seed in range(self.hash_count):
            result = mmh3.hash(item, seed) % self.size
            if self.bit_array[result] == 0:
                return "Nope"
        return "Maybe"
        
bf = BloomFilter(32, 5)
bf.add("hello")
bf.add("world")
print(bf.check("hello")) # prints "Maybe"
print(bf.check("hi")) # prints "Nope"

```


In this example, the `BloomFilter` class has a constructor that takes in two arguments: the size of the bit array and the number of hash functions to be used. The `add` method takes an item and adds it to the filter by passing it through each of the hash functions and setting the bits.
Python Memory leaks
Tags: python
Published: 2023-01-20 07:48:35

A memory leak in Python occurs when the program dynamically allocates memory for an object and then fails to deallocate it, even though it is no longer needed. This can cause the program to consume an increasing amount of memory over time, eventually causing the program to slow down or crash.

There are several ways that memory leaks can occur in Python. One common cause is when a program creates a reference cycle. A reference cycle occurs when two or more objects reference each other, causing them to be kept in memory even though they are no longer needed.

Here's an example of a simple Python program that demonstrates a memory leak caused by a reference cycle:

```
import gc

class Foo:
    def __init__(self):
        self.bar = None

foo1 = Foo()
foo2 = Foo()
foo1.bar = foo2
foo2.bar = foo1

gc.collect()
print(gc.garbage)  # will print [<__main__.Foo object at 0x...>]

```

In abve example, the two Foo objects, foo1 and foo2, reference each other, creating a reference cycle that the garbage collector is unable to break. This means that the objects will not be deallocated, and the program will continue to consume more and more memory.

Another way of leaking memory in python is by using global variables and not cleaning them properly or not re-initializing them. Also in some cases, using too many list comprehensions, or using recursion instead of iteration can lead to memory leaks.

To avoid memory leaks, it's important to keep track of the references to objects and make sure that they are properly deallocated when they are no longer needed. This can be achieved by using the `del` keyword, or by using the `gc.collect()` function to manually invoke the garbage collector. Also, it's important to use Python's garbage collector, which automatically frees memory that is no longer in use.
Projects for Diploma Students
Tags: javascript, programming, beginners, react
Published: 2023-01-20 07:28:51

Diploma students have the opportunity to take on projects that showcase their skills and knowledge in their field of study. These projects can range from small assignments to more significant undertakings, and they can be a great way for students to apply what they have learned in their coursework to real-world situations. In this essay, I will discuss some potential project ideas for [diploma students](https://www.youtube.com/watch?v=b5sCgWFGy8Q) in different fields of study, including engineering, computer science, business, and design.

Engineering students can take on a wide range of projects, from designing and building small-scale renewable energy systems to developing control systems for robotic devices. One potential project idea for engineering students is to design and build a small-scale solar or wind power system. 
     
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9bkava8mp8g4ttcxy9a.png)

This project would allow students to learn about renewable energy technologies, as well as the practical aspects of designing and building such a system. Additionally, students could use their knowledge of control systems to create a system that could automatically adjust the output of the solar or wind power system based on the weather conditions or the electrical load.

Computer science students also have many project options available to them. One potential project idea is to develop a mobile application for a specific purpose or audience. For example, students could create an app that helps users plan and organize their daily tasks, or an app that provides information and resources for a specific community or group. Additionally, students could build a website or web application using modern technologies such as JavaScript, React, or Angular. This would provide students with the opportunity to learn about web development and create a functional and visually appealing website.

Few of the [projects for diploma students](https://takeoffprojects.com/projects-for-diploma-students) are:
- Smart Event Invitation
- On Road Vehicle Assistance Finder
- Agriculture Updates Android Project
- Anti-Ragging App
- Android File Storage

In conclusion, diploma students have a wide range of project options available to them, depending on their field of study. These projects can provide students with hands-on experience in their field and allow them to apply what they have learned in their coursework to real-world situations. Additionally, students will have the opportunity to develop their skills and demonstrate their knowledge to potential employers or graduate schools.
Scaffold Tutorial
Published: 2023-01-20 07:16:57

When considering Draft Resource vs. Scaffold, think about which RCAVs we need for our app. (Create, edit, update, destroy actions). 

1. Command to generate: "rails generate scaffold task text:string status:string owner:references"

1. (cont.) Using 'owner:references' instead of 'owner_id:string' initializes the 'owner' column as a foreign key column in the database. 

2. In the model migration file, update any default values. 

3. Typically, we might also want to add 'index: true' to the :owner column in the migration file. However, this should be set to true by default in current versions of Rails.

4. Since we used :owner instead of :user, we need to add to the foreign key: 'foreign_key: { to_table: :users }'

4. (cont.) If we do not do this step, the migration will fail. 

5. In the 'tasks' model, we also need to update the belongs_to relation: 'belongs_to :owner, class_name: "User"'. 

5. (cont.) In the users model, we add the following association: 'has_many :own_tasks, class_name: "Task", foreign_key: "owner_id"'.

5. (cont.) belongs_to should always have a matching has_many association.

6. Repeat for any other models in the app.
if statement
Published: 2023-01-20 07:16:36

> Agar rost bo'lsa  () ifoda  qavussi ichidegi to'gri bo'lsa ifodani yechadi va javobini chiqarib beradi.
Agar ifoda yolg'on bo'lsa uni ishlamaydi.
 

```cpp
   if (misol){
}
else if (misol){
  
    
  }

```

```cpp
  int age1, age2;
  cin >> age1 >> age2;
  if (age1 > age2){
    cout << "birinchi kiritilgani katta: bu son : " << age1;
  }

  return 0;
}
```

> eslse if - Agar shartlarimiz ko'payip ketsa biz `else if` ni ishlatamiz.

> Agar shartimiz bitta bo'lasa biz `if` va `else` ni ishalatamiz.
`else` da nma yozilgan bo'lsa ham `if` noto'gri bo'lsa elseni chiqarib beradi.




@dawrounn
Palindromes in C++
Tags: palindrome, cpp, functions, ifelse
Published: 2023-01-20 07:10:34

## What is Palindrome?

A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward, such as "madam" or "racecar". It is often used in literature and word play.


![You are Palindrome](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60x035ktt6xdd204srn8.png)

Palindromic numbers are numbers that remain the same when their digits are reversed, such as 121 or 73837.

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

Palindromic dates, such as 02/02/2020 or 11/11/1111, are also a popular example of palindromes.

Palindrome can be applied on sentences, numbers, phrases or even in programming languages.


![Palindrome List](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03pyh5ve34etto3qfo83.png)

---

## Define a function in C++ that checks whether the input string is palindrome or not?

```c++
#include <iostream>
using namespace std;

bool isPalindrome(string text){
  int start = 0, end = text.length() - 1;
  while(start < end)
    if(text[start++] != text[end--])
        return false;
  return true;
}

int main() {
    std::cout << isPalindrome("madam");
    return 0;
}
```

We are comparing each ith character to ith last character. If they are equal then we proceed forward else we return false.
Conditional Operator
Published: 2023-01-20 07:02:52

> Conditonal Operatoori - Shartli OPerator
Conditonal Operatorida 3 ta opertator ishlatilinadi 
uchlik operatori ham deb nomlanadi.
Conditanal operatorida biz yozgan ko'd to'g'ri bo'lasa javobini chiqarib beradi. Agar noto'gi bo'lsa u ishlamaydi,javobini chiqarib bermaydi'

```cpp
int main (){
  int a ,b ;
  cin >> a >> b;
  a < b ? cout  << a : cout << b;
     
 return 0;
}
```

@dawrounn
Devise Tutorial
Published: 2023-01-20 06:58:26

1. Add Devise gem in Gemfile and configure the app according to the instructions in the terminal.

1. (cont.) Add 'config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }' to the 'development.rb' file.

2. Create the users model using: 'rails generate devise user username'. This is a simple model that only tracks a user's username and nothing else. More variables and their data types can be added if necessary.

3. Update default values in the users migration file. Make sure default values are appropriate.

4. Add indexes where appropriate in the migration file. Example: "add_index" :users, :username,        unique: true". 

4. (cont.) The index above provides a database level constraint on uniqueness. 

5. Add case-insensitive column for username. Add 'enable_extension("citext")' to the top of change method in the migration file. 

5. (cont.) Change **username and email** columns in migration file to 't.citext' instead of 't.string'. This adds database level protection for case insensitivity.

6. Once all default values, indexes, and case-insensitivities are updated, migrate the model with 'rails db:migrate'

MISC - if we at any point drop the database, we need to use 'rails db:create' to re-add the database since we are using Postgre.
How to read a histogram?
Tags: chart, graphs, histogram
Published: 2023-01-20 06:55:24

A histogram is a graphical representation of the distribution of a dataset. It is an estimate of the probability distribution of a continuous variable. To read a histogram in detail, you should pay attention to the following elements:

1. The x-axis represents the variable of interest, while the y-axis represents the frequency of that variable.
2. The bars of the histogram show the frequency of observations within each class or bin. The height of each bar corresponds to the number of observations that fall within the corresponding class.
3. The shape of the histogram can reveal information about the distribution of the data. For example, a symmetric histogram with a bell-shaped curve indicates a normal distribution, while a histogram with a long tail to the right or left indicates a skewed distribution.
4. The number of classes or bins can also be important. A histogram with too few classes can make the data appear more variable than it really is, while a histogram with too many classes can make the data appear less variable than it really is.
5. The histogram can also be used to identify patterns or outliers in the data by looking for gaps or clusters in the distribution.

Finally, it is important to keep in mind that histograms are just one way of visualizing data, and other types of plots such as box plots, scatter plots, etc might be better suited depending on the context and the question you want to answer.
You can create histogram easily using [histogram maker.](https://histogrammaker.co/)
MVVM Architecture in Android development
Tags: mvvm, android, kotlin, tutorial
Published: 2023-01-20 06:47:53

MVVM (Model-View-ViewModel) is a design pattern that is commonly used in Android app development. It is a variation of the MVC (Model-View-Controller) pattern and is designed to help developers separate the concerns of the app's user interface from the underlying data and business logic.

The Model represents the data and business logic of the app. It is responsible for handling data operations, such as retrieving and storing information.

The View is the user interface of the app and is responsible for displaying the data to the user. It communicates with the ViewModel to get the data it needs to display.

The ViewModel is an intermediary between the Model and the View. It acts as a link between the two, providing the data that the View needs to display and handling user input. It also implements the app's business logic and communicates with the Model to perform data operations.


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



MVVM is often used with the Android Data Binding Library, which allows developers to bind the ViewModel's data to the View, eliminating the need for explicit data passing between the ViewModel and the View.

Overall, the MVVM pattern makes it easier to write maintainable, testable, and scalable code for Android apps by separating the concerns of the user interface and data handling.