teleren/devto huggingface dataset:
DevOps: Learn what it IS by what it ISN'T
Tags: devops, azure
Published: 2021-03-04 03:28:07

The DevOps Engineer role is a relatively new role that has come into existence during the past decade in I.T. and seems hard to define.
Part of what makes the position challenging to understand is that it is continually changing due to new technologies.

However, a good start at understanding it is to realize that it is a mix of several different roles; software engineer, sysadmin, network engineer, and more.

Of the roles, the two with the most massive influence are software engineering and sysadmin. I think the  Dev piece of DevOps is Software Engineering, and the Ops is sysadmin.

With that mindset, then the following will make sense.
> A DevOps Engineer is responsible for building software that automates the developer experience and sysadmin responsibilities.

This post demonstrates what a DevOps engineer does and what DevOps culture is and isn't using Azure and Azure DevOps.

### Skillset

Typically a DevOps Engineer has the following experience with technology:

- Containers like Docker
- Container Orchestration like Kubernetes
- Infrastructure as Code like Terraform
- Configuration of Servers through code like Ansible, Puppet, Salt, or Packer
- Proficiency in a programming language like Python or GO
- Familiarity with shell scripting awk/bash
- Familiar with Linux and User Management
- Networking
- Software Development
- Familiarity with a cloud host provider like AWS, GCP, Azure, Digital Ocean, etc.

### Not DevOps
To better understand, let's establish what a culture of Not DevOps looks like in an organization.

### Dunder Mifflin Paper Company
Suppose we're at a Fortune 500 company like Dunder Mifflin Paper Company. The leaders decide they want to build a new web application to take paper orders. And you have been hired as a fresh graduate of a Bootcamp or college to make it happen. So you get work, which might look like this.
(1) You write and push code to GitHub -> (2) Code is tested by QA / Security -> (3) Code is Deployed -> (4) Users visit website
Let's look at a technical example to understand the workflow better.

### Azure - Technical Example
We'll use the free Azure App Service to deploy a Python Django Web App.

