teleren/devto huggingface dataset:
Ansible to install docker and create docker images
Published: 2022-03-13 08:24:36

**create an ansible file to install docker and create docker images**

```
---
- hosts: docker
  become: true
  vars:
    container_count: 1
    default_container_name: docker
    default_container_image: ubuntu
    default_container_command: sleep 1d

  tasks:
    - name: Install aptitude
      apt:
        name: aptitude
        state: latest
        update_cache: true

    - name: Install required system packages
      apt:
        pkg:
          - apt-transport-https
          - ca-certificates
          - curl
          - software-properties-common
          - python3-pip
          - virtualenv
          - python3-setuptools
        state: latest
        update_cache: true

    - name: Add Docker GPG apt Key
      apt_key:
        url: https://download.docker.com/linux/ubuntu/gpg
        state: present

    - name: Add Docker Repdoository
      apt_repository:
        repo: deb https://download.docker.com/linux/ubuntu focal stable
        state: present

    - name: Update apt and install docker-ce
      apt:
        name: docker-ce
        state: latest
        update_cache: true
      notify: Restart docker

    - name: Install Docker Module for Python
      pip:
        name: docker

    - name: Pull default Docker image
      docker_image:
        name: "{{ default_container_image }}"
        source: pull

    - name: Create default containers
      docker_container:
        name: "{{ default_container_name }}{{ item }}"
        image: "{{ default_container_image }}"
        command: "{{ default_container_command }}"
        state: present
      with_sequence: count={{ container_count }}

  handlers:
    - name: Restart docker
      service:
        name: docker
        state: restarted



```
Getting started with pthreads
Tags: c, pthreads, threads, programming
Published: 2022-03-13 07:49:22

1. [Installing pthreads library](#Installation)
2. [Compiling pthread programs](#Compilation)
3. [Pthreads API](#Pthreads-API) 
 
 

## Installation <a name="Installation"></a>
Installing pthreads library on linux: 
``` sudo apt-get install libpthread-stubs0-dev ```

---

## Compilation  <a name="Compilation"></a>

You can compile threaded programms with gnu compiler with the following command:

1)  ```  gcc -pthread file.c ```

or 

2) ``` gcc -pthread file.c -o thread -lpthread ```

where:
-lpthread command will tell the compiler to execute the program with pthread.h library. 
gcc is the compiler command.
file.c is the name of c program source file.
-o is option to make object file.
thread is the name of object file.

---

## Pthreads API <a name="Pthreads-API"></a>

All identifiers in the threads library begin with pthread_.

Some frequently used methods are:

1) pthread_ = Threads themselves and miscellaneous subroutines 
2) pthread_attr_ = Thread attributes objects
3) pthread_mutex_ = Mutexes
4) pthread_mutexattr_ = Mutex attributes objects.

Also the pthread.h header file should be included in each source file using the Pthreads library.
Why tax on cryptocurrency is so high?
Tags: cryptocurrency, blockchain, writing, ankitgupta
Published: 2022-03-13 06:57:57

First lets understand what are the taxes on cryptocurrency & then come to why?

**Budget 2022 tax announcements for cryptocurrency in India are -**

1. Income (Any gains or losses made from a crypto asset held less than 12 months / Financial year) from any transfer of crypto, even gifts, would attract a **30% tax**
2. Investors will also have to face **additional 1% TDS** (Tax Deducted at Source) on digital asset transfers above a certain threshold, which will allow it to capture transaction data with the government.
3. In addition, investors cannot get any deductions and won’t be allowed to set off losses from transfer of such assets against any other income.
4. As a disclosure requirements the taxpayers will have to report income from crypto through a separate column while filing I-T returns.
5. RBI-backed ‘digital rupee’ to be launched in FY23.

**Now, Let’s understand Why such huge tax on crypto?**

> _The higher tax rate also hints at tougher crypto regulations & government wants people to be aware of the higher volatility & risk into crypto market before investing into crypto._

- **Lets, take an example to understand the tax system on crypto trading.**

_I assume that you have booked a profit of Rs.100 earned by trading crypto on any crypto exchange._

