teleren/devto huggingface dataset:
Cmd and Entrypoint in Docker container.
Tags: docker, container
Published: 2020-01-19 11:08:25

For a long time, I can not tell the exact difference between `CMD` and `ENTRYPOINT` in Dockerfile.
Until I have a chance to take a look for the definition.

I will explain this base on few different scenarios.

---

Let's say If I have a Ubuntu image-based container named ubuntu-sleeper to execute the `sleep` for 5 seconds. And the Dockerfile showed as below.

```
FROM ubuntu

CMD sleep 5
```

When I type `docker run ubuntu-sleeper`, container will automatically execute the `sleep 5` to sleep 5 seconds.

But what if I like to customize the second to sleep?

As we know, we can overwrite the default CMD by appending the command after the `docker run`.
For example, `docker run ubuntu-sleeper sleep 10`

But it looks bad, and we like make it look like this.
`docker run ubuntu-sleeper 10`
Which only pass the second argument we need.

To achieve this, we can use **ENTRYPOINT**, to write our dockerfile..
```
FROM ubuntu

ENTRYPOINT ["sleep"]
```

Docker will execute the command in ENTRYPOINT first, then the CMD.
So, when we type `docker run ubuntu-sleeper 10`.
Docker will get the ENTRYPOINT `sleep` and the `10` we passed via run commmad.

But what if I run this container without passing the CMD?
For example, just run `docker run ubuntu-sleeper`.
As we know, this will make container only run `sleep` without given argument. And you will get the error says the operand is missing.

So how do you define the default value for this container?
In this case, You can define ENTRYPOINT and CMD at a same time.
```
FROM ubuntu

ENTRYPOINT ["sleep"]
CMD ["5"]
```
So when you simply run `docker run ubuntu-sleeper`, the container will sleep 5 seconds by default.
And you can change `CMD` value by `docker run ubutnu-sleeper 20`



PS: And you can even change the ENTRYPOINT with `--entrypoint` option in `docker run`.
```
docker run --entrypoint sleep2.0 ubuntu-sleeper 10
```
just an idea ! could i use the devto api to autofollow you (back) ? 
Tags: mashup, api, devto, smn
Published: 2020-01-19 21:40:04

just occurred to be that i could mashup the following 2 posts

* https://dev.to/osde8info/what-are-the-most-important-smns-bmns-for-devs-in-2020-521g
* https://dev.to/healeycodes/dev-article-analysis-2d40

and create an app that used the devto api to autofollow you back on all your SMNs and BMNs ? ive been feeling so guilty about not having time to click followback on all the networks of everyone who has followed me so far
Python: What is a tuple?
Tags: python, beginners, learning, tuple
Published: 2020-01-19 21:25:58

---
title: Python: What is a tuple?
published: true
description: Understanding tuples in Python.
tags: python, beginners, learning, tuple
---

In Python, tuples are immutable data sequences. They are typically used to group related but heterogeneous values.

Say we have several pieces of information&mdash;in a variety of data types&mdash;that together describe a single work of art:

```python
artist = "Louise Nevelson"
title = "Sky Gate, New York"
media = ["wood", "oil paint"]
completed = 1978
```

It may be convenient to group these values together. Since the description of an artwork should never change during our program, an immutable tuple suits our needs perfectly:

```python
artwork = (artist, title, media, completed)
```

Elements in a tuple can be accessed by index:

```
>>> artwork[0]
'Louise Nevelson'
```

But, since tuples are immutable, we cannot change elements by index:

```
>>> art_work[0] = "Ruth Asawa"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
```

For more information on tuples, see the [Python docs](https://docs.python.org/3/library/stdtypes.html#tuple).

---

Was this helpful? Did I save you some time?

## {% cta https://www.adamlombard.com/support-me %} 🫖 Buy Me A Tea! ☕️ {% endcta %}

---

Learn more about [Louise Nevelson](https://en.wikipedia.org/wiki/Louise_Nevelson) and [Ruth Asawa](https://en.wikipedia.org/wiki/Ruth_Asawa).
Developer Problems
Tags: productivity, python, healthydebate
Published: 2020-01-19 21:15:11

###Hello, and Good evening (from my end😏)

My name is Simon Stanley and i am a software developer. I usually have my stress level go up after an intensive coding season and would like to know how you all manage your "dev stress"... thanks.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/h6u8tigvm4dw36c88kxl.jpg)
DynaShoot: dynamic archery target shooting system controlled by raspberry and svelte
Tags: raspberrypi, archery
Published: 2020-01-19 21:11:25

hi,

weekends are great to go for experiments. 

Just wanted to share an experiment combining raspberry and svelte to control servo motors which allow to pilot archery targets. 

Still in very (very) early stage but so fun to be able to merge passions around electronics, web technologies, woodworking and metal working. 

Tested it live with some archer friends and we had a really good time playing with it.

Here are 2 videos which demonstrate the concept: 

First one at home:
{% youtube x6IwifLl6bQ %}

Second one in live conditions with real archers:

{% youtube aT-62KmUrm8 %}

Enjoy your end of weekend
Tic Tac Toe and Endless Loop PTSD
Published: 2020-01-19 20:09:12

I don't think I'll ever play Tic Tac Toe again.

If you're a Flatiron School student, you know a big part of the first module is building a CLI Tic Tac Toe game, piece by piece.

It is from these labs that I have come to learn that when my code is broken, it is almost always broken in the smallest, most difficult to identify way.

Another thing I've come to realize is that I wait too long before asking for help. Flatiron School has a great team of technical coaches who are waiting in the wings most hours of the day to help you out when you get stuck. Learning to code has really taught me to stop being so stubborn and prideful and to ask for help when I need it.

While I was working on this lab, every time I ran the tests or tried to run my code, I would hit an infinite loop so hard it crashed my IDE.

I spent hours poring over my code, doubting myself, thinking that maybe I didn't understand code at all. But then I looked at the code my peers had written and my code didn't look too different. 

Eventually, when I reached out to the technical coach team, we went through my code, method by method, trying to find the issue. All three I worked with said, "It looks right." That was a confidence booster, but when we ran the tests, the loop would happen, and the IDE would crash again.

Eventually, after a couple weeks of being stuck on this lab, a technical coach and I narrowed it down to my play method. While it looked correct, Erika taught me a trick: **If you can narrow your issue down to one method, comment out every line in the method, and add each line back one at a time**--typing the line as a new line, and deleting the old, commented out version. If the code breaks, you know which line is the problem child. If the code doesn't break, and it magically works this time, hey, you have working code now.

I still have no idea what was wrong with my play method. When I added each line in, line by line, re-typing my code in, the loop was magically gone.

I hope this tip helps someone else as much as it helped me! It's still something I do.

One more thing I learned that really helped was learning how to use [pry](https://rubygems.org/gems/pry/versions/0.10.3). If you're a Flatiron Student starting with Ruby, I highly recommend joining a Study Group on how pry works, or pairing with a technical coach to learn about this Ruby gem.

-A

***

**Connect with Me**
[GitHub](https://github.com/helloamandamurphy)
[Intercoastals](https://theintercoastals.com/)
[Instagram](https://www.instagram.com/intercoastals/)
[LinkedIn](https://www.linkedin.com/in/helloamandamurphy)
[Twitter](https://twitter.com/babiescatscode)

***

*Originally published at [A Good Unicorn](http://agoodunicorn.com) on January 2, 2019.*
How to pretend you are an Awesome UX Designer (funny) Part 1
Tags: uxdesigner, ux, funny, jokes
Published: 2020-01-19 19:46:57

This is supposed to be a funny video, I don't want to offend anyone or anything.

Enjoy :)



--
**Thank you for taking the time to watch my video.**

*Would you like to get me a coffee?!☕️
You can do that here → paypal.me/eleftheriabatsou
But If you can’t, that’s ok too 😍.*

It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.
[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/elef_in_tech/)
Is there a risk to relying on external APIs on the JAMstack?
Tags: jamstack, jamuary
Published: 2020-01-19 19:17:35

The A in JAMstack is a powerful feature to building modern websites. They give developers the autonomy to abstract otherwise complex functionality and maintain the dynamism of websites despite a static architecture. Still, relying on third parties to provide critical functionality like authentication and payments is a daunting endeavor. For one, third parties add weight to your site. Whether executed at build time or run time, APIs take time to process and can result in either slower build times or page load times. The added risk to relying heavily on external APIs is the complexity they bring to the build process. Sure, APIs abstract complicated functionality but they also create an added “cognitive overhead” for developers—that is to say the number of logical connections and jumps your brain needs to make to contextualize a particular API is high. Because APIs in the JAMstack are often outsourced, no two APIs operate similarly. As a result, integrating or configuring an API in an existing setup requires substantial code switching and carries the risk of overcomplicating an otherwise lean, straightforward stack.

In spite of the potential risks that APIs bring, the decoupled approach of the JAMstack still reduces the overall burden of maintenance. The move towards an API driven architecture offers flexibility and promises an improved developer experience, but doesn’t make the claim to prevent over-engineering. Instead, the JAMstack approach pushes developers to think critically about their sites, and make conscious decisions on what and how to consume and build. Compared to monolithic setups where developers are stuck with choices that frameworks choose for them, the JAMstack provides developers with a stack that they can choose for themselves from back to front. The JAMstack in all its glory encourages building complexity consciously.

To explore all the services you can use with the JAMstack, check out these resources:

https://serverless.css-tricks.com/services/major
https://www.thenewdynamic.org/
Planck EZ Keyboard: Two minutes of Typing
Tags: watercooler, productivity
Published: 2020-01-19 18:57:07

---
title:Planck EZ Keyboard: Two minutes of Typing
published: true
description: A short video of typing on the Planck EZ Keyboard, showing off layers, lighting, and musical features. 🎶 
tags: watercooler, productivity
---

Here's a quick video of me typing and showing off some of the features of my new keyboard, the [Planck EZ 🎶](https://ergodox-ez.com/pages/planck). If you're interested in my layout, [here's where you can get it](https://configure.ergodox-ez.com/planck-ez/layouts/rPOG9/latest/0). If you have any questions, or if you'd be interested in a more full post, let me know in the comments!

P.S. If you are looking to pick one up yourself, know that the factory takes a break for the lunar new year, so be prepared! And as a bonus, here's the keyboard plugged directly into my phone as I take notes in the car on dev.to!

![Planck Keyboard plugged into phone](https://thepracticaldev.s3.amazonaws.com/i/fzuw3t89z6hpmek0fn2b.jpeg)

-- Ryan
Optimal Strategy for Giving SALARY EXPECTATIONS in Phone Screens (videos)
Tags: salary, tips, career, advice
Published: 2020-01-19 18:39:03

Last week, I shared key phrases that you can use to answer the question, "What's your current salary?" when it is asked early in the application process.

This week, I want to help you answer another application question, "What's your desired salary?"

POST NOTES
☆ Compensation range disclosure laws by state: https://www.hrdive.com/news/salary-history-ban-states-list/516662/

HAVE A CANDIDATE QUESTION YOU WANT US TO ANSWER?
☆ candidateplanet@gmail.com

OTHER WAYS TO CONSUME THIS CONTENT:
☆ Youtube ☆ https://www.youtube.com/channel/UCdvny6qs8e4VUJIG01puw2Q
☆ Newsletter ☆ https://www.dangoormendel.com/blog (sign up at top of blog)
☆ Podcast ☆ https://candidate-planet.simplecast.com
☆ Dev.to ☆ https://dev.to/candidateplanet

MORE ABOUT DANGOORMENDEL:
☆ DangoorMendel ☆ https://www.dangoormendel.com
☆ Speaking and Client Inquiries ☆ hello@dangoormendel.com
☆ Lusen on LinkedIn https://www.linkedin.com/in/lus
☆ Lusen on Twitter ☆ https://twitter.com/staycalmcomic
☆ Adam on LinkedIn ☆ https://www.linkedin.com/in/adamdangoor
☆ Adam on Twitter ☆ https://twitter.com/adamdangoor
How to share styles between Angular Components
Tags: angular, css, typescript
Published: 2020-01-19 18:38:26

Today I'm going to show you different ways to share styles between components in Angular, and I guess some techniques can apply to other frameworks as well.

# The scenario

I'm currently doing (another) login page. This time, I wanted to show a message before the user signs up, and give him a choice between login and register. So, with this, I have 3 components. And I want those 3 components to share the same styles.

# With a CSS class

Angular usually has a style file that allows you to apply classes globally in your application. You can create a class there and apply it to your components, and that you can do it in two ways, using `host` property, and using `HostBinding` decorator.

- Declaring the CSS class

  ```scss
  // In your style file, usually styles.scss
  .auth {
    // The styles you want to share
  }
  ```

- Using the CSS class with host

  ```ts
  @Component({
    // Stuff you know...
    host: {
      class: "auth"
    }
  })
  class WelcomeComponent {}
  ```

- Using the CSS class with HostBinding

  ```ts
  @Component({
    // Stuff you know...
  })
  class WelcomeComponent {
    @HostBinding("class")
    public readonly classList = "auth";
  }
  ```

Whatever version will do the same, but I prefer the first for static values and the second for dynamic values.

# Using a shared component style file

When you are using the style file from the component you can do interesting things like `:host` and `::ng-deep`, that may be valuable to you. When you decorate a file and use the `styleUrls` property you sure have noticed that it should be an array of values. And you can take advantage of that and use another style file with the common styles and it will be applied the same way the component style is.

```ts
@Component({
  // Stuff you know...
  styleUrls: ["./welcome.component.scss", "../shared.scss"]
})
class WelcomeComponent {}
```

Keep in mind that the URL should be relative to the component folder.

# Using SCSS `@import`

This is a classic one, but we may end up forgetting that Angular does nothing special with SCSS files, and we can even use Webpack features to import from `src` folder. Here is how you can do it.

- Declaring the mixin

  ```scss
  // src/styles/_auth.scss
  @mixin auth {
    :host {
      // The styles you want to share
    }
  }
  ```

- Using the mixin

  ```scss
  // src/../welcome.component.scss
  @import "src/styles/auth";

  @include auth;
  ```


# That's all folks!

You now have three ways of sharing styles in your app. Do you think you are going to use one of these? Do you have another way to share styles between your components? Let me know in the comments. Of course, you could always create another component just to apply styles, but I think sometimes CSS is just what you need.

PS: For what's worth, I end up using the latest one.
6 Things I Learned From Migrating From jQuery to React
Tags: react, javascript
Published: 2020-01-19 18:22:21

I'm creating a commenting platform called [Hyvor Talk](https://talk.hyvor.com). I previously used [Jquery](https://jquery.com/) and now [React](https://reactjs.org/) for the moderation console. Here's what I learned by migrating from jQuery to React.

> BTW, If you like to know, Hyvor is the network I'm building, and Hyvor Talk is one product of it. I developed the whole website alone (Yep, front-end, back-end, DevOps, designing, and everything except graphic designing).

Lessons Learned:

1. **MOST IMPORTANT ONE**: It's time-consuming. If you are hiring people just to migrate from jQuery to React, be cautious! It requires a **lot of time and effort** than you think.

2. Once you migrate to React, the next part of the development process is easier than in jQuery.

3. Routing is super easy and efficient in React. `react-router` is super cool. Its latest version perfectly goes with "thinking in react".

4. The codebase will look more arranged. The main reason for this is JSX.
   
```js
const div = $("<div>").addClass("container").appendTo(somewhere);
```
```js
<div class="container"></div>
```
   
  Which one is more clear? Obviously the second one, especially when you have nested elements. You can also easily break things into Components in React.

=> 5. Updating or adding features is easier in React.

=> 6. The most disgusting thing for me when using jQuery (or vanilla JS) is having to update elements each time when the data changes.

```js
function changeName(val) {
   var data.name = val;
   dataElem.html(val); // <- I hate this (updating DOM inside data handling functions?)
}
```

In React,

```js
changeName(val) {
   this.setState({name: val});
}
```

All you have to do is to use the states correctly.

## Final Thoughts...

Honestly, I **feel** much better and organized when using React compared to jQuery. And, I have continued using React for the other parts of the website. However, as I mentioned earlier, migrate from jQuery to React if you **really need** to do it. If you have a large app, it would take months for the task (And, another months for bug fixing 🤗).

This is my personal experience. You **should** search the internet before making the decision. [Here's](https://programmingwithmosh.com/javascript/react-vs-jquery-how-they-compare/) a good comparison I have seen. Make sure to discuss with the development team about the impacts of the decision before migrating.

One thing I can guarantee is that you will have a better sleep **after** migrating to React 👀.

Thanks for reading.

PS: Like to try our [comments platform](https://talk.hyvor.com) on your website? It's free. Give it a try (before your competitor does 😊)
TypeScript Full Stack project (Part II) - Client-side
Tags: angular, typescript
Published: 2020-01-19 18:02:22

> [Original Post](https://blog.yggdrasilts.com/typescript-full-stack-project-part-ii-client-side/)

[In the previous post](https://dev.to/yggdrasilts/typescript-full-stack-project-part-i-2l9l), I told about the project structure. Now, we are going to create the **_client-side_**.

## Client-Side

Let's go to create the [Angular](https://angular.io/) application using its [CLI](https://cli.angular.io/) and the following options:

-   **name**: *issues-ui*. Because the angular application will be the
    client-side project.
-   **directory**: *client*. I want a container folder different as the
    client-side project name.
-   **enableIvy**: *true*. I want to use [Angular
    Ivy](https://angular.io/guide/ivy) for compilation.
-   **routing**: *true*. The project will have routing to manage the
    page flow.
-   **style**: *scss*. And finally, I prefer to use scss to manage
    styles.

```bash
odin@asgard:~/issues $ ng new issues-ui --directory=client --enableIvy=true --routing=true --style=scss
```

The new folder structure will contain a new folder *client*, with the
angular application.

```bash
issues    
  ├── client    
  ├── .git    
  ├── .gitignore    
  └── package.json
```

To start the client from the parent folder, ***issues***, we need to
modify the *package.json* adding a new *start:ui* script.

```json
{    
  ...    
  "scripts": {
    "start:ui": "npm start --prefix ./client"    
  },
  ...
}
```

Now we are able to start the angular application:

```bash
odin@asgard:~/issues $ npm run start:ui
```

![http//blogyggdrasiltscom/content/images/2019/11/image1png](http://blog.yggdrasilts.com/content/images/2019/11/image-1.png)

Once all is working, we commit all the changes to save the advance.

```shell
odin@asgard:~/issues $ git add .odin@asgard:~/issues $ git commit -m "UI working"
```

Because of the purpose of this post is not to build an angular application, you can get the client-side code from this [repository](https://github.com/yggdrasilts/typescript-full-stack-project/tree/master/client).
Setting Up Your React Project
Tags: javascript, react
Published: 2020-01-19 17:57:18


In the section, we are going to see the necessary things to make sure before you start a react project. We are not going to do any changes in react, instead, we will focus on stuff that needs to be done before that.

You can consider this section as a to-do list for setting up a react project.

> We are going to use [VS Code](https://code.visualstudio.com/) in our case

## What is React?

[React](https://reactjs.org/) is an open-source JavaScript library for building user interfaces which were created by Jordan Walk and maintained by Facebook and a community of individual developers and companies.

## Why Create React App?

[Create React App](https://create-react-app.dev/) (CRA) is an officially and easiest way to get started building React applications.

### Quick Start

```bash
npx create-react-app demo
code demo
```

### ESLint

[ESLint](https://eslint.org/) is a static code analysis tool for identifying problematic patterns found in JavaScript code.

Install [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) in your code editor.

Create a `.eslintrc` file in the root directory of the project.

```json
{
  "extends": ["react-app", "plugin:jsx-a11y/strict"]
}
```

### EditorConfig

#### Why EditorConfig?

[EditorConfig](https://editorconfig.org/) helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.

Install [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) in your code editor.

Create a `.editorconfig` file in the root directory of the project.

```javascript
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[COMMIT_EDITMSG]
max_line_length = 0
```

### Prettier

[Prettier](https://prettier.io/) is a code formatter.

Add [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) to your editor.

Create a `.prettierrc` file in the root directory of the project.

```json
{
  "tabWidth": 2,
  "semi": true,
  "singleQuote": true,
  "jsxSingleQuote": true
}
```

> Add or remove rules according to your convenience

Go to [VS Code Setting](https://code.visualstudio.com/docs/getstarted/settings)

Search for `"Editor: Formate On Save"` and make sure you check the box to formate the code when you save the file.

If you are in the middle of the project and the codes are not formatted well you can do then as well.

```bash
npx prettier --write "src/**/*.{js,jsx,json,css,scss,md}"
```

### Checklist

1. ESLint
2. EditorConfig
3. Prettier

<!-- Something else needs to be added, we can discuss that in [Twitter](/) -->

### Resources

1. [web.dev](https://web.dev/accessibility-auditing-react/#use-eslint-plugin-jsx-a11y)
2. [create-react-app.dev](https://create-react-app.dev/docs/setting-up-your-editor/)
3. [react github repo](https://github.com/facebook/react/blob/master/.editorconfig)

Thanks for reading!