teleren/devto huggingface dataset:
Getting Started with Docker
Tags: docker, devops, containerization
Published: 2020-11-29 08:40:59

###Introduction
***
Docker is a set of tools and products that deliver software packages called **containers**.Docker provides the plateform to develop applications in an isolated bundles/packages making the application more secure and portable.
It is a containerization plateform that enables you to build,test and deploy software solutions quickly and reliably.

**Containerization** means that first it will allow you to bundle a full blown application into an image and then this image can be runned as a container on any host that is running docker.The images are pushed into the docker repository or registory and from there the images can be runned as a container.

**Docker host** is a machine or a virtual machine on which docker is running.Multiple containers can be runned on a docker host with proper isolation between them using the namespaces and control group behind the scenes.

### Features of Docker:
***
**1.Simplified Configration**
Docker helps deploy codes with less time and efforts,this is beacuse the infrastructure requirements are no longer dependent on the enviornment of the application.

**2.Multi-tenancy**
The current release of the Docker Enterprise Edition(EE) provides the facility to restrict and share the same available resources among various teams.

**3.Isolated Applications**
Docker provides the isolated enviornment for different applications to run without any interference.

**4.Rapid Deployment**
The incoming request are routed to each and every nodes.This feature enables the connection even if there is no task running on the nodes.

**5.Security**
Along with security docker also saves some secret in the container and allow only certain teams to access them.

###Why Docker - Benefits of Docker:
***
1.Docker is a best way to pack the libraries,binaries and resources all together inside a single image.

2.These Docker images are in ready to run state.

3.Earlier there is problem that what works in the development phase might not work in the production phases but with docker this problem is also resolved as it provides the same layer for the operation in any phase be it a developement or production.

4.Docker is more fast and light weight as compared to similar tech as Virtual Machine.

5.It can work on any level i.e. on-premise or at the cloud level.

>"Docker is an open-source engine that automates the deployment".
Edge Router X | OpenWRT | Tailscale
Tags: tutorial, linux, tailscale
Published: 2020-11-29 08:22:48