**So, the tax on Rs. 100 profit is :**

**Net Profit =** Rs.100 — (Net Loss, if any in current financial year)

_(I assume you have Net Loss = Rs.0. So, Net Profit = Rs.100 — Rs.0 = Rs.100)_

**Tax on Net Profit =** ( **30%** of Rs.100 **+**  **1%** of Rs.100 ) = ( 0.3 \* Rs.100 + 0.01 \* Rs.100 ) = Rs. 31

**So, your Tax on your Net Profit is Rs. 31**

Thanks for reading till the end! Hope it helps…

---

_Connect me on Twitter for regular updates on such informative contents or just to say Hi! 👇
@_ [**Mr_AnkitGupta01**](http://twitter.com/Mr_AnkitGupta01)

_I'll be happy to connect you on my socials_ 👇
[**Ankit Gupta**](ankitgupta.bio.link)

_Happy Leaning!_
Task force 5.0 week IV Recap
Tags: codeofafrica, awes0mitylab, taskforce
Published: 2022-03-13 06:41:28

Hi, here is my legend role model’s quote saying:
 “You can’t connect the dots looking forward; you can only connect them looking backward. So you have to trust that the dots will somehow connect in your future.  ” Steve Jobs said.
It was week four in my journey of the task force, we connected more dots as the quote said I looked back and l see that l attain much experience with numerous skills.
We had #handsOnkeyboard as the hashtag of the week. It was more fun making endpoints through new technology which is GraphQL, I had to do the authentication, but the process comes with some bugs, but since we are in the team, we tried to resolve them, but even our facilitator assisted us. It's a great experience where my goal is for everyone at CODE OF AFRICA AND AWES0MITYLAB to enjoy GraphQL doing API😎.

The week was also super cool to know a lot about time management had an insight into time management, but so far I've learned more about it. Where we lay down the main keys to time management where I used to do only two to three of them.
We have also found more about a good talk in the presentation can be, for me before it was hard to present well but so far there are many changes. 
Actually this week we exploited much as our team we didn’t know that there is more than two WHY’s on any problem that happened but so far we went deep to 5WHY’s.
All in all, I saw that “The first step is to establish that something is possible; Elon Musk said. As am still studying I realized am becoming the best version in the industry of tech. 
Thanks to @codeofafrica, @awosamitylab.🤩
The uri parameter to openUri must be a string mongoose.connection or mongoose.createConnection is a string (Solution)
Tags: mongooseerror, mongooseconnectionerror, mongodberror
Published: 2022-03-13 06:36:13

i have been working in a Node js small project where i use MongoDB as Database and use mongoose as a Data Modeling Library.
but when i tried to connect to Database its show an which is: **Mongoose Error The uri parameter to openUri must be a string-got undefined Make sure the first parameter to mongoose.connect 
 or mongoose.createConnection is a string**
the actual error screen shot is:

![The uri parameter to openUri must be a string-got undefined Make sure the first parameter to mongoose.connect 
 mongoose.createConnection is a string ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c6rvxxqjeww7dx0sfmj2.PNG)
after seen this type of error i want to fix why this is happen cause i am 100% confident that there is no any coding issues and i have written well organize code. so i try to find out the problem after few times i got what i did and what is my mistake and then i solve the issue and i decide to share this solution with all of you the internet people.
So, to solve **The uri parameter to openUri must be a string-got undefined Make sure the first parameter to mongoose.connect 
 or mongoose.createConnection is a string**
i go to my API index file and place the dbConfig.js file under the dotenv config file. so why dotenv because i have created env file and use dotenv libraray.
and now i want to show 2 screen shot where the first one is hold the **Mongoose Error:  mongoose.connect or mongoose.createConnection is a string**
and the second one is the solution of this type of error i men to say what i exactly did to avoid this type of error.

## **1 . Screen shot of the code which generate Mongoose connection String error:**

![Mongoose Error: mongoose.createConnection is a string](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/im4h8xn42jzgtoa3xzue.png)

## **2. Screen shot of the code How i solve or avoid Mongoose connection String error:**

![The uri parameter to openUri must be a string-got undefined Make sure the first parameter to mongoose.connect Solution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sry9vr9yapmukakfjt01.png)
this all solve my Mongoose Error: Connection String Error. and after solution the terminal scenario is:

![Imongoose.connect 
 mongoose.createConnection is a string error solution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/flb4880ucmqqxy1tx11v.PNG)
.
That's it
Hope this will help you
Happy Coding
.
osman forhad
Full-Stack Developer💻 (Mobile App & Web App)
developer.osmanforhad@gmail.com
Example 1- Simple GTK example
Published: 2022-03-13 06:14:58

/*
 to make a GTK project in codeblocks, we have to sepecify 'other compiler settings' and 'linker settigs', to har example ke liye alag jagah source code file save nahi karenge

we will continue testing it in this project and will store our source codes files at one location : desktop/gtk_examples

in case u need to create new project , visit this : (timestamp_for_C 3:45) https://www.youtube.com/watch?v=fdGOmBahxeY&ab_channel=AtoZProgrammingTutorials  
*/


`
#include <gtk/gtk.h>

void main (int argc, char *argv[]){

    GtkWidget *window;  /*! GtkWidget is a variable type to define various components like window, button, label... In this example, a window is defined like the following:  GtkWidget *window;*/

    gtk_init (&argc, &argv); /*! intitiates the toolkit and gets the parameter entered in command line */
    /*! this function should be used after declaring the componenets, (jaise hmne window ko define kr dia h)*/

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);  /*! GtkWidget *gtk_window_new(GtkWindowType windowtype) creates a new window. Window type can be: GTK_WINDOW_TOPLEVEL,GTK_WINDOW_DIALOG, GTK_WINDOW_POPUP,,,, hmne TOPLEVEL wala banaya hai*/

    gtk_widget_show (window);
    /*! void gtk_widget_show(GtkWidget *widget) is used to make the component appear in a window. After defining a component and changing attributes, this function must be used.*/


    gtk_main ();
    /*! void gtk_main(void) prepares windows and all components to appear in the screen. This function must be used at the end of GTK programs.*/

}`
My fourth week experience, while in the taskforce at CodeofAfrica
Tags: reactnative, codeofafrica, awesemitylab
Published: 2022-03-13 06:14:21

**Elaborate on how your fourth week experience at the taskforce was to you?**

 This week was a remarkable week! It was a week that we celebrated happy women's day as a special event! My fellow team members shared memorable hug outs with me in appreciation of my being and most importantly, making the bold move of giving voice to what am passionate about which is IT.

Further more, this week we got to learn alot on different interesting topics specifically, time management. We gained knowledge on the terms;  SMART and the 5 whys, that are practical soft skills in our daily life.  We also proceeded more on  programming language regarding react native, used in mobile application. We further learnt new topics  that included routing, App localization, deepliking and forms. React native is a new programming language l had encountered however,with persistence and gaining understanding and knowledge , l will eventually grasp the concept and smoothly.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xib7fgaxwyla8fd2da9k.png)


