teleren/devto huggingface dataset:
Docker Cheat Sheet - Container Lifetime and Persistent Data
Tags: docker, bash, container, image
Published: 2021-11-14 08:23:02

Containers are immutable. We can only re-deploy containers but not change existing ones. This helps in retaining history changes.

## Persisting data across containers

There are two options:

1. Bind mounts
2. Volumes

| Bind mount | Volume |
| - | - |
| When we use a bind mount, a file or directory on the host machine is mounted into a container. This file or directory is referenced by its absolute path on the host machine. | When we use a volume, a new directory is created within Docker's storage directory on the host machine and it's contents are completely managed by Docker. |
| | Volumes need manual deletion. They can't be cleaned up just by removing a container |

### Prune

To cleanup unused volumes:
```bash
docker volume prune
```

### List all volumes

```bash
docker volume ls
```

### Create a named volume

We can have a named volume with the `-v` flag.

```bash
docker container run -d --name mysql-container -e MYSQL_ALLOW_EMPTY_PASSWORD=True -v <volume_name>:/var/lib/mysql mysql
```

The `-v` command allows us to do the following:

1. Create a new volume for a container
2. Create a named volume

For bind mounts, instead of `volume_name`, we specify the absolute path of the file or folder in the host in the above command.

```bash
docker container run -d --name mysql-container -e MYSQL_ALLOW_EMPTY_PASSWORD=True -v /<absolute_path_on_host>:/var/lib/mysql mysql
```

### Creating docker volumes manually

We can create docker volumes manually using `docker volume create`. 

This is required when we want to use custom drivers and labels. 

**NOTE:** We need to do this before `docker run`.
Machine Learning - Streamlit [Python]
Tags: python, tutorial, machinelearning, datascience
Published: 2021-11-14 07:48:13


Streamlit, an open-source Python library that makes it easy to create and share beautiful, custom web apps for machine learning and data science. 
In this tutorial, you will see how in just a few minutes you can build a financial web app which you can use it for presentation or your own use.

Streamlit turns data scripts into shareable web apps in minutes; and the best part is that it's all in Python, and it's open source which means all for free. No front‑end experience required. So to create animation sliders, rendering charts/graphs, animating download bars and much more is done without any HTML/CSS/JS , just Python.

To try it out, go ahead to your terminal and type:

$ pip install streamlit
then fire the server for demo apps:
$ streamlit hello

This is the latest Data Science video tutorial created on the channel :

{%youtube e_OPmGjkAVs %}

Hope you enjoy it, and I will see in next video posts :)

✨ Streamlit Website:  https://streamlit.io

🔗 Social Media  
--------------------------
Facebook : https://www.facebook.com/bekbrace​​​​ 
Twitter : https://twitter.com/BekBrace
Instagram : https://www.instagram.com/bek_brace/
Tech Blog : ttps://dev.to/bekbrace​​​​
GitHub profile : https://github.com/BekBrace​​​
Website : https://bekbrace.com
code every day with me
Tags: javascript, programming, algorithms, 100daysofcode
Published: 2021-11-14 07:21:28

##--DAY 20--
Hi, I am going to make #100DaysOfCode Challenge. Everyday I will try solve 1 problem from leetcode or hackerrank. Hope you can go with me until end.
**Now let's solve problem today:**
Problem: Two Sum II
Detail: [here](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)
My solution(javascript):
```
var twoSum = function(numbers, target) {
    let i=0,j=numbers.length-1;
    while(i<j){
        if(numbers[i]+numbers[j]==target){
            return [i+1,j+1];
        }
        else if (numbers[i] + numbers[j] < target)
            i++;
        else
            j--;
    }
};
```
-->*If you have better solution or any question, please comment below. I will appreciate.*
How I create a Web3 project in 7 days.
Published: 2021-11-14 07:04:05

---
title: How I create a Web3 project in 7 days.
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