[continue reading...](https://toul.io/devops-learn-what-it-is-by-what-it-isnt/)
How To Implement Angular Service With Example
Tags: angular, node
Published: 2021-03-04 03:22:19

we are learning how to create angular service or import service as a global dependency via module and via component with example. In time we will see how to use the Angular service.

**Why use Angular service**
We sometimes have to use some code in our project again and again, just like we use an API call in our project instead we use Angular service which we once use in Angular service Write our own code and you can use that code anywhere through the components, it gives us ease, so we use Angular Service. We see some examples below.

**[How To Implement Angular Service With Example](https://www.phpcodingstuff.com/blog/how-to-implement-angular-service.html "How To Implement Angular Service With Example")**

**Create Angular Service**
To create a service, we need to make use of the command line then open your command prompt. The command for the same is −

```ng g service myservice```

![This is image title](https://www.phpcodingstuff.com/uploads/tutorial_images/service_img.png "This is image title")


**app.module.ts.**
```
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AboutComponent } from './about/about.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {MatInputModule} from '@angular/material/input';
import {MatButtonModule} from '@angular/material/button';
import { MyserviceService } from './myservice.service';  //  <--------------Import service ---------------

@NgModule({
  declarations: [
    AppComponent,
    AboutComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MatInputModule, 
    MatButtonModule 
  ],
  providers: [MyserviceService],  //  <------------ add service -------------------
  bootstrap: [AppComponent]
})
export class AppModule { }
```

*Original source: [https://www.phpcodingstuff.com/blog/how-to-implement-angular-service.html](https://www.phpcodingstuff.com/blog/how-to-implement-angular-service.html "https://www.phpcodingstuff.com/blog/how-to-implement-angular-service.html")*
Make debugging a breeze with Dependency Injection in GoLang
Tags: testing, go, beginners
Published: 2021-03-04 03:21:42

Dependency injection is the idea of removing dependencies from within a function and aids in building a more resilient codebase by doing so.

Removing dependencies from a function also makes it easier to debug because tests are more straightforward to conduct. 

To better understand dependency injection, an example will be shown using test-driven development.

### Example
Suppose we have a file called `user.json` containing a single user's information, and we want to get their age via a function.

### Data Structure 

```
// user.json
{
  "age": 34
}
```

### Function

```Go
type User struct {
 Age int `json:"age"`
}
// GetUserData opens a file and returns a piece of data
func GetUserData(fPath String) (String, error) {
 userFile, err := os.Open(fPath)
 if err != nil {
 fmt.Println(err)
 }
 byteValue, _ := ioutil.ReadAll(userFile)
 var u User
 json.Unmarshal(byteValue, &u)
 return u
}
```

### Test Function
```go
func TestGetUserData(t *testing.T) {
 t.Parallel()
 got, _ := GetUserData("../test/resources/user.json")
 s := fmt.Sprint(got)
 if s == "" {
 t.Errorf("Wanted %s got %s", got, s)
 }
}
```
### Dependencies

The above function works, and the test also works. However, the following dependencies have been introduced:

[continue reading...](https://www.toul.io/tired-of-tough-to-debug-code-try-dependency-injection/)
Filtering jquery autocomplete 
Tags: csharp
Published: 2021-03-04 02:50:19

hey, may I have the solution for https://www.youtube.com/watch?v=I3_5gnTIS4E&ab_channel=kudvenkat, so I got request to make an dropdownlist for gender. If I choose Female, the autocomplete suggestion will only shown all the female students. Please kindly help me, I've been a week struggling to find the solution.
Hello, World!
Tags: ruby, rails
Published: 2021-03-04 02:39:42

I'm pretty new to Dev.to, but not new to writing software. :-)

My main reason for being on this site is so that I can read articles about Ruby to learn more about this language while I also teach myself Rails.

If you'd like to follow along on my Rails learning journey, [https://trello.com/b/ZBbT9Efe/dmuth-learns-ruby-on-rails](I set up a Trello Board to track my progress).

Seeya around!

-- Doug
Easy Dark Mode With CSS variables
Tags: css, webdev, tutorial, beginners
Published: 2021-03-04 02:37:29

Link to original article with code snippets (recommended): https://gabriellazcano.com/blog/easy-dark-mode-with-css-variables/

I’ve found out a lot of ways of implementing a dark mode in your site. Both with Javascript and CSS. Today I’m going to share a method which doesn’t allow it to be toggled with a button but it’s the easiest way I’ve found.

For achieving this we are going to use the prefers-color-scheme media feature, which is used to detect if the user has requested to use a light or dark theme, and :root for setting global variables in CSS.

Then in any part of the site we have to use the --bg-color variable with var() like this:

You can check support for prefers-color-scheme in https://caniuse.com/mdn-css_at-rules_media_prefers-color-scheme

Wrap up
I hope you will find this blog post useful and keep it handy for a quick reference. Feel free to send me a DM or to mention me on Twitter if you’ve got any suggestion or fix :)
Trying to make Webstorm like VSCode (Part 1)
Tags: discuss, vscode
Published: 2021-03-04 02:33:44

Hi folks! I recently needed to install PHPStorm as I am working on a complex PHP project and VSCode was not that good for PHP...
I am trying to make a smooth transition, because I have always used VSCode for basically everything. I also downloaded Webstorm, so I am experimenting on Webstorm so that I can apply what I learned later on PHPStorm.

## Unstaged files

I think VSCode has a great and simple Git integration. Before you add a file to the stage you have the file like this:

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

I like that "plus" button, and managed to add it:

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

Just go to Settings `(Ctrl + Alt + S) > Appearance & Behavior > VCS Local Changes Toolbar` 

You can add the "Add" button by clicking on the "Add actions..." and searching for the "Add" action inside `Version Control Systems > Git` (sorry for that tongue twister 😂)

Now, you can add the "Add" button to stage a file. I mostly use this functionality for when I don't want to add all files in the stage by using the terminal (i.e. `git add .`).

## Staged files (??)

When the file is staged, you have a button to unstage a file in VSCode:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/06qb0mu3j9opghh7dcl5.png)

However, I don't see this option in Webstorm. Neither there is a separation between "staged" and "unstaged" file in the Commit tab in Webstorm nor PHPStorm. Do you know how to achieve this or if this is possible? 

Thanks in advance.
The Twilight Zone / Bermuda Triangle of Javascript
Tags: finneganswake, humor, psychedelia, time
Published: 2021-03-04 01:30:58

An alternative universe of space and time awaits.  An exotic place where 3 + 3 is not always six and the the nexus of time is 2 and a half years after the 1967 summer of love. 

A relative psychedelic Bermuda triangle of bending reality you say?

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lggg8ubvwqdhs0d591i0.jpg)



 I can not tell you what was or was not involved in this universe's conception. I was not there and anyway if you ask Peter Paul and Mary their most famous song is just about a boy and a dragon and the theme of getting old and thats it.  Who knows about those cats with the bitten apple symbol on their machines and what that is supposed to mean - we can only speculate - and end up back at Harvard with Norbert Wiener after the war. But I digress into pop nostalgia.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjmrfw43sy59iwfwvvt2.jpg)

The Nexus of Time - Well apparently there is all kind of time.  Solar Time, Greenwich Mean Time, UTC Time, Terrence McKenna had the theory time was constantly speeding up and slowing down with regards to novelty or auspicious events occurring around us.  Unix time which computers use seems to be the most Saturnian in its Chronos-like constance and unwavering inhumanity. In this banal godless world the beginning of time was Jan 1, 1970 the "Unix Epoch" and everyday is exactly the same 86,400 seconds winter, spring and fall.  Chaos is sometimes defined as complete lack of variation - organization is thus made impossible because no pattern can be created when everything is the same.  Bleak.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73hvv1ghgktlov3ub3nw.png)
And what about the Numbers? What the sam-i-el is up with this weird arithmetic Javascript be dropping on our otherwise mundane and quiet financially oppressed police state in between the oceans.  
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o8j3s0x8btri1zo2hoso.png)

