teleren/devto huggingface dataset:
How I Sold My Side Project!🤑
Tags: javascript, webdev, productivity
Published: 2023-05-13 19:58:36

Hi everyone in this blog I will share my story how I sold one of my projects called "beSocial" for 30 USD to a foreign client.

Last year, in November I built a social-media-cum-blogging platform called "beSocial", which featured all the basic functionalities that are found in typical social media site: like share post, like/dislike, comment, follow/unfollow etc. 

The project was made using Nodejs, Expressjs, Mongodb and other NPM libraries. I hosted it on Render.com in free tier. The website was minimalistic and easy to operate. It took me a week to design and develop it from scratch.

After deploying and getting beSocial live, I decided to sell it on **sideprojectors.com**, a platform where you can list your side projects. I listed beSocial for $30.

In May, I got an email from a person in Kenya, he was interested in buying the source-code of beSocial. I created a sales agreement and sent it to him. After three days he sent me $30 through PayPal and I, as per the agreement sent him the complete proper documentation along with the code, wrapped in a zip file, to him.

beSocial live link (it may take a while to load): [beSocial](http://besocial.onrender.com/)

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

<hr>

## Insights


- 
Make useful tools/softwares using whatever programming knowledge you have, and list them on websites like sideprojectors.com.

- 
You should create a proper documentation of your project.

- If you consider your project worth solving people needs, share it on social media like LinkedIn, Twitter etc.

<hr>

## beSocial snapshots


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


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


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


**I am a newcomer in Dev.to community, I will highly appreciate if you will like this post!**
_I have the full source code along with proper documentation, if anyone want, reach me at merudra.official@gmail.com_
How to Create a Tray-Only Tauri App
Tags: rust, ui, programming
Published: 2023-05-13 19:56:38

1. Start with a Tauri app boilerplate. You can use the following command to create one: `npm create tauri-app@latest`

2. Add a tray bar icon to your Tauri app:
   - Open the `tauri.conf.json` file.
   - Locate the `"tauri"` property.
   - Inside it, add a `"systemTray"` object, as shown below:
   
   ```json
   {
     "tauri": {
       "systemTray": {
         "iconPath": "icons/icon.png",
         "iconAsTemplate": true
       }
     }
   }
   ```
   Ensure that you provide the correct path to your tray icon image file.

3. Configure Tauri to not display any window:
   - In the same `tauri.conf.json` file, find the `"build"` property.
   - Inside it, locate the `"windows"` property and set it to an empty array, like this:
   
   ```json
   {
     "build": {
       "windows": []
     }
   }
   ```

By following these steps, you will be able to create a tray-only Tauri app with the specified tray bar icon and without any visible windows. Feel free to adjust the configuration based on your specific requirements.

Remember to run the necessary commands and build the app according to the Tauri documentation after making these changes.
How to use UML Diagrams for better communication
Tags: programming, design, diagram
Published: 2023-05-13 19:39:54

## Why I think you should learn UML Diagrams?

I think it can help a lot when explaining complex concept. It is very easy to get caught up in the weeds when talking to another developer and miss the whole reason for the conversation. Having a diagram keeps me from caring so much about the details and allow more higher level thinking.

Another benefit I think it helps with is understanding a new system. If you force yourself to map out a system into a diagram, it helps you visualize it and learn the system. It is also great for sharing this knowledge or refreshing your mind in the future. The bonus of learning a system by drawing out a diagram is you end up with a diagram in the end that could be use as documentation for your team!

## Diagram types
- structural
- behavioral

### Structural diagram
Structural diagrams helps explain the actual parts inside your system like model classes and their relationships.


### Behavior diagram
Behavior diagrams helps explain some process like clicking a button and the light turns on.


## What are the most useful UML Diagrams for developer in my opinion

- class diagram
- sequence diagram
- use case diagram

### class diagram
Shows a class and their members and its relationship with other classes.

![class diagram image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5iwqxj7eaz65rn2gkw6.png)



### sequence diagram

![sequence diagram image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2ef1t4k6chq7g0pe50z.png)


Diagram is good for mapping out the flow of function calls during an execution between the instances of classes. It is a great compliment on top of class diagram. It shows how the class instances interact with each other. 

## Use case diagram

![Use case diagram image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/prf6jajvykurlgg5898x.png)

It is another behavioral diagram that helps map out how a system operate with different user behaviors.

## Component diagram

This is used when planning the architecture of a project. This help abstract out complex system into components and show their interaction with each other.

## other types
- state diagram
- deployment diagram

## tips
- keep diagrams scope narrow to avoid clutter
- make sure to have a purpose and audience for the diagram
- remember the purpose is to communicate something, so don't overthink it

## software to use
Note: you can just use paper and pen.

My recommendation for software is `draw.io`. It's free easy to install and has great integration with Notion.


## source
[source 1](https://builtin.com/software-engineering-perspectives/uml-diagrams)
Queue Data Structure in Javascript, Python and Ruby
Published: 2023-05-13 19:13:32

Like stacks, queues are abstract data structures. In a queue, the first element is inserted from one end, called REAR (also called the tail), and the removal of existing elements from the other end, is called FRONT (also called the head).

This makes the queue a FIFO (First In First Out) data structure, where the first element inserted is the first element removed.

_Queue applications_
Queues, as the name suggests, are used whenever we need to manage any group of objects on a first-come-first-served basis. Here are a few examples of the same:

- Serving requests on a single shared resource, such as a printer, CPU task scheduling, etc.
- In a real-life scenario, call centre phone systems use queues to queue people who call them, unless the service representative is free.

**Algorithm for ENQUEUE operation**

- Check if the queue is full or not.
- If the queue is full, then pop the first element / give an overflow error and exit the program.
- If you popped the first element, then increment the tail and add the element.
- If the queue is not full, then increment the tail and add the element.

**Algorithm for DEQUEUE operation**

- Check if the queue is empty or not.
- If the queue is empty, then print the underflow error and exit the program.
- If the queue is not empty, then print the element at the head and increment the head.

**Time Complexity:**

Enqueue: O(1)
Dequeue: O(1)
Size: O(1)

The functions associated with queue are:

empty() – Returns whether the stack is empty – Time Complexity: O(1)

size() – Returns the size of the stack – Time Complexity: O(1)

top() / peek() – Returns a reference to the topmost element of the stack – Time Complexity: O(1)

push(a) – Inserts the element ‘a’ at the top of the stack – Time Complexity: O(1)

pop() – Deletes the topmost element of the stack – Time Complexity: O(1)

print - To print the stack
Functional Programming in JavaScript: Unleashing the Fun(side) of Functions!
Published: 2023-05-13 18:59:58

_Are you tired of writing long, convoluted code that resembles a spaghetti monster's lunch? Fear not! It's time to embrace the quirks of **`functional programming`** and unleash the fun(side) of functions in JavaScript!_

**What the Functional Programming Anyway?**

Before diving headfirst into the world of **`functional programming`**, let's quickly break it down. Picture this: Functions are the rockstars, and data is their devoted groupie. **`functional programming`** is all about writing code by chaining together these rockstar functions to achieve some magical results. Say goodbye to procedural nightmares and hello to clean, reusable code!

**Embrace Your Inner "Fun"ctional Programmer:**

Remember those fancy arrays? Well, **`functional programming`** loves them more than pizza (almost). With methods like map(), filter(), and reduce(), you can transform arrays faster than a shape-shifting chameleon. Not only do these methods make your code elegant, but they also unleash your inner poet, allowing you to express complex operations in just a few lines. It's time to become a JavaScript wordsmith!

**Avoid Mutant Bugs with Immutable Data:**

Ah, bugs—the tiny creatures that love to wreak havoc in your code. But fear not,**`functional programming`** has got your back! By embracing immutable data, you render those sneaky bugs powerless. Immutable data ensures that your variables stay intact, preventing any unwanted mutations. It's like having a bodyguard for your precious data—no more unexpected side effects or sleepless nights debugging!

**Say Goodbye to For Loops, Hello to Higher-Order Functions:**

Are you tired of those never-ending for loops? Bid them farewell, my friend, because **higher-order functions** are here to save the day! Functions like forEach(), map(), and reduce() take your loops and give them a touch of elegance. Say hello to concise and readable code. Who knew programming could be this much fun?

### Conclusion:

And there you have it, fellow devs! **`functional programming`** in JavaScript is not only a powerful tool but also a doorway to a whole new world of coding fun. So, next time you're writing code, remember to embrace the magic of functions, unleash the power of immutability, and compose your way to programming stardom. Happy coding, and may the fun(side) of **`functional programming`** be with you!
How to Update VScode in Linux - Debian
Tags: tutorial, vscode, webdev, ubuntdebian
Published: 2023-05-13 18:46:57

As a new user in linux - debian from Windows, i had some couple of issues updating some program specifically VScode.

it's so simple
Open terminal or press ctrl+alt+t to open the Terminal

Then type this command:

```
sudo apt-get install code
```
that's  it. Pretty simple right!!

Happy Coding :) 😊
How to install R and Rstudio in Linux (GNOME)
Tags: tutorial, datascience, computerscience, community
Published: 2023-05-13 18:37:36

SO! you intrested in learning R but your Operating System is Linux moreso Ubuntu. Looks intimidating don't it? Just take a breath.
Let's get into it - I'll show you how to install R and Rstudio in you linux machine....
Just follow this simple steps and you ready to go.

Step 1
Open the terminal and run the following commands:

```
sudo apt update
```
This command is used in Linux to update the package list from the configured repositories.

Step 2

Next step, Use this command in the Terminal:
```
sudo apt -y install r-base gdebi-core
```
In this command we are installing R and gdebi.
Question: What is gdebi
Answer: so, In Ubuntu and other Linux distributions based on Debian, gdebi is a graphical tool for installing Debian packages. It provides a straightforward user interface for organizing and controlling software downloads on your computer. Gdebi makes managing software files on your Ubuntu system easy for users who prefer a graphical user interface over the command line. In this case gdebi will help us install Rstudio

I hope we are still together? Let move on with the Process.

Step 3
As of 23rd March 2023 - follow this link to download Rstudio:
Download the Ubuntu 18+/Debian 10+ with the .deb extension
[rstudio-download](https://posit.co/download/rstudio-desktop/)

Don't get tired, we almost there!!

Step 4
Go to the downloads folder and locate the Rstudio file. Select the file then copy the whole name of the download file and make sure you include also the .deb extension

Step 5
Open a terminal or just use the one that is open, Change directory to download folder then type this command

```
sudo gdebi
```
with the name of the file that you copied then press enter and let the magic happen - should look like this screenshot


Final Step
Go to Application and Type Rstudio - Hope you can now see your install. Now you can add it to your Task tab or your Favourites.


Happy That you got to the last Step. 

Happy Programming 😊.
Big Data Generator or Faker?
Tags: discuss, help, datascience, testing
Published: 2023-05-13 18:35:54

Hi, any recommendations for good (preferably open-source) data generators?

I want to generate a lot of data and inject into an SQL DB, specifically data that looks like sales data, to test the performance of our product end-to-end.
How do you generate data? Know any good tool?
PrettyPrint JSON in OSX cli
Tags: python, json, webdev, tutorial
Published: 2023-05-13 18:29:15

When testing APIs its easy to use `curl` in your terminal but the output is definitely not pretty. We can pipe the command to `python -m json.tool` and have it readable but we want it to be pretty)

We will be using `homebrew` as the package manager to install `pygments` and `python` and use this as the default version with `pyenv`. First we will uninstall any previous version of python installed eg: `pyenv uninstall 3.10.5 && pyenv rehash`

Let’s start brewing)