I'm a totally newbie to the crypto world. I think most people in dev.to is same as me. As a web2 developer(they called us), this is the first time I know the term - Web3. What's web3? It confused me for a long time. If you ask me, I'll tell you that web3 is some tech stack from Ethereum, Which you can used to create DApp. (That's may not be right, I'm sure! And what is DApp?...)

Let's just throw away these confusing concept, I just tell what I did, What I learn. 

## What I did?

The project I created is a tool, which can be used to store money(crypto money) in NFT(What is NFT? 😂). You can play it at: https://redpacket.app/ .

I use react to create the frontend ui, and use web3js to interact with the Ethereum.

## What I learn?

1. Ethereum
2. Solidity  
3. Web3js

Ethereum is a blockchain, as you known blockchain is just an unchanged database. What Ethereum different from normal database is that Ethereum can run code, the code running on Ethereum called Smart Contract. So if you want to write something like a small program, in Ethereum world, you should write smart contract(like android's apk, or iOS's ipa).

Smart contract use Solidity as it native language. Solidity is a little like javascript, here is some code snippet:

```
/**
 * @title Storage
 * @dev Store & retrieve value in a variable
 */
contract Storage {

    uint256 number;

    /**
     * @dev Store value in variable
     * @param num value to store
     */
    function store(uint256 num) public {
        number = num;
    }

    /**
     * @dev Return value 
     * @return value of 'number'
     */
    function retrieve() public view returns (uint256){
        return number;
    }
}
```
These code above store a number in the Ethereum blockchain. When you deployed the Solidity program(or smart contract) to Ethereum, how to use it? When we create an android application, we can install it in our smart phone, and open it/play it. But ethereum has no mobile application, if we want to play the program, we should use some library, one of these libraries is web3js. So you can also see web3js as a library to interact with ethereum. 

Web3js provide api to call method of the smart contract. The last thing is to write some ui, then people can use it more friendly. I use react to create the website, at dev.to everyone know react, so I wont talk it more.

![Here is the architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ta5bcjwoa8gwjd9m98cl.png)

Now, you known the architecture of a mini DApp.

# End

I always want to try some new tech, and blockchain is my new favor! There are so many concept in the crypto world, I'm sinking and enjoying. 

One more thing: If someone know what I'm doing and have a MetaMask wallet, you can play the small project at develop mode: https://redpacket.app/send#dev at dev mode, you can switch to Ropsten testnet. 

Sourecode：https://github.com/NFTRedpacket/redpacketv1
Creating an empty branch on an existing git repo
Tags: github, git, beginners
Published: 2021-11-14 07:00:56

Sometimes you need a separate empty branch for your project.
In my case, because I'm going to switch frameworks. And it's easier to start with an empty repo and work my way up from there.

This repo should have nothing in it, and if it has no git history, that's a win!

## Introducing git orphan branches

For this purpose, we can use orphan branches.
These branches are created with nothing in them, as they are orphaned from their ancestor.

Let's go through this process on our existing git test project, which you can find [here on GitHub](https://github.com/rebelchris/git-test).

