teleren/devto huggingface dataset:
How to install Docker Compose on Ubuntu 18.04
Tags: docker, ubuntu
Published: 2021-07-26 02:54:08

---
title: How to install Docker Compose on Ubuntu 18.04
published: true
description: Docker Compose, Ubuntu
tags: #Docker, #Ubuntu
cover_image: https://res.cloudinary.com/dvehkdedj/image/upload/v1627267840/docker-compose_uuazqm.png
---

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. read more for detail [Docker Compose Documentation](https://docs.docker.com/compose/)

In this article, I will introduce setup Docker Compose on Ubuntu 18.04 or later version.

### 1. Install Docker Compose on Ubuntu Repository

Ubuntu Repository will provide stable version and update for automationally

`sudo apt update`

Then open your terminal and input command:

`sudo apt install docker-compose`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627194560795/gEtDT9sYi.png)

It is take few minutes for downloading and installation.
To verify version installation successfully on your system, by command:

`docker-compose version`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627194862898/Br2CdproE.png)

### 2. Install Docker Compose on Ubuntu by GitHub Repository

GitHub is a inventory contain a lot of repository from organization, developer, etc. Contribute to the open source community.

Install and updated version of Docker utility, copy the following command:

`sudo wget –O /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627195379456/dloXW8o9Y.png)

Give the command assign permission to executable file:

`sudo chmod +x /usr/local/bin/docker-compose`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627195537355/QlDE94EWE.png)

Then permission will be applied to the executable file after this command
To verify version installation successfully on your system, by command:

`docker-compose version`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1627194862898/Br2CdproE.png)

### How to uninstall Docker Compose on Ubuntu 18.04

The file Docker Compose can be deleted from your system when we remove it is binary

Given command to remove it:

`sudo rm /usr/local/bin/docker-compose`

### Conclusion

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. read more for detail [Docker Compose Documentation](https://docs.docker.com/compose/)

📚 Recommended Books

Clean Code:[Book](https://amzn.to/2UGDPlX)

HTTP: [The Definitive Guide ](https://amzn.to/2JDVi8s)

Clean architecture: [Book](https://amzn.to/2xOBNXW)

📱 Social Media

Blog: [KhanhNHB Tech](https://hashnode.com/@KhanhHoang)

Twitter: [KhanhNHB](https://twitter.com/khanh_nhb)

Youtube: [KhanhNHB Tech](https://www.youtube.com/channel/UCp_M_ymiNsbu0_Hs1mIgSZg)

GitHub: [KhanhNHB](https://github.com/KhanhNHB)

Email: khanhnhbse@gmail.com
The Posh Show
Tags: gamedev, gamejam, unity3d, gamedesign
Published: 2021-07-26 02:37:07

Last week, I participated in two game jams: The [Pompous Trash Jam](https://itch.io/jam/pompous-trash) and the first [Lospec Jam](https://itch.io/jam/lospec-jam-1)!

I combined the themes and restrictions from both jams to create this silly WarioWare-style game about posh etiquette.

![The Posh Show](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ejhpe7zmsax6bnwsnhq8.png)

[Play the game for free on itch.io!](https://andrewdavidj.itch.io/posh)

This year, I've been taking on the one-game-a-month challenge and this game counts as my entry for July! The game jams have been keeping me motivated and help me come up with new ideas each month.

I've also been producing devlog videos to help keep me accountable! You can watch the ones I've produced so far on [my YouTube channel!](https://youtube.com/andrewdavidj)

Let me know what you think of my game!
Tricks to learn Python
Tags: python, tutorial
Published: 2021-07-26 02:19:34

Hey there, I am Piyush Duggal and I want to share some tips/tricks to learn Python easily(remember: Nothing is easy)

1. LEARN BY DOING - What i mean that don't just watch/read Tutorials on Programming, it applies on all language, don't just watch, do what you learning, its not the medical class where you need a "patient" to do experiments on it, NO, you only need a PC/MAC, or even a PHONE!!! yes PHONE, I am still do programming on my phone when my laptop is not around.

2. CREAT A FREQUENCY - Means, do frequently! because its not as easy as people say/think because its not easy to learn all the operation of a list(datatype in python) in one night/day, do it frequently.

3. DRY - DRY stands for DONT REPEAT YOURSELF, you might have heard this, if you do same thing again and again it will not gonna give you any kind of profit/progress so, DRY!

thats for this post guys
happg programming.
✨🥞 Rust Visualized: The Stack, the Heap, and Pointers
Tags: rust, beginners, computerscience, programming
Published: 2021-07-26 02:14:12

The part of your operating system that allocates memory for a program as well as loading its code and data into memory is called a __loader__. 

The loader defines four different areas of memory for a program: _code_, _static_, _stack_, and _heap_.

The static segment contains global variables, the code segment contains machine code, and the stack segment contains local variables that are defined inside functions. 

![code snippet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/htsmaows5pttp2mr9lrp.png)
 
When the function `foo` goes on the call stack, its stack frame must store `foo`'s arguments, local variables, and return address. 
 

The memory layout of a stack frame is fixed, so the size of variables needs to be known at compile time. The size of variables on the stack cannot grow or shrink. 


![memory structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzvuitthesm20123ejb2.png)
 

Stacks are a simple but common data structure. Like a pile of pancakes, the last pancakes that go on a stack are the first pancakes to leave the stack. When you add to a stack, you always add to the top.




 ![stack frames](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vjsnto1av1q9kacbf7e8.gif)
 
The call stack consists of stack frames, which contain arguments, local variables, and return addresses. Let's look inside the stack frame on the call stack when `main` is called.

![1o](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rm35u7t5w1cbrkgesbgc.png)
 
 

If we look inside the stack frames on the call stack when `foo(y)` is called, we notice that the arguments, local variables, and variable addresses of `foo` have been added to the top of the stack. 

![2o](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n8zwdgb0atp0tucqh852.png)
 
 
The heap is dedicated to variables whose size is not known at compile time. You have a lot more freedom with variables stored on the heap, but you lose speed. You can control the lifetime of variables on the heap as well as assign them an arbitrary size. 

In Rust, you can allocate memory on the heap using types like [Box](https://doc.rust-lang.org/rust-by-example/std/box.html) or [Vec](https://doc.rust-lang.org/book/vectors.html). 

A `Box<T>` stores a pointer to heap data on the stack. The type of this Box is type `T`.

Pointers are an important concept, because we often reference variables in Rust using `&` syntax. When you reference a variable, you are pointing to that variable's location in memory.


![borrowing in rust](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n90xu57sqmzka0gx9ipt.gif)
Tower Of God Terminal Ask Game and Profile Generator
Tags: python, firstproject, codenewbie
Published: 2021-07-26 01:56:18

Created my first ever Python Terminal game from scratch. In this game, a user is asked about the hit Webtoon/Anime series Tower of God. After answering a couple of questions, a profile type is generated and presented to the user.

Here is a link to my GitHub for the project: https://github.com/H3R01A/ToGAsk
Integrate ReactJS with existing Visual studio web application
Tags: react
Published: 2021-07-26 01:22:36

Hello everyone, I am new to ReactJS. So please help me out.  I have an existing web application created in Visual studio 2017. It's not MVC project. I have found this react calendar

https://github.com/hiramzamorano/react-big-scheduler

And I would like to use it with my project. But I am not sure how to reference the library. Firstly, this link tells me how to add React library to my page

https://reactjs.org/docs/add-react-to-a-website.html#add-jsx-to-a-project

Now I am stuck when I keep reading the calendar documentation about running:

npm install scheduler-react --save

After running the command, literally there are hundreds of files being saved into node_module folder. How could I reference them all? A lot of tutorial online for React and Visual Studio is mostly related to MVC project. I could not find much information dealing with web application. With angularJS and jQuery, I can reference the library easily by dropping a link referencing the library on my web page. I am not sure what to do with this scheduler-react. Thanks
LeetCode 11. Container With Most Water (javascript solution)

Tags: javascript, algorithms
Published: 2021-07-26 00:40:15

###Description:
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the container contains the most water.

Notice that you may not slant the container.

###Solution:
Time Complexity : O(n)
Space Complexity: O(1)

```javascript
// 2 pointers
var maxArea = function(height) {
    // Max amountof water
    let max = 0
    // Pointer to move possible heights
    let left = 0
    let right = height.length-1
    // Use 2 pointers to find the max area
    while(left < right) {
        // Current area
        const area = Math.min(height[left], height[right]) * (right - left)
        // Check if current area is greater than previous max
        max = Math.max(max, area)
        // Move the pointer that has the lowest height
        if(height[left]>height[right]) {
            right--
        } else {
            left++
        }
    }
    return max
}
```
Consistency is the key
Published: 2021-07-26 00:01:51

This past week has been great to me in regards to coding. The reason being is because not only have I been learning a lot, but I felt the results of all the work that I have been putting in.

My goal is to get a job as a blockchain developer and as I have been working towards this goal, in the beginning it did not feel like I was getting anywhere. I just felt that I had all of this stuff to learn and I was drowning in it. Anyone who is involved in this space knows that you have a ton to learn and new protocols are created all the time. Honestly, I love that the technology is fast paced, but when you are learning to be developer it is a lot of information to take in.

This past week was special because things really are clicking. I have read blog post and tweets about this feeling, but to actually feel it is amazing. Errors that pop up are no longer feeling super foreign. I am understanding the solidity programming language a lot better. It is true being consistent is the key. **Having a plan and sticking to it produces results.** 

**Here are some tips if you would like to get better as a developer:**

 - Create a schedule for yourself and stick to it
 - Try to code everyday. Even the days when you get stuck. If you are stuck look up the error on google, reach out to the community. Just do not give up.
 - Document certain processes while you code
 - Join a community 
 - Its okay to take breaks. A fresh pair of eyes is better than drained ones.
 - Build things!!! This really helps you understand things.
 - Have fun!

That is all I have. Have a great day!

Happy coding!
How to add a new user in Linux?
Tags: resource
Published: 2021-07-26 00:00:00

---
  title: How to add a new user in Linux?
  published: true
  tags: Resource
  date: Mon Jul 26 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/add-a-new-user-linux
  cover_image: https://melvingeorge.me/_next/static/images/main-a82662a0ed3c3e72f75c95519f5ce65a.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/add-a-new-user-linux)
  
To add a new user in Linux, you can use the `adduser` command followed by a space and your name for the user in Linux.

For example, let's say you want to create a new user called `john`, you can use the `adduser` command like this,

```bash
# Add a new user
sudo adduser john
```

- Sometimes you may need to use the `sudo` command before the `adduser` command to obtain the correct privileges to execute the command.

After executing the `adduser` command, you may need to add a password for the user you just created, to do that see [How to create a password for a user in Linux?](https://melvingeorge.me/blog/add-change-password-user-linux).

Try executing the above command in this [online terminal](https://linuxcontainers.org/lxd/try-it/) to see the result.

### Feel free to share if you found this useful 😃.

---
When is a shortcut appropriate?
Tags: programming, shortcuts, readability
Published: 2021-07-27 11:20:53

---
title: When is a shortcut appropriate?
published: true
date: 2021-07-26 00:00:00 UTC
tags: programming,shortcuts,readability
canonical_url: https://jhall.io/archive/2021/07/26/when-is-a-shortcut-appropriate/
---

Yesterday I saw this “pro” tip on LinkedIn:

> In JavaScript, instead of `Math.floor` use `~~`.

Fortunately, the majority of commentors on this “tip” pointed out that it would hurt readability.

A few brave souls tried to defend this syntactic sugar. I want to break down what I see as the pros and cons of shortcuts like this, to see if there are situations when it makes sense.

Reasons to use short cuts in code:

- It requires less typing<sup>1</sup>.
- Each use saves (up to<sup>2</sup>) 8 bytes on disk, in memory or over the network.
- Some shortcuts improve performance.<sup>3</sup>
- Shortcuts may make you feel more “advanced” as a programmer.

And in contrast, reasons not to use short cuts in code:

- Fewer people will understand the code, as only those who know the shortcuts can read it.
- Even for those who understand the shortcuts, it often increases the cognitive load of reading code.
- Many shortcuts make searching the code harder.

And a bonus just for this situation:

- `~~` isn’t actually equivalent to `Math.floor`. I’ll let [StackOverflow explain](https://stackoverflow.com/a/4055675/13860).

So when do the pros outweigh the cons?

In my personal opinion, the only time less typing is more important than readability is on the command line. I.e. when typing bash commands that nobody else will ever read.

As soon as I’m writing a script or a program, future readability (even by me) wins over keystroke count by a mile.

In the case of performance-enhancing shortcuts, I use those only sparingly, in areas of code that are truly performance critical. And in such cases, I probably use a comment to explain why I chose a less readable form in that instance.

> “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”  
> — Martin Fowler

* * *

<sup>1</sup>Although auto-complete in most IDEs can mitigate or entirely eliminate this benefit.  
<sup>2</sup>In reality the savings are likely to be less, or nothing, with the use of on-disk and over-the-wire encryption.  
<sup>3</sup>But this one does not

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Parte I - O alicerce do Javascript
Tags: javascript, beginners
Published: 2021-07-25 23:55:56

## O Alicerce

O alicerce de Javascript são:

## Variáveis:

```javascript
let endereco = 'Rua dos Bobos, nº 0';
const nossoPlaneta = "Terra";
```
## Tipos de Dados:

```javascript
string, number, boolean, array, objeto
```

## Operadores aritméticos, comparação e lógicos

```javascript
//Artiméticos:
+, -, *, %, **, ++, --

//comparação
==, !=, ===, !==, >, <, >=, <=

//lógicos
&&, ||, !
```

## Parte I.0
Nessa primeira parte iremos falar sobre variáveis 

### O que são variáveis

Para guardar e devolver valores em Javascript usamos `variáveis`.
Exemplo:

```Javascript
let city = "São Paulo"
```
Ao usarmos a palavra  `let` indica que iremos definir uma variável, seguida pelo nome da variável, no nosso exemplo `city` e atribuimos um valor de `São Paulo`.

Também podemos instanciar uma variável e depois atribuirmos um valor:
```Javascript
let city
city = "São Paulo";
```


#### Tipos de variáveis
As variávies em Javascript são: `let`, `var` e `const`.

Iniciante iremos usar `let` e `const`
- `let` e `var` são variáveis que podem receber um valor e depois podemos atribuir outro valor para a mesma variável.
- `const` são variáveis que não podemos atribuir outro valor. Ou seja seu valor não pode ser alterado.

```Javascript
let city = "São Paulo"
console.log(city)

city = "Fortaleza"
console.log(city)

const cpf = "000.111.222-33"
console.log(cpf)

cpf = "444.555.666-77"
console.log(cpf)
```
Saída
```Javascript
TypeError: invalid assignment to const 'cpf'

São Paulo
Fortaleza
000.111.222-33
```

## Exercício
- Crie uma `variável` que recebe o valor recebido de `prompt` e depois exiba o valor da variável no `console.log()`
- Crie uma `variável` que recebe o valor de pi (valor não alterado) e depois tente alterar o valor e veja o que acontece.

Para resolver o exercício clique no arquivo `script.js` se você não souber como fazer ou quiser visualizar como eu fiz, clique no arquivo `resposta.js`

[Exercício ParteI](https://replit.com/@RadhaRay/IniciandoJS-ParteI#script.js)
Post #4: Graphical User Interface
Tags: python, javascript, opensource, gsoc
Published: 2021-07-25 23:30:01

Hello everyone! this is the 4th post of my blog post series to the GSOC internship, you can check out all previous if you want to know more about it :D

At this opportunity, I was working on refactoring the graphical user interface lesson, this lesson in the original course was created using the library to create GUIs [tkinter](https://docs.python.org/3/library/tkinter.html) but now I refactored using Brython. 

In order to make this change, I used Brython's widgets to create [dialogs](https://brython.info/static_doc/en/widgets-dialog.html). This was the way that I found to simulate the behavior of the tkinter library. The result is quite similar, below is a screenshot of the result.

![example dialog](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rwer2mulrde2n5i2tj28.png)

These kinds of dialogs are created using the syntax of Brython and translated to HTML internally using javascript (without use javascript itself), and also you can put any element HTML inside using the same syntaxis, like buttons, input fields (any type), and so on. 

I have done a [PR](https://github.com/PyAr/PyZombis/pull/139) that is waiting for my mentors' review, and in the meantime, I am going to work to make reviews of peers' PR and after that, I am going to work in the Model View Controller lesson, which is very important in the second milestone of my internship, so keep going.

<img src="https://media.giphy.com/media/LOQyoLIojnizS949is/giphy.gif" alt="keep going meme"/>
🌙 Moon - Vue 3 component library starter [Vite]
Tags: vue
Published: 2021-07-25 21:58:39

---
title: 🌙 Moon - Vue 3 component library starter [Vite]
published: true
description: A small component library that can be used as a starter for your own library! Smallest configuration possible + powered by Vite ⚡
tags: vue
//cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qyxriablq3z40p03e5g.PNG
---

![Moon component library homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qyxriablq3z40p03e5g.PNG)

Hello Dev.to community 👋

Today I wanted to share with you my latest side-project, a Vue 3 component library powered by Vite. 

As some of you might know Vue 3 is out and it's doing a great job offering a more lightweight alternative to React. I decided to dig into it only to find that most resources on the web are still talking about Vue 2.

Having had to work on a component library at my job (using Vue 2) I decided to try and create one from scratch using the latest tech avaliable for Vue 3.

My goal was to provide a perfectionist's dream setup with the fewest dependencies possible but including those that are really valuable for development.

After researching about the best way to achieve this goal I settled with [Vite](https://vitejs.dev/).

Using Vite's library mode and VitePress (a Vite powered VuePress) I created a low config component library with documentation included. I called it [🌙 Moon](https://moon.ulissesferreira.dev/). I believe my setup is easy to replicate and could provide value for others trying to create a component library for Vue 3. The fact that Vite uses [esbuild](https://esbuild.github.io/) also provides a great developer experience with blazing fast build speeds.

Currently the component library includes the following utilities:
1. ES Modules + UMD build
2. ESLint + Prettier setup with individual commands
3. [rollup-plugin-visualizer](https://www.npmjs.com/package/rollup-plugin-visualizer) that allows you to check your bundle size breakdown
4. Blazing fast build speed.
5. Least amount of config possible

There are 13 components available and I intend to add some more that I feel are essential to most interfaces (like Tabs and Selects). These components were built with accessibility in mind, use as little JS as possible and try to keep the HTML markup as light as possible as well.

I have already identified some possible improvements but I haven't had much time to work on them. Even though it's still a work in progress I am sure it will be of help for those researching about this topic.

Feel free to fork it or take a look under the hood and get some inspiration for your own projects

https://github.com/ulissesferreira/moon