We didn't make it this far without knowing that a fifth of a tenth and also a tenth of a fifth will get you one fiftieth or in regular dimensional non twilight zone math:  .2 x .1 = .02
So what is the deal?

Floating Point - well it turns out computers use some kind of binary scientific notation style for their calculations where fractions are referred to as "bicimals" instead of "decimals."

In this land of flying dragons one tenth is a repeating decimal similar to 1/3 being the equivalent of .3333333 on into eternity.  While we are accustomed to dealing with these common failures of our own dimensional understanding and allowing for them, we find ourselves shocked when they occur amidst the strange javascript reality.  The fault I suppose is ours for thinking we were still in Kansas when we should have known by the technicolor and golden road that we were not.
How to Deploy Hexo to China?
Tags: hexo, javascript, node, china
Published: 2021-03-04 01:07:03

---
canonical_url: https://www.21cloudbox.com/solutions/how-to-deploy-hexo-static-site-in-production-server.html
---
# What is Hexo?
Hexo is a static site generator (SSG) based on Node.js.

21YunBox provides a very simple Hexo deployment method. You can quickly deploy **static webpages**with 21YunBox.


# How to deploy Hexo in China?
1. Register as a [21YunBox Member](https://www.21yunbox.com/u/signup/)
2. Fork [Hexo Example](https://gitee.com/eryiyunbox-examples/hello-hexo)
3. Set-up with the following configuration


| Environment       | `Static Site.  `          |
| ----------------- | :-----------------------: |
| Build command     | **`yarn && hexo deploy`** |
| Release Directory | **`./public`**            |

If the description of the above text is not clear, please watch the following step by step video: [How to deploy Hexo to the server operation video](https://www.bilibili.com/video/BV1uy4y1q7LL)

# Why Choose 21YunBox?

> 21YunBox is a Cloud Service platform based out of Beijing. Our services enable your team to be more effective in leveraging the growing opportunity within China by hosting your sites at blazing speeds with an operational and maintenance free, and low code solution.
>
> 21YunBox provides an easy and budget friendly, end-to-end web platform deployment service for all applications from small teams to large enterprises.
We also offer [full support in obtaining your ICP license](https://launch-in-china.21yunbox.com/solutions/how-to-get-an-ICP-license-for-china.html) allowing you to legally host online content inside of Mainland China.


To learn about the differences between 21YunBox and these foreign (outside of China) cloud service platforms, please refer to:

* [21YunBox vs Heroku](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-heroku-in-china.html)
* [21YunBox vs Netlify](https://launch-in-china.21yunbox.com/blog/solutions/alternatives-to-netlify-in-china.html)
* [21YunBox vs Vercel](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-vercel-in-china.html)
* [21YunBox vs Gatsby Cloud](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-gatsby-cloud-in-china.html)
* [21YunBox vs Github Pages](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-github-pages-in-china.html)
* [21YunBox vs Surge.sh](https://launch-in-china.21yunbox.com/solutions/how-to-speed-up-surgesh-in-china.html)
* [Compare in terms of function and price: 21YunBox vs Heroku, Netlify, Vercel](https://www.21yunbox.com/compare-others/)


<br>
*This article's content originated [here](https://launch-in-china.21yunbox.com/solutions/algolia-alternatives-in-china.html)*

*For additional detail and future modifications, refer the original post.*
Run remote install scripts without using `curl` command in Ansible
Tags: ansible, provisioning
Published: 2021-03-04 00:54:12

---
title: Run remote install scripts without using `curl` command in Ansible
published: true
description: Ansible warns when you use curl command in shell module. This is the work around when you try to install something using remote shell scripts.
tags: ansible, provisioning
---

## TL;DR

Use `ansible.builtin.uri` to fetch the script content, and pass it through `stdin` parameter of `ansible.builtin.shell`.

## Execution environment

* Ansible: 2.10.5
* Python: 3.8.7

## Sample case

There are a lot of cases where the install instructions of tool X introduces the remote script to run. For instance, [rustup](https://rustup.rs/) gives the script as the primary method to install it.

```shell
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

In the case you install rustup via Ansible, you may want to write lines like the following:

```yaml
- name: Run rustup
  ansible.builtin.shell:
    cmd: curl -sSf https://sh.rustup.rs | sh -s -- -y
```

(I added `-s` option to install the script without prompt that blocks the Ansible installation process.)

Ansible warns when it runs the task like this:

```
TASK [common : Run rustup] **********************************************************************************
[WARNING]: Consider using the get_url or uri module rather than running 'curl'.  If you need to use command
because get_url or uri is insufficient you can add 'warn: false' to this command task or set
'command_warnings=False' in ansible.cfg to get rid of this message.
changed: [dev]
```

## Solution

The easiest way to avoid this is to use `get_url` to download the shell script and run it.

```yaml
- name: Download rustup
  ansible.builtin.get_url:
    url: https://sh.rustup.rs
    dest: /tmp/rustup.sh

- name: Run rustup
  ansible.builtin.shell:
    cmd: cat /tmp/rustup.sh | sh -s -- -y
```

Otherwise, you can directly pass the script contents into stdin of `shell` with `stdin` parameter.

```yaml
- name: Fetch rustup
  ansible.builtin.uri:
    url: https://sh.rustup.rs
    return_content: yes
  register: rustup_installer

- name: Run rustup installer
  ansible.builtin.shell:
    cmd: sh -s -- -y
    stdin: "{{ rustup_installer.content }}"
```
Publish on your Own Site, Syndicate Elsewhere (POSSE)
Tags: discus, help
Published: 2021-03-04 00:17:38

I was planning on posting articles on my WordPress blog and cross-posting on Hashnode, Dev.to and Medium with canonical URLs? Is this a good idea?

I am not exactly sure how canonical URLs work. I have used Medium's 'Import Story' feature a few times. Although my medium articles have canonical URLs referring to my WordPress blog, upon searching on Google my medium articles are ranked higher than my original articles.
MySQL tutorial - 3 Data Insertion
Tags: mysql, beginners, tutorial
Published: 2021-03-04 00:06:23

In MySQL, data insertion can be done using `INSERT` query. The data type that will be inserted into table must match with the data type that already specified in each columns.

This is the basic query structure of data insertion.

```
INSERT INTO table_name (column_name,column_name) VALUES (data_value,data_value)
```

In this example, a new data will be inserted into `shop` table.

```sql
-- create a new table called shop
CREATE TABLE shop(
    id INT PRIMARY KEY AUTO_INCREMENT,
    product_name VARCHAR(255) NOT NULL,
    quantity INT NOT NULL,
    price FLOAT NOT NULL
);
```

```sql
-- insert new data
INSERT INTO shop (id, product_name, quantity, price) VALUES (0,"Chocolate",12,12.5);
```

When insertion is succeed, there is a number of row affected of data insertion.

This is the shorthand version of data insertion query,

```
INSERT INTO table_name VALUES (data_value, data_value)
```

Here is the example of data insertion with shorthand version.

```sql
INSERT INTO shop VALUES (0,"Mango",90,7.8);
```

To view all the data that exist in a table, use `SELECT` query. This query will be explained in separated article.

```sql
SELECT * FROM shop;
```

Based on the query above, all of the column will be retrieved using `*` notation besides `SELECT`. This is the output example.

```
+----+---------------+----------+-------+
| id | product_name  | quantity | price |
+----+---------------+----------+-------+
|  1 | Mango         |       90 |   7.8 |
|  2 | Milk          |      100 |   8.8 |
|  3 | Apple         |      110 |   7.8 |
|  4 | Fresh Chicken |       25 |  10.3 |
|  5 | Corn Flakes   |       19 |  2.99 |
+----+---------------+----------+-------+
```

I hope this article is helpful for learning SQL, If you have any thoughts or comments you can write in the discussion section below.
I can't connect a react native project with my physical phone via wifi
Tags: reactnative
Published: 2021-03-04 00:04:36

Hi, I'm new to react native, and I'm trying to connect an RN project with my cell phone via wifi, as the documentation says: https://reactnative.dev/docs/running-on-device 

But when adding an ip and a port, it seems that it does not work, any solution for this? My android version is 10

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ncragey9hhorkk1z07bz.jpg)
Rust: First Impressions
Tags: rust, firstimpressions, cargo, learning
Published: 2023-01-24 15:09:08

---
title: Rust: First Impressions
published: true
date: 2021-03-04 00:00:00 UTC
tags: rust, firstimpressions, cargo, learning
canonical_url: https://www.rocky.dev/blog/rust-first-impressions
---

Scala is great for recent microservices I've written, enabling incredible velocity. However, certain scenarios benefit from lower-level languages.

I have five years of (dated) C++ experience. It's a high learning curve and even experts can cause segfaults, undefined behavior, double free errors, array overruns, mishandle concurrency, etc. This prevents novices from jumping into code for fear of breaking things, slowing productivity. Even modern C++ lacks a strong tooling ecosystem, making some things, including AWS Lambdas, a "batteries not included" experience.

For these reasons, I spent time looking at how Rust and Go compare. The key requirements,

- Integrates with existing code, libraries, and tools
- Increases productivity
- Reduces bugs by catching preventable ones early and being hard to misuse
- Negligible performance differences
- Comparable learning curve (ideally, shorter)
- Doesn't impact recruiting (ideally, improves)
- Stable with backward compatibility, meets future needs

Both Rust and Go are great, but have different priorities as [this article describes](https://bitfieldconsulting.com/golang/rust-vs-go). Compared to Go, Rust has better C++ interoperability, no garbage collector (leading to better and more consistent performance), and richer language features (at the cost of additional complexity/higher learning curve). Taken together, these fit my use cases and preferences better.

Addressing the "Key Requirements" above, Rust has

- Great C++ interoperability via the [CXX crate](https://github.com/dtolnay/cxx)
- an aim to be [faster than C](https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/rust.html)
- Excellent tooling
  - Cargo provides compile, test, format, lint, package management, and workspace/monorepo support
  - VS Code extensions provide the above along with in-editor line coverage
- A sophisticated compiler giving non-experts the confidence to make changes since it won't - build code with mistakes easy to make in C++
- Concurrency via familiar `async`/`await`
- Zero-cost abstractions around things like generics
- Functional programming features like iterators and closures
- A devoted following as Stack Overflow's [Most Loved Language](https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages-loved) five years running
- A bright future. As our front-end apps grow in complexity, Rust's relative approachability and WASM compilation may become important. Other languages have this capability, but at least at this point garbage collection adds client-side baggage.

Additional resources include,

- [A half-hour to learn Rust](https://fasterthanli.me/articles/a-half-hour-to-learn-rust)
- [The Rust Programming Language](https://doc.rust-lang.org/book/)
- [Asynchronous Programming in Rust](https://rust-lang.github.io/async-book/)