teleren/devto huggingface dataset:
Tile Calculator Project
Tags: python, beginners
Published: 2023-12-26 04:07:38

This is my first project I made upon my own accord. Nothing too large or complex, just something to test my knowledge and skillbase. I know it is still incomplete and some more work still needs to be done, but I would appreciate any feedback given about it.

## **Some Background**
My father is a contractor, mainly he does bathroom and kitchen remodeling. One of the things that he always wanted was a formula or a calculator that would tell him how many of certain types of tile a job needs to complete it. I have worked with him in this line of work for a couple years, so I know what values are needed to calculate the amount of tile needed, and what information would be pertinent to such a job. 

I have made this calculator project once he had requested it, both for him and to test out my python skills. I think it came out half decent. Obviously some more work still needs to be done, but I believe it functions well enough for what the calculator needs to do. 

[Attached](https://github.dev/kylekovov/projects/blob/3369db34b313525a8395774d25346bea9c02615e/TILE_CALCULATOR.py) is the link to the GitHub where I committed the code. Again, any questions/comments would be appreciated, thank you!
Laravel `loadCount` Relationship Count 😎
Tags: laravel, webdev, laraveltips
Published: 2023-12-26 03:40:26

Hello Artisans 😎

Did you know you can get relationship counts even after retrieving the parent model? 🤔

Using the loadCount method, you may load a relationship count after the parent model has already been retrieved:

```
$book = Book::first();
 
$book->loadCount('genres');
```

If you need to set additional query constraints on the count query, you may pass an array keyed by the relationships you wish to count. The array values should be closures which receive the query builder instance:

```
$book->loadCount(['reviews' => function (Builder $query) {
    $query->where('rating', 5);
}])
```
ReactJs UseEffect Dependency (Use case)
Tags: javascript, reactjsdevelopment, typescript, webdev
Published: 2023-12-26 03:30:53

**Usecase** 

Consider you have a checkbox, on the toggle of the checkbox you have to get the employee information from another method if the checkbox is checked.

**Solution** 

To begin with, I created the following things.

Assume the below method will get called once the checkbox is checked.

```
function getActiveEmployeeInformation(): Employee {
  return {
    name: {
      firstName: "Sam",
      lastName: "El",
    },
  };
}
```

A Simple component to store the checkbox status and the employeeInfo.

```
function Employee() {
  const [status, updateStatus] = useState(false);
  const [employeeInfo, updateEmployeeInfo] = useState<Employee | null>(null);
 
  return (
    <>
      <label>
        <input
          type="checkbox"
          checked={status}
          onChange={() => {
            updateStatus(!status);
          }}
        />
        Is Active
      </label>
      {status && (
        <p>
          {employeeInfo?.name.firstName} {employeeInfo?.name.lastName}
        </p>
      )}
    </>
  );
}
```

The obvious instinct will take us to write a method to be called on change of the checkbox and check the status there to call the getActiveEmployeeInformation method like below, 

```
 function onStatusChange(){
    updateStatus(!status);
    if(status){
      const activeEmployeeInfo = getActiveEmployeeInformation();
      updateEmployeeInfo(activeEmployeeInfo);
    }
  }
```

this seems like a solution, but the problem is status may not be updated right after the updateStatus call, which might lead to an inconsistent result.

To solve the above use-case, we need a simple understanding of the useEffect, in a very simple term it can be explained that when there is a change in the dependent variable the associated callback(method) will be called.

for example, if you connect, methodA to a variable employee, if any action changes the employee, that change will trigger a change-event to call the associated callback which is methodA. 

Here useEffect is the connector that connects the variable and its callback. 

`useEffect(()=>{},[dependentVariable])`

on change of the dependent variable the anonymous method will be called, using this we can solve our use case by adding the following snippet in our Employee component.

```
 useEffect(() => {
    if (status) {
      const activeEmployeeInfo = getActiveEmployeeInformation();
      updateEmployeeInfo(activeEmployeeInfo);
    }
  }, [status]);
```

In the above snippet, we used the status as a dependent variable, on change of it the anonymous method will get the employee info if the status is true. Once I get the information I store it in a state variable for further access.

[Solution](https://hh5krr.csb.app/) 

Hope you enjoyed reading this, Do let me know your feedback in the comments.

Thanks,
Sam El
C++, about priority_queue(min max heap)
Tags: priorityqueue, minheap, maxheap, timecomplexity
Published: 2023-12-26 03:16:20

priority_queue (min/max heap)
Building complexity:  O(n) / priority_queue<int> pq(iV.begin(),iV.end()); 
 priority_queue<int> s_pq;
 for(auto i: iV) s_pq.push(i) //building time complexity O(n* log n)
pop                : O(log n)
push             : O(log n)
top                : O(1)
default order: max heap( maximum item is on top) - descending order.
min heap (min item on top) - ascending order
 priority_queue<int,vector<int>, std::greater<int>> m_h(iV.begin(),iV.end());
Example code

```cpp
 vector<int> iV = { 3,5,8,3,6,1,20,4,8,1};
    cout << "==========max heap=============" << endl;
    // building time complexity O(n)
    priority_queue<int> pq(iV.begin(), iV.end());// default order => max heap, descending order
    pq.push(24);//O(log n) time complexity
    while (!pq.empty()) {
        cout << " " << pq.top() << endl; // --> acces the maximum item : O(1)
        pq.pop();// O(log n) time complexity
    }
    //==========
    cout << "==========min heap==============" << endl;
    // min heap, O(n) building time complexity
    priority_queue<int,vector<int>, std::greater<int>> m_h(iV.begin(),iV.end());
    while (!m_h.empty()) {
        cout << " " << m_h.top() << endl;
        m_h.pop();
    }

    priority_queue<int, vector<int>, greater<int>> slow_bh; // O(1) building time
    for (auto i : iV) slow_bh.push(i); // building time O (n* log n) 
```
Custom data type

```cpp
struct City {
    int population;
    string name;
    City(int pop = 0, string s = "") {
        population = pop;
        name = s;
    }
    // for max heap
    bool operator< (const City& c) const
    {
        return population < c.population || (population == c.population && name < c.name);
    }
    //for min heap
    bool operator> (const City& c) const {
        return population > c.population || (population == c.population && name > c.name);
    }
    //bool operator== (const City& c) const / for other methods
    
};
void test_priority_queue() {
    vector<City> cV = { {100,"suwon"},{320,"incheon"},{40,"seoul"},{500,"kwangju"}};
    // max heap
    cout << "========== max heap =============" << endl;
    priority_queue<City> pq(cV.begin(), cV.end());
    while (!pq.empty()) {
        cout << " " << pq.top().population << " " << pq.top().name << endl;
        pq.pop();
    }
    cout << "========== min heap =============" << endl;
    //min heap
    priority_queue<City, vector<City>, std::greater<City>> mc_h(cV.begin(), cV.end());
    while (!mc_h.empty()) {
        cout << " " << mc_h.top().population << " " << mc_h.top().name << endl;
        mc_h.pop();
    }
}
```
What is the reason Madden NFL 24 players
Published: 2023-12-26 02:27:40



The week before, Bill Barnwell of ESPN explained how, in the lottery-like draft "the most effective strategy is to buy many more lottery tickets." The RG3 trade is perhaps the most successful example in the past, but losers of the trade seem to be ignoring the knowledge. Perhaps it will work however the Rams ought to be aware of this.

The Chargers could make a deal for Philip Rivers, but they'd likely make a mistake too.

LaDainian Tomlinson believes that the Chargers should sell Philip Rivers. It is said that the Chargers are in rebuilding mode and should consider trading Philip Rivers instead of ruin his entire career. Are they realistic?

It is logical at first glance. The Chargers have been, yet again an absolute mess, losing three games in a gruelling manner by blowing their fourth-quarter lead. Rivers isn't the main cause of the issue. He's completed 68 percent of passes. He averages 7.8 yards for every attempt and has 1.110 yards. He also scored seven touchdowns, and one interception.

The Chargers signed Rivers to a four-year, extension worth $83 million this year, however his structure in the deal does not make it prohibitive to trade him. The cap-to-cap hit won't exceed $22 million until the end of the year, so it's simple for teams to get out of the contract after 2018.

However, the Chargers really require the most support from fans they are able to get ... something they're not getting much of after having suffered so much loss and the Bosa standoff and the threat to alienate fans with the relocation thing. If they can get rid of Mike McCoy and make the appropriate moves during their offseason, they could be back in the game sooner than you imagine. It's a big risk for an organization that hasn't accomplished much positive either on or off the field.

What is the reason Madden NFL 24 players favored the latest CBA despite its obvious shortcomings

If you want to know more about Madden 24 coins， please visit https://www.mmoexp.com/Nfl-24/Coins.html
Don't sell the sugar, sell the empty bag
Tags: startup, business, tactics, tips
Published: 2023-12-26 02:03:02

---
title: Don't sell the sugar, sell the empty bag
published: true
description: Are you a wantrepreneur? then this post is for you. learn basics of business from a prespective of a grocery store. Grocery stores are the most common business you can see nearby, they’re everywhere, and so competition is very high.
tags: startup, business, tactics, tips
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-12-26 01:59 +0000
---

My father runs a grocery store, and running a grocery store is not as easy as it looks. There are a lot of business tactics and meticulous calculations behind it.

Grocery stores are the most common business you can see nearby, they’re everywhere, and so competition is very high.

Sugar, oil, and tomato 🍅. The three killer products in any grocery store which they sell for zero margin.

These three items are essential for any household, and everyone uses them as a measuring gauge about how much margin a shop places on products they sell. Also, it has loyalty tactics too.

[Continue Reading in my blog](https://kamesh.xyz/posts/dont-sell-sugar-sell-empty-sugar-bag/)
What is Deno and Why Was It Released?
Tags: deno, rust, ryandah
Published: 2023-12-26 01:24:00


![Deno JS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rust45flkj610xyatpvr.jpg)

> As per Deno.js official website, Deno is an open-source runtime environment for JavaScript and TypeScript.

It was created by American software engineer Ryan Dahl - the same guy who created Node.js in 2009 - on May 18, 2018. And as of now, Deno.js has received more than 90k stars on GitHub.

But why was it created? Well, there were some problems in Node.js. To address those problems, Deno.js was released. What were those problems in Node.js? We will discuss that shortly.

First things first, in Deno.js no support for npm is provided. You have to import services or modules via URL. Contrary to Node.js, Deno.js is built using Rust. But like Node.js, deno.js is based on the V8 engine.

Furthermore, one advantage of using Deno.js is that you don't have to compile. You can write your code directly in TypeScript and JavaScript. And contrary to Node.js, Deno.js is more secure. That's because when you run an app in Node.js, it can access your network, server, and files. But in Deno.js, it asks for permission.

There are lots of built-in tools for varying tasks, including code formatting, linting, and testing in Deno.js. But that's not present in Node.js. You have to use third-party packages and tools for performing code formatting, linting, and testing.

And when it comes to performance, I can't say that Deno.js is faster than Node.js and vice versa. That's because Deno.js performs better in some cases. Node.js performs better in cases.

But yes, unlike Node.js, the Deno.js community is small. You might not receive adequate help while working in deno.js. And for this very reason, I recommend developers not learn Deno.js if they aren't familiar with Node.js. But definitely go for it, if you are willing to invest a lot of your effort and time.

And no. Despite all the pros of Deno.js, it can never replace Node.js. Not even in the next 10 years. There are still areas where Node.js is taking the lead. Node.js 21 was released in October 2023. Contrarily, Deno.js is still in its first version.
5 Open Source Systems / Softwares For Developers & Project Managers
Tags: developer, developers, management, team
Published: 2023-12-26 00:54:00


In this post, I will share information on 5 Free & Open Source Systems / Softwares For Developers & Project Managers, along with their Project Location & Download Links.

## Virtual Machines for Quick PHP Mysql Projects

https://sourceforge.net/projects/lamp-package-in-virtual-machin/

{% youtube ePerwxLMvHY %}

## OpenProject CE Virtual Machine - Free & Open Source - Project : Task : Time & Team Management Software

 https://sourceforge.net/projects/openproject-ce-virtual-machine/

 {% youtube 5vQJXaEIES0 %}
 
## Team Docs Software for all Team Documentations & Team Collaborations

 https://sourceforge.net/projects/easy-team-document-software/

 {% youtube Crxr8X9bGn8 %}
 
## Automatic Website Forms Creator & Local Hoster - Create Forms, Surveys, Quizzes, Polls, Questionnaires etc.

 https://sourceforge.net/projects/automatic-website-forms-create/

 {% youtube aizomf33cik %}
 
## Capacity Planning & Management Software - For All Organizations and Professions

 https://sourceforge.net/projects/trcfir/

 {% youtube 5PVyyAo4aR4 %}
 
 Hope you find this information useful. Please do share this information with your friends and contacts, for their benefit too.
First Contributions: learn how to contribute to open source projects
Tags: opensource, beginners, tutorial
Published: 2023-12-26 00:45:23

## My Journey to Open Source Contribution

In my early teens, at the turn of the century, I dreamed of owning a computer. However, due to fatal health issues and financial constraints, it took me another 15 years to get my first one. Those years were filled with challenges and setbacks, but also with resilience and gradual rebuilding. This journey, though personal and often overlooked, shaped me profoundly.

Today, I'm not here to dwell on my past. Instead, I want to share the joy and sense of belonging I've discovered in the Open Source community. This diverse and vibrant group feels like a large, welcoming family of brilliant minds and kind souls.

About a decade ago, I watched '[Project Code Rush - The Beginnings of Netscape](https://youtu.be/4Q7FTjhvZ7Y?si=E-SH6U5Akpfv0lw5)', a documentary that inspired me as much as classics like 'The Matrix', 'Rambo' or 'Enter the Dragon'. It sparked a deep interest in technology, though circumstances led me astray for a while.

Now in my late thirties and with five years in the software industry, I feel an unquenched thirst for achievement and contribution. To those in their teens or early in their careers: channel your energy and passion into meaningful pursuits. Dive into history, collaborate, and contribute to making the world brighter.

I recently had the honor of contributing to the [firstcontributions GitHub repository](https://github.com/firstcontributions), maintained by Roshan Jossy ([Roshanjossey on GitHub](https://github.com/Roshanjossey)). This was a milestone for me, and I'm grateful to Roshan and the community for guiding newcomers into the world of open source and bolstering our confidence.

If you haven't yet contributed to open source, start today. Search for terms like 'first contribution', 'good first issue', or 'help needed'. Fork repositories, experiment in your environment, tackle issues, and adhere to contribution guidelines. I did this with 'first contribution', leading to my first pull request.

[First Contributions GitHub Repository](https://github.com/firstcontributions/first-contributions)

**Happy coding to all, and may your journey in open source be fulfilled!**


I followed the hands-on tutorial in the Readme of first contributions and made my first pull request to the same repo.


{% embed https://github.com/firstcontributions/first-contributions %}

Github [shalaka-deshan0110](https://github.com/shalaka-deshan0110)
Twitter [SDeshanS](https://twitter.com/SDeshanS)
LinkedIn [shalaka-deshan](https://www.linkedin.com/in/shalaka-deshan/)
Complete MERN Stack Todo Application
Tags: mern, todo
Published: 2023-12-27 18:20:58

---
title: Complete MERN Stack Todo Application
published: true
date: 2023-12-26 00:22:00 UTC
tags: MERN,Todo
canonical_url: https://reactjsexample.com/complete-mern-stack-todo-application/
---

 ![Complete MERN Stack Todo Application](https://reactjsexample.com/content/images/2023/12/Code_2023-12_19-17-11.jpg)

![Complete MERN Stack Todo Application](https://raw.githubusercontent.com/SamiurRahmanMukul/Complete-MERN-TODO-Application/master/app_screenshot_v1.png)

# Complete MERN Stack Todo Application

Hello 👋, I’m Samiur Rahman Mukul. At this repository i will be build a `Complete MERN Stack TODO Application ☋`. Using `Node.js, Express.js, MongoDB, React.js, Redux.js & Tailwind CSS`. So are you interested at this project let’s connect with me. Thanks

### 👨‍💻 Development with MERN Stack Todo Application

- `Backend` – Node.js, Express.js & MongoDB database
- `Frontend` – React.js, Redux.js, & Tailwind CSS

### 🖱️Browse App & API Routes Live URL

| # | Projects | Live Preview |
| --- | --- | --- |
| 01 | [Todo App](https://github.com/SamiurRahmanMukul/Complete-MERN-TODO-Application/tree/master/todo-fronted) | [Click Here ↗](https://mukul-todo-app.netlify.app) |
| 02 | [API Routes](https://github.com/SamiurRahmanMukul/Complete-MERN-TODO-Application/tree/master/todo-backend) | [Click Here ↗](https://mukul-todo-app-new.herokuapp.com) |

### 👉 Live API Routes Documentations

```
|--------------------------------------------------------------------------------------------------------|
| METHOD: URL: // DESCRIPTION |
|--------------------------------------------------------------------------------------------------------|
| GET: https://mukul-todo-app-new.herokuapp.com/ // defaults welcome routes |
| GET: https://mukul-todo-app-new.herokuapp.com/api/v1/todos-all // get all todos |
| GET: https://mukul-todo-app-new.herokuapp.com/api/v1/todo/:id // get a single todo |
| POST: https://mukul-todo-app-new.herokuapp.com/api/v1/todo/new // create a new todo |
| POST: https://mukul-todo-app-new.herokuapp.com/api/v1/todos-many // create many todos |
| PUT: https://mukul-todo-app-new.herokuapp.com/api/v1/todo/:id // update a todo |
| DELETE: https://mukul-todo-app-new.herokuapp.com/api/v1/todo/:id // delete a todo |
|--------------------------------------------------------------------------------------------------------|
```

**HAPPY PROGRAMMING 😀 & I LOVE PROGRAMMING 💖**

## GitHub

[View Github](https://github.com/TanakaAkihiro0930/dev?ref=reactjsexample.com)
Rust Server Windows
Tags: webdev, programming, tutorial, beginners
Published: 2023-12-26 00:03:16

[Click Here](https://mywild.work/rust-server-installing-a-rust-server-the-easy-way) to read the full document.

Rust is a multiplayer-only survival sandbox game developed by Facepunch Studios. It was released in early access in 2013 and fully released in 2018. In Rust, players must gather resources, build structures, and craft weapons and tools in order to survive in a harsh and unforgiving world. Rust is known for its challenging gameplay, its emphasis on PvP combat, and its unique world-building system.

## How to Build Your Own Local Rust Server Easy
**_System Requirements_**

The Rust server can be taxing on your host/local machine but maybe not as much as you might think. As a baseline a 3 square km (default gen size) map freshly generated will run at close to 2 gigabytes of ram. After some stress testing and 150k entities later, can use 6+ gigabytes of memory easily. So I would suggest having at least 8 gigs allocated per server so you don't encounter as much lag during peek times.
The Shell
Tags: mit, computerscience, bash
Published: 2023-12-25 23:57:27

## Bourne Again SHell prompt   

`machine-name:current-working-directory$`

~ means home
$ means not the root user

We can type in commands at the shell

The shell parses the command

- splitting it by whitespace,
- runs the program (first word),
- supplying each subsequent word as an argument
  - argument that contains spaces or other special characters
    - either quote the argument with ' or "
    - or escape just the relevant characters with \

The shell is a programming environment with variables, conditionals, loops, and functions.

`date` prints the current date and time.

`echo` prints out its arguments.

`$PATH` is an environment variable that lists which directories the shell should search for programs when it is given a command.

`which` find out which file is executed for a given program name

Bypass $PATH by giving the path to the file we want to execute.

Path

- delimited list of directories
- separated by / on Linux and macOS and \ on Windows
- the path /
  - linux and macOS
  - “root” of the file system
  - absolute path
    - starts with /
  - relative path
    - relative to the current working directory

`pwd` print working directory
`cd` change current working directory

`.` current directory
`..` parent directory
  
`ls` list files in current directory

`~` home directory

`-` flags with values modify command behavior

`-h` or `--help` flag will print some help text

`cd -` previous directory

`mv` rename, move a file

- two arguments
  - renames the first arg as the second (file name) or,
  - moves moves first arg to the second (directory)

`cp` copy a file or directory
`cp [options] source destination`
`cp file.txt backup/` copy a file from one location to another
`cp file1.txt file2.txt backup/` copy multiple files 
`cp -r mydirectory/ backup/` copy an entire directory and its contents
 Be cautious with the -r option, as it can overwrite files and directories.

`mkdir` make a new directory

`man` takes as an argument the name of a program, and shows you its manual page 
`q` to exit

`ctr l` clears terminal

Connecting programs

- input stream
  - program reads input from input stream
  - default keyboard

- output stream
  - sends data out of the program
  - default screen

`< file` rewire the input of this program to be the contents of a file

`> file` rewire the output of the preceding program into this file

`cat` prints the context of a file

`>>` append

`|` 

- take the output of the program to the left and make it the input to the program on the right.
- “chain” programs such that the output of one is the input of another

`#` mean run as root

`touch` create new file