I sum up by saying, this week was an interesting week full of fun and a lot of learning as well.
Five lessons in 20 years
Tags: programming, life
Published: 2022-03-13 06:12:58

After graduation in year 2000, started working as an ASP developer. Never looked back. In 20 years though, 5 lessons stick out. Here are the stories of the first time I picked them up.

### Pick your battles

For a junior, a board meeting is like the club of the elite. A senior member of the company I worked for skipped one of those, a behavior I could not make sense of as a junior. When I asked him, he said if there was anything important, they would email it to him later. Then he said: you have to learn to pick your battles.

### Use notepad

A team leader opened notepad to add a task to a to-do list. When I asked him why not use a proper, more complex tool. He said what meant: the tasks were complex enough, do not need one more complexity to add. Those days, notepad removed a lot of the clots that formed in my head due to thinking about a complex problem.

### Eat your frog first

Or what is known as: Eat That Frog. Someone shared that from an article or a book he read, in a company meeting, just before a release. Ever since then, I tackle the most obnoxious task (my frog) early on.

### Structure folder according to intent

Met a client who gave me that advice about sorting out inbox. He said, do not place your emails according to what they are, but what you intend to do with them. I took that advice to my folder structure, it has been 15 years and my folder structure did not change: "work", "bulk", "zjunk", "exe". It all starts with "zjunk", that gets burried on an external drive every once in a while. Another advice I was given: why delete files when you can buy cheep HD.

