teleren/devto huggingface dataset:
How to check the weather right from your terminal with Python
Tags: python, tutorial, productivity
Published: 2021-05-31 10:58:07


Today I want to show you how to check the weather from your terminal. For this purpose, we are going to use `cli-weather`, a lightweight command-line app to get fast weather data right on the command line. 

[cli-weather](https://pypi.org/project/cli-weather/) is a command-line app to get instant real-time weather data by city name or postal code from any corner on earth right on the command line.

With _`cli-weather app`_ you can retrieve current weather observations from over **45,000** live weather stations using WeatherBIT API, and highly localized weather forecasts for any point on the globe using the world's most trusted weather models such as GFS 13km, ECMWF, DWD 6.5km ICON-Europe, and NOAA 3km HRRR.!

### Installation
cli-weather requires [pip](https://pypi.org/project/cli-weather/pip.pypa.io) python package manager to install.

```python
pip install cli-weather
```

### Basic Usage
```python
cli-weather command [-h] [-a] [-d] [-f] [-c COUNTRY] [-u {M,S,I}] city_nmae/postal_cod
```
This is our example:

![enter image description here](https://i.ibb.co/HBBf2pv/video.gif)

Sweet, isn't it? :-)

Thank you all.
Closures in JavaScript 
Tags: javascript, closures, webdev, fundamentals
Published: 2021-05-31 10:57:17

Closures are equivalent to what grammar is to English. If you don't understand closures, it's like speaking English without understanding grammar.
In JavaScript, closures are created every time a function is created. To understand them better, we first need to understand what is *lexical scoping*.
```javascript
const outer = function(number1) {
  const inner = function(number2, number3) {
    let sum = number1+number2+number3;
    console.log(number1" + "number2" + "number3" = " + sum);
  }
  inner(3,5);
}
```
```
outer(4);
4 + 3 + 5 = 12
```
In the snippet above, the code inside the *inner* function can **see** the variable/binding *number* by the outer function. **But**, the bindings number2 and number3 are *not visible* in the outer function. Every local scope is also able to see all the local scopes outside it. The inner function is lexically bound by that of the outer function. This is *lexical scoping*.

Now that we have understood what lexical scopes are, we can move towards understanding what *closures* are.
*Closures* are nothing but functions bundled together with their *lexical scope*.
Let's understand this by an example.
```javascript
function a(){
  let x = 50;
  function b(){
    console.log(x);
  }
  b();
}
```
What happens when we execute the function a()?
Yup, the variable x gets declared, and when we call the function b, it looks up to it's lexical environment, finds x, and logs it.

Now, consider the code below:
```javascript
function a(){
  let x = 50;
  function b(){
    console.log(x);
  }
  return b;
}
let c = a();
console.log(c);
```
```
> function b(){
  console.log(x);
}
```
The function a returns another function b, which we are binding to c.
Now, what happens when we execute the code below?
```javascript
function a(){
  let x = 50;
  function b(){
    console.log(x);
  }
  return b;
}
let c = a();
//.... More code

c();
```
Now, closures come into play. Remember, closures are nothing but functions bundled together with their *lexical scope*. Here, c is a closure which binds to the function b along with b's lexical scope, which contains the variable x. So it can access the variable x anywhere in the code.

This is the magic of JavaScript.

I hope you can figure out what the output will be when c is called.
How to Start Programming in C++
Tags: cpp, programming
Published: 2021-05-31 10:46:31

C++ is one of the most popular and powerful object-oriented programming languages, and it's the best place to start if you want to undertake low-level programming.
C++ applications can be found in a variety of disciplines, including embedded programming, server-side applications, gaming, and even high-frequency trading. C++ is used to write the majority of complicated software, such as operating systems, database management systems, and powerful trading systems.

While many of us have learnt to program in C and C++, I will admit that learning C++ is difficult. There are many areas that are difficult to grasp, such as points, but you will learn them gradually with the help of these free C++ classes.

There is no doubt that mastering C++ will provide you with several chances. C++ developers are in high demand, especially in the field of high-frequency trading, where every microsecond counts and the power of C++ is essential.

C++ is the language that gives you the best of both worlds: it allows you to use OOP to manage software complexity while also allowing you to get close to your machine and access all of your computer's hardware, something that other object-oriented languages like Java or Python don't allow you to do. You should take help from expert if you got stuck in any [c++ homework help](https://favtutor.com/cpp-homework-help)

That's why C++ is so popular for building native device drivers, high-end desktop games, and complex artificial intelligence algorithms that require a lot of processing power.
React templates - wrap-up
Tags: react, javascript, template, webdev
Published: 2021-05-31 10:24:33


## How the templates were created

I ran this command to create the React Node app.

```sh
$ npx create-react-app my-app
```

 Then I used that to create the other repos.


## Why use the templates

I've customized the apps to be easy for you to use.

- I'm keeping the functionality **minimal** so you can see how the app is structured without being overwhelmed. 
- I've added **documentation** to guide you through using and understanding the projects
- Each project is hosted as a **live demo** on GitHub Pages.
- For CI deploy flows, I've set up GitHub Actions in the case of Node and Deno. So when you commit to GitHub, you can run checks, build your site and publish to GitHub Pages.


## How to use the templates

The projects are ready to be used to make a new project - click _Use this template_ button. 

Then follow the instructions in the project's docs.


## Credits

Cover image:

- I designed using Google Jamboard. 
- Background image by [@ana_insomnia](https://unsplash.com/photos/GyKVGQiIGdI)
- Icons from GitHub [topics](https://github.com/github/explore/tree/master/topics). 

---

Thanks for reading.

Let me know what you think in the comments.
React templates - Frontend only
Tags: html, javascript, template, beginners
Published: 2021-05-31 10:20:22

## Frontend template

This project uses just HTML, CSS, and JS. All are statically hosted on GitHub Pages. No need for Node to manage packages or run a build step.

{% github MichaelCurrin/react-frontend-quickstart %}


## Imports

Imports are done by URL, using the [ES Modules](https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/javascript/general/modules/es-modules.html) approach. 

e.g. `main.js`

```javascript
import React from "https://dev.jspm.io/react@17.0";
import ReactDOM from "https://dev.jspm.io/react-dom@17.0";
```

The browser will run the JS file and see that it needs React and then fetch React from CDN URL and then use it. 

You get to load React _directly_ in your JS script, by URL. _Without_ having to manage dependencies as `script` tags in HTML or having to manage a `package.json` file.


## Start dev server

This is no `npm` command to run here.

Simply start a static HTTP server in the repo root, using your preferred options. See my [Start a dev server](https://gist.github.com/1a6116a4e0918c8468dc7e1a701a5f95) guide for a few ideas. 

If you use VS Code, then the Live Server extension works great.


## Who should use this template?

This Frontend template is great for someone who has never used Node before but wants to get the benefit of React.

Even if you already use Node regularly, I would still recommend you have a look at the template's code and site,  

Since when you understand how to run React without Node, you'll understand the purpose and benefits of Node. As well as the downsides - such as requiring the use of Node locally and in a build step, environment and compatibility issues, and requiring a strict structure of a Node app (which makes it hard to add React to an existing project that doesn't use Node).
Rescan SCSI Lun inside Docker container : Permission Denied
Published: 2021-05-31 10:20:21

I have been running a docker container on my SLES-15 VM. I have been passing capability - SYS_ADMIN, SYS_RESOURCE, NET_ADMIN with /dev:/dev and /sys:/sys mount points. I want to access newly added LUN inside the container. While I run rescan-scsi-bus.sh script or echo "- - -" > /sys/class/scsi_host/host0/scan , I am having permission denied error. 
Can anyone help me to suggest the way to access the newly Added LUN, any alternative to rescan the luns or what other capabilities need to pass to the container ?
Thanks in advance !
Hey company reps, give me a tip!
Tags: discuss
Published: 2021-05-31 10:19:51

I am thinking of a way to travel around the world and still do IT. My idea goes by this:

I contact companies and I work for them 3-6 months, where I write a review of the company culture, the colleagues, the technologies they use and the overall experience. I also write about the life in the country. To me, this idea sounds really cool and I would be reading every post & watching every video of it along the creator's (me haha) adventure.

What the company gets from my review:
* Exposure - One more place where the company name is shown.
* Advertisement - The company gets the positive look of being open-minded for hiring such person and participating in this program.
* A worker for 3-6 months - I will be a contractor due to a regular contract being too hard to come up with and too much work for a 3-6 months employee.
* A slightly lower paid employee due to no existing promise for a long-term employment from my side

In general, my question is:

**Would you participate?**
React templates - Node
Tags: react, node, javascript, beginners
Published: 2021-05-31 10:18:25

## Node template

The classic approach with [Node](https://michaelcurrin.github.io/dev-resources/resources/javascript/node-js/).

{% github MichaelCurrin/react-quickstart %}


## Imports

You'll see imports are done like this:

```javascript
import React from 'react';
import ReactDOM from 'react-dom';
```

That requires dependencies like `react` to be specified in `package.json` and installed using:

```sh
$ npm install
```


## Start dev server

As per the _Usage_ doc in the docs directory, use one of:

```sh
$ yarn start

$ npm start
```


## CI

This templates uses Node to build a React app. 

The project is configured to use _GitHub Actions_, so that when a commit is made to the main branch then some NPM commands run to build the app and output static files. These files are committed to the `gh-pages` branch so they can be served with _GitHub Pages_. At that point, Node is no longer needed. At least until the next commit triggers a build and deploy.

For more info, see the _Actions_ tab on the repo for a history or workflow runs. Also see the `.github/workflows` directory where a GH Actions workflow config file exists.


## Who should use this template?

This Node project is good for beginners in JavaScript who have little experience in React or Node and want to learn more.

Or, maybe you make a lot of React projects already but want to standardize your process. Or you want to add some docs and CI to your project and get it deployed to GitHub Pages.
React templates - intro
Tags: react, deno, webdev, javascript
Published: 2021-05-31 10:16:57

Hello fellow web developer.

I created this post series for those interested in React who want to use a template or who want to compare different ways of building a Helloworld app without getting lost in the large repos and tutorials out there. 

I'm about to share my React template projects with you. I hope you will learn more about the technologies use by looking at the code and sites. And maybe you can use of these starter templates to make your next project, even if just to experiment.

Here are the 3 approaches I used:

- **Node**
    - The traditional approach, using Node and a build step to make a web app.
- **Frontend**
    - Plain frontned. Only HTML, CSS, and JS only - no Node or CI build step here!
- **Deno**
    - An alternative to Node, with built-in support for TypeScript, JSX, and more.

In each post of this series, you'll find details on a template listed above. I include a link to the corresponding GitHub repo of mine. There, you can view the source code and find a link to the live website hosted on [GitHub Pages](https://pages.github.com/).

I hope you find these useful. Let me know in the comments on points to clarify or ways to improve a template.
Google Analytics for Beginners
Tags: analytics, googlecloud, cloudskills, analyst
Published: 2021-05-31 10:11:38

Google Analytics for Beginners shows new users how to create an account, implement tracking code, and set up data filters. You'll learn how to navigate the Google Analytics interface and reports, and set up dashboards and shortcuts. The course will also demonstrate how to analyze basic Audience, Acquisition, and Behavior reports, and set up goals and campaign tracking.

This course covers Google Analytics primarily for measuring website traffic. To learn about new capabilities that bring app and web analytics together, visit Analytics Help.

<a href="https://www.answerswami.com/google-analytics-for-beginners-assessment-answers-2021-pdf-file/#Google%20Analytics%20For%20Beginners%20Assessment%201%20Answers" target="_blank" rel="dofollow"> **Unit 1: Introducing Google Analytics** </a>
Lesson 1: Why digital analytics?
Lesson 2: How Google Analytics works
Lesson 3: Google Analytics setup
Lesson 4: How to set up views with filters

<a href="https://www.answerswami.com/google-analytics-for-beginners-assessment-answers-2021-pdf-file/#Google%20Analytics%20For%20Beginners%20Assessment%202%20Answers" target="_blank" rel="dofollow"> **Unit 2: The Google Analytics Interface** </a>

Lesson 1: Navigating Google Analytics
Lesson 2: Understanding overview reports
Lesson 3: Understanding full reports
Lesson 4: How to share reports
Lesson 5: How to set up dashboards and shortcuts

<a href="https://www.answerswami.com/google-analytics-for-beginners-assessment-answers-2021-pdf-file/#Google%20Analytics%20For%20Beginners%20Assessment%202%20Answers" target="_blank" rel="dofollow"> **Unit 3: Basic Reports** </a>

Lesson 1: Audience reports
Lesson 2: Acquisition reports
Lesson 3: Behavior reports

<a href="https://www.answerswami.com/google-analytics-for-beginners-assessment-answers-2021-pdf-file/#Google%20Analytics%20For%20Beginners%20Assessment%202%20Answers" target="_blank" rel="dofollow"> **Unit 4: Basic Campaign and Conversion Tracking** </a>

Lesson 1: How to measure Custom Campaigns
Lesson 2: Tracking campaigns with the URL Builder
Lesson 3: Use Goals to measure business objectives
Lesson 4: How to measure Google Ads campaigns
Lesson 5: Course review and next steps


Source:<a href="https://www.answerswami.com/google-analytics-for-beginners-assessment-answers-2021-pdf-file/" target="_blank" rel="dofollow"> **Google Analytics for Beginners** </a>
How to Use Nuxt.js Loading Progress Bar
Tags: vue, javascript
Published: 2021-05-31 09:31:46

Are you using Nuxt.js on your current project as front-end framework? then you have a great news, Nuxt.js Out of the box gives you its own loading progress bar component that's shown between routes. You can do anything with the Nuxt.js loading progress bar, customize it, disable it, or can create your own **loading** progress bar.

## Active & Customize Progress Bar:
You can activate the progress bar on your Nuxt.js application by adding the **loading** property of the **nuxt.config.js** inside the `export default { //code here }` with the corresponding properties.

To set a green progress bar with a height of 5px, add the following code inside your project **nuxt.config.js** file.

```javascript
export default {
  loading: {
    color: 'green',
    height: '5px',
    throttle: 0
  }
}
```
You can customize many things, you can change color(color name/color hex code), height, duration, direction for **rtl** sites, keep animating progress bar when loading takes longer than duration.

```javascript
export default {
  loading: {
    color: 'green',
    height: '5px',
    duration: 1000,
    rtl: true,
    continuous: true
  }
}
```

## Disable the Progress Bar:
You can disable the progress bar globally or locally. If you want to disable the progress bar globally then add **loading: false** in your **nuxt.config.js** file:
```javascript
export default {
  loading: false
}
```

Your can also disable the progress bar for specific page.  Add **loading: false** in the specific page.
```javascript
<template>
  <h1>Contact Us Page</h1>
</template>

<script>
  export default {
    loading: false
  }
</script>
```

##Custom Loading Progress Bar:
You can also create your own custom loading progress bar. Inside the component directory create your custom component in **LoadingBar.vue**:
```javascript
<template>
  <div v-if="loading" class="loading-page">
    <p>Loading...</p>
  </div>
</template>

<script>
  export default {
    data: () => ({
      loading: false
    }),
    methods: {
      start() {
        this.loading = true
      },
      finish() {
        this.loading = false
      }
    }
  }
</script>

<style scoped>
  .loading-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding-top: 200px;
    font-size: 30px;
    font-family: sans-serif;
  }
</style>
```

Then go to **nuxt.config.js** file and add your custom loading component to the **loading** property.
```javascript
export default {
  loading: '~/components/LoadingBar.vue'
}
```
It’s very simple, right? Now you can see your own custom loading bar between routes changing.

##Useful Links:
* Nuxt [Loading Docs.](https://nuxtjs.org/docs/2.x/features/loading)
* Custom loading component [example.](https://nuxtjs.org/examples/custom-loading-component)
tmux terminal multiplexer
Tags: linux, tmux
Published: 2021-05-31 09:31:24

tmux is a terminal multiplexer: it enables a number of [terminals](https://bsdnerds.org/what-is-linux-shell/) (or windows), each running a separate program, to be created, accessed, and controlled from a single screen. 

tmux may be detached from a screen and continue running in the background, then later reattached. 

It allows you to easily manage separate terminal sessions inside a single terminal window. 

tmux can connect to a server, and multiple clients can be connected to the same session, simultaneously exchanging their input and display.

![tmux](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b70cabwx2eg4a1mv791g.png)

## Commands?

You can use these commands and shortcuts to work with tmux in Linux. From the command line:

Session Control | |
---|---
tmux 	| Start a new session |
tmux new -s <session-name> |	Start a new session with the name chosen |
tmux ls |	List all sessions |

Pane Control | |
---|---|
Ctrl b, " |	Split pane horizontally
Ctrl b, % |	Split pane vertically
Ctrl b, o |     Next pane 

## Why tmux?

I've used tmux for years, and it has become an essential part of my work flow. I couldn't imagine editing code without it. If you want to practice Linux commands, you can use [these exercises](https://www.practicelinux.com/) 

tmux is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen.

Features include:

• Splitting a terminal window into horizontal or vertical panes.
• The ability for windows to be re-ordered by the user, and to be assigned names.
• Executing shell commands in any pane, and running custom commands in response to window changes.
• Detaching and reattaching a session (allowing the user to leave terminals behind, and then return to them).
• A powerful configuration language.

![and so you code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mnf6pmatohkliik0fosl.gif)

tmux is very useful for people who commonly work on remote machines via ssh.

Why did I pick tmux over screen and a terminal multiplexer? Three reasons.

* First, tmux is written is responsive and light.
* Second, tmux is much more expressive than screen. I can split my terminal into six panes and change the size of each pane with the same ease as resizing a terminal in GNU Screen.
* Third, tmux has integrated support for a status bar. This means I can read from one pane and keep an eye on other panes at the same time.
A day in a life of a software engineer 
Published: 2021-05-31 09:28:05

A day in a life of a Software engineer!

⌛️10% actually coding
⌛️10% meetings
⌛️20% googling errors
⌛️40% copying code from stack overflow and spending hours in debugging to make it work.
⌛️10% coffee breaks
⌛️10% wondering, if I'm the right person for this job

#engineer #coding #debugging #c #developerlife #devcommunity
Where am I Wrong?
Published: 2021-05-31 09:17:39

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=de
  vice-width, initial-scale=1.0">
  <style>
      .container{
          margin-left: 20rem;
          margin-top: 15rem;
          margin-right: 20rem;
          padding: 3rem;
          border: 2px solid red;
          text-align: center;
      }
  </style>
    <title>Practice</title>
</head>

<body>
   <div class="container">
       <h3>&#128540 Write a number to display that number &#128540;</h3>
    <input type="text" name="num" id="num1"><br><br>
    <button onclick="show()">Click Here!</button>    <p>The number is <span class="no"></span></p>

   </div>
    <script>
        function show() {
            var i = parseInt(document.getElementById("num1").value)
            document.getElementsByClassName(
                "no").innerHTML = i;
    </script>

</body>


</html>
Saving 200+ Man-Hours With An Automated Reimbursement System
Published: 2021-05-31 09:14:17

If you’ve been in the technology industry for the past year, you must have heard buzzwords like low code or no code in the community, then you and I are on the same page. Forbes has called No code/Low code the most disruptive trend in 2021 because it has changed the way organizations function. By 2024, 75% of large enterprises will be using at least four low-code development tools for both IT application development and citizen development initiatives.

Read the full article at https://yaya28.medium.com/saving-200-man-hours-with-an-automated-reimbursement-system-a0e5bb8866a9
Empty Pseudo Class
Published: 2021-05-31 08:59:28

There are so many Pseudo Class and ":empty" is one of them.Let's break dowth is pseudo class. 

Empty pseudo class is applied on empty element.At First we need to learn what are empty elements. There are certain requiements to become an empty element. 
Some examples of empty elements are.
```
<div></div> 
<div><!--This is a comment --></div>
```
Even a space inside an element cause the element to be non empty 
 element.Even if we add one letter or one sentence it becomes a non empty element such as:
```
 <div>P</div> 
 <div>Lorem ipsum dolor sit amet.</div>
 <div> </div>
```

If we want to target those empty element,  we can use empty pseudo class.Let's target all empty elements in CSS:
```
:empty {
   //Your code here
}
```
If you want to target specific empty element such as empty table cell use this
```
td:empty {
    background: red;
}
```
I hope you get it How to use empty pseudo class