```sh
brew install @python3.11
cd ~/.pyenv/versions
ln -sfv "$(brew --prefix python@3.11)" 3.11
cd "$(brew --prefix python@3.11)" 
ln -sfv Frameworks/Python.framework/Versions/3.11/include/python3.11 include
cd "$(brew --prefix python@3.11)/bin" 
ln -sfv idle3 idle
ln -sfv pip3 pip 
ln -sfv python3 python
ln -sfv wheel3 wheel
pyenv rehash
pyenv global 3.11
python --version
brew install pygments
```

Now we can pipe our API call to `json.tool` for formatting and `pygments` for JS like colorized output
`curl -X GET ‘https://api.printful.com/store/products/307743308' | python -m json.tool | pygmentize -l javascript`


![Terminal pretty-prints API response
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cb70w8rtiddyuywysg46.png)

&nbsp;
Finally, I can get back to writing my next [Vendure](https://vendure.io) plugin for Printful! Follow me on [twitter @prasmalla](https://twitter.com/prasmalla) for updates on the plugin :v:
Can You participate in my survey it is for my data analysis project.
Published: 2023-05-13 18:07:00

I'm doing a internship in Data Glacier and I have a data analysis project that requires data from google surveys I have created a survey about different jobs in it field. 1.Data Science 2. Data Analysis 3. Front end developer 4. etc. :https://forms.gle/vCdi4biiDFLn625y8
OSDC-Github actions
Tags: osdc, github, git
Published: 2023-05-13 17:49:50

---
title: OSDC-Github actions
published: true
description: 
tags: osdc,github,git
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-05-13 17:22 +0000
---

* [This week](https://github.com/OSDC-Code-Maven/osdc-2023-03-azrieli) we learned about "Continuous Integration for GitHub projects" We covered the basics of GitHub Actions and provided examples of how to use them. The presentation included a demonstration of a simple workflow and implementation, examples of how to trigger jobs, and an overview of environment variables and repositories.
Take a look:
* [GitHub Actions examples](https://code-maven.com/github-actions)
* [slides: Continuous Integration for GitHub projects](https://code-maven.com/slides/github-ci/)
* [Collection of official GitHub Actions](https://github.com/actions)
* [capturecli, simple python project with CI](https://github.com/szabgab/capturecli)

We also discussed the use of a matrix strategy and presented examples of Linux commands with GitHub Actions.

The assignment for the session was to find a project with tests but without continuous integration and set up a GitHub Action to run the tests, then show the results to before sending the pull request to the project owner.

## Contribution to Automated Testing: Adding GitHub Actions Workflow to [cybrid-api-organization-python](https://github.com/Cybrid-app/cybrid-api-organization-python)

I hope to contribute to this [project](https://github.com/Cybrid-app/cybrid-api-organization-python/pull/1). I created a GitHub Actions workflow file named "CI" that runs automated tests on multiple operating systems and Python versions to ensure code quality and consistency. The workflow is triggered by push and pull request events as well as manually through the GitHub web interface.

The matrix strategy allows the workflow to test the code on Ubuntu, macOS, and Windows using Python 3.9, 3.10, and 3.11. The setup-python action installs the necessary version of Python, while the install dependencies step installs the required dependencies from the requirements.txt and test-requirements.txt files.

The final step runs the pytest command to execute the test cases. The workflow provides developers with feedback on the quality of their code and alerts them to any issues or errors that need attention.

This automated testing process helps maintain a high level of code quality and ensures that the code is consistent across different operating systems and Python versions. It saves developers time and effort by catching issues early in the development process, allowing them to focus on developing new features and improving existing ones.

Learning and progressing from week to week, keep following :)
Distracted Development
Tags: webdev, career, learning, motivation
Published: 2023-05-13 17:37:49

So I finally found the courage to post. This post, and perhaps future ones too, will serve as a journal chronicling my journey for my future self. At times, I may try and share or distil things that I find interesting, or difficult, or whatever. Think of it as "rubber ducking in public." It will be a personal living record of my quest to always keep moving forward no matter how hard or confusing the road may get. If my knowledge or opinions, which are my own and subject to change, can assist others starting their journey in development, then all the better.
Stack Data Structure in Javascript, Python and Ruby
Published: 2023-05-13 17:36:58

A stack is a simple data structure that allows adding and removing elements in a particular order. Every time an element is added, it goes on the top of the stack and the only element that can be removed is the element that is at the top of a stack, just like a pile of books.

Stack is an ordered list of similar data types following the LIFO(Last in First out) principle. Here the push() function is used to insert new elements into the Stack and the pop() function is used to remove the topmost element from the stack.

**Algorithm for PUSH operation**

- Check if the stack is full or not.
- If the stack is full, exit the program.
- If the stack is not full, then increment the top and add the element.

**Algorithm for POP operation**

- Check if the stack is empty or not.
- If the stack is empty, print the underflow error and exit the program.
- If the stack is empty, print the element at the top and decrement the top.

**Time complexity**

Push: O(1)
Pop: O(1)
Size: O(1)


The functions associated with stack are:

empty() – Returns whether the stack is empty – Time Complexity: O(1)

size() – Returns the size of the stack – Time Complexity: O(1)

top() / peek() – Returns a reference to the topmost element of the stack – Time Complexity: O(1)

push(a) – Inserts the element ‘a’ at the top of the stack – Time Complexity: O(1)

pop() – Deletes the topmost element of the stack – Time Complexity: O(1)

print - To print the stack

Below we have a Javascript program implementing a stack data structure

```
class Stack {
  constructor(){
        this.stack = [];
    }

  push = (item) => {
    return item ? this.stack.push(item) : "do nothing";
  };
  pop = () => this.stack.pop();
  isEmpty = () => (this.stack.length === 0 ? true : false);
  size = () => this.stack.length
  peek = () => this.stack[-1]
  print = () => 
   console.log("stack:",JSON.stringify(this.stack));
}
```
Below we have a Python program implementing a stack data structure

```
class Stack:
    def __init__(self):
        self.items = []

    def isEmpty(self):
        return self.items == []
    
    def push(self, item):
        return self.items.insert(0, item)


    def pop(self):
        return self.items.pop(0)
    
    def peek(self):
        return self.items[0]
    
    def size(self):
        return len(self.items)
    
    def print(self):
        return print("Stack is:", self.items)
```
Below we have a Ruby program implementing a stack data structure

```
class Stack
    attr_reader :item
    @@contents = []
    def initialize(item)
        @item = item
        @@contents << item 
    end
    
    def pop
        @@contents.pop
    end

    def push(item)
        @@contents.push(item)
    end

    def print
        puts "#{@@contents}"
    end

    def peek
        puts "#{@@contents.last}"
    end

    def size
        puts "#{@@contents.length}"
    end    
end
    
```
25 Clean Code Tips That You Should Be Familiar
Tags: webdev, beginners, programming, productivity
Published: 2023-05-13 17:26:08

- 1. Format your code
- 2. Use meaningful names
- 3. Avoid returning NULL
- 4. Keep class size small
- 5. Don’t reinvent the wheel
- 6. Use appropriate tools/IDE
- 7. Structure your solution well
- 8. Use proper naming convention
- 9. Use OOP Principles in your code
- 10.Write short methods (20-30 lines)
- 11.Removed unused and duplicate code
- 12.Avoid catching generic exceptions 
- 13.Don’t put everything in single class
- 14.Use constants instead of magic numbers
- 15.Avoid deep nested conditions and loops
- 16.For simple if-else use ternary operator
- 17.Don’t use too many parameters in Methods
- 18.Refactor code and re revaluate conditions
- 19.Use async/await for better user experience
- 20.Unit test and test code after code reviews
- 21.Use expression bodied methods where possible
- 22.Use version control to maintain history of code
- 23.Now a days libraries a quite common, choose wisely
- 24.Don’t use a lot of comments, only add where necessary
- 25.Follow coding and design principles (SOLID, KISS, YAGNI)
- 26.Eliminate extra functions and create functions where possible