### Use the point system to choose between alternatives.

A friend of mine was quitting his job, and when I asked him how he came to this decision, he showed me this way. Better shown than described:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1647151751118/TgPLJIK8L.png)
CRUD Operations In React JS | MERN STACK | CRUD REST API
Tags: javascript, node, react, webdev
Published: 2022-03-13 05:42:53

Hi guys, In this video we gonna build front-end of Employee app with React.js. We are going build all CRUD (create, read, update, delete) operation in this MERN Stack app. Learn how to call APIs in React.

{% youtube 5aUV5rfSxgc %}
CRUD Operations In Node JS | MERN STACK | CRUD REST API
Tags: javascript, node, react, programming
Published: 2022-03-13 05:40:41

Hi guys, In this video we gonna build backend of Employee app with Node.js, Express and MongoDB as database. We are going build all CRUD (create, read, update, delete) operation in this MERN Stack app.

{% youtube K6m3QSdCRAM %}
Graph Algorithm - Depth First Search
Tags: beginners, programming, tutorial, career
Published: 2022-03-13 05:12:38

## Depth First Search

Depth First Search(DFS) is a graph traversal algorithm that starts with a node in the graph and goes deeper and deeper until we reach a node that does not have further children. Then the algorithm backtracks towards the most recent node and continues the search if there are children unvisited.
Consider a graph given below, with node 0 as the start node. In the DFS algorithm, we will start our search from node 0 and mark it as visited. We continue our search deeper until we reach a dead-end and keep on backtracking to finding a node that has some unvisited children.


![DFS Starting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2imfe0ucznl7xt2abvhv.png)


## General Algorithm

📌 If the graph is disconnected, run a loop from node 0.
📌 A recursive function is called that takes the node and visited array.
📌 Mark the node as a visited node and store the node in the result list.
📌 Traverse the children of the current node and call the recursive function if the child is not visited.


![DFS Walkthrough](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tx39xj4ef4g4m5yv71cp.gif)




## Time Complexity
📌 We are traversing through all the nodes and edges. So time complexity will be O(V + E) where V = vertices or node, E = edges.
📌 We use a visited array, adjacency list for the graph and some space for the recursion stack. So the space complexity will be O(V) + O(V + E) + Auxiliary space for recursion stack. (Ignoring the space for the final result list).


## Code

![DFS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymk21z9rif5ueiu6ln2p.png)

Originally Published On LinkedIn Newsletter : [LinkedIn Newsletter](https://www.linkedin.com/newsletters/graph-algorithm-6905161199672025088/) 

## Github Link

{% github https://github.com/Rohithv07/LeetCodeTopInterviewQuestions %}
How to Solve "Struct Containing a (Nested) Mapping Cannot be Constructed" in Solidity
Tags: soldity, ethereum, mapping, struct
Published: 2022-03-13 05:08:04

This compilation error is encountered when you try to instantiate a struct that contains a mapping as an attribute. I needed this data structure to write [this contract](https://github.com/ndehouche/DecentralizedClinicalTrials/blob/main/README.md) to allow patients to license the datasets resulting from their clinical trials, as part of an [Algovera](https://docs.algovera.ai/blog/2022/01/27/grant%20recipients%20for%20algovera%20grants%20r1/) grant.

This type of one-to-many data structure can be useful, for instance, to encode a marketplace for time-limited licenses to some content. In addition to the content to be licensed, the struct would need to map licensees' addresses with a timestamp for the start of their license, so that their access can be controlled.  

`struct content{ 
  address payable owner;
  bytes32 hash;
  mapping(address => uint) licenses;
  }
mapping(address => content[]) public contents;
`



Visually it would look like this:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbjv7si3moecffjb5hnq.png)

The "struct containing a (nested) mapping cannot be constructed" error would appear when trying to instantiate the struct, the usual way, with a recent compiler version. Like this, for instance:

`function submitContent(bytes32 _hash) public payable
returns(uint _id)
{
_id=contents[msg.sender].length;
contents[msg.sender].push(content({
owner: payable(msg.sender),
hash:_hash
return(_id);
}));
}`
Indeed, since version 0.7.0, structs or arrays that contain a mapping can only be used in storage, so Solidity complains because variables in an instantiation function would be in memory by default. 
You can read about this change in the [Solidity documentaiton](https://docs.soliditylang.org/en/v0.7.1/070-breaking-changes.html#mappings-outside-storage). The relevant part is under "Removal of Unused or Unsafe Features":
 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzd9a09mgn90znkmjzjl.png)
 
I wanted to write this short note because some top results when Googling this error are either outdated, or to the extent of "just don't use a mapping in a struct bro". A struct containing a mapping cannot be equivalently modeled with a separate mapping; reading and writing would require much more computation.

The workaround is quite simple, we just have to declare the struct in storage before we instantiate a pointer to it. Our _submitContent()_ function would have to look like this:
`function submitContent(bytes32 _hash) public payable
returns(uint _id)
{  
_id= contents[msg.sender].length;
content[] storage c = contents[msg.sender];
c.push();
c[_id].owner = payable(msg.sender);
d[_id].hash=_hash;
return _id;
}`
Designing software in a complex domain - Domain-Driven Design
Published: 2022-03-13 05:03:41

Today’s enterprise business domain is often large and sophisticated that is growing/changing — and the software to accept this enhancement. Domain-Driven Design (DDD) is an approach to software development where the software artifacts align fully with the core business concepts and objectives

More at - https://bibekshah09.medium.com/designing-software-in-a-complex-domain-domain-driven-design-10604ad08d12
Linux Cheat Sheet: Save the command output to a file
Tags: linux, cheatsheet, commandline, cli
Published: 2022-03-13 01:38:58

---
title: Linux Cheat Sheet: Save the command output to a file
published: true
description: Linux Cheat Sheet: Save the command output to a file
tags: linux, cheatsheet, commandline, cli
//cover_image: https://direct_url_to_image.jpg
---

![Save the command output to a file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vfljqodnnz0jyvar301d.jpg)

[Full size](https://github.com/andreia/cheat-sheets/blob/master/linux/linux-cheat-sheet-command-output-to-file.jpg)
Book Review: A Radical Enterprise
Tags: bookreview, agile
Published: 2022-09-09 12:33:06

---
title: Book Review: A Radical Enterprise
published: true
date: 2022-03-13 00:00:00 UTC
tags: bookreview,agile
canonical_url: https://jhall.io/archive/2022/03/13/book-review-a-radical-enterprise/
---

I just finished reading a book that I’d like to recommend to anyone who likes the idea of “agile”, applied beyond the scope of software development.

[_A Radical Enterprise: Pioneering the Future of High-Performing Organizations_](https://amzn.to/3pYCrKR) by Matt Parker several key charactaristics, or imperatives, of organizations that practice “radical collaboration”:

- Team Autonomy
- Managerial Devolution
- Deficiency Gratification
- Candid Vulnerability

Taken together, these four imperatives form the foundation of several highly-successful companies profiled in the book, each of which differs from traditional, top-down/command-and-control style management in very surprising and profound ways.

- Employees setting their own salaires
- Employees changing teams whenever they feel the need
- Employees setting their own priorities

Many of these tactics feel like they could have been taken straight out of the [Manifesto for Agile Software Development](https://agilemanifesto.org/), but then they go farther… to not just how software is built by self-organizing teams, but how the entire company is self-organizing, or is made up of peers, with no designated leader.

I recommend this book to anyone in leadership, or anyone who longs for a better way of conducting business. Unless you’re the owner or CEO, you may not be able to implement _everything_ in this book, but without a doubt you can implement _something_ from this book to make your business more effective, and your reports/employees happier and more engaged.

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._