[Tailscale](https://www.tailscale.com) is an awesome opensource project.  It leverages [WireGuard](https://www.wireguard.com/) to create a light weight `VPN` like connection.

I am using an [EdgeRouter X](https://www.ui.com/edgemax/edgerouter-x/) with [OpenWRT](https://openwrt.org/) on it.  This router is using a `mipsle` chipset.

# Getting started
Build from source below or download the static bin file from [builds](https://pkgs.tailscale.com/unstable/#static)

## Clone the tailscale repo 
`git clone https://github.com/tailscale/tailscale.git`

## Build the `mipsle` binaries
[Other options](https://golang.org/doc/install/source#environment)

```
GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -o tailscale tailscale.com/cmd/tailscale
```

```
GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -o tailscaled tailscale.com/cmd/tailscaled
```

## Copy binaries to /usr/sbin/

`scp <bins> root@<router-ip>:/usr/sbin/`

## Install deps
```
opkg update
opkg install ca-bundle kmod-tun
```

## Create /etc/init.d/tailscaled

**NOTE line /usr/sbin/tailscale up is commented out remove comment after logging in manually**
```
#!/bin/sh /etc/rc.common
### BEGIN INIT INFO
# Provides:       tailscaled
# Description:    tailscaled daemon service
### END INIT INFO

USE_PROCD=1

# starts after network starts
START=21
# stops before networking stops
STOP=89

PROG=/usr/sbin/tailscaled

start_service() {
        echo "starting tailscaled"
        procd_open_instance
        procd_set_param env SERVICE_RUN_MODE=1
        procd_set_param command $PROG -state /etc/tailscale/tailscaled.state
        procd_set_param pidfile /var/run/tailscaled.pid
        procd_set_param stdout 1
        procd_set_param stderr 1
        procd_set_param respawn
        procd_close_instance
        # /usr/sbin/tailscale up
}

service_triggers() {
        procd_add_reload_trigger "tailscaled"
}
```

Make the file executable
```
chmod +x /etc/init.d/tailscaled
```

## Test service
`/etc/init.d/tailscaled start`
`/usr/sbin/tailscale up`

This should prompt with a url.  Use this to authorize the device. If everything is good. Remove the comment in the `/etc/init.d/tailscaled` (tailscale up)

## Enable service
`/etc/init.d/tailscaled enable`

## Reboot
`reboot`
Verify things are working
Deploy React app on github pages with GitHub action auto deploy
Published: 2020-11-29 07:02:05

## Steps to follow
1. First create a project with command **npx create-react-app appname**

2. Then just create a repo on GitHub and then connect the repo with project after that push our first commit on this repo and then install library called **gh-pages** using  npm/yarn

3. now open package.json file and add **homepage** key after private key and assign value to homepage key **http://githib_username.github.io/repo_name**

now add these two line in scripts object

`“predeploy: “yarn run build”,
“deploy”: “gh-pages -d build”,`

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/d8jm3w5i0kvozenpx1hf.png)

after that run the command on project terminal **npm run deploy** this command will create build folder in your project.
If you want to see your hosted project then go to repo setting which you integrate with the project then search for a **GitHub Page** and you will find a **url** click on it and you will see you hosted app

now for automate your deployment then whenever you push code to a specific branch it will automatically run the deployment command and you don’t need to run multiple commands for deploy

create a .github folder in project root inside this folder create workflows folder and create a file in it with any name with .yml extension

this file have your automate job code for deployment

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6195vmydmunf3ljjcn1k.png)

name is representing you GitHub action name on what action the job will perform will be showing by on keyword when you push your code to master it will run a job and do a deployment

on last you can see name as Deploy and we have some authentication process having USERNAME USER_EMAIL ACCESS_TOKEN these all will define in you connected repo , 
go to setting=> of this repo 
go to=> secrets on left side bar 
and define this variables

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/u9yeidyy60zo6rqka1i3.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tgflzrdclubw1gahes6x.png)

Now after all that you just have to push latest code to your master branch and it will run the git hub action you can also check your status of deployment on with click on Action button on repository bar and see your action status after deploy successfully you can check out on your app on same link as earler from setting->GitHub pages

hope it will help you and you learn alot from this , also you can support me on my Youtube channel

https://www.youtube.com/channel/UCkaoWtBz6ioLbNwRzIco5Yg?view_as=subscriber
A few analysis tools for Python
Tags: python
Published: 2020-11-29 07:00:01

### Summary
I added some tools and notes to help anyone who wants to contribute to my opensource can follow similar standards
[Repo link](https://github.com/HenryZerocool/henz-cli)
[Merge commit](https://github.com/HenryZerocool/henz-cli/commit/a4dd25b547de32e4f7cf72b6a104b4fea343deff)

### Features
A code formatter ([black](https://github.com/psf/black)), a linter ([flake8](https://pypi.org/project/flake8/)) and Vscode environment settings.

### Focus
Newly graduated students will be very similar with JS web development. I think JS is the most popular for now. So when we work with JS, there are some must have tools/extension for VScode. Prettier, ESLint are the most popular. I'm saying this just to assume everyone knows those 2 tools. So basically `black` is Prettier for Python and `flake8` is ESLint for Python. As simple as that for what it does, how to use it, how to configure it.
VScode setting was the only new thing here. Now I know that we can share configuration for VScode specific for different projects. And then can recommend extension for others. We all know how important extensions are when working with VScode.
The one problem I could not figure out was how to have scripts for `black` and `flake8`. If it was a JS projects, all I have to do is add a few lines to `package.json` -> `"scripts"`. There is no such thing in Python, or I could not find it. I found something that might work which is using `.sh` files. But it doesn't work on Windows (I tried GIT bash on Windows too). So I feel kind of bad to work on Python right now :(
How not to design an Enum (Java)
Tags: java
Published: 2020-11-29 06:59:49

Throughout the years, I've seen and created many Enums in Java. Some of them were very useful, some just avoided a bit of hard-code and a few bad ones.

This is an example of a very bad enum design. I'm not blaming anyone else, I was a contributor to this. But in my defense I was a newbie then. Let's take a look at it :
```
public enum EventStatusType {
    /**
     * event is processed {0 value in database}
     */
    PROCESSED,
    /**
     *  event is not processed {1 value in database}
     */
    UNPROCESSED,
    /**
     * event is now running {2 value in database}
     */
    IN_PROGRESS,
    /**
     * event has failed {3 value in database}
     */
    FAILED
}
```
First of all, what's with the name? It's either a *Status* or a *Type*, which in this case it's a status, so `EventStatus` would be a better name. 

Then we get to the JavaDocs. They are not explaining anything. Instead of explaining for example what does it mean that the event is `in progress` they are just a repetition of the values. Also, the mention of what they represent in the database is absolutely useless, redundant, and even incorrect. Useless and redundant because everyone working with enums and saving them by their ordinals in a database should know how they work. Incorrect because if we change the type used in our entity to `String`, we should not be forced to change the JavaDoc for the enum.

The other utterly annoying thing in this enum is its order. When watching the database to check the status of the events, you encounter some records with statuses of `0`, `1`, `2`, and `3`. Your intuition says the `0` is the base value, then the event status would move on to `1` and `2` (or `3`). And you are wrong. The base value is `1`, then you move to `2` and the final status is either `0` or `3`. Very counter-intuitive.

Taking care of the mentioned issues with this code would improve the readability and ease of maintenance.

Do you have any more suggestions? Please share it with me.
Integrate my CLI with another project
Tags: opensource
Published: 2020-11-29 06:37:05

### Summary
I modified my CLI so it can be (kind of) integrated with Seneca Telescope.
[Repo link](https://github.com/HenryZerocool/henz-cli)
[Gist diff](https://gist.github.com/HenryZerocool/e015248e5d18218e5beaf3e13755afa8)

### Challenges
The first challenges is setting up the project. I believe I mentioned this in one of my previous blog. So in short, I had some problems setting it up. But if I know that all I need was Node.js and Docker, it should be fine. Setting up to work with REST API is in contrast, simple enough.
So majority of the work is adding functionality to my CLI so it can work with this project. The steps as follow:
- Send GET request query to Telescope backend to receive initial data. A simple and straight forward code.
- Convert the request result to JSON object so we can use it later.
- Loop through each link the JSON object to send GET request to receive HTML page source code.
- Append HTML results in to a big HTML file.
- The CLI can read HTML file like it was originally built for.
- Clean up the file afterward
I don't get much problems with the works. The only thing I remember was JSON object works a little bit different from JS objects.
A rap song about becoming tech lead
Tags: showdev, culture, programming
Published: 2020-11-29 06:28:49

---
title: A rap song about becoming tech lead
published: true
description: https://www.youtube.com/watch?v=mFNnc3kpZ4o
tags: #showdev, #culture, #programming
---

Song url: https://www.youtube.com/watch?v=mFNnc3kpZ4o

Quick background on the project: I'm a full time programmer and I love making rap music. I see a lot of humor in the profession/industry, and thought it would be fun to combine the two.
5 Step Process To Create Selenium Framework from Scratch
Tags: testing, selenium, beginners, java
Published: 2020-11-29 06:27:58

In this video, We are starting our Selenium Framework using Java, We are going to create own custom Selenium Framework from scratch with our 5-Step process.



✅ 5-Step process to Create Selenium Automation Framework
1. Build Management
2. Configuration Management
3. Add Logs for Framework.
4. Reporting to Framework.
5. Page Object Model, Test, Utils

{% youtube 917gq9mn8jA %}

✅ Download Notes in PDF - https://sdet.live/2TJn
✅  Download Source Code - https://github.com/apitestingco/selenium-pom.git


✅  What is Selenium?
Selenium is the biggest open source automation testing suite that has been making testing seamless. It is widely used for testing among the bigwigs like Google, Netflix, Fitbit, etc. to the emerging startups such as likewise.


✅  What is Selenium Framework?
Selenium Framework is a code structure that helps to make code maintenance easy

✅ API Testing - 
https://www.learnapitesting.com

✅ Cypress Tutorial with LIVE Projects -
http://cypresstutorial.com

✅ 30 Days of API Testing Challenge - https://apitesting.co/30days

✅ 30 Days of Automation Testing Challenge - https://go.scrolltest.com/automation

✅ 30 Days of Rest Assured(with Framework) - https://go.scrolltest.com/30days-restassured
Rails Command Line Shortcuts // Re: Generate 
Tags: rails, tutorial, beginners
Published: 2020-11-29 06:01:20

Learning Ruby on Rails can be overwhelming, so this article provides some examples on frequently used command line shortcuts to help get you started. We're going to focus on the **rails generate** shortcuts.

Using **rails generate** (or **rails g**) can help cut down the amount of time typing out code needed to build out your application, but what should we use, and when? Let's break down each shortcut and see what is created when we invoke it. 

The shortcuts that we will be reviewing are: 
- Model 
- Controller
- Resource
- Migration 



**1. Model**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/u59vaik1aq42verflkny.png) 
Entering **rails generate model** will create: 
- Model file in the app/models directory
- Migration file in the db/migrate directory 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s9ky4v1jke70b62h1z9i.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bo2vgpj38u8wlx13yxdj.png)


####2. Controller
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/h0zd9zdvcgr7qewc7a9v.png)
Entering **rails generate controller** will create: 
- Controller file in app/controller directory with actions included (**new, create,** and **show** in this example) 
- Routes for each action in the config/routes file
- HTML view files for each action in the app/views directory 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iwe8zeb5xljr3zx6a0p3.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/l6qeu2kid98b9ssic1ji.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/q38ln7bdkkonaj9i37w7.png)

####3. Resource
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wffraz3plpqsf9zf8koo.png)
Entering **rails generate resource** will create: 
- Model file in the app/models directory
- Migration file in the db/migrate directory 
- Controller file in the app/controllers directory 
- Resources in the config/routes file

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s9ky4v1jke70b62h1z9i.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bo2vgpj38u8wlx13yxdj.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iqrtj36o0omtnbtm7xqk.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/u99msxo613cb9l9qjerp.png)


####4. Migration
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/e4kmv87h9zvqcn1ef59y.png)
Entering **rails generate migration** can create a variety of different outcomes such as adding a column to an existing table, renaming a table, destroying a column, and so on.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5z1zhpp6yfgdl1k2hlpl.png)