![Git branch with files and history](https://cdn.hashnode.com/res/hashnode/image/upload/v1635918397239/BVfj0dfXI.png)

As you can see in the image, it has some files and a commit history here.

From our terminal, navigate to the root of this project.
In there, you can run the following command to create an orphan branch.

```bash
git checkout --orphan version-2
```

We need to remove all files that might have been staged in this process by running the following command.

```bash
git rm -rf .
```

Then we have two options. We could add a new readme file or push an empty commit.
The steps for a readme you already know, so let's try out an empty commit.

```bash
git commit --allow-empty -m "Starting a new version"
```

And then we can push this new branch.

```bash
git push origin version-2
```

![Fully empty git orphan](https://cdn.hashnode.com/res/hashnode/image/upload/v1635918638195/f-CU0lTxu.png)

As you can see, this branch is empty and has no git history!
This is a perfect way to get started on a new framework or complete rework of your application.

You can view the branch on [GitHub](https://github.com/rebelchris/git-test/tree/version-2).

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Programming is not easy
Published: 2021-11-14 07:00:40

Programming is not easy. At least, not in the sense that it will always be easy for you to learn new technologies successfully. Software development is an ever changing field, which means that if you want to remain relevant then you will have to learn at a rapid pace or get left behind. This is why it's so important to have a solid foundation of knowledge before diving straight into programming languages and technologies.

However, there are also some simple tricks and practices that new coders can use in order to make this process easier for themselves. This article is written to help you make good, consistent progress when learning the programming language of your choice.

1.  Read!  Reading is essential to learning new things. Reading materials in languages that are completely foreign will prevent you from feeling overwhelmed by all the details that you haven't experienced before. You can then apply what you read in everyday life situations, which will further help with your understanding and retention of the subject matter.
2.  Communicate with others!  Being able to interact with people in person is an invaluable way of sharing knowledge and experiences with other people who are interested in the subject matter as well.

Visit: https://www.jasonmolding.com
My first Hacktoberfest experience 2021!
Tags: hacktoberfest, opensource, github
Published: 2021-11-14 06:59:06


#Hacktoberfest
Open source is changing the world. Happy to share that I have successfully completed the Hacktoberfest 2021.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fb74kr10b8r73ec7nsyr.jpg)
It was a great experience, learned a lot of things about open source.✌
It was a great way to start with open source.
Coming to the swags, it is going to be my first swag in my tech life. 
It just a start, many miles to go🚀
First Hacktoberfest 2021!
Tags: opensource, hacktoberfest, git, beginners
Published: 2021-11-14 06:32:23

I had heard some commotion online about some hacktoberfest around the last week of September 2021, but did not gave much attention to it, but boy I had no idea that it would be such a brilliant experience to get started with opensource contribution. A friend of mine pulled me towards it, and thanks to him I really did some exciting contributions.

## Getting Started
I registered for the fest on the start of October and my first contribution was made around 3-4th October. I was not familiar with creating pull requests, so following some tutorials on Youtube I accidentally made a PR in my own repository😜. I freaked out after that, knowing that this time Hacktoberfest does have some strict rules on contributions. But then I calmed down after reading that PRs to your own repository are also valid with some conditions, and as said my first PR was reflected on the website✌. And so did the other 10.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7rm1o8byt44q0f0no7t.png)

## After First PR
So moving on, I thought that wouldn't it be much easier that I just made a couple of PRs in some of my own repository and finish it off. But a few reasons stopped me from doing that, first of all it won't be in the good spirit of opensource contribution and the motive of Hacktoberfest will not be successful, secondly they have some rules to promote others contributions into good projects and violating those could ban you indefinitely🤔. 

So I looked out for quality projects which might be easy to contribute in and also I do something which I haven't done till now, you know to learn more. Finding quality projects can be a challenging task as well ..... but, ok we were done.

## Outcomes
I interacted with some awesome people🤝 during the whole month of October. I had a look at some projects and figured out what we can do better and made a healthy relationship with maintainers. Learned a lot about how to use different tech and became very comfortable with it overtime. 
During this I also discovered my hidden skill to teach others, so as recommended by a few I might start a channel on that🤙.
Next time do take part in these kinds of events and lets start becoming more active in the community💪.

## Word of Caution
Read the FAQs first!!!!!
Project alert!
Tags: python, programming, opensource, github
Published: 2021-11-14 06:00:21

New project made by Jothin-kumar! Link: https://github.com/Jothin-kumar/virtual-operating-system

Fork it on GitHub (don't forget to like).

Let's see what you are going to do with it.

Can you make something amazing?

What are some of your best ideas for a Virtual OS?

I can't wait to see your work!

You better start!
https://github.com/Jothin-kumar/virtual-operating-system
Decode Singleton Pattern
Tags: pattern, java, design, architecture
Published: 2021-11-14 05:57:15


###When to use
* Application needs “only one instance” of a class.
* To have complete control over the instance creation.

---------
###Intent
Ensure a class has only one instance, and provide a global point of access to it.

---------
###Components
* Singleton Class

---------
###Structure
![Singleton](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tg5069z3235ai6k110u2.png)

---------
###Implementation
Create a Singleton class with a static instance and a private constructor. Provide a static method to allow access to this 'only' instance.

1 Create a Singleton Class <Singleton.java>

```
package com.gaurav.singleton;

public class Singleton {

  /* the singleton obj */
  private static Singleton instance = null;

  /* private constructor to avoid
     external instantiation of this class */
  private Singleton() {
  }

  /* method to get the singleton obj */
  public static Singleton getInstance() {
    if (instance == null) {
      synchronized (Singleton.class) {
        /* double checked locking */
        if (instance == null) {
          instance = new Singleton();
        }
      }
    }
    return instance;
  }

  public void printObj() {
    System.out.println("Unique Id of the obj: "
    + System.identityHashCode(this));
  }

}
```
2 Access the singleton instance <Demo.java>

```
class Demo {

  public static void main(String[] args) {
    Singleton obj1 = Singleton.getInstance();
    obj1.printObj();
    Singleton obj2 = Singleton.getInstance();
    obj2.printObj();
  }

}
```

####Output
```
Unique Id of the obj: 1916222108
Unique Id of the obj: 1916222108
```

---------
###Benefits
* Controlled instantiation
* Supports both EAGER and LAZY initializations
* Singletons can be converted to Multitons (to support limited number of instances identified by keys)

---------
###Drawbacks
* Singleton is often seen as 'not-so-good' design as it resembles global variables
* Special handling is required if the Singleton object needs to be deleted
* Singletons that maintain global state may cause issues

---------
###Real World Examples
* The Office of the President (there can be only one President at any given time)

###Software Examples
* Logger classes
* Window Manager
* Printer Spooler

####Java SDK Examples
java.lang.Runtime.getRuntime( )
java.awt.Toolkit.getDefaultToolkit( )
java.awt.Desktop.getDesktop( )
java.util.logging.LogManager.getLogManager( )
java.lang.System#getSecurityManager( )

---------
Want to discuss more 
[Lets have a Coffee](https://www.buymeacoffee.com/gauravratnawat)
Sea Property
Published: 2021-11-14 05:32:35

Sea Property  
SeaProperty.vn là nền tảng review và cập nhật thông tin dự án bất động sản hàng đầu Việt Nam. Tại Sea Property, chúng tôi sử dụng công nghệ giúp quá trình mua bán được dễ dàng hơn, đáp ứng được nhu cầu đưa góc nhìn chính xác giúp khách hàng có thêm thông tin.
Địa chỉ: 71/3 Đường Nguyễn Văn Thương, P.25, Q.Bình Thạnh, Tp. HCM
Phone: 0908982299
Email: seaproperty.vn@gmail.com
Tags: #SeaProperty.vn #SeaProperty #bietthubien #canho #condotel #canhochungcu #nhàphốbiệtthự, #PhuQuoc #HoTram #NhaTrang #DaNang
Website: https://seaproperty.vn/
Biệt Thự Biển: https://seaproperty.vn/biet-thu-bien
Đất Nền: https://seaproperty.vn/dat-nen
Căn Hộ Chung Cư: https://seaproperty.vn/can-ho
Nhà Phố Biệt Thự: https://seaproperty.vn/nha-pho-biet-thu
Condotel: https://seaproperty.vn/condotel
Google Site: https://sites.google.com/view/sea-property/seaproperty
Social:
https://www.mojomarketplace.com/user/seaproperty-k8yVKryZid
https://padlet.com/seaproperty1/seaproperty
https://www.spreaker.com/user/15651432
https://www.figma.com/@seaproperty
https://network-marketing.ning.com/members/SeaProperty
My first hello-world article
Published: 2021-11-14 04:07:51

---
title: My first hello-world article
published: true
description: This is just a hello-world in Markdown, mainly for testing dev.to capabilities.
tags: 
//cover_image: https://direct_url_to_image.jpg
---

## Release Early, Release Often

Or so they say. So here it is an early release!

Regular paragraph.

```ruby
# frozen_string_literal: true

##
# The purpose of this class is to print the folkloric message.
class HelloSayer
  def say
    "Hello World!"
  end
end
```

---

(horizontal rule?)

---

## Second level title

### Third level title

#### Fourth level

##### Fifth level

###### Sixth level


## ToDo list

- [x] Make a todo list
- [x] Check the 2 first items
- [ ] Don't procrastinate
- [x] Realize that todo lists do not render like in github

## Testing liquid tags

{% user jess %}
CS 102 Final - Movie Recommender
Published: 2021-11-14 02:50:57

Hey fellow coders,

So this is my second project. I created a Movie Recommender for my CS 102 final where I used a linked list data structure, as well as linear search and pattern search algorithms.

https://github.com/JayV-XCVI/CS102_Movie_Recommender

Any tips or points of focus would be much appreciated!

Happy coding,

-Joseph
Day 8 of #100daysofcode: Continued Work
Tags: 100daysofcode, react, python, beginners
Published: 2021-11-14 00:35:57


Not quite as much work done today as I would like. School and life continue to eat more time than I expect them to.

## Today
I started today with continuing my design work on my project, but I quickly got caught up in learning more about (and messing around with) React states and how to use them in my app. As is usual for my learning process, I spent a lot of today playing around with state and learning ways to *not* do things. 

## Tomorrow
I expect tomorrow I will still be thinking about state. If that is the case, I will probably sit down and try to properly learn state using tutorials and documentation. Outside of that, I am continuing to polish my project. I'm aiming to be done with this project by Friday so that I can move on to bigger and better things. Every problem I solve in this project is a problem I'll be better equipped to solve in my next project, so I'm not too worried.

## What I'm Struggling on
Frequently I am running into cases in React and JS where I *think* I know how something works because of my experience in previous languages. This keeps biting me in the butt as I don't even realize that I'm wrong about something. This is a scenario where I think having a more traditional learning path from the ground up on JS would be very helpful. 

I'm thinking that I may complete a few lessons a day on FreeCodeCamp in their JS course or their React course. Given that a lot of the problems I'm running into would be better solved if I knew more about JS in general, I'm leaning towards starting with that course first. 
 
### Resources
[10 modern layout in 1 line of CSS - Google Chrome Developers](https://www.youtube.com/watch?v=qm0IfG1GyZU)
[JS Course - FreeCodeCamp](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/)
I'm writing Publishing Python Packages
Tags: python, book, showdev, discuss
Published: 2021-11-14 01:37:35

---
title: I'm writing Publishing Python Packages
published: true
description: Publishing Python Packages is a new book from Manning to learn the latest standards for creating Python packages and maximizing your productivity through tooling and automation.
tags: python, book, showdev, discuss
---

This is my first DEV post in quite a while. I've been really busy. In 2020 in the midst of the pandemic we purchased a home across the state, renovated it, and moved. Not long after getting settled into that, I jumped into writing another book.

Over the last several years at [ITHAKA](https://www.ithaka.org) I've focused on creating modular code shared across our department and platform, maintaining a few dozen Python and JavaScript packages. I've also come to love the open source community—though I don't contribute nearly as often as I'd like—and thinking about ways to solve some the issues project maintainers face in their day-to-day work.

I hope that my new book, [_Publishing Python Packages_](https://pypackages.com), can make even a small impact in helping project maintainers be more productive through tooling and automation, so they can continue focusing on their projects and communities.

[![Publishing Python Packages by Dane Hillard for Manning Books](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xvdhl0l6pzr5h1d7wz32.jpg)](https://pypackages.com)

[Manning](https://manning.com) has made a **50% discount** code for the book available, and if you've been thinking about grabbing a copy or know someone who might benefit from it, I hope you'll be able to take advantage of this price reduction while it's in early access. Use the code `mlhillard350` at checkout.

I'm happy to answer any questions I can about the book, the publishing process, or my writing workflow as well! Hope to hear from you ☺️