Resources: 
- https://guides.rubyonrails.org/command_line.html#rails-generate
Git rebase
Tags: git
Published: 2020-11-29 04:49:51

### Summary
I experienced `git rebase` command with some small commits.
[Repo link](https://github.com/HenryZerocool/henz-cli)
[Merge commit](https://github.com/HenryZerocool/henz-cli/commit/bee6450a5f96be95708025b94ab728cc9592e403)

### Features
I my understanding, `git rebase` can be uses to shorten git log or rewrite git history

### The goals
Since the goals is mainly to experience rebasing the repos, I just made a few small commits and then combined those into one. I made some changes by renaming variables to be more clear, adjusting if else statements so it is most logical, and most of it was cleaning up the code. At this time, I tried to refactor the projects, but it seems very hard in the sense that my functions are being used once, and it very simple. So I don't see the point of refactor right now.
A random thought on `rebase`. When I started working as junior, my first objective was to understand the flow of the project I'm working on. I looked at commits tree to select a commit and it was huuge. I tried to read it by picking commits and after a while, I lost track. I feel like they forgot to rebase the project or did not do it enough. It was just a very big trees. So I think this is the very good feature to help junior like me to catch up with the work
JavaScript find() method
Tags: javascript
Published: 2020-11-29 05:55:09

Today we are exploring the `find()` array method in JavaScript.
I find this method very similar to the [`some()` method](https://daily-dev-tips.com/posts/javascript-some-method/).

What it does is it searches the array for a specific hit, but instead of returning a boolean, it will return the first match it finds.

## Using the Javascript find() method

Let's start by creating an array of items.

```js
const items = [
  { name: 'T-shirt plain', price: 9 },
  { name: 'T-shirt print', price: 20 },
  { name: 'Jeans', price: 30 },
  { name: 'Cap', price: 5 }
];
```

Let's find the first item that is under the price of 10.

```js
const haveNames = items.find(item => {
  return item.price < 10;
});

// { name: 'T-shirt plain', price: 9 }
```

This can also be written as a one-liner:

```js
const found = items.find(item => item.price < 10);
```

Some use cases could be the first blog-post with the same category.

To see this in action let's say we are currently viewing this article:

```js
const blog = {
	'name': 'JavaScript find() method',
	'category': 'javascript'
}
```

And we have an array of blog items like this:

```js
const blogs = [
  {
    'name': 'CSS :focus-within',
	  'category': 'css'
  },
  {
    'name': 'JavaScript is awesome',
	  'category': 'javascript'
  },
  {
    'name': 'Angular 10 routing',
	  'category': 'angular'
  }
];
```

Now we can use `find()` to get the first blog item that is related to our one (`javascript` based).

```js
const related = blogs.find(item => item.category === blog.category);
console.log(related);

// { name: 'JavaScript is awesome', category: 'javascript' }
```

There you go, an example of how to use the find `find()` method in JavaScript.

### 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)
Unit Test & Github Action
Published: 2020-11-29 05:39:59

The task for lab 8 is to add unit tests and CI to my urlCHECKER program, which was created in the former labs. I spent some time learning about unit test in Golang, and the grammar is not that hard in Go, which can be told from the example below: 

```go
func TestExtractURL(t *testing.T) {
	result := extractURL("https://www.google.ca, https://www.facebook.com")

	expected := []string{"https://www.google.ca", "https://www.facebook.com"}
	if !reflect.DeepEqual(result, expected) {
		t.Errorf("Expected: %v, but got: %v", expected, result)
	}
}
```
The terminal will show the below information after the test is run successfully. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ytoaeel2j26wbx0583mi.png)

To run the code coverage tool I used for my project, the below commands need to be run:  
```
go test -coverprofile cover.out 
go tool cover -html=cover.out
```


## Github action

```
name: Go

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:

    - name: Set up Go 1.x
      uses: actions/setup-go@v2
      with:
        go-version: ^1.13

    - name: Check out code into the Go module directory
      uses: actions/checkout@v2

    - name: Build
      run: go build -v ./...

    - name: Test
      run: go test -v ./...

```

The CI workflow result can be found through the following link:

https://github.com/isabellaliu77/urlChecker/actions

## Linter
For the linter, the package needs to be got using the below command, which I have learned the hard way. 

```
    - name: Lint
      run: |
           go get -u golang.org/x/lint/golint
           golint ./...
```
InoLetter - a newsletter theme for ghost 
Tags: showdev, startup, productivity, news
Published: 2020-11-29 05:19:22

Hello Fellow Devs,
Just launched our Brand new ghost theme. With InoLetter you can Create a Newsletter site in no time utilizing the power of Ghost Publishing Platform.
[The theme can be purchased here](https://inoryum.com/ghost-themes/inoletter) - [demo](https://inoletter.inoryum.com)

For the community members we have a 40% discount. Use the code FC50OFF at checkout.

---

#### Theme features

*   Newsletter Focused theme 
*   Clean & responsive design
*   Lightweight
*   Enhanced performance
*   Responsive images
*   Lazy Loading for images
*   SVG icons are used
*   Well structured & commented codes
*   Easy to customize
*   Instant Search
*   Social share support for posts
*   Responsive videos
*   Developer friendly



#### Ghost core features

*   Membership support  
    - Signin page  
    - Signup page  
    - Account page  
    - Pricing page  
    - Notifications  
    - Call to action for subscription in members, paid-members only post.  
    - Post visibility depending on access
*   Translation ready  
    - English, Spanish, Italian, French & Turkish included.
*   Publication title & description
*   Publication icon & Logo
*   Primary & secondary Navigation  
    - Primary navigation on header  
    - Secondary navigation on footer
*   Subscriber form
*   Feature Icon for Featured post
*   Social links & icons
*   Read time
*   Multiple author support for post
*   Koenig Editor  
    - Gallery and Bookmark and all other inbuilt card in Koenig editor
*   Responsive YouTube, Vimeo, SoundCloud, Spotify, twitter, Instagram and all other embed
*   Previous and next post link in single post view



Hope you guys like the theme… your feedback & opinions